Clicking on hotspots under objects

Started by MiteWiseacreLives!, Fri 28/09/2012 20:31:18

Previous topic - Next topic

MiteWiseacreLives!

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??

Crimson Wizard

#1
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

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


Khris

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.

MiteWiseacreLives!

#3
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.

SMF spam blocked by CleanTalk