From d8db4b1dee1ffed858754707a95ad019a2f0d1ef Mon Sep 17 00:00:00 2001 From: "Joskic, Ivan" Date: Wed, 6 May 2026 20:33:44 +0200 Subject: [PATCH] Use WasKeyJustPressed for ExitOnEscape --- .../building_2d_games/11_input_management/snippets/core.cs | 2 +- .../building_2d_games/15_audio_controller/snippets/core.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/articles/tutorials/building_2d_games/11_input_management/snippets/core.cs b/articles/tutorials/building_2d_games/11_input_management/snippets/core.cs index 02e7fa49..28278c7b 100644 --- a/articles/tutorials/building_2d_games/11_input_management/snippets/core.cs +++ b/articles/tutorials/building_2d_games/11_input_management/snippets/core.cs @@ -112,7 +112,7 @@ protected override void Update(GameTime gameTime) // Update the input manager. Input.Update(gameTime); - if (ExitOnEscape && Input.Keyboard.IsKeyDown(Keys.Escape)) + if (ExitOnEscape && Input.Keyboard.WasKeyJustPressed(Keys.Escape)) { Exit(); } diff --git a/articles/tutorials/building_2d_games/15_audio_controller/snippets/core.cs b/articles/tutorials/building_2d_games/15_audio_controller/snippets/core.cs index 4841b07e..9ad4cc7d 100644 --- a/articles/tutorials/building_2d_games/15_audio_controller/snippets/core.cs +++ b/articles/tutorials/building_2d_games/15_audio_controller/snippets/core.cs @@ -132,7 +132,7 @@ protected override void Update(GameTime gameTime) // Update the audio controller. Audio.Update(); - if (ExitOnEscape && Input.Keyboard.IsKeyDown(Keys.Escape)) + if (ExitOnEscape && Input.Keyboard.WasKeyJustPressed(Keys.Escape)) { Exit(); }