Midterm Project

Concept:

My midterm project sheds light on the issue of space debris and how there is a lot of space junk resulting from the satellites and other objects in space that are no longer functioning. It is a very important issue as we need to take care of outer space and keep it sustainable as we are using it for so many different aspects such as GPS, weather forecasting, and other important technologies.

How to play:

To play this game, you can control the spaceship with your head movement to shift it either up or down and catch as many space debris as possible. Make sure not to hit any dwarf planets coming your way.

https://editor.p5js.org/alreem/full/aXQa2BjsH

Challenges & solutions:

My biggest struggle for this was having to mirror the createCapture, which eventually worked but I ended up removing it as it affected other parts of the code and would lag very much if it is played as multiplayer. I fixed this problem by removing the control of the x-axis (right or left movement) and keeping the direction moving up and down only. Even if I removed that aspect, it still seems as if the user is moving sideways due to the moving background.

for(let i=0; i<people.length; i++){
    let pose = people[i].pose;
    
    let nose = pose.nose;
  
    image (imgss, width/2,nose.y, 30, 30); 
    
    
    if(debris.contains(nose.x, nose.y)) {
      debris.pop();
      score++; }
    if(planet.contains(nose.x, nose.y)) {
      gameState = 'end';
    }
  }

Overall logic:

For the game itself, I mainly used OOP to control the planet and the debris. The parameters included the size, speed, x and y position, collision detection, and moving the object. For the poseNet, I used it to detect the person’s nose and move the spaceship accordingly.

Improvements:

For future improvements, I would want to let the user move in all four directions and have it as a multiplayer game where more people can join. I would also want the game to keep moving faster as time goes by.

References:

Music: https://www.youtube.com/watch?v=AzL10r8AeQ8

Photos: Google search

Intro page & Instructions:

Dwarf planet (what you have to avoid):

Space debris (what you have to collect):

Final Page (where your score is shown):

Aerial view of Earth surrounded by space junk from space ships and satellites; 3D; 3D Illustration

Code help: mainly from https://p5js.org/reference/

Leave a Reply