Hi guys,
I'm making a small platformer and planned on using Ogmo Editor to create my levels. Ogmo gives me the XML document, but for some reason I can't recreate the level. I've included images of the OEL file and my result vs the ogmo result. Also when I trace the length or crack ofr levelArray I get 887 instead of 864 (36x24).
ActionScript Code:
public function createLevel(levelID,s):void
{
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("Level11.oel"));
function LoadXML(e:Event):void
{
levelXML = new XML(e.target.data);
xmlFilter = levelXML.*
for each (var levelTest:XML in levelXML)
{
crack = levelTest;
}
levelArray = crack.split('');
count = 0;
for(i = 0; i <= 23; i++)
{
for(j = 0; j <= 35; j++)
{
if(levelArray[i*36+j] == 1)
{
block = new Platform;
s.addChild(block);
block.x = j*20;
block.y = i*20;
count++;
trace("i ", i);
trace("blockX ",block.x);
trace("j ",j);
trace("blockY ",block.y);
}
}
}
trace("count ",count);
}