You will recall that the Cucumber Man has the ability to throw cherries at the Cucumber Beetles. This is a ranged attack, and if the Cucumber Beetle were to start walking or running on the ground toward the Cucumber Man to attack, it is likely the beetle would die before reaching the Cucumber Man.
So, if a beetle is hit by a cherry, we want the following to occur:
- Beetle faces Cucumber Man
- Beetle stands
- Beetle runs, while standing, towards the Cucumber Man
- Beetle attacks Cucumber Man while standing
You can review the animations if you need a refresher on what they look like.
We will make some significant changes to our BeetleNPC script. The updated script is presented in the following code in its entirety, divided ...