Smoovement.lua
Revision as of 00:34, 30 April 2016 by Spinda (talk | contribs) (Created page with "Category:LunaLua helper libraries '''''This page is still under heavy construction and by no means complete!''''' smoovement is an API that introduces sprite objects and...")
This page is still under heavy construction and by no means complete!
smoovement is an API that introduces sprite objects and ways to transform them as well as parent-children relationships.
Installation
Just download this and extract it. Then, copy the file into your level's graphics folder. Rinkas;Tale, an example level, is included, too.
Setup
To enable the smoovement library for a specific level, add this line to lunadll.lua:
local smoovement = API.load ("smoovement");
This will load the smoovement API.
Documentation
Values
These are variables you can access.
| world | sprite | The sprite object used for referencing everything. Any transformations applied to this sprite will get applied to every sprite. |
|---|
Sprite
Values
| Sprite.img | The LuaImageResource that the sprite is currently displaying |
|---|---|
| Sprite.x | The x translation relative to its parent |
| Sprite.y | The y translation relative to its parent |
| Sprite.rotation | The current rotation of the sprite relative to its parent in degrees |
| Sprite.pivotX | The x coordinate of the pivot point, the point that's used as the center for scaling and rotation, where 0 represents the leftmost side of the sprite and 1 the rightmost |
| Sprite.pivotY | The y coordinate of the pivot point, the point that's used as the center for scaling and rotation, where 0 represents the top of the sprite and 1 the bottom |
| Sprite.scaleX | The value by which the sprite is scaled horizontally |
| Sprite.scaleX | The value by which the sprite is scaled vartically |
| Sprite.visible | boolean containing whether the sprite is visible |
| Sprite.hasParent | boolean containing whether the sprite has a parent |
| Sprite.parent | Parent sprite |
| Sprite.children | table of children |
| Sprite.hasAnimation | boolean containing whether the sprite is animated |
| Sprite.dTime | Number of frames between animations |
| Sprite.counter | A counter that increases from 0 to Sprite.dTime - 1 and is used to keep track of animation |
| Sprite.frame | The index of the frame that the sprite is currently on |
| Sprite.frames | table of LuaImageResource, with each one representing one frame of animation |
| Sprite.priority | Priority with which the sprite is drawn. See LunaLua Render Priority |
| Sprite.transform | The transform of the sprite; only used for rendering |
| Sprite.deleted | boolean containing whether the sprite, as well as its children, are to be deleted on the next frame |