Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ezra on Thu 08/04/2004 16:16:34

Title: If mouse.x and mouse.y =???
Post by: ezra on Thu 08/04/2004 16:16:34
I have my room, and I want to make it so when the mouse is over a certain area (at the bottom of the screen), the mouse cursor changes to a down arrow. I guess I could use the SetCursorMode to change the cursor, but I don't know how to do the [if mouse.x = whateva and mouse.y = whateva] SetCursorMode(DOWN_ARROW);

Please help..
From Ezra
Title: Re:If mouse.x and mouse.y =???
Post by: Darth Mandarb on Thu 08/04/2004 17:15:50
You should use hotspots.

When the mouse if over the hotspot, change the cursor to the down arrow.  Surround the hotspot with another hotspot that, when moused over, changes the cursor back.
Title: Re:If mouse.x and mouse.y =???
Post by: Ishmael on Thu 08/04/2004 18:09:02
In the beginning of the room script:

int curmode;

In the room repeadetly_execute function, place:

if (mouse.y > 180) { // this in case you use 320x200 res, it activates when the mouse is taken closer then 20 pixels form the bottom edge
Ã, Ã, curmode = GetCursorMode();
Ã, Ã, SetCursorMode(ARROW_DOWN);
} else {
Ã, Ã, SetCorsorMode(curmode);
}

This can be build global, more complicated, but this is the simplest method, just do it in every room you need the arrow cursor.
Title: Re:If mouse.x and mouse.y =???
Post by: MarvinS on Thu 08/04/2004 22:49:43
Is this possible to know the coordinates of the mouse when the player click ?

In order to do a specific action only when the player click on a certain area (and i dont want to use hotspot if possible).
Title: Re:If mouse.x and mouse.y =???
Post by: Alynn on Thu 08/04/2004 23:13:11
if you don't want to use a hotspot then you need to put it in your  on mouse click funtion....

mouse.x, and mouse.y will tell you the screen coordnants of the mouse pointer.
Title: Re:If mouse.x and mouse.y =???
Post by: MarvinS on Fri 09/04/2004 06:51:00
Ok, thanks
Title: Re:If mouse.x and mouse.y =???
Post by: MarvinS on Fri 09/04/2004 08:55:47
Another question :

Is this possible to have the mouse coordinate relative to the background, instead of the screen ?
That's because the background is larger than 320x200.

Perhaps will it be easier to do it with a hotspot, but it is possible to make an hotspot with no interactions ? Beacuse I only want to know, if the player has click on the hotspot, and I dont want that he can do action like 'Look', 'use', on this hotspot.
Title: Re:If mouse.x and mouse.y =???
Post by: MarvinS on Fri 09/04/2004 09:46:27
Quote from: MarvinS on Fri 09/04/2004 08:55:47
Another question :

Is this possible to have the mouse coordinate relative to the background, instead of the screen ?
That's because the background is larger than 320x200.

ok, I found the answer. I must use the GetViewPort functions.


But my Hotspot question still continue !
Title: Re:If mouse.x and mouse.y =???
Post by: Scorpiorus on Sat 10/04/2004 18:29:18
QuotePerhaps will it be easier to do it with a hotspot, but it is possible to make an hotspot with no interactions ? Beacuse I only want to know, if the player has click on the hotspot, and I dont want that he can do action like 'Look', 'use', on this hotspot.
If you want to go with a hotspot you can either use a global unhandled_event() function (see manual) or put your handling code into Any Click on Hotspot interaction.