Frame 1
showBlood = true;
showTrails = false;
MENU = new ContextMenu();
MENU.hideBuiltInItems();
_root.menu = MENU;
var debug = true;
var gameID = 0;
var gameName = "advancedninja";
stop();
fscommand ("showmenu", "false");
prel.onEnterFrame = function () {
prel.procent.text = Math.ceil((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
prel.gotoAndStop(prel.procent.text);
if (Number(prel.procent.text) > 99) {
play();
delete this.onEnterFrame;
}
};
Frame 2
stop();
Frame 3
if (!okToPlay) {
gotoAndStop (2);
}
Frame 4
var myLevel = {};
var Verts = new Array();
var Props = new Array();
keys1 = new Object();
keys1.k_left = 65;
keys1.k_right = 68;
keys1.k_up = 87;
keys1.k_down = 83;
keys2 = new Object();
keys2.k_left = 81;
keys2.k_right = 68;
keys2.k_up = 90;
keys2.k_down = 83;
keys = keys1;
function init() {
constraints = [];
disConstraints = [];
pp1 = {x:xxx, y:ypos + (h_dis * 1), vx:0, vy:0, r:17, d:0};
pp2 = {x:xxx + www, y:ypos + (h_dis * 1), vx:0, vy:0, r:17, d:0};
BStart = {gfx:Button_Start, points:[pp1, pp2]};
constraints.push({p1:pp1, p2:pp2, len:118, bp:100});
pp3 = {x:xxx, y:ypos + (h_dis * 2), vx:0, vy:0, r:17, d:0};
pp4 = {x:xxx + www, y:ypos + (h_dis * 2), vx:0, vy:0, r:17, d:0};
BLevel = {gfx:Button_LevelEdit, points:[pp3, pp4]};
constraints.push({p1:pp3, p2:pp4, len:118, bp:100});
pp5 = {x:xxx, y:ypos + (h_dis * 3), vx:0, vy:0, r:17, d:0};
pp6 = {x:xxx + www, y:ypos + (h_dis * 3), vx:0, vy:0, r:17, d:0};
BInstruct = {gfx:Button_Instruct, points:[pp5, pp6]};
constraints.push({p1:pp5, p2:pp6, len:118, bp:100});
pp7 = {x:xxx, y:ypos + (h_dis * 4), vx:0, vy:0, r:17, d:0};
pp8 = {x:xxx + www, y:ypos + (h_dis * 4), vx:0, vy:0, r:17, d:0};
BCredits = {gfx:Button_Credits, points:[pp7, pp8]};
constraints.push({p1:pp7, p2:pp8, len:118, bp:100});
disConstraints.push({p1:{x:xxx, y:100, vx:0, vy:0, s:true}, p2:pp1, len:50, bp:50});
disConstraints.push({p1:{x:(xxx + www) + 18, y:100, vx:0, vy:0, s:true}, p2:pp2, len:50, bp:50});
disConstraints.push({p1:pp1, p2:pp3, len:h_dis, bp:50});
disConstraints.push({p1:pp2, p2:pp4, len:h_dis, bp:50});
disConstraints.push({p1:pp3, p2:pp5, len:h_dis, bp:50});
disConstraints.push({p1:pp4, p2:pp6, len:h_dis, bp:50});
disConstraints.push({p1:pp5, p2:pp7, len:h_dis, bp:50});
disConstraints.push({p1:pp6, p2:pp8, len:h_dis, bp:50});
buttons = [BStart, BLevel, BInstruct, BCredits];
}
function PE_Clear() {
delete onEnterFrame;
points = [];
constraints = [];
disConstraints = [];
}
stop();
game_speed = 0.8;
time_step = game_speed;
ts = time_step;
grav = 0.5;
alpha = (Math.PI/180);
_root.createEmptyMovieClip("draw", _root.getNextHighestDepth());
var gf = (new flash.filters.GlowFilter(16777215, 100, 20, 20, 100, 100, false, false));
draw.filters = [new flash.filters.GlowFilter()];
constraints = [];
disConstraints = [];
dragOb = undefined;
xpos = 261;
ypos = 121;
h_dis = 38;
xxx = 205;
www = 100;
init();
onEnterFrame = function () {
draw.clear();
i = 0;
while (i < buttons.length) {
j = 0;
while (j < buttons[i].points.length) {
p = buttons[i].points[j];
p.vy = p.vy + grav;
p.x = p.x + p.vx;
p.y = p.y + p.vy;
if ((p.y + p.r) > 400) {
p.vy = -Math.abs(p.vy * 0.5);
p.vx = p.vx * 0.9;
p.y = 400 - p.r;
}
if ((p.y - p.r) < 0) {
p.vy = Math.abs(p.vy * 0.5);
p.vx = p.vx * 0.9;
p.y = p.r;
}
if ((p.x + p.r) > 500) {
p.vx = -Math.abs(p.vx * 0.4);
p.vy = p.vy * 0.8;
p.x = 500 - p.r;
}
if ((p.x - p.r) < 0) {
p.vx = Math.abs(p.vx * 0.4);
p.vy = p.vy * 0.8;
p.x = p.r;
}
j++;
}
buttons[i].gfx._rotation = Math.atan2(buttons[i].points[1].y - buttons[i].points[0].y, buttons[i].points[1].x - buttons[i].points[0].x) / alpha;
buttons[i].gfx._x = buttons[i].points[0].x;
buttons[i].gfx._y = buttons[i].points[0].y;
i++;
}
i = 0;
while (i < constraints.length) {
p1 = constraints[i].p1;
p2 = constraints[i].p2;
len = constraints[i].len;
bp = constraints[i].bp;
xd = (p2.x + p2.vx) - (p1.x + p1.vx);
yd = (p2.y + p2.vy) - (p1.y + p1.vy);
dis = Math.sqrt((xd * xd) + (yd * yd));
force = dis - len;
p1.vx = p1.vx + (((force * xd) / dis) / 2);
p1.vy = p1.vy + (((force * yd) / dis) / 2);
p2.vx = p2.vx - (((force * xd) / dis) / 2);
p2.vy = p2.vy - (((force * yd) / dis) / 2);
i++;
}
i = 0;
while (i < disConstraints.length) {
p1 = disConstraints[i].p1;
p2 = disConstraints[i].p2;
len = disConstraints[i].len;
bp = disConstraints[i].bp;
xd = (p2.x + p2.vx) - (p1.x + p1.vx);
yd = (p2.y + p2.vy) - (p1.y + p1.vy);
dis = Math.sqrt((xd * xd) + (yd * yd));
force = dis - len;
if (dis > len) {
if (Math.abs(force) > bp) {
disConstraints.splice(i, 1);
}
if (p1.s != true) {
p1.vx = p1.vx + (((force * xd) / dis) / 2);
p1.vy = p1.vy + (((force * yd) / dis) / 2);
}
p2.vx = p2.vx - (((force * xd) / dis) / 2);
p2.vy = p2.vy - (((force * yd) / dis) / 2);
}
draw.lineStyle(5, 0, 50);
draw.moveTo(p1.x, p1.y);
draw.lineTo(p2.x, p2.y);
i++;
}
if (dragOb != undefined) {
i = 0;
while (i < dragOb.points.length) {
p = dragOb.points[i];
xd = (p.x + p.vx) - _xmouse;
yd = (p.y + p.vy) - _ymouse;
dis = Math.sqrt((xd * xd) + (yd * yd));
force = dis - p.d;
if (force > 1) {
p.vx = p.vx - ((xd / dis) * force);
p.vy = p.vy - ((yd / dis) * force);
}
i++;
}
}
};
onMouseDown = function () {
i = 0;
while (i < buttons.length) {
button = buttons[i];
if (button.gfx.hitTest(_xmouse, _ymouse, true)) {
xd = _xmouse - button.points[0].x;
yd = _ymouse - button.points[0].y;
button.points[0].d = Math.sqrt((xd * xd) + (yd * yd));
xd = _xmouse - button.points[1].x;
yd = _ymouse - button.points[1].y;
button.points[1].d = Math.sqrt((xd * xd) + (yd * yd));
dragOb = button;
return;
}
i++;
}
};
onMouseUp = function () {
dragOb = undefined;
};
Instance of Symbol 283 MovieClip in Frame 4
on (release) {
_root.init();
}
Instance of Symbol 317 MovieClip [TMP6pbk6uzm9i] in Frame 6
//component parameters
onClipEvent (construct) {
gameID = 0;
}
Instance of Symbol 323 MovieClip in Frame 7
on (release) {
getURL ("http://www.pillowbasher.com", "_blank");
}
Frame 8
function Editor_Init() {
Dbg = _root.createEmptyMovieClip("Dbg", _root.getNextHighestDepth());
Dverts = _root.createEmptyMovieClip("Dverts", _root.getNextHighestDepth());
frame = _root.createEmptyMovieClip("frame", _root.getNextHighestDepth());
frame.lineStyle(0);
frame.moveTo(0, 0);
frame.lineTo(1000, 0);
frame.lineTo(1000, 1000);
frame.lineTo(0, 1000);
frame.lineTo(0, 0);
startPos.swapDepths(_root.getNextHighestDepth());
exitPos.swapDepths(_root.getNextHighestDepth());
check1.swapDepths(_root.getNextHighestDepth());
check2.swapDepths(_root.getNextHighestDepth());
}
function Editor_End(goto, edit) {
i = 0;
while (i < Cprops.length) {
Cprops[i].removeMovieClip();
i++;
}
Cprops = [];
myLevel = {polys:Verts, props:Props, sp:{x:startPos._x, y:startPos._y}, ep:{x:exitPos._x, y:exitPos._y}, c1:{x:check1._x, y:check1._y}, c2:{x:check2._x, y:check2._y}};
frame.removeMovieClip();
mousePointer.removeMovieClip();
Dverts.removeMovieClip();
Dbg.removeMovieClip();
startPos.removeMovieClip();
exitPos.removeMovieClip();
check1.removeMovieClip();
check2.removeMovieClip();
delete onEnterFrame;
delete onMouseDown;
delete onMouseUp;
_interface.removeMovieClip();
Mouse.show();
editMode = edit;
_root.gotoAndStop(goto);
}
function reDraw(view) {
Dverts.clear();
Dbg.clear();
if (myLevel.sp.x != undefined) {
startPos._visible = true;
startPos._x = myLevel.sp.x;
startPos._y = myLevel.sp.y;
exitPos._visible = true;
exitPos._x = myLevel.ep.x;
exitPos._y = myLevel.ep.y;
check1._visible = true;
check1._x = myLevel.c1.x;
check1._y = myLevel.c1.y;
check2._visible = true;
check2._x = myLevel.c2.x;
check2._y = myLevel.c2.y;
}
i = 0;
while (i < Verts.length) {
vert = Verts[i];
if (vert.mat == 3) {
dl = Dbg;
} else {
dl = Dverts;
}
if (view == 0) {
dl.beginFill(vert.fcol, 100);
dl.lineStyle(vert.linet, vert.col, vert.linea);
} else if (view == 1) {
if (vert.mat == 0) {
dl.beginFill(vert.fcol, 0);
dl.lineStyle(0, vert.col, 100);
} else if (vert.mat == 1) {
dl.beginFill(0, 0);
dl.lineStyle(0, vert.col, 50);
} else if (vert.mat == 2) {
dl.beginFill(16711680, 0);
dl.lineStyle(0, 16711680, 100);
} else if (vert.mat == 3) {
dl.beginFill(0, 10);
dl.lineStyle(0, vert.col, 50);
}
}
dl.moveTo(vert.p1.x, vert.p1.y);
dl.lineTo(vert.p2.x, vert.p2.y);
dl.lineTo(vert.p3.x, vert.p3.y);
dl.lineTo(vert.p1.x, vert.p1.y);
dl.endFill();
i++;
}
i = 0;
while (i < Props.length) {
e = _root.attachMovie(Props[i].t, Props[i].t, _root.getNextHighestDepth(), {_x:Props[i].x, _y:Props[i].y});
Cprops.push(e);
i++;
}
}
function clearAll() {
Dverts.clear();
Dbg.clear();
Verts = [];
i = 0;
while (i < Cprops.length) {
Cprops[i].removeMovieClip();
i++;
}
Cprops = [];
startPos._visible = false;
exitPos._visible = false;
check1._visible = false;
check2._visible = false;
}
function onMouseDown() {
if (!_interface.hitTest(_xmouse, _ymouse, true)) {
if (Key.isDown(67)) {
e = _root.attachMovie("elevator", "elevator", _root.getNextHighestDepth(), {_x:xmouse, _y:ymouse});
Cprops.push(e);
Props.push({t:"elevator", x:xmouse, y:ymouse});
} else if (vstep == 0) {
vert = {p1:{x:xmouse, y:ymouse}};
vstep = 1;
} else if (vstep == 1) {
vert.p2 = {x:xmouse, y:ymouse};
vstep = 2;
} else if (vstep == 2) {
clear();
vert.p3 = {x:xmouse, y:ymouse};
lineA = 100;
lineT = _interface.lthick.val / 5;
if (lineT == 0) {
lineA = 0;
}
if (selMat == 3) {
dl = Dbg;
} else {
dl = Dverts;
}
if (selView == 0) {
dl.lineStyle(lineT, 0, lineA);
dl.beginFill(selCol, 100);
} else if (selView == 1) {
dl.lineStyle(0, 0, lineA);
dl.beginFill(selCol, 0);
}
dl.moveTo(vert.p1.x, vert.p1.y);
dl.lineTo(vert.p2.x, vert.p2.y);
dl.lineTo(xmouse, ymouse);
dl.lineTo(vert.p1.x, vert.p1.y);
dl.endFill();
vstep = 0;
Verts.push({p1:vert.p1, p2:vert.p2, p3:vert.p3, fcol:selCol, col:0, linet:lineT, linea:lineA, mat:selMat});
reDraw(_root.selView);
}
}
}
function testLevel() {
if (startPos._visible) {
if (exitPos._visible) {
if ((check1._visible == check2._visible) == 1) {
Editor_End("Game", true);
}
}
}
}
function saveLevel() {
myLevel = {polys:Verts, props:Props, sp:{x:startPos._x, y:startPos._y}, ep:{x:exitPos._x, y:exitPos._y}, c1:{x:check1._x, y:check1._y}, c2:{x:check2._x, y:check2._y}};
so.data.level = myLevel;
}
function loadLevel() {
myLevel = so.data.level;
Props = myLevel.props;
Verts = myLevel.polys;
startPos._x = myLevel.sp.x;
startPos._y = myLevel.sp.y;
exitPos._x = myLevel.ep.x;
exitPos._y = myLevel.ep.y;
check1._x = myLevel.c1.x;
check1._y = myLevel.c1.y;
check2._x = myLevel.c2.x;
check2._y = myLevel.c2.y;
reDraw(0);
}
function ImportExport() {
_interface.play();
}
function parseToServer(str, save) {
if (save) {
this.loadVariables(str, this, "POST");
} else {
loadVariables (str, _root, "POST");
SI = setInterval(updateData, 100);
trace("Loading: " + str);
}
}
function updateData() {
trace(levelString);
if (levelString != undefined) {
_interface.saveBox.outputData = levelString;
clearInterval(SI);
}
}
function saveLevelToServer(nam, dat) {
parseToServer((((serverName + "save.php?levelName=") + nam) + "&levelString=") + dat, true);
}
function loadLevelFromServer(nam) {
parseToServer((serverName + "load.php?levelName=") + nam, false);
}
function saveLevelData() {
tex = ((("StartPos:[" + startPos._x) + ",") + startPos._y) + "]";
tex = ((((tex + "ExitPos:[") + exitPos._x) + ",") + exitPos._y) + "]";
tex = ((((tex + "CheckPoint1:[") + check1._x) + ",") + check1._y) + "]";
tex = ((((tex + "CheckPoint2:[") + check2._x) + ",") + check2._y) + "]";
tex = tex + "Polys:";
i = 0;
while (i < Verts.length) {
V = Verts[i];
tex = ((((((((((((((((((((((tex + "(") + V.p1.x) + ",") + V.p1.y) + ",") + V.p2.x) + ",") + V.p2.y) + ",") + V.p3.x) + ",") + V.p3.y) + ",") + V.fcol) + ",") + V.linet) + ",") + V.col) + ",") + V.linea) + ",") + V.mat) + ")";
i++;
}
_interface.saveBox.outputData = tex;
}
function loadLevelData(dat) {
var _local1 = new String(dat);
var _local2 = [];
loadVariable("StartPos:", "[", "]", 0, _local1, startPos);
startPos._visible = true;
loadVariable("ExitPos:", "[", "]", 0, _local1, exitPos);
exitPos._visible = true;
loadVariable("CheckPoint1:", "[", "]", 0, _local1, check1);
check1._visible = true;
loadVariable("CheckPoint2:", "[", "]", 0, _local1, check2);
check2._visible = true;
ff = _local1.indexOf("Polys:", 0);
if (ff != -1) {
i = ff;
while (i < _local1.length) {
si = _local1.indexOf("(", i);
if (si != -1) {
li = _local1.indexOf(")", si);
_local2.push(_local1.substr(si + 1, li - (si + 1)));
i = li;
}
i++;
}
polyList = [];
i = 0;
while (i < _local2.length) {
var _local3 = _local2[i];
l = _local3.split(",");
polyList.push({p1:{x:l[0], y:l[1]}, p2:{x:l[2], y:l[3]}, p3:{x:l[4], y:l[5]}, fcol:l[6], linet:l[7], col:l[8], linea:l[9], mat:l[8]});
i++;
}
Verts = polyList;
reDraw(0);
}
_interface.gotoAndStop(1);
}
function loadVariable(code, sb, lb, si, str, ob) {
ff = str.indexOf(code, si);
if (ff != -1) {
f = str.indexOf(sb, ff);
l = str.indexOf(lb, f);
s = str.substr(f + 1, l - (f + 1));
sa = s.split(",");
ob._x = sa[0];
ob._y = sa[1];
} else {
trace("Var doesnt exist");
}
}
var so = SharedObject.getLocal("SAVEDGAME");
editMode = true;
vstep = 0;
cam = {x:0, y:0, s:10};
selMat = 0;
selMatM = 3;
selView = 0;
selViewM = 1;
CZ = 0;
Mouse.hide();
startPos.stop();
check1.stop();
check2.stop();
startPos._visible = false;
exitPos._visible = false;
check1._visible = false;
check2._visible = false;
Cprops = [];
rgbToHex = function (r, g, b) {
return(((r << 16) | (g << 8)) | b);
};
lvDat = _root.createEmptyMovieClip("lvDat", _root.getNextHighestDepth());
onEnterFrame = function () {
if (Key.isDown(16)) {
xmouse = _xmouse;
ymouse = _ymouse;
} else {
xmouse = Math.round(_xmouse / 10) * 10;
ymouse = Math.round(_ymouse / 10) * 10;
}
mousePointer._x = xmouse;
mousePointer._y = ymouse;
if (vstep == 1) {
clear();
lineStyle(0);
moveTo(vert.p1.x, vert.p1.y);
lineTo(xmouse, ymouse);
} else if (vstep == 2) {
clear();
lineStyle(0);
beginFill(selCol, 20);
moveTo(vert.p1.x, vert.p1.y);
lineTo(vert.p2.x, vert.p2.y);
lineTo(xmouse, ymouse);
lineTo(vert.p1.x, vert.p1.y);
endFill();
}
if (Key.isDown(37)) {
cam.x = cam.x - cam.s;
} else if (Key.isDown(39)) {
cam.x = cam.x + cam.s;
}
if (Key.isDown(38)) {
cam.y = cam.y - cam.s;
} else if (Key.isDown(40)) {
cam.y = cam.y + cam.s;
}
if (Key.isDown(83)) {
startPos._visible = true;
startPos._x = xmouse;
startPos._y = ymouse;
}
if (Key.isDown(69)) {
exitPos._visible = true;
exitPos._x = xmouse;
exitPos._y = ymouse;
}
if (Key.isDown(90)) {
check1._visible = true;
check1._x = xmouse;
check1._y = ymouse;
}
if (Key.isDown(88)) {
check2._visible = true;
check2._x = xmouse;
check2._y = ymouse;
}
if (Key.isDown(17) && (Key.isDown(90))) {
if (CZ == 0) {
if (vstep > 0) {
vstep--;
clear();
}
CZ = 1;
}
} else {
CZ = 0;
}
if (cam.x > 750) {
cam.x = 750;
}
if (cam.x < -250) {
cam.x = -250;
}
if (cam.y > 800) {
cam.y = 800;
}
if (cam.y < -250) {
cam.y = -250;
}
_x = (-cam.x);
_y = (-cam.y);
_interface._x = cam.x;
_interface._y = cam.y;
_interface.swapDepths(_root.getNextHighestDepth());
mousePointer.swapDepths(_root.getNextHighestDepth());
_interface.polyCount = "Polys: " + Verts.length;
};
Editor_Init();
reDraw(_root.selView);
Instance of Symbol 427 MovieClip "_interface" in Frame 8
onClipEvent (enterFrame) {
if (this.hitTest(_xmouse - _root._x, _ymouse - _root._y, true)) {
Mouse.show();
_root.mousePointer._visible = false;
} else {
Mouse.hide();
_root.mousePointer._visible = true;
}
}
Frame 9
function getDis(ob1, ob2) {
dx = ob2._x - ob1._x;
dy = ob2._y - ob1._y;
return(Math.sqrt((dx * dx) + (dy * dy)));
}
function getDir(ob1, ob2) {
return(Math.atan2(ob2._y - ob1._y, ob2._x - ob1._x) / alpha);
}
function mouseDir(ob) {
return((Math.atan2(_ymouse - ob._y, _xmouse - ob._x) / alpha) + 90);
}
function hitground(x, y) {
if (level.collision.hitTest(x, y, true) && (!level.collision.lava.hitTest(x, y, true))) {
return(1);
}
return(0);
}
function loadLevelData(levelDat) {
level_bg.removeMovieClip();
level_bg = _root.createEmptyMovieClip("level_bg", _root.getNextHighestDepth());
check1.swapDepths(_root.getNextHighestDepth());
check2.swapDepths(_root.getNextHighestDepth());
exit.swapDepths(_root.getNextHighestDepth());
player.swapDepths(_root.getNextHighestDepth());
hook_rope.swapDepths(_root.getNextHighestDepth());
DRender.swapDepths(_root.getNextHighestDepth());
level.removeMovieClip();
level = _root.createEmptyMovieClip("level", _root.getNextHighestDepth());
level.createEmptyMovieClip("collision", level.getNextHighestDepth());
level.collision.createEmptyMovieClip("death", level.collision.getNextHighestDepth());
level.cacheAsBitmap = true;
i = 0;
while (i < levelDat.props.length) {
var _local2 = levelDat.props[i];
level.collision.attachMovie(_local2.t, _local2.t, level.collision.getNextHighestDepth(), {_x:_local2.x, _y:_local2.y});
i++;
}
i = 0;
while (i < levelDat.polys.length) {
poly = levelDat.polys[i];
if (poly.mat == 0) {
dl = level.collision;
} else if (poly.mat == 1) {
dl = level;
} else if (poly.mat == 2) {
dl = level.collision.death;
} else if (poly.mat == 3) {
dl = level_bg;
}
dl.lineStyle(poly.linet, poly.col, poly.linea);
dl.beginFill(poly.fcol, 100);
dl.moveTo(poly.p1.x, poly.p1.y);
dl.lineTo(poly.p2.x, poly.p2.y);
dl.lineTo(poly.p3.x, poly.p3.y);
dl.lineTo(poly.p1.x, poly.p1.y);
dl.endFill();
i++;
}
lh = level._height;
lw = level._width;
l_sp = {x:levelDat.sp.x, y:levelDat.sp.y};
l_ep = {x:levelDat.ep.x, y:levelDat.ep.y};
check1._visible = 1;
check1._x = levelDat.c1.x;
check1._y = levelDat.c1.y;
check1.gotoAndStop(1);
check2._visible = 1;
check2._x = levelDat.c2.x;
check2._y = levelDat.c2.y;
check2.gotoAndStop(1);
exit._x = l_ep.x;
exit._y = l_ep.y;
output.swapDepths(_root.getNextHighestDepth());
}
function generateLevel() {
d = level.collision;
d.lineStyle(0);
exit._x = 1000 - (exit._width / 2);
exit._y = 1000;
i = 0;
while (i < 50) {
d.beginFill(16777215, 100);
x = random(900) + 50;
y = random(900) + 50;
r = random(360);
num = 4 + random(2);
j = 0;
while (j < num) {
r = r + (180 / num);
s = random(20) + 40;
if (j == 0) {
d.moveTo(x + (Math.cos(r * alpha) * s), y + (Math.sin(r * alpha) * s));
} else {
d.lineTo(x + (Math.cos(r * alpha) * s), y + (Math.sin(r * alpha) * s));
}
j++;
}
d.endFill();
i++;
}
}
function loadLevel(num) {
_root.stopAllSounds();
level_bg.removeMovieClip();
level_bg = _root.attachMovie(("level" + num) + "_bg", "level_bg", _root.getNextHighestDepth());
check1.swapDepths(_root.getNextHighestDepth());
check2.swapDepths(_root.getNextHighestDepth());
exit.swapDepths(_root.getNextHighestDepth());
DRender.swapDepths(_root.getNextHighestDepth());
player.swapDepths(_root.getNextHighestDepth());
hook_rope.swapDepths(_root.getNextHighestDepth());
level.removeMovieClip();
level = _root.attachMovie("level" + num, "level", _root.getNextHighestDepth());
lh = level._height;
lw = level._width;
l_sp = {x:level.sp._x, y:level.sp._y};
l_ep = {x:level.ep._x, y:level.ep._y};
if (level.cp1._x != undefined) {
check1._visible = 1;
check1._x = level.cp1._x;
check1._y = level.cp1._y;
check1.gotoAndStop(1);
} else {
check1._visible = 0;
check1._x = -500;
}
if (level.cp2._x != undefined) {
check2._visible = 1;
check2._x = level.cp2._x;
check2._y = level.cp2._y;
check2.gotoAndStop(1);
} else {
check2._visible = 0;
check2._x = -500;
}
exit._x = l_ep.x;
exit._y = l_ep.y;
bmpdt.fillRect(bmpdt.rectangle, 0);
bmp.swapDepths(_root.getNextHighestDepth());
output.swapDepths(_root.getNextHighestDepth());
}
function changeLevel(num) {
if (levelN > 1) {
playerTime = playerTime + Math.floor((getTimer() - timeS) / 1000);
playerDeaths = playerDeaths + deaths;
if (deaths != 0) {
if (deaths < 2) {
playerScore = playerScore + Math.round(10000 - (playerTime * (deaths / 2)));
} else {
playerScore = playerScore + Math.round(10000 - (playerTime * deaths));
}
} else {
playerScore = playerScore + Math.round(10000 - playerTime);
}
if (playerScore < 0) {
playerScore = 0;
}
}
if (num > level_amount) {
unloadGame();
_root.gotoAndStop("game_over");
} else {
i = 0;
while (i < blood.length) {
blood[i].removeMovieClip();
i++;
}
blood = [];
reset();
loadLevel(num);
deaths = 0;
timeS = getTimer();
_Interface.levelNum = num;
levelN = num;
}
}
function unloadGame() {
delete onEnterFrame;
delete onMouseDown;
delete onMouseUp;
grap1.removeMovieClip();
player.removeMovieClip();
_Interface.removeMovieClip();
bmpdt = null;
bmp.removeMovieClip();
Splayer.removeMovieClip();
level_bg.removeMovieClip();
level.removeMovieClip();
check1.removeMovieClip();
check2.removeMovieClip();
exit.removeMovieClip();
DRender.removeMovieClip();
hook_rope.removeMovieClip();
output.removeMovieClip();
ninjaTrail.removeMovieClip();
i = 0;
while (i < blood.length) {
blood[i].removeMovieClip();
i++;
}
blood = null;
PE_Clear();
clearInterval(fpsc);
_y = 0;
_x = 0;
_root.stopAllSounds();
}
function respawn() {
grap1.removeMovieClip();
player._x = l_sp.x;
player._y = l_sp.y;
player.vx = 0;
player.vy = 0;
_Interface.respawn._visible = false;
}
function playSound(l) {
var _local2 = new Sound(_root);
_local2.attachSound(l);
_local2.start(0, 1);
}
function updateCamera() {
_x = (_x - Math.round((_x - ((250 - cameraOb._x) - ((_xmouse + _x) - 250))) / 10));
_y = (_y - Math.round((_y - ((200 - cameraOb._y) - ((_ymouse + _y) - 200))) / 10));
if (_x > 0) {
_x = 0;
} else if (_x < -500) {
_x = -500;
}
if (_y > 0) {
_y = 0;
} else if (_y < -600) {
_y = -600;
}
_Interface._x = -_x;
_Interface._y = -_y;
_Interface.swapDepths(_root.getNextHighestDepth());
_Interface.timer = Math.floor((getTimer() - timeS) / 1000);
_Interface.deaths = deaths;
}
function SprayBlood(x, y, d, p, f, t) {
if (showBlood) {
var _local2 = 0;
while (_local2 < p) {
blood_c++;
bbb = _root.attachMovie("Blood", "blood" + blood_c, _root.getNextHighestDepth());
blood.push(bbb);
if (f != undefined) {
bbb.gotoAndStop(f);
bbb.rs = Math.random() * 5;
}
bbb.ro = d;
bbb.spd = 1 + (Math.random() * 10);
bbb.ro = bbb.ro + ((Math.random() * 20) - (Math.random() * 20));
bbb.vx = Math.cos(((bbb.ro - 90) * Math.PI) / 180) * bbb.spd;
bbb.vy = Math.sin(((bbb.ro - 90) * Math.PI) / 180) * bbb.spd;
bbb.col = 16711680 /* 0xFF0000 */;
bbb._x = x;
bbb._y = y;
if (t == undefined) {
t = 1;
}
bbb.t = t;
_local2++;
}
}
}
function UpdateBlood() {
i = 0;
while (i < blood.length) {
b = blood[i];
with (b) {
_x = _x + vx;
_y = _y + vy;
vy = vy + gravity;
vx = vx * 0.94;
vy = vy * 0.94;
s = Math.sqrt((vx * vx) + (vy * vy));
if (_currentframe == 1) {
if (t == 1) {
clear();
lineStyle(s / 3, 4294901760);
moveTo(0, 0);
lineTo((-vx) * 3, (-vy) * 3);
}
if (level.death.hitTest(_x, _y + 2, true)) {
b.removeMovieClip();
blood.splice(i, 1);
}
if (hitground(_x, _y) && (!level.collision.noColl.hitTest(_x, _y, true))) {
createGround(bmpdt, _x, _y, s / 3, 4294901760);
b.removeMovieClip();
blood.splice(i, 1);
}
} else {
_rotation = _rotation + rs;
if (hitground(_x, _y + 1)) {
vy = -Math.abs(vy * 0.4);
rs = rs * 0.7;
while (hitground(_x, _y + 1)) {
_y = _y - 0.5;
}
} else if (hitground(_x, _y - 2)) {
vy = Math.abs(vy * 0.4);
_y = _y + 1;
}
if (hitground(_x + 2, _y)) {
vx = -Math.abs(vx * 0.4);
while (hitground(_x + 2, _y)) {
_x = _x - 0.5;
}
} else if (hitground(_x - 2, _y)) {
vx = Math.abs(vx * 0.4);
while (hitground(_x - 2, _y)) {
_x = _x + 0.5;
}
}
if (level.death.hitTest(_x, _y + 2, true)) {
b.removeMovieClip();
blood.splice(i, 1);
}
if (((s < 0.5) && (hitground(_x, _y + 2))) && (!level.collision.noColl.hitTest(_x, _y + 2, true))) {
b.br._x = b.br._x + _x;
b.br._y = b.br._y + _y;
bmpdt.draw(b);
b.removeMovieClip();
blood.splice(i, 1);
}
}
if (s < 0.2) {
if (bbb._currentframe == 1) {
b.removeMovieClip();
blood.splice(i, 1);
}
}
}
i++;
}
}
function createGround(bmd, xp, yp, r, c) {
x = -r;
while (x < r) {
y = -r;
while (y < r) {
dis = Math.sqrt((x * x) + (y * y));
if (dis < r) {
bmd.setPixel32(xp + x, yp + y, c);
}
y++;
}
x++;
}
}
function predictRope() {
hook_rope.clear();
hook_rope.lineStyle(2, 16711680);
dir = Math.atan2(_ymouse - player._y, _xmouse - player._x) / alpha;
pp = {_x:player._x, _y:player._y, h:0, r:1, len:120};
pp.vx = (ropeSpd * Math.cos(dir * alpha)) + player.vx;
pp.vy = (ropeSpd * Math.sin(dir * alpha)) + player.vy;
it = 100;
hook_rope.moveTo(pp._x, pp._y);
while (it > 0) {
pp._x = pp._x + (pp.vx * _root.ts);
pp._y = pp._y + (pp.vy * _root.ts);
if (hitground(pp._x, pp._y)) {
ospd = Math.sqrt((pp.vx * pp.vx) + (pp.vy * pp.vy));
while (hitground(pp._x, pp._y)) {
pp._x = pp._x - (pp.vx / ospd);
pp._y = pp._y - (pp.vy / ospd);
}
if (hitground(pp._x, pp._y + 1)) {
it = 0;
} else {
if (hitground(pp._x - 1, pp._y)) {
pp.vx = Math.abs(pp.vx) * 0.4;
pp.vy = 0;
} else if (hitground(pp._x + 1, pp._y)) {
pp.vx = (-Math.abs(pp.vx)) * 0.4;
pp.vy = 0;
}
if (hitground(pp._x, pp._y - 1)) {
pp.vy = Math.abs(pp.vy) * 0.4;
pp.vx = 0;
}
}
} else {
pp.vy = pp.vy + (grav * _root.ts);
}
xd = player._x - (pp._x + (pp.vx * _root.ts));
yd = player._y - (pp._y + (pp.vy * _root.ts));
dis = Math.sqrt((xd * xd) + (yd * yd));
if (dis >= pp.len) {
force = (dis - pp.len) / 5;
pp.vx = pp.vx + ((force * xd) / dis);
pp.vy = pp.vy + ((force * yd) / dis);
}
hook_rope.lineTo(pp._x, pp._y);
it--;
}
hook_rope.lineStyle(10, 16750899);
hook_rope.moveTo(pp._x, pp._y);
hook_rope.lineTo(pp._x, pp._y + 1);
}
playerScore = 0;
playerDeaths = 0;
playerTime = 0;
blood_c = 0;
function CreatePoint(name, x, y, r) {
_root.attachMovie("point", name, _root.getNextHighestDepth(), {_x:x, _y:y, _width:r * 2, _height:r * 2, vx:0, vy:0, r:r});
points.push(this[name]);
}
function Constrain(p1, p2, bp) {
xd = p2._x - p1._x;
yd = p2._y - p1._y;
dis = Math.sqrt((xd * xd) + (yd * yd));
constraints.push({p1:p1, p2:p2, len:dis, bp:bp});
}
function disConstrain(p1, p2, bp, dis) {
if (dis == undefined) {
xd = p2._x - p1._x;
yd = p2._y - p1._y;
dis = Math.sqrt((xd * xd) + (yd * yd));
}
disConstraints.push({p1:p1, p2:p2, len:dis, bp:bp});
}
function CreateRagdoll(nam, x, y, size, bp) {
xs = (size * player._xscale) / Math.abs(player._xscale);
ys = size;
CreatePoint(nam + "_head", player._x + (player.h._x * xs), player._y + (player.h._y * ys), 12 * size);
this[nam + "_head"].gotoAndStop(2);
this[nam + "_head"]._xscale = this[nam + "_head"]._xscale * (player._xscale / Math.abs(player._xscale));
CreatePoint(nam + "_neck", player._x + (player.n._x * xs), player._y + (player.n._y * ys), 5);
CreatePoint(nam + "_art", player._x + (player.ar1._x * xs), player._y + (player.ar1._y * ys), 5);
CreatePoint(nam + "_arb", player._x + (player.ar2._x * xs), player._y + (player.ar2._y * ys), 5);
CreatePoint(nam + "_alt", player._x + (player.al1._x * xs), player._y + (player.al1._y * ys), 5);
CreatePoint(nam + "_alb", player._x + (player.al2._x * xs), player._y + (player.al2._y * ys), 5);
CreatePoint(nam + "_body", player._x + (player.b._x * xs), player._y + (player.b._y * ys), 5);
CreatePoint(nam + "_lrt", player._x + (player.lr1._x * xs), player._y + (player.lr1._y * ys), 5);
CreatePoint(nam + "_lrb", player._x + (player.lr2._x * xs), player._y + (player.lr2._y * ys), 5);
CreatePoint(nam + "_llt", player._x + (player.ll1._x * xs), player._y + (player.ll1._y * ys), 5);
CreatePoint(nam + "_llb", player._x + (player.ll2._x * xs), player._y + (player.ll2._y * ys), 5);
Constrain(this[nam + "_head"], this[nam + "_neck"], bp * 4);
Constrain(this[nam + "_neck"], this[nam + "_body"], bp * 2);
Constrain(this[nam + "_neck"], this[nam + "_art"], bp);
Constrain(this[nam + "_art"], this[nam + "_arb"], bp);
Constrain(this[nam + "_neck"], this[nam + "_alt"], bp);
Constrain(this[nam + "_alt"], this[nam + "_alb"], bp);
Constrain(this[nam + "_body"], this[nam + "_lrt"], bp);
Constrain(this[nam + "_lrt"], this[nam + "_lrb"], bp);
Constrain(this[nam + "_body"], this[nam + "_llt"], bp);
Constrain(this[nam + "_llt"], this[nam + "_llb"], bp);
this[nam] = new Object();
this[nam].points = [this[nam + "_neck"], this[nam + "_body"], this[nam + "_art"], this[nam + "_arb"], this[nam + "_alt"], this[nam + "_alb"], this[nam + "_lrt"], this[nam + "_lrb"], this[nam + "_llt"], this[nam + "_llb"]];
i = 0;
while (i < this[nam].points.length) {
this[nam].points[i].b = 1;
i++;
}
}
function PE_ApplyForces() {
i = 0;
while (i < points.length) {
p = points[i];
p.vy = p.vy + gravity;
p._y = p._y + (p.vy * ts);
p._x = p._x + (p.vx * ts);
spd = Math.sqrt((p.vx * p.vx) + (p.vy * p.vy));
CR = 1;
if (spd != 0) {
if (hitground(p._x, p._y)) {
dxv = p.vx / spd;
dyv = p.vy / spd;
while (hitground(p._x, p._y)) {
p._x = p._x - dxv;
p._y = p._y - dyv;
}
}
} else {
trace("EEE");
}
if (hitground(p._x + p.vx, (p._y + p.vy) + CR)) {
p.vx = p.vx * friction;
p.vy = -Math.abs(p.vy * bounce);
checkHit(p);
if (showBlood) {
if ((p == rag1_head) && (spd > 10)) {
SprayBlood(p._x, p._y, 0, 5, 2);
points.splice(i, 1);
ii = 0;
while (ii < constraints.length) {
c = constraints[ii];
if (c.p1 == p) {
constraints.splice(ii, 1);
}
ii++;
}
rag1_head.removeMovieClip();
break;
}
}
while (hitground(p._x, p._y + CR)) {
p._y = p._y - 0.2;
}
} else if (hitground(p._x + p.vx, (p._y + p.vy) - CR)) {
p.vx = p.vx * friction;
p.vy = Math.abs(p.vy * bounce);
checkHit(p);
while (hitground(p._x, p._y - CR)) {
p._y = p._y + 0.2;
}
}
if (hitground((p._x + p.vx) + CR, p._y + p.vy)) {
p.vy = p.vy * friction;
p.vx = -Math.abs(p.vx * bounce);
checkHit(p);
while (hitground(p._x + CR, p._y)) {
p._x = p._x - 0.2;
}
} else if (hitground((p._x + p.vx) - CR, p._y + p.vy)) {
p.vy = p.vy * friction;
p.vx = Math.abs(p.vx * bounce);
checkHit(p);
while (hitground(p._x - CR, p._y)) {
p._x = p._x + 0.2;
}
}
i++;
}
i = 0;
while (i < constraints.length) {
p1 = constraints[i].p1;
p2 = constraints[i].p2;
len = constraints[i].len;
bp = constraints[i].bp;
dx = (p2._x + p2.vx) - (p1._x + p1.vx);
dy = (p2._y + p2.vy) - (p1._y + p1.vy);
dis = Math.sqrt((dx * dx) + (dy * dy));
dx = dx / dis;
dy = dy / dis;
force = len - dis;
if (Math.abs(force) > 20) {
constraints.splice(i, 1);
}
p1.vx = p1.vx - ((dx * force) / 2);
p1.vy = p1.vy - ((dy * force) / 2);
p2.vx = p2.vx + ((dx * force) / 2);
p2.vy = p2.vy + ((dy * force) / 2);
i++;
}
i = 0;
while (i < disConstraints.length) {
p1 = disConstraints[i].p1;
p2 = disConstraints[i].p2;
len = disConstraints[i].len;
bp = disConstraints[i].bp;
dx = (p2._x + p2.vx) - (p1._x + p1.vx);
dy = (p2._y + p2.vy) - (p1._y + p1.vy);
dis = Math.sqrt((dx * dx) + (dy * dy));
if (dis > len) {
dx = dx / dis;
dy = dy / dis;
force = len - dis;
p1.vx = p1.vx - ((dx * force) / 2);
p1.vy = p1.vy - ((dy * force) / 2);
p2.vx = p2.vx + ((dx * force) / 2);
p2.vy = p2.vy + ((dy * force) / 2);
}
i++;
}
}
function PE_Render(mc) {
mc.clear();
mc.lineStyle(3);
i = 0;
while (i < constraints.length) {
p1 = constraints[i].p1;
p2 = constraints[i].p2;
mc.moveTo(p1._x, p1._y);
mc.lineTo(p2._x, p2._y);
i++;
}
mc.lineStyle(1, 16711680);
i = 0;
while (i < disConstraints.length) {
p1 = constraints[i].p1;
p2 = constraints[i].p2;
mc.moveTo(p1._x, p1._y);
mc.lineTo(p2._x, p2._y);
i++;
}
}
function checkHit(o) {
if (random(3) == 1) {
a = Math.sqrt((o.vx * o.vx) + (o.vy * o.vy));
if (a > 4) {
playSound("splat" + (random(3) + 1));
SprayBlood(o._x, o._y, 0, 2);
}
}
}
function PE_Clear() {
i = 0;
while (i < points.length) {
points[i].removeMovieClip();
i++;
}
points = [];
constraints = [];
disConstraints = [];
}
gravity = 0.3;
bounce = 0.4;
friction = 0.9;
constraints = [];
disConstraints = [];
points = [];
function collision() {
with (player) {
spd = Math.sqrt((vx * vx) + (vy * vy));
ground = 0;
if (player.hitTest(check1) && (check1._currentframe == 1)) {
check1.gotoAndStop(2);
l_sp.x = check1._x;
l_sp.y = check1._y - hr;
}
if (player.hitTest(check2) && (check2._currentframe == 1)) {
check2.gotoAndStop(2);
l_sp.x = check2._x;
l_sp.y = check2._y - hr;
}
if (level.collision.death.hitTest(_x, _y + hr, true)) {
ragdoll();
}
if (level.collision.death.hitTest(_x, _y - hr, true)) {
ragdoll();
}
if (level.collision.death.hitTest(((_x + wr) + vx) + 1, _y + (hr / 2), true)) {
ragdoll();
}
if (level.collision.death.hitTest(((_x - wr) + vx) - 1, _y + (hr / 2), true)) {
ragdoll();
}
if (hitground(_x, _y + hr)) {
ground = 1;
if ((Math.abs(vy) > die_y) && (!RDing)) {
ragdoll();
}
vy = -Math.abs(vy * 0.2);
if (_currentframe != 8) {
vx = vx * 0.8;
}
while (hitground(_x, _y + hr)) {
_y = _y - 0.1;
}
}
if (hitground(_x, _y - hr)) {
if ((Math.abs(vy) > die_y) && (!RDing)) {
ragdoll();
}
vy = Math.abs(vy * 0.2);
while (hitground(_x, _y - hr)) {
_y = _y + 0.5;
}
}
if (hitground((_x - wr) + vx, _y + (hr / 2)) or hitground((_x - wr) + vx, _y - (hr / 2))) {
if ((Math.abs(vx) > 10) && (!RDing)) {
ragdoll();
}
vx = 0;
if (((Key.isDown(keys.k_up) && (Key.isDown(keys.k_right))) && (!ground)) && (vy < 0)) {
vy = -jump_power;
vx = kick_power;
}
while (hitground(_x - wr, _y + (hr / 2)) or hitground(_x - wr, _y - (hr / 2))) {
_x = _x + 0.2;
}
}
if (hitground((_x + wr) + vx, _y + (hr / 2)) or hitground((_x + wr) + vx, _y - (hr / 2))) {
if ((Math.abs(vx) > 10) && (!RDing)) {
ragdoll();
}
vx = 0;
if (((Key.isDown(keys.k_up) && (Key.isDown(keys.k_left))) && (!ground)) && (vy < 0)) {
vy = -jump_power;
vx = -kick_power;
}
while (hitground(_x + wr, _y + (hr / 2)) or hitground(_x + wr, _y - (hr / 2))) {
_x = _x - 0.2;
}
}
ledge = 0;
if (((_xscale > 0) && (hitground((_x + wr) + 2, _y - hr))) && (!hitground((_x + wr) + 2, (_y - hr) - 2))) {
ledge = 1;
vy = 0;
vx = 0;
gotoAndStop(5);
_xscale = ww;
if (Key.isDown(keys.k_left) && (Key.isDown(keys.k_up))) {
vx = -3;
vy = -kick_jump;
} else if (Key.isDown(keys.k_up)) {
vx = 0;
vy = -ledge_jump;
gotoAndStop(6);
}
} else if (((_xscale < 0) && (hitground((_x - wr) - 2, _y - hr))) && (!hitground((_x - wr) - 2, (_y - hr) - 2))) {
ledge = 1;
vy = 0;
vx = 0;
gotoAndStop(5);
_xscale = -ww;
if (Key.isDown(keys.k_right) && (Key.isDown(keys.k_up))) {
vx = 3;
vy = -kick_jump;
} else if (Key.isDown(keys.k_up)) {
vx = 0;
vy = -ledge_jump;
gotoAndStop(6);
}
}
if (exit.hitTest(player)) {
if (editMode) {
reset();
cleanUp();
gotoAndStop("Editor");
} else {
levelN++;
changeLevel(levelN);
reset();
respawn();
}
}
}
}
function ragdoll() {
if (RDing == 0) {
_Interface.respawn._visible = true;
deaths++;
grap1.removeMovieClip();
hook_rope.clear();
CreateRagdoll("rag1", player._x, player._y - player.hr, 1, 500);
rag1_head.vx = player.vx;
rag1_head.vy = player.vy;
i = 0;
while (i < rag1.points.length) {
rag1.points[i]._visible = 0;
rag1.points[i].vx = player.vx;
rag1.points[i].vy = player.vy;
i++;
}
player._visible = 0;
RDing = 1;
}
cameraOb = rag1_neck;
level.swapDepths(_root.getNextHighestDepth());
bmp.swapDepths(_root.getNextHighestDepth());
output.swapDepths(_root.getNextHighestDepth());
}
function reset() {
cameraOb = player;
RDing = 0;
player._visible = 1;
DRender.clear();
PE_Clear();
}
function fpscal() {
_Interface.fps = fpsn;
fpsn = 0;
}
function cleanUp() {
level_bg.removeMovieClip();
check1.removeMovieClip();
check2.removeMovieClip();
exit.removeMovieClip();
player.removeMovieClip();
hook_rope.removeMovieClip();
DRender.removeMovieClip();
level.removeMovieClip();
_Interface.removeMovieClip();
Splayer.removeMovieClip();
ninjaTrail.removeMovieClip();
bmp.removeMovieClip();
i = 0;
while (i < blood.length) {
blood[i].removeMovieClip();
i++;
}
blood = [];
PE_Clear();
clearInterval(fpsc);
_y = 0;
_x = 0;
_root.stopAllSounds();
}
_root.createEmptyMovieClip("hook_rope", _root.getNextHighestDepth());
var gf = (new flash.filters.GlowFilter(0, 100, 1, 1, 50, 1, false, false));
hook_rope.filters = [gf];
_root.createEmptyMovieClip("ninjaTrail", _root.getNextHighestDepth());
var bmpnt = (new flash.display.BitmapData(100, 100, true, 16777215));
ninjaTrail.attachBitmap(bmpnt, 1);
var blurF = (new flash.filters.BlurFilter(2, 2, 10));
ninjaTrail.filters = [blurF];
Splayer = _root.createEmptyMovieClip("Splayer", _root.getNextHighestDepth());
Splayer.attachMovie("player", "p", 0);
Splayer._visible = false;
_root.createEmptyMovieClip("bmp", _root.getNextHighestDepth());
var bmpdt = (new flash.display.BitmapData(1000, 1000, true, 16777215));
bmp.attachBitmap(bmpdt, 1);
_root.createEmptyMovieClip("DRender", _root.getNextHighestDepth());
paused = false;
cameraOb = player;
player.vy = 1;
player.vx = 0;
player.spd = 2;
player.jump_power = 6;
player.hr = player._height / 2;
player.wr = player._width / 2;
player.r = wr;
player.kick_power = 5;
player.kick_jump = 8.5;
player.ledge_jump = 6.5;
player.die_y = 12;
player.max_vy = 15;
player.ww = player._xscale;
ropeLenMin = 5;
ropeLenMax = 150;
ropeSpd = 15;
ropeBreak = 60;
ropeClimbSpd = 2;
maxspd = 5;
grap_maxspd = 12;
grap_spd = 0.2;
pw = 5;
phn = 10;
phd = 5;
ph = phn;
grap = 0;
ledge = 0;
particleAmount = 0;
particleMax = 100;
RDing = 0;
fpsn = 0;
deaths = 0;
timerS = getTimer();
blood = [];
level_amount = 8;
onEnterFrame = function () {
fpsn++;
if (showBlood) {
UpdateBlood();
}
if (RDing == 1) {
PE_ApplyForces();
RDcollision();
PE_Render(DRender);
}
with (player) {
if (ground) {
spd = 1.25;
} else {
spd = 0.2;
}
if (((grap == 0) && (_currentframe != 7)) && (_currentframe != 8)) {
if (ledge == 0) {
if (Key.isDown(keys.k_left)) {
vx = vx - (spd * ts);
player._xscale = -player.ww;
player.gotoAndStop(2);
} else if (Key.isDown(keys.k_right)) {
vx = vx + (spd * ts);
player._xscale = player.ww;
player.gotoAndStop(2);
} else if (player._currentframe != 6) {
player.gotoAndStop(1);
}
}
} else {
if (Key.isDown(keys.k_left)) {
vx = vx - (grap_spd * ts);
}
if (Key.isDown(keys.k_right)) {
vx = vx + (grap_spd * ts);
}
}
if (Key.isDown(keys.k_up) && (grap == 0)) {
if (ground) {
vy = -jump_power;
}
}
if ((Key.isDown(1) && (ground == 0)) && (ledge == 0)) {
xd = _x - grap1._x;
yd = _y - grap1._y;
_rotation = (Math.atan2(yd, xd) / alpha) - 90;
if (_rotation > 45) {
_rotation = 45;
} else if (_rotation < -45) {
_rotation = -45;
}
} else {
player._rotation = 0;
}
if (grap == 0) {
if ((Math.abs(vx) > 5) && (player._currentframe != 8)) {
vx = vx * 0.99;
}
if (Math.abs(vy) > max_vy) {
vy = vy * 0.95;
}
}
if (hitground(player._x, (player._y + (player._height / 2)) + 1)) {
if (player._currentframe > 2) {
if (((!player._currentframe) != 6) && (player.vy > 0)) {
player.gotoAndStop(1);
}
}
} else if (player._currentframe != 6) {
player.gotoAndStop(4);
}
if (RDing == 0) {
if (ledge == 0) {
vy = vy + (grav * ts);
}
_y = _y + (vy * ts);
_x = _x + (vx * ts);
}
}
collision();
if (Key.isDown(32)) {
if (KEY_SPACE) {
if (!RDing) {
ragdoll();
} else {
reset();
respawn();
}
KEY_SPACE = false;
}
} else {
KEY_SPACE = true;
}
if (!grap) {
if (Key.isDown(16)) {
predictRope();
} else {
hook_rope.clear();
}
}
if (!Key.isDown(1)) {
if (grap == 1) {
grap1.removeMovieClip();
}
}
if (showTrails) {
if ((player._visible == 1) && ((Math.abs(player.vx) > 0.5) or (Math.abs(player.vy) > 0.5))) {
ninjaTrail._x = player._x - 50;
ninjaTrail._y = player._y - 50;
Splayer.p._x = 50;
Splayer.p._y = 50;
Splayer.p.gotoAndStop(player._currentframe);
Splayer.p._xscale = player._xscale;
Splayer.p._yscale = player._yscale;
Splayer.p._rotation = player._rotation;
Splayer._visible = 0;
bmpnt.draw(Splayer);
ninjaTrail.swapDepths(_root.getNextHighestDepth());
var ct = (new flash.geom.ColorTransform(0, 0, 0, 0.6, 0, 0, 0, 0));
bmpnt.colorTransform(bmpnt.rectangle, ct);
bmpnt.scroll(-player.vx, -player.vy);
} else {
bmpnt.fillRect(bmpnt.rectangle, 16777215);
}
}
updateCamera();
};
onMouseDown = function () {
if (Key.isDown(16)) {
if (editMode) {
reset();
cleanUp();
gotoAndStop ("Editor");
}
} else if (Key.isDown(8)) {
levelN++;
changeLevel(levelN);
respawn();
} else if (Key.isDown(69)) {
if (RDing == 0) {
ragdoll();
}
} else if (!RDing) {
if (!Key.isDown(16)) {
_root.attachMovie("grap", "grap1", _root.getNextHighestDepth(), {_x:player._x, _y:player._y});
grap = 1;
}
}
};
onMouseUp = function () {
grap1.removeMovieClip();
hook_rope.clear();
grap = 0;
};
if (editMode) {
loadLevelData(myLevel);
} else {
levelN = 1;
loadLevel(levelN);
_Interface.levelNum = levelN;
timeS = getTimer();
}
respawn();
fpsc = setInterval(fpscal, 1000);
Frame 10
submitScore.Score = playerScore;
Symbol 11 MovieClip [Blood] Frame 1
stop();
Instance of Symbol 9 MovieClip "br" in Symbol 11 MovieClip [Blood] Frame 2
onClipEvent (load) {
gotoAndStop(random(_totalframes) + 1);
}
Symbol 14 MovieClip [point] Frame 1
stop();
Symbol 16 MovieClip Frame 1
stop();
Symbol 17 MovieClip [particle] Frame 1
xv = s * Math.cos((r - 90) * (Math.PI/180));
yv = s * Math.sin((r - 90) * (Math.PI/180));
stop();
if (mods.glow && (size > 2)) {
gotoAndStop (2);
}
anim.gotoAndStop(animation);
onEnterFrame = function () {
_x = (_x + xv);
_y = (_y + yv);
yv = yv + _root.grav;
xv = xv * f;
yv = yv * f;
lf--;
if (lf <= 0) {
_alpha = (_alpha - fs);
}
if (_alpha <= 0) {
this.removeMovieClip();
}
if (_y > 410) {
this.removeMovieClip();
}
if (_root.hitground(_x + xv, _y + yv)) {
remove_ground(_x, _y, _width);
this.removeMovieClip();
}
};
Symbol 29 MovieClip Frame 1
stop();
onPress = function () {
gotoAndStop (3);
};
onRelease = function () {
_root.draw.removeMovieClip();
_root.stopAllSounds();
_root.PE_Clear();
_root.gotoAndStop("Scores");
};
onReleaseOutside = function () {
gotoAndStop (1);
};
onRollOver = function () {
gotoAndStop (2);
};
onRollOut = function () {
gotoAndStop (1);
};
Symbol 35 MovieClip [airPart] Frame 1
gotoAndStop(random(_totalframes) + 1);
vy = 40 + random(20);
onEnterFrame = function () {
_y = (_y - vy);
vy = vy * 0.9;
_alpha = (_alpha - 5);
if (_alpha <= 0) {
this.removeMovieClip();
}
};
Symbol 39 MovieClip Frame 1
_visible = false;
Instance of Symbol 41 MovieClip in Symbol 44 MovieClip [level2] Frame 1
onClipEvent (load) {
_visible = false;
}
onClipEvent (enterFrame) {
if (this.hitTest(_root.player)) {
_root.ragdoll();
}
}
Symbol 55 MovieClip Frame 1
stop();
Symbol 75 MovieClip Frame 42
Symbol 75 MovieClip Frame 55
stop();
_parent.play();
Symbol 116 MovieClip Frame 1
stop();
l = 0;
Instance of Symbol 59 MovieClip "mcNotice" in Symbol 116 MovieClip Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 116 MovieClip Frame 28
l++;
if (l < 5) {
gotoAndPlay ("loop");
} else if ((_url.indexOf("freeonlinegames.com") >= 0) && (_url.indexOf("file:") == -1)) {
_root.okToPlay = true;
_root.play();
stop();
} else if (_root.debug) {
_root.okToPlay = true;
_root.play();
stop();
} else {
mcNotice._visible = true;
l = -99999;
gotoAndPlay ("loop");
}
Instance of Symbol 116 MovieClip "logo" in Symbol 117 MovieClip Frame 1
on (release) {
getURL ("http://www.freeonlinegames.com/?" + _root.gameName, "_blank");
}
Symbol 142 MovieClip Frame 1
stop();
Symbol 142 MovieClip Frame 40
stop();
Instance of Symbol 135 MovieClip in Symbol 145 MovieClip [level3] Frame 1
onClipEvent (enterFrame) {
if (this.hitTest(_root.player._x, _root.player._y + _root.player.hr, true)) {
_root.ragdoll();
}
}
Instance of Symbol 138 MovieClip in Symbol 145 MovieClip [level3] Frame 1
onClipEvent (load) {
act = 0;
stop();
}
onClipEvent (enterFrame) {
if (!act) {
if (this.hitTest(_root.player)) {
act = 1;
gotoAndStop (2);
_parent.collision.door1.play();
}
}
}
Symbol 150 MovieClip Frame 1
stop();
Symbol 150 MovieClip Frame 15
stop();
Symbol 156 MovieClip Frame 1
stop();
Symbol 156 MovieClip Frame 15
stop();
Instance of Symbol 150 MovieClip in Symbol 159 MovieClip [level4] Frame 1
onClipEvent (load) {
act = 0;
}
onClipEvent (enterFrame) {
if (!act) {
if (this.hitTest(_root.player)) {
act = 1;
play();
_parent.collision.door1.play();
}
}
}
Instance of Symbol 153 MovieClip in Symbol 159 MovieClip [level4] Frame 1
onClipEvent (enterFrame) {
if (this.hitTest(_root.player._x, _root.player._y + _root.player.hr, true)) {
_root.ragdoll();
}
}
Symbol 178 MovieClip Frame 1
stop();
Symbol 178 MovieClip Frame 85
stop();
_root.cameraOb = _root.player;
Instance of Symbol 174 MovieClip in Symbol 183 MovieClip Frame 1
onClipEvent (enterFrame) {
s = oy - e._x;
oy = e._x;
if (this.hitTest(_root.player._x, ((_root.player._y + _root.player.hr) + 3) + _root.player.vy)) {
if (!Key.isDown(_root.keys_up)) {
while (!this.hitTest(_root.player._x, _root.player._y + _root.player.hr)) {
_root.player._y = _root.player._y + 0.2;
}
_root.player._x = _root.player._x - s;
}
}
if (this.hitTest(_root.player._x, _root.player._y - _root.player.hr)) {
_root.ragdoll();
}
}
Instance of Symbol 180 MovieClip in Symbol 183 MovieClip Frame 1
onClipEvent (load) {
h = _height / 2;
len = _width - (h * 2);
var con1 = {x:_x, y:_y - 100};
var con2 = {x:_x + len, y:_y - 100};
var p1 = {x:_x, y:_y, vx:1, vy:0.2, r:this._height / 2};
var p2 = {x:_x + len, y:_y, vx:1, vy:0.2, r:this._height / 2};
br = _parent._parent._parent.createEmptyMovieClip("BRender2", _parent.getNextHighestDepth());
br.filters = [_root.gf];
points = [p1, p2];
cons = [[p1, con1, 100], [p2, con2, 100]];
}
onClipEvent (enterFrame) {
if (this.hitTest(_root.player._x, (_root.player._y + _root.player.hr) + 5, true)) {
}
dx = (p1.x + p1.vx) - (p2.x + p2.vx);
dy = (p1.y + p1.vy) - (p2.y + p2.vy);
dis = Math.sqrt((dx * dx) + (dy * dy));
Force = (dis - len) / 2;
p1.vx = p1.vx - ((dx / dis) * Force);
p1.vy = p1.vy - ((dy / dis) * Force);
p2.vx = p2.vx + ((dx / dis) * Force);
p2.vy = p2.vy + ((dy / dis) * Force);
i = 0;
while (i < cons.length) {
con = cons[i];
p = con[0];
c = con[1];
xd = (p.x + p.vx) - c.x;
yd = (p.y + p.vy) - c.y;
dis = Math.sqrt((xd * xd) + (yd * yd));
if (dis > con[2]) {
force = (con[2] - dis) / 3;
p.vx = p.vx + ((xd / dis) * force);
p.vy = p.vy + ((yd / dis) * force);
}
i++;
}
if (this.hitTest(_root.player._x, ((_root.player._y + _root.player.hr) + _root.player.vy) + 1, true)) {
i = 0;
while (i < points.length) {
p = points[i];
xd = _root.player._x - p.x;
yd = _root.player._y - p.y;
dis = Math.sqrt((xd * xd) + (yd * yd));
spd = Math.sqrt((_root.player.vx * _root.player.vx) + (_root.player.vy * _root.player.vy)) / 2;
p.vy = p.vy - ((spd * yd) / dis);
i++;
}
_root.player._x = _root.player._x + p1.vx;
}
i = 0;
while (i < points.length) {
p = points[i];
p.vy = p.vy + _root.gravity;
p.y = p.y + p.vy;
p.x = p.x + p.vx;
if ((p.x - p.r) < 415) {
p.vx = Math.abs(p.vx * 0.4);
p.x = 415 + p.r;
}
if ((p.x + p.r) > 590) {
p.vx = -Math.abs(p.vx * 0.4);
p.x = 590 - p.r;
}
i++;
}
xd = p2.x - p1.x;
yd = p2.y - p1.y;
dir = Math.atan2(yd, xd);
_rotation = (dir / _root.alpha);
_x = p1.x;
_y = p1.y;
br.clear();
br.lineStyle(2, 7028995);
br.moveTo(con1.x, con1.y);
br.lineTo(p1.x, p1.y);
br.moveTo(con2.x, con2.y);
br.lineTo(p2.x, p2.y);
}
Instance of Symbol 182 MovieClip in Symbol 183 MovieClip Frame 1
onClipEvent (load) {
fall = 0;
tm = 10;
t = tm;
sy = _y;
tt = 200;
vy = 0;
}
onClipEvent (enterFrame) {
function reset() {
_y = sy;
vy = 0;
fall = 0;
t = tm;
}
if (this.hitTest(_root.player._x, (_root.player._y + _root.player.hr) + 1)) {
if (_root.player._y < _y) {
t = t - 5;
if (Key.isDown(_root.keys.k_up)) {
t = 0;
}
if (t <= 0) {
fall = 1;
}
}
} else {
if (t < tm) {
t = t + 0.1;
}
if (vy > 50) {
reset();
}
if (_alpha < 100) {
_alpha = (_alpha + 5);
}
}
if (fall) {
vy = vy + 0.5;
_y = (_y + vy);
_alpha = (_alpha - 5);
}
}
Instance of Symbol 182 MovieClip in Symbol 183 MovieClip Frame 1
onClipEvent (load) {
fall = 0;
tm = 10;
t = tm;
sy = _y;
tt = 200;
vy = 0;
}
onClipEvent (enterFrame) {
function reset() {
_y = sy;
vy = 0;
fall = 0;
t = tm;
}
if (this.hitTest(_root.player._x, (_root.player._y + _root.player.hr) + 1)) {
if (_root.player._y < _y) {
t = t - 5;
if (Key.isDown(_root.keys.k_up)) {
t = 0;
}
if (t <= 0) {
fall = 1;
}
}
} else {
if (t < tm) {
t = t + 0.1;
}
if (vy > 50) {
reset();
}
if (_alpha < 100) {
_alpha = (_alpha + 5);
}
}
if (fall) {
vy = vy + 0.5;
_y = (_y + vy);
_alpha = (_alpha - 5);
}
}
Instance of Symbol 182 MovieClip in Symbol 183 MovieClip Frame 1
onClipEvent (load) {
fall = 0;
tm = 10;
t = tm;
sy = _y;
tt = 200;
vy = 0;
}
onClipEvent (enterFrame) {
function reset() {
_y = sy;
vy = 0;
fall = 0;
t = tm;
}
if (this.hitTest(_root.player._x, (_root.player._y + _root.player.hr) + 1)) {
if (_root.player._y < _y) {
t = t - 5;
if (Key.isDown(_root.keys.k_up)) {
t = 0;
}
if (t <= 0) {
fall = 1;
}
}
} else {
if (t < tm) {
t = t + 0.1;
}
if (vy > 50) {
reset();
}
if (_alpha < 100) {
_alpha = (_alpha + 5);
}
}
if (fall) {
vy = vy + 0.5;
_y = (_y + vy);
_alpha = (_alpha - 5);
}
}
Instance of Symbol 166 MovieClip "lava" in Symbol 185 MovieClip Frame 1
onClipEvent (enterFrame) {
if (this.hitTest(_root.player._x, _root.player._y + _root.player.hr)) {
_root.ragdoll();
}
}
Instance of Symbol 170 MovieClip in Symbol 185 MovieClip Frame 1
onClipEvent (load) {
sy = _y;
spd = 5;
}
onClipEvent (enterFrame) {
if (this.c.hitTest((_root.player._x + _root.player.wr) + 3, (_root.player._y + _root.player.hr) - 2, true)) {
if (Key.isDown(_root.keys.k_up)) {
if (_y > 65) {
_y = (_y - spd);
_root.player._y = _root.player._y - (spd + _root.gravity);
_root.player.vy = 0;
}
}
if (Key.isDown(_root.keys.k_down)) {
_y = (_y + spd);
_root.player._y = _root.player._y + (spd + _root.gravity);
_root.player.vy = _root.gravity;
}
_root.jumpLock = true;
} else {
_root.jumpLock = false;
}
if (this.hitTest(_root.player._x, _root.player._y - _root.player.hr, true) && (_root.player._y > (_y + (_height / 2)))) {
_root.ragdoll();
}
if (_parent._parent.area1.hitTest(_root.player) && (_y < sy)) {
_y = (_y + spd);
}
}
Instance of Symbol 184 MovieClip in Symbol 185 MovieClip Frame 1
onClipEvent (load) {
i = 0;
}
onClipEvent (enterFrame) {
a = 0;
while (a < 2) {
if (_root.particleAmount < _root.particleMax) {
r = (Math.random() * 16) - (Math.random() * 16);
_root.attachMovie("fire", "fire" + i, _root.getNextHighestDepth(), {_x:_x + r, _y:_y, _rotation:(((Math.random() * r) * 4) - ((Math.random() * r) * 4)) + 180, spd:4});
i++;
}
a++;
}
}
Instance of Symbol 184 MovieClip in Symbol 185 MovieClip Frame 1
onClipEvent (load) {
i = 0;
}
onClipEvent (enterFrame) {
if (_root.particleAmount < _root.particleMax) {
r = (Math.random() * 16) - (Math.random() * 16);
_root.attachMovie("fire", "fire2" + i, _root.getNextHighestDepth(), {_x:_x + r, _y:_y, _rotation:(((Math.random() * r) * 4) - ((Math.random() * r) * 4)) + 180, spd:4});
i++;
}
}
Instance of Symbol 184 MovieClip in Symbol 185 MovieClip Frame 1
onClipEvent (load) {
i = 0;
}
onClipEvent (enterFrame) {
if (_root.particleAmount < _root.particleMax) {
r = (Math.random() * 16) - (Math.random() * 16);
_root.attachMovie("fire", "fire2" + i, _root.getNextHighestDepth(), {_x:_x + r, _y:_y, _rotation:(((Math.random() * r) * 4) - ((Math.random() * r) * 4)) + 180, spd:4});
i++;
}
}
Instance of Symbol 162 MovieClip [level5_bg] in Symbol 188 MovieClip [level5] Frame 1
onClipEvent (load) {
this._visible = 0;
}
Instance of Symbol 164 MovieClip "area1" in Symbol 188 MovieClip [level5] Frame 1
onClipEvent (load) {
this._alpha = 15;
}
Instance of Symbol 138 MovieClip in Symbol 188 MovieClip [level5] Frame 1
onClipEvent (load) {
stop();
}
onClipEvent (enterFrame) {
if (_root.player.hitTest(_x, _y - 10)) {
if (_parent.collision.noColl.door1._currentframe == 1) {
_parent.collision.noColl.door1.play();
_root.cameraOb = _parent.collision.noColl.door1;
gotoAndStop (2);
}
}
}
Symbol 195 MovieClip [level6] Frame 1
stop();
Symbol 199 MovieClip [elevator] Frame 1
speed = 3;
y = _y;
if (ymin == undefined) {
ymin = _height;
}
if (ymax == undefined) {
ymax = 1000 - _height;
}
onEnterFrame = function () {
if (this.p.hitTest((_root.player._x + _root.player.wr) + 3, _root.player._y) or this.p.hitTest((_root.player._x - _root.player.wr) - 3, _root.player._y)) {
if (Key.isDown(_root.keys.k_up) && (_y > ymin)) {
_y = (_y - speed);
_root.player.vy = _root.player.vy + speed;
} else if (Key.isDown(_root.keys.k_down) && (_y < ymax)) {
_y = (_y + speed);
_root.player._y = _root.player._y + speed;
}
}
if (Key.isDown(32) && (_root.RDing)) {
_y = y;
}
};
Symbol 202 MovieClip [grap] Frame 1
hook = 0;
_rotation = (Math.atan2(_root._ymouse - _y, _root._xmouse - _x) / _root.alpha);
spd = _root.ropeSpd;
vx = (spd * Math.cos(_rotation * _root.alpha)) + _root.player.vx;
vy = (spd * Math.sin(_rotation * _root.alpha)) + _root.player.vy;
r = 1;
maxl = 120;
len = maxl;
timeOut = 30;
var ss = new Sound(this);
ss.attachSound("throwHook");
ss.start(0, 1);
var sss = new Sound(this);
onEnterFrame = function () {
if (!hook) {
_rotation = ((Math.atan2(_root.player._y - _y, _root.player._x - _x) / _root.alpha) + 180);
_x = (_x + (vx * _root.ts));
_y = (_y + (vy * _root.ts));
if (_root.hitground(_x, _y)) {
ospd = Math.sqrt((vx * vx) + (vy * vy));
if (ospd != 0) {
steps = 0;
while (_root.hitground(_x, _y) && (steps < timeOut)) {
_x = (_x - (vx / ospd));
_y = (_y - (vy / ospd));
steps++;
if (steps >= timeOut) {
trace("TIME OUT HOOK");
break;
}
}
} else {
trace("EEE");
}
if (_root.hitground(_x, _y + 1)) {
sss.attachSound("hitGround1");
sss.start(0, 1);
hook = 1;
len = _root.getDis(this, _root.player);
} else {
if (_root.hitground(_x - 1, _y)) {
sss.attachSound("hitGround2");
sss.start(0, 1);
vx = Math.abs(vx) * 0.4;
vy = 0;
} else if (_root.hitground(_x + 1, _y)) {
sss.attachSound("hitGround2");
sss.start(0, 1);
vx = (-Math.abs(vx)) * 0.4;
vy = 0;
}
if (_root.hitground(_x, _y - 1)) {
sss.attachSound("hitGround2");
sss.start(0, 1);
vy = Math.abs(vy) * 0.4;
vx = 0;
}
}
} else {
vy = vy + (_root.grav * _root.ts);
}
xd = _root.player._x - (_x + (vx * _root.ts));
yd = _root.player._y - (_y + (vy * _root.ts));
dis = Math.sqrt((xd * xd) + (yd * yd));
if (dis >= len) {
force = (dis - len) / 5;
vx = vx + ((force * xd) / dis);
vy = vy + ((force * yd) / dis);
}
}
if (hook) {
xd = _x - (_root.player._x + (_root.player.vx * _root.ts));
yd = _y - (_root.player._y + (_root.player.vy * _root.ts));
dis = Math.sqrt((xd * xd) + (yd * yd));
while (_root.hitground(_x, _y)) {
_y = (_y - 0.2);
}
if (dis >= len) {
force = (dis - len) / 5;
if (force > 10) {
_root.grap = 0;
_root.hook_rope.clear();
this.removeMovieClip();
}
_root.player.vx = _root.player.vx + ((force * xd) / dis);
_root.player.vy = _root.player.vy + ((force * yd) / dis);
}
}
if (Key.isDown(_root.keys.k_up)) {
if (len > _root.ropeLenMin) {
len = len - _root.ropeClimbSpd;
}
}
if (Key.isDown(_root.keys.k_down)) {
if (len < _root.ropeLenMax) {
len = len + _root.ropeClimbSpd;
}
}
_root.hook_rope.clear();
_root.hook_rope.lineStyle(2, 16750899);
_root.hook_rope.moveTo(_x, _y);
_root.hook_rope.lineTo(_root.player._x + _root.player.vx, _root.player._y + _root.player.vy);
};
Symbol 225 MovieClip Frame 1
function toggleAct(a) {
if (a == undefined) {
act = !act;
} else {
act = a;
}
}
range = 280;
w = _width / 2;
act = true;
onEnterFrame = function () {
if (act) {
if (_root.player._y < _y) {
if ((_root.player._x > (_x - w)) && (_root.player._x < (_x + w))) {
p = range - (_y - _root.player._y);
if (p > range) {
p = range;
}
if (p < 0) {
p = 0;
}
_root.player.vy = _root.player.vy - (p / 100);
}
}
i = 0;
while (i < _root.points.length) {
pp = _root.points[i];
if (pp._y < _y) {
if ((pp._x > (_x - w)) && (pp._x < (_x + w))) {
p = range - (_y - pp._y);
if (p > range) {
p = range;
}
if (p < 0) {
p = 0;
}
pp.vy = pp.vy - (p / 100);
}
}
i++;
}
}
};
Symbol 227 MovieClip Frame 1
function tgravity(p, d) {
xd = _x - p._x;
yd = _y - p._y;
dis = (xd * xd) + (yd * yd);
disSQ = Math.sqrt(dis);
if (disSQ < range) {
f = (power / disSQ) / dis;
p.vx = p.vx + (f * xd);
p.vy = p.vy + (f * yd);
if ((disSQ < rad) && (d)) {
f = rad - disSQ;
p.vx = p.vx - ((xd / disSQ) * f);
p.vy = p.vy - ((yd / disSQ) * f);
}
}
if (p == _root.grap1) {
if (this.hitTest(_root.grap1._x, _root.grap1._y, true)) {
_root.grap1.hook = true;
_root.grap1.len = _root.getDis(_root.grap1, _root.player);
}
}
}
function toggleAct(a) {
if (a == undefined) {
act = !act;
} else {
act = a;
}
}
power = -20000;
range = Infinity;
act = false;
rad = 58;
points = [_root.player];
onEnterFrame = function () {
if (act) {
i = 0;
while (i < points.length) {
tgravity(points[i], false);
i++;
}
tgravity(_root.grap1, false);
i = 0;
while (i < _root.points.length) {
tgravity(_root.points[i], true);
i++;
}
}
};
Symbol 231 MovieClip Frame 1
stop();
Instance of Symbol 231 MovieClip in Symbol 234 MovieClip [level7] Frame 1
onClipEvent (enterFrame) {
if (this.hitTest(_root.player)) {
_parent.collision.magnet.act = true;
gotoAndStop (2);
}
}
Instance of Symbol 231 MovieClip in Symbol 234 MovieClip [level7] Frame 1
onClipEvent (enterFrame) {
if (this.hitTest(_root.player)) {
_parent.collision.magnet.act = false;
gotoAndStop (2);
}
}
Instance of Symbol 184 MovieClip in Symbol 234 MovieClip [level7] Frame 1
onClipEvent (load) {
range = 30;
tm = 1;
t = tm;
pn = 0;
}
onClipEvent (enterFrame) {
if (t < 0) {
r = random(range) - random(range);
this.attachMovie("airPart", "a" + pn, this.getNextHighestDepth(), {_x:r, _y:0});
pn++;
t = tm;
} else {
t--;
}
}
Symbol 240 MovieClip Frame 1
stop();
Symbol 240 MovieClip Frame 40
stop();
Instance of Symbol 237 MovieClip in Symbol 244 MovieClip [level8] Frame 1
onClipEvent (load) {
act = 0;
stop();
}
onClipEvent (enterFrame) {
if (!act) {
if (this.hitTest(_root.player)) {
act = 1;
gotoAndStop (2);
_parent.collision.door1.play();
}
}
}
Symbol 245 MovieClip Frame 1
stop();
Symbol 254 Button
on (release) {
gotoAndStop (1);
_root.keys = _root.keys1;
}
Symbol 257 Button
on (release) {
gotoAndStop (2);
_root.keys = _root.keys2;
}
Symbol 260 MovieClip Frame 1
stop();
Symbol 265 MovieClip Frame 1
stop();
onPress = function () {
gotoAndStop (3);
};
onRelease = function () {
_root.draw.removeMovieClip();
_root.stopAllSounds();
_root.PE_Clear();
_root.gotoAndStop("Game");
};
onReleaseOutside = function () {
gotoAndStop (1);
};
onRollOver = function () {
gotoAndStop (2);
};
onRollOut = function () {
gotoAndStop (1);
};
Symbol 268 MovieClip Frame 1
stop();
onPress = function () {
gotoAndStop (3);
};
onRelease = function () {
_root.draw.removeMovieClip();
_root.stopAllSounds();
_root.PE_Clear();
_root.gotoAndStop("Editor");
};
onReleaseOutside = function () {
gotoAndStop (1);
};
onRollOver = function () {
gotoAndStop (2);
};
onRollOut = function () {
gotoAndStop (1);
};
Symbol 273 MovieClip Frame 1
stop();
onPress = function () {
gotoAndStop (3);
};
onRelease = function () {
_root.draw.removeMovieClip();
_root.stopAllSounds();
_root.PE_Clear();
_root.gotoAndStop("Instructions");
};
onReleaseOutside = function () {
gotoAndStop (1);
};
onRollOver = function () {
gotoAndStop (2);
};
onRollOut = function () {
gotoAndStop (1);
};
Symbol 276 MovieClip Frame 1
stop();
onPress = function () {
gotoAndStop (3);
};
onRelease = function () {
_root.draw.removeMovieClip();
_root.stopAllSounds();
_root.PE_Clear();
_root.gotoAndStop("Credits");
};
onReleaseOutside = function () {
gotoAndStop (1);
};
onRollOver = function () {
gotoAndStop (2);
};
onRollOut = function () {
gotoAndStop (1);
};
Symbol 280 Button
on (release) {
getURL ("http://www.freeonlinegames.com", "_blank");
}
Symbol 283 MovieClip Frame 1
stop();
onPress = function () {
gotoAndStop (3);
};
onRelease = function () {
};
onReleaseOutside = function () {
gotoAndStop (1);
};
onRollOver = function () {
gotoAndStop (2);
};
onRollOut = function () {
gotoAndStop (1);
};
Symbol 284 MovieClip Frame 1
onEnterFrame = function () {
if (_alpha > 0) {
_alpha = (_alpha - 5);
this.swapDepths(_root.getNextHighestDepth());
} else {
this.removeMovieClip();
}
};
Symbol 288 MovieClip Frame 1
stop();
onPress = function () {
gotoAndStop (3);
};
onRelease = function () {
_root.draw.removeMovieClip();
_root.stopAllSounds();
_root.PE_Clear();
_root.gotoAndStop("Title");
};
onReleaseOutside = function () {
gotoAndStop (1);
};
onRollOver = function () {
gotoAndStop (2);
};
onRollOut = function () {
gotoAndStop (1);
};
Symbol 299 Button
on (press) {
sboard.dir = "up";
}
on (release) {
sboard.dir = "stop";
}
Symbol 300 Button
on (press) {
sboard.dir = "down";
}
on (release) {
sboard.dir = "stop";
}
Symbol 307 MovieClip Frame 1
stop();
Symbol 307 MovieClip Frame 2
stop();
Symbol 317 MovieClip [TMP6pbk6uzm9i] Frame 1
var arrScore = new Array();
mcScoreboard.sboard.dir = "stop";
mcScoreboard.sboard.mcScoreHolder.mcScore._visible = false;
mcLabel._visible = false;
var main = this;
xmlPlayer = new XML();
xmlPlayer.ignoreWhite = true;
xmlPlayer.onLoad = function (success) {
if (success) {
myPlayer = xmlPlayer.firstChild.childNodes;
ctr2 = 0;
while (ctr2 < myPlayer.length) {
thisPlayer = main.mcScoreboard.sboard.mcScoreHolder.mcScore.duplicateMovieClip("mcScore" + ctr2, ctr2);
thisPlayer._y = ctr2 * thisPlayer._height;
thisPlayer._visible = true;
if ((ctr2 % 2) > 0) {
thisPlayer.gotoAndStop(2);
}
thisPlayer.txtNumber.text = (ctr2 + 1) + ")";
thisPlayer.txtNickname.text = myPlayer[ctr2].attributes.player;
thisPlayer.txtScore.text = myPlayer[ctr2].attributes.score;
ctr2++;
}
main.mcScoreboard.mcLoading._visible = false;
main.mcScoreboard.sboard.mcScoreHolder.item = myPlayer.length;
main.mcScoreboard.sboard.mcScoreHolder.speedy = 0;
main.mcScoreboard.sboard.mcScoreHolder.desty = 0;
main.mcScoreboard.sboard.mcScoreHolder.onEnterFrame = function () {
if ((this.desty < 0) && (this._parent.dir == "up")) {
this.desty = this.desty + 10;
if (this.desty > 0) {
this.desty = 0;
}
}
if ((this.desty > (this._parent.mcBlock._height - (this.mcScore._height * this.item))) && (this._parent.dir == "down")) {
this.desty = this.desty - 10;
if (this.desty < (this._parent.mcBlock._height - (this.mcScore._height * this.item))) {
this.desty = this._parent.mcBlock._height - (this.mcScore._height * this.item);
}
}
this.speedy = (this.desty - this._y) + (this.speedy * 0.4);
this._y = this._y + this.speedy;
};
}
};
xmlPlayer.load(((("http://www.freeonlinegames.com/scoreboard/getTopPlayer.php?id=" + gameID) + "&rand=") + random(999999)) + "&filt=1");
Symbol 333 Button
on (release) {
getURL ("http://www.supa-monky.deviantart.com", "_blank");
}
Symbol 342 Button
on (release) {
getURL ("http://www.the-titan.deviantart.com", "_blank");
}
Symbol 346 Button
on (release) {
getURL ("http://www.toxicportal.com", "_blank");
}
Symbol 370 MovieClip Frame 3
stop();
Symbol 380 MovieClip Frame 1
stop();
Symbol 380 MovieClip Frame 15
stop();
Symbol 384 MovieClip Frame 1
f = this.createEmptyMovieClip("f", this.getNextHighestDepth());
onEnterFrame = function () {
val = slide._x;
if (slide.id) {
f.clear();
f.lineStyle(0);
f.beginFill(16777215, 50);
f.moveTo(0, 0);
f.lineTo(slide._x, 0);
f.lineTo(slide._x, 10);
f.lineTo(0, 10);
f.lineTo(0, 0);
}
};
Instance of Symbol 383 MovieClip "slide" in Symbol 384 MovieClip Frame 1
onClipEvent (load) {
id = false;
}
on (press) {
id = true;
this.startDrag(true, 0, 5, 100, 5);
}
on (release, releaseOutside) {
id = false;
this.stopDrag();
_parent.f.clear();
_parent.f.lineStyle(0);
_parent.f.beginFill(_parent.c, 50);
_parent.f.moveTo(0, 0);
_parent.f.lineTo(_x, 0);
_parent.f.lineTo(_x, 10);
_parent.f.lineTo(0, 10);
_parent.f.lineTo(0, 0);
}
Symbol 405 MovieClip Frame 1
stop();
Symbol 407 MovieClip Frame 1
stop();
Symbol 409 MovieClip Frame 1
stop();
Symbol 411 MovieClip Frame 1
stop();
Symbol 413 MovieClip Frame 1
stop();
Symbol 420 MovieClip Frame 1
stop();
Symbol 423 MovieClip Frame 1
stop();
Symbol 425 MovieClip Frame 1
stop();
Instance of Symbol 423 MovieClip in Symbol 426 MovieClip Frame 1
onClipEvent (load) {
stop();
}
on (release) {
_root.saveLevelData();
}
Instance of Symbol 425 MovieClip in Symbol 426 MovieClip Frame 1
onClipEvent (load) {
stop();
}
on (release) {
_root.loadLevelData(_root._interface.saveBox.outputData);
}
Symbol 427 MovieClip Frame 1
stop();
Instance of Symbol 380 MovieClip in Symbol 427 MovieClip Frame 1
on (release) {
play();
}
Instance of Symbol 384 MovieClip "colR" in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
c = 16711680 /* 0xFF0000 */;
}
Instance of Symbol 384 MovieClip "colG" in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
c = 65280;
}
Instance of Symbol 384 MovieClip "colB" in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
c = 255;
}
Instance of Symbol 388 MovieClip "colSample" in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
var col = new Color(this.b);
}
onClipEvent (enterFrame) {
r = (_parent.colR.val / 100) * 255;
g = (_parent.colG.val / 100) * 255;
b = (_parent.colB.val / 100) * 255;
col.setRGB(_root.rgbToHex(r, g, b));
_root.selCol = _root.rgbToHex(r, g, b);
}
Instance of Symbol 396 MovieClip in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
gotoAndStop (1);
}
on (release) {
_root.selMat = 0;
_parent.mat_sel._y = _y;
}
Instance of Symbol 400 MovieClip in Symbol 427 MovieClip Frame 1
on (release) {
_root.clearAll();
}
Instance of Symbol 402 MovieClip in Symbol 427 MovieClip Frame 1
on (release) {
_root.Verts.splice(_root.Verts.length - 1, 1);
_root.reDraw(_root.selView);
}
Instance of Symbol 405 MovieClip in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
gotoAndStop (1);
}
on (release) {
_root.selView = 0;
_root.reDraw(_root.selView);
}
Instance of Symbol 407 MovieClip in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
stop();
}
on (release) {
_root.testLevel();
}
Instance of Symbol 409 MovieClip in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
stop();
}
on (release) {
_root.saveLevel();
}
Instance of Symbol 411 MovieClip in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
stop();
}
on (release) {
_root.loadLevel();
}
Instance of Symbol 413 MovieClip in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
stop();
}
on (release) {
_root.ImportExport();
}
Instance of Symbol 384 MovieClip "lthick" in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
c = 0;
}
Instance of Symbol 396 MovieClip in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
gotoAndStop (2);
}
on (release) {
_root.selMat = 1;
_parent.mat_sel._y = _y;
}
Instance of Symbol 396 MovieClip in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
gotoAndStop (3);
}
on (release) {
_root.selMat = 2;
_parent.mat_sel._y = _y;
}
Instance of Symbol 396 MovieClip in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
gotoAndStop (4);
}
on (release) {
_root.selMat = 3;
_parent.mat_sel._y = _y;
}
Instance of Symbol 405 MovieClip in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
gotoAndStop (2);
}
on (release) {
_root.selView = 1;
_root.reDraw(_root.selView);
}
Instance of Symbol 420 MovieClip in Symbol 427 MovieClip Frame 1
onClipEvent (load) {
stop();
}
on (release) {
_root.Editor_End("Title", false);
}
Symbol 427 MovieClip Frame 35
stop();