From 2b53fd46d3b4af7c80988c7d1d0d6d5248c688ac Mon Sep 17 00:00:00 2001 From: Tipragot Date: Fri, 3 Nov 2023 15:41:38 +0100 Subject: [PATCH] =?UTF-8?q?R=C3=A9glage=20du=20probleme=20d'animations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/animation.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/animation.py b/src/plugins/animation.py index fc810b6..9aa251a 100644 --- a/src/plugins/animation.py +++ b/src/plugins/animation.py @@ -85,6 +85,15 @@ def __update_animations(world: World) -> None: del entity[Animation] 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 animation.callback(world, entity) else: