Frame 1
function fireWeapon(xStart, yStart, xEnd, yEnd) {
if (reloadComplete == true) {
effectHolder.onEnterFrame = function () {
effectHolder.clear();
effectHolder.lineStyle(lightningWidth, lightningColor, lightningAlpha, true);
var _local12 = xStart - xEnd;
var _local10 = yStart - yEnd;
var _local11 = Math.sqrt((_local12 * _local12) + (_local10 * _local10));
var _local8 = _local11 / lightningFrequency;
var _local2 = Math.atan2(yStart - yEnd, xStart - xEnd);
var _local9 = _local11 / _local8;
var _local7 = 0;
while (_local7 < lightningBranches) {
effectHolder.moveTo(xStart, yStart);
var _local1 = 1;
while (_local1 < (_local8 + 1)) {
var _local4 = _local9 * _local1;
var _local3 = random(lightningOffset - (lightningOffset / 2));
var _local5 = (xStart - (Math.cos(_local2) * _local4)) + (Math.cos(_local2 + 1.55) * _local3);
var _local6 = (yStart - (Math.sin(_local2) * _local4)) + (Math.sin(_local2 + 1.55) * _local3);
effectHolder.lineTo(_local5, _local6);
_local1++;
}
_local7++;
}
};
effectHolder.lineTo(xEnd, yEnd);
addSparkles(xEnd, yEnd, sparkNumber, sparkDistance, sparkSize);
startReloading();
}
}
function startReloading() {
reloadComplete = false;
reloadTimer = setInterval(this, "gunReloaded", reloadSpeed);
screenTimer = setInterval(this, "clearScreen", clearSpeed);
}
function clearScreen() {
clearInterval(screenTimer);
delete effectHolder.onEnterFrame;
effectHolder.clear();
}
function gunReloaded() {
clearInterval(reloadTimer);
reloadComplete = true;
}
function rotatePlayer() {
rotationDirection = Math.round(180 - ((Math.atan2(_root._xmouse - player_mc._x, _root._ymouse - player_mc._y) * 180) / Math.PI));
player_mc._rotation = rotationDirection;
}
function addSparkles(_targetX, _targetY, _sparkNumber, _distance, _sparkSize) {
var _local6 = 0;
while (_local6 < _sparkNumber) {
var _local4 = _root.attachMovie("spark", "spark_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
var _local3 = _root.attachMovie("spark2", "spark2_" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = (_targetX + random(_distance)) - (_distance / 2);
_local4._y = (_targetY + random(_distance)) - (_distance / 2);
_local3._x = (_targetX + random(_distance)) - (_distance / 2);
_local3._y = (_targetY + random(_distance)) - (_distance / 2);
var _local5 = random(_sparkSize) + (_sparkSize / 4);
_local4._xscale = _local5;
_local4._yscale = _local5;
_local5 = random(_sparkSize) + (_sparkSize / 4);
_local3._xscale = _local5;
_local3._yscale = _local5;
_local3._rotation = random(359);
_local4._alpha = lightningAlpha;
_local3._alpha = lightningAlpha;
_local6++;
}
}
var lightningOffset = 15;
var lightningFrequency = 15;
var lightningWidth = 1;
var lightningColor = "0x5C98EF";
var lightningAlpha = 80;
var lightningBranches = 1;
var sparkNumber = 5;
var sparkDistance = 10;
var sparkSize = 100;
var reloadSpeed = 300;
var clearSpeed = 100;
var glow_color = lightningColor;
var glow_alpha = 0.2;
var glow_blurX = 5;
var glow_blurY = 5;
var glow_strength = 10;
var glow_quality = 3;
var effectHolder = effectHolder_mc;
var reloadTimer;
var screenTimer;
var reloadComplete = true;
var rotationDirection;
var filter_glow = (new flash.filters.GlowFilter(glow_color, glow_alpha, glow_blurX, glow_blurY, glow_strength, glow_quality));
effectHolder.filters = [filter_glow];
mouseListener = new Object();
mouseListener.onMouseDown = function () {
fireWeapon(player_mc._x, player_mc._y, _root._xmouse, _root._ymouse);
};
mouseListener.onMouseMove = function () {
rotatePlayer();
};
Mouse.addListener(mouseListener);
Symbol 3 MovieClip [spark2] Frame 16
this.removeMovieClip();
Symbol 4 MovieClip [spark] Frame 16
this.removeMovieClip();
Instance of Symbol 9 MovieClip in Symbol 11 MovieClip [eye2] Frame 1
onClipEvent (load) {
function movePupil() {
if (_parent._parent._xmouse <= _parent._x) {
var _local4 = 1 - (_parent._parent._xmouse / _parent._x);
this._x = (-((_parent.eyeBal._width / 2) - (this._width / 1.5))) * _local4;
} else if (_parent._parent._xmouse > _parent._x) {
var _local4 = (_parent._parent._xmouse - _parent._x) / (Stage.width - _parent._x);
this._x = ((_parent.eyeBal._width / 2) - (this._width / 1.5)) * _local4;
}
if (_parent._parent._ymouse <= _parent._y) {
var _local3 = 1 - (_parent._parent._ymouse / _parent._y);
this._y = (-((_parent.eyeBal._height / 2) - (this._height / 1.5))) * _local3;
} else if (_parent._parent._ymouse > _parent._y) {
var _local3 = (_parent._parent._ymouse - _parent._y) / (Stage.height - _parent._y);
this._y = ((_parent.eyeBal._height / 2) - (this._height / 1.5)) * _local3;
}
}
movePupil();
mouseMoveListener = new Object();
mouseMoveListener.onMouseMove = function () {
movePupil();
};
Mouse.addListener(mouseMoveListener);
}
Symbol 30 MovieClip Frame 1
play();
Symbol 30 MovieClip Frame 4
play();
Symbol 30 MovieClip Frame 7
play();
Symbol 30 MovieClip Frame 10
play();
Symbol 30 MovieClip Frame 13
play();
Symbol 30 MovieClip Frame 16
play();
Symbol 30 MovieClip Frame 19
play();
Symbol 30 MovieClip Frame 22
play();
Symbol 30 MovieClip Frame 25
gotoAndPlay (1);
Symbol 32 Button
on (press) {
gotoAndPlay (2);
}
Symbol 47 MovieClip Frame 1
stop();
Symbol 47 MovieClip Frame 2
play();
Symbol 47 MovieClip Frame 11
gotoAndStop (1);