Change Gui button graphic

Started by Nixxon, Wed 15/04/2015 09:23:22

Previous topic - Next topic

Nixxon

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.

Crimson Wizard

#1
Well, assuming your button is named "gMyButton", you just do:
Code: ags

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)

Nixxon

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.

Nixxon

Hey just quickly, is there a way to change the hover graphic as well?

Crimson Wizard

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).

Snarky

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.

SMF spam blocked by CleanTalk