From ac9535c0102e5966d5557f9b10601d5c685b80c5 Mon Sep 17 00:00:00 2001 From: Daniel Ribeiro <=> Date: Tue, 21 Feb 2023 12:51:38 -0300 Subject: [PATCH] fix animated sprinte image order closes #2 sort filesnames when listing the animation directory --- sprite_object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sprite_object.py b/sprite_object.py index cbcf8bf..1965e3a 100644 --- a/sprite_object.py +++ b/sprite_object.py @@ -82,7 +82,7 @@ def check_animation_time(self): def get_images(self, path): images = deque() - for file_name in os.listdir(path): + for file_name in sorted(os.listdir(path)): if os.path.isfile(os.path.join(path, file_name)): img = pg.image.load(path + '/' + file_name).convert_alpha() images.append(img)