Skip to main content

Module tilemap

Module tilemap 

Source
Expand description

Tile map is a 2D “image”, made out of a small blocks called tiles. Tile maps used in 2D games to build game worlds quickly and easily. See TileMap docs for more info and usage examples.

Modules§

brush
Tile map brush is a set of tiles arranged in arbitrary shape, that can be used to draw on a tile map. A brush resembles a tile set in that they are both collections of tiles, but they are distinct because a brush can be freely organized to suit whatever is most convenient while editing a tile map. The tiles of a brush can be moved at any time without consequence, and so can the pages. A brush is like a painter’s toolbox, where the sole purpose is to serve the painter’s convenience.
tileset
Tile set is a special storage for tile descriptions. It is a sort of database, that contains descriptions (definitions) for tiles. Tiles are organized into pages. Each page has particular (x,y) coordinates and each tile within the page has its own (x,y) coordinates, so finding a tile requires two pairs of coordinates (x,y):(x,y), which is called a TileDefinitionHandle.

Structs§

ChangeFlag
A record whether a change has happened since the most recent save.
CustomTileCollider
Triangle data for a tile collider arranged in rectangle from (0,0) to (1,1). Custom tile colliders can be converted to and from strings, where the strings contain 2D vertex positions and triangle index triples. A group of two numbers is taken to be a 2D vertex position while a group of three numbers is taken to be an index triple, and the numbers are therefore parsed as ints. For example, “0,0 1,1 1,0 0,1,2” would be a valid string for a custom tile collider. The commas (,) are used to connect two numbers as being part of the same group. Any other characters are ignored, so this would also be accepted: “(0,0) (1,1) (1,0) [0,1,2]”.
Iter
Iterator for OrthoTransformMap.
Keys
Keys iterator for OrthoTransformMap.
MacroTilesUpdate
This is a step in the process of performing an edit to a tile map when macros are involved. It contains the tiles to be written and the positions within the brush that the tiles were taken from. It is constructed from a TransTilesUpdate by applying the transformation to the tiles. A None indicates that the tile is to be erased.
OptionRectIter
Iterator for the cells contained in an OptionTileRect.
OptionTileRect
An option version of TileRect that contains nothing.
OrthoTransformMap
A map from Vector2<i32> to values. It can be transformed to flip and rotate the positions of the values.
OrthoTransformation
The amount of an orthogonal transformation. The tranformation either includes an optional initial x-flip that turns (1,0) into (-1,0), or not. Following the optional flip, the object being transformed is rotated counter-clockwise by some number of right-angle turns: 0, 1, 2, or 3. Multiple transformations can be chained together for arbitrary sequences of x-flips, y-flis, clockwise and counter-clockwise rotations.
PartialRandomTileSource
A tile source that produces a random tile from the included set of tiles.
PatternBits
PatternBits represents a tile’s pattern as a 3x3 grid of i8 values for doing autotiling in 2D with Vector2<i32> positions. The center of the 3x3 grid is called the pattern’s terrain. The 8 values around the outside of the grid are called the pattern’s peering bits.
RandomTileSource
A tile source that produces a random tile from the included set of tiles.
RectIter
Iterator for the cells contained in a TileRect.
RepeatTileSource
A tile source that adapts another source so that it infinitely repeats the tiles within the given rect.
RotTileHandle
A stamp element plus the transformation of the Stamp where the element is taken from, allowing the stamp element itself to be later transformed before it is applied to a tile map, tile set, or brush.
SingleTileSource
A tile source that always produces the same tile.
Stamp
A set of tiles and a transformation, which represents the tiles that the user has selected to draw with.
StampElement
Each cell of a stamp must have a tile handle and it may optionally have the handle of a brush cell where the tile was taken from.
Tile
Tile is a base block of a tile map. It has a position and a handle of tile definition, stored in the respective tile set.
TileCursorEffect
Renders a rectangle of the given material at the given position in the tile map.
TileDefinitionHandle
Position of a tile definition within some tile set
TileDefinitionHandleParseError
An syntax error in parsing a TileDefinitionHandle from a string.
TileEraseEffect
Sets the tiles at the given positions to invisible.
TileGridMap
A 2D grid that contains tile data.
TileIter
Adapt an iterator over positions into an iterator over (Vector2<i32>, TileHandleDefinition).
TileMap
Tile map is a 2D “image”, made out of a small blocks called tiles. Tile maps used in 2D games to build game worlds quickly and easily. Each tile is represented by a TileDefinitionHandle which contains the position of a page and the position of a tile within that page.
TileMapBuilder
Tile map builder allows you to create TileMap scene nodes.
TileMapData
Asset containing the tile handles of a tile map.
TileMapDataIterator
Iterator over the tiles of a TileMapData in the form of (position, handle).
TileMapDataRef
A reference to the tile data of a some tile in a tile set.
TileMapRenderContext
Context for rendering tiles in a tile map. It is especially used by TileMapEffect objects.
TileOverlayEffect
Draws the given tiles with the given offset, and sets the drawn tile positions to invisible so that no other tiles will be drawn there.
TileRect
This is a variation of Rect that is specifically designed for use with TileMap. While the y-axis of Rect points downward to match the y-axis of UI, the y-axis of TileRect points upward to match the y-axis of TileMap, TileSet, and TileMapBrush.
TileRegion
A region of tiles to be filled from some source of tiles.
TileRenderData
The specification for how to render a tile.
TileSelectionEffect
Renders borders of the given material around the given positions in the tile map.
TileSetAutoTileContext
This is a specialization of AutoTileContext for use with a TileSet. The pattern of each tile is taken from the values of a nine-slice property, and TileDefinitionHandle is used to represent individual tiles.
TileSetAutoTiler
Autotiler for the tiles of a TileSet that uses the nine-slice values of one of the tile set’s properties as the auto-tiler’s pattern.
TileSetPatternSource
An object that wraps a tile map, a tile set, an update, and the UUID of the property that is used to store the pattern of each tile, and then provides access to the pattern at any cell. It looks for the cell’s handle in the update, then in the tile map, and then uses the tile set to find the pattern.
TileSetUpdate
This represents a change to some pages of a tile set, without specifying which tile set.
TileSetWfcConstraint
A hash table based wave function collapse constraint that maps PatternBits objects to sets of TileDefinitionHandle. Each handle refers to a tile, and each tile is assigned a pattern and a frequency. The sum of the frequencies of all a pattern’s tiles becomes the frequency of the pattern, which is then normalized into a probability between 0.0 and 1.0 for use as a constraint for a TileSetWfcPropagator which will perform the wave function collapse.
TileSetWfcPropagator
Wave function collapse propagator for the tiles of a TileSet that uses the nine-slice values of one of the tile set’s properties as the wave function’s pattern.
TileUpdateEffect
Uses the given tile update to render the replacement tiles and make the erased tiles invisible.
TileVertex
A vertex for tiles.
Tiles
A set of tiles.
TilesUpdate
A set of changes to a set of tiles. A value of None indicates that a tile is being removed from the set. A None indicates that the tile is to be erased.
TransTilesUpdate
This is a step in the process of performing an edit to a tile map, brush, or tile set. It provides handles for the tiles to be written and the transformation to apply to those tiles. A None indicates that the tile is to be erased.
TransformSetCell
TransformSetCell represents a position within a transform set page and the corresponding transform. This object fascilitates using a transform set page to transform tiles by moving between positions in the page based on the desired transformation.

Enums§

CustomTileColliderStrError
Errors that may occur while parsing a custom tile collider.
FillPatternMapError
An error that might occur while filling a pattern map from a tile set using TileSetAutoTileContext::fill_pattern_map.
MaterialUpdate
A change of material for some tile. Either the material is being erased, or it is being replaced by the given material.
PageType
Tile pages come in these types.
ResourceTilePosition
The position of a page or a tile within a tile resource. Despite the difference between pages and tiles, they have enough similarities that it is sometimes useful to view them abstractly as the same. Both pages and tiles have a Vecto2<i32> position. Both pages and tiles have a TileDefinitionHandle and are rendered using TileRenderData. For pages this is due to having an icon to allow the user to select the page. Both pages and tiles can be selected by the user, moved, and deleted.
TileBook
Abstract source of tiles, which can either be a tile set or a brush. It is called a “book” because each of these tile resources contains pages of tiles.
TileCollider
Supported collider types for tiles.
TileDataUpdate
This represents a change to a tile in some tile set.
TilePaletteStage
Each brush and tile set has two palette areas: the pages and the tiles within each page. These two areas are called stages, and each of the two stages needs to be handled separately. Giving a particular TilePaletteStage to a tile map palette will control which kind of tiles it will display.
TilePropertyError
An error in finding a property for a tile.

Constants§

VERSION
Current implementation version marker.

Statics§

DEFAULT_TILE_MATERIAL
The default material for tiles that have no material set.

Traits§

BoundedTileSource
A trait for types that can produce a TileDefinitionHandle upon demand, for use with drawing on tilemaps.
OrthoTransform
Trait for objects that can perform a 2D orthogonal transformation. In other words, they can be flipped along the x and y axis, and they can be rotated by multiples of 90 degrees.
TileMapEffect
A trait for objects that can perform specialized rendering for a tile map by adding them to TileMap::before_effects or TileMap::after_effects, depending on whether the effect should render before the tile map renders or after the tile map renders.
TileSource
A trait for types that can produce a TileDefinitionHandle upon demand, for use with drawing on tilemaps.

Type Aliases§

CustomTileColliderResource
A resource to hold triangle data for a tile collider arranged in rectangle from (0,0) to (1,1).
PalettePosition
The type of coordinates stored in a a TileDefinitionHandle.
TileMapDataResource
Resource for storing the tile handles of a tile map.
TileMapEffectRef
A reference to TileMapEffect. A TileMap keeps some of these if it needs to be rendered specially.
TileSetAutoTileConstraint
A pair of a TileSetConstraintMap and a TileSetTerrainPatternMap.
TileSetAutoValueMap
A mapping from auto-tiler patterns to tile handles. Multiple tiles may share the same pattern, and each tile is given a frequency value that controls the probability of randomly selecting that tile when its pattern is chosen.
TileSetConstraintMap
A map from Vector2<i32> positions to auto-tile cell constriants. Each cell contraint is either an TileTerrainId which represents the center of the permitted patterns for this cell, or else it is a PatternBits which represents the only permitted pattern for this cell and thereby constrains the neighboring cells.
TileSetTerrainPatternMap
A terrain pattern map for tile map auto-tiler, using the fields of a nine-slice tile set property for the terrain types and the patterns.
TileTerrainId
A value that specifies the terrain of a tile map cell for auto-tiling. This value comes from the center of a nine-slice tile set property, so it can constrain which tiles are permitted in a particular cell.