-
All the sprites in your big game are now animated.
-
But nothing happens when they run into each
other.
-
We're going to use collision detection to
find out when sprites have touched each other
-
so that we can later apply rules like increasing
or decreasing your score when your sprites
-
collide.
-
Using the provided line-length function, you
will complete a function distance that uses
-
the distance formula to calculate the distance
between the center points of two sprites.
-
Next you'll update the collide function to
use the distance function.
-
If the distance between two sprites is less
than 100 pixels, the sprites are close enough
-
to be touching and the collide function should
return true.
-
If everything works, you'll see that when
the player collides with the target, your
-
score increases.
-
And when the player collides with the danger,
your score decreases.