
SECTION 2
CHALLENGES
Try these challenge prompts to modify the code we've written:
- 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 uselerpColor()to create smooth color transitions. - As noted, these examples assume the default
rectMode(CENTER). Can you make new versions to work withrectMode(CENTER)instead? - 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?