敵除けゲーム
int count=0; float x1=50,y1=50; float x2=50,y2=0; float x3=50,y3=0; float x4=60,y4=10; void setup(){ size(400,400); frameRate(30); } void draw(){ count++; background(150,255,255); stroke(255,0,128,128); stroke(128,255,128,128); fill(255,0,0,30); fill(255,0,0,30); rect(250,250,100,50); fill(255,255,0,80); ellipse(200,200,50,50); ellipse(150,150,100,100); fill(255,255,255); ellipse(x1,y1,50,50); x1=x1+2; if(x1>400){ x1=0; } if(count<90){ fill(0,0,255); } else { fill(255,200,0); } rect(x2,y2,50,50); y2=y2-2; if(y2<0){ y2=400; } fill(150,0,150); ellipse(x3,y3,60,60); x3=x3+1; y3=y3+2; if(x3>400){ x3=0; } if(y3>400){ y3=0; } fill(50,100,150); ellipse(x4,y4,80,80); x4=x4+10; y4=y4+5; } void keyPressed(){ if(keyCode == ENTER){ saveFrame("image-####.png"); } }
Copy