Calculator Tools Calculator Tools
Create

Point Blank Period

Sep 8, 2023

About this app

A fun and addictive web app that tests your reflexes. See how fast you can tap the target!

Point Blank Period 0 Start

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>Point Blank Period</title>
<meta name="description" content="A fun and addictive web app that tests your reflexes. See how fast you can tap the target!">
<meta name="keywords" content="game, reflexes, tap, target">

<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() {
var target = document.getElementById("target");
var counter = document.getElementById("counter");
var startButton = document.getElementById("start-button");
var score = 0;
var timer;

// Start the game when the start button is clicked
startButton.addEventListener("click", function() {
score = 0;
counter.textContent = score;
startButton.disabled = true;
target.addEventListener("click", increaseScore);
timer = setInterval(moveTarget, 1000);
});

// Increase the score when the target is clicked
function increaseScore() {
score += 1;
counter.textContent = score;
}

// Move the target to a random position
function moveTarget() {
var x = Math.floor(Math.random() * (window.innerWidth - 100));
var y = Math.floor(Math.random() * (window.innerHeight - 100));
target.style.left = x + "px";
target.style.top = y + "px";
}

// End the game when the target is clicked 10 times
target.addEventListener("click", function() {
if (score >= 10) {
clearInterval(timer);
startButton.disabled = false;
target.removeEventListener("click", increaseScore);
alert("Game Over! Your score is " + score);
}
});
});

} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>

<style>
/* App CSS Goes Here */
body {
background-color: #f9f9f9;
font-family: 'Open Sans', sans-serif;
}

#main-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}

#target {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 100px;
height: 100px;
background-color: #ff5f5f;
border-radius: 50%;
cursor: pointer;
transition: all 0.3s ease-in-out;
}

#counter {
margin-top: 20px;
font-size: 24px;
font-weight: bold;
color: #555;
}

#start-button {
margin-top: 20px;
padding: 10px 20px;
font-size: 18px;
font-weight: bold;
color: #fff;
background-color: #ff5f5f;
border: none;
border-radius: 5px;
cursor: pointer;
transition: all 0.3s ease-in-out;
}

#start-button:hover {
background-color: #e53e3e;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<div id="target"></div>
<div id="counter">0</div>
<button id="start-button">Start</button>
</div>
</body>
</html>