I have enemy objects that cause damage upon contact with the player… the player flashes but at the end of the flashing of the player if the player is still in contact with the enemy he does not suffer damage… until… a new contact occurs… how could I make sure that at the end of the flashing if and in contact it does damage every time???
Use OnCollisionStay/Stay2D. It’s called continuously while the contact remains. You will have to manage the cooldown if the object can only get hurt when some other effect like flashing is still playing.
tnk you for anser…
IEnumerator PlayerHitted()
{
for (int i = 0; i < nuberOfFlashes; i++)
{
spriteRend.color = new Color(1, 0, 0, 0.5f);
yield return new WaitForSeconds(iFramesDuration / (nuberOfFlashes * 2));
spriteRend.color = Color.white;
yield return new WaitForSeconds(iFramesDuration / (nuberOfFlashes * 2));
}
Physics2D.IgnoreLayerCollision(6, 11);
yield return new WaitForSeconds(0.5f);
Physics2D.IgnoreLayerCollision(6, 11, false);
}
with this code how do i tell When it stops blinking"?
The blinking only exists during the loop. When you are exiting the function, it has stopped.
okok and?? now how to check if is still colliding
ok ok tank to all i solved… just improve whit knock back system… "not solved " but i have want i want