PImage img, imgbg;
float eggX=750, eggY=550, eggVX, eggVY, flying=0;
void setup() {
size(800, 600);
img = loadImage("dog.png");
imgbg = loadImage("background.jpg");
imgbg.resize(800, 600);
imageMode(CENTER);
}
void draw()
{
background(imgbg);
image(img, mouseX, mouseY, 200, 200);
if (flying>0)
{
ellipse(eggX, eggY, 50, 50);
eggX += eggVX;
eggY += eggVY;
flying--;
}
}
void mousePressed() {
eggX=750;
eggY=550;
flying=30;
eggVX=(mouseX-eggX)/30;
eggVY=(mouseY-eggY)/30;
}
沒有留言:
張貼留言