A haxe/flixel library that makes loading and manipulating DAME levels easy.
Switch branches/tags
Nothing to show
Pull request Compare This branch is even with migimunz:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
chxdoc-templates
docs
src
LICENCE
Makefile
README.md
application.build
application.nmml
gitignore

README.md

#About

LevelTools is a haxe/flixel library that makes loading and manipulating flixel tilemaps easy (or at least easier). This library is written to work with Beeblerox' HaxeFlixel port. It provides utility classes for loading level data from DAME and Tiled Map Editor, as well as extension methods for iterating tiles in tilemaps.

#Targets

So far, the library has been tested with neko, native linux and windows and flash targets. However, it should support all platforms supported by HaxeFlixel.

#How to build/install

With haxelib:
haxelib install LevelTools

Building documentation, requires chxdoc:
make docs

Installing with haxelib locally:
make lib testlib

Otherwise, there is nothing to build, just include the library sources in your classpath.

#Demos

Demos can be found here.

#Features

  • Loading levels exported from DAME. Supports:
    • Tilemap layers
    • Sprite layers
    • Path layers (at this point, one path per layer, due to a problem with naming individual tiles)
    • Links between sprites
    • Properties for all objects except individual tiles
  • Loading levels exported from Tiled Map Editor, experimental, wouldn't recommend using it at this point.
  • Tilemap iterators
  • Convenience extension methods for iterating, filtering and replacing tiles

#Examples

Loading a DAME level and retrieving individual layers:


level = DameLevel.loadLevel(
	Assets.getText("assets/DameProject/Level_DemoLevel1.xml"), //XML file exported from DAME
	"assets/", //Assets directory
	true //Add the level to the state when loaded
	);
var mainTilemap = level.getTilemap("MainTilemap");
var spriteLayer = level.getLayer("SpriteLayer");

Iterating a tilemap with a for loop:


using org.ivar.leveltools.LevelTools; //imports the extension methods
/* ... */

for(tileId in mainTilemap.iterAll())
{
	trace(tileId);
}

Alternatively, using each* methods provides more information and easier modification of the tilemap:


private var flowerId = 5;
/* ... */
//Adds variation by randomly changing the first flower tile to different flowers.
mainTilemap.eachWithId(flowerId, function(data:TileData) {
	data.tilemap.setTile(data.x, data.y, FlowerId + Std.random(3));
});