finishing touches
This commit is contained in:
parent
a059b2cf2b
commit
3b84ef5b77
BIN
assets/idle_motor.mp3
Normal file
BIN
assets/idle_motor.mp3
Normal file
Binary file not shown.
BIN
assets/main_music.wav
Normal file
BIN
assets/main_music.wav
Normal file
Binary file not shown.
30
kek2.pde
30
kek2.pde
@ -1,3 +1,5 @@
|
|||||||
|
import processing.sound.*;
|
||||||
|
|
||||||
float checkDistance(Log log, Ship ship) {
|
float checkDistance(Log log, Ship ship) {
|
||||||
float testX = ship.pos.x;
|
float testX = ship.pos.x;
|
||||||
float testY = ship.pos.y;
|
float testY = ship.pos.y;
|
||||||
@ -13,7 +15,8 @@ float checkDistance(Log log, Ship ship) {
|
|||||||
float distY = ship.pos.y-testY;
|
float distY = ship.pos.y-testY;
|
||||||
float distance = sqrt( (distX*distX) + (distY*distY) );
|
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!
|
// if the distance is less than the radius, collision!
|
||||||
return distance;
|
return distance;
|
||||||
@ -23,10 +26,20 @@ float checkDistance(Log log, Ship ship) {
|
|||||||
// Chris, Julia, Marla, Tarek, Max
|
// Chris, Julia, Marla, Tarek, Max
|
||||||
void play() {
|
void play() {
|
||||||
background(75, 105, 47);
|
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();
|
ship_zero.draw();
|
||||||
saw_zero.drawSaw();
|
saw_zero.drawSaw();
|
||||||
ship_zero.collect(saw_zero);
|
ship_zero.collect(saw_zero);
|
||||||
@ -51,6 +64,7 @@ void play() {
|
|||||||
|
|
||||||
// -----
|
// -----
|
||||||
|
|
||||||
|
|
||||||
// global state
|
// global state
|
||||||
boolean isgame = false;
|
boolean isgame = false;
|
||||||
boolean ismenu = true;
|
boolean ismenu = true;
|
||||||
@ -82,6 +96,10 @@ PImage player_sprite_bob;
|
|||||||
PImage saw_sprite;
|
PImage saw_sprite;
|
||||||
PImage bob_sprite;
|
PImage bob_sprite;
|
||||||
|
|
||||||
|
SoundFile idle_motor;
|
||||||
|
SoundFile music;
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
size(600, 600);
|
size(600, 600);
|
||||||
textAlign(CENTER, CENTER);
|
textAlign(CENTER, CENTER);
|
||||||
@ -99,7 +117,12 @@ void setup() {
|
|||||||
saw_sprite = loadImage("./assets/Sprite-saege.png");
|
saw_sprite = loadImage("./assets/Sprite-saege.png");
|
||||||
bob_sprite = loadImage("./assets/Sprite-bob.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");
|
savefile.loadJson("./saves/save.json");
|
||||||
|
|
||||||
|
music.loop(1, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chris
|
// Chris
|
||||||
@ -110,6 +133,7 @@ void draw() {
|
|||||||
// game state
|
// game state
|
||||||
if (isgame) {
|
if (isgame) {
|
||||||
|
|
||||||
|
|
||||||
// Go to second or first slide
|
// Go to second or first slide
|
||||||
if(ship_zero.pos.x > 0) {
|
if(ship_zero.pos.x > 0) {
|
||||||
start_slide = false;
|
start_slide = false;
|
||||||
|
|||||||
2
keys.pde
2
keys.pde
@ -5,6 +5,7 @@ void keyPressed() {
|
|||||||
if (key == CODED) {
|
if (key == CODED) {
|
||||||
if(keyCode == UP) {
|
if(keyCode == UP) {
|
||||||
NORTH = true;
|
NORTH = true;
|
||||||
|
if(!idle_motor.isPlaying()) idle_motor.play();
|
||||||
} else if (keyCode == DOWN) {
|
} else if (keyCode == DOWN) {
|
||||||
SOUTH = true;
|
SOUTH = true;
|
||||||
} else if (keyCode == LEFT) {
|
} else if (keyCode == LEFT) {
|
||||||
@ -21,6 +22,7 @@ void keyPressed() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Marla
|
// Marla
|
||||||
|
// Pause menu
|
||||||
} else if (keyCode == ESC){
|
} else if (keyCode == ESC){
|
||||||
key = 0;
|
key = 0;
|
||||||
if (isgame) {
|
if (isgame) {
|
||||||
|
|||||||
2
logs.pde
2
logs.pde
@ -39,7 +39,7 @@ class Log {
|
|||||||
strokeWeight(1); // Set stroke weight for the log
|
strokeWeight(1); // Set stroke weight for the log
|
||||||
fill(logcolor); // Set fill color for the log
|
fill(logcolor); // Set fill color for the log
|
||||||
rect(0, 0, logwidth, -logheight); // Draw the log as a rectangle
|
rect(0, 0, logwidth, -logheight); // Draw the log as a rectangle
|
||||||
text(logtext, x, y);
|
// text(logtext, x, y);
|
||||||
strokeWeight(1);
|
strokeWeight(1);
|
||||||
stroke(0);
|
stroke(0);
|
||||||
|
|
||||||
|
|||||||
5
menu.pde
5
menu.pde
@ -90,7 +90,10 @@ class Stats extends Menus {
|
|||||||
text("Trees Sawed: " , 100, 70);
|
text("Trees Sawed: " , 100, 70);
|
||||||
text(trees_sawed, 500, 70);
|
text(trees_sawed, 500, 70);
|
||||||
text("Insgesamt Spielzeit", 100, 90);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
15
readme.org
15
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 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 Robi muss noch beschleunigen können
|
||||||
*** DONE setze bob auf den Robi
|
*** DONE setze bob auf den Robi
|
||||||
*** TODO Wir brauchen Geräusche
|
*** DONE Wir brauchen Geräusche
|
||||||
*** TODO Richtige Texte am Anfang zum erklären
|
*** DONE 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 End menu
|
||||||
*** TODO Roboter muss abprallen, kaputt gehen
|
*** TODO Game neustarten können
|
||||||
*** BUG sometimes a log gets stuck in sawed = false state
|
*** DONE Roboter muss kaputt gehen können
|
||||||
** Menu
|
** Menu
|
||||||
*** DONE Statistikseite: Spielzeit, Bäume gefällt, Zeit gestoppt
|
*** DONE Statistikseite: Spielzeit, Bäume gefällt, Zeit gestoppt
|
||||||
*** DONE Richtige Texte im Menu
|
*** DONE Richtige Texte im Menu
|
||||||
@ -15,3 +15,8 @@ Wird noch nicht benutzt
|
|||||||
*** DONE nochmal die statistikseite überarbeiten
|
*** DONE nochmal die statistikseite überarbeiten
|
||||||
**** DONE Math for best_game_time
|
**** DONE Math for best_game_time
|
||||||
**** TODO Why doesnt bestgametime work
|
**** 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
|
||||||
|
|||||||
7
ship.pde
7
ship.pde
@ -14,7 +14,7 @@ class Ship {
|
|||||||
boolean hasSaw = false;
|
boolean hasSaw = false;
|
||||||
int nextLog;
|
int nextLog;
|
||||||
|
|
||||||
int health = 3;
|
int health = 150;
|
||||||
|
|
||||||
Ship() {
|
Ship() {
|
||||||
// pos.x = width/2;
|
// pos.x = width/2;
|
||||||
@ -40,7 +40,8 @@ class Ship {
|
|||||||
// println(newX, " : ", newY);
|
// println(newX, " : ", newY);
|
||||||
|
|
||||||
if (health == 0) {
|
if (health == 0) {
|
||||||
exit();
|
isgame = false;
|
||||||
|
isend = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
colliding_logs = false;
|
colliding_logs = false;
|
||||||
@ -124,6 +125,8 @@ class Ship {
|
|||||||
speed.sub(acceleration);
|
speed.sub(acceleration);
|
||||||
pos.add(0, 0);
|
pos.add(0, 0);
|
||||||
pos.add(speed.mult(2));
|
pos.add(speed.mult(2));
|
||||||
|
|
||||||
|
health = health - 1;
|
||||||
}
|
}
|
||||||
// println(speed);
|
// println(speed);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user