energy bar

Started by Paranoia, Mon 16/06/2003 09:32:25

Previous topic - Next topic

Paranoia

is there anyway to make a energy bar? ie the character's strenght after attacks?

Paranoia

Mr Jake

SOmeone said something about using int counters... I see if I can find the post

TerranRich

Yes, use a global int for the value of the energy level. Let's say it ranges from 0 to 100, and you're using global int #47,  as an example. Every time the player gets attacked, you could use SetGlobalInt(47, GetGlobalInt(47)-3); to decrease the energy level by 3 every time. If the player drinks some potion or eats some food to regenerate his/her energy, use SetGlobalInt(47, GetGlobalInt(47)+2); to increase by 2 every time, for example.

As for the graphical part of the energy bar, that's something I don't really know how to do. As far as I know, there isn't any way to resize GUI objects during runtime. Or is there? Does anyone else know?
Status: Trying to come up with some ideas...

Mr Jake

You could use a GUI for each 1% to 100% but that would take a lot of filespace...

Scummbuddy

No, you could set up 10 back-to-back pics... say 10% levels.

then
---------------------------------
SetButtonPic
SetButtonPic (int gui, int object, int which, int newslot)

Changes a GUI button's graphic to the one you specify. This could be used as an indicator of whether a feature is switched on or off by changing its picture. Sets object number OBJECT on gui GUI to NEWSLOT from the sprite manager.
The WHICH parameter selects which picture to change. It can have these values:

1  normal picture
2  mouse-over picture
3  button pushed picture

Note that you can pass NEWSLOT as -1 to disable the mouse-over and pushed pictures.
Example: if the GUI setup in the editor specifies a pushed-pic, but you want to change the main picture in the game (and so remove the old pushed picture), you can do something like this:

SetButtonPic (2, 3, 1, 100);
SetButtonPic (2, 3, 3, -1);

which will change button 3 on GUI 2 to have normal picture the one in slot 100 and not have a pushed graphic.

-------------------------------------------

You can turn them on and off succesfully, especially with the help of an if statement to find which one needs to be turned on or off next.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Paranoia

TY Scummbuddy ;D thats great

Paranoia

SMF spam blocked by CleanTalk