Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-2
Question by waqasmajeed · Jan 27, 2014 at 08:27 AM · inputeventscolider

I am working on temple run like game

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 ?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Fornoreason1000 · Jan 27, 2014 at 09:08 AM

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

  1. 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.

  2. 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.

  3. 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.

  4. 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

  1. Door Open and you set the switch bool to true, the character will run again like normal.

  2. Door will close behind the character for visuals

Hope it helps.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image waqasmajeed · Jan 27, 2014 at 10:29 AM 0
Share

I have done that ... Thanks for your help ...

avatar image waqasmajeed · Jan 27, 2014 at 10:26 PM 0
Share

There is a problem. I am doing this by replacing the scenes. I am instantiating an empty Game-object prefab in GamePlayScene when player is colliding with that i am loading HouseScene and when it is colliding with back door (in HouseScene) i am loading GamePlayScene. but the game is starting from the beginning. how can I resume the game From where I left And keep the track of Distance covered and coins collected? And also for HouseScene . Remember the points i achieved in it. script help would be great. Thanks.

avatar image Fornoreason1000 · Jan 29, 2014 at 09:06 AM 0
Share

You can make a cache of your position, coins ,points, pickup's and whatever that gets carried over when you collide with GamePlayScene. then load them in to your game. pretty simple really. i thought you were going to instantiate the house on the fly is all.

To make a cache in unity is a bit different from how you would go about it. there more play on $$anonymous$$onobehaviours. you can make one on your manager script (a manager script is a script attached to a game object that Never gets destroyed, even loaded scenes, setting one up is self-explainitory). since that should always be present and will automatically be carried over.

avatar image Fornoreason1000 · Jan 29, 2014 at 09:29 AM 0
Share

also in future reference, you question is rather vague which can lead to complications from people making assumptions. and the title should be more specific. such as "Inserting a room in a Temple run type game". this will give other users a better description and are more likely to help you.

avatar image waqasmajeed · Feb 03, 2014 at 05:57 PM 0
Share

O$$anonymous$$ @Fornoreason1000 . Thanks for your answer. I will take care of that (Title) in future.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

GetKeyDown is fired more than once in Update() 1 Answer

Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers

Input: Missing mouse button events 2 Answers

How do I detect when UI events are triggered on *any object*? 1 Answer

OnClick Event getting called on another event 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges