Tile Smasher Game Using Classes

Luke Siegert
2 min readMar 9, 2021

For this project I recreated the classic arcade game “Brick Breaker”. The 3 classes inside my code are the paddle, brick and ball classes. The beginning of my code consists of the declaration of variables which include these 3 classes and then the player score and game state to keep track of the game and change its state when all the tiles are gone or the ball flies past the paddle and out of the constraint. The paddle classes uses the constructor function with “this” statements to give it its constant variables of size and color and then includes if and else statements to declare its speed and direction once certain keys are pressed. The ball class includes its horizontal and vertical speed, color, direction and the collision relationship with the paddle in the function “bouncePaddle()” where a series of this statements allow its direction to be reversed upon contact of the paddle. The brick class dictates the points each brick will count for and the collision relationship with the ball where they will disappear after being in contact with it.

Classic Brick Breaker Arcade monitor
Newer online version of brick breaker

https://www.youtube.com/watch?v=3GLirU3SkDM&t=6688s

This is the youtube video I used as reference. I wrote the different pages of code that they had all into one and first made it fit and function together on a singular JS script and then altered different things to make the speed, size, and colors of the objects different, while also changing the game states.

--

--