fix save file and branch

This commit is contained in:
Makussu 2023-12-22 16:52:11 +01:00
parent c985508079
commit 2a2af21d03
2 changed files with 1 additions and 99 deletions

View File

@ -17,6 +17,7 @@ class Files {
} catch (Exception e) {
println("Savefile not found");
stats_menu.best_game_time = 90000;
}
}

View File

@ -1,99 +0,0 @@
boolean ismenu = true;
boolean isgame = false;
PVector pos = new PVector(220, 50);
void setup() {
size(800,800);
}
https://forum.processing.org/two/discussion/19925/rotating-an-object-and-making-it-move-with-a-variable.html
void draw() {
// debug();
if (ismenu) {
mainMenu();
} else if (isgame) {
play();
}
}
int rotation;
void play() {
background(255);
rotate(radians(rotation));
translate(pos.x, pos.y);
rect(0, 0, 20, 20);
}
void mainMenu() {
background(246, 244, 235);
fill(116, 155, 194);
textSize(128);
textAlign(CENTER);
text("p4dash", width/2, height/2 - 100);
// go to game
fill(70, 130, 169);
if (drawRectWithMouseColission(width/2, height/2, 300, 100)) {
if (mousePressed) {
ismenu = false;
isgame = true;
}
}
fill(0);
textSize(40);
text("Play", width/2, height/2);
// go to editor
fill(70, 130, 169);
if (drawRectWithMouseColission(width/2, height/2+200, 300, 100)) {
if (mousePressed) {
ismenu = false;
}
}
fill(0);
textSize(40);
text("Editor", width/2, height/2+200);
fill(145, 200, 228);
// exit game
if (drawRectWithMouseColission(50, 100, 80, 40)) {
if (mousePressed) {
exit();
}
}
fill(0);
textSize(40);
textAlign(CENTER);
text("Exit", 50, 110);
}
// Rectangle with editor colission
boolean drawRectWithMouseColission(int x, int y, int rectwidth, int rectheight) {
// Draw A Rect
rectMode(CENTER);
rect(x, y, rectwidth, rectheight);
// Check it for collission
if((mouseX > x - rectwidth/2 && mouseX < x + rectwidth/2) && (mouseY > y - rectheight/2 && mouseY < y + rectheight/2)) {
return true;
} else {
return false;
}
}
void keyPressed() {
if (ismenu) {
} else if (isgame) {
if (key == CODED) {
if (keyCode == UP) {
pos.x = pos.x + 1;
} else if (keyCode == DOWN) {
pos.x = pos.x - 1;
} else if (keyCode == LEFT) {
rotation = rotation +1;
} else if (keyCode == RIGHT) {
rotation = rotation -1;
}
}
}
}