top of page
Blog: Blog2
Search

Bear Hop Game

  • Writer: anmonaco
    anmonaco
  • Apr 29, 2019
  • 1 min read

For my AP project I created a game that involved a jumping bear. To create this game I used two main functions, one for the bear and one for the obstacles. I hand drew the bear using shapes and colors, as well as the obstacles. I used simple physics concepts of gravity and drag force to create a nice, smooth jump for the bear. Then I used a lot of random variation to generate the obstacles. I used the modulus and millis function to make the game increase in difficulty as it goes on. I created a score counter, and even found confetti to make the game look more fun.

My greatest challenge was to get the collisions work. I had to specifically define the area of the bear and the obstacles to get the code to stop when it overlapped. I wrote this code and used trial and error and testing to solve this issue:

this.collide = function(glaciers) {

if (penguin.y > this.y1 && penguin.y < this.y3) {

if (penguin.x < this.x1 && penguin.x > this.x3)

return true;

}

return false;

}




 
 
 

Comments


©2018 by Anna Monaco. Proudly created with Wix.com

  • facebook
  • twitter
  • linkedin
bottom of page