diff --git a/avocado.py b/avocado.py index ca1879e..316a23d 100644 --- a/avocado.py +++ b/avocado.py @@ -36,6 +36,7 @@ class Avocado: self.is_falling = True self.has_been_pinned = False + def updateTargetColor(self, targetColor): self.target = targetColor diff --git a/game.py b/game.py index 9c9ca42..33a3b2b 100755 --- a/game.py +++ b/game.py @@ -43,7 +43,11 @@ class TheGame: #size = initialize_screen() size = (800, 600) bg = pygame.image.load("img/background.png") - desired_fps = 10 + desired_fps = 15 + multiplier = 6 + score = 0 + time = timeleft = 30 + level = 1 font = pygame.font.Font(None, 40) # I don't know, should we move this text out of the way? @@ -60,20 +64,23 @@ class TheGame: color = self.chooseRandomColor() fullegast.setColor(color) - score = 0 - time = timeleft = 15 - level = 5 - avocados = [] running = True while running: time_passed = clock.tick(desired_fps) fps = clock.get_fps() + if type(bg) is tuple: screen.fill(bg) else: - screen.blit(pygame.transform.scale(bg,(800,600)),(0,0)) + screen.blit(pygame.transform.scale(bg, (800, 600)), (0, 0)) + + # Next level? + if score >= 500: + score = 0 + level += 1 + print('DEBUG :: Level ' + string(level)) # Let's add the lawyer fullegast.blitme() @@ -94,8 +101,9 @@ class TheGame: # Initialize a number of avocados, depending on the level avocados_in_game = len(avocados) - if avocados_in_game != level: - for i in range(avocados_in_game, level): + avocadosWanted = level * multiplier + if avocados_in_game < avocadosWanted: + for i in range(avocados_in_game, avocadosWanted): avocolor = self.chooseRandomColor() avosize = (50, 50) # should we randomize this? a = avocado.Avocado(screen, avocolor, avosize, color, noSound)