player can now jump on enemies to defeat them
This commit is contained in:
		@@ -150,8 +150,7 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
        }
 | 
			
		||||
        else if (col.tag == "instaDeath")
 | 
			
		||||
        {
 | 
			
		||||
            this.stateController.SetDeathCanvasActive(true);
 | 
			
		||||
            Destroy(this.gameObject);
 | 
			
		||||
            DestroyPlayer();
 | 
			
		||||
        }
 | 
			
		||||
        else if (col.tag == "spawnPoint") {
 | 
			
		||||
            stateController.spawnPoint.GetComponent<SpawnPointBehavior>().DeactivateSpawnPoint();
 | 
			
		||||
@@ -169,8 +168,20 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    void OnCollisionEnter2D(Collision2D collision) {
 | 
			
		||||
        if (collision.gameObject.tag == "Enemy") {
 | 
			
		||||
            this.stateController.SetDeathCanvasActive(true);
 | 
			
		||||
            Destroy(this.gameObject);
 | 
			
		||||
            if (collision.transform.position.y < transform.position.y) {
 | 
			
		||||
                Destroy(collision.gameObject);
 | 
			
		||||
            } else {
 | 
			
		||||
                DestroyPlayer();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else if (collision.gameObject.tag == "Projectile") {
 | 
			
		||||
            Destroy(collision.gameObject);
 | 
			
		||||
            DestroyPlayer();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void DestroyPlayer() {
 | 
			
		||||
        this.stateController.SetDeathCanvasActive(true);
 | 
			
		||||
        Destroy(this.gameObject);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user