Python Forum
[PyGame] fill tint - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Game Development (https://python-forum.io/forum-11.html)
+--- Thread: [PyGame] fill tint (/thread-2029.html)



fill tint - Zman350x - Feb-12-2017

for my pause screen I want to tint the background a bit black so you can still see the game in the back but it's darker (you have probably seen this in other video games) could I do a "screen.fill()" with a black slight alpha. how would I do so?


RE: fill tilt - metulburr - Feb-12-2017

you have to create a new surface the same size as the screen, then set the alpha, and blit that surface at the top left. Im in a rush currently but something along the lines of

overlay_bg = pg.Surface(screen_rect.size)
overlay_bg.fill(0)
overlay_bg.set_alpha(200)
...
    #main loop
    screen.blit(overlay_bg,(0,0))