Mario GIF

Overview

During my second semester at Staffordshire University I was tasked with creating a replica of the Mario Bros Arcade Game from scratch in C++ and SDL, this included creating a game loop, creating a control scheme to allow two players to play at the same time, animations, creating full collisions using both bounding box and bounding circle and also limit the players to the game screen, audio, and enemies that are effected by the POW block.

Creating Mario from Scratch was a difficult and rewarding experience that improved my abilities and pushed me further such as learning and implementing singleton classes, creating a character class that is inherited from enemies and players using polymorphism to change them.

Luigi Jumping

Getting Started

Once SDL was integrated and a window was created The first this I did was create objects for Mario and Luigi and render them to the window, I learnt how to take a sprite and render that to the screen using a texture class that can be called for any object that will have a texture in the game. Once the Mario bros were added gravity and movement came next, implementing my gravity opened the consideration of how fast Mario expected to fall and after some testing, I found a speed I felt happy with.

Mario Pow Block

POW

Creating the POW block added an interesting challenge, when Either of the Mario Bros collided with the bottom of the block how to get all enemies on the screen to flip over? To accomplish this I added a variable that only members or children of the enemies class had access to called m_injured, once the pow block was hit all enemies in the enemy array became injured and flipped over, after a set amount of time elapsed then they would flip back over.

Mario GIF

Boundries

Once the enemies were created and added to an array, they would then be updated and drawn to the screen. however getting the enemies to stick in the bounds of the screens provided an error in logic, to keep the enemies on the screen bounds were set and would stop the enemies from going any further and turn them around, uncountably this caused the enemies to spin infinitely on the border of the level. to stop this a simple compounded if statement was added to check the direction they were travelling and flipping them once..

Mario Death Animation

Death Animation

Mario's Death animation was a tricky one to get correct, first, he would just disappear then he would just fall through the floor without the signature up motion first, but with trial and error, I managed to get it looking as I wanted.