2014年9月29日 星期一

Week03




PImage img,imgBG;
float eggX=400,eggY=280,eggVX,eggVY,flying=0;
void setup(){
  size(800,600,P3D);
  minim = new Minim(this);
  player = minim.loadFile();
 
  img=loadImage("http://www.mariowiki.com/images/thumb/e/eb/MushroomstickerPMSS.png/500px-MushroomstickerPMSS.png");
  imgBG=loadImage("background.jpg");
  imgBG.resize(800,600);
  imageMode(CENTER);
}
void draw(){
  background(imgBG);
  image(img,mouseX,mouseY,50,50);
  if(flying>0){
    ellipse(eggX,eggY,40,40);
    eggX+=eggVX; eggY+=eggVY; flying--;
  }
}
void mousePressed(){
  eggX=400; eggY=280; flying=30;
  eggVX=(mouseX-eggX/30);
  eggVY=(mouseY-eggY/30);
}

沒有留言:

張貼留言