diff options
Diffstat (limited to 'GameView.py')
| -rw-r--r-- | GameView.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/GameView.py b/GameView.py index 241914c..50785a7 100644 --- a/GameView.py +++ b/GameView.py @@ -1,5 +1,6 @@ from Game import Game +from Box import Box import pygame class GameView: @@ -29,16 +30,24 @@ class GameView: surface.fill("black") - for cell in self.game.snake.cells: - pygame.draw.rect(surface, "red", pygame.Rect( + for cell in self.game.walls.walls(): + pygame.draw.rect(surface, "white", pygame.Rect( cell.x*self.cellWidth, cell.y*self.cellWidth, self.cellWidth, self.cellWidth )) - for cell in self.game.walls.walls(): - pygame.draw.rect(surface, "white", pygame.Rect( + for box in self.game.boxes: + pygame.draw.rect(surface, "brown", pygame.Rect( + box.pos.x*self.cellWidth, + box.pos.y*self.cellWidth, + self.cellWidth, + self.cellWidth + )) + + for cell in self.game.snake.cells: + pygame.draw.rect(surface, "red", pygame.Rect( cell.x*self.cellWidth, cell.y*self.cellWidth, self.cellWidth, @@ -46,6 +55,7 @@ class GameView: )) + def update(self, time): if (self._previousTick == None) or (self._previousTick + self._tickTime <= time): self._previousTick = time |
