2013年11月10日 星期日

第十週期中作品展示

黃敦群與陳建勳的作品
我們是要照順序接漢堡素材,若接錯順序或是時間內沒有接完就會GameOver!!

PImage img;
PImage img2;
PImage img3;
int N=20;
PImage img4;
PImage img5;
PImage img6;
PImage img7;
PImage img8;
PImage img9;
PImage img10;
float a, b, c, d, e;
int A1=0;
int A2=0;
int A3=0;
int A4=0;
int A5=0;
int G1=0;
int G2=0;
int G3=0;
int G4=0;
int G5=0;
float B1=0;
float B2=0;
float B3=0;
float B4=0;
float B5=0;
int C1, C2, C3, C4, C5;
int L=330;
int I1, I2, I3, I4, I5;
float []thingAA = new float[N];
float []thingBB = new float[N];
float []thingCC = new float[N];
float []thingDD = new float[N];
float []thingEE = new float[N];

float x=random(0, 600);
float y=random(0, 600);
float z=random(0, 600);
float w=random(0, 600);
float v=random(0, 600);

int R=0;
import ddf.minim.*;

AudioPlayer player;
AudioPlayer player1;
AudioPlayer player2;

Minim minim;//audio context

void setup() {
  size(600, 400);
  I1=0;
  I2=0;
  I3=0;
  I4=0;
  I5=0;
  thingAA[0]=int(random(5, 7));
  thingBB[0]=int(random(5, 7));
  thingCC[0]=int(random(5, 7));
  thingEE[0]=int(random(5, 7));
  thingDD[0]=int(random(5, 7));
  img = loadImage("01.jpg");
  img2 = loadImage("down.jpg");
  img3 = loadImage("meet.jpg");
  img4 = loadImage("cheese.jpg");
  img5 = loadImage("vegetable.jpg");
  img6 = loadImage("top.jpg");
  img7 = loadImage("dish.jpg");
  img8 = loadImage("win.jpg");
  img9 = loadImage("lose.jpg");
  img10= loadImage("start.jpg");
  minim = new Minim(this);
  player = minim.loadFile("file.mp3", 2048);
  player1 = minim.loadFile("winner.wav", 2048);
  player2 = minim.loadFile("loser.WAV", 2048);
}
void draw() {

  if (R==0) {
    background(img10);
    A1=0;
    A2=0;
    A3=0;
    A4=0;
    A5=0;
    G1=0;
    G2=0;
    G3=0;
    G4=0;
    G5=0;
    B1=0;
    B2=0;
    B3=0;
    B4=0;
    B5=0;

    L=330;

    x=random(0, 600);
    y=random(0, 600);
    float z=random(0, 600);
    float w=random(0, 600);
    float v=random(0, 600);

    I1=0;
    I2=0;
    I3=0;
    I4=0;
    I5=0;
    thingAA[0]=int(random(5, 7));
    thingBB[0]=int(random(5, 7));
    thingCC[0]=int(random(5, 7));
    thingEE[0]=int(random(5, 7));
    thingDD[0]=int(random(5, 7));
  }
  if (I1<=10 && I2<=10 && I3<=10 && I4<=10. && I5<=10 && L!=230 && R==1) {
    background(img);
    image(img7, mouseX, 350, 80, 60);

    if (thingAA[I1]==5) {
      a=a+5;
      image(img2, x, a, 60, 40);
    }
    if (thingAA[I1]!=5)
    {
      thingAA[I1]=int(random(5, 25));
    }

    if (thingBB[I2]==5) {
      b=b+5;
      image(img3, y, b, 60, 40);
    }
    if (thingBB[I2]!=5)
    {
      thingBB[I2]=int(random(5, 25));
    }

    if (thingCC[I3]==5) {
      c=c+5;
      image(img4, z, c, 60, 40);
    }
    if (thingCC[I3]!=5)
    {
      thingCC[I3]=int(random(5, 25));
    }

    if (thingDD[I4]==5) {
      d=d+5;
      image(img5, w, d, 60, 40);
    }
    if (thingDD[I4]!=5)
    {
      thingDD[I4]=int(random(5, 25));
    }

    if (thingEE[I5]==5) {
      e=e+5;
      image(img6, v, e, 60, 40);
    }
    if (thingEE[I5]!=5)
    {
      thingEE[I5]=int(random(5, 25));
    }

    if (a==400) {
      I1=I1+1;
      thingAA[I1]=int(random(5, 8));
    }
    if (b==400) {
      I2=I2+1;
      thingBB[I2]=int(random(5, 8));
    }
    if (c==400) {
      I3=I3+1;
      thingCC[I3]=int(random(5, 8));
    }
    if (d==400) {  
      I4=I4+1;
      thingDD[I4]=int(random(5, 8));
    }
    if (e==400) {
      I5=I5+1;
      thingEE[I5]=int(random(5, 8));
    }


    if (a==400) {
      a=0;
      x = random(0, 600);
    }

    if (b==400) {
      b=0;
      y = random(0, 600);
    }

    if (c==400) {
      c=0;
      z = random(0, 600);
    }

    if (d==400) {
      d=0;
      w = random(0, 600);
    }

    if (e==400) {
      e=0;
      v = random(0, 600);
    }

    if (a==L && x <= mouseX+20 && x>= mouseX-20 && G1==0)
    {
      A1=1;
      B1=mouseX-x;
      C1=L;
      L=L-20;
      G1=1;
    }
    if (A1==1&&G1==1) {
      image(img2, mouseX+B1, C1, 60, 40);
    }

    if (b==L && y <= mouseX+20 && y>= mouseX-20 && G2==0)
    {
      A2=1;
      B2=mouseX-y;
      C2=L;
      L=L-20;
      G2=1;
    }
    if (A2==1&&G2==1) {
      image(img3, mouseX+B2, C2, 60, 40);
    }

    if (c==L && z <= mouseX+20 && z>= mouseX-20 && G3==0)
    {
      A3=1;
      B3=mouseX-z;
      C3=L;
      L=L-20;
      G3=1;
    }
    if (A3==1&&G3==1) {
      image(img4, mouseX+B3, C3, 60, 40);
    }


    if (d==L && w <= mouseX+20 && w>= mouseX-20 && G4==0)
    {
      A4=1;
      B4=mouseX-w;
      C4=L;
      L=L-20;
      G4=1;
    }
    if (A4==1&&G4==1) {
      image(img5, mouseX+B4, C4, 60, 40);
    }

    if (e==L && v <= mouseX+20 && v>= mouseX-20 && G5==0)
    {
      A5=1;
      B5=mouseX-v;
      C5=L;
      L=L-20;
      G5=1;
    }
    if (A5==1&&G5==1) {
      image(img6, mouseX+B5, C5, 60, 40);
    }
  }
  else {
    if (R!=0) {
      if (C1==330&&C2==310&&C3==290&&C4==270&&C5==250) {
        background(img8);
        R=2;
     
        player1.play();
      }
      else
      {
        background(img9);
        R=3;
        player2.play();
      }
    }
  }
 }

void mouseClicked()
{
  if (R==0) {
    player.play();
    R=1;
  }
  if (I1==10 || I2==10 || I3==10 || I4==10 || I5==10 || L==230 )
    R=0;
}

void stop()
{
 player.close();
 minim.stop();
 super.stop();
}


沒有留言:

張貼留言