Close popup if there is a message

This commit is contained in:
Yohann D'ANELLO 2020-11-27 17:35:51 +01:00
parent 5cdb12e8a8
commit b7f61d9485
2 changed files with 8 additions and 0 deletions

View File

@ -5,6 +5,10 @@ from squirrelbattle.display.display import Box, Display
class MessageDisplay(Display): class MessageDisplay(Display):
"""
Display a message in a popup.
"""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)

View File

@ -72,6 +72,10 @@ class Game:
Indicates what should be done when the given key is pressed, Indicates what should be done when the given key is pressed,
according to the current game state. according to the current game state.
""" """
if self.message:
self.message = None
return
if self.state == GameMode.PLAY: if self.state == GameMode.PLAY:
self.handle_key_pressed_play(key) self.handle_key_pressed_play(key)
elif self.state == GameMode.MAINMENU: elif self.state == GameMode.MAINMENU: