Okay I have been thinking really hard about this but it's making my brain explode and it is driving me nuts. I want to have a boss with a megaman health bar. the bar is a sprite with 29 frames, frame 0 is an empty bar so a full bar is frame 28 with 28 "mini bars" in it. I want the boss to be allowed to have any amount of maximum health I ever choose at any given time (it will be a set number chosen by me for each boss, but perhaps different for different bosses, however the max health of a boss won't change during the game), hundreds of points even, possibly thousands, and I want each "mini bar" to represent 1/28 of the boss' health, rounded up to the nearest possibility (so if it has only 1 or 2 health out of a gazillion, it will show frame 1). What formula would I need to set the bar's frame number? I have been thinking about this round and round and I just can't come up with it. I am sure it's simple once thought of, so could somebody please help me? Most Megaman games seem to do one hit point per mini bar, or out of always 100 health, so I don't think many of those examples out there would help, even if they are made in MMF or Game Maker (if they did what I was describing then they would indeed give me the answer).
edit: I figured it out. It's ceil(currenthealth/maxhealth*28).
I actually had explored this before, but it was with the width of a sprite, rather than the frame number of an animation, so I kinda got confused. sorry if this topic caused any trouble!