# Progress Check (90%): Final Project: Hopping Ginger Bread Man

Disclaimer: the title is a little deceiving – I’m not 90% done (more like 60%) yet, but I’ll hopefully get there by the end of this week!

My initial outline of completing this project was finishing the physical constructing part (the Arduino) and then moving onto the coding (p5.js), but I ended up jumping between both of them instead.

Since my first very rough brainstorm post about my gingerbread man game, I’ve made a lot of adjustments, additions, and progress in general. In this post, I will report my progress by dividing it into two: the p5.js part and the Arduino part.

P5.js:

The game (only the coding part) that I have so far can be shown here.

I’d say my code highlights are adding animation/movement to the chimneys, which can be shown below:

```class Chimney1 {
constructor(){
this.r = 120;
this.x = width;
this.y = height - this.r;
}

move(){
this.x -= 3;
}

show(){
image(chimney1Img, this.x, this.y, this.r, this.r);
}
}```

…and also constructing the collision between the gingerbread man and the chimneys, as shown below:

```hits(chimneys) {
return collideRectRect(this.x, this.y, this.r, this.r, chimneys.x+20, chimneys.y, chimneys.r, chimneys.r);
}```

These were some of the struggles I’ve faced with p5.js:

• Adjusting the “collideRectRect()” function – it was hard to get the perfect measurement of both the chimneys and the gingerbread man’s image boundaries and set it so that the unnecessary empty spaces that surrounds the actual illustrations acted as the “collision points,” thus making it hard for the user to aim the gingerbread man’s jumping.
• Constantly shifting + playing around with the “jump” function of the gingerbread man, as well as gravity.

Arduino:

Here are some sources that I’ve used to aid my process of making a physical game controller with Arduino:

Work I still have left to do:

Although I’m mostly done with the coding part, these questions still remain in my mind:

• connecting arduino + p5js?
• how to minimize the distance between gingerbread man and the chimneys before making it count as a “fail?”

…and here’s the list of things that I still need to do:

• reset + start game
• Arduino connection
• building a physical game controller using Arduino

Sources used: