ok here is what I'm stuck on I have one sprite Call wooden box and when you destroy it, it will spawn a loot.
Now i want to add in random loot.
The problem is when i have multiple wooden box to destroy it will spawn both item instead of just one to spawn.
My question is this is there a Condition that allows me to let the code work individual for each new sprite instead of looping it all to that one same sprite causing my code an spawn object to change every time i kill a new box
First you have to be sure right box is picked beforehand by condition.
Then you can either put all loot in 1 family and then spawn family (which will give you one random object in that family), or you can use compare variable with random number and else:
Develop games in your browser. Powerful, performant & highly capable.
Family is the best way to spawn random object
But with random numbers you can adjust chance of each object to appear. For example if you want speed power up to appear twice as often as shield power up.