Computer Science Canada

Time

Author:  andrew. [ Tue Apr 22, 2008 8:02 pm ]
Post subject:  Time

Hi guys,

I'm in a bit of a dillema. I'm trying to make Turing start a timer when I want it to start. By using Time.Elapsed, no matter when I declare the variable, the timer still starts from the beginning. Is there any way that I can start a timer at a certain time?

BTW, this is for a bowling game I'm making where I want to calculate the velocity of the ball by having the user move the mouse at the speed that they want the ball to go at. Here is the procedure for that so far:

Turing:
proc bowling
    View.Update
    Mouse.Where (mx, my, mb)
    my2 := my
    mx2 := mx
    var vtime : int := Time.Elapsed
    loop
        Mouse.Where (mx, my, mb)
        if mb = 0 then
            velocity := ((my - my2) div vtime)
            exit
        end if
        View.Update
        put vtime
    end loop
    bowlingball
end bowling


This is where the timer messes the velocity up, which messes the ball up, so the ball never moves.

Author:  Mackie [ Tue Apr 22, 2008 8:32 pm ]
Post subject:  RE:Time

Have the timer accumulate in a variable. Add that variable to the timer.


: