2020年10月19日 星期一

WEEK-6

Processing

輸入文字&文字設定:



size(800,300);
fill(0,0,255);

PFont font1 = createFont("Times New Roman", 30);
textFont(font1);
textSize(30);
text("中文vs.English", 30,30);

PFont font2 = createFont("標楷體" ,30);
textFont(font2);
textAlign(LEFT,CENTER);
text("中文vs.English", 30,130);

戳泡泡遊戲:


int [][]A={ {2,2,2,2},
            {0,1,1,1},
            {0,1,1,1},
            {2,2,2,2} };
PImage alien,bear;
void mousePressed(){
  int i =int(mouseY/100);
  int j =int(mouseX/100);
  A[i][j]=0;
}
void setup(){
  size(400,400);
  alien=loadImage("1.png");
  bear=loadImage("2.png");
}
void draw(){
  background(0);
  for(int i=0; i<4; i++){
    for(int j=0; j<4; j++){
      if(A[i][j]==1) image(alien, j*100, i*100, 100,100);
      if(A[i][j]==2) image(bear, j*100, i*100, 100,100);
    }
  }
  ellipse(mouseX,mouseY, 25,25);
  text("mouseX:"+mouseX + "mouseY:"+mouseY, 200,200);
}

沒有留言:

張貼留言