diff --git a/steam_saver/surfaces/steam_screen.py b/steam_saver/surfaces/steam_screen.py index 7eaa48b..7811fd3 100644 --- a/steam_saver/surfaces/steam_screen.py +++ b/steam_saver/surfaces/steam_screen.py @@ -110,7 +110,11 @@ class SteamLogo(pygame.sprite.Sprite): # Mini logos have some randomness built into their bounce function to make the background look more organic. if self.is_mini: # Reflect off the left or right wall, clamping the speed (in case it was raised too high) - self.x_speed = max(-1 * self.max_speed, min((self.x_speed * -1), self.max_speed)) + # The speed gets clamped if it goes above the max speed or below the starting speed (max - 1) + if self.x_speed > 0: + self.x_speed = max(-1 * self.max_speed, min((self.x_speed * -1), (-1 * self.max_speed) + 1)) + else: + self.x_speed = max(self.max_speed - 1, min((self.x_speed * -1), self.max_speed)) # Add or subtract anywhere from 0 to 10% of the max speed to the vertical speed component self.y_speed += random.uniform(self.max_speed * 0.1, self.max_speed * -0.1) @@ -122,7 +126,10 @@ class SteamLogo(pygame.sprite.Sprite): # Do the same stuff for the top and bottom walls if self.float_y < 0 or self.float_y > self.max_y: if self.is_mini: - self.y_speed = max(-1 * self.max_speed, min((self.y_speed * -1), self.max_speed)) + if self.y_speed > 0: + self.y_speed = max(-1 * self.max_speed, min((self.y_speed * -1), (-1 * self.max_speed) + 1)) + else: + self.y_speed = max(self.max_speed - 1, min((self.y_speed * -1), self.max_speed)) self.x_speed += random.uniform(self.max_speed * 0.1, self.max_speed * -0.1) else: self.y_speed *= -1