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 :slight_smile:

Tremayne

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.

Try

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

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