Game Development Community

dev|Pro Game Development Curriculum

GuiVehicleHealthBar for Torque 1.5

by CodingChris · 01/09/2007 (10:12 am) · 4 comments

Download Code File

1. This article was oginally written by Anthony Rosenbaum. The modification to get it work with the race mod was written by Bruce Wallace. Thanks go to both of them.
2. Add the source file to your engine and compile a new build.

3. You have to do the same modifications as in Anthony's resource:
Be sure you have this in your vehicle datablock:
// Energy
    jetForce = 3000;
    minJetEnergy = 30;
    maxEnergy = 200;
    jetEnergyDrain = 2;
    rechargeRate = 0.8;
and then in the WheeledVehicleData::OnAdd(%this, %obj):
%obj.setEnergyLevel(%this.MaxEnergy);
 %obj.setRechargeRate(%this.rechargeRate);
4. Add the guivehicleHealthbar control to your playGUI for example with the GUIEditor.

Now try it out!