Game Development Community

A word from the not so wise for fellow newbies.

by Cosmic Logic · in Torque X 2D · 11/13/2009 (12:25 am) · 0 replies

Hey,

After following some code with the source in TX I found a problem with the way I was playing my animations.

The way I did it was simply changing the animation data:
mySprite.AnimationData = someAnimationData;

The correct way (as far as I know) is to use this method:
mySprite.PlayAnimation(someAnimationData);

The problem I was having is that once in awhile the animation would keep going with the new one where the old one left off and the new one had less frames. The next animation would tick to the next frame (lets say frame 6 to 7) but the animation thinks its using the new animation (lets say with only 4 frames). So, now you've got an animation with only 4 frames trying to display the 7th frame... EXPLOSION!

Just for good measure I figured I should give you guys a heads up.