Tracking the puck
Once you know the location, you can now find out the speed and direction of the puck. In this case, the easiest way is to find the delta movement in the x direction and the delta movement in the y direction. This is easy to add to your program by simply tracking your puck from frame to frame, that is, how much the puck has moved in pixels. Here is the code:
And when you run the code, you will see the following:
Here, the line is pointing in the direction of the puck movement. Now that you know the location and direction of the puck, you can move the paddle to connect with the puck.