When you press the green flag, there are 3 possible outcomes. If you land on a dot, the sprite will rotate to face the mouse. If you land on nothing, the sprite will just follow your mouse. If you land on the apple, the sprite transforms, and then will complete the same outcome as the option above. It's completely randomized.
This is for school! :)