Created
January 12, 2016 04:31
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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