Enemies half done

This commit is contained in:
Gerard Gascón 2023-08-22 20:12:53 +02:00
parent eaa8cdd462
commit 16507f4121
93 changed files with 31744 additions and 119 deletions

View file

@ -10,11 +10,13 @@ namespace Level1 {
}
void OnTriggerEnter2D(Collider2D other) {
if (!other.CompareTag("Player")) return;
if (!other.CompareTag("Player") && !other.CompareTag("Bullet")) return;
PlayerMovement1 player = other.GetComponent<PlayerMovement1>();
player.Rb.velocity = new Vector2(player.Rb.velocity.x, player.deathForce);
player.Animator.SetTrigger(PlayerMovement1.Jump1);
if(player) player.Rb.velocity = new Vector2(player.Rb.velocity.x, player.deathForce);
if(player) player.Animator.SetTrigger(PlayerMovement1.Jump1);
if(!player) Destroy(other.gameObject);
Destroy(_enemy.gameObject);
}
}