home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / mid_flight.swf / scripts / frame_25 / DoAction.as
Encoding:
Text File  |  2008-08-07  |  2.0 KB  |  86 lines

  1. movieclip.prototype.findy = function(x, p1x, p1y, p2x, p2y)
  2. {
  3.    return p1y + (x - p1x) / (p2x - p1x) * (p2y - p1y);
  4. };
  5. movieclip.prototype.cekboxcoll = function(ex, ey, ew, eh, sx, sy, sw, sh)
  6. {
  7.    var _loc2_ = ey;
  8.    var _loc3_ = sy;
  9.    var _loc1_ = 0;
  10.    if(math.abs(ex - sx) < ew + sw)
  11.    {
  12.       if(_loc2_ - _loc3_ > 0 and _loc2_ - _loc3_ < eh or _loc3_ - _loc2_ > 0 and _loc3_ - _loc2_ < sh)
  13.       {
  14.          _loc1_ = 1;
  15.       }
  16.    }
  17.    return _loc1_;
  18. };
  19. movieclip.prototype.popscore = function(hits, skor)
  20. {
  21.    _root.pops.hits = hits;
  22.    _root.pops.gotoAndPlay(2);
  23. };
  24. Color.prototype.setBrightness = function(value)
  25. {
  26.    this.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,bb:0});
  27.    var trans = this.getTransform();
  28.    var percent = Math.abs(value) / 100;
  29.    var brightnessColor = value <= 0 ? 0 : 255;
  30.    with(trans)
  31.    {
  32.       ra -= ra * percent;
  33.       ga -= ga * percent;
  34.       ba -= ba * percent;
  35.       rb += (brightnessColor - rb) * percent;
  36.       gb += (brightnessColor - gb) * percent;
  37.       bb += (brightnessColor - bb) * percent;
  38.    }
  39.    this.setTransform(trans);
  40. };
  41. Color.prototype.resetcolor = function()
  42. {
  43.    this.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,bb:0});
  44. };
  45. Array.prototype.removeElement = function(i)
  46. {
  47.    var _loc2_ = this;
  48.    var _loc3_ = i;
  49.    if(_loc3_ == null)
  50.    {
  51.       _loc3_ = 0;
  52.    }
  53.    var r = _loc2_[_loc3_];
  54.    var _loc1_ = _loc3_;
  55.    while(_loc1_ < _loc2_.length - 1)
  56.    {
  57.       _loc2_[_loc1_] = _loc2_[_loc1_ + 1];
  58.       _loc1_ = _loc1_ + 1;
  59.    }
  60.    _loc2_.pop();
  61.    return r;
  62. };
  63. Array.prototype.removeValue = function(a)
  64. {
  65.    var _loc2_ = this;
  66.    var _loc3_ = a;
  67.    var _loc1_ = 0;
  68.    while(_loc1_ < _loc2_.length)
  69.    {
  70.       if(_loc3_ == _loc2_[_loc1_])
  71.       {
  72.          _loc2_.removeElement(_loc1_);
  73.       }
  74.       _loc1_ = _loc1_ + 1;
  75.    }
  76. };
  77. Array.prototype.copy = Array.prototype.slice;
  78. Array.prototype.randomize = function()
  79. {
  80.    return this.sort(function(a, b)
  81.    {
  82.       return Math.floor(Math.random() * 2) != 0 ? -1 : 1;
  83.    }
  84.    );
  85. };
  86.