Merge branch 'master' of github.com:lvl2/avocados

master
David Raison 2014-08-31 11:48:25 +02:00
commit b9e10650be
8 changed files with 16 additions and 2 deletions

View File

@ -67,7 +67,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:

15
game.py
View File

@ -34,6 +34,8 @@ class TheGame:
self.screen = pygame.display.set_mode((self.WIDTH, self.HEIGHT))
self.colors = [BLUE, GREEN, RED, YELLOW]
self.bg = pygame.image.load(os.path.join('img', 'lawyerCrystalBall.png'))
self.bg.set_colorkey((255,255,255))
self.bg.set_alpha(75)
# fonts
self.bigFont = pygame.font.Font(None, 90)
@ -260,20 +262,31 @@ 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?
if event.type == pygame.QUIT:
running = False
game.gameOver()
pygame.quit()
sys.exit()
elif event.type == pygame.KEYDOWN:
if pygame.key.get_pressed()[pygame.K_f] != 0:
print("Toggling full screen, in the Future")
elif (pygame.key.get_pressed()[pygame.K_q] != 0) or (pygame.key.get_pressed()[pygame.K_ESCAPE] != 0):
running = False
game.gameOver()
pygame.quit()
sys.exit()
pygame.display.flip()

BIN
img/AvoCado_0_BLUE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
img/AvoCado_0_GREEN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
img/AvoCado_0_PINK.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
img/AvoCado_0_RED.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
img/AvoCado_0_YELLOW.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 33 KiB