Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by fcc32 · Dec 27, 2015 at 11:02 AM · c#javascriptgame over

Making Game Over And Win Screen

Hello,

I have been struggling with this fairly basic issue: To make a game over menu appear upon death, as well as making it so a menu is also displayed upon winning.

I am making a 3D game in Unity, where you, the player, must control a sphere with the basic controls: w,a,s,d/up,down,left,right. It is a game where you must "drive" the ball and pass a broad variety of obstacles to ultimately win the game. I have already implemented the Main Menu, Pause Menu and the actual game overall. I just need to figure out how to make it so the player can actually lose and win the game. The 2 most important aspects of a game. To lose. To win. Unfortunately, I have not a single clue on how I can make such. The player is on a platform, as are the obstacles etc. I have made in my game a bridge you must cross over, on which below it is nothing. So, if you slide off the bridge, you will basically die, as there is nowhere else to go upon falling. I want to make it so that when you fall from the actual platform, or the map, falling into the "abyss", you will die, on which I would like a game over screen to appear. On the other hand, there is only one way to win the game. You must control your ball, passing through obstacles and lead the ball to fall into a box, on which if the ball is within it, you win. I basically have no clue how to make any of this a reality. Not one single clue. If possible, I would be delighted if anyone could develop a script for both for me. Java Script or C#, doesn't matter. If you can assist me in anyway, please do. I am going to release this game for the PC, on Steam soon and if possible.

Best regards,

fcc32

Comment
Add comment · Show 1
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 fcc32 · Dec 31, 2015 at 09:46 AM 0
Share

BU$$anonymous$$P! I still am in need of full assistance! Help! Anyone? Please and thank you!

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by FrederikK · Dec 27, 2015 at 11:51 AM

What you need are events and collider triggers.

https://unity3d.com/learn/tutorials/modules/intermediate/scripting/events

https://unity3d.com/learn/tutorials/modules/beginner/physics/colliders-as-triggers

What I would do is put a script on the ball that triggers a lose event if its y value becomes to low, because it fell. Then I would also put invisible triggerboxes around any deadly obstacles as well as the "win zone".

Comment
Add comment · Show 2 · 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 fcc32 · Dec 27, 2015 at 02:03 PM 0
Share

Sorry, I am a complete novice in Unity. Could you provide these scripts if possible? Thank you for your response.

avatar image ShadyProductions fcc32 · Jan 02, 2016 at 05:29 PM 0
Share

we don't "provide" scripts, we help with problems.

avatar image
1

Answer by Developer1212 · Jan 10, 2016 at 05:41 PM

Hello, I've made a game similar to this.

the easiest way to make the game over part is to create a cube,make it transparent by unchecking it's mesh renderer(don't do this until after you've finished otherwise things can get confusing), and resize it so if your sphere falls off the bridge it's guaranteed that the sphere will collide with the cube.Now make two scenes.One for game over and one for winner. And , assuming you've already made your winner's box, here's the javascript code:

 #pragma strict //It's good to put this at the top of each javascript script
 
 function OnCollisionEnter(theCollision : Collision) {  //Unity's built in collision function
 
 if(theCollision.gameObject.name == "Whatever you called that cube I asked you to make") { //if the collision is called Whatever you called that cube I asked you to make
 Application.LoadLevel("Whatever your game over scene is called"); //this loads your game over scene. Make sure you put that scene in the build settings
 }
 
 if(theCollision.gameObject.name == "Whatever you called your box") { //I'll let you figure this out :)
 Application.LoadLevel("Whatever your winner scene is called"); //You get the idea, but be sure to put your winner scene in the build settings.
 }
 }
 
 
 


Comment
Add comment · Show 1 · 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 Developer1212 · Jan 10, 2016 at 05:46 PM 0
Share

Also, I wouldn't rush into this kind of stuff. Watch some tutorials. I would recommend Brackeys or my tech tutorials website www.technologywithmax.wordpress.com

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

6 People are following this question.

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

Related Questions

Distribute terrain in zones 3 Answers

Multiple Cars not working 1 Answer

Problem Javascript to C# 3 Answers

dealing with gameObject formations 1 Answer

The best place to learn Javascript/C# 1 Answer


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