Time for action – creating the black bird

As with the two birds discussed earlier, inheriting from the red bird makes the black bird's creation much easier:

  1. As with the others, this bird is initially created in the same way as the red bird, readjusting the Radius for its increased size.
  2. Again, we create a new script to extend the Bird script. This time it is called BlackBird.
  3. Do not forget to adjust line four to extend the Bird script and not MonoBehaviour.
    public class BlackBird : Bird {
  4. This script has two variables. The first is the size of the explosion and the second is its strength.
    public float radius = 2.5f;
    public float power = 25f;
  5. Once more we override the DoSpecial function, first marking that we did it. Next, we use Physics.OverlapSphere ...

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.