Location-arrows

Started by Hobbes, Wed 16/07/2003 11:26:29

Previous topic - Next topic

Hobbes

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

magintz

Of the top of my head i'm not sure, but you may have to use regions instead of hotspots.
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

Hobbes

Then the complication has just grown... Don't really know much about them. :)

I'll look into regions. Thanks for the suggestion!

BOYD1981

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

Limey Lizard, Waste Wizard!
01101101011000010110010001100101001000000111100101101111011101010010000001101100011011110110111101101011

SSH

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
}

12

Hobbes

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?

SSH

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
}


12

MachineElf

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

}
There are 10 kinds of people in the world: Those who understand binary and those who don't.

Proskrito

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.

Hobbes

*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.

SMF spam blocked by CleanTalk