I am using full screen for pygame, however I want to set some boundaries so that my player cannot escape the screen. I originally set boundaries like this:
if x > display_width - player_width or x < 0
crash()
However, this will not work since there is not fixed display_width, is there some way that I can get a display width? Or can I use some other method to set boundaries on the screen.
>Solution :
I believe this is what your looking for. It will provide the width and height, as a tuple.
width, height = pygame.display.get_surface().get_size()
Credit: How do I get the size (width x height) of my pygame window