Game Timer Component

By Joachim Schnier

This is a game timer, which has several options:
         automatic or manual start count down,
         normal timer with automatic or manual start and stop,
         automatic start and stop can be manipulated by changing frames,
         one or two players,
         and recording the scores.

Instructions to install: Put the component in the component folder. Then click on it and follow the instructions of the extension manager.

Download files.



INSTRUCTIONS to set up:

1. PLAYER OPTIONS
         one Player (true) or two (false).

2. START OPTIONS
     2.1 manual Start:
         set start to 0, will require stop to false,
     2.2 automatic Start:
         set start to 1, will require stop to true, enter this line into the frame where the start should occur:

         componentName.timer.startGame(1,false,0);

     2.3 automatic countdown start:
         set start to 2, will require stop to false, set countdown to true, enter countdown time in seconds,
     2.4 manual countdown start:
         set start to 3, set countdown to true, enter countdown time in seconds.

3. STOP FUNCTION
     automatic Stop: true, will require automatic start and frame number or name
     false, manual stop, will require automatic start.

4. FRAME NUMBER
     enter frame number to stop timer.

5. RESETTING TIMER FOR AUTOMATIC START AND STOP
     Normally to reset timer push the "reset" button, but when timer stops by changing going to another frame, reset can be done automatically. When going back to the original frame enter this line into a button for example:

         componentName.timer.resetTimer();

KEEPING TRACK OF THE SCORE
     to use the score name the component on the stage and enter these lines into your script to count the score.
     for one player:

         _global.scoreCountOne++;
         componentName.timer.oneScore.oneScoreField.text=_global.scoreCountOne;
     //or for decreasing the score:
         _global.scoreCountOne--;
         componentName.timer.oneScore.oneScoreField.text=_global.scoreCountOne;
     for two players:
         _global.scoreCountA++;
         componentName.timer.twoScore.aScoreField.text=_global.scoreCountA;

         _global.scoreCountB++;
         componentName.timer.twoScore.bScoreField.text=_global.scoreCountB;