From cead73be34ad2acad18df313c70be7f718d7139f Mon Sep 17 00:00:00 2001 From: FelixBurkhard <38423129+FelixBurkhard@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:40:42 +0200 Subject: [PATCH 1/5] async return type from void to Task --- getting_started/first_2d_game/06.heads_up_display.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/getting_started/first_2d_game/06.heads_up_display.rst b/getting_started/first_2d_game/06.heads_up_display.rst index a5a861f7b7b..b79fab3304e 100644 --- a/getting_started/first_2d_game/06.heads_up_display.rst +++ b/getting_started/first_2d_game/06.heads_up_display.rst @@ -211,7 +211,7 @@ We also need to process what happens when the player loses. The code below will .. code-tab:: csharp - async public void ShowGameOver() + async public Task ShowGameOver() { ShowMessage("Game Over"); @@ -242,6 +242,9 @@ We also need to process what happens when the player loses. The code below will _message_label->show(); _start_message_timer->start(); } +.. warning:: + + If you are using C# you need to add ``using System.Threading.Tasks;`` at the top of you script. This function is called when the player loses. It will show "Game Over" for 2 seconds, then return to the title screen and, after a brief pause, show the From ae09833e5ce8b3a82f4df48eb670ec5429dacd7c Mon Sep 17 00:00:00 2001 From: FelixBurkhard <38423129+FelixBurkhard@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:43:58 +0200 Subject: [PATCH 2/5] remove \n from label text --- getting_started/first_2d_game/06.heads_up_display.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getting_started/first_2d_game/06.heads_up_display.rst b/getting_started/first_2d_game/06.heads_up_display.rst index b79fab3304e..767142582d6 100644 --- a/getting_started/first_2d_game/06.heads_up_display.rst +++ b/getting_started/first_2d_game/06.heads_up_display.rst @@ -203,7 +203,7 @@ We also need to process what happens when the player loses. The code below will # Wait until the MessageTimer has counted down. await $MessageTimer.timeout - $Message.text = "Dodge the\nCreeps!" + $Message.text = "Dodge the Creeps!" $Message.show() # Make a one-shot timer and wait for it to finish. await get_tree().create_timer(1.0).timeout @@ -219,7 +219,7 @@ We also need to process what happens when the player loses. The code below will await ToSignal(messageTimer, Timer.SignalName.Timeout); var message = GetNode