week06👅👿
♥設定文字及文字大小、位置
♥程式碼-
size(300,300);
fill(255,0,255);
textSize(40);
text("07160220",30,50);
---
♥文字置左、置中、置右
(以座標為中心方向對齊)
♥程式碼-
size(300,300);
background(0);
fill(255,0,255);
textSize(40);
textAlign(LEFT);
text("LEFT",150,50);
fill(255,255,0);///紫色
textSize(40);
textAlign(CENTER);
text("CENTER",150,100);
fill(0,255,255);///
textSize(40);
textAlign(RIGHT);
text("RIGHT",150,150);
---
♥匯入圖片(鬼魂、南瓜),圖片出現在陣列中正確的位置上
♥程式碼-
int [][]A={{2,2,2,2},
{0,1,1,1},
{0,1,1,1},
{2,2,2,2}};
///0=black, 1=p,2=b
PImage p,b;
void setup(){
size(400,400);
p=loadImage("11.png");///匯入南瓜
b=loadImage("12.png");///匯入鬼魂
}
void draw(){
background(0);///背景為黑
for(int i=0;i<4;i++){///left
for(int j=0;j<4;j++){///right
if(A[i][j]==1) image(p,j*100,i*100,100,100);///1=南瓜
if(A[i][j]==2) image(b,j*100,i*100,100,100);///2=鬼魂
}
}
}
int [][]A={{2,2,2,2},
{0,1,1,1},
{0,1,1,1},
{2,2,2,2}};///0=black, 1=p,2=b
PImage p,b;
void mousePressed(){
int i=int(mouseY/100);
int j=int(mouseX/100);
A[i][j]=0;
}
void setup(){
size(400,400);
p=loadImage("11.png");
b=loadImage("12.png");
}
void draw(){
background(0);
for(int i=0;i<4;i++){///left
for(int j=0;j<4;j++){///right
if(A[i][j]==1) image(p,j*100,i*100,100,100);
if(A[i][j]==2) image(b,j*100,i*100,100,100);
}
}
}






沒有留言:
張貼留言