Fix scoring
parent
f45632acee
commit
1538609e81
|
@ -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:
|
||||||
|
|
4
game.py
4
game.py
|
@ -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?
|
||||||
|
|
Loading…
Reference in New Issue