Time for action – creating the red bird
Let's get started with creating the red bird:
- Although the red bird model is 3D, it is set up in a manner similar to that of the pig. Create an empty GameObject, naming it
Bird_Red
, and add the appropriate model from thebirds
model as a child, zeroing out its position. The model should be rotated to align it along the z axis. If turned a little more toward the camera, the player is able to see the bird's face while still giving the impression of looking down the field. - Next, give it a Sphere Collider component and a Rigidbody component, and set the Constraints parameters.
- Now, we need to create a new script named
Bird
. This script will be a base for all of our birds, tracking their health and triggering their special powers when appropriate. - It starts with two variables. The first will keep track of the bird's current health. The second is a flag so that the bird will only use its special power once. It is marked as
protected
so...