health bar as a distance indicator

hy there :confused:

as you can see i’m trying to use a health bar as a distance indicator in a car game. for example, car is getting nearer and nearer to another car in traffic and my health bar is becoming red, indicating that something’s wrong.

any ideas? suggestions? please, if you have some, feel free to say.

tnx

MG

Usually it is tha same logic. It should not matter if you measure a health property or a speed or a distance property.
It is just a question how you fill the value (and what is the max) ;).

i already have ray sensors in front and back of the car. i’m printing distance by a debug properties. so if there’s some way to connect that measured distance with a health bar with a python script(easier to me) or with logic bricks(if it’s easier to you).

max value is 50. but i figure that health bar would react only on distance of 20 and lower.

have any suggestions? :eek:

Do you have an healthbar already?

yeah, i have a few of them, one for each sensor on the car.

The point is: I do not know your healthbars. So I can’t tell you how you should use them. Usually you put the distance that you get in the “health” (or whatever) property of the healthbar. That’s it.

i can do this without python scripts, right?

EDIT:

or you can post one example so i can see what you mean :slight_smile:

I do not think it is possible without python.
but I do not have an healthbar.
You could post a demo file, so I could have a look.

i’ll mock up a demo.