Skip to content
Lukas Sägesser edited this page Jun 22, 2015 · 13 revisions

TileMap

####Inherits: Node2D ####Category: Core

Brief Description

Node for 2D Tile-Based games.

Member Functions

Signals

  • settings_changed ( )

Numeric Constants

  • INVALID_CELL = -1 - Returned when a cell doesn't exist.
  • MODE_SQUARE = 0
  • MODE_ISOMETRIC = 1
  • MODE_CUSTOM = 2
  • HALF_OFFSET_X = 0
  • HALF_OFFSET_Y = 1
  • HALF_OFFSET_DISABLED = 2
  • TILE_ORIGIN_TOP_LEFT = 0
  • TILE_ORIGIN_CENTER = 1

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

  • void set_tileset ( TileSet tileset )

Set the current tileset.

Return the current tileset.

  • void set_cell_size ( Vector2 size )

Set the cell size.

Return the cell size.

  • void set_quadrant_size ( int size )

Set the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time.

  • int get_quadrant_size ( ) const

Return the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time.

  • 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).

  • 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).

  • 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).

  • 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).

Return the contents of a cell.

Return if a given cell is flipped in x axis.

Return if a given cell is flipped in y axis.

  • void clear ( )

Clear all cells.

Clone this wiki locally