Making Things Move With p5

Week 2 of ICM and we’re getting into using variables and animating using code. I could have recycled the sketch from last week for this assignment but I think Cheese Face is already a little strange without needing to move… Though I read into objects and think they may have made this particular sketch a little easier and the code a little neater, For this I wanted to focus on just getting things moving successfully

We needed one thing controlled by the mouse (my fish movement), one thing moving on its own over time (the bubbles), and something that’s different every time (the saying). Technically there are three different sayings that can pop up but because it’s random, sometimes I’ll get the same one over and over. I think making the range smaller or increasing the options might help that though.

You can check out the code here!

While I got mapping the range of my fish to the tank pretty easily, I struggled when it came to getting him to reverse directions correctly. Depending on what if statements I was trying, if you held the mouse in one place he would be drawn facing both directions,  disappear, immediately face the opposite direction, etc. I solved this with the creation of a Boolean but I’m still wondering if there’s a more efficient way of fixing it.

I’d also like to figure out how to create the bubbles as individuals with their own speeds or behaviors instead of as a group that move as one. Make them an object maybe?