Help With A Little Math Please

Get help using Construct 2

Post » Fri Jan 09, 2015 11:15 pm

I have two toons ones got 600 health the other got 450 health I want to figure out how to do the life bars if I do width= player.life it's too big

if I do width = player.life/5 it's different for both

is there a number that I can divide by that would have the bars visually equal in width regardless of the overall life capacity?
Need Sprites For Your Next Project?
100% Vector Animated Sprites
B
8
S
2
Posts: 170
Reputation: 1,086

Post » Fri Jan 09, 2015 11:32 pm

You could use a fixed lifebar, it always goes up to 250px max

100% hp = 250px = 600hp = 450hp

current hp / max hp = percentage of 250px

500hp / 600hp = 83%
83% * 250px = 207.5px

100hp / 450hp = 22%
22% * 250px = 55px
B
32
S
6
G
2
Posts: 317
Reputation: 2,801

Post » Fri Jan 09, 2015 11:35 pm

For simplicity, lets say you want your life bars to be a max of 100px. If player is 600 HP than 600/100 = 6 so width = player.life/6 and if toon is 450 450/100 = 4.5 so toon.life/4.5

See attached .capx
You do not have the required permissions to view the files attached to this post.
Image Image Image
B
61
S
19
G
6
Posts: 325
Reputation: 7,944


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, trance, yiuyiu6666 and 6 guests