How do I make enemies only take 1 damage?

0 favourites
  • 3 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 have a family set up with an instance called hp. I have 2 enemies so far in that family: a small fly and a small frog. The fly has 2 hp, and the frog has 3 hp. My attack subtracts 1 from the family hp instance. However, both are dying after only 1 hit. My attack is 3 frames at .1 seconds at 30 frames per second, and only the middle frame has a hitbox that can touch them. So they are in contact with the attack for 1 frame. I have attached an image of all actions that may be relevant. Can anybody help me figure out why they are dying after 1 hit?

  • Hey! I figured it out right after I posted this, but I will leave it up in case anyone needs it. I changed slash is overlapping to slash on collision with, and everything works great now.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Correct, "is overlapping" check performs many times per second.

    But I would suggest re-organizing your events like this:

    This way you don't perform unnecessary checks on every tick, which means better performance. It also makes the code easier to understand when everything related to enemy damage is grouped in one event, rather that scattered across the event sheet.

    Also, instead of updating the position of Slash sprite on every tick, you can pin it to the player, or attach with hierarchy (add as a child).

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