How do you get pygame to give warning when player touches side of screen?
Define a pygame.Rect object for the player: player_rect = pygame.Rect(w, y, width, height) or get a rectangle from the player image (player_image): player_rect = player_image.get_Rect(topleft = (x, y)) Get the rectangle of the display Surface (screen) screen_rect = screen.get_rect() Evaluate if the player is out of the screen: if player_rect.left < screen_rect.left or player_rect.right < … Read more