I'm currently creating animation with xna. I have no problem to animate spritesheet when the frame Height, Width and duration are the same between all the frames.
But i didn't find it very flexible and i'd like to animate without a spritesheet of same frameHeight/Width and more importantly without constant duration.
Is there any tutorials or code sample to learn this?
EDIT: I think of something like this but i can't make it work:
public void Update(GameTime gameTime)
{
if (elapsedTime > frameTime)
{
currentFrame++;
elapsedTime = 0;
}
sourceRect = new Rectangle(newpositionX, newpositionY, newframeWidth, newframeHeight);
frametime = newframetime
}
enter code here
The difficulty is how to specify accurately the new position and the new frame time for each frame.