is it possible to delete a single tile from a tilemap from code ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MrMonk
:warning: Old Version Published before Godot 3 was released.

hey guys, is it possible to delete a single tile from a tilemap, directly from code ?
there is no obvious function that could do that in the TileMap class.
How about adding a single tile to an existing tilemap, also directly from code ?

:bust_in_silhouette: Reply From: MrMonk

d’oh… tilemap.setcell(int x, int y, int tile) seems to do both…creating a new tile whenint tile is a valid tile number, or deleting a tile when int tile = -1

can’t believe I actually created an invisible tile with no properties, to replace the visible one which had collisions and stuff…

MrMonk | 2017-03-21 10:47

:bust_in_silhouette: Reply From: infomaster

Try in 2 options

1.tilemap.tileset.remove_tile(id)

2.tilemap.set_cellv(position, -1)