How do i Make Protection point (based on %) for my character

0 favourites
  • 3 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Sorry for not answering on my last post btw. so i made a system where Player takes Damage whenever hes hit by an attack (Hitbox) and A Health system as well, but i had planned of making a system where Player can equip armor and gain Protection However, as i am going with a % system i fail to find a way to make it work. let me explain

    so let say an Enemy has 100 Damage, and Player has 10% Protection, 10% of 100 = 10 (Simply enough) the enemy should be dealing 90 damage to the player then.

    Now lets say its 150 Damage instead and if the Protection is the same it would be 135 Damage dealt.

    but back to 100 damage and 20% it would be 80 damage.

    i think you get the idea but i dont know a way to tell the System to decrease the Player health by %

    Note also i have a System for The Armor Items where there is a Variable based on the Protection Value

    But anyways i hve tried with

    On Collission with Enemy_HitBox. Subtract 100 * "ProtectionValue"

    On Collission with Enemy_HitBox. Subtract 100 - 100 * ProtectionValue

    ( ProtectionValue being Lets say "8" to decrease the value of the damage to 92% of 100, i did "Subtract ProtectionValue * 0.1 and it will give 0.8, and that seems to have worked for me in the past) but i keep ending up with wrong results, being either not subtracting anything, or Subtracting way too much Health.

    does anyone know an answer to this, i hope i explained it well enough, since its kinda hard to explain without being able to take screenshots? what do i do?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Calculation for negated health is damage*(armour/100) so for example 200 damage with 20% is 200*(20/100) = 40. That gives you the amount you are protecting with the armour, then you subtract that from original damage amount to get damage done to the player, so the total calculation you need for damage done to the player is

    damage-(damage*(armour/100))

  • thank you so! it actually helped, had some trouple with it first but now it works

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