From ec609ca03a10203f2a4804b43f1923b2b7e4e49b Mon Sep 17 00:00:00 2001 From: DaNubCoding Date: Sun, 10 Nov 2024 14:23:12 -0500 Subject: [PATCH] make storm snowballs fall slower --- src/player.py | 4 ++-- src/snowball.py | 7 ++++--- src/storm.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/player.py b/src/player.py index 35bd1cc..db61d8a 100644 --- a/src/player.py +++ b/src/player.py @@ -471,8 +471,8 @@ def add_snowball(self, size: int) -> None: self.snowball_queue.append(size) self.dig_progress.snowballs_displays.append(self.dig_progress.SnowballDisplay(self.scene, self, size)) - def spawn_snowball(self, size: int, pos: tuple[int, int], vel: tuple[int, int], follow: bool = True) -> None: - sb = Snowball(self.scene, VEC(vel), size, pos=pos, follow=follow) + def spawn_snowball(self, size: int, pos: tuple[int, int], vel: tuple[int, int], follow: bool = True, is_storm: bool = False) -> None: + sb = Snowball(self.scene, VEC(vel), size, pos=pos, follow=follow, is_storm=is_storm) self.snowballs[sb.id] = sb def pop_snowball(self) -> int: diff --git a/src/snowball.py b/src/snowball.py index 662e656..4f38685 100644 --- a/src/snowball.py +++ b/src/snowball.py @@ -20,7 +20,7 @@ from . import assets class Snowball(VisibleSprite): - def __init__(self, scene: Scene, vel: tuple[float, float], sb_type: int, pos: VEC = None, follow: bool = True) -> None: + def __init__(self, scene: Scene, vel: tuple[float, float], sb_type: int, pos: VEC = None, follow: bool = True, is_storm: bool = False) -> None: super().__init__(scene, Layers.SNOWBALL) self.id = uuid4().hex @@ -43,6 +43,7 @@ def __init__(self, scene: Scene, vel: tuple[float, float], sb_type: int, pos: VE self.rot_speed = choice([randint(-400, -100), randint(100, 400)]) self.hit_player = None self.follow = follow + self.is_storm = is_storm if self.type == 2: self.swirl = Swirl(self.scene, Layers.SNOWBALL, 64) @@ -64,8 +65,8 @@ def update(self) -> None: self.rotation += self.rot_speed * self.manager.dt self.image = pygame.transform.rotate(self.frames[self.frame], self.rotation) - self.acc = VEC(0, GRAVITY) - self.acc += self.scene.wind_vel + self.acc = VEC(0, GRAVITY) * (0.4 if self.is_storm else 1) + self.acc += self.scene.wind_vel * (0.1 if self.is_storm else 1) self.vel += self.acc * self.manager.dt self.pos += self.vel * self.manager.dt diff --git a/src/storm.py b/src/storm.py index 1539b82..603cdea 100644 --- a/src/storm.py +++ b/src/storm.py @@ -79,7 +79,7 @@ def update(self) -> None: if self.alpha >= 255: if time.time() - self.snowball_timer > 0.18: offset = VEC(choice(self.offsets)) * PIXEL_SIZE - self.scene.player.spawn_snowball(0, self.pos + offset, VEC(0, 0), follow=False) + self.scene.player.spawn_snowball(0, self.pos + offset, VEC(0, 0), follow=False, is_storm=True) self.snowball_timer = time.time() if time.time() - self.lifetime_timer > self.lifetime: