/** * ============================================================================================== * Modul: DTIM-ZEC MICRO-COSMOS STARSHIP (OPEN-WORLD QUANTUM, ISOTOPE & DOCKING SANDBOX) * Datei: TLW_Atom_simulator_2.pde * Framework: DTIM-ZEC MODULAR PHYSICS FRAMEWORK (DAMTP ACADEMIC STANDARD) * Architektur: Bühring-Metrik Ring-Starship + Bohr-Slater + Bethe-Weizsäcker + Docking-Stationen * Copyright: (c) 2026 Jan Bühring & Adaptive Intelligence Synthesis Network (Google AI) * Lizenz: MIT License (Quellcode) / CC0 1.0 Universal (Offene Daten & Modelle) * Plattform: Processing 4.5.6 (Linux x64) & Processing.js (processing.min.js) * Steuerung: [Maus bewegen] Kurs & Auto-Aim | [Linksklick / Leertaste] Boson abfeuern * [W/A/S/D oder Pfeile] Schub & Drehung | [1-4] Waffe (Photon/Gluon/W-Boson/Elektron) * [F] An Station angedocktes Isotop umwandeln | [E] Auto-Aim | [H] Sehhilfe * ============================================================================================== */ // ============================================================================================== // MODUL 1: SYSTEMKONSTANTEN & OPEN-WORLD ZUSTAND (100% PROCESSING.JS-KOMPATIBEL) // ============================================================================================== float WORLD_SIZE = 3200.0; float HALF_WORLD = 1600.0; // Starship Zustand in Weltkoordinaten float shipX = 0.0; float shipY = 0.0; float shipVX = 0.0; float shipVY = 0.0; float shipAngle = 0.0; float camX = 0.0; float camY = 0.0; // Gameplay, Energie & Isotopen-Frachtraum int ladung = 15; // 0 .. 100 % Akkumulator int score = 0; int schild = 100; // 0 .. 100 % Hüllenintegrität int isotopeCores = 1; // Gesammelte stabilisierte Isotope zur Umwandlung an Stationen float simTime = 0.0; boolean gameOver = false; boolean missionWon = false; // Andock-Stationen (Koordinaten & Status) float reactorX = 640.0; // Station 1: DTIM-ZEC Fusions-Reaktor (Sektor II NO) float reactorY = -580.0; float vaultX = -640.0; // Station 2: Quanten-Speicher (Sektor III SW) float vaultY = 580.0; float dockRadius = 96.0; int dockedStation = 0; // 0 = frei im Raum, 1 = Fusions-Reaktor, 2 = Quanten-Speicher float shieldRegenAccum = 0.0; // Waffen- & Auto-Aim-System int activeWeapon = 1; // 1: Photon, 2: Gluon, 3: W-Boson, 4: Elektron boolean autoAim = true; float aimAngle = 0.0; float currentShotEv = 10.20; MicroAtom lockedTarget = null; String targetInfoText = "Kein Ziel im Sensorradius"; // Schockwelle (Raumzeit-Verzerrung beim Quanten-Kollaps) float shockX = 0.0; float shockY = 0.0; float shockRadius = 0.0; float shockIntensity = 0.0; // Entitäten-Listen (untypisiert für 100% Processing.js-Kompatibilität) ArrayList worldQuanta; ArrayList worldRifts; ArrayList worldAtoms; ArrayList worldShots; ArrayList worldRings; // Steuerung & UI-Modi boolean keyUp = false; boolean keyDown = false; boolean keyLeft = false; boolean keyRight = false; boolean mouseSteer = true; int a11yTheme = 0; // 0: DTIM Standard (Schwarz/Blutrot/Nachtblau), 1: Farbenblind, 2: Max-Kontrast boolean briefingOpen = true; String sectorName = "SEKTOR I: WASSERSTOFF-NEBEL (QUANTENSPRÜNGE)"; String logHeadline = "Bordcomputer bereit: Ziele auf Atome und feuere Bosonen ab!"; String logSubtext = "1 Start-Isotop an Bord: Fliege zum Fusions-Reaktor (NO) oder Quanten-Speicher (SW)!"; int logFlashTimer = 0; // ============================================================================================== // MODUL 2: FARB-PALETTEN & PHYSIKALISCHE FORMELN (BOHR-SLATER & BETHE-WEIZSÄCKER) // ============================================================================================== int getUiPalette(int theme, int role) { if (theme == 1) { // Farbenblind-Optimiert (Blau / Gold-Amber) if (role == 0) return color(5, 9, 17); if (role == 1) return color(11, 17, 29); if (role == 2) return color(180, 120, 10); if (role == 3) return color(10, 75, 130); if (role == 4) return color(251, 191, 36); return color(255, 255, 255); } if (theme == 2) { // Maximal-Kontrast if (role == 0) return color(0, 0, 0); if (role == 1) return color(0, 0, 0); if (role == 2) return color(0, 0, 0); if (role == 3) return color(0, 0, 0); if (role == 4) return color(255, 255, 0); return color(255, 255, 255); } // Standard: Tiefschwarz, Dunkles Blutrot, Dunkles Nachtblau, Helles Silbergrau if (role == 0) return color(6, 8, 14); if (role == 1) return color(12, 15, 24); if (role == 2) return color(122, 16, 38); if (role == 3) return color(18, 46, 98); if (role == 4) return color(225, 55, 85); return color(242, 246, 255); } int getEntityColor(int theme, int kind) { // 1: Proton, 2: Neutron, 3: Elektron, 4: Photon, 5: Gluon, 6: W-Boson, 7: Quantum(Grün), 8: Rift(Rot) if (theme == 1) { if (kind == 1) return color(230, 159, 0); if (kind == 2) return color(195, 210, 230); if (kind == 3) return color(56, 189, 248); if (kind == 4) return color(253, 224, 71); if (kind == 5) return color(45, 212, 191); if (kind == 6) return color(244, 114, 182); if (kind == 7) return color(52, 211, 153); return color(245, 158, 11); } if (theme == 2) { if (kind == 8) return color(255, 0, 255); if (kind == 7) return color(0, 255, 255); return color(255, 255, 0); } if (kind == 1) return color(220, 42, 74); // Proton: Blutrot if (kind == 2) return color(185, 198, 220); // Neutron: Silbergrau if (kind == 3) return color(65, 145, 255); // Elektron: Blau if (kind == 4) return color(255, 215, 55); // Photon: Goldgelb if (kind == 5) return color(35, 215, 155); // Gluon: Smaragd if (kind == 6) return color(205, 85, 235); // W-Boson: Violett if (kind == 7) return color(0, 255, 180); // Vakuum-Quantum: Grün return color(255, 45, 65); // Singularitäts-Riss: Warnrot } float calcShellEnergyEv(int Z, int electrons, int n) { if (Z <= 0) return -1.5; float zEff = 1.0; if (electrons <= 2) zEff = max(1.0, float(Z) - 0.30 * float(electrons - 1)); else zEff = max(1.15, float(Z) - 0.85 * float(electrons - 1)); return -13.6 * (zEff * zEff) / float(n * n); } float calcBetheWeizsaecker(int Z, int N) { int A = Z + N; if (A <= 1 || Z <= 0) return 0.0; float av = 15.8; float as = 18.3; float ac = 0.714; float aa = 23.2; float ap = 12.0; float Evol = av * A; float Esurf = as * pow(float(A), 2.0 / 3.0); float Ecoul = ac * Z * (Z - 1) / pow(float(A), 1.0 / 3.0); float Esym = aa * pow(float(A - 2 * Z), 2.0) / float(A); float Epair = 0.0; if (A % 2 == 0) { if (Z % 2 == 0 && N % 2 == 0) Epair = ap / sqrt(float(A)); else Epair = -ap / sqrt(float(A)); } return max(0.0, Evol - Esurf - Ecoul - Esym + Epair); } String getElementName(int Z) { if (Z == 0) return "Neutron"; if (Z == 1) return "Wasserstoff (H)"; if (Z == 2) return "Helium (He)"; if (Z == 3) return "Lithium (Li)"; if (Z == 4) return "Beryllium (Be)"; if (Z == 5) return "Bor (B)"; if (Z == 6) return "Kohlenstoff (C-12)"; return "Kern Z=" + Z; } void pushPhysicsLog(String head, String sub) { logHeadline = head; logSubtext = sub; logFlashTimer = 95; } // ============================================================================================== // MODUL 3: INITIALISIERUNG & OPEN-WORLD SEEDING // ============================================================================================== void setup() { size(960, 660); noSmooth(); frameRate(60); worldQuanta = new ArrayList(); worldRifts = new ArrayList(); worldAtoms = new ArrayList(); worldShots = new ArrayList(); worldRings = new ArrayList(); resetMicroCosmos(); } void resetMicroCosmos() { shipX = 0.0; shipY = 0.0; shipVX = 0.0; shipVY = 0.0; shipAngle = 0.0; camX = 0.0; camY = 0.0; ladung = 15; score = 0; schild = 100; isotopeCores = 1; dockedStation = 0; shieldRegenAccum = 0.0; gameOver = false; missionWon = false; worldQuanta.clear(); worldRifts.clear(); worldAtoms.clear(); worldShots.clear(); worldRings.clear(); // 1. Grüne Vakuum-Quanten im gesamten Mikrokosmos verteilen for (int i = 0; i < 36; i++) { float qx = random(-HALF_WORLD + 120, HALF_WORLD - 120); float qy = random(-HALF_WORLD + 120, HALF_WORLD - 120); worldQuanta.add(new VacuumQuantum(qx, qy)); } // 2. Rote Singularitäts-Risse (Anomalien zum Ausweichen, halten Sicherheitsabstand zu Stationen) for (int i = 0; i < 22; i++) { float rx = random(-HALF_WORLD + 160, HALF_WORLD - 160); float ry = random(-HALF_WORLD + 160, HALF_WORLD - 160); if (dist(0, 0, rx, ry) > 260.0 && dist(reactorX, reactorY, rx, ry) > 220.0 && dist(vaultX, vaultY, rx, ry) > 220.0) { worldRifts.add(new SingularityRift(rx, ry)); } } // 3. Open-World Atome & Kerne in den 4 Sektoren ansiedeln worldAtoms.add(new MicroAtom(250, -40, 1, 0, 1, false)); worldAtoms.add(new MicroAtom(330, 110, 1, 0, 0, false)); for (int i = 0; i < 26; i++) { float ax = random(-HALF_WORLD + 180, HALF_WORLD - 180); float ay = random(-HALF_WORLD + 180, HALF_WORLD - 180); if (dist(0, 0, ax, ay) < 220.0) continue; if (dist(reactorX, reactorY, ax, ay) < 170.0) continue; if (dist(vaultX, vaultY, ax, ay) < 170.0) continue; if (ax < 0 && ay < 0) { // Sektor NW: Wasserstoff- & Ionen-Wolke int eCount = (i % 2 == 0) ? 1 : 0; worldAtoms.add(new MicroAtom(ax, ay, 1, 0, eCount, false)); } else if (ax >= 0 && ay < 0) { // Sektor NO: Fusions-Schmiede (nahe Fusions-Reaktor) if (i % 2 == 0) worldAtoms.add(new MicroAtom(ax, ay, 1, 0, 0, false)); else worldAtoms.add(new MicroAtom(ax, ay, 0, 1, 0, false)); } else if (ax < 0 && ay >= 0) { // Sektor SW: Instabile Isotope (nahe Quanten-Speicher -> mit W-Boson [3] ernten!) worldAtoms.add(new MicroAtom(ax, ay, 3, 1, 2, true)); } else { // Sektor SO: Kohlenstoff C-12 & Helium-4 Cluster if (i % 3 == 0) worldAtoms.add(new MicroAtom(ax, ay, 6, 6, 6, false)); else worldAtoms.add(new MicroAtom(ax, ay, 2, 2, 2, false)); } } pushPhysicsLog("Systeme online: Bühring-Metrik-Ring aktiv (1 Isotop an Bord)", "Sammle Isotope per Fusion [2] / W-Boson [3] & docke an Reaktor (NO) oder Speicher (SW)!"); } // ============================================================================================== // MODUL 4: HAUPTSCHLEIFE & TOPOLOGISCHES HEXAGON-GITTER MIT SCHOCKWELLE // ============================================================================================== void draw() { background(getUiPalette(a11yTheme, 0)); float shipScale = 1.0 + (ladung / 100.0) * 0.25; float rootFactor = 1.0 + sqrt(float(ladung)) * 0.14; if (!briefingOpen && !gameOver && !missionWon) { simTime += 0.02; updateStarshipMotion(rootFactor); updateDockingStations(); updateSectorTelemetry(); if (shockIntensity > 0.0) { shockRadius += 12.0; shockIntensity -= 5.5; } updateAutoAimSensor(); updateWorldEntities(shipScale); } camX = lerp(camX, shipX, 0.12); camY = lerp(camY, shipY, 0.12); // Welt-Ansicht zeichnen pushMatrix(); translate(width * 0.5 - camX, (height - 135) * 0.5 - camY); drawSpacetimeHexGrid(); drawSectorBoundaries(); drawDockingStations(); drawShockwaves(); drawWorldEntities(); drawAutoAimLaser(); // Starship mit Matrix-Rotation & Wurzel-Skalierung rendern pushMatrix(); translate(shipX, shipY); rotate(shipAngle); scale(shipScale); drawStarship(0, 0); popMatrix(); popMatrix(); // Richtungs-Kompass zu den beiden Andock-Stationen am Bildschirmrand drawStationWaypoints(); // HUD, Radar & Bordcomputer-Texte zeichnen drawPilotHUD(rootFactor); if (gameOver) { drawEndOverlay("HÜLLENKOLLAPS IM VAKUUM", "Zu viele Singularitäts-Risse getroffen. Klicke auf NEUSTART."); } else if (missionWon) { drawEndOverlay("MISSION ERFOLGREICH (100% LADUNG)", "Dein Starship ist vollständig mit topologischer Vakuum-Energie geladen!"); } else if (briefingOpen) { drawBriefingModal(); } } void drawSpacetimeHexGrid() { int step = 44; int startX = floor((camX - width * 0.6) / step) * step; int endX = ceil((camX + width * 0.6) / step) * step; int startY = floor((camY - height * 0.6) / step) * step; int endY = ceil((camY + height * 0.6) / step) * step; for (int gx = startX; gx <= endX; gx += step) { for (int gy = startY; gy <= endY; gy += step) { float dx = shipX - gx; float dy = shipY - gy; float d = sqrt(dx * dx + dy * dy); if (d < 0.1) d = 0.1; float compression = (d < 190.0) ? map(d, 0, 190, 20.0 * (ladung / 100.0), 0.0) : 0.0; float sDx = gx - shockX; float sDy = gy - shockY; float sDist = sqrt(sDx * sDx + sDy * sDy); float shockShift = 0.0; if (shockIntensity > 0.0 && abs(sDist - shockRadius) < 45.0) { shockShift = map(abs(sDist - shockRadius), 0, 45, 22.0 * (shockIntensity / 255.0), 0.0); } float denom = (sDist < 0.1) ? 1.0 : sDist; float px = gx + (dx / d) * compression + (sDx / denom) * shockShift; float py = gy + (dy / d) * compression + (sDy / denom) * shockShift; float glow = (shockIntensity > 0.0 && abs(sDist - shockRadius) < 55.0) ? map(abs(sDist - shockRadius), 0, 55, shockIntensity, 0.0) : 0.0; if (a11yTheme == 2) { stroke(70 + glow * 0.6); } else if (a11yTheme == 1) { stroke(30 + glow * 0.5, 110 + glow * 0.4, 210, map(d, 0, 460, 46, 12)); } else { stroke(45 + glow * 0.6, 85 + glow * 0.3, 195, map(d, 0, 460, 48, 12)); } strokeWeight(glow > 18.0 ? 1.5 : 1.0); noFill(); beginShape(); for (int i = 0; i < 6; i++) { float a = (PI / 3.0) * i + simTime * 0.02; vertex(px + cos(a) * 22.0, py + sin(a) * 22.0); } endShape(CLOSE); } } strokeWeight(1.0); } void drawSectorBoundaries() { stroke(a11yTheme == 2 ? color(255) : color(179, 25, 56, 130)); strokeWeight(2.0); noFill(); rect(-HALF_WORLD, -HALF_WORLD, WORLD_SIZE, WORLD_SIZE); stroke(59, 110, 194, 65); line(-HALF_WORLD, 0, HALF_WORLD, 0); line(0, -HALF_WORLD, 0, HALF_WORLD); strokeWeight(1.0); } // ============================================================================================== // MODUL 5: ANDOCK-STATIONEN (FUSIONS-REAKTOR & QUANTEN-SPEICHER) // ============================================================================================== void updateDockingStations() { int prevDock = dockedStation; float dReactor = dist(shipX, shipY, reactorX, reactorY); float dVault = dist(shipX, shipY, vaultX, vaultY); if (dReactor <= dockRadius) { dockedStation = 1; if (prevDock != 1) { pushPhysicsLog("ANGEDOCKT: DTIM-ZEC Fusions-Reaktor (Schild-Regeneration aktiv)", "Drücke [F] oder klicke auf 'ISOTOP FUSIONIEREN', um Isotope in +25% Energie zu wandeln!"); } // Kontinuierliche Schildaufladung im Magnetfeld if (schild < 100) { shieldRegenAccum += 0.28; if (shieldRegenAccum >= 1.0) { int addS = int(shieldRegenAccum); schild = min(100, schild + addS); shieldRegenAccum -= float(addS); } } } else if (dVault <= dockRadius) { dockedStation = 2; if (prevDock != 2) { pushPhysicsLog("ANGEDOCKT: Quanten-Speicher & Vakuum-Kondensator (Schnell-Schild aktiv)", "Drücke [F] oder klicke auf 'QUANTEN-SYNTHESE', um Isotope in 3 Vakuum-Quanten +15% zu wandeln!"); } // Schnellere Schildaufladung am Quanten-Speicher if (schild < 100) { shieldRegenAccum += 0.45; if (shieldRegenAccum >= 1.0) { int addS = int(shieldRegenAccum); schild = min(100, schild + addS); shieldRegenAccum -= float(addS); } } } else { dockedStation = 0; } } void convertIsotopeAtStation() { if (dockedStation == 0) return; if (isotopeCores <= 0) { pushPhysicsLog("Keine Isotope im Frachtraum!", "Stabilisiere instabile Kerne mit W-Boson [3] oder fusioniere Kerne mit Gluon [2]!"); return; } isotopeCores--; if (dockedStation == 1) { // STATION 1: FUSIONS-REAKTOR -> Hohe direkte Batterie-Ladung (+25%) + Bethe-Weizsäcker-Score float yieldMeV = calcBetheWeizsaecker(2, 2); ladung = constrain(ladung + 25, 0, 100); score += 300; shockX = reactorX; shockY = reactorY; shockRadius = 0.0; shockIntensity = 255.0; worldRings.add(new ShockRing(reactorX, reactorY, getEntityColor(a11yTheme, 4))); pushPhysicsLog("REAKTOR-FUSION ABGESCHLOSSEN! +" + nf(yieldMeV, 1, 2) + " MeV -> +25% Batterie (+300 Pkt)", "Verbleibende Isotope an Bord: " + isotopeCores); if (ladung >= 100) missionWon = true; } else if (dockedStation == 2) { // STATION 2: QUANTEN-SPEICHER -> +15% Batterie + 3 neue Vakuum-Quanten + Riss-Abwehrwelle ladung = constrain(ladung + 15, 0, 100); score += 220; shockX = vaultX; shockY = vaultY; shockRadius = 0.0; shockIntensity = 255.0; worldRings.add(new ShockRing(vaultX, vaultY, getEntityColor(a11yTheme, 7))); for (int k = 0; k < 3; k++) { float ang = simTime + k * (TWO_PI / 3.0); worldQuanta.add(new VacuumQuantum(vaultX + cos(ang) * 135.0, vaultY + sin(ang) * 135.0)); } pushPhysicsLog("QUANTEN-SYNTHESE AKTIV! +15% Batterie & 3 Vakuum-Quanten synthetisiert!", "Verbleibende Isotope an Bord: " + isotopeCores); if (ladung >= 100) missionWon = true; } } void drawDockingStations() { int bloodAccent = getUiPalette(a11yTheme, 4); int blueAccent = getEntityColor(a11yTheme, 3); int goldCol = getEntityColor(a11yTheme, 4); int quantCol = getEntityColor(a11yTheme, 7); // ------------------------------------------------------------------ // STATION 1: DTIM-ZEC FUSIONS-REAKTOR (Sektor II NO: 640, -580) // ------------------------------------------------------------------ pushMatrix(); translate(reactorX, reactorY); // Äußere Andock-Zone noFill(); stroke(dockedStation == 1 ? goldCol : bloodAccent); strokeWeight(dockedStation == 1 ? 2.5 : 1.5); ellipse(0, 0, dockRadius * 2.0, dockRadius * 2.0); // Rotierender Magnet-Torus (8 Segmente) pushMatrix(); rotate(simTime * 0.45); stroke(bloodAccent); strokeWeight(2.0); fill(26, 10, 16); beginShape(); for (int i = 0; i < 8; i++) { float a = (TWO_PI / 8.0) * i; vertex(cos(a) * 44.0, sin(a) * 44.0); } endShape(CLOSE); popMatrix(); // Pulsierender Fusionskern im Zentrum noStroke(); fill(goldCol); ellipse(0, 0, 22 + sin(simTime * 8.0) * 4.0, 22 + sin(simTime * 8.0) * 4.0); fill(255); ellipse(0, 0, 8, 8); fill(255); textSize(11); textAlign(CENTER, TOP); text("STATION I: FUSIONS-REAKTOR\n[Schild-Lader & +25% Energie/Isotop]", 0, dockRadius + 8); popMatrix(); // Energieleitung zum Schiff, wenn an Reaktor angedockt if (dockedStation == 1) { stroke(goldCol); strokeWeight(2.5); line(reactorX, reactorY, shipX, shipY); strokeWeight(1.0); } // ------------------------------------------------------------------ // STATION 2: QUANTEN-SPEICHER (Sektor III SW: -640, 580) // ------------------------------------------------------------------ pushMatrix(); translate(vaultX, vaultY); noFill(); stroke(dockedStation == 2 ? quantCol : blueAccent); strokeWeight(dockedStation == 2 ? 2.5 : 1.5); ellipse(0, 0, dockRadius * 2.0, dockRadius * 2.0); // Gegenläufig rotierende Kristall-Hexagone pushMatrix(); rotate(-simTime * 0.4); stroke(blueAccent); strokeWeight(2.0); fill(10, 20, 38); beginShape(); for (int i = 0; i < 6; i++) { float a = (TWO_PI / 6.0) * i; vertex(cos(a) * 46.0, sin(a) * 46.0); } endShape(CLOSE); popMatrix(); noStroke(); fill(quantCol); ellipse(0, 0, 22 + cos(simTime * 8.0) * 4.0, 22 + cos(simTime * 8.0) * 4.0); fill(255); ellipse(0, 0, 8, 8); fill(255); textSize(11); textAlign(CENTER, TOP); text("STATION II: QUANTEN-SPEICHER\n[Schnell-Schild & Quanten-Synthese]", 0, dockRadius + 8); popMatrix(); if (dockedStation == 2) { stroke(quantCol); strokeWeight(2.5); line(vaultX, vaultY, shipX, shipY); strokeWeight(1.0); } strokeWeight(1.0); } // Zeigt am Sichtfeldrand dezente Richtungs-Marker zu beiden Stationen, wenn sie außerhalb liegen void drawStationWaypoints() { drawSingleWaypoint(reactorX, reactorY, "Reaktor", getUiPalette(a11yTheme, 4)); drawSingleWaypoint(vaultX, vaultY, "Speicher", getEntityColor(a11yTheme, 7)); } void drawSingleWaypoint(float wx, float wy, String label, int col) { float viewH = height - 135; float sx = width * 0.5 + (wx - camX); float sy = viewH * 0.5 + (wy - camY); if (sx >= 24 && sx <= width - 24 && sy >= 44 && sy <= viewH - 20) { return; // Station ist bereits direkt im Bild sichtbar } float dx = wx - shipX; float dy = wy - shipY; float distUnits = sqrt(dx * dx + dy * dy); float ang = atan2(dy, dx); float cx = constrain(sx, 48, width - 48); float cy = constrain(sy, 54, viewH - 24); fill(8, 10, 18, 220); stroke(col); rect(cx - 42, cy - 14, 84, 28, 4); fill(255); textSize(10); textAlign(CENTER, CENTER); text(label + " " + int(distUnits / 10.0) + "m", cx, cy); // Kleiner Richtungspfeil an der Box stroke(col); strokeWeight(2.0); line(cx + cos(ang) * 44, cy + sin(ang) * 16, cx + cos(ang) * 52, cy + sin(ang) * 22); strokeWeight(1.0); } // ============================================================================================== // MODUL 6: STARSHIP-KINEMATIK, BÜHRING-METRIK RING-DESIGN & AUTO-AIM // ============================================================================================== void updateStarshipMotion(float rootFactor) { float maxSpeed = 4.2 * rootFactor; if (keyLeft) shipAngle -= 0.055; if (keyRight) shipAngle += 0.055; if (keyUp || keyDown) { mouseSteer = false; float thrust = keyUp ? 0.24 : -0.16; shipVX += cos(shipAngle) * thrust; shipVY += sin(shipAngle) * thrust; } else if (mouseSteer && mouseY < height - 135) { float screenShipX = width * 0.5 + (shipX - camX); float screenShipY = (height - 135) * 0.5 + (shipY - camY); float dx = mouseX - screenShipX; float dy = mouseY - screenShipY; float d = sqrt(dx * dx + dy * dy); if (d > 18.0) { float desiredAng = atan2(dy, dx); float diff = atan2(sin(desiredAng - shipAngle), cos(desiredAng - shipAngle)); shipAngle += diff * 0.12; float throttle = constrain((d - 18.0) / 140.0, 0.0, 1.0) * 0.22; shipVX += cos(shipAngle) * throttle; shipVY += sin(shipAngle) * throttle; } } shipVX *= 0.95; shipVY *= 0.95; float curSpd = sqrt(shipVX * shipVX + shipVY * shipVY); if (curSpd > maxSpeed) { shipVX = (shipVX / curSpd) * maxSpeed; shipVY = (shipVY / curSpd) * maxSpeed; } shipX = constrain(shipX + shipVX, -HALF_WORLD + 60, HALF_WORLD - 60); shipY = constrain(shipY + shipVY, -HALF_WORLD + 60, HALF_WORLD - 60); } void updateSectorTelemetry() { String nextSector; if (shipX < 0 && shipY < 0) nextSector = "SEKTOR I (NW): WASSERSTOFF-NEBEL — Quantensprünge mit Photon [1]"; else if (shipX >= 0 && shipY < 0) nextSector = "SEKTOR II (NO): FUSIONS-SCHMIEDE — Fusions-Reaktor & Gluon [2]"; else if (shipX < 0 && shipY >= 0) nextSector = "SEKTOR III (SW): ISOTOPEN-RISS — Quanten-Speicher & W-Boson [3]"; else nextSector = "SEKTOR IV (SO): KOHLENSTOFF-CLUSTER — Ionen stabilisieren mit Elektron [4]"; if (!nextSector.equals(sectorName)) { sectorName = nextSector; pushPhysicsLog("Sektor-Eintritt: " + sectorName, "Sensoren kalibriert · Auto-Aim sucht passende Resonanz-Energien."); } } void updateAutoAimSensor() { lockedTarget = null; float bestD = 340.0; for (int i = 0; i < worldAtoms.size(); i++) { MicroAtom a = (MicroAtom) worldAtoms.get(i); if (a.destroyed) continue; float d = dist(shipX, shipY, a.x, a.y); if (d < bestD) { bestD = d; lockedTarget = a; } } if (autoAim && lockedTarget != null) { aimAngle = atan2(lockedTarget.y - shipY, lockedTarget.x - shipX); if (activeWeapon == 1) { if (lockedTarget.electrons > 0) { int curN = lockedTarget.excitedShell; if (curN < 3) { float e1 = calcShellEnergyEv(lockedTarget.protons, lockedTarget.electrons, curN); float e2 = calcShellEnergyEv(lockedTarget.protons, lockedTarget.electrons, curN + 1); currentShotEv = max(0.5, e2 - e1); targetInfoText = getElementName(lockedTarget.protons) + " | Sprung n=" + curN + "->" + (curN + 1) + ": " + nf(currentShotEv, 1, 2) + " eV"; } else { float eIon = abs(calcShellEnergyEv(lockedTarget.protons, lockedTarget.electrons, 3)); currentShotEv = eIon; targetInfoText = getElementName(lockedTarget.protons) + " | Ionisation (n=3->frei): " + nf(currentShotEv, 1, 2) + " eV"; } } else { currentShotEv = 13.6; targetInfoText = getElementName(lockedTarget.protons) + " (Ionisiert · kein Elektron)"; } } else if (activeWeapon == 2) { float bMeV = calcBetheWeizsaecker(lockedTarget.protons, lockedTarget.neutrons); targetInfoText = getElementName(lockedTarget.protons) + " | Gluon-Fusion (Bindung: " + nf(bMeV, 1, 1) + " MeV)"; } else if (activeWeapon == 3) { targetInfoText = getElementName(lockedTarget.protons) + (lockedTarget.hostile ? " [INSTABIL] -> W-Boson erntet Isotop!" : " -> Schwache Wechselwirkung bereit"); } else { int q = lockedTarget.protons - lockedTarget.electrons; targetInfoText = getElementName(lockedTarget.protons) + " | Ladung: " + (q > 0 ? "+" + q : "" + q) + " (Elektronen-Injektion)"; } } else { aimAngle = shipAngle; targetInfoText = autoAim ? "Sensoren scannen Mikrokosmos..." : "Manuelles Zielen in Flugrichtung"; } } void drawAutoAimLaser() { if (!autoAim || lockedTarget == null) return; int wCol = getEntityColor(a11yTheme, activeWeapon == 1 ? 4 : (activeWeapon == 2 ? 5 : (activeWeapon == 3 ? 6 : 3))); stroke(wCol); strokeWeight(1.5); line(shipX, shipY, lockedTarget.x, lockedTarget.y); noFill(); ellipse(lockedTarget.x, lockedTarget.y, 76, 76); strokeWeight(1.0); } void drawStarship(float cx, float cy) { int ringCol = getEntityColor(a11yTheme, 7); stroke(ringCol); strokeWeight(2.5); fill(18, 28, 45); ellipse(cx - 26, cy, 18, 54); if (ladung > 0) { fill(red(ringCol), green(ringCol), blue(ringCol), 110 + sin(simTime * 22.0) * 80); noStroke(); ellipse(cx - 26, cy, 8, 30); } fill(238, 243, 252); stroke(30, 42, 60); strokeWeight(1.5); beginShape(); vertex(cx - 32, cy - 10); vertex(cx + 38, cy - 8); vertex(cx + 104, cy); vertex(cx + 38, cy + 8); vertex(cx - 32, cy + 10); vertex(cx - 18, cy); endShape(CLOSE); fill(75, 88, 108); stroke(30, 42, 60); rect(cx - 14, cy - 16, 24, 4); rect(cx - 14, cy + 12, 24, 4); if (ladung > 45) { noFill(); stroke(getEntityColor(a11yTheme, 3)); arc(cx + 109, cy, 16, 16, -HALF_PI, HALF_PI); } strokeWeight(1.0); } // ============================================================================================== // MODUL 7: MIKROKOSMOS-ENTITÄTEN & PHYSIKALISCHE WECHSELWIRKUNGEN // ============================================================================================== class VacuumQuantum { float x, y, phase; VacuumQuantum(float qx, float qy) { x = qx; y = qy; phase = random(TWO_PI); } } class SingularityRift { float x, y, phase; SingularityRift(float rx, float ry) { x = rx; y = ry; phase = random(TWO_PI); } } class MicroAtom { float x, y, vx, vy; int protons, neutrons, electrons; int excitedShell; int exciteTimer; boolean hostile; int attackCooldown; boolean destroyed; MicroAtom(float ax, float ay, int p, int n, int e, boolean isHostile) { x = ax; y = ay; vx = random(-0.4, 0.4); vy = random(-0.4, 0.4); protons = p; neutrons = n; electrons = e; excitedShell = 1; exciteTimer = 0; hostile = isHostile; attackCooldown = int(random(90, 180)); destroyed = false; } } class BosonProjectile { float x, y, vx, vy; int kind; float energyEv; boolean fromPlayer; int life; BosonProjectile(float sx, float sy, float svx, float svy, int k, float ev, boolean playerOwned) { x = sx; y = sy; vx = svx; vy = svy; kind = k; energyEv = ev; fromPlayer = playerOwned; life = 115; } } class ShockRing { float x, y, r; int col, alpha; ShockRing(float rx, float ry, int c) { x = rx; y = ry; r = 12.0; col = c; alpha = 240; } } void fireStarshipWeapon() { if (briefingOpen || gameOver || missionWon) return; float noseX = shipX + cos(shipAngle) * 45.0; float noseY = shipY + sin(shipAngle) * 45.0; float spd = 10.5; int shotKind = 3; if (activeWeapon == 1) shotKind = 4; else if (activeWeapon == 2) shotKind = 5; else if (activeWeapon == 3) shotKind = 6; worldShots.add(new BosonProjectile(noseX, noseY, cos(aimAngle) * spd, sin(aimAngle) * spd, shotKind, currentShotEv, true)); } void updateWorldEntities(float shipScale) { // 1. Grüne Vakuum-Quanten einsammeln for (int i = worldQuanta.size() - 1; i >= 0; i--) { VacuumQuantum q = (VacuumQuantum) worldQuanta.get(i); q.y += sin(simTime * 3.0 + q.phase) * 0.45; if (dist(shipX, shipY, q.x, q.y) < 38.0 * shipScale) { shockX = q.x; shockY = q.y; shockRadius = 0.0; shockIntensity = 255.0; score += 50; ladung = constrain(ladung + 10, 0, 100); worldRings.add(new ShockRing(q.x, q.y, getEntityColor(a11yTheme, 7))); pushPhysicsLog("QUANT COLLAPSED! +10% Vakuum-Energie geladen (Score: " + score + ")", "Die Raumzeit-Krümmung des Bühring-Rings absorbiert Nullpunkt-Energie."); q.x = random(-HALF_WORLD + 140, HALF_WORLD - 140); q.y = random(-HALF_WORLD + 140, HALF_WORLD - 140); if (ladung >= 100) missionWon = true; } } // 2. Rote Singularitäts-Risse (werden zurückgedrängt, wenn nahe einer aktiven Stations-Schockwelle) for (int i = 0; i < worldRifts.size(); i++) { SingularityRift r = (SingularityRift) worldRifts.get(i); r.x += cos(simTime * 1.4 + r.phase) * 0.6; r.y += sin(simTime * 1.7 + r.phase) * 0.6; if (shockIntensity > 40.0 && dist(r.x, r.y, shockX, shockY) < shockRadius + 60.0) { float pushAng = atan2(r.y - shockY, r.x - shockX); r.x = constrain(r.x + cos(pushAng) * 5.0, -HALF_WORLD + 100, HALF_WORLD - 100); r.y = constrain(r.y + sin(pushAng) * 5.0, -HALF_WORLD + 100, HALF_WORLD - 100); } if (dist(shipX, shipY, r.x, r.y) < 34.0 * shipScale) { schild = max(0, schild - 34); worldRings.add(new ShockRing(r.x, r.y, getEntityColor(a11yTheme, 8))); pushPhysicsLog("ANOMALIE-EINSCHLAG! Schild: " + schild + "% — Fliege zum Reaktor oder Speicher!", "Beide Andock-Stationen regenerieren dein Schild automatisch auf 100%."); r.x = shipX + cos(shipAngle + PI) * 420.0 + random(-150, 150); r.y = shipY + sin(shipAngle + PI) * 420.0 + random(-150, 150); if (schild <= 0) gameOver = true; } } // 3. Atome & Kerne im Mikrokosmos for (int i = worldAtoms.size() - 1; i >= 0; i--) { MicroAtom a = (MicroAtom) worldAtoms.get(i); if (a.destroyed) { worldAtoms.remove(i); continue; } a.x += a.vx; a.y += a.vy; if (a.x < -HALF_WORLD + 90 || a.x > HALF_WORLD - 90) a.vx = -a.vx; if (a.y < -HALF_WORLD + 90 || a.y > HALF_WORLD - 90) a.vy = -a.vy; if (a.excitedShell > 1 && a.electrons > 0) { a.exciteTimer--; if (a.exciteTimer <= 0) { int oldN = a.excitedShell; a.excitedShell = 1; worldQuanta.add(new VacuumQuantum(a.x + random(-24, 24), a.y + random(-24, 24))); worldRings.add(new ShockRing(a.x, a.y, getEntityColor(a11yTheme, 4))); pushPhysicsLog("SPONTANE EMISSION! Elektron fällt n=" + oldN + " -> n=1", "Freigesetztes Photon-Paket erzeugt einsammelbares Vakuum-Quantum!"); } } if (a.hostile && dist(shipX, shipY, a.x, a.y) < 380.0) { a.attackCooldown--; if (a.attackCooldown <= 0) { a.attackCooldown = 140; float ang = atan2(shipY - a.y, shipX - a.x); worldShots.add(new BosonProjectile(a.x, a.y, cos(ang) * 4.6, sin(ang) * 4.6, 8, 2.0, false)); } } } // 4. Projektile bewegen & Treffer auswerten for (int i = worldShots.size() - 1; i >= 0; i--) { BosonProjectile s = (BosonProjectile) worldShots.get(i); s.x += s.vx; s.y += s.vy; s.life--; if (s.life <= 0) { worldShots.remove(i); continue; } if (!s.fromPlayer) { if (dist(s.x, s.y, shipX, shipY) < 26.0 * shipScale) { schild = max(0, schild - 15); worldRings.add(new ShockRing(shipX, shipY, getEntityColor(a11yTheme, 8))); pushPhysicsLog("ISOTOPEN-STRAHLUNG GETROFFEN! Schild: " + schild + "%", "Nutze W-Bosonen [3] zur Umwandlung oder lade das Schild an einer Station!"); worldShots.remove(i); if (schild <= 0) gameOver = true; } continue; } boolean consumed = false; for (int j = 0; j < worldAtoms.size(); j++) { MicroAtom target = (MicroAtom) worldAtoms.get(j); if (target.destroyed) continue; if (dist(s.x, s.y, target.x, target.y) < 42.0) { handlePlayerBosonHit(s, target); consumed = true; break; } } if (consumed) worldShots.remove(i); } // 5. Schockwellen-Ringe aktualisieren for (int i = worldRings.size() - 1; i >= 0; i--) { ShockRing r = (ShockRing) worldRings.get(i); r.r += 2.8; r.alpha -= 10; if (r.alpha <= 0) worldRings.remove(i); } } void handlePlayerBosonHit(BosonProjectile s, MicroAtom target) { if (s.kind == 4) { // PHOTON: Quantensprung oder Ionisation if (target.electrons > 0) { if (target.excitedShell < 3) { target.excitedShell++; target.exciteTimer = 110; score += 25; worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 3))); pushPhysicsLog("QUANTENSPRUNG! Elektron auf Schale n=" + target.excitedShell + " (" + nf(s.energyEv, 1, 2) + " eV)", "Gleich fällt das Elektron zurück und setzt ein Vakuum-Quantum frei!"); } else { target.electrons--; target.excitedShell = 1; score += 40; worldQuanta.add(new VacuumQuantum(target.x + 25, target.y)); worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 4))); pushPhysicsLog("PHOTO-IONISATION! Elektron aus " + getElementName(target.protons) + " gelöst!", "Das Atom ist jetzt ein positiv geladenes Ion (+1)."); } } else { pushPhysicsLog("Photon passiert nackten Kern (" + getElementName(target.protons) + ")", "Kein gebundenes Elektron vorhanden — wechsle auf Gluon [2] oder Elektron [4]!"); } } else if (s.kind == 5) { // GLUON: Starke Kernkraft -> Verschmilzt Kerne & erntet +1 Isotop! MicroAtom partner = null; float bestD = 220.0; for (int k = 0; k < worldAtoms.size(); k++) { MicroAtom other = (MicroAtom) worldAtoms.get(k); if (other != target && !other.destroyed) { float d = dist(target.x, target.y, other.x, other.y); if (d < bestD) { bestD = d; partner = other; } } } if (partner != null) { target.protons += partner.protons; target.neutrons += partner.neutrons; target.electrons += partner.electrons; target.hostile = false; partner.destroyed = true; float bindMeV = calcBetheWeizsaecker(target.protons, target.neutrons); isotopeCores++; ladung = constrain(ladung + 10, 0, 100); score += 120; worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 5))); pushPhysicsLog("KERNFUSION! " + getElementName(target.protons) + " (" + nf(bindMeV, 1, 1) + " MeV) -> +1 Isotop!", "Isotope im Frachtraum: " + isotopeCores + " (Umwandlung an Station I oder II)"); if (ladung >= 100) missionWon = true; } else { score += 15; worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 5))); pushPhysicsLog("Gluon verstärkt Quark-Bindung im Kern", "Fliege in Gebiete mit mehreren Kernen (Sektor II), um sie zu fusionieren!"); } } else if (s.kind == 6) { // W-BOSON: Schwache Wechselwirkung (wandelt p -> n & erntet +1 stabilisiertes Isotop!) if (target.protons > 0) { target.protons--; target.neutrons++; boolean wasHostile = target.hostile; target.hostile = false; isotopeCores++; score += wasHostile ? 100 : 40; worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 6))); pushPhysicsLog("W-BOSON UMWANDLUNG: p -> n + e+ + Neutrino (+1 Isotop geerntet!)", "Isotope im Frachtraum: " + isotopeCores + " · Docke an Station I/II zur Umwandlung!"); } else if (target.neutrons > 0) { target.neutrons--; target.protons++; score += 35; worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 6))); pushPhysicsLog("BETA-ZERFALL: Neutron -> Proton + Elektron + Anti-Neutrino!", "Neues Proton erzeugt — bereit für Fusion oder Elektroneneinfang."); } } else { // ELEKTRON: Wird von positivem Ion eingefangen if (target.protons > target.electrons) { target.electrons++; score += 45; ladung = constrain(ladung + 6, 0, 100); worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 3))); pushPhysicsLog("ELEKTRONEN-EINFANG! Schale von " + getElementName(target.protons) + " aufgefüllt", "Elektrische Neutralität hergestellt (+6% Energie)."); if (ladung >= 100) missionWon = true; } else { pushPhysicsLog("Schale bereits gesättigt", "Das Elektron wird abgestoßen — suche positiv geladene Ionen (e < Z)!"); } } } void drawWorldEntities() { int qCol = getEntityColor(a11yTheme, 7); for (int i = 0; i < worldQuanta.size(); i++) { VacuumQuantum q = (VacuumQuantum) worldQuanta.get(i); if (abs(q.x - camX) > width * 0.6 || abs(q.y - camY) > height * 0.6) continue; stroke(qCol); strokeWeight(1.8); fill(8, 30, 36); ellipse(q.x, q.y, 20, 20); noStroke(); fill(255); ellipse(q.x, q.y, 6, 6); } int rCol = getEntityColor(a11yTheme, 8); for (int i = 0; i < worldRifts.size(); i++) { SingularityRift r = (SingularityRift) worldRifts.get(i); if (abs(r.x - camX) > width * 0.6 || abs(r.y - camY) > height * 0.6) continue; stroke(rCol); strokeWeight(2.0); fill(35, 6, 14); ellipse(r.x, r.y, 26, 26); noStroke(); fill(rCol); ellipse(r.x, r.y, 10 + sin(simTime * 12.0 + r.phase) * 4.0, 10 + sin(simTime * 12.0 + r.phase) * 4.0); } int eCol = getEntityColor(a11yTheme, 3); int pCol = getEntityColor(a11yTheme, 1); int nCol = getEntityColor(a11yTheme, 2); for (int i = 0; i < worldAtoms.size(); i++) { MicroAtom a = (MicroAtom) worldAtoms.get(i); if (abs(a.x - camX) > width * 0.65 || abs(a.y - camY) > height * 0.65) continue; float shellR = 22.0 + a.excitedShell * 11.0; noFill(); stroke(a.hostile ? rCol : eCol); strokeWeight(1.2); ellipse(a.x, a.y, shellR * 2.0, shellR * 2.0); for (int e = 0; e < a.electrons; e++) { float ang = simTime * 2.2 + (TWO_PI * e) / max(1, a.electrons); noStroke(); fill(eCol); ellipse(a.x + cos(ang) * shellR, a.y + sin(ang) * shellR, 8, 8); } int totalNuc = a.protons + a.neutrons; for (int k = 0; k < totalNuc; k++) { float offX = 0.0; float offY = 0.0; if (totalNuc > 1) { float kAng = (TWO_PI * k) / float(totalNuc) + simTime; offX = cos(kAng) * 6.5; offY = sin(kAng) * 6.5; } fill(k < a.protons ? pCol : nCol); stroke(255, 150); ellipse(a.x + offX, a.y + offY, 12, 12); } fill(245); textSize(10); textAlign(CENTER, TOP); String tag = getElementName(a.protons) + (a.hostile ? " [!]" : ""); text(tag, a.x, a.y + shellR + 4); } for (int i = 0; i < worldShots.size(); i++) { BosonProjectile s = (BosonProjectile) worldShots.get(i); fill(getEntityColor(a11yTheme, s.kind)); stroke(255); ellipse(s.x, s.y, 11, 11); } strokeWeight(1.0); } void drawShockwaves() { for (int i = 0; i < worldRings.size(); i++) { ShockRing r = (ShockRing) worldRings.get(i); noFill(); stroke(red(r.col), green(r.col), blue(r.col), r.alpha); strokeWeight(2.0); ellipse(r.x, r.y, r.r * 2.0, r.r * 2.0); } strokeWeight(1.0); } // ============================================================================================== // MODUL 8: PILOT-HUD, MINIMAP-RADAR (INKL. STATIONEN) & BORDCOMPUTER-TEXTE // ============================================================================================== void drawPilotHUD(float rootFactor) { int hudTop = height - 135; // Obere Sektor- & Telemetrie-Leiste fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, 0, width, 34); stroke(getUiPalette(a11yTheme, 4)); line(0, 34, width, 34); fill(255); textSize(12); textAlign(LEFT, CENTER); text(sectorName, 14, 17); textAlign(RIGHT, CENTER); text("Pos: (" + int(shipX) + ", " + int(shipY) + ") | v_TLW: " + nf(4.2 * rootFactor, 1, 2) + " c_eff", width - 14, 17); // Unteres Cockpit-Deck fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, hudTop, width, 135); stroke(getUiPalette(a11yTheme, 4)); strokeWeight(2.0); line(0, hudTop, width, hudTop); strokeWeight(1.0); // 1. Statuswerte: Score, Schild, Isotope, Batterie fill(255); textSize(11); textAlign(LEFT, TOP); text("SCORE: " + score, 16, hudTop + 10); text("SCHILD: " + schild + "%", 112, hudTop + 10); fill(getEntityColor(a11yTheme, 4)); text("ISOTOPE: " + isotopeCores, 206, hudTop + 10); fill(35, 42, 60); stroke(120, 145, 195); rect(292, hudTop + 9, 118, 15, 3); noStroke(); fill(getEntityColor(a11yTheme, 7)); rect(293, hudTop + 10, map(ladung, 0, 100, 0, 116), 13, 2); fill(255); text("AKKU: " + ladung + "%", 418, hudTop + 10); // 2. Waffenwahl [1]..[4] drawWeaponSlot(16, hudTop + 34, 1, "[1] Photon", getEntityColor(a11yTheme, 4)); drawWeaponSlot(142, hudTop + 34, 2, "[2] Gluon", getEntityColor(a11yTheme, 5)); drawWeaponSlot(268, hudTop + 34, 3, "[3] W-Boson", getEntityColor(a11yTheme, 6)); drawWeaponSlot(394, hudTop + 34, 4, "[4] Elektron", getEntityColor(a11yTheme, 3)); // 3. Andock-Aktion [F], Auto-Aim [E] & Sehhilfe [H] if (dockedStation == 1) { drawCockpitBtn(520, hudTop + 34, 283, 26, "[F] ISOTOP FUSIONIEREN (+25% AKKU)", getUiPalette(a11yTheme, 2)); } else if (dockedStation == 2) { drawCockpitBtn(520, hudTop + 34, 283, 26, "[F] QUANTEN-SYNTHESE (+15% & 3 QUANTEN)", getUiPalette(a11yTheme, 3)); } else { drawCockpitBtn(520, hudTop + 34, 283, 26, "Stationen: Reaktor (NO) / Speicher (SW)", color(24, 30, 44)); } drawCockpitBtn(520, hudTop + 7, 138, 22, autoAim ? "Auto-Aim [E]: AN" : "Auto-Aim [E]: AUS", autoAim ? color(20, 125, 75) : color(55, 65, 85)); String a11yLbl = (a11yTheme == 0) ? "Sehhilfe [H]" : ((a11yTheme == 1) ? "Farbenblind" : "Max-Kontrast"); drawCockpitBtn(665, hudTop + 7, 138, 22, a11yLbl, getUiPalette(a11yTheme, 3)); // 4. Kleiner DTIM-ZEC Bordcomputer-Text if (logFlashTimer > 0) logFlashTimer--; fill(a11yTheme == 2 ? color(0) : color(8, 10, 18)); stroke(logFlashTimer > 0 ? getUiPalette(a11yTheme, 4) : color(55, 68, 95)); rect(16, hudTop + 66, 787, 58, 5); fill(getEntityColor(a11yTheme, 4)); textSize(11); textAlign(LEFT, TOP); String dockHint = (dockedStation == 1) ? " [ANGEDOCKT: REAKTOR]" : ((dockedStation == 2) ? " [ANGEDOCKT: SPEICHER]" : ""); text("SENSOR-ZIEL: " + targetInfoText + dockHint, 26, hudTop + 72); fill(255); textSize(12); text(logHeadline, 26, hudTop + 90); fill(200, 215, 240); textSize(11); text(logSubtext, 26, hudTop + 108); // 5. Open-World Minimap-Radar unten rechts (115 x 115 px) int mapSize = 115; int mapX = width - mapSize - 16; int mapY = hudTop + 10; fill(4, 6, 12); stroke(getUiPalette(a11yTheme, 4)); rect(mapX, mapY, mapSize, mapSize, 4); stroke(45, 60, 90); line(mapX + mapSize * 0.5, mapY, mapX + mapSize * 0.5, mapY + mapSize); line(mapX, mapY + mapSize * 0.5, mapX + mapSize, mapY + mapSize * 0.5); noStroke(); // Quanta auf Radar fill(getEntityColor(a11yTheme, 7)); for (int i = 0; i < worldQuanta.size(); i++) { VacuumQuantum q = (VacuumQuantum) worldQuanta.get(i); float rx = map(q.x, -HALF_WORLD, HALF_WORLD, mapX + 3, mapX + mapSize - 3); float ry = map(q.y, -HALF_WORLD, HALF_WORLD, mapY + 3, mapY + mapSize - 3); rect(rx, ry, 2, 2); } // Risse auf Radar fill(getEntityColor(a11yTheme, 8)); for (int i = 0; i < worldRifts.size(); i++) { SingularityRift r = (SingularityRift) worldRifts.get(i); float rx = map(r.x, -HALF_WORLD, HALF_WORLD, mapX + 3, mapX + mapSize - 3); float ry = map(r.y, -HALF_WORLD, HALF_WORLD, mapY + 3, mapY + mapSize - 3); rect(rx, ry, 2, 2); } // Atome auf Radar fill(getEntityColor(a11yTheme, 3)); for (int i = 0; i < worldAtoms.size(); i++) { MicroAtom a = (MicroAtom) worldAtoms.get(i); float rx = map(a.x, -HALF_WORLD, HALF_WORLD, mapX + 3, mapX + mapSize - 3); float ry = map(a.y, -HALF_WORLD, HALF_WORLD, mapY + 3, mapY + mapSize - 3); rect(rx, ry, 2, 2); } // Station 1 (Fusions-Reaktor) & Station 2 (Quanten-Speicher) deutlich auf Radar markieren float s1x = map(reactorX, -HALF_WORLD, HALF_WORLD, mapX + 6, mapX + mapSize - 6); float s1y = map(reactorY, -HALF_WORLD, HALF_WORLD, mapY + 6, mapY + mapSize - 6); fill(getUiPalette(a11yTheme, 4)); stroke(255); rect(s1x - 4, s1y - 4, 8, 8); float s2x = map(vaultX, -HALF_WORLD, HALF_WORLD, mapX + 6, mapX + mapSize - 6); float s2y = map(vaultY, -HALF_WORLD, HALF_WORLD, mapY + 6, mapY + mapSize - 6); fill(getEntityColor(a11yTheme, 7)); stroke(255); ellipse(s2x, s2y, 8, 8); // Schiff auf Radar noStroke(); float sx = map(shipX, -HALF_WORLD, HALF_WORLD, mapX + 4, mapX + mapSize - 4); float sy = map(shipY, -HALF_WORLD, HALF_WORLD, mapY + 4, mapY + mapSize - 4); fill(255); ellipse(sx, sy, 5, 5); } void drawWeaponSlot(int bx, int by, int id, String label, int dotCol) { boolean sel = (activeWeapon == id); if (a11yTheme == 2) { fill(0); stroke(sel ? color(255, 255, 0) : color(255)); } else { fill(sel ? getUiPalette(a11yTheme, 2) : color(20, 25, 38)); stroke(sel ? getUiPalette(a11yTheme, 4) : color(60, 75, 105)); } rect(bx, by, 120, 26, 4); fill(dotCol); stroke(255); ellipse(bx + 14, by + 13, 10, 10); fill(255); textSize(11); textAlign(LEFT, CENTER); text(label, bx + 25, by + 13); } void drawCockpitBtn(int bx, int by, int bw, int bh, String label, int bgCol) { if (a11yTheme == 2) { fill(0); stroke(255, 255, 0); } else { fill(bgCol); stroke(120, 145, 195); } rect(bx, by, bw, bh, 4); fill(a11yTheme == 2 ? color(255, 255, 0) : color(255)); textSize(11); textAlign(CENTER, CENTER); text(label, bx + bw * 0.5, by + bh * 0.5); } void drawBriefingModal() { fill(4, 5, 12, 225); noStroke(); rect(0, 0, width, height); fill(getUiPalette(a11yTheme, 1)); stroke(getUiPalette(a11yTheme, 4)); strokeWeight(2.0); rect(140, 115, 680, 380, 8); strokeWeight(1.0); fill(getUiPalette(a11yTheme, 2)); noStroke(); rect(141, 116, 678, 42, 7); fill(255); textSize(16); textAlign(LEFT, CENTER); text("SPACEX ULTIMATE: DTIM-ZEC MIKROKOSMOS & ANDOCK-STATIONEN", 165, 137); fill(235, 240, 250); textSize(13); textAlign(LEFT, TOP); text("Willkommen im freien Open-World-Mikrokosmos (4 Sektoren):\n\n" + "1. Sammle gruene Vakuum-Quanten & weiche roten Singularitaets-Rissen aus.\n" + "2. Nutze deine Elementarteilchen-Kanone (Tasten 1 bis 4):\n" + " [1] Photon: Regt Elektronen an -> setzt neue Vakuum-Quanten frei!\n" + " [2] Gluon: Verschmilzt Kerne (Kernfusion) -> erntet +1 Isotop!\n" + " [3] W-Boson: Stabilisiert instabile Kerne -> erntet +1 Isotop!\n" + " [4] Elektron: Neutralisiert Ionen (+6% Akku).\n" + "3. Zwei Andock-Stationen (auf Radar & per Kompass-Pfeil sichtbar):\n" + " - Fusions-Reaktor (NO): Laedt Schild & wandelt Isotope [F] in +25% Akku!\n" + " - Quanten-Speicher (SW): Schnell-Schild & synthetisiert [F] 3 Quanten!", 165, 174); drawCockpitBtn(360, 435, 240, 42, "SYSTEME STARTEN >>", getUiPalette(a11yTheme, 2)); } void drawEndOverlay(String title, String sub) { fill(4, 5, 12, 220); noStroke(); rect(0, 0, width, height - 135); fill(getUiPalette(a11yTheme, 1)); stroke(getUiPalette(a11yTheme, 4)); strokeWeight(2.0); rect(210, 180, 540, 210, 8); strokeWeight(1.0); fill(255); textSize(20); textAlign(CENTER, CENTER); text(title, width * 0.5, 225); fill(220, 230, 245); textSize(13); text(sub + "\nEndstand: " + score + " Punkte", width * 0.5, 275); drawCockpitBtn(380, 325, 200, 40, "NEUSTART", getUiPalette(a11yTheme, 2)); } // ============================================================================================== // MODUL 9: MAUS- & TASTATUR-STEUERUNG // ============================================================================================== void mouseMoved() { if (!briefingOpen && !gameOver && !missionWon && mouseY < height - 135) { mouseSteer = true; } } void mousePressed() { if (briefingOpen) { if (mouseX >= 360 && mouseX <= 600 && mouseY >= 435 && mouseY <= 477) { briefingOpen = false; } return; } if (gameOver || missionWon) { if (mouseX >= 380 && mouseX <= 580 && mouseY >= 325 && mouseY <= 365) { resetMicroCosmos(); } return; } int hudTop = height - 135; if (mouseY >= hudTop) { // Waffen-Slots [1]..[4] if (mouseY >= hudTop + 34 && mouseY <= hudTop + 60) { if (mouseX >= 16 && mouseX <= 136) { activeWeapon = 1; return; } if (mouseX >= 142 && mouseX <= 262) { activeWeapon = 2; return; } if (mouseX >= 268 && mouseX <= 388) { activeWeapon = 3; return; } if (mouseX >= 394 && mouseX <= 514) { activeWeapon = 4; return; } if (mouseX >= 520 && mouseX <= 803 && dockedStation > 0) { convertIsotopeAtStation(); return; } } // Auto-Aim & Sehhilfe Buttons if (mouseY >= hudTop + 7 && mouseY <= hudTop + 29) { if (mouseX >= 520 && mouseX <= 658) { autoAim = !autoAim; return; } if (mouseX >= 665 && mouseX <= 803) { a11yTheme = (a11yTheme + 1) % 3; return; } } return; } if (mouseY > 34 && mouseY < hudTop && mouseButton == LEFT) { fireStarshipWeapon(); } } void keyPressed() { if (key == '1') activeWeapon = 1; if (key == '2') activeWeapon = 2; if (key == '3') activeWeapon = 3; if (key == '4') activeWeapon = 4; if (key == 'f' || key == 'F') convertIsotopeAtStation(); if (key == 'e' || key == 'E') autoAim = !autoAim; if (key == 'h' || key == 'H') a11yTheme = (a11yTheme + 1) % 3; if (key == ' ') { if (briefingOpen) briefingOpen = false; else fireStarshipWeapon(); } if (key == 'w' || key == 'W') keyUp = true; if (key == 's' || key == 'S') keyDown = true; if (key == 'a' || key == 'A') keyLeft = true; if (key == 'd' || key == 'D') keyRight = true; if (key == CODED) { if (keyCode == UP) keyUp = true; if (keyCode == DOWN) keyDown = true; if (keyCode == LEFT) keyLeft = true; if (keyCode == RIGHT) keyRight = true; } } void keyReleased() { if (key == 'w' || key == 'W') keyUp = false; if (key == 's' || key == 'S') keyDown = false; if (key == 'a' || key == 'A') keyLeft = false; if (key == 'd' || key == 'D') keyRight = false; if (key == CODED) { if (keyCode == UP) keyUp = false; if (keyCode == DOWN) keyDown = false; if (keyCode == LEFT) keyLeft = false; if (keyCode == RIGHT) keyRight = false; } }