If mouse.x and mouse.y =???

Started by ezra, Thu 08/04/2004 16:16:34

Previous topic - Next topic

ezra

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
He who laughs last thinks slowest.

Darth Mandarb

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.

Ishmael

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.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

MarvinS

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).

Alynn

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.


MarvinS

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.

MarvinS

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 !

Scorpiorus

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.

SMF spam blocked by CleanTalk