home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / Frizzle_fraz.swf / scripts / Code / LOGIC / OBJECTS / ACTORS / RECTS / _dt98.as < prev    next >
Encoding:
Text File  |  2008-09-26  |  5.0 KB  |  181 lines

  1. package Code.LOGIC.OBJECTS.ACTORS.RECTS
  2. {
  3.    import Code.LOGIC.OBJECTS.ACTORS.INTERFACES._mk516;
  4.    import Code.LOGIC.OBJECTS.GRAPHICS._jy145;
  5.    import Code.org.cove.ape._be271;
  6.    import flash.geom.Point;
  7.    
  8.    public class _dt98 extends _gg531 implements _mk516
  9.    {
  10.       
  11.       public static const ORIENTATION_UP:int = 0;
  12.       
  13.       public static const ORIENTATION_RIGHT:int = 3;
  14.       
  15.       public static const stTime:int = 0;
  16.       
  17.       public static const stPop:int = 1;
  18.       
  19.       public static const ORIENTATION_DOWN:int = 1;
  20.       
  21.       public static const ORIENTATION_LEFT:int = 2;
  22.       
  23.       public static const stPush:int = 2;
  24.        
  25.       
  26.       private var _orientation:int;
  27.       
  28.       private var initalPos:_be271;
  29.       
  30.       private var progress:int;
  31.       
  32.       private var timer:int;
  33.       
  34.       private var startPos:Point;
  35.       
  36.       private var state:int;
  37.       
  38.       private var vel:Point;
  39.       
  40.       private var maxProgress:int;
  41.       
  42.       private var timeDelay:int;
  43.       
  44.       public function _dt98(param1:Object)
  45.       {
  46.          super(param1);
  47.          this._orientation = param1.orientation;
  48.          this.timeDelay = param1.timeDelay;
  49.          this.startPos = new Point(0,0);
  50.          this.vel = new Point(0,0);
  51.          this._yt549 = true;
  52.          initalPos = new _be271(param1.x,param1.y);
  53.          State = stTime;
  54.          _mb474(new _jy145(this));
  55.       }
  56.       
  57.       public static function _lu255() : Object
  58.       {
  59.          var _loc1_:Object = null;
  60.          return {
  61.             "toolClass":_dt98,
  62.             "name":"trap",
  63.             "params":{
  64.                "_tp253":0,
  65.                "timeDelay":100,
  66.                "width":120,
  67.                "height":50,
  68.                "orientation":[["down",_dt98.ORIENTATION_DOWN],["left",_dt98.ORIENTATION_LEFT],["right",_dt98.ORIENTATION_RIGHT],["up",_dt98.ORIENTATION_UP]]
  69.             }
  70.          };
  71.       }
  72.       
  73.       public function _eu538() : Object
  74.       {
  75.          var _loc1_:Object = null;
  76.          _loc1_ = new Object();
  77.          _loc1_._tp253 = _tp253;
  78.          _loc1_.prClass = "TTRap";
  79.          _loc1_.x = initalPos.x;
  80.          _loc1_.y = initalPos.y;
  81.          _loc1_.width = width;
  82.          _loc1_.height = height;
  83.          _loc1_.orientation = orientation;
  84.          _loc1_.timeDelay = timeDelay;
  85.          return _loc1_;
  86.       }
  87.       
  88.       private function _uy215() : void
  89.       {
  90.          this.vel.x = 0;
  91.          this.vel.y = 0;
  92.          switch(this.orientation)
  93.          {
  94.             case ORIENTATION_LEFT:
  95.                this.vel.x = -1;
  96.                this.maxProgress = width;
  97.                break;
  98.             case ORIENTATION_RIGHT:
  99.                this.vel.x = 1;
  100.                this.maxProgress = width;
  101.                break;
  102.             case ORIENTATION_UP:
  103.                this.vel.y = -1;
  104.                this.maxProgress = height;
  105.                break;
  106.             case ORIENTATION_DOWN:
  107.                this.vel.y = 1;
  108.                this.maxProgress = height;
  109.          }
  110.       }
  111.       
  112.       public function _ur45() : Object
  113.       {
  114.          var _loc1_:Object = null;
  115.          _loc1_ = _lu255();
  116.          _loc1_.params.x = initalPos.x;
  117.          _loc1_.params.y = initalPos.y;
  118.          _loc1_.params.width = width;
  119.          _loc1_.params.height = height;
  120.          _loc1_.params._tp253 = _tp253;
  121.          _loc1_.params.orientation = _orientation;
  122.          return _loc1_;
  123.       }
  124.       
  125.       override public function update(param1:Number) : void
  126.       {
  127.          super.update(param1);
  128.          switch(state)
  129.          {
  130.             case stTime:
  131.                if(this.timeDelay == -1)
  132.                {
  133.                   break;
  134.                }
  135.                if(this.timer++ > this.timeDelay)
  136.                {
  137.                   State = stPop;
  138.                }
  139.                break;
  140.             case stPop:
  141.                this.position = new _be271(_ej28 + vel.x,_th99 + vel.y);
  142.                if(++progress >= maxProgress)
  143.                {
  144.                   this.vel.x *= -1;
  145.                   this.vel.y *= -1;
  146.                   State = stPush;
  147.                }
  148.                break;
  149.             case stPush:
  150.                this.position = new _be271(_ej28 + vel.x,_th99 + vel.y);
  151.                if(--progress <= 0)
  152.                {
  153.                   State = stTime;
  154.                   this.position = new _be271(startPos.x,startPos.y);
  155.                }
  156.          }
  157.       }
  158.       
  159.       public function get orientation() : int
  160.       {
  161.          return _orientation;
  162.       }
  163.       
  164.       private function set State(param1:int) : void
  165.       {
  166.          state = param1;
  167.          switch(state)
  168.          {
  169.             case stTime:
  170.                this.timer = 0;
  171.                break;
  172.             case stPop:
  173.                startPos.x = _ej28;
  174.                startPos.y = _th99;
  175.                _uy215();
  176.                this.progress = 0;
  177.          }
  178.       }
  179.    }
  180. }
  181.