Here’s a short and simple tutorial on creating a Health Bar for your Blender Games.
Making a quick and simple Health Bar for Blender’s Game engine.
Add 2 planes (separate objects). Make one green and one red. Mine will be used from an
over head view so my green plane is slightly above the red plane.
My green plane is just above the red one. Set the center of your green plane to the far left side.
This is an over head view. My planes stretches across the x axis. To change the objects center, place
the 3D cursor over the far left side of the plane. While in object mode, press the button labeled
“Center Cursor”. The pink dot that represents the objects center will move to the 3D cursor.
With my green bar the same length as the red one, this will represent Full Health in my game or
100%. Here I’ve set the Frame number to 100.
Space Bar – Object – Insert Key Frame….
Scale. We’ve just set the shape of our health bar when it’s at 100%.
Now, change the frame counter back to 1.
Scale your bar way down to almost nothing.
Space Bar – Object – Insert Keyframe…
A quick peek at our IPO window shows our bar’s X scale goes from frame 0 to 100. Frame 0
is at about 1% and at frame 100 our bar will represent 100%.
Switch to a Game Logic window, with the green bar still selected. Add a property. Change
it to ‘INT’ which stands for integer. I named mine HP for Hit Points.
Add a new Sensor, Controller and Actuator with the ‘Add’ buttons in each column.