- Home /
Question by
Jeezker · Apr 24, 2014 at 12:34 PM ·
collider 2drestart game
Executing some actions when 2d rigidbodies collide?
Hey, thanks for clicking this! Also, sorry for asking for coding, but I can't get anything to work.
-making a 2d infinite runner -character avoids obstacle -more avoiding, more points -my first game
What I need: when the character collides with the obstacle, the game time changes to slow motion, the audio pitch lowers, and after 3 seconds the level restarts.
Thank you very much, all I can do is add your name to the credits.
:)
Comment
void OnCollisionEnter2D(Collision2D coll) {
if (coll.gameObject.tag == "Obstacle"){
Time.timeScale = 0.7F;
Invoke("Restart", 3F);
}
}
void Restart()
{
//restart code
}
Your answer
Follow this Question
Related Questions
Unity 5.0.2 iOS Build Having GUI Errors When Loading Level 0 Answers
My game keeps restarting at random 1 Answer
Trigger actions when avatar enters/exists area 1 Answer
2D Topdown deteriorating orbit? 1 Answer
2D Colliders and spawners check 0 Answers