Ejemplo n.º 1
0
 def decrease_lives(self):
     self.lives -= 1
     if self.lives <= 0:
         raise exceptions.GameOver('Player died',
                                   score=self.score,
                                   name=self.name)
     return self.lives
Ejemplo n.º 2
0
 def decrease_lives(self):
     """
     If player lost battle then reduce his lives
     :return: int Player's lives
     """
     # Raises a GameOver exception
     self.lives -= 1
     if self.lives == 0:
         print('Your Game is Over')
         print('Your total score is ', self.score)
         exceptions.GameOver.save_result(self.name, self.score)
         raise exceptions.GameOver()
     return self.lives
Ejemplo n.º 3
0
 def exit_func(self):
     raise exceptions.GameOver('You stopped the game',
                               score=self.score,
                               name=self.name)
Ejemplo n.º 4
0
def out():
    """ close game """
    raise exceptions.GameOver("", 0)
Ejemplo n.º 5
0
 def decrease_lives(self):
     self.lives -= 1
     if (self.lives == 0):
         raise exceptions.GameOver()
Ejemplo n.º 6
0
 def decrease_lives(self):
     """ player's decrease lives """
     if self.lives == 0:
         raise exceptions.GameOver(self.name, self.score)
     else:
         self.lives -= 1