Camera
Each room has a camera, configured in the room Inspector. In code it is camera (Lua) or scene().camera (C++).
function onSpawn(self) camera.follow(self) camera.smoothing = 4 camera.bounded = true
self:onTouchStart("Enemy", function() camera.shake(3, 0.2) end)endvoid onSpawn() override { Camera& camera = scene().camera; camera.follow(handle()); camera.smoothing = 4; camera.bounded = true;
onTouchStart<Enemy>([this](Enemy&) { scene().camera.shake(3, 0.2f); });}Properties
Section titled “Properties”| Property | What it is |
|---|---|
x, y |
Top-left corner of the visible area, in world coordinates. |
zoom |
World magnification (1 = no zoom). The interface and onRenderGui are not magnified. |
bounded |
true = while following a target, the camera does not leave the room. |
smoothing |
From 0 to 10. 0 sticks to the target. |
deadzoneW, deadzoneH |
Size of the central rectangle in which the target moves without moving the camera. |
Functions
Section titled “Functions”| Function | What it does |
|---|---|
follow(instance) |
Starts following an instance, centering on it on the first frame. |
stopFollowing() |
Stops following; the camera stays where it is. |
shake(force, seconds) |
Shakes the screen, up to force pixels each way, fading until it stops. |
C++: follow takes a Handle; handle() returns that of the instance itself.
