In Chapter 7, Implementing our Player Character, we demonstrated the Cucumber Man's throw animation using the E keyboard key. In this section, we will make the necessary changes to instantiate a cherry in the Cucumber Man's right hand when the E keyboard key is pressed and then allow it to be launched. We will check to ensure the Cucumber Man has at least one cherry in his inventory so we know whether a cherry should be instantiated or not. Okay, let's get started.
The following steps demonstrate how to create a spot for the cherry on the Cucumber Man's right hand.
- In the
Hierarchypanel, expand the
CucumberManobject until you see
- Rename the new GameObject to
cherrySpot. This will be the spot where we render the cherry.
- Using the transform tools, move the
cherrySpotGameObject so that it is inside...