Merge branch 'master' of github.com:lvl2/avocados
commit
1a32547801
Binary file not shown.
BIN
audio/click.wav
BIN
audio/click.wav
Binary file not shown.
Binary file not shown.
15
avocado.py
15
avocado.py
|
@ -31,6 +31,7 @@ class Avocado:
|
|||
|
||||
# Avocado sounds
|
||||
self.click = self.loadClick()
|
||||
self.clickFail = self.loadFailClick()
|
||||
|
||||
|
||||
def setTargetColor(self, targetColor):
|
||||
|
@ -57,14 +58,18 @@ class Avocado:
|
|||
if self.rect.left < mousex and self.rect.right > mousex and \
|
||||
self.rect.top < mousey and self.rect.bottom > mousey:
|
||||
|
||||
self.click.play()
|
||||
|
||||
if self.color == self.target:
|
||||
self.has_been_pinned = True
|
||||
self.is_still_falling = False
|
||||
self.click.play()
|
||||
return True
|
||||
else:
|
||||
self.clickFail.play()
|
||||
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):
|
||||
|
@ -101,5 +106,11 @@ class Avocado:
|
|||
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):
|
||||
del(self)
|
||||
|
|
BIN
img/pin.png
BIN
img/pin.png
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 |
Loading…
Reference in New Issue