Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: VampireWombat on Fri 20/09/2019 20:07:53

Title: Mouse over character (Solved)
Post by: VampireWombat on Fri 20/09/2019 20:07:53
Is there a simple way to do something similar to mouse moves over hotspot, but with a character? It looks like it's possible since Unavowed does it. But I can't find any information in the manual or the forums. Unless somehow I missed it or looked for the wrong thing.
Any information would be great. Thanks in advance.
Title: Re: Mouse over character
Post by: eri0o on Fri 20/09/2019 20:18:01
If the character is the player, there's is player stands on hotspot event. If not, you can use character position (c.x, c.y) to check if he is at the hotspot, using room repeatedly execute event. Check the example here https://github.com/adventuregamestudio/ags-manual/wiki/Hotspot#getatroomxy .
Title: Re: Mouse over character
Post by: VampireWombat on Fri 20/09/2019 20:21:41
Thanks, but I don't want anything to do with a hotspot. I want something to happen when the cursor is over the character.  I thought maybe this code would work, but it's too precise to be useful.

Code (ags) Select
function room_RepExec()
{
if (mouse.x==cMM.x && mouse.y==cMM.y)
{
Display("Test.");
}
}
Title: Re: Mouse over character
Post by: Crimson Wizard on Fri 20/09/2019 20:36:26
Character.GetAtScreenXY should work. GetAtScreenXY function (or equivalent) exists for all types of game objects and returns whatever is under these coordinates.
https://github.com/adventuregamestudio/ags-manual/wiki/Character#getatscreenxy

Also related: GetLocationType.
https://github.com/adventuregamestudio/ags-manual/wiki/Globalfunctions_General#getlocationtype
Title: Re: Mouse over character
Post by: VampireWombat on Fri 20/09/2019 20:40:25
Thank you very much. That's exactly what I needed. I have no idea how I missed it...