Help with character spawning

I haven’t been programming in processing or java that long, but I am trying to make a game where and enemy spawns at random inter volts, but my enemy program isn’t working. Any help? Thank you

//var setup
int high = 2;
int enemyX = 850;

//setting it up
void setup() {
  background(150);
  size(1280, 800);
  line(0, 260, 1280, 260);
  line(0, 530, 1280, 530);
}

//Changing the variable for player height
public void keyPressed(KeyEvent e) {
  if (e.getKeyCode() == 38 && !(high == 3)) {
    high = high + 1;
  } else if (e.getKeyCode() == 40 && !(high == 1)) {
    high = high - 1;
  }
}

//Player Drawing
void draw() {
  if (high == 2) {
    background(150);
    line(0, 260, 1280, 260);
    line(0, 530, 1280, 530);
    rectMode(CENTER);
    rect(300, 395, 250, 250);
  } else if (high == 1) {
    background(150);
    line(0, 260, 1280, 260);
    line(0, 530, 1280, 530);
    rectMode(CENTER);
    rect(300, 665, 250, 250); 
  } else if (high == 3) {
    background(150);
    line(0, 260, 1280, 260);
    line(0, 530, 1280, 530);
    rectMode(CENTER);
    rect(300, 130, 250, 250);
  }
  
  if (enemyX <= 0) {
    rectMode(CENTER);
    rect(enemyX,665,250,250);
    enemyX = enemyX - 5;
  }
}

hi,
looks like you are fighting with translating from p5.js?

as i not understand what you want to do i can not fix your ?game?
but just as a example i want show you a different coding style,
if you think it is more readable and like it, use it.

int high = 2, enemyX = 800, rposY = 400, rw = 250;

//__________________________________________
void setup() {
 size(1280, 800);
 rectMode(CENTER);
}

//__________________________________________ //Player Drawing
void draw() {
 background(150);
 line(0, 260, width, 260);
 line(0, 530, width, 530);  
 if (high == 1) rposY = 665;
 if (high == 2) rposY = 395;
 if (high == 3) rposY = 130;
 rect(enemyX, rposY, rw, rw);
 enemyX = enemyX - 5;
 if (enemyX <= 0)  enemyX = width-rw/2;
}

//__________________________________________ //Changing the variable for player height
void keyPressed() {
 if (keyCode == UP   && !(high == 3)) high += 1;
 if (keyCode == DOWN && !(high == 1)) high -= 1;
}