Answer the question
In order to leave comments, you need to log in
How to add a collision delay?
There are obstacles, an enemy and ladders, but with 1 collision, several health is removed at once. How can this be fixed?
Bot collision check code:
void OnCollisionEnter2D(Collision2D collision)
{
if (health <= 0)
{
ReloadLevel();
}
if (collision.gameObject.tag == "enemy")
{
anim.SetTrigger("Hit");
health--;
}
}
Код проверки столкновения с трапой:
void OnTriggerEnter2D(Collider2D collder)
{
if (health <= 0)
{
ReloadLevel();
}
if (collder.gameObject.tag == "saw")
{
health--;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question