Created
October 3, 2021 02:38
-
-
Save curious-username/12a52a01c0deda4aa4d52742cbaf0e70 to your computer and use it in GitHub Desktop.
enemy fire interaction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Player _player; | |
private float _speed = 8f; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
_player = GameObject.Find("Player").GetComponent<Player>(); | |
} | |
private void OnTriggerEnter2D(Collider2D collision) | |
{ | |
if(collision.tag == "Player") | |
{ | |
_player.Damage(); | |
Destroy(gameObject); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment