Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Hobbes on Wed 16/07/2003 11:26:29

Title: Location-arrows
Post by: Hobbes on Wed 16/07/2003 11:26:29
Remember Full Throttle? That game had those neat arrows when you moved to the side of the screen, indicating you could travel in that direction.

I loved that, and to clear up navigational confusion within my own game, I would love to do that as well.

Now. I've tried to draw a few hotspots and make the cursor change when the mouse moves over it. This worked, but the problem was that the cursor doesn't change back when I move away from it again.

I think I can overcome this by drawing one huge hotspot around it (the rest of the screen). But I don't want to do that... the normal cursor I use highlights when it's over a hotspot and I don't want that to happen all the time...

Is there anyone who has implemented such a thing into his/her game? And willing to help me? :)
Title: Re:Location-arrows
Post by: magintz on Wed 16/07/2003 12:15:55
Of the top of my head i'm not sure, but you may have to use regions instead of hotspots.
Title: Re:Location-arrows
Post by: Hobbes on Wed 16/07/2003 13:12:35
Then the complication has just grown... Don't really know much about them. :)

I'll look into regions. Thanks for the suggestion!
Title: Re:Location-arrows
Post by: BOYD1981 on Wed 16/07/2003 13:49:04
well, i'm not sure about this, but you could make a big hotspot on the screen that sets the cursor to what it is normally, or just right near the hotspots that change the cursor...
Title: Re:Location-arrows
Post by: SSH on Wed 16/07/2003 13:55:52
Rather than using a hotspot interaction to change the cursor, do it in repeatedly_execute with:

if (GetHotspotAt(mouse.x,mouse.y)==EXITSPOTNUMBER) {
 // "exit here" cursor
} else {
 // "normal" cursor
}

Title: Re:Location-arrows
Post by: Hobbes on Wed 16/07/2003 14:29:04
SSH, you're making some sense to me, but I'm really not that skilled in scripting. :)

EXITSPOTNUMBER is a variable I will have to define, right?
Title: Re:Location-arrows
Post by: SSH on Wed 16/07/2003 14:42:41
Well, since you're probably going to have a lot of exits like this, I would recommend picking up the latest beta AGS and setting a property on every hotspot that you want to behave like this (call the property "IsExit" for example)

then put this somehere in your repeatedly execute function:

if (GetHotspotProperty (GetHotspotAt(mouse.x,mouse.y), "IsExit")) {
// "exit here" cursor
} else {
// "normal" cursor
}


Title: Re:Location-arrows
Post by: MachineElf on Wed 16/07/2003 15:34:08
I use changing mousecursors a lot. Basically, what happens in the following script (I believe you will have to use scripts for this, and you should really get into scripting, can't stress that enough!) is that whener your cursor hovers over a hotspot or object with a name, it'll animate. If the name of the hotspot is "Exit" it will animate the exit-cursor. Whenever you move the cursor out of an area, it'll return to normal state.
If you want different arrows for different directions, you'll have to call the exits "South", "North" etc and set the cursor graphic properly.

I've added a few comments to my code, but not too many. If you don't understand this right now, start scripting some more and then go through it again.

(Sorry about the indentation, is there a way to keep the indentation when posting?)

function repeatedly_execute() {
 
 //begin change mouse cursor:
GetLocationName (mouse.x,mouse.y,locationname);
if ( StrComp(locationname,"") == 0 )
  {
  SetDefaultCursor();
  cursor = 0;
  }
else
  {
  if (GetCursorMode() == 0)
     {
     if ( StrComp(locationname,"Exit") == 0) // all exits must say "Exit"!
        {
        if ( cursor != 5 )
           {
           SetMouseCursor (5); // = exitani
           cursor = 5;
           }
        }
     else if ( GetLocationType (mouse.x,mouse.y) > 0 )
        {
        if ( cursor != 8 )
           {
           SetMouseCursor (8); // = standardani
           cursor = 8;
           }
        }
     else
        {
        SetDefaultCursor ();
        cursor = 0;
        }
     }
  if (GetCursorMode() == 4) // = inv
     {
     if ( GetLocationType (mouse.x,mouse.y) > 0)
        {
        if ( cursor != 9 ) // was 5...
           {
           SetMouseCursor (9); // = invani
           cursor = 9;
           }
        }
     else
        {
        SetDefaultCursor ();
        cursor = 0;
        }
     }
  }
// end change mouse cursor

}
Title: Re:Location-arrows
Post by: Proskrito on Thu 17/07/2003 02:04:04
you could use the new properties feature.
Set a propertie called exit, with 4 different values, up down left and right, for setting the arrow direction, and then in the repeatedly execute you could check if the property is set, and which direction.
That is, if i understood properties well.
Title: Re:Location-arrows
Post by: Hobbes on Thu 17/07/2003 15:04:44
*grin*

Thank you everybody for these helpful comments! The script looks very interesting, so I'll begin to study that one.

Not that I can't script, but I've yet to delve into the more complex gaming functions.