From 1538609e818b681a2a2b66b7ab9af1ee6774e8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Sun, 31 Aug 2014 10:45:06 +0200 Subject: [PATCH] Fix scoring --- avocado.py | 3 ++- game.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/avocado.py b/avocado.py index 3ec49ac..3930bd3 100644 --- a/avocado.py +++ b/avocado.py @@ -65,7 +65,8 @@ class Avocado: return True, self.rect.center else: self.clickFail.play() - return False, (0, 0) + return False, (0, 0) + return None, (0, 0) # BUG - isHit is called 4 times upon click which makes it return the # first time but fail the consecutive times #else: diff --git a/game.py b/game.py index 6af1237..137c357 100755 --- a/game.py +++ b/game.py @@ -258,12 +258,14 @@ class TheGame: # Check if any avocados have been hit for avo in self.movingAvocados: hit, center = avo.isHit(mousepos) + if hit is None: + continue if hit: score += 100 newPin.throwAt(center) color = self.chooseRandomColor() crystalBall.setColor(color) - elif hit == False: + else: score -= 50 # Had enough of this?