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

master
David Raison 2014-08-31 10:06:27 +02:00
commit 1a32547801
6 changed files with 13 additions and 2 deletions

Binary file not shown.

BIN
audio/poop.wav Normal file

Binary file not shown.

View File

@ -31,6 +31,7 @@ class Avocado:
# Avocado sounds # Avocado sounds
self.click = self.loadClick() self.click = self.loadClick()
self.clickFail = self.loadFailClick()
def setTargetColor(self, targetColor): def setTargetColor(self, targetColor):
@ -57,14 +58,18 @@ class Avocado:
if self.rect.left < mousex and self.rect.right > mousex and \ if self.rect.left < mousex and self.rect.right > mousex and \
self.rect.top < mousey and self.rect.bottom > mousey: self.rect.top < mousey and self.rect.bottom > mousey:
self.click.play()
if self.color == self.target: if self.color == self.target:
self.has_been_pinned = True self.has_been_pinned = True
self.is_still_falling = False self.is_still_falling = False
self.click.play()
return True return True
else: else:
self.clickFail.play()
return False return False
# BUG - isHit is called 4 times upon click which makes it return the
# first time but fail the consecutive times
#else:
# self.clickFail.play()
def isFalling(self): def isFalling(self):
@ -101,5 +106,11 @@ class Avocado:
return pygame.mixer.Sound("audio/click.wav") return pygame.mixer.Sound("audio/click.wav")
def loadFailClick(self, sound=True):
if not sound:
return
return pygame.mixer.Sound("audio/poop.wav")
def destroy(self): def destroy(self):
del(self) del(self)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB