API Reference › Camera › Camera.set
method

Camera.set

Camera.set(x, y)

Sets the camera offset directly: a world point (wx, wy) draws on screen at (wx - x, wy - y). The same control as Screen.camera, under the Camera namespace. Use it to snap the view, or as the base that Camera.follow and Camera.shake build on.

Example

program Demo {
  property Position { x: int = 0, y: int = 0 }
  model Player { Position }
  handler DrawWorld phase Render {
    Camera.set(Position.x - 160, Position.y - 120)
    Screen.show()
  }
}
← All symbols