Browse Source

#31 today sagefu-bun

ai-migration
みてるぞ 1 month ago
parent
commit
11195e5125
1 changed files with 19 additions and 1 deletions
  1. +19
    -1
      test.py

+ 19
- 1
test.py View File

@@ -1,5 +1,7 @@
from __future__ import annotations from __future__ import annotations


from abc import ABCMeta, abstractmethod

import pygame import pygame




@@ -19,13 +21,29 @@ class Game:
self.clock = pygame.time.Clock () 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__ ( def __init__ (
self, self,
game: Game, game: Game,
pattern: DeerjikaPattern = DeerjikaPattern.NORMAL, pattern: DeerjikaPattern = DeerjikaPattern.NORMAL,
direction: Direction = Direction.LEFT, direction: Direction = Direction.LEFT,
): ):
super ().__init__ (self)
self.game = game self.game = game
self.pattern = pattern self.pattern = pattern
self.direction = direction self.direction = direction


Loading…
Cancel
Save