diff --git a/danmaku/game/animated.py b/danmaku/game/animated.py index 25adb6a..f4e548e 100644 --- a/danmaku/game/animated.py +++ b/danmaku/game/animated.py @@ -26,7 +26,7 @@ def __init__( xy: tuple[int | float, int | float], width_height: tuple[int | float, int | float], speed: int | float, - frames, + frames: dict[Direction, list[str]], freq: int | float, period: int | float | None = None, ) -> None: @@ -45,8 +45,9 @@ def __init__( self.last_direction = 0 if len(frames): - self.texture_file = self.animation_frames[ - self.animation_current] + self.texture_file = self.animation_frames[Direction.STATIC][ + self.animation_current + ] def can_animate(self) -> bool: """Check if possible to animate""" @@ -57,13 +58,15 @@ def can_animate(self) -> bool: return True return False - def animate(self, direction_vector: tuple[int | float, int | float] = (0, 0)) -> None: - """Animate one frame if possible - if self.can_animate(): - self.animation_current = (self.animation_current + 1) % len( - self.animation_frames - ) - self.texture_file = self.animation_frames[self.animation_current]""" + def animate( + self, direction_vector: tuple[int | float, int | float] = (0, 0) + ) -> None: + """Animate one frame if possible""" + # if self.can_animate(): + # self.animation_current = (self.animation_current + 1) % len( + # self.animation_frames + # ) + # self.texture_file = self.animation_frames[self.animation_current] if self.can_animate(): direction = None @@ -106,7 +109,7 @@ def frames_from_str(self, str_frames, adress): Direction.RIGHT: [], Direction.UP: [], Direction.DOWN: [], - Direction.STATIC: [] + Direction.STATIC: [], } for i in files: diff --git a/danmaku/game/background.py b/danmaku/game/background.py index b5dfb23..301f617 100644 --- a/danmaku/game/background.py +++ b/danmaku/game/background.py @@ -31,9 +31,11 @@ def draw(self, graphics: vgame.graphics.Graphics): def update(self, delta: int | float): self.animate() - def animate(self, direction_vector: tuple[int | float, int | float] = (0, 0)) -> None: + def animate( + self, direction_vector: tuple[int | float, int | float] = (0, 0) + ) -> None: if self.can_animate(): self.animation_current = (self.animation_current + 1) % len( self.animation_frames ) - self.texture_file = self.animation_frames[self.animation_current] \ No newline at end of file + self.texture_file = self.animation_frames[self.animation_current] diff --git a/docs/mecs.md b/docs/mecs.md index a579dd8..19eaf0d 100644 --- a/docs/mecs.md +++ b/docs/mecs.md @@ -87,6 +87,9 @@ classDiagram GameObject <-- Animated Animated <-- Background Entity <-- Shooter + GameObject <-- Drop + Drop <-- Points + Drop <-- PowerUp class Sprite { texture_file: str @@ -141,6 +144,13 @@ classDiagram class Background { } + class Drop { + + } + class PowerUp { + + } + class Points ``` ## Enemies' actions processing