# dial indicator

### » Thu Oct 15, 2009 4:31 pm

bit of a dilemma here, see if i can get a solution here before I give up on that hud system.
I'm using the dials as hp indicates etc. the top one is for indicating health now ive tried a few things but im left a little dumbstruck on how to implement the health one. (large arrow) since its odd degrees etc.

end of red = 0 health, vica versa end of blue is 100 health.
http://3.bp.blogspot.com/_3oHN8lpkLvg/S ... -final.jpg
B
3
G
3
Posts: 20
Reputation: 1,040

### » Thu Oct 15, 2009 5:04 pm

dont give up...that art is beautiful.

ok, the equation you need is as follows
get the angle of absolute red, and get the angle of absolute blue
to get the arrow to point to the correct level of health:
(lerp(0,(blueAngle-redAngle),currenthealth/100))+redAngle
Spriter Dev
B
91
S
21
G
12
Posts: 3,246
Reputation: 16,573

### » Thu Oct 15, 2009 5:26 pm

A simpler version of Lucid's expression that does the same things would be this:

lerp(RedAngle, BlueAngle, Health / 100)
Moderator
B
104
S
39
G
19
Posts: 1,584
Reputation: 18,167

### » Thu Oct 15, 2009 6:49 pm

i was thinking of the 360-0 gap, when i did the adding thing, but thats at 3oclock not 12 oclock
Spriter Dev
B
91
S
21
G
12
Posts: 3,246
Reputation: 16,573

### » Thu Oct 15, 2009 6:52 pm

hey guys thanks for the speedy replies rotation works great on both equations not knowing my left from right took me a while to implement it ^^! anyways it fully rotates fine now but doesnt stop at the
red or blue angles.

lerp(0,(45-210),(global('Healthplayer')/100))+210

im using set angle to

yea im a nub -_-.
B
3
G
3
Posts: 20
Reputation: 1,040

### » Thu Oct 15, 2009 7:17 pm

One thing to keep in mind with Construct is that 90 degrees isn't up, but rather down, and I think that's what your problem might be. So the red angle would be 150 degrees and the blue angle would be 315(although 330 is actually a better fit for your image).
Moderator
B
104
S
39
G
19
Posts: 1,584
Reputation: 18,167

### » Thu Oct 15, 2009 7:23 pm

linkman2004- yea those angles do work much better, thanks.
B
3
G
3
Posts: 20
Reputation: 1,040

### Who is online

Users browsing this forum: No registered users and 3 guests