Etch A Sketch Sketch

int x = 215;
int y = 45;

void setup() {
  size(480, 480);
  background(150);
  frameRate(100);
}

void draw() {
  if (keyPressed && (key == CODED)) { // If it's a coded key
    if (keyCode == LEFT && x > 0) {            // If it's the left arrow
      x--;
    }
    if(keyCode == UP && y > 0){
      y--;
    }
    if(keyCode == DOWN && y < 480-25){
      y++;
    }
    if (keyCode == RIGHT && x < 480-25) {      // If it's the right arrow
      x++;
    }
    else{
      x = x;
      y = y;
    }

  }
  fill(255,0,0); // fill color for dot
  rect(x, y, 5, 5);
  fill(0); // fill color for line
  if(keyPressed && (key != CODED)){
    background(150);
  }
}