Quick and Easy Health Bar

On September 2, 2008, in Tutorials, by Admin

Here’s a short and simple tutorial on creating a Health Bar for your Blender Games.

Step 1:

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.
Step 2:
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.
Step 3:
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.
Step 4:
Space Bar – Object – Insert Key Frame….
Step 5:
Scale. We’ve just set the shape of our health bar when it’s at 100%.
Step 6:
Now, change the frame counter back to 1.
Step 7:
Scale your bar way down to almost nothing.
Step 8:
Space Bar – Object – Insert Keyframe…
Step 9:
Step 10:
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%.
Step 11:
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.
Step 12:
Add a new Sensor, Controller and Actuator with the ‘Add’ buttons in each column.

  • The Sensor will stay at the default ‘Always’ Sensor with the ‘True level Triggering’ button still depressed.
  • The Controller will stay at the default ‘And’ controller.
  • The Actuator will be changed to an ‘IPO’ Actuator. Change the IPO Type from the default
    Play to Property. In the space labeled ‘Prop’, type in the name of the property that you added. In my case,
    I’ve typed in HP.That’s it. During your game, any changes to the HP property will scale your health bar accordingly.
    The HP property is used to set the position of the IPO. When HP is set to 75, the green bar will be scaled
    to about 75%. Like wise, as the value changes, the bar will be scaled accordingly. In this setup,
    anything below 0 will show the bar at the lowest scale we set. Anything above and beyond 100 will
    show the will show our bar scaled at 100%.

    Good Luck.



Comments are closed.

muzica noua
filme Online
filme online gratis
seriale online
filme noi
muzica noua
desene animate online
jocuri noi online
jocuri online
filme bune
filme online
filme online hd
filme online subtitrate
filme noi