home *** CD-ROM | disk | FTP | other *** search
- class smashing.Base
- {
- var aT;
- var currentWorld;
- static var interval;
- var bPlay = false;
- function Base()
- {
- if(smashing.Base.interval != null)
- {
- clearInterval(smashing.Base.interval);
- smashing.Base.interval = null;
- }
- this.aT = [];
- }
- function get playing()
- {
- return this.bPlay;
- }
- function play()
- {
- var _loc1_ = this;
- if(smashing.Base.interval == null)
- {
- _loc1_.bPlay = true;
- _loc1_.last = getTimer();
- smashing.Base.interval = setInterval(function(o)
- {
- o.update();
- }
- ,0,_loc1_);
- _loc1_.currentWorld.onPlay();
- }
- }
- function pause()
- {
- if(smashing.Base.interval != null)
- {
- this.bPlay = false;
- clearInterval(smashing.Base.interval);
- smashing.Base.interval = null;
- this.currentWorld.onPause();
- }
- }
- function update(o)
- {
- var _loc2_ = this;
- var nCurrent = getTimer();
- var nElapsed = (nCurrent - _loc2_.last) / 1000;
- _loc2_.currentWorld.update(nElapsed);
- _loc2_.last = nCurrent;
- if(_loc2_.aT.length > 4)
- {
- var _loc3_ = undefined;
- _loc3_ = 0;
- var _loc1_ = 0;
- while(_loc1_ < _loc2_.aT.length)
- {
- _loc3_ += _loc2_.aT[_loc1_];
- _loc1_ = _loc1_ + 1;
- }
- _root.nDebug0 = _loc3_ / _loc2_.aT.length;
- _loc2_.aT = [];
- }
- _loc2_.aT.push(nElapsed);
- }
- function setWorld(oWorld)
- {
- var _loc1_ = this;
- if(oWorld != null)
- {
- _loc1_.currentWorld.onExit();
- _loc1_.currentWorld = oWorld;
- _loc1_.currentWorld.onEnter();
- }
- }
- static function hey()
- {
- }
- }
-