crystal.Tileset
Collection of tiles to build maps with.
Constructor
You cannot construct tilesets manually. Use crystal.assets.get to load them from disk. Even better, load a Map and it will load the tileset(s) its need automatically.
Methods
| Name | Description |
|---|---|
| image | Returns the love.Image used by this tileset. |
| num_tiles | Returns the number of tiles in this tileset. |
| tile_height | Returns the height in pixels of a single tile. |
| tile_width | Returns the width in pixels of a single tile. |
Examples
local map = crystal.assets.get("assets/maps/dungeon.lua");
for _, tileset in ipairs(map:tilesets()) do
print(tileset:image());
end
local tileset = crystal.assets.get("assets/tileset.lua");
print(tileset:image());