Well this is probably more of a math question than programming, but still I can't get it right and I don't think math forums would be the best place either.
I'm programming a simple 2D tank game for my entertainment.
You can basically consider tanks and bullets to be located at points on an X,Y axis.
I am trying to make an enemy tank shoot my bullets out of the sky. Let's just say that both our bullets travel at the same speed.
So math wise, I am looking for a direction the enemy tank can shoot, that will intersect my bullet's path and collide with my bullet.
My understanding is that if the bullets travel the same speed, the distance between my bullet and the intersection point, and the enemy's bullet and same intersection point, must be the same for the bullets to hit each other, rather than just cross paths.
What I have been trying to do is convert my bullet's path to the format y = mx + b, then find another linear equation that meets the criteria to hit my bullet.
I'm not sure how to do this. I've tried a couple different ways, and neither have worked. One at least shot somewhat close, but my more recent attempt produced weird, fail results.
I've attached a picture that hopefully makes this a lot more clear to understand what I'm trying to find.
Ideally finding the x,y point of intersection to shoot at would be best, but any help finding the line or angle to shoot in would be great.
Thanks for your time!