The core functionality of this project was to create the final version for my final project. Since I really enjoyed creating a game for MP3, I chose to create a new game: Boba Run (similar to Cookie Run and Google's dino run game pictured below). Play Boba Run here!
The code can be found in this github repository called "boba-run". The repo can be cloned to your own device -- note, you will need to install libraries, run a local development server, bundle the code, and deploy the app on your own device.
1. Create New Repo.
To start, I created a new public Github
repository called "boba-run" to host the project.
Then, I cloned the new repo to my computer using my terminal.
2. Copy over code from FP1.
Once my new "boba-run" repository was cloned to my computer, I copied over all my code from my FP1 prototype (from
cookie-run-prototype repo) into my new repo.
3. Edit Game Sketch in p5 Web Editor.
I then went back to the p5 Web Editor to make edits to my game based on feedback from the class demo.
Here are some of the implementations I made to add to my prototype version:
4. Build and Deploy Game.
Once I was happy with how my game looked and worked, I moved my code over to my repo folder and built and deployed my site using the dev toolchain.
One issue that I ran into was that I wanted animate my game sprites as they were showing only as static images in the game. I had set the sprite image to a url path to a gif image file. In the p5 web editor, they were animated, but once my game was deployed, the sprites were static.
By doing a search online, I found a github issues page that explained why gifs do not show as animated.
This has something to do with the frame rate that the canvas is drawn, which makes animated gif files
only display as static images that do not move.
A workaround around this issue was to use the
sprite animation function, specifically the
Sprite Sheets with Multiple Animations page. I took each frame from my gif file and positioned them
next to each other in a single image to create a sprite sheet (pictured). I then uploaded the sprite sheet into the web
editor to see the animation changes in real time. Once loaded, I used the addAnis function to encode
animation names as keys and sprite sheet atlases as values.
At first, I had a bit of difficulty getting the proportions and spacings of the sprites in the sprite sheet to make the animations show smoothly without being cut off as I was unfamiliar with the animation function. The documentation mentioned using same-size frames for the animation and putting them in order from left to right. Once I did this, my character sprite animations turned out perfectly without me needing to manually specify the position of every consequent frame.
From my project proposal, I was able to accomplish some of my stretch goals including:
An unanticipated setback was the amount of time I used to implement the sprites (specifically getting the animations to work). Due to time constraints, I was unable to accomplish getting Firebase implemented to keep track of user high scores for my game. This is something I would like to continue to work on if I were to have more time working on my project.
Here are some additional ideas and features I would like to add to my game in the future!
Kudos to these helpful online resources! And special thanks to Hannah, Raina, and other peers as well :)