Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: stepsoversnails on Mon 13/06/2011 05:49:19

Title: Animate Button On Rollover
Post by: stepsoversnails on Mon 13/06/2011 05:49:19
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.
Title: Re: Animate Button On Rollover
Post by: Khris on Mon 13/06/2011 06:41:10
There's unfortunately no elegant way to do this:

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