Was watching a tutorial and I stumbled upon this 'AttributeError'

Viewed 17

I was watching a tutorial on how to make the snake and apple game, but came to a stop with this error

Can someone explain to me what this means also what an attribute error means AttributeError: 'SNAKE' object has no attribute 'body'

It came from this line of code that I was watching a tutorial on and it's referring to the '.body'

class SNAKE:
    def __int__(self):
        self.body = [Vector2(5,10),Vector2(6,10),Vector2(7,10)]

    def draw_snake(self):
        for block in self.body:
            x_pos = int(block.x * cell_size)
            y_pos = int(block.y * cell_size)
            block_rect = pygame.Rect(x_pos,y_pos,cell_size,cell_size)
            pygame.draw.rect(screen,pygame.Color('brown'),block_rect)

I imported the pygame.math from the Vector2 library, but I'm not even sure exactly what my problem is

0 Answers
Related