'Fuzzy' mouse location

Started by bx83, Wed 23/08/2017 04:37:47

Previous topic - Next topic

bx83

Hi
I've been trying to select objects, but if they're quite small, I can't do it. Take for example a key, whose spine is very thin; I can only select with the mouse pixel-perfect, and it takes ages. I've thought of a solution to this (compare mouse cursor to a range), but can't figure out how to implement it. Also I've though of surrounding the graphic with a colour one shade above transparent (very difficult, always comes out white, no idea how to use transparency), and attach a small 10x10 pixel object the mouse x,y, and check whether it's colliding with anything (also no idea how to do this, having a general object in Global mode).

Can anyone help? Has anyone had this pesky problem before? I imagine so but can't find any solutions to it.

Slasher

First off

Check all the mouse cursors hotspots are set at the right place.

Sometimes if the object(s) are really small: in the editor, open the room with the object(s) showing, then copy the room (print screen button on keyboard). In a paint program paste the background. Select an area around the key and cut it out so you have an area of the background with the key in the middle. Import to ags and select it as the object...The object now has a bigger click area... you may need to turn off it's 'use room lighting' to false,,,

Something alone these lines...


Khris

If this is about room objects, you can set them to non-clickable, then draw a hotspot behind them and use that.

In order to use transparency you need to make sure the game's color depth is set to 32bit first. Then import the sprite and AGS should detect and ask about the alpha channel.

Slasher

QuoteKhris: If this is about room objects, you can set them to non-clickable, then draw a hotspot behind them and use that.
Of course, I never mentioned that way, Khris..

Good way to go (nod)

NicolaGs

Your idea of creating a nearly transparent border around the object works quite well too (I used it several times).
The thing is to create a 32 bits bitmap, i.e. with alpha.
You must start with an empty image, i.e, not on a blank white or whatever colour background... an empty one (or you'll have to remove all the blank area around your sprite later).
You draw your key with 100% opacity. Then you paint with any colour (I prefer black) around the key, but with a 1% opacity and save your file in PNG32 bits format.
When you import your sprite :
- first dialog : you validate the use of alpha channel,
- second dialog : you set Transparent colour to No transparency.

The nearly transparent colour shouldn't be seen, but the clickable area of the object will be expanded.

Of course, you need a paint software that deals with alpha channel.
My first game : I Want Out!

bx83

Thankyou all, a simple solution was there as I knew :P
It turned out to be painless adding a hotspot (previous tried and failed code doing this exact thing has led me astray from it), though more complex than the 1% opacity colour :)

NicolaGs

It's a good thing to have several solutions to one problem. In my case : I had no choice, because I didn't have any more hotspot available...
My first game : I Want Out!

Snarky

To the original question, there's an interaction mechanism known as a "bubble cursor", where the cursor grows and shrinks as you move it so that it always selects the closest object. I think it could be well suited for adventure games. You have to figure out how to divide up the screen in a Voronoi diagram, though.

http://hci.toronto.edu/papers/tgrossman_CHI2005.pdf

SMF spam blocked by CleanTalk