Game Development Community

Displaying Tank health

by Stephen · in Torque Game Engine · 01/08/2006 (4:33 pm) · 1 replies

I have added this Vehicle Health/Energy Bar Resource to display the vehicles health but I noticed when you mount the tank, nothing displays. Could someone help me to fix this?

Thanks

#1
01/09/2006 (5:08 am)
Have a look at the onRender code for the health/energy gui class in the engine. There is normally a sentry that tests whether the control object is of a certain type

eg:
// don't render unless we're controlling a player
if ( !(controlObj->getType() & PlayerObjectType) )
return;

You'll need to change the type mask "PlayerObjectType" to whatever type the tank class you're using is registered as. It could be a vehicile type or a compleatly new type depending on how its setup. If you want the bar to show for both tanks and players then just extend the above to test for the different types you want to allow.