constrain

examples


a

  void move() {
    x = constrain(x + (int)random(-2, 2), 0, width);
    y = constrain(y + (int)random(-2, 2), 0, height);
  }

Here the constrain-function is used to hinder the walker-object to leave off the canvas


results matching ""

    No results matching ""