Night-Chaser
1/15/2019 - 8:52 AM

pygame snake step 1

создание змейки по шагам

import pygame

pygame.init()

window = pygame.display.set_mode((441, 441))
pygame.display.set_caption('Snake')

flag_game = True
head = [45, 45]
snake_speed = 0

while flag_game:
    for event in pygame.event.get():
        # print(event)
        if event.type == pygame.QUIT:
            flag_game = False
    #создаем змеюку
    window.fill(pygame.Color('Black'))
    pygame.draw.rect(window, pygame.Color('Green'), pygame.Rect(head[0],head[1], 10, 10))
    #добавляем анимацию
    if snake_speed % 1000 == 0:
        head[0] += 25
    snake_speed += 1
    pygame.display.flip()