How do I make all enemies take damage from 1 event?

0 favourites
  • 8 posts
From the Asset Store
This sound pack features 117 game sounds : Axe,Punch Swing & Hit & Damage. This is a perfect collection for your game.
  • I don't really know how to say this right, but in my game I have multiple enemies, and the current way damage is dealt to them is by each weapon having its own event block that deals damage to that enemy, and I have to create a new event for every enemy that a weapon/projectile can hit, and it very quickly clutters up the event sheet. Is there a way to make it where all I only need 1 event for something to do damage to different enemies?

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you have the paid version you'll want to use families like oosy suggested.

    Otherwise you will need an event for each type of enemy. I suggest creating a Group for damage enemies. Then you can throw all your gross code into there and minimize the group so it takes up next to no room. Every time you add a new enemy you will have to pop open your damage enemies group and add the new enemy.

  • So I tried using families, but came across an issue.

    All my enemies have different amounts of health, and if I use families, they would all have to share the same health variable, which I don't want to do.

  • What? No. Every instance of every object in a family can have their own value for the variable, even if the variable is the family's variable.

  • I get that, but that's not what I mean.

    Certain enemies have different max healths, Ex: One has 13 and the other has 11, and from what I can tell there is no way to use families in a way that makes it to where they can keep their different max healths in a convenient way. I could make different families for different health classes of enemies, but I don't have a large enough amount of enemies for that to be helpful, and I don't have a small enough amount for each one to have its own event and it still be easily manageable.

  • They can still have individual variables in addition to the family variables.

  • Sure you can, you just need to make sure you call the specific instance you want with UID.

    On the time of collision I grab the UID of the auto attack as well as the Enemy I need to target. My enemies all have different health amounts.

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