Week #5
To start with Week #5 I had an overview of the project I wanted to create. There will be distinct classes for the Alfie bot, the retrieved objects, and the obstacles respectively. The bot will bounce around and lock onto nearby objects in an attempt to bring them back to a location until they are all collected. The obstacles will slow down the bot, impeding its progress.I started off by defining the basic properties of my classes. The Alfie bot will bounce around the entire screen, changing velocity depending on which side it hits. The objects will stay still until the bot approaches them, upon which they will attach. Now I need a drop-off point for the objects.
A new class called the end zone will disconnected the object from Alfie whence placed inside. The size could be adjusted. An issue is the Alfie moves around aimlessly and we need him to get to the end zone.
Alfie will now rotate at a frequency that allows it cover more of the map in a faster manner. It now also has an obstacle to face. This was a bit challenging to create. I tried limiting the max speed, but it was hard to stop that from affecting Alfie permanently. I eventually decided for it to slow the bot 40% for a set time. Alfie will then be set back to its normal speed to prevent it from slowing down forever. The for loop is also set to break so it cannot be effected by multiple obstacles at once.
Now all of the elements have a place in a monkey's quest to find his bananas, you can watch him spin around as he claims one banana at a time, while avoiding tigers and trying to return to his home!
Here is the project:https://editor.p5js.org/SunyCoder444/sketches/FB_ezQp7o
Drawing, Moving, and Seeing with Code - Spring 2025
Status | In development |
Category | Other |
Author | SUNYCoder444 |
Leave a comment
Log in with itch.io to leave a comment.