diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f80bd2..179cc09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [1.1.4] - 09 - March 2021 + +- Fixed trig calc in Asteroid starting velocity to match map coordinate system. + ## [1.1.3] - 09 - March 2021 - Enabled specification of starting position/angle/lives of the ShipSprite diff --git a/src/fuzzy_asteroids/__init__.py b/src/fuzzy_asteroids/__init__.py index 0b2f79d..c72e379 100644 --- a/src/fuzzy_asteroids/__init__.py +++ b/src/fuzzy_asteroids/__init__.py @@ -1 +1 @@ -__version__ = "1.1.3" +__version__ = "1.1.4" diff --git a/src/fuzzy_asteroids/sprites.py b/src/fuzzy_asteroids/sprites.py index b1dd9f5..31846c4 100644 --- a/src/fuzzy_asteroids/sprites.py +++ b/src/fuzzy_asteroids/sprites.py @@ -22,8 +22,8 @@ def __init__(self, frequency: float, starting_angle: float, starting_position: T self.bullet_speed = 800 # Set the starting state - self.change_y = math.cos(math.radians(starting_angle)) * self.bullet_speed / self.frequency self.change_x = -math.sin(math.radians(starting_angle)) * self.bullet_speed / self.frequency + self.change_y = math.cos(math.radians(starting_angle)) * self.bullet_speed / self.frequency self.angle = math.degrees(math.atan2(self.change_y, self.change_x)) self.center_x, self.center_y = starting_position @@ -289,12 +289,12 @@ def __init__(self, frequency: float, position: Tuple[float, float] = None, self.max_speed = 60.0 * speed_scaler # Use options angle and speed arguments - starting_angle = angle if angle else random.random()*360.0 - 180.0 - starting_speed = speed if speed else random.random()*self.max_speed - self.max_speed/2.0 + starting_angle = angle if angle is not None else random.random()*360.0 - 180.0 + starting_speed = speed if speed is not None else random.random()*self.max_speed - self.max_speed/2.0 # Set constant starting velocity based on starting angle and speed - self.change_x = starting_speed * math.cos(math.radians(starting_angle)) / self.frequency - self.change_y = starting_speed * math.sin(math.radians(starting_angle)) / self.frequency + self.change_x = starting_speed * math.sin(math.radians(starting_angle)) / self.frequency + self.change_y = starting_speed * math.cos(math.radians(starting_angle)) / self.frequency # Use parent position as starting point if this asteroid is starting form a parent # Otherwise use the position given