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); }
Attached Thumbnails
Importing data from a XML to create a level
Monday, June 25, 2012
[Action Script] Importing data from a XML to create a level June,2012
Posted by Bimo Hery Prabowo at 3:13 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment