• 26-07-2025, 23:40:29
    #1
    Flappybird oyunu var bazı yerlerinde revize yapılacak.

    1-) frontend’deki hataların giderilmesi

    2-) mevcut scoreboard son 24 saatlik dilimi gösteriyor, last 24 hours butonu eklenip bir önceki 24 saatlik döngüdeki sıralamalar oraya çekilecek

    3-) ekstra optimize edilmesi gereken yerler varsa buralar optimize edilecek

    wp: +90 553 213 43 54
  • 26-07-2025, 23:40:48
    #2
    Yapay zeka
  • 26-07-2025, 23:43:16
    #3
    <!DOCTYPE html>
    <html lang="tr">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Flappy Bird (Basit)</title>
    <style>
    body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #70c5ce;
    overflow: hidden; /* Kaydırmayı engelle */
    font-family: Arial, sans-serif;
    color: white;
    flex-direction: column;
    }

    #game-container {
    width: 320px;
    height: 480px;
    background-color: #4ec0ca;
    border: 2px solid #333;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    }

    #bird {
    width: 30px;
    height: 24px;
    background-color: #ffeb3b; /* Sarı kuş */
    position: absolute;
    left: 50px;
    top: 200px;
    border-radius: 50%;
    border: 1px solid #cddc39;
    z-index: 10;
    }

    .pipe {
    position: absolute;
    width: 50px;
    background-color: #7ed321; /* Yeşil boru */
    border: 2px solid #5a9b1c;
    z-index: 5;
    }

    .pipe-top {
    top: 0;
    }

    .pipe-bottom {
    bottom: 0;
    }

    #score {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    z-index: 100;
    }

    #game-over-screen {
    display: none; /* Başlangıçta gizli */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 2em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 200;
    }

    #game-over-screen button {
    background-color: #ff5722;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    margin-top: 20px;
    }
    </style>
    </head>
    <body>
    <h1>Basit Flappy Bird</h1>
    <div id="game-container">
    <div id="score">0</div>
    <div id="bird"></div>
    <div id="game-over-screen">
    OYUN BİTTİ!
    <br>
    Skorunuz: <span id="final-score">0</span>
    <button id="restart-button">Tekrar Oyna</button>
    </div>
    </div>

    <script>
    const gameContainer = document.getElementById('game-container');
    const bird = document.getElementById('bird');
    const scoreDisplay = document.getElementById('score');
    const gameOverScreen = document.getElementById('game-over-screen');
    const finalScoreDisplay = document.getElementById('final-score');
    const restartButton = document.getElementById('restart-button');

    let birdY = 200;
    let birdVelocity = 0;
    const gravity = 0.3; // Yerçekimi
    const jumpStrength = -6; // Zıplama gücü

    let pipes = [];
    let score = 0;
    let gameOver = false;
    let gameInterval;
    let pipeGenerationInterval;

    const containerWidth = 320;
    const containerHeight = 480;

    function startGame() {
    birdY = 200;
    birdVelocity = 0;
    score = 0;
    gameOver = false;
    scoreDisplay.textContent = score;
    gameOverScreen.style.display = 'none';

    // Mevcut boruları temizle
    pipes.forEach(pipePair => {
    pipePair.top.remove();
    pipePair.bottom.remove();
    });
    pipes = [];

    bird.style.top = birdY + 'px';

    gameInterval = setInterval(gameLoop, 20); // Oyun döngüsü
    pipeGenerationInterval = setInterval(generatePipe, 2000); // Boru oluşturma
    }

    function gameLoop() {
    if (gameOver) {
    clearInterval(gameInterval);
    clearInterval(pipeGenerationInterval);
    gameOverScreen.style.display = 'flex';
    finalScoreDisplay.textContent = score;
    return;
    }

    birdVelocity += gravity;
    birdY += birdVelocity;
    bird.style.top = birdY + 'px';

    // Kuşun ekran dışına çıkmasını engelle
    if (birdY > containerHeight - bird.offsetHeight || birdY < 0) {
    endGame();
    }

    // Boruları hareket ettir ve kontrol et
    pipes.forEach((pipePair, index) => {
    const pipeSpeed = 2;
    pipePair.top.style.left = (parseInt(pipePair.top.style.left) - pipeSpeed) + 'px';
    pipePair.bottom.style.left = (parseInt(pipePair.bottom.style.left) - pipeSpeed) + 'px';

    const pipeLeft = parseInt(pipePair.top.style.left);

    // Boru ekran dışına çıktığında sil
    if (pipeLeft + pipePair.top.offsetWidth < 0) {
    pipePair.top.remove();
    pipePair.bottom.remove();
    pipes.splice(index, 1);
    score++;
    scoreDisplay.textContent = score;
    }

    // Çarpışma kontrolü
    if (
    bird.offsetLeft < pipeLeft + pipePair.top.offsetWidth &&
    bird.offsetLeft + bird.offsetWidth > pipeLeft &&
    (
    (birdY < parseInt(pipePair.top.style.height)) ||
    (birdY + bird.offsetHeight > containerHeight - parseInt(pipePair.bottom.style.height))
    )
    ) {
    endGame();
    }
    });
    }

    function generatePipe() {
    const pipeWidth = 50;
    const gap = 120; // Borular arası boşluk
    const minHeight = 50;
    const maxHeight = containerHeight - gap - minHeight;
    const topPipeHeight = Math.floor(Math.random() * (maxHeight - minHeight + 1)) + minHeight;
    const bottomPipeHeight = containerHeight - topPipeHeight - gap;

    const pipeTop = document.createElement('div');
    pipeTop.classList.add('pipe', 'pipe-top');
    pipeTop.style.width = pipeWidth + 'px';
    pipeTop.style.height = topPipeHeight + 'px';
    pipeTop.style.left = containerWidth + 'px'; // Ekranın sağından başla

    const pipeBottom = document.createElement('div');
    pipeBottom.classList.add('pipe', 'pipe-bottom');
    pipeBottom.style.width = pipeWidth + 'px';
    pipeBottom.style.height = bottomPipeHeight + 'px';
    pipeBottom.style.left = containerWidth + 'px'; // Ekranın sağından başla

    gameContainer.appendChild(pipeTop);
    gameContainer.appendChild(pipeBottom);

    pipes.push({ top: pipeTop, bottom: pipeBottom });
    }

    function jump() {
    if (!gameOver) {
    birdVelocity = jumpStrength;
    }
    }

    function endGame() {
    gameOver = true;
    }

    document.addEventListener('keydown', (e) => {
    if (e.code === 'Space' || e.key === ' ') {
    jump();
    }
    });

    gameContainer.addEventListener('click', jump); // Mobil cihazlar için tıklama

    restartButton.addEventListener('click', startGame);

    startGame(); // Oyunu başlat
    </script>
    </body>
    </html>

    bu kodu codepen.io html bölümüne at flaapy bird yapay zeka yaptı az önce