From 95305d890f6ea27d7d8759191aa92d4eae30f4b7 Mon Sep 17 00:00:00 2001 From: Randy McShandy Date: Thu, 12 Feb 2026 21:30:36 -0600 Subject: [PATCH] Rework controls for dynamic keymaps, add dedicated handler module, and support for different control modes depending on map properties. --- main/control.lua | 55 ++++++++++----- main/handlers.lua | 17 +++++ main/main.lua | 14 ++-- main/render.lua | 34 +++++++++ main/tiled/test_1.lua | 159 ++++++++++++------------------------------ main/tiled/test_1.tmx | 3 + main/utils.lua | 8 +++ 7 files changed, 149 insertions(+), 141 deletions(-) create mode 100644 main/handlers.lua diff --git a/main/control.lua b/main/control.lua index c6c689b..ec982e5 100644 --- a/main/control.lua +++ b/main/control.lua @@ -12,23 +12,27 @@ control.ControlType = Movement = 1, } --- I'd kind of like to keep player controls in a dedicated table that these then map into, --- but that's probably overengineering for now. Maybe a nice move for flexibility. --- Maybe even any keymapping here could describe the event(s) and params it should push. --- At some point in the future, keymaps can be switched out contextually for *very* dynamic behavior, --- like setting up menu systems. - control.keymap = {} -control.keymap['l'] = { heading = (math.pi / 2) * -0, control = control.ControlType.Movement, } -control.keymap['k'] = { heading = (math.pi / 2) * -1, control = control.ControlType.Movement, } -control.keymap['h'] = { heading = (math.pi / 2) * -2, control = control.ControlType.Movement, } -control.keymap['j'] = { heading = (math.pi / 2) * -3, control = control.ControlType.Movement, } -control.keymap['d'] = { heading = (math.pi / 2) * -0, control = control.ControlType.Movement, } -control.keymap['w'] = { heading = (math.pi / 2) * -1, control = control.ControlType.Movement, } -control.keymap['a'] = { heading = (math.pi / 2) * -2, control = control.ControlType.Movement, } -control.keymap['s'] = { heading = (math.pi / 2) * -3, control = control.ControlType.Movement, } +control.keymap.active_keymap = nil +control.keymap[render.ViewClass.Topdown] = {} +control.keymap[render.ViewClass.Sidescroll] = {} + +control.keymap[render.ViewClass.Topdown]['l'] = { heading = (math.pi / 2) * -0, control = control.ControlType.Movement, } +control.keymap[render.ViewClass.Topdown]['k'] = { heading = (math.pi / 2) * -1, control = control.ControlType.Movement, } +control.keymap[render.ViewClass.Topdown]['h'] = { heading = (math.pi / 2) * -2, control = control.ControlType.Movement, } +control.keymap[render.ViewClass.Topdown]['j'] = { heading = (math.pi / 2) * -3, control = control.ControlType.Movement, } +control.keymap[render.ViewClass.Topdown]['d'] = { heading = (math.pi / 2) * -0, control = control.ControlType.Movement, } +control.keymap[render.ViewClass.Topdown]['w'] = { heading = (math.pi / 2) * -1, control = control.ControlType.Movement, } +control.keymap[render.ViewClass.Topdown]['a'] = { heading = (math.pi / 2) * -2, control = control.ControlType.Movement, } +control.keymap[render.ViewClass.Topdown]['s'] = { heading = (math.pi / 2) * -3, control = control.ControlType.Movement, } + +control.keymap[render.ViewClass.Sidescroll]['l'] = { heading = (math.pi / 2) * -0, control = control.ControlType.Movement, } +control.keymap[render.ViewClass.Sidescroll]['h'] = { heading = (math.pi / 2) * -2, control = control.ControlType.Movement, } +control.keymap[render.ViewClass.Sidescroll]['a'] = { heading = (math.pi / 2) * -2, control = control.ControlType.Movement, } +control.keymap[render.ViewClass.Sidescroll]['d'] = { heading = (math.pi / 2) * -0, control = control.ControlType.Movement, } -control.keymap['q'] = { +control.keymap['global'] = {} +control.keymap['global']['q'] = { control = control.ControlType.System, system_action = function(key) print('Quitting') @@ -36,7 +40,7 @@ control.keymap['q'] = { end, } -control.keymap['z'] = { +control.keymap['global']['z'] = { control = control.ControlType.System, system_action = function(key) if render.map.scale < 8.0 then @@ -46,7 +50,7 @@ control.keymap['z'] = { end, } -control.keymap['x'] = { +control.keymap['global']['x'] = { control = control.ControlType.System, system_action = function(key) if render.map.scale > 0.4 then @@ -67,4 +71,21 @@ end function love.handlers.collision(collider, tile) end +function control.search_keymap(key, keymap) + local key_found = false + --for k,v in pairs(control.keymap.active_keymap) do + for k,v in pairs(keymap) do + if key == k then + key_found = true + if v.control == control.ControlType.System then + v.system_action(k) + end + if v.control == control.ControlType.Movement then + love.event.push('movement_control', k, v) + end + end + end + return key_found +end + return control diff --git a/main/handlers.lua b/main/handlers.lua new file mode 100644 index 0000000..aeba1e7 --- /dev/null +++ b/main/handlers.lua @@ -0,0 +1,17 @@ +-- handlers.lua +-- Dumping ground for love handlers since +-- I couldn't think of a better place. +-- No module should have to include this. + +local control = require('control') +local render = require('render') + +function love.handlers.map_changed(new_map_name) + local new_map = assets.get_map(new_map_name) + if new_map then + control.keymap.active_keymap = control.keymap[render.ViewClassData[new_map.properties.viewclass]] + else + print('invalid map: '..new_map_name) + end + +end diff --git a/main/main.lua b/main/main.lua index fe21254..cc3e4ef 100644 --- a/main/main.lua +++ b/main/main.lua @@ -5,6 +5,7 @@ local sti = require('plugin.sti') local lovebird = require('plugin.lovebird') -- Debugging tool http://127.0.0.1:8000 -- Modules +local handlers = require('handlers') local conf = require('conf') local assets = require('assets') local player_module = require('player') @@ -19,7 +20,7 @@ function love.load() love.graphics.setFont(assets.get_font('Cuneiform36')) love.audio.play(assets.get_source('intro')) - render.map.active_map = assets.get_map('test_map_1') + render.activate_map('test_map_1') player = assets.get_object('Player') player_module.init_controls(player, render.map.active_map) end @@ -31,15 +32,8 @@ function love.update(dt) end function love.keyreleased(key) - for k,v in pairs(control.keymap) do - if key == k then - if v.control == control.ControlType.System then - v.system_action(k) - end - if v.control == control.ControlType.Movement then - love.event.push('movement_control', k, v) - end - end + if not control.search_keymap(key, control.keymap['global']) then + control.search_keymap(key, control.keymap.active_keymap) end end diff --git a/main/render.lua b/main/render.lua index ccc777a..a176880 100644 --- a/main/render.lua +++ b/main/render.lua @@ -1,6 +1,24 @@ -- render.lua -- + +assets = require('assets') +utils = require('utils') + local render = {} +ViewClass = +{ + Topdown = 1, + Sidescroll = 2, +} +render.ViewClass = ViewClass +render.active_viewclass = ViewClass.Topdown + +render.ViewClassData = {} +render.ViewClassData[ViewClass.Topdown] = "topdown" +render.ViewClassData[ViewClass.Sidescroll] = "sidescroll" +render.ViewClassData["topdown"] = ViewClass.Topdown +render.ViewClassData["sidescroll"] = ViewClass.Sidescroll + -- Define a palette render.color = {} -- wrapping a function that returns multiple values in {} packs @@ -14,4 +32,20 @@ render.map.topleft = { x = 0, y = 0 } render.map.scale = 2.0 render.map.active_map = nil +render.activate_map = function(new_map_name) + local success = false + + local new_map = assets.get_map(new_map_name) + if new_map then + success = true + render.map.active_map = new_map + render.active_viewclass = render.ViewClassData[new_map.properties.viewclass] + utils.shallow_dump(render.map.active_map.properties) + + love.event.push('map_changed', new_map_name) + end + + return success +end + return render diff --git a/main/tiled/test_1.lua b/main/tiled/test_1.lua index 8af5fff..b11069d 100644 --- a/main/tiled/test_1.lua +++ b/main/tiled/test_1.lua @@ -11,82 +11,13 @@ return { tileheight = 16, nextlayerid = 7, nextobjectid = 13, - properties = {}, + properties = { + ["viewclass"] = "topdown" + }, tilesets = { - { - name = "colored_packed", - firstgid = 1, - class = "", - tilewidth = 16, - tileheight = 16, - spacing = 0, - margin = 0, - columns = 49, - image = "../assets/tilesets/kenney_1_bit/Tilesheet/colored_packed.png", - imagewidth = 784, - imageheight = 352, - objectalignment = "unspecified", - tilerendersize = "tile", - fillmode = "stretch", - tileoffset = { - x = 0, - y = 0 - }, - grid = { - orientation = "orthogonal", - width = 16, - height = 16 - }, - properties = {}, - wangsets = {}, - tilecount = 1078, - tiles = {} - }, - { - name = "colored_packed", - firstgid = 1079, - class = "", - tilewidth = 16, - tileheight = 16, - spacing = 0, - margin = 0, - columns = 49, - image = "../assets/tilesets/kenney_1_bit/Tilesheet/colored_packed.png", - imagewidth = 784, - imageheight = 352, - objectalignment = "unspecified", - tilerendersize = "tile", - fillmode = "stretch", - tileoffset = { - x = 0, - y = 0 - }, - grid = { - orientation = "orthogonal", - width = 16, - height = 16 - }, - properties = {}, - wangsets = {}, - tilecount = 1078, - tiles = { - { - id = 49, - properties = { - ["wall"] = true - } - }, - { - id = 50, - properties = { - ["wall"] = true - } - } - } - }, { name = "monochrome_bw_packed", - firstgid = 2157, + firstgid = 1, class = "", tilewidth = 16, tileheight = 16, @@ -224,26 +155,26 @@ return { properties = {}, encoding = "lua", data = { - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, - 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }, { @@ -264,26 +195,26 @@ return { properties = {}, encoding = "lua", data = { - 2207, 3025, 3026, 3027, 3028, 3029, 3030, 3031, 3032, 3033, 3034, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, - 3074, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 3075, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 3076, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 3077, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 3078, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2902, 2903, 2904, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 3079, 0, 0, 0, 0, 0, 0, 2362, 2684356921, 1610615097, 2684356921, 1610615097, 2684356921, 2684356922, 0, 0, 0, 0, 2951, 2952, 2953, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 3080, 0, 0, 0, 0, 0, 0, 3221227833, 0, 0, 0, 0, 0, 2361, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 3081, 0, 0, 0, 0, 0, 0, 2361, 2362, 1610615097, 2684356921, 1610615097, 2684356922, 3221227833, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 3082, 0, 0, 0, 0, 0, 0, 3221227833, 2361, 0, 2365, 0, 2361, 2361, 0, 0, 0, 0, 0, 0, 2175, 2177, 2175, 2177, 0, 0, 0, 0, 0, 2207, - 3083, 0, 0, 0, 0, 0, 0, 2361, 1610615098, 1610615097, 1610615100, 2684356921, 3221227834, 3221227833, 0, 0, 0, 0, 0, 0, 2273, 2275, 2273, 2275, 0, 0, 0, 0, 0, 2207, - 3084, 0, 0, 0, 0, 0, 0, 3221227833, 0, 0, 2361, 0, 0, 2361, 0, 0, 0, 0, 0, 0, 2175, 2177, 2175, 2177, 0, 0, 0, 0, 0, 2207, - 2207, 0, 0, 0, 0, 0, 0, 1610615098, 1610615097, 2684356921, 1610615099, 2684356921, 1610615097, 3221227834, 0, 0, 0, 0, 0, 0, 2273, 2275, 2273, 2275, 0, 0, 0, 0, 0, 2207, - 2207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 2207, 0, 2207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 2207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 2207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 2207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 2207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2207, - 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207 + 51, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 918, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 919, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 920, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 922, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 746, 747, 748, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 923, 0, 0, 0, 0, 0, 0, 206, 2684354765, 1610612941, 2684354765, 1610612941, 2684354765, 2684354766, 0, 0, 0, 0, 795, 796, 797, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 924, 0, 0, 0, 0, 0, 0, 3221225677, 0, 0, 0, 0, 0, 205, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 925, 0, 0, 0, 0, 0, 0, 205, 206, 1610612941, 2684354765, 1610612941, 2684354766, 3221225677, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 926, 0, 0, 0, 0, 0, 0, 3221225677, 205, 0, 209, 0, 205, 205, 0, 0, 0, 0, 0, 0, 19, 21, 19, 21, 0, 0, 0, 0, 0, 51, + 927, 0, 0, 0, 0, 0, 0, 205, 1610612942, 1610612941, 1610612944, 2684354765, 3221225678, 3221225677, 0, 0, 0, 0, 0, 0, 117, 119, 117, 119, 0, 0, 0, 0, 0, 51, + 928, 0, 0, 0, 0, 0, 0, 3221225677, 0, 0, 205, 0, 0, 205, 0, 0, 0, 0, 0, 0, 19, 21, 19, 21, 0, 0, 0, 0, 0, 51, + 51, 0, 0, 0, 0, 0, 0, 1610612942, 1610612941, 2684354765, 1610612943, 2684354765, 1610612941, 3221225678, 0, 0, 0, 0, 0, 0, 117, 119, 117, 119, 0, 0, 0, 0, 0, 51, + 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 51, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 } }, { @@ -310,7 +241,7 @@ return { width = 16, height = 16, rotation = 0, - gid = 2671, + gid = 515, visible = true, properties = {} } diff --git a/main/tiled/test_1.tmx b/main/tiled/test_1.tmx index 869e646..d719bf4 100644 --- a/main/tiled/test_1.tmx +++ b/main/tiled/test_1.tmx @@ -3,6 +3,9 @@ + + + diff --git a/main/utils.lua b/main/utils.lua index f5b0102..1137b20 100644 --- a/main/utils.lua +++ b/main/utils.lua @@ -15,4 +15,12 @@ function utils.shallow_copy(t) return t2 end +function utils.shallow_dump(t) + if t then + for k,v in pairs(t) do + print(k..':', v) + end + end +end + return utils -- 2.49.0