Animating Sprites?

Aug 5, 2011 at 1:58 AM

I can't seem to find much info about animating a Sprite (physicsObject). 

Let's say for instance, in my game I have created a userControl called ucPlayer.  During the initialization of the game, ucPlayer gets added to the physics controller (in code).  During game play, when the user hits the left or right key, I want the ucPlayer to flip to the left or right or do some other interesting animations for other reasons... hands up/down, etc.   In a perfect world, I'd like to be able to create Storyboards for each animation that could then be applied to ucPlayer from code (fire the Storyboards as necessary)... but I believe Andy said in an earlier post that there may be no way (easy way) to do this.

Ideas?  Any help would be appreciated.

Coordinator
Aug 5, 2011 at 1:05 PM

There used to be big limitations on what Storyboards were carried over to the physics controller. But in newer versions, most Storyboards should come over OK.

Place your PhysicsObjectBehavior on a Canvas inside your UserControl. Make sure your Storyboard is animating items inside the Canvas. And you should be OK.

A word of caution though - on WP7, Storyboard animations perform horribly!! I usually do little tricks like turn off Storyboards when I can, or use programmatic animations inside the timer loop instead of SB's.