home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / germ_roundup.swf / scripts / __Packages / smashing / Base.as next >
Encoding:
Text File  |  2007-03-20  |  1.8 KB  |  81 lines

  1. class smashing.Base
  2. {
  3.    var aT;
  4.    var currentWorld;
  5.    static var interval;
  6.    var bPlay = false;
  7.    function Base()
  8.    {
  9.       if(smashing.Base.interval != null)
  10.       {
  11.          clearInterval(smashing.Base.interval);
  12.          smashing.Base.interval = null;
  13.       }
  14.       this.aT = [];
  15.    }
  16.    function get playing()
  17.    {
  18.       return this.bPlay;
  19.    }
  20.    function play()
  21.    {
  22.       var _loc1_ = this;
  23.       if(smashing.Base.interval == null)
  24.       {
  25.          _loc1_.bPlay = true;
  26.          _loc1_.last = getTimer();
  27.          smashing.Base.interval = setInterval(function(o)
  28.          {
  29.             o.update();
  30.          }
  31.          ,0,_loc1_);
  32.          _loc1_.currentWorld.onPlay();
  33.       }
  34.    }
  35.    function pause()
  36.    {
  37.       if(smashing.Base.interval != null)
  38.       {
  39.          this.bPlay = false;
  40.          clearInterval(smashing.Base.interval);
  41.          smashing.Base.interval = null;
  42.          this.currentWorld.onPause();
  43.       }
  44.    }
  45.    function update(o)
  46.    {
  47.       var _loc2_ = this;
  48.       var nCurrent = getTimer();
  49.       var nElapsed = (nCurrent - _loc2_.last) / 1000;
  50.       _loc2_.currentWorld.update(nElapsed);
  51.       _loc2_.last = nCurrent;
  52.       if(_loc2_.aT.length > 4)
  53.       {
  54.          var _loc3_ = undefined;
  55.          _loc3_ = 0;
  56.          var _loc1_ = 0;
  57.          while(_loc1_ < _loc2_.aT.length)
  58.          {
  59.             _loc3_ += _loc2_.aT[_loc1_];
  60.             _loc1_ = _loc1_ + 1;
  61.          }
  62.          _root.nDebug0 = _loc3_ / _loc2_.aT.length;
  63.          _loc2_.aT = [];
  64.       }
  65.       _loc2_.aT.push(nElapsed);
  66.    }
  67.    function setWorld(oWorld)
  68.    {
  69.       var _loc1_ = this;
  70.       if(oWorld != null)
  71.       {
  72.          _loc1_.currentWorld.onExit();
  73.          _loc1_.currentWorld = oWorld;
  74.          _loc1_.currentWorld.onEnter();
  75.       }
  76.    }
  77.    static function hey()
  78.    {
  79.    }
  80. }
  81.