I'm trying to create a system when my player gets hit the player ignores all enemy collisions for a brief moment so the player could have a chance to escape. Then when the time period is over he can get hit again. The problem is that when the player gets hit by the enemy, the same enemy that hit him can never touch him again other enemies can, but once they do the can never touch him again either. I have been trying my best to fix this please help me; heres the code.
if (ghostmode && coll.gameObject.tag == "charger" ) {
Physics2D.IgnoreCollision (gameObject.GetComponent (),coll.collider);
}
if(ghostmode = false){
Physics2D.IgnoreCollision (gameObject.GetComponent (), coll.collider,false);
}
↧