2020程式設計二B
2020年3月27日 星期五
Week04
Processing
PImage imgBG;
int[]x={0,0,0,0,0};
int[]y={0,0,0,0,0};
int n=0;// 子彈數
void setup(){
size(768,1280);
// 圖片大小
imgBG=loadImage("background.png");
}
void draw(){
background(imgBG);
for(int i=0; i<5; i++)
circle(x[i],y[i],40);
}
void mousePressed(){
x[n]=mouseX;
y[n]=mouseY;
n=(n+1)%5;
// 一個只能出現5顆(會自己回收消失)
}
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言