Hi, I followed the tutorial in the link below to step #4. I only want the health bar.
I did everything as the tutorial said it.
However, the tutorial has basic python and was made in 2008, so I imagine the python part changed.
Basically, the health bar starts out at it’s smallest point and stays that way.
I tried using the left/right arrow keys to decrease/increase the size of the bar and it didn’t work.
I am not very experienced at all with Python, so I wouldn’t know what changes to the code need to be made to work.
If you can’t get to the page for some reason, here is the code:
YES, I named the file correctly and made the actuators just as the tutorial says.
Will someone update this code?
If you do and it works, I’ll post you a picture of a kitten.
Edit:
I suppose I should actually have tried to figure out the code.
The code is irrelevant to the problem, in fact. It’s obviously just for the percentage.
In that case, I must have to do something else different in Blender 2.49.
Im pretty new to Python aswell, but I do know that you just have to have two bars that are animated with scale so they are full at the first frame and empty on the last, then just make the properties for the bars.
A “simple” health bar can be done without Python, and if you don’t know what you’re doing with python, maybe you should try plain logicbricks.
The general idea is to have a bar that has an animation that scales itself from zero health to full health. Then you can use the IPO actuator to control that bar’s size with a property (Play Property). You can have it copy the health attribute from your player with the property actuator.
I made a little demo (plus a minigame!) to demonstrate this. You really should only have to look at the health bar to see how this is all done.
Thanks for the reply, but I already figured out how to do it with logic bricks. It took a little trial and error to understand the various sensors, but the healthbar works fine now.
Andrew, thanks for the code clairification. Now I know some of the changes since Dec 2008 in Python.