Animate the Cursor Only Once

Started by Bad Voo-doo man, Sat 26/03/2005 09:41:28

Previous topic - Next topic

Bad Voo-doo man

In my game, The cursor starts as a + and then when it moves over a character, or something you can interact with, It opens up into a box instead of the plus...I need to make it so it animates when its over whatever you can interact with, but only once and it stays at the box untill the mouse is moved off of whatever was there.  I've tried messing around with the animate cursor....only when over hotspot, but that just animates it over and over.  And isn't really what I'm looking for.  Is there any other way to accomplish this?
<img>Image Comming Soon!</img>
The Fall of Reach (A Halo fan game)
STORY: 100%
GRAPHICS: 2%
CODE: .56%

Ashen

I think you'd have to code that manually, in rep_ex, e.g.:
It's easier if the frames are in sequence, but it's still do-able if they're not. For now, suppose the cross sprite is 16, the box is 21, and the animation frames are between them.
Code: ags

// define a couple of ints
int cursor = 16; // as 16 is the first frame of your animation
int step; // to set a delay

#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
  // put anything you want to happen every game cycle here
  if (GetLocationType (mouse.x, mouse.y) != 0) { // Mouse is over something
    if (cursor < 21) { // i.e. not the box
      step ++; // increase step every game loop
      cursor += (step/3); and increase cursor every 3 loops
      // You could miss out step, and just use cursor ++, but I think that runs to fast
      // Play with the delay untill it suit you.
    }
  }
  else { // Mouse isn't over something
    cursor = 16; // reset cursor to the cross
    step = 0; // and reset step
  }
  ChangeCursorGraphic (GetCursorMode(), cursor); // As cursor changes, so does the mouse graphic

NOTE: this also assumes a single cursor interface. If you have different anims for different modes, again it's do-able you just have to add a few conditionals in there.
I know what you're thinking ... Don't think that.

Bad Voo-doo man

Wow, Thanks a lot! I'll give it try as soon as I get to my house...There's only one animation for the cursor, but thanks again Ashen
<img>Image Comming Soon!</img>
The Fall of Reach (A Halo fan game)
STORY: 100%
GRAPHICS: 2%
CODE: .56%

Bad Voo-doo man

Thanks Ashen, I tried your script and it works like a charm! I'm in your debt :=
<img>Image Comming Soon!</img>
The Fall of Reach (A Halo fan game)
STORY: 100%
GRAPHICS: 2%
CODE: .56%

SMF spam blocked by CleanTalk