Tile (class)
Jump to navigation
Jump to search
| This is the archived page of the old LunaLua documentation The rest of LunaLua related articles in this wiki contain a lot of outdated documentation preserved for historical purposes and may be used with legacy versions of the LunaLua.
Please visit the SMBX2 Documentation Page to access the latest documentation for the LunaLua scripting system of the SMBX2 Project. Adding LunaLua contents into this Wiki is not advised. |
This class provides fields/functions for managing Tiles on the overworld.
Static functions
| Static Tile Functions | ||
|---|---|---|
| Function | Return values | Description |
| Tile.count() | number | How many tiles are on the overworld. |
| Tile.get() | table of Tile | Returns all tiles on the overworld. |
| Tile.get(number or table ids) | table of Tile | Returns all tiles with the matching item ids. |
| Tile.getIntersecting(number x1, number y1, number x2, number y2) | table of Tile | Returns all tiles which are intersecting with an area from x1/y1 to x2/y2. |
Instance functions
These fields and functions are part of Tile Objects and have to be called for that object. Trying to call them from the static Tile class will result in an error. Example (feel free to copy it into your lua file to see how it works):
function onTick()
for index,myTile in ipairs(Tile.get()) do
myTile.id = 1
end
end
| Tile class | |||
|---|---|---|---|
| Type | Function/Field | Return values/Value type | Description |
| Field | Tile.id | double | The id of the tile object. |
| Field | Tile.x | double | The x position of the tile object. |
| Field | Tile.y | double | The y position of the tile object. |
| Field | Tile.width | double | The width of the tile object. |
| Field | Tile.height | double | The height of the tile object. |
| Field | Tile.isValid | boolean | Whether the object is valid or not. |