Game Development Community

Generic Level meter

by Howard Dortch · in Torque Game Engine · 12/03/2005 (11:16 am) · 4 replies

I looked through the engine and didn't see any generic meters. Healthbar type is what im looking for. I have an object that only operates if it has power and uses power when it operates. I want a level meter like the healthbar to show the power of the device. Is there one available or should I write one?

#1
12/05/2005 (8:19 am)
That bar used for loading is generic, and can be receive values between 0 and 1. But if you want a bar on top of a shape like the health bar, you'll need to change the code a bit.

Making a copy of the health bar class, renaming it, and adding a method to set it's value by hand, instead of it reading the shape's health could work.

Or you could simply use the health property to show the power of the device, and use the health bar to display that.
#2
12/05/2005 (9:18 am)
Howard,

If you look closely at the stock healthbar, you'll see there is an option called "displayEnergy".

Check the box and click "apply".

Done.
#3
12/05/2005 (11:54 am)
Thanks Manoel I guess I will just do that.
Kirby I wanted to tie the meter to an object like a rocket pack or something not a player.
#4
12/05/2005 (12:12 pm)
Hmmm...

Obviously, I can't sit down and write a script that would this (not at my home PC) but I don't see why it wouldn't work. You'd just be getting the energy value of %obj as assinged to an object by the objects' script.

Should work about the same.