I have a health bar, its has a near invisible scale on frame 1, on frame 100 its the biggest I want it to be. I want to be able to use the percentage of my max health left to determine the size of the bar.
is my script completely wrong?
cont = bge.logic.getCurrentController()
own = cont.owner
import bpy
if own['health'] > own['healthMax']:
own ['health] = own['healthMax']
if own['health'] < 0:
own['health'] = 0
own['divide'] = (100 / own['healthMax'])
own['percent'] = (own['divide'] * own['health'])
Heres pics of logic bricks and script
[ATTACH=CONFIG]140381[/ATTACH]
I tried what you said and fixed the script, however its still not working and it doesnt keep health from going over healthMax… Does it matter if when I play game the debug property shown on screen says healthbargreen.health and healthbargreen.percent etc etc.