Basic cursor question.

Started by , Wed 12/07/2006 09:08:33

Previous topic - Next topic

Saner

Hiya, its been a while since I played about with anything like this, and after reading the getting started tutorials, something is not covered that I am trying to work out.

I dont even know if its possible, and rather than spend hours trying to work it out and then find out its not possible, I have decided to post.


On my reading, I read that you can animate a cursor over a hotspot / object.

Is there anyway of changing what cursor is used when animating.

For example.

If I have it over a object, I would like to see a (for example) grabbing hand.

If it is over the left hand side of the screen near an exit point, an arrow pointing to the right, or vice versa if its the right hand side.


Is this possible to have mutiple cursors for diffrent objects / hotspots, or would this fall into the advance scripting and something better not to look into until more experianced with the engine.

Thanks in advance.


monkey0506

Hmm...perhaps you could look into using Mouse.ChangeModeGraphic, and Mouse.ChangeModeView...

But it would require scripting to achieve the effect...I think...maybe. I'm actually just off to bed as I am about to pass out. THank you.

Khris

#2
This can be achieved pretty easily using the custom properties. (As long as it's not necessary for the cursor for a certain hotspot/exit/etc. to change during the game, since custom properties are static).

Yet it *does* fall under advanced scripting, IMO, at least from a beginner's point of view.
See below for an example of how to implement this:


Create a property, name: "exit", type: "bool", default value: "false"
Then a second one, name: "param", type: "number", default value: 0

Set the properties of a left-exit-hotspot: exit to true, param to 1.

In the repeatedly_execute(), you'd add something like this:
Code: ags
...
int param;
Hotspot*hs=Hotspot.GetAtScreenXY(mouse.x, mouse.y);
if (hs!=null) {
  param=hs.GetProperty("param");
  if (hs.GetProperty("exit")) {   // exit is set to true, so hotspot is an exit
    if (param==1) mouse.ChangeModeView(LEFTARROW);
    if (param==2) mouse.ChangeModeView(RIGHTARROW);
    ...
  }
  else {     // no exit, "normal" hotspot
    if (param==1) mouse.ChangeModeView(LOOKAT);
    if (param==2) mouse.ChangeModeView(INTERACT);
    ...
  }
}


It's basically the same for objects and characters, except with them it's not necessary to check the exit-property.
Just use the param-property to specify the default action.

SMF spam blocked by CleanTalk