Mouse over character (Solved)

Started by VampireWombat, Fri 20/09/2019 20:07:53

Previous topic - Next topic

VampireWombat

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.

eri0o

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 .

VampireWombat

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
function room_RepExec()
{
if (mouse.x==cMM.x && mouse.y==cMM.y)
{
Display("Test.");
}
}

Crimson Wizard

#3
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

VampireWombat

Thank you very much. That's exactly what I needed. I have no idea how I missed it...

SMF spam blocked by CleanTalk