home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / MindScape.swf / scripts / __Packages / RawCell.as < prev    next >
Encoding:
Text File  |  2007-12-04  |  2.9 KB  |  88 lines

  1. class RawCell extends MovieClip
  2. {
  3.    function RawCell()
  4.    {
  5.       super();
  6.    }
  7.    function onLoad()
  8.    {
  9.       var _loc1_ = this;
  10.       _loc1_._x = _loc1_.xId * _loc1_._parent.cellsize;
  11.       _loc1_._y = _loc1_.yId * _loc1_._parent.cellsize;
  12.       _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].clip = _loc1_;
  13.       if(_loc1_.tileType != undefined)
  14.       {
  15.          if(_loc1_.tileType < 50)
  16.          {
  17.             _loc1_.attachMovie("Tile" + _loc1_.tileType,"tile",1);
  18.          }
  19.          else if(_loc1_.tileType < 80)
  20.          {
  21.             _loc1_.attachMovie("Spawn" + (_loc1_.tileType - 50),"tile",1);
  22.          }
  23.          else
  24.          {
  25.             _loc1_.attachMovie("ItemSpawn" + (_loc1_.tileType - 80),"tile",1);
  26.          }
  27.       }
  28.       if(_loc1_.gravType > 0)
  29.       {
  30.          _loc1_.createEmptyMovieClip("grav",2);
  31.          _loc1_.grav.attachMovie("GravityArrow","dir",1);
  32.          if(_loc1_.gravType <= 4)
  33.          {
  34.             _loc1_.grav.dir._rotation = 90 * (_loc1_.gravType - 1);
  35.          }
  36.          else
  37.          {
  38.             _loc1_.grav.dir._rotation = 90 * (_loc1_.gravType - 5) + 45;
  39.          }
  40.       }
  41.    }
  42.    function onEnterFrame()
  43.    {
  44.       var _loc1_ = this;
  45.       var _loc2_ = _root;
  46.       if(_loc1_.hitTest(_loc2_._xmouse,_loc2_._ymouse) && !_loc2_.ep.hitTest(_loc2_._xmouse,_loc2_._ymouse) && _loc2_.mousePressed)
  47.       {
  48.          if(_loc2_.ep.setType == 1)
  49.          {
  50.             _loc1_.attachMovie("Tile" + _loc2_.ep.tileType,"tile",1);
  51.             _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].tile = _loc2_.ep.tileType;
  52.          }
  53.          else if(_loc2_.ep.setType == 2)
  54.          {
  55.             _loc1_.attachMovie("Spawn" + (_loc2_.ep.spawnType - 50),"tile",1);
  56.             _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].tile = _loc2_.ep.spawnType;
  57.          }
  58.          else if(_loc2_.ep.setType == 3)
  59.          {
  60.             _loc1_.attachMovie("ItemSpawn" + (_loc2_.ep.itemType - 80),"tile",1);
  61.             _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].tile = _loc2_.ep.itemType;
  62.          }
  63.          else if(_loc2_.ep.setType == 4)
  64.          {
  65.             if(_loc2_.ep.gravType > 0)
  66.             {
  67.                _loc1_.createEmptyMovieClip("grav",2);
  68.                _loc1_.grav.attachMovie("GravityArrow","dir",1);
  69.                _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].gravType = _loc2_.ep.gravType;
  70.                if(_loc2_.ep.gravType <= 4 && _loc2_.ep.gravType > 0)
  71.                {
  72.                   _loc1_.grav.dir._rotation = 90 * (_loc2_.ep.gravType - 1);
  73.                }
  74.                else if(_loc2_.ep.gravType > 4)
  75.                {
  76.                   _loc1_.grav.dir._rotation = 90 * (_loc2_.ep.gravType - 5) + 45;
  77.                }
  78.             }
  79.             else
  80.             {
  81.                _loc1_.grav.removeMovieClip("dir");
  82.                _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].gravType = 0;
  83.             }
  84.          }
  85.       }
  86.    }
  87. }
  88.