This Content is from Stack Overflow. Question asked by Ekumify
I’m working on a little game where tilemap gets generated.
This is so far not done in chunks and pretty basic.
Single tiles (rule tiles) of the tilemap can be destroyed by the player.
This is working so far (and took me long enough to figure out!)
Now I am looking for a way of saving tilemap data that allows me to give each tile a specific amount of lifepoints (so that the player needs to hit harder tiles twice oder three times before they get destroyed.
Also upon destruction I want the tiles to be able to drop loot (like gems).
How would you go about this?
I thought about putting gems etc. on a different (visible) tilemap and while destroying the tile of the “ground” tilemap check if for the same position of “gem” tilemap there is an object. If so destroy it and drop item to be picked up by the player.
I’m quite lost on this one, so every input is very welcome!
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.
This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.