This site requires JavaScript, please enable it in your browser!
Greenfoot back
CrazyGamer1122
CrazyGamer1122 wrote ...

2012/10/28

health bar?

CrazyGamer1122 CrazyGamer1122

2012/10/28

#
i was wondering if there was a way to make a health bar that would decrease as my player was hit. [Disallowed URL]
danpost danpost

2012/10/28

#
Absolutely, have you not seen examples of them in some of the scenarios here? Enter "health bar" (without the quotation marks) in the search bar at the top of the page.
CrazyGamer1122 CrazyGamer1122

2012/10/28

#
ok. also, how could i make the health-bar picture change every time the health lowered?
danpost danpost

2012/10/28

#
Whenever the health is lowered, call a method within the healthbar class to update the image to show the new value. Are you creating your own health bar or import one from somewhere else?
CrazyGamer1122 CrazyGamer1122

2012/10/28

#
Are you creating your own health bar or import one from somewhere else?
creating my own.
pashmi pashmi

2012/10/29

#
I'm not an expert on this, however you could set a private variable to the amount of bars of health in your health bar, and after every hit in the hit method minus 1 from the health variable. Then, you'd make the health bar's image update for every number, e.g having the health variable being at 4 showing a full health bar, at 3, less, etc until 0 where you'd effectively complete a method for the actor's death. Possibly just a removeObject but maybe you want to go into more detail.
You need to login to post a reply.