From 6fc7035db506b648ab27f21cd4ccbe2e874e3750 Mon Sep 17 00:00:00 2001 From: ne_mene Date: Thu, 12 Mar 2026 13:11:38 +0100 Subject: tilemap skeleton --- main.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index 5811733..c739bf4 100644 --- a/main.lua +++ b/main.lua @@ -10,17 +10,21 @@ function love.load() event_bind(scn.on_update, "Sprite", sprite_anim_sys) event_bind(scn.on_draw, "Sprite", sprite_draw_sys) + event_bind(scn.on_draw, "Tilemap", tilemap_draw_sys) set_scene(scn) new_player(100, 100) box1 = phys.Box.new(20, 20, 16, 16, { layers = {}, - mask = {"hard"}, + mask = { "hard" }, }) ground1 = phys.Box.new(5, 50, 64, 16, {}) - ground2 = phys.Box.new(64-16, 50+16, 16, 64, {}) + ground2 = phys.Box.new(64 - 16, 50 + 16, 16, 64, {}) + + local tilemap = new_tilemap(64, 64) + scn.tilemap = tilemap end function love.update(dt) @@ -49,15 +53,14 @@ function love.draw(dt) -- TODO: Take care of weird displays lg.setCanvas() local scr_width, scr_height = lg.getDimensions() - WindowScale = min(scr_width/SCR_WIDTH, scr_height/SCR_HEIGHT) + WindowScale = min(scr_width / SCR_WIDTH, scr_height / SCR_HEIGHT) lg.draw( viewport, - scr_width/2, scr_height/2, 0, + scr_width / 2, scr_height / 2, 0, WindowScale, WindowScale, - SCR_WIDTH/2, SCR_HEIGHT/2) + SCR_WIDTH / 2, SCR_HEIGHT / 2) lg.print(tostring(love.timer.getFPS())) input_step() end - -- cgit v1.3-2-g0d8e