Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: MiteWiseacreLives! on Fri 28/09/2012 20:31:18

Title: Clicking on hotspots under objects
Post by: MiteWiseacreLives! on Fri 28/09/2012 20:31:18
Having trouble, tried searching with no luck.
I want to be able to interact with certain hotspots set underneath an Object.
This is inorder to do animations with the Object as you interact on diferent parts of it.
Is it posible to lay hotspots over an object??
Title: Re: Clicking on hotspots under objects
Post by: Crimson Wizard on Fri 28/09/2012 20:56:25
First of all, why can't you make several objects each for bigger object's part?

Rearding hotspots.
Hotspots are layed over room background and have no explicit relation to objects.
You may get a hotspot under cursor by calling Hotspot.GetAtScreenXY function. That should return a hotspot even if there's something above it (character or object).
You may then run any possible interaction with the hotspot you found by the use of Hotspot.RunInteraction function.

Basic example:
Code (ags) Select

Hotspot *h = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
if (h != null)
{
   h.RunInteraction(mouse.Mode);
}

Title: Re: Clicking on hotspots under objects
Post by: Khris on Sat 29/09/2012 02:15:41
A hotspot is a part of the background while an Object is part of the foreground. However, if you're just using the object to animate the background as opposed to something the player can interact with, you can set the object's clickable property to false.
Title: Re: Clicking on hotspots under objects
Post by: MiteWiseacreLives! on Sat 29/09/2012 07:17:33
Thanks Khris!
Set clickable to false in the "before enters room" area, works fine now.
It's a keypad (the object) and the keys are hospots. Thought it would be easier to animate and line up the keys this way, Crimson. I would use your suggestion if it was critical to interact with the Object, but it just needs to have blinking keys and a little 2 option display.