i need help with healtpanel

Non-platform specific questions.

i need help with healtpanel

Postby varta007 » Fri Jun 19, 2009 11:04 am

i need step by step help with a healtpanel making :|

i need help

here is my hpbar

hpbar.PNG


need demo

im so noooooob
Last edited by varta007 on Tue Feb 16, 2010 1:05 pm, edited 1 time in total.
--------------------------------------
making space game 5% done
name:space wars
--------------------------------------
varta007
 
Posts: 1
Joined: Mon Feb 04, 2008 2:10 pm
Score: 0 Give a positive score

Re: i need help with healtpanel

Postby Kalladdolf » Fri Jun 19, 2009 11:51 am

First off, welcome!
Before you can get the health bar to show your player's health you need an animation for it.
healthbar.png
healthbar.png (363 Bytes) Viewed 449 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:
healthbardemo.zip
(188.06 KiB) Downloaded 81 times
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron