Estava meio sem o que fazer, fiz um joguinho, com JS/HTML/CSS:
<html><head>
<title>Jogo Simples em JS</title>
</head>
<style type="text/css">
body {
background-color: black;
margin-left: 20px;
margin-top: 20px;
color: white;
}
div#jogo {
border: 1px solid white;
width:400px;
height:300px;
}
.botao {
width:21px;
height:21px;
background-color: white;
position:relative;
}
</style>
<script language="javascript">
var started = 0;
var pontos = 0;
var segundos = 0;
function bemvindo()
{
alert("Bem vindo!\nPara começar um jogo, clique em Iniciar.");
}
function rand( min, max ) {
// http://kevin.vanzonneveld.net
// + original by: Leslie Hoare
// + bugfixed by: Onno Marsman
// * example 1: rand(1, 1);
// * returns 1: 1
var argc = arguments.length;
if (argc == 0) {
min = 0;
max = 2147483647;
} else if (argc == 1) {
throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');
}
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function randomBotao()
{
if (started == 1)
{
var botao = document.getElementById("mainbutton");
var rand_width = rand(25,375);
var rand_height = rand(25,275);
botao.style.top = rand_height+"px";
botao.style.left = rand_width+"px";
setTimeout("randomBotao();",2000);
}
}
function pontuar()
{
if (started == 1)
{
var botao = document.getElementById("mainbutton");
var rand_width = rand(25,375);
var rand_height = rand(25,275);
botao.style.top = rand_height+"px";
botao.style.left = rand_width+"px";
pontos++;
document.getElementById("pontuacao").innerHTML = pontos;
}
}
function iniciarjogo()
{
if (confirm("Você deseja começar um novo jogo?") == true)
{
alert("Jogo iniciado.\nPara jogar, basta clicar o máximo de vezes no quadrado que aparecerá na tela.");
pontos = 0;
started = 1;
document.getElementById("mainbutton").style.display = "block";
randomBotao();
segundos = 60;
document.getElementById("tempo_restante").innerHTML = segundos;
iniciarTimer();
document.getElementById("pontuacao").innerHTML = 0;
}
else
{
alert("Jogo não iniciado.");
}
}
function iniciarTimer()
{
if (segundos > 1)
{
segundos = segundos - 1;
document.getElementById("tempo_restante").innerHTML = segundos;
setTimeout("iniciarTimer();",1000);
}
else
{
segundos = 0;
document.getElementById("tempo_restante").innerHTML = segundos;
alert("Jogo terminado!\nPontos feitos: "+pontos+"");
pontos = 0;
started = 0;
document.getElementById("pontuacao").innerHTML = 0;
document.getElementById("mainbutton").style.display = "none";
}
}
</script>
<body onload="bemvindo();">
<input type="button" value="Iniciar" onclick="iniciarjogo();" /> <br><br>
<div id="jogo"><input type="button" value=" " onClick="pontuar();" id="mainbutton" class="botao" style="display:none;"/></div><br>
<div style="margin-left:30px;"><b>Pontos:</b> <span id="pontuacao">0</span> <b>Segundos Restantes:</b> <span id="tempo_restante">0</span> </div>
</body>
</html>