Trying to get interaction with two objects

I am getting so confused by the code that I have created. I am trying to make it so that when the laser hits the alien, the alien would disappear. To make the laser work, you have to press and hold the mouse. Please help me because I am stuck.

The code I have created in Processing:

PImage img;
PImage img2;
String a = "You Failed!!!!!!";
Alien a1;
Lazer laz; //declared lazer

void setup(){
  size(800,800);
  img = loadImage("space.jpg");
  img2 = loadImage("Planet-explode.jpg");
  a1 = new Alien(#199688,0,0,5);
  laz = new Lazer(255, mouseX, 700, -5); //lazer position
}

void draw(){
  image(img,0,0);
  img.resize(800,800);
  noStroke();
  fill(100);
  rect(mouseX,700,150,50);
  //action that is meant for the alien to be hit by lazer
  boolean hit (){
    
  }
  //action that the alien would dissapear if the alien was hit by the lazer
  if (hit) {
    return true;
  } else {
    return false;
  }
  a1.drive();
  a1.display();
  
  //lazer action
  if (mousePressed) {
  laz.display();
  laz.shot();
  }
}

//lazer class
class Lazer {
 int c;
 float tx;
 float ty;
 float speed;
 
 Lazer(int cchange, float txpos, float typos, float tempspeed) {
   c = cchange;
   tx = txpos;
   ty = typos;
   speed = tempspeed;
 }
 
 void display() {
   noStroke();
   fill(c);
   rect(tx,ty,10,100);
 }
 
 void shot() {
   ty = ty + speed;
 }
}

class Alien {
 int c;
 float xpos;
 float ypos;
 float speed;
 
 Alien(int cchange, float tempxpos, float tempypos, float tempspeed) {
   c = cchange;
   xpos = tempxpos;
   ypos = tempypos;
   speed = tempspeed;
 }
 
   void display() {
    stroke(255,255,0);
    fill(c);
    rect(xpos,ypos,100,100);
   }
   
   void drive() {
    ypos = ypos + speed;
    if (ypos >= 800) {
     image(img2,0,0);
      img2.resize(800,800);
      textSize(100);
      fill(255,0,0);
      text(a,0,20,800,800);
   }
  }
}

Please format your code.

Notice you have some error in your code. For instance, there is a function hit in draw which is not proper. Also, check the fill statements in your code. They do not show proper in the site. You can also share your code using pastebin.

Kf