HP %

0 favourites
  • 5 posts
  • So i want to have a % HP bar.

    for example 100 HP

    So if i lose 25% of HP ,25 Hp IS LOST.

    BUT if i have,

    for example, 200 hp, i would lose 50 HP.

    How do i make the % part, since i want to constantly mess around with the % of HP without touching the values diractly.

  • Am I understand right?

    That when you got hit, your HP will be decrease X(%)

    So you could have a variable : current_HP

    And whenever you got hit, you can set the current_HP = current_HP * X / 100

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • But the thing is, i have 100 HP

    And i have animation frame 1 when:

    - HP bar =< 100

    And i have animation frame 2 when:

    - HP bar =< 70

    And i have animation frame 3 when:

    - HP bar =< 30

    In case i drink a potion that gives me 200 HP, those values above will be wrong, so i wanted to make this using %, that way i can have the same animation frames for the correct amount of HP

    How can i do this?

    I am still very new to construct.

  • You need to change the values to variables rather than static numbers that don't change but the problem is you don't have a defined total, if you start with 100HP then you gain a potion that increases your hp to 200, it's not clear what the design is for hp, it keeps increasing as you get more potions with no max limit? What you need is a max limit for hp defined as a variable first so maxHP, then you calculate hp% = hp/maxHP*100. So if you put in 25 out of 100 or 50 out of 200 hp% is the same value of 25. Then you can use the same animation frame events mentioned in your post using the hp% value.

  • Yeah i already figured it out, thanks for the help :)

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