Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Ghostlady on Sun 31/05/2009 01:16:34

Title: Hotspots different when using inventory item.
Post by: Ghostlady on Sun 31/05/2009 01:16:34
I seemed to have broke something in my game and am not sure what I did.  I have a hallway with 6 doors, three on each side.  Each of the doors is a hotspot.  If the cursor interacts with any of the 6 doors, everything seems to be working correctly.  If I use an inventory key on the each of the doors, the hotspot seems to have shifted forward.  So now door #6's hotspot is at door #5.

This is part of my repeatedly execute, (it changes the way the key is pointing)

if (player.ActiveInventory == iKey) {   
  if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hBedroomD) {
      iKey.Graphic = 10; } 
  if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hBedroomP) {
      iKey.Graphic = 10; } 
  if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hBathroom) {
      iKey.Graphic = 10; } 
  if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hDoor) {
      iKey.Graphic = 9; } 
  if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hHistoryRoom) {
      iKey.Graphic = 9; } 
  if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hBedroom) {
      iKey.Graphic = 9; }}
     
if (GUI.GetAtScreenXY(mouse.x, mouse.y)!=null) {
    if(Mouse.Mode!=eModeUseinv) {
       mouse.UseModeGraphic(eModePointer);}}

And

I am using this for using the inventory on the hotspot:

function hDoor_UseInv()
{
  if (player.ActiveInventory == iKey) {
      gGui3.Visible = true;
      SaySpecial2(player, "I guess this isn't my room then.");
      gGui3.Visible = false; }
Title: Re: Hotspots different when using inventory item.
Post by: Trent R on Sun 31/05/2009 01:20:11
Have you correctly marked the 'hotspot' (ie. where the mouse clicks) on the inventory item correctly? That seems like it may mess things up (especially since you see the mouse.x/y results immediately in the rep_exec)


~Trent
Title: Re: Hotspots different when using inventory item.
Post by: Ghostlady on Sun 31/05/2009 01:27:07
Yes, I did.
Title: Re: Hotspots different when using inventory item.
Post by: Ghostlady on Sun 31/05/2009 01:42:19
The first image shows the hotspot on the last door, the bathroom, see the arrow.

The second image show the inventory key on the "now" bathroom hotspot, the middle door.

I am using the "overhotspot" gui so don't let the wording throw you.

Sample1 (http://www.mysterymanor.net/junk/Sample002.jpg)

Sample2 (http://www.mysterymanor.net/junk/Sample004.jpg)
Title: Re: Hotspots different when using inventory item.
Post by: Ghostlady on Sat 06/06/2009 04:25:14
I figured out what is causing this problem.  I upgraded to the latest AGS version, SP1, and one of the enhancements is this: * Added inventory item CursorImage property to allow you to set a different image for the mouse cursor to the inventory window *

So when I was coding this: if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hBedroomD) {
      iKey.Graphic = 10;

It must have been getting confused since the CursorImage defaulted to the inventory image, which was something like 200.  Once I changed the image number to 10 in the CursorImage box, it started working correctly again. Yea!