[SOLVED]Object turning invisible with next mouse click

Started by Racoon, Sun 16/01/2022 20:33:05

Previous topic - Next topic

Racoon

Hey,

I have an animated object that pops up that I want to be invisible the next time the player clicks the mouse anywhere. Is there a command that I can put in the room script?

If not, could someone help me out by suggesting another way? Maybe with bool and on_mouse_click? But I don´t have a precise idea how it could work.

newwaveburritos

I'm not 100% sure what you mean here.  They player walks into the room...then what happens?  The player enters the room and the animated object is animating which you want to stop animating as soon as the player clicks anything or anywhere in the room?

Khris

You can indeed use on_mouse_click():

Code: ags
function on_mouse_click(MouseButton button) {
  if (oPopup.Visible && button == eMouseLeft) {
    oPopup.Visible = false;
    ClaimEvent(); // don't do anything further
  }
}


(just add this to your room script, doesn't have to be linked to an event)

Racoon

Thanks Khris, that works just like I hoped!

SMF spam blocked by CleanTalk