Показать сообщение отдельно
Старый 29.08.2008, 09:12
darkvam вне форума Посмотреть профиль Отправить личное сообщение для darkvam Найти все сообщения от darkvam
  № 10  
Ответить с цитированием
darkvam

Регистрация: Aug 2008
Сообщений: 52
dirigableNorge
Molecula
непомогает...(((

вот код. может попробуете найти протечку. знаю код не совершенен, но делаю всё что могу...

Код:
stop();
import flash.filters.DropShadowFilter;
var dropShadowOut:DropShadowFilter = new DropShadowFilter(5, 135, 0x000000, 1, 7, 7, 1.5, 1, false);
//массив пушек для уровня
for (i=0; i<1; i++) {
	attachMovie("Gun", "gun"+i, i+100, {_x:700, _y:_root.asteroidlvl._y+2670});
}
var gunElements:Array = [gun0];
for (l=0; l<gunElements.length; l++) {
	gunElements[l].GunGround.filters = [dropShadowOut];
}
var ArrSmoke:Array = [];
//переменная глубины
depth = this.getNextHighestDepth();
//переменная времени для определения закрытия OpenMediaOption------------
w = 0;
//устанавливаем качество изображения-------------------------------------
_quality = "LOW";
//хз---------------------------------------------------------------------
timeshoot = 30;
//Звуковые файлы
var voice1:Sound = new Sound();
_global.voice1 = voice1;
_global.voice1.attachSound("voice1");
//текст для MediaTextWindow----------
m = 0;
tt2 = "Обнаружены вражеские корабли численностью в 22 единицы.";
//Скорость перезарядки орудий корабля
_global.shootreload = 10;
shootreload = 10;
//количество плазмо-пуль
plazmanum = 0;
//уровень корябля выше дыма делаем на слое 100
tank.swapDepths(100);
//масссив дыма, который будет создавать
var ArrSmoke:Array = [];
//переменная счетчик дыма, сколько создали копий
var trailNum:Number = 0;
stopping = false;
var speed = _global.speedTank;
// скорость танка
var speedRot = _global.rotationTank;
// скорость кручения
onEnterFrame = function () {
	WaitOpenMediaOption();
	MediaText();
	ramkiMoving();
	shipMoving();
	_global.speedTank = speed;
	SnegLvlMov._y -= speed*0.45*Math.sin(tank._rotation*(Math.PI/180));
	asteroidlvl._y -= speed*1.8*Math.sin(tank._rotation*(Math.PI/180));
	//Всё для пушек
	for (k=0; k<gunElements.length; k++) {
		gunElements[k]._y = _root.asteroidlvl._y+2670;
		if (tank._y<gunElements[k]._y+600) {
			_root.attachMovie("PlazmaGun", "plazmaGun", depth);
			depth++;
			_root.plazmaGun._x = gunElements[k]._x;
			_root.plazmaGun._y = gunElements[k]._y;
			_root.plazmaGun.play();
			gunElements[k].GunTower.play();
			gunElements[k].GunTower._rotation = Math.atan2(gunElements[k]._y-tank._y, gunElements[k]._x-tank._x)/(Math.PI/180);
			if (_root.plazmaGun._currentframe<5) {
				_root.plazmaGun._rotation = gunElements[k].GunTower._rotation;
			}
		}
	}
	tank._x += speed*Math.cos(tank._rotation*(Math.PI/180));
	// управление-------------------------------------;  
	//Стрельба;
	if (Key.isDown(Key.SPACE)) {
		shootreload++;
		if (shootreload>=_global.shootreload) {
			plazmanum += 1;
			_root.attachMovie("PlazmaShip", "PlazmaShip"+plazmanum, depth, {_x:tank._x, _y:tank._y});
			depth++;
			_root.attachMovie("PlazmaShip2", "PlazmaShip2"+plazmanum, depth, {_x:tank._x, _y:tank._y});
			depth++;
			_root["PlazmaShip"+plazmanum]._rotation = tank._rotation;
			_root["PlazmaShip"+plazmanum].gotoAndPlay(2);
			_root["PlazmaShip2"+plazmanum]._rotation = tank._rotation;
			_root["PlazmaShip2"+plazmanum].gotoAndPlay(2);
			_root["PlazmaShip"+plazmanum].lasttankrot = tank._rotation;
			_root["PlazmaShip2"+plazmanum].lasttankrot = tank._rotation;
			shootreload = 0;
		}
	} else {
		shootreload = 10;
	}
	//покадрово для каждой из двух пуль
	//-------------1---------------------
	_root["PlazmaShip"+plazmanum].onEnterFrame = function() {
		if (this.hitTest(gun0.GunTower)) {
			attachMovie("PlazmaShipbrake", "plazmaShipbrake", depth);
			depth++;
			plazmaShipbrake._xscale = 60;
			plazmaShipbrake._yscale = 60;
			plazmaShipbrake._x = this._x;
			plazmaShipbrake._y = this._y-10;
			plazmaShipbrake._rotation = this._rotation-180;
			plazmaShipbrake.gotoAndPlay(2);
			this.removeMovieClip();
			this.onEnterFrame = null;
		}
		if (this._currentframe<5) {
			this._rotation = tank._rotation;
			this._x = tank._x;
			this._y = tank._y;
		} else {
			this._x += 15*Math.cos(this.lasttankrot*(Math.PI/180));
			this._y += 15*Math.sin(this.lasttankrot*(Math.PI/180));
			if (this._x>1024 || this._x<0 || this._y>678 || this._y<0) {
				this._alpha = 0;
			}
			if (this._x>1524 || this._x<-500 || this._y>1178 || this._y<-500) {
				this.removeMovieClip();
				this.onEnterFrame = null;
			}
		}
	};
	//----------------2--------------------
	_root["PlazmaShip2"+plazmanum].onEnterFrame = function() {
		if (this.hitTest(gun0.GunTower)) {
			attachMovie("PlazmaShipbrake", "plazmaShipbrake2", depth);
			depth++;
			plazmaShipbrake2._xscale = 60;
			plazmaShipbrake2._yscale = 60;
			plazmaShipbrake2._x = this._x;
			plazmaShipbrake2._y = this._y+10;
			plazmaShipbrake2._rotation = this._rotation-180;
			plazmaShipbrake2.gotoAndPlay(2);
			this.removeMovieClip();
			this.onEnterFrame = null;
		}
		if (this._currentframe<5) {
			this._rotation = tank._rotation;
			this._x = tank._x;
			this._y = tank._y;
		} else {
			this._x += 15*Math.cos(this.lasttankrot*(Math.PI/180));
			this._y += 15*Math.sin(this.lasttankrot*(Math.PI/180));
			if (this._x>1024 || this._x<0 || this._y>678 || this._y<0) {
				this._alpha = 0;
			}
			if (this._x>1524 || this._x<-500 || this._y>1178 || this._y<-500) {
				this.removeMovieClip();
				this.onEnterFrame = null;
			}
		}
	};
	//------------------------------------------------------------------------------
	//влево танк;                                                                                              
	if ((Key.isDown(65)) || (Key.isDown(37))) {
		_global.speedTank = _global.speedTank-4;
		tank._rotation -= speedRot;
	}
	if ((Key.isDown(68)) || (Key.isDown(39))) {
		// вправо;
		_global.speedTank = _global.speedTank-4;
		tank._rotation += speedRot;
	}
	if ((Key.isDown(87)) || (Key.isDown(38))) {
		// впепед;
		if (tank._currentframe == 1) {
			tank.gotoAndPlay(2);
		}
		stopping = false;
		if (speed<4) {
			speed += 0.1;
		}
		if (speedRot>4) {
			speedRot -= 0.5;
		}
		tank._x += speed*Math.cos(tank._rotation*(Math.PI/180));
	} else {
		if (tank._currentframe == 20) {
			tank.gotoAndPlay(21);
		}
		if (speed != 0.5) {
			stopping = true;
		}
	}
	if ((Key.isDown(83)) || (Key.isDown(40))) {
		// назад;
		if (speed>0.5) {
			speed -= 0.1;
		}
		if (speedRot<6) {
			speedRot += 0.5;
		}
	}
	if (stopping == true) {
		if (speed>0.5) {
			speed -= 0.05;
			if (speedRot<6) {
				speedRot += 0.5;
			}
			tank._x += speed*Math.cos(tank._rotation*(Math.PI/180));
		}
	}
};
_global.speedTank = speed;
function ramkiMoving() {
	//выставляем рамки движения и динамическую камеру
	//динамо камера
	if (tank._rotation>=0 && tank._rotation<=180) {
		if (tank._y>200) {
			tank._y -= speed;
			SnegLvlMov._y -= speed/4;
			asteroidlvl._y -= speed;
			for (var i = ArrSmoke.length-1; i>=0; i--) {
				ArrSmoke[i]._y -= Math.sin(tank._rotation*(Math.PI/180))+speed;
			}
		}
	} else {
		if (tank._y<500) {
			tank._y += speed;
			SnegLvlMov._y += speed/4;
			asteroidlvl._y += speed;
			for (var i = ArrSmoke.length-1; i>=0; i--) {
				ArrSmoke[i]._y += Math.sin(tank._rotation*(Math.PI/180))+speed;
			}
		}
	}
	//Рамки по иксу   
	if (tank._x<=50) {
		if (tank._rotation>=0 && tank._rotation<=180) {
			tank._x = 494.5;
			tank._y = 200;
		} else {
			tank._x = 494.5;
			tank._y = 500;
		}
	}
	if (tank._x>=974) {
		if (tank._rotation>=0 && tank._rotation<=180) {
			tank._x = 494.5;
			tank._y = 200;
		} else {
			tank._x = 494.5;
			tank._y = 500;
		}
	}
}
function shipMoving() {
	//добавляем новые копии дыма в массив
	ArrSmoke.push(smoke.duplicateMovieClip("smoke"+trailNum, trailNum));
	//устанавливает координаты корабля для дыма
	_root["smoke"+trailNum]._x = tank._x;
	_root["smoke"+trailNum]._y = tank._y;
	_root["smoke"+trailNum]._rotation = tank._rotation;
	//увеличиваем счетчик
	trailNum++;
	//если ставить очень большое число, до будет тормрзить движение
	if (trailNum>10) {
		trailNum = 0;
	}
	//смотрим на массив с конца                                                                                                                                                                                                                                                                     
	for (var i = ArrSmoke.length-1; i>=0; i--) {
		//уменьшаем прозрачность и увеличиваем копии дыма
		ArrSmoke[i]._y -= speed*1.8*Math.sin(tank._rotation*(Math.PI/180));
		ArrSmoke[i]._alpha -= speed*4;
		ArrSmoke[i]._xscale += speed;
		ArrSmoke[i]._yscale += speed;
		//если дым невидим удаляем из массива и удаляем клип
		if (ArrSmoke[i]._alpha<=0) {
			ArrSmoke.splice(0, 1);
			ArrSmoke[i].removeMovieClip();
			//trace(trailNum);
		}
	}
}
//Функция для текстовых предупреждений для окна MediaTextWindow-----------------------
function MediaText() {
	//*****печатная машинка****
	if (_root.MediaTextWindow._currentFrame == 42) {
		m++;
		_root.MediaTextWindow.MediaWindowText.text = substring(tt2, 0, m/2)+"_";
		if (m == 1) {
			_global.voice1.start();
		}
	}
	//*****печатная машинка****                                                                         
}
//Функция проверки времени до автоматического закрытия OpenMediaOption----------------
function WaitOpenMediaOption() {
	if (_root.OpenMediaOption._currentFrame == 35) {
		if (!_root.OpenMediaOption.hitTest(_root.mouse)) {
			w++;
			if (w == 50) {
				_root.OpenMediaOption.play();
			}
		} else {
			w = 0;
		}
	}
}