public override void _PhysicsProcess(float delta) { if (Input.IsActionPressed("up")) { PlayerDirection = Up; } if (Input.IsActionPressed("down")) { PlayerDirection = Down; } if (Input.IsActionPressed("left")) { PlayerDirection = Left; } if (Input.IsActionPressed("right")) { PlayerDirection = Right; } Velocity = MoveAndSlide(GetInput(delta)); if (IsMoving) { } if (!_Sword.Swinging) { switch (PlayerDirection) { case Up: _Sword.Rotation = 0f; _Sword.Position = new Vector2(0, -15); break; case Down: _Sword.Rotation = Convert.ToSingle(Math.PI); _Sword.Position = new Vector2(0, 15); break; case Left: _Sword.Rotation = Convert.ToSingle((3 * Math.PI) / 2); _Sword.Position = new Vector2(-16, -5); break; case Right: _Sword.Rotation = Convert.ToSingle((Math.PI) / 2d); _Sword.Position = new Vector2(16, -5); break; } } }
protected abstract Node_Direction parseDirection(PDirection node);