🗺️
Map
🐠 Tidepool Match
🎮
All Games
🐠 Tidepool Match 🐠
Match three sea creatures in a row to clear the tidepool!
Score
0
Time
2:00
Best
0
Tap a creature, then tap a neighbour to swap!
🌊 Bonus Time! +2 Minutes! 🌊
Time's up! 🌊
Your final score:
0
Play Again 🐚
All Games 🎮
let board = []; let selected = null; let score = 0; let moves = MAX_MOVES; let bestScore = 0; let isAnimating = false; const sleep = ms => new Promise(r => setTimeout(r, ms)); /* ---- BUBBLES ---- */ (()=>{ const wrap = document.getElementById('bubbles'); for(let i=0;i<20;i++){ const b = document.createElement('div'); b.className='bubble'; const s = 6+Math.random()*28; b.style.cssText=`width:${s}px;height:${s}px;left:${Math.random()*100}%;animation-duration:${7+Math.random()*11}s;animation-delay:${Math.random()*9}s;`; wrap.appendChild(b); } })(); /* ---- BOARD INIT ---- */ function randomPiece(){ return PIECES[Math.floor(Math.random()*PIECES.length)]; } function causesMatch(b, r, c, p){ if(c>=2 && b[r][c-1]===p && b[r][c-2]===p) return true; if(r>=2 && b[r-1][c]===p && b[r-2][c]===p) return true; return false; } function initBoard(){ board = []; for(let r=0;r
c1) return 'swap-right'; if(c2
r1) return 'swap-down'; return 'swap-up'; } /* ---- FIND MATCHES ---- */ function findMatches(){ const matched=new Set(); for(let r=0;r
bestScore) bestScore=score; updateHud(); // animate matched cells matches.forEach(key=>{ const [r,c]=key.split(',').map(Number); const el=getCellEl(r,c); if(el) el.classList.add('matched'); }); // show score pop on first matched cell const firstKey=[...matches][0]; const [fr,fc]=firstKey.split(',').map(Number); const firstEl=getCellEl(fr,fc); if(firstEl){ const pop=document.createElement('div'); pop.className='score-pop'; pop.textContent=`+${pts}`; firstEl.appendChild(pop); } await sleep(380); // remove matched pieces matches.forEach(key=>{ const [r,c]=key.split(',').map(Number); board[r][c]=null; }); // gravity: drop pieces down for(let c=0;c
=0;r--){ if(board[r][c]!==null){ board[empty][c]=board[r][c]; if(empty!==r) board[r][c]=null; empty--; } } } // fill from top for(let c=0;c
=bestScore && score>0; document.getElementById('finalBest').textContent = isNew ? '🌟 New best score!' : `Best score: ${bestScore}`; document.getElementById('overlay').classList.add('show'); isAnimating=false; } /* ---- PLAY AGAIN ---- */ document.getElementById('playAgainBtn').addEventListener('click',()=>{ document.getElementById('overlay').classList.remove('show'); startGame(); }); function startGame(){ score=0; moves=MAX_MOVES; selected=null; isAnimating=false; initBoard(); renderBoard(); updateHud(); setHint('Tap a creature to select it.'); } startGame();