Ejemplo n.º 1
0
        public override void Update()
        {
            float speed = 5;

            hurtTimer.Update();
            if (hurtTimer.Ready())
            {
                color = Color.White;
                hurtTimer.Reset();
                hurtTimer.Puase();
            }
            kinetics.velocity.X = ControllerInput.Instance().Sticks.Left.X *speed;
            kinetics.velocity.Y = -ControllerInput.Instance().Sticks.Left.Y *speed;

            if (ControllerInput.Instance().GetKey(Keys.Left).Held)
            {
                kinetics.velocity.X = -speed;
            }

            if (ControllerInput.Instance().GetKey(Keys.Right).Held)
            {
                kinetics.velocity.X = speed;
            }

            if (ControllerInput.Instance().GetKey(Keys.Down).Held)
            {
                kinetics.velocity.Y = speed;
            }

            if (ControllerInput.Instance().GetKey(Keys.Up).Held)
            {
                kinetics.velocity.Y = -speed;
            }

            Attack();

            LevelBoundingBox();

            kinetics.Update();

            if (Melee)
            {
                if (currentAnimation.Finished())
                {
                    currentAnimation = walk;
                    currentAnimation.Reset();
                    Melee = false;
                }
            }

            if (Magic)
            {
                if (currentAnimation.Finished())
                {
                    currentAnimation = walk;
                    currentAnimation.Reset();
                    Magic = false;
                }
            }

            currentAnimation.Update(kinetics);
        }