Exemplo n.º 1
0
        public void Update(TimeSpan elapsed)
        {
            m_rigidBody.Update(elapsed);

            m_down = m_rigidBody.Grounded && Engine.Keyboard.IsKeyPressed(Key.Down);

            var sequence = GetSpriteSequence();

            if (sequence != m_currentSequence)
            {
                m_currentSequence = sequence;
                m_currentSequence.Reset();
            }

            m_currentSequence.Update(elapsed);
        }
Exemplo n.º 2
0
        public Player()
        {
            m_location  = new LocationComponent(this);
            m_rigidBody = new RigidBodyComponent(this, m_location);

            m_renderer = new SpriteRenderer(PlayerSprites.Instance);
            m_sprite   = m_renderer.AddSprite(PlayerSprites.Instance.StandRight);

            m_walkRightSequence = new SpriteSequence(
                PlayerSprites.Instance.WalkRight01,
                PlayerSprites.Instance.WalkRight02,
                PlayerSprites.Instance.WalkRight03,
                PlayerSprites.Instance.WalkRight04,
                PlayerSprites.Instance.WalkRight05,
                PlayerSprites.Instance.WalkRight06,
                PlayerSprites.Instance.WalkRight07,
                PlayerSprites.Instance.WalkRight08,
                PlayerSprites.Instance.WalkRight09,
                PlayerSprites.Instance.WalkRight10,
                PlayerSprites.Instance.WalkRight11
                );

            m_walkLeftSequence = new SpriteSequence(
                PlayerSprites.Instance.WalkLeft01,
                PlayerSprites.Instance.WalkLeft02,
                PlayerSprites.Instance.WalkLeft03,
                PlayerSprites.Instance.WalkLeft04,
                PlayerSprites.Instance.WalkLeft05,
                PlayerSprites.Instance.WalkLeft06,
                PlayerSprites.Instance.WalkLeft07,
                PlayerSprites.Instance.WalkLeft08,
                PlayerSprites.Instance.WalkLeft09,
                PlayerSprites.Instance.WalkLeft10,
                PlayerSprites.Instance.WalkLeft11
                );

            m_standRightSequence = new SpriteSequence(PlayerSprites.Instance.StandRight);
            m_standLeftSequence  = new SpriteSequence(PlayerSprites.Instance.StandLeft);
            m_jumpRightSequence  = new SpriteSequence(PlayerSprites.Instance.JumpRight);
            m_jumpLeftSequence   = new SpriteSequence(PlayerSprites.Instance.JumpLeft);
            m_duckRightSequence  = new SpriteSequence(PlayerSprites.Instance.DuckRight);
            m_duckLeftSequence   = new SpriteSequence(PlayerSprites.Instance.DuckLeft);
        }
Exemplo n.º 3
0
        public Player()
        {
            m_location = new LocationComponent(this);
            m_rigidBody = new RigidBodyComponent(this, m_location);

            m_renderer = new SpriteRenderer(PlayerSprites.Instance);
            m_sprite = m_renderer.AddSprite(PlayerSprites.Instance.StandRight);

            m_walkRightSequence = new SpriteSequence(
                PlayerSprites.Instance.WalkRight01,
                PlayerSprites.Instance.WalkRight02,
                PlayerSprites.Instance.WalkRight03,
                PlayerSprites.Instance.WalkRight04,
                PlayerSprites.Instance.WalkRight05,
                PlayerSprites.Instance.WalkRight06,
                PlayerSprites.Instance.WalkRight07,
                PlayerSprites.Instance.WalkRight08,
                PlayerSprites.Instance.WalkRight09,
                PlayerSprites.Instance.WalkRight10,
                PlayerSprites.Instance.WalkRight11
            );

            m_walkLeftSequence = new SpriteSequence(
                PlayerSprites.Instance.WalkLeft01,
                PlayerSprites.Instance.WalkLeft02,
                PlayerSprites.Instance.WalkLeft03,
                PlayerSprites.Instance.WalkLeft04,
                PlayerSprites.Instance.WalkLeft05,
                PlayerSprites.Instance.WalkLeft06,
                PlayerSprites.Instance.WalkLeft07,
                PlayerSprites.Instance.WalkLeft08,
                PlayerSprites.Instance.WalkLeft09,
                PlayerSprites.Instance.WalkLeft10,
                PlayerSprites.Instance.WalkLeft11
            );

            m_standRightSequence = new SpriteSequence(PlayerSprites.Instance.StandRight);
            m_standLeftSequence = new SpriteSequence(PlayerSprites.Instance.StandLeft);
            m_jumpRightSequence = new SpriteSequence(PlayerSprites.Instance.JumpRight);
            m_jumpLeftSequence = new SpriteSequence(PlayerSprites.Instance.JumpLeft);
            m_duckRightSequence = new SpriteSequence(PlayerSprites.Instance.DuckRight);
            m_duckLeftSequence = new SpriteSequence(PlayerSprites.Instance.DuckLeft);
        }
Exemplo n.º 4
0
        public void Update(TimeSpan elapsed)
        {
            m_rigidBody.Update(elapsed);

            m_down = m_rigidBody.Grounded && Engine.Keyboard.IsKeyPressed(Key.Down);

            var sequence = GetSpriteSequence();

            if (sequence != m_currentSequence)
            {
                m_currentSequence = sequence;
                m_currentSequence.Reset();
            }

            m_currentSequence.Update(elapsed);
        }