method
Camera.follow
Camera.follow(x, y, lerp)
Moves the camera a fraction lerp of the way toward centring the world point (x, y) on screen. lerp is a fixed in 0.0..1.0: 0 holds still, a small value trails smoothly behind a moving target, 1.0 snaps it centred. Call it each frame with the target's position for a classic smooth-follow camera. Deterministic.
Parameters
lerphow far to move this frame (a fixed, 0..1)Example
program Demo {
property Position { x: int = 0, y: int = 0 }
model Player { Position }
handler DrawWorld phase Render {
Camera.follow(Position.x, Position.y, fixed(1) / fixed(8)) # smooth trail
Screen.show()
}
}