class flixel.addons.editors.ogmo.FlxOgmoLoader

Available on all platforms

Instance Fields

function new(LevelData:Dynamic):Void

Creates a new instance of OgmoLevelLoader and prepares the XML level data to be loaded. * This object can either be contained or ovewritten. * * IMPORTANT: -> Tile layers must have the Export Mode set to "CSV". * -> First tile in spritesheet must be blank or debug. It will never get drawn so don't place them in Ogmo! * (This is needed to support many other editors that use index 0 as empty.) * *

LevelData

A String or Class representing the location of xml level data.

function loadEntities(EntityLoadCallback:String ->Xml ->Void, ?EntityLayer:String = 'entities'):Void

Parse every entity in the specified layer and call a function that will spawn game objects based on their name. * Optional data can be read from the xml object, here's an example that reads the position of an object: * public function loadEntity( type:String, data:Xml ):Void { switch (type.toLowerCase()) { case "player": player.x = Std.parseFloat(data.get("x")); player.y = Std.parseFloat(data.get("y")); default: throw "Unrecognized actor type '" + type + "' detected in level file."; } } * *
EntityLoadCallback

A function that takes in the following parameters (name:String, data:Xml):Void (returns Void) that spawns entities based on their name. *

EntityLayer

The name of the layer the entities are stored in Ogmo editor. Usually "entities" or "actors"

function loadRectangles(RectLoadCallback:FlxRect ->Void, ?RectLayer:String = 'rectangles'):Void

Parse every 'rect' in the specified layer and call a function to do something based on each rectangle. * Useful for setting up zones or regions in your game that can be filled in procedurally. * *

RectLoadCallback

A function that takes in the Rectangle object and returns Void. *

RectLayer

The name of the layer which contains 'rect' objects.

function loadTilemap(TileGraphic:Dynamic, ?TileWidth:Int = 16, ?TileHeight:Int = 16, ?TileLayer:String = 'tiles'):FlxTilemap

Load a Tilemap. Tile layers must have the Export Mode set to "CSV". * Collision with entities should be handled with the reference returned from this function. Here's a tip: * // IMPORTANT: Always collide the map with objects, not the other way around. // This prevents odd collision errors (collision separation code off by 1 px). FlxG.collide(map, obj, notifyCallback); * *
TileGraphic

A String or Class representing the location of the image asset for the tilemap. *

TileWidth

The width of each individual tile. *

TileHeight

The height of each individual tile. *

TileLayer

The name of the layer the tilemap data is stored in Ogmo editor, usually "tiles" or "stage". *

returns

A FlxTilemap, where you can collide your entities against.