# Introduction

Mario is on an adventure to find his beloved peach, but there is a wall of bricks in his way! He must use his launch pad to bounce back and forth to eventually clear all the blocks! Watch out though, if he misses his launch pad three times he must start all over again!

# Controls

• A to move left, D to move right
• W to toggle to the next level, S to toggle to the previous level
• Spacebar to start the game/launch mario from the pad

# Features

• Audio
• Collision Detection
• Texture Mapping
• Particle Effects
• Juicy Effects

# AABB Collision Detection

Collision Detection was done by axis-aligned bounding box's which is a rectangular collision shape aligned to the base axes of the scene, which in 2D aligns to the x and y axis. Being axis-aligned means the rectangular box is not rotated and its edges are parallel to the base axes of the scene. To check for a collision we check if the horizontal edges overlap and if the vertical edges overlap of both objects. If both the horizontal and vertical edges overlap we have a collision.

## Collsions with the Ball/Mario

Detecting collisions between a circle and a rectangle is slightly more complicated, but the trick is as follows: we find the point on the AABB that is closest to the circle and if the distance from the circle to this point is less than its radius, we have a collision.

# Particle Effects

A single particle has a life variable that slowly decays once it is spawned, a color variable, and a velocity variable. Once its life is less than 0 kill the particle so it can be replaced with a new particle object when the next particle spawns. A particle emitter controls all its spawned particles and changes the behavior based on their attributes. The particle generator spawns each particle at the balls position, gives it a velocity equal to a fracton of the ball and changes the color of the particle based on how long it lived.

# Texture Mapping

I used the SOIL library and a resource manager to map textures onto fixed sized dimensions. The SOIL texture mapping was used for the backgrounds, bricks (solid and non_solid), the paddle, ball, and powerups.

# Juicy Effects

• Audio
• I used the irrKlang library to add a sound manager to my project. Through the sound manager I could add audio effects to different portions of the game.

• Power Ups
• I have 5 different power ups: speed, slow, sticky, increase, and pass through. The first two either speed up (Lightning) or slow down (Snowflake) the ball velocity. Sticky (Cherries) will make the ball stick to the player paddle until the player hits the spacebar to relaunch the ball. Increase (Mushroom) will increase the size of the play paddle making it easier to hit the ball. Pass through (Star) will allow the ball to pass through as many non-solid breaks until it reaches an edge of the screen.

• Levels
• Level's are stored in a matrix-like structure where each number represents a type of brick, each one separated by a space. A number of 0: no brick, an empty space within the level. A number of 1: a solid brick, a brick that cannot be destroyed. A number higher than 1: a destroyable brick. These numbers correlate to a brick game object and by using this approach levels can quickly be created.

# Obstacles

I tried to add render text to my game through the use of the Freetype library. Although, after hours of adding linker libraries and crashing my program I never was able to get it implemented into the final game. I then tried to use GLUT's glutBitmapString function, but was unable to draw the text over my level background.