Timer::forMillis()
Returns true for a given amount of milliseconds
Examples
import org.openpatch.scratch.*;
import org.openpatch.scratch.extensions.timer.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)
Scratch
Parameters
Name | Data Type | Description |
---|---|---|
millis | boolean | Time in milliseconds to return true. Afterwards return false. |
Return
boolean