All embeded in my main window: (and i still have many more pde files in the game that's just the tip of the iceberg)
```
import processing.core.PShape;
import processing.core.PApplet;
import processing.opengl.PGraphics3D;
import processing.awt.PSurfaceAWT;
import javax.swing.JFrame;
import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.GraphicsDevice;
import java.awt.Rectangle;
import java.util.ArrayList;
import wblut.processing.WB_Render;
import wblut.hemesh.*;
BlackHole blackHole;
ArrayList<Star> objects;
ArrayList<Wormhole> wormholes; // List to hold all active wormholes
MovableResizableWindow consoleWindow;
MovableResizableHUDWindow hudWindow;
MovableResizablePrestigeWindow prestigeWindow;
MovableResizable4DShapesMenuWindow shapesMenuWindow; // Add this line for 4D shapes menu
MovableResizableSpaceCasinoWindow casinoWindow;
PGraphics slotMachineGraphics; // PGraphics for the slot machine
// Define the SlotMachine instance
SlotMachine slotMachine;
int prestigePoints = 0; // Initial prestige points
PFont gameFont; // Font for the game HUD
PFont consoleFont; // Font for the console window
PFont hudFont; // Font for the HUD window
PFont rainbowFont; // Font for Rainbow Mode text
int points = 0;
int blackHoleMass = 1;
int gravityPull = 1; // Renamed from gravityBoost
int starSpeedDisplay = 1; // Initial display value for star speed
int starMultiplier = 1; // Initial value for star multiplier
int rainbowMultiplier = 1; // Initial value for rainbow star multiplier
int wormholeMultiplier = 1; // Initial value for wormhole multiplier
int pointsMultiplier = 1; // Initial points multiplier value
int polyhedronSpawnInterval = 3600; // Interval for spawning PolyhedronStars
int lastAlienRubySpawnFrame = 0; // Last frame when an AlienRuby was spawned
int alienRubySpawnInterval = 30000; // Interval for spawning AlienRubies
int lastPolyhedronSpawnFrame = 0; // Last frame when a PolyhedronStar was spawned
int lastDataGemStarSpawnFrame = 0; // Last frame when a DataGemStar was spawned
int dataGemsCollected = 0;
int geodesicStarSpawnInterval = 220000; // Half of the Data Gem Star interval
int lastGeodesicStarSpawnFrame = 0; // Last frame when a GeodesicStar was spawned
int dwarvenGoldStarSpawnInterval = 18000; // Spawn interval for DwarvenGoldStars
int lastDwarvenGoldStarSpawnFrame = 0; // Last frame when a DwarvenGoldStar was spawned
int raresSpawnRateMultiplier = 1; // Initial multiplier value
float dataGemStarSpawnInterval = 8000; // Interval for spawning DataGemStars
color backgroundColor;
color textColor;
static float starSpeed = 0.25; // Initial slow speed of stars
static float spawnMultiplier = 1.0; // Global spawn multiplier
float starSpawnInterval = 60; // Base spawn interval for regular stars
float rainbowStarSpawnInterval; // Interval for spawning rainbow stars
float wormholeSpawnInterval = 1800; // Interval for spawning wormholes
int lastWormholeSpawnFrame = 0; // Last frame when a wormhole was spawned
final int INITIAL_BLACK_HOLE_SIZE = 50; // Initial size for the black hole
boolean pullAreaVisible = false; // Variable to track pull area visibility
boolean delayVisible = false; // Variable to track the visibility of spawn rate info
boolean showFPS = false; // Variable to track FPS display
int targetFPS = 60; // Default FPS
// Rainbow Mode variables
boolean rainbowMode = false;
int rainbowModeTimer = 0;
color[] rainbowColors = {color(255, 0, 0), color(255, 127, 0), color(255, 255, 0), color(0, 255, 0), color(0, 0, 255), color(75, 0, 130), color(148, 0, 211)};
int rainbowColorIndex = 0;
int extraStarsPerSecond = 10; // Number of extra stars to spawn per second during Rainbow Mode
int lastExtraStarSpawnFrame = 0; // Frame count of the last extra star spawn
int lastRainbowStarSpawnFrame = 0; // Frame count of the last rainbow star spawn
// Base values and scaling factors for the growth curve
int baseBlackHoleMass = 1;
int baseGravityPull = 1;
int baseStarSpeedDisplay = 1;
int baseStarMultiplier = 1;
// Maximum values
final int MAX_STAR_MULTIPLIER = 73500;
final int MAX_STAR_SPEED = 73500;
final int MAX_GRAVITY_PULL = 5400000;
final int MAX_BLACK_HOLE_MASS = 2850;
final int MAX_POINTS = 9999999;
final int MAX_RAINBOW_MULTIPLIER = MAX_STAR_MULTIPLIER; // Same max value for consistency
final int MAX_WORMHOLE_MULTIPLIER = MAX_STAR_MULTIPLIER; // Same max value for consistency
float kGrowth = 0.15; // Unified constant for balanced growth
float kGravityPull = 0.20; // Slightly higher growth rate for gravity pull
float kStarSpeed = 0.20; // Slightly higher growth rate for star speed
float kStarMultiplier = 0.20; // Slightly higher growth rate for star multiplier
// New variables for screen management
GraphicsDevice device;
JFrame frame;
Dimension prevDimension;
Rectangle bounds;
int screenMode = 0; // 0 for windowed, 1 for fullscreen
// Constant for rainbow star speed
final float RAINBOW_STAR_SPEED = 10.0; // Set this to a high value for fast movement
void settings() {
size(displayWidth, displayHeight, P3D); // Ensure P3D is used for 3D rendering
}
void setup() {
backgroundColor = color(0, 0, 0); // Background color
textColor = color(255); // Text color
gameFont = createFont("PaladinsStraight.otf", 32); // Font size for the game HUD
consoleFont = createFont("CascadiaMonoPL-Regular.otf", 16); // Font size for the console window
hudFont = createFont("syncrone.otf", 20); // Font size for the HUD window
rainbowFont = createFont("MinnePetat.ttf", 48); // Font size for Rainbow Mode text
textFont(gameFont);
// Initialize the slot machine's PGraphics
slotMachineGraphics = createGraphics(1000, 1000, P3D); // Adjust size as necessary
// Ensure to pass the MovableResizable4DShapesMenuWindow instance to the BlackHole constructor
shapesMenuWindow = new MovableResizable4DShapesMenuWindow(100, 700, 400, 300, hudFont, this); // 4D shapes menu window
blackHole = new BlackHole(width / 2, height / 2, INITIAL_BLACK_HOLE_SIZE, shapesMenuWindow); // Pass the shapesMenuWindow
objects = new ArrayList<Star>();
wormholes = new ArrayList<Wormhole>(); // Initialize wormholes list
consoleWindow = new MovableResizableWindow(100, 100, 800, 300, consoleFont, this); // Pass the console font and the current instance to the window
hudWindow = new MovableResizableHUDWindow(100, 450, 400, 300, hudFont, this); // HUD window for displaying game information
prestigeWindow = new MovableResizablePrestigeWindow(100, 300, 600, 300, hudFont, this); // Adjusted to match HUD window width
polyhedronSpawnInterval = 110000; // Adjust this value as needed
// Set the initial rainbow star spawn interval
rainbowStarSpawnInterval = starSpawnInterval * 50; // 50 times less frequent than regular stars
frameRate(targetFPS); // Set initial frame rate
// Initialize the slot machine instance
slotMachine = new SlotMachine();
PGraphics slotMachineGraphics = createGraphics(800, 300, P3D);
casinoWindow = new MovableResizableSpaceCasinoWindow(100, 100, 800, 300, hudFont, this, slotMachineGraphics);
// Initialize screen management for P3D renderer
if (surface instanceof PSurfaceAWT) {
frame = (JFrame) ((PSurfaceAWT) surface).getNative();
prevDimension = frame.getSize();
bounds = frame.getBounds();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
device = ge.getDefaultScreenDevice();
}
}
void draw() {
background(backgroundColor);
lights(); // Add this line to enable lighting
// Game logic for normal stars
if (frameCount % int(starSpawnInterval / spawnMultiplier) == 0) {
objects.add(new StarMeteor(width, random(height), SizeType.getRandomSize(this))); // Add star with random size
}
// Rainbow star spawning logic
if (frameCount - lastRainbowStarSpawnFrame >= rainbowStarSpawnInterval) {
for (int i = 0; i < rainbowMultiplier; i++) {
RainbowStar rainbowStar = new RainbowStar(width, random(height), SizeType.getRandomSize(this));
rainbowStar.setSpeed(RAINBOW_STAR_SPEED); // Set the speed for rainbow stars
objects.add(rainbowStar); // Add rainbow star with random size
}
lastRainbowStarSpawnFrame = frameCount; // Update the last spawn frame
}
// Debug print to check multiplier value
println("Rares Spawn Rate Multiplier: " + prestigeWindow.raresSpawnRateMultiplier);
float raresMultiplier = 1 + (prestigeWindow.raresSpawnRateMultiplier - 1) * 0.1;
// PolyhedronStar spawning logic
if (frameCount - lastPolyhedronSpawnFrame >= polyhedronSpawnInterval / raresMultiplier) {
objects.add(new PolyhedronStar((float) width, random(height), 100.0f));
lastPolyhedronSpawnFrame = frameCount; // Update the last spawn frame
println("PolyhedronStar spawned at frame: " + frameCount);
}
// DataGemStar spawning logic
if (frameCount - lastDataGemStarSpawnFrame >= dataGemStarSpawnInterval / raresMultiplier) {
objects.add(new DataGemStar((float) width, random(height), 75.0f));
lastDataGemStarSpawnFrame = frameCount; // Update the last spawn frame
println("DataGemStar spawned at frame: " + frameCount);
}
// DwarvenGoldStar spawning logic
if (frameCount - lastDwarvenGoldStarSpawnFrame >= dwarvenGoldStarSpawnInterval / raresMultiplier) {
DwarvenGoldStar newStar = new DwarvenGoldStar((float) width, random(height), SizeType.LARGE, this, 70.0f / 3); // Ensure size is reduced by a factor of three
objects.add(newStar);
lastDwarvenGoldStarSpawnFrame = frameCount; // Update the last spawn frame
println("DwarvenGoldStar spawned at frame: " + frameCount);
}
// GeodesicStar spawning logic
if (frameCount - lastGeodesicStarSpawnFrame >= geodesicStarSpawnInterval / raresMultiplier) {
objects.add(new GeodesicStar((float) width, random(height), SizeType.MEDIUM, this));
lastGeodesicStarSpawnFrame = frameCount; // Update the last spawn frame
println("GeodesicStar spawned at frame: " + frameCount);
}
// AlienRuby spawning logic
if (frameCount - lastAlienRubySpawnFrame >= alienRubySpawnInterval / raresMultiplier) {
objects.add(new AlienRuby(this, (float) width, random(height), SizeType.SMALL));
lastAlienRubySpawnFrame = frameCount; // Update the last spawn frame
println("AlienRuby spawned at frame: " + frameCount);
}
// Wormhole spawning logic
if (frameCount - lastWormholeSpawnFrame >= wormholeSpawnInterval) {
Wormhole newWormhole = new Wormhole(random(width), random(height), 250);
wormholes.add(newWormhole);
lastWormholeSpawnFrame = frameCount; // Update the last spawn frame
}
// Extra stars spawning logic during Rainbow Mode
if (rainbowMode && frameCount - lastExtraStarSpawnFrame >= 60 / extraStarsPerSecond) {
for (int i = 0; i < extraStarsPerSecond; i++) {
objects.add(new StarMeteor(width, random(height), SizeType.getRandomSize(this))); // Add extra star with random size
}
lastExtraStarSpawnFrame = frameCount;
}
// Display and update wormholes
for (int i = wormholes.size() - 1; i >= 0; i--) {
Wormhole wormhole = wormholes.get(i);
if (wormhole.active) {
wormhole.display();
if (frameCount - wormhole.spawnFrame > 300) { // Wormhole duration
wormhole.deactivate(); // Deactivate the wormhole after the duration
}
} else {
wormholes.remove(i); // Remove inactive wormholes
}
}
blackHole.update();
blackHole.display();
slotMachine.drawSlotMachine(slotMachineGraphics);
if (pullAreaVisible) {
drawPullArea();
drawSpiralPath(); // Add the spiral path visualization
}
// Process all stars, including removal of marked ones
for (int i = objects.size() - 1; i >= 0; i--) {
Star obj = objects.get(i);
if (obj.markForRemoval) {
println("Removing star at frame: " + frameCount);
objects.remove(i); // Remove the star if marked for removal
continue; // Skip the rest of the loop for this object
}
if (rainbowMode) {
obj.currentColor = rainbowColors[(frameCount / 5) % rainbowColors.length]; // Cycle through rainbow colors
}
obj.move();
obj.display();
blackHole.applyGravity(obj); // Apply gravity pull effect
if (blackHole.absorb(obj)) {
if (obj instanceof RainbowStar) {
// For RainbowStars, points are multiplied by the pointsMultiplier
points = min(points + (100 * prestigeWindow.getPointsMultiplier()), MAX_POINTS); // Ensure MAX_POINTS is not exceeded
activateRainbowMode(); // Activate Rainbow Mode
} else if (obj instanceof DwarvenGoldStar) {
shapesMenuWindow.incrementDwarvenGoldCollected(); // Increment Dwarven Gold collected
} else {
// For normal stars, points are multiplied by the pointsMultiplier
points = min(points + (1 * prestigeWindow.getPointsMultiplier()), MAX_POINTS); // Ensure MAX_POINTS is not exceeded
}
objects.remove(i); // Remove absorbed stars
}
}
if (delayVisible) {
displaySpawnRates(); // Display spawn rate information
}
// Display Rainbow Mode text if active
if (rainbowMode) {
displayRainbowModeText();
if (rainbowModeTimer <= 0) {
deactivateRainbowMode(); // Deactivate Rainbow Mode when timer reaches 0
}
}
// Display the movable resizable HUD window
hudWindow.update(mouseX, mouseY);
hudWindow.display();
// Display the movable resizable prestige window
prestigeWindow.update(mouseX, mouseY);
prestigeWindow.display();
// Display the movable resizable console window
consoleWindow.display();
// Display the casino window if it's visible
casinoWindow.update(mouseX, mouseY);
casinoWindow.display();
// Display the movable resizable 4D shapes menu window
shapesMenuWindow.update(mouseX, mouseY);
shapesMenuWindow.display();
// Display FPS if enabled
if (showFPS) {
displayFPS();
}
}
void drawPullArea() {
int numDivisions = 10; // Number of divisions for the pull strength
float maxPullStrength = 5.0; // Maximum pull strength at the center
float minPullStrength = 0.1; // Minimum pull strength at the edge
// Set the font to the console font for consistency
textFont(consoleFont);
textSize(10); // Smaller text size for the numbers
for (int i = 0; i <= numDivisions; i++) {
float strength = map(i, 0, numDivisions, maxPullStrength, minPullStrength);
float radius = map(i, 0, numDivisions, 0, blackHole.gravityPullRadius);
noFill();
stroke(50, 50, 50, 150); // Dark grey with low opacity for the circles
ellipse(blackHole.x, blackHole.y, radius * 2, radius * 2);
// Calculate position for the text in a spiral
float angle = PI / 4 * i; // Adjust the angle increment as needed for spiral effect
float textX = blackHole.x + cos(angle) * radius;
float textY = blackHole.y + sin(angle) * radius;
fill(255); // White color for text
textAlign(CENTER, CENTER);
text(nf(strength, 1, 1), textX, textY); // Display the strength value in the spiral path
}
}
void drawSpiralPath() {
stroke(255, 0, 0, 150); // Red color with low opacity for the spiral
noFill();
beginShape();
float angle = 0;
float radius = 0;
while (radius < blackHole.gravityPullRadius) {
float x = blackHole.x + cos(angle) * radius;
float y = blackHole.y + sin(angle) * radius;
vertex(x, y);
angle += 0.1;
radius += 0.5;
}
endShape();
}
void displaySpawnRates() {
fill(255); // Set text color to white
textFont(consoleFont);
textSize(20);
textAlign(LEFT, TOP);
int yOffset = 20; // Start offset for the text
int lineSpacing = 30; // Spacing between lines
// Calculate remaining time for each type of star
int normalStarFramesRemaining = (int) ((starSpawnInterval / spawnMultiplier) - (frameCount % (starSpawnInterval / spawnMultiplier)));
String normalStarTimeRemaining = formatTime(normalStarFramesRemaining);
int rainbowStarFramesRemaining = (int) (rainbowStarSpawnInterval - (frameCount - lastRainbowStarSpawnFrame));
String rainbowStarTimeRemaining = formatTime(rainbowStarFramesRemaining);
int polyhedronFramesRemaining = (int) (polyhedronSpawnInterval / (1 + (prestigeWindow.raresSpawnRateMultiplier - 1) * 0.1) - (frameCount - lastPolyhedronSpawnFrame));
String polyhedronTimeRemaining = formatTime(polyhedronFramesRemaining);
int datagemFramesRemaining = (int) (dataGemStarSpawnInterval / (1 + (prestigeWindow.raresSpawnRateMultiplier - 1) * 0.1) - (frameCount - lastDataGemStarSpawnFrame));
String datagemTimeRemaining = formatTime(datagemFramesRemaining);
int wormholeFramesRemaining = (int) (wormholeSpawnInterval - (frameCount - lastWormholeSpawnFrame));
String wormholeTimeRemaining = formatTime(wormholeFramesRemaining);
int dwarvenGoldStarFramesRemaining = (int) (dwarvenGoldStarSpawnInterval / (1 + (prestigeWindow.raresSpawnRateMultiplier - 1) * 0.1) - (frameCount - lastDwarvenGoldStarSpawnFrame));
String dwarvenGoldStarTimeRemaining = formatTime(dwarvenGoldStarFramesRemaining);
int geodesicStarFramesRemaining = (int) (geodesicStarSpawnInterval / (1 + (prestigeWindow.raresSpawnRateMultiplier - 1) * 0.1) - (frameCount - lastGeodesicStarSpawnFrame));
String geodesicStarTimeRemaining = formatTime(geodesicStarFramesRemaining);
int alienRubyFramesRemaining = (int) (alienRubySpawnInterval / (1 + (prestigeWindow.raresSpawnRateMultiplier - 1) * 0.1) - (frameCount - lastAlienRubySpawnFrame));
String alienRubyTimeRemaining = formatTime(alienRubyFramesRemaining);
text("Normal Stars Spawn Rate: " + (starSpawnInterval / spawnMultiplier) + " (" + normalStarTimeRemaining + ")", 20, yOffset);
yOffset += lineSpacing;
text("Wormhole Spawn Rate: " + wormholeSpawnInterval + " (" + wormholeTimeRemaining + ")", 20, yOffset);
yOffset += lineSpacing;
text("Rainbow Stars Spawn Rate: " + rainbowStarSpawnInterval + " (" + rainbowStarTimeRemaining + ")", 20, yOffset);
yOffset += lineSpacing;
text("DataGemStar Spawn Rate: " + dataGemStarSpawnInterval / (1 + (prestigeWindow.raresSpawnRateMultiplier - 1) * 0.1) + " (" + datagemTimeRemaining + ")", 20, yOffset);
yOffset += lineSpacing;
text("DwarvenGoldStar Spawn Rate: " + dwarvenGoldStarSpawnInterval / (1 + (prestigeWindow.raresSpawnRateMultiplier - 1) * 0.1) + " (" + dwarvenGoldStarTimeRemaining + ")", 20, yOffset);
yOffset += lineSpacing;
text("AlienRuby Spawn Rate: " + alienRubySpawnInterval / (1 + (prestigeWindow.raresSpawnRateMultiplier - 1) * 0.1) + " (" + alienRubyTimeRemaining + ")", 20, yOffset);
yOffset += lineSpacing;
text("Polyhedron Spawn Rate: " + polyhedronSpawnInterval / (1 + (prestigeWindow.raresSpawnRateMultiplier - 1) * 0.1) + " (" + polyhedronTimeRemaining + ")", 20, yOffset);
yOffset += lineSpacing;
text("GeodesicStar Spawn Rate: " + geodesicStarSpawnInterval / (1 + (prestigeWindow.raresSpawnRateMultiplier - 1) * 0.1) + " (" + geodesicStarTimeRemaining + ")", 20, yOffset);
yOffset += lineSpacing;
}
String formatTime(int frames) {
int fps = (int) frameRate; // Approximate frames per second
int totalSeconds = frames / fps;
int hours = totalSeconds / 3600;
int minutes = (totalSeconds % 3600) / 60;
int seconds = totalSeconds % 60;
return hours + "h " + minutes + "m " + seconds + "s";
}
void displayRainbowModeText() {
fill(rainbowColors[rainbowColorIndex]);
textFont(rainbowFont);
textAlign(CENTER, TOP);
textSize(68);
text("RAINBOW MODE!!!: " + rainbowModeTimer, width / 2, 100);
if (frameCount % 60 == 0 && rainbowModeTimer > 0) { // Reduce timer every second
rainbowModeTimer--;
if (rainbowModeTimer == 0) {
deactivateRainbowMode(); // Disable Rainbow Mode when timer reaches 0
}
}
if (frameCount % 5 == 0) { // Change color rapidly
rainbowColorIndex = (rainbowColorIndex + 1) % rainbowColors.length;
}
}
void displayFPS() {
fill(255); // White color for FPS text
textFont(consoleFont);
textSize(20);
textAlign(CENTER, TOP);
text("FPS: " + int(frameRate), width / 2, 10);
}
void setFPS(int fps) {
targetFPS = fps;
frameRate(targetFPS);
println("FPS set to: " + targetFPS);
}
void activateRainbowMode() {
if (!rainbowMode) {
rainbowMode = true;
rainbowModeTimer = 10; // Set the timer to 10 seconds
lastExtraStarSpawnFrame = frameCount; // Reset the extra star spawn frame count
blackHole.activateRainbowMode(); // Activate Rainbow Mode for the black hole
// Change the color of all existing stars
for (Star obj : objects) {
obj.currentColor = color(255, 0, 0); // Set initial color to red
}
} else {
// Reset the timer if Rainbow Mode is already active
rainbowModeTimer = 10;
}
}
void deactivateRainbowMode() {
rainbowMode = false;
blackHole.deactivateRainbowMode(); // Deactivate Rainbow Mode for the black hole
// Reset the color of all existing stars to their original color
for (Star obj : objects) {
obj.currentColor = obj.originalColor;
}
}
void mousePressed() {
println("Mouse Pressed at: " + mouseX + ", mouseY: " + mouseY);
// Handle click on "+"" icon for speed
if (hudWindow.mouseOverSpeedIconPlus()) {
println("Speed Icon Plus Clicked");
if (points > 0 && starSpeedDisplay < MAX_STAR_SPEED) {
points -= pointsMultiplier;
hudWindow.updateStarSpeed(starSpeedDisplay + pointsMultiplier);
} else {
println("Star speed is at maximum value.");
}
}
// Handle click on "+"" icon for gravity
if (hudWindow.mouseOverGravityIconPlus()) {
println("Gravity Icon Plus Clicked");
if (points > 0 && gravityPull < MAX_GRAVITY_PULL) {
points -= pointsMultiplier;
hudWindow.updateGravityPull(gravityPull + pointsMultiplier);
} else {
println("Gravity pull is at maximum value.");
}
}
// Handle click on "+"" icon for black hole mass
if (hudWindow.mouseOverBlackHoleMassIconPlus()) {
println("Black Hole Mass Icon Plus Clicked");
if (points > 0 && blackHoleMass < MAX_BLACK_HOLE_MASS) {
points -= pointsMultiplier;
hudWindow.updateBlackHoleMass(blackHoleMass + pointsMultiplier);
} else {
println("Black hole mass is at maximum value.");
}
}
// Handle click on "+"" icon for stars multiplier
if (hudWindow.mouseOverStarMultiplierIconPlus()) {
println("Star Multiplier Icon Plus Clicked");
if (points > 0 && starMultiplier < MAX_STAR_MULTIPLIER) {
points -= pointsMultiplier;
hudWindow.updateStarMultiplier(starMultiplier + pointsMultiplier);
} else {
println("Star multiplier is at maximum value.");
}
}
// Handle click on "+"" icon for rainbow multiplier
if (hudWindow.mouseOverRainbowMultiplierIconPlus()) {
println("Rainbow Multiplier Icon Plus Clicked");
if (points > 0 && rainbowMultiplier < MAX_RAINBOW_MULTIPLIER) {
points -= pointsMultiplier;
hudWindow.updateRainbowMultiplier(rainbowMultiplier + pointsMultiplier);
} else {
println("Rainbow multiplier is at maximum value.");
}
}
// Handle click on "+"" icon for wormhole multiplier
if (hudWindow.mouseOverWormholeMultiplierIconPlus()) {
println("Wormhole Multiplier Icon Plus Clicked");
if (points > 0 && wormholeMultiplier < MAX_WORMHOLE_MULTIPLIER) {
points -= pointsMultiplier;
hudWindow.updateWormholeMultiplier(wormholeMultiplier + pointsMultiplier);
} else {
println("Wormhole multiplier is at maximum value.");
}
}
// Handle click on the points multiplier text
if (hudWindow.mouseOverPointsMultiplier()) {
println("Points Multiplier Text Clicked");
togglePointsMultiplier();
}
// Handle click on the minimize button for the HUD window
if (hudWindow.overMinimizeButton(mouseX, mouseY)) {
hudWindow.toggleMinimize();
}
// Handle click on the minimize button for the prestige window
if (prestigeWindow.overMinimizeButton(mouseX, mouseY)) {
prestigeWindow.toggleMinimize();
}
// Handle click on the "+" buttons in the prestige window
prestigeWindow.handleMouseClick(mouseX, mouseY);
// Handle the casino window dragging and resizing
if (casinoWindow.overTitleBar(mouseX, mouseY)) {
casinoWindow.startDragging(mouseX, mouseY);
} else if (casinoWindow.overWindow(mouseX, mouseY)) {
// Other actions for the casino window can go here
}
if (consoleWindow.visible) {
if (consoleWindow.overTitleBar(mouseX, mouseY)) {
consoleWindow.startDragging(mouseX, mouseY);
} else if (consoleWindow.overResizeArea(mouseX, mouseY)) {
consoleWindow.startResizing(mouseX, mouseY);
} else {
// Handle console window specific mousePressed events
consoleWindow.handleMousePressed();
}
} else if (hudWindow.overWindow(mouseX, mouseY)) {
hudWindow.startDragging(mouseX, mouseY);
} else if (prestigeWindow.overWindow(mouseX, mouseY)) {
prestigeWindow.startDragging(mouseX, mouseY);
} else {
checkHUDClicks();
}
// Handle clicks on the 4D shapes menu window
if (shapesMenuWindow.overTitleBar(mouseX, mouseY)) {
shapesMenuWindow.startDragging(mouseX, mouseY);
} else if (shapesMenuWindow.overResizeArea(mouseX, mouseY)) {
shapesMenuWindow.startResizing(mouseX, mouseY);
}
}
void mouseDragged() {
if (consoleWindow.dragging || consoleWindow.resizing) {
consoleWindow.update(mouseX, mouseY);
} else if (consoleWindow.visible) {
// Handle console window specific mouseDragged events
consoleWindow.handleMouseDragged();
} else if (hudWindow.dragging || hudWindow.resizing) {
hudWindow.update(mouseX, mouseY);
} else if (prestigeWindow.dragging || prestigeWindow.resizing) {
prestigeWindow.update(mouseX, mouseY);
}
// Handle dragging for the casino window
if (casinoWindow.dragging) {
casinoWindow.update(mouseX, mouseY);
}
// Handle dragging for the 4D shapes menu window
if (shapesMenuWindow.dragging || shapesMenuWindow.resizing) {
shapesMenuWindow.update(mouseX, mouseY);
}
}
void mouseReleased() {
if (consoleWindow.dragging || consoleWindow.resizing) {
consoleWindow.stopDragging();
consoleWindow.stopResizing();
}
if (hudWindow.dragging || hudWindow.resizing) {
hudWindow.stopDragging();
hudWindow.stopResizing();
}
if (prestigeWindow.dragging || prestigeWindow.resizing) {
prestigeWindow.stopDragging();
prestigeWindow.stopResizing();
}
if (casinoWindow.dragging) {
casinoWindow.stopDragging();
}
if (consoleWindow.visible) {
// Handle console window specific mouseReleased events
consoleWindow.handleMouseReleased();
}
// Stop dragging/resizing for the 4D shapes menu window
if (shapesMenuWindow.dragging || shapesMenuWindow.resizing) {
shapesMenuWindow.stopDragging();
shapesMenuWindow.stopResizing();
}
}
void keyPressed() {
println("Key pressed: " + key + ", keyCode: " + keyCode);
if (key == CODED && keyCode == 26) { // Key code for the "Insert" key
consoleWindow.toggleVisibility(); // Toggle console window visibility
}
// Handle console window key events if it's visible
if (consoleWindow.visible) {
consoleWindow.handleKeyPressed();
} else {
// Handle other key events
if (key == 'P' || key == 'p') {
prestigeWindow.toggleVisibility(); // Toggle Prestige window visibility
}
if (key == 'R' || key == 'r') {
shapesMenuWindow.toggleVisibility(); // Toggle Shapes menu window visibility
}
if (key == 'C' || key == 'c') {
println("Toggling Casino window visibility");
casinoWindow.toggleVisibility();
println("Casino window visibility: " + casinoWindow.visible);
}
}
}
void checkHUDClicks() {
float plusSize = textWidth("+");
int baseY = height - 250;
// Check if click is on the + for Black Hole Mass
if (mouseY > baseY + 40 - gameFont.getSize() && mouseY < baseY + 40) {
if (mouseX > width / 2 - textWidth("Black Hole Mass: " + blackHoleMass) / 2 - plusSize && mouseX < width / 2 - textWidth("Black Hole Mass: " + blackHoleMass) / 2) {
if (points > 0 && blackHoleMass < MAX_BLACK_HOLE_MASS) {
points -= pointsMultiplier;
updateBlackHoleMass(blackHoleMass + pointsMultiplier);
} else {
println("Black hole mass is at maximum value.");
}
}
}
// Check if click is on the + for Gravity Pull
if (mouseY > baseY + 80 - gameFont.getSize() && mouseY < baseY + 80) {
if (mouseX > width / 2 - textWidth("Gravity Pull: " + gravityPull) / 2 - plusSize && mouseX < width / 2 - textWidth("Gravity Pull: " + gravityPull) / 2) {
if (points > 0 && gravityPull < MAX_GRAVITY_PULL) {
points -= pointsMultiplier;
updateGravityPull(gravityPull + pointsMultiplier);
} else {
println("Gravity pull is at maximum value.");
}
}
}
// Check if click is on the + for Stars Speed
if (mouseY > baseY + 120 - gameFont.getSize() && mouseY < baseY + 120) {
if (mouseX > width / 2 - textWidth("Stars Speed: " + starSpeedDisplay) / 2 - plusSize && mouseX < width / 2 - textWidth("Stars Speed: " + starSpeedDisplay) / 2) {
if (points > 0 && starSpeedDisplay < MAX_STAR_SPEED) {
points -= pointsMultiplier;
updateStarSpeed(starSpeedDisplay + pointsMultiplier);
} else {
println("Star speed is at maximum value.");
}
}
}
// Check if click is on the + for Stars Multiplier
if (mouseY > baseY + 160 - gameFont.getSize() && mouseY < baseY + 160) {
if (mouseX > width / 2 - textWidth("Stars Multiplier: " + starMultiplier) / 2 - plusSize && mouseX < width / 2 - textWidth("Stars Multiplier: " + starMultiplier) / 2) {
if (points > 0 && starMultiplier < MAX_STAR_MULTIPLIER) {
points -= pointsMultiplier;
updateStarMultiplier(starMultiplier + pointsMultiplier);
} else {
println("Star multiplier is at maximum value.");
}
}
}
}
void setPoints(int newPoints) {
if (newPoints > MAX_POINTS) {
newPoints = MAX_POINTS;
consoleWindow.consoleText.add("The MAX Value Can Only Be: " + MAX_POINTS);
}
points = min(newPoints, MAX_POINTS);
}
void setGravityPull(int newGravityPull) {
updateGravityPull(newGravityPull);
consoleWindow.consoleText.add("Gravity pull set to: " + gravityPull);
}
void setBlackHoleMass(int mass) {
updateBlackHoleMass(mass);
}
void setStarSpeed(int speed) {
updateStarSpeed(speed);
consoleWindow.consoleText.add("Star speed set to: " + starSpeedDisplay);
}
void setStarMultiplier(int multiplier) {
updateStarMultiplier(multiplier);
consoleWindow.consoleText.add("Stars multiplier set to: " + starMultiplier);
}
void setRainbowMultiplier(int multiplier) {
updateRainbowMultiplier(multiplier);
consoleWindow.consoleText.add("Rainbow multiplier set to: " + rainbowMultiplier);
}
void setWormholeMultiplier(int multiplier) {
updateWormholeMultiplier(multiplier);
consoleWindow.consoleText.add("Wormhole multiplier set to: " + wormholeMultiplier);
}
void setPrestigePoints(int newPrestigePoints) {
prestigePoints = max(0, newPrestigePoints); // Ensure prestige points are not negative
prestigeWindow.updatePrestigePoints(prestigePoints); // Update the prestige window display
consoleWindow.consoleText.add("Prestige points set to: " + prestigePoints);
}
void setDelayVisible(boolean visibility) {
delayVisible = visibility;
consoleWindow.consoleText.add("Delay visibility set to: " + (visibility ? "on" : "off"));
}
float calculateBalancedGrowth(int baseValue, float k, int pointsSpent) {
return baseValue * pow(1 + k, log(pointsSpent + 1) * 2);
}
void updateBlackHoleMass(int mass) {
if (mass > MAX_BLACK_HOLE_MASS) {
mass = MAX_BLACK_HOLE_MASS;
consoleWindow.consoleText.add("The MAX Value Can Only Be: " + MAX_BLACK_HOLE_MASS);
}
blackHoleMass = min(max(1, mass), MAX_BLACK_HOLE_MASS);
float newSize = max(INITIAL_BLACK_HOLE_SIZE, calculateBalancedGrowth(INITIAL_BLACK_HOLE_SIZE, kGrowth, blackHoleMass));
blackHole.setSize(newSize);
println("Black hole mass updated: " + blackHoleMass + ", New size: " + newSize);
}
void updateGravityPull(int pull) {
if (pull > MAX_GRAVITY_PULL) {
pull = MAX_GRAVITY_PULL;
consoleWindow.consoleText.add("The MAX Value Can Only Be: " + MAX_GRAVITY_PULL);
}
gravityPull = min(max(1, pull), MAX_GRAVITY_PULL); // Assuming the minimum pull value is 1
blackHole.setGravityPullRadius(calculateBalancedGrowth(baseGravityPull, kGravityPull, gravityPull));
println("Gravity pull radius updated: " + gravityPull);
}
void updateStarSpeed(int speed) {
if (speed > MAX_STAR_SPEED) {
speed = MAX_STAR_SPEED;
consoleWindow.consoleText.add("The MAX Value Can Only Be: " + MAX_STAR_SPEED);
}
starSpeedDisplay = min(max(1, speed), MAX_STAR_SPEED); // Ensure the speed display doesn’t go below 1
BlackHoleFrenzy.starSpeed = calculateBalancedGrowth(baseStarSpeedDisplay, kStarSpeed, starSpeedDisplay) * 0.1;
println("Star speed updated: " + starSpeedDisplay);
}
void updateStarMultiplier(int multiplier) {
if (multiplier > MAX_STAR_MULTIPLIER) {
multiplier = MAX_STAR_MULTIPLIER;
consoleWindow.consoleText.add("The MAX Value Can Only Be: " + MAX_STAR_MULTIPLIER);
}
starMultiplier = min(max(1, multiplier), MAX_STAR_MULTIPLIER); // Ensure the multiplier doesn’t go below 1
BlackHoleFrenzy.spawnMultiplier = calculateBalancedGrowth(baseStarMultiplier, kStarMultiplier, starMultiplier);
println("Star multiplier updated: " + starMultiplier);
}
void updateRainbowMultiplier(int multiplier) {
if (multiplier > MAX_RAINBOW_MULTIPLIER) {
multiplier = MAX_RAINBOW_MULTIPLIER;
consoleWindow.consoleText.add("The MAX Value Can Only Be: " + MAX_RAINBOW_MULTIPLIER);
}
rainbowMultiplier = min(max(1, multiplier), MAX_RAINBOW_MULTIPLIER); // Ensure the multiplier doesn’t go below 1
rainbowStarSpawnInterval = starSpawnInterval * (50 / (1 + log(rainbowMultiplier) * 0.1)); // Adjust spawn interval based on multiplier
println("Rainbow multiplier updated: " + rainbowMultiplier);
}
void updateWormholeMultiplier(int multiplier) {
if (multiplier > MAX_WORMHOLE_MULTIPLIER) {
multiplier = MAX_WORMHOLE_MULTIPLIER;
consoleWindow.consoleText.add("The MAX Value Can Only Be: " + MAX_WORMHOLE_MULTIPLIER);
}
wormholeMultiplier = min(max(1, multiplier), MAX_WORMHOLE_MULTIPLIER); // Ensure the multiplier doesn’t go below 1
wormholeSpawnInterval = 1800 / (1 + log(wormholeMultiplier) * 0.1); // Adjust spawn interval based on multiplier
println("Wormhole multiplier updated: " + wormholeMultiplier);
}
void togglePointsMultiplier() {
switch (pointsMultiplier) {
case 1:
pointsMultiplier = 10;
break;
case 10:
pointsMultiplier = 100;
break;
case 100:
pointsMultiplier = 1000;
break;
case 1000:
pointsMultiplier = 10000;
break;
case 10000:
pointsMultiplier = MAX_POINTS;
break;
default:
pointsMultiplier = 1;
}
}
String getPointsMultiplierText() {
if (pointsMultiplier == MAX_POINTS) {
return "MAX";
}
return pointsMultiplier + "X";
}
void spawnStar(String starType, float size) {
Star newStar;
SizeType sizeType = determineSizeType(size); // Determine SizeType for drawing purposes
switch(starType) {
case "rainbow":
newStar = new RainbowStar(width, random(height), sizeType);
newStar.setSpeed(RAINBOW_STAR_SPEED);
newStar.setSize(size); // Set the actual size
break;
case "meteor":
newStar = new StarMeteor(width, random(height), sizeType);
newStar.setSize(size); // Set the actual size
break;
case "polyhedron":
newStar = new PolyhedronStar(width, random(height), size); // Corrected constructor
break;
case "datagemstar":
newStar = new DataGemStar(width, random(height), size);
newStar.setSize(size); // Ensure size is set correctly
break;
case "geodesic":
newStar = new GeodesicStar(width, random(height), sizeType, this, size);
newStar.setSize(size); // Ensure size is set correctly
break;
case "dwarvengold":
newStar = new DwarvenGoldStar(width, random(height), sizeType, this, size);
newStar.setSize(size); // Ensure size is set correctly
break;
case "alienruby": // Add AlienRuby case
newStar = new AlienRuby(this, width, random(height), sizeType);
newStar.setSize(size); // Set the actual size
break;
case "wormhole":
Wormhole newWormhole = new Wormhole(random(width), random(height), size);
wormholes.add(newWormhole); // Add the new wormhole to the list of wormholes
consoleWindow.consoleText.add("Spawned a wormhole.");
return;
default:
consoleWindow.consoleText.add("Unknown star type: " + starType);
return;
}
objects.add(newStar);
println("Spawning a " + starType + " star of size " + size);
}
SizeType determineSizeType(float size) {
if (size <= 15) {
return SizeType.SMALL;
} else if (size <= 30) {
return SizeType.MEDIUM;
} else {
return SizeType.LARGE;
}
}
void resetToDefaultStats() {
// Reset stats to their default starting values
blackHoleMass = baseBlackHoleMass;
gravityPull = baseGravityPull;
starSpeedDisplay = baseStarSpeedDisplay;
starMultiplier = baseStarMultiplier;
rainbowMultiplier = 1; // Reset rainbow multiplier to 1
wormholeMultiplier = 1; // Reset wormhole multiplier to 1
// Reset points if needed
points = 0;
// Update the relevant game mechanics
updateBlackHoleMass(blackHoleMass);
updateGravityPull(gravityPull);
updateStarSpeed(starSpeedDisplay);
updateStarMultiplier(starMultiplier);
updateRainbowMultiplier(rainbowMultiplier);
updateWormholeMultiplier(wormholeMultiplier);
// Add a message to the console to confirm the reset
consoleWindow.consoleText.add("All game stats have been reset to default starting values.");
}
void clearAllStars() {
// Clear all stars from the objects list
objects.clear();
wormholes.clear(); // Clear all wormholes from the list
// Add a message to the console to confirm the action
consoleWindow.consoleText.add("All stars and wormholes currently visible on the screen have been removed.");
}
void toggleScreenMode() {
screenMode = (screenMode + 1) % 2;
switch (screenMode) {
case 0:
frame.setVisible(false);
frame.dispose();
frame.setUndecorated(false);
frame.setBounds(bounds);
surface.setSize((int) prevDimension.getWidth(), (int) prevDimension.getHeight());
device.setFullScreenWindow(null);
frame.setVisible(true);
break;
case 1:
frame.setVisible(false);
frame.dispose();
frame.setUndecorated(true);
surface.setSize(displayWidth, displayHeight);
device.setFullScreenWindow(frame);
frame.setVisible(true);
break;
}
((PSurfaceAWT.SmoothCanvas) getSurface().getNative()).requestFocus();
}
int getDataGemStarSpawnRate() {
return (int) dataGemStarSpawnInterval;
}
void mouseWheel(MouseEvent event) {
float e = event.getCount();
// Forward the event to your console window
if (consoleWindow.visible && consoleWindow.overWindow(mouseX, mouseY)) {
consoleWindow.mouseWheel(event);
}
}
void setDataGemsCollected(int value) {
shapesMenuWindow.dataGemsCollected = value;
consoleWindow.consoleText.add("Data Gems collected set to: " + value);
}
void setDwarvenGoldCollected(int value) {
shapesMenuWindow.dwarvenGoldCollected = value;
consoleWindow.consoleText.add("Dwarven Gold collected set to: " + value);
}
void setAlienRubyCollected(int value) {
shapesMenuWindow.alienRubyCollected = value;
consoleWindow.consoleText.add("Alien Ruby collected set to: " + value);
}
void setPolyhedronsCollected(int value) {
shapesMenuWindow.polyhedronsCollected = value;
consoleWindow.consoleText.add("Polyhedrons collected set to: " + value);
}
void setGeodesicStarsCollected(int value) {
shapesMenuWindow.geodesicStarsCollected = value;
consoleWindow.consoleText.add("Geodesic Stars collected set to: " + value);
}
```