Making A Pause Screen
Im trying to make a pause screen function but the images shutter and appear with a good delay. Any ideas Heres my code: PauseLogo = pg.image.load('Stop.png') Pause = pg.image.load(
Solution 1:
Draw different scenes dependent on the state of paused
:
while running:
clock.tick(FPS)
for event in pg.event.get():
if event.type == pg.QUIT:
running = Falseif event.type == pg.KEYDOWN:
if event.key == pg.K_SPACE:
paused = not paused
if paused == True:
screen.blit(PauseLogo, (0,0))
screen.blit(Pause, (400, 330))
else:
all_sprites.update()
screen.fill(DARKGRAY)
all_sprites.draw(screen)
pygame.display.update()
Note, pygame.time.Clock.tick()
measures the time since the last call of this function and delays the application. If you call it twice in the application, the application is delayed twice.
Post a Comment for "Making A Pause Screen"