Frame 1
stop();
alpha = 0.0174532925199433 /* Math.PI/180 */;
controls = {};
controls.kup = 87;
controls.kdown = 83;
controls.kleft = 65;
controls.kright = 68;
Frame 2
function addBody() {
b = {};
b.points = [];
b.constraints = [];
b.limbs = [];
b.vx = 0;
b.vy = 0;
b.blood = 1;
b.eTime = 0;
b.force = 0;
PE_bodies.push(b);
return(b);
}
function addPoint(x, y, r) {
p = {};
p.x = x;
p.y = y;
p.vx = 0;
p.vy = 0;
p.r = r;
return(p);
}
function addConstraint(p1, p2, l) {
c = {};
c.p1 = p1;
c.p2 = p2;
if (l == null) {
xd = p2.x - p1.x;
yd = p2.y - p1.y;
l = Math.sqrt((xd * xd) + (yd * yd));
}
c.len = l;
c.len2 = c.len * c.len;
return(c);
}
function addLimb(mc, p1, p2) {
_root.attachMovie(mc, "limb" + limbNum, _root.getNextHighestDepth(), {_x:p1.x, _y:p1.y});
l = {};
l.p1 = p1;
l.p2 = p2;
r = this["limb" + limbNum]._width / 2;
if (l.p1.r < r) {
l.p1.r = r;
}
if (l.p2.r < r) {
l.p2.r = r;
}
l.len = this["limb" + limbNum]._height - (l.p1.r + l.p2.r);
l.len2 = l.len * l.len;
l.mc = this["limb" + limbNum];
l.mcName = mc;
limbNum++;
return(l);
}
function createRagdoll(ob) {
body = addBody();
side = Math.abs(ob._xscale) / ob._xscale;
i = 0;
while (i < ob.points.length) {
body.points.push(addPoint((ob.points[i]._x * side) + ob._x, ob.points[i]._y + ob._y, 2));
body.points[body.points.length - 1].vx = ob.vx;
body.points[body.points.length - 1].vy = ob.vy;
i++;
}
i = 0;
while (i < ob.limbs.length) {
body.limbs.push(addLimb(ob.limbs[i].gfx, body.points[ob.limbs[i].p1], body.points[ob.limbs[i].p2]));
body.limbs[body.limbs.length - 1].mc._xscale = ob._xscale;
i++;
}
i = 0;
while (i < ob.constraints.length) {
body.constraints.push(addConstraint(body.points[ob.constraints[i].p1], body.points[ob.constraints[i].p2], null));
i++;
}
i = 0;
while (i < body.points.length) {
p = body.points[i];
while (hitGround(p.x, p.y)) {
p.y = p.y - 0.1;
}
i++;
}
return(body);
}
function PE_update() {
i = 0;
while (i < PE_bodies.length) {
body = PE_bodies[i];
body.force = 0;
body.eTime++;
body.vy = body.vy + PE_gravity;
body.ground = 0;
j = 0;
while (j < body.points.length) {
p = body.points[j];
p.vx = p.vx + body.vx;
p.vy = p.vy + body.vy;
ii = 0;
while (ii < PE_p_iterations) {
p.x = p.x + (p.vx / PE_p_iterations);
p.y = p.y + (p.vy / PE_p_iterations);
if (hitGround(p.x, p.y + p.r)) {
body.ground = 1;
if (body.blood) {
if (Math.abs(p.vy) > 10) {
sprayBlood(p.x, p.y - p.vy, 1, 0, 45, 3, 3);
}
}
p.vy = -Math.abs(p.vy * PE_bounce);
p.vx = p.vx * PE_friction;
while (hitGround(p.x, p.y + p.r)) {
p.y = p.y - 0.1;
}
} else if (hitGround(p.x, p.y - p.r)) {
p.vy = Math.abs(p.vy * PE_bounce);
p.vx = p.vx * PE_friction;
while (hitGround(p.x, p.y - p.r)) {
p.y = p.y + 0.2;
}
}
if (hitGround(p.x + p.r, p.y) && (p.vx > 0)) {
p.vx = -Math.abs(p.vx * PE_bounce);
p.vy = p.vy * PE_friction;
while (hitGround(p.x + p.r, p.y)) {
p.x = p.x - 0.2;
}
} else if (hitGround(p.x - p.r, p.y) && (p.vx < 0)) {
p.vx = Math.abs(p.vx * PE_bounce);
p.vy = p.vy * PE_friction;
while (hitGround(p.x - p.r, p.y)) {
p.x = p.x + 0.2;
}
}
ii++;
}
body.force = body.force + Math.abs(p.vx);
body.force = body.force + Math.abs(p.vy);
j++;
}
body.vx = 0;
body.vy = 0;
ii = 0;
while (ii < PE_iterations) {
j = 0;
while (j < body.limbs.length) {
l = body.limbs[j];
dat = satisfyConstraint(l.p1, l.p2, l.len, 10, c.len2);
l.mc._x = l.p1.x;
l.mc._y = l.p1.y;
l.mc._rotation = (Math.atan2(dat.y, dat.x) / alpha) + 90;
j++;
}
j = 0;
while (j < body.constraints.length) {
c = body.constraints[j];
d = satisfyConstraint(c.p1, c.p2, c.len, 10, c.len2);
j++;
}
ii++;
}
if ((((body.force < 4) && (body.eTime > 5)) && (body.ground)) or (body.eTime > 1000)) {
j = 0;
while (j < body.limbs.length) {
limb = body.limbs[j];
drawLimbToBitmap(limb);
limb.mc.removeMovieClip();
j++;
}
PE_bodies.splice(i, 1);
}
i++;
}
if (PE_debug) {
dDraw.swapDepths(_root.getNextHighestDepth());
dDraw.clear();
i = 0;
while (i < PE_bodies.length) {
b = PE_bodies[i];
dDraw.lineStyle(3, 16711680);
j = 0;
while (j < b.points.length) {
p = b.points[j];
dDraw.moveTo(p.x, p.y);
dDraw.lineTo(p.x, p.y + 1);
j++;
}
dDraw.lineStyle(3, 255);
j = 0;
while (j < b.constraints.length) {
c = b.constraints[j];
dDraw.moveTo(c.p1.x, c.p1.y);
dDraw.lineTo(c.p2.x, c.p2.y);
j++;
}
i++;
}
}
}
function satisfyConstraint(p1, p2, len, bp, len2) {
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 = ((len - dis) / dis) * 0.5;
xf = xd * force;
yf = yd * force;
p1.vx = p1.vx - xf;
p1.vy = p1.vy - yf;
p2.vx = p2.vx + xf;
p2.vy = p2.vy + yf;
return({x:xd, y:yd, b:0});
}
function sprayBlood(x, y, a, d, rd, spd, rs) {
i = 0;
while (i < a) {
s = spd + ((Math.random() - Math.random()) * rs);
d = d + (random(rd) - random(rd));
vx = s * Math.sin(d / alpha);
vy = s * Math.cos(d / alpha);
createBlood(x, y, vx, vy);
i++;
}
}
function createBlood(x, y, vx, vy) {
this["blood" + bloodNum] = _root.createEmptyMovieClip("blood" + bloodNum, _root.getNextHighestDepth());
this["blood" + bloodNum]._x = x;
this["blood" + bloodNum]._y = y;
this["blood" + bloodNum].vx = vx;
this["blood" + bloodNum].vy = vy;
this["blood" + bloodNum].lineStyle(2, 16711680);
this["blood" + bloodNum].moveTo(0, 0);
this["blood" + bloodNum].lineTo(0, 1);
bloodList.push(this["blood" + bloodNum]);
bloodNum++;
}
function updateBlood() {
i = 0;
while (i < bloodList.length) {
b = bloodList[i];
b.vy = b.vy + gravity;
b._x = b._x + b.vx;
b._y = b._y + b.vy;
if (hitGround(b._x, b._y)) {
spd = Math.sqrt((b.vx * b.vx) + (b.vy * b.vy));
xs = b.vx / spd;
ys = b.vy / spd;
while (hitGround(b._x, b._y)) {
b._x = b._x - xs;
b._y = b._y - ys;
}
level.setPixel32(b._x, b._y, 4294901760);
b.removeMovieClip();
bloodList.splice(i, 1);
}
i++;
}
}
function addActor(ob, x, y, updates) {
obj = _root.attachMovie(ob, "actor" + actorNum, _root.getNextHighestDepth(), {_x:x, _y:y});
actorNum++;
obj.vx = 0;
obj.vy = 0;
obj.heightRad = obj._height;
obj.widthRad = obj._width / 2;
obj.ground = 0;
obj.speed = 0.5;
obj.jump = 8;
obj.xSpeedMax = 8;
obj.ySpeedMax = 10;
obj.moveQuality = 0.1;
obj.moveStep = 2;
obj.updates = updates;
obj.AI = true;
actors.push(obj);
return(obj);
}
function updateActors() {
i = 0;
while (i < actors.length) {
actor = actors[i];
j = 0;
while (j < actor.updates.length) {
this[actor.updates[j]](actor);
j++;
}
i++;
}
}
function updateActor(ob) {
ob.ground = 0;
ob.vy = ob.vy + gravity;
ms = ob.moveStep;
while (ms > 0) {
ob._y = ob._y + (ob.vy / player.moveStep);
ob._x = ob._x + (ob.vx / player.moveStep);
if (hitGround(Math.round(ob._x), Math.round(ob._y))) {
ob.vy = -Math.abs(ob.vy * 0.4);
ob.ground = 1;
while (hitGround(ob._x, ob._y)) {
ob._y = ob._y - ob.moveQuality;
}
} else if (hitGround(Math.round(ob._x), Math.round(ob._y - ob.heightRad))) {
ob.vy = Math.abs(ob.vy * 0.4);
while (hitGround(ob._x, ob._y - ob.heightRad)) {
ob._y = ob._y + ob.moveQuality;
}
}
if (hitGround(Math.round(ob._x - ob.widthRad), Math.round(ob._y - (ob.heightRad / 2)))) {
ob.vx = -Math.abs(ob.vx * 0.4);
ob.vy = ob.vy * 0.99;
if (ob.AI) {
if ((!hitGround(ob._x - (ob.widthRad * 2), ob._y - (ob.heightRad * 1.5))) && (ob.ground)) {
ob.vy = ob.vy - ob.jump;
}
}
while (hitGround(ob._x - ob.widthRad, ob._y - (ob.heightRad / 2))) {
ob._x = ob._x + ob.moveQuality;
}
} else if (hitGround(Math.round(ob._x + ob.widthRad), Math.round(ob._y - (ob.heightRad / 2)))) {
ob.vx = Math.abs(ob.vx * 0.4);
ob.vy = ob.vy * 0.99;
if (ob.AI) {
if ((!hitGround(ob._x + (ob.widthRad * 2), ob._y - (ob.heightRad * 1.5))) && (ob.ground)) {
ob.vy = ob.vy - ob.jump;
}
}
while (hitGround(ob._x + ob.widthRad, ob._y - (ob.heightRad / 2))) {
ob._x = ob._x - ob.moveQuality;
}
}
ms--;
}
}
function flyingAI(ob) {
if (ob.fa == undefined) {
ob.fa = 10;
}
if (ob.fa < 0) {
xd = player._x - ob._x;
if (Math.abs(xd) > 50) {
ob.vy = ob.vy - 11;
}
ob.fa = 10;
} else {
ob.fa--;
}
}
function updateAnimation(ob) {
if (ob.vx > 0) {
ob._xscale = 100;
} else {
ob._xscale = -100;
}
if (Math.abs(ob.vx) > 0.5) {
ob.gotoAndStop("walking");
} else {
ob.gotoAndStop("still");
}
}
function playerControl(ob) {
if (Key.isDown(controls.kleft)) {
ob.vx = ob.vx - ob.speed;
} else if (Key.isDown(controls.kright)) {
ob.vx = ob.vx + ob.speed;
} else if (ob.ground) {
ob.vx = ob.vx * 0.9;
}
if (Key.isDown(controls.kup) && (ob.ground)) {
ob.vy = -ob.jump;
}
if (Math.abs(ob.vx) > ob.xSpeedMax) {
ob.vx = ob.xSpeedMax * (ob.vx / Math.abs(ob.vx));
}
}
function enemyAI(ob) {
if ((ob._x + ob.widthRad) < (player._x - player.widthRad)) {
ob.vx = ob.vx + ob.speed;
} else if ((ob._x - ob.widthRad) > (player._x + player.widthRad)) {
ob.vx = ob.vx - ob.speed;
} else if (ob.ground) {
ob.vx = ob.vx * 0.9;
}
if (Math.abs(ob.vx) > ob.xSpeedMax) {
ob.vx = ob.xSpeedMax * (ob.vx / Math.abs(ob.vx));
}
}
function enemyGunAI(ob) {
xd = player._x - ob._x;
yd = player._y - ob._y;
dis = Math.sqrt((xd * xd) + (yd * yd));
if (dis > ob.range) {
if ((ob._x + ob.widthRad) < (player._x - player.widthRad)) {
ob.vx = ob.vx + ob.speed;
} else if ((ob._x - ob.widthRad) > (player._x + player.widthRad)) {
ob.vx = ob.vx - ob.speed;
} else if (ob.ground) {
ob.vx = ob.vx * 0.9;
}
} else {
ob.vx = ob.vx * 0.8;
if (!ob.reloading) {
if (ob.ammo > 0) {
if (ob.shootInt <= 0) {
enemyAttack(ob, player);
} else {
ob.shootInt--;
}
} else {
ob.reloading = true;
ob.reload = ob.gun.reload;
}
}
}
if (ob.reloading) {
if (ob.reload <= 0) {
ob.ammo = ob.gun.ammo;
ob.reloading = false;
} else {
ob.reload--;
}
}
if (Math.abs(ob.vx) > ob.xSpeedMax) {
ob.vx = ob.xSpeedMax * (ob.vx / Math.abs(ob.vx));
}
}
function enemyAttack(ob, target) {
egun = ob.gun;
if (((ob.ammo > 0) && (ob.shootInt <= 0)) && (!ob.reloading)) {
xd = ob._x - target._x;
yd = ob._y - target._y;
dir = (Math.atan2(yd, xd) / alpha) + 180;
var _local9 = new Sound(ob);
_local9.attachSound(egun.fireSound);
sv = Math.abs(600 - xd);
if (sv > 80) {
sv = 80;
}
_local9.setVolume(sv);
_local9.start(0, 1);
ob.vx = ob.vx - (Math.cos(dir * alpha) * egun.recoil);
ob.vy = ob.vy - (Math.sin(dir * alpha) * egun.recoil);
i = 0;
while (i < egun.amount) {
spd = egun.spd + ((Math.random() - Math.random()) * egun.spdR);
dir = dir + ((Math.random() - Math.random()) * egun.dirR);
_root.attachMovie("bullet", "bullet" + bulletNum, _root.getNextHighestDepth(), {_x:ob._x, _y:ob._y - (ob.heightRad / 2), _rotation:dir, vx:Math.cos(dir * alpha) * spd, vy:Math.sin(dir * alpha) * spd});
this["bullet" + bulletNum].iterations = egun.iterations;
this["bullet" + bulletNum].force = egun.force;
enemyBullets.push(this["bullet" + bulletNum]);
bulletNum++;
i++;
}
ob.ammo--;
ob.shootInt = egun.interval * 5;
}
}
function changeWeapon(num) {
gun = gunList[num];
}
function changeLevel(num) {
clearInterval(currentLevel.enemyInterval);
currentLevel = gameLevels[num];
loadLevel(currentLevel.gfx);
currentLevel.enemyInterval = setInterval(createEnemyNow, currentLevel.spawnInterval);
}
function loadLevel(nam) {
levelCol = _root.attachMovie(nam, "levelCol", _root.getNextHighestDepth());
currentLevel.spawnPoints = [{x:levelCol.enemySpawn1._x, y:levelCol.enemySpawn1._y}];
enemySpawn1 = {x:levelCol.enemySpawn1._x, y:levelCol.enemySpawn1._y};
enemySpawn2 = {x:levelCol.enemySpawn2._x, y:levelCol.enemySpawn2._y};
currentLevel.spawnPoints = [enemySpawn1, enemySpawn2];
player._x = levelCol.playerSpawn._x;
player._y = levelCol.playerSpawn._y;
level.draw(levelCol);
levelCol.removeMovieClip();
}
function drawLimbToBitmap(limb, bi) {
bitmapDrawHolder._visible = 1;
bitmapDrawHolder.attachMovie(limb.mcName, "a", 0, {_x:limb.mc._x, _y:limb.mc._y, _rotation:limb.mc._rotation, _xscale:limb.mc._xscale});
level.draw(bitmapDrawHolder);
}
function drawGround(x, y, r, c) {
xx = x - r;
while (xx < (x + r)) {
yy = y - r;
while (yy < (y + r)) {
level.setPixel32(xx, yy, c);
yy++;
}
xx++;
}
}
function drawGroundCir(x, y, r, c) {
xx = -r;
while (xx < r) {
yy = -r;
while (yy < r) {
if (Math.sqrt((xx * xx) + (yy * yy)) < r) {
level.setPixel32(x + xx, y + yy, c);
}
yy++;
}
xx++;
}
}
function hitGround(x, y) {
if (level.getPixel32(x, y) != 0) {
return(1);
}
return(0);
}
function attack() {
if (((gun.cAmmo > 0) && (gun.cInterval <= 0)) && (!gun.reloading)) {
var _local8 = new Sound(_root);
_local8.attachSound(gun.fireSound);
_local8.start(0, 1);
player.vx = player.vx - (Math.cos(player_gun._rotation * alpha) * gun.recoil);
player.vy = player.vy - (Math.sin(player_gun._rotation * alpha) * gun.recoil);
i = 0;
while (i < gun.amount) {
spd = gun.spd + ((Math.random() - Math.random()) * gun.spdR);
dir = player_gun._rotation + ((Math.random() - Math.random()) * gun.dirR);
_root.attachMovie("bullet", "bullet" + bulletNum, _root.getNextHighestDepth(), {_x:player._x, _y:player._y - (player.heightRad / 2), _rotation:dir, vx:Math.cos(dir * alpha) * spd, vy:Math.sin(dir * alpha) * spd});
this["bullet" + bulletNum].iterations = gun.iterations;
this["bullet" + bulletNum].force = gun.force;
this["bullet" + bulletNum].holeSize = gun.bulletHole;
bullets.push(this["bullet" + bulletNum]);
bulletNum++;
i++;
}
gun.cAmmo--;
gun.cInterval = gun.interval;
}
}
function updateBullets() {
iii = 0;
while (iii < bullets.length) {
bullet = bullets[iii];
bullet.vy = bullet.vy + 0.1;
if ((((bullet._x > screenWidth) or (bullet._y < 0)) or (bullet._y > screenHeight)) or (bullet._y < 0)) {
bullets[iii].removeMovieClip();
bullets.splice(iii, 1);
}
it = 0;
while (it < bullet.iterations) {
bullet._x = bullet._x + (bullet.vx / bullet.iterations);
bullet._y = bullet._y + (bullet.vy / bullet.iterations);
if (hitGround(bullet._x, bullet._y)) {
spd = Math.sqrt((bullet.vx * bullet.vx) + (bullet.vy * bullet.vy));
xma = (bullet.vx / spd) * 2;
yma = (bullet.vy / spd) * 2;
if (bullet._x != undefined) {
while (hitGround(bullet._x, bullet._y)) {
bullet._x = bullet._x - xma;
bullet._y = bullet._y - yma;
}
}
bullet._x = bullet._x + xma;
bullet._y = bullet._y + yma;
drawGroundCir(bullet._x, bullet._y, 2, 0);
bullets[iii].removeMovieClip();
bullets.splice(iii, 1);
break;
}
ii = 0;
while (ii < enemies.length) {
enemy = enemies[ii];
if (enemy.hitTest(bullet._x, bullet._y)) {
kills++;
rd = createRagdoll(enemy);
rd.vx = rd.vx + (bullet.vx * bullet.force);
rd.vy = rd.vy + (bullet.vy * bullet.force);
sprayBlood(bullet._x, bullet._y, 10, Math.atan2(bullet.vy, bullet.vx) / alpha, 45, 3, 3);
enemies[ii].removeMovieClip();
enemies.splice(ii, 1);
bullets[iii].removeMovieClip();
bullets.splice(iii, 1);
break;
}
ii++;
}
it++;
}
iii++;
}
iii = 0;
while (iii < enemyBullets.length) {
bullet = enemyBullets[iii];
bullet.vy = bullet.vy + 0.1;
if ((((bullet._x > screenWidth) or (bullet._y < 0)) or (bullet._y > screenHeight)) or (bullet._y < 0)) {
enemyBullets[iii].removeMovieClip();
enemyBullets.splice(iii, 1);
}
it = 0;
while (it < bullet.iterations) {
bullet._x = bullet._x + (bullet.vx / bullet.iterations);
bullet._y = bullet._y + (bullet.vy / bullet.iterations);
if (hitGround(bullet._x, bullet._y)) {
spd = Math.sqrt((bullet.vx * bullet.vx) + (bullet.vy * bullet.vy));
xma = (bullet.vx / spd) * 2;
yma = (bullet.vy / spd) * 2;
if (bullet._x != undefined) {
while (hitGround(bullet._x, bullet._y)) {
bullet._x = bullet._x - xma;
bullet._y = bullet._y - yma;
}
}
bullet._x = bullet._x + xma;
bullet._y = bullet._y + yma;
level.setPixel32(bullet._x, bullet._y, 0);
enemyBullets[iii].removeMovieClip();
enemyBullets.splice(iii, 1);
break;
}
if (player.hitTest(bullet._x, bullet._y)) {
player.vx = player.vx + ((bullet.vx * bullet.force) / 3);
player.vy = player.vy + ((bullet.vy * bullet.force) / 3);
sprayBlood(bullet._x, bullet._y, 10, Math.atan2(bullet.vy, bullet.vx) / alpha, 45, 3, 3);
enemyBullets[iii].removeMovieClip();
enemyBullets.splice(iii, 1);
break;
}
it++;
}
iii++;
}
}
function createEnemyNow() {
if (enemies.length < maxEnemies) {
et = random(currentLevel.spawnPoints.length);
typ = random(currentLevel.enemies.length - 1);
addEnemy(currentLevel.enemies[typ], currentLevel.spawnPoints[et]);
}
}
function addEnemy(dat, sp) {
enemies.push(addActor(dat.gfx, sp.x, sp.y, dat.modules));
actors[actors.length - 1].health = gameEnemy[dat.nam].health;
actors[actors.length - 1].gun = gameEnemy[dat.nam].gun;
actors[actors.length - 1].reload = gameEnemy[dat.nam].reload;
actors[actors.length - 1].shootInt = gameEnemy[dat.nam].shootInt;
actors[actors.length - 1].ammo = gameEnemy[dat.nam].ammo;
actors[actors.length - 1].reloading = gameEnemy[dat.nam].reloading;
actors[actors.length - 1].range = gameEnemy[dat.nam].range;
}
stop();
PE_gravity = 0.9;
PE_friction = 0.7;
PE_bounce = 0.1;
PE_bodies = [];
PE_iterations = 1;
PE_p_iterations = 5;
dDraw = _root.createEmptyMovieClip("dDraw", _root.getNextHighestDepth());
limbNum = 0;
bloodList = [];
bullet_regular = {};
bullet_regular.size = 1;
bullet_regular.iterations = 2;
bullet_regular.update = function (ob, ind) {
b = bullet_regular;
};
bullet_list = [bullet_regular];
guns = {};
guns.handgun = {};
guns.handgun.nam = "Teh Handgun";
guns.handgun.amount = 2;
guns.handgun.dirR = 2;
guns.handgun.spd = 60;
guns.handgun.spdR = 3;
guns.handgun.force = 0.1;
guns.handgun.iterations = 5;
guns.handgun.ammo = 666;
guns.handgun.auto = false;
guns.handgun.interval = 10;
guns.handgun.reload = 1;
guns.handgun.recoil = 0.2;
guns.handgun.zoom = 0.5;
guns.handgun.bulletHole = 3;
guns.handgun.fireSound = "rev";
guns.handgun.reloadSound = "magnum_reload";
guns.handgun.emptySound = "gun_empty";
guns.shotgun = {};
guns.shotgun.nam = "OMG SHOTGONN";
guns.shotgun.amount = 10;
guns.shotgun.dirR = 10;
guns.shotgun.spd = 100;
guns.shotgun.spdR = 10;
guns.shotgun.force = 1;
guns.shotgun.iterations = 5;
guns.shotgun.ammo = 100;
guns.shotgun.auto = false;
guns.shotgun.interval = 20;
guns.shotgun.reload = 1;
guns.shotgun.recoil = 1;
guns.shotgun.zoom = 0;
guns.shotgun.bulletHole = 3;
guns.shotgun.fireSound = "shotgun_shot";
guns.shotgun.reloadSound = "shotgun_reload";
guns.shotgun.emptySound = "gun_empty";
guns.uzi = {};
guns.uzi.nam = "OOZI";
guns.uzi.amount = 1;
guns.uzi.dirR = 6;
guns.uzi.spd = 100;
guns.uzi.spdR = 20;
guns.uzi.force = 0.5;
guns.uzi.iterations = 10;
guns.uzi.ammo = 1337;
guns.uzi.auto = true;
guns.uzi.interval = 5;
guns.uzi.reload = 1;
guns.uzi.recoil = 0.1;
guns.uzi.zoom = 0.7;
guns.uzi.bulletHole = 3;
guns.uzi.penDepth = 3;
guns.uzi.fireSound = "gunshot2";
guns.uzi.reloadSound = "magnum_reload";
guns.uzi.emptySound = "gun_empty";
guns.barret = {};
guns.barret.nam = "Death";
guns.barret.amount = 5;
guns.barret.dirR = 0.5;
guns.barret.spd = 100;
guns.barret.spdR = 1;
guns.barret.force = 0.3;
guns.barret.iterations = 10;
guns.barret.ammo = 1234;
guns.barret.auto = true;
guns.barret.interval = 2;
guns.barret.reload = 1;
guns.barret.recoil = 0.1;
guns.barret.zoom = 1;
guns.barret.bulletHole = 0.5;
guns.barret.fireSound = "barret";
guns.barret.reloadSound = "magnum_reload";
guns.barret.emptySound = "gun_empty";
gunList = [guns.handgun, guns.shotgun, guns.uzi, guns.barret];
enemyTypes = [];
gameEnemy = {};
gameEnemy.zombie = {};
gameEnemy.zombie.nam = "zombie";
gameEnemy.zombie.gfx = "nazi1";
gameEnemy.zombie.health = 2;
gameEnemy.zombie.gun = gunList[0];
gameEnemy.zombie.reload = 10;
gameEnemy.zombie.shootInt = 1;
gameEnemy.zombie.ammo = 0;
gameEnemy.zombie.reloading = true;
gameEnemy.zombie.range = 250;
gameEnemy.zombie.modules = ["enemyGunAI", "updateActor", "updateAnimation"];
gameLevels = [{gfx:"level1c", enemies:[gameEnemy.zombie], spawnInterval:300}, {gfx:"level2c", enemies:[gameEnemy.zombie], spawnInterval:1000}];
bullet_regular.update();
PE_debug = false;
screenWidth = 2880;
screenHeight = 2880;
var level = (new flash.display.BitmapData(screenWidth, screenHeight, true, 0));
levelGfx = _root.createEmptyMovieClip("levelGfx", _root.getNextHighestDepth());
levelGfx.attachBitmap(level, 0);
_root.createEmptyMovieClip("bitmapDrawHolder", _root.getNextHighestDepth());
bitmapDrawHolder._visible = 0;
gravity = 0.5;
actors = [];
actorNum = 0;
player = addActor("player", 50, 50, ["playerControl", "updateActor", "updateAnimation"]);
player.AI = false;
player_gun.swapDepths(_root.getNextHighestDepth());
enemies = [];
maxEnemies = 12;
i = 0;
while (i < gunList.length) {
cgun = gunList[i];
cgun.cAmmo = cgun.ammo;
cgun.cReload = cgun.reload;
cgun.reloading = 0;
cgun.cInterval = cgun.interval;
i++;
}
changeWeapon(0);
bulletNum = 0;
bullets = [];
enemyBullets = [];
cameraOb = player;
kills = 0;
oldTime = 0;
fps = 0;
onEnterFrame = function () {
fps = ((((((((((((((("FPS: " + Math.round(1000 / (getTimer() - oldTime))) + newline) + "kills: ") + kills) + "\nbullets: ") + bullets.length) + "\nragdolls: ") + PE_bodies.length) + "\n\nGun: ") + gun.nam) + "\nAmmo: ") + gun.cAmmo) + "/") + gun.ammo) + "\nReload: ") + gun.cReload;
oldTime = getTimer();
updateActors();
PE_update();
updateBlood();
updateBullets();
player_gun._x = player._x;
player_gun._y = player._y - (player.heightRad / 2);
player_gun._rotation = (Math.atan2((player._y - (player.heightRad / 2)) - _ymouse, player._x - _xmouse) / alpha) + 180;
if ((player_gun._rotation < -90) or (player_gun._rotation > 90)) {
player_gun._yscale = -100;
} else {
player_gun._yscale = 100;
}
_x = (_x - Math.round((_x - ((275 - cameraOb._x) - (((_xmouse + _x) - 275) * gun.zoom))) / 10));
_y = (_y - Math.round((_y - ((200 - cameraOb._y) - (((_ymouse + _y) - 200) * gun.zoom))) / 10));
if (Key.isDown(1)) {
if (gun.auto) {
attack();
}
}
if (gun.cInterval > 0) {
gun.cInterval--;
}
if (gun.reloading) {
if (gun.cReload <= 0) {
gun.cAmmo = gun.ammo;
gun.reloading = 0;
gun.cReload = gun.reload;
} else {
gun.cReload--;
}
}
UI._x = -_x;
UI._y = -_y;
UI.swapDepths(_root.getNextHighestDepth());
};
onMouseDown = function () {
if (Key.isDown(16)) {
PE_debug = !PE_debug;
dDraw.clear();
} else if (Key.isDown(32)) {
ii = 0;
while (ii < enemies.length) {
e = enemies[ii];
xxd = player._x - e._x;
yyd = player._y - e._y;
dis = Math.sqrt((xxd * xxd) + (yyd * yyd));
if (dis < 200) {
rd = createRagdoll(e);
rd.vx = rd.vx + (((-xxd) / dis) * 15);
rd.vy = rd.vy + (((-yyd) / dis) * 15);
e.removeMovieClip();
enemies.splice(ii, 1);
}
ii++;
}
} else if (!gun.auto) {
if (gun.cAmmo <= 0) {
var _local2 = new Sound(_root);
_local2.attachSound(gun.emptySound);
_local2.start(0, 1);
}
attack();
}
};
var keyList = new Object();
keyList.onKeyDown = function () {
if (Key.isDown(82)) {
gun.reloading = 1;
}
if (Key.isDown(49)) {
changeWeapon(0);
} else if (Key.isDown(50)) {
changeWeapon(1);
} else if (Key.isDown(51)) {
changeWeapon(2);
} else if (Key.isDown(52)) {
changeWeapon(3);
}
};
Key.addListener(keyList);
changeLevel(0);
Symbol 33 MovieClip [nazi1] Frame 1
points = [frame.head, frame.body, frame.arms, frame.lbf, frame.lbb, frame.abf, frame.abb];
constraints = [{p1:2, p2:0}, {p1:2, p2:1}];
limbs = [{gfx:"nazi1_ab", p1:2, p2:6}, {gfx:"nazi1_lb", p1:1, p2:4}, {gfx:"nazi1_body", p1:1, p2:0}, {gfx:"nazi1_lf", p1:1, p2:3}, {gfx:"nazi1_af", p1:2, p2:5}];
stop();
Symbol 36 MovieClip [level1c] Frame 1
spawnPoints = [enemySpawn1, enemySpawn2];
Symbol 47 MovieClip [player] Frame 1
points = [frame.head, frame.body, frame.arms, frame.lbf, frame.lbb, frame.abf, frame.abb];
constraints = [{p1:2, p2:0}, {p1:2, p2:1}];
limbs = [{gfx:"arm_back", p1:2, p2:6}, {gfx:"leg_back", p1:1, p2:4}, {gfx:"body", p1:1, p2:0}, {gfx:"leg_front", p1:1, p2:3}, {gfx:"arm_front", p1:2, p2:5}];
stop();
Symbol 65 MovieClip [enemy_flying1] Frame 1
points = [frame.head, frame.neck, frame.body, frame.tail];
constraints = [{p1:0, p2:2}];
limbs = [{gfx:"enemy_flying1_tail", p1:2, p2:3}, {gfx:"enemy_flying1_body", p1:2, p2:1}, {gfx:"enemy_flying1_head", p1:1, p2:0}];
stop();
Symbol 75 MovieClip [level2c] Frame 1
spawnPoints = [enemySpawn1, enemySpawn2];
Symbol 79 Button
on (release) {
gotoAndStop (2);
}
Symbol 87 Button
on (release) {
getURL ("http://www.supa-monky.deviantart.com", "_blank");
}