Author Topic: [Lua] Space Invaders  (Read 28729 times)

0 Members and 1 Guest are viewing this topic.

Ashbad

  • Guest
Re: [Lua] Space Invaders
« Reply #15 on: June 03, 2011, 04:42:25 pm »
That means TI put an old version of Lua on the Nspire.  I say the first thing they need to improve is the version number.

Well, 80% of the speed optimizations were actually with the merged tables, so that should still increase the speed significantly :)

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [Lua] Space Invaders
« Reply #16 on: June 03, 2011, 04:58:37 pm »
If it could help you to understand :

I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: [Lua] Space Invaders
« Reply #17 on: June 03, 2011, 04:59:16 pm »
that looks evil Levak
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Ashbad

  • Guest
Re: [Lua] Space Invaders
« Reply #18 on: June 03, 2011, 05:00:04 pm »
Hmm, it actually seems as though they DO have 5.1.4 on it O.o  No idea why the += operators aren't working then.  I explicitly remember being able to use them when I used Lua a few years ago, and I've seen code examples with double ops in them.

Offline BrownyTCat

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 420
  • Rating: +37/-8
    • View Profile
Re: [Lua] Space Invaders
« Reply #19 on: June 03, 2011, 05:02:30 pm »
Ooooh, I like this. Perhaps try exchanging the geometric drawing for original sprites.

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: [Lua] Space Invaders
« Reply #20 on: June 03, 2011, 05:08:53 pm »
Hmm, it actually seems as though they DO have 5.1.4 on it O.o  No idea why the += operators aren't working then.  I explicitly remember being able to use them when I used Lua a few years ago, and I've seen code examples with double ops in them.

Well, in the official Manual, " += " appears only one time, in the C integration part :
http://www.lua.org/manual/5.1/manual.html#lua_CFunction
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Ashbad

  • Guest
Re: [Lua] Space Invaders
« Reply #21 on: June 03, 2011, 05:10:27 pm »
Hmm, it actually seems as though they DO have 5.1.4 on it O.o  No idea why the += operators aren't working then.  I explicitly remember being able to use them when I used Lua a few years ago, and I've seen code examples with double ops in them.

Well, in the official Manual, " += " appears only one time, in the C integration part :
http://www.lua.org/manual/5.1/manual.html#lua_CFunction

Hmm, I guess I just remember that from when I embedded Lua into a C program a few times.  False alarm then.  In that case, Lua itself needs to improve.

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: [Lua] Space Invaders
« Reply #22 on: June 04, 2011, 03:21:17 am »
Thanks for your helping, Ashbad.  :)

For the '+=' operators, I was thinking that I've already tried it.
But I don't really understand the :
Code: [Select]
for i=1,21,2 do
aliensXY[i]=(math.ceil(i/2)-1)%7*31+1
aliensXY[i+1]=math.floor((math.ceil(i+1/2)-1)/7)*25+10
shotsXY[i]=aliensX[i]
shotsXY[i+1]=200
end
Wasn't it supposed to be :
Code: [Select]
for i=1,21,2 do
aliensXY[i]=(math.ceil(i/2)-1)%7*31+1
aliensXY[i+21]=math.floor((math.ceil(i+1/2)-1)/7)*25+10javascript:void(0);
shotsXY[i]=aliensXY[i]
shotsXY[i+21]=200
end
And all your "aliensXY[i+1]" shouldn't be changed in "aliensXY[i+21]" ? Because there are 21 aliens, and the table should content first their X position, and after their Y pos.

Quote from: Ashbad
- using numbers for directions rather than strings.
Is it really faster ? I think that it will not really increase the speed...

PS:Well, it is 9:20 in France, but in USA, it may be very early... I will not get any answers until a few hours, I think   :D

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: [Lua] Space Invaders
« Reply #23 on: June 04, 2011, 08:19:12 am »
Strings take more memory so yeah ti would probably be faster to use numbers
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: [Lua] Space Invaders
« Reply #24 on: June 04, 2011, 11:42:26 am »
PS:Well, it is 9:20 in France, but in USA, it may be very early... I will not get any answers until a few hours, I think   :D
Yup, France is about 6-9 hours ahead of the US, so a lot of activity will happen at night in the US, when you're sleeping,and some of your activity will happen when most people in the US are sleeping.  That being said, we do have a few other members from Europe. :)
Welcome to Omnimaga, Chockosta.  This project looks great. :D

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: [Lua] Space Invaders
« Reply #25 on: June 04, 2011, 11:57:18 am »
Some people like me though will commonly stay up all night here in the US and be on
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: [Lua] Space Invaders
« Reply #26 on: June 04, 2011, 02:10:23 pm »
I updated the first post with a playable version, screenies, and a link to the .tns (unfortunately the website where I uploaded it has a lot of ads)
This may be the final version, because the game is finished and the gameplay seems good for me.
Some optimizations still can be done, but the speed is fast enough. (If you think that it's too slow, try to reach 100 points ;) )

EDIT : I just saw we could attach files ;D No more ads, now.
« Last Edit: June 04, 2011, 02:21:19 pm by Chockosta »

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: [Lua] Space Invaders
« Reply #27 on: June 04, 2011, 02:35:37 pm »
Yay it works. now need to get the emulator set up so i can play it
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: [Lua] Space Invaders
« Reply #28 on: June 04, 2011, 03:23:17 pm »
Good job! Congratulations!

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: [Lua] Space Invaders
« Reply #29 on: June 04, 2011, 03:35:20 pm »
If it could help you to understand :


Wait... you can read that thing?

Great! Can't wait to play the game.

P.S.- I lost the game.