home *** CD-ROM | disk | FTP | other *** search
- function removeAllObjects()
- {
- for(var _loc3_ in _root)
- {
- var _loc2_ = _root[_loc3_];
- if(typeof _loc2_ == "movieclip" && _loc2_.removable)
- {
- _loc2_.removeMovieClip();
- }
- }
- }
- function newObject(type, x, y)
- {
- _root.level_array.push([type,Math.round(x),Math.round(y)]);
- return level_array.length - 1;
- }
- function arrayToString(arr)
- {
- var _loc3_ = "";
- var _loc2_ = 0;
- while(_loc2_ < arr.length)
- {
- var _loc1_ = arr[_loc2_];
- if(_loc2_ == 0)
- {
- _loc3_ += _loc1_[0] + "," + _loc1_[1] + ":";
- }
- else if(_loc2_ == 1)
- {
- _loc3_ += _loc1_;
- }
- else
- {
- _loc3_ += ":" + _loc1_[0] + "," + _loc1_[1] + "," + _loc1_[2];
- }
- _loc2_ = _loc2_ + 1;
- }
- return _loc3_;
- }
- function stringToArray(str)
- {
- var _loc3_ = [];
- var _loc4_ = str.split(":");
- var _loc1_ = 0;
- while(_loc1_ < _loc4_.length)
- {
- var _loc2_ = _loc4_[_loc1_].split(",");
- if(_loc1_ == 0)
- {
- _loc3_.push([_loc2_[0],_loc2_[1]]);
- }
- else if(_loc1_ == 1)
- {
- _loc3_.push(_loc4_[_loc1_]);
- }
- else
- {
- _loc3_.push([_loc2_[0],_loc2_[1],_loc2_[2]]);
- }
- _loc1_ = _loc1_ + 1;
- }
- return _loc3_;
- }
- function stringToLevel(str)
- {
- var _loc4_ = stringToArray(str);
- level_array = [];
- removeAllObjects();
- var _loc3_ = 0;
- while(_loc3_ < _loc4_.length)
- {
- var _loc2_ = _loc4_[_loc3_];
- if(_loc3_ == 0)
- {
- _root.copter._x = _loc2_[0];
- _root.copter._y = _loc2_[1];
- level_array[0] = [];
- setCopterPosition(_loc2_[0],_loc2_[1]);
- }
- else if(_loc3_ == 1)
- {
- BG.gotoAndStop(_loc2_);
- setBG(_loc2_);
- }
- else
- {
- attachItem(_loc2_[0],_loc2_[1],_loc2_[2]).updateData();
- }
- _loc3_ = _loc3_ + 1;
- }
- }
- function fadeInCodeBox()
- {
- codeBox._visible = true;
- codeBox.onEnterFrame = function()
- {
- if(this._alpha >= 100)
- {
- this._alpha = 100;
- Selection.setFocus(this.code);
- this.onEnterFrame = null;
- }
- this._alpha += 10;
- };
- }
- function fadeOutCodeBox()
- {
- codeBox.onEnterFrame = function()
- {
- if(this._alpha <= 0)
- {
- this._alpha = 0;
- this._visible = false;
- this.onEnterFrame = null;
- }
- this._alpha -= 10;
- };
- }
- function timeCrAdd()
- {
- timeCr++;
- }
- MovieClip.prototype.makeDraggable = function()
- {
- this.useHandCursor = false;
- this.removable = true;
- this.onPress = function()
- {
- if(!edit)
- {
- return undefined;
- }
- this.startDrag();
- };
- this.onRelease = this.onReleaseOutside = function()
- {
- this.stopDrag();
- this.updateData();
- };
- };
- items = [obs,wu,wl,wulo,wllo,flag,wSrightSmall,wSleftSmall,wSleftBig,wSrightBig,obsHOR,mine,mace,spin];
- itemsNum = 2;
- _global.attachItem = function(type, x, y)
- {
- if(!edit)
- {
- return undefined;
- }
- var _loc4_ = items[type];
- if(_loc4_ == flag)
- {
- flag_btn.enabled = false;
- }
- var _loc3_ = _loc4_.duplicateMovieClip("item" + itemsNum,_root.getNextHighestDepth(),{_x:x,_y:y});
- itemsNum++;
- var _loc5_ = newObject(type,x,y);
- _loc3_.index = _loc5_;
- _loc3_.type = type;
- _loc3_.updateData = function()
- {
- modifyObject(this.index,this.type,this._x,this._y);
- };
- return _loc3_;
- };
- _global.modifyObject = function(index, type, x, y)
- {
- _root.level_array[index][0] = type;
- _root.level_array[index][1] = x;
- _root.level_array[index][2] = y;
- };
- _global.setCopterPosition = function(x, y)
- {
- _root.level_array[0][0] = Math.round(x);
- _root.level_array[0][1] = Math.round(y);
- };
- _global.setBG = function(BG)
- {
- _root.level_array[1] = BG;
- };
- codeBox._alpha = codeBox._visible = 0;
- level_array = [];
- level_array[0] = [];
- MovieClip.prototype.removeObject = function()
- {
- if(this.index == undefined)
- {
- trace("Error: This item cannot be removed");
- return undefined;
- }
- _root.level_array.splice(this.index,1);
- this.removeMovieClip();
- };
- edit = true;
- depth = 1;
- obsNum = 1;
- wuNum = 1;
- wlNum = 1;
- wuloNum = 1;
- wlloNum = 1;
- wSrightSmallNum = 1;
- setBG("mountain");
- setCopterPosition(copter._x,copter._y);
- speedMax = 0;
- speedMin = 0;
- speedPlus = 0;
- addOpen = true;
- timeCr = 0;
- setInterval(timeCrAdd,1000);
- attachItem(5,300,300);
- addObj.onEnterFrame = function()
- {
- this.swapDepths(this._parent.getNextHighestDepth());
- };
- used.onEnterFrame = function()
- {
- this.swapDepths(this._parent.getNextHighestDepth() + 1);
- };
- info.onEnterFrame = function()
- {
- this.swapDepths(this._parent.getNextHighestDepth() + 2);
- };
-