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):
 | 
					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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user