Exemple #1
0
        public override void Update()
        {
            float speed = 5;

            kinetics.velocity.X = ControllerInput.Instance().Sticks.Right.X *speed;
            kinetics.velocity.Y = -ControllerInput.Instance().Sticks.Right.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);
            if (Vector2.Distance(kinetics.position, Avatar.Instance().kinetics.position) < 50)
            {
                Avatar.Instance().health.grow(.05f);
            }
        }
Exemple #2
0
        public override void Update()
        {
            float max = 5;

            Decision.makeDecision(thought);
            kinetics.velocity.X = MathHelper.Clamp(kinetics.velocity.X, -max, max);
            kinetics.velocity.Y = MathHelper.Clamp(kinetics.velocity.Y, -max, max);
            kinetics.Update();
            current.Update(kinetics);
        }
Exemple #3
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);
        }