Mounted and Unmounted at the same time?
by Robert Carroll · in Torque Game Builder · 09/19/2009 (3:58 pm) · 1 replies
I got a health bar at the top of my screen and mounted it to my player. But when I play the scene The health bar moves around In a strange way hard to explain but its just not mounted.
About the author
Stay Up all night playing PS3 ;) add me PSN: RCBASEBALL13.
Torque Owner J
Act 7
function FixedHealthBar::onAddToScene(%this) { ... %this.startPosX = %this.owner.getPositionX(); %this.startPosY = %this.owner.getPositionY();It's grabbing the position of your sceneObject.
Next, it then updates it to that position...
case "Left": ... %this.owner.[b]setPositionX[/b](%this.[b]startPosX[/b] - (%sizeDiff / 2));So it's just doing what's it's told...
Now you'd have to change how that is updated to get it working correctly:
Try this code from Joe, Here, I had to edited it a bit, but it seems to work pretty slick and might be a better solution for you.