瘋狂程設
1.進階題:進階題:兩數之間的3倍數總和2.進階題:區間測速3.加分題:You can say 11
註解:
Processing
1.angry bird遊戲
程式:
PImage imgBird,imgPig; float birdX=200,birdY=200,oldX,oldY,vx=0,vy=0; void setup(){ size(400,400); imgBird=loadImage("bird.png"); imgPig=loadImage("pig.gif"); imageMode(CENTER); } void draw(){ background(255); image(imgBird,birdX,birdY,100,100); birdX+=vx;birdY+=vy; } void mousePressed(){ oldX=birdX;oldY=birdY;///for shooting center } void mouseReleased(){ vx=(oldX-birdX)/10; vy=(oldY-birdY)/10; }
沒有留言:
張貼留言