Second Project: Artillery Game in C++ with SDL
- Benny Sing
- Dec 27, 2015
- 1 min read
My second project was to create either an Artillery game similar to Angry birds or a Trigonometry calculator. We weren't taught anything about SDL and was encouraged to do some self learning. With that said, I was able to learn SDL and partner that with my basic knowledge of C++ I was able to create this game.
Gameplay Video:
No classes

At this point in time, I had no idea what classes were and so creating this game without any classes proved to be rather challenging.
However, with the help of lazyfoo's step by step tutorial I was able to understand SDL better. Granted he used plenty of classes for his examples but I was able to break his code down for me to work around that.
Trajectory formula

Although only in the console window, it is able to provide the player with details on the current angle and velocity the cannon has been set to as well as whether or not the player has hit or missed.
But as can be seen in the video, the trajectory of the cannonball can be seen perfectly on the game screen. This was done by incorporating the mathematical formula of a projectile trajectory and just converting it into coding language.
Ideas for improvement
These would include:
Making use of SDL's truetype font to display on the actual game screen to better allow the player to know what's going on ( who's turn etc).
A score board and point system.
Updating the images used ( Terrain and cannons as well as background blending of the images used)
Terrain generation( Similar to terrains in WORMS for example).
Comments