Hi, I’m making a game about randomness and tiles,
I have a problem with the game logic
TL;DR I don’t know how to make separate timer for each object if a condition is met
This is what my game looks like now
There are 4 tiles on the image, at the start of the scene all tiles randomly create object from my array list.
After the object is deleted I want it to count down let say 5 secs then spawn new items based on random value
Randomly spawn is not the problem, but how to make each tile has its own countdown when its item object is deleted
For example:
I delete my tile number 2 object which is “Tree” object
then 3 secs later I also delete tile 4 which is “Beehive”
I want tile 2 to count down its number 1 2 3 4 5 or 5 4 3 2 1 separately from tile 4 count down
Let say tile 2 it is counting 1 2 then I suddenly delete object on tile 4 the tile 2 is still counting
3 4 while tile number 4 has just start counting 1 2 and after count to 5 tile 2 spawn maybe Tree and a few secs later tile 4 will spawn too.
How to apply these count down to all of the tiles?
Here is my scene object for now
This is my beginning scene code for creating starting objects and give the tiles index variable to be called later.
The GameText is just for visual log to view its index
This is what I don’t know how to do next
“Resources” is dead (Group of my objects consists of Tree and Beehive)
Delete it then start counting down
If (Countdown == Done) { Spawn Object at that deleted resource (x,y) }
But I think I can’t spawn at that xy because it is deleted and no xy to find
or maybe how to relate the x y to the tile of that deleted object
Thank you.