Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] fill tint
#1
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?
Reply
#2
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))
Recommended Tutorials:
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020