How can I create a dynamic HUD bar in the GE? I 've been taking a break and got rusty so I need your help.

I have an integer property with a random first value.I want to somehow connect it to the length of a plane, so that when the integer property decreases the plane's length will decrease the same percentage.

For example if the first value of the property was 100 then every second that passed the integer would be subtracted by 1 so the plane would lose 0.01.

If the first value was 20 then it would lose 0.05.

I 've found some tutorials where the plane would get animated but they did not quite help. Any ideas on how to procceed?
The following script runs every second when the light is on. I used an always sensor with "60" placed on the frequency. Since I am interested only in the plane's vertices I won't say more about the logic bricks.

import bge

scene = bge.logic.getCurrentScene()
controller = bge.logic.getCurrentController()
object = controller.owner
#sensor = controller.sensors["name"]

# Get a list of the mesh
meshList = object.meshes
# Get the first mesh on the object
mesh = meshList[0]
# or mesh = object.meshes[0] for both lines

# get the 2 vertices in the right side of the battery
verttop = mesh.getVertex( 0, 2)
vertbot = mesh.getVertex( 0, 1)

# new xyz for the vertices
# 0.09 is a result of the following:
#length of battery(180cm)/time it should work(20s)
verttop_xyz_Pos = verttop.getXYZ()
verttop_xyz_Pos[0] = verttop_xyz_Pos[0]-0.09
vertbot_xyz_Pos = vertbot.getXYZ()
vertbot_xyz_Pos[0] = vertbot_xyz_Pos[0]-0.09


# set local xyz position of the vertices
verttop.setXYZ(verttop_xyz_Pos)
vertbot.setXYZ(vertbot_xyz_Pos)


This solution worked for me. So till anyone finds a drawback, here it is.