I have two scenes ["scene", "HUD"]. In "HUD" is a healthBar (plane), in "scene" is a player, that contains collision sensor and python controller. I need to reduce player's health and show it in HUD. This is my script:
import bpy
import bge
cont = bge.logic.getCurrentController()
health = cont.owner["Health"] #Health is property
health -= 10
#try change healthBar dimension - full health has dimensions[1] = 1.0
hb = bpy.data.objects["HealthBar"]
hb.dimensions[1] = health/100
cont.owner["Health"] = health
This is not working. Dimensions of "HealthBar" changes, but only after the game (When I run game again, I see healthBar smaller). Where is the problem? Is there any function to update view, refresh or redraw?