Das Klick Spiel

Aus QED-WIKI - Ein Berliner Mathe-WIKI von und für Schülerinnen und Schüler
Wechseln zu: Navigation, Suche

von Erdmännchen 15:53, 24. Jan. 2013 (CET)

int x = 0;

int Zeit2 = 10000; //Spielzeit in Millisekunden


void setup() {

 smooth();
 size(800, 800);
 background(0, 255, 0);

}

void draw() {

 int Zeita = millis();                           //aktuelle Zeit in Millisekunden
 PFont Text;
 Text = loadFont("Arial.vlw");
 background(0, 255, 0);
 fill(255);
 rect(0, 500, x, 200);
 if (Zeita < Zeit2) {
   if (mousePressed) {
     x+=10;
     mousePressed = false;
   }
 }
 if (Zeita < Zeit2) {
   fill(255);
   rect(0,400,400,50);
   fill(0,0,255);
   rect(0,400,Zeita/25,50);
   fill(0);
   text("Zeit : " + Zeita/1000, 100, 300);
   text(Zeita/1000 + "/10sek.", 140, 435);
 }
 else {
   fill(255);
   rect(0,400,400,50);
   fill(0,0,255);
   rect(0,400,Zeit2/25,50);
   fill(0);
   text("Zeit : " + Zeit2/1000, 100, 300);
   text(Zeit2/1000 + "/10sek.", 140, 435);
 }
 fill(0);
 textFont(Text, 20);
 text("Punkte : " + x, 100, 100);
 text("Rekord : Punkte(Spieler,Spielzeit) ", 100, 200);
 if (Zeita >= Zeit2) {
   x=x;
   Zeita=10000;
 }

}