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

  1. class EditorPanel extends MovieClip
  2. {
  3.    function EditorPanel()
  4.    {
  5.       super();
  6.    }
  7.    function onLoad()
  8.    {
  9.       var _loc1_ = this;
  10.       _loc1_.createEmptyMovieClip("tileContainer",1);
  11.       _loc1_.tileContainer.attachMovie("Tile1","tile",1);
  12.       _loc1_.tileContainer._x = 30;
  13.       _loc1_.tileContainer._y = 30;
  14.       _loc1_.tileType = 1;
  15.       _loc1_.numOfTileTypes = 10;
  16.       _loc1_.createEmptyMovieClip("spawnContainer",2);
  17.       _loc1_.spawnContainer.attachMovie("Spawn0","spawn",1);
  18.       _loc1_.spawnContainer._x = 90;
  19.       _loc1_.spawnContainer._y = 30;
  20.       _loc1_.spawnType = 50;
  21.       _loc1_.numOfSpawnTypes = 10;
  22.       _loc1_.createEmptyMovieClip("itemContainer",3);
  23.       _loc1_.itemContainer.attachMovie("ItemSpawn1","item",1);
  24.       _loc1_.itemContainer._x = 150;
  25.       _loc1_.itemContainer._y = 30;
  26.       _loc1_.itemType = 80;
  27.       _loc1_.numOfItemTypes = 10;
  28.       _loc1_.createEmptyMovieClip("gravContainer",4);
  29.       _loc1_.gravContainer.attachMovie("GravityArrow","grav",1);
  30.       _loc1_.gravContainer._x = 30;
  31.       _loc1_.gravContainer._y = 80;
  32.       _loc1_.gravType = 1;
  33.       _loc1_.setType = 1;
  34.    }
  35.    function onMouseDown()
  36.    {
  37.       var _loc1_ = this;
  38.       var _loc2_ = _root;
  39.       if(_loc1_.tileContainer.hitTest(_loc2_._xmouse,_loc2_._ymouse))
  40.       {
  41.          if(_loc1_.setType == 1)
  42.          {
  43.             if(_loc1_.tileType < _loc1_.numOfTileTypes - 1)
  44.             {
  45.                _loc1_.tileType = _loc1_.tileType + 1;
  46.             }
  47.             else
  48.             {
  49.                _loc1_.tileType = 0;
  50.             }
  51.          }
  52.          _loc1_.setType = 1;
  53.          _loc1_.tileContainer.attachMovie("Tile" + _loc1_.tileType,"tile",1);
  54.       }
  55.       else if(_loc1_.spawnContainer.hitTest(_loc2_._xmouse,_loc2_._ymouse))
  56.       {
  57.          if(_loc1_.setType == 2)
  58.          {
  59.             if(_loc1_.spawnType < _loc1_.numOfSpawnTypes + 49)
  60.             {
  61.                _loc1_.spawnType = _loc1_.spawnType + 1;
  62.             }
  63.             else
  64.             {
  65.                _loc1_.spawnType = 50;
  66.             }
  67.          }
  68.          _loc1_.setType = 2;
  69.          _loc1_.spawnContainer.attachMovie("Spawn" + (_loc1_.spawnType - 50),"spawn",1);
  70.       }
  71.       else if(_loc1_.itemContainer.hitTest(_loc2_._xmouse,_loc2_._ymouse))
  72.       {
  73.          if(_loc1_.setType == 3)
  74.          {
  75.             if(_loc1_.itemType < _loc1_.numOfItemTypes + 79)
  76.             {
  77.                _loc1_.itemType = _loc1_.itemType + 1;
  78.             }
  79.             else
  80.             {
  81.                _loc1_.itemType = 80;
  82.             }
  83.          }
  84.          _loc1_.setType = 3;
  85.          _loc1_.itemContainer.attachMovie("ItemSpawn" + (_loc1_.itemType - 80),"item",1);
  86.       }
  87.       else if(_loc1_.gravContainer.hitTest(_loc2_._xmouse,_loc2_._ymouse))
  88.       {
  89.          if(_loc1_.setType == 4)
  90.          {
  91.             if(_loc1_.gravType < 8)
  92.             {
  93.                _loc1_.gravType = _loc1_.gravType + 1;
  94.             }
  95.             else
  96.             {
  97.                _loc1_.gravType = 0;
  98.             }
  99.          }
  100.          _loc1_.setType = 4;
  101.          if(_loc1_.gravType > 0 && _loc1_.gravType <= 4)
  102.          {
  103.             _loc1_.gravContainer.attachMovie("GravityArrow","grav",1);
  104.             _loc1_.gravContainer.grav._rotation = 90 * (_loc1_.gravType - 1);
  105.          }
  106.          else if(_loc1_.gravType > 4)
  107.          {
  108.             _loc1_.gravContainer.attachMovie("GravityArrow","grav",1);
  109.             _loc1_.gravContainer.grav._rotation = 90 * (_loc1_.gravType - 5) + 45;
  110.          }
  111.          else if(_loc1_.gravType == 0)
  112.          {
  113.             _loc1_.gravContainer.attachMovie("GravNeutral","grav",1);
  114.          }
  115.       }
  116.    }
  117. }
  118.