I'm trying to figure out how I would script a custom HP meter in my quest. Right now, I have actual counters like in an RPG, but I've found that using actual meters are both easier to see at a quick glance rather than having to do the mental math on how many hits you can take depending on how much HP you have, and take up less room. Since I currently have a bit of a cramped Subscreen, this will help tidy things up and hopefully give me enough room for something else I want to make.
I always liked the shape of the health bars in Kingdom Hearts, and I want to do something similar. I figure this means that I'd want to do a tile-based approach rather than just DrawRectangle with a frame around it. (Also because I already have the tile graphics from when I wanted to try and do this without scripting. I've never done anything like this before, but a quick look through the database gave me this script that I'm basing mine off of: http://www.purezc.ne...=scripts&id=112
I've gotten a bit confused while reverse-engineering this, and wanted a bit of help. So far, I think I've gotten a good amount of this figured out, having put together the part that determines which graphic to draw depending on current health. I've got two things that I don't understand. First of all, what part of this script determines how many tiles need to be drawn? All I have right now would draw a single tile, limiting Link to 16 HP. Needless to say, the player's going to need more than a single Heart to get through the whole quest.
Second, like I said, I'm putting in a Kingdom Hearts-style curve to the HP meter. (For those who've never played the game, it's three quarters of a circle before extending straight outwards like a normal meter) This means that the first three tiles of the meter need to be unique, and the fourth tile being what's copied for the rest of the meter. How would I add this detail to the script?
Before I forget, this is what I've figured out so far...
int DrawHP = Link->HP; //Amount of Health to draw
int TileHP = 16 //Each tile represents 16 HP
While(Link->HP >= 0){
DrawHP = Link->HP; //Reset DrawHP
int TileToDraw = OriginalTile;
int TileChooser = DrawHP/TileHP; //Determine graphic based on current HP
//Determine Which Tile To Draw
if(TileChooser >= 1){
TileToDraw = OriginalTile;
}
else if(TileChooser > 0.9375){
TileToDraw = OriginalTile + 1;
)
else if(TileChooser > 0.875){
TileToDraw = OriginalTile + 2;
)
else if(TileChooser > 0.8125){
TileToDraw = OriginalTile + 3;
)
else if(TileChooser > 0.75){
TileToDraw = OriginalTile + 4;
)
else if(TileChooser > 0.6875){
TileToDraw = OriginalTile + 5;
)
else if(TileChooser > 0.625){
TileToDraw = OriginalTile + 6;
)
else if(TileChooser > 0.5625){
TileToDraw = OriginalTile + 7;
)
else if(TileChooser > 0.5){
TileToDraw = OriginalTile + 8;
)
else if(TileChooser > 0.4375){
TileToDraw = OriginalTile + 9;
)
else if(TileChooser > 0.375){
TileToDraw = OriginalTile + 10;
)
else if(TileChooser > 0.3125){
TileToDraw = OriginalTile + 11;
)
else if(TileChooser > 0.25){
TileToDraw = OriginalTile + 12;
)
else if(TileChooser > 0.1875){
TileToDraw = OriginalTile + 13;
)
else if(TileChooser > 0.125){
TileToDraw = OriginalTile + 14;
)
else if(TileChooser > 0.0625){
TileToDraw = OriginalTile + 15;
}
else TileToDraw = OriginalTile + 16;


