int []x={0,0,0,0,0};//Java的陣列(C: int x[10]);
int []y={0,0,0,0,0};//Java的陣列
void setup()
{
size(249,277);
imgBG=loadImage("98.jpg");
}
void draw()
{
background(imgBG);
circle(x[0],y[0],40);
}
void mousePressed()
{
x[0] = mouseX;
y[0] = mouseY;
}
PImage imgBG;
int []x={0,0,0,0,0};//Java的陣列(C: int x[10]);
int []y={0,0,0,0,0};//Java的陣列
int n=0;//子彈數目, 現在用了0顆子彈
void setup()
{
size(249,277);
imgBG=loadImage("98.jpg");
}
void draw()
{
background(imgBG);
for(int i=0; i<5; i++)
{
circle(x[i], y[i], 40);//circle(x[0],y[0],40);
}
}
void mousePressed()
{
if(n>=5) return;//保護一下,不要超過5顆!
x[n] = mouseX;//x[0] = mouseX;//陣列不夠大,暗地六顆就爆了 ...n: 5 ->6
y[n] = mouseY;//y[0] = mouseY;
n++;
}
PImage imgBG;
int []x={0,0,0,0,0};//Java的陣列(C: int x[10]);
int []y={0,0,0,0,0};//Java的陣列
int n=0;//子彈數目, 現在用了0顆子彈
void setup()
{
size(249,277);
imgBG=loadImage("98.jpg");
}
void draw()
{
background(imgBG);
for(int i=0; i<5; i++)
{
circle(x[i], y[i], 40);//circle(x[0],y[0],40);
}
}
void mousePressed()
{
if(n>=5) return;//保護一下,不要超過5顆!
x[n] = mouseX;//x[0] = mouseX;//陣列不夠大,暗地六顆就爆了...n: 5 ->6
y[n] = mouseY;//y[0] = mouseY;
n = (n+1)%5;//可回收子彈,下次用到最舊的那顆
}
void setup()
{
int []a={1,0,1,0};
size(400,100);
for(int i=0; i<4; i++)
{ //for迴圈配陣列
if(a[i]==1) fill(255,0,0);//陣列那格是1,紅
else fill(250,250,0);//黃
rect(i*100, 0, 100, 100);
}//算出他對應的座標
}
void setup()
{
int [][]a={ //口訣:左手 i 右手 j
{1,0,1,0,1},//i:0
{0,1,0,1,0},//i:1
{0,0,0,1,1},//i:2
{1,0,0,1,0},
{0,1,1,0,1}//i:3
};
size(500,500);
for(int i=0; i<5; i++)
{
for(int j=0; j<5; j++)
{
if( a[i][j] == 1) fill(255,0,0);
else fill(255,255,0);
rect( j*100, i*100, 100, 100);
}//j 對應x座標, i對應y座標
}
}
PImage imgBG;
int []x={0,0,0,0,0};//Java的陣列(C: int x[10]);
int []y={0,0,0,0,0};//Java的陣列
int []r={5,5,5,5,5};//表示圖的大小
int n=0;//子彈下一次要,更新誰
void setup()
{
size(249,277);
imgBG=loadImage("98.jpg");
}
void draw()
{
background(imgBG);
for(int i=0; i<5; i++)
{
circle(x[i], y[i], r[i]);//circle(x[0],y[0],40);
}
if(mousePressed) r[now]++;//如果一直按,那顆球要變大
}
int now=0;
void mousePressed()
{
//if(n>=5) return;
x[n] = mouseX;//x[0] = mouseX;
y[n] = mouseY;//y[0] = mouseY;
r[n] =5;
now= n;
n = (n+1)%5;//可回收子彈,下次用到最舊的那顆
}






沒有留言:
張貼留言