miércoles, 11 de mayo de 2016

ARKANDID GAME

Click here to Download

int y=300;
int x=300;
int yspeed=8;
int xspeed=-6;
int score=0;
int brokenbrick=0;
int cont =0;

void setup(){
size(600,600);
fill(0,0,0);
background(255.255,255);
}

void draw(){
  background(255);
  fill(0);
  text("yspeed:"+ yspeed,10,10);
  text("y:"+ y,10,30);
  text("score:"+score,10,50);
  text("brokenbrick:"+brokenbrick, 10,70);
 text("score:"+score, 10,50);
 fill(x,y,250);
  ellipse (x,y,40,40);
  y=y + yspeed;
  x=x + xspeed;
 if (y<0 || y>600){
   yspeed=yspeed*-1;}
 if (x<0 || x>600){
   xspeed=xspeed*-1;}
 fill(0);
 rect(mouseX,550, 90,20);
 if (x>mouseX && x<mouseX+90 && y>535){
   yspeed=yspeed*-1;
   xspeed=(x-(mouseX+45))/10;
}

if(brokenbrick==0){
 fill(255,153,255);
 rect(100,100,120,30);
}

 if (brokenbrick ==1){ cont= cont+1;}

 if (x>80 && x<240 && y>80 && y<150){
   yspeed=yspeed*-1;
   brokenbrick=1;
   score=score + 10;}
if  (cont==20){
   stop();
   background(102,255,102);
   fill(0,102,0);
   textSize(60);
   text("CONGRATULATIONS!",10,250);
   text("YOU WON:)",120,320);
}

 
if (y>600){
   background(0);
   fill(9,255,240);
   textSize(60);
   text("GAME OVER :(",100,300);
   stop();
   }

}

No hay comentarios:

Publicar un comentario