private void OnCollisionEnter2D(Collision2D collision) { print("Collided"); print(collision.gameObject.tag + "ayush"); if (!(collision.gameObject.tag == "baseBlock"))//if its not baseblock { // firstBlockbool.counterblocks1(); //firstBlockbool.resize(); // firstBlockbool.counterblocks1(); firstBlockbool.collisonsubstracter(); Destroy(collision.gameObject); explode.Play(); firstBlockbool.updatelives(); print("explode"); } /* * { * * if (collision.gameObject.CompareTag("ground")) * { * print(a + " " + b); * a = a * (4f / 3f); * b = b * (4f / 3f); * Destroy(this.gameObject); * * * } * if (!collision.gameObject.CompareTag("ground")) * { * if (buildingBlockNew.transform.localScale.x != collision.transform.localScale.x * (3f / 4f)) * { * * // print("abc"); * * Destroy(this.gameObject); * * * } * } * } */ }
private void OnCollisionEnter2D(Collision2D collision) { if (!(collision.gameObject.tag == "baseBlock")) { //if its not baseblock firstBlockbool.resize(); firstBlockbool.collisonsubstracter(); birdsound.Play(); Destroy(collision.gameObject); Destroy(gameObject); print("birdexplode"); firstBlockbool.updatelives(); } }