Skip to content

Instantly share code, notes, and snippets.

@01010111
Created June 11, 2019 16:05
Show Gist options
  • Save 01010111/514e8ea3a542879f0d7360431ba70be3 to your computer and use it in GitHub Desktop.
Save 01010111/514e8ea3a542879f0d7360431ba70be3 to your computer and use it in GitHub Desktop.
Example of using OgmoUtils class
using OgmoUtils;
class OgmoExample
{
public function new(level_json:String)
{
var data = level_json.parse_level_json();
var tile_layer = data.get_tile_layer('tiles');
trace(tile_layer.data2D);
var entity_layer = data.get_entity_layer('entities');
entity_layer.load_entities(entity_loader);
}
function entity_loader(e:EntityData)
{
switch e.name {
case 'player': trace('make new player at ${e.x}, ${e.y}');
default: return;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment