Click or drag to resize

TileMapSetCell Method

Sets the tile index for the cell given by a Vector2.

An index of -1 clears the cell.

Optionally, the tile can also be flipped, transposed, or given autotile coordinates. The autotile coordinate refers to the column and row of the subtile.

Note: Data such as navigation polygons and collision shapes are not immediately updated for performance reasons.

If you need these to be immediately updated, you can call UpdateDirtyQuadrants.

Overriding this method also overrides it internally, allowing custom logic to be implemented when tiles are placed/removed:

func set_cell(x, y, tile, flip_x=false, flip_y=false, transpose=false, autotile_coord=Vector2()):
    # Write your custom logic here.
    # To call the default method:
    .set_cell(x, y, tile, flip_x, flip_y, transpose, autotile_coord)

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public void SetCell(
	int x,
	int y,
	int tile,
	bool flipX = false,
	bool flipY = false,
	bool transpose = false,
	Vector2? autotileCoord = null
)

Parameters

x
Type: SystemInt32

[Missing <param name="x"/> documentation for "M:Godot.TileMap.SetCell(System.Int32,System.Int32,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Nullable{Godot.Vector2})"]

y
Type: SystemInt32

[Missing <param name="y"/> documentation for "M:Godot.TileMap.SetCell(System.Int32,System.Int32,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Nullable{Godot.Vector2})"]

tile
Type: SystemInt32

[Missing <param name="tile"/> documentation for "M:Godot.TileMap.SetCell(System.Int32,System.Int32,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Nullable{Godot.Vector2})"]

flipX (Optional)
Type: SystemBoolean

[Missing <param name="flipX"/> documentation for "M:Godot.TileMap.SetCell(System.Int32,System.Int32,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Nullable{Godot.Vector2})"]

flipY (Optional)
Type: SystemBoolean

[Missing <param name="flipY"/> documentation for "M:Godot.TileMap.SetCell(System.Int32,System.Int32,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Nullable{Godot.Vector2})"]

transpose (Optional)
Type: SystemBoolean

[Missing <param name="transpose"/> documentation for "M:Godot.TileMap.SetCell(System.Int32,System.Int32,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Nullable{Godot.Vector2})"]

autotileCoord (Optional)
Type: SystemNullableVector2
If the parameter is null, then the default value is new Vector2(0, 0)
See Also