Object-oriented programming and Arrays
For this assignment we were tasked to deploy object-oriented programming with arrays as well as an interactive element to the sketch. I created the Wand class, where you can create a wand object and emit bubbles by pressing the mouse button. I declared a constructor with these following variables:
- x_length : the width of the wand
- y_length : the height of the wand
- Wand_thickness: thickness of the wand
- Particle_count: the frequency of bubbles you see on screen (between 1-50)
I also created two functions within the class. The display() function that displays the wand and the bubbles() function that makes the wand object emit bubbles if the mouse is pressed. Finally, I created a wand_list and appended several wand objects in the setup function, and I displayed one of the objects in draw().
This was an interesting assignment to work with arrays and for loops for the first time in p5. As I always relied on the looping nature of draw(). Moreover, creating interactivity in the sketch is definitely trickier than anything I have done so far. The reason is that you have to work to imitate or accomplish something specific (like water dropping, or the effect of fire or snow etc.) while in the past, I simply experimented with the values and functions to create something within a wider parameter.