diff --git a/assets/idle_motor.mp3 b/assets/idle_motor.mp3 new file mode 100644 index 0000000..810e129 Binary files /dev/null and b/assets/idle_motor.mp3 differ diff --git a/assets/main_music.wav b/assets/main_music.wav new file mode 100644 index 0000000..d45242e Binary files /dev/null and b/assets/main_music.wav differ diff --git a/kek2.pde b/kek2.pde index e6627f1..4a726df 100644 --- a/kek2.pde +++ b/kek2.pde @@ -1,3 +1,5 @@ +import processing.sound.*; + float checkDistance(Log log, Ship ship) { float testX = ship.pos.x; float testY = ship.pos.y; @@ -13,7 +15,8 @@ float checkDistance(Log log, Ship ship) { float distY = ship.pos.y-testY; float distance = sqrt( (distX*distX) + (distY*distY) ); - line(testX, testY, ship.pos.x, ship.pos.y); + // Debug Lines + // line(testX, testY, ship.pos.x, ship.pos.y); // if the distance is less than the radius, collision! return distance; @@ -23,10 +26,20 @@ float checkDistance(Log log, Ship ship) { // Chris, Julia, Marla, Tarek, Max void play() { background(75, 105, 47); - - text(playtime.second(), 20, 20); + // Timer + fill(0); + textSize(24); + text(playtime.second(), 40, 20); + text(playtime.second(), -580, 20); + + // Tutorial + textAlign(LEFT); + textSize(16); + text("You are a robot that has to save Bob. He is stuck in the forest.", -570, 160); + text("Here is a chainsaw to get through", -570, 180); + ship_zero.draw(); saw_zero.drawSaw(); ship_zero.collect(saw_zero); @@ -51,6 +64,7 @@ void play() { // ----- + // global state boolean isgame = false; boolean ismenu = true; @@ -82,6 +96,10 @@ PImage player_sprite_bob; PImage saw_sprite; PImage bob_sprite; +SoundFile idle_motor; +SoundFile music; + + void setup() { size(600, 600); textAlign(CENTER, CENTER); @@ -99,7 +117,12 @@ void setup() { saw_sprite = loadImage("./assets/Sprite-saege.png"); bob_sprite = loadImage("./assets/Sprite-bob.png"); + idle_motor = new SoundFile(this, "./assets/idle_motor.mp3"); + music = new SoundFile(this, "./assets/main_music.wav"); + savefile.loadJson("./saves/save.json"); + + music.loop(1, 0.5); } // Chris @@ -110,6 +133,7 @@ void draw() { // game state if (isgame) { + // Go to second or first slide if(ship_zero.pos.x > 0) { start_slide = false; diff --git a/keys.pde b/keys.pde index 2557bac..d8abbc4 100644 --- a/keys.pde +++ b/keys.pde @@ -5,6 +5,7 @@ void keyPressed() { if (key == CODED) { if(keyCode == UP) { NORTH = true; + if(!idle_motor.isPlaying()) idle_motor.play(); } else if (keyCode == DOWN) { SOUTH = true; } else if (keyCode == LEFT) { @@ -21,6 +22,7 @@ void keyPressed() { } } // Marla + // Pause menu } else if (keyCode == ESC){ key = 0; if (isgame) { diff --git a/logs.pde b/logs.pde index 41e3696..a4600ea 100644 --- a/logs.pde +++ b/logs.pde @@ -39,7 +39,7 @@ class Log { strokeWeight(1); // Set stroke weight for the log fill(logcolor); // Set fill color for the log rect(0, 0, logwidth, -logheight); // Draw the log as a rectangle - text(logtext, x, y); + // text(logtext, x, y); strokeWeight(1); stroke(0); diff --git a/menu.pde b/menu.pde index 0054fff..3a44389 100644 --- a/menu.pde +++ b/menu.pde @@ -90,7 +90,10 @@ class Stats extends Menus { text("Trees Sawed: " , 100, 70); text(trees_sawed, 500, 70); text("Insgesamt Spielzeit", 100, 90); - text(game_time, 500, 90); + int sek = game_time/1000; + int min = game_time/1000/60; + int minsek = sek % 60; + text(min + ":" + minsek, 500, 90); } } diff --git a/readme.org b/readme.org index 12ce66a..4c6f5f8 100644 --- a/readme.org +++ b/readme.org @@ -2,11 +2,11 @@ *** 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 *** DONE setze bob auf den Robi -*** TODO Wir brauchen Geräusche -*** 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 +*** DONE Wir brauchen Geräusche +*** DONE Richtige Texte am Anfang zum erklären +*** TODO End menu +*** TODO Game neustarten können +*** DONE Roboter muss kaputt gehen können ** Menu *** DONE Statistikseite: Spielzeit, Bäume gefällt, Zeit gestoppt *** DONE Richtige Texte im Menu @@ -15,3 +15,8 @@ Wird noch nicht benutzt *** DONE nochmal die statistikseite überarbeiten **** DONE Math for best_game_time **** TODO Why doesnt bestgametime work + +** Vllt +*** 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 diff --git a/ship.pde b/ship.pde index da3f0f7..b963d87 100644 --- a/ship.pde +++ b/ship.pde @@ -14,7 +14,7 @@ class Ship { boolean hasSaw = false; int nextLog; - int health = 3; + int health = 150; Ship() { // pos.x = width/2; @@ -40,7 +40,8 @@ class Ship { // println(newX, " : ", newY); if (health == 0) { - exit(); + isgame = false; + isend = true; } colliding_logs = false; @@ -124,6 +125,8 @@ class Ship { speed.sub(acceleration); pos.add(0, 0); pos.add(speed.mult(2)); + + health = health - 1; } // println(speed); }