import ddf.minim.*;
Minim minim;
AudioPlayer player,wolf;
PImage img, imgBG;
float eggX=750, eggY=550, eggVX, eggVY, flying=0;
void setup() {
size(800, 600, P3D);
img=loadImage("123.png");
imgBG = loadImage("bg.jpg");
imgBG.resize(800, 600);
imageMode(CENTER);
minim = new Minim(this);
wolf = minim.loadFile("wolf.wav");
player = minim.loadFile("marcus_kellis_theme.mp3");
}
void draw() {
background(imgBG);
image(img, mouseX, mouseY, 300, 300);
if (flying>0) {
ellipse(eggX, eggY, 50, 50);
eggX+=eggVX;
eggY+=eggVY;
flying--;
}
}
void mousePressed() {
player.play();
wolf.rewind();
wolf.play();
eggX=750;
eggY=550;
flying=30;
eggVX=(mouseX-eggX)/30;
eggVY=(mouseY-eggY)/30;
}

沒有留言:
張貼留言