Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: td on Wed 24/05/2006 17:08:07

Title: Object animation.
Post by: td on Wed 24/05/2006 17:08:07
I guess so it's my problem with english language but... For example i make START button  and i wanna if cursor put on START button then button is change colour.
Probably it must be object=gif animated??? Or?
Title: Re: Object animation.
Post by: Ashen on Wed 24/05/2006 17:26:19
Generally, to make objects animate, you use the Object.Animate (http://www.adventuregamestudio.co.uk/manual/Object.Animate.htm) command.

However, in is case that's not actually what you want. You need to set up a 'Repeatedly executed' interaction for the room, and use Object.GetAtScreenXY (http://www.adventuregamestudio.co.uk/manual/Object.GetAtScreenXY.htm) to check if the mouse is over it. If you just want the object's graphic to change once (e.g. to a highlighted version) use the Object.Graphic (http://www.adventuregamestudio.co.uk/manual/Object.Graphic.htm) property, e.g.:

if (Object.GetAtScreenXY(mouse.x, mouse.y) == oButton) { // Replace with your object's script name
  oButton.Graphic = 23; // Spriteslot for 'Highlight' graphic
}
else oButton.Graphic = 22; // 'Normal' graphic


If you want it to animate while the mouse is over it, use Object.Animate, and probably the Object.Animating (http://www.adventuregamestudio.co.uk/manual/Object.Animating.htm) property, to make sure the animation isn't constantly restarted (i.e. never gets a chance to run).

However, specifically for a Start button, you may be better using a GUI placed at the right point on screen. GUI Buttons have a settable 'mouseover image', that's automatically used when the mouse is over it.
Title: Re: Object animation.
Post by: td on Fri 26/05/2006 19:26:37
Thanks Ashen! I has read carefully what did u wrote. Oh yeah... animating button in GUi much more easy. Button is work, it's a Miracle! haha