diff options
Diffstat (limited to 'Snake.py')
| -rw-r--r-- | Snake.py | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -6,15 +6,13 @@ import Game class Snake: - def __init__(self, cells: list[Vec2], game: Game): - self.cells = [] + def __init__(self, cells: list[Vec2], game: "Game.Game") -> None: self.heading = Vec.up - self.game = None self.hasCollided = False self.cells = cells self.game = game - def move(self): + def move(self) -> None: nextPos = self.cells[0] + self.heading last = self.cells.pop() if self.game.enter(nextPos, self.heading): @@ -23,5 +21,5 @@ class Snake: self.cells.append(last) self.hasCollided = True - def head(self): + def head(self) -> Vec2: return self.cells[0] |
