Okay, I have a healthbar in my GUI. Now I've looked in the manual but can't find what I want. Is there a way to change the sprite on the button when my health int decreases?
Something like
if (health==90){
Ã, Ã, //change image//
}
etc.
Ã, Ã,Â
Button.NormalGraphic property (http://www.adventuregamestudio.co.uk/manual/Button.NormalGraphic.htm) should be what you're after. (And possibly MouseOverGraphic and PushedGraphic too.)
So:
if (health == 90) {
btnHealth.NormalGraphic = 54; // where 54 is the spriteslot of the new image
}
//etc
However, depending on what exactly is on the graphic there may be another way to do it. For example, if the button is a bar that you want to shrink or grow depending on your health, you could use the ClipImage property, and just change the button's size accordingly.
Thanks a lot. I was just confused earlier.
You may want to lookup Button.ClipImage in the manual also. Set this property to true and then you can just resize the button to implement a bar graph.
It is now saying btnHealth is an undefined token and
I even put the int on the top of global script and it says it's already been defined. Am I doing something wrong?
No, I did - kind of. I should've mentioned that btnHealth needs to be replaced with the script name of the button you want to change the graphic of. You can check (or set, if needed) the script name on the GUI editor window. Sorry about that.