A simple asteroids-like game in Python using pygame.
This program depends on the pygame library. You can install pygame using pip like so:
pip install pygame
Once pygame is installed you can run the game like so:
python asteroids.py
Press the return (aka enter) key to start the game.
Use the arrow keys to fly the ship around.
Left and right arrows rotate the ship.
The up key accelerates the ship. To decelerate you should rotate and accelerate in the opposite direction.
The space bar fires bullets. You have an infinite supply of bullets, so use unwisely. If a bullet hits a large rock it will shatter into a number of smaller rocks which fly off in random directions. Small rocks that are hit by bullets will disappear.
If your ship crashes into a rock the game will end. You can start again by hitting the return (aka enter) key.
The escape button will quit the game.