mirror of
https://github.com/n0remac/game-jam-2020.git
synced 2025-12-10 00:05:22 -06:00
cleanup imports, improve typehints in sprites.py
This commit is contained in:
@@ -2,13 +2,13 @@
|
|||||||
sprites.py
|
sprites.py
|
||||||
A file dedicated to managing sprites and animations for characters.
|
A file dedicated to managing sprites and animations for characters.
|
||||||
"""
|
"""
|
||||||
from itertools import cycle
|
|
||||||
|
|
||||||
import arcade
|
import arcade
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from typing import Pattern
|
from typing import Pattern, Iterable
|
||||||
|
from itertools import cycle
|
||||||
|
|
||||||
|
|
||||||
class AnimationSet(object):
|
class AnimationSet(object):
|
||||||
@@ -16,7 +16,7 @@ class AnimationSet(object):
|
|||||||
A class that helps assist with grabbing new animations from a set.
|
A class that helps assist with grabbing new animations from a set.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, directory: str):
|
def __init__(self, directory: str) -> None:
|
||||||
"""
|
"""
|
||||||
Initializes the AnimationSet class by loading files and
|
Initializes the AnimationSet class by loading files and
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ class AnimationSet(object):
|
|||||||
self.directory = directory
|
self.directory = directory
|
||||||
self.animations = os.listdir(directory)
|
self.animations = os.listdir(directory)
|
||||||
|
|
||||||
def getAnimations(self, pattern: Pattern) -> iter:
|
def getAnimations(self, pattern: Pattern) -> Iterable[arcade.Texture]:
|
||||||
"""
|
"""
|
||||||
Loads all animations from the AnimationSet's directory that match the pattern.
|
Loads all animations from the AnimationSet's directory that match the pattern.
|
||||||
The pattern must have 1 group that specifies the animation's index.
|
The pattern must have 1 group that specifies the animation's index.
|
||||||
@@ -56,7 +56,7 @@ class PlayerAnimations(AnimationSet):
|
|||||||
index: [0,) - The index of the animation. Index should be enumerated in ascending order.
|
index: [0,) - The index of the animation. Index should be enumerated in ascending order.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, directory: str):
|
def __init__(self, directory: str) -> None:
|
||||||
"""
|
"""
|
||||||
Initializes the PlayerAnimations class.
|
Initializes the PlayerAnimations class.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user