Arrow keys to move.
Nice.
I would suggest some things:
- xspeed/yspeed in _init() is inside the for-loop
- You could color the stars depending on starspeed - so stars far arway are darker
- you can use a "setstar(x,y)"-function which set the x,y and the random speed - this should save some tokens. And you can set here a star-color depending on the speed.
@GPI Thank you! I didn't catch the thing about x/yspeed. I did think about coloring it different as well as making other shapes, but I liked the look of the white against the black. I know I could have done it more efficiently, if I did it again I probably would have used tables within tables.
There are actually several shades you could use, @kellercode ... You might be able to slip some distance colors in there too.
Let me see, like this:
Sure thing, @kellercode.
You can also do shades of B&W if you like.
Now you just need to wrap a great little shooter or space tactical game around this.
You are very welcome, @kellercode. We can all learn from each other in here. :)
I played a little with the source code :)
some suggestions:
- tables start with 1, not 0 - your code works, but keep it in mind. when you do something like this:
a={} a[0]=1 ? #a |
will return zero for empty table!
-
count(table) can be shorten to #table
- only a personal thing, you declare/define global variables in _init() - I personal would do this outside every function. So when you read the code you can easier recognize global variables.
And maybe this playlist is something for you:
https://www.youtube.com/watch?v=81WM_cjp9fo&list=PLea8cjCua_P3Sfq4XJqNVbd1vsWnh7LZd
[Please log in to post a comment]