// ========================================================== // TLW-Modell: Mars-Kolonisations-Demo & Idle-Prototyp // Website: jan-buehring.de | Hard Sci-Fi Story-Simulation // ========================================================== float shipX, shipY; float velocityX = 0, velocityY = 0; float tlwEnergy = 30.0; float maxEnergy = 150.0; // Idle-Lade-Tool (erwerbbar für 50 Energie) boolean hasIdleCharger = false; int chargerLevel = 0; // Kolonisations-Fortschritt & Story-Events int storyStep = 0; // 0: Start, 1: Reaktor, 2: Schild, 3: ISRU, 4: Fertig boolean coreActive = false; boolean shieldActive = false; boolean isruActive = false; // Story Pop-Up Textsteuerung String activePopupTitle = ""; String activePopupText = ""; boolean showPopup = false; int popupTimer = 0; ArrayList tokens; ArrayList exhaust; void setup() { size(900, 680); shipX = width / 2; shipY = (height - 120) / 2; tokens = new ArrayList(); exhaust = new ArrayList(); // Start-Ionen im Raum verteilen for (int i = 0; i < 6; i++) { tokens.add(new TLWToken(random(50, width-50), random(50, height-170))); } triggerStory("MISSION START", "Willkommen im TLW-Universum! Sammle blaue Raum-Ionen ein, um Energie zu gewinnen. Kaufe dir bald das automatische Ladetool, um ins Idle-Gameplay zu wechseln!"); } void draw() { background(10, 12, 22); // 1. Hintergrund & Mars-Oberfläche drawTLWBackground(); // 2. Idle-Lade-Mechanik (Automatisches Laden nach Kauf) if (hasIdleCharger) { if (frameCount % 15 == 0 && tlwEnergy < maxEnergy) { tlwEnergy += 0.8 + (chargerLevel * 0.5); // Langsames automatisches Laden } } // 3. Physik & Schiff updateShip(); // 4. Token verwalten manageTokens(); // 5. Partikel updateParticles(); // 6. Schiff rendern drawShip(); // 7. Dashboard, Upgrades & Story Pop-Ups drawHUD(); drawStoryPopup(); } void updateShip() { float targetX = mouseX; float targetY = mouseY; float dx = targetX - shipX; float dy = targetY - shipY; if (mousePressed && mouseY < height - 120 && tlwEnergy > 0.2) { velocityX += dx * 0.005; velocityY += dy * 0.005; tlwEnergy -= 0.12; if (frameCount % 3 == 0) { exhaust.add(new Particle(shipX, shipY, -velocityX * 0.5, -velocityY * 0.5)); } } velocityX *= 0.94; velocityY *= 0.94; shipX += velocityX; shipY += velocityY; shipX = constrain(shipX, 30, width - 30); shipY = constrain(shipY, 30, height - 140); } void drawTLWBackground() { stroke(30, 50, 90, 40); strokeWeight(1); for (int x = 0; x < width; x += 50) { line(x, 0, x, height - 120); } for (int y = 0; y < height - 120; y += 50) { line(0, y, width, y); } // Marsoberfläche fill(120, 45, 25); noStroke(); rect(0, height - 120, width, 120); fill(190, 75, 40); rect(0, height - 128, width, 8); } void manageTokens() { for (int i = tokens.size() - 1; i >= 0; i--) { TLWToken t = tokens.get(i); t.display(); if (dist(shipX, shipY, t.x, t.y) < 25) { tlwEnergy = min(maxEnergy, tlwEnergy + 20.0); tokens.remove(i); tokens.add(new TLWToken(random(50, width-50), random(50, height-170))); } } } void updateParticles() { for (int i = exhaust.size() - 1; i >= 0; i--) { Particle p = exhaust.get(i); p.update(); p.display(); if (p.isDead()) { exhaust.remove(i); } } } void drawShip() { pushStyle(); pushMatrix(); translate(shipX, shipY); float angle = atan2(velocityY, velocityX) + HALF_PI; rotate(angle); fill(0, 200, 255); stroke(255); strokeWeight(1.5); triangle(0, -18, -12, 16, 12, 16); fill(255, 100, 255); ellipse(0, 2, 6, 6); popMatrix(); popStyle(); } void drawHUD() { pushStyle(); // Oberes Dashboard fill(15, 20, 35, 235); stroke(60, 110, 190); strokeWeight(2); rect(15, 15, width - 30, 95, 8); // Energieleiste fill(40); noStroke(); rect(25, 45, 180, 16, 4); float energyWidth = map(tlwEnergy, 0, maxEnergy, 0, 180); fill(255, 0, 200); rect(25, 45, energyWidth, 16, 4); fill(255); textSize(12); text("TLW-ENERGIE: " + int(tlwEnergy) + " / " + int(maxEnergy), 25, 35); if (hasIdleCharger) { fill(0, 255, 120); text("[IDLE LADETOOL AKTIV]", 215, 35); } // Upgrades & Automatisierung (Kauf-Buttons) textSize(11); fill(200, 220, 255); text("UPGRADES & MARS-MISSION:", 25, 85); // Button 1: Idle Ladetool (50 Energie) fill(hasIdleCharger ? color(0,255,100) : color(80)); rect(210, 72, 115, 26, 4); fill(0); textSize(10); text(hasIdleCharger ? "Ladetool: AN" : "Ladetool (50E)", 218, 88); // Button 2: TLW-Kern (100 Energie) fill(coreActive ? color(0,255,100) : color(80)); rect(335, 72, 110, 26, 4); fill(0); text(coreActive ? "1. TLW-Kern: OK" : "1. TLW-Kern (100E)", 343, 88); // Button 3: Schild (120 Energie) fill(shieldActive ? color(0,255,100) : color(80)); rect(455, 72, 110, 26, 4); fill(0); text(shieldActive ? "2. Schild: OK" : "2. Schild (120E)", 463, 88); // Button 4: ISRU Fabrik (150 Energie) fill(isruActive ? color(0,255,100) : color(80)); rect(575, 72, 110, 26, 4); fill(0); text(isruActive ? "3. ISRU: OK" : "3. ISRU (150E)", 583, 88); // Basis-Visualisierung auf dem Mars unten if (coreActive) { stroke(0, 255, 100); noFill(); ellipse(width/2 - 120, height - 60, 45, 45); fill(255); textSize(10); text("TLW-Kern", width/2 - 145, height - 25); } if (shieldActive) { stroke(100, 200, 255, 180); noFill(); arc(width/2, height - 60, 200, 130, PI, TWO_PI); fill(255); textSize(10); text("TLW-Schild", width/2 - 25, height - 25); } if (isruActive) { stroke(255, 180, 0); noFill(); rect(width/2 + 90, height - 85, 40, 40, 4); fill(255); textSize(10); text("ISRU-Fabrik", width/2 + 80, height - 25); } popStyle(); } void drawStoryPopup() { if (showPopup) { pushStyle(); fill(10, 15, 30, 240); stroke(0, 200, 255); strokeWeight(2); rect(width/2 - 220, height/2 - 90, 440, 150, 10); fill(0, 255, 200); textSize(14); text("📡 STORY EVENT: " + activePopupTitle, width/2 - 200, height/2 - 60); fill(255); textSize(11); text(activePopupText, width/2 - 200, height/2 - 30, 400, 80); textSize(10); fill(150, 180, 220); text("[Klicken zum Fortfahren]", width/2 - 70, height/2 + 40); popStyle(); } } void mousePressed() { if (showPopup) { showPopup = false; return; } // Kauf 1: Idle Ladetool (50 Energie) if (mouseX > 210 && mouseX < 325 && mouseY > 72 && mouseY < 98) { if (!hasIdleCharger && tlwEnergy >= 50) { tlwEnergy -= 50; hasIdleCharger = true; triggerStory("AUTOMATISIERUNG AKTIVIERT", "Das Idle-Ladetool arbeitet nun im Hintergrund. Du kannst dich zurücklehnen und zusehen, wie sich der Speicher durch Vakuum-Resonanz füllt!"); } } // Kauf 2: TLW-Kern (100 Energie) if (mouseX > 335 && mouseX < 445 && mouseY > 72 && mouseY < 98) { if (!coreActive && tlwEnergy >= 100) { tlwEnergy -= 100; coreActive = true; triggerStory("PHASE 1: TLW-KRAFTWERK", "Der TLW-Kern ist auf dem Mars gelandet. Er zapft die Vakuumenergie an und liefert unbegrenzte Leistung für die Besiedlung."); } } // Kauf 3: Schild (120 Energie) if (mouseX > 455 && mouseX < 565 && mouseY > 72 && mouseY < 98) { if (!shieldActive && tlwEnergy >= 120) { tlwEnergy -= 120; shieldActive = true; triggerStory("PHASE 2: KÜNSTLICHE MAGNETOSPHÄRE", "Ein hochenergetisches TLW-Feld spannt sich über die Kolonie. Es lenkt den solaren Wind ab und stabilisiert die Marsatmosphäre."); } } // Kauf 4: ISRU Fabrik (150 Energie) if (mouseX > 575 && mouseX < 685 && mouseY > 72 && mouseY < 98) { if (!isruActive && tlwEnergy >= 150) { tlwEnergy -= 150; isruActive = true; triggerStory("PHASE 3: TERRAFORMING ERFOLGREICH", "Autonome Raffinerien wandeln Wassereis und CO2 um. Der Mars wird bewohnbar. Die Mission ist ein historischer Meilenstein!"); } } } void triggerStory(String title, String txt) { activePopupTitle = title; activePopupText = txt; showPopup = true; } class TLWToken { float x, y; TLWToken(float px, float py) { x = px; y = py; } void display() { pushStyle(); noStroke(); fill(0, 255, 220, 210); ellipse(x, y, 12, 12); fill(255); ellipse(x, y, 5, 5); popStyle(); } } class Particle { float x, y, vx, vy, alpha; Particle(float px, float py, float dirX, float dirY) { x = px; y = py; vx = dirX + random(-0.5, 0.5); vy = dirY + random(-0.5, 0.5); alpha = 255; } void update() { x += vx; y += vy; alpha -= 18; } void display() { pushStyle(); noStroke(); fill(255, 100, 255, alpha); ellipse(x, y, 4, 4); popStyle(); } boolean isDead() { return alpha <= 0; } }