00:00
00:00
Newgrounds Background Image Theme

renatocfrancisco just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

AS3 level creation

507 Views | 4 Replies
New Topic Respond to this Topic

AS3 level creation 2013-04-23 17:46:44


so i've been looking into tutorials into creating levels through as3 programming, it wouldve been easier if i was using one of adobe's products, but alas im just a poor boy, so i have been using flash develop, which is not bad i have to say, but since it doesnt use a GUI i have been helpless. i tried using Tiled, but i just cant get XML parsing, so i would appreciate if someone would explain a simple way of parsing xml into as3, the tutorials i have found help but im having a hard time trying to find a simpler version. this is for me to create simple levels so i can test out game elements, i will be looking forward to mastering this parsing buisness, so to repeat myself help with simple level creation would be appreciated.
thank you

Response to AS3 level creation 2013-04-23 20:53:51


I'd suggest using a framework like Flixel to make small games with tile based levels, that what I did for a long time using only FlashDevelop and made a level editor for each of my games. You'll want to do some kind of blitting which is another reason to use a framework as adding a new Sprite for each tile is going to bog you down really hard really fast.


If ya have something to say, PM me. I have a lot of time to spare.

Also never PM egg82.

BBS Signature

Response to AS3 level creation 2013-04-23 23:32:48


I'll do a quick explanation of parsing here, but I'm planning on doing a more in-depth one after my exams (sometime next week), along with blitting and some other stuff.

Imagine a tile-based level. In the XML, let's say 0 is a ground tile, 1 is the sky or something, 2 is a coin, etc. Your XML would look something like

<data>
   <level id = "Level 1">
      <r>11111</r>
      <r>11211</r>
      <r>00000</r>
   </level>
</data>

So embed the XML however. Then you want to access xml.level, which returns an XMLList (an array) of each element that is named "level." Use a currentLevel variable or something to keep track of which element to access. From here:

xmlList[currLevel].@id is "Level 1" use @ for attributes
xl[currLvl].r is another XMLList of all the r's (rows, can be any name) within this level
xl[currLvl].r[0] is the first row - "11111" so loop through those

The stuff within the @attributes in the XML file are strings, and the stuff within each element is XMLText or whatever, so you'll have to use toString() and int(x) a lot to get actual numbers and usable strings out.

Response to AS3 level creation 2013-04-24 12:17:06


At 4/23/13 08:53 PM, MintPaw wrote: I'd suggest using a framework like Flixel to make small games with tile based levels.:

hmm yea i might go back to trying to work out flixel.

Response to AS3 level creation 2013-04-24 12:18:17


At 4/23/13 11:32 PM, MSGhero wrote: I'll do a quick explanation of parsing here, but I'm planning on doing a more in-depth one after my exams (sometime next week), along with blitting and some other stuff.

looking forward to it plus good luck