Game Development Community

Pause Screen with animated sprite

by Doni "Spudz" Bowman · in Torque X 2D · 09/23/2010 (5:14 am) · 2 replies

The pause screen we have set up is working with the controller and keyboard but the animated sprite we are calling in is not being animated anymore. How we have it setup is that when you hit either the start button or the "P" key on the keyboard the game will pause and make visible the animated sprite we attached to the player. Is there a way to keep the animations of the pause sprite going while the game is paused?

#1
09/23/2010 (5:12 pm)
You could tick the animation manually from Game.
#2
09/24/2010 (12:32 am)
I did what Duncan suggested for Dungeons.
Here is what I did:
public void AddAnimationUpdate(T2DAnimatedSprite sprite)
{
    _animationUpdate.Add(sprite);
}

public void RemoveAnimationUpdate(T2DAnimatedSprite sprite)
{
    _animationUpdate.Remove(sprite);
}

protected override void Update(GameTime gameTime)
{
    base.Update(gameTime);

    if (_animationUpdate.Count != 0)
    {
        T2DAnimatedSprite _s;
        for (int i = _animationUpdate.Count - 1; i >= 0; --i)
        {
            _s = _animationUpdate[i] as T2DAnimatedSprite;
            if (_s != null && _s.IsRegistered)
                _s.UpdateAnimation((float)gameTime.ElapsedGameTime.TotalMilliseconds / 1000.0f);
            if (_s == null || _s.MarkForDelete || !_s.IsRegistered)
                _animationUpdate.RemoveAt(i);
        }
    }
}

protected ArrayList _animationUpdate = new ArrayList();