Game crashes after defeating enemy. + Patrolling question [GIF included]

I need to note that when the health bar does not exist, the game does not crash when the enemy is eliminated. Example:


So, here’s everything I have done in terms of “health”:

EDIT: I’ve removed the “Hide Enemy2” action. Same problem :confused:

Additional questions:

  1. I want to add multiple enemy minions but when I copy-paste them, the health bar
    exists only over one minion. Is there a way to add a health bar over every minion? Maybe tags?

  2. (ANSWERED) How can I solve the fact that every time I start the game, the player’s walking down animation is playing? Every game I’ve made until now had the same problem

  3. (ANSWERED) How can I give a path of patrolling for the enemies?

Try to add a “Trigger Once” condition underneath the first line. Otherwise I think it is constantly trying to delete an enemy which has already been deleted which might explain the crash.

The other questions…

  1. I’m not too sure about that one.
  2. Either At the beginning of the scene do action “Change animation” and choose the animation you prefer. But I’m guessing your player walk down animation is probably animation number 0, so it plays automatically. You can also just drag a different animation to the animation 0 slot and it should play that first instead.
  3. Search YouTube for “Advanced Enemy AI” video by Wishforge. There are lots of different tutorials there for that sort of in-depth stuff.
1 Like

I added “Trigger Once” as a condition to the Delete Enemy2 action. (I added two copies of enemy2 but that’s irrelevant.)
Result: Same thing. Once the health bar reaches zero, game crashes.

  1. It worked! Thank you!
  2. I will watch those videos, thanks.

Glad it worked! Just a guess you might need to delete the Health Bar when you delete the enemy because I think GD is still reading the command “Put Health around Enemy” after the enemy has been deleted.

1 Like

Tried ‘Delete “Health”’ as well, and still crashes. It’s fine, as I thought of a less conventional way. Thank you for the help! :smiley:

1 Like

You can make an object group for all minions/enemies and use a for each event to create a new health bar object over them and link it to the minion.