以下が実際のプログラムです。
```html
<!DOCTYPE html>
<html>
<head>
<title>Poop Game</title>
<style type="text/css">
body {
margin: 0;
padding: 0;
overflow: hidden;
}
canvas {
width: 100vw;
height: 100vh;
}
</style>
</head>
<body>
<script type="text/javascript">
var canvas = document.createElement("canvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
document.body.appendChild(canvas);
var ctx = canvas.getContext("2d");
var poopImg = new Image();
poopImg.src = "https://i.imgur.com/dB7NRSr.png";
var toiletImg = new Image();
toiletImg.src = "https://i.imgur.com/eZfUlYn.png";
var width = 30;
var height = 30;
var poops = [];
var toilets = [];
var score = 0;
var timer = 30;
var gameOver = false;
function Poop(x, y, speed) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.speed = speed;
this.move = function() {
this.x += this.speed;
}
this.draw = function() {
ctx.drawImage(poopImg, this.x, this.y, this.width, this.height);
}
}
function Toilet(x, y) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.draw = function() {
ctx.drawImage(toiletImg, this.x, this.y, this.width, this.height);
}
}
canvas.addEventListener("click", function(event) {
if (!gameOver) {
var x = event.clientX - width / 2;
var y = event.clientY - height / 2;
var speed = 5 + Math.random() * 5;
poops.push(new Poop(x, y, speed));
}
});
function spawnToilet() {
if (!gameOver) {
var x = canvas.width - width;
var y = Math.random() * (canvas.height - height);
toilets.push(new Toilet(x, y));
setTimeout(spawnToilet, 1000);
}
}
function detectCollision(poop, toilet) {
if (poop.x + poop.width > toilet.x &&
poop.x < toilet.x + toilet.width &&
poop.y + poop.height > toilet.y &&
poop.y < toilet.y + toilet.height) {
return true;
}
return false;
}
function gameLoop() {
if (!gameOver) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < poops.length; i++) {
poops[i].move();
poops[i].draw();
if (poops[i].x > canvas.width) {
poops.splice(i, 1);
i--;
}
}
for (var i = 0; i < toilets.length; i++) {
toilets[i].draw();
for (var j = 0; j < poops.length; j++) {
if (detectCollision(poops[j], toilets[i])) {
toilets.splice(i, 1);
i--;
poops.splice(j, 1);
j--;
score++;
break;
}
}
}
timer -= 1 / 60;
if (timer <= 0) {
gameOver = true;
}
ctx.fillStyle = "white";
ctx.font = "36px Arial";
ctx.fillText("Score: " + score.toFixed(0), 10, 50);
ctx.fillText("Time: " + timer.toFixed(0), 10, 100);
requestAnimationFrame(gameLoop);
} else {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "white";
ctx.font = "72px Arial";
ctx.fillText("Game Over!", canvas.width / 2 - 200, canvas.height / 2);
ctx.fillStyle = "white";
ctx.font = "36px Arial";
ctx.fillText("Final Score: " + score.toFixed(0), canvas.width / 2 - 100, canvas.height / 2 + 50);
}
}
spawnToilet();
requestAnimationFrame(gameLoop);
</script>
</body>
</html>
```
ジョークとして、「トイレに顔を寄せていると宇宙人に誘拐される」というものを追加してみました。これは、ポーズ画面に表示されるメッセージに含まれています。