I am making a game for pre-literate kids. I need to move to the next scene automatically when they have touched all the specific sprites in a scene. Because kids will poke at everything, I need to identify the touch on the sprite and, if it has not been touched before, increment a counter. Then, when all the correct sprites in the scene have been touched, I’ll move to the next scene. But I have been unable to detect the touch on the sprite. Are there any example scripts?
I used the button approach for another scene, but it means there is still a boundary around the sprite, so that would not be as desirable for this scene.
The second choice is my preferred one, but I can’t seem to write a script that is correct that detects when the colliders are touched. An example script would be much appreciated.
The idea of disabling the script once the sprite is touched is great. Thanks.
There are several ways to do this.
You could make them buttons that call a function when touched. If the function requires an ID, and each sprite passes a unique ID to the function, you could keep track of which IDs have already been touched.
You could add colliders to the sprites and a script that detect when the colliders are touched. The script could send a signal to a central script when it’s touched and then disable itself, so further touch of that sprite would not be detected.