Fun Game
About this app
Play a fun and addictive game
Fun Game Score: 0 Start Reset
Related apps
Put this on your site
Source
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Fun Game</title>
<meta name="description" content="Play a fun and addictive game">
<meta name="keywords" content="game, fun, addictive">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<script type="text/javascript">
try {
// App Javascript Goes Here. Place your entire script content inside the try block for error handling.
document.addEventListener("DOMContentLoaded", function() {
// Game logic goes here
const gameContainer = document.getElementById("game-container");
const scoreContainer = document.getElementById("score-container");
const startButton = document.getElementById("start-button");
const resetButton = document.getElementById("reset-button");
const scoreText = document.getElementById("score-text");
let score = 0;
let gameInProgress = false;
let intervalId;
function startGame() {
if (gameInProgress) {
return;
}
gameInProgress = true;
score = 0;
scoreText.textContent = score;
intervalId = setInterval(() => {
score++;
scoreText.textContent = score;
}, 1000);
}
function stopGame() {
if (!gameInProgress) {
return;
}
gameInProgress = false;
clearInterval(intervalId);
}
function resetGame() {
stopGame();
score = 0;
scoreText.textContent = score;
}
startButton.addEventListener("click", startGame);
resetButton.addEventListener("click", resetGame);
});
} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>
<style>
/* App CSS Goes Here */
body {
background-color: #f1f1f1;
font-family: 'Roboto', sans-serif;
}
#main-container {
text-align: center;
padding-top: 50px;
}
#game-container {
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
padding: 20px;
margin-bottom: 20px;
}
#score-container {
font-size: 24px;
margin-bottom: 10px;
}
#score-text {
font-weight: bold;
color: #ff0000;
}
#start-button, #reset-button {
font-size: 16px;
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
margin-right: 10px;
}
#start-button:hover, #reset-button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<div id="game-container">
<div id="score-container">
Score: <span id="score-text">0</span>
</div>
<button id="start-button">Start</button>
<button id="reset-button">Reset</button>
</div>
</div>
</body>
</html>
NEW APPS
These are apps made by the community!