class_tilemap - BonianSazanShomal/godot GitHub Wiki
TileMap
####Inherits: Node2D ####Category: Core
Brief Description
Node for 2D Tile-Based games.
Member Functions
- void set_tileset ( TileSet tileset )
- TileSet get_tileset ( ) const
- void set_cell_size ( int size )
- int get_cell_size ( ) const
- void set_quadrant_size ( int size )
- int get_quadrant_size ( ) const
- void set_center_x ( bool enable )
- bool get_center_x ( ) const
- void set_center_y ( bool enable )
- bool get_center_y ( ) const
- void set_cell ( int x, int y, int tile, bool flip_x=false, bool flip_y=false )
- int get_cell ( int x, int y ) const
- bool is_cell_x_flipped ( int x, int y ) const
- bool is_cell_y_flipped ( int x, int y ) const
- void clear ( )
Numeric Constants
- INVALID_CELL = -1 - Returned when a cell doesn't exist.
Description
Node for 2D Tile-Based games. Tilemaps use a TileSet which contain a list of tiles (textures, their rect and a collision) and are used to create complex grid-based maps. To optimize drawing and culling (sort of like GridMap), you can specify a quadrant size, so chunks of the map will be batched together the time of drawing.
Member Function Description
set_tileset
- void set_tileset ( TileSet tileset )
Set the current tileset.
get_tileset
- TileSet get_tileset ( ) const
Return the current tileset.
set_cell_size
- void set_cell_size ( int size )
Set the cell size.
get_cell_size
- int get_cell_size ( ) const
Return the cell size.
set_quadrant_size
- void set_quadrant_size ( int size )
Set the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time.
get_quadrant_size
- int get_quadrant_size ( ) const
Return the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time.
set_center_x
- void set_center_x ( bool enable )
Set tiles to be centered in x coordinate. (by default this is false and they are drawn from upper left cell corner).
get_center_x
- bool get_center_x ( ) const
Return true if tiles are to be centered in x coordinate (by default this is false and they are drawn from upper left cell corner).
set_center_y
- void set_center_y ( bool enable )
Set tiles to be centered in y coordinate. (by default this is false and they are drawn from upper left cell corner).
get_center_y
- bool get_center_y ( ) const
Return true if tiles are to be centered in y coordinate (by default this is false and they are drawn from upper left cell corner).
set_cell
Set the contents of a cell. Cells can be optionally flipped in y or x.
get_cell
Return the contents of a cell.
is_cell_x_flipped
Return if a given cell is flipped in x axis.
is_cell_y_flipped
Return if a given cell is flipped in y axis.
clear
- void clear ( )
Clear all cells.