Please find attached pygame code for running a game I created called "Alien Attack." The game is quite similar in nature to "Space Invaders."
The purpose of creating this code is to try and train a Neural Network to play the game and get a
higher score than the 5 random scores I got when playing the game.
For anyone interested please feel free to take my code and create your own game. The code is quite heavily commented but I am happy to answer any questions you may have. Please note it would not have been possible to create the game without the following excellent website - http://programarcadegames.com/index.php?lang=en.
Save the code and each of the attached files to the same location on your drive, import the required packages and run the code. If this does not work please let me know.
Mouse - Shoot
Left arrow - move left
Right arrow - move right
Up arrow - move up
Down arrow - move down
The aim of the game is to maximise your score within the 3 minute time-limit (or until your life/health decreases to zero). You score points by shooting the aliens.
There are 3 types of aliens:
Blue aliens
These move down the screen at a regular speed. You get 100 points for each alien you hit.
Green aliens
These move horizontally across the screen very quickly. You get 300 points for each green alien you hit.
Pink aliens
These move down the screen twice as fast as the blue alien. You get 500 points for each pink alien you hit.
Your health is 100 at the start of the game. Each time you collide with an alien your health/life decreases by 10. When your life falls to zero the game is over.