Movement to where I touch on the screen

Hey, I’m working in this videogame where you have to shoot the ball pressing in x place in the net/goal. Does anyone knows how to incorporate this with easy coding? Thanks

Hello,

Lots of resources here:
https://processing.org/

Look for the Linear Interpolation example and the reference for lerp().

:)

okay, thanks, i will

I added the lerp function,but still has no smoothness to the movement. This the code i applied:

class Pelota {
  
  float x, y, ang, vel, arcox=020, arcoy=0, ancho=800, alto=281, endX, endY, pct = 0.00, step = 0.0001;
  PImage pelota;
  
  //constructor
 Pelota(){
    x=width/2;
    y=500;  
    ang=0;
    vel=1;
    pelota=loadImage("pelota.png");
  }
    
  //metodos
 void dibujar(){
  
        
        //pelota
        pushMatrix();
        imageMode(CENTER);
        translate(x,y);
        rotate(radians(ang));
     image(pelota,0, 0);
     popMatrix();
  }
  
  void patear(){
   if((mouseX>arcox && mouseX<arcox+ancho && mouseY>arcoy && mouseY<arcoy+alto) && mousePressed && (pct < 1)) {
      mouseClicked();
      ang=lerp(y,endY,0.05);
      endX = mouseX;
      endY = mouseY;
      x = lerp(x,endX,0.05);
      y = lerp(y,endY,0.05);
      
   
    }
  }
  void resetear(){
    if(y<180){
      ang=0;
      x=width/2;
      y=500;
    }
  } 
}```