Prompt:

Functions are the basic unit of labor in your code. Take a sketch you’ve already done and re-organize the code into functional units of labor that you define. You can also conceive of an entirely new world of labor. What kinds of labor does it take to make your sketch run?

https://editor.p5js.org/Ayanoriri/sketches/kroHmT9CZ

For my week 2 assignment, I chose to enhance the animated sketch from week 2 assignment by adding more variation and playfulness to the animation.

Initially, I modified the logic of the worm bite: rather than changing position with each click, it now relocates whenever the mouse (representing the worm) hovers over it. This change was implemented using the mouseMoved() function.

Additionally, I wanted the worm to flip horizontally when the mouse moved from left to right, ensuring that the movement appeared more natural. To achieve a smoother transition, I extracted the worm drawing logic into a separate function, allowing the flip to be handled more efficiently and cleanly.