🎮ArcadeLab

Birthday Minecraft Game

by SilverTiger54
156 lines2.9 KB
▶ Play
<!DOCTYPE html>
<html>
<head>
    <title>Birthday Minecraft Game</title>

    <style>
        body {
            margin: 0;
            font-family: Arial, sans-serif;
            text-align: center;
            background: #87CEEB;
        }

        h1 {
            background: #4CAF50;
            color: white;
            padding: 20px;
            margin: 0;
        }

        #game {
            padding: 20px;
        }

        #score {
            font-size: 24px;
            font-weight: bold;
            margin: 15px;
        }

        .block {
            width: 80px;
            height: 80px;
            display: inline-block;
            margin: 8px;
            border: 4px solid #333;
            cursor: pointer;
            font-size: 40px;
            line-height: 80px;
            user-select: none;
        }

        .grass {
            background: #5DBB63;
        }

        .stone {
            background: #888888;
        }

        .dirt {
            background: #9B6B43;
        }

        #message {
            display: none;
            background: white;
            margin: 20px auto;
            padding: 25px;
            max-width: 500px;
            border-radius: 15px;
            border: 4px solid #FFD700;
        }

        button {
            padding: 12px 20px;
            font-size: 18px;
            cursor: pointer;
            border-radius: 10px;
            border: none;
        }
    </style>
</head>

<body>

<h1>🎂 Minecraft Birthday Adventure! ⛏️</h1>

<div id="game">

    <h2>Mine the blocks to find diamonds! 💎</h2>

    <div id="score">💎 Diamonds: 0</div>

    <div id="blocks"></div>

    <div id="message">
        <h2>🎉 ACHIEVEMENT UNLOCKED! 🎉</h2>
        <h1>🎂 HAPPY BIRTHDAY! 🎂</h1>

        <p>
            💎 You found all the diamonds!
        </p>

        <p>
            ⭐ Your birthday level has increased!
        </p>

        <p>
            🏆 You are an awesome friend!
        </p>
    </div>

</div>

<script>

let diamonds = 0;

let blocks = document.getElementById("blocks");
let score = document.getElementById("score");
let message = document.getElementById("message");

let blockTypes = ["grass", "stone", "dirt"];

for (let i = 0; i < 15; i++) {

    let block = document.createElement("div");

    let type = blockTypes[Math.floor(Math.random() * blockTypes.length)];

    block.className = "block " + type;
    block.innerHTML = "⬛";

    block.onclick = function() {

        if (block.innerHTML === "💎") {
            return;
        }

        let chance = Math.random();

        if (chance < 0.3) {

            block.innerHTML = "💎";
            diamonds++;

            score.innerHTML = "💎 Diamonds: " + diamonds;

            if (diamonds >= 5) {
                message.style.display = "block";
            }

        } else {

            block.innerHTML = "💥";
        }
    };

    blocks.appendChild(block);
}

</script>

</body>
</html>

Game Source: Birthday Minecraft Game

Creator: SilverTiger54

Libraries: none

Complexity: moderate (156 lines, 2.9 KB)

The full source code is displayed above on this page.

Remix Instructions

To remix this game, copy the source code above and modify it. Add a ARCADELAB header at the top with "remix_of: birthday-minecraft-game-silvertiger54" to link back to the original. Then publish at arcadelab.ai/publish.