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

  1. class smashing.Misc
  2. {
  3.    function Misc()
  4.    {
  5.    }
  6.    static function rndArray(aToBeRnd)
  7.    {
  8.       var _loc2_ = 0;
  9.       var _loc1_ = [];
  10.       var aResult = [];
  11.       _loc1_ = _loc1_.concat(aToBeRnd);
  12.       var _loc3_ = undefined;
  13.       _loc2_ = 0;
  14.       while(_loc2_ < aToBeRnd.length)
  15.       {
  16.          _loc3_ = int(Math.random() * _loc1_.length);
  17.          aResult.push(_loc1_[_loc3_]);
  18.          _loc1_.splice(_loc3_,1);
  19.          _loc2_ = _loc2_ + 1;
  20.       }
  21.       return aResult;
  22.    }
  23.    static function uniquePush(aPush, oObject)
  24.    {
  25.       var _loc2_ = aPush;
  26.       var _loc3_ = false;
  27.       var _loc1_ = 0;
  28.       while(_loc1_ < _loc2_.length)
  29.       {
  30.          if(_loc2_[_loc1_] == oObject)
  31.          {
  32.             _loc3_ = true;
  33.          }
  34.          _loc1_ = _loc1_ + 1;
  35.       }
  36.       if(_loc3_ != true)
  37.       {
  38.          _loc2_.push(oObject);
  39.       }
  40.    }
  41.    static function number(sNum)
  42.    {
  43.       var l = sNum.length + 1;
  44.       var _loc2_ = 1;
  45.       var _loc3_ = 0;
  46.       var _loc1_ = 1;
  47.       while(_loc1_ < l)
  48.       {
  49.          _loc3_ += Number(sNum.substr(- _loc1_,1)) * _loc2_;
  50.          _loc2_ *= 10;
  51.          _loc1_ = _loc1_ + 1;
  52.       }
  53.       return _loc3_;
  54.    }
  55.    static function rndBool()
  56.    {
  57.       return Boolean(Math.floor(Math.random() * 2));
  58.    }
  59.    static function isHoriz(l)
  60.    {
  61.       if(l.normal.dot(smashing.Phys.up) > 0)
  62.       {
  63.          return true;
  64.       }
  65.       return false;
  66.    }
  67. }
  68.