elipse que se mueve

int x=100;
int y=100;
void setup(){
  size(400,400);
}
void draw(){
  background(200);
  ellipse(x,y,50,100);
}
void keyPressed(){
  if(key=='w'){
    y=y-10;
  }
  if(key=='s'){
    y=y+10;
  }
  if(key=='a'){
    x=x-10;
  }
  if(key=='d'){
    x=x+10;
  }
  if(key=='w'){
  fill(random(0,255),random(0,255),random(0,255));
  }
  if(key=='a'){
  fill(random(0,255),random(0,255),random(0,255));
  }
  if(key=='s'){
  fill(random(0,255),random(0,255),random(0,255));
  }
  if(key=='d'){
  fill(random(0,255),random(0,255),random(0,255));
  }
}
void mousePressed(){
  fill(random(0,255),random(0,255),random(0,255));
}
void mouseReleased(){
  fill(255);
}
void keyReleased(){
  if(key=='w'){
    fill(255);
  }
  if(key=='a'){
    fill(255);
  }
  if(key=='s'){
    fill(255);
  }
  if(key=='d'){
    fill(255);
  }
}

Comentarios

Entradas populares de este blog

Actividades tema 1

Ejercicios tema 1