Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Kain_V on Sun 22/02/2009 20:02:57

Title: Problem with Mouse Over GUI [SOLVED]
Post by: Kain_V on Sun 22/02/2009 20:02:57
Hi, I am trying to make a GK2 style game so I have a GUI appearing on the bottom of the background room (always visible) . And I want the mouse to change mode each time it passes the edges of the room to an exit mouse cursor, and then to change back again. So I put 3 hotspots with the following code:


function hHotspot2_MouseMove()
{
  mouse.SaveCursorUntilItLeaves();
  mouse.Mode= eModeRoomExitL;

}

function hHotspot3_MouseMove()
{
  mouse.SaveCursorUntilItLeaves();
  mouse.Mode= eModeExitright;
}

function hHotspot4_MouseMove()
{
  mouse.SaveCursorUntilItLeaves();
  mouse.Mode= eModeExitDown;
}


The problem is that when my cursor passes the hotspot at the bottom edge and moves over the GUI it changes to exit cursor and stays that way... How can I set a specific cursor mode when the cursor is over the GUI?

For an image go to:

http://img24.imageshack.us/my.php?image=roomgui.png (http://img24.imageshack.us/my.php?image=roomgui.png)
Title: Re: Problem with Mouse Over GUI
Post by: Makeout Patrol on Sun 22/02/2009 22:30:32
The way I would do it is to put the code for changing the mouse mode in the game's 'repeatedly execute' function; when the mouse is below a certain y-coordinate, change it to 'pointer' for the GUI, when the mouse is over each of the exit regions, switch it to the exit cursor, and when the mouse is over none of those, change it to the default mode. That way, you also wouldn't need to put this code in every single room.
Title: Re: Problem with Mouse Over GUI
Post by: Kain_V on Sun 22/02/2009 22:43:48
Thanks for the quick reply!
I'm not much of a scripter so, can you show me the code, how would you do it?
Title: Re: Problem with Mouse Over GUI
Post by: Ultra Magnus on Mon 23/02/2009 00:22:12
There are 2 or 3 different methods in this post (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36670).
Title: Re: Problem with Mouse Over GUI
Post by: Kain_V on Mon 23/02/2009 01:19:57
Thanks for the help guys!
Another problem solved!  ;D