วันอาทิตย์ที่ 6 กันยายน พ.ศ. 2558

Lab 3 : Song (mousePressed and keyPressed)


int x=50;

void setup(){
size(500,500);
}

void draw(){
  draw_song(x,10);
}

void draw_song(int x,int y){
background(#FCECB5);

fill(0);                               //in door
stroke(0);
rect(150+x,300+y,200,250);

fill(#D36A06);                        //l door
stroke(#D36A06);
rect(135+x,300+y,15,250);

fill(#D36A06);                        //r door
stroke(#D36A06);
rect(350+x,300+y,15,250);

fill(#D36A06);                       //on door
stroke(#D36A06);
rect(135+x,285+y,230,15);

fill(#FF0B03);                       //open
stroke(#FF0B03);
ellipse(180+x,450+y,20,20);

/////word on door WELCOME////

fill(#E9FF03);
textSize(20);
text("W",180+x,360+y);

fill(#03F9FF);
textSize(20);
text("E",200+x,360+y);

fill(#05FF03);
textSize(20);
text("L",220+x,360+y);

fill(#FF9F03);
textSize(20);
text("C",240+x,360+y);

fill(#AC6BF7);
textSize(20);
text("O",260+x,360+y);

fill(#6BF7CA);
textSize(20);
text("M",280+x,360+y);

fill(#FF0000);
textSize(20);
text("E",300+x,360+y);

/////name of song/////

fill(#0D08A5);
textSize(80);
text("Pra",x,140+y);

fill(#08A50E);
textSize(80);
text("Tu",150+x,140+y);

fill(#BC0606);
textSize(80);
text("Jai",300+x,140+y);

/////name of singer/////

fill(#AC39F5);
textSize(40);
text("Sao Sao Sao",x+100,210+y);

}

void keyPressed(){
  x=x+100;
}

void mousePressed(){
  x=x-100;
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น