Bastian Barennes

- The Best Ever

    Catch the Falling Object

    Score: 0

    Time: 0 seconds

    Game Over

    Your score:

    Time survived: seconds

    const canvas = document.getElementById('gameCanvas'); const ctx = canvas.getContext('2d'); const scoreElement = document.getElementById('score'); const timeElement = document.getElementById('time'); const gameOverElement = document.getElementById('gameOver'); const finalScoreElement = document.getElementById('finalScore'); const finalTimeElement = document.getElementById('finalTime'); const restartButton = document.getElementById('restartButton'); let score = 0; let basketX = canvas.width / 2; const basketY = canvas.height - 30; const basketWidth = 60; const basketHeight = 20; let itemX = Math.random() * (canvas.width - 20); let itemY = 0; const itemSize = 20; let itemSpeed = 2; let startTime = Date.now(); let elapsedTime = 0; let gameActive = true; function drawBasket() { ctx.fillStyle = 'brown'; ctx.fillRect(basketX - basketWidth / 2, basketY, basketWidth, basketHeight); } function drawItem() { ctx.fillStyle = 'red'; ctx.fillRect(itemX, itemY, itemSize, itemSize); } function updateGame() { if (!gameActive) return; ctx.clearRect(0, 0, canvas.width, canvas.height); drawBasket(); drawItem(); elapsedTime = Math.floor((Date.now() - startTime) / 1000); timeElement.textContent = elapsedTime; itemSpeed = 2 + (elapsedTime / 10); itemY += itemSpeed; if (itemY + itemSize > basketY && itemX + itemSize > basketX - basketWidth / 2 && itemX < basketX + basketWidth / 2) { score++; scoreElement.textContent = score; resetItem(); } if (itemY > canvas.height) { gameOver(); return; } requestAnimationFrame(updateGame); } function resetItem() { itemY = 0; itemX = Math.random() * (canvas.width - itemSize); } function gameOver() { gameActive = false; gameOverElement.style.display = 'block'; finalScoreElement.textContent = score; finalTimeElement.textContent = elapsedTime; } function restartGame() { score = 0; itemSpeed = 2; startTime = Date.now(); elapsedTime = 0; gameActive = true; gameOverElement.style.display = 'none'; scoreElement.textContent = '0'; timeElement.textContent = '0'; resetItem(); updateGame(); } canvas.addEventListener('mousemove', (e) => { if (!gameActive) return; const rect = canvas.getBoundingClientRect(); basketX = e.clientX - rect.left; }); restartButton.addEventListener('click', restartGame); updateGame();
    Enter the Code

    Access Granted

    Welcome to the secret area. Here you can put any content you want to reveal.

    const codeInput = document.getElementById('codeInput'); const submitBtn = document.getElementById('submitBtn'); const secretContainer = document.getElementById('secretContainer'); const correctCode = "suri"; submitBtn.addEventListener('click', checkCode); codeInput.addEventListener('keypress', function(e) { if (e.key === 'Enter') { checkCode(); } }); function checkCode() { const enteredCode = codeInput.value.toLowerCase(); if (enteredCode === correctCode) { revealSecret(); } else { shakeInput(); } } function revealSecret() { secretContainer.style.display = 'block'; codeInput.style.backgroundColor = '#d4edda'; submitBtn.disabled = true; secretContainer.scrollIntoView({ behavior: 'smooth' }); } function shakeInput() { codeInput.style.backgroundColor = '#f8d7da'; codeInput.classList.add('shake'); setTimeout(() => { codeInput.classList.remove('shake'); codeInput.style.backgroundColor = ''; }, 500); } const style = document.createElement('style'); style.textContent = ` @keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-5px); } 100% { transform: translateX(0); } } .shake { animation: shake 0.2s ease-in-out 0s 2; } `; document.head.appendChild(style);