Compare commits
6 Commits
007bb67a0d
...
abprallen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e391e2fc88 | ||
|
|
e7940aa125 | ||
|
|
3e56813b04 | ||
|
|
02b0a39c75 | ||
|
|
3b84ef5b77 | ||
| a059b2cf2b |
100
#simulation.pde#
100
#simulation.pde#
@@ -1,100 +0,0 @@
|
|||||||
boolean ismenu = true;
|
|
||||||
boolean isgame = false;
|
|
||||||
PVector pos = new PVector(220, 50);
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
size(800,800);
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://forum.processing.org/two/discussion/19925/rotating-an-object-and-making-it-move-with-a-variable.html
|
|
||||||
void draw() {
|
|
||||||
// debug();
|
|
||||||
|
|
||||||
if (ismenu) {
|
|
||||||
mainMenu();
|
|
||||||
} else if (isgame) {
|
|
||||||
play();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int rotation;
|
|
||||||
void play() {
|
|
||||||
background(255);
|
|
||||||
|
|
||||||
rotate(radians(rotation));
|
|
||||||
translate(pos.x, pos.y);
|
|
||||||
rect(0, 0, 20, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mainMenu() {
|
|
||||||
background(246, 244, 235);
|
|
||||||
|
|
||||||
fill(116, 155, 194);
|
|
||||||
textSize(128);
|
|
||||||
textAlign(CENTER);
|
|
||||||
text("p4dash", width/2, height/2 - 100);
|
|
||||||
// go to game
|
|
||||||
fill(70, 130, 169);
|
|
||||||
if (drawRectWithMouseColission(width/2, height/2, 300, 100)) {
|
|
||||||
if (mousePressed) {
|
|
||||||
ismenu = false;
|
|
||||||
isgame = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fill(0);
|
|
||||||
textSize(40);
|
|
||||||
text("Play", width/2, height/2);
|
|
||||||
// go to editor
|
|
||||||
fill(70, 130, 169);
|
|
||||||
if (drawRectWithMouseColission(width/2, height/2+200, 300, 100)) {
|
|
||||||
if (mousePressed) {
|
|
||||||
ismenu = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fill(0);
|
|
||||||
textSize(40);
|
|
||||||
text("Editor", width/2, height/2+200);
|
|
||||||
fill(145, 200, 228);
|
|
||||||
// exit game
|
|
||||||
if (drawRectWithMouseColission(50, 100, 80, 40)) {
|
|
||||||
if (mousePressed) {
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fill(0);
|
|
||||||
textSize(40);
|
|
||||||
textAlign(CENTER);
|
|
||||||
text("Exit", 50, 110);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rectangle with editor colission
|
|
||||||
boolean drawRectWithMouseColission(int x, int y, int rectwidth, int rectheight) {
|
|
||||||
// Draw A Rect
|
|
||||||
rectMode(CENTER);
|
|
||||||
rect(x, y, rectwidth, rectheight);
|
|
||||||
|
|
||||||
// Check it for collission
|
|
||||||
if((mouseX > x - rectwidth/2 && mouseX < x + rectwidth/2) && (mouseY > y - rectheight/2 && mouseY < y + rectheight/2)) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void keyPressed() {
|
|
||||||
if (ismenu) {
|
|
||||||
} else if (isgame) {
|
|
||||||
if (key == CODED) {
|
|
||||||
if (keyCode == UP) {
|
|
||||||
pos.x = pos.x + 1;
|
|
||||||
} else if (keyCode == DOWN) {
|
|
||||||
pos.x = pos.x - 1;
|
|
||||||
} else if (keyCode == LEFT) {
|
|
||||||
rotation = rotation +1;
|
|
||||||
} else if (keyCode == RIGHT) {
|
|
||||||
rotation = rotation -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
(undo-tree-save-format-version . 1)
|
|
||||||
"f7678610572151071a75b80e34c3a939accf7c9b"
|
|
||||||
[nil nil nil nil (25974 54439 79887 0) 0 nil]
|
|
||||||
([nil nil ((#("
|
|
||||||
|
|
||||||
" 0 2 (fontified t)) . 1) (undo-tree-id0 . -1) (undo-tree-id1 . -1) (undo-tree-id2 . -1) (undo-tree-id3 . -1) (undo-tree-id4 . -1) (undo-tree-id5 . -1) (undo-tree-id6 . -2) 2 (t 25974 54118 112253 507000)) nil (25974 54439 79883 0) 0 nil])
|
|
||||||
([nil nil ((1471 . 1474) (1469 . 1469) (1469 . 1471) (1463 . 1469) (1461 . 1463) (1460 . 1460) (1460 . 1461) (1459 . 1460) (1458 . 1459) (1456 . 1457) (1455 . 1456) (#("." 0 1 (face font-lock-string-face fontified t)) . -1455) (undo-tree-id7 . -1) (undo-tree-id8 . -1) (undo-tree-id9 . -1) (undo-tree-id10 . -1) (undo-tree-id11 . -1) (undo-tree-id12 . -1) (undo-tree-id13 . -1) (#(" " 0 1 (face font-lock-string-face fontified t)) . -1456) (undo-tree-id14 . -1) (undo-tree-id15 . -1) (undo-tree-id16 . -1) (undo-tree-id17 . -1) (undo-tree-id18 . -1) 1457 (1454 . 1457) (1453 . 1455) (#("\"" 0 1 (fontified nil)) . -1453) (undo-tree-id19 . -1) (undo-tree-id20 . -1) (1452 . 1454) (1451 . 1452) (1448 . 1451) (1447 . 1447) (1447 . 1448) (#("N" 0 1 (fontified t)) . -1447) (undo-tree-id21 . -1) (undo-tree-id22 . -1) (#("e" 0 1 (fontified t)) . -1448) (undo-tree-id23 . -1) (undo-tree-id24 . -1) 1449 (1448 . 1449) (1446 . 1446) (1446 . 1448) (1440 . 1446) (1439 . 1440) (1438 . 1439) (1437 . 1437) (1437 . 1438) (1436 . 1438) (#("(" 0 1 (face font-lock-keyword-face fontified nil)) . -1436) (1436 . 1437) (1430 . 1436) (1429 . 1429) (1429 . 1430) (#("o" 0 1 (fontified t)) . -1429) (undo-tree-id25 . -1) (undo-tree-id26 . -1) 1430 (1429 . 1429) (1429 . 1430) (1427 . 1429) (#(" " 0 2 (fontified nil)) . 1426) (undo-tree-id27 . -2) (1428 . 1429) (1425 . 1428) (t 25974 54439 84243 136000) 1379) nil (25974 55177 491605 0) 0 nil])
|
|
||||||
([nil nil ((1475 . 1476) (t 25974 55177 494845 710000)) nil (25974 55179 791073 0) 0 nil])
|
|
||||||
([nil current ((apply -3 1427 1480 undo--wrap-and-run-primitive-undo 1427 1480 ((1429 . 1432) 1443))) nil (25974 55193 449487 0) 0 nil])
|
|
||||||
nil
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
(undo-tree-save-format-version . 1)
|
|
||||||
"aafce57dc9d3ed6c354179a6ca1caa678609b93f"
|
|
||||||
[nil nil nil nil (25974 55370 872343 0) 0 nil]
|
|
||||||
([nil nil ((#("logwidth/2, y+5, 170*0.3, 160*0.3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void logCollide() " 0 13 (fontified t) 13 14 (prettify-symbols-end 918 prettify-symbols-start 917 composition (0 1 [32 65 57709]) fontified t) 14 20 (fontified t) 20 21 (prettify-symbols-end 925 prettify-symbols-start 924 composition (1 1 [32 65 57711]) fontified t) 21 29 (fontified t) 29 30 (prettify-symbols-end 934 prettify-symbols-start 933 composition (1 1 [32 65 57711]) fontified t) 30 42 (fontified t) 42 45 (fontified t) 45 46 (fontified t) 46 47 (fontified t) 47 49 (fontified t) 49 50 (face font-lock-type-face fontified t) 50 51 (face font-lock-type-face fontified t) 51 52 (face font-lock-type-face fontified t) 52 53 (face font-lock-type-face c-type c-decl-id-start fontified t) 53 54 (fontified t) 54 55 (face font-lock-function-name-face fontified t) 55 56 (face font-lock-function-name-face fontified t) 56 57 (face font-lock-function-name-face fontified t) 57 58 (face font-lock-function-name-face fontified t) 58 59 (face font-lock-function-name-face fontified t) 59 60 (face font-lock-function-name-face fontified t) 60 61 (face font-lock-function-name-face fontified t) 61 62 (face font-lock-function-name-face fontified t) 62 63 (face font-lock-function-name-face fontified t) 63 64 (face font-lock-function-name-face fontified t) 64 65 (fontified t) 65 66 (fontified t) 66 67 (fontified t)) . -904) (undo-tree-id10 . -44) (undo-tree-id11 . -61) (undo-tree-id12 . -67) 971 (970 . 971) (968 . 970) (#("(" 0 1 (face font-lock-variable-name-face fontified nil)) . -968) (968 . 969) (#(" " 0 1 (fontified t)) . -968) (undo-tree-id13 . -1) 969 (965 . 969) (#("o" 0 1 (face font-lock-variable-name-face fontified t)) . -965) (undo-tree-id14 . -1) 966 (965 . 966) (#("ide() " 0 1 (face font-lock-function-name-face fontified t) 1 2 (face font-lock-function-name-face fontified t) 2 3 (face font-lock-function-name-face fontified t) 3 4 (fontified t) 4 5 (fontified t) 5 6 (fontified t)) . -965) (undo-tree-id15 . -4) (undo-tree-id16 . -6) 971 (970 . 971) (#(";" 0 1 (fontified t)) . -970) (undo-tree-id17 . -1) (#("
|
|
||||||
" 0 1 (fontified t)) . -971) (undo-tree-id18 . -1) (#(" " 0 1 (fontified t)) . -972) (undo-tree-id19 . -1) (#(" " 0 1 (fontified t)) . -973) (undo-tree-id20 . -1) 974 (971 . 974) (970 . 971) (#("L" 0 1 (face font-lock-type-face fontified t)) . -969) (undo-tree-id21 . -1) (undo-tree-id22 . -1) (#("o" 0 1 (face font-lock-type-face fontified t)) . -970) (undo-tree-id23 . -1) (undo-tree-id24 . -1) (#("g" 0 1 (face font-lock-type-face fontified t)) . -971) (undo-tree-id25 . -1) (undo-tree-id26 . -1) 972 (970 . 972) (969 . 969) (969 . 970) (968 . 970) (#("(" 0 1 (face font-lock-variable-name-face fontified nil)) . -968) (968 . 969) (959 . 968) (954 . 954) (954 . 959) (953 . 953) (953 . 954) (951 . 953) (#(" " 0 2 (fontified nil)) . 950) (undo-tree-id27 . -2) (952 . 953) (949 . 952) (t 25974 54118 112720 118000) 948) nil (25974 55370 872341 0) 0 nil])
|
|
||||||
([nil nil ((#("
|
|
||||||
" 0 1 (fontified nil) 1 3 (fontified nil)) . 949) (undo-tree-id1 . -3) (#("
|
|
||||||
" 0 1 (fontified nil)) . 952) (undo-tree-id2 . -1) (950 . 952) (#(" " 0 2 (fontified nil)) . 951) (undo-tree-id3 . -2) (#("v" 0 1 (face font-lock-type-face fontified nil)) . 953) (undo-tree-id4 . -1) (#("oid l" 0 1 (face font-lock-type-face fontified nil) 1 2 (face font-lock-type-face fontified nil) 2 3 (face font-lock-type-face fontified nil) 3 4 (fontified nil) 4 5 (face font-lock-function-name-face fontified nil)) . 954) (undo-tree-id5 . -5) (#("ogCollide" 0 1 (face font-lock-function-name-face fontified nil) 1 2 (face font-lock-function-name-face fontified nil) 2 3 (face font-lock-function-name-face fontified nil) 3 4 (face font-lock-function-name-face fontified nil) 4 5 (face font-lock-function-name-face fontified nil) 5 6 (face font-lock-function-name-face fontified nil) 6 7 (face font-lock-function-name-face fontified nil) 7 8 (face font-lock-function-name-face fontified nil) 8 9 (face font-lock-function-name-face fontified nil)) . 959) (undo-tree-id6 . -9) (#("(" 0 1 (face font-lock-variable-name-face fontified nil)) . 968) (968 . 969) (#("()" 0 1 (fontified nil) 1 2 (fontified nil)) . 968) (undo-tree-id7 . -1) (#("L" 0 1 (face font-lock-type-face fontified nil)) . 969) (undo-tree-id8 . -1) (#("og" 0 1 (face font-lock-type-face fontified nil) 1 2 (face font-lock-type-face fontified nil)) . 970) (undo-tree-id9 . -2) (969 . 972) (#(";" 0 1 (fontified nil)) . 970) (#("
|
|
||||||
" 0 1 (fontified nil) 1 2 (fontified nil) 2 3 (fontified nil)) . 971) (970 . 974) (#(" " 0 1 (fontified nil)) . 970) (965 . 971) (#("o" 0 1 (face font-lock-variable-name-face fontified nil)) . 965) (965 . 966) (#("ide " 0 1 (face font-lock-function-name-face fontified nil) 1 2 (face font-lock-function-name-face fontified nil) 2 3 (face font-lock-function-name-face fontified nil) 3 4 (fontified nil)) . 965) (968 . 969) (#("(" 0 1 (face font-lock-variable-name-face fontified nil)) . 968) (968 . 969) (#("()" 0 1 (fontified nil) 1 2 (fontified nil)) . 968) (#(" " 0 1 (fontified nil)) . 970) (904 . 971)) nil (25974 55370 872332 0) 0 nil])
|
|
||||||
([nil current ((970 . 971) (968 . 970) (#("(" 0 1 (face font-lock-variable-name-face fontified nil)) . -968) (968 . 969) (959 . 968) (954 . 954) (954 . 959) (953 . 953) (953 . 954) (951 . 953) (#(" " 0 2 (fontified nil)) . 950) (undo-tree-id0 . -2) (952 . 953) (949 . 952) (t 25974 54118 112720 118000) 948) nil (25974 55370 872323 0) 0 nil])
|
|
||||||
nil
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
(undo-tree-save-format-version . 1)
|
|
||||||
"5a0971ca47ac30921e9b713a56e832b4cdda3829"
|
|
||||||
[nil nil nil nil (25974 55084 608787 0) 0 nil]
|
|
||||||
([nil nil ((#("
|
|
||||||
" 0 1 (fontified t)) . -254) (undo-tree-id0 . -1) (undo-tree-id1 . -1) (undo-tree-id2 . -1) (undo-tree-id3 . -1) (undo-tree-id4 . -1) (undo-tree-id5 . -1) (#("
|
|
||||||
" 0 1 (fontified t)) . -255) (undo-tree-id6 . -1) (undo-tree-id7 . -1) (undo-tree-id8 . -1) (undo-tree-id9 . -1) (undo-tree-id10 . -1) (#(" " 0 1 (fontified t)) . -256) (undo-tree-id11 . -1) (undo-tree-id12 . -1) (undo-tree-id13 . -1) (#(" " 0 1 (fontified t)) . -257) (undo-tree-id14 . -1) (undo-tree-id15 . -1) 258 (256 . 258) (#(" " 0 2 (fontified nil)) . 255) (undo-tree-id16 . -2) (257 . 258) (254 . 257) (t 25974 54118 112987 610000) 251) nil (25974 55084 608783 0) 0 nil])
|
|
||||||
([nil nil ((apply 3 484 507 undo--wrap-and-run-primitive-undo 484 507 ((#("// " 0 1 (face font-lock-comment-delimiter-face fontified t c-is-sws t c-in-sws t) 1 3 (face font-lock-comment-delimiter-face fontified t c-in-sws t)) . -488) 507))) nil (25974 55118 133801 0) 0 nil])
|
|
||||||
([nil nil ((484 . 485)) nil (25974 55118 133801 0) 0 nil])
|
|
||||||
([nil nil ((511 . 514) (509 . 509) (509 . 511) (508 . 509) (506 . 507) (505 . 506) (504 . 505) (503 . 505) (#("\"" 0 1 (fontified nil)) . -503) (503 . 504) (#("\"" 0 1 (face font-lock-string-face fontified nil)) . -503) (undo-tree-id17 . -1) (#("\"" 0 1 (face font-lock-string-face fontified t)) . 504) (503 . 505) (#("\"" 0 1 (fontified nil)) . -503) (502 . 504) (501 . 502) (499 . 501) (498 . 498) (498 . 499) (497 . 497) (497 . 498) (#("colliding" 0 9 (fontified t)) . 497) (undo-tree-id18 . -8) (undo-tree-id19 . -8) (undo-tree-id20 . -1) (undo-tree-id21 . -1) (undo-tree-id22 . -1) (undo-tree-id23 . -1) (undo-tree-id24 . -9) (undo-tree-id25 . -9) 498) nil (25974 55118 133798 0) 0 nil])
|
|
||||||
([nil current ((apply -3 485 520 undo--wrap-and-run-primitive-undo 485 520 ((489 . 492) 497))) nil (25974 55141 588556 0) 0 nil])
|
|
||||||
nil
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
(undo-tree-save-format-version . 1)
|
|
||||||
"6ba7b52093be99eddee500fa2cd073dfd0644cc9"
|
|
||||||
[nil nil nil nil (25965 46461 784103 0) 0 nil]
|
|
||||||
([nil nil ((122 . 123) (120 . 122) (#("#" 0 1 (fontified t)) . -120) (undo-tree-id0 . -1) 121 (120 . 121) (t 25939 34023 800616 55000)) nil (25965 46461 784100 0) 0 nil])
|
|
||||||
([nil nil ((83 . 84) (t 25965 46461 786953 630000) 48) nil (25974 17116 102820 0) 0 nil])
|
|
||||||
([nil current ((#("
|
|
||||||
" 0 1 (fontified t)) . 84) (undo-tree-id0 . 1)) nil (25974 17116 102818 0) 0 nil])
|
|
||||||
nil
|
|
||||||
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.
@@ -1,3 +1,4 @@
|
|||||||
|
// Tarek
|
||||||
class Collectable {
|
class Collectable {
|
||||||
float cwidth, cheight;
|
float cwidth, cheight;
|
||||||
boolean is_attached = false;
|
boolean is_attached = false;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Marla
|
||||||
class Files {
|
class Files {
|
||||||
|
|
||||||
boolean checkSaveFile(String filepath) {
|
boolean checkSaveFile(String filepath) {
|
||||||
|
|||||||
6
keys.pde
6
keys.pde
@@ -1,8 +1,11 @@
|
|||||||
boolean NORTH, SOUTH, ROTATEL, ROTATER;
|
boolean NORTH, SOUTH, ROTATEL, ROTATER;
|
||||||
|
|
||||||
|
// Julia, Max
|
||||||
void keyPressed() {
|
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) {
|
||||||
@@ -18,6 +21,8 @@ void keyPressed() {
|
|||||||
stats_menu.trees_sawed = stats_menu.trees_sawed + 1;
|
stats_menu.trees_sawed = stats_menu.trees_sawed + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Marla
|
||||||
|
// Pause menu
|
||||||
} else if (keyCode == ESC){
|
} else if (keyCode == ESC){
|
||||||
key = 0;
|
key = 0;
|
||||||
if (isgame) {
|
if (isgame) {
|
||||||
@@ -27,6 +32,7 @@ void keyPressed() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Julia
|
||||||
void keyReleased() {
|
void keyReleased() {
|
||||||
if(keyCode == UP) {NORTH = false; }
|
if(keyCode == UP) {NORTH = false; }
|
||||||
else if (keyCode == DOWN) SOUTH = false;
|
else if (keyCode == DOWN) SOUTH = false;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// Julia, Max
|
||||||
|
|
||||||
// Outside wall
|
// Outside wall
|
||||||
Log[] walls = {new Log(-30, 275, 40, 275, false, true), new Log(-30, 600, 40, 275, false, true)};
|
Log[] walls = {new Log(-30, 275, 40, 275, false, true), new Log(-30, 600, 40, 275, false, true)};
|
||||||
|
|
||||||
@@ -5,10 +7,10 @@ void create_level(int logcount) {
|
|||||||
logs = new Log[logcount];
|
logs = new Log[logcount];
|
||||||
randomSeed((int)random(0, 30));
|
randomSeed((int)random(0, 30));
|
||||||
for (int i = 1; i < logs.length; i++) {
|
for (int i = 1; i < logs.length; i++) {
|
||||||
logs[i] = new Log((int) random(0, width), (int) random(0, height), 20, 60 + random(0, 40), true, false);
|
logs[i] = new Log((int) random(20, width), (int) random(0, height), 20, 60 + random(0, 40), true, false);
|
||||||
}
|
}
|
||||||
// 2nd slide entry
|
// 2nd slide entry
|
||||||
logs[0] = new Log(-5, 325, 10, 50, false, true);
|
logs[0] = new Log(-15, 325, 10, 50, false, true);
|
||||||
|
|
||||||
// debug log
|
// debug log
|
||||||
logs[1] = new Log(-300, 100, 20, 100, true, false);
|
logs[1] = new Log(-300, 100, 20, 100, true, false);
|
||||||
|
|||||||
4
logs.pde
4
logs.pde
@@ -19,8 +19,8 @@ class Log {
|
|||||||
//draw();
|
//draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tarek
|
||||||
void drawLog(int logtext) {
|
void drawLog(int logtext) {
|
||||||
|
|
||||||
if (sawed) {
|
if (sawed) {
|
||||||
logcolor = color(128, 88, 60);
|
logcolor = color(128, 88, 60);
|
||||||
if (a > -90) a = a - 1;
|
if (a > -90) a = a - 1;
|
||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
36
menu.pde
36
menu.pde
@@ -16,6 +16,7 @@ class Menus {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Julia
|
||||||
class MainMenu extends Menus {
|
class MainMenu extends Menus {
|
||||||
|
|
||||||
void playButton(float x, float y, float w, float h) {
|
void playButton(float x, float y, float w, float h) {
|
||||||
@@ -59,6 +60,35 @@ class MainMenu extends Menus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class EndMenu extends Menus {
|
||||||
|
|
||||||
|
void menuButton(float x, float y, float w, float h) {
|
||||||
|
fill(100, 100, 100);
|
||||||
|
if(drawRectWithMouseColission(x, y, w, h) && mousePressed) {
|
||||||
|
ismenu = true;
|
||||||
|
ispause = false;
|
||||||
|
isgame = false;
|
||||||
|
}
|
||||||
|
fill(0);
|
||||||
|
textAlign(CENTER, CENTER);
|
||||||
|
textSize(32);
|
||||||
|
text("Menu", x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawMenu() {
|
||||||
|
background(40);
|
||||||
|
// color maincolor = color(100, 100, 100);
|
||||||
|
menuButton(300, 350, 150, 50);
|
||||||
|
|
||||||
|
textSize(100);
|
||||||
|
textAlign(CENTER, CENTER);
|
||||||
|
if (ship_zero.health < 1) {
|
||||||
|
text("You Died", 300, 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Julia, Max, Marla, Chris
|
||||||
class Stats extends Menus {
|
class Stats extends Menus {
|
||||||
int trees_sawed = 0;
|
int trees_sawed = 0;
|
||||||
int best_game_time = 0;
|
int best_game_time = 0;
|
||||||
@@ -88,10 +118,14 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Chris
|
||||||
class StopWatchTimer {
|
class StopWatchTimer {
|
||||||
int startTime = 0, stopTime = 0, pauseTime = 0;
|
int startTime = 0, stopTime = 0, pauseTime = 0;
|
||||||
boolean running = false;
|
boolean running = false;
|
||||||
|
|||||||
@@ -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,18 +15,30 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main Game entry
|
// Main Game entry
|
||||||
|
// 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();
|
||||||
@@ -50,6 +64,7 @@ void play() {
|
|||||||
|
|
||||||
// -----
|
// -----
|
||||||
|
|
||||||
|
|
||||||
// global state
|
// global state
|
||||||
boolean isgame = false;
|
boolean isgame = false;
|
||||||
boolean ismenu = true;
|
boolean ismenu = true;
|
||||||
@@ -61,6 +76,7 @@ boolean start_slide = true;
|
|||||||
// ----- Objectives
|
// ----- Objectives
|
||||||
MainMenu main_menu = new MainMenu();
|
MainMenu main_menu = new MainMenu();
|
||||||
Stats stats_menu = new Stats();
|
Stats stats_menu = new Stats();
|
||||||
|
EndMenu end_menu = new EndMenu();
|
||||||
|
|
||||||
Log[] logs;
|
Log[] logs;
|
||||||
|
|
||||||
@@ -81,6 +97,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);
|
||||||
@@ -92,14 +112,21 @@ void setup() {
|
|||||||
saw_zero = new Saw(-width+100, 100, 20, 50);
|
saw_zero = new Saw(-width+100, 100, 20, 50);
|
||||||
bob = new Bob(500, 400, 20, 40);
|
bob = new Bob(500, 400, 20, 40);
|
||||||
|
|
||||||
|
// Marla
|
||||||
player_sprite = loadImage("./assets/Sprite-robi.png");
|
player_sprite = loadImage("./assets/Sprite-robi.png");
|
||||||
player_sprite_bob = loadImage("./assets/Sprite-robiwithbob.png");
|
player_sprite_bob = loadImage("./assets/Sprite-robiwithbob.png");
|
||||||
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, Max
|
||||||
void draw() {
|
void draw() {
|
||||||
// time debug
|
// time debug
|
||||||
// println(millis(), " start: ", playtime.startTime, " pause: ", playtime.pauseTime);
|
// println(millis(), " start: ", playtime.startTime, " pause: ", playtime.pauseTime);
|
||||||
@@ -107,6 +134,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;
|
||||||
@@ -145,6 +173,16 @@ void draw() {
|
|||||||
stats_menu.draw();
|
stats_menu.draw();
|
||||||
} else if (isend) {
|
} else if (isend) {
|
||||||
// end screen code
|
// end screen code
|
||||||
|
end_menu.drawMenu();
|
||||||
|
|
||||||
|
// get into right state
|
||||||
|
ship_zero.health = 150;
|
||||||
|
ship_zero.pos.x = -width/2;
|
||||||
|
ship_zero.pos.y = height/2;
|
||||||
|
bob.is_attached = false;
|
||||||
|
saw_zero.is_attached = false;
|
||||||
|
create_level(30);
|
||||||
|
ship_zero.hasSaw = false;
|
||||||
|
|
||||||
|
|
||||||
// save
|
// save
|
||||||
16
readme.org
16
readme.org
@@ -1,12 +1,12 @@
|
|||||||
** Ingame
|
** Ingame
|
||||||
*** 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
|
||||||
*** TODO Wir brauchen Geräusche
|
|
||||||
*** DONE setze bob auf den Robi
|
*** DONE setze bob auf den Robi
|
||||||
*** TODO Richtige Texte am Anfang zum erklären
|
*** DONE Wir brauchen Geräusche
|
||||||
*** TODO Abprallen nicht machen, wenn newx nicht erreicht sein kann, sondern wenn Robi tatsächlich die Wand berührt
|
*** DONE Richtige Texte am Anfang zum erklären
|
||||||
*** TODO Roboter muss abprallen, kaputt gehen
|
*** DONE End menu
|
||||||
*** BUG sometimes a log gets stuck in sawed = false state
|
*** DONE Game neustarten können
|
||||||
|
*** 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,9 @@ 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
|
||||||
|
** TODO Stats neu machen
|
||||||
|
|
||||||
|
** 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
|
||||||
|
|||||||
17
ship.pde
17
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;
|
||||||
@@ -25,6 +25,7 @@ class Ship {
|
|||||||
newY = height/2;
|
newY = height/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tarek
|
||||||
void draw() {
|
void draw() {
|
||||||
nextLog = returnIndexOfNearestLog();
|
nextLog = returnIndexOfNearestLog();
|
||||||
|
|
||||||
@@ -39,12 +40,14 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Max, julia
|
||||||
void sawIndicator() {
|
void sawIndicator() {
|
||||||
if (hasSaw) {
|
if (hasSaw) {
|
||||||
if (checkDistance(logs[nextLog], ship_zero) < 40) {
|
if (checkDistance(logs[nextLog], ship_zero) < 40) {
|
||||||
@@ -58,6 +61,7 @@ class Ship {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Max
|
||||||
int returnIndexOfNearestLog() {
|
int returnIndexOfNearestLog() {
|
||||||
float shortest_distance_log_distance = checkDistance(logs[0], ship_zero);
|
float shortest_distance_log_distance = checkDistance(logs[0], ship_zero);
|
||||||
int shortest_distance_log = 0;
|
int shortest_distance_log = 0;
|
||||||
@@ -73,6 +77,7 @@ class Ship {
|
|||||||
return shortest_distance_log;
|
return shortest_distance_log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Max
|
||||||
void simulate() {
|
void simulate() {
|
||||||
// First do the Math but dont move something
|
// First do the Math but dont move something
|
||||||
|
|
||||||
@@ -95,8 +100,10 @@ class Ship {
|
|||||||
if(NORTH) {
|
if(NORTH) {
|
||||||
speed.add(acceleration);
|
speed.add(acceleration);
|
||||||
speed.limit(1.3);
|
speed.limit(1.3);
|
||||||
|
} else if (SOUTH) {
|
||||||
|
speed.mult(0.80);
|
||||||
} else { // decrease it if not
|
} else { // decrease it if not
|
||||||
speed.mult(0.95);
|
speed.mult(0.90);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -120,10 +127,13 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tarek
|
||||||
void logCollide(Log[] loggers) {
|
void logCollide(Log[] loggers) {
|
||||||
for(int i = 0; i < loggers.length; i++) {
|
for(int i = 0; i < loggers.length; i++) {
|
||||||
if(loggers[i].sawed == false) {
|
if(loggers[i].sawed == false) {
|
||||||
@@ -134,6 +144,7 @@ class Ship {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tarek, Marla
|
||||||
void collect(Collectable c) {
|
void collect(Collectable c) {
|
||||||
if (pos.dist(c.pos) < 20) {
|
if (pos.dist(c.pos) < 20) {
|
||||||
if (c.getClass() == Saw.class ) hasSaw = true;
|
if (c.getClass() == Saw.class ) hasSaw = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user