Health bar in GameBlender

-Open Blender ,create a plane.It's our bar.Press F8 with the plane selected to go in realtime buttons.Add an event Sensor(the event that will make the bar to go forward e.g. keyboard sensor,collision etc..).Split the 3D window and add a Text editor(Shift+F11).Put the script below:

import GameLogic
cont=GameLogic.getCurrentController()
own=cont.getOwner()



mesh=own.getMesh()
for s in range(0,2):
	own.length=own.length+1
	vert=mesh.getVertex(0,s).getXYZ()
	vert[1]=vert[1]+own.add
	mesh.getVertex(0,s).setXYZ(vert)

-Name it and put its name in a Python Controller attached to the Sensor created before.Now select the plane and in the Realtime buttons add two properties.The first one is step of the bar and in this example is named "add" and a second property named "length".It 's the max length of the bar.Add an Always Sensor.Connect it with an Expression Controller.This will contain the condition of the max length.In this example the Expression value is "length<20".Than connect it with Property Actuator (Assign-add-0).Take here the example Health.zip