Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Nixxon on Wed 15/04/2015 09:23:22

Title: Change Gui button graphic
Post by: Nixxon on Wed 15/04/2015 09:23:22
Hey Guys,

Probably an easy one for you savants.

On my initial screen I have two buttons within a GUI, labelled 'Play' and 'Quit' respectively.

After the character dies, I would like to change the 'Play' graphic to 'Try again' when returning to the initial menu screen.

I could paste the code during the death scene.

Any help would be greatly appreciated.
Title: Re: Change Gui button graphic
Post by: Crimson Wizard on Wed 15/04/2015 09:36:53
Well, assuming your button is named "gMyButton", you just do:
Code (ags) Select

gMyButton.NormalGraphic = 10; // where '10' is the number of wanted sprite


Also, I mean no offense, but questions like that are easily resolved by simply reading a manual:
http://www.adventuregamestudio.co.uk/manual/ags59.htm#button.normalgraphic

as stated in the forum rules (http://www.adventuregamestudio.co.uk/forums/index.php?topic=14373.0)
Title: Re: Change Gui button graphic
Post by: Nixxon on Wed 15/04/2015 09:46:47
Hey mate, thanks a bunch.

None taken, I generally peruse the dynamic help within the editor before posting. I'll try the above link instead from now on as it looks far more comprehensive.
Title: Re: Change Gui button graphic
Post by: Nixxon on Wed 15/04/2015 10:00:24
Hey just quickly, is there a way to change the hover graphic as well?
Title: Re: Change Gui button graphic
Post by: Crimson Wizard on Wed 15/04/2015 10:37:03
Quote from: Nixxon on Wed 15/04/2015 10:00:24
Hey just quickly, is there a way to change the hover graphic as well?

Yes, its "gMyButton.MouseOverGraphic = X" (it's mentioned just above the NormalGraphic in that article).
Title: Re: Change Gui button graphic
Post by: Snarky on Wed 15/04/2015 11:07:59
Quote from: Nixxon on Wed 15/04/2015 09:46:47
None taken, I generally peruse the dynamic help within the editor before posting. I'll try the above link instead from now on as it looks far more comprehensive.

The editor has a built-in version of the manual CW linked to, which you can bring up by pressing F1 or through the Help menu. You should really start by browsing through it, and reading at least the intro tutorial.