- Home /
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
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.
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 :)
Hmm ... sorry I cannot really help, as I am still trying to understand what you intend to do.
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.
Your answer
Follow this Question
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