<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Find the Hidden Sock</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f8ff;
margin: 0;
padding: 0;
}
.game-container {
position: relative;
width: 100%;
max-width: 800px;
height: 600px;
margin: 50px auto;
border: 3px solid #ddd;
background-image: url('laundry-room.jpg'); /* Add your background image here */
background-size: cover;
background-position: center;
}
.sock {
position: absolute;
width: 50px;
height: 50px;
cursor: pointer;
display: none;
}
#found-message {
text-align: center;
font-size: 24px;
font-weight: bold;
margin: 20px;
color: green;
}
.button-container {
text-align: center;
}
.start-button {
padding: 10px 20px;
font-size: 18px;
background-color: #4caf50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.start-button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<h1 style="text-align: center;">Find the Hidden Sock!</h1>
<div id="found-message"></div>
<div class="game-container">
<!-- Hidden Socks -->
<img src="sad-sock.png" class="sock" id="sock1" style="top: 200px; left: 100px;" alt="Sock">
<img src="stinky-sock.png" class="sock" id="sock2" style="top: 350px; left: 300px;" alt="Sock">
<img src="fuzzy-sock.png" class="sock" id="sock3" style="top: 100px; left: 500px;" alt="Sock">
</div>
<div class="button-container">
<button class="start-button" onclick="startGame()">Start Game</button>
</div>
<script>
const socks = document.querySelectorAll('.sock');
let foundCount = 0;
function startGame() {
document.getElementById('found-message').textContent = '';
foundCount = 0;
socks.forEach(sock => {
sock.style.display = 'block';
sock.onclick = function() {
this.style.display = 'none';
foundCount++;
checkWin();
};
});
}
function checkWin() {
if (foundCount === socks.length) {
document.getElementById('found-message').textContent = 'Congratulations! You found all the socks!';
}
}
</script>
</body>
</html>