-
Notifications
You must be signed in to change notification settings - Fork 41
Tile Set Definitions
Tile set definitions are stored in the mods/[mod-name]/tilesetdefs/ folder.
There are four types of lines which look like this:
# cave/mines tile set
img=tileset_cave.png
alpha_background=1
tile=16,0,0,64,32,32,16
Comments begin with a # sign. 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/
alpha_background notifies the engine that this image uses an alpha layer (if set to 1). If omitted, the engine assumes image is using RGB(255,0,255) to represent 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]
- 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 Anchor Point of the tile, relative to (left_x,top_y). These can be negative.
The Anchor Point of a tile, when drawn on a grid, matches the exact center point of a grid square. In a typical 64x32 isometric tile, the Anchor Point is at 32,16.
Tile sets are specified in the headers of map files. Example:
tileset=tileset_cave.txt
Alpha background should probably be the engine default. Instead, we should allow a tilesetdef to specify the transparency color. Example: transparency=255,0,255
At some point we'll introduce animated tiles. For each tile index we'll have a way to specify multiple tile-image locations on the image, along with the animation speed.