From de88a80833cde0cb470721bd7e5ed6cbd3f52bac Mon Sep 17 00:00:00 2001 From: Michael Kitson Date: Thu, 11 Nov 2010 22:48:18 +0000 Subject: Gameover now resets the game to the start of level 1 with 3 lives and 0 points. --- 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) -- cgit v0.9.1