Exemplo n.º 1
0
        public void WalkLeft(SpriteBatch spriteBatch)
        {
            int currIndex;

            if (LastMove == 'r')
            {
                ResetAll();
            }
            else
            {
                Run.SetIndex(0);
                Crouch.SetIndex(0);
                Stance.SetIndex(0);
                Attack.Reset();
                Special.SetIndex(0);
            }

            currIndex = Walk.GetIndex();
            Location  = new Vector2(Location.X - 20, Location.Y);
            if (currIndex < Walk.GetAnimationLength())
            {
                spriteBatch.Draw(Walk.GetTex(), Location, Walk.GetRect(), Color.White, 0, new Vector2(0), new Vector2(1), SpriteEffects.FlipHorizontally, 0);
                Walk.SetIndex(++currIndex);
            }
            else
            {
                currIndex = 0;
                Walk.SetIndex(currIndex);
                spriteBatch.Draw(Walk.GetTex(), Location, Walk.GetRect(), Color.White, 0, new Vector2(0), new Vector2(1), SpriteEffects.FlipHorizontally, 0);
                Walk.SetIndex(++currIndex);
            }
            LastMove = ('l');
        }
    public bool Attack(bool usePlayerInput)
    {
        if (m_comboHandler.Finished)
        {
            m_comboHandler.Reset();
            m_attackTime = 0.0f;
        }

        if (((usePlayerInput && Input.GetButtonDown(m_playerNumber + "_AttackNormal")) || (!usePlayerInput)))
        {
            if (m_attackTime >= m_attackCooldown)
            {
                m_comboHandler.Attack();
            }

            return(true);
        }

        return(false);
    }