diff options
-rw-r--r-- | dev/pacmath.activity/gameMain.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/dev/pacmath.activity/gameMain.py b/dev/pacmath.activity/gameMain.py index d1b034f..7449ef4 100644 --- a/dev/pacmath.activity/gameMain.py +++ b/dev/pacmath.activity/gameMain.py @@ -42,6 +42,18 @@ class gameMain: self.score = 0 self.level = 1 + def gameOver(self): + self.level = 1 + self.lives = BASE_LIVES + self.score = 0 + self.screen.fill((0,0,0)) + self.operation = random.sample('x+-/', 1) + self.questGen = questionGenerator( self.operation, 2, 12 ) + self.QandA.updateLives(self.screen, self.lives) + self.QandA.updateScore(self.screen, self.score) + self.QandA.updateLevel(self.screen, self.level) + self.resetQuestion() + def resetQuestion(self): self.maze = mazeSetup(self.screen, MAZE_SIZE) # create an instance of the @@ -114,7 +126,7 @@ class gameMain: for ghost in pygame.sprite.spritecollide(self.pacman, self.wrongGhosts, False): self.lives -= 1 if self.lives < 0: - print "GAME OVER" + self.gameOver() else: self.QandA.updateLives(self.screen, self.lives) self.QandA.updateScore(self.screen, self.score) |