DEV Community

Discussion on: Getting Started With Pygame, Making a snake game

Collapse
 
karimdigou profile image
karimdigou

hello there, thank you alot for your tutorial it's very simple to follow, but i have one issue for this code:
for square in snake_body[:-1]:
if pygame.Rect(square[0], square[1], 10, 10).colliderect(pygame.Rect(snake_pos[0], snake_pos[1], 10, 10)):
sys.exit()

the window close at the moment it's open i need some help to fix that, thank you !

Collapse
 
grapejuice profile image
Grape Juice

you are calling sys.exit() here but you should be calling game_over()