2023年11月23日 星期四

week11_10160863

 Week11



void setup(){
  size(600,500);
}
void draw(){
  background(255);
  for(int i=0; i<4; i++){
    for(int j=0; j<6; j++){
      fill(#F5B4B4); rect(j*100, i*100, 100, 100);
      fill(0); text("Hello", j*100+25, i*100+50);
    }
  }
}
void setup(){
  size(600,500);
  for(int i=0; i<4; i++){
    for(int j=0; j<6; j++){
      value[i][j] = int(random(40));
    }
  }
}
int [][] value = new int[4][6];
void draw(){
  background(255);
  for(int i=0; i<4; i++){
    for(int j=0; j<6; j++){
      fill(#F5B4B4); rect(j*100, i*100, 100, 100);
      fill(0); text(value[i][j], j*100+25, i*100+50);
    }
  }
}


void setup(){
  size(600,500);
  for(int i=0; i<4; i++){
    for(int j=0; j<6; j++){
      value[i][j] = i*6+j +10;
    }
  }
  for(int k=0;k<2;k++){
  int i=int(random(4)),j=int(random(6));
  int i2=int(random(4)),j2=int(random(6));
  int temp = value[i][j];
  value[i][j] = value[i2][j2];
  value[i2][j2] = temp;
  }
}
int [][] value = new int[4][6];
void draw(){
  background(255);
  for(int i=0; i<4; i++){
    for(int j=0; j<6; j++){
      fill(#F5B4B4); rect(j*100, i*100, 100, 100);
      fill(0); text(value[i][j], j*100+25, i*100+50);
    }
  }
}
int state=0;
void setup(){
  size(400,400);
  textSize(50);
}
void draw(){
  if(state==0){
    background(255);
    fill(0); text("Click to Start",80,200);  
  }
  else if(state==1){
    background(255,0,0);
  }
  else if(state==2){
    background(0,0,255);
  }
}
void mousePressed(){
  if(state==0) state=1;
}

int state=0;
void setup(){
  size(400,400);
  textSize(50);
}
int x = 50, y = 50;
void draw(){
  if(state==0){
    background(255);
    fill(0); text("Click to Start", 80,200);
  }
  else if(state==1){
    background(255,0,0);
    fill(255); rect(300,50,50,50); 
    fill(128); rect(x,y,50,50); 
  }
  else if(state==2){
    background(0,0,255);
  }
}
void mousePressed(){
  if(state==0) state=1;
}
void keyPressed(){
  if(state==1 && keyCode==RIGHT){
  x += 10;
  if(x==300)state=2;
  }
}


int state=0; 
void setup(){
  size(400,400);
  textSize(50);
}
int x=50, y=50, t=100;
void draw(){
  if(state==0){
    background(255);
    fill(0); text("Click to Start",80,200);  
    x=50;
  }
  else if(state==1){
    background(255,0,0);
    fill(255); rect(300, 50, 50, 50);
    fill(128); rect(x, y, 50, 50);
    t=100;
  }
  else if(state==2){
    background(0,0,255);
    fill(255, 255, 0); text("Wait "+ t, 80, 200);
    t--;
    if(t==0) state=0;
  }
}
void mousePressed(){
  if(state==0) state=1;
}
void keyPressed(){
  if(state==1 && keyCode==RIGHT){
    x += 10;
    if(x==300) state=2;
  }
}

沒有留言:

張貼留言