!DOCTYPE HTML
!DOCTYPE HTML
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Escape the Cursed Tomb</title>
<style>
body { font-family: Arial, sans-serif; background-color: black; color:
white; text-align: center; padding: 20px; }
#game-text { margin: 20px auto; width: 80%; max-width: 600px; }
.choice-button { background-color: gold; color: black; border: none;
padding: 10px; margin: 5px; cursor: pointer; font-size: 18px; }
.choice-button:hover { background-color: darkgoldenrod; }
</style>
</head>
<body>
<h1>Escape the Cursed Tomb</h1>
<p id="game-text">You wake up inside an ancient Egyptian tomb. The door behind
you is sealed. You must find a way out before time runs out!</p>
<div id="choices"></div>
<script>
const gameText = document.getElementById("game-text");
const choicesDiv = document.getElementById("choices");
function startGame() {
updateGame("You see two paths: A dark tunnel to the left and a stairway
leading up to the right.", [
{ text: "Take the left tunnel", action: exploreTunnel },
{ text: "Go up the stairs", action: climbStairs }
]);
}
function exploreTunnel() {
updateGame("The tunnel leads to a dimly lit chamber. You see an ancient
chest.", [
{ text: "Open the chest", action: openChest },
{ text: "Ignore the chest and move on", action: moveForward }
]);
}
function openChest() {
inventory.push("Golden Scarab");
updateGame("You found a Golden Scarab! It might be useful later.", [
{ text: "Move forward", action: moveForward }
]);
}
function moveForward() {
updateGame("You encounter a giant stone door with hieroglyphs.", [
{ text: "Try to decipher the symbols", action: decipherSymbols },
{ text: "Look for another way", action: findAnotherWay }
]);
}
function climbStairs() {
updateGame("You reach the top but trigger a trap! A rolling boulder is
coming.", [
{ text: "Run back down!", action: startGame },
{ text: "Jump to the side", action: avoidBoulder }
]);
}
function avoidBoulder() {
updateGame("You barely dodge the boulder! But now you are lost in
another chamber.", [
{ text: "Search for clues", action: findClues }
]);
}
function findClues() {
updateGame("You find an old map. It shows a hidden exit behind a
statue.", [
{ text: "Go to the statue", action: goToStatue }
]);
}
function goToStatue() {
if (inventory.includes("Golden Scarab")) {
updateGame("You place the Golden Scarab in the statue's hands. A
secret door opens. You escape!", []);
} else {
updateGame("The statue requires an offering. You don’t have one!
You are trapped forever.", []);
}
}
function decipherSymbols() {
updateGame("The symbols tell of an ancient treasure. You press one, and
a hidden door opens!", [
{ text: "Enter the door", action: enterSecretRoom }
]);
}
function findAnotherWay() {
updateGame("You search for another way but find nothing. You are
trapped forever.", []);
}
function enterSecretRoom() {
updateGame("Inside, you find an ancient artifact. A bright light
engulfs you, and you are transported outside! You have escaped!", []);
}
startGame();
</script>
</body>
</html>