0 Favourites

Counting down damage taken(resolved)

  • Could be an obvious answer but I need some assistance with this counter. I have a player in an RPG taking damage, but rather than have the damage be simply taken off it counts down the damage to a new value.

    So i've set it up like this, where CurrentHP is the current HP of the character and NewHP is a new value set by CurrentHP-Damage :

    Every tick

    While

    Char1.CurrentHP > Char1.NewHP ------------ Set Char1.CurrentHP to Char1.CurrentHP-1

    When set up like this it just takes off the damage amount and updates to show newHP, so it's half working but it hasn't counted down by 1 every tick. If i remove the While and the variable comparison then the HP does just count down by 1 every tick as I expect but then of course there are no limits, it just keeps counting down. This is why I put the newHP in place, to set a limit. Am i missing something obvious here as to why it won't count down by 1 every tick while the HP is greater than the new HP?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Nevermind I fixed it by adding a different kind of variable comparison.

    OnDamage ----------- SetNewHP to CurrentHP-Damage

    Every tick

    If StopDamage = 0 ------------- SetChar1.CurrentHP to Char1.CurrentHP - 1

    If Char1.CurrentHP = Char1.NewHP ------------- StopDamage = 1

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
C2 Slow Down Over Time
71 6,427
The Mnk's avatar
The Mnk
Unread hot topic
54 9,216
angelo's avatar
angelo
Unread hot topic
0 Favourites
3D Top Down Shooter (2.28.11)
48 16,386
RioLuk's avatar
RioLuk