Hello.I need a health bar for my game…but the script work on 2.49…i want to make it work on 2.5.
I ve done some modifications to this script
import bge
cont = bge.logic.getCurrentController()
obj = cont.owner
obj.percent = obj.health * 100 / obj.healthMax
but i get this error in console.
Attribute error: KX_GameObject object has no attribute “health”
I cant figure it out,maybe you guys can help me.
Thx.
HG1
(HG1)
2
Change the line
obj.percent = obj.health * 100 / obj.healthMax to
obj[‘percent’] = obj[‘health’] * 100 / obj[‘healthMax’]
http://blenderarchive.hostilestudios.com/about.php#backwardscompatible
Moguri
(Moguri)
4
If you want a more in depth look at the API changes between 2.4x and 2.5, take a look at this article:
agoose77
(agoose77)
5
agoose77
(agoose77)
8
yeah, server is being moved at the moment :@
will be up this week !