Windows Dyamic Health Icon, ala, Doomguy and Banjo-Kazooie

B

brendanmarie

Guest
I was following this helpful video guide on stamina bars, although I wish to know how to replace the bars with images as mentioned in the title. I don't want to use bars at all, just faces that a player may relate to. So when a global number reaches certain numbers over time, the sprite changes too.

I couldn't find a related video or article that answers my question through Google or these forums.
 
M

montiedragon

Guest
Like something similar to the original doom? Or a sprite that works as a health bar?
 
M

montiedragon

Guest
Here's something that I threw together. The sprite would have subimages that start with the worst off, and end with the most healthy. I made the variable names as explanatory as possible.
Code:
image_number_to_draw = (floor((sprite_get_number(insert_face_sprite_name) - 1)/ max_health) * current_health);
draw_sprite(insert_face_sprite_name, image_number_to_draw, location_x, location_y);
edit: typo
edit2: fixed an off by one bug
 
Last edited by a moderator:
  • Like
Reactions: Yal
Top