![]() |
picHPbar - Printable Version +- Mirage Engine (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49) +---- Thread: picHPbar (/showthread.php?tid=1420) |
picHPbar - Stomach Pulser - 29-11-2007 OK. This tutorial is to teach you all how to make an HP bar in frmMirage. When the player looses hp, the picture will resize, and another picture underneath will be a different (I used a grayed-out) color. Also, I have added a label that tells you how much HP you have (12 / 62). Difficulty (1/5) C & P This is all Client side First place two picture bars of the same size, but differing colors in frmMirage and label them picFull and picOut. Choose whatever HP bar pictures you want now (make sure they are the same size). Inside each of those picture boxes add a label (lblFull and lblOut respectively). Set the captions of both to " 0 / 0" Now In modHandleData find: Code: ' :::::::::::::::::::::: replace that packet with: Code: ' :::::::::::::::::::::: make sure that you change hpbwidth to the width of you HP bar (in pixels, not twips) Analysis: To resize the full HP bar we must get the current percentage of the players HP. such as .1, .92, or 1; then we multiply it by the width of the maxed out bar in order to make sure that the bar is resized properly. Next, we update both labels because once your full HP bar goes past a certain point, you wont see it anymore, so we added the bottom one in order to keep it visible (make sure that they are in the same place on both HP bars). Your Challenge: Add an MP, SP, and/or EXP bar(s). Re: picHPbar - Rezeyu - 29-11-2007 Meh, I had trouble adding HP bars when I first used them a long time ago, I'm glad someone finally did a tut on it, although I've already sorted out my own style for them. It's good seeing new tuts too, heh. Re: picHPbar - William - 29-11-2007 I don't know if you mentioned twip, the noob killer ![]() Re: picHPbar - Stomach Pulser - 30-11-2007 Here is my version of the HP/MP/SP bars in action. (Although in my source I load the images onto the picture box when the game starts) (Shouldn't make a difference as the code above is the same as my code that updates the pictures) This is just to show people what the code does: [spoiler]Stage 1: I set all my stats to the bare minimum (w/o dieing) ![]() Stage 2:Slight regeneration in stats ![]() Stage 3: Slightly more restoration ![]() (Don't steal those, as they are property of me)[/spoiler] |