mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-24 19:59:36 +00:00
Ensure bird doesn't fly up too far
This commit is contained in:
@@ -552,6 +552,12 @@ Promise.all([
|
||||
birb.setAnimation(Animations.STILL);
|
||||
}
|
||||
|
||||
// Clamp startY, birdY, targetY to a bit above the top of the window
|
||||
const maxY = getWindowHeight() * 1.5;
|
||||
startY = Math.min(startY, maxY);
|
||||
birdY = Math.min(birdY, maxY);
|
||||
targetY = Math.min(targetY, maxY);
|
||||
|
||||
// Update HTML element position
|
||||
birb.setX(birdX);
|
||||
birb.setY(birdY);
|
||||
|
||||
Reference in New Issue
Block a user