Make an enemy drop loot on the floor

I want to have an enemy drop his bodyparts when he dies. The player can walk into them and pick them up. What I have now kind of works, but it keeps spawning too much bodyparts and some variables don’t change. How do I make him drop the right amount of bodyparts and make the variables work?


This is my code currently.

1 Like

First, welcome!

Secondly you dont need the repeat event (Maybe only for the eye part you need Repeat 2 times and one single event) and you should absolutely add a trigger once in all your conditions.

1 Like

Just add the trigger once condition

No, throwing a trigger once at all the events is the wrong way to go about it. It’ll have unwanted consequences. For example, if one BlueGuy has animation set to “Dead” and remains on screen for a while, then any subsequent BlueGuy objects that have their animation set to “Dead” won’t have the body parts generated.


@JayRayze , the issue is that you when the BlueGuy animation is “Dead”, there is no action to change the animation or delete the BlueGuy object. And so the event is repeated over and over. Add a subevent to the end of the other subevents with those actions to fix that:

If, however, you need to keep the dead BlueGuy in the scene for a while, then add a boolean object variable (say called hasSpawnedBodyParts) and default it to false.

Then, in the first event, add the condition checking if boolean variable hasSpawnedBodyParts of BlueGuy is false, and add an action to set the boolean variable hasSpawnedBodyParts of BlueGuy to true.

Additionally, you do not need to have those repeat 1 time events for nose and mouth - just use a standard event. For the eyes, as @Kruger suggested, get rid of one of the eye spawning events, and change the other one to repeat 2 times.

Also you don’t need the check for collision with Eye twice, the first time it will get all the eyes the WeirdGuy is colliding with and work with all of them.

And finally, you are settng the boolean for Nose when collision with a Mouth:

2 Likes