I am working on temple run like game using this Kit. Ruin Run.
I want to insert a room with two doors , when my player enters in the room it stops running and user can control with arrow keys , and when it leaves the room by back door it starts running again . what should i do when it collides with the door coliders ?
I’m not using the kit but i could provide some information on how to go about it.
It won’t be simple but first.
Collision of the First Door
-
Well when the player goes through the first door, you want to stop calling what ever is making your character run automatically. the character should stop , his animation might not , so you will have to fix that. this can be done by using an if block will a bool as a switch. the switch is triggered by the OnCollisionEnter Command called by Monobehaviour.
-
then you need to provide some movement logic for your inputs. do you want the character to walk or Run? you could even get the automatic run code to respond to the inputs of the user using events. this can e done many ways its really up to you.
-
of course you may want to close the first door after the character walks inside so they do not walk out unless you are intending this of course.
-
Actual movement of the character being implemented depends largely on the code that makes the character run. Of course you can add your own movement script that activates when you collide with the door. you want it to respond to your Arrow keys using the Input classes.
Collision of the Back door
-
Door Open and you set the switch bool to true, the character will run again like normal.
-
Door will close behind the character for visuals
Hope it helps.