How do I make a bar that changes width

Get help using Construct 2

Post » Sat Dec 06, 2014 8:53 pm

While I'm pressing a button it keeps adding 15 every 0,0001 seconds to a variable XYZ. I want to match StrengthBar's Width to this value, but I need to do it in % since the Strength will have higher values almost all the time and this bar can't grow inifinitly.

To sum up, I need to take the strength value (variable) and make the StrengthBar grow without exceeding the value 209.821.

Could some help me please?
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Sat Dec 06, 2014 11:32 pm

hope it helps
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sat Dec 06, 2014 11:43 pm

I've already made it, but thank you for your help.

I did this

If ShotStrength <= 7000
ShotPowerBar.MAXWidth*ShotStrength/ShotStrengthMAX

This way I always find the % of my max power and then I multiply it to the max of my width bar
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Sat Dec 06, 2014 11:43 pm

you're welcome
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests