PImage plane;
PImage moster;
void setup()
{
background(255,255,255);
size(600,400);
plane=loadImage("plane.gif");
moster=loadImage("moster.jpg");
}
int now=0;
int no=0;
void draw()
{
background(255);
image(moster,300+no,200+now,50,80);
image(plane,0,0,600,400);
}
void keyPressed(){
if(keyCode==UP) now+=10;
if(keyCode==DOWN) now-=10;
if(keyCode==LEFT) no+=10;
if(keyCode==RIGHT) no-=10;
for(int i=0;i<5;i++){
if(moster<300 && moster>200 && moster>300 && moster<200) {
if(keyCode==32) now-=20;
image(moster,X[i], Y[i], 60, 60);
}
}
}
沒有留言:
張貼留言