neocities mascot wearing a halloween mask

Theme:
Save View Share
<!DOCTYPE html>
<html>
<head>
<title>Survive Smoke-Free</title>
<style>
/* CSS styles for the game elements */
body {
font-family: Arial, sans-serif;
text-align: center;
}
h1, h2 {
color: #333;
}
#game-container {
margin-top: 50px;
}
#score {
font-size: 24px;
margin-bottom: 10px;
}
#buttons {
margin-top: 20px;
}
.button {
display: inline-block;
padding: 10px 20px;
font-size: 18px;
background-color: #f00;
color: #fff;
text-decoration: none;
border-radius: 5px;
margin: 10px;
}
.button:hover {
background-color: #c00;
}
#message {
font-size: 18px;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>Survive Smoke</h1>
<h2>Choose a Path to a Healthy Life</h2>
<div id="game-container">
<div id="score">Score: 0</div>
<div id="buttons">
<a href="#" class="button" onclick="chooseOption('quit')">Quit Smoking</a>
<a href="#" class="button" onclick="chooseOption('exercise')">Exercise Regularly</a>
<a href="#" class="button" onclick="chooseOption('eat')">Eat a Balanced Diet</a>
<a href="#" class="button" onclick="chooseOption('hydrate')">Stay Hydrated</a>
</div>
<div id="message"></div>
<div id="final-score" style="display: none;">
<h2>Final Score: <span id="final-score-value"></span></h2>
<p>Thank you for playing! Make healthy choices to live a smoke-free life.</p>
<button class="button" onclick="resetGame()">Play Again</button>
</div>
</div>
<script>
// JavaScript code for the game logic
var score = 0;
var message = document.getElementById('message');
var buttons = document.getElementById('buttons');
var finalScoreContainer = document.getElementById('final-score');
var finalScoreValue = document.getElementById('final-score-value');
// Function to handle option selection
function chooseOption(option) {
buttons.style.display = 'none';
if (option === 'quit') {
score += 30;
message.textContent = 'Congratulations! Quitting smoking greatly reduces the risk of various diseases.';
} else if (option === 'exercise') {
score += 20;
message.textContent = 'Great choice! Regular exercise improves overall health and reduces the impact of smoking.';
} else if (option === 'eat') {
score += 20;
message.textContent = 'Well done! A balanced diet supports a healthy immune system and reduces smoking-related risks.';
} else if (option === 'hydrate') {
score += 10;
message.textContent = 'Stay hydrated! Drinking plenty of water helps in flushing out toxins from the body.';
}
updateScore();
// Check if the game has ended
if (score >= 60) {
endGame();
}
}
// Function to update the score display
function updateScore() {
var scoreDisplay = document.getElementById('score');
scoreDisplay.textContent = 'Score: ' + score;
}
// Function to end the game
function endGame() {
finalScoreValue.textContent = score;
finalScoreContainer.style.display = 'block';
message.style.display = 'none';
}
// Function to reset the game
function resetGame() {
score = 0;
buttons.style.display = 'block';
finalScoreContainer.style.display = 'none';
message.style.display = 'block';
updateScore();
}
</script>
</body>
</html>
×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”×”
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX