polish, more assets and todo

This commit is contained in:
Makussu 2023-12-21 16:07:29 +01:00
parent 967dc93f23
commit 007bb67a0d
12 changed files with 63 additions and 58 deletions

BIN
assets/Sprite-0002.ase Normal file

Binary file not shown.

BIN
assets/Sprite-robi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -19,10 +19,6 @@ class Saw extends Collectable {
void drawSaw() {
if (!is_attached) {
// stroke(0);
// fill(210, 210, 0);
// rect(pos.x, pos.y, cwidth, cheight);
// fill(0);
image(saw_sprite, pos.x, pos.y);
}
}
@ -36,10 +32,6 @@ class Bob extends Collectable {
void drawBob() {
if (!is_attached) {
// stroke(0);
// fill(255, 209, 152);
// rect(pos.x, pos.y, cwidth, cheight);
// fill(0);
image(bob_sprite, pos.x, pos.y);
}
}

View File

@ -1,6 +1,3 @@
// DONE File loading and Saving
// TODO Math for best_game_time
class Files {
boolean checkSaveFile(String filepath) {
@ -8,13 +5,17 @@ class Files {
}
void loadJson(String jsonfile) {
if (!checkSaveFile(jsonfile)) {
// if (!checkSaveFile(jsonfile)) {
try {
JSONArray values = loadJSONArray(jsonfile);
stats_menu.best_game_time = values.getInt(0);
stats_menu.trees_sawed = values.getInt(1);
stats_menu.game_time = values.getInt(2);
println("Savefile found");
} catch (Exception e) {
println("Savefile not found");
}
}

View File

@ -1,9 +1,3 @@
// DONE Level mit 2 Bereichen. Erster Bereich Straße und Kettensäge und End/Startpunkt. Zweiter Bereich Wald und Bob
// DONE Statistikseite: Spielzeit, Bäume gefällt, Zeit gestoppt
// TODO Wir brauchen Geräusche
// DONE Robi muss noch beschleunigen können
float checkDistance(Log log, Ship ship) {
float testX = ship.pos.x;
float testY = ship.pos.y;
@ -27,7 +21,7 @@ float checkDistance(Log log, Ship ship) {
// Main Game entry
void play() {
background(50);
background(75, 105, 47);
text(playtime.second(), 20, 20);
@ -79,9 +73,11 @@ Bob bob;
// stopwatch
StopWatchTimer playtime = new StopWatchTimer();
Files savefile = new Files();
PImage player_sprite;
PImage player_sprite_bob;
PImage saw_sprite;
PImage bob_sprite;
@ -96,9 +92,12 @@ void setup() {
saw_zero = new Saw(-width+100, 100, 20, 50);
bob = new Bob(500, 400, 20, 40);
player_sprite = loadImage("./assets/Sprite-0001.png");
player_sprite = loadImage("./assets/Sprite-robi.png");
player_sprite_bob = loadImage("./assets/Sprite-robiwithbob.png");
saw_sprite = loadImage("./assets/Sprite-saege.png");
bob_sprite = loadImage("./assets/Sprite-bob.png");
savefile.loadJson("./saves/save.json");
}
void draw() {
@ -146,6 +145,11 @@ void draw() {
stats_menu.draw();
} else if (isend) {
// end screen code
// save
if(playtime.second() < stats_menu.best_game_time) stats_menu.best_game_time = playtime.second();
savefile.savetofile("save");
} else if (ispause) {
main_menu.drawMenu();

View File

@ -11,7 +11,6 @@ void keyPressed() {
ROTATER = true;
}
} else if (key == 's') { // SAW
// BUG sometimes a log gets stuck in sawed = false state
if (ship_zero.hasSaw) {
Log target_log = logs[ship_zero.nextLog];
if(checkDistance(target_log, ship_zero) < 40) {

View File

@ -55,31 +55,4 @@ class Log {
}
// void logCollide(Ship ship) {
// if(sawed == false) {
// if(ship.newX+10 > x && ship.newX-10 < x + logwidth && ship.newY+10 > y && ship.newY-10 < y + logheight) {
// ship.colliding = true;
// }
// }
// }
// void draw() {
// drawLog(4);
// logCollide(ship_zero);
// }
}
// class Tree extends Log {
// Tree (float x, float y, float logw, float logh, boolean hasC) {
// super(x, y, logw, logh, hasC);
// }
// void draw() {
// color treecolor = color(133, 79, 51);
// // rectMode(CENTER);
// drawLog(1);
// }
// }

View File

@ -25,6 +25,9 @@ class MainMenu extends Menus {
ispause = false;
isgame = true;
}
fill(0);
textAlign(CENTER, CENTER);
textSize(32);
text("Play", x, y);
}
@ -34,6 +37,9 @@ class MainMenu extends Menus {
ismenu = false;
isstats = true;
}
fill(0);
textAlign(CENTER, CENTER);
textSize(32);
text("Stats", x, y);
}
@ -42,6 +48,10 @@ class MainMenu extends Menus {
// color maincolor = color(100, 100, 100);
playButton(300, 300, 150, 50);
statsButton(300, 400, 150, 50);
textSize(100);
textAlign(CENTER, CENTER);
text("Save Bob", 300, 200);
}
void draw() {
@ -62,6 +72,8 @@ class Stats extends Menus {
isstats = false;
}
fill(0);
textSize(32);
textAlign(CENTER, CENTER);
text("Main Menu", 300, 300);
}
@ -69,13 +81,14 @@ class Stats extends Menus {
background(50);
menuButton();
textAlign(LEFT);
textSize(24);
text("Best Game Time", 50, 50);
text(best_game_time, 200, 50);
text("Trees Sawed: " , 50, 70);
text(trees_sawed, 200, 70);
text("Insgesamt Spielzeit", 50, 90);
text(game_time, 200, 90);
text("Best Game Time", 100, 50);
text(best_game_time, 500, 50);
text("Trees Sawed: " , 100, 70);
text(trees_sawed, 500, 70);
text("Insgesamt Spielzeit", 100, 90);
text(game_time, 500, 90);
}
}

17
readme.org Normal file
View File

@ -0,0 +1,17 @@
** Ingame
*** DONE Level mit 2 Bereichen. Erster Bereich Straße und Kettensäge und End/Startpunkt. Zweiter Bereich Wald und Bob
*** DONE Robi muss noch beschleunigen können
*** TODO Wir brauchen Geräusche
*** DONE setze bob auf den Robi
*** TODO Richtige Texte am Anfang zum erklären
*** TODO Abprallen nicht machen, wenn newx nicht erreicht sein kann, sondern wenn Robi tatsächlich die Wand berührt
*** TODO Roboter muss abprallen, kaputt gehen
*** BUG sometimes a log gets stuck in sawed = false state
** Menu
*** DONE Statistikseite: Spielzeit, Bäume gefällt, Zeit gestoppt
*** DONE Richtige Texte im Menu
*** DONE File loading and saving
Wird noch nicht benutzt
*** DONE nochmal die statistikseite überarbeiten
**** DONE Math for best_game_time
**** TODO Why doesnt bestgametime work

5
saves/save.json Normal file
View File

@ -0,0 +1,5 @@
[
0,
13,
205455
]

View File

@ -1,6 +1,3 @@
// Roboter muss abprallen, kaputt gehen
// TODO Abprallen nicht machen, wenn newx nicht erreicht sein kann, sondern wenn Robi tatsächlich die Wand berührt
class Ship {
// Movement
PVector pos = new PVector(-width/2, height/2); // position
@ -157,7 +154,11 @@ class Ship {
// line(-10, 10, 0, -10);
// triangle(- 5, - 5, - 5, 5, 10, 0);
imageMode(CENTER);
if(bob.is_attached) {
image(player_sprite_bob, 0, 0);
} else {
image(player_sprite, 0, 0);
}
if(hasSaw) {
image(saw_sprite, 20, 0);
}