Time for action – creating the blue bird

The blue bird will again make use of inheritance, reducing the amount of code that needs to be written to create the bird:

  1. Again, start building your blue bird the same way as the previous two, substituting the appropriate model. You should also adjust the Radius of the Sphere Collider component to align appropriately with the smaller size of this bird.
  2. Next, we create the BlueBird script.
  3. Again, adjust line four so the script extends Bird instead of MonoBehaviour.
    public class BlueBird : Bird {
  4. This script has three variables. The first is a list of prefabs to spawn when the bird splits. Next is the angle difference between each new bird that will be launched. Finally is a value to spawn the birds a little ...

Get Unity Android Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.