I am getting this problem while adding features to my game boss . One of the attack boss will perform ,is jumping from it's initial postion to directly on players body (Hurting him). Now I am not getting the idea how to set the initial velocity of boss so that it will jump on player's body always. We have two factors Boss position and Player Position (End Point).Any Formula/suggestions will be appreciated. thanks
First the vertical part.
Conventions: up is the positive direction, and g is positive.
To start from Ay and reach maximum height H requires an initial velocity Vy=sqrt(2g(H-Ay)).
The time to reach this height and then fall back down to By is t=sqrt(2/g) (sqrt(H-Ay)+sqrt(H-By)).
Now we can do the horizontal part. To get from Ax to Bx in the time t, we must have a (constant) horizontal velocity Vx = (Bx-Ax)/t.