In order to make the tile-objects work, I had to change the Map:getTileSetFromGID(gid) function in tile-map.lua to:
[lua]— Gets a Tile image from a GID.
– @param gid The gid to use.
– @return The tileset at the gid location.
function Map:getTileSetFromGID(gid)
– why are all the gids still strings instead of numbers???
gid = gid and tonumber(gid)
local tileSets = self.tileSets
if(gid and type(gid)==“number” and #tileSets > 0 and gid >= tonumber(tileSets[1].firstgid))then
for i=2, #tileSets, 1 do
if(tonumber(tileSets[i].firstgid) > gid)then
return tileSets[i-1]
end
end
return tileSets[#self.tileSets] – leap of faith that it’s in the last tileset
else
return nil –
end
end[/lua]
It took me a while to figure this out, which is why it’s rewritten … and I’m not even sure if this is correct…but at least my tile-object show up on the screen now…
What spooked me was that the gid and firstgid are all strings still and not numbers (?) - I understand that they are xml-strings coming in, but I thought they were transformed into number along the way.
-FS.
[import]uid: 8093 topic_id: 6795 reply_id: 306795[/import]