fill(255,0,0);//文字填充顏色
textSize(40);//字體大小
text("Hello",30,30);//字&左下位置
size(500,500);
//rect(100,100,100,100);
fill(255,0,0);
PFont font1=createFont("Times New Roman",30);
textFont(font1);
text("中文 vs. English",30,30);
PFont font2=createFont("標楷體",30);
textFont(font2);
text("中文 vs. English",30,130);
互動遊戲
int [][]A={{1,1,1},{0,1,0},{0,1,1},{1,1,1}};
size(300,400);
for(int i=0;i<4;i++){
for(int j=0;j<3;j++){
if(A[i][j]==0)fill(0);
else fill(255,255,0);
rect(j*100,i*100,100,100);
}
}
int [][]A={{2,2,2,2},{0,1,1,1},{0,1,1,1},{2,2,2,2}};
PImage bird,pig;
void setup(){
size(400,400);
bird=loadImage("bird.png");
pig=loadImage("pig.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(bird,j*100,i*100,100,100);
if(A[i][j]==2)image(pig,j*100,i*100,100,100);
}
}
}
int [][]A={{2,2,2,2},{0,1,1,1},{0,1,1,1},{2,2,2,2}};
PImage bird,pig;
void mousePressed(){
int i=int(mouseY/100);
int j=int(mouseX/100);
float r=random(3);
if(A[i][j]==0)A[i][j]=(int)r;
else A[i][j]=0;
}
void setup(){
size(400,400);
bird=loadImage("bird.png");
pig=loadImage("pig.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(bird,j*100,i*100,100,100);
if(A[i][j]==2)image(pig,j*100,i*100,100,100);
}
}
}



沒有留言:
張貼留言