home *** CD-ROM | disk | FTP | other *** search
/ Geek Games #12 / GEGA012.iso / eroticos / spankthebooty.swf / scripts / __Packages / ScoreKeeper.as < prev    next >
Text File  |  2005-10-13  |  876b  |  38 lines

  1. class ScoreKeeper
  2. {
  3.    static var totalScores = 0;
  4.    static var numScores = 0;
  5.    static var latestScore = 0;
  6.    function ScoreKeeper()
  7.    {
  8.    }
  9.    static function reset()
  10.    {
  11.       ScoreKeeper.numScores = 0;
  12.       ScoreKeeper.totalScores = 0;
  13.       ScoreKeeper.latestScore = 0;
  14.    }
  15.    static function addScore(score)
  16.    {
  17.       ScoreKeeper.totalScores += score;
  18.       ScoreKeeper.numScores = ScoreKeeper.numScores + 1;
  19.       ScoreKeeper.latestScore = score;
  20.    }
  21.    static function getNumScores()
  22.    {
  23.       return ScoreKeeper.numScores;
  24.    }
  25.    static function getLatestScore()
  26.    {
  27.       return Math.round(ScoreKeeper.latestScore);
  28.    }
  29.    static function getAverageScore()
  30.    {
  31.       if(ScoreKeeper.numScores == 0)
  32.       {
  33.          return 0;
  34.       }
  35.       return Math.round(ScoreKeeper.totalScores / ScoreKeeper.numScores);
  36.    }
  37. }
  38.