First off, welcome!
Before you can get the health bar to show your player's health you need an animation for it.
- healthbar.png (363 Bytes) Viewed 450 times
You have to set the "vertical frames" to 8 when you add this animation and you'll see that GE will play this as an infinite animation, growing bigger and changing in color the bigger it gets. You add it. Then, on "Create Actor", put: "ChangeAnimationDirection" and you select "Stopped".
You'll notice that when you test it, you health bar will be red and small.
Now, you'll need a "health" variable for your player (telling you how healthy he is). If you don't know how to create variables, just ask.
Anyway, the variable should be global and an integer (just as in the basic settings).
Then (I guess we'll just let the player have a health of 70 at the beginning, ok? Just to make things simple).
On "Create Actor" you go on Script Editor and enter: "health = 70;"
Then on Draw Actor:
- Code: Select all
animpos = heatlh/10;
This will set the health bar's frame to the health your player has.
What you can do with the player is shown in this demo: