Skip to content

Tile Set Definitions

Stefan Beller edited this page Oct 4, 2012 · 2 revisions

Tile set definitions are stored in the mods/[mod-name]/tilesetdefs/ folder.

There are five types of lines which look like this:

# cave/mines tile set
img=tileset_cave.png
transparency=255,0,255
tile=16,0,0,64,32,32,16
animation=16;0,0,3;64,0,3;128,0,3

Comments begin with a # symbol. These should be on a line by themselves.

img refers to a tile set image. All the tiles for a single tile set are packed into one image. A tilesetdef file should only have one img entry. The path of this file is assumed to be mods/[mod-name]/images/tilesets/

transparency notifies the engine that this RGB color is the transparency color key. If omitted, the engine assumes by default that the tile set has alpha transparency (or no transparency).

tile specifies where one tile is on the image. The data is as follows:

tile=[index],[left_x],[top_y],[width],[height],[offset_x],[offset_y]

tile entry diagram

  • index is the unique (to this tile set) integer index for this tile. This index is used in map layers (background and object). Indexes from 1 through 1023 are allowed (0 is reserved for "empty").
  • (left_x,top_y) are the top-left coordinates of the tile.
  • (width,height) are the dimensions of the tile.
  • (offset_x,offset_y) describes the drawing offset of the tile, relative to (left_x,top_y). These can be negative. The offset point of the tile matches the exact center point of the grid square. E.g. in a typical 64x32 isometric tile, the offset is 32,16.

animation is optional and specifies the animated frames for one tile. The data is as follows:

animation=[index],[left_x],[top_y],[duration];[left_x],[top_y],[duration]

The block of x,y,duration can be repeated (up to 64 tiles for one tile). These x,y values represent the top corner of the new frame of animation. The frame size and display offset are assumed to be the same as the base tile (specified in the matching tile= line). Duration is how long to display this animation frame, in number of screen frames. A 0 duration on a frame will cause the animation to stop on that frame; otherwise the animation will loop.

Using Tile Sets

Tile sets are specified in the headers of map files. Example:

tileset=tileset_cave.txt
Clone this wiki locally