# How do I detect how much of an object has been “cleaned” by the player?

I want to let the player wipe some dust off of a book, then start a short animation.

Here's what it looks like:

I'm using a clipping region on the "dusty" book bitmap image to progressively hide the dust as the player mouses over it.

However, I'm stuck with how to detect when the dust is all gone. What's a good way of tracking how much is left?

• Keep track of how much you're removing. When it's reached a certain amount, play the animation. Alternatively, just start the animation a set amount of time after the user starts to clean the book. Further, questions that are just "Here's this code, how do I add X?" are poor questions. You should tell us what you've tried and what about it didn't work. I'd go as far as to say the code is not even required in this question at all. – MichaelHouse Feb 13 '14 at 19:04

Now, when the mouse is pressed, you could set the closest point on the grid to a true value. The percentage cleaned would then be the ratio of true spots to total spots.