Dynamic interaction with TileMapLayer

Godot Version

v4.5.1

Question

I’m creating top down game using TileMapLayer. On layer contains rocks witch could be destroyed and then drop some loot. How could i handle it in proper way? I use Custom Data Layers to set rock max hp, and is mineable flag, and loot type. But what is the best way to handle state of each generated rock so i could detect collision from pickaxe hit, apply dmg, destroy when health is <= 0 and spawn loot.

Are there any ways to dynamically change states of tile map in runtime?

Yes you can set and place tiles during runtime, but i believe for your case its better to use the “scene collection” which allows for placing scenes as tiles.

Just put your logic in a “rock”-scene and add it to a scene collection in your tileset

1 Like

Thank you, I need to check this. I have not found this solution but it seems perfect

1 Like