aboutsummaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
authorne_mene <[email protected]>2026-03-12 13:11:38 +0100
committerne_mene <[email protected]>2026-03-12 13:11:38 +0100
commit6fc7035db506b648ab27f21cd4ccbe2e874e3750 (patch)
tree4c3c498bec60f8ab549d130ba31d4bc5696b451d /main.lua
parentc63b1e049c9da2c095281b3e5dd012cc4fc4b6fc (diff)
tilemap skeleton
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua15
1 files changed, 9 insertions, 6 deletions
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
-