Author Topic: [SOLVED] Extending the surface area of an object or character  (Read 642 times)

My test player has trouble picking up items (objects or characters) as they look quite small on the screen and she has to be careful when positioning the mouse cursor over the item in question. I'd like to sort of "increase mouse sensitivity area" when it comes to mouse clicks and IsInteractionAvailable functions. Is this possible?
« Last Edit: 02 Jan 2016, 11:54 by Nanuaraq »

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on one or more games that won an AGS Award!
    •  
    • Gurok worked on one or more games that was nominated for an AGS Award!
Re: Extending the surface area of an object or character
« Reply #1 on: 02 Jan 2016, 11:11 »
What I often do, and I believe it's a common technique, is put a thick border of rgba(0, 0, 0, 1) -- that's black with 1/255 opacity, around the object. You won't notice it in game, and it allows you to customise the clickable area to your liking. When you import the sprite into the sprites section of the project, you'll see a big pink outline where the almost transparent black is.

You can also use hotspots, but it depends on how you're currently using hotspots and takes a bit of finessing if you have an object sitting over a hotspot you've defined for the background. e.g. a vase object on a window sill hotspot. For simple cases though, it works well. Just define a hotspot and make its look/interact methods call the object's look/interact methods. You'll then want to disable the hotspot for the object when the object gets picked up.

There are other, more complicated ways to define a tolerance for object highlighting. Basically, you can replace the entire mouse hover and click processing functionality in AGS, if need be. That's a little involved though, and I'd recommend trying one of the other two methods first to see if either suits you.
« Last Edit: 02 Jan 2016, 11:14 by Gurok »

Re: Extending the surface area of an object or character
« Reply #2 on: 02 Jan 2016, 11:19 »
Thanks Gurok, this seems very doable.

Especially your first solution is good within the scope of my project.

But I'm a little unsure how to make the border opaque. Is it best done with a dynamic sprite (can do, just wondering if there is an even easier solution)?

Gurok

  • Rottwheelers
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on one or more games that won an AGS Award!
    •  
    • Gurok worked on one or more games that was nominated for an AGS Award!
Re: Extending the surface area of an object or character
« Reply #3 on: 02 Jan 2016, 11:30 »
I would just make changes to the sprites themselves and re-import them, opting to preserve alpha channel. Here's the blue cup altered, for example:



It could *possibly* be done with dynamic sprites, but working with transparency and dynamic sprites is a bit prohibitive. Is there a reason you want a system for adding this border? How many sprites does it affect? In my case, it's only ever been the odd tiny thing like a cup or a pen.

Also, I forgot to mention this, but I believe alpha channels might require that your game is a 32-bit colour game. I think most people work with that nowadays anyway.

Re: Extending the surface area of an object or character
« Reply #4 on: 02 Jan 2016, 11:53 »
Ah. Can do. Thank you.