Worldmaps are technically optional, but a highly recommended part of most levelsets. A worldmap enables a levelset to branch out into alternative level choices and gives the player a chance to replay levels that have already been won.
Table of Contents
- Worldmap Properties
- Worldmap Construction
A new copy of data/worldmaps/base.json will be the size of one screen, empty, and have its music set to "salcon.ogg".
To change the size, simply resize the map to the desired size. Every screen is 25 tiles wide and 14 tiles tall.
Unlike levels, worldmaps do not have special backgrounds defined. The background color is used if no tile is available. The background color of data/worldmaps/base.json is a color suitable for use as water.
The music used for the worldmap is specified by the custom "music" map property. This should be the exact file name of one of the files found in data/music. If another file exists with the same name, but with "-start" at the end of the base file name (before the extension), then ReTux considers that file to be the start of the music and plays it once before playing the indicated file.
It is possible to include a custom music file with a level set. If you do this, please make sure the file name is reasonably unique so that your custom music does not conflict with another level set's custom music. It is also possible to make the worldmap not play music by deleting the existing "music" custom property.
Constructing a worldmap consists of three tasks: designing the look of the worldmap, placing map objects, and specifying the layout of the worldmap.
The look of the worldmap is customized by placing tiles. Tiles are found in any tileset which is not defined as a particular object. They have no effect on the game other than appearance. data/worldmaps/base.json comes with five tile layers (named for their intended purposes for the sake of convenience), but you can add more tile layers if needed.
Map objects are found in the "map_objects" tileset. These objects consist of the player, level spaces, warp spaces, and water, respectively.
Every map must have a player object. It should be placed in the intended starting position on the map, on the "Objects" layer. If a levelset starts on this map, its position is where the player will be located.
Level spaces and warp spaces should be placed in the "Spaces" layer. All spaces can optionally have the following custom properties defined:
- "level": Indicates the name of a file found in data/levels which corresponds with the space. In the case of a level space, the level defined must be completed at least once before the player is allowed to move through the space. In the case of a warp space, the level must be completed each time the warp space is used; it can be completed either by winning the level, or by warping to "__map__". Level spaces with no level defined are invisible and can simply be passed through, while warp spaces with no level defined cause the player to warp to their destination immediately when "entered".
- "level_spawn": Indicates the spawn point within the level to start the player at, overriding the level's own settings.
- "ID": Indicates the ID of the space, used by warp spaces and save files. If this is undefined, an ID will automatically be chosen.
Warp spaces should also have the custom "dest" property defined. This indicates the other warp space it should cause the player to warp to. It should be a string in the form of "mapname:id", where "mapname" is the file name of the worldmap located in data/worldmaps, and "id" is the ID of a space within that worldmap.
Water is simply an animated water tile. It has no effect on the game and should be placed as a tile generally in the "Water" tile layer.
The layout of the worldmap is specified by drawing polylines in the "map_path" layer. These polylines should be in the top-left corner of the road tiles and map objects they correspond to. Each polyline should be drawn from the earlier level to the later level that it leads to. Where the path goes between the starting level and the destination level does not matter, but note that the initial direction the player moves out of determines what direction key the player uses to start moving along the path, and there are only four such directional keys (left, right, up, and down). Paths that start diagonally will work, but two paths that start diagonally in the same direction will conflict with each other when the player attempts to move in that direction, and only one of them will be followed.
The direction a path is drawn in specifies the "forward" direction. This information is used to define what the "sneak" key does.
It is possible for a path to lead to or from an empty area on the map. This is useful if you want to create a fork in the road.