diff options
| author | ne_mene <[email protected]> | 2026-03-13 17:54:17 +0100 |
|---|---|---|
| committer | ne_mene <[email protected]> | 2026-03-13 17:54:17 +0100 |
| commit | b47490aea2f63d881a2cc69a326b03abae1a46c0 (patch) | |
| tree | 2f25d7d56fb495bdbc5a2f24fc7776c9f7e87bdd /src/objs/tilemap.lua | |
| parent | bc52ad3e36ecb0918eca17ea68a0dc54852a3392 (diff) | |
| parent | 94141331ac0365c8eaa823d0ed1e8eb928f09dc6 (diff) | |
stupid merge that i hate
Diffstat (limited to 'src/objs/tilemap.lua')
| -rw-r--r-- | src/objs/tilemap.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/objs/tilemap.lua b/src/objs/tilemap.lua index 7904a19..834a770 100644 --- a/src/objs/tilemap.lua +++ b/src/objs/tilemap.lua @@ -107,7 +107,7 @@ function rebuild_tilemap(map) end end -local TILE_TEX = get_tex("res/img/tilesets.png") +TILE_TEX = get_tex("res/img/tilesets.png") local TILE_QUAD = lg.newQuad( 0, 0, TILESIZE, TILESIZE, @@ -157,3 +157,16 @@ function remove_tile(map, x, y) map.tiledata[ID(map, x, y)] = 0 map.needs_rebuild = true end + +function get_tileset_quad(tileset) + local start_y = (tileset - 1) * 4 * TILESIZE + return lg.newQuad( + 0, start_y, + 4 * TILESIZE, 4 * TILESIZE, + TILE_TEX:getDimensions() + ) +end + +function get_tileset_count() + return TILE_TEX:getHeight() / (4 * TILESIZE) +end |
