Pcomp - Project 2 Gold Miner

Code: from Arduino to P5.js

Evolving from the original basic cat-eat flower game manipulated by the keyboard using “up/down/right/left“ (provided by Yvonne), I was able to change it into a gold miner game and adding with more features, like obstacles also the beginning and ending screens, and control by the distance of two ultrasonic sensors, one controls up and down movement and the other controls left and right movements, and a restart button.

During the process, I had some major problems when transplanting a game that originally used the keyboard to control into something controlled by the incoming serial readings from Arduino. Since the original game was having a preset canvas size and a grid system, it took me a while to change the original coding structure to a game that could open as windowWidth and windowHeight. Below are some process images.

Special thanks to Yan.S, Cheer, and Tree for helping me with the code!

Sensor: testing sensors

I spend most of my time last week testing different sensors (some videos were in my blog last week). Instead of traditional controlling, I was thinking of using the reading of different kinds of sensors to control the x and y coordination of the player. Begin my testing using two potentiometers and then I was considering using distance sensors. After trying the time-of-flight sensor(because I failed to connect two tof sensors together) and the ultrasonic sensors, I decided to use the ultrasonic sensors.

But the readings of the ultrasonic sensor were not very stable since it always detects whatever the object closest to it. The raw reading came out from 0 to 2500+, so I put a threshold to 65 for a more accurate reading. (sometimes the reading still jumps up and down drastically, but much better!)

Fabrication of the cover

I imagined that the game could be played by two players one controlling the up and down movement and one controlling the left and right movement, or it could be played by one player with two hands on two sides of the ‘game box’. So I decided to create a box that has two ultrasonic sensors placed on the opposite sides (this also prevents the body of the player mess up the reading of the ultrasonic sensor) and have the Arduino boards hiding inside the ‘game box’. The entire color palette was using pink, green, and orange from the beginning and ending screen of the game. My groupmate Yvonne did the illustrator drawing for the box and I laser cut out the paper box and colored it.

Play Test/ User Testing

And here is the final product!

Previous
Previous

Project 3 - Notification Toaster

Next
Next

Pcomp - week 8 & Project 2 progress