Jump to content

Using Ogmo Editor with Phaser?


JordanMagnuson
 Share

Recommended Posts

Hi, I'm new here, and looking to get into HTML5 game development. I've written a few games in AS3 using the FlashPunk framework that I'd like to port to Phaser. Along with FlashPunk, I've used Ogmo Editor to create xml tilemaps for my AS3 games. 

 

My question is, is there any way to get Phaser to read an Ogmo generated level file, or any way to convert the Ogmo files to be compatible with Phaser? If possible, I'd rather not recreate all my levels using the Tiled editor (which I've read is compatible with Phaser, correct?) if I don't have to...

Link to comment
Share on other sites

Ogmo is a pretty simple editor, and the level files are straightforward xml, so the data is quite easy to parse. It would be awesome if Ogmo support could be added to Phaser... I know that Ogmo is used by a decent number of Actionscript programmers, especially within the Flashpunk community. For me, it would definitely be another reason to choose Phaser over some of the other html5 frameworks.

 

For a sample Ogmo level file see http://pastebin.com/EDe8cdic

 

Not sure how level loading is handled by Phaser, but in Flashpunk I would load that level within a "world" class using something like:

 

public function loadLevel(file:Class):void{// load the level xmlvar bytes:ByteArray = new file;level = new XML(bytes.readUTFBytes(bytes.length));// load level informationwidth = level.width;height = level.height;// load sittersfor each (var o:XML in level.actors.sitter)add(new Sitter(o.@x, o.@y));// load mixersfor each (o in level.actors.mixer_center)add(new MixerCenter(o.@x, o.@y)); for each (o in level.actors.mixer)add(new Mixer(o.@x, o.@y)); // load orbitersfor each (o in level.actors.orbiter_center)add(new OrbiterCenter(o.@x, o.@y)); for each (o in level.actors.orbiter)add(new Orbiter(o.@x, o.@y)); // load jumpers for each (o in level.actors.jumper)add(new Jumper(o.@x, o.@y));// load marchers for each (o in level.actors.marcher)add(new Marcher(o.@x, o.@y)); } 

 

Link to comment
Share on other sites

Well, I emailed Matt (Ogmo Editor creator) about a spec doc, and his reply was:

 

There's no spec but the files are super simple and made to be human-readable. If you just open some up it will be apparent really quickly how they work :)

 

I'm guessing you could figure out the file format in a few minutes playing with the editor, but I know that's not super convenient. Would it be helpful if I compiled a list of a few sample files?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...