Frame 1
fscommand ("allowscale", "false");
fscommand ("fullscreen", "false");
Frame 2
factor = _root.getBytesLoaded() / _root.getBytesTotal();
percent.text = Math.floor(factor * 100) + "%";
if (factor >= 1) {
_root.gotoAndStop("Splash");
}
Frame 3
_root.gotoAndPlay("loader");
Frame 25
stop();
Symbol 14 MovieClip Frame 1
stop();
Symbol 14 MovieClip Frame 2
stop();
Symbol 51 MovieClip [ice cube] Frame 1
stop();
Symbol 51 MovieClip [ice cube] Frame 22
stop();
Symbol 61 MovieClip [platform] Frame 1
stop();
Symbol 80 MovieClip Frame 14
this.gotoAndPlay(1);
Symbol 80 MovieClip Frame 21
_parent.removeMovieClip();
Symbol 81 MovieClip [baddy] Frame 1
hitArea._visible = false;
Symbol 93 MovieClip Frame 15
stop();
stop();
Symbol 106 MovieClip [flag] Frame 1
stop();
Symbol 106 MovieClip [flag] Frame 88
where.levelComplete();
stop();
Symbol 112 MovieClip Frame 1
stop();
Symbol 118 Button
on (release) {
this.gotoAndStop("Game");
}
Symbol 131 Button
on (release) {
getURL ("http://www.mili-tary.de", "_blank");
}
Symbol 171 MovieClip Frame 1
stop();
Symbol 171 MovieClip Frame 11
this.gotoAndPlay(2);
Symbol 182 MovieClip Frame 1
stop();
Symbol 182 MovieClip Frame 5
this.gotoAndStop(1);
Symbol 182 MovieClip Frame 25
this.gotoAndStop(1);
Symbol 182 MovieClip Frame 40
this.gotoAndStop(1);
Symbol 182 MovieClip Frame 54
this.gotoAndStop(1);
Symbol 182 MovieClip Frame 66
this.gotoAndStop(1);
Symbol 182 MovieClip Frame 79
this.gotoAndStop(1);
Symbol 192 MovieClip Frame 1
stop();
Symbol 199 MovieClip Frame 1
stop();
Symbol 203 Button
on (release) {
playClicked();
}
Symbol 210 Button
on (release) {
_parent.loadNext();
}
Symbol 216 MovieClip Frame 50
stop();
Symbol 220 Button
on (release) {
getURL ("http://www.mili-tary.de/games/mili-tary.php", "_blank");
}
Symbol 225 Button
on (release) {
getURL ("http://www.mili-tary.de/highscores/gun-runner/highscore.htm", "_blank");
}
Symbol 228 MovieClip Frame 1
function ladeDaten() {
news_xml = _parent.mein_xml.firstChild.childNodes;
initNavigation();
setListe();
}
function setListe() {
var _local1 = this;
i = aktAnzeige;
while (i < maxAnzeige) {
nName = "newsclip" + j;
attachMovie("newsclip", nName, j++);
if (news_xml[i] != undefined) {
_local1[nName]._x = 15;
_local1[nName]._y = ((_local1[nName]._height * j) * 1.2) - 15;
_local1[nName].nr_txt.text = i + 1;
_local1[nName].name_txt.text = news_xml[i].attributes.vorname;
_local1[nName].ver_txt.text = news_xml[i].attributes.nachname;
_local1[nName].punkte_txt.text = news_xml[i].firstChild;
_local1[nName].stern_mc.gotoAndStop(news_xml[i].attributes.icon);
_local1[nName].useHandCursor = false;
} else {
_local1[nName].removeMovieClip();
}
i++;
}
if (anzahl <= (aktAnzeige + max)) {
anzeige_txt.text = ((aktAnzeige + 1) + " / ") + anzahl;
} else if (anzahl != 0) {
anzeige_txt.text = ((aktAnzeige + 1) + " / ") + (aktAnzeige + max);
}
if (anzahl == 0) {
anzeige_txt.text = "0 / 0";
}
gesamt_txt.text = "Gesamt: " + anzahl;
}
function initNavigation() {
j = 0;
anzahl = news_xml.length;
max = 10;
maxAnzeige = 10;
aktAnzeige = 0;
}
butVor.onRelease = function () {
if (aktAnzeige < (anzahl - max)) {
j = 0;
aktAnzeige = aktAnzeige + max;
maxAnzeige = maxAnzeige + max;
setListe();
}
};
butZuruck.onRelease = function () {
if (aktAnzeige > 1) {
j = 0;
aktAnzeige = aktAnzeige - max;
maxAnzeige = maxAnzeige - max;
setListe();
}
};
Symbol 229 MovieClip Frame 1
function ladeDaten() {
news_xml = _parent.mein_xml.firstChild.childNodes;
initNavigation();
setListe();
}
function setListe() {
var _local2 = this;
var _local1 = 0;
while (_local1 < news_xml.length) {
if (_local1 <= 9) {
nName = "newsclip" + _local1;
attachMovie("newsclip", nName, _local1);
_local2[nName]._x = 15;
_local2[nName]._y = ((_local2[nName]._height * (_local1 + 1)) * 1.2) - 15;
_local2[nName].nr_txt.text = _local1 + 1;
_local2[nName].name_txt.text = (news_xml[_local1].attributes.vorname + " ") + news_xml[_local1].attributes.nachname;
_local2[nName].punkte_txt.text = news_xml[_local1].firstChild;
_local2[nName].stern_mc.gotoAndStop(news_xml[_local1].attributes.icon);
_local2[nName].useHandCursor = false;
} else {
return;
}
_local1++;
}
}
Symbol 243 Button
on (release) {
setSpieler();
}
Symbol 244 MovieClip Frame 1
function setListe() {
prev_mc._visible = 0;
prev_mc._visible = 1;
prev_mc.ladeDaten();
prev_mc.ladeDaten();
}
function setSpieler() {
var _local1 = this;
fvorname = vorname_txt.text;
fnachname = nachname_txt.text;
fpunkte = punkte_txt.text;
ficon = stern_mc._currentframe;
loadVariables ("http://www.mili-tary.ch/highscores/gun-runner/schreiben.php?" + new Date().getTime(), _local1, "POST");
loadVariables ("http://www.mili-tary.de/highscores/gun-runner/schreiben.php?" + new Date().getTime(), _local1, "POST");
loadVariables ("http://www.mili-tary.com/highscores/gun-runner/schreiben.php?" + new Date().getTime(), _local1, "POST");
status_txt.text = "Schreibe Daten!";
_local1.onData = function () {
if (eintrag) {
this.gotoAndStop(1);
delete eintrag;
} else {
status_txt.text = "Fehler !";
delete eintrag;
}
};
}
function nextIcon() {
stern_mc.nextFrame();
}
function prevIcon() {
if (stern_mc._currentframe > 2) {
stern_mc.prevFrame();
}
}
mein_xml = new XML();
mein_xml.ignoreWhite = true;
status_txt.text = "Lade Eintr\u00E4ge!";
mein_xml.load("http://www.mili-tary.ch/highscores/gun-runner/ausgabe.php?" + new Date().getTime());
mein_xml.load("http://www.mili-tary.de/highscores/gun-runner/ausgabe.php?" + new Date().getTime());
mein_xml.load("http://www.mili-tary.com/highscores/gun-runner/ausgabe.php?" + new Date().getTime());
mein_xml.onLoad = function (signal) {
if (signal) {
status_txt.text = "";
setListe();
}
};
schreiben_btn.onRelease = function () {
prev_mc._visible = 0;
prev_mc._visible = 1;
gotoAndStop (3);
vorname_txt.restrict = "A-Za-z\u00F6\u00E4\u00FC\u00D6\u00C4\u00DC\u00DF";
nachname_txt.restrict = "A-Za-z\u00F6\u00E4\u00FC\u00D6\u00C4\u00DC\u00DF";
punkte_txt.restrict = "0-5";
};
prev_mc._visible = 0;
prev_btn.onRelease = function () {
prev_mc._visible = !prev_mc._visible;
prev_mc._visible = !prev_mc._visible;
};
/:_root.a.waitingscreen.dis.nu = Number(_root.a.display.num2);
Symbol 244 MovieClip Frame 2
stop();
Instance of Symbol 14 MovieClip "stern_mc" in Symbol 244 MovieClip Frame 2
onClipEvent (load) {
this.gotoAndStop(2);
}
Symbol 244 MovieClip Frame 3
function setListe() {
prev_mc._visible = 0;
high_mc._visible = 1;
prev_mc.ladeDaten();
high_mc.ladeDaten();
}
mein_xml = new XML();
mein_xml.ignoreWhite = true;
status_txt.text = "Lade Eintr\u00E4ge!";
mein_xml.load("http://www.mili-tary.ch/highscores/gun-runner/ausgabe.php?" + new Date().getTime());
mein_xml.load("http://www.mili-tary.de/highscores/gun-runner/ausgabe.php?" + new Date().getTime());
mein_xml.load("http://www.mili-tary.com/highscores/gun-runner/ausgabe.php?" + new Date().getTime());
mein_xml.onLoad = function (signal) {
if (signal) {
status_txt.text = "";
setListe();
}
};
stop();
Symbol 248 Button
on (release) {
_parent.startOver();
/:_root.a.display.num2 = "0";
}
Symbol 302 Button
on (release) {
gotoAndStop ("lose");
}
Symbol 303 MovieClip Frame 1
function playClicked() {
if (_parent.game.loaded) {
_parent.startLevel();
}
}
function startedLoading() {
this.gotoAndStop(1);
status.gotoAndStop("Loading");
playButton._alpha = 50;
}
function finishedLoading() {
status.gotoAndStop("Loaded");
playButton._alpha = 100;
}
function gameOver() {
this._visible = true;
_parent.gameClip._visible = false;
this.gotoAndStop("Lose");
}
function showStats() {
var _local1 = _parent;
var _local2 = this;
_local2._visible = true;
_local1.gameClip._visible = false;
if (_local1.game.level == _local1.game.numLevels) {
_local2.gotoAndStop("Win");
} else {
_local2.gotoAndStop("Stats");
}
}
stop();
Symbol 303 MovieClip Frame 12
stop();
Symbol 303 MovieClip Frame 21
/:_root.a.waitingscreen.nu = Number(_root.a.display.num2);
Symbol 307 Button
on (release) {
stopAllSounds();
_root.gotoAndStop("Splash");
}
Symbol 308 Button
on (release) {
if (!soundOn) {
soundOn = true;
playSound("music");
} else {
stopAllSounds();
soundOn = false;
}
}
Symbol 309 MovieClip Frame 2
function startLevel() {
hero.x = hero.startx;
hero.y = hero.starty;
hero.xmov = 0;
hero.ymov = 0;
hero.clip._x = hero.x;
hero.clip._y = hero.y;
game.inPlay = true;
game.flagCaptured = false;
waitingScreen._visible = false;
gameClip._visible = true;
}
function loadNext() {
var _local1 = ++game.level;
loadLevel(_local1);
}
function startOver() {
hero.lives = game.numLives - 1;
display.num = hero.lives;
game.level = 0;
loadNext();
}
function levelLoaded() {
display.num = hero.lives;
waitingScreen.finishedLoading();
game.loaded = true;
game.platforms = {};
game.platforms.column = [];
var info = levelXML.firstChild;
game.flag = {};
game.flag.x = Number(info.attributes.flagx);
game.flag.y = Number(info.attributes.flagy);
placeFlag();
var tempBlocks = info.firstChild.childNodes;
var i = 0;
while (i < tempBlocks.length) {
var _local2 = tempBlocks[i].attributes;
var ob = new Object();
for (j in _local2) {
var nan = isNaN(Number(_local2[j]));
if (nan) {
ob[j] = _local2[j];
if (ob[j].toLowerCase() == "true") {
ob[j] = true;
} else if (ob[j].toLowerCase() == "false") {
ob[j] = false;
}
} else {
ob[j] = Number(_local2[j]);
}
}
var depth = (++game.depth);
var name = ("platform" + depth);
var clip = gameClip.overlay.attachMovie("platform", name, depth);
ob.clip = clip;
ob.clip._x = ob.x;
ob.clip._y = ob.y;
if (ob.graphic == null) {
ob.clip.gotoAndStop("cube");
} else {
ob.clip.gotoAndStop(ob.graphic);
}
ob.width = ob.clip.vertical._x;
ob.clip.vertical._visible = false;
ob.height = ob.clip.horizontal._y;
ob.clip.horizontal._visible = false;
ob.clip.me = ob;
if (ob.mover == "yes") {
makeMover(ob.clip);
}
game.platforms.column.push(ob);
i++;
}
var temp = info.firstChild.nextSibling.childNodes;
var groundWidth = 233;
game.grounds = [];
var i = 0;
while (i < temp.length) {
var atts = temp[i].attributes;
var xstart = Number(atts.xstart);
var _local1 = Number(atts.xend);
var ob = {x1:xstart, x2:_local1};
game.grounds.push(ob);
var _local3 = Math.ceil((_local1 - xstart) / groundWidth);
var nowx = xstart;
var j = 0;
while (j < _local3) {
var depth = (++game.depth);
var name = ("ground" + depth);
var clip = gameClip.overlay.attachMovie("ground", name, depth);
clip._y = game.floor;
clip._x = nowx;
if (_local3 == 1) {
clip._width = _local1 - xstart;
}
if (j == (_local3 - 1)) {
var cornerx = endx;
var depth = (++game.depth);
var name = ("corner" + depth);
var clip = gameClip.overlay.attachMovie("corner", name, depth);
clip._x = (_local1 - clip._width) + 15;
clip._y = game.floor;
}
if (j == 0) {
var cornerx = (xstart + 26);
var depth = (++game.depth);
var name = ("corner" + depth);
var clip = gameClip.overlay.attachMovie("corner", name, depth);
clip._x = cornerx;
clip._y = game.floor;
clip._xscale = -100;
}
if (j != (_local3 - 2)) {
var nowx = (nowx + groundWidth);
} else {
var nowx = (_local1 - groundWidth);
}
j++;
}
i++;
}
var temp = info.firstChild.nextSibling.nextSibling.childNodes;
game.baddies = [];
var i = 0;
while (i < temp.length) {
var atts = temp[i].attributes;
var x = Number(atts.x);
var y = Number(atts.y);
var speed = Number(atts.speed);
var breadth = Number(atts.breadth);
if (atts.start_direction == "left") {
var dir = -1;
} else {
var dir = 1;
}
var depth = (++game.depth);
var name = ("baddy" + depth);
var clip = gameClip.overlay.attachMovie("baddy", name, depth);
var ob = {homex:x, homey:y, speed:speed, breadth:breadth, dir:dir, clip:clip};
clip.me = ob;
game.baddies.push(ob);
clip._x = x;
clip._y = y;
addBaddyFXN(ob);
i++;
}
var temp = info.firstChild.nextSibling.nextSibling.nextSibling.childNodes;
game.collectables = [];
var i = 0;
while (i < temp.length) {
var atts = temp[i].attributes;
var x = Number(atts.x);
var y = Number(atts.y);
var type = atts.type;
var depth = (++game.depth);
var name = ("collectable" + depth);
var clip = gameClip.overlay.attachMovie(type, name, depth);
clip._x = x;
clip._y = y;
if (type == "ice cube") {
clip._xscale = (clip._yscale = 50);
}
clip.gotoAndStop("Display");
var ob = {x:x, y:y, type:type, clip:clip};
game.collectables.push(ob);
i++;
}
}
function levelComplete() {
game.inPlay = false;
if (hero.lives >= 0) {
waitingScreen.showStats();
} else {
waitingScreen.gameOver();
}
for (i in gameClip.overlay) {
var _local1 = typeof(gameClip.overlay[i]);
if (_local1 == "movieclip") {
if (gameClip.overlay[i]._name != "man") {
gameClip.overlay[i].removeMovieClip();
}
}
}
}
function placeFlag() {
var _local2 = ++game.depth;
var _local3 = "flag" + _local2;
var _local1 = gameClip.overlay.attachMovie("flag", _local3, _local2);
_local1._x = game.flag.x;
_local1._y = game.flag.y;
_local1.where = this;
_local1.flag.num.text = game.level;
game.flag.clip = _local1;
}
function playSound(name) {
if (soundOn) {
soundFX.gotoAndPlay(name);
}
}
function moveBaddy(ob) {
var _local1 = ob;
var _local2 = _local1.x + (_local1.dir * _local1.speed);
if ((_local1.dir < 0) && (_local2 < _local1.minx)) {
_local1.dir = _local1.dir * -1;
_local2 = _local1.x;
_local1.clip._xscale = (-_local1.dir) * 100;
} else if ((_local1.dir > 0) && (_local2 > _local1.maxx)) {
_local1.dir = _local1.dir * -1;
_local2 = _local1.x;
_local1.clip._xscale = (-_local1.dir) * 100;
}
_local1.x = _local2;
_local1.clip._x = _local1.x;
}
function addBaddyFXN(ob) {
var _local1 = ob;
_local1.minx = _local1.homex - (_local1.breadth / 2);
_local1.maxx = _local1.homex + (_local1.breadth / 2);
_local1.x = _local1.homex;
_local1.clip._xscale = (-_local1.dir) * 100;
_local1.clip.onEnterFrame = function () {
moveBaddy(this.me);
};
}
function loadLevel(num) {
waitingScreen.startedLoading();
game.loaded = false;
var _local1 = ("level" + num) + ".xml";
levelXML = new XML();
levelXML.onLoad = levelLoaded;
levelXML.ignoreWhite = true;
levelXML.load(_local1);
}
function makeMover(who) {
var _local1 = who;
_local1.me.homex = _local1._x;
_local1.me.homey = _local1._y;
_local1.onEnterFrame = moverFXN;
}
function listenForKeys() {
hero.wasCrouching = hero.isCrouching;
if (hero.inAir) {
hero.walkIncrement = hero.airWalkIncrement;
} else {
hero.walkIncrement = hero.groundWalkIncrement;
}
if (Key.isDown(39) && ((!hero.isCrouching) || (hero.isCrouching && (hero.inAir)))) {
hero.xmov = hero.xmov + hero.walkIncrement;
hero.walkRight();
} else if (Key.isDown(37) && ((!hero.isCrouching) || (hero.isCrouching && (hero.inAir)))) {
hero.xmov = hero.xmov - hero.walkIncrement;
hero.walkLeft();
}
if ((Key.isDown(32) || (Key.isDown(38))) && (okToJump)) {
okToJump = false;
if ((!hero.isJumping) && (!hero.inAir)) {
hero.inAir = true;
hero.ymov = hero.ymov - hero.jumpSpeed;
hero.jump();
}
} else if ((!Key.isDown(32)) && (!Key.isDown(38))) {
okToJump = true;
}
if (Key.isDown(40)) {
hero.crouch();
} else {
hero.unCrouch();
}
}
function addFrictionAndGravity() {
hero.ymov = hero.ymov + game.gravity;
if (!hero.inAir) {
hero.xmov = hero.xmov * game.runDecay;
} else {
hero.xmov = hero.xmov * game.windResistance;
}
if (Math.abs(hero.xmov) < hero.minXmov) {
if (hero.isWalking) {
hero.stopWalking();
}
hero.xmov = 0;
} else if (Math.abs(hero.xmov) > hero.maxXmov) {
hero.xmov = (Math.abs(hero.xmov) / hero.xmov) * hero.maxXmov;
}
}
function createTempPosition() {
hero.tempx = hero.x + hero.xmov;
hero.tempy = hero.y + hero.ymov;
var _local1 = Math.abs(hero.ymov);
if (_local1 > 10) {
if (_local1 > 22) {
hero.ymov = 22 * (hero.ymov / _local1);
}
game.totalIterations = 2;
} else {
game.totalIterations = 1;
}
}
function nextLife() {
playSound("die");
hero.lives--;
display.num = hero.lives;
hero.dead = false;
hero.fallingToDeath = false;
hero.x = hero.startx;
hero.y = hero.starty;
hero.xmov = 0;
hero.ymov = 0;
hero.walkRight();
if (hero.lives < 0) {
levelComplete();
}
}
function renderScreen() {
hero.lastX = hero.x;
hero.lastY = hero.y;
hero.x = hero.tempx;
hero.y = hero.tempy;
clip._x = hero.x;
clip._y = hero.y;
if (hero.dead && ((hero.y - game.floor) > 250)) {
nextLife();
}
var _local2 = (-hero.x) * game.xScrollFactor;
var _local1 = ((-((hero.y - game.floor) - 20)) * game.yScrollFactor) - (game.bg.height - game.viewableHeight);
game.bg.position(_local2, _local1);
_local2 = (-hero.x) + (game.viewableWidth / 2);
_local1 = (-hero.y) + (game.viewableHeight / 2);
game.overlay.position(_local2, _local1);
}
function checkFloor() {
var heroOnFloor = (hero.tempY > game.floor);
if (heroOnFloor) {
var heroMin = hero.x;
var heroMax = (hero.x + hero.width);
var _local3 = false;
var _local1 = 0;
while (_local1 < game.grounds.length) {
var _local2 = game.grounds[_local1];
if ((heroMax > _local2.x1) && (heroMin < _local2.x2)) {
_local3 = true;
break;
}
_local1++;
}
if (!_local3) {
hero.dead = true;
}
}
if (((heroOnFloor && (_local3)) && (!hero.onPlatform)) && (!hero.fallingToDeath)) {
hero.ymov = 0;
hero.tempy = game.floor;
hero.stopJumping();
hero.inAir = false;
}
}
function bounceOffOfPlatform(newx) {
hero.x = newx;
hero.xmov = 0;
hero.tempx = hero.x + hero.xmov;
}
function bounceOffOfBottom(newy) {
hero.y = newy;
hero.ymov = 0;
hero.tempy = hero.y + hero.ymov;
}
function landOnPlatform(platformTop) {
hero.ymov = 0;
hero.y = platformTop;
hero.tempy = hero.y + hero.ymov;
hero.inAir = false;
hero.stopJumping();
}
function platformDetect() {
var oldOnPlatform = hero.onPlatform;
var onPlatform = false;
var i = 0;
while (i < game.platforms.column.length) {
var _local2 = game.platforms.column[i];
var _local1 = _local2.x;
var _local3 = _local2.y;
var pw = _local2.width;
var ph = _local2.height;
var type = _local2.type;
var iteration = 1;
while (iteration <= game.totalIterations) {
hero.tempx = hero.x + ((hero.xmov / game.totalIterations) * iteration);
hero.tempy = hero.y + ((hero.ymov / game.totalIterations) * iteration);
if (((((hero.tempx + hero.width) > _local1) && (hero.tempx < (_local1 + pw))) && ((hero.tempy - hero.height) < (_local3 + ph))) && (hero.tempy > _local3)) {
if ((((hero.tempy > _local3) && (hero.y <= (_local3 + 0.01))) && (hero.tempy < (_local3 + ph))) && (hero.ymov > 0)) {
var onPlatform = true;
var platformTop = _local3;
landOnPlatform(platformTop);
if (_local2.mover == "yes") {
var xinc = (_local2.xspeed + (hero.xmov * 0.5));
hero.x = hero.x + xinc;
hero.y = hero.y + (_local2.yspeed + (hero.ymov * 0.5));
hero.tempx = hero.x;
hero.tempy = hero.y;
}
} else if ((((((type != "cloud") && ((hero.tempy - hero.height) > _local3)) && ((hero.tempy - hero.height) < (_local3 + ph))) && ((hero.tempx + (hero.width / 2)) > _local1)) && (hero.tempx < ((_local1 + pw) - (hero.width / 2)))) && (hero.ymov < 0)) {
var newy = ((_local3 + ph) + hero.height);
bounceOffOfBottom(newy);
if (_local2.container) {
_local2.clip.item.gotoAndPlay("Display");
display.num2 = Number(display.num2) + 1;
playSound("collect");
if ((--_local2.containerCounter) <= 0) {
_local2.container = false;
}
}
} else if (((type != "cloud") && ((hero.tempx + hero.width) > _local1)) && ((hero.tempx + hero.width) < (_local1 + pw))) {
if (!hero.wasCrouching) {
var newx = (_local1 - hero.width);
bounceOffOfPlatform(newx);
} else {
hero.crouch();
var crouchMove = true;
var left = true;
}
} else if (((type != "cloud") && (hero.tempx > _local1)) && (hero.tempx < (_local1 + pw))) {
if (!hero.wasCrouching) {
var newx = (_local1 + pw);
bounceOffOfPlatform(newx);
} else {
hero.crouch();
var crouchMove = true;
var left = false;
}
}
}
iteration++;
}
i++;
}
hero.onPlatform = onPlatform;
if (crouchMove) {
if (left) {
hero.tempx = hero.tempx - hero.pushSpeed;
} else {
hero.tempx = hero.tempx + hero.pushSpeed;
}
}
if ((!hero.onPlatform) && (oldOnPlatform)) {
hero.inAir = true;
}
}
function killBaddy(who, index) {
playSound("kill");
who.clip.animation.gotoAndPlay("dead");
game.baddies.splice(index, 1);
}
function baddyDetection() {
var _local1 = 0;
while (_local1 < game.baddies.length) {
var _local2 = game.baddies[_local1];
if (hero.clip.hitTest(_local2.clip.hitArea)) {
if (hero.ymov > game.gravity) {
hero.tempy = hero.y;
hero.ymov = -10;
killBaddy(_local2, _local1);
} else {
hero.ymov = -20;
hero.xmov = 15;
hero.die();
}
}
_local1++;
}
}
function collectableDetect() {
var _local3 = _root;
var _local2 = 0;
while (_local2 < game.collectables.length) {
var _local1 = game.collectables[_local2];
if (hero.clip.hitTest(_local1.clip) && (!_local1.captured)) {
display.num2 = Number(display.num2) + 1;
_local3.a.waitingscreen.num2 = Number(_local3.a.waitingscreen.num2) + 1;
playSound("collect");
_local1.captured = true;
_local1.clip.gotoAndPlay("Capture");
}
_local2++;
}
}
function detectFlag() {
if (hero.clip.hitTest(game.flag.clip) && (!game.flagCaptured)) {
game.flagCaptured = true;
game.flag.clip.play();
}
}
stop();
soundOn = true;
game = {};
game.level = 1;
game.numLevels = 5;
game.hero = {};
game.hero.clip = gameClip.overlay.man;
game.bg = {};
game.bg.clip = gameClip.bg;
game.bg.x = 0;
game.bg.y = 0;
game.bg.height = game.bg.clip._height;
game.bg.width = game.bg.clip._width;
game.overlay = {};
game.overlay.clip = gameClip.overlay;
game.overlay.x = 0;
game.overlay.y = 0;
game.gravity = 2;
game.windResistance = 0.92;
game.numLives = 3;
hero = game.hero;
hero.lives = game.numLives - 1;
clip = game.hero.clip;
hero.xmov = 0;
hero.startx = 50;
hero.starty = 320;
hero.standingHeight = 50;
hero.crouchingHeight = 30;
hero.width = 23;
hero.height = hero.standingHeight;
hero.ymov = 0;
hero.minXmov = 0.75;
hero.maxXmov = 12;
hero.groundWalkIncrement = 1.7;
hero.airWalkIncrement = 0.85;
hero.pushSpeed = 4;
hero.walkIncrement = hero.groundWalkIncrement;
hero.jumpSpeed = 23;
hero.clip.swapDepths(1000000);
game.runDecay = 0.85;
game.depth = 10000;
game.floor = 330;
game.viewableHeight = 350;
game.viewableWidth = 680;
game.walkAbleWidth = 4800;
game.walkAbleHeight = 4000;
game.xScrollFactor = (game.bg.width - game.viewableWidth) / game.walkAbleWidth;
game.yScrollFactor = game.bg.height / game.walkAbleHeight;
moverFXN = function () {
var _local1 = this;
_local1.me.tempx = _local1._x + _local1.me.xspeed;
_local1.me.tempy = _local1._y + _local1.me.yspeed;
if (_local1.me.xspeed > 0) {
if (_local1.me.tempx < (_local1.me.homex + _local1.me.maxxmov)) {
_local1._x = _local1.me.tempx;
} else {
_local1.me.xspeed = -Math.abs(_local1.me.xspeed);
}
}
if (_local1.me.xspeed < 0) {
if (_local1.me.tempx > (_local1.me.homex - _local1.me.maxxmov)) {
_local1._x = _local1.me.tempx;
} else {
_local1.me.xspeed = Math.abs(_local1.me.xspeed);
}
}
if (_local1.me.yspeed > 0) {
if (_local1.me.tempy < (_local1.me.homey + _local1.me.maxymov)) {
_local1._y = _local1.me.tempy;
} else {
_local1.me.yspeed = -Math.abs(_local1.me.yspeed);
}
}
if (_local1.me.yspeed < 0) {
if (_local1.me.tempy > (_local1.me.homey - _local1.me.maxymov)) {
_local1._y = _local1.me.tempy;
} else {
_local1.me.yspeed = Math.abs(_local1.me.yspeed);
}
}
_local1.me.x = _local1._x;
_local1.me.y = _local1._y;
};
hero.stopWalking = function () {
var _local1 = this;
_local1.isWalking = false;
if (!_local1.isCrouching) {
_local1.clip.animation.gotoAndStop(1);
}
};
hero.walkRight = function () {
var _local1 = this;
_local1.isWalking = true;
_local1.clip.animation._xscale = 100;
if (!_local1.inAir) {
_local1.clip.animation.play();
}
};
hero.walkLeft = function () {
var _local1 = this;
_local1.isWalking = true;
_local1.clip.animation._xscale = -100;
if (!_local1.inAir) {
_local1.clip.animation.play();
}
};
hero.jump = function () {
playSound("jump");
this.isJumping = true;
this.clip.animation.gotoAndStop("Jump Frame");
};
hero.die = function () {
playSound("die");
this.dead = true;
this.clip.animation.gotoAndStop("Dead");
};
hero.crouch = function () {
var _local1 = this;
_local1.isCrouching = true;
_local1.height = _local1.crouchingHeight;
_local1.clip.animation.gotoAndStop("Crouch");
if (Key.isDown(39)) {
_local1.clip.animation._xscale = 100;
} else if (Key.isDown(37)) {
_local1.clip.animation._xscale = -100;
}
};
hero.unCrouch = function () {
var _local1 = this;
if (_local1.isCrouching) {
_local1.isCrouching = false;
_local1.height = _local1.standingHeight;
if (!_local1.inAir) {
if (_local1.isWalking) {
_local1.clip.animation.gotoAndPlay("Walk");
} else {
_local1.clip.animation.gotoAndStop(1);
}
} else if (_local1.inAir) {
if (_local1.isJumping) {
_local1.clip.animation.gotoAndStop("Jump Frame");
}
}
}
};
hero.stopJumping = function () {
var _local1 = this;
if (_local1.isJumping) {
_local1.isJumping = false;
if (!_local1.isWalking) {
if (!_local1.isCrouching) {
_local1.clip.animation.gotoAndStop(1);
} else {
_local1.clip.animation.gotoAndStop("Crouch");
}
} else if (_local1.isCrouching) {
_local1.clip.animation.gotoAndStop("Crouch");
} else {
_local1.clip.animation.gotoAndPlay("Walk");
}
}
};
hero.stopWalking();
game.bg.position = function (x, y) {
var _local1 = y;
var _local2 = x;
if (_local2 > 0) {
_local2 = 0;
}
if ((_local1 + game.bg.height) < (game.floor + 30)) {
_local1 = (game.floor + 30) - game.bg.height;
}
if ((_local2 + game.bg.width) < game.viewableWidth) {
_local2 = game.viewAbleWidth - game.bg.width;
}
game.bg.clip.x = _local2;
game.bg.clip.y = _local1;
game.bg.clip._x = _local2;
game.bg.clip._y = _local1;
};
game.overlay.position = function (x, y) {
var _local1 = y;
var _local2 = x;
if (_local2 > 0) {
_local2 = 0;
} else if (_local2 < ((-game.walkableWidth) + game.viewableWidth)) {
_local2 = (-game.walkableWidth) + game.viewableWidth;
}
if (_local1 < 0) {
_local1 = 0;
}
game.overlay.clip.x = _local2;
game.overlay.clip.y = _local1;
game.overlay.clip._x = _local2;
game.overlay.clip._y = _local1;
};
game.bg.position(0, 0);
loadLevel(1);
playSound("music");
this.onEnterFrame = function () {
if (game.inPlay) {
if (!hero.dead) {
listenForKeys();
}
addFrictionAndGravity();
createTempPosition();
if (!hero.dead) {
baddyDetection();
platformDetect();
collectableDetect();
detectFlag();
checkFloor();
}
renderScreen();
}
};