dimanche 21 février 2016

Actionscript 2 to 3 conversion

this is a sample of my game im trying to convert the code from actionscript 2 to 3. Ive looked up tutorials and sadly still dont have a clue. I would more than greatly appreciate it. If you would include why you changed.., Im hoping this is easier than it seems. Thank you... Also a couple tips or samples on what i need to look for in the future.

   class Human
    {
       function Human(nmc)
       {
          this.mc = nmc;
          this.pts = new Array(11);
          this.size = 3;
          var _loc4_ = 4;
          var _loc3_ = 6;
          var _loc2_ = 4;
          this.pts[0] = new Vec(0,(- this.size) * 2.5);
          this.pts[1] = new Vec(0,- this.size);
          this.pts[2] = new Vec(0,_loc2_ * this.size);
          this.pts[3] = new Vec((- _loc4_) * this.size,0);
          this.pts[4] = new Vec(_loc4_ * this.size,0);
          this.pts[5] = new Vec(- this.size,_loc2_ * this.size + _loc3_ * this.size);
          this.pts[6] = new Vec(this.size,_loc2_ * this.size + _loc3_ * this.size);
          this.pts[7] = new Vec((- _loc4_) * 2 * this.size,0);
          this.pts[8] = new Vec(_loc4_ * 2 * this.size,0);
          this.pts[9] = new Vec(- this.size,_loc2_ * this.size + _loc3_ * 2 * this.size);
          this.pts[10] = new Vec(this.size,_loc2_ * this.size + _loc3_ * 2 * this.size);
          this.pts[0].addLink(this.pts[1]);
          this.pts[1].addLink(this.pts[2]);
          this.pts[1].addLink(this.pts[3]);
          this.pts[1].addLink(this.pts[4]);
          this.pts[2].addLink(this.pts[5]);
          this.pts[2].addLink(this.pts[6]);
          this.pts[3].addLink(this.pts[7]);
          this.pts[4].addLink(this.pts[8]);
          this.pts[5].addLink(this.pts[9]);
          this.pts[6].addLink(this.pts[10]);
          this.left_wire = new Wire(this.mc,this.left_hand());
          this.right_wire = new Wire(this.mc,this.right_hand());
          this.left_wire.trans(this.left_hand());
          this.right_wire.trans(this.right_hand());
          this.walk_state = 0;
          this.on_the_ground = 0;
          this.use_left = true;
       }
       function left_hand()
       {
          return this.pts[8];
       }
       function right_hand()
       {
          return this.pts[7];
       }
       function trans(v)
       {
          var _loc2_ = 0;
          while(_loc2_ < this.pts.length)
          {
             this.pts[_loc2_].x = this.pts[_loc2_].x + v.x;
             this.pts[_loc2_].y = this.pts[_loc2_].y + v.y;
             this.pts[_loc2_].px = this.pts[_loc2_].px + v.x;
             this.pts[_loc2_].py = this.pts[_loc2_].py + v.y;
             _loc2_ = _loc2_ + 1;
          }
          this.left_wire.trans(v);
          this.right_wire.trans(v);
       }

Aucun commentaire:

Enregistrer un commentaire