Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: FanOfHumor on Wed 06/04/2022 06:09:35

Title: (Solved)Check if any object that the mouse is over is animating.
Post by: FanOfHumor on Wed 06/04/2022 06:09:35
I would like to be able to have a small script to change the cursor to normal whenever its over any object and the object is animating.If it isn't animating to then change the mouse mode to whatever I choose.
This is the script I use to change it whenever it's animating. This is in a rooms repeatedly execute function.
Code (ags) Select

if(Hotspot.GetAtRoomXY(mouse.x, mouse.y)==hHotspot1)
{
if(fries2.Animating||fries.Animating)
{
mouse.Mode=eModeWalkto;
}
else
{
mouse.SaveCursorUntilItLeaves();
mouse.Mode=eModeclickable;

}

What I would like to do is to check if any object is animating+mouse is on it.
What I have tried is this in Global Script in repeatedly execute always. I stopped short because I couldn't think of anything that could possibly work.
Code (ags) Select

  if (GetLocationType(mouse.x, mouse.y) == eLocationCharacter||GetLocationType(mouse.x, mouse.y) == eLocationObject && \\I thought maybe something here to set the condition of animating.)
  {
     if(__//any object that the mouse is over__.animating==true)
     {
        mouse.SaveCursorUntilItLeaves();
        mouse.Mode=eModeclickable;
     }
  }


So basically it should check what object the mouse is on and then check if that object is animating.

EDIT:

If no one knows please say so.
Title: Re: Check if any object that the mouse is over is animating.
Post by: Matti on Tue 12/04/2022 11:09:27
Something like this should work:

Code (ags) Select
     Object *o = Object.GetAtScreenXY(mouse.x, mouse.y);
     if (o != null && o.Animating) // do something


Quote from: Pajama Sam
If no one knows please say so.

What is that supposed to mean? Should everyone who doesn't know the answer post here to say they don't know the answer?  :-D
Title: Re: Check if any object that the mouse is over is animating.
Post by: Khris on Tue 12/04/2022 11:22:19
Usually, if you don't receive a fast answer, the question is either very hard/involved or very easy. I tend to skip both of these until I'm really bored.
Title: Re: Check if any object that the mouse is over is animating.
Post by: FanOfHumor on Tue 12/04/2022 23:36:11
Thanks for the answer.

QuoteWhat is that supposed to mean? Should everyone who doesn't know the answer post here to say they don't know the answer?  :-D
Of course not. (laugh)