Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-23-2012, 09:13 PM   #1
inzombiak
Registered User
 
Join Date: Mar 2012
Posts: 6
Default Importing data from a XML to create a level

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
Click image for larger version

Name:	Untitled-1.jpg
Views:	24
Size:	199.1 KB
ID:	38564   Click image for larger version

Name:	Capture.JPG
Views:	26
Size:	68.3 KB
ID:	38565  
inzombiak is offline   Reply With Quote
Old 06-24-2012, 01:20 AM   #2
inzombiak
Registered User
 
Join Date: Mar 2012
Posts: 6
Default

Solved: I had an "/n" at the end of each line.
inzombiak is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:48 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.