Fix scoring

master
Raphaël Vinot 2014-08-31 10:45:06 +02:00
parent f45632acee
commit 1538609e81
2 changed files with 5 additions and 2 deletions

View File

@ -66,6 +66,7 @@ class Avocado:
else: else:
self.clickFail.play() 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 # BUG - isHit is called 4 times upon click which makes it return the
# first time but fail the consecutive times # first time but fail the consecutive times
#else: #else:

View File

@ -258,12 +258,14 @@ class TheGame:
# Check if any avocados have been hit # Check if any avocados have been hit
for avo in self.movingAvocados: for avo in self.movingAvocados:
hit, center = avo.isHit(mousepos) hit, center = avo.isHit(mousepos)
if hit is None:
continue
if hit: if hit:
score += 100 score += 100
newPin.throwAt(center) newPin.throwAt(center)
color = self.chooseRandomColor() color = self.chooseRandomColor()
crystalBall.setColor(color) crystalBall.setColor(color)
elif hit == False: else:
score -= 50 score -= 50
# Had enough of this? # Had enough of this?