🔺程式
float[] eggX=new float [100];
float[] eggY=new float [100];
void setup(){
size(800,600);
for(int i=0;i<100;i++){
eggX[i]=random(100,700);
eggY[i]=-random(2000);
}
}
void draw(){
background(255);
for(int i=0;i<100;i++){
ellipse(eggX[i],eggY[i],80,100);
eggY[i]+=5;
}
}
float[] eggX=new float [100];
float[] eggY=new float [100];
boolean[] eggDie=new boolean[100];
void setup(){
size(800,600);
for(int i=0;i<100;i++){
eggX[i]=random(100,700);
eggY[i]=-random(2000);
eggDie[i]=false;
}
}
void draw(){
background(255);
rect(mouseX-50,mouseY-25,100,50);
for(int i=0;i<100;i++){
if(eggDie[i])continue;
ellipse(eggX[i],eggY[i],80,100);
eggY[i]+=5;
if(eggY[i]>700) eggY[i]+=-2000+600;
if(dist(mouseX,mouseY,eggX[i],eggY[i])<50)
eggDie[i]=true;
}
}
float[] eggX=new float [100];
float[] eggY=new float [100];
boolean[] eggDie=new boolean[100];
void setup(){
size(800,600);
for(int i=0;i<100;i++){
eggX[i]=random(100,700);
eggY[i]=-random(2000);
eggDie[i]=false;
}
}
int score=0;
void draw(){
background(255);
fill(255);
rect(mouseX-50,mouseY-25,100,50);
for(int i=0;i<100;i++){
if(eggDie[i])continue;
ellipse(eggX[i],eggY[i],80,100);
eggY[i]+=5;
if(eggY[i]>700) eggY[i]+=-2000+600;
if(dist(mouseX,mouseY,eggX[i],eggY[i])<50){
eggDie[i]=true;
score+=100;
}
}
fill(255,0,0);
textSize(80);
text("Score:"+score,100,100);
}
PImage [] imgN=new PImage[10];
float[] eggX=new float [100];
float[] eggY=new float [100];
boolean[] eggDie=new boolean[100];
void setup(){
size(800,600);
for(int i=0;i<=9;i++)imgN[i]=loadImage(i+".jpg");
for(int i=0;i<100;i++){
eggX[i]=random(100,700);
eggY[i]=-random(2000);
eggDie[i]=false;
}
}
int score=0;
void draw(){
background(255);
fill(255);
rect(mouseX-50,mouseY-25,100,50);
for(int i=0;i<100;i++){
if(eggDie[i])continue;
ellipse(eggX[i],eggY[i],80,100);
eggY[i]+=5;
if(eggY[i]>700) eggY[i]+=-2000+600;
if(dist(mouseX,mouseY,eggX[i],eggY[i])<50){
eggDie[i]=true;
score+=100;
}
}/*
fill(255,0,0);
textSize(80);
text("Score:"+score,100,100);
*/
int now=score;
for(int i=0;i<7;i++){
image(imgN[(now%10)],800-i*100,100,100,150);
now/=10;
}
}
PImage img;
float cherryX=0,cherryY=700;
float cherryVX=6,cherryVY=-40;
void setup(){
size(800,600);
img=loadImage("cherry.png");
}
void draw(){
background(255);
image(img,cherryX,cherryY,100,150);
cherryX+=cherryVX;
cherryY+=cherryVY;
cherryVY+=0.98;
}
PImage img;
float cherryX=0,cherryY=700;
float cherryVX=6,cherryVY=-40;
void setup(){
size(800,600);
img=loadImage("cherry.png");
for(int i=0;i<10;i++) sword[i]=new PVector();
}
PVector [] sword =new PVector[10] ;
void draw(){
background(255);
image(img,cherryX,cherryY,100,150);
cherryX+=cherryVX;
cherryY+=cherryVY;
cherryVY+=0.98;
for(int i=9;i>0;i--){
sword[i].x=sword[i-1].x;
sword[i].y=sword[i-1].y;
}
sword[0].x=mouseX;
sword[0].y=mouseY;
for(int i=1;i<10;i++){
line(sword[i].x,sword[i].y,sword[i-1].x,sword[i-1].y);
}
}
PImage []img=new PImage[8];
float []cherryX=new float [8];
float []cherryY=new float [8];
float []cherryVX=new float [8];
float []cherryVY=new float [8];
void cherryReborn(int i){
cherryX[i]=random(800);
cherryVX[i]=700;
cherryY[i]=random(8)-4;
cherryVY[i]=-40;
}
void setup(){
size(800,600);
for(int i=0;i<8;i++) img[i]=loadImage("cherry.png");
for(int i=0;i<8;i++) cherryReborn(i);
for(int i=0;i<10;i++) sword[i]=new PVector();
}
PVector [] sword =new PVector[10] ;
void draw(){
background(255);
for(int i=0;i<8;i++){
image(img[i],cherryX[i],cherryY[i],100,150);
cherryX[i]+=cherryVX;
cherryY[i]+=cherryVY;
cherryVY[i]+=0.98;
}
for(int i=9;i>0;i--){
sword[i].x=sword[i-1].x;
sword[i].y=sword[i-1].y;
}
sword[0].x=mouseX;
sword[0].y=mouseY;
for(int i=1;i<10;i++){
line(sword[i].x,sword[i].y,sword[i-1].x,sword[i-1].y);
}
}

float []cherryX=new float [8];
float []cherryY=new float [8];
float []cherryVX=new float [8];
float []cherryVY=new float [8];
void cherryReborn(int i){
cherryX[i]=random(800);
cherryVX[i]=700;
cherryY[i]=random(8)-4;
cherryVY[i]=-40;
}
void setup(){
size(800,600);
for(int i=0;i<8;i++) img[i]=loadImage("cherry.png");
for(int i=0;i<8;i++) cherryReborn(i);
for(int i=0;i<10;i++) sword[i]=new PVector();
}
PVector [] sword =new PVector[10] ;
void draw(){
background(255);
for(int i=0;i<8;i++){
image(img[i],cherryX[i],cherryY[i],100,150);
cherryX[i]+=cherryVX;
cherryY[i]+=cherryVY;
cherryVY[i]+=0.98;
}
for(int i=9;i>0;i--){
sword[i].x=sword[i-1].x;
sword[i].y=sword[i-1].y;
}
sword[0].x=mouseX;
sword[0].y=mouseY;
for(int i=1;i<10;i++){
line(sword[i].x,sword[i].y,sword[i-1].x,sword[i-1].y);
}
}
沒有留言:
張貼留言