ScrollCam.lua
Jump to navigation
Jump to search
A small API that will force the camera to only scroll, like Megaman Series Games.
Installation
Place the file scrollCam.lua in either your level's custom graphics folder for use in a level, along with a lunadll.lua file, or in the same directory as your .wld file along with a lunaworld.lua file for use throughout an entire episode.
How to Use
local scrollCam= API.load("scrollCam");
This will load the API.
Examples
local scrollCam = API.load("scrollCam")
function onStart()
scrollCam.enable()
end
Documentation
Values
Value | Default | Description |
---|---|---|
speedX | 10 | The X-speed when making a horizontal animation. |
speedY | 10 | The Y-speed when making a vertical animation. |
controlHorizontal | true | Should there be a horizontal animation? |
controlVertical | true | Should there be a vertical animation? |
Functions
Functions | Description |
---|---|
enable(x,y) | Two optional parameters. This function is used to enable the camera effect. If the parameters are used, then it will use those values as the starting point of the camera effect, otherwise, it will use the player's camera. NOTE: it is recommended to use manual coordinates if this function is used before onStart(). |
disable() | Will disable the camera effect. |
onCamera(x,y) | Two required parameters. Input an X-scene and Y-scene coordinate and it will return a boolean on whether the point is currently inside the camera. |
getCoord(side) | One required string parameter, either "top", "bottom", "left", "right". Will return the camera's "left" or "right" X-scene coordinates or the camera's "up" or "down" Y-scene coordinates. |