Adding Column Obstacles

Checked with version: 5.5

-

Difficulty: Beginner

In this beginner friendly live training we will look at creating a simple 2D Flappy Bird style game. We'll cover best practices for infinite or endless games, basic object pooling and creating cartoon physics effects.

Adding Column Obstacles

Beginner 2D Game Creation

Column

Code snippet

using UnityEngine;
using System.Collections;

public class Column : MonoBehaviour 
{
    void OnTriggerEnter2D(Collider2D other)
    {
        if(other.GetComponent<Bird>() != null)
        {
            //If the bird hits the trigger collider in between the columns then
            //tell the game control that the bird scored.
            GameControl.instance.BirdScored();
        }
    }
}