Scratch for Java

Timer::everyMillis()

Returns true every given amount of milliseconds

Examples

import org.openpatch.scratch.*;
import org.openpatch.scratch.extensions.timer.Timer;

public class TimerEveryMillis {

  public TimerEveryMillis() {
    Stage myStage = new Stage(600, 240);
    Timer myTimer = new Timer();
    int i = 0;
    while (myStage.getTimer().forMillis(3000)) {
      if (myTimer.everyMillis(500)) {
        myStage.display("Count: " + i++);
      }
    }
    myStage.exit();
  }

  public static void main(String[] args) {
    new TimerEveryMillis();
  }
}

View on GitHub

Syntax

Java

.everyMillis(millis)

Scratch

Parameters

NameData TypeDescription
millisbooleanMilliseconds to return true

Return

boolean