Skip to content

Commit ee388dd

Browse files
committed
Updated the dodge_the_creeps demo to include the "removing the creeps" part
1 parent 57baf0a commit ee388dd

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

2d/dodge_the_creeps/Main.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ func _on_MobTimer_timeout():
3333
direction += rand_range(-PI / 4, PI / 4)
3434
mob.rotation = direction
3535
mob.linear_velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0).rotated(direction)
36+
# warning-ignore:return_value_discarded
37+
$HUD.connect("start_game", mob, "_on_start_game")
3638

3739

3840
func _on_ScoreTimer_timeout():

2d/dodge_the_creeps/Mob.gd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ func _ready():
1111

1212
func _on_VisibilityNotifier2D_screen_exited():
1313
queue_free()
14+
15+
16+
func _on_start_game():
17+
queue_free()

mono/dodge_the_creeps/Main.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,7 @@ public void OnMobTimerTimeout()
8484

8585
// Choose the velocity.
8686
mobInstance.SetLinearVelocity(new Vector2(RandRange(150f, 250f), 0).Rotated(direction));
87+
88+
GetNode("HUD").Connect("StartGame", mobInstance, "OnStartGame");
8789
}
8890
}

mono/dodge_the_creeps/Mob.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@ public void OnVisibilityScreenExited()
2323
{
2424
QueueFree();
2525
}
26+
27+
public void OnStartGame()
28+
{
29+
QueueFree();
30+
}
2631
}

0 commit comments

Comments
 (0)