diff --git a/test.py b/test.py index a5e578c..75d2759 100644 --- a/test.py +++ b/test.py @@ -1,5 +1,7 @@ from __future__ import annotations +from abc import ABCMeta, abstractmethod + import pygame @@ -19,13 +21,29 @@ class Game: self.clock = pygame.time.Clock () -class Deerjika: +class GameObject (metaclass = ABCMeta): + def __init__ ( + self, + game: Game, + ): + self.game = game + self.redrawer.append (self.redraw) + + @abstractmethod + def redraw ( + self, + ) -> None: + raise NotImplementedError () + + +class Deerjika (GameObject): def __init__ ( self, game: Game, pattern: DeerjikaPattern = DeerjikaPattern.NORMAL, direction: Direction = Direction.LEFT, ): + super ().__init__ (self) self.game = game self.pattern = pattern self.direction = direction