I put this little effect when the game is over to avoid an abrupt change from the game to the menu. Added also a sound of a robotic voice that says game over, until I find a better effect.
https://github.com/formazione/snake
(repository)
def gameover(): def surface(redux): main = pygame.Surface((Costants.w - redux, Costants.h - redux)) if (redux // 20) % 2 == 0: main.fill((0,0,0)) else: main.fill((64, 64, 64)) Costants.window.blit(main, (redux, redux)) Costants.screen.blit(pygame.transform.scale(main, ((Costants.w - redux) * 2, (Costants.h - redux) * 2)), (redux, redux)) # pygame.time.delay(5) pygame.display.update() Costants.clock.tick(20) play("over") for x in range(20): surface(x * 20)
Video devlog Pysnake 1.9.4
Experimenting with sounds and some gameplay ideas
Subscribe to the newsletter for updates
Tkinter templates
My youtube channel
Twitter: @pythonprogrammi - python_pygame