Animate Button On Rollover

Started by stepsoversnails, Mon 13/06/2011 05:49:19

Previous topic - Next topic

stepsoversnails

I'm having trouble scripting a button to animate while the mouse is over it. I'm sure it's not difficult and i'm just stupid.

Khris

There's unfortunately no elegant way to do this:

Code: ags
// in repeatedly_execute(_always)

  GUIControl*gc = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
  if (gc == Button1) {
    if (!button1_animating) {
      Button1.Animate(BUTTONVIEW1, 0, 3, eRepeat);
      button1_animating = true;
    }
  }
  else {
    Button1.NormalGraphic = 47;
    button1_animating = false;
  }


If you have more than one or two buttons that are supposed to be animated, it's probably better to use a more general approach.

SMF spam blocked by CleanTalk