ScrollCam.lua
Revision as of 08:18, 16 May 2017 by Yoshi021 (talk | contribs) (Created page with "Category:LunaLua helper libraries [https://cdn.discordapp.com/attachments/281202928495230976/313894639054749720/scrollCam.zip Download scrollCam.lua] A small API that wil...")
A small API that will force the camera to only scroll
Installation
Place the file scrollCam.lua into the LuaScriptsLib folder.
How to Use
To enable the scrollCam.lua, add this line to lunadll.lua:
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. |