diff --git a/2d/dodge_the_creeps/Main.gd b/2d/dodge_the_creeps/Main.gd index ceea43d6..7695ef5f 100644 --- a/2d/dodge_the_creeps/Main.gd +++ b/2d/dodge_the_creeps/Main.gd @@ -33,6 +33,8 @@ func _on_MobTimer_timeout(): direction += rand_range(-PI / 4, PI / 4) mob.rotation = direction mob.linear_velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0).rotated(direction) + # warning-ignore:return_value_discarded + $HUD.connect("start_game", mob, "_on_start_game") func _on_ScoreTimer_timeout(): diff --git a/2d/dodge_the_creeps/Mob.gd b/2d/dodge_the_creeps/Mob.gd index b8ad51cf..d08f1620 100644 --- a/2d/dodge_the_creeps/Mob.gd +++ b/2d/dodge_the_creeps/Mob.gd @@ -11,3 +11,7 @@ func _ready(): func _on_VisibilityNotifier2D_screen_exited(): queue_free() + + +func _on_start_game(): + queue_free() diff --git a/mono/dodge_the_creeps/Main.cs b/mono/dodge_the_creeps/Main.cs index d840ea7e..537a890f 100644 --- a/mono/dodge_the_creeps/Main.cs +++ b/mono/dodge_the_creeps/Main.cs @@ -84,5 +84,7 @@ public class Main : Node // Choose the velocity. mobInstance.SetLinearVelocity(new Vector2(RandRange(150f, 250f), 0).Rotated(direction)); + + GetNode("HUD").Connect("StartGame", mobInstance, "OnStartGame"); } } diff --git a/mono/dodge_the_creeps/Mob.cs b/mono/dodge_the_creeps/Mob.cs index d48f189d..1d69371e 100644 --- a/mono/dodge_the_creeps/Mob.cs +++ b/mono/dodge_the_creeps/Mob.cs @@ -23,4 +23,9 @@ public class Mob : RigidBody2D { QueueFree(); } + + public void OnStartGame() + { + QueueFree(); + } }