<!--
--  Uploaded on : https://haxor.my.id/open/virlw.html
--  Official Web : https://prinsh.com
--  script-deface-generator.prinsh.com
-->
# Flappy Bird Game

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Flappy Bird Sumu</title>
    <style>
        body {
            margin: 0;
            overflow: hidden;
            background-color: #70c5ce;
        }
        canvas {
            display: block;
            margin: auto;
            background: #70c5ce;
        }
    </style>
</head>
<body>
    <canvas id="gameCanvas" width="320" height="480"></canvas>
    <script>
        const canvas = document.getElementById('gameCanvas');
        const ctx = canvas.getContext('2d');

        let bird = { x: 50, y: 150, width: 20, height: 20, gravity: 0.6, lift: -15, velocity: 0 };
        let pipes = [];
        let score = 0;
        let frame = 0;

        function setup() {
            document.addEventListener('keydown', () => bird.velocity += bird.lift);
            setInterval(() => {
                if (frame % 90 === 0) {
                    let pipeHeight = Math.random() * (canvas.height - 100) + 20;
                    pipes.push({ x: canvas.width, y: pipeHeight, width: 20 });
                }
                frame++;
                update();
            }, 1000 / 60);
        }

        function update() {
            bird.velocity += bird.gravity;
            bird.y += bird.velocity;

            if (bird.y > canvas.height) {
                resetGame();
            }

            for (let i = pipes.length - 1; i >= 0; i--) {
                pipes[i].x -= 2;

                if (pipes[i].x < bird.x && pipes[i].x + pipes[i].width > bird.x) {
                    if (bird.y < pipes[i].y || bird.y + bird.height > pipes[i].y + 100) {
                        resetGame();
                    } else {
                        score++;
                        pipes.splice(i, 1);
                    }
                }

                if (pipes[i].x + pipes[i].width < 0) {
                    pipes.splice(i, 1);
                }
            }

            draw();
        }

        function draw() {
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            ctx.fillStyle = 'yellow';
            ctx.fillRect(bird.x, bird.y, bird.width, bird.height);

            ctx.fillStyle = 'green';
            pipes.forEach(pipe => {
                ctx.fillRect(pipe.x, 0, pipe.width, pipe.y);
                ctx.fillRect(pipe.x, pipe.y + 100, pipe.width, canvas.height);
            });

            ctx.fillStyle = 'black';
            ctx.font = '20px Arial';
            ctx.fillText(`Score: ${score}`, 10, 20);
        }

        function resetGame() {
            bird.y = 150;
            bird.velocity = 0;
            pipes = [];
            score = 0;
        }

        setup();
    </script>
</body>
</html>