Set relative to progress bar

Just started using Construct 2? Post your questions here

Post » Thu Apr 02, 2015 8:49 am

I am making a game with achievements and a progress bar to track those achievements. But I can't set relative to progress bar, only absolute. I tried setting a variable and getting the progress off that but it won't take the variable as input.
Please help! :( Thanks!
B
5
Posts: 16
Reputation: 259

Post » Thu Apr 02, 2015 10:53 am

say your bar is at maximum 200 pixels wide, maximum achievement points = 500, and you currently have 5 points.

bar.maxwidth = 200
bar.maxpoints = 500
bar.currentpoints = 5


bar set bar.width = bar.maxwidth * (bar.currentpoints/bar.maxpoints)

would get you a 2 pixels wide bar.

bar.currentpoints = 300


would get you a 120 pixels wide bar.
Who dares wins
B
56
S
15
G
16
Posts: 1,838
Reputation: 16,777

Post » Thu Apr 02, 2015 10:19 pm

Thanks so much!
B
5
Posts: 16
Reputation: 259


Return to Beginner's Questions

Who is online

Users browsing this forum: alextro and 2 guests