Beispiel #1
0
        public void EnterAttack()
        {
            movement.Axis          = null;
            movement.TargetSpeed.X = 0;
            movement.TargetSpeed.Y = 0;

            Vector2 offset    = new Vector2(0, -16);
            Vector2 direction = new Vector2(X - Input.MouseX + offset.X - Scene.CameraX, Y - Input.MouseY + offset.Y - Scene.CameraY);

            direction.Normalize();
            movement.Speed.X = 1000 * -direction.X;
            movement.Speed.Y = 1000 * -direction.Y;

            movement.MoveXY((int)(direction.X * -1000), (int)(direction.Y * -1000), Collider);

            if (Rand.Chance(50))
            {
                Sfx.instance.sword.Play();
            }
            else
            {
                Sfx.instance.sword2.Play();
            }

            var slash = Scene.Add(new Slash(X + offset.X, Y + offset.Y, direction.X, direction.Y, Damage.Side.player));

            attackTimer = 30;

            sprite.Play("attack");
            sprite.Flip = direction.X > 0;
        }