Use float velocities

This commit is contained in:
Patrick Moessler 2023-02-19 16:02:58 +01:00
parent 1a725e50a2
commit 253490406e

View file

@ -61,13 +61,13 @@ def rainbow_surface(
def transform_bounce(
bounds: pg.Rect,
velocity: Tuple[int, int],
velocity: Tuple[float, float],
x_factor: Tuple[float, float],
y_factor: Tuple[float, float],
) -> Generator[Tuple[int, int], Tuple[int, int], None]:
min_velocity = velocity[0]
max_velocity = velocity[1]
current_velocity = random.randint(min_velocity, max_velocity)
current_velocity = random.uniform(min_velocity, max_velocity)
phase = random.uniform(0, 360)
current_x_factor = random.uniform(x_factor[0], x_factor[1])
current_y_factor = random.uniform(y_factor[0], y_factor[1])
@ -84,7 +84,7 @@ def transform_bounce(
)
phase += current_velocity / 180 * math.pi
current_velocity = random.randint(min_velocity, max_velocity)
current_velocity = random.uniform(min_velocity, max_velocity)
size_x, size_y = yield (pos_x, pos_y)