Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: noxis on March 26, 2007, 03:31:50 PM

Title: Hotspot Animations
Post by: noxis on March 26, 2007, 03:31:50 PM
I have a title menu in the game, and when you move the mouse cursor over the "NEW GAME" entity, how do I make it activate an animation when you put the mouse cursor over it, and then when mouse cursor is not on it, reverse the animation.

The animation is a slight zoom in on the text, and then zooms back out when the cursor is not on it.
Title: Re: Hotspot Animations
Post by: Mnemonic on March 26, 2007, 05:24:57 PM
You didn't say how your menu is done. But I'll suppose it's not an ordinary window (because it's pretty straightforward to assign hover images to buttons), but it's made of entities, right? In that case see this thread  (http://forum.dead-code.org/index.php?topic=1942.msg13179#msg13179) for an example of how to change entity sprite on mouse over.
Title: Re: Hotspot Animations
Post by: noxis on March 27, 2007, 03:39:36 AM
I did that and when the cursor was over the hotspot it kept looping the first frame over and over again, until i moved the cursor away from the image it would go through the whole animation.  I would display the code but I'm not at home at the moment.  Actually I'll try to remember it off the top of my head

on "MouseEntry"
{
  newgame.SetSprite("sprites\menu\newgame_zoomin.sprite");
}

on "MouseLeave"
{
  newgame.SetSprite("sprites\menu\newgame_zoomout.sprite");
}


Also when I make the initial entity of the "new game" and I have to attach a sprite to it, should I make a one frame animation of the first frame?  So it doesn't automatically when the screen loads.


Title: Re: Hotspot Animations
Post by: Mnemonic on March 27, 2007, 11:53:35 AM
Your newgame_zoomin.sprite is probably set as looping animation. Uncheck the "Looping" check-box in SpriteEdit and it should work ok.