diff --git a/.idea/.idea.CodingLand/.idea/workspace.xml b/.idea/.idea.CodingLand/.idea/workspace.xml
index 628bd79..31be8ef 100644
--- a/.idea/.idea.CodingLand/.idea/workspace.xml
+++ b/.idea/.idea.CodingLand/.idea/workspace.xml
@@ -7,7 +7,6 @@
-
@@ -30,6 +29,7 @@
+
@@ -110,7 +110,7 @@
-
+
diff --git a/Scenes/Player.tscn b/Scenes/Player.tscn
index 355fd1c..d485be4 100644
--- a/Scenes/Player.tscn
+++ b/Scenes/Player.tscn
@@ -18,6 +18,9 @@ properties/0/replication_mode = 1
properties/1/path = NodePath(".:PlayerId")
properties/1/spawn = true
properties/1/replication_mode = 1
+properties/2/path = NodePath("RotationCentre:rotation")
+properties/2/spawn = true
+properties/2/replication_mode = 1
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_hojn2"]
properties/0/path = NodePath("InputSynchronizer:IsDashing")
@@ -34,11 +37,11 @@ PlayerInput = NodePath("InputSynchronizer")
BulletScene = ExtResource("2_nmop0")
[node name="HUD" type="VBoxContainer" parent="."]
-offset_left = -70.0
+offset_left = -90.0
offset_top = -80.0
-offset_right = 70.0
+offset_right = 90.0
offset_bottom = -20.0
-theme_override_constants/separation = 6
+theme_override_constants/separation = 4
alignment = 1
[node name="NameTag" type="Label" parent="HUD"]
@@ -49,6 +52,7 @@ vertical_alignment = 1
clip_text = true
[node name="HealthBar" type="ProgressBar" parent="HUD"]
+custom_minimum_size = Vector2(2.08165e-12, 8)
layout_mode = 2
rounded = true
allow_greater = true
@@ -79,6 +83,10 @@ Noise = SubResource("FastNoiseLite_cfnx7")
[node name="DashCountdown" type="Timer" parent="."]
one_shot = true
+[node name="ProtectionCountdown" type="Timer" parent="."]
+wait_time = 0.05
+one_shot = true
+
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_bekoo")
diff --git a/Scripts/Player.cs b/Scripts/Player.cs
index 62f7664..badffcc 100644
--- a/Scripts/Player.cs
+++ b/Scripts/Player.cs
@@ -107,10 +107,18 @@ public partial class Player : CharacterBody2D
[Rpc(MultiplayerApi.RpcMode.AnyPeer, CallLocal = true)]
private void GotDamage(double damage)
{
- Health -= damage;
+ var protection = GetNode("ProtectionCountdown");
- var bar = GetNode("HUD/HealthBar");
- bar.Value = Health / MaxHealth * 100;
+ if (protection.IsStopped())
+ {
+ Health -= damage;
+
+ var tween = CreateTween();
+ var bar = GetNode("HUD/HealthBar");
+ tween.TweenProperty(bar, "value", Health / MaxHealth * 100, 0.3);
+
+ protection.Start();
+ }
var shakableCamera = GetNode("Camera2D");
shakableCamera.AddTrauma(0.5f);