diff options
author | Michael Kitson <msk5293@rit.edu> | 2010-11-11 22:48:18 (GMT) |
---|---|---|
committer | Michael Kitson <msk5293@rit.edu> | 2010-11-11 22:48:18 (GMT) |
commit | de88a80833cde0cb470721bd7e5ed6cbd3f52bac (patch) | |
tree | aaf4ebbb58162dd780a9e651a5c4b10fb5bd6ede | |
parent | 31386d9f76eb28441abf64d646d6808f13a24f2d (diff) |
Gameover now resets the game to the start of level 1 with 3 lives and 0 points.
-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) |