Added explosion on enemy defeat

Also added a little force for when you land on an enemy, but sometimes it YEETS the player if done at the right moment with a trumpet jump
This commit is contained in:
Sam
2023-04-29 18:10:36 -07:00
parent 3ec0e985fb
commit 3318e11fd1
14 changed files with 1053 additions and 7 deletions

View File

@@ -179,6 +179,7 @@ public class PlayerBehavior : MonoBehaviour
void OnCollisionEnter2D(Collision2D collision) {
if (collision.gameObject.tag == "Enemy") {
if (collision.transform.position.y < transform.position.y) {
_rb.AddForce(Vector2.up * 8, ForceMode2D.Impulse);
collision.gameObject.GetComponent<EnemyPatrol>().DefeatEnemy();
} else {
DestroyPlayer();