Best practice for triggering enemy death?

0 favourites
  • 2 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • As it stands I have a function that when called when a character is damaged it runs through all enemies and bosses in the game to see if their HP has reached 0 to initiate their death animation or exploding to pieces or whatever. This however has led to the function being massive due to how many hostile characters we have and so it can noticeably slow down the C3 GUI when expanded.

    Is there a better way to do this via a trigger event? It's not good for FPS if the game checks if their HP is 0 or lower every frame.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • all your enemies should be in a family, and the health variable should be on the family. Then one event can pick enemies with health 0. And then a sub event can do a for each enemy to call the appropriate death sequence (which can also be set as a family instance variable).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)