31 ตุลาคม 2556

Life & Button


////  Life & Button  ////



void Life(int count, int x, int y) {
  int n = 0;
  while (n<count) {
    noStroke();
    fill(255);
    ellipse(x-20/2, y-20/2, 25, 25);
    ellipse(x-30/2, y-10/2, 30, 20);
    fill(0);
    ellipse(x-60/2, y-10/2, 7/2, 7/2 );
    ellipse(x, y-10/2, 10, 35/2);
    stroke(0);
    strokeWeight(1);
    line(x-35/2, y-30/2, x-30/2, y-25/2);
    x = x+40;
    n = n+1;
  }
}


int button(String s, int number) {
  fill(60, 227, 69);
  rect(150, 100, 300, 200);
  fill(255, 10, 47);
  textFont(createFont("Arial", 50));
  text(s, 220, 210);  
  if (mousePressed&&mouseX>150&&mouseX<450&&mouseY>100&&mouseY<300) {  
    if (number==0) {
      number=1;
    }
  }
  return number;
}

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

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