Need help with an assignment from school

I tried something at school for the square to collide with the circle. Please check it and tell me what i could do better.

int x;
int y;
float circleX;
float circleY;
int points = 0;

 
void setup(){
  size (400, 400);
  x = width/2;
  y = height/2;
  circleX = random(0,400);
  circleY = random(0,400);
}
 
void draw(){
  background(0,255,0);
 fill(255,0,0);
  rect(x, y, 20,20);
  fill(0); 
  ellipse(circleX, circleY, 6,6);
fill(0);
text("Score :" + points, 0,20);
}
void keyPressed() {
   if ((keyPressed == true) && (key == CODED)) {
    if (keyCode == UP){
     y --;
    } else if (keyCode == DOWN) {
      y ++;
    } else if (keyCode == LEFT){
      x --;
    } else if (keyCode == RIGHT) {
      x ++;
    }  
    
      
    }
    
//collision with the coin
if ((x >= circleX) && (y >= circleY)){
  ellipse(circleX, circleY, 6,6);
  points++;
  }
}