diff --git a/avocado.py b/avocado.py index b334f3f..bc34929 100644 --- a/avocado.py +++ b/avocado.py @@ -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: diff --git a/game.py b/game.py index 0c56d28..8374131 100755 --- a/game.py +++ b/game.py @@ -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() diff --git a/img/AvoCado_0_BLUE.png b/img/AvoCado_0_BLUE.png new file mode 100644 index 0000000..b20caa9 Binary files /dev/null and b/img/AvoCado_0_BLUE.png differ diff --git a/img/AvoCado_0_GREEN.png b/img/AvoCado_0_GREEN.png new file mode 100644 index 0000000..d494c52 Binary files /dev/null and b/img/AvoCado_0_GREEN.png differ diff --git a/img/AvoCado_0_PINK.png b/img/AvoCado_0_PINK.png new file mode 100644 index 0000000..459dad4 Binary files /dev/null and b/img/AvoCado_0_PINK.png differ diff --git a/img/AvoCado_0_RED.png b/img/AvoCado_0_RED.png new file mode 100644 index 0000000..9b4fe13 Binary files /dev/null and b/img/AvoCado_0_RED.png differ diff --git a/img/AvoCado_0_YELLOW.png b/img/AvoCado_0_YELLOW.png new file mode 100644 index 0000000..8f46c1f Binary files /dev/null and b/img/AvoCado_0_YELLOW.png differ diff --git a/img/AvoCado_Mush_0.png b/img/AvoCado_Mush_0.png index fed4d40..43b7a6f 100644 Binary files a/img/AvoCado_Mush_0.png and b/img/AvoCado_Mush_0.png differ