top of page

Games

Planet Petrol

Planet Petrol.JPG

For my creative programming class, we were tasked with creating a browser-type game using JavaScript in p5.js. I decided to make a game where an astronaut is stranded on an alien planet due to low rocket fuel and now has to collect a specific amount in order to escape while avoiding getting captured by the aliens. The core concept when making my game was that the player would have to collect a certain amount of objects without getting hit once to win the game. Originally I intended to have a maze aspect incorporated but coding the collision and random spawn points that did not interfere with the maze proved to be very difficult so I settled for an open arena. Some assets, like the rocket ship and grass, were clipart from Google images while the astronauts and aliens were designed and made in Adobe Illustrator. 

Planet Petrol, JavaScript, Browser Game

Dec 2023

Planet Petrol Game.png

This is what the gameplay looks like, each time a blue fuel cell is collected another alien will spawn. At the title screen the player can choose the goal amount of fuel cells as well as the max speed of the aliens. The max speed is random for each spawned alien so if Speed 5 is selected on the start screen one alien could have a speed of 2 while another a speed of 5. This made the game more replayable because at times there were several fast aliens or there were only a few fast ones to worry about, making the player more attentive when there was many low speed aliens so that they could potentially beat the 50 fuel cell cap.

Planet Petrol Code - Copy.png

In total I wrote 655 lines of code with help from my professor and classmates. This is a screenshot of the first couple of lines which is just defining the variables and bringing in the graphics.

Collison code.png

These lines of code control how fuel cells and enemy's spawn. Initially I had an issue with spawning the first enemy alien because they would only spawn if the player gathered a fuel cell so I had to make the first enemy its own separate variable 

Capture.JPG

This is a drawing of what I originally conceptualized at the beginning stages of our game's design. As I have said before I originally wanted to have some sort of maze aspect but it was becoming to much of a headache when trying to spawn new fuel cells and enemies.

bottom of page