Meta Description" name="description" />

Share this result

Previews are deleted daily. Get a permanent share link sent to your inbox:
Script
<!DOCTYPE html> <html> <head> <title>Shooting Game</title> <style> body { margin:0; background:black; overflow:hidden; } canvas { display:block; } </style> </head> <body> <canvas id="canvas"></canvas> <script> const canvas = document.getElementById("canvas"); const ctx = canvas.getContext("2d"); canvas.width = window.innerWidth; canvas.height = window.innerHeight; // Player let player = { x: 100, y: canvas.height/2, size: 30 }; // Enemy let enemy = { x: canvas.width - 150, y: canvas.height/2, size: 30, alive: true }; // Bullets let bullets = []; // Controls window.addEventListener("keydown", (e) => { if (e.key === "ArrowUp") player.y -= 20; if (e.key === "ArrowDown") player.y += 20; if (e.key === " ") { bullets.push({ x: player.x + 20, y: player.y + 10 }); } }); function drawPlayer() { ctx.fillStyle = "blue"; ctx.fillRect(player.x, player.y, player.size, player.size); } function drawEnemy() { if (enemy.alive) { ctx.fillStyle = "red"; ctx.fillRect(enemy.x, enemy.y, enemy.size, enemy.size); } } function drawBullets() { ctx.fillStyle = "yellow"; bullets.forEach(b => { ctx.fillRect(b.x, b.y, 10, 5); }); } function updateBullets() { bullets.forEach(b => { b.x += 8; // Collision if (enemy.alive && b.x < enemy.x + enemy.size && b.x + 10 > enemy.x && b.y < enemy.y + enemy.size && b.y + 5 > enemy.y) { enemy.alive = false; } }); } function drawWin() { if (!enemy.alive) { ctx.fillStyle = "white"; ctx.font = "40px Arial"; ctx.fillText("You Win!", canvas.width/2 - 100, 100); } } function update() { ctx.clearRect(0,0,canvas.width,canvas.height); drawPlayer(); drawEnemy(); drawBullets(); updateBullets(); drawWin(); requestAnimationFrame(update); } update(); </script> </body> </html>
Landing Page
This ad does not have a landing page available
Network Timeline
Performance Summary

1

Requests

1

Domains

2KB

Transfer Size

2KB

Content Size

114.0ms

Dom Content Loaded

188.0ms

First Paint

114.0ms

Load Time
Domain Breakdown
Transfer Size (bytes)
Loading...
Content Size (bytes)
Loading...
Header Size (bytes)
Loading...
Requests
Loading...
Timings (ms)
Loading...
Total Time
Loading...
Content Breakdown
Transfer Size (bytes)
Loading...
Content Size (bytes)
Loading...
Header Size (bytes)
Loading...
Requests
Loading...