Game Development Community

Animation frame not starting on the first frame

by John Bura · in Torque X 2D · 11/11/2010 (7:20 pm) · 4 replies

Hi guys,

Im trying to make a simple door animation and it works very well. Except, I cannot get the animation to start on the first frame. The first frame is the door in closed position and the last frame is the open position. The problem is when I drop the animation onto my scene, the default frame is the last one instead of the first one. In the game it also shows the last frame first.

Here is my door code
T2DAnimatedSprite DoorOpen1 = TorqueObjectDatabase.Instance.FindObject<T2DAnimatedSprite>("DoorAni");


            if (DoorOpen1 != null)
                DoorOpen1.PlayAnimation();

Does anybody know what I can do?

#1
11/12/2010 (3:05 am)
is it set to play on load? if you edit your animated sprite
#2
11/12/2010 (3:35 am)
It isn't but for some reason it plays on load.
#3
11/12/2010 (10:20 am)
If you set ((T2DAnimatedSprite)YourAnimationObj).StartFrame = 0; before you register does it work as you expected?
#4
11/12/2010 (1:38 pm)
Ive tried to put that in where the level is loaded. But no success.

T2DAnimatedSprite DoorOpen1 = TorqueObjectDatabase.Instance.FindObject<T2DAnimatedSprite>("DoorAni");

            if (DoorOpen1 != null)
                DoorOpen1.StartFrame = 0;