home *** CD-ROM | disk | FTP | other *** search
- class RawCell extends MovieClip
- {
- function RawCell()
- {
- super();
- }
- function onLoad()
- {
- var _loc1_ = this;
- _loc1_._x = _loc1_.xId * _loc1_._parent.cellsize;
- _loc1_._y = _loc1_.yId * _loc1_._parent.cellsize;
- _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].clip = _loc1_;
- if(_loc1_.tileType != undefined)
- {
- if(_loc1_.tileType < 50)
- {
- _loc1_.attachMovie("Tile" + _loc1_.tileType,"tile",1);
- }
- else if(_loc1_.tileType < 80)
- {
- _loc1_.attachMovie("Spawn" + (_loc1_.tileType - 50),"tile",1);
- }
- else
- {
- _loc1_.attachMovie("ItemSpawn" + (_loc1_.tileType - 80),"tile",1);
- }
- }
- if(_loc1_.gravType > 0)
- {
- _loc1_.createEmptyMovieClip("grav",2);
- _loc1_.grav.attachMovie("GravityArrow","dir",1);
- if(_loc1_.gravType <= 4)
- {
- _loc1_.grav.dir._rotation = 90 * (_loc1_.gravType - 1);
- }
- else
- {
- _loc1_.grav.dir._rotation = 90 * (_loc1_.gravType - 5) + 45;
- }
- }
- }
- function onEnterFrame()
- {
- var _loc1_ = this;
- var _loc2_ = _root;
- if(_loc1_.hitTest(_loc2_._xmouse,_loc2_._ymouse) && !_loc2_.ep.hitTest(_loc2_._xmouse,_loc2_._ymouse) && _loc2_.mousePressed)
- {
- if(_loc2_.ep.setType == 1)
- {
- _loc1_.attachMovie("Tile" + _loc2_.ep.tileType,"tile",1);
- _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].tile = _loc2_.ep.tileType;
- }
- else if(_loc2_.ep.setType == 2)
- {
- _loc1_.attachMovie("Spawn" + (_loc2_.ep.spawnType - 50),"tile",1);
- _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].tile = _loc2_.ep.spawnType;
- }
- else if(_loc2_.ep.setType == 3)
- {
- _loc1_.attachMovie("ItemSpawn" + (_loc2_.ep.itemType - 80),"tile",1);
- _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].tile = _loc2_.ep.itemType;
- }
- else if(_loc2_.ep.setType == 4)
- {
- if(_loc2_.ep.gravType > 0)
- {
- _loc1_.createEmptyMovieClip("grav",2);
- _loc1_.grav.attachMovie("GravityArrow","dir",1);
- _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].gravType = _loc2_.ep.gravType;
- if(_loc2_.ep.gravType <= 4 && _loc2_.ep.gravType > 0)
- {
- _loc1_.grav.dir._rotation = 90 * (_loc2_.ep.gravType - 1);
- }
- else if(_loc2_.ep.gravType > 4)
- {
- _loc1_.grav.dir._rotation = 90 * (_loc2_.ep.gravType - 5) + 45;
- }
- }
- else
- {
- _loc1_.grav.removeMovieClip("dir");
- _loc1_._parent.cells[_loc1_.xId][_loc1_.yId].gravType = 0;
- }
- }
- }
- }
- }
-