Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Don't kill contributors on window squish #6675

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/games/contributors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ fn collision_system(
let wall_right = window.width() / 2.;

// The maximum height the birbs should try to reach is one birb below the top of the window.
let max_bounce_height = window.height() - SPRITE_SIZE * 2.0;
let max_bounce_height = (window.height() - SPRITE_SIZE * 2.0).max(0.0);

let mut rng = rand::thread_rng();

Expand All @@ -274,7 +274,7 @@ fn collision_system(
transform.translation.y = ground + SPRITE_SIZE / 2.0;

// How high this birb will bounce.
let bounce_height = rng.gen_range((max_bounce_height * 0.4)..max_bounce_height);
let bounce_height = rng.gen_range((max_bounce_height * 0.4)..=max_bounce_height);

// Apply the velocity that would bounce the birb up to bounce_height.
velocity.translation.y = (bounce_height * GRAVITY * 2.).sqrt();
Expand Down