class AnimateSprite(pygame.sprite.Sprite):
def __init__(self, sprite_name):
super().__init__()
self.image = pygame.image.load(f'assets/{sprite_name}.png')
self.current_image = 0
self.images = animations.get(sprite_name)
def animate(self):
self.current_image += 1
if self.current_image >= 24:
self.current_image = 0
self.image = **self.images**[self.current_image]
def load_animation_images(sprite_name):
images = []
path = f"assets/{sprite_name}/{sprite_name}"
for num in range(1,24):
image_path = path + str(num) + '.png'
images.append(pygame.image.load(image_path))
return images
i am trying to code an animation code in pygame for a game but i have this error:
Object of type "None" is not subscriptablePylancereportOptionalSubscript
(variable) images: list[Unknown] | None
I am accualy using VSC and Python 3.11.3 64bit installed in Microsoft store