Не появляется окно с игрой и не выходит ошибка

import pygame

pygame.init()#РАЗМЕР ОКНА С ИГРОЙ
win = pygame.display.set_mode((500, 500))

walkLeft = [pygame.image.load('left_1.png'),
pygame.image.load('left_2.png'),pygame.image.load('left_3.png')]

walkRight = [pygame.image.load('right_1.png'),
pygame.image.load('right_2.png'),pygame.image.load('right_3.png')]


playerStand = pygame.image.load('idle.png')

bg = pygame.image.load('x.jpg')

clock = pygame.time.Clock ()

class Player(pygame.sprite.Sprite):
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.Surface((50, 50))
        self.image.fill(GREEN)
        self.rect = self.image.get_rect()
        self.rect.center = (WIDTH / 2, HEIGHT / 2)

x = 220
y = 425
width = 60#ШИРИНА
height = 71#высота
speed = 5

isJump = False
jumpCount = 10

left = False
right = False
animCount = 0
lastMove = 'right'



class Maslina():#СОЗДАНИЕ СНАРЯДА
    def __init__(self, x, y, radius, color, facing):
        self.x = x
        self.y = y
        self.radius = radius
        self.color = color
        self.facing = facing
        self.vel = 8 * facing

    def draw(self, win):
        pygame.draw.circle (win, self.color, (self.x, self.y), self.radius)


def drawWindow ():
    global animCount
    win.blit (bg, (0, 0))

    if animCount + 1 >= 30:
        animCount = 0

    if left:
        win.blit(walkLeft[animCount //10], (x, y) )
        animCount += 1

    elif right:
        win.blit(walkRight[animCount //10], (x, y))
        animCount += 1
    else:
        win.blit(playerStand, (x, y))

    for bullet in bullets:
        bullet.draw(win)

    pygame.display.update()

    for act in pygame.event.get():
        if act.type == pygame.QUIT:
            run = False

    for bullet in bullets:
        if bullet.x < 500 and bullet.x > 0:
            bullet.x += bullet. vel
        else:
            bullets. pop(bullets.index(bullet))

    keys = pygame.key.get_pressed()

    if keys[pygame.K_c]:
        if lastMove == 'right':
            facing = 1
        else:
            facing = -1

        if len(bullets) < 5:
            bullets.append (Maslina(round(x + width // 2), round(y + height // 2
            ), 5, (255, 0 , 0), facing))

    #PERS MOVIES
    if keys[pygame.K_a] and x > 5:
        x -= speed
        left = True
        right = False
        lastMove = 'left'
    elif keys[pygame.K_d] and x < 500 - width - 5:
        x += speed
        left = False
        right = True
        lastMove = 'right'
    else:
        left = False
        right = False
        animCount = 0
    if not(isJump):
        if keys[pygame.K_SPACE]:
            isJump = True
    else:
        if jumpCount >= -10:
            if jumpCount < 0:
                y += (jumpCount ** 2) / 2
            else:
                y -= (jumpCount ** 2) / 2
            jumpCount -= 1
        else:
            isJump = False
            jumpCount = 10

    drawWindow ()

pygame.quit()

Ответы (0 шт):