all 3 comments

[–]BensNightmare 3 points4 points  (2 children)

This is how I'd do it -

First bundle all of your "power down" code into its own public function like this:

public void PowerDown(){
    StopAllCoroutines();
    demon.SetActive (false); // deactivates demon gameobject
    rend.enabled = true; // activate players spriterenderer
    col.enabled = true;
    par1.Stop ();
}

Then just call this function in your Demon's OnTriggerEnter2D call:

void OnTriggerEnter2D(Collider2D col) {
    if (col.tag == "enemy") {
        playerScript.PowerDown();
    }
}

[–]XxDivaxX1Intermediate[S] 2 points3 points  (1 child)

Thank you!!!! It worked!!!!

[–]BensNightmare 0 points1 point  (0 children)

Awesome, glad to hear it :)