From 1acd790806f37bb9552254c0fb78b60034971b6b Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 23 Oct 2026 20:16:39 +0200 Subject: [PATCH] Pipe barriers now reach the top of the screen On a tall phone the game world sits in the lower part of the display, so the upper pipe column used to stop in mid-air with dead sky above it - and the bird could actually fly up past the wall into that gap. The upper column is now drawn from above the top edge of the screen down to the gap, and its collision box matches, so the ceiling is always where the player expects it on any screen shape. --- index.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index b3a9920..9bd6d43 100644 --- a/index.html +++ b/index.html @@ -950,7 +950,8 @@ function lucky(p, kind) { /* ---------------- collisions & scoring ---------------- */ function pipeHit(box) { for (const p of S.pipes) { - const top = { x: p.x, y: 0, w: p.theme.w, h: p.gapY }; + /* the upper column reaches up past the top of the screen */ + const top = { x: p.x, y: -1e5, w: p.theme.w, h: p.gapY + 1e5 }; const bot = { x: p.x, y: p.gapY + p.gap, w: p.theme.w, h: GROUND_Y - (p.gapY + p.gap) }; if (aabb(box, top) || aabb(box, bot)) return p; } @@ -1362,9 +1363,12 @@ function drawPipe(p) { const topH = p.gapY; const botY = p.gapY + p.gap; const botH = GROUND_Y - botY; + /* the column starts above the top of the screen so the barrier always + reaches the top edge, whatever shape the device is */ + const startY = Math.floor((-VIEW.oy / VIEW.scale) / BLOCK) * BLOCK; for (let col = 0; col < cols; col++) { const bx = Math.round(p.x + col * BLOCK); - for (let y = 0; y < topH; y += BLOCK) { + for (let y = startY; y < topH; y += BLOCK) { block(ctx, bx, y, (y + BLOCK > topH - BLOCK) ? th.top : th.body, p.seed + col); } for (let y = botY; y < botY + botH; y += BLOCK) {