0
\$\begingroup\$

I am creating an educational game for kids , and in one of the levels player must to paint animals , like in color book, so I created scene where 2 object , already colorful lion and white lion (white is above) and script, which is instantiating circle sprite masks in players touch position , how can I check if white lion is fully covered by masks and not visiable .

P. S. If you have better idea for painting (like painting with brush) and checking , please say.

\$\endgroup\$
1
\$\begingroup\$

One possible solution is to cover your lion with invisible GameObjects that start off with a bool isTouched = false.

Then, you keep a count of how many of these GameObjects are on the lion and how many have been touched so far. Each time one is touched and !isTouched, you set isTouched = true;, increment the count by 1, and then check if the touched count equals the total number of points. If they are equal, then you know every point has been touched at least once.

Pros:

  • You can adjust the granularity of how much of the lion needs to be touched manually: fewer GameObjects = more forgiving of gaps in the coloring; more GameObjects = higher fidelity

  • You can use the number of touched objects vs the total number to cheaply measure progress & add effects accordingly

  • Time efficient - things are only called on frames where something is touched.

Cons:

  • Requires manual placement of the GameObjects (there may be a good way around this)

  • Depending on GameObject placement and how large their colliders are, there can be false positives or false negatives on detecting complete coloring

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.