i made a snake game for you but i haven't tested it yet. here's the code.


import pygameimport time
import random

pygame.init()

Colors

white = (255, 255, 255)
yellow = (255, 255, 102)
black = (0, 0, 0)
red = (213, 50, 80)
green = (0, 255, 0)
blue = (50, 153, 213)

Display settings

width = 600
height = 400
display = pygame.display.set_mode((width, height))
pygame.display.set_caption('Snake Game')

Game settings

clock = pygame.time.Clock()
snake_block = 10
snake_speed = 15

font_style = pygame.font.SysFont("bahnschrift", 25)
score_font = pygame.font.SysFont("comicsansms", 35)

def our_snake(snake_block, snake_list):
for x in snake_list:
pygame.draw.rect(display, black, [x[0], x[1], snake_block, snake_block])

def message(msg, color):
mesg = font_style.render(msg, True, color)
display.blit(mesg, [width / 6, height / 3])

def gameLoop():
game_over = False
game_close = False

x1 = width / 2
y1 = height / 2

x1_change = 0
y1_change = 0

snake_List = []
Length_of_snake = 1

foodx = round(random.randrange(0, width - snake_block) / 10.0) * 10.0
foody = round(random.randrange(0, height - snake_block) / 10.0) * 10.0

while not game_over:

    while game_close == True:
        display.fill(blue)
        message("You Lost! Press C-Play Again or Q-Quit", red)
        pygame.display.update()

        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_q:
                    game_over = True
                    game_close = False
                if event.key == pygame.K_c:
                    gameLoop()

    for event in pygame.event.get():
        if