The events below allow me to (sometimes, based on chance) spawn a coin whenever an enemy dies and also add xp to the player. This works fine, until you kill multiple enemies at once. At that point, you only get the rewards once. I thought I could fix that with Repeat for each instance, but obviously I’m missing something.
Does anyone have an idea how I could fix that?
Thanks a lot!
Can you add a screenshot of the events?
In the meantime, and as a guess to what you’re doing, check it’s something along these lines:
The first event filters the list of Enemy objects to those that are dead, and then the subevent iterates over that filtered list, creating a coin and deleting the Enemy object.
Note this example is making use of the Health extension
So sorry, thought I included the screenshot!
I think I’m doing the same thing, though I had to add the trigger once condition, otherwise 1 enemy ended up giving infinite xp
Actually, I think I figured it out!
I added a dying animation and took that into account almost everywhere… except here! I replaced the ‘trigger once’ condition with ‘animation is finished’. I delete the enemies after the dying animation is finished as well and that seems to do the trick. Thanks!