Skip to content

Commit

Permalink
fix: clamp flappy velocity when not being driven
Browse files Browse the repository at this point in the history
  • Loading branch information
nelson137 committed Jan 12, 2024
1 parent b08c421 commit 68c6e3e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/elements/flappy_jellyfish.rs
Expand Up @@ -171,6 +171,7 @@ fn control_flappy_jellyfish(
player_inputs: Res<MatchInputs>,
mut explode_flappies: CompMut<ExplodeFlappyJellyfish>,
mut bodies: CompMut<KinematicBody>,
flappy_jellyfishes: Comp<FlappyJellyfish>,
) {
let t = time.delta_seconds();

Expand Down Expand Up @@ -199,7 +200,9 @@ fn control_flappy_jellyfish(
if owner_control.jump_just_pressed {
body.velocity.y += SPEED_JUMP;
}
}

for (_, (_, body)) in entities.iter_with((&flappy_jellyfishes, &mut bodies)) {
body.velocity = body.velocity.clamp(MIN_SPEED, MAX_SPEED);
}
}
Expand Down

0 comments on commit 68c6e3e

Please sign in to comment.