+1 vote

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 ?

in Engine by (528 points)
edited by

2 Answers

+1 vote
Best answer

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

by (528 points)

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

0 votes

Try in 2 options

1.tilemap.tileset.remove_tile(id)

2.tilemap.set_cellv(position, -1)

by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.