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
|
# 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)
|
||||||
|
|
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