Align bird with hopped upon elements

This commit is contained in:
Idrees Hassan
2025-08-13 22:55:58 -04:00
parent 603d5cd5a1
commit b9dc0506b1
2 changed files with 4 additions and 4 deletions

View File

@@ -1029,7 +1029,7 @@ Promise.all([loadSpritesheetPixels(SPRITE_SHEET_URI), loadSpritesheetPixels(DECO
petStack.shift(); petStack.shift();
} }
const pets = petStack.filter((time) => Date.now() - time < 1000).length; const pets = petStack.filter((time) => Date.now() - time < 1000).length;
if (pets >= 4) { if (pets >= 3) {
setAnimation(Animations.HEART); setAnimation(Animations.HEART);
// Clear the stack // Clear the stack
petStack = []; petStack = [];
@@ -1074,7 +1074,7 @@ Promise.all([loadSpritesheetPixels(SPRITE_SHEET_URI), loadSpritesheetPixels(DECO
// Update the bird's position // Update the bird's position
if (currentState === States.IDLE) { if (currentState === States.IDLE) {
if (focusedElement !== null) { if (focusedElement !== null) {
birdY = getFocusedElementY(); birdY = getFocusedElementY() - 0.5;
if (!isWithinHorizontalBounds()) { if (!isWithinHorizontalBounds()) {
focusOnGround(); focusOnGround();
} }

4
dist/birb.js vendored
View File

@@ -1029,7 +1029,7 @@ Promise.all([loadSpritesheetPixels(SPRITE_SHEET_URI), loadSpritesheetPixels(DECO
petStack.shift(); petStack.shift();
} }
const pets = petStack.filter((time) => Date.now() - time < 1000).length; const pets = petStack.filter((time) => Date.now() - time < 1000).length;
if (pets >= 4) { if (pets >= 3) {
setAnimation(Animations.HEART); setAnimation(Animations.HEART);
// Clear the stack // Clear the stack
petStack = []; petStack = [];
@@ -1074,7 +1074,7 @@ Promise.all([loadSpritesheetPixels(SPRITE_SHEET_URI), loadSpritesheetPixels(DECO
// Update the bird's position // Update the bird's position
if (currentState === States.IDLE) { if (currentState === States.IDLE) {
if (focusedElement !== null) { if (focusedElement !== null) {
birdY = getFocusedElementY(); birdY = getFocusedElementY() - 0.5;
if (!isWithinHorizontalBounds()) { if (!isWithinHorizontalBounds()) {
focusOnGround(); focusOnGround();
} }