Skip to content

Instantly share code, notes, and snippets.

@OutlawGameTools
Created January 12, 2016 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OutlawGameTools/e9a5241c1b99cf78045d to your computer and use it in GitHub Desktop.
Save OutlawGameTools/e9a5241c1b99cf78045d to your computer and use it in GitHub Desktop.
Corona SDK. Make walkable map for Jumper from a Tiled map exported as Lua.
local map
local level01 = require("wasilla") -- the Tiled map exported as wasilla.lua
--=======================================================================================
-- pass in the table that holds the level info from: local level01 = require("level01")
-- get back a table that can be used as a map for Pathfinder
--=======================================================================================
local function walkableMapFromTMX(lvl)
local t = {}
local idx = 1
for h = 1, lvl.layers[1].height do
t[h] = {}
for w = 1, lvl.layers[1].width do
t[h][w] = lvl.layers[1].data[idx]
idx = idx + 1
end
end
return t
end
-- use like this:
-- map = walkableMapFromTMX(level01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment