C++ Endless Runner
Details
Project Type: Skills Development & Learning
Language/Software/Libraries: C++, Visual Studio Code, Raylib
Images
About
Towards the later stages of my University career, although my experience was very Design focused, my heart lay more in the Programming/Scripting side of things. Realising this, and looking at Gameplay Programmer jobs, I knew that I would need to relearn and develop my C++ skillset.
Project 2 in the C++ Fundamentals: Game Programming For Beginners course on GameDev.tv, Dapper-Dasher, gave me a strong start to create an Endless Runner (click here for Dapper Dasher repository) .
At the end of the tutorial project, all code for the Dapper Dasher game was contained within a single .cpp file, shown above. To improve upon this and start creating my own Endless Runner game, I split out the Parallax Backgrounds, Character, and Obstacles into their own classes:
Next, I had to turn the game into an Endless Runner, rather than simply a having a set number of obstacles and a finish line.
I first removed the finish line functionality, so that it would keep on running past the final obstacle and not end the game.
I then needed to make sure that obstacles would continue spawning. Initially I did literally spawn a new obstacle at each interval to get things working, but knowing this isn't the best way to do it I created an Object Pool instead. This had just 5 obstacles that would be moved back to their start position when needed again, and this process could repeat indefinitely.
Finally I made the game increase in difficulty as time went on by reducing the time between obstacles, and I added a simple score to the game.