Minim minim;
AudioPlayer tireblowout;
PImage img, imgBG;
float eggX=750, eggY=500, eggVX, eggVY, flying=0;
void setup() {
size(800, 600);
img = loadImage("20080323134429460.png");
imgBG = loadImage("bfd.jpg");
imgBG.resize(800, 600);
imageMode(CENTER);
minim =new Minim(this);
tireblowout =minim.loadFile("tireblowout.wav");
tireblowout.play();
}
void draw() {
background(imgBG);
image(img, mouseX, mouseY, 100, 100);
if (flying>0) {
ellipse(eggX, eggY, 50, 50);
eggX+=eggVX;
eggY+=eggVY;
flying--;
}
}
void mousePressed() {
eggX=750;
eggY=50;
flying=30;
eggVX=(mouseX-eggX)/30;
eggVY=(mouseY-eggY)/30;
tireblowout.rewind();
tireblowout.play();
}


沒有留言:
張貼留言