From 729fb297700f8b3b8521bd1efa3429c6872f5a52 Mon Sep 17 00:00:00 2001 From: rsxri Date: Wed, 16 Apr 2025 18:57:16 +0100 Subject: [PATCH] fix: prevent duplicate asteroid signal connection - fixes double scoring issue --- MB_FYP/scenes/game.tscn | 2 +- MB_FYP/scenes/main_menu.tscn | 25 ------------------------- MB_FYP/script/asteroid.cs | 3 +++ MB_FYP/script/game.cs | 35 +++++++++++++++++------------------ 4 files changed, 21 insertions(+), 44 deletions(-) diff --git a/MB_FYP/scenes/game.tscn b/MB_FYP/scenes/game.tscn index a95b119..b6a98b9 100644 --- a/MB_FYP/scenes/game.tscn +++ b/MB_FYP/scenes/game.tscn @@ -16,7 +16,7 @@ script = ExtResource("1_dukjm") position = Vector2(800, 450) scale = Vector2(0.6, 0.6) collision_layer = 8 -type = 1 +type = 0 [node name="Lasers" type="Node" parent="."] diff --git a/MB_FYP/scenes/main_menu.tscn b/MB_FYP/scenes/main_menu.tscn index eef60fb..1114447 100644 --- a/MB_FYP/scenes/main_menu.tscn +++ b/MB_FYP/scenes/main_menu.tscn @@ -29,28 +29,3 @@ offset_right = 157.8 offset_bottom = 44.0 text = "Exit Game " - -[node name="OptionButton" type="Button" parent="."] -layout_mode = 0 -offset_top = 68.0 -offset_right = 96.0 -offset_bottom = 99.0 -text = "Options -" - -[node name="Label" type="Label" parent="."] -layout_mode = 1 -anchors_preset = -1 -anchor_left = 16.1 -anchor_top = 5.7 -anchor_right = 33.175 -anchor_bottom = 10.4 -offset_left = -2.0 -offset_top = 2.99998 -offset_right = -2.00012 -offset_bottom = 2.99997 -grow_horizontal = 0 -grow_vertical = 0 -theme_override_font_sizes/font_size = 80 -text = "Name in Progress" -horizontal_alignment = 1 diff --git a/MB_FYP/script/asteroid.cs b/MB_FYP/script/asteroid.cs index 3ae617e..26b49e4 100644 --- a/MB_FYP/script/asteroid.cs +++ b/MB_FYP/script/asteroid.cs @@ -69,6 +69,9 @@ public partial class asteroid : Area2D public void Explode() { + //DEBUG PRINT + GD.Print($"DEBUG: Explode() called for {Name} at {GlobalPosition}"); + GD.Print($"DEBUG: {Name} calling Explode()"); EmitSignal(SignalName.Exploded, GlobalPosition, (int)size); QueueFree(); } diff --git a/MB_FYP/script/game.cs b/MB_FYP/script/game.cs index b40cda4..ff69e87 100644 --- a/MB_FYP/script/game.cs +++ b/MB_FYP/script/game.cs @@ -28,13 +28,7 @@ public partial class game : Node2D ScoreLabel = GetNode