How do I fix bug of damage in tower defense?

0 favourites
  • 4 posts
From the Asset Store
🙌 Battle Defense Sound Pack comes with 525 high-quality sound effect
  • I need help with this issue

    I have a Tower Defense project and i can't fix a bug.

    I have something for the damage effect, but when checking, this gets bugged if two entities try to do the same action at the same time, for example if two knights get synchronized and hit at the same time it only damages as if it was one, or if two slimes try to divide at the same time only one manages to finish the effect.

    I think it must be due to the "trigger once while true"

    I'd like for that to apply for each and every singular individual and not every individual at the same time, i don't know if it's possible or if there's another way to achieve the effect that i want.

    I'll post the file so you can check it.

    And lastly, how to make it so the damage is not area of effect?

    Thank you very much.

    ht*tps://dri*ve.goo*gle.co*m/open?id=1f4knhBJb6SKoRgghaqueImmeD-d6vypR

  • To ensure it's always working for multiple enemies I use functions. You can pass the UID of the enemy or slime through a function and then using a condition that picks by UID parameter you can apply the actions to that specific instance of enemy or slime. So I would move all spawn actions into a function and test it out, and yes remove the trigger once.

    And lastly, how to make it so the damage is not area of effect? What do you mean?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for replying!

    I tried to do it with functions but when I take out the "Trigger Once" when it is in the attack frame, it subtracts the slime life several times instead of only one.

    and the damage in the area was that when hitting, it hits everything it reaches and not one by one.

  • I tried to do it with functions but when I take out the "Trigger Once" when it is in the attack frame, it subtracts the slime life several times instead of only one.

    Instead of "Trigger once", add "On frame changed" condition (from your "CarmesyButterfly"). It will behave like trigger once but it will check for each individual instance of your object.

    and the damage in the area was that when hitting, it hits everything it reaches and not one by one.

    As far as I understand, you could create a boolean in your "CbDañoLanza", let's say, "hasHit". Then, set it to true after hitting the first enemy. You also have to check against that boolean in your "Slime - On Collision with CbDañoLanza" so it will not affect other enemy instances.

    I've got similar problems when I was developing my TD game as well 😅. Check it out if you have some time!

    construct.net/en/free-online-games/a-r-ctower-defense-game-9635/play

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