2.8.0
.Constructor
new(projectData:String, levelData:String)
Creates a new instance of FlxOgmo3Loader
and prepares the level and project data to be used in other methods
Parameters:
projectData | The path to your project data ( |
---|---|
levelData | The path to your level data ( |
Methods
getLevelValue(value:String):Dynamic
Get a custom value for the loaded level.
Returns null
if no value is present.
loadDecals(decalLayer:String = "decals", decalsPath:String):FlxGroup
Loads every decal in a decal layer into a FlxGroup.
IMPORTANT: All decals must be included in one directory!
Parameters:
decalLayer | The name of the layer the decals are stored in Ogmo editor. Usually |
---|---|
decalsPath | The path to the directory in which your decal assets are stored. |
loadEntities(entityLoadCallback:EntityData ‑> Void, entityLayer:String = "entities"):Void
Parse every entity in the specified layer and call a function that will spawn game objects based on its entity data. Here's an example that reads the position of an object:
function loadEntity(entity:EntityData)
{
switch (entity.name)
{
case "player":
player.x = entity.x;
player.y = entity.y;
player.custom_value = entity.values.custom_value;
default:
throw 'Unrecognized actor type ${entity.name}';
}
}
Parameters:
entityLoadCallback | A function with the signature |
---|---|
entityLayer | The name of the layer the entities are stored in Ogmo editor. Usually |
loadGridMap(gridLayer:String = "grid"):Map<String, Array<FlxPoint>>
Loads a Map of FlxPoint
arrays from a grid layer. For example:
var gridData = myOgmoData.loadGridMap('my grid layer');
for (point in gridData['e'])
addSpawnPoint(point.x, point.y);
loadTilemap(tileGraphic:FlxTilemapGraphicAsset, tileLayer:String = "tiles", ?tilemap:FlxTilemap):FlxTilemap
Load a Tilemap. Collision with entities should be handled with the reference returned from this function.
IMPORTANT: Tile layers must export using IDs, not Coords!
Parameters:
tileGraphic | A String or Class representing the location of the image asset for the tilemap. |
---|---|
tileLayer | The name of the layer the tilemap data is stored in Ogmo editor, usually |
tilemap | (optional) A tilemap to load tilemap data into. If not specified, new |
Returns:
A FlxTilemap
, where you can collide your entities against.
loadTilemapExt(tileGraphic:FlxTilemapGraphicAsset, tileLayer:String = "tiles", ?tilemap:FlxTilemapExt):FlxTilemapExt
Load a FlxTilemapExt
, which supports additional features such as flipped and rotated tiles.
Collision with entities should be handled with the reference returned from this function.
IMPORTANT: Tile layers must export using IDs, not Coords!
Parameters:
tileGraphic | A String or Class representing the location of the image asset for the tilemap. |
---|---|
tileLayer | The name of the layer the tilemap data is stored in Ogmo editor, usually |
tilemap | (optional) A tilemap to load tilemap data into. If not specified, new |
Returns:
A FlxTilemapExt
, where you can collide your entities against.
2.10.0
.