Space Invaders is the final Project for the course, How to Design Programs on EDX that is based on the book: How to design programs
Space Invaders game has the following behaviour:
-
The tank should move right and left at the bottom of the screen when you press the arrow keys. If you press the left arrow key, it will continue to move left at a constant speed until you press the right arrow key.
-
The tank should fire missiles straight up from its current position when you press the space bar.
-
The invaders should appear randomly along the top of the screen and move at a 45 degree angle. When they hit a wall they will bounce off and continue at a 45 degree angle in the other direction.
-
When an invader reaches the bottom of the screen, the game is over.
video: Short video game Example
The program is written in Racket programmig language and needs DR Racket IDE to run on it. you can download it from here: Dr Racket
Run code, then initialize the game with:
(main G0)
This is the main parts of the program