Object animation.

Started by td, Wed 24/05/2006 17:08:07

Previous topic - Next topic

td

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?

Ashen

#1
Generally, to make objects animate, you use the Object.Animate 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 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 property, e.g.:
Code: ags

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 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.
I know what you're thinking ... Don't think that.

td

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

SMF spam blocked by CleanTalk