A downloadable game for Windows

This is the SDL2 version of a game I previously made in pygame. I chose to remake the game simply as a way to practice my C++ programming skills. There is currently only one game mode (resembling the python version's endless mode) where you start with three shots, but coins give back extra shots depending on their size.

Download

Download
CannonGame.zip 8 MB

Install instructions

To run the game simply:

  1. Download the zip file
  2. Extract it into a new folder
  3. Run cannon.exe

Comments

Log in with itch.io to leave a comment.

Yoo! the ball bounce is epic. Do you have the source code for this? I really want to see the physics..

(1 edit)

Source code is here: https://github.com/ALaevens/Cannon-Game-SDL2
The relevant code is the collideGround function in src/scenes/CannonScene.cpp and the Kinematics component in include/Components/CKinematics.hpp.

In short, the kinematics component keeps track of a vector velocity and acceleration and uses it to update the position every frame. On collision with the ground, the ball is slowed down a bit horizontally and I flip the vertical velocity (also reduced by a little bit) to give the bounce effect. I had plans of implementing collision between the balls but never got around to it.

Thanks so much!