Smart Robot Alfie!


Hello! Welcome back to my Devlog. This is the fifth post of the semester. 

This week is a little crazy so I'll get into it. First I started with the code and the notes on Brightspace. That was a good starting point. I added an image for my robot, made multiple boxes for the robot to collect. One thing I tried was putting object1-object5 in an array. Then I tried making an individual collision method for every object. The pictures show screenshots of these. Doing a  collision 1 method for the object1, and so on, worked! 

However, the next problem was getting the robot to deliver the box and let it go. I created a stop moving method to check if the X value of the box was past 320, and if so, to let go of the box and keep the current coordinates. This worked, but it was very sensitive, I was trying to adjust the values for the collision detection. It was an odd pattern of the x value saying at 320, but the y value tied to the robot still, even when the X was far from 320. 

So now here we are.  I have five collision methods for every object, but I am getting the error shown. The code is shown in the images as well.  This problem is quite vague, which adds to its difficulty. This error makes me think I messed up on the code somewhere. I will try to fix this and post an update. I liked the idea of this project and the character Alfie!! I also want to add some moving or possibly static obstacles. I also want to change the generation so the boxes do not overlap. I also may make some visual additions. 

Here's the code: https://editor.p5js.org/gracelynn/sketches/EAolB8eIi

Leave a comment

Log in with itch.io to leave a comment.