做出跟隨滑鼠移動的圖
void setup(){ size(1000,800); fill(0,0,0); rect(0,0,1000,800); PImage HA; HA=loadImage("C:/Documents and Settings/s513s/桌面/a.jpg"); image(HA,100,100); } void draw(){ PImage YA; YA=loadImage("C:/Documents and Settings/s513s/桌面/ccc.jpg"); image(YA,mouseX,mouseY); }
作業3-2:
貓咪追兔子然後把它吃掉
void setup(){ size(1000,800); } float x=100,y=100; void draw(){ fill(0,0,0); rect(0,0,1000,800); PImage HA; HA=loadImage("C:/Documents and Settings/s513s/桌面/22.jpg"); image(HA,mouseX,mouseY); PImage YA; YA=loadImage("C:/Documents and Settings/s513s/桌面/1.jpg"); image(YA,x,y); x=x*0.99+mouseX*0.01; y=y*0.99+mouseY*0.01; }
↓一個大圖後面跟一堆小圖 ( 貓咪大很多大便 : D )
void setup(){
size(1000,800);
frameRate(12);
}
float [] x = new float[10];
float [] y = new float[10];
void draw(){
fill(255,255,255);
rect(0,0,1000,800);
PImage HA;
PImage YA;
HA=loadImage("C:/Documents and Settings/s513s/桌面/a.png");
image(HA,mouseX,mouseY);
x[9]= mouseX;
y[9]= mouseY;
for(int a=0;a<9;a++){
YA=loadImage("C:/Documents and Settings/s513s/桌面/b.png");
image(YA,x[a]+100,y[a]+150);
x[a]=x[a+1];
y[a]=y[a+1];
}
}
作業3-3:
心得與問題檢討
我覺得今天這堂課教的東西好好玩:D
首先是畫面可以和滑鼠作互動
當
95
回覆刪除