example of classes being used
https://editor.p5js.org/p5/sketches/Mobile:_Shake_Ball_Bounce
Here is an example that I found that uses classes. The class is used in this code to create one function of "Ball" which is then used to make multiple balls. All of the balls have different movements and sizes even though they are called on in the ball function once which makes the code shorter and easier to read. The balls all look different in terms of shape and motion because the code uses the random function. In the constructor, the code uses different functions that are simplified and separated by what they are doing such as shape, display, and move.
Comments
Post a Comment