local tiled = require "com.ponywolf.ponytiled" local json = require "json" local mapData = json.decodeFile(system.pathForFile("maps/objects/un.json", system.ResourceDirectory)) -- load from json export local map = tiled.new(mapData, "maps/objects") -- center the map on screen map.x,map.y = display.contentCenterX - map.designedWidth/2, display.contentCenterY - map.designedHeight/2 -- drag the whole map for fun local dragable = require "com.ponywolf.plugins.dragable" map = dragable.new(map)
21:06:29.070 WARNING: External tilesets only suported for tilesheets…
21:06:29.070 ERROR: Runtime error
21:06:29.070 C:\Users\user\Documents\Corona Projects\ponytiled-master - Test\com\ponywolf\ponytiled.lua:142: attempt to compare number with nil
21:06:29.070 stack traceback:
21:06:29.070 C:\Users\user\Documents\Corona Projects\ponytiled-master - Test\com\ponywolf\ponytiled.lua:142: in function ‘gidLookup’
21:06:29.070 C:\Users\user\Documents\Corona Projects\ponytiled-master - Test\com\ponywolf\ponytiled.lua:197: in function ‘new’
21:06:29.070 C:\Users\user\Documents\Corona Projects\ponytiled-master - Test\main.lua:28: in main chunk
Why? I created the map using tiled and exported both lua and json. loaded json map, but am getting this message. But tiled layered is working well, not object oriented. What is the solution?
Hi. This is a high level issue you’ll have to debug on your own. Fortunately, you can, since you have all the source code for the loader in your project.
You can follow it from beginning to end, or work your way backwards.
Did into what this function is doing:
local map = tiled.new(mapData, "maps/objects")
Corona is already telling you where the error is, so working backwards from there seems the most logical.
Just add print statements to the ponywolf code till you understand how it runs and what it is doing. You’ll eventually figure out what is missing.
That said, It looks like a texture of some kind is needed and not present.
PS - There is nothing wrong with the code by the way. It is how you are using it and whether you’re supplying the assets correctly that is the issue.
From the warning " External tilesets only suported for tilesheets" it seems like you may be using a feature of tiled the library doesn’t support.
I’d also go back and walk through all of PonyWolf’s tutorials, guides, videos etc. He must mention something about this.
Sorry I can’t just tell you, “here is the problem”, but that is simply the way it goes when you’re using high-level libraries and features.
local tiled = require "com.ponywolf.ponytiled" local mapData = require "maps.trial.trial" local map = tiled.new(mapData, "maps/trial") -- center the map on screen map.x,map.y = display.contentCenterX - map.designedWidth/2, display.contentCenterY - map.designedHeight/2 -- drag the whole map for fun local dragable = require "com.ponywolf.plugins.dragable" map = dragable.new(map)
This is the solution. Loaded with map.lua file. Pardon me.
Again, I doubt there is an issue with PonyWolf’s code.
Also, I’m not trying to dissuade you from asking for help, but I do want to point out:
The ratio of folks who read and answer posts to those who use this specific piece of code may be small.
(not an admonishment) This is the danger of using code without understanding how it works. When it doesn’t work you’re stuck till you understand it.
If this were a paid product you might be able to ask for direct support, but since this is something given for free (and at the expense of paid time on the author’s part)… you’re just going to have to debug it.
That said, it should be a pretty easy debug so I am sure you’ll work it out soon.
Got it. Thanks for the reply. I am basically an architect. I play games, now I want to make one. First I want to learn the software and all methods first. Am trying out.
Both formats are working correctly. Look at StickerKnight platformer example. There are json maps generated (You CAN open/save json in Tiled, use this possibility)
Hi. This is a high level issue you’ll have to debug on your own. Fortunately, you can, since you have all the source code for the loader in your project.
You can follow it from beginning to end, or work your way backwards.
Did into what this function is doing:
local map = tiled.new(mapData, "maps/objects")
Corona is already telling you where the error is, so working backwards from there seems the most logical.
Just add print statements to the ponywolf code till you understand how it runs and what it is doing. You’ll eventually figure out what is missing.
That said, It looks like a texture of some kind is needed and not present.
PS - There is nothing wrong with the code by the way. It is how you are using it and whether you’re supplying the assets correctly that is the issue.
From the warning " External tilesets only suported for tilesheets" it seems like you may be using a feature of tiled the library doesn’t support.
I’d also go back and walk through all of PonyWolf’s tutorials, guides, videos etc. He must mention something about this.
Sorry I can’t just tell you, “here is the problem”, but that is simply the way it goes when you’re using high-level libraries and features.
local tiled = require "com.ponywolf.ponytiled" local mapData = require "maps.trial.trial" local map = tiled.new(mapData, "maps/trial") -- center the map on screen map.x,map.y = display.contentCenterX - map.designedWidth/2, display.contentCenterY - map.designedHeight/2 -- drag the whole map for fun local dragable = require "com.ponywolf.plugins.dragable" map = dragable.new(map)
This is the solution. Loaded with map.lua file. Pardon me.
Again, I doubt there is an issue with PonyWolf’s code.
Also, I’m not trying to dissuade you from asking for help, but I do want to point out:
The ratio of folks who read and answer posts to those who use this specific piece of code may be small.
(not an admonishment) This is the danger of using code without understanding how it works. When it doesn’t work you’re stuck till you understand it.
If this were a paid product you might be able to ask for direct support, but since this is something given for free (and at the expense of paid time on the author’s part)… you’re just going to have to debug it.
That said, it should be a pretty easy debug so I am sure you’ll work it out soon.
Got it. Thanks for the reply. I am basically an architect. I play games, now I want to make one. First I want to learn the software and all methods first. Am trying out.
Both formats are working correctly. Look at StickerKnight platformer example. There are json maps generated (You CAN open/save json in Tiled, use this possibility)