Hey everyone, I'm new here and new to Processing so please forgive me if this is a really dumb question.
I am making a simple version of the game Missile Command. I've created a class called Missile which draws one "missile" (an ellipse) on the screen from one point on the screen to another.
What I want to do is create a loop that will call my moveMissile function every x amount of seconds. Preferably the amount of seconds could be a variable I can work with, e.g. to create different difficulty levels in the game.
I can use an if loop to check if a certain time has elapsed to draw only one missile with this:
int time = millis();
if (millis() > time + 2000)
{
miss.moveMissile();
}
which happens one time at the 2 second mark. Beyond that though I'm stumped!
Thanks in advance for any help!
I am making a simple version of the game Missile Command. I've created a class called Missile which draws one "missile" (an ellipse) on the screen from one point on the screen to another.
What I want to do is create a loop that will call my moveMissile function every x amount of seconds. Preferably the amount of seconds could be a variable I can work with, e.g. to create different difficulty levels in the game.
I can use an if loop to check if a certain time has elapsed to draw only one missile with this:
int time = millis();
if (millis() > time + 2000)
{
miss.moveMissile();
}
which happens one time at the 2 second mark. Beyond that though I'm stumped!
Thanks in advance for any help!
1