Frame 2
ifFrameLoaded (6) {
this.gotoAndPlay("load");
}
Frame 3
this.gotoAndPlay(this._currentframe - 1);
Frame 5
movie_bytes = this.getBytesTotal();
movie_loaded = this.getBytesLoaded();
var isNumMovieBytes = isNaN(movie_bytes);
var isNumMovieLoaded = isNaN(movie_loaded);
if ((!isNumMovieBytes) && (!isNumMovieLoaded)) {
if ((movie_bytes != 0) && (movie_loaded != 0)) {
var totalBytes = movie_bytes;
var totalLoaded = movie_loaded;
var percent_done = int((totalLoaded / totalBytes) * 100);
loaderBar.bar_mc.gotoAndStop(percent_done);
ifFrameLoaded (15) {
gotoAndPlay (11);
}
}
}
Frame 6
gotoAndPlay(_currentframe - 1);
Frame 11
Frame 12
this.play();
Frame 15
stop();
Symbol 8 MovieClip Frame 1
stop();
Symbol 12 MovieClip [scope_mc] Frame 1
stop();
Symbol 36 MovieClip [crash] Frame 7
_parent._parent.gotoAndStop(1);
stop();
Symbol 41 MovieClip Frame 1
stop();
Symbol 55 MovieClip Frame 1
if (!firstRun) {
this._visible = false;
firstRun = true;
}
this.onRollOver = function () {
gotoAndStop (2);
};
this.onRollOut = function () {
gotoAndStop (1);
};
stop();
Symbol 55 MovieClip Frame 2
stop();
Symbol 68 MovieClip Frame 1
function executeCallback() {
this.gotoAndPlay("out" + this._parent.directionNumber);
clearInterval(intervalId);
}
stop();
clearInterval(intervalId);
_parent.onStage = false;
_parent.personType = null;
Symbol 68 MovieClip Frame 2
play();
clearInterval(intervalId);
_parent.onStage = true;
Symbol 68 MovieClip Frame 14
stop();
intervalId = setInterval(this, "executeCallback", _parent._parent.getOnStageTime());
Symbol 68 MovieClip Frame 15
play();
Symbol 68 MovieClip Frame 21
if (_parent.personType == "bad") {
_parent._parent.addMark("badAway");
}
_parent._parent.tryToPopulateDoor();
gotoAndStop (1);
Symbol 68 MovieClip Frame 22
Symbol 68 MovieClip Frame 23
play();
clearInterval(intervalId);
_parent.onStage = true;
Symbol 68 MovieClip Frame 35
stop();
intervalId = setInterval(this, "executeCallback", _parent._parent.getOnStageTime());
Symbol 68 MovieClip Frame 36
play();
Symbol 68 MovieClip Frame 42
if (_parent.personType == "bad") {
_parent._parent.addMark("badAway");
}
_parent._parent.tryToPopulateDoor();
Symbol 80 MovieClip Frame 1
this._visible = false;
Symbol 83 MovieClip Frame 1
this._visible = false;
Symbol 87 MovieClip Frame 1
if (!firstRun) {
this._visible = false;
firstRun = true;
}
stop();
Symbol 87 MovieClip Frame 2
stop();
Symbol 96 MovieClip Frame 1
this._visible = false;
Symbol 100 MovieClip Frame 1
stop();
Symbol 112 MovieClip Frame 1
stop();
Symbol 112 MovieClip Frame 10
stop();
Symbol 115 MovieClip Frame 1
this._visible = false;
info.gotoAndStop(1);
stop();
Symbol 115 MovieClip Frame 15
info.gotoAndPlay("in");
stop();
Symbol 116 MovieClip Frame 1
function playSound(type) {
trace("function playSound(): " + type);
this["my_sound" + type] = new Sound();
this["my_sound" + type].attachSound(type);
this["my_sound" + type].start();
}
function delaySound(type) {
trace("function delaySound()");
clearInterval(this.pInterval);
this.pInterval = setInterval(this, "play" + type, 200);
}
function playmiss() {
trace("function playmiss");
clearInterval(this.pInterval);
playSound("miss");
}
function playwrong() {
trace("function playwrong");
clearInterval(this.pInterval);
playSound("wrong");
}
function playhit() {
trace("function playhit()");
clearInterval(this.pInterval);
}
function stopmiss() {
trace("function stopmiss()");
clearInterval(this.pInterval);
my_soundmiss.stop();
}
function stopshoot() {
trace("function stopshoot()");
clearInterval(this.pInterval);
my_soundshoot.stop();
}
function shoot() {
trace("\nfunction shoot()");
if (shotAllowed) {
scope_mc.gotoAndPlay("in");
shotAllowed = false;
shotAllowedTimer = setInterval(this, "allowShot", 125);
playSound("shoot");
if (checkGameState()) {
shotFired++;
if ((((_xmouse > scopeBounds.xMin) && (_xmouse < scopeBounds.xMax)) && (_ymouse > (Number(scopeBounds.yMin) + 55))) && (_ymouse < scopeBounds.yMax)) {
this.attachMovie("shot", "shot" + shotFired, shotFired, {_x:_xmouse, _y:_ymouse});
}
this["shell" + shotFired].gotoAndStop(2);
checkShot(this["shot" + shotFired]);
}
}
}
function checkShot(thisShot) {
trace("function checkShot(): " + thisShot);
missedShot = true;
i = 1;
while (i <= 6) {
if (thisShot.hitTest(this["door" + i].bounds)) {
trace((("hit a :" + this["door" + i].personType) + " in door#: ") + i);
if (this["door" + i].personType) {
this["door" + i].mover.peopleLoader.attachMovie("crash", "crash", 1);
this["door" + i].mover.stop();
if (this["door" + i].personType == "bad") {
missedShot = false;
addMark("badHit");
score = score + 25;
threats++;
} else if (this["door" + i].personType == "good") {
missedShot = false;
delaySound("wrong");
scope_mc.pointer.pointerColor.gotoAndPlay("red");
flash_mc.gotoAndPlay(2);
civilian++;
if (civilian >= 3) {
gameOver = true;
}
score = score - 50;
}
this["door" + i].personType == "dead";
tryToPopulateDoor();
}
unloadMovie (thisShot);
break;
}
i++;
}
if (missedShot) {
delaySound("miss");
}
}
function allowShot() {
trace("function allowShot(): ");
clearInterval(shotAllowedTimer);
shotAllowed = true;
}
function showNextPerson() {
trace("function showNextPerson()");
thisDoor = getDoor();
if (!this["door" + thisDoor].onStage) {
peopleShown++;
thisPerson = getPerson();
this["door" + thisDoor].mover.peopleLoader.attachMovie(thisPerson, "person" + peopleShown, 1);
this["door" + thisDoor].directionNumber = getDirection();
this["door" + thisDoor].mover.gotoAndPlay("in" + this["door" + thisDoor].directionNumber);
if (thisPerson.indexOf("good") >= 0) {
this["door" + thisDoor].personType = "good";
addMark("good");
} else {
this["door" + thisDoor].personType = "bad";
addMark("bad");
}
trace((("made a :" + this["door" + thisDoor].personType) + " in door #: ") + thisDoor);
} else {
tryToPopulateDoor();
}
}
function getDoor() {
var _local1 = Math.floor(Math.random() * 6) + 1;
trace("function getDoor() return: " + _local1);
return(_local1);
}
function getPerson() {
var _local1 = null;
var _local2 = Math.floor(Math.random() * 5) + 1;
if (_local2 <= level) {
_local1 = "good";
trace(("function getPerson() return: " + _local1) + getGoodGuy());
return(_local1 + getGoodGuy());
}
_local1 = "bad";
trace(("function getPerson() return: " + _local1) + getBadGuy());
return(_local1 + getBadGuy());
}
function getDirection() {
var _local1 = Math.floor(Math.random() * 2) + 1;
trace("function getDirection() return: " + _local1);
return(_local1);
}
function getGoodGuy() {
var _local1 = Math.floor(Math.random() * 3) + 1;
trace("function getGoodGuy() return: " + _local1);
return(_local1);
}
function getBadGuy() {
var _local1 = Math.floor(Math.random() * 2) + 1;
trace("function getBadGuy() return: " + _local1);
return(_local1);
}
function tryToPopulateDoor() {
trace("function tryToPopulateDoor()");
if (checkGameState()) {
clearInterval(intervalId);
doorCount = countDoorsUsedNow();
if (doorCount > 0) {
mm = 0;
while (mm < doorCount) {
showNextPerson();
mm++;
}
} else {
intervalId = setInterval(this, "tryToPopulateDoor", getOnStageTime() + 1000);
}
} else {
clearInterval(intervalId);
}
}
function countDoorsUsedNow() {
var _local2;
doorsOnStage = 0;
_local2 = 1;
while (_local2 <= 6) {
if (this["door" + _local2].personType != null) {
doorsOnStage++;
}
_local2++;
}
doorsNeeded = (Number(level) - Number(doorsOnStage)) + 1;
trace("function countDoorsUsedNow() return: " + doorsNeeded);
return(doorsNeeded);
}
function getOnStageTime() {
var _local1 = Math.floor((((Math.random() * 3) + 1) - level) * 1000);
if (_local1 < 500) {
onStageTime = 500;
} else {
onStageTime = _local1;
}
trace("function getOnStageTime() return: " + onStageTime);
return(onStageTime);
}
var mouseListener = new Object();
mouseListener.onMouseMove = function () {
if (((((_xmouse > scopeBounds.xMin) && (_xmouse < scopeBounds.xMax)) && (_ymouse > scopeBounds.yMin)) && (_ymouse < scopeBounds.yMax)) && (checkGameState(true))) {
Mouse.hide();
scope_mc._visible = true;
scope_mc._x = _xmouse;
scope_mc._y = _ymouse;
updateAfterEvent();
} else {
scope_mc._visible = false;
Mouse.show();
}
};
mouseListener.onMouseDown = function () {
if (((((_xmouse > scopeBounds.xMin) && (_xmouse < scopeBounds.xMax)) && (_ymouse > scopeBounds.yMin)) && (_ymouse < scopeBounds.yMax)) && (checkGameState(true))) {
Mouse.hide();
shoot();
updateAfterEvent();
}
};
Mouse.addListener(mouseListener);
function addMark(type) {
trace("function addMark(): " + type);
markLevel++;
this[type + "X"]++;
if (this[type + "X"] < 10) {
newX = this[type + "X"] * -4;
marks[type].duplicateMovieClip("mark" + markLevel, markLevel, {_x:newX, _y:marks[type]._y});
}
}
function starTimer() {
trace("function startTimet()");
clearInterval(everySecond);
if (level == 1) {
endTime = 40;
} else if (level == 2) {
endTime = 35;
} else if (level == 3) {
endTime = 30;
} else {
endTime = 0;
}
timer.text = "00:" + endTime;
everySecond = setInterval(this, "secondTick", 1000);
}
function secondTick() {
trace("function secondTick() ");
if (checkGameState()) {
endTime--;
if (endTime.toString().length < 2) {
addZero = "0";
} else {
addZero = "";
}
timer.text = ("00:" + addZero) + endTime;
} else {
clearInterval(everySecond);
}
}
function setLevelUp(levelNumber) {
trace("function setUpLevel(): " + levelNumber);
_parent.startButton._visible = false;
_parent.intro._visible = false;
gun._visible = true;
hud._visible = true;
clip._visible = true;
tick = 21;
levelResults.gotoAndPlay("out");
this.onEnterFrame = function () {
tick--;
this["shell" + tick]._visible = true;
this["shell" + tick].gotoAndStop(1);
if ((tick % 10) == 0) {
playSound("reload");
}
if (tick == 1) {
setLevelPlayable(levelNumber);
delete this.onEnterFrame;
}
};
}
function setLevelPlayable(levelNumber) {
trace("function setLevelPlayable(): " + levelNumber);
if (levelNumber == 1) {
score = 0;
}
badAwayX = 0;
badHitX = 0;
badX = 0;
goodX = 0;
markLevel = 0;
shotAllowed = true;
levelComplete = false;
levelResults._visible = false;
button._visible = false;
gameOver = false;
thisDoor = null;
shotFired = 0;
totalShots = 20;
threats = 0;
civilian = 0;
level = levelNumber;
peopleShown = 0;
starTimer();
tryToPopulateDoor();
}
function checkGameState(fromMouse) {
if (((shotFired < totalShots) && (endTime >= 1)) && (!gameOver)) {
if (!fromMouse) {
trace("function checkGameState() return: true");
}
return(true);
}
if ((!fromMouse) && (!levelComplete)) {
levelComplete = true;
if (gameOver) {
levelGameOver();
} else if ((civilian >= 5) || (threats < 10)) {
levelGameOver();
} else {
levelOver();
}
}
if (!fromMouse) {
trace("function checkGameState() return: false");
}
return(false);
}
function levelGameOver() {
trace("function levelGameOver()");
scope_mc._visible = false;
Mouse.show();
i = 1;
while (i <= 20) {
unloadMovie (this["shot" + i]);
i++;
}
button._visible = true;
button.text_mc.txt.text = "PLAY AGAIN";
button.onRelease = function () {
setLevelUp(1);
delete this.onRelease;
};
levelResults._visible = true;
levelResults.info.gameOver_mc._visible = true;
levelResults.complete_txt.level.text = ("Level " + level) + " Failed";
if (threats.toString().length < 2) {
threatsDigit = "0";
} else {
threatsDigit = "";
}
if (civilian.toString().length < 2) {
civilianDigit = "0";
} else {
civilianDigit = "";
}
levelResults.info.threats.text = threatsDigit + threats;
levelResults.info.civilian.text = civilianDigit + civilian;
if (threats == 20) {
levelResults.info.perfect._visible = true;
} else {
levelResults.info.perfect._visible = false;
}
levelResults.gotoAndPlay("in");
}
function levelOver() {
trace("function levelOver()");
scope_mc._visible = false;
Mouse.show();
i = 1;
while (i <= 20) {
unloadMovie (this["shot" + i]);
i++;
}
button._visible = true;
if (level < 3) {
button.text_mc.txt.text = "NEXT LEVEL";
button.onRelease = function () {
level++;
setLevelUp(level);
delete this.onRelease;
};
} else {
button.text_mc.txt.text = "PLAY AGAIN";
button.onRelease = function () {
setLevelUp(1);
delete this.onRelease;
};
}
levelResults._visible = true;
if (level == 3) {
levelResults.info.gameOver_mc._visible = true;
} else {
levelResults.info.gameOver_mc._visible = false;
}
levelResults.complete_txt.level.text = ("LEVEL " + level) + " COMPLETE";
if (threats.toString().length < 2) {
threatsDigit = "0";
} else {
threatsDigit = "";
}
if (civilian.toString().length < 2) {
civilianDigit = "0";
} else {
civilianDigit = "";
}
levelResults.info.threats.text = threatsDigit + threats;
levelResults.info.civilian.text = civilianDigit + civilian;
if (threats == 20) {
levelResults.info.perfect._visible = true;
} else {
levelResults.info.perfect._visible = false;
}
levelResults.gotoAndPlay("in");
}
scopeBounds = building.getBounds(this);
this.attachMovie("scope_mc", "scope_mc", 420, {_x:scopeBounds.xMin, _y:scopeBounds.yMin});
scope_mc._visible = false;
Symbol 124 Button
on (release) {
gamePlay.setLevelUp(1);
}