Frame 1
percentloaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
loader._xscale = percentloaded;
trace(percentloaded);
Frame 2
if (percentloaded < 100) {
gotoAndPlay ("preloader");
}
Frame 3
stop();
Frame 4
function restart() {
outstanding = false;
patx = 0;
paty = 0;
patt = 0;
eatx = 0;
eaty = 0;
eatt = 0;
eadir = 1;
phiding = true;
alldead = false;
kills = 0;
stealthkills = 0;
spotted = 0;
arow = new arro(0, 0, 0);
arow.kill();
}
function gotolevel(lev) {
restart();
removeMovieClip("characters");
attachMovie("characters", "characters", 2);
map.gotoAndStop(lev);
wallmap.gotoAndStop(lev);
foreground.gotoAndStop(lev);
sky.gotoAndStop(lev);
characters.gotoAndStop(lev);
leftst.gotoAndStop(lev);
rightst.gotoAndStop(lev);
left.gotoAndStop(lev);
right.gotoAndStop(lev);
hiding.gotoAndStop(lev);
}
function loadsounds() {
land_s = new Sound();
land_s.attachSound("landsound");
gethit_s = new Sound();
gethit_s.attachSound("gethit");
slash1_s = new Sound();
slash1_s.attachSound("slash1");
hitground_s = new Sound();
hitground_s.attachSound("hitground");
uh_s = new Sound();
uh_s.attachSound("uh");
jump_s = new Sound();
jump_s.attachSound("jump");
thunder_s = new Sound();
thunder_s.attachSound("thunder");
}
function angTo(x1, y1, x2, y2) {
i = Math.atan2(y2 - y1, x2 - x1);
i = i / (Math.PI/180);
return(i);
}
function getX(dist, angleDegs) {
i = angleDegs * (Math.PI/180);
return(dist * Math.cos(i));
}
function getY(dist, angleDegs) {
i = angleDegs * (Math.PI/180);
return(dist * Math.sin(i));
}
_root.attachMovie("sky", "sky", 1);
_root.attachMovie("characters", "characters", 2);
_root.createEmptyMovieClip("arrowlayer", 3);
_root.createEmptyMovieClip("bloodlayer", 4);
_root.attachMovie("wallmap", "wallmap", 5);
_root.attachMovie("map", "map", 6);
_root.attachMovie("foreground", "foreground", 7);
_root.attachMovie("leftst", "leftst", 8);
_root.attachMovie("rightst", "rightst", 9);
_root.attachMovie("left", "left", 10);
_root.attachMovie("right", "right", 11);
_root.attachMovie("hiding", "hiding", 12);
_root.attachMovie("report", "report", 13);
report._visible = false;
wallmap._visible = false;
map._visible = false;
hiding._visible = false;
right._visible = false;
left._visible = false;
rightst._visible = false;
leftst._visible = false;
loadsounds();
stopAllSounds();
music = new loopsound("rain");
bloods = new bloodhandler();
totalkills = 0;
totalstealth = 0;
totalspot = 0;
totalcontinue = 0;
level = 1;
gotolevel(level);
onEnterFrame = function () {
bloods.advance();
arow.advance();
if (alldead == true) {
report._visible = true;
} else {
report._visible = false;
report._alpha = 0;
}
alldead = true;
};
Symbol 13 MovieClip [you_died] Frame 1
this._alpha = 0;
this.onEnterFrame = function () {
if (this._alpha < 100) {
this._alpha = this._alpha + 10;
}
if (Key.isDown(32)) {
_root.gotolevel(_root.level);
_root.alldead = false;
removeMovieClip(this);
}
};
Symbol 19 MovieClip [blood] Frame 1
gotoAndStop(Math.round(Math.random() * _totalframes));
Symbol 21 MovieClip [lightning] Frame 1
_root.flashtime = 0;
this.onEnterFrame = function () {
if (_root.flashtime > 0) {
this._visible = true;
_root.flashtime = _root.flashtime - 1;
} else {
this._visible = false;
if ((Math.random() * 500) > 498) {
_root.thunder_s.start();
_root.flashtime = 10;
}
}
};
Symbol 38 MovieClip [sky] Frame 1
stop();
Symbol 47 MovieClip Frame 1
function onEnterFrame() {
if (_root.characters.player._x > 350) {
gotoAndStop ("open");
}
if (_root.characters.player._x < 100) {
gotoAndStop ("closed");
}
}
stop();
Symbol 51 MovieClip [map] Frame 1
stop();
Symbol 59 MovieClip [wallmap] Frame 1
stop();
Symbol 123 MovieClip Frame 1
function onPress() {
_root.totalkills = 0;
_root.totalstealth = 0;
_root.totalspot = 0;
_root.totalcontinue = 0;
_root.level = 1;
_root.gotolevel(1);
}
Symbol 124 MovieClip Frame 1
_visible = false;
onEnterFrame = function () {
if (_root.report._visible == true) {
totalkills.text = "KILLS: " + _root.totalkills;
totalstealth.text = "STEALTH KILLS: " + _root.totalstealth;
totalspotted.text = "SPOTTED: " + _root.totalspot;
totalcontinue.text = "CONTINUES: " + _root.totalcontinue;
rating = ((_root.totalstealth - _root.totalspot) - _root.totalcontinue) / _root.totalkills;
if (rating <= -0.5) {
comment.text = "AWFUL";
}
if ((rating > -0.5) and (rating <= 0)) {
comment.text = "POOR";
}
if ((rating > 0) and (rating <= 0.5)) {
comment.text = "NINJA";
}
if ((rating > 0.5) and (rating < 1)) {
comment.text = "MASTER";
}
if (rating == 1) {
comment.text = "GRANDMASTER";
}
_visible = true;
}
};
Symbol 125 MovieClip [foreground] Frame 1
stop();
Symbol 163 MovieClip [enemyb] Frame 1
#initclip 11
Object.registerClass("enemyb", enemy);
#endinitclip
Symbol 215 MovieClip [ninja] Frame 1
#initclip 8
Object.registerClass("ninja", player);
#endinitclip
Symbol 253 MovieClip [enemya] Frame 1
#initclip 9
Object.registerClass("enemya", enemy);
#endinitclip
Symbol 288 MovieClip [enemy] Frame 1
#initclip 10
Object.registerClass("enemy", bowman);
#endinitclip
Symbol 289 MovieClip [characters] Frame 1
stop();
Symbol 292 MovieClip [hiding] Frame 1
stop();
Symbol 294 MovieClip [leftst] Frame 1
stop();
Symbol 296 MovieClip [rightst] Frame 1
stop();
Symbol 300 MovieClip [left] Frame 1
stop();
Symbol 303 MovieClip [right] Frame 1
stop();
Symbol 309 MovieClip [report] Frame 1
stop();
onEnterFrame = function () {
if (_visible) {
if (_root.characters.player._x > 535) {
_root.level = _root.level + 1;
_root.gotolevel(_root.level);
}
stealthkills.text = (("STEALTH KILLS: " + _root.stealthkills) + "/") + _root.kills;
spotted.text = "SPOTTED: " + _root.spotted;
rating = (_root.stealthkills - (_root.spotted / 2)) / _root.kills;
if (rating < 0) {
comment.text = "AWFUL";
}
if ((rating > 0) and (rating <= 0.3)) {
comment.text = "POOR";
}
if ((rating > 0.3) and (rating <= 0.9)) {
comment.text = "NINJA";
}
if (rating > 0.9) {
comment.text = "MASTER";
}
if (_root.outstanding) {
comment.text = "GRANDMASTER";
}
if (_alpha < 100) {
_alpha = (_alpha + 10);
}
}
};
Symbol 341 MovieClip [__Packages.player] Frame 0
class player extends MovieClip
{
var _xscale, _yscale, stop, _y, checky, checkx, _x, gotoAndStop;
function player () {
super();
_xscale = 70 * pdir;
_yscale = 70;
(stop());// not popped
}
function dealkeys() {
if (sticktime <= 0) {
action = "wait";
if (Key.isDown(39) and (fallv < 5)) {
action = "walk";
pdir = 1;
}
if (Key.isDown(37) and (fallv < 5)) {
action = "walk";
pdir = -1;
}
if (Key.isDown(40) and (fallv < 5)) {
action = "duck";
}
if ((Key.isDown(68) and (fallv < 5)) and (dletgo == true)) {
action = "block";
sticktime = 5;
mdir = -1;
dletgo = false;
}
if (Key.isDown(68) == false) {
dletgo = true;
}
if ((Key.isDown(83) and (fallv < 5)) and (sletgo == true)) {
sletgo = false;
_root.slash1_s.start();
action = "attackb";
sticktime = 5;
if (Key.isDown(40)) {
action = "attacka";
}
if (Key.isDown(37) or Key.isDown(39)) {
action = "attackc";
}
}
if (Key.isDown(83) == false) {
sletgo = true;
}
if (Key.isDown(38) and (fallv < 5)) {
_root.jump_s.start();
action = "jump";
sticktime = 25;
fallv = -12;
}
}
if (sticktime > 0) {
sticktime = sticktime - 1;
}
}
function floortest() {
_y = _y + fallv;
checky = _y + pheight;
checkx = _x;
var _local3 = false;
if (_root.map.hitTest(checkx, checky, true)) {
while (_root.map.hitTest(checkx, checky - 1, true)) {
_y = _y - 1;
checky = (_y + pheight) - 1;
checkx = _x;
}
if (action == "jump") {
sticktime = 0;
}
if (((action == "dead") or (action == "die")) and (fallv > 3)) {
_root.hitground_s.start();
(gotoAndStop("dead"));// not popped
}
if ((fallv > 5) and (action != "die")) {
_root.land_s.start();
action = "duck";
sticktime = 2;
}
fallv = 0;
} else {
fallv = fallv + grav;
if (fallv > 14) {
fallv = 14;
}
if (fallv > 2) {
_x = _x + ((1 * pdir) * mdir);
}
}
}
function walltest() {
checky = (_y + pheight) - 10;
checkx = _x + ((15 * pdir) * mdir);
var _local3 = false;
if (_root.map.hitTest(checkx, checky, true)) {
mdir = 1;
if (action == "jump") {
_local3 = true;
}
if ((action != "die") and (alive == true)) {
action = "wait";
} else {
pdir = pdir * -1;
}
if ((fallv > 2) and (_local3 == false)) {
_x = _x - (4 * pdir);
}
}
if (_local3 and _root.wallmap.hitTest(checkx, checky, true)) {
if (fallv > -1) {
_root.land_s.start();
}
action = "wallrun";
}
}
function hitcheck() {
if (_root.eatt > 0) {
if ((((_root.eatx > (_x - 20)) and (_root.eatx < (_x + 20))) and (_root.eaty > (_y - 20))) and (_root.eaty < (_y + 20))) {
if ((action != "block") and (action != "sparkblock")) {
_root.gethit_s.start();
_root.bloods.newblood(_x, _y, pdir);
_root.bloods.newblood(_x, _y, pdir);
_root.bloods.newblood(_x, _y, pdir);
_root.bloods.newblood(_x, _y, pdir);
action = "die";
_root.totalcontinue = _root.totalcontinue + 1;
sticktime = 9;
mdir = -1;
pdir = _root.eadir;
} else {
action = "sparkblock";
sticktime = 6;
mdir = -1;
}
}
}
}
function arrowcheck() {
if (_root.arow.time > 0) {
if ((((_root.arow.x > (_x - 20)) and (_root.arow.x < (_x + 20))) and (_root.arow.y > (_y - 20))) and (_root.arow.y < (_y + 20))) {
_root.gethit_s.start();
pdir = (_root.arow.xs / Math.abs(_root.arow.xs)) * -1;
_root.bloods.newblood(_x, _y, pdir);
_root.bloods.newblood(_x, _y, pdir);
_root.bloods.newblood(_x, _y, pdir);
_root.bloods.newblood(_x, _y, pdir);
action = "die";
_root.totalcontinue = _root.totalcontinue + 1;
sticktime = 9;
mdir = -1;
}
}
}
function setanim() {
if (action == "wait") {
(gotoAndStop("wait"));// not popped
}
if (action == "walk") {
(gotoAndStop("walk"));// not popped
_x = _x + (6 * pdir);
mdir = 1;
}
if (action == "jump") {
(gotoAndStop("jump"));// not popped
_x = _x + (5 * pdir);
mdir = 1;
}
if (action == "duck") {
(gotoAndStop("duck"));// not popped
mdir = 1;
}
if (action == "block") {
(gotoAndStop("block"));// not popped
_x = _x - (5 * pdir);
mdir = -1;
}
if (action == "backflip") {
(gotoAndStop("backflip"));// not popped
_x = _x - (5 * pdir);
mdir = -1;
}
if (action == "sparkblock") {
(gotoAndStop("sparkblock"));// not popped
_x = _x - (3 * pdir);
mdir = -1;
}
if (action == "die") {
if (fallv > 3) {
(gotoAndStop("deadfall"));// not popped
} else {
(gotoAndStop("die"));// not popped
}
_x = _x - (3 * pdir);
if (sticktime == 1) {
alive = false;
}
mdir = -1;
}
if (action == "wallrun") {
(gotoAndStop("wallrun"));// not popped
sticktime = 15;
fallv = -10;
action = "jump";
mdir = 1;
if (((pdir == 1) and Key.isDown(37)) or ((pdir == -1) and Key.isDown(39))) {
outstand = 25;
_root.jump_s.start();
action = "backflip";
sticktime = 10;
mdir = -1;
fallv = -10;
}
}
if (action == "attacka") {
(gotoAndStop("attacka"));// not popped
_x = _x + (4 * pdir);
if (sticktime == 2) {
_root.patx = _x + (20 * pdir);
_root.paty = _y;
_root.patt = 2;
}
mdir = 1;
}
if (action == "attackb") {
(gotoAndStop("attackb"));// not popped
_x = _x + (4 * pdir);
if (sticktime == 2) {
_root.patx = _x + (20 * pdir);
_root.paty = _y;
_root.patt = 2;
}
mdir = 1;
}
if (action == "attackc") {
(gotoAndStop("attackc"));// not popped
_x = _x + (4 * pdir);
if (sticktime == 1) {
_root.patx = _x + (20 * pdir);
_root.paty = _y;
_root.patt = 2;
}
mdir = 1;
}
}
function onEnterFrame() {
if (alive == true) {
dealkeys();
_xscale = 70 * pdir;
floortest();
walltest();
if (outstand > 0) {
outstand = outstand - 1;
}
if (_root.patt > 0) {
_root.patt = _root.patt - 1;
}
if (_root.eatt > 0) {
_root.eatt = _root.eatt - 1;
}
if (action != "die") {
hitcheck();
arrowcheck();
if (_y > 430) {
action = "die";
sticktime = 9;
}
}
checky = _y + 5;
checkx = _x;
if ((action == "duck") and _root.hiding.hitTest(checkx, checky, false)) {
_root.phiding = true;
} else {
_root.phiding = false;
}
setanim();
} else {
(gotoAndStop("dead"));// not popped
mdir = -1;
if (fallv > 2) {
(gotoAndStop("deadfall"));// not popped
}
if (deadtime < 30) {
deadtime = deadtime + 1;
}
if (deadtime == 10) {
_root.attachMovie("you_died", "you_died", 14);
_root.you_died._x = 275;
_root.you_died._y = 100;
}
floortest();
}
}
var pdir = 1;
var mdir = 1;
var action = "wait";
var fallv = 0;
var pheight = 26;
var grav = 2.4;
var sticktime = 0;
var alive = true;
var deadtime = 0;
var sletgo = true;
var dletgo = true;
var outstand = 0;
}
Symbol 342 MovieClip [__Packages.enemy] Frame 0
class enemy extends MovieClip
{
var _x, _y, _xscale, _yscale, stop, checkx, checky, gotoAndStop;
function enemy () {
super();
aistyle = "swapper";
if (_root.rightst.hitTest(_x, _y, true)) {
pdir = 1;
action = "marchwait";
aistyle = "still";
}
if (_root.leftst.hitTest(_x, _y, true)) {
pdir = -1;
action = "marchwait";
aistyle = "still";
}
_xscale = 70 * pdir;
_yscale = 70;
(stop());// not popped
}
function mainai() {
if (aistyle == "swapper") {
action = "marchwait";
swaptime = swaptime + 1;
if (swaptime > 70) {
swaptime = 0;
pdir = pdir * -1;
}
}
if (aistyle == "still") {
action = "marchwait";
}
if ((fallv < 5) and (aistyle == "walker")) {
action = "march";
}
}
function lookcheckpoints() {
checkx = _x;
checky = _y;
if (_root.right.hitTest(checkx, checky, true)) {
pdir = 1;
action = "march";
aistyle = "walker";
}
if (_root.left.hitTest(checkx, checky, true)) {
pdir = -1;
action = "march";
aistyle = "walker";
}
}
function lookplayer() {
if ((_root.characters.player.alive == true) and (_root.phiding == false)) {
if ((_y < (_root.characters.player._y + 60)) and (_y > (_root.characters.player._y - 60))) {
checkx = _x - (10 * pdir);
checky = _y;
while ((checkx < (_x + 200)) and (checkx > (_x - 200))) {
checkx = checkx + (40 * pdir);
if (_root.map.hitTest(checkx, checky, true)) {
break;
}
if ((checkx < (_root.characters.player._x + 20)) and (checkx > (_root.characters.player._x - 20))) {
if (aware == 0) {
_root.spotted = _root.spotted + 1;
_root.totalspot = _root.totalspot + 1;
}
aware = 50;
break;
}
}
}
}
}
function chaseplayer() {
if (fallv < 3) {
action = "wait";
if ((Math.random() < 0.1) and ((_root.characters.player._x > (_x + 90)) or (_root.characters.player._x < (_x - 90)))) {
action = "walk";
sticktime = 5;
}
if (_root.characters.player._x > _x) {
pdir = 1;
}
if (_root.characters.player._x < _x) {
pdir = -1;
}
if (((_root.characters.player._x < (_x + 90)) and (_root.characters.player._x > (_x - 90))) and (Math.random() < 0.2)) {
_root.slash1_s.start();
if (Math.random() < 0.5) {
action = "attacka";
} else {
action = "attackb";
}
sticktime = 5;
}
}
}
function checkfloor() {
_y = _y + fallv;
checky = _y + pheight;
checkx = _x;
if (_root.map.hitTest(checkx, checky, true)) {
while (_root.map.hitTest(checkx, checky - 1, true)) {
_y = _y - 1;
checky = (_y + pheight) - 1;
checkx = _x;
}
if (action == "jump") {
sticktime = 0;
}
if (((action == "dead") or (action == "die")) and (fallv > 3)) {
_root.hitground_s.start();
(gotoAndStop("dead"));// not popped
}
if (((fallv > 3) and (alive == true)) and (action != "die")) {
_root.land_s.start();
action = "duck";
sticktime = 2;
}
fallv = 0;
} else {
fallv = fallv + grav;
if (fallv > 14) {
fallv = 14;
}
if (((fallv > 5) and (alive == true)) and (action != "die")) {
_x = _x + (2 * pdir);
action = "wait";
}
}
}
function checkwalls() {
checky = (_y + pheight) - 5;
checkx = _x + ((15 * pdir) * mdir);
var _local3 = false;
if (_root.map.hitTest(checkx, checky, true)) {
if (action == "jump") {
_local3 = true;
}
if ((action != "die") and (alive == true)) {
action = "marchwait";
}
if (aistyle == "swapper") {
aistyle = "still";
}
if ((fallv > 2) and (_local3 == false)) {
_x = _x - (4 * pdir);
}
pdir = pdir * -1;
aware = 0;
}
}
function hitcheck() {
if ((_root.patt > 0) and (action != "die")) {
if ((((_root.patx > (_x - 20)) and (_root.patx < (_x + 20))) and (_root.paty > (_y - 20))) and (_root.paty < (_y + 20))) {
if (aware <= 0) {
_root.uh_s.start();
} else {
_root.gethit_s.start();
}
_root.bloods.newblood(_x, _y, _root.characters.player.pdir);
_root.bloods.newblood(_x, _y, _root.characters.player.pdir);
_root.bloods.newblood(_x, _y, _root.characters.player.pdir);
_root.bloods.newblood(_x, _y, _root.characters.player.pdir);
action = "die";
mdir = -1;
sticktime = 8;
_root.kills = _root.kills + 1;
_root.totalkills = _root.totalkills + 1;
if (aware == 0) {
_root.stealthkills = _root.stealthkills + 1;
_root.totalstealth = _root.totalstealth + 1;
if (_root.characters.player.outstand > 0) {
_root.outstanding = true;
}
}
pdir = _root.characters.player.pdir * -1;
}
}
}
function setanim() {
if (action == "wait") {
(gotoAndStop("wait"));// not popped
mdir = 1;
}
if (action == "walk") {
(gotoAndStop("walk"));// not popped
_x = _x + (5 * pdir);
mdir = 1;
}
if (action == "march") {
(gotoAndStop("march"));// not popped
_x = _x + (1.5 * pdir);
mdir = 1;
}
if (action == "duck") {
(gotoAndStop("duck"));// not popped
mdir = 1;
}
if (action == "marchwait") {
(gotoAndStop("marchwait"));// not popped
mdir = 1;
}
if (action == "die") {
if (fallv > 3) {
(gotoAndStop("deadfall"));// not popped
} else {
(gotoAndStop("die"));// not popped
}
_x = _x - (3 * pdir);
if (sticktime == 1) {
alive = false;
}
mdir = -1;
}
if (action == "attacka") {
(gotoAndStop("attacka"));// not popped
_x = _x + (4 * pdir);
if (sticktime == 2) {
_root.eatx = _x + (15 * pdir);
_root.eaty = _y;
_root.eatt = 2;
_root.eadir = pdir * -1;
}
mdir = 1;
}
if (action == "attackb") {
(gotoAndStop("attackb"));// not popped
_x = _x + (4 * pdir);
if (sticktime == 2) {
_root.eatx = _x + (15 * pdir);
_root.eaty = _y;
_root.eatt = 2;
_root.eadir = pdir * -1;
}
mdir = 1;
}
}
function onEnterFrame() {
if (alive == true) {
_root.alldead = false;
if (_root.characters.player.alive == false) {
aware = 0;
}
if (sticktime <= 0) {
if (aware <= 0) {
mainai();
lookcheckpoints();
lookplayer();
}
if (aware > 0) {
chaseplayer();
lookplayer();
}
}
if (sticktime > 0) {
sticktime = sticktime - 1;
}
if (aware > 0) {
aware = aware - 1;
}
_xscale = 70 * pdir;
checkfloor();
checkwalls();
hitcheck();
if ((_y > 400) and (action != "die")) {
_root.kills = _root.kills + 1;
_root.totalkills = _root.totalkills + 1;
action = "die";
sticktime = 9;
}
setanim();
} else {
(gotoAndStop("dead"));// not popped
if (fallv > 2) {
(gotoAndStop("deadfall"));// not popped
if ((Math.random() > 0.8) and (_y < 400)) {
_root.bloods.newblood((_x + 5) - (Math.random() * 10), _y, 0);
}
}
mdir = -1;
action = "dead";
checkfloor();
}
}
var pdir = 1;
var mdir = 1;
var action = "marchwait";
var fallv = 0;
var pheight = 26;
var grav = 2.4;
var sticktime = 0;
var aware = 0;
var alive = true;
var aistyle = "swapper";
var swaptime = 0;
}
Symbol 343 MovieClip [__Packages.bowman] Frame 0
class bowman extends MovieClip
{
var _x, _y, _xscale, _yscale, stop, checkx, checky, gotoAndStop;
function bowman () {
super();
aistyle = "swapper";
if (_root.rightst.hitTest(_x, _y, true)) {
pdir = 1;
action = "marchwait";
aistyle = "still";
}
if (_root.leftst.hitTest(_x, _y, true)) {
pdir = -1;
action = "marchwait";
aistyle = "still";
}
_xscale = 70 * pdir;
_yscale = 70;
(stop());// not popped
}
function mainai() {
if (aistyle == "swapper") {
action = "marchwait";
swaptime = swaptime + 1;
if (swaptime > 70) {
swaptime = 0;
pdir = pdir * -1;
}
}
if (aistyle == "still") {
action = "marchwait";
}
if ((fallv < 5) and (aistyle == "walker")) {
action = "march";
}
}
function lookcheckpoints() {
checkx = _x;
checky = _y;
if (_root.right.hitTest(checkx, checky, true)) {
pdir = 1;
action = "march";
aistyle = "walker";
}
if (_root.left.hitTest(checkx, checky, true)) {
pdir = -1;
action = "march";
aistyle = "walker";
}
}
function lookplayer() {
if ((_root.characters.player.alive == true) and (_root.phiding == false)) {
if ((_y < (_root.characters.player._y + 60)) and (_y > (_root.characters.player._y - 60))) {
checkx = _x - (10 * pdir);
checky = _y;
while ((checkx < (_x + 200)) and (checkx > (_x - 200))) {
checkx = checkx + (40 * pdir);
if (_root.map.hitTest(checkx, checky, true)) {
break;
}
if ((checkx < (_root.characters.player._x + 20)) and (checkx > (_root.characters.player._x - 20))) {
if (aware == 0) {
_root.spotted = _root.spotted + 1;
_root.totalspot = _root.totalspot + 1;
}
aware = 50;
break;
}
}
}
}
}
function chaseplayer() {
if (fallv < 3) {
action = "wait";
if ((_root.characters.player._x < (_x + 150)) and (_root.characters.player._x > (_x - 150))) {
action = "walk";
sticktime = 5;
}
if (_root.characters.player._x > _x) {
pdir = 1;
}
if (_root.characters.player._x < _x) {
pdir = -1;
}
if ((_root.arow.time == 0) and (Math.random() < 0.2)) {
_root.slash1_s.start();
action = "attacka";
sticktime = 11;
}
}
}
function checkfloor() {
_y = _y + fallv;
checky = _y + pheight;
checkx = _x;
if (_root.map.hitTest(checkx, checky, true)) {
while (_root.map.hitTest(checkx, checky - 1, true)) {
_y = _y - 1;
checky = (_y + pheight) - 1;
checkx = _x;
}
if (action == "jump") {
sticktime = 0;
}
if (((action == "dead") or (action == "die")) and (fallv > 3)) {
_root.hitground_s.start();
(gotoAndStop("dead"));// not popped
}
if (((fallv > 3) and (alive == true)) and (action != "die")) {
_root.land_s.start();
action = "duck";
sticktime = 2;
}
fallv = 0;
} else {
fallv = fallv + grav;
if (fallv > 14) {
fallv = 14;
}
if (((fallv > 5) and (alive == true)) and (action != "die")) {
_x = _x + (2 * pdir);
action = "wait";
}
}
}
function checkwalls() {
checky = (_y + pheight) - 5;
checkx = _x + ((15 * pdir) * mdir);
var _local3 = false;
if (_root.map.hitTest(checkx, checky, true)) {
if (action == "jump") {
_local3 = true;
}
if ((action != "die") and (alive == true)) {
action = "marchwait";
}
if (aistyle == "swapper") {
aistyle = "still";
}
if ((fallv > 2) and (_local3 == false)) {
_x = _x - (4 * pdir);
}
pdir = pdir * -1;
aware = 0;
}
}
function hitcheck() {
if ((_root.patt > 0) and (action != "die")) {
if ((((_root.patx > (_x - 20)) and (_root.patx < (_x + 20))) and (_root.paty > (_y - 20))) and (_root.paty < (_y + 20))) {
if (aware <= 0) {
_root.uh_s.start();
} else {
_root.gethit_s.start();
}
_root.bloods.newblood(_x, _y, pdir);
_root.bloods.newblood(_x, _y, pdir);
_root.bloods.newblood(_x, _y, pdir);
_root.bloods.newblood(_x, _y, pdir);
action = "die";
mdir = -1;
sticktime = 8;
_root.kills = _root.kills + 1;
_root.totalkills = _root.totalkills + 1;
if (aware == 0) {
_root.stealthkills = _root.stealthkills + 1;
_root.totalstealth = _root.totalstealth + 1;
if (_root.characters.player.outstand > 0) {
_root.outstanding = true;
}
}
pdir = _root.characters.player.pdir * -1;
}
}
}
function setanim() {
if (action == "wait") {
(gotoAndStop("wait"));// not popped
mdir = 1;
}
if (action == "walk") {
(gotoAndStop("walk"));// not popped
mdir = -1;
checky = (_y + pheight) - 5;
checkx = _x + ((35 * pdir) * mdir);
if (_root.map.hitTest(checkx, checky, true) == false) {
_x = _x - (2 * pdir);
} else {
action = "wait";
}
}
if (action == "march") {
(gotoAndStop("march"));// not popped
mdir = 1;
checky = (_y + pheight) - 5;
checkx = _x + ((25 * pdir) * mdir);
if (_root.map.hitTest(checkx, checky, true) == false) {
_x = _x + (1.5 * pdir);
} else {
action = "marchwait";
pdir = pdir * -1;
}
}
if (action == "duck") {
(gotoAndStop("duck"));// not popped
mdir = 1;
}
if (action == "marchwait") {
(gotoAndStop("marchwait"));// not popped
mdir = 1;
}
if (action == "die") {
if (fallv > 3) {
(gotoAndStop("deadfall"));// not popped
} else {
(gotoAndStop("die"));// not popped
}
_x = _x - (3 * pdir);
if (sticktime == 1) {
alive = false;
}
mdir = -1;
}
if (action == "attacka") {
(gotoAndStop("attacka"));// not popped
if (sticktime == 3) {
_root.arow = new arro(_x + (15 * pdir), _y - 10, pdir);
}
mdir = 1;
}
}
function onEnterFrame() {
if (alive == true) {
_root.alldead = false;
if (_root.characters.player.alive == false) {
aware = 0;
}
if (sticktime <= 0) {
if (aware <= 0) {
mainai();
lookcheckpoints();
lookplayer();
}
if (aware > 0) {
chaseplayer();
lookplayer();
}
}
if (sticktime > 0) {
sticktime = sticktime - 1;
}
if (aware > 0) {
aware = aware - 1;
}
_xscale = 70 * pdir;
checkfloor();
if (action == "die") {
checkwalls();
}
hitcheck();
setanim();
} else {
(gotoAndStop("dead"));// not popped
if (fallv > 2) {
(gotoAndStop("deadfall"));// not popped
if (Math.random() > 0.8) {
_root.blood.newblood((_x + 5) - (Math.random() * 10), _y, 0);
}
}
mdir = -1;
action = "dead";
checkfloor();
}
}
var pdir = 1;
var mdir = 1;
var action = "marchwait";
var fallv = 0;
var pheight = 26;
var grav = 2.4;
var sticktime = 0;
var aware = 0;
var alive = true;
var aistyle = "swapper";
var swaptime = 0;
}
Symbol 344 MovieClip [__Packages.arro] Frame 0
class arro
{
var my_mc, x, y, xs, ys;
function arro (nax, nay) {
my_mc = _root.arrowlayer.attachMovie("arrow", "arrow", 1);
x = nax;
y = nay;
var _local3 = x - _root.characters.player._x;
var _local4 = Math.sqrt(Math.abs(_local3));
xs = ((_local4 * -0.7) * _local3) / Math.abs(_local3);
ys = (-1 * _local4) * 0.7;
time = 30;
}
function kill() {
removeMovieClip(my_mc);
time = 0;
}
function advance() {
if (time > 0) {
time = time + -1;
}
if (time <= 0) {
kill();
}
ys = ys + 1;
x = x + xs;
y = y + ys;
my_mc._x = x;
my_mc._y = y;
my_mc._rotation = _root.angTo(0, 0, xs, ys);
if (time < 10) {
my_mc._alpha = time * 10;
}
if (_root.map.hitTest(x, y, true)) {
kill();
}
}
var time = 0;
}
Symbol 345 MovieClip [__Packages.loopsound] Frame 0
class loopsound extends Sound
{
var attachSound, start;
function loopsound (soundname) {
super();
attachSound(soundname);
start();
}
function onSoundComplete() {
start();
}
}
Symbol 346 MovieClip [__Packages.bloodhandler] Frame 0
class bloodhandler extends Array
{
var i, splice;
function bloodhandler () {
super();
this[0] = "SLOT ZERO: NOT USED";
i = 1;
while (i <= maxbloods) {
this[i] = undefined;
i++;
}
}
function newblood(nbx, nby, nbd) {
i = 1;
while (i <= maxbloods) {
if ((this[i] == undefined) or (this[i].time < 20)) {
break;
}
i++;
}
if (i <= maxbloods) {
splice(i, 1, new blood(nbx, nby, nbd, i));
}
}
function killblood(kbn) {
this[kbn].kill();
this[kbn] = undefined;
}
function advance() {
i = 1;
while (i <= maxbloods) {
if (this[i] != undefined) {
this[i].advance();
if (this[i].time <= 0) {
killblood(i);
}
}
i++;
}
}
var maxbloods = 20;
}
Symbol 347 MovieClip [__Packages.blood] Frame 0
class blood
{
var my_mc, rspeed, time, x, y, xspeed, yspeed;
function blood (nbx, nby, nbd, nbn) {
my_mc = _root.bloodlayer.attachMovie("blood", "blood_" + nbn, nbn);
rspeed = (Math.random() * 30) - 15;
time = 50;
x = nbx;
y = nby;
xspeed = (nbd * Math.random()) * 4;
yspeed = 1 - (Math.random() * 10);
my_mc._rotation = Math.random() * 360;
}
function kill() {
removeMovieClip(my_mc);
}
function advance() {
yspeed = yspeed + 0.5;
x = x + xspeed;
y = y + yspeed;
my_mc._x = x;
my_mc._y = y;
my_mc._rotation = my_mc._rotation + rspeed;
time = time + -2;
my_mc._alpha = time * 2;
}
}
Symbol 324 MovieClip Frame 1
function onPress() {
_root.debug = false;
_root.gotoAndStop("game");
}
Symbol 326 MovieClip Frame 1
function onPress() {
_parent.gotoAndStop("help");
}
Symbol 328 MovieClip Frame 1
function onPress() {
_parent.gotoAndStop("about");
}
Symbol 330 MovieClip Frame 1
function onPress() {
if (_quality != "LOW") {
_quality = "LOW";
} else {
_quality = "HIGH";
}
}
Symbol 336 MovieClip Frame 1
function onPress() {
_parent.gotoAndStop("main");
}
Symbol 339 MovieClip Frame 1
stop();
music = new loopsound("menumusic");