From fe11421fc1d3cf440091f8f3622913bda9acb7ec Mon Sep 17 00:00:00 2001 From: HumanoidSandvichDispenser Date: Sun, 26 Mar 2023 10:53:58 -0700 Subject: [PATCH] fix other stuff from map switching --- BoundingBoxes/Hitbox.cs | 13 ++++++++++--- Characters/Player.tscn | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/BoundingBoxes/Hitbox.cs b/BoundingBoxes/Hitbox.cs index 04cee97..d6ceb13 100644 --- a/BoundingBoxes/Hitbox.cs +++ b/BoundingBoxes/Hitbox.cs @@ -16,6 +16,8 @@ namespace SupaLidlGame.BoundingBoxes [Export] public float Damage { get; set; } + private bool _isDisabled = false; + /// /// Getter/setter for the CollisionShape2D's Disabled property. /// @@ -25,10 +27,14 @@ namespace SupaLidlGame.BoundingBoxes get => _collisionShape.Disabled; set { - _collisionShape.Disabled = value; - if (value) + _isDisabled = value; + if (_collisionShape is not null) { - DamageStartTime = Time.GetTicksMsec(); + _collisionShape.Disabled = value; + if (value) + { + DamageStartTime = Time.GetTicksMsec(); + } } } } @@ -47,6 +53,7 @@ namespace SupaLidlGame.BoundingBoxes public override void _Ready() { _collisionShape = GetNode("CollisionShape2D"); + IsDisabled = _isDisabled; // sets _collisionShape.Disabled } private bool ShouldParry(Hitbox box) diff --git a/Characters/Player.tscn b/Characters/Player.tscn index f119421..dedeeaa 100644 --- a/Characters/Player.tscn +++ b/Characters/Player.tscn @@ -141,7 +141,6 @@ StateMachine = NodePath("StateMachine") Faction = 1 [node name="Camera2D" parent="." instance=ExtResource("4_ym125")] -position_smoothing_enabled = true position_smoothing_speed = 8.0 [node name="Sprite" type="AnimatedSprite2D" parent="."] @@ -174,6 +173,7 @@ script = ExtResource("6_6bgrj") IdleState = NodePath("../Idle") [node name="Debug" type="Control" parent="."] +visible = false layout_mode = 3 anchors_preset = 0