Level editing

New levels can be created using Tiled.

Take a look at the existing level files in the editor, e.g. games/droids/arena1.tmx

The levels are composed of 16x16 pixel tiles. The maximum size is currently 26x16 tiles, since scrolling is not supported. If you make smaller levels the size of the UI will increase to fill some of the empty space.

Map properties

Click Map menu, then Map Properties to edit the Custom Properties of the map. The following are supported:

PropertyTypeDescription
openTop Boolean If true, the level wraps around at the top of the screen.
openLeft Boolean If true, the level wraps around at the left of the screen.
openRight Boolean If true, the level wraps around at the right of the screen.
openBottom Boolean If true, the level wraps around at the bottom of the screen.

Layer and Tile properties

These properties can be assigned to individual tiles, or to entire layers (in which case they apply to all tiles in the layer).

PropertyTypeDescription
blocked Boolean If true, tile blocks all movement.
characterBlocked Boolean If true, tile blocks movement of characters but allows bullets to pass through.
destructable Boolean If true, the tile can be destroyed.

Objects

The object layer contains objects rather than tiles, but each object should be a square of the same size as a tile. The type field of the object can take these values:

TypeDescription
playerspawn Player characters will spawn from this point. If there are insufficient spawn points, players will not spawn until one becomes free. There must always be at least one spawn point.
cratespawn Crates will spawn at this point. If there are none of these points then crates will spawn at random points.
code Invoke a function from a Groovy script. The script must have the same name as the level. The name of the function must be put in the invoke property of this object. The function will be called and passed the (x,y) coordinates of the object.

For example, to spawn a Trap entity, if the level is mylevel.tmx the script must be in mylevel.groovy. Make a code type object in Tiled and give it an invoke property set to trap. Then define a function in the script file: def trap(x, y){ new Spawner(world)archetype.create(x, y)}

There are several examples of these scripts in the tutorial levels.