The Goal: create an object oriented program where the pieces each had a life of their own. I wanted to create a program where with each click of the mouse, a new line was drawn and would continually draw across the screen.
Steps:

Before setup, I declared the Lines array so that the object could be inserted into the array. Declaring the "linecount" as 0 in the beginning declares that there are no lines when the program first begins. I also declared randomColor to be used later in the display function. In setup, I used "frameRate" to change the speed of the animation.

In this class, I only needed x, y and the directions of both x and y. Under display, i included the line objects and the random color generator.
Issues: Originally, I wanted the lines to draw across the screen in a random direction from a random position. However, in my code, I couldn't figure out how to make them stop redrawing with each frame rather than staying in one position.
Comentários