What makes a gui clickable?

Started by Ghostlady, Fri 19/07/2024 23:08:54

Previous topic - Next topic

Ghostlady

I have gui's for all my characters and the gui stays on the screen with text until it is clicked and then the gui goes away.  I created a non character gui with a label for text and made the gui pause game when shown and clickable but it doesn't work if it is clicked on. I have to put a "wait" in between to even see it. so I have to do a gui.enabled true - a wait - then a guu.enabled = false. What do I need to have the gui stay on the screen and wait for the player to click on it?
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Khris

Please always post the actual code you have.

The following works fine for me:
Code: ags
  gDraggable.Visible = true;
  WaitMouseKey(1000);
  gDraggable.Visible = false;

I can simply click anywhere and the GUI disappears again.

To have the GUI stay on the screen until it is clicked, you need to use on_event:
Code: ags
void on_event(EventType event, int data) {
  if (event == eEventGUIMouseDown && data == gDraggable.ID) gDraggable.Visible = false;
}

Ghostlady

Thank you, Kris. This worked perfectly!
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

SMF spam blocked by CleanTalk