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
0
Question by Tremayne · Dec 20, 2013 at 07:28 PM · javascriptguipointstimers

Help with points Algorithm?

Hi there

I wrote some code that gives you a certain amount of stars on level completion.

this is how my game works so far

if (finishTime < 60) {

                 Time1 = true;

             } if (finishTime <= 70) {

                 Time2 = true; and so on......

so if time 1 is called

if (Time1)

             {
             
              
                 oneStarGUI.enabled = true;
                 twoStarGUI.enabled = true;
                 threeStarGUI.enabled = true; 
                 finishTimeText.text =  textTime; 
                    Handheld.Vibrate ();                          
                 finishTimeText.text = "Your Time       "+ textTime;
                 
                 
                 scoreFinalText.text = "Score:" + scoreFinal;
                 
                 
                 yield WaitForSeconds(7);
                 Application.LoadLevel(5); 
   
             }

.........

it basically enables the GUI textures that will give you the relevant amount of stars and start next level...

i get the Time data from a standard stopwatch.

The part i am struggling with is that i want to implement a numeric score as well as the GuiStars so that it adds more competition to the game.

i want to say

If completed in 40 seconds or less you get the relevant stars as well as a standard level completion score of 500

but to be more specific, if the allocated time for the level is eg: 40seconds and the player finishes in 34seconds, i want to give them a score that takes the remainder of 34 seconds and multiplies it by 4

like this: - Time Given For Completion 40 (User receives Stars + 500 level completion points) - User completed in 34 - so 40 - 34 = 6 x 4 = 24 + 500 (level completion bonus points) = 524

i also need help with adding the standard 500 points on completion to the final score

sorry for the crap way of explaining

Thanks a million in advance :)

Tremayne

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by contab009 · Dec 20, 2013 at 08:00 PM

If I'm understanding this well, you want to show that score over the course of several levels. You can use PlayerPrefs to store the score as a saved variable, meaning you get it at the end of each level, increase it by what you wish and store it back.

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 Tremayne · Dec 20, 2013 at 08:07 PM 0
Share

hi there

thanks for the feedback

I want to assign a standard "finish score" to each level and a "bonus score" that is deter$$anonymous$$ed by the remainder of seconds to recommended time to finish level. I don't want to carry score to next levels. Each level can have its own score :)

avatar image contab009 · Dec 20, 2013 at 08:25 PM 0
Share

Hmm ... sorry I cannot really help, as I am still trying to understand what you intend to do.

avatar image
0

Answer by Kiwasi · Jul 24, 2014 at 02:16 PM

Try

Points = 500 + (40 - levelTime) * 4;

I'm not sure what your exact problem is, the equation is straight out of your question.

Comment
Add comment · 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

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

21 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 avatar image

Related Questions

Multiple Cars not working 1 Answer

JavaScript: GUI Box help 1 Answer

Is it possible to link character skill lists to a GUI, and if so, how? 3 Answers

GUIText Problem With MENU 1 Answer

Pause Menu background problem 0 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