[Solved] how create function for flappy bird game? [duplicate]


The function you are looking for is called OnTriggerEnter2D

void OnTriggerEnter2D(Collider other) {
         if(other.gameObject.tag == "Floor")
              //You lost
 }

You need to place this function in a Scrip in the bird gameobject, then add colliders to the bird and the floor, and assign a tag to the floor so you can check inside the OnTriggerEnter2D is the bird crashed against the floor.

solved how create function for flappy bird game? [duplicate]