Выводится странная ошибка pygame

В ошибке пишет, что нету параметра image, но картинки я импортировал, может проблема в другом? Пытался использовать группы спрайтов pygame, но вылетает ошибка:(

import pygame
import sys

from pygame import sprite
from pygame.locals import *

window = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock()
play = True
image = pygame.image.load('images/wall-g8f28eaad9_1280.jpg')
window.blit(image, (0, 0))
lose = pygame.image.load('images/lose.png')
win = pygame.image.load('images/win.png')

class GameSprite(pygame.sprite.Sprite):
    def __init__(self, picture, w, h, x, y):
        super().__init__()
        self.w = w
        self.h = h
        self.picture = pygame.transform.scale(pygame.image.load(picture), (self.w, self.h))
        self.rect = self.picture.get_rect()
        self.rect.x = x
        self.rect.y = y

def reset(self):
    window.blit(self.picture, (self.rect.x, self.rect.y))


class Player(GameSprite):
    def __init__(self, picture, w, h, x, y, speed_x, speed_y):
        GameSprite.__init__(self, picture, w, h, x, y)
        self.speed_x = speed_x
        self.speed_y = speed_y

def update(self):
    if self.speed_x != 0:
        self.rect.x += self.speed_x
    if self.speed_y != 0:
        self.rect.y += self.speed_y


hero = Player('images/hero-sprite.png', 100, 200, 400, 25, 0, 0)
w1_v = GameSprite('images/wall_sprite_vertical.png', 100, 200, 85, 25)
w1_h = GameSprite('images/wall_sprite_horizontal.png', 300, 100, 85, 400)
w2_h = GameSprite('images/wall_sprite_horizontal.png', 300,100,385,400)
enemy = GameSprite('images/pixil-frame-0 (3).png', 100, 67, 400, 400)
chest = GameSprite('images/chest.png', 120, 100, 550, 400)
hero.reset()

barriers_h = sprite.Group()
barriers_v = sprite.Group()
barriers_h.add(w1_h)
barriers_v.add(w1_v)

barriers_h.draw(window)
barriers_v.draw(window)


finish = False
while play:
for event in pygame.event.get():
    if event.type == pygame.QUIT:
        sys.exit()
    if event.type == pygame.KEYDOWN:
        if event.key == K_w:
            hero.speed_y = - 5
        elif event.key == K_d:
            hero.speed_x = 5
        elif event.key == K_s:
            hero.speed_y = 5
        elif event.key == K_a:
            hero.speed_x = -5
    elif event.type == pygame.KEYUP:
        hero.speed_x = 0
        hero.speed_y = 0
hero.reset()
hero.update()
if hero.rect.x >= 1280:
    hero.rect.x = -10
elif hero.rect.x <= -20:
    hero.rect.x = 500
elif hero.rect.y >= 720:
    hero.rect.y = -50
elif hero.rect.y <= -150:
    hero.rect.y = 390


elif sprite.collide_rect(hero,chest):
    finish = True
    window.blit(win,(0,0))
    pygame.display.update()
if not finish:
    window.blit(image, (0, 0))
    chest.reset()
    enemy.reset()
    hero.reset()
    pygame.display.update()
    clock.tick(60)
else:
    pygame.time.delay(3000)
    sys.exit()

Вот и сама ошибка:

zip(sprites, surface.blits((spr.image, spr.rect) for spr in sprites)) AttributeError: 'GameSprite' object has no attribute 'image'


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