martes, 19 de diciembre de 2017

bola

float x=300;
float y=20;
float move_x=2;
float move_y=2;
void setup (){
  size (700,700);
  stroke(7,99,87);
  strokeWeight(33);
}
void draw(){
  background(200,200,200);
  ellipse(x,y,40,40);
  x= x+move_x;
  y= y+move_y;
  if(x>width){
  x=width;
  move_x=-move_x;
  }
  if(y>width){
    y=width;
    move_y=-move_y;
   
  }
  if(x<0){
    x=0;
    move_x=-move_x;
    if(y<0)
    move_y=-move_y;
  }
}

No hay comentarios:

Publicar un comentario