Animating Cursor

Started by Dragonisle, Tue 04/10/2005 22:20:43

Previous topic - Next topic

Dragonisle

Hi,
I want to animate the cursor only over a certain hotspot, not all of them. Can this be done? For example...have some animating feet for a exit hotspot.
Thanks

Ashen

#1
One way to do it is:

First, create an int in the room(s) you want it to happen in:
Code: ags

// room script
int cursorset;

(Actually, if you want it to happen in multiple rooms, you've propbably better making it a global int, or using the Get/SetGlobalInt functions.)


Put this in the repeatedly_execute function for the room(s):
Code: ags

//room rep_ex
if (Hotspot.GetAtScreenXY(mouse.x,mouse.y) == hExit) { // or whatever your hotspot is called
  if (cursorset == 0) {
    Mouse.ChangeModeView(Mouse.Mode, ANIMFEET);
    cursorset = 1;
  }
}

// other 'else if (Hotspot.GetAtScreenXY(...' conditions could go here.

else {
  if (cursorset == 1) {
    Mouse.ChangeModeView(Mouse.Mode, -1);
    cursorset = 0;
  }
}

NOTE(1): Change ANIMFEET to the name of the view containing the animation.
NOTE(2): Using Mouse.Mode as above will change the graphic for whatever mode you're using - to make it specific to one (e.g. eModeInteract), just change that part of both lines. If you want to have a different anim running for a couple different mode, just add more Mouse.ChangeModeView commands. (Be sure to add matching -1 lines at the end, though.)

Also, remember you'll have to add the rep_ex bit to every room you want it in - I don't think there's an easy way to make it global, as the same hotspots won't necessarily be 'animated' in every room.
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk