From 3378d916e5084491f42c5bc56e95cee859f971e3 Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 20 Apr 2020 02:19:19 -0500 Subject: [PATCH] create new sprites file for managing animations and static --- triple-dungeon/config.py | 3 ++- triple-dungeon/sprites.py | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 triple-dungeon/sprites.py diff --git a/triple-dungeon/config.py b/triple-dungeon/config.py index a1a2aac..6fc426f 100644 --- a/triple-dungeon/config.py +++ b/triple-dungeon/config.py @@ -52,7 +52,8 @@ class Enums(Enum): UP_FACING = 3 DOWN_FACING = 4 -class Sprites(object): + +class SpritePaths(object): """ Simple class for holding sprite paths. """ diff --git a/triple-dungeon/sprites.py b/triple-dungeon/sprites.py new file mode 100644 index 0000000..eb77079 --- /dev/null +++ b/triple-dungeon/sprites.py @@ -0,0 +1,41 @@ +""" +sprites.py +A file dedicated to managing sprites and animations for characters. +""" +import re + + +class AnimationSet(object): + """ + A class that helps assist with grabbing new animations from a set. + """ + + def __init__(self, directory: str): + """ + Initializes the AnimationSet class by loading files and + + :param directory: A directory containing valid animation files in the correct format. + """ + pass + + +class PlayerAnimations(AnimationSet): + """ + A class dedicated to serving player animations. + Player animations must be served to the class in the correct format. + """ + + def __init__(self): + """ + Initializes the PlayerAnimations class. + """ + + super(PlayerAnimations, self).__init__() + + self.idles = self.getAnimations(re.compile(r'idle_\d+.png')) + self.down = self.getAnimations(re.compile(r'run_down_\d+.png')) + self.right = self.getAnimations(re.compile(r'run_right_\d+.png')) + self.up = self.getAnimations(re.compile(r'run_up_\d+.png')) + self.down = self.getAnimations(re.compile(r'run_left_\d+.png')) + + def __loadAnimations(self): \ No newline at end of file