Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: kaputtnik on Fri 08/08/2008 11:41:34

Title: GetAtScreenXY - area rather than just pixel?
Post by: kaputtnik on Fri 08/08/2008 11:41:34
Hello there.

I have a rather odd problem and can't think of a solution that wouldn't involve code trash galore, so I thought I might as well ask: I'd like to check whether there is character standing at a certain point where the player clicks. The problem is that the GUI is a home brew verb coin GUI with different buttons, so the mouse pointer will actually end up next to the character in at least 50% and thus not give a response.

Is it possible to define a field to be checked, rather than a single pixel coordinate? A fixed hotspot also won't work, because the characters will be standing at different locations too often.

Thanks in advance!
Title: Re: GetAtScreenXY - area rather than just pixel?
Post by: Khris on Fri 08/08/2008 12:10:08
Checking an area is problematic because there could be more than one character inside.
Why don't you store the character when the player presses the button down, then use that stored character to run the interaction as soon as the button is released?
Title: Re: GetAtScreenXY - area rather than just pixel?
Post by: Mazoliin on Fri 08/08/2008 12:45:43
Consept from the verbcoin gui template:

Make to ints (mx, my), and when you click set mx, my to the mouse x and y co-ordinates. Then you can move the mouse how much you want, and still have the important co-ordinates.
Title: Re: GetAtScreenXY - area rather than just pixel?
Post by: SSH on Fri 08/08/2008 12:48:45
To put that another way: store whether the character is there when the verb coin opens, rather than when the verb is selected.
Title: Re: GetAtScreenXY - area rather than just pixel?
Post by: kaputtnik on Fri 08/08/2008 13:38:40
Ah, this does the trick! Hats off to you!