|
Hello I am working on a game, can anyone tell me how to calculate the score based on seconds? For instance if the player plays for 10 seconds the score will be 10; 1 second = 1 point;
(comments are locked)
|
Because time is granular , if you wanted to do you could multiple the result by 10 and have a score that has fractions of a second. I just used the code but it gives me 2 errors! Assets/Scripts/MainScene/ScoreGUI.js(10,14): BCE0044: expecting (, found 'CalclulateScore'. Assets/Scripts/MainScene/ScoreGUI.js(10,29): BCE0044: expecting EOF, found '('. How do I fix them!
Apr 22 '12 at 01:41 PM
hariprasadh10792
I'm not really that sure what @Fabkins is doing here ... for one, he seems to have mixed a bit of C# with JS! You could either calculate the score at the end of a playing session by calling this function: or you could increment as you are going if you want like so: Pretty darn simple.
Apr 22 '12 at 02:19 PM
Kleptomaniac
Sorry typo. @Kleptomaniac, no you cant use Time.time on its own as its the time since the program started not the time since the game started. So, typos asside, my code stands.
Apr 22 '12 at 03:21 PM
Fabkins
PS corrected typo. I was having a mad moment and mixing JS and C#.
Apr 22 '12 at 03:24 PM
Fabkins
Thanks a lot for that! But when it prints on the screen it even displays Milli-seconds with it, is there a way just to display seconds?
Apr 22 '12 at 03:52 PM
hariprasadh10792
(comments are locked)
|
|
It displays mili-second because u have assigned the score avriable as float. now the scoring will in fixed value what you can also do is :
(comments are locked)
|
