Step 9. Mouse Interaction with Objects

When we click inside an object, that object changes color.

This is done by getting the global function mousePressed() to call a function clicked() inside every object. Each object then checks if the click was actually inside it.

World

Tutorial 7.4
Mouse Interaction with Objects
Tweet this step: