STD is a version in the space of the famous game Tower Defense.
There is a grid in which you can put spaceships to defense your land. Waves of
asteroids come to attack you, so you need to install a big defense in order to
keep the game going.
Each spaceship automatically shots from the left to right, but in case a increasing number of asteroids are on the same line in front of the spaceships. The asteroids move ramdonly in the vertical axis but constantly in the horizontal axis.
There are three types of spaceships:
- SNOW : cheap white spaceship, fast moving and shooting, but very weak
- GRASS : green spaceship with a cost, speed, and frequency enhanced compared to white spaceship(SNOW)
- BLOOD: expensive red spaceship, very slow moving and shooting but very hard to destroy.
Each time a spaceship is hit by an asteroid, the spaceship loses a level and if it is a SNOW spaceship it gets destroided with the asteroid.
For example a BLOOD spaceship can degraded to a GRASS spaceship.
You can add only one spaceship per cell, if you can pay a well-known value with your score.
Asteroids can move only from right to left, and if they reach the left border
score is decreased according on a well-known value.
Pay attention, because if you
reach a negative score and you have not any other spaceships, you lose the
match. Otherwise, until you have some spaceships alive, you can keep going with
the game.
If you kill every asteroid in a wave, you can call a next wave.
Every wave has a bigger number of asteroids, so make sure you have a great defense!
- p: Game in pause
- h: Show help page
- a: Launch a new wave of asteroids
- q: Select spaceship SNOW
- w: Select spaceship GRASS
- e: Select spaceship BLOOD
- mouse left-key: put a ship inside a cell
A very basic GUI is used for the game, developed by Guillaume Perez. It is based on the GLUT library.
- Linux distribution
- GLUT is required for the GUI
# Installing GLUT via terminal
sudo apt-get install freeglut3-dev
The code has been tested under ubuntu 16.04 using qtcreator 4.2 and CMake 3.5.1. To access the program, clone the repository:
$ git clone https://github.com/MarcosBernal/DemoGameCpp
You can use either the CMakelist.txt or the Makefile to build the program. In case of using Makefile:
make
make run
Some configurations, like difficulty or number of lines can be changed in the main menu of the game. But others havo to be changed in the file Config.h. Remember to compile the whole program after changing any value in Config.h.
The project follows the following structure
STD EIT Edition
|
+-- include # Depends on libEngine.a (provided library)
| |
| +-- Engine.h
| +-- GraphicPrimitives.h
| +-- ...
| \-- <FileNameN>.txt
|
+-- libLinux # Depends on libEngine.a (provided library)
| |
| \-- libEngine.a
|
+-- src
| |
| +-- Config.h
| |
| +-- headers
| | |
| | +-- Asteroid.h
| | +-- Spaceship.h
| | +-- Shot.h
| | +-- spaceLogic.h
| | +-- BLine.h
| | +-- Game.h
| | +-- MyControlEngine.h
| | +-- MyGameEngine.h
| | +-- MyGraphicEngine.h
| | +-- Observer.h
| | \-- Wave.h
| |
| \-- sources
| +-- <HeaderFile1>.cpp
| +-- ...
| \-- <HeaderFileN>.cpp
|
+-- CMakeLists.txt
+-- Makefile
\-- README.md
- Added CMakeList.txt file. Now, it is possible working and test the code with any IDE instantly.
- Removed all warnings regarding -Weffc++. It should have improved the performance.
- Removed some warnings regarding -Wnon-virtual-dtor. When a class has virtual functions, its destructor should be also virtual. GLUT custom library has to be improved.
- Added Main menu to configure the game. From there can be selected the number of lines and the difficulty.
- Added suppport for increassing the difficulty(number of asteroids and their lives) and increase or decrease the number of lines.
- Added a timer to reduce the resources consumed and improved the game experience. Now the game speed can be followed.
- improve class relation:
- elements such as Waves, Ships or Shots should be only contained in Game.h removing dependencies with other classes
- agroup elements that share features in a general class
- maybe Observer and MyGameEngine should be joined into one class
- improve asteroids behavior and collision
- show the type of spaceship choosen
- improve difficulty by spamming more asteroids or reducind reward
libEngine.a his project., the GLUT based library used in this project for GUI, was written by Guillaume Perez.
The original author of the previous version of Spaceships Tower Defense, Lukesmolo, which code can be accessed by this link.
STD is released under the GPLv2 license.