Counting down damage taken(resolved)

0 favourites
  • 2 posts
From the Asset Store
An educational game for counting pictures. An easy to use template for developers to build larger games
  • 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?

  • Try Construct 3

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

    Try 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)