/** * ============================================================================================== * Modul: DTIM-ZEC NORN MARS HOMEWORLD — COZY SQUARE BASE & 0-CLICK HOMEWORLD FARM * Datei: DTIM_ZEC_Norn_Mars_Homeworld.pde * Framework: DTIM-ZEC MODULAR PHYSICS FRAMEWORK (DAMTP ACADEMIC STANDARD) * Architektur: Phase 1: Cozy 9-Square Mars Terraforming, Shield, Defense & Supply Base * Phase 2: Automatic Transformation into Norn Homeworld (0-Click Farm & Orbit) * Includes: Bilingual DE/EN [L], Accessibility Themes [H], Save/Load [K]/[O] * Copyright: (c) 2026 Jan Bühring & Adaptive Intelligence Synthesis Network (Google AI) * Lizenz: MIT License * Plattform: Processing 4.5.6 (Linux x64) & Processing.js (processing.min.js) * * Steuerung / Controls: * [Maus bewegen / Move Mouse] Sanfter Kurs zu den Quadraten (0-Klick-Aktivierung beim Überflug!) * [Linksklick / Left Click] Quadrat direkt ausbauen oder Meteor abwehren * [Leertaste / Space] Triebwerke AN / AUS (gemütlich auf einem Quadrat parken) * [K] Speichern / Save | [O] Laden / Load | [L] Deutsch / English | [H] Sehhilfe * ============================================================================================== */ // ============================================================================================== // MODUL 1: SYSTEM-, SPRACH- & PHASEN-VARIABLEN (100% PROCESSING.JS-SICHER) // ============================================================================================== int langMode = 0; // 0 = Deutsch, 1 = English int a11yTheme = 0; // 0 = DTIM Standard (Schwarz/Blutrot/Nachtblau), 1 = Blau/Gold, 2 = Max-Kontrast int gamePhase = 0; // 0 = Mars-Aufbaubasis (9 Quadrate), 1 = Siegesmeldung, 2 = Norn-Heimatwelt (0-Klick Farm) float simTime = 0.0; // Norn-Raumschiff & Begleit-Fraktal float shipX = 560.0; float shipY = 315.0; float shipVX = 0.0; float shipVY = 0.0; float shipAngle = 0.0; boolean drivesActive = true; // [Space] parkt das Schiff ruhig auf einem Quadrat boolean mouseFollow = true; boolean keyW = false, keyA = false, keyS = false, keyD = false; boolean fractalHelperActive = false; float droneX = 520.0; float droneY = 280.0; float droneAngle = 0.0; // ============================================================================================== // MODUL 2: PHASE 1 — MARS-AUFBAUBASIS (9 GEMÜTLICHE QUADRATE) // ============================================================================================== float dtimEnergy = 140.0; float maxDtimEnergy = 500.0; // 9 Aufbau-Quadrate (jeweils 0.0 .. 100.0 %) // 0: DTIM-Energie-Kern, 1: Zeno-Schutzschild, 2: Meteor-Abwehr, // 3: Dipol-Atmosphäre, 4: Wärme & Wasser, 5: Enthalpie-Flora, // 6: Döner & Ayran ISRU, 7: Norn-Habitate, 8: Fraktal-Helfer-Dock float[] padProgress = new float[9]; float[] padX = new float[9]; float[] padY = new float[9]; float PAD_W = 176.0; float PAD_H = 112.0; boolean shieldActive = false; boolean defenseActive = false; int nornSettlers = 0; // Lässige Dynamik (langsame Sonnenwinde, gemächliche Meteore & schwebende Energie-Orbs) ArrayList energyOrbs; ArrayList defenseLasers; ArrayList floatingNotes; float eventCooldown = 780.0; // Viel Ruhe zwischen Ereignissen boolean flareWarning = false; boolean flareActive = false; int eventTimer = 0; boolean meteorActive = false; float meteorX = 560.0; float meteorY = 50.0; float meteorVX = 0.25; float meteorVY = 0.42; // Sehr gemächliche Sinkgeschwindigkeit float meteorHP = 100.0; // ============================================================================================== // MODUL 3: PHASE 2 — TRANSFORMIERTE NORN-HEIMATWELT (DTIM_ZEC_ZeroClick_Farm_Space) // ============================================================================================== int geld = 35; int korn = 3; int tom = 3; int wasser = 4; int heu = 2; int milch = 0; int kaese = 0; int mehl = 0; int pizza = 0; float kornGrow = 0.0; float tomGrow = 0.0; boolean stallBuilt = false; boolean muehleBuilt = false; boolean kaeseBuilt = false; float stallWork = 0.0; float muehleWork = 0.0; float kaeseWork = 0.0; float pizzaWork = 0.0; int orbitForce = 45; int orbitChargo = 60; int orbitLevel = 1; float orbitDroneX = 560.0; float orbitDroneY = 92.0; float orbitDroneHP = 100.0; boolean orbitHostile = true; float walkPhase = 0.0; String quickSaveSlot = ""; String statusLine = ""; // ============================================================================================== // ZWEISPRACHIGE TEXTE & FARB-PALETTEN // ============================================================================================== String tr(String de, String en) { return (langMode == 0) ? de : en; } int getUiPalette(int theme, int role) { if (theme == 1) { 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) { 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); } if (role == 0) return color(6, 8, 14); if (role == 1) return color(13, 16, 26); 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); } // ============================================================================================== // INITIALISIERUNG // ============================================================================================== void setup() { size(1120, 740); noSmooth(); frameRate(60); energyOrbs = new ArrayList(); defenseLasers = new ArrayList(); floatingNotes = new ArrayList(); initMarsSquareGrid(); for (int i = 0; i < 10; i++) { energyOrbs.add(new EnergyOrb(random(90, width - 90), random(75, 560))); } statusLine = tr( "Gemütlicher Mars-Aufbau: Fliege über die 9 Quadrate oder klicke sie an, um Stück für Stück die Norn-Heimatwelt zu errichten!", "Cozy Mars Construction: Fly over the 9 squares or click them to build the Norn Homeworld step by step!" ); } void initMarsSquareGrid() { // 3x3 Raster von Quadraten mit großzügigen Flugkorridoren dazwischen float[] cols = { 125.0, 472.0, 819.0 }; float[] rows = { 66.0, 228.0, 390.0 }; int idx = 0; for (int r = 0; r < 3; r++) { for (int c = 0; c < 3; c++) { padX[idx] = cols[c]; padY[idx] = rows[r]; padProgress[idx] = 0.0; idx++; } } // Energie-Kern startet bereits auf 35%, damit man direkt losbauen kann padProgress[0] = 35.0; } // ============================================================================================== // HAUPTSCHLEIFE // ============================================================================================== void draw() { background(getUiPalette(a11yTheme, 0)); simTime += 0.025; if (gamePhase == 0 || gamePhase == 1) { drawMarsConstructionPhase(); if (gamePhase == 1) { drawHomeworldVictoryModal(); } } else { drawNornHomeworldFarmPhase(); } drawGlobalTopBar(); } // ============================================================================================== // TOP-LEISTE (MODUS, SPEICHERN/LADEN, SPRACHE & SEHHILFE) // ============================================================================================== void drawGlobalTopBar() { fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, 0, width, 38); stroke(getUiPalette(a11yTheme, 4)); line(0, 38, width, 38); String phaseBadge = (gamePhase < 2) ? tr("PHASE 1: MARS-AUFBAUBASIS (9 QUADRATE)", "PHASE 1: MARS CONSTRUCTION BASE (9 SQUARES)") : tr("PHASE 2: NORN-HEIMATWELT (0-KLICK FARM & ORBIT)", "PHASE 2: NORN HOMEWORLD (0-CLICK FARM & ORBIT)"); fill(gamePhase < 2 ? getUiPalette(a11yTheme, 2) : color(20, 125, 75)); noStroke(); rect(10, 5, 340, 28, 5); fill(255); textSize(11); textAlign(CENTER, CENTER); text(phaseBadge, 180, 19); // Fortschritts- oder Ressourcenanzeige textAlign(LEFT, CENTER); if (gamePhase < 2) { int totalPct = getAverageBaseCompletion(); text(tr("Gesamt-Aufbau: ", "Total Progress: ") + totalPct + "% | DTIM-Energie: " + int(dtimEnergy) + " | Norn-Siedler: " + nornSettlers + "/60", 362, 19); } else { text(tr("Geld: " + geld + " EUR | Pizza: " + pizza + " | Orbit-Force: " + orbitForce + "/" + orbitChargo + " | Level: " + orbitLevel, "Funds: " + geld + " EUR | Pizza: " + pizza + " | Orbit Force: " + orbitForce + "/" + orbitChargo + " | Level: " + orbitLevel), 362, 19); } drawNavBtn(740, 5, 86, 28, tr("Speichern", "Save"), color(20, 125, 75)); drawNavBtn(831, 5, 74, 28, tr("Laden", "Load"), getUiPalette(a11yTheme, 3)); drawNavBtn(912, 5, 62, 28, langMode == 0 ? "DE [L]" : "EN [L]", color(30, 38, 56)); String a11yLbl = (a11yTheme == 0) ? tr("Sehhilfe", "A11y") : ((a11yTheme == 1) ? tr("Blau/Gold", "Blue/Gold") : tr("Kontrast", "Contrast")); drawNavBtn(980, 5, 130, 28, a11yLbl + " [H]", getUiPalette(a11yTheme, 3)); } void drawNavBtn(int bx, int by, int bw, int bh, String lbl, int bg) { if (a11yTheme == 2) { fill(0); stroke(255, 255, 0); } else { fill(bg); stroke(125, 160, 220); } rect(bx, by, bw, bh, 5); fill(a11yTheme == 2 ? color(255, 255, 0) : color(255)); textSize(11); textAlign(CENTER, CENTER); text(lbl, bx + bw * 0.5, by + bh * 0.5); } // ============================================================================================== // PHASE 1: MARS-AUFBAUBASIS (9 QUADRATE MIT ATMOSPHÄRE, SCHILD, ABWEHR & VERSORGUNG) // ============================================================================================== void drawMarsConstructionPhase() { float atmoPct = padProgress[3]; float waterPct = padProgress[4]; float floraPct = padProgress[5]; // 1. Mars-Atmosphäre & Boden-Landschaft (verfärbt sich live von Rostrot zu Blau/Smaragd!) drawTerraformingBackdrop(atmoPct, waterPct, floraPct); // 2. Schiffs- & Helfer-Bewegung (ganz lässig & sanft) if (gamePhase == 0) { updateNornShipMotion(); updateFractalHelperDrone(); updateCozyMarsDynamics(); processSquarePads(); } // 3. Die 9 Aufbau-Quadrate zeichnen drawAllNineSquares(); // 4. Energie-Orbs, Verteidigungs-Laser, Meteore & Raumschiffe drawOrbsAndEvents(); drawFractalDrone(); drawNornShip(); drawFloatingNotes(); // 5. Unteres Cockpit & Telemetrie drawPhase1BottomHUD(); // Prüfen, ob das Projekt abgeschlossen ist -> Die Norn haben ihre erste Heimatwelt! if (gamePhase == 0 && isHomeworldComplete()) { gamePhase = 1; statusLine = tr( "PROJEKT ABGESCHLOSSEN: DIE NORN HABEN IHRE ERSTE HEIMATWELT!", "PROJECT COMPLETE: THE NORNS HAVE FOUNDED THEIR FIRST HOMEWORLD!" ); } } void drawTerraformingBackdrop(float atmoPct, float waterPct, float floraPct) { // Himmel: wird mit steigender Dipol-Atmosphäre von Tiefschwarz zu sanftem Nachtblau/Himmelblau float skyR = map(atmoPct, 0, 100, 8, 16); float skyG = map(atmoPct, 0, 100, 10, 38); float skyB = map(atmoPct, 0, 100, 18, 82); fill(skyR, skyG, skyB); noStroke(); rect(0, 38, width, 567); // Feines hexagonal-topologisches Gitter im Hintergrund stroke(59, 110, 194, 28); for (int gx = 40; gx < width; gx += 64) { line(gx, 38, gx, 605); } for (int gy = 60; gy < 605; gy += 64) { line(0, gy, width, gy); } // Mars-Horizont am unteren Rand des Spielfelds (verwandelt sich in Wasser & grüne Wiesen!) float marsR = map(floraPct, 0, 100, 130, 34); float marsG = map(floraPct, 0, 100, 44, 135); float marsB = map(waterPct, 0, 100, 28, 72); fill(marsR, marsG, marsB); rect(0, 535, width, 70); if (waterPct > 5.0) { fill(35, 130, 225, map(waterPct, 0, 100, 20, 150)); rect(0, 565, width, 40); } // Planetarer Zeno-Schutzschild (wenn Quadrat 2 aktiv ist) if (shieldActive) { noFill(); stroke(56, 189, 248, 130 + sin(simTime * 3.0) * 35); strokeWeight(3.0); arc(width * 0.5, 605, width - 30, 1090, PI, TWO_PI); strokeWeight(1.0); } // Sanftes Sonnensturm-Leuchten if (flareActive) { fill(255, 140, 30, shieldActive ? 14 : 36); noStroke(); rect(0, 38, width, 567); } } void drawAllNineSquares() { String[] titlesDe = { "1. DTIM-Energie-Kern", "2. Zeno-Schutzschild", "3. Meteor-Abwehrturm", "4. Dipol-Atmosphäre", "5. Wärme & Wasser", "6. Enthalpie-Flora", "7. Döner & Ayran ISRU", "8. Norn-Habitate", "9. Fraktal-Helfer-Dock" }; String[] titlesEn = { "1. DTIM Energy Core", "2. Zeno Deflector Shield", "3. Meteor Defense Tower", "4. Dipole Atmosphere", "5. Thermal & Water", "6. Enthalpy Flora", "7. Doner & Ayran ISRU", "8. Norn Habitats", "9. Fractal Helper Dock" }; String[] subDe = { "Erzeugt +Energie beim Überflug", "Schützt vor Sonnenstürmen", "Schießt langsame Meteore ab", "Baut Luftdruck (500 mbar)", "Schmilzt Polareis zu Ozeanen", "Pflanzt grüne O2-Vegetation", "Versorgt Siedler mit Nahrung", "Siedelt 60 Norn-Pioniere an", "Startet autonomen Ernte-Helfer" }; String[] subEn = { "Generates +Energy on flyover", "Protects against solar flares", "Intercepts slow meteors", "Builds air pressure (500 mbar)", "Melts polar ice into oceans", "Grows green O2 vegetation", "Supplies settlers with food", "Settles 60 Norn pioneers", "Launches autonomous harvester" }; for (int i = 0; i < 9; i++) { float x = padX[i]; float y = padY[i]; float pct = padProgress[i]; boolean done = (pct >= 100.0); boolean shipOver = isPointInPad(shipX, shipY, i); // Rahmenfarbe je nach Rolle (Energie/Schutz = Nachtblau, Atmosphäre/Flora = Smaragd, Versorgung = Blutrot/Gold) int baseBg = color(16, 21, 34, 232); int borderCol = color(59, 110, 194); if (i == 1 || i == 2) borderCol = color(56, 189, 248); if (i >= 3 && i <= 5) borderCol = color(45, 210, 145); if (i >= 6) borderCol = color(225, 55, 85); if (done) { baseBg = color(16, 46, 36, 235); borderCol = color(80, 245, 175); } if (shipOver) { baseBg = color(26, 36, 58, 245); } if (a11yTheme == 2) { fill(0); stroke(done ? color(0, 255, 255) : color(255, 255, 0)); } else { fill(baseBg); stroke(borderCol); } strokeWeight(shipOver ? 2.5 : 1.5); rect(x, y, PAD_W, PAD_H, 8); strokeWeight(1.0); // Titel fill(255); textSize(12); textAlign(CENTER, TOP); text(tr(titlesDe[i], titlesEn[i]), x + PAD_W * 0.5, y + 10); // Beschreibung fill(215, 228, 248); textSize(10); text(tr(subDe[i], subEn[i]), x + PAD_W * 0.5, y + 32); // Fortschrittsbalken fill(10, 14, 22); noStroke(); rect(x + 14, y + 58, PAD_W - 28, 14, 4); fill(done ? color(45, 225, 145) : borderCol); rect(x + 14, y + 58, map(pct, 0, 100, 0, PAD_W - 28), 14, 4); // Statuszeile unten im Quadrat fill(255); textSize(11); textAlign(CENTER, CENTER); String stateLbl = int(pct) + "%"; if (i == 0) stateLbl = tr("Energie-Quelle (", "Energy Source (") + int(pct) + "%)"; else if (i == 1) stateLbl = shieldActive ? tr("SCHILD AKTIV (", "SHIELD ON (") + int(pct) + "%)" : int(pct) + "%"; else if (i == 2) stateLbl = defenseActive ? tr("ABWEHR AKTIV (", "DEFENSE ON (") + int(pct) + "%)" : int(pct) + "%"; else if (i == 7) stateLbl = nornSettlers + " / 60 Norns (" + int(pct) + "%)"; else if (done) stateLbl = tr("FERTIG (100%)", "COMPLETE (100%)"); text(stateLbl, x + PAD_W * 0.5, y + 90); } } boolean isPointInPad(float px, float py, int idx) { return (px >= padX[idx] && px <= padX[idx] + PAD_W && py >= padY[idx] && py <= padY[idx] + PAD_H); } void processSquarePads() { // 1. Passive Energie-Erzeugung durch ausgebauten Energie-Kern (Quadrat 0) if (frameCount % 15 == 0) { float regen = 0.6 + (padProgress[0] / 100.0) * 1.8; dtimEnergy = min(maxDtimEnergy, dtimEnergy + regen); } // 2. Norn-Siedler wachsen gemütlich nach, sobald ISRU (6) und Habitate (7) gebaut werden if (frameCount % 30 == 0 && padProgress[6] >= 30.0 && padProgress[7] >= 20.0) { int targetSettlers = int((padProgress[7] / 100.0) * 60.0); if (nornSettlers < targetSettlers) { nornSettlers++; } } // 3. Überflug über ein Quadrat baut es gemütlich Stück für Stück aus! for (int i = 0; i < 9; i++) { if (isPointInPad(shipX, shipY, i)) { if (i == 0) { // Energie-Kern: lädt beim Überfliegen zügig DTIM-Energie auf & baut den Kern aus if (frameCount % 4 == 0) { dtimEnergy = min(maxDtimEnergy, dtimEnergy + 2.5); if (padProgress[0] < 100.0) padProgress[0] = min(100.0, padProgress[0] + 0.55); } } else { advanceSquareBuild(i, 0.42); } } } } void advanceSquareBuild(int idx, float stepAmt) { if (padProgress[idx] >= 100.0) return; float cost = stepAmt * 0.65; if (dtimEnergy < cost) return; dtimEnergy -= cost; float prev = padProgress[idx]; padProgress[idx] = min(100.0, padProgress[idx] + stepAmt); // Meilensteine beim Ausbau freischalten if (idx == 1 && padProgress[1] >= 25.0 && !shieldActive) { shieldActive = true; addFloatingNote(padX[1] + PAD_W * 0.5, padY[1], tr("Zeno-Schutzschild AKTIV!", "Zeno Shield ACTIVE!"), color(56, 189, 248)); } if (idx == 2 && padProgress[2] >= 25.0 && !defenseActive) { defenseActive = true; addFloatingNote(padX[2] + PAD_W * 0.5, padY[2], tr("Meteor-Abwehr BEREIT!", "Meteor Defense READY!"), color(56, 189, 248)); } if (idx == 8 && padProgress[8] >= 40.0 && !fractalHelperActive) { fractalHelperActive = true; addFloatingNote(padX[8] + PAD_W * 0.5, padY[8], tr("Fraktal-Helfer gestartet!", "Fractal Helper launched!"), color(0, 255, 180)); } if (prev < 100.0 && padProgress[idx] >= 100.0) { addFloatingNote(padX[idx] + PAD_W * 0.5, padY[idx], tr("QUADRAT 100% AUSGEBAUT!", "SQUARE 100% BUILT!"), color(80, 245, 175)); } } void updateNornShipMotion() { float maxSpd = 3.6; if (drivesActive) { if (keyW || keyS || keyA || keyD) { mouseFollow = false; if (keyW) shipVY -= 0.22; if (keyS) shipVY += 0.22; if (keyA) shipVX -= 0.22; if (keyD) shipVX += 0.22; if (abs(shipVX) > 0.05 || abs(shipVY) > 0.05) { shipAngle = atan2(shipVY, shipVX); } } else if (mouseFollow && mouseY > 42 && mouseY < 600) { float dx = mouseX - shipX; float dy = mouseY - shipY; float d = sqrt(dx * dx + dy * dy); if (d > 14.0) { float targetA = atan2(dy, dx); float diff = atan2(sin(targetA - shipAngle), cos(targetA - shipAngle)); shipAngle += diff * 0.14; float throttle = constrain((d - 14.0) / 130.0, 0.0, 1.0) * 0.20; shipVX += cos(shipAngle) * throttle; shipVY += sin(shipAngle) * throttle; } } shipVX *= 0.93; shipVY *= 0.93; } else { shipVX *= 0.85; shipVY *= 0.85; } float sp = sqrt(shipVX * shipVX + shipVY * shipVY); if (sp > maxSpd) { shipVX = (shipVX / sp) * maxSpd; shipVY = (shipVY / sp) * maxSpd; } shipX = constrain(shipX + shipVX, 40, width - 40); shipY = constrain(shipY + shipVY, 55, 585); } void updateFractalHelperDrone() { if (!fractalHelperActive) return; droneAngle += 0.07; // Sucht den nächsten schwebenden Energie-Orb und sammelt ihn gemütlich ein EnergyOrb bestOrb = null; float bestD = 9999.0; for (int i = 0; i < energyOrbs.size(); i++) { EnergyOrb o = (EnergyOrb) energyOrbs.get(i); float d = dist(droneX, droneY, o.x, o.y); if (d < bestD) { bestD = d; bestOrb = o; } } if (bestOrb != null) { droneX = lerp(droneX, bestOrb.x, 0.035); droneY = lerp(droneY, bestOrb.y, 0.035); } // Hilft außerdem sanft beim Ausbau eines unfertigen Quadrats mit if (frameCount % 25 == 0) { for (int i = 0; i < 9; i++) { if (padProgress[i] < 100.0) { padProgress[i] = min(100.0, padProgress[i] + 0.35); break; } } } } void updateCozyMarsDynamics() { // 1. Schwebende Energie-Orbs einsammeln for (int i = 0; i < energyOrbs.size(); i++) { EnergyOrb o = (EnergyOrb) energyOrbs.get(i); o.x += cos(simTime + o.phase) * 0.35; o.y += sin(simTime * 0.8 + o.phase) * 0.35; boolean picked = (dist(shipX, shipY, o.x, o.y) < 34.0); if (fractalHelperActive && dist(droneX, droneY, o.x, o.y) < 28.0) picked = true; if (picked) { dtimEnergy = min(maxDtimEnergy, dtimEnergy + 18.0); addFloatingNote(o.x, o.y, "+18 DTIM", color(0, 255, 180)); o.x = random(90, width - 90); o.y = random(75, 560); } } // 2. Gemütliche Dynamik (gelegentlicher Sonnensturm oder langsamer Meteor — nie hektisch) if (!flareWarning && !flareActive && !meteorActive) { eventCooldown -= 1.0; if (eventCooldown <= 0.0) { eventCooldown = 960.0; if (random(1.0) < 0.5) { flareWarning = true; eventTimer = 240; statusLine = tr( "Sanfter Sonnenwind im Anflug! Schutzschild-Quadrat (2) schirmt die Basis ab.", "Gentle solar wind approaching! Shield Square (2) protects the base." ); } else { meteorActive = true; meteorX = random(180, width - 180); meteorY = 46.0; meteorVX = random(-0.22, 0.22); meteorVY = 0.40; meteorHP = 100.0; statusLine = tr( "Langsamer Eis-Meteor gesichtet! Abwehrturm (3) oder Klick zerlegt ihn in Wasser & Energie.", "Slow ice meteor spotted! Defense Tower (3) or clicking breaks it into Water & Energy." ); } } } if (flareWarning) { eventTimer--; if (eventTimer <= 0) { flareWarning = false; flareActive = true; eventTimer = 240; } } if (flareActive) { eventTimer--; if (!shieldActive && frameCount % 25 == 0) { dtimEnergy = max(10.0, dtimEnergy - 3.0); } if (eventTimer <= 0) { flareActive = false; } } if (meteorActive) { meteorX += meteorVX; meteorY += meteorVY; // Automatische Laser-Abwehr durch Quadrat 3 if (defenseActive && frameCount % 18 == 0 && dtimEnergy >= 2.0) { dtimEnergy -= 1.5; meteorHP -= 22.0; defenseLasers.add(new LaserBeam(padX[2] + PAD_W * 0.5, padY[2] + PAD_H * 0.5, meteorX, meteorY)); } if (meteorHP <= 0.0) { meteorActive = false; dtimEnergy = min(maxDtimEnergy, dtimEnergy + 30.0); padProgress[4] = min(100.0, padProgress[4] + 6.0); addFloatingNote(meteorX, meteorY, tr("+30 Energie & +6% Wasser!", "+30 Energy & +6% Water!"), color(56, 189, 248)); } else if (meteorY > 540.0) { meteorActive = false; if (!shieldActive) { padProgress[5] = max(0.0, padProgress[5] - 4.0); } addFloatingNote(meteorX, 535.0, tr("Meteor gelandet", "Meteor landed"), color(255, 190, 80)); } } for (int i = defenseLasers.size() - 1; i >= 0; i--) { LaserBeam lb = (LaserBeam) defenseLasers.get(i); lb.life--; if (lb.life <= 0) defenseLasers.remove(i); } for (int i = floatingNotes.size() - 1; i >= 0; i--) { FloatingNote fn = (FloatingNote) floatingNotes.get(i); fn.y -= 0.6; fn.life -= 3; if (fn.life <= 0) floatingNotes.remove(i); } } void drawOrbsAndEvents() { for (int i = 0; i < energyOrbs.size(); i++) { EnergyOrb o = (EnergyOrb) energyOrbs.get(i); noStroke(); fill(0, 255, 180, 65); ellipse(o.x, o.y, 22, 22); fill(0, 255, 180); ellipse(o.x, o.y, 10, 10); } for (int i = 0; i < defenseLasers.size(); i++) { LaserBeam lb = (LaserBeam) defenseLasers.get(i); stroke(56, 189, 248); strokeWeight(2.5); line(lb.x1, lb.y1, lb.x2, lb.y2); strokeWeight(1.0); } if (meteorActive) { fill(140, 85, 65); stroke(255, 175, 95); strokeWeight(2.0); ellipse(meteorX, meteorY, 44, 44); strokeWeight(1.0); fill(255); textSize(10); textAlign(CENTER, CENTER); text(int(meteorHP) + "%", meteorX, meteorY); } } void drawFractalDrone() { if (!fractalHelperActive) return; pushMatrix(); translate(droneX, droneY); rotate(droneAngle); noFill(); stroke(0, 255, 180); strokeWeight(1.5); for (int k = 0; k < 3; k++) { rotate(TWO_PI / 3.0); triangle(0, -12, -9, 8, 9, 8); } strokeWeight(1.0); popMatrix(); } void drawNornShip() { pushMatrix(); translate(shipX, shipY); rotate(shipAngle); if (drivesActive) { stroke(0, 255, 180); strokeWeight(2.0); fill(18, 28, 45); ellipse(-18, 0, 12, 34); } else { stroke(80, 95, 120); fill(14, 18, 28); ellipse(-18, 0, 12, 34); } fill(235, 240, 250); stroke(45, 210, 145); strokeWeight(1.5); beginShape(); vertex(-20, -8); vertex(16, -6); vertex(42, 0); vertex(16, 6); vertex(-20, 8); vertex(-11, 0); endShape(CLOSE); fill(235, 185, 110); noStroke(); ellipse(-2, 0, 8, 6); strokeWeight(1.0); popMatrix(); } void drawFloatingNotes() { for (int i = 0; i < floatingNotes.size(); i++) { FloatingNote fn = (FloatingNote) floatingNotes.get(i); fill(red(fn.col), green(fn.col), blue(fn.col), fn.life); textSize(12); textAlign(CENTER, CENTER); text(fn.txt, fn.x, fn.y); } } void drawPhase1BottomHUD() { int hy = 605; fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, hy, width, height - hy); stroke(getUiPalette(a11yTheme, 4)); line(0, hy, width, hy); fill(255); textSize(12); textAlign(LEFT, TOP); String driveTxt = drivesActive ? tr("Antrieb: AN [Space]", "Drives: ON [Space]") : tr("Antrieb: AUS [Space]", "Drives: OFF [Space]"); text(driveTxt + " | " + tr("Atmosphäre: ", "Atmosphere: ") + int(padProgress[3]) + "% | " + tr("Wasser: ", "Water: ") + int(padProgress[4]) + "% | " + tr("Flora: ", "Flora: ") + int(padProgress[5]) + "% | " + tr("Versorgung: ", "Supply: ") + int(padProgress[6]) + "% | " + tr("Siedler: ", "Settlers: ") + nornSettlers + "/60", 18, hy + 12); fill(255, 220, 85); textSize(12); text(statusLine, 18, hy + 42); fill(195, 210, 235); textSize(11); text(tr("Tipp: Fliege gemütlich über die Quadrate (oder klicke darauf), bis alle 9 Quadrate auf 100% stehen — dann entsteht die Norn-Heimatwelt!", "Tip: Fly casually over the squares (or click them) until all 9 squares reach 100% — founding the Norn Homeworld!"), 18, hy + 72); } int getAverageBaseCompletion() { float sum = 0.0; for (int i = 0; i < 9; i++) sum += padProgress[i]; return int(sum / 9.0); } boolean isHomeworldComplete() { for (int i = 0; i < 9; i++) { if (padProgress[i] < 100.0) return false; } return true; } // ============================================================================================== // SIEGES-MELDUNG BEI ABSCHLUSS DER BASIS ("DIE NORN HABEN IHRE ERSTE HEIMATWELT") // ============================================================================================== void drawHomeworldVictoryModal() { fill(4, 5, 12, 220); noStroke(); rect(0, 38, width, height - 38); int mx = 210; int my = 155; int mw = width - 420; int mh = 370; fill(getUiPalette(a11yTheme, 1)); stroke(color(80, 245, 175)); strokeWeight(2.5); rect(mx, my, mw, mh, 10); strokeWeight(1.0); fill(color(20, 125, 75)); noStroke(); rect(mx + 1, my + 1, mw - 2, 52, 9); fill(255); textSize(19); textAlign(CENTER, CENTER); text(tr("DIE NORN HABEN IHRE ERSTE HEIMATWELT!", "THE NORNS HAVE FOUNDED THEIR FIRST HOMEWORLD!"), width * 0.5, my + 27); fill(240, 246, 255); textSize(14); textAlign(CENTER, TOP); text(tr("Atmosphäre, Zeno-Schutzschild, Meteor-Abwehr und Döner/Ayran-Versorgung\n" + "sind vollständig errichtet. Aus der Mars-Aufbaubasis wird nun eure\n" + "lebendige 0-Klick-Heimatwelt (DTIM-ZEC ZeroClick Farm & Space)!\n\n" + "Bewege einfach die Maus über Felder, Ställe, Mühle, Bäckerei und\n" + "den Orbit-Sektor — ganz ohne Klicken!", "Atmosphere, Zeno Shield, Meteor Defense, and Doner/Ayran Supply\n" + "are fully established. Your Mars construction base now transforms into\n" + "your living 0-Click Homeworld (DTIM-ZEC ZeroClick Farm & Space)!\n\n" + "Simply move your mouse over fields, stables, mill, bakery, and\n" + "the orbital sector — completely zero-click!"), mx + 30, my + 74, mw - 60, 200); drawNavBtn(int(width * 0.5 - 190), my + 292, 380, 48, tr("HEIMATWELT-BASIS BETRETEN (0-KLICK) ▶", "ENTER HOMEWORLD BASE (0-CLICK) ▶"), getUiPalette(a11yTheme, 2)); } // ============================================================================================== // PHASE 2: TRANSFORMIERTE NORN-HEIMATWELT (DTIM_ZEC_ZeroClick_Farm_Space MODUS) // ============================================================================================== void drawNornHomeworldFarmPhase() { // Wiesen- & Orbit-Hintergrund der neuen Norn-Heimatwelt fill(16, 44, 34); noStroke(); rect(0, 38, width, 567); // Orbit-Himmel oben (y: 38..175) fill(8, 14, 28); rect(0, 38, width, 138); stroke(56, 189, 248); line(0, 176, width, 176); // Figur folgt der Maus ganz entspannt (0-Klick-Prinzip) if (mouseY > 42 && mouseY < 600) { float dx = mouseX - shipX; float dy = mouseY - shipY; if (sqrt(dx * dx + dy * dy) > 6.0) { shipX = lerp(shipX, mouseX, 0.08); shipY = lerp(shipY, mouseY, 0.08); walkPhase += 0.22; } } // Orbit-Drohne & 0-Klick-Laser / Traktorstrahl oben orbitDroneX = width * 0.5 + sin(simTime * 1.1) * 360.0; orbitDroneY = 106.0; fill(orbitHostile ? color(220, 42, 74) : color(58, 135, 255)); stroke(255); rect(orbitDroneX - 28, orbitDroneY - 16, 56, 32, 6); fill(255); textSize(10); textAlign(CENTER, CENTER); text(orbitHostile ? "ORBIT:" + int(orbitDroneHP) + "%" : "CHARGO", orbitDroneX, orbitDroneY); if (dist(mouseX, mouseY, orbitDroneX, orbitDroneY) < 55.0) { if (orbitHostile && orbitForce > 0) { stroke(65, 145, 255); strokeWeight(2.5); line(shipX, shipY - 14, orbitDroneX, orbitDroneY); strokeWeight(1.0); orbitDroneHP -= 1.4; if (frameCount % 18 == 0) orbitForce = max(0, orbitForce - 1); if (orbitDroneHP <= 0.0) { orbitHostile = false; orbitDroneHP = 100.0; geld += 35; statusLine = tr("Orbit-Drohne gesichert (+35 EUR)! Halte Maus darauf für Traktor-Aufladung.", "Orbital drone secured (+35 EUR)! Hover to recharge via tractor beam."); } } else if (!orbitHostile) { stroke(0, 255, 180); strokeWeight(2.5); line(shipX, shipY - 14, orbitDroneX, orbitDroneY); strokeWeight(1.0); orbitForce = min(orbitChargo, orbitForce + 1); if (orbitForce >= orbitChargo) { orbitHostile = true; orbitLevel++; orbitChargo += 10; } } } // Die 8 Heimatwelt-Quadrate (0-Klick Farm & Manufaktur) drawHomeworldSquare(60, 200, 220, 105, kornGrow > 0 ? color(175, 155, 35) : color(95, 68, 35), tr("Korn-Feld (" + int(kornGrow) + "%)", "Grain Field (" + int(kornGrow) + "%)"), tr("0-Klick: Sät & erntet Korn + Stroh", "0-Click: Sows & harvests Grain + Straw")); drawHomeworldSquare(310, 200, 220, 105, tomGrow > 0 ? color(185, 45, 55) : color(95, 68, 35), tr("Tomaten-Feld (" + int(tomGrow) + "%)", "Tomato Field (" + int(tomGrow) + "%)"), tr("0-Klick: Sät & erntet Tomaten + Stroh", "0-Click: Sows & harvests Tomatoes + Straw")); drawHomeworldSquare(560, 200, 220, 105, color(18, 75, 155), tr("Heimatwelt-Brunnen (" + wasser + ")", "Homeworld Well (" + wasser + ")"), tr("0-Klick: Schöpft frisches Wasser", "0-Click: Draws fresh water")); drawHomeworldSquare(810, 200, 250, 105, stallBuilt ? color(30, 115, 70) : color(35, 45, 65), stallBuilt ? tr("Norn-Kuhstall (" + int(stallWork) + "%)", "Norn Barn (" + int(stallWork) + "%)") : tr("Kuhstall bauen (15 EUR)", "Build Barn (15 EUR)"), tr("2 Korn + 4 Stroh -> 4 Milch", "2 Grain + 4 Straw -> 4 Milk")); drawHomeworldSquare(60, 340, 220, 105, kaeseBuilt ? color(175, 135, 25) : color(35, 45, 65), kaeseBuilt ? tr("Käserei (" + int(kaeseWork) + "%)", "Creamery (" + int(kaeseWork) + "%)") : tr("Käserei bauen (30 EUR)", "Build Creamery (30 EUR)"), tr("4 Milch -> 2 Käse", "4 Milk -> 2 Cheese")); drawHomeworldSquare(310, 340, 220, 105, muehleBuilt ? color(135, 95, 45) : color(35, 45, 65), muehleBuilt ? tr("Getreide-Mühle (" + int(muehleWork) + "%)", "Grain Mill (" + int(muehleWork) + "%)") : tr("Mühle bauen (25 EUR)", "Build Mill (25 EUR)"), tr("4 Korn -> 3 Mehl", "4 Grain -> 3 Flour")); drawHomeworldSquare(560, 340, 220, 105, color(165, 35, 55), tr("Pizza-Manufaktur (" + int(pizzaWork) + "%)", "Pizza Manufactory (" + int(pizzaWork) + "%)"), tr("Mehl + Käse + Tomate -> Pizza", "Flour + Cheese + Tomato -> Pizza")); drawHomeworldSquare(810, 340, 250, 105, color(122, 16, 38), tr("Heimatwelt-Markt (Shop)", "Homeworld Market (Shop)"), tr("0-Klick: Verkauft Waren für EUR", "0-Click: Sells goods for EUR")); // 0-Klick-Interaktionen auf den 8 Heimatwelt-Quadraten ausführen processHomeworldFarmSquares(); // Norn-Pionier-Figur zeichnen drawNornPioneerFigure(shipX, shipY); // Unteres Heimatwelt-HUD int hy = 605; fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, hy, width, height - hy); stroke(color(80, 245, 175)); line(0, hy, width, hy); fill(255); textSize(13); textAlign(LEFT, TOP); text(tr("HEIMATWELT-INVENTAR — Geld: " + geld + " EUR | Pizza: " + pizza + " | Käse: " + kaese + " | Mehl: " + mehl + " | Milch: " + milch, "HOMEWORLD INVENTORY — Funds: " + geld + " EUR | Pizza: " + pizza + " | Cheese: " + kaese + " | Flour: " + mehl + " | Milk: " + milch), 18, hy + 12); fill(215, 228, 248); textSize(12); text(tr("Korn: " + korn + " · Tomaten: " + tom + " · Wasser: " + wasser + " · Stroh: " + heu + " · Siedler: " + nornSettlers + " Norns", "Grain: " + korn + " · Tomatoes: " + tom + " · Water: " + wasser + " · Straw: " + heu + " · Settlers: " + nornSettlers + " Norns"), 18, hy + 40); fill(120, 255, 185); textSize(12); text(statusLine, 18, hy + 72); } void drawHomeworldSquare(float x, float y, float w, float h, int bgCol, String title, String sub) { boolean over = (shipX >= x && shipX <= x + w && shipY >= y && shipY <= y + h); fill(a11yTheme == 2 ? color(0) : bgCol); stroke(over ? color(255, 230, 80) : color(200, 220, 245)); strokeWeight(over ? 2.5 : 1.4); rect(x, y, w, h, 7); strokeWeight(1.0); fill(255); textSize(13); textAlign(CENTER, TOP); text(title, x + w * 0.5, y + 18); fill(235, 242, 255); textSize(11); text(sub, x + w * 0.5, y + 54); } boolean overBox(float x, float y, float w, float h) { return (shipX >= x && shipX <= x + w && shipY >= y && shipY <= y + h); } void processHomeworldFarmSquares() { // 1. Korn-Feld if (overBox(60, 200, 220, 105)) { if (kornGrow == 0 && korn >= 1) { korn--; kornGrow = 1.0; } else if (kornGrow > 0 && wasser >= 1) { kornGrow += 1.4; if (kornGrow >= 100.0) { kornGrow = 0.0; wasser--; korn += 4; heu += 4; statusLine = tr("Korn-Ernte: +4 Korn & +4 Stroh!", "Grain harvest: +4 Grain & +4 Straw!"); } } } // 2. Tomaten-Feld if (overBox(310, 200, 220, 105)) { if (tomGrow == 0 && tom >= 1) { tom--; tomGrow = 1.0; } else if (tomGrow > 0 && wasser >= 1) { tomGrow += 1.4; if (tomGrow >= 100.0) { tomGrow = 0.0; wasser--; tom += 4; heu += 2; statusLine = tr("Tomaten-Ernte: +4 Tomaten & +2 Stroh!", "Tomato harvest: +4 Tomatoes & +2 Straw!"); } } } // 3. Brunnen if (overBox(560, 200, 220, 105) && frameCount % 20 == 0 && wasser < 12) { wasser++; statusLine = tr("Brunnen: Frisches Wasser geschöpft (" + wasser + ").", "Well: Fresh water drawn (" + wasser + ")."); } // 4. Kuhstall if (overBox(810, 200, 250, 105)) { if (!stallBuilt && geld >= 15) { geld -= 15; stallBuilt = true; statusLine = tr("Norn-Kuhstall errichtet!", "Norn Barn built!"); } else if (stallBuilt && korn >= 2 && heu >= 4) { stallWork += 1.6; if (stallWork >= 100.0) { stallWork = 0.0; korn -= 2; heu -= 4; milch += 4; statusLine = tr("+4 frische Milch produziert!", "+4 fresh Milk produced!"); } } } // 5. Käserei if (overBox(60, 340, 220, 105)) { if (!kaeseBuilt && geld >= 30) { geld -= 30; kaeseBuilt = true; statusLine = tr("Käserei errichtet!", "Creamery built!"); } else if (kaeseBuilt && milch >= 4) { kaeseWork += 1.6; if (kaeseWork >= 100.0) { kaeseWork = 0.0; milch -= 4; kaese += 2; statusLine = tr("+2 Käse gereift!", "+2 Cheese aged!"); } } } // 6. Mühle if (overBox(310, 340, 220, 105)) { if (!muehleBuilt && geld >= 25) { geld -= 25; muehleBuilt = true; statusLine = tr("Getreide-Mühle errichtet!", "Grain Mill built!"); } else if (muehleBuilt && korn >= 4) { muehleWork += 1.6; if (muehleWork >= 100.0) { muehleWork = 0.0; korn -= 4; mehl += 3; statusLine = tr("+3 Sack Mehl gemahlen!", "+3 sacks of Flour milled!"); } } } // 7. Pizza-Manufaktur if (overBox(560, 340, 220, 105) && mehl >= 1 && kaese >= 1 && tom >= 1) { pizzaWork += 2.0; if (pizzaWork >= 100.0) { pizzaWork = 0.0; mehl--; kaese--; tom--; pizza++; statusLine = tr("Heimatwelt-Pizza gebacken!", "Homeworld Pizza baked!"); } } // 8. Markt-Shop if (overBox(810, 340, 250, 105)) { int earned = 0; if (pizza > 0) { earned += pizza * 30; pizza = 0; } if (kaese > 0) { earned += kaese * 14; kaese = 0; } if (mehl > 0) { earned += mehl * 6; mehl = 0; } if (milch > 0) { earned += milch * 5; milch = 0; } if (korn > 4) { int sk = korn - 3; earned += sk * 2; korn = 3; } if (tom > 4) { int st = tom - 3; earned += st * 2; tom = 3; } if (earned > 0) { geld += earned; statusLine = tr("Markt-Verkauf: +" + earned + " EUR auf der ersten Norn-Heimatwelt!", "Market sale: +" + earned + " EUR on the first Norn Homeworld!"); } } } void drawNornPioneerFigure(float cx, float cy) { float sw = sin(walkPhase) * 10.0; stroke(255); strokeWeight(2.2); // Norn-Kopf & Ohren fill(235, 185, 110); triangle(cx - 10, cy - 30, cx - 18, cy - 42, cx - 4, cy - 34); triangle(cx + 10, cy - 30, cx + 18, cy - 42, cx + 4, cy - 34); ellipse(cx, cy - 24, 24, 22); // Körper, Arme & Beine line(cx, cy - 13, cx, cy + 16); line(cx, cy - 6, cx - 14, cy + 8 + sw); line(cx, cy - 6, cx + 14, cy + 8 - sw); line(cx, cy + 16, cx - 10, cy + 38 - sw); line(cx, cy + 16, cx + 10, cy + 38 + sw); strokeWeight(1.0); } // ============================================================================================== // SPEICHERN & LADEN [K] / [O] // ============================================================================================== void saveMarsHomeworldState() { String pStr = ""; for (int i = 0; i < 9; i++) { if (i > 0) pStr = pStr + ","; pStr = pStr + nf(padProgress[i], 1, 1); } String state = gamePhase + "|" + nf(shipX, 1, 1) + "," + nf(shipY, 1, 1) + "," + nf(dtimEnergy, 1, 1) + "," + nornSettlers + "," + (shieldActive ? 1 : 0) + "," + (defenseActive ? 1 : 0) + "," + (fractalHelperActive ? 1 : 0) + "|" + pStr + "|" + geld + "," + korn + "," + tom + "," + wasser + "," + heu + "," + milch + "," + kaese + "," + mehl + "," + pizza; quickSaveSlot = state; try { String[] lines = new String[1]; lines[0] = state; saveStrings("norn_mars_homeworld.txt", lines); } catch (Exception e) { } statusLine = tr("Spielstand gespeichert! [Laden / O] stellt ihn jederzeit wieder her.", "Game saved! Press [Load / O] anytime to restore."); } void loadMarsHomeworldState() { String raw = quickSaveSlot; if (raw.length() < 15) { try { String[] lines = loadStrings("norn_mars_homeworld.txt"); if (lines != null && lines.length > 0) raw = lines[0]; } catch (Exception e) { } } if (raw.length() < 15) { statusLine = tr("Noch kein gespeicherter Spielstand vorhanden.", "No saved game found yet."); return; } String[] parts = split(raw, '|'); if (parts == null || parts.length < 4) return; gamePhase = int(parts[0]); String[] a = split(parts[1], ','); shipX = float(a[0]); shipY = float(a[1]); dtimEnergy = float(a[2]); nornSettlers = int(a[3]); shieldActive = (int(a[4]) == 1); defenseActive = (int(a[5]) == 1); fractalHelperActive = (int(a[6]) == 1); String[] b = split(parts[2], ','); for (int i = 0; i < 9 && i < b.length; i++) padProgress[i] = float(b[i]); String[] c = split(parts[3], ','); geld = int(c[0]); korn = int(c[1]); tom = int(c[2]); wasser = int(c[3]); heu = int(c[4]); milch = int(c[5]); kaese = int(c[6]); mehl = int(c[7]); pizza = int(c[8]); statusLine = tr("Spielstand erfolgreich geladen!", "Savegame loaded successfully!"); } // ============================================================================================== // HILFSKLASSEN & EINGABEN // ============================================================================================== class EnergyOrb { float x, y, phase; EnergyOrb(float ox, float oy) { x = ox; y = oy; phase = random(TWO_PI); } } class LaserBeam { float x1, y1, x2, y2; int life; LaserBeam(float ax, float ay, float bx, float by) { x1 = ax; y1 = ay; x2 = bx; y2 = by; life = 12; } } class FloatingNote { float x, y; String txt; int col, life; FloatingNote(float fx, float fy, String t, int c) { x = fx; y = fy; txt = t; col = c; life = 255; } } void addFloatingNote(float x, float y, String txt, int col) { floatingNotes.add(new FloatingNote(x, y, txt, col)); } void mouseMoved() { if (gamePhase == 0 && mouseY > 38 && mouseY < 605) mouseFollow = true; } void mousePressed() { // 1. Top-Leiste (y: 0..38) if (mouseY <= 38) { if (mouseX >= 740 && mouseX <= 826) { saveMarsHomeworldState(); return; } if (mouseX >= 831 && mouseX <= 905) { loadMarsHomeworldState(); return; } if (mouseX >= 912 && mouseX <= 974) { langMode = (langMode + 1) % 2; return; } if (mouseX >= 980 && mouseX <= 1110) { a11yTheme = (a11yTheme + 1) % 3; return; } return; } // 2. Sieges-Dialog: Übergang zur Norn-Heimatwelt if (gamePhase == 1) { if (mouseX >= width * 0.5 - 190 && mouseX <= width * 0.5 + 190 && mouseY >= 447 && mouseY <= 495) { gamePhase = 2; statusLine = tr( "Willkommen auf der ersten Norn-Heimatwelt! Bewege einfach die Maus über Felder, Gebäude & Orbit (0-Klick).", "Welcome to the first Norn Homeworld! Simply move your mouse over fields, buildings & orbit (0-Click)." ); } return; } // 3. Phase 1: Direkter Klick auf Meteor oder auf eines der 9 Aufbau-Quadrate if (gamePhase == 0) { if (meteorActive && dist(mouseX, mouseY, meteorX, meteorY) < 38.0) { meteorHP -= 35.0; defenseLasers.add(new LaserBeam(shipX, shipY, meteorX, meteorY)); return; } for (int i = 0; i < 9; i++) { if (isPointInPad(mouseX, mouseY, i)) { if (i == 0) { dtimEnergy = min(maxDtimEnergy, dtimEnergy + 15.0); padProgress[0] = min(100.0, padProgress[0] + 6.0); } else { advanceSquareBuild(i, 8.0); } return; } } } } void keyPressed() { if (key == ' ') { drivesActive = !drivesActive; return; } if (key == 'k' || key == 'K') saveMarsHomeworldState(); if (key == 'o' || key == 'O') loadMarsHomeworldState(); if (key == 'l' || key == 'L') langMode = (langMode + 1) % 2; if (key == 'h' || key == 'H') a11yTheme = (a11yTheme + 1) % 3; if (key == 'w' || key == 'W') keyW = true; if (key == 's' || key == 'S') keyS = true; if (key == 'a' || key == 'A') keyA = true; if (key == 'd' || key == 'D') keyD = true; if (key == CODED) { if (keyCode == UP) keyW = true; if (keyCode == DOWN) keyS = true; if (keyCode == LEFT) keyA = true; if (keyCode == RIGHT) keyD = true; } } void keyReleased() { if (key == 'w' || key == 'W') keyW = false; if (key == 's' || key == 'S') keyS = false; if (key == 'a' || key == 'A') keyA = false; if (key == 'd' || key == 'D') keyD = false; if (key == CODED) { if (keyCode == UP) keyW = false; if (keyCode == DOWN) keyS = false; if (keyCode == LEFT) keyA = false; if (keyCode == RIGHT) keyD = false; } }