From: Skullheadx <94652084+Skullheadx@users.noreply.github.com> Date: Fri, 2 Jun 2023 23:45:46 +0000 (-0400) Subject: clean up X-Git-Tag: game~15 X-Git-Url: http://git.skullheadx.com/nixos/static/git-logo.png?a=commitdiff_plain;h=26649aa3c790aafa0f363f2e1cde37389d341b36;p=fruit-ninja.git clean up --- diff --git a/bomb.py b/bomb.py index 3d7e49a..0af48a6 100644 --- a/bomb.py +++ b/bomb.py @@ -1,5 +1,5 @@ -from setup import * from fruit import Fruit +from setup import * class Bomb(Fruit): @@ -25,8 +25,6 @@ class Bomb(Fruit): self.velocity = pygame.Vector2(0, 0) self.acceleration = pygame.Vector2(0, 0) - - for fruit in fruits: fruit.velocity += (fruit.position - self.position).normalize() * self.POWER for bomb in bombs: @@ -35,7 +33,9 @@ class Bomb(Fruit): def draw(self, surf): if self.exploded: - pygame.draw.circle(surf, DARK_RED, self.position, clamp(self.RADIUS + self.exploded_time / 1000 * 100, 0, 300)) - pygame.draw.circle(surf, BLACK, self.position, clamp(self.RADIUS + self.exploded_time / 1000 * 100, 0, 300), self.OUTLINE_WIDTH) + pygame.draw.circle(surf, DARK_RED, self.position, + clamp(self.RADIUS + self.exploded_time / 1000 * 100, 0, 300)) + pygame.draw.circle(surf, BLACK, self.position, clamp(self.RADIUS + self.exploded_time / 1000 * 100, 0, 300), + self.OUTLINE_WIDTH) else: pygame.draw.circle(surf, BLACK, self.position, self.RADIUS) diff --git a/game.py b/game.py index 552b246..474e3d6 100644 --- a/game.py +++ b/game.py @@ -1,9 +1,9 @@ -from setup import * -from player import Player -from fruit import Fruit from bomb import Bomb -from effect import Effect from combo_counter import ComboCounter +from effect import Effect +from fruit import Fruit +from player import Player +from setup import * class Game: @@ -11,13 +11,14 @@ class Game: EFFECT_COUNT_PER_FRUIT = 20 COMBO_TIME = 250 GAME_OVER_TIME = 1000 + def __init__(self): self.player = Player() self.fruits = [Fruit()] self.bombs = [] self.effects = [] self.combo_counters = [] - self.wave = 100 + self.wave = 1 self.score = 0 self.time_since_last_hit = 0 self.current_combo = 0 @@ -62,7 +63,7 @@ class Game: if self.time_since_last_hit < self.COMBO_TIME: self.current_combo += 1 if self.current_combo > 1: - self.combo_counters.append(ComboCounter(hit.position, f"x{self.current_combo+1}")) + self.combo_counters.append(ComboCounter(hit.position, f"x{self.current_combo + 1}")) self.time_since_last_hit = 0