from pygame import *
window = display.set_mode((600, 600))
display.set_caption("Шлёпа")
class Flopa(sprite.Sprite):
def __init__(self, image, x, y,):
sprite.Sprite.__init__(self)
self.image = transform.scale(image.load("flopa.png"), (50, 50))
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
def update(self):
keys = key.get_pressed()
if keys[K_LEFT]:
self.rect.x -= 5
if keys[K_RIGHT]:
self.rect.x += 5
run = True
while run:
for e in event.get():
if e.type == KEYDOWN:
if e.key == K_ESCAPE:
run = False
flopa = Flopa("flopa.png", 100, 100)
flopa.update()
window.fill((250,250,250))
time.delay(20)
display.update()
Ошибка:
self.image = transform.scale(image.load("flopa.png"), (50, 50))
AttributeError: 'str' object has no attribute 'load'