• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[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