Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Make a variable called "display_health" and set it to false, then put the code in the draw event as I demonstrated above. When you want the object to display a health bar, set the variable to true and at the same time set an alarm for the length of time you want the bar to stay there.
In that alarm event, set the display_health variable back to false.
if global.FocusHPMAX>0
{
draw_sprite(Spr_EnemyHP,((global.FocusHP)/(global.FocusHPMAX)*100),view_xview+8,view_yview+68)
}
the Focus variables are obtained on the collision with the sword, on the slime; Each slime has a Creation Code with their stats, and one of the lines includes "global.FocusHP=EnemyHP", and so on. The bar never disappears, not even when said slime dies.
EDIT: Ahah, Daynar is correct on that. I didn't even notice there were two globals.
In the object, you'll set the sprite_index to whichever sprite you want to use at the time (also remember to set image_index to 0 so the animation will start on the first frame).
But, like I said, you CAN put all of the animations in one sprite if you want. Timing the animations will be really annoying though, so I highly recommend you just separate them.
Also, separating them will allow the animations to have different collision masks. So, for example, crouching can have smaller box than standing up.