create new sprites file for managing animations and static

This commit is contained in:
Xevion
2020-04-20 02:19:19 -05:00
parent 35513dce16
commit 3378d916e5
2 changed files with 43 additions and 1 deletions

View File

@@ -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.
"""

41
triple-dungeon/sprites.py Normal file
View File

@@ -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):