Close popup if there is a message
This commit is contained in:
		@@ -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)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user