[SOLVED] Objects seem to block scripts of hotspots

Started by johanvepa, Thu 26/11/2015 22:18:46

Previous topic - Next topic

johanvepa

I have put a neat little feature in my christamas spoof for the office where, whenever the mouse moves over a certain hotspot, the cursor changes. I use the mouse.Mode = eModeUseInv and change the players active inventory accordingly with functions like "hHotspot2_MouseMove()". That has worked so far.

However, in a certain room I put some objects that cover the entire room, and now the hotspots seem to be "missing" in some way. At least the game somehow no longer reacts to the mouse being on top of the hotspots.

I also tried making the game check for mouse x,y-coordinates in rep_exec, and change the cursor and mouse mode whenever mouse position was at certain location. This doesn't work either.

I have a feeling that the objects that cover the screen somehow prevent other functions from carrying out. What could be causing this?

CaptainD

I had the same issue a while ago - You can use object.clickable = false; replacing object with the object name(s).  That should do the trick.
 

Khris

It should be obvious: the object is covering the hotspots. Since AGS is 2D, it uses a layered approach. Characters and objects can obscure each other and parts of the background (i.e.: hotspots). This is useful of course, since in order to implement a filled fridge, all you have to do is cover the objects inside the fridge by another object, the fridge door.

If everything were kept active, how would the game know what you're clicking on? GetLocationType() only returns the topmost layer; if a character is standing in front of a box, which in turn covers a hotspot on the back wall, moving the mouse on top of all three will ignore the box and hotspot.

However, you can find out the Hotspot under the mouse using Hotspot.GetAtScreenXY(); this function will simply check the supplied coordinates against the Hotspot bitmap drawn/imported in the room editor.
Using the usual tracking method you can now handle the mouse entering or leaving an arbitrary hotspot in rep_exe.

johanvepa

Thank you very much for this solution, Khris, and for the hint, CaptainD.

Having slept on it, I think I'll also try using non-clickable versus clickable GUI's on top of each other.

I'll try out everything ;)

Thanks again.

johanvepa

GUI's work, albeit with a warning since I have to make them bigger than the screen, but I haven't got time for proper solutions with this :-\
I'll stick with it, and thank you very much for your contributions.

SMF spam blocked by CleanTalk