object hotspot too small

Started by pixg, Wed 21/11/2012 09:28:09

Previous topic - Next topic

pixg

I have found that the hotspot on an object can be awfully small, because of this it can take several attempts to pick the object up by not clicking the very precise area, this in turn leads people to believe they can not pick up the object and give up after the first few attempts.

I was wondering if there is a way to make the clickable area or the hotspot larger so that it is much easier to pick it up?

Would creating a room hotspot area around the object be the best solution to the pro
blem?

Lewis

In General Settings -> Visual, you'll find an option for 'Pixel-perfect click detection'. If it's set to true, the game will detect the shape of your object sprite based on the alpha channel, and make anything that's transparent unclickable. If you set it to false, it'll just make the clickable area of the object a rectangle that surrounds the whole thing. This might solve your issue.
Returning to AGS after a hiatus. Co-director of Richard & Alice and The Charnel House Trilogy.

kinan___rod

#2
Another thing you can do is linking object click to a hotspot behind the object instead of the object itself.
Like this you can define any size and shape for the hotspot erea.
Code: AGS
function hHotspot_Interact()
{
    oObject.visable = fales;
    player.AddInventory(iItem);
    hHotspot.Enabled = false;
}

Not sure if this is professional though.

Crimson Wizard

#3
I'd say the choice between those solutions depends on the rest of the game. For example, you may have objects that you want to be interacted using pixel-perfect detection (e.g. they have complex shape). In which case you won't be able to use global setting to turn pixel-perfect detection off, and will have to use other solutions, like the one pointed by kinan___rod.

selmiak

Another idea with less code is to place the object like it already is, start the game and then screenshot the scene ingame and cut the area you want the object to be from the screenshot in a painting program and use the cropped screenshot as object. This way you can still have other objects with pixel perfect click detection. The downside is that when you change the background image around the object you have to change the object image too. And with animated objects it can also be hard to do ;)

Crimson Wizard

#5
Quote from: selmiak on Wed 21/11/2012 13:50:06
Another idea with less code is to place the object like it already is, start the game and then screenshot the scene ingame and cut the area you want the object to be from the screenshot in a painting program and use the cropped screenshot as object. This way you can still have other objects with pixel perfect click detection. The downside is that when you change the background image around the object you have to change the object image too. And with animated objects it can also be hard to do ;)
This also won't work if Object has a normal baseline :) - other objects and characters will be drawn behind that part of background you copied to object's graphic.

But regardless, I don't get this screenshot thing. Why can't you just take your background pic?

Slasher

Normally with smallish objects, as mentioned, I show room with the object visible, screen capture it and cut around object in a paint program (so area of object is bigger) and use it as the object. You do need to line it up well with the background.

Works everytime.


Lewis

A good suggestion too. I'd warn against doing this if you plan to change the light levels of the region in which the object is at any point. Because you'll probably end up with a slight discrepancy between the perceived light level of the object and the background.
Returning to AGS after a hiatus. Co-director of Richard & Alice and The Charnel House Trilogy.

selmiak

yep, it's a quick and dirty solution, the best way is probably using a room hotspot and disabeling the click on the object.

MurrayL

There's a much easier solution than using a screenshot if you're able to use alpha channel (PNG) sprites.

Expand the edges of the object to your desired dimensions, and then fill the outside layer with pure black/white at the minimum opacity (but not 0%). You won't be able to see it in-game, but AGS should treat it as visible pixels for the purpose of click detection.

SMF spam blocked by CleanTalk