Skip to content

Tile Map actions

5 actions in the Tile Map category. Each block mirrors how the action appears in the editor's sidebar.

Cell To Position

Every Frame
Cell To Position Tile Map
Layer not set | Cell (0, 0)

Turns a cell of a TileMapLayer into the world position at its center and stores it. With 16 by 16 tiles, Cell = Vector2i(2, 0) stores Vector2(40, 8).

Input Type Default Description
Layer Node - The TileMapLayer whose grid the cell belongs to.
Cell Vector2i (0, 0) The cell to locate, in tiles, where Vector2i(1, 0) is one tile to the right.
Output Type Description
Position Vector2 Where to store the world position at the center of the cell.

Phases StartEvery FramePhysics

Erase Cell

Start
Erase Cell Tile Map
Layer not set | Cell (0, 0)

Clears one cell of a TileMapLayer, leaving a hole where the tile was. With Cell = Vector2i(3, 5), that tile disappears and Get Cell then reads -1 there.

Input Type Default Description
Layer Node - The TileMapLayer to erase from.
Cell Vector2i (0, 0) The cell to clear, in tiles, where Vector2i(1, 0) is one tile to the right.

Phases StartEvery FramePhysicsEnd

Get Cell

Every Frame
Get Cell Tile Map
Layer not set | Cell (0, 0) | → Filled | → Empty

Reads one cell of a TileMapLayer and stores the id of the tile source filling it, or -1 when the cell is empty. With Cell = Vector2i(3, 5) over a floor tile it stores 0, and over a hole it stores -1.

Input Type Default Description
Layer Node - The TileMapLayer to read from.
Cell Vector2i (0, 0) The cell to read, in tiles, where Vector2i(1, 0) is one tile to the right.
Output Type Description
Source int Where to store the source id found in the cell, or -1 when it is empty.
Branch Goes to
Filled Where to go when a tile sits in the cell.
Empty Where to go when the cell holds no tile, which is when -1 is stored.

Phases StartEvery FramePhysics

Position To Cell

Every Frame
Position To Cell Tile Map
Layer not set | Position (0.0, 0.0)

Turns a world position into the cell of a TileMapLayer that covers it and stores the coordinates. With 16 by 16 tiles, a position of Vector2(40, 8) stores Vector2i(2, 0).

Input Type Default Description
Layer Node - The TileMapLayer whose grid the position is measured against.
Position Vector2 (0.0, 0.0) A position in world space, such as the mouse position.
Output Type Description
Cell Vector2i Where to store the cell that covers the position, in tiles.

Phases StartEvery FramePhysics

Set Cell

Start
Set Cell Tile Map
Layer not set | Cell (0, 0) | Source 0 | Atlas (0, 0)

Paints a tile into one cell of a TileMapLayer. With Cell = Vector2i(3, 5), Source = 0 and Atlas = Vector2i(2, 0), the tile at column 2 row 0 of the first source fills that cell.

Input Type Default Description
Layer Node - The TileMapLayer to paint into.
Cell Vector2i (0, 0) The cell to paint, in tiles, where Vector2i(1, 0) is one tile to the right.
Source int 0 Which tile set source the tile comes from, where the first source is 0.
Atlas Vector2i (0, 0) The column and row of the tile inside that source, such as Vector2i(2, 0).

Phases StartEvery FramePhysicsEnd