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.
28
kek2.pde
28
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;
|
||||
@ -24,8 +27,18 @@ float checkDistance(Log log, Ship ship) {
|
||||
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();
|
||||
@ -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;
|
||||
|
||||
2
keys.pde
2
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) {
|
||||
|
||||
2
logs.pde
2
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);
|
||||
|
||||
|
||||
5
menu.pde
5
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 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
|
||||
|
||||
7
ship.pde
7
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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user