Jump to content
  • 0

Stop Attack Animation while moving?


Justn

Question

Has anyone attempted to block the attacking animation from starting while walking or is this a engine limitation at the moment? There already seems to be a check for a If moving  = then just walk. I have attempted to add !IsMoving in a few sections below but seems to not stop the attack animation completely.

 

Thank you.

 

 SpriteAnimation = AnimatedTextures[SpriteAnimations.Idle] != null && LastActionTime + TimeBeforeIdling < Globals.System.GetTimeMs() ? SpriteAnimations.Idle : SpriteAnimations.Normal;
            if (IsMoving)
            {
                SpriteAnimation = SpriteAnimations.Normal;
                LastActionTime = Globals.System.GetTimeMs();
            }
            else if (AttackTimer > Globals.System.GetTimeMs()) //Attacking
            {
                var timeIn = CalculateAttackTime() - (AttackTimer - Globals.System.GetTimeMs());
                LastActionTime = Globals.System.GetTimeMs();

                if (AnimatedTextures[SpriteAnimations.Attack] != null)
                {
                    SpriteAnimation = SpriteAnimations.Attack;
                    SpriteFrame = (int)Math.Floor((timeIn / (CalculateAttackTime() / 3f)));
                }

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...