- This is our own version of the popular game asteroids. Press left, right, up, and down arrows to avoid falling asteroids in order to get the highest score. If you collide with an asteroid your game will end.
- Shooting: Press space bar to shoot at the asteoirds, one bullet will kill them, but you cannot spam the shooting in order to make it harder.
- Press
Enter
then enter your name and then pressEnter
again. Then pressesc
to leave the game.
- Ship is created in our
drawPlayer()
function Keyboard()
andspecialKeys()
functions are used to process user inputs from the keyboarddrawAsteroids()
anddrawasteroidcircle()
is where we draw the asteroids that fall from the sky- There are a few other smaller functions which are self names and should be easy to understand
- For linux machines like used in CSIL:
g++ main.cpp lib/player.cpp lib/game.cpp lib/asteroid.cpp -std=c++17 -lGL -lglut
- That should create an a.out executable which you can run by typing
./a.out
- To run the game again, simply re-enter
./a.out
All source code is in the src/
directory, which contains:
- main.cpp
- lib/
- highscore.txt
- asteroids.h
- asteroids.cpp
- game.h
- game.cpp
- asteroid.cpp
- asteroid.h