Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
Hi again friends,
I got a golf game where the power of the shot is equal to the distance between the mouse position and the ball position (with limitations, obviously).
Now, the bar, for example, can be 300px long but I want to show a number with the percentage of the power.
I'm horrible at maths xD
Bar.MaxLength (300 px in your example)
Bar.CurLength (the current length, max, 300 px, min 0 px, anything within those two values)
(Bar.CurLength / Bar.MaxLength) * 100
Develop games in your browser. Powerful, performant & highly capable.
Thank you soooooooooo much. Works like a charm.
If you want however an indicator not starting from 0 (for exemple, if your bar min lenght would be 10)
You could use unlerp(minlenght, maxlenght, curlenght)*100 to get the percentage