Asteroids.lua
From codeTank
Asteroids.lua is a game that is included with Brain Damage 1.1.1.
Download it here: http://codetank.com/damage/1.1.1/Asteroids.lua
(Latest Update to Source Code: 26 Dec 2007)
Controls
- Up, Down, Left, Right - Control your ship
- Space bar - Shoot
Goal
Your goal is to shoot all the asteroids! They will keep splitting and multiplying until you shoot the really small ones.
Homework
Try messing around with things, and read the comments. Check out the first table, config, at the top of the program. Edit the values inside the table, and see what happens.
There is some bad design... if a user is shooting a lot, but dies and gets a game over, then they might accidentally miss their score by hitting "space bar" on the alert that displays the final tally - and make the window exit immediately! This might frustrate the users... perhaps you can find a solution to ensure that tap-happy players won't miss their score at the end?
For a real challenge, try to edit the script to make an on-screen display of score and lives left (instead of displaying the stats in the window title, which is bad practice). You'll probably want to use paint.print inside of the onpaint function to do this.

