Collision Detection

SECTION 2

CHALLENGES

Try these challenge prompts to modify the code we've written:

  1. Can you make an object change color gradually as the mouse gets closer? Hint: use map() to convert the distance to a useful range. You can also use lerpColor() to create smooth color transitions.
  2. As noted, these examples assume the default rectMode(CORNER). Can you make new versions to work with rectMode(CENTER) instead?
  3. With Circle/Rectangle collision covered, we have enough to build Pong! Can you create a simple version with rectangles as paddles and a circle as the ball?

NEXT: Line/Point