ICC
< back to sketch

int x,y;

void setup(){
  size(300,300);
}

void loop(){
  background(255,255,255);
  rectMode(CENTER_DIAMETER);
  stroke(255,0,0);
  fill(255,0,0);
  rect(x+10,y+10,20,20);
  rect(x+30,y+30,20,20);
  rect(x+50,y+50,20,20);
  rect(x+70,y+70,20,20);
  rect(x+70,y+70,20,20);
  rect(x+90,y+90,20,20);
  rect(x+110,y+110,20,20);
  rect(x+130,y+130,20,20);
  rect(x+10,y+130,20,20);
  rect(x+30,y+110,20,20);
  rect(x+50,y+90,20,20);
  rect(x+130,y+10,20,20);
  rect(x+110,y+30,20,20);
  rect(x+90,y+50,20,20);

}

void keyPressed(){

  if(key == UP){
    y =y-10;
  }

  if(key == DOWN){
    y = y+10;
  }

  if(key == LEFT){
    x = x-10;
  }

  if(key ==RIGHT){
    x = x+10;
  }
}

< back to sketch