home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / Never_End.swf / scripts / elements / HeadItem.as < prev    next >
Encoding:
Text File  |  2008-09-23  |  2.3 KB  |  81 lines

  1. package elements
  2. {
  3.    import flash.display.MovieClip;
  4.    import game.Model;
  5.    
  6.    public class HeadItem extends Item
  7.    {
  8.        
  9.       
  10.       private var __height:Number = 2;
  11.       
  12.       private var model:Model;
  13.       
  14.       private var rotate:Number;
  15.       
  16.       private var offset:Number = 10;
  17.       
  18.       public var _man:MovieClip;
  19.       
  20.       private var __width:Number = 7;
  21.       
  22.       public function HeadItem(param1:Number = 0, param2:Number = 0)
  23.       {
  24.          offset = 10;
  25.          __height = 2;
  26.          __width = 7;
  27.          super(param1,param2 - offset,__width,__height);
  28.          model = Model.getInstance();
  29.       }
  30.       
  31.       public function setSize0() : void
  32.       {
  33.          itemHeight = itemWidth = 2;
  34.          this.x = this.tx = this.xPosition = group.items[0].tx;
  35.          this.y = this.ty = this.yPosition = group.items[0].ty;
  36.       }
  37.       
  38.       public function resetPosition(param1:Number, param2:Number) : void
  39.       {
  40.          if(group.items.length > 1)
  41.          {
  42.             switch(Math.round(rotate / 90))
  43.             {
  44.                case 0:
  45.                   this.x = this.tx = this.xPosition = param1;
  46.                   this.y = this.ty = this.yPosition = param2 - offset;
  47.                   break;
  48.                case 1:
  49.                   this.x = this.tx = this.xPosition = param1 - offset;
  50.                   this.y = this.ty = this.yPosition = param2;
  51.                   break;
  52.                case 2:
  53.                   this.x = this.tx = this.xPosition = param1;
  54.                   this.y = this.ty = this.yPosition = param2 + offset;
  55.                   break;
  56.                case 3:
  57.                   this.x = this.tx = this.xPosition = param1 + offset;
  58.                   this.y = this.ty = this.yPosition = param2;
  59.             }
  60.          }
  61.       }
  62.       
  63.       override public function set rotation(param1:Number) : void
  64.       {
  65.          super.rotation = -param1;
  66.          rotate = param1;
  67.          resetPosition(group.items[0].tx,group.items[0].ty);
  68.          if(Math.round(param1 / 90) % 2 == 0)
  69.          {
  70.             itemHeight = __height;
  71.             itemWidth = __width;
  72.          }
  73.          else
  74.          {
  75.             itemHeight = __width;
  76.             itemWidth = __height;
  77.          }
  78.       }
  79.    }
  80. }
  81.