- Home /
Question by
oliver-jones · Jun 14, 2012 at 03:28 PM ·
guireversemathshealth
Health - Inverse GUI Health Bar
Hello,
I can't get my head around the maths required to reverse my GUI bar. Basically, I have a GUI health bar, that when it decreases, it shrinks on the right side (the left is always static), and the right moves towards the left.
I want to reverse that. So the right is static, and the left moves towards the right.
var healthSize = (playersHealth/100) * 113;
GUI.DrawTexture(Rect(152, 47, healthSize, 13), healthBar);
Help me out please,
Thanks
Comment
Best Answer
Answer by whydoidoit · Jun 14, 2012 at 04:00 PM
How about this:
var healthSize = (playersHealth/100) * 113;
GUI.DrawTexture(Rect(152 + (113 - healthSize), 47, healthSize, 13), healthBar);
Your answer
Follow this Question
Related Questions
GetComponent Help 2 Answers
GUI.Button carrying out two functions? 1 Answer
Need help converting unityscript to c# 5 Answers
I need Help with the bergzerg arcade Melee combat scripts 1 Answer
How do I make a custom health bar? 0 Answers