API Docs for:
Show:

gs.TilesetConfiguration Class

A tileset configuration is used for gs.Tilemap to describe the structure of the tileset. For more info, check out the "Tilemaps" chapter in "Scripter's Guide" in help-file.

Constructor

gs.TilesetConfiguration

(
  • tileSize
)

Parameters:

  • tileSize Number
    • The size of a single tile on the tileset. A single tile needs to be quadratic so a value of 32 means 32x32 pixels. If omitted, a value of 32 is used.

Properties

@specialTileSize

gs.Rect

Defines the size of a special/animated tile. For normal animated tiles, this size is just the regular tile size. But for auto or terrain tiles, this is the size of the expanded auto/terrain-tileset and not of a single tile.

This setting is important to animate auto / terrain tiles correctly. The width is used as the animation-offset.

Default: { width: tileSize*8, height: tileSize*6 }

animationFrames

Number

Number of animation frames for animated tiles.

Default: 4

expandedSize

gs.Size

The internal tileset size. The original tileset will be copied into the internal tileset at the position defined in regularTiles area. That only happens if useOriginalTileset is set to false.

Default: { width: 2048, height: 2048 }

expandedSize

gs.Rect

The original tileset will be copied into the internal tileset at the position defined here. That only happens if useOriginalTileset is set to false.

Default: { 0, 0, tileSize * 8, tileSize * 64 }

invisibleTileId

Number

The tile-id used for invisible tiles. Its recommended to use the invisible tile id for non-visible tiles instead of choosing a random transparent tile on the tileset because it safes performance.

Default: 32767

specialTiles

gs.Rect

Defines the area on the tileset used for special tiles such as auto/terrain or animated tiles. It is important that the y-coordinate of this area is always 0 and the height should match the tileset height or should be dividable by the special tile height.

Only the x-coordinate and width can be configured. The more the x-coordinate is moved to the right, the the more space becomes available for regular tiles. But in exchange for that, the space for animation-frames becomes less. So if you don't use animated tiles at all, you can move the x-coordinate completely to right.

There is technically no difference between an auto/terrain or animated tile. Only one kind of special tiles is supported per tileset. For Example: If you decide to use auto/terrain tile taking 256x192 pixels in expanded state, you cannot have 32x32 animated tiles in addition. In that case, your animated tiles need to be auto/terrain tiles as well with 256x192 offset per animation frame. That kind of limitation is necessary for optimization on mobile devices.

Default: { tileSize * 8, 0, tileSize * 8 * 4, tileSize * 6 * 10 }

useOriginalTileset

Boolean

Indicates if no internal tileset should be created and the original tileset image should be used as is. In that case, the expandedSize, regularTiles and specialTiles properties have no effect. In addition, gs.Tilemap.autotiles are ignored too and no autotile expansion will happen. You have to prepare the original tileset image yourself.

Notice that this is set to true by default.

Default: true