Game Development Reference
Remember that for this collision detection system to work, you need to find out two things:
The distance between the objects
The amount that they're overlapping
The previous line tells how far apart they are and copies that information into a variable called `t.
Technically, the d in `t stands for delta , but I'll let you off the hook and allow you to think it stands
for distance , which is a much more concrete concept to grasp. So `t is the distance between the two
objects on the x axis.
To find out the distance between the two objects, all you need to do is subtract the t position of k^fa_p=
from the t position of k^fa_p>. Sounds too easy to be true? Figure 7-38 explains how this works.
Figure 7-38. Subtract objectA's position from objectB's position to find the
distance between them.