Now that iTween is in place, let's see how we can script the mole character to make use of iTween and animate the character correctly. What we are aiming to achieve with the mole script at this stage is to have it animate up and down from the molehill. The animation should start at a random time between two ranges to avoid repetition and predictability of the behavior.
Let's take a look at how this script looks like. The following screenshot shows
The first three lines in the
Start() function are quite simple. We find and attach the mole hit sound source to
moleHitAudio to be used by us in the script. ...