energy bar expanding to the right
by David Horn · in Torque X 2D · 03/11/2010 (8:10 am) · 4 replies
I'm attempting to create an energy bar for lack of a better description (it actually has a different use, but I'll spare the details).
Essentially, it's a bar (T2DSceneObject) that increases in size starting from the left and expanding out to the right.
Here's my problem:
Right now, when I change the .Size property, it resizes from the middle and expands the left and right equally.
Now the normal calculation to fix this would be the following:
increase the size by "factor"
change the X property: current x + factor/2
The problem is that the x property is measured in different units than the size property. i.e. a value of 1 size does not equal a value of 1 x-position.
Any ideas of how I could accomplish this?
Thanks!
Essentially, it's a bar (T2DSceneObject) that increases in size starting from the left and expanding out to the right.
Here's my problem:
Right now, when I change the .Size property, it resizes from the middle and expands the left and right equally.
Now the normal calculation to fix this would be the following:
increase the size by "factor"
change the X property: current x + factor/2
The problem is that the x property is measured in different units than the size property. i.e. a value of 1 size does not equal a value of 1 x-position.
Any ideas of how I could accomplish this?
Thanks!
About the author
#4
03/11/2010 (8:38 pm)
Photoshop. Just use a transparent png. left half transparent, right half the color of the energy bar. It still expands in the middle, but it looks like the color is the only thing that expands to the right.
Torque Owner Alex Richards