Skip to content

Level Editor Guide

Kevin Prehn edited this page Aug 2, 2018 · 7 revisions

Levels in the game are created in Tiled and then converted to a JSON level file, which has a format specific to the game.

Why have Tiled map files built to JSON? Why not just read Tiled files directly? We eventually want to create a level generator, and making levels defined in easier to define JSON files make it so any program that can generate a JSON file can also generate level files.

Creating a Level

Levels are made by first creating them in Tiled and then converting the map file into a JSON level file using the TiledToJson.rb ruby script or TiledToJson.exe executable.

Make sure you have Tiled installed. Open it up and click New Map.... Make sure Orientation is Orthogonal, the Tiled layer format is CSV, the Tile render order is Left Up, and the Tile size is 64x64px. The map size does not matter, so make it as large or small as you would like. Currently, the script does not support infinite maps.

tiled tutorial image 1

Only Object Layers are used by the conversion file, so feel free to remove the default Tile layer. The number of object layers does not matter, so feel free to use as many of them as you want to organize the level.

tiled tutorial image 2

All objects should be Rectangles when you're adding them to the level. All objects, except for Ground, must be a specific size (usually a 1x1 unit block).

tiled tutorial image 3

The Type property in Tiled will determine what kind of object it is turned into in the conversion script. If the type property is not set correctly, it will not show up in the converted JSON level file. Some objects also need the Name property or custom properties to be set for special behavior. The table on the bottom of this page will say what properties need to be set for each type of object.

This screenshot shows an example of the properties for a single-linked list platform.

!tiled tutorial image 4

Once you have created the level file, you can build the JSON level file from it. Every level MUST have a Player, Goal, StartLinkBlock, and HelicopterRobot object. Below is a sample level.

tiled tutorial image 5

Adding Win Conditions

Levels with Objective Blocks will have the objective blocks fade in or out depending on whether the player has fulfilled the level's win condition or not. By default, levels have no win condition.

Building a JSON Level File from a Tiled File

When you have a Tiled level file created, you may then convert/built it into a JSON level file using the TiledToJson.rb ruby script or TiledToJson.exe executable.

First, place the file into a directory with the TiledToJson.rb script or executable.

tiled tutorial building 1

Run the following command in the same directory as the level file and the script.

ruby TiledToJson.rb tutorial_making_map.tmx tutorial_making_map.json

If there is an error, make sure that the level has a Player, Goal, StartLinkBlock, and HelicopterRobot object, and that any objects which refer other objects don't have names or properties that are misspelled. If it is successful, it will create a new JSON level file.

tiled tutorial building 2

This JSON level file can be given to the WorldGenerator object. If you add it to the list of files then the level will be generated in the game.

tiled tutorial building 3

Creating New Instruction Panels

TODO

Level Editor References Guide

This table tells you what the Type filed of an object in Tiled should be for it to be converted to the proper game object for the script.

Object Type Other properties
TODO TODO TODO

TODO