/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.43$gxYcr1En/rev.3276
*
* authors:
* Melanie
* fhvipa
*
*
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
level l1 = new level(t);
faenger f1 = new faenger(200,400,100,20);
boolean verloren=false;
boolean genau=false;
int stage=-1;
int joint=0;
int rot= 0;
int gruen=0;
int blau=0;
double jointx=0;
int ge=0;
boolean freeze=false;
boolean fertig=false;
int w=0;
int p=1;
int time=500;
boolean gewonnen=false;
int t= 0;
int g= 20;
int z = 0;
int a= 3000;
int rekord1=0;
int rekord2=0;
int rekord3=0;
int rekord4=0;
int variante=0;
boolean richtig=false;
void mouseReleased(){
if(stage==-1){
if(200 < mouseX && mouseX < 300 && 220 < mouseY && mouseY < 280){
if(mouseButton == LEFT){
stage=0;
}
}
}
if(stage==2){
if(190 < mouseX && mouseX < 270 && 390 < mouseY && mouseY < 410){
if(mouseButton == LEFT){
stage=0;
gewonnen=false;
verloren=false;
}
}
}
if(stage==1){
if(freeze==false){
if(400 < mouseX && mouseX < 450 && 330 < mouseY && mouseY < 380){
if(mouseButton == LEFT){
freeze=true;
}
}
}
if(freeze==true){
if(200 < mouseX && mouseX < 340 && 180 < mouseY && mouseY < 200){
if(mouseButton == LEFT){
freeze=false;
}
}
}
if(400 < mouseX && mouseX < 450 && 380 < mouseY && mouseY < 450){
if(mouseButton == LEFT){
stage=0;
}
}
}
if( stage==0){
if(150 < mouseX && mouseX < 200 && 150 < mouseY && mouseY < 200){
if (mouseButton == LEFT){
gewonnen=false;
stage=1;
w=0;
ge=1;
t=0;
p=0;
time=1000;
variante=1;
rot= 0;
gruen=255;
blau=255;
}
}
if(300 < mouseX && mouseX < 350 && 300 < mouseY && mouseY < 350){
if (mouseButton == LEFT){
gewonnen=false;
stage=1;
ge=45;
t=50;
w=50;
p=55;
time=20000;
variante=4;
rot= 50;
gruen=250;
blau=50;
}
}
if(300 < mouseX && mouseX < 350 && 150 < mouseY && mouseY < 200){
if (mouseButton == LEFT){
gewonnen=false;
stage=1;
t=15;
w=20;
ge=25;
p=10;
time=7500;
variante=2;
rot= 205;
gruen=50;
blau=205;
}
}
if(150 < mouseX && mouseX < 200 && 300 < mouseY && mouseY < 350){
if (mouseButton == LEFT){
gewonnen=false;
stage=1;
w=40;
t=35;
ge=45;
p=30;
time=15000;
variante=3;
rot= 50;
gruen=250;
blau=50;
}
}
}
}
fall Schrank[] = new fall();
void setup(){
krank=loadImage("https://ccdzia-bn1305.files.1drv.com/y4pLanPvi-WNPBFCjFaiNqOvLXNAckt4pkYCCkhHJsjof5kLfJmnCjkNT4T-Hq8LnkbD02WrRlQbW377p05x0zTpdmxWOfITII6Oa1WHZr6X-cQNYNT5LqWiFzt2cUE6Lh5MW_hORhOdh5r3fsPPksHgYHbuCahckOkcLDE2_bV5ojvEDSMjEtwrJKBlPzjTEPGrLIvokpeP1FyOyOOOgDAjQ/krankenhaus-l.jpg?psid=1");
halde=loadImage("https://ccdzia-bn1305.files.1drv.com/y4p6Wvq9ou5bkuhAGLOAUorYzhAZTsLCoUmc3fe-i2XMYevAgNirQ89PX7j1bFmQaks_YoTDDDESowOw8ZAYTs5e2kZxrizaGiR4ty36k2S8KA5Z2n8l76yK3xBnqI_ue3U_bnu2stvR8TyRHx5gaZaOTFl6zMd5GhcCIUhonwiIBouY5R1IS53Znl4Hbjr0QoCh2HEvovHUG1TGWMoVIQACg/196-baumgarten-muellhalde-30_Bildgre_ndern.jpg?psid=1");
omak=loadImage("https://ccdzia-bn1305.files.1drv.com/y4pHu55ApTddh6pnsxQEGggdrtHZ-RBx_kTPMETlVq2haBpjebtqgNcWI93GPLNqt_1wP668newC8jwklFnNwg1Fg1zcA5Qc8CwYGn1r8_R1NrU5OLskLnJ_m3ubvGRQLww-G_Av0R0BJighasjb2FDEQhEQ30NbgEONiJH6aLkl-lO2kcSoavGWX0NOc1nvYmCs0UAbYgZ-8xhpjK0SNWt_Q/kind_mag_oma_nicht.jpg?psid=1");
spielp=loadImage("https://ccdzia-bn1305.files.1drv.com/y4pRIyKAsdf9zTXtOcx4uoVjfwEC-h6LfCAjtGUP2j55iJpAKeY50T3Df0j7Q8K1trQuV2StDTi8T6j1FHovCpaJiY46-Rgvm4u27Xx4MgZ1fhwNzMxv_1ANJONzsQITU75gdwYYYoZVR_rSliYkWejTATbqJoel2epEqNKhUU8FW6LqSb8WhxFEvPwNZO5kPo100oUBIGmeKpRx3NrmQZdnA/Beutlerpark-20150704_182243.jpg?psid=1");
weed=loadImage("https://ccdzia-bn1305.files.1drv.com/y4papBl6UVVjFGn447e6lKtiNim9LGIBzisbFNmlsD62he2pzqy7n80FINQUOxQiNWszWCQlr0wnOH1YY-Ti8tUbs2SLMgNCaDAwrfY1OGlPRCNdXui4R1piuqNTp6ciuO8C08zeeDgmjZqlxfp0cNci_fR10-NOqVJNCpTYbdZVBAw4PgZaFgYBL4dV0aaYjBRuQ8oAoMjjF6sw-fbmKc0gg/c1920x1080_69.jpg?psid=1");
pulvermix=loadImage("https://ccdzia-bn1305.files.1drv.com/y4pviHREDLR5F-TjHHc_2e-kj9Y2OzLJrHgA2uqhzPfvFjYYLmN9dG2suRvo9-UfZrpooln88e6n2f8QWvr1zg43kvzFxVpaOqFX3YB6h_1sko0_573SpYmOyySM9DB1fJe0IbfKeFxn4tf0eFqQBQhBCskE56MwZHry-F-GLY5fY5wnz6-Ww5m3RKerqrRclEuPMmC3dxtNp6xpMUcF9AwrQ/0_big.jpg?psid=1");
pulver=loadImage("https://ccdzia-bn1305.files.1drv.com/y4pLVZCl6LC0tYZgRlaYN2BX11ciD0tNtcK5rliS1iNRL44JefVIrZ4XexkM2iR0ZHWWZApdysMnMjVh52n7CiVjinunowdqjtsDLrHSiNaQFrxmU2Ym2Ni3SZERU6m26fxI3EJCkO3kJnLpMEaNF_UqFUKjXgdODy9Gn4LGn5rwmZx6viTySKZBTShOz6ZyOvQRhq8WrSNlqKUtaeUO_VF7A/Holi-Farbpulver_1.jpg?psid=1");
opposum=loadImage("https://ccdzia-bn1305.files.1drv.com/y4pbb0aiSTwEyMyQ5AwVnLvecXv5Z6ZJCEflJ_tQPnPCZiXO48NcPqlz90fOc5HhSF6beCM40ZM1stw2yC2TJ8-gMH_3V6VLnEIN_sxbLMepi9wIStn1j66HN8FTBdjYcrPepgq05WzL10Yctk7dvoYas-ItHxxta8sGX3tMFYf8a8Pdy4rqR30smBDoxAVlEIijOJysDV1QUm22HrefSZKzg/t67653f_das-schielende-opossum-heidi.jpg?psid=1");
won=loadImage("https://ccdzia-bn1305.files.1drv.com/y4p9kIKghOjInZuc7oh15Ps0nnClpupm5KPGjoIm8acxaOo4nltvvJY1u01fBOb9rQtfgk1rZ9mjTAkCjLFEjJTJC_yPQYDgIbbGc_bvNZPPKB6MnpLjLh8Bs4J-AnslVBbcOLdcXhxiRUsWxGLsw6YYfaZDW5oUU2wvtwNHFL_TFAYa9bTlYzpiU7yOefSsplN8hb2dJMVyq16GNmpqll6Ig/coole%20oma%20pamaki.png?psid=1");
lost= loadImage("https://ccdzia-bn1305.files.1drv.com/y4pE_aYopcWGsj8CPHRyfeYXVi3srbMRBGwDlfiF3DP10N3qPUtmCVjpjGte10sWvQ85fj2DlKu7hilQ71HSvlf8wyqQqVeBj9fwM5eBRk92P2Swar4YH0Ag-PaMOF05fJKKkT3vEnX8x5Dh6wsCqx8MseUYkpeWz3ntb37IeHjHfR_PKVodduuTy6vRWE7u2YibRaL7Xkslvq38nZxMnNLsQ/deznuts.jpg?psid=1");
rundl = loadImage("https://ccdzia-bn1305.files.1drv.com/y4pJU_xTzB8NJ3AyOi2uJHhz1nxNNptQQh3xrHgX2ZxbZaTNn3NUkk2i6MrwHmHkD2xTkvb3aCGHQTBwKPMCDhf-QBGcklBjCjn0QlLuJhCZKXQsA00Y0TR1FyVGn8bYvkVIt_3zNYASeiz-GzfHgg6dnFwrOKi_RSFchh3mV7leCU7a0lbUsOEiIWPSg5cPTzPeb32JiDW0mNEbYssvLjCFA/tasten.jpeg?psid=1");
oma = loadImage("http://www.lsg.musin.de/klassen/sj1617/images/c/c6/OMA.png");
tw = loadImage("http://www.lsg.musin.de/klassen/sj1617/images/1/1a/Twa.png");
tb = loadImage("https://ccdzia-bn1305.files.1drv.com/y4pMPaERGH5E-fT8Zulq88Jz2FtD_s8zz1IykKiDLrv9W5WNAGy4qn-GS1o5kDtmcq03M9b7iTCIFQIazMcTMBRdGu2eNL8swetG_rC3C1gIfKJtTBNZPrt1wUjW_BrMxjq_3xWCTYDGvzCEEpxu6kYCtE0L_L1eh5stRnKfLl6_cCiPiwotwKXXezVAmZ2-dZcyyF9-YebbCc00MQPN-B-CA/tbaf.png?psid=1");
j = loadImage("https://p6kozg-bn1305.files.1drv.com/y4pOZX-5XDx7mHHyYUlvtP7rbGFEq4ULwjd7Z8vlV0mZQhBDmADG0entt4Vdm60RKTlDa7zWcYO2ZLdbK6lKYLcKE_vXEr3MKUuMxD_rAyBFM3HBenhZj6m2GZsdRVp6whWorHKmYR5tf59-JMW1VAiY16OpybMry0oLoiLSTFNgrjmvMo_P_mrVwyUv_ieRZkEzEyT9H_680vB9IoiVSFVAQ/jaf.png?psid=1");
tr =loadImage("https://ccdzia-bn1305.files.1drv.com/y4pHlWexgiLTdldbqFxhCejnLo_lQtO6RjZAKWVRYfQJwg_NyhOld7AIcS6VBX6cddw3-8M4FHs91G72q8kFMcZYP0qVhNx3U-vu4TjyNbj0GvKD4U7f8MUW9l9QYyHJ-xkGRGA9udg3OAZi2C88B0haDNly_g90v6HCKf8zD2IrKR8_48T0_sjmK8_nvSQvxW0vN6LEp_ULxCrNcxkPH2U5w/ptaf.png?psid=1");
tr= loadImage("https://ccdzia-bn1305.files.1drv.com/y4peruVufYAAS8BkrfugnnsWlXakQbc28IcuvDQzZ_Ns24NupfCdQk9Ss2ge0IeSS64e41ZmQQMU5VfqInq5c6ZvkpixvKL9FvJGXb77d0OEvjIWk0KtaIIcbsHQSOMRmoCM45_4YiDuP7WGf5AXt1rtj7P_6ON0PO_RAAyv2mdf9NgoH82HdbD_oM--GCIBE4URE_jGqCQ44OcLrtJwZ27CA/ptaf.png?psid=1");
tg = loadImage("https://ccdzia-bn1305.files.1drv.com/y4pq4KJVj06M33Nf73w2JSPeKU1uLGhFRgyBPTRU5SF3a3ql9CE5bbfF2Ml1Go49-CTa9qg1XuThMnE4EvqW9psiHlUPrucZqeARHXAi8kWPN-K50WKbE-_AAOiNzxieBhLOM4o9Padp7Qy628NX7Kz1F_sH5mTbwHohGNnDYlO2_LgZj5knDQ-xZ77QceDHHzDbzkQvltpH5uQhPO_OAiz2Q/tga.png?psid=1");
win= loadImage("https://ccdzia-bn1305.files.1drv.com/y4p4k_tvsJBicdxU5_1piHdXKtNtIIchf5kkbDOycVIsOdt4okJ10E1BpcsYIB_OpOlAx4FUgJFWTTVpOAD4OKImFTrgRQnJ8pOs3FkyYZy-iSF1JhBssF_NdFbUeOGcv5FSKrdONxkTfo377Dq_K3fwq4-KlxAs6VAY7kpAuUXBeshFDZdQe6oEUfatEsKSl-k8QFGHEFoMmCdTDIKTN1RiA/win.jpg?psid=1");
size(500,500);
for (int i = 0; i<a; i++) {
z++;
Schrank[i] = new fall(z);
}
}
class level{
int hoch;
level(int h){
hoch =Math.round(h*0.1);
}
}
class faenger{
int X;
int Y;
int B;
int H;
boolean D;
faenger(int x,int y,int b,int h){
X = x;
Y = y;
B = b;
H = h;
D=true;
}
void zeichnefaenger(){
fill(0);
image(oma,X,Y,100,100);
}
void bewegen(){
if (keyPressed==true) {
if (keyCode==LEFT && X > -16) {
X -=4;
}
if (keyCode==RIGHT && X+B < 500) {
X +=4;
}
}
}
}
class fall{
int X;
double Y;
int H;
int r;
int g;
double SW;
int b;
boolean D;
boolean E;
fall(int y){
X=(int)(Math.random()*(width-70)+40);
Y=z*-100;
D=true;
SW=0.5;
H=20;
E=true;
entscheide();
gut();
}
void entscheide(){
if(Math.random()*1>0.5){
E=false;
}
}
void gut(){
if(Math.random()*1<SW){
D=false;
}
}
void farbe (){
if(D==true&&E==false){
image(tr,X,Y,20,20);
}
if(D==true&&E==true){
image(tg,X,Y,30,30);
}
if(D==false&&E==false){
image(tw,X,Y,30,30);
}
if(D==false&&E==true){
image(tb,X,Y,30,30);
}
}
void fallen(){
Y++;
}
}
void draw(){
if(stage==-1){
image(omak,-100,0,750,500);
textFont(createFont("Georgia Bold",50))
fill(50,250,50);
rect(200,220,100,60);
String anzeige = "CATCH IT";
text(anzeige ,120,200);
fill(0);
textFont(createFont("Georgia Bold",30));
String anzeige = "play";
text(anzeige ,214,258);
}
if(p==0&&ge==0&&ge==0&&t==0){
richtig=true;
}
if(p>0||ge>0||t>0||w>0){
richtig=false;
}
if(freeze==true){
image(opposum,0,0,500,500);
textFont(createFont("Georgia Bold",30))
fill(255,0,0);
String anzeige = "continue";
text(anzeige ,200,200);
}
if(freeze==false){
if(stage==2){
image(pulver,0,0,500,500);
if(gewonnen==true){
if(variante==1){
if(time>rekord1){
rekord1=time;
fill(0);
}
}
if(variante==2){
if(time>rekord2){
rekord2=time;
}
}
if(variante==3){
if(time>rekord3){
rekord3=time;
}
}
if(variante==4){
if(time>rekord4){
rekord4=time;
}
}
}
if(variante==1){
if(rekord1==time){
if(verloren==false){
image(pulvermix,0,0,500,500);
textFont(createFont("Georgia",30));
String anzeige = "NEW HIGHSCORE";
text(anzeige ,150,300);
}
}
}
if(variante==2){
if(rekord2==time){
if(verloren==false){
image(pulvermix,0,0,500,500);
textFont(createFont("Georgia",30));
String anzeige = "NEW HIGHSCORE";
text(anzeige ,150,300);
}
}
}
if(variante==3){
if(rekord3==time){
if(verloren==false){
image(pulvermix,0,0,500,500);
textFont(createFont("Georgia",30));
String anzeige = "NEW HIGHSCORE";
text(anzeige ,150,300);
}
}
}
if(variante==4){
if(rekord4==time){
if(verloren==false){
image(pulvermix,0,0,500,500);
textFont(createFont("Georgia",30));
String anzeige = "NEW HIGHSCORE";
text(anzeige ,150,300);
}
}
}
textFont(createFont("Georgia",20))
fill(128,128,128);
rect(190,390,80,20);
fill(39,64,139);
String anzeige = "weiter";
text(anzeige ,200,405);
String anzeige = "Highscores:";
text(anzeige ,50,50);
String anzeige = "level 1: "+rekord1;
text(anzeige ,50,100);
String anzeige = "level 2: "+rekord2;
text(anzeige ,50,150);
String anzeige = "level 3: "+rekord3;
text(anzeige ,50,200);
String anzeige = "level 4: "+rekord4;
text(anzeige ,50,250);
}
if(stage==0){
background(0);
anfang();
jointx=0;
joint=0;
}
if(stage==1){
if(time>0&&richtig==false){
time--;
}
background(66,75,244);
fill(34,139,34);
rect(0,410,500,70);
fill(170,101,28);
rect(0,480,500,100);
if(variante==2){
image(spielp,-100,0,750,500);
}
if(variante==4){
image(krank,0,0,630,420);
}
if(variante==3){
image(halde,0,0,630,420);
}
punkte();
for (int i = 0; i<a; i++) {
Schrank[i].Y= Schrank[i].Y+1+(t+w+ge+p)*0.01;
if(Schrank[i].D==true&&Schrank[i].E==true){
if(Schrank[i].Y+Schrank[i].H<f1.Y){
Schrank[i].farbe();
if(Schrank[i].Y+Schrank[i].H>f1.Y-1.01-(t+w+ge+p)*0.01&&Schrank[i].X>f1.X&&Schrank[i].X<f1.X+f1.B){
if(ge>0){
ge--;
}
}
}
}
if(Schrank[i].D==false&&Schrank[i].E==false){
if(Schrank[i].Y+Schrank[i].H<f1.Y){
Schrank[i].farbe();
if(Schrank[i].Y+Schrank[i].H>f1.Y-1.01-(t+w+ge+p)*0.01&&Schrank[i].X>40+f1.X&&Schrank[i].X<f1.X+f1.B){
if(w>0){
w--;
}
}
}
}
if(Schrank[i].D==false&&Schrank[i].E==true){
if(Schrank[i].Y+Schrank[i].H<f1.Y){
Schrank[i].farbe();
if(Schrank[i].Y+Schrank[i].H>f1.Y-1.01-(t+w+ge+p)*0.01&&Schrank[i].X>40+f1.X&&Schrank[i].X<f1.X+f1.B){
if(t>0){
t--;
}
}
}
}
if(Schrank[i].D==true&&Schrank[i].E==false){
if(Schrank[i].Y+Schrank[i].H<f1.Y){
Schrank[i].farbe();
if(Schrank[i].Y+Schrank[i].H>f1.Y-1.01-(t+w+ge+p)*0.01&&Schrank[i].X>50+f1.X&&Schrank[i].X<f1.X+f1.B){
if(p>0){
p--;
}
}
}
}
}
if(p==0&&ge==0&&t==0&&w==0){
if(jointx==0){
jointx=Math.random()*(430)+40;
}
rot= 255;
gruen=255;
blau=255;
image(weed,-80,0,660,440);
fill(34,139,34);
rect(0,410,500,70);
fill(170,101,28);
rect(0,480,500,100);
joint++;
image(j,jointx,joint,40,40);
if(f1.X+40<jointx&&f1.X+100>jointx&&f1.Y<joint&&f1.Y+1.1>joint){
p=p-1;
}
if(joint>f1.Y&&joint<f1.Y+15){
genau=true;
}
}
f1.zeichnefaenger();
f1.bewegen();
textFont(createFont("Georgia",19))
fill(255,255,255);
String anzeige = "time: "+time;
text(anzeige ,391,493);
textFont(createFont("Georgia",20))
fill(rot,gruen,blau);
String anzeige = "skip";
text(anzeige ,400,400);
String anzeige = "pause";
text(anzeige ,400,350);
if(time==0){
if(0 < mouseX && mouseX < 500 && 0 < mouseY && mouseY < 500){
if( mouseButton == RIGHT){
stage=2;
}
}
verloren=true;
image(lost,0,0,520,500);
textFont(createFont("Georgia Bold",40))
fill(255,0,0);
String anzeige = "UND GESTORBEN";
text(anzeige ,50,230);
String anzeige = "PLEASE CLICK RIGHT";
text(anzeige ,20,280);
}
if(p==-1&&ge==0&&t==0&&w==0){
if(0 < mouseX && mouseX < 500 && 0 < mouseY && mouseY < 500){
if (mouseButton == RIGHT){
stage=2;
}
}
gewonnen=true;
image(win,0,0,520,500);
textFont(createFont("Georgia Bold",40))
fill(0,255,0);
String anzeige = "YOU WON";
text(anzeige ,150,230);
String anzeige = "PLEASE CLICK RIGHT";
text(anzeige ,20,280);
genau=false;
joint=0;
}
if(p==0&&ge==0&&t==0&&w==0&&genau==true){
if(0 < mouseX && mouseX < 500 && 0 < mouseY && mouseY < 500){
if (mouseButton == RIGHT){
genau=false;
stage=2;
}
}
gewonnen=true;
image(won,0,0,500,500);
textFont(createFont("Georgia Bold",40))
fill(0,255,0);
String anzeige = "YOU WON";
text(anzeige ,150,230);
String anzeige = "PLEASE CLICK RIGHT";
text(anzeige ,20,280);
joint=0;
}
}
}
}
void punkte(){
textFont(createFont("Georgia Bold",20))
fill(255,255,0);
String anzeige = " "+ge;
text(anzeige ,300,g);
fill(255,255,255);
String anzeige = " "+w;
text(anzeige ,200,g);
fill(255,0,255);
String anzeige = " "+p;
text(anzeige ,20,g);
fill(66,244,238);
String anzeige = " "+t;
text(anzeige ,450,g);
}
void anfang(){
textFont(createFont("Georgia",20))
fill(255,0,0);
String anzeige = "for control";
text(anzeige ,200,430);
String anzeige = "choose the level";
text(anzeige ,180,100);
image(rundl,320,380,150,150);
fill(0,0,0);
rect(378,400,32,100);
fill(30,200,30);
String anzeige = "level 1";
text(anzeige ,150,130);
rect(150,150,50,50);
fill(30,30,200);
String anzeige = "level 4";
text(anzeige ,300,280);
rect(300,300,50,50);
fill(200,30,30);
String anzeige = "level 3";
text(anzeige ,150,280);
rect(150,300,50,50);
fill(220,220,220);
String anzeige = "level 2";
text(anzeige ,300,130);
rect(300,150,50,50);
}