Loading leaderboard...
// ===== WORLD GENERATION ===== function generateSection(startX, first=false){ for(let i=0;i<6;i++){ const x = startX + i*260; const gapH = 150; // height of the gap const gapY = Math.random() * (canvas.height - gapH - 40) + 20; // Top pipe walls.push({x: x, y: 0, w: 40, h: gapY}); // Bottom pipe walls.push({x: x, y: gapY + gapH, w: 40, h: canvas.height - (gapY + gapH)}); // Optional: add ship portals in the gap if(!first && Math.random() < 1/15) portals.push({x: x + 20, y: gapY + gapH/2, type: 'ship'}); } lastGeneratedX = startX + 1560; } // ===== DRAW WALLS ===== function drawWalls() { ctx.fillStyle = "#333"; walls.forEach(w => { ctx.fillRect(w.x, w.y, w.w, w.h); }); } // ===== WORLD GENERATION WITH STACKED PIPES ===== function generateSection(startX, first=false){ for(let i=0;i<6;i++){ const x = startX + i*260; const gapH = 150; // height of the gap const gapY = Math.random() * (canvas.height - gapH - 40) + 20; // Top pipe walls.push({x: x, y: 0, w: 40, h: gapY}); // Extra top segment (slightly lower) walls.push({x: x, y: gapY, w: 40, h: 20}); // small "step" below top pipe // Bottom pipe walls.push({x: x, y: gapY + gapH, w: 40, h: canvas.height - (gapY + gapH)}); // Extra bottom segment (slightly above bottom pipe) walls.push({x: x, y: gapY + gapH - 20, w: 40, h: 20}); // small "step" above bottom pipe // Optional: ship portal in the center of the gap if(!first && Math.random() < 1/15) portals.push({x: x + 20, y: gapY + gapH/2, type: 'ship'}); } lastGeneratedX = startX + 1560; } let blades = []; // store all blades function generateSection(startX, first=false){ for(let i=0;i<6;i++){ const x = startX + i*260; const gapH = 150; const gapY = Math.random() * (canvas.height - gapH - 40) + 20; // Top pipe walls.push({x: x, y: 0, w: 40, h: gapY}); // Extra top step walls.push({x: x, y: gapY, w: 40, h: 20}); // Bottom pipe walls.push({x: x, y: gapY + gapH, w: 40, h: canvas.height - (gapY + gapH)}); // Extra bottom step let baseSpeed = 3.5; let speedMultiplier = 1; let pipesPassed = 0; let lastPipeCheckX = 0; // Count pipes passed walls.forEach(w=>{ // Count pipes passed walls.forEach(w=>{ if(w.x + w.w < player.x && !w.passed){ w.passed = true; pipesPassed++; // Every 20 pipes → 1.5x speed if(pipesPassed % 20 === 0){ speedMultiplier *= 1.5 let currentSpeed = baseSpeed * speedMultiplier; player.x += currentSpeed; player.y += currentSpeed * (holding ? -1 : 1); if(holding) player.vy -= 0.35 * speedMultiplier; else player.vy += 0.3 * speedMultiplier; player.vy *= 0.98; player.y += player.vy; player.vy += 0.4 * speedMultiplier; if(holding && !player.ufoJumped){ player.vy = -6 * speedMultiplier; player.ufoJumped = true; } if(!holding) player.ufoJumped = false; player.y += player.vy;