Skip to content
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Asteroids [p5.js]

Start Screen


Used the p5.js library to develop and design a clone of the classic Asteroids game. I added in power-ups which allow the player to slow down time, get better weapons, become invincible, and explode all of the rocks on the screen at once. The particles that explode from the rocks are repelled by the ship, creating interesting patterns when the ship flies through them. The game is arcade style and never ending.

game-play 1

Motivation and Challenges

If you were to look at the previous video game I made, you would notice it was written with functional code, however did not follow the four core principals of Object Oriented Programming. I paid special attention to these four core principals in this game to demonstrate my knowledge of Inheritence, Abstraction, Polymorphism and Encapsulation. Some of the challenges I faced and overcame when developing this game was how to make the alien ship aim and shoot at the player's ship and how to manipulate the angles on the weapon upgrade that makes your lasers fan out. Furthermore, I also used a recursive algorithim to define the starting positions of the asteroids at the start of every level, ensuring that the rocks will not spawn on top of the player, thus giving the player's ship ample time to move around and get situated.

game-play 1


I also composed the background music for the game, which was just an additional fun experience when building the game. You can listen to it (and the rest of the album) here:

You can’t perform that action at this time.