mirror of
https://github.com/n0remac/game-jam-2020.git
synced 2025-12-10 16:05:21 -06:00
create new sprites file for managing animations and static
This commit is contained in:
@@ -52,7 +52,8 @@ class Enums(Enum):
|
|||||||
UP_FACING = 3
|
UP_FACING = 3
|
||||||
DOWN_FACING = 4
|
DOWN_FACING = 4
|
||||||
|
|
||||||
class Sprites(object):
|
|
||||||
|
class SpritePaths(object):
|
||||||
"""
|
"""
|
||||||
Simple class for holding sprite paths.
|
Simple class for holding sprite paths.
|
||||||
"""
|
"""
|
||||||
|
|||||||
41
triple-dungeon/sprites.py
Normal file
41
triple-dungeon/sprites.py
Normal 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):
|
||||||
Reference in New Issue
Block a user