
-----------------------------------
Mr. T
Sun May 29, 2005 12:27 pm

Time.Elapsed
-----------------------------------
is there a way to hault the Time.Elapsed from counting becuz..my scoring system bonus works on the amount of time u spend within a level.  however, when the level is complete, a scoring chart appears...if u spend a long time in the scoring chart, the Time.Elapsed will still be counting milliseconds, and then u end up geting a negative bonus. please help.

-----------------------------------
MysticVegeta
Sun May 29, 2005 12:45 pm


-----------------------------------
var tim : int
put "Press any key to win"
loop
    tim := Time.Elapsed
    exit when hasch
end loop
put "Your time was: ", tim div 1000, " seconds."
if tim < 10000 then
    put "Time bonus is: ", 10000 - tim
end if


This?

-----------------------------------
Mr. T
Sun May 29, 2005 12:52 pm

Alex's Opinion
-----------------------------------
I'm not sure if that would work...let me give u some code.

put "Your score is: ", score     %score with out additional time bonus
    var timeBonus : int := bonus - Time.Elapsed div 1000     %1 min timer (Time.Elapsed = 1000 milliseconds = 1 min)
    put "Your time bonus is: ", timeBonus     %time bonus
    score := score + timeBonus     %updated score = score as of to that point + time bonus
    put "Your overall score is: ", score     %score as of to that point + time bonus
    score:= 60 + (Time.Elapsed div 1000) %score reset 
    put "[press enter to continue to next round]"     %gives the user time to read the score

the problem is that this reset line

score:= 60 + (Time.Elapsed div 1000) %score reset 

takes into affect before the game enters the next level...so the time is continually counting.

-----------------------------------
Cervantes
Sun May 29, 2005 2:50 pm


-----------------------------------
Everytime you enter a new level, store the Time.Elapsed at that time into a variable. When you finish the level, use (Time.Elapsed - the_time_variable_from_the_start_of_the_level) to determine the score.
