
http://globalgamejam.org/2011/alienslime
Code: Select all
function TiledMap_Objects(filename, objectname)
local xml = LoadXML(love.filesystem.read(filename))
local objects = {}
for k, sub in ipairs(xml[2]) do
if (sub.label == "objectgroup") then
print ("found objectgroup")
for l, child in ipairs(sub) do
to = child.xarg
to.properties = nil
if child[1] ~= nil then
to.properties = {}
local property = {}
for i, prop in ipairs(child[1]) do
local name = prop.xarg.name
local value = prop.xarg.value
--property[name]=value
property.name = name
property.value = value
end
table.insert(to.properties, property)
end
if objectname == nil then
table.insert(objects, to)
else
if child.xarg.name == objectname then
table.insert(objects, to)
end
end
end
end
end
return objects
end
Users browsing this forum: No registered users and 2 guests