Friday, July 16th, 2010

Resetting Clock() ??

Ok, i have my code:
int seconds;
        clock_t clock();
        seconds = clock()/CLOCKS_PER_SEC;
                       
        if (seconds == 8){
                        FIVE.SetPositionX(-1);
                        }
//....
if ((AdventureGame.keypressed[DIK_F]) && (WOO.positionX == -10)){
               
                //reset clock() here
                FIVE.SetPositionX(-5);}
the clock starts when the program is run and after 8 secs, FIVE moves position.
When i press F, i want FIVE to reset its position [which it does], and to reset the clock(), so that after 8 secs, FIVE will move again.
Anyway to do this?
Using Windows 7, visual studio.

Original source : Resetting Clock() ??
Category: C++

Comments are closed.