Being primarily a programmer I wanted to have a flexible level editor for my game. I decided to use tiled for the purpose.
The game is platformer which relies only on flicks for jump and no on screen buttons(flickformer). The game is built with libgdx with physics using box2d. Tiled as such provides these functionalities
1) Tiled layer – Make a tiled level, which can be rendered in game.
2) Image layer – Background image
3) Object layer – to generated shapes in your box2d world.
Things I wanted from my level editor
1) Tiled images should dictate the physics world, i.e no additional shape drawing
2) Dynamic actors also should be part of the level editor. Say a moving enemy.
3) Customization for dynamic actors
To make images dictate the physics world, I used the properties functionality of a Tile (right click on a tile and add properties) to name the physical shape. Ex: TOP_RECT, FULL, RIGHT_SLIDE etc
This way any changes in level design can be done solely using images.
To make dynamic actors I dedicated a layer which is not render in the game, but during level load this layer is passed through and any dynamic actors needed on generated.
Ignore the rendering in code of a layer if it has a property “hide”. Lets call this layer “others”.
Customization is acheived using either additional layer on adjacent tiles on “others” layer. So to make a enemy move right for 5 block, I put the enemy in 5 blocks the direction is given by the tile’s property.
If I have some specific property like speed of the enemy they are via “others” layer properties. To make a enemy chain – periodically generating an enemy, I have an additional layer “spawn” if this layer has the same tile as “others” layer
then I make that enemy instance a periodic one. (check the attached video for periodic enemy).
The entire map can also have properties, I use this to select camera type, level type (basic, runner etc),music, background image (libgdx’s tiledmaprenderer doesn’t support image layer yet).
Doing this allows me to achieve most of what I wanted.
I am attaching the image from Tiled Map editor and a video of me trying out that level. (There are some bugs like enemy animation etc). Click on image to see it properly
The video of this level is here
Making physical shape depend on tile means that a platform on 10 blocks will be 10 shapes, whereas making a single shape of size 10 is much more optimal. This optimization can be done via code, but I haven’t tried it yet.
One thing I miss is the functionality to add properties at a cell level. So two instances of the same enemy will have to share the same speed.
I know most of this might seem trivial but this has sure made level design easier for me, is there some techniques that you prefer? please let me know.