From 8d836146613735d6e1f3dff04012d719f668c6df Mon Sep 17 00:00:00 2001 From: NelDav Date: Sun, 23 Jun 2019 15:06:17 +0200 Subject: [PATCH 1/4] StartMenuScene is the same as the one in master now --- godot/src/scenes/menus/StartMenuScene.tscn | 1 - 1 file changed, 1 deletion(-) diff --git a/godot/src/scenes/menus/StartMenuScene.tscn b/godot/src/scenes/menus/StartMenuScene.tscn index 7d4b592..c756abf 100644 --- a/godot/src/scenes/menus/StartMenuScene.tscn +++ b/godot/src/scenes/menus/StartMenuScene.tscn @@ -50,7 +50,6 @@ margin_top = 50.0 margin_right = 250.0 margin_bottom = 100.0 text = "Start Menu" - [connection signal="pressed" from="StartMenuButtons/StartGame" to="StartMenuButtons" method="_on_StartGame_pressed"] [connection signal="pressed" from="StartMenuButtons/Options" to="StartMenuButtons" method="_on_Options_pressed"] [connection signal="pressed" from="StartMenuButtons/Quit" to="StartMenuButtons" method="_on_Quit_pressed"] From 9b8a43805182bfe6111e68296098eefc556b2ca8 Mon Sep 17 00:00:00 2001 From: NelDav Date: Sun, 23 Jun 2019 15:13:51 +0200 Subject: [PATCH 2/4] Player is taking damage now --- godot/src/scripts/Bullet.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/godot/src/scripts/Bullet.cs b/godot/src/scripts/Bullet.cs index d1c774a..e9a9826 100644 --- a/godot/src/scripts/Bullet.cs +++ b/godot/src/scripts/Bullet.cs @@ -27,7 +27,7 @@ public override void _Ready() /// /// The node, wich collides /// If the bullet collides with a player, the name of that player else an empty string - private string onCollision(Node body) + private Player onCollision(Node body) { //creates the collision animation; collisionAnimation(); @@ -36,12 +36,14 @@ private string onCollision(Node body) GetParent().RemoveChild(this); //Return the players name, if the bullet collide with a player. - if (false) + if (body is Player) { - + Player player = (Player)body; + player.Health -= Damage; + return player; } - return ""; + return null; } From e5029845d3e752e6eb14973603aec465400fab64 Mon Sep 17 00:00:00 2001 From: NelDav Date: Sun, 23 Jun 2019 15:15:57 +0200 Subject: [PATCH 3/4] Player looses damage till 0 now --- godot/src/scripts/Player.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/godot/src/scripts/Player.cs b/godot/src/scripts/Player.cs index 3d4f2d7..265c664 100644 --- a/godot/src/scripts/Player.cs +++ b/godot/src/scripts/Player.cs @@ -42,12 +42,21 @@ public double Health get => health; set { - if ((value >= 0 && value <= 100) || value == double.PositiveInfinity) + if(value < 0) + { + health = 0; + } + else if(value > 100) + { + health = 100; + } + else { health = value; - //sends an signal about - EmitSignal(nameof(HealthChangeSignal), Health); } + + //sends an signal about + EmitSignal(nameof(HealthChangeSignal), Health); } } From f4017f29ee4e9af6331945dc30acc39f0f5cc0f3 Mon Sep 17 00:00:00 2001 From: NelDav Date: Sun, 23 Jun 2019 15:18:08 +0200 Subject: [PATCH 4/4] removed changes of StartMenueScene.tscn --- godot/src/scenes/menus/StartMenuScene.tscn | 1 + 1 file changed, 1 insertion(+) diff --git a/godot/src/scenes/menus/StartMenuScene.tscn b/godot/src/scenes/menus/StartMenuScene.tscn index c756abf..7d4b592 100644 --- a/godot/src/scenes/menus/StartMenuScene.tscn +++ b/godot/src/scenes/menus/StartMenuScene.tscn @@ -50,6 +50,7 @@ margin_top = 50.0 margin_right = 250.0 margin_bottom = 100.0 text = "Start Menu" + [connection signal="pressed" from="StartMenuButtons/StartGame" to="StartMenuButtons" method="_on_StartGame_pressed"] [connection signal="pressed" from="StartMenuButtons/Options" to="StartMenuButtons" method="_on_Options_pressed"] [connection signal="pressed" from="StartMenuButtons/Quit" to="StartMenuButtons" method="_on_Quit_pressed"]