There is a randomly moving object(obj1) on the panel. We have another object(obj2) that is supposed to track obj1 initiating from the (0,0) point on the panel. The obj2 must get closer to the obj1 as time passes.
What logic should I use to do this?
In my code, I have that obj1 moving aimlessly on the screen with a line pointing that object only from the (0,0) point.
I put a link here that can help me make myself clear.
Sounds like basic 2D vector math to me, which is something you can Google for hundreds of articles on the matter. You have two points representing your two objects - now imagine an invisible line between those two points. One of the objects (your "terminator") should be periodically moving along that line until it collides with the other object.
Hi. thank you for your reply gimbal2. I've been searching this for a while now but unfortunately I couldn't find a working solution for this. there are some approaches disscused on some websites but they didn't show good results. I would really appreciate it if you could tell me how it works or at least drop some link in which I could find it myself.
I must also add that I'm not good at math.