[SOLVED] Animated meter

Pfap

Member
What's your approach to animating health bars, meters, etc... Without, drawing individual sprites for each position? For instance you have a health bar with 100 points, but the player takes 11 damage. Is there a way to draw it without having a sprite with 100 different states, assuming an integer only damage system no 11.5 or 11.25 for example. I'm imaging just having one "empty" test tube sprite, now how can I draw it being filled at different levels without hand drawing it?
 
J

Jdown79

Guest
You could have a health bar sprite thats hollow, and draw a rectangle within it, something like
draw_rectangle(0,0,0+health,20)
I usually do use a sprite with 100 frames though, its easier to call image_index = health for me at least
 
Top