마우스 클릭시 사각형 이동

|
int x = 100;
int y = 100;

void setup(){
  size(200, 200);
  smooth();
  rectMode(CENTER);
}

void draw(){
  background(0);
  rect(x, y, 20, 20);
}

void mousePressed(){
  x = mouseX;
  y = mouseY;
}



And