Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Racoon on Sun 16/01/2022 20:33:05

Title: [SOLVED]Object turning invisible with next mouse click
Post by: Racoon on Sun 16/01/2022 20:33:05
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.
Title: Re: Object turning invisible with next mouse click
Post by: newwaveburritos on Sun 16/01/2022 22:55:36
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?
Title: Re: Object turning invisible with next mouse click
Post by: Khris on Mon 17/01/2022 08:14:22
You can indeed use on_mouse_click():

Code (ags) Select
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)
Title: Re: Object turning invisible with next mouse click
Post by: Racoon on Mon 17/01/2022 09:41:26
Thanks Khris, that works just like I hoped!