Use float velocities
This commit is contained in:
parent
1a725e50a2
commit
253490406e
1 changed files with 3 additions and 3 deletions
|
@ -61,13 +61,13 @@ def rainbow_surface(
|
||||||
|
|
||||||
def transform_bounce(
|
def transform_bounce(
|
||||||
bounds: pg.Rect,
|
bounds: pg.Rect,
|
||||||
velocity: Tuple[int, int],
|
velocity: Tuple[float, float],
|
||||||
x_factor: Tuple[float, float],
|
x_factor: Tuple[float, float],
|
||||||
y_factor: Tuple[float, float],
|
y_factor: Tuple[float, float],
|
||||||
) -> Generator[Tuple[int, int], Tuple[int, int], None]:
|
) -> Generator[Tuple[int, int], Tuple[int, int], None]:
|
||||||
min_velocity = velocity[0]
|
min_velocity = velocity[0]
|
||||||
max_velocity = velocity[1]
|
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)
|
phase = random.uniform(0, 360)
|
||||||
current_x_factor = random.uniform(x_factor[0], x_factor[1])
|
current_x_factor = random.uniform(x_factor[0], x_factor[1])
|
||||||
current_y_factor = random.uniform(y_factor[0], y_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
|
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)
|
size_x, size_y = yield (pos_x, pos_y)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue