(SOLVED) Change GUI button appearance on click

Started by Kandessa, Fri 24/04/2020 22:55:10

Previous topic - Next topic

Kandessa

How can I make a button change its appearance when I click on it and then make so it stays that way until I click on the same button again then it goes back to normal?
The closest answer that I found was this old post: https://www.adventuregamestudio.co.uk/forums/index.php?topic=24034.0
But the solutions given in that topic doesn't work for me. ???
I'm also using the 3.4 version of AGS.

Cassiebsg

You have a manual along with the editor.  ;)
Click Help, and choose Index, then type "Button" in search box & pick "Button.NormalGraphic".

There you can see that all you need to do is:

btnNAME.NormalGraphic=20;

replace btnNAME with the name of your button, and 20 with the sprite number.  ;)
There are those who believe that life here began out there...

Kandessa

Quote from: Cassiebsg on Fri 24/04/2020 23:20:57
You have a manual along with the editor.  ;)
Click Help, and choose Index, then type "Button" in search box & pick "Button.NormalGraphic".

There you can see that all you need to do is:

btnNAME.NormalGraphic=20;

replace btnNAME with the name of your button, and 20 with the sprite number.  ;)



Hello, so I've already tried that.
And the problem is that although the button does change when I click on it, it doesn't go back to its previous state when I click on it a second time.
But still, thanks for the reply.  :)

Slasher

If its just alternate image on click...

Example:
Code: ags

if(btnNAME.NormalGraphic==20)
btnNAME.NormalGraphic=30;
else
btnNAME.NormalGraphic=20;


Kandessa

Quote from: Slasher on Sat 25/04/2020 14:46:44
If its just alternate image on click...

Example:
Code: ags

if(btnNAME.NormalGraphic==20)
btnNAME.NormalGraphic=30;
else
btnNAME.NormalGraphic=20;




Oh my God, a million thanks to you! I was really struggling trying to solve this button problem.  :-D

SMF spam blocked by CleanTalk