Hotspots behind objects

Started by stamatefilip, Tue 05/06/2012 12:52:29

Previous topic - Next topic

stamatefilip

Hi!

I encountered a little problem. So, I have a transparent object behind which the player can move, but if I place a hotspot behind it, I can't access it with "Look at hotspot", "Interact hotspot" and so on. Basically, I want to be able to interact with the transparent object too, but the area where the hotspot is should belong to the hotspot.

Is there a way to move the hotspot in front of the object? That seems like it would solve my problem.

Thank you.

Jared

A workaround that springs to mind is to use if statements on the objects functions to call the hotspot interactions.

Something like

Code: AGS
oObject1_Look(){

if(mouse.x > xa && mouse.x < xb){
    if(mouse.y > ya && mouse.y < yb){
        hHotspot1_Look();
    }
}else{
    Display("Man this thing gets in the way!");
    }
}


Bear in mind I haven't done much coding for quite a while so that's probably a little sloppy...

stamatefilip

Hah, thanks! You pointed me in the right direction I think!
I used this on the transparent object:

Code: AGS
function oLight_Look()
{
 if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hLeftLamp)
  Display("Now the click gets right through it!");
}


Seems to work for now!

monkey0506

If the object isn't meant to be interacted with at all, you can simply set Clickable to false:

Code: ags
function room_Load()
{
  oLight.Clickable = false;
}

Jared

Lol, glad you got the idea because looking back I worded that quite confusingly. I am WAY too tired to be giving people advice online...  :P

stamatefilip

Yes, thanks! Even better, following monkey_05_06's advice I approached it another way.
I made the object unclickable, then made a hotspot for it. So now there's two hotspots, one for the transparent object and the one behind it. I think it's better like this in case I want to have other stuff behind the transparent object later! Plus, you get the ego interactions as well which weren't accessible either when the player was behind the object!

I know, I must sound too enthusiastic for such small stuff, but just yesterday I installed AGS for the first time. :)

Khris

Just to make sure, you aren't talking about transparent areas of the object's sprite but you have an object with its Transparency set to something above 0, right?
So you actually want the click to go through some of the object's semi-transparent areas, but not through others?

Cause I guess I was reading the OP wrong and at first wanted to write about checking the pixel-perfect click detection setting.

monkey0506

Actually, I might have skimmed the OP too fast and missed the fact that you wanted to be able to interact with the object. (roll) I'll blame it on the fact that I was on break at work and trying to multitask. :P

The pixel-perfect click detection setting is probably not a bad idea either way though.

SMF spam blocked by CleanTalk