From b7f61d9485473398cd92eced6f76d2c9631e4398 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 27 Nov 2020 17:35:51 +0100 Subject: [PATCH] Close popup if there is a message --- squirrelbattle/display/messagedisplay.py | 4 ++++ squirrelbattle/game.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/squirrelbattle/display/messagedisplay.py b/squirrelbattle/display/messagedisplay.py index 34c6586..9e4ffae 100644 --- a/squirrelbattle/display/messagedisplay.py +++ b/squirrelbattle/display/messagedisplay.py @@ -5,6 +5,10 @@ from squirrelbattle.display.display import Box, Display class MessageDisplay(Display): + """ + Display a message in a popup. + """ + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/squirrelbattle/game.py b/squirrelbattle/game.py index 4553392..4eb38c1 100644 --- a/squirrelbattle/game.py +++ b/squirrelbattle/game.py @@ -72,6 +72,10 @@ class Game: Indicates what should be done when the given key is pressed, according to the current game state. """ + if self.message: + self.message = None + return + if self.state == GameMode.PLAY: self.handle_key_pressed_play(key) elif self.state == GameMode.MAINMENU: