Reset Timer Problem
in
Programming Questions
•
2 years ago
I have this Challenge, to "drop" an ellipse across a screen every 1 minute, this is the code i have so far
- float y = 10;
- float speed = 1.0;
- float radius = 15.0;
- int direction = 1;
- int time;
- int timeDelay;//Time Delay between calls
- void setup() {
- size(500, 500);
- smooth();
- noStroke();
- ellipseMode(RADIUS);
- time = millis();
- timeDelay = 10000;
- }
- void draw() {
- background(0);
- fill(255);
- if(millis() > time + timeDelay){
- dropBall();
- //time =millis(); this didnt give me the Desired Effect
- }
- }
- void dropBall(){
- ellipse(33, y, radius, radius);
- y += speed * direction;
- }
- void reset(){
- time = millis();
- print("called");
The dropBall() Function is called only once, i guess i'ld probably need to reset the Millis() function?, how would i achieve calling the dropBall() Function every minute
Thank You
1