0

Im working on a platformer for my game and im trying to learn how to add animation to enemies i was looking at a tutorial on how to add animation too enemies i copied it into my own but it just come up with an error saying pygame has no attribute image what does this mean and how can i fix it

# adding enemies
class Enemy1(pygame.sprite.Sprite):
    def __init__(self, x, y):
        pygame.sprite.Sprite.__init__(self)
        self.animation_images  = [pygame.image.load('Arlong_1.png'), pygame.image.load('Arlong_2.png'),
        pygame.image.load('Arlong_3.png')]
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y 
        self.move_direction = 1
        self.move_counter = 0

    def update(self):
        self.rect.x += self.move_direction
        self.move_counter += 1
        if abs(self.move_counter) > 50:
            self.move_direction *= -1
            self.move_counter *= -1

I tried changing the word image to img or images but it still didnt work I dont know why

0 Answers0