diff --git a/kek2.pde b/kek2.pde index aa6bc52..8090ae2 100644 --- a/kek2.pde +++ b/kek2.pde @@ -30,7 +30,7 @@ void play() { background(50); text(playtime.second(), 20, 20); - println(playtime.second()); + // println(playtime.second()); // for(int i = 0; i < trees.length; i++) { @@ -58,6 +58,7 @@ void play() { // println(ship_zero.newX, " : ", ship_zero.newY); // println("x: ", ship_zero.x, " : ", ship_zero.y); + println(stats_menu.trees_sawed); } // ----- diff --git a/keys.pde b/keys.pde index e367439..68bd2d7 100644 --- a/keys.pde +++ b/keys.pde @@ -14,8 +14,13 @@ void keyPressed() { if (ship_zero.hasSaw) { if(checkDistance(logs[ship_zero.nextLog], ship_zero) < 40) { logs[ship_zero.nextLog].sawed = true; + stats_menu.trees_sawed = stats_menu.trees_sawed + 1; } } + } else if (keyCode == ESC && isgame){ + key = 0; + isgame = false; + ismenu = true; } } diff --git a/menu.pde b/menu.pde index cb71ee5..3150eaa 100644 --- a/menu.pde +++ b/menu.pde @@ -37,6 +37,7 @@ class MainMenu extends Menus { } void drawMenu() { + background(40); // color maincolor = color(100, 100, 100); playButton(300, 300, 150, 50); statsButton(300, 400, 150, 50); @@ -64,9 +65,10 @@ class Stats extends Menus { void draw() { background(50); menuButton(); + String trees = "Trees Sawed: ", trees_sawed; text("Best Game Time", 50, 50); - text("Trees Sawed", 50, 70); + text(trees , 50, 70); text("Insgesamt Spielzeit", 50, 90); } } diff --git a/ship.pde b/ship.pde index c0f8e94..9be3ffe 100644 --- a/ship.pde +++ b/ship.pde @@ -1,4 +1,5 @@ // 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 { float x, y, a; @@ -10,14 +11,14 @@ class Ship { float movementSpeed = 2; // The speed of movement int nextLog; - int health; + int health = 3; Ship() { x = width / 2; y = height / 2; a = -90; - // newX = width/2; - // newY = height/2; + newX = width/2; + newY = height/2; } void draw() { @@ -31,6 +32,10 @@ class Ship { // println(newX, " : ", newY); + if (health == 0) { + exit(); + } + colliding2 = false; } @@ -86,6 +91,7 @@ class Ship { float richtungY = y-newY; x = (7*richtungX) + x; y = (7*richtungY) + y; + health = health - 1; } } else if (SOUTH) { newX = x - cos(radians(a)) * movementSpeed;