0 votes

Is it possible to remove tiles during runtime? I need to destroy some walls parts in a game, which is an ideal candidate to use tilemaps, but Im concerned that I cant selectively destroy elements.

in Engine by (172 points)

1 Answer

0 votes

The TileMap docs have you covered:

void set_cell ( int x, int y, int tile, bool flip_x=false, bool flip_y=false, bool transpose=false, Vector2 autotile_coord=Vector2( 0, 0 ) )

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

An index of -1 clears the cell.
by (20,477 points)

Do they have some sort of collider to let me identify individual collisions?

The whole point of a TileMap is that individual textures and colliders are batched into a single object for performance. That said, when you collide with the TileMap, you can then use the collision position to determine which particular tile you collided with.

See here for a deeper explanation: http://kidscancode.org/godot_recipes/2d/tilemap_collision/

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.