Camera Functions
Contents
CameraZoom(z)
[require Xmoto >= 0.2.0]
Explanation
In some levels, you may want that the camera is a bit more far from the player. Use this function to change the camera zoom.
Script example
The example shows how a different zoom can be used to play a level.
function OnLoad() Game.CameraZoom(-0.05) return true end
CameraMove(x, y)
[require Xmoto >= 0.2.0]
Explanation
For some particular levels, you may want the camera to be moved. Use this function to do that.
Script example
The example shows how you can focus a level on the part above the player.
function OnLoad() Game.CameraMove(0, 3) return true end
CameraRotate(angle)
[require Xmoto >= 0.3.0]
Explanation
For some particular levels, you may want that the camera be rotated. Use this function to do that.
Script example
The example shows how you use this function.
function OnLoad() Game.CameraRotate(math.pi / 4.0); return true end
CameraAdaptToGravity()
[require Xmoto >= 0.3.0]
Explanation
For some particular levels, you may want that the camera be rotated. Use this function to do that in function of the gravity.
Script example
The example shows how you use this function.
function OnLoad() Game.SetGravity(0.0, 9.81) Game.CameraAdaptToGravity() return true end
SetCameraRotationSpeed(z)
[require Xmoto >= 0.4.2]
Explanation
For some particular levels, you may want that the camera beeing rotated does that at a certain speed. With this function you can make it rotate either very slow ( z = 0.1 ) or extremely fast ( z = 7.2 ). The values are given in RAD, so they can reach from 0 to 2 * PI.
Script example
The example shows how you use this function.
function OnLoad() Game.SetGravity(0.0, 9.81) Game.SetCameraRotationSpeed(0.2) Game.CameraAdaptToGravity() return true end