unbenannt

Pasted Nov 28, 2026, 3:49 PM1 file283 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/zzgrtrzwj39dqtss
unbenannt

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Burger Arena – Wave Attack</title>
<style>
*{box-sizing:border-box}
body{margin:0;background:#17243b;color:white;font-family:Arial;text-align:center}
header{padding:15px;background:#263c60}
h1{margin:5px;color:#ffcf45}
#stats{display:flex;justify-content:center;gap:12px;flex-wrap:wrap;padding:12px}
.stat{background:#304663;padding:12px;border-radius:12px;min-width:85px}
canvas{display:block;width:min(96vw,800px);height:auto;margin:auto;background:#85d5f4;border:4px solid white;border-radius:15px;touch-action:none}
button{border:0;border-radius:12px;padding:14px 20px;margin:5px;background:#ed7c25;color:white;font-size:17px;font-weight:bold;cursor:pointer}
button:hover{filter:brightness(1.15)}
#message{color:#ffd35a;min-height:25px;padding:10px}
.controls{display:grid;grid-template-columns:repeat(3,65px);justify-content:center;gap:5px;margin:10px}
.controls button{padding:12px;margin:0}
</style>
</head>
<body>
<header>
<h1>🍔 BURGER ARENA 🍌</h1>
<p>Wave Attack – Überlebe die Gegnerwellen!</p>
</header>

<div id="stats">
<div class="stat">Welle<br><b id="wave">1</b></div>
<div class="stat">Gegner<br><b id="enemies">4</b></div>
<div class="stat">Leben<br><b id="hp">5 ❤️</b></div>
<div class="stat">Punkte<br><b id="score">0</b></div>
</div>

<canvas id="game" width="800" height="500"></canvas>
<div id="message">🍔 Besiege alle Gegner!</div>

<button onclick="fire()">🍔 FEUER!</button>
<button onclick="restart()">↻ Neustart</button>

<div class="controls">
<span></span><button onpointerdown="move.up=true" onpointerup="move.up=false" onpointerleave="move.up=false" onpointercancel="move.up=false">⬆️</button><span></span>
<button onpointerdown="move.left=true" onpointerup="move.left=false" onpointerleave="move.left=false" onpointercancel="move.left=false">⬅️</button>
<button onpointerdown="move.down=true" onpointerup="move.down=false" onpointerleave="move.down=false" onpointercancel="move.down=false">⬇️</button>
<button onpointerdown="move.right=true" onpointerup="move.right=false" onpointerleave="move.right=false" onpointercancel="move.right=false">➡️</button>
</div>
<p>PC: WASD / Pfeiltasten bewegen · Maus zielt · Leertaste schießt</p>

<script>
const canvas=document.getElementById("game");
const ctx=canvas.getContext("2d");
const W=800,H=500;
const move={up:false,down:false,left:false,right:false};
let player,enemies,shots,particles,wave,score,ended,aim,breakTime,frame,crate,fireWait;

function rand(a,b){return a+Math.random()*(b-a)}

function restart(){
 wave=1;score=0;ended=false;breakTime=0;frame=0;fireWait=0;
 player={x:390,y:250,hp:5,inv:0};
 shots=[];particles=[];crate=null;
 aim={x:600,y:200};
 spawnWave();message("🍔 Welle 1 beginnt!");
}

function spawnWave(){
 let boss=wave%5===0;
 let count=boss?1:Math.min(4+wave*2,24);
 enemies=[];
 for(let i=0;i<count;i++){
  let side=Math.floor(Math.random()*4);
  enemies.push({
   x:side===0?120:side===1?680:rand(120,680),
   y:side===2?100:side===3?400:rand(100,400),
   hp:boss?15:1,max:boss?15:1,
   boss,color:boss?"#9e42cf":["#ff536d","#ffc13b","#9b76e8","#30b9d5"][i%4],
   stun:0,attack:0,vx:0,vy:0,r:boss?31:17
  });
 }
 update();
 message(boss?"👹 BOSS-WELLE!":"👾 WELLE "+wave+"!");
}

function update(){
 document.getElementById("wave").textContent=wave;
 document.getElementById("enemies").textContent=enemies.length;
 document.getElementById("hp").textContent=player.hp+" ❤️";
 document.getElementById("score").textContent=score;
}

function message(t){document.getElementById("message").textContent=t}

function fire(){
 if(ended||fireWait>0)return;
 fireWait=15;
 let a=Math.atan2(aim.y-player.y,aim.x-player.x);
 shots.push({x:player.x,y:player.y,vx:Math.cos(a)*11,vy:Math.sin(a)*11});
}

function burst(x,y,emoji){
 for(let i=0;i<14;i++){
  let a=rand(0,Math.PI*2),s=rand(1,4);
  particles.push({x,y,vx:Math.cos(a)*s,vy:Math.sin(a)*s,life:30,emoji});
 }
}

function burger(x,y){
 ctx.font="30px Arial";ctx.textAlign="center";ctx.fillText("🍔",x,y+10);
}

function character(e,isPlayer=false){
 ctx.fillStyle="rgba(0,0,0,.2)";
 ctx.beginPath();ctx.ellipse(e.x,e.y+20,e.r,7,0,0,7);ctx.fill();
 ctx.fillStyle=isPlayer?"#2679ed":e.color;
 ctx.beginPath();ctx.ellipse(e.x,e.y+5,e.r,e.r*1.1,0,0,7);ctx.fill();
 ctx.fillStyle="#ffd0a8";
 ctx.beginPath();ctx.arc(e.x,e.y-14,e.r*.75,0,7);ctx.fill();
 ctx.fillStyle="#51362b";
 ctx.beginPath();ctx.arc(e.x,e.y-20,e.r*.7,Math.PI,7);ctx.fill();
 ctx.fillStyle="#222";
 ctx.beginPath();ctx.arc(e.x-5,e.y-14,2,0,7);ctx.arc(e.x+5,e.y-14,2,0,7);ctx.fill();
 if(isPlayer){
  ctx.fillStyle="white";ctx.font="bold 11px Arial";ctx.fillText("DU",e.x,e.y-35);
 }
 if(e.boss){
  ctx.fillStyle="white";ctx.font="bold 14px Arial";ctx.fillText("BOSS",e.x,e.y-48);
  ctx.fillStyle="#333";ctx.fillRect(e.x-30,e.y-40,60,6);
  ctx.fillStyle="#ffdb36";ctx.fillRect(e.x-30,e.y-40,60*e.hp/e.max,6);
 }
}

function draw(){
 ctx.clearRect(0,0,W,H);
 let sky=ctx.createLinearGradient(0,0,0,H);
 sky.addColorStop(0,"#65c9f3");sky.addColorStop(1,"#d6f4ff");
 ctx.fillStyle=sky;ctx.fillRect(0,0,W,H);

 ctx.fillStyle="#32854c";ctx.fillRect(100,65,600,370);
 ctx.fillStyle="#91d88e";ctx.fillRect(110,75,580,350);
 ctx.strokeStyle="white";ctx.lineWidth=5;ctx.strokeRect(110,75,580,350);

 for(let x=130;x<690;x+=40){
  for(let y=90;y<420;y+=40){
   ctx.fillStyle="rgba(255,255,255,.12)";
   ctx.fillRect(x,y,2,2);
  }
 }

 // Bananen-Kanone
 ctx.save();
 ctx.translate(55,250);
 ctx.rotate(Math.atan2(aim.y-player.y,aim.x-player.x));
 ctx.font="42px Arial";ctx.fillText("🍌",0,12);
 ctx.restore();

 enemies.forEach(e=>character(e));
 if(player.inv%8<4)character(player,true);

 shots.forEach(s=>burger(s.x,s.y));

 if(crate){
  ctx.font="30px Arial";ctx.fillText("🎁",crate.x,crate.y);
 }
 particles.forEach(a=>{
  ctx.globalAlpha=a.life/30;
  ctx.font="22px Arial";ctx.fillText(a.emoji,a.x,a.y);
  ctx.globalAlpha=1;
 });

 if(ended){
  ctx.fillStyle="rgba(0,0,0,.7)";ctx.fillRect(0,0,W,H);
  ctx.fillStyle="white";ctx.font="bold 42px Arial";
  ctx.fillText("GAME OVER",400,225);
  ctx.font="23px Arial";ctx.fillText("Punkte: "+score,400,265);
 }
}

function tick(){
 requestAnimationFrame(tick);
 if(!ended){
  frame++;
  if(fireWait>0)fireWait--;
  if(player.inv>0)player.inv--;

  if(breakTime>0){
   breakTime--;
   if(breakTime===0){wave++;spawnWave()}
  }else{
   let dx=(move.right?1:0)-(move.left?1:0);
   let dy=(move.down?1:0)-(move.up?1:0);
   let n=Math.hypot(dx,dy)||1;
   player.x=Math.max(125,Math.min(675,player.x+dx/n*3.5));
   player.y=Math.max(95,Math.min(415,player.y+dy/n*3.5));

   enemies.forEach(e=>{
    let dx=player.x-e.x,dy=player.y-e.y;
    let d=Math.hypot(dx,dy)||1;
    if(e.stun>0)e.stun--;
    else{
     let speed=e.boss?1.4:1.4+wave*.07;
     e.vx+=dx/d*speed*.09;
     e.vy+=dy/d*speed*.09;
    }
    e.x+=e.vx;e.y+=e.vy;
    e.vx*=.94;e.vy*=.94;
    e.x=Math.max(120,Math.min(680,e.x));
    e.y=Math.max(90,Math.min(420,e.y));

    if(d<34&&e.attack<=0&&player.inv<=0){
     player.hp--;player.inv=75;e.attack=60;
     burst(player.x,player.y,"💫");
     message("😵 Ein Gegner hat dich erwischt!");
     update();
    }
    if(e.attack>0)e.attack--;
   });

   shots.forEach(s=>{
    s.x+=s.vx;s.y+=s.vy;
    enemies.forEach(e=>{
     if(s.gone)return;
     if(Math.hypot(s.x-e.x,s.y-e.y)<e.r+12){
      e.hp--;e.stun=18;s.gone=true;
      burst(s.x,s.y,"✨");
      if(e.hp<=0){
       e.dead=true;score+=e.boss?1000:100;
       burst(e.x,e.y,"🍟");
      }
     }
    });
    if(s.x<0||s.x>800||s.y<0||s.y>500)s.gone=true;
   });
   shots=shots.filter(s=>!s.gone);
   enemies=enemies.filter(e=>!e.dead);

   if(crate&&Math.hypot(player.x-crate.x,player.y-crate.y)<30){
    player.hp=Math.min(7,player.hp+1);score+=50;crate=null;
    burst(player.x,player.y,"❤️");message("❤️ Extra-Leben!");
   }
   if(!crate&&Math.random()<.003)crate={x:rand(150,650),y:rand(110,390)};

   if(enemies.length===0){
    score+=wave*50;breakTime=150;
    message("🏆 Welle geschafft! Nächste Welle!");
    update();
   }
   if(player.hp<=0)ended=true;
  }
  particles.forEach(a=>{
   a.x+=a.vx;a.y+=a.vy;a.vy+=.05;a.life--;
  });
  particles=particles.filter(a=>a.life>0);
  if(frame%10===0)update();
 }
 draw();
}

canvas.addEventListener("pointerdown",e=>{
 let r=canvas.getBoundingClientRect();
 aim={x:(e.clientX-r.left)*800/r.width,y:(e.clientY-r.top)*500/r.height};
});
document.addEventListener("keydown",e=>{
 let k=e.key.toLowerCase();
 if(k==="w"||e.key==="ArrowUp")move.up=true;
 if(k==="s"||e.key==="ArrowDown")move.down=true;
 if(k==="a"||e.key==="ArrowLeft")move.left=true;
 if(k==="d"||e.key==="ArrowRight")move.right=true;
 if(e.code==="Space"){e.preventDefault();fire()}
});
document.addEventListener("keyup",e=>{
 let k=e.key.toLowerCase();
 if(k==="w"||e.key==="ArrowUp")move.up=false;
 if(k==="s"||e.key==="ArrowDown")move.down=false;
 if(k==="a"||e.key==="ArrowLeft")move.left=false;
 if(k==="d"||e.key==="ArrowRight")move.right=false;
});
restart();
tick();
</script>
</body>
</html>

9,090 chars · codepastes.com