Réglage du probleme d'animations

This commit is contained in:
Tipragot 2023-11-03 15:41:38 +01:00
parent f5889f0ddf
commit 2b53fd46d3

View file

@ -85,6 +85,15 @@ def __update_animations(world: World) -> None:
del entity[Animation] del entity[Animation]
animation.ended = True animation.ended = True
# On trouve la dernière image de l'animation et on met à jour la texture
while texture is assets.error_texture:
frame_index -= 1
texture = assets.get_texture(f"{animation.name}/{frame_index:04d}")
if frame_index < 0:
break
if texture is not assets.error_texture:
__update_sprite(entity, texture, assets)
# Et on appelle la fonction de callback # Et on appelle la fonction de callback
animation.callback(world, entity) animation.callback(world, entity)
else: else: