https://editor.p5js.org/rl4800/sketches/L_Ew4QOY3
This is an image of flame illustrated by particles. I utilized classes for particles, and they are basically divided into three clusters. The fire would gather in a row and then fade away.
- What is Object-Oriented Programming (OOP), a Class and an Instance of the Class?
I think it is basically a program that combines different separated objects, and it has different objects with different actions.
- Discuss the effectiveness of OOP. When is OOP useful? In what way can it be utilized?
I think a program that includes a lot of different objects would be useful if we utilize objects. And if we have dozens of the same objects repeating, it is also a good way to use OOP.
- Describe the objects you have created. What properties and methods were implemented? What kind of behaviors did you create by manipulating them?
I made a very basic object, it is a circle with different colors. I added properties like the x-coordinates, y-coordinates, and clusters to their original properties.
Besides, I added functions like move(), fade(), and gather() to my particles. After observing what the flame is like in the video, I found out the flame was in random clusters, and they would rise in clusters, and finally fade away. So to make it more realistic, I wrote the functions above.
- Please share it if there is any challenging and confusing aspect(s) in the OOP concepts and techniques.
The main problem when I was writing the code is that I wanted to make the fire particles generate in clusters. Besides, I want them to be randomly generated at first, and then gathered together and fade away.
Thus, I tried to use the % function to divide them into 5 groups.
However, when I wanted them to gather together as rising, I need the i value to be returned by the draw function. However, I did not know how to do that. I went to LAs, and they added the “i” as a parameter when I called on the attract function. Then, I made the i a property of the attract behaviors. In this way, I built a connection between the i and num.