part of the parser:
for each (var objectgroup:XML in mapXML.objectgroup)
{
var groupname:String = objectgroup.attribute("name");
switch (groupname)
{
case "Spawn":
for each (var object:XML in objectgroup.object)
{
var objectname:String = objectgroup.object.attribute("name");
trace(objectname)
switch (objectname)
{
case "Hero":
FP.world.add(new Hero(new Point(int(object.@x * 8), int(object.@y * 8))));
break;
case "Goblin_Thief":
FP.world.add(new Goblin_Thief(new Point(int(object.@x * 8), int(object.@y * 8))));
break;
default:
trace("no spawns")
}
}
}
}
XML file:
<object name="Wooden" x="160" y="80" width="16" height="16"/>
</objectgroup>
<objectgroup name="Spawn" width="15" height="9">
<object name="Hero" x="32" y="96" width="16" height="16"/>
<object name="Goblin_Thief" x="112" y="80" width="16" height="16"/>
</objectgroup>```
The trace gives me "HeroGoblin_Thief" twice, not "Hero" then "Goblin_Thief". Why is this? It's driving me insane, I can't spawn the enemy and hero anymore. I have no idea why this happened. It worked previously!