]> git.mcshandy.xyz Git - sumeriangame/commitdiff
Rework controls for dynamic keymaps, add dedicated handler module, and support for...
authorRandy McShandy <randy@mcshandy.xyz>
Fri, 13 Feb 2026 03:30:36 +0000 (21:30 -0600)
committerRandy McShandy <randy@mcshandy.xyz>
Fri, 13 Feb 2026 03:30:36 +0000 (21:30 -0600)
main/control.lua
main/handlers.lua [new file with mode: 0644]
main/main.lua
main/render.lua
main/tiled/test_1.lua
main/tiled/test_1.tmx
main/utils.lua

index c6c689bddfd8db08189e2a64167b0aa0a74dd1a8..ec982e5caae7c6b7caf3e550889c9f77d3401ea9 100644 (file)
@@ -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 (file)
index 0000000..aeba1e7
--- /dev/null
@@ -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
index fe21254ba8b846d0c41ef01422b89030e7fa1a89..cc3e4eff32271a42533d6aeccbebb7b753ced016 100644 (file)
@@ -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
 
index ccc777a6757fad05b4c9f73950f85e3ce4f301fc..a1768808e41500c7b3411688598189a4e62e658e 100644 (file)
@@ -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
index 8af5fff6d4515c1f1b10afff3c9fabe2fb5cee59..b11069deaa5b9dcea0ad6902faa2d3dde7d52412 100644 (file)
@@ -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 = {}
         }
index 869e64656f7be8dc5dc277da70f34c27704fc691..d719bf4e91bcb6d6192a291149e0c1884fa58308 100644 (file)
@@ -3,6 +3,9 @@
  <editorsettings>
   <export target="test_1.lua" format="lua"/>
  </editorsettings>
+ <properties>
+  <property name="viewclass" value="topdown"/>
+ </properties>
  <tileset firstgid="1" name="monochrome_bw_packed" tilewidth="16" tileheight="16" tilecount="1078" columns="49">
   <image source="../assets/tilesets/kenney_1_bit/Tilesheet/monochrome_bw_packed.png" width="784" height="352"/>
   <tile id="49">
index f5b01029e1d21f042f5e8c74656fb579792880b6..1137b2042403600c1fff9a9d2c3674cc707d0ebc 100644 (file)
@@ -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