C++ Game
ROLE
Solo
GIT REPO
DESCRIPTION
C++ project is a fun tech demo made from scratch in C++. I wrote in depth documentation about the physics engine here. In this tech demo you can complete 2 level by swinging around on your grappling hook. To get up to high areas you need to use your momentum to build up speed.
TIP: Hover over images to play videos
Project Length
6 Weeks
GENRE
2D Platformer
PLATFORM
PC


HOW THE SWINGING WORKS
Swinging Overview
When the player clicks a raycast it's sent outward in that direction and if its a swingable object, the start of an array of springs connected by boxes is connected to the player, and the end is connect to the swingable object. When the player lets go of the mouse button, the springs connecting the boxes are deleted, and the boxs turn into triggers so they can fall, and not get in the way of the player. The grappling hook works for both static, and kinematic physics objects. While on the grappling hook, the player can swing left and right. Swinging left and right adds only forces to the left and right, the springs do the rest to lift the player up, depending on where it is on the arc.
Improvements
Sometimes the springs are very reactive when spawning, other time not so much. This is because the amount of springs created, and their spring force is made from the distance away from each other. So if they are all 1 unit long, at 1 unit apart, spawning a grappling hook at 5 units away will spawn 3 springs (includes the player and the swingable object). If however the player is 5.5 units away, 3 springs will still spawn, but they will be a further distance away because its not quite far enough to spawn another spring, making the spring force higher. Reverse effect if they were 4.5 units apart. To fix this, I could make the distance that the springs rest distance to be their starting distance, and slowly lower/raise it over time to the distance that they should be (1 unit)
