From fbef18f58b9fa0650fbea36d5eebb2b300926ac5 Mon Sep 17 00:00:00 2001 From: captain-redbeard Date: Fri, 12 Apr 2024 17:56:02 +1000 Subject: [PATCH] Updated Dodge the Creeps C# to Godot mono 4.2 (#1000) Co-authored-by: Ivan Shakhov Co-authored-by: Aaron Franke --- 2d/dodge_the_creeps/Player.gd | 2 +- 2d/dodge_the_creeps/Player.tscn | 2 +- .../Dodge the Creeps with C#.csproj | 11 ++- mono/dodge_the_creeps/HUD.cs | 11 ++- mono/dodge_the_creeps/HUD.tscn | 63 +++++++------- mono/dodge_the_creeps/Main.cs | 47 ++++++----- mono/dodge_the_creeps/Main.tscn | 34 ++++---- mono/dodge_the_creeps/Mob.cs | 11 ++- mono/dodge_the_creeps/Mob.tscn | 77 ++++++++++------- mono/dodge_the_creeps/Player.cs | 47 +++++------ mono/dodge_the_creeps/Player.tscn | 84 ++++++++++--------- .../art/House In a Forest Loop.ogg.import | 2 +- .../art/enemyFlyingAlt_1.png.import | 31 ++++--- .../art/enemyFlyingAlt_2.png.import | 31 ++++--- .../art/enemySwimming_1.png.import | 31 ++++--- .../art/enemySwimming_2.png.import | 31 ++++--- .../art/enemyWalking_1.png.import | 31 ++++--- .../art/enemyWalking_2.png.import | 31 ++++--- mono/dodge_the_creeps/art/gameover.wav.import | 7 +- .../art/playerGrey_up1.png.import | 31 ++++--- .../art/playerGrey_up2.png.import | 31 ++++--- .../art/playerGrey_walk1.png.import | 31 ++++--- .../art/playerGrey_walk2.png.import | 31 ++++--- .../fonts/Xolonium-Regular.ttf.import | 34 ++++++++ mono/dodge_the_creeps/project.godot | 41 +++++---- 25 files changed, 425 insertions(+), 358 deletions(-) create mode 100644 mono/dodge_the_creeps/fonts/Xolonium-Regular.ttf.import diff --git a/2d/dodge_the_creeps/Player.gd b/2d/dodge_the_creeps/Player.gd index 2621907e..e2d3e87b 100644 --- a/2d/dodge_the_creeps/Player.gd +++ b/2d/dodge_the_creeps/Player.gd @@ -47,7 +47,7 @@ func start(pos): $CollisionShape2D.disabled = false -func _on_Player_body_entered(_body): +func _on_body_entered(_body): hide() # Player disappears after being hit. hit.emit() # Must be deferred as we can't change physics properties on a physics callback. diff --git a/2d/dodge_the_creeps/Player.tscn b/2d/dodge_the_creeps/Player.tscn index 742899db..86e7c1e3 100644 --- a/2d/dodge_the_creeps/Player.tscn +++ b/2d/dodge_the_creeps/Player.tscn @@ -72,4 +72,4 @@ process_material = SubResource("7") texture = ExtResource("2") speed_scale = 2.0 -[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"] +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj b/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj index e4b73e2a..c8d6221d 100644 --- a/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj +++ b/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj @@ -1,6 +1,13 @@ - + - net472 + net6.0 + true DodgeTheCreeps + + + + + + \ No newline at end of file diff --git a/mono/dodge_the_creeps/HUD.cs b/mono/dodge_the_creeps/HUD.cs index 3dea0859..005e3502 100644 --- a/mono/dodge_the_creeps/HUD.cs +++ b/mono/dodge_the_creeps/HUD.cs @@ -3,7 +3,7 @@ using Godot; public partial class HUD : CanvasLayer { [Signal] - public delegate void StartGame(); + public delegate void StartGameEventHandler(); public void ShowMessage(string text) { @@ -19,11 +19,10 @@ public partial class HUD : CanvasLayer ShowMessage("Game Over"); var messageTimer = GetNode("MessageTimer"); - await ToSignal(messageTimer, "timeout"); + await ToSignal(messageTimer, Timer.SignalName.Timeout); - var messageLabel = GetNode