Run details
- Model
- openai/gpt-6-luna
- Route
- OpenRouter API
- Served by
- OpenAI
- Effort
- medium (OpenRouter default)
- Limits
- 60 min · 128,000 output tokens (model max)
- Date
- 24 Oct 2026
- Time
- 59 s
- Size
- 19 kB
- Tokens
- 83 in, 7,759 out (1,223 thinking)
- List price
- $0.004 at today's price ($0.10 in / $0.50 out per M)
- Paid
- $0.004
Prompt
Make a Breakout game I can play right now with the keyboard or the mouse. Give it several levels, a score and some juice. It must be one complete, self-contained HTML file: inline all CSS and JavaScript, and make no network requests of any kind (no CDNs, web fonts or remote images). Reply with the file in a single ```html code block.
Source
19 kB 456 lines Raw
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>BREAKOUT // NEON ARCADE</title>
<style>
:root { color-scheme: dark; --cyan:#63f5ff; --pink:#ff56ba; --ink:#070a17; }
* { box-sizing:border-box; }
body {
margin:0; min-height:100vh; display:flex; align-items:center; justify-content:center;
padding:24px; overflow-x:hidden; color:#eaf6ff;
background:
radial-gradient(ellipse at 50% 0%, #17234a 0%, #0b1025 42%, #060812 100%);
font-family:Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.shell { width:min(100%, 960px); }
header { display:flex; justify-content:space-between; align-items:end; gap:16px; margin:0 2px 12px; }
.eyebrow { color:var(--cyan); font-size:10px; font-weight:800; letter-spacing:.25em; text-transform:uppercase; }
h1 { margin:3px 0 0; font-size:clamp(22px,4vw,34px); line-height:1; letter-spacing:.08em; font-weight:900; }
h1 span { color:var(--pink); text-shadow:0 0 18px #ff56ba77; }
.tag { color:#8591b3; font-size:11px; letter-spacing:.14em; text-align:right; }
.frame {
padding:1px; border-radius:15px;
background:linear-gradient(135deg,#69f7ff99,#483f9b44 42%,#ff56ba77);
box-shadow:0 0 50px #162d6c55, 0 22px 70px #0009;
}
.screen { position:relative; overflow:hidden; border-radius:14px; background:#080c1b; }
canvas { display:block; width:100%; height:auto; aspect-ratio:3/2; touch-action:none; cursor:crosshair; }
.bar {
display:flex; justify-content:space-between; align-items:center; gap:12px;
padding:12px 4px 0; color:#8d99b8; font-size:11px;
}
.keys { display:flex; flex-wrap:wrap; gap:7px 15px; }
.keys b { color:#d7e5ff; font-weight:650; }
kbd {
display:inline-block; min-width:21px; padding:2px 5px; margin-right:3px;
border:1px solid #34405f; border-radius:4px; color:#dbe9ff;
background:#131a30; font:inherit; text-align:center;
}
.actions { display:flex; gap:8px; flex-shrink:0; }
button {
border:1px solid #34405f; border-radius:7px; padding:7px 10px;
background:#11182d; color:#dce9ff; font:700 10px inherit;
font-size:10px; letter-spacing:.08em; cursor:pointer;
}
button:hover { border-color:var(--cyan); color:var(--cyan); }
@media (max-width:600px) {
body { padding:12px; }
header { align-items:center; }
.tag { display:none; }
.bar { align-items:flex-start; }
.keys { gap:7px 10px; }
.keys .optional { display:none; }
.actions { flex-direction:column; }
}
</style>
</head>
<body>
<main class="shell">
<header>
<div>
<div class="eyebrow">★ A tiny neon arcade ★</div>
<h1>BREAK<span>OUT</span></h1>
</div>
<div class="tag">5 LEVELS · 3 LIVES · BIG JUICE</div>
</header>
<div class="frame"><div class="screen">
<canvas id="game" aria-label="Breakout game. Move the paddle with the mouse or arrow keys."></canvas>
</div></div>
<div class="bar">
<div class="keys">
<span><kbd>←</kbd><kbd>→</kbd> <b>Move</b></span>
<span><kbd>SPACE</kbd> <b>Launch</b></span>
<span class="optional"><kbd>P</kbd> <b>Pause</b></span>
<span class="optional"><kbd>R</kbd> <b>Restart</b></span>
</div>
<div class="actions">
<button id="soundBtn" type="button">♪ SOUND: ON</button>
<button id="restartBtn" type="button">↻ NEW GAME</button>
</div>
</div>
</main>
<script>
(() => {
"use strict";
const canvas = document.getElementById("game");
const ctx = canvas.getContext("2d");
const W = 960, H = 640;
const field = { x:36, y:72, w:888, h:526 };
const paddleY = 556;
let dpr = 1;
function resize() {
dpr = Math.min(window.devicePixelRatio || 1, 2);
canvas.width = Math.round(W * dpr);
canvas.height = Math.round(H * dpr);
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
}
window.addEventListener("resize", resize);
resize();
const palette = [
["#5df6ff","#39b9ff","#8b78ff","#ff67c4","#ff985f"],
["#73f7d2","#52c9ff","#a48cff","#ff71aa","#ffd166"]
];
const keys = Object.create(null);
let state = "ready", level = 1, score = 0, lives = 3;
let bricks = [], balls = [], drops = [], particles = [];
let paddle = { x:W/2, w:116, target:W/2, vx:0 };
let levelTimer = 0, shake = 0, combo = 0, comboTimer = 0;
let wideTimer = 0, soundOn = true, audio = null, lastTime = 0;
let best = Number(localStorage.getItem("neon-breakout-best") || 0);
let pointerActive = false;
const stars = Array.from({length:100}, (_,i) => ({
x:(i*173.7+41)%W, y:(i*97.3+19)%H,
r:(i%4===0 ? 1.5 : .7), a:.12+(i%7)*.055
}));
function audioContext() {
if (!audio) {
try { audio = new (window.AudioContext || window.webkitAudioContext)(); }
catch (_) { audio = null; }
}
if (audio && audio.state === "suspended") audio.resume();
}
function beep(freq=440, duration=.06, type="sine", volume=.035) {
if (!soundOn) return;
audioContext();
if (!audio) return;
const osc = audio.createOscillator(), gain = audio.createGain();
osc.type = type; osc.frequency.setValueAtTime(freq, audio.currentTime);
gain.gain.setValueAtTime(volume, audio.currentTime);
gain.gain.exponentialRampToValueAtTime(.001, audio.currentTime + duration);
osc.connect(gain); gain.connect(audio.destination);
osc.start(); osc.stop(audio.currentTime + duration);
}
function newBall(stuck=true, x=paddle.x, y=paddleY-17, vx=0, vy=0) {
return {x,y,r:8,vx,vy,stuck,trail:[]};
}
function setupLevel() {
bricks = []; drops = []; particles = [];
balls = [newBall(true)];
paddle.x = paddle.target = W/2;
paddle.vx = 0;
wideTimer = 0;
const cols=11, rows=Math.min(5+Math.floor((level-1)/2),7);
const gap=8, bw=(W-112-gap*(cols-1))/cols, bh=22;
const startX=56, startY=126;
for (let r=0;r<rows;r++) for (let c=0;c<cols;c++) {
let on=true, hp=1;
if (level===2) on = c>=1 && c<=9 && !(r===0 && (c<3||c>7)) && !(r===4 && (c<2||c>8));
else if (level===3) on = (r+c)%2===0 || r===0;
else if (level===4) on = Math.abs(c-5) <= 2 + (r%3) || r===0;
else if (level>=5) on = r===0 || (r>0 && (c===0||c===10||c===5)) || (r===2 && c>=2&&c<=8);
if (level>=3 && on && ((r+c+level)%4===0)) hp=2;
if (!on) continue;
const color=palette[(level-1)%2][(r+level-1)%5];
bricks.push({x:startX+c*(bw+gap),y:startY+r*(bh+9),w:bw,h:bh,hp,maxHp:hp,color,alive:true});
}
state = "ready";
}
function restart() {
level=1; score=0; lives=3; combo=0; comboTimer=0;
shake=0; levelTimer=0;
setupLevel();
}
setupLevel();
function launch() {
if (state==="paused") { state="running"; return; }
if (state==="ready") {
state="running";
for (const b of balls) if (b.stuck) {
const a=(-Math.PI/2) + (Math.random()-.5)*.25;
const speed=390+(level-1)*28;
b.vx=Math.cos(a)*speed; b.vy=Math.sin(a)*speed; b.stuck=false;
}
beep(520,.09,"triangle",.045);
} else if (state==="gameover" || state==="won") restart();
}
function setPointer(e) {
const rect=canvas.getBoundingClientRect();
const x=(e.clientX-rect.left)/rect.width*W;
paddle.target=Math.max(field.x+paddle.w/2,Math.min(field.x+field.w-paddle.w/2,x));
pointerActive=true;
}
canvas.addEventListener("pointermove",setPointer);
canvas.addEventListener("pointerdown",e=>{ setPointer(e); canvas.setPointerCapture?.(e.pointerId); launch(); });
canvas.addEventListener("pointerleave",()=>{ pointerActive=false; });
window.addEventListener("keydown",e=>{
if (["ArrowLeft","ArrowRight","Space"].includes(e.code)) e.preventDefault();
keys[e.code]=true;
if (e.code==="Space" && !e.repeat) launch();
if ((e.code==="KeyP" || e.code==="Escape") && !e.repeat) {
if (state==="running") state="paused";
else if (state==="paused") state="running";
}
if (e.code==="KeyR" && !e.repeat) restart();
});
window.addEventListener("keyup",e=>keys[e.code]=false);
document.getElementById("restartBtn").addEventListener("click",restart);
document.getElementById("soundBtn").addEventListener("click",()=>{
soundOn=!soundOn;
document.getElementById("soundBtn").textContent=soundOn?"♪ SOUND: ON":"♪ SOUND: OFF";
if (soundOn) beep(660,.08,"sine",.03);
});
function burst(x,y,color,n=12,power=190) {
for(let i=0;i<n;i++) {
const a=Math.random()*Math.PI*2, s=power*(.3+Math.random()*.8);
particles.push({x,y,vx:Math.cos(a)*s,vy:Math.sin(a)*s,life:.35+Math.random()*.45,max:.8,color,r:1.5+Math.random()*3});
}
}
function addScore(n) {
score+=n;
if(score>best){best=score;localStorage.setItem("neon-breakout-best",best);}
}
function loseLife() {
lives--;
shake=12;
beep(130,.24,"sawtooth",.055);
burst(paddle.x,paddleY,"#ff5a91",24,230);
if(lives<=0) state="gameover";
else { balls=[newBall(true)]; state="ready"; }
}
function levelDone() {
state="levelclear"; levelTimer=1.65;
shake=8; beep(780,.12,"triangle",.045);
setTimeout(()=>beep(1040,.2,"triangle",.035),100);
}
function update(dt) {
if (state==="levelclear") {
levelTimer-=dt;
if(levelTimer<=0) {
if(level>=5) state="won";
else {level++; setupLevel();}
}
}
let dir=(keys.ArrowRight||keys.KeyD?1:0)-(keys.ArrowLeft||keys.KeyA?1:0);
if(dir) {
paddle.target += dir*620*dt;
pointerActive=false;
}
paddle.target=Math.max(field.x+paddle.w/2,Math.min(field.x+field.w-paddle.w/2,paddle.target));
const oldX=paddle.x;
paddle.x += (paddle.target-paddle.x)*Math.min(1,dt*16);
paddle.vx=(paddle.x-oldX)/Math.max(dt,.001);
if(wideTimer>0) {wideTimer-=dt;if(wideTimer<=0)paddle.w=116;}
if(state==="running") {
comboTimer-=dt;
if(comboTimer<=0) combo=0;
for(let i=balls.length-1;i>=0;i--) {
const b=balls[i];
if(b.stuck){b.x=paddle.x;b.y=paddleY-17;continue;}
b.trail.unshift({x:b.x,y:b.y});
if(b.trail.length>7)b.trail.pop();
b.x+=b.vx*dt; b.y+=b.vy*dt;
if(b.x-b.r<field.x){b.x=field.x+b.r;b.vx=Math.abs(b.vx);beep(240,.035,"sine",.02);}
if(b.x+b.r>field.x+field.w){b.x=field.x+field.w-b.r;b.vx=-Math.abs(b.vx);beep(240,.035,"sine",.02);}
if(b.y-b.r<field.y){b.y=field.y+b.r;b.vy=Math.abs(b.vy);beep(260,.035,"sine",.02);}
if(b.vy>0 && b.y+b.r>=paddleY && b.y-b.r<=paddleY+15 &&
b.x>=paddle.x-paddle.w/2-b.r && b.x<=paddle.x+paddle.w/2+b.r) {
const offset=Math.max(-1,Math.min(1,(b.x-paddle.x)/(paddle.w/2)));
const angle=offset*1.08 + Math.max(-.18,Math.min(.18,paddle.vx/1800));
const speed=Math.min(650,Math.hypot(b.vx,b.vy)*1.012);
b.vx=Math.sin(angle)*speed; b.vy=-Math.cos(angle)*speed;
b.y=paddleY-b.r;
burst(b.x,paddleY,"#63f5ff",5,80);
beep(320+Math.abs(offset)*240,.055,"triangle",.035);
}
let hit=null;
for(const br of bricks) if(br.alive) {
const nx=Math.max(br.x,Math.min(b.x,br.x+br.w));
const ny=Math.max(br.y,Math.min(b.y,br.y+br.h));
const dx=b.x-nx, dy=b.y-ny;
if(dx*dx+dy*dy<=b.r*b.r){hit={br,dx,dy};break;}
}
if(hit) {
const {br,dx,dy}=hit;
if(Math.abs(dx)>Math.abs(dy)) b.vx=dx>0?Math.abs(b.vx):-Math.abs(b.vx);
else b.vy=dy>0?Math.abs(b.vy):-Math.abs(b.vy);
br.hp--;
burst(b.x,b.y,br.color,br.hp<=0?13:5,br.hp<=0?170:90);
shake=Math.max(shake,br.hp<=0?4:2);
beep(br.hp<=0?500:360,.045,"square",.024);
if(br.hp<=0) {
br.alive=false; combo++; comboTimer=1.4;
addScore(10+level*3+Math.min(combo-1,8)*2);
if(Math.random()<.12) drops.push({x:br.x+br.w/2,y:br.y+br.h/2,vy:105,type:Math.random()<.52?"wide":"multi",spin:0});
} else addScore(2);
if(!bricks.some(x=>x.alive)){levelDone();break;}
}
if(b.y-b.r>H) balls.splice(i,1);
}
if(state==="running" && balls.length===0) loseLife();
for(let i=drops.length-1;i>=0;i--) {
const d=drops[i]; d.y+=d.vy*dt; d.spin+=dt*4;
if(d.y>paddleY-6 && d.y<paddleY+18 && Math.abs(d.x-paddle.x)<paddle.w/2+12) {
if(d.type==="wide"){paddle.w=166;wideTimer=10;beep(780,.13,"sine",.04);burst(d.x,d.y,"#63f5ff",18,150);}
else {
const source=balls.find(b=>!b.stuck);
if(source) {
const speed=Math.hypot(source.vx,source.vy);
for(const sign of [-1,1]) {
const a=Math.atan2(source.vy,source.vx)+sign*.38;
balls.push(newBall(false,source.x,source.y,Math.cos(a)*speed,Math.sin(a)*speed));
}
} else balls.push(newBall(true));
beep(900,.12,"sine",.04);burst(d.x,d.y,"#ff70d0",18,155);
}
drops.splice(i,1);
} else if(d.y>H+20) drops.splice(i,1);
}
}
for(let i=particles.length-1;i>=0;i--) {
const p=particles[i];p.x+=p.vx*dt;p.y+=p.vy*dt;p.vx*=Math.pow(.12,dt);p.vy=p.vy*Math.pow(.25,dt)+90*dt;p.life-=dt;
if(p.life<=0)particles.splice(i,1);
}
shake=Math.max(0,shake-dt*30);
}
function roundRect(x,y,w,h,r,fill,stroke) {
ctx.beginPath();ctx.roundRect(x,y,w,h,r);
if(fill){ctx.fillStyle=fill;ctx.fill();}
if(stroke){ctx.strokeStyle=stroke;ctx.stroke();}
}
function text(str,x,y,size,color,align="left",weight=700) {
ctx.fillStyle=color;ctx.font=`${weight} ${size}px ui-sans-serif,system-ui,sans-serif`;
ctx.textAlign=align;ctx.textBaseline="middle";ctx.fillText(str,x,y);
}
function draw() {
ctx.setTransform(dpr,0,0,dpr,0,0);
ctx.clearRect(0,0,W,H);
const sx=shake?(Math.random()-.5)*shake:0, sy=shake?(Math.random()-.5)*shake:0;
ctx.save();ctx.translate(sx,sy);
const bg=ctx.createLinearGradient(0,0,0,H);bg.addColorStop(0,"#0d1530");bg.addColorStop(.55,"#090e20");bg.addColorStop(1,"#080b17");
ctx.fillStyle=bg;ctx.fillRect(0,0,W,H);
for(const s of stars){ctx.globalAlpha=s.a*(.7+.3*Math.sin(performance.now()*.001+s.x));ctx.fillStyle="#b7dfff";ctx.fillRect(s.x,s.y,s.r,s.r);}
ctx.globalAlpha=1;
// Top HUD
text("SCORE",48,29,10,"#7f91b5","left",800);
text(String(score).padStart(6,"0"),48,50,19,"#eaf6ff","left",800);
text("BEST "+String(best).padStart(6,"0"),W/2,40,11,"#8291b4","center",700);
text(`LEVEL ${String(level).padStart(2,"0")} / 05`,W-48,29,10,"#7f91b5","right",800);
for(let i=0;i<3;i++){
ctx.beginPath();ctx.arc(W-53-i*23,51,6,0,Math.PI*2);
ctx.fillStyle=i<lives?"#ff67c4":"#29304b";ctx.shadowColor=i<lives?"#ff67c4":"transparent";ctx.shadowBlur=i<lives?12:0;ctx.fill();ctx.shadowBlur=0;
}
// Playfield frame
ctx.strokeStyle="#253456";ctx.lineWidth=1;ctx.strokeRect(field.x,field.y,field.w,field.h);
ctx.strokeStyle="#63f5ff22";ctx.strokeRect(field.x+4,field.y+4,field.w-8,field.h-8);
for(const br of bricks) if(br.alive) {
const grad=ctx.createLinearGradient(br.x,br.y,br.x,br.y+br.h);
grad.addColorStop(0,br.color);grad.addColorStop(1,br.color+"aa");
ctx.shadowColor=br.color;ctx.shadowBlur=br.hp>1?13:8;
roundRect(br.x,br.y,br.w,br.h,5,grad);
ctx.shadowBlur=0;
ctx.fillStyle="#ffffff33";roundRect(br.x+3,br.y+3,br.w-6,4,2,"#ffffff33");
if(br.hp>1){ctx.fillStyle="#fff";ctx.globalAlpha=.75;ctx.fillRect(br.x+br.w/2-2,br.y+br.h/2-2,4,4);ctx.globalAlpha=1;}
}
// Paddle
const pg=ctx.createLinearGradient(paddle.x-paddle.w/2,paddleY,paddle.x+paddle.w/2,paddleY+12);
pg.addColorStop(0,"#a0ffff");pg.addColorStop(.5,"#57dfff");pg.addColorStop(1,"#7b83ff");
ctx.shadowColor="#57eaff";ctx.shadowBlur=18;
roundRect(paddle.x-paddle.w/2,paddleY,paddle.w,13,7,pg);
ctx.shadowBlur=0;roundRect(paddle.x-paddle.w/2+8,paddleY+2,paddle.w-16,3,2,"#ffffff88");
// Balls and trails
for(const b of balls) {
for(let i=b.trail.length-1;i>=0;i--){
const t=b.trail[i],a=(1-i/b.trail.length)*.17;
ctx.globalAlpha=a;ctx.fillStyle="#a8ffff";ctx.beginPath();ctx.arc(t.x,t.y,b.r*(.35+.6*(1-i/b.trail.length)),0,Math.PI*2);ctx.fill();
}
ctx.globalAlpha=1;ctx.shadowColor="#b8ffff";ctx.shadowBlur=19;
const g=ctx.createRadialGradient(b.x-2,b.y-3,1,b.x,b.y,b.r+2);g.addColorStop(0,"#fff");g.addColorStop(.45,"#c9ffff");g.addColorStop(1,"#57dfff");
ctx.fillStyle=g;ctx.beginPath();ctx.arc(b.x,b.y,b.r,0,Math.PI*2);ctx.fill();ctx.shadowBlur=0;
}
for(const d of drops) {
ctx.save();ctx.translate(d.x,d.y);ctx.rotate(d.spin);
ctx.shadowColor=d.type==="wide"?"#63f5ff":"#ff70d0";ctx.shadowBlur=15;
roundRect(-11,-11,22,22,6,d.type==="wide"?"#1b768e":"#95396f");
ctx.shadowBlur=0;text(d.type==="wide"?"W":"✦",0,0,13,"#fff","center",900);ctx.restore();
}
for(const p of particles) {
ctx.globalAlpha=Math.max(0,p.life/p.max);ctx.fillStyle=p.color;ctx.shadowColor=p.color;ctx.shadowBlur=8;
ctx.beginPath();ctx.arc(p.x,p.y,p.r,0,Math.PI*2);ctx.fill();ctx.shadowBlur=0;
}
ctx.globalAlpha=1;
if(combo>=2 && comboTimer>0 && state==="running") {
text(`${combo}× COMBO`,W/2,field.y+field.h-27,13,"#ffd166","center",900);
}
if(wideTimer>0 && state==="running") {
roundRect(field.x+12,field.y+field.h-39,90,5,3,"#26324b");
roundRect(field.x+12,field.y+field.h-39,90*Math.min(1,wideTimer/10),5,3,"#63f5ff");
text("WIDE",field.x+12,field.y+field.h-49,9,"#63f5ff","left",800);
}
if(state!=="running") drawOverlay();
ctx.restore();
}
function drawOverlay() {
ctx.fillStyle="#050817aa";ctx.fillRect(field.x+1,field.y+1,field.w-2,field.h-2);
let title="",sub="",accent="#63f5ff";
if(state==="ready") {
title=level===1?"READY?":"LEVEL "+level;
sub="MOVE TO AIM · SPACE OR CLICK TO LAUNCH";
} else if(state==="paused") {title="PAUSED";sub="PRESS P OR SPACE TO RESUME";}
else if(state==="levelclear") {title="SECTOR CLEARED";sub=level>=5?"YOU BEAT THE ARCADE!":"NEXT LEVEL INCOMING…";accent="#ffd166";}
else if(state==="gameover") {title="GAME OVER";sub="PRESS SPACE OR CLICK TO TRY AGAIN";accent="#ff67c4";}
else if(state==="won") {title="YOU WIN!";sub="FIVE LEVELS DOWN. THAT WAS ELECTRIC.";accent="#ffd166";}
else return;
ctx.textAlign="center";ctx.textBaseline="middle";
ctx.shadowColor=accent;ctx.shadowBlur=22;ctx.fillStyle=accent;
ctx.font="900 38px ui-sans-serif,system-ui,sans-serif";ctx.fillText(title,W/2,290);
ctx.shadowBlur=0;ctx.fillStyle="#e1eaff";ctx.font="700 12px ui-sans-serif,system-ui,sans-serif";ctx.fillText(sub,W/2,333);
if(state==="ready") {
ctx.fillStyle="#8492b2";ctx.font="600 10px ui-sans-serif,system-ui,sans-serif";
ctx.fillText("CATCH THE FALLING ✦ POWER-UPS: W = WIDE PADDLE",W/2,366);
}
if(state==="gameover"||state==="won") {
ctx.fillStyle="#98a8ca";ctx.font="700 12px ui-sans-serif,system-ui,sans-serif";
ctx.fillText(`FINAL SCORE ${String(score).padStart(6,"0")} · BEST ${String(best).padStart(6,"0")}`,W/2,370);
}
}
function frame(now) {
const dt=Math.min(.033,(now-lastTime)/1000||0);lastTime=now;
update(dt);draw();requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
})();
</script>
</body>
</html>

