- Home /
Question by
wheatz · Feb 03, 2020 at 07:31 PM ·
2d game2d-platformer2d-gameplay
2D platformer squashed
private void OnCollisionStay2D(Collision2D collision)
{
if (collision.gameObject.tag == "MovingPlatform" && collision.gameObject.tag == "Ground")
{
StartCoroutine(die());
}
}
I need help with a few lines of code that kill the player if they touch
Comment
Answer by logicandchaos · Feb 04, 2020 at 01:57 AM
You need to explain what you are trying to accomplish and show all your code. Why are you calling a coroutine? Also your OnCollisionStay2D Should probably be OnCollision2D, otherwise your coroutine may be called multiple times..
Your answer

Follow this Question
Related Questions
Player getting stuck between grounds 0 Answers
Destroy a gameObject in the scene if instantiate the same gameObject 0 Answers
OnCollisonEnter2D. 1 Answer
How to Implement a “Parry” mechanic to a 2D game? 1 Answer
How to create soil or sand?? 1 Answer