Hi guys,
I am making an animation in processing in which a number of lines on the left go to the right and vice versa. When two lines collide, a sphere will form at the point of their collision and cause a sort of "explosion" effect.
However I have a small problem.
I want the lines to start at a random height y and move across the screen with a constant speed. However after 7 seconds I want the scene to be looped but the lines have to start at another random height.
However the problem is I am trying to achieve this with global variables which means once their declared the random value is the same for the remainder of the program.
So do i just redeclare the value after the 7 seconds or are their other ways to achieve this?
This actually is an assignment for school and we are only allowed to use global and local variables (with the help of loops and conditionals of course).
I hope you can help me out.
I am making an animation in processing in which a number of lines on the left go to the right and vice versa. When two lines collide, a sphere will form at the point of their collision and cause a sort of "explosion" effect.
However I have a small problem.
I want the lines to start at a random height y and move across the screen with a constant speed. However after 7 seconds I want the scene to be looped but the lines have to start at another random height.
However the problem is I am trying to achieve this with global variables which means once their declared the random value is the same for the remainder of the program.
So do i just redeclare the value after the 7 seconds or are their other ways to achieve this?
This actually is an assignment for school and we are only allowed to use global and local variables (with the help of loops and conditionals of course).
I hope you can help me out.
1