method
Camera.shake
Camera.shake(amount)
Adds a random screen shake of up to +/- amount pixels on top of the camera's base offset, drawn from the seeded RNG so a replay shakes identically. Call it each frame with a decaying amount for a hit or explosion; Camera.shake(0) clears it. It stacks on Camera.set / Camera.follow, so follow and shake compose.
Parameters
amountthe maximum shake magnitude in pixels (0 clears it)Example
program Demo {
property Hit { timer: int = 0 }
model Cam { Hit }
handler DrawWorld phase Render {
if Hit.timer > 0 { Camera.shake(Hit.timer) }
else { Camera.shake(0) }
Screen.show()
}
}