Timer::forMillis()
Checks if the specified amount of milliseconds has passed since the method was first called. If the method is called for the first time, it initializes the start time.
Examples
import org.openpatch.scratch.*;
import org.openpatch.scratch.Timer;
public class TimerForMillis {
public TimerForMillis() {
Stage myStage = new Stage(600, 240);
Timer myTimer = new Timer();
myStage.display("Start!");
myStage.wait(500);
while (myTimer.forMillis(1000)) {
myStage.display("Running...");
}
;
myStage.display("Stop!");
myStage.wait(500);
myStage.exit();
}
public static void main(String[] args) {
new TimerForMillis();
}
}
Syntax
Java
.forMillis(millis)
Parameters
| Name | Data Type | Description |
|---|---|---|
| millis | int | the number of milliseconds to check against |
Return
boolean