unbenannt

Pasted Nov 21, 2026, 11:07 AM1 file319 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/zzgs04xpfe812jdj
unbenannt
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neon Harbor – Open World</title>
<style>
  * { box-sizing: border-box; }
  body { margin: 0; overflow: hidden; background: #111; font-family: Arial, sans-serif; color: white; }
  canvas { display: block; }
  #hud {
    position: fixed; top: 12px; left: 12px; z-index: 2;
    background: #0009; padding: 12px 16px; border-radius: 8px;
    line-height: 1.6; min-width: 210px; pointer-events: none;
  }
  #help {
    position: fixed; bottom: 12px; left: 12px; z-index: 2;
    background: #0009; padding: 10px 14px; border-radius: 8px;
    font-size: 13px; line-height: 1.5; pointer-events: none;
  }
  #message {
    position: fixed; top: 18%; left: 50%; transform: translateX(-50%);
    z-index: 3; background: #000b; padding: 12px 20px; border-radius: 8px;
    display: none; font-size: 18px; text-align: center;
  }
  #crosshair {
    position: fixed; left: 50%; top: 50%; z-index: 2; pointer-events: none;
    transform: translate(-50%,-50%); font-size: 22px; color: white;
    text-shadow: 0 0 5px black;
  }
</style>
</head>
<body>
<div id="hud"></div>
<div id="help">
  WASD / Pfeile: bewegen & fahren · Maus: umsehen · E: Auto ein/aussteigen<br>
  Linksklick: schießen · Rechtsklick halten: zielen · 1–4: Auto auswählen<br>
  Tesla: Shift steigen · Backspace sinken · B: Bank ausrauben
</div>
<div id="message"></div>
<div id="crosshair">+</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script>
(() => {
  const scene = new THREE.Scene();
  scene.background = new THREE.Color(0x87bde8);
  scene.fog = new THREE.Fog(0x87bde8, 150, 650);

  const camera = new THREE.PerspectiveCamera(70, innerWidth / innerHeight, 0.1, 1000);
  const renderer = new THREE.WebGLRenderer({ antialias: true });
  renderer.setSize(innerWidth, innerHeight);
  renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
  renderer.toneMapping = THREE.ACESFilmicToneMapping;
  renderer.toneMappingExposure = 1.15;
  document.body.appendChild(renderer.domElement);

  scene.add(new THREE.HemisphereLight(0xc9e5ff, 0x536247, 1.5));
  const sun = new THREE.DirectionalLight(0xffffff, 2.2);
  sun.position.set(-100, 180, 80);
  scene.add(sun);

  const mat = (color, roughness=0.85) =>
    new THREE.MeshStandardMaterial({ color, roughness });
  const groundMat = mat(0x4d754c);
  const roadMat = mat(0x30343a);
  const lineMat = mat(0xf4df78);
  const buildingMats = [0x777d86, 0xc1a98d, 0x668596, 0x9b7373, 0x77718f].map(c => mat(c));

  const ground = new THREE.Mesh(new THREE.PlaneGeometry(1000,1000), groundMat);
  ground.rotation.x = -Math.PI/2;
  ground.position.y = -0.12;
  scene.add(ground);

  const colliders = [];
  const targets = [];
  const cars = [];
  const keys = {};
  let money = 5000, health = 100, wanted = 0;
  let activeCar = null, inCar = false, aiming = false;
  let yaw = 0, pitch = 0.12, speed = 0, fireCooldown = 0;
  let messageTimer = 0;
  const player = new THREE.Group();
  scene.add(player);

  // Einfacher Körper aus kompatiblen Kugel- und Zylinderformen.
  const body = new THREE.Mesh(new THREE.CylinderGeometry(0.28,0.34,1.05,10), mat(0x2686db));
  body.position.y = 0.82; player.add(body);
  const head = new THREE.Mesh(new THREE.SphereGeometry(0.25,12,10), mat(0xf1c59b));
  head.position.y = 1.5; player.add(head);
  const legs = [];
  for (const x of [-0.15,0.15]) {
    const leg = new THREE.Mesh(new THREE.CylinderGeometry(0.09,0.11,0.62,8), mat(0x222b3b));
    leg.position.set(x,0.31,0); player.add(leg); legs.push(leg);
  }
  player.position.set(0,0,0);

  function box(w,h,d,material,x,y,z) {
    const o = new THREE.Mesh(new THREE.BoxGeometry(w,h,d), material);
    o.position.set(x,y,z); scene.add(o); return o;
  }
  function addCollider(x,z,w,d) { colliders.push({x,z,w,d}); }

  // Straßen in einem großen, begehbaren Raster.
  for (let i=-4;i<=4;i++) {
    const p=i*90;
    box(18,0.05,900,roadMat,p,0,0);
    box(900,0.05,18,roadMat,0,0,p);
    for (let q=-420;q<=420;q+=24) {
      box(0.35,0.07,9,lineMat,p,0.04,q);
      box(9,0.07,0.35,lineMat,q,0.04,p);
    }
  }

  // Stadtgebäude und Bäume.
  for (let x=-390;x<=390;x+=30) {
    for (let z=-390;z<=390;z+=30) {
      if (Math.abs(x%90)<22 || Math.abs(z%90)<22) continue;
      if (Math.random()<0.22) {
        const trunk = new THREE.Mesh(new THREE.CylinderGeometry(0.35,0.5,3,8),mat(0x62452a));
        trunk.position.set(x,1.5,z); scene.add(trunk);
        const crown = new THREE.Mesh(new THREE.SphereGeometry(2.1,10,8),mat(0x27743d));
        crown.position.set(x,4,z); scene.add(crown);
        addCollider(x,z,2.2,2.2);
      } else {
        const w=10+Math.random()*10, d=10+Math.random()*10, h=12+Math.random()*45;
        const b=box(w,h,d,buildingMats[Math.floor(Math.random()*buildingMats.length)],x,h/2,z);
        addCollider(x,z,w+1,d+1);
        // Fensterstreifen
        for (let y=5;y<h-2;y+=6) {
          const win=mat(0x9bdcff,0.35);
          box(w*0.72,0.7,0.12,win,x,y,z+d/2+0.08);
          box(0.12,0.7,d*0.72,win,x+w/2+0.08,y,z);
        }
      }
    }
  }

  // Missionsziele zum Abschießen.
  for(let i=0;i<5;i++){
    const target=new THREE.Mesh(new THREE.SphereGeometry(1.25,16,12),mat(0xff2525,0.35));
    target.position.set(-65+i*32,4,-105);
    scene.add(target); targets.push(target);
  }
  let hits=0;

  function makeCar(name,color,x,z,fly=false) {
    const g=new THREE.Group();
    const paint=mat(color,0.35), dark=mat(0x16191d,0.5), glass=mat(0x8fd5e8,0.25);
    const base=new THREE.Mesh(new THREE.BoxGeometry(2.1,0.7,4),paint);
    base.position.y=0.75; g.add(base);
    const cabin=new THREE.Mesh(new THREE.BoxGeometry(1.55,0.75,1.9),glass);
    cabin.position.set(0,1.35,-0.15); g.add(cabin);
    const roof=new THREE.Mesh(new THREE.BoxGeometry(1.6,0.15,1.95),paint);
    roof.position.set(0,1.77,-0.15); g.add(roof);
    for(const wx of [-1,1]) for(const wz of [-1.25,1.25]){
      const wheel=new THREE.Mesh(new THREE.CylinderGeometry(0.38,0.38,0.22,12),dark);
      wheel.rotation.z=Math.PI/2; wheel.position.set(wx,0.4,wz); g.add(wheel);
    }
    g.position.set(x,0,z); scene.add(g);
    const car={name,group:g,fly,speed:0,yaw:0,owned:true};
    cars.push(car); return car;
  }
  makeCar("Sportwagen",0xe33c37,8,0);
  makeCar("Geländewagen",0xe3b82f,14,0);
  makeCar("Klassiker",0x37a568,20,0);
  const tesla=makeCar("Tesla",0x252a35,26,0,true);

  // Bank und Interaktionsmarker
  const bank=box(16,10,12,mat(0x927c60),0,5,-135);
  box(5,1,0.3,mat(0xffd84b),0,7,-128.8);
  const marker=new THREE.Mesh(new THREE.CylinderGeometry(2,2,0.15,24),mat(0xffd400,0.5));
  marker.position.set(0,0.1,-119); scene.add(marker);

  function showMessage(text) {
    const el=document.getElementById("message");
    el.textContent=text; el.style.display="block"; messageTimer=2.5;
  }
  function blocked(x,z) {
    return colliders.some(c=>Math.abs(x-c.x)<c.w/2+0.8 && Math.abs(z-c.z)<c.d/2+0.8);
  }
  function setCar(car) {
    if(inCar) { showMessage("Steig zuerst mit E aus dem Auto aus."); return; }
    if(!car.owned && money<1000){showMessage("Du brauchst $1000 für dieses Auto.");return;}
    if(!car.owned){money-=1000;car.owned=true;}
    activeCar=car; car.group.position.set(player.position.x+4,0,player.position.z);
    showMessage(car.name+" ausgewählt – drücke E zum Einsteigen.");
  }
  function enterExit() {
    if(inCar){inCar=false;player.visible=true;player.position.set(activeCar.group.position.x+2,0,activeCar.group.position.z);activeCar=null;speed=0;return;}
    let nearest=null,dist=5;
    for(const c of cars){const d=c.group.position.distanceTo(player.position);if(d<dist){nearest=c;dist=d;}}
    if(nearest){activeCar=nearest;inCar=true;player.visible=false;showMessage("E zum Aussteigen.");}
    else if(Math.hypot(player.position.x,player.position.z+119)<5){showMessage("Bank: Drücke B für einen Überfall.");}
    else showMessage("Kein Auto in der Nähe.");
  }

  addEventListener("keydown",e=>{
    keys[e.code]=true;
    if(["Space","Backspace","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.code)) e.preventDefault();
    if(e.repeat)return;
    if(e.code==="KeyE")enterExit();
    if(e.code==="Digit1")setCar(cars[0]);
    if(e.code==="Digit2")setCar(cars[1]);
    if(e.code==="Digit3")setCar(cars[2]);
    if(e.code==="Digit4")setCar(cars[3]);
    if(e.code==="KeyB"){
      if(Math.hypot(player.position.x,player.position.z+119)<12 || (inCar && Math.hypot(activeCar.group.position.x,activeCar.group.position.z+119)<12)){
        money+=2500;wanted=Math.min(6,wanted+2);showMessage("Bank ausgeraubt! +$2500 · Fahndung: "+wanted+" Sterne");
      } else showMessage("Fahre oder gehe zur Bank.");
    }
  });
  addEventListener("keyup",e=>keys[e.code]=false);
  renderer.domElement.addEventListener("click",()=>{if(document.pointerLockElement!==renderer.domElement)renderer.domElement.requestPointerLock();});
  document.addEventListener("mousemove",e=>{
    if(document.pointerLockElement===renderer.domElement){yaw-=e.movementX*0.0025;pitch=Math.max(-0.6,Math.min(0.8,pitch-e.movementY*0.002));}
  });
  document.addEventListener("mousedown",e=>{
    if(e.button===2){aiming=true;e.preventDefault();}
    if(e.button===0)shoot();
  });
  document.addEventListener("mouseup",e=>{if(e.button===2)aiming=false;});
  document.addEventListener("contextmenu",e=>e.preventDefault());

  const raycaster=new THREE.Raycaster();
  function shoot(){
    if(inCar || fireCooldown>0)return;
    fireCooldown=0.22;
    const origin=player.position.clone().add(new THREE.Vector3(0,1.35,0));
    const dir=new THREE.Vector3(Math.sin(yaw),0,-Math.cos(yaw));
    raycaster.set(origin,dir);raycaster.far=100;
    const hit=raycaster.intersectObjects(targets);
    if(hit.length){
      scene.remove(hit[0].object);targets.splice(targets.indexOf(hit[0].object),1);
      hits++;money+=100;
      showMessage("Ziel getroffen! +$100 · "+hits+"/5");
      if(hits===5)showMessage("Mission abgeschlossen! Alle 5 Ziele getroffen.");
    }
  }

  const clock=new THREE.Clock();
  function animate(){
    requestAnimationFrame(animate);
    const dt=Math.min(clock.getDelta(),0.04);
    fireCooldown=Math.max(0,fireCooldown-dt);
    if(messageTimer>0){messageTimer-=dt;if(messageTimer<=0)document.getElementById("message").style.display="none";}
    camera.fov=aiming?48:70;camera.updateProjectionMatrix();

    const forward=(keys.KeyW||keys.ArrowUp)?1:0;
    const back=(keys.KeyS||keys.ArrowDown)?1:0;
    const left=keys.KeyA||keys.ArrowLeft, right=keys.KeyD||keys.ArrowRight;

    if(inCar && activeCar){
      const car=activeCar;
      const accel=car.fly?48:34; // game speed units; HUD shows km/h
      if(forward)car.speed=Math.min(car.speed+accel*dt, car.fly?160:150);
      if(back)car.speed=Math.max(car.speed-accel*dt,-45);
      if(!forward&&!back)car.speed*=Math.pow(0.97,dt*60);
      const steer=(right?1:0)-(left?1:0);
      car.yaw+=steer*dt*(0.8+Math.abs(car.speed)*0.012)*(car.speed<0?-1:1);
      car.group.rotation.y=car.yaw;
      const nx=car.group.position.x+Math.sin(car.yaw)*car.speed*dt*0.12;
      const nz=car.group.position.z-Math.cos(car.yaw)*car.speed*dt*0.12;
      if(car.fly){
        if(keys.ShiftLeft||keys.ShiftRight)car.group.position.y=Math.min(85,car.group.position.y+22*dt);
        if(keys.Backspace)car.group.position.y=Math.max(0,car.group.position.y-22*dt);
        car.group.position.x=nx;car.group.position.z=nz;
      } else if(!blocked(nx,nz)){
        car.group.position.x=nx;car.group.position.z=nz;
      } else car.speed=0;
      player.position.copy(car.group.position);
      player.position.y=0;
      speed=car.speed;
    } else {
      const dir=new THREE.Vector3(Math.sin(yaw),0,-Math.cos(yaw));
      const side=new THREE.Vector3(Math.cos(yaw),0,Math.sin(yaw));
      let move=new THREE.Vector3();
      if(forward)move.add(dir);if(back)move.sub(dir);
      if(right)move.add(side);if(left)move.sub(side);
      if(move.lengthSq()>0){
        move.normalize().multiplyScalar(12*dt);
        const nx=player.position.x+move.x,nz=player.position.z+move.z;
        if(!blocked(nx,player.position.z))player.position.x=nx;
        if(!blocked(player.position.x,nz))player.position.z=nz;
        player.rotation.y=yaw;
        legs.forEach((l,i)=>l.rotation.x=Math.sin(performance.now()*0.012+i*Math.PI)*0.5);
      }else legs.forEach(l=>l.rotation.x*=0.8);
    }

    // Kamera folgt Spieler oder Auto
    const focus=inCar&&activeCar?activeCar.group.position:player.position;
    const distance=aiming?5:9;
    const camPos=new THREE.Vector3(
      focus.x-Math.sin(yaw)*distance,
      focus.y+(inCar?3.2:3.4)+pitch*4,
      focus.z+Math.cos(yaw)*distance
    );
    camera.position.lerp(camPos,0.15);
    camera.lookAt(focus.x,focus.y+(inCar?1.5:1.2),focus.z);

    document.getElementById("hud").innerHTML=
      "💵 Geld: $"+money+"<br>❤️ Gesundheit: "+health+"<br>"+
      "🚘 "+(inCar&&activeCar?activeCar.name:"Zu Fuß")+" · "+Math.round(Math.abs(speed)*1.2)+" km/h<br>"+
      "⭐ Fahndung: "+"★".repeat(wanted)+"☆".repeat(6-wanted)+"<br>"+
      "🎯 Signalziele: "+hits+"/5";

    marker.rotation.y+=dt;
    renderer.render(scene,camera);
  }
  animate();

  addEventListener("resize",()=>{
    camera.aspect=innerWidth/innerHeight;camera.updateProjectionMatrix();
    renderer.setSize(innerWidth,innerHeight);
  });
})();
</script>
</body>
</html>

13,455 chars · codepastes.com