DriakTravo.
I have seen your example.
Please try to understand this: In my previous post i search angle value
just because RotateSprite3D need it, no other reason.
To do your matter:
-Lets suppose the target (T) point coords are (t1,t2), and the gunner (G)coords are (g1,g2).
-Well; now you must to know vector G->T; this is vector (t1-g1,t2-g2). Let v1=t1-g1 and v2=t2-g2.
-And now you must get the bullet movement vector (direction and speed):
simply just assign bullet speed (the speed you want; for example 20 pixels per frame) to that vector; this means getting a new vector with same direction but with modulo=speed.
To do that, lets M(m1,m2) the bullet movement vector:
m1=20/sqr(1+(v2*v2)/(v1*v1))
m2=20/sqr(1+(v1*v1)/(v2*v2))
-Now for each screen frame, add m1 value to bullet x coordenate and m2 value to bullet y coordenate. That's all
-Finally, if you want to shoot not only directly to target, but near target too, then you must get a perpendicular vector of G->T; this is (-v2,v1) to one side, and (v2,-v1) to the other side of target. And of course, you must "cut" (or "enlarge") the lenght (modulo) of that vector to the distance you want the bullets to pass near target.
For example, if you want those bullets to be directed to pass always at 15 pixels side from target, you must positionate a fictitious target at (fr1,fr2), being:
fr1=-15/sqr(1+(v1*v1)/(v2*v2))
fr2=15/sqr(1+(v2*v2)/(v1*v1))
and another at the other side of the target (fl1,fl2), being:
fl1=15/sqr(1+(v1*v1)/(v2*v2))
fl2=-15/sqr(1+(v2*v2)/(v1*v1))
and add this vectors to target position in order to get the fictitious target position and throw bullets there.
But if for example you want those bullets to be directed to pass near target to a distance which depends of target distance to gunner, then you must stablish relationship between distance from gunner; for example let be the relation 1/20 (this is, if there are 200 pixels from gunner to target, then bullets must be directed to 10 pixels at side of target). Then:
fr1=(1/20)*-v2
fr2=(1/20)*v1
and for the other side of target:
fl1=(1/20)*v2
fr2=(1/20)*-v1
and then add this vectors to target position in order to get the fictitious target position and throw bullets there.
If someone knows a best, process fastest, simplest .... way to do all this kind of things, please explain it.