Section 1
//MainTimeline (mainfla_fla.MainTimeline)
package mainfla_fla {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.media.*;
import flash.filters.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
import flash.ui.*;
import flash.geom.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public const necklength = 6;
public const computerheight = 24;
public const riflepickupammo = 20;
public const bulletslowamount = 1.75;
public const megazombieinaccuracy = 16;
public const smgtracercolor = 0xFFFF00;
public const weaponchance = 500;
public const g = 0.15;
public const grenadeammoamount = 3;
public const lowerleglength = 8;
public const rocketlivetime = 50;
public const enemyBhealth = 65;
public const enemyCseedistance = 800;
public const berserkduration = 200;
public const nailgunflashdistance = 8;
public const pistolyoffset = 9;
public const turretflashdistance = 8;
public const bulletcasingrotatespeed = 25;
public const kamikazepush = 6;
public const rifleammosidelength = 12;
public const noderadius = 20;
public const megazombiegundistance = 12;
public const linedebrislivetime = 250;
public const shotgunframe = 6;
public const spinspeed = 12;
public const weaponfadetime = 100;
public const rifleammoamount = 30;
public const laserlivetime = 100;
public const enemyBaircontrolfactor = 0.1;
public const playerf = 0.9;
public const playerg;
public const chainf = 0.5;
public const weaponf = 0.75;
public const chaing;
public const naillivetime = 200;
public const smgshootdelay = 3;
public const weapong;
public const playerwatercontrolfactor = 0.6;
public const safetydisplacement = 0.15;
public const enemyBshootdelay = 24;
public const rpglength = 24;
public const crateradius = 12;
public const rifleflashdistance = 10;
public const naildummytime = 30;
public const smginaccuracy = 12;
public const bulletbloodps = 2;
public const riflecasingsize = 5;
public const smgtraceralpha = 0.4;
public const berserkmultiplier = 10;
public const enemyBinaccuracy = 90;
public const stringf = 0.75;
public const stringg;
public const grenadebarreldistance = 6;
public const grenadeshootdistance = 5;
public const turretbarreldistance = 24;
public const rpgdamage = 200;
public const pistolnum = 1;
public const enemyAwatercontrolfactor = 0.4;
public const chainsegmentlength = 10;
public const fireskipnum = 7;
public const playeraf = 0.99;
public const smgammosidelength = 10;
public const physicsobjectcolor = 0xFFF000;
public const megazombiemaxshots = 5;
public const rocketdamage = 200;
public const pointdebrisfadetime = 20;
public const grenadenum = 2;
public const smgholddistance = 10;
public const neckconstraint = 12;
public const enemyAaf = 0.99;
public const degtorad = 0.0174532925199433;
public const nailgunyoffset = 15;
public const enemyAaircontrolfactor = 0.15;
public const riflelength = 16;
public const smgflashdistance = 6;
public const bulletcasingfadetime = 10;
public const rpgbarreldistance = 16;
public const pistolflashdistance = 9;
public const bulletcasingaf = 0.95;
public const weaponlivetime = 500;
public const nailgunnum = 9;
public const rifletracercolor = 0xFFFF00;
public const shotguntracercolor = 0xFFFF00;
public const nailspeed = 25;
public const smgcasingskip = 3;
public const pistolpickupammo = 20;
public const enemyAshootdistance = 16;
public const itemchance = 300;
public const characterpushratio = 0.08;
public const rifledamage = 5;
public const smgframe = 8;
public const nailgunframe = 12;
public const upperlegconstraint1 = 12;
public const upperlegconstraint2 = 20;
public const rpgyoffset = 8;
public const playerjumpdelay = 5;
public const chaindebrisf = 0.6;
public const chaindebrisg;
public const rocketradius = 150;
public const enemyBwatercontrolfactor = 0.3;
public const corpsef = 0.5;
public const corpseg;
public const rifleholddistance = 16;
public const grenadeshootdelay = 45;
public const rpgflashdistance = 4;
public const resttime = 90;
public const turretdebrisparticles = 3;
public const maxrifleammo = 60;
public const shotgunholddistance = 14;
public const enemyCshootdelay = 20;
public const maxdelta = 5;
public const enemyCdamage = 70;
public const grenadeinaccuracy = 12;
public const enemyBmaxmovespeed = 2.5;
public const ratradius = 4;
public const enemyCinaccuracy = 90;
public const maxpistolammo = 48;
public const grenadeyoffset = 8;
public const maxnailgunammo = 48;
public const enemyAhealth = 40;
public const pistolammoamount = 20;
public const grenadepush = 5;
public const pickupf = 0.6;
public const pickupg;
public const pistolammosidelength = 10;
public const rifleshootdelay = 5;
public const boxdebrisaf = 0.96;
public const turretshootdelay = 8;
public const pointdebrislivetime = 200;
public const enemyAf = 0.95;
public const enemyAg;
public const megazombieflashdistance = 8;
public const chaindebrissegmentlength = 5;
public const rifleinaccuracy = 4;
public const turretbaselength = 24;
public const rifletraceralpha = 0.75;
public const shotguntraceralpha = 0.25;
public const enemyBf = 0.95;
public const enemyBg;
public const enemyAseedistance = 800;
public const nailgunshootdistance = 300;
public const rpgpickupammo = 1;
public const laserdamage = 20;
public const enemyCf = 0.95;
public const enemyCg;
public const turretinaccuracy = 5;
public const rpgholddistance = 4;
public const turretshootdistance = 600;
public const pistolcasingsize = 3;
public const bulletcasinglivetime = 100;
public const corpsegibs = 4;
public const nailgunammosidelength = 12;
public const enemyCwatercontrolfactor = 0.2;
public const grenadedamage = 100;
public const nailgunpickupammo = 24;
public const turretside = -1;
public const bulletcasingspeed = 3;
public const lowerarmlength = 5;
public const riflebarreldistance = 21;
public const chainsawlength = 24;
public const turretmaxswivel = 60;
public const rifleyoffset = 9;
public const megazombiedamage = 3;
public const maxcorpses = 5;
public const messageduration = 300;
public const chainaf = 0.99;
public const crateheight = 24;
public const enemyAmovedelay = 16;
public const bulletcasingf = 0.5;
public const bulletcasingg;
public const chainsawdamage = 5;
public const chaindebrissegments = 6;
public const pistollength = 8;
public const enemyCshootdistance = 16;
public const chainsawholddistance = 10;
public const weaponaf = 0.98;
public const rifleshootdistance = 300;
public const enemyBaf = 0.99;
public const grenaderadius = 100;
public const shotgunyoffset = 10;
public const nailgunammoamount = 24;
public const pickupaf = 0.99;
public const pistoldamage = 4;
public const rifleframe = 0;
public const megazombierotatespeed = 3;
public const playermoveacceleration = 0.3;
public const riflenum = 0;
public const barrelradius = 10;
public const riflecasingskip = 2;
public const pistolcasingframe = 0;
public const shotgunpickupammo = 8;
public const enemyBmovedelay = 20;
public const nailpinspeed = 4;
public const upperleglength = 8;
public const smgbarreldistance = 11;
public const chainsawshootdelay = 3;
public const boxdebrisfadetime = 30;
public const nailguncasingsize = 6;
public const laserspeed = 10;
public const smgyoffset = 9;
public const turretdamage = 25;
public const pointdebrisaf = 0.98;
public const maxlights = 32;
public const pistolholddistance = 12;
public const chaindebrisaf = 0.97;
public const megazombiebarreldistance = 24;
public const corpseaf = 0.99;
public const nailaf = 0.96;
public const turrettracercolor = 0xFFFF00;
public const safetydistance = 16;
public const explosionbloodps = 6;
public const enemyside = 1;
public const smgshootdistance = 300;
public const enemyCmovedelay = 12;
public const pistolshootdistance = 300;
public const limbfadetime = 40;
public const chainsawbarreldistance = 0;
public const rpgframe = 14;
public const shotgunammoamount = 8;
public const megazombieseedistance = 270;
public const maxgrenadeammo = 6;
public const nailmaxbleedtime = 60;
public const pistolshootdelay = -1;
public const shotgunflashdistance = 15;
public const enemyBdamage = 55;
public const shotgunnum = 3;
public const pickupfadetime = 100;
public const grenaderotatespeed = 80;
public const shotgunammosidelength = 10;
public const pistolinaccuracy = 8;
public const shotguncasingsize = 6;
public const crowradius = 4;
public const nailgunholddistance = 7;
public const smgcasingframe = 0;
public const riflerecieverdistance = 7;
public const ragdollheight;
public const pistolframe = 2;
public const healthsidelength = 12;
public const shotgunlength = 24;
public const smglength = 8;
public const enemyCmoveacceleration = 0.3;
public const grenadefadetime = 1;
public const bulletpushradius = 6;
public const boxdebrislivetime = 300;
public const turrettraceralpha = 80;
public const chaindebrisfadetime = 35;
public const corpsefadetime = 50;
public const pistolbarreldistance = 12;
public const limbg;
public const limbf = 0.9;
public const berserkdecay = 0.75;
public const nailgunlength = 24;
public const shotgundamage = 8;
public const smgdamage = 5;
public const enemyCaf = 0.99;
public const playerjumpspeed = -4;
public const enemyBseedistance = 800;
public const nailgundamage = 15;
public const enemyCmaxmovespeed = 2;
public const shotgunrecieverdistance = 4;
public const computerradius = 12;
public const stringsegmentlength = 12;
public const nailgunbarreldistance = 19;
public const limblivetime = 200;
public const playermaxmovespeed = 3;
public const maxlookdelta = 60;
public const pistolcasingskip = 1;
public const nailgunshootdelay = 9;
public const chainsawyoffset = 12;
public const rpginaccuracy = 5;
public const enemyChealth = 30;
public const linedebrisg;
public const pointdebrisrotatespeed = 15;
public const lowerarmconstraint = 4;
public const rocketpush = 6;
public const linedebrisf = 0.75;
public const maxshotgunammo = 24;
public const nailguncasingframe = 3;
public const stringaf = 0.98;
public const nailguninaccuracy = 10;
public const upperarmconstraint = 6;
public const nailslowamount = 3;
public const pickuplivetime = 1500;
public const barrelheight = 20;
public const smgpickupammo = 30;
public const enemyBmoveacceleration = 0.4;
public const chainsawshootdistance = 25;
public const kamikazedamage = 100;
public const enemychance = 70;
public const radtodeg = 57.2957795130823;
public const playeraircontrolfactor = 0.25;
public const grenadeg;
public const grenadeframe = 4;
public const turretrotatespeed = 2;
public const chainsawframe = 10;
public const bulletcasingdirection = 20;
public const rpgnum = 10;
public const chainsawnum = 5;
public const grenadef = 0.5;
public const lowerlegconstraint = 5;
public const grenadelivetime = 150;
public const grenadeammosidelength = 18;
public const naildamage = 15;
public const chestlength = 7;
public const chaindebrislivetime = 250;
public const corpselivetime = 300;
public const shotgunshootdelay = 20;
public const megazombiehealth = 30;
public const enemyBshootdistance = 24;
public const shotguninaccuracy = 16;
public const smgammoamount = 40;
public const healthamount = 200;
public const kamikazeradius = 100;
public const nailguncasingskip = 1;
public const shotguncasingframe = 2;
public const riflecasingframe = 1;
public const pistoltracercolor = 0xFFFF00;
public const upperarmlength = 5;
public const grenadeaf = 0.995;
public const rocketspeed = 20;
public const hsbloodps = 4;
public const linedebrislength = 16;
public const headshotmultiplier = 4;
public const boxdebrisf = 0.5;
public const boxdebrisg;
public const minbulletcasingspeed = 1;
public const maxrpgammo = 1;
public const turretseedistance = 600;
public const enemyAdamage = 35;
public const enemyAmaxmovespeed = 3;
public const megazombieside = 1;
public const smgcasingsize = 3;
public const boxdebrissidelength = 8;
public const enemyAmoveacceleration = 0.5;
public const bulletpushspeed = 4;
public const linedebrisfadetime = 25;
public const smgrecieverdistance = 4;
public const pointdebrisf = 0.7;
public const pointdebrisg;
public const shotgunshootdistance = 300;
public const nailgunrecieverdistance = 4;
public const linedebrisaf = 0.98;
public const pistolrecieverdistance = 8;
public const maxberserkamount = 300;
public const smgnum = 4;
public const shotgunbarreldistance = 20;
public const enemyAshootdelay = 16;
public const turrethealth = 30;
public const killberserkamount = 60;
public const nailfadetime = 50;
public const limbaf = 0.97;
public const shotguncasingskip = 1;
public const maxrestdelta = 1;
public const enemyAinaccuracy = 90;
public const maxbloodps = 5;
public const enemyCaircontrolfactor = 0.1;
public const chestconstraint = 11.326;
public const playerside = 0;
public const maxsmgammo = 90;
public const pistoltraceralpha = 0.5;
public const megazombieshootdelay = 3;
public var line:Array;
public var vstring:Array;
public var killzone:Array;
public var string:Array;
public var lightcontainer:Sprite;
public var playerweapon:uint;
public var raindrops:int;
public var fullbtn0:SimpleButton;
public var fullbtn1:SimpleButton;
public var fullbtn2:SimpleButton;
public var fullbtn3:SimpleButton;
public var fullbtn4:SimpleButton;
public var megazombiedie:Sound;
public var f:int;
public var o:uint;
public var i:uint;
public var messagetextdelay:uint;
public var u:uint;
public var p:Array;
public var t:uint;
public var playerhealth:uint;
public var walldoor:Array;
public var q:uint;
public var z:uint;
public var r:uint;
public var isplayer:Boolean;
public var nonebtn0:SimpleButton;
public var nonebtn1:SimpleButton;
public var nonebtn3:SimpleButton;
public var yposition:Number;
public var vobjectline:Array;
public var gps:uint;
public var berserkbar:MovieClip;
public var movetrail:Array;
public var alternatenum:uint;
public var numberofps:int;
public var tdtp:Array;
public var rope:Array;
public var fires:uint;
public var hinge:Array;
public var selectedp:int;
public var nailgunammo:Array;
public var electricbuzz:Sound;
public var bodyAs:uint;
public var wait:int;
public var pistol:Array;
public var winzone:Array;
public var chainsaw:Array;
public var hardbtn:SimpleButton;
public var bodyBs:uint;
public var vbox:Array;
public var xposition:Number;
public var pickuptext:String;
public var chaindistance:Number;
public var killzones:uint;
public var enemyA:Array;
public var enemyB:Array;
public var enemyC:Array;
public var players:int;
public var tempnormal:Number;
public var floordoor:Array;
public var rocketshoot:Sound;
public var bodyCs:uint;
public var weapons:uint;
public var bodyDs:uint;
public var chains:uint;
public var wateraffector:Array;
public var particlequalityselection:MovieClip;
public var waterspray:Sound;
public var blast:Array;
public var backgroundmappropscontainer:Sprite;
public var berserkscreen:MovieClip;
public var playerrpgammo:uint;
public var rifleshoot:Sound;
public var health:Array;
public var playerpistolammo:uint;
public var weaponglowfilter:GlowFilter;
public var linedebris:Array;
public var strings:uint;
public var bool1;
public var bool2:Boolean;
public var bool3:Boolean;
public var bool4:Boolean;
public var bool5:Boolean;
public var bool6:Boolean;
public var hitzones:uint;
public var lowerlegs:uint;
public var nodes:uint;
public var pickupglowfilter:GlowFilter;
public var debrisqualityselection:MovieClip;
public var dooropen:Sound;
public var leftlegdamage:uint;
public var boxdebris:Array;
public var pointdebris:Array;
public var lighting:Boolean;
public var foundbullet:int;
public var explosion:Sound;
public var easybtn:SimpleButton;
public var screenflash:MovieClip;
public var shotgunammos:uint;
public var chance:int;
public var cursor:MovieClip;
public var blastdamage:Number;
public var midgroundmappropscontainer:Sprite;
public var hit:Array;
public var playersmgammo:uint;
public var playergrenadeammo:uint;
public var rpgs:uint;
public var lowerarm:Array;
public var boxes:uint;
public var crate:Array;
public var bodypartscontainer;
public var controlsbtn:SimpleButton;
public var graphicsquality:uint;
public var lowerarms:uint;
public var rockets:uint;
public var spawnpointdirection:Number;
public var possiblelines:uint;
public var damagezones:uint;
public var clicktime:uint;
public var hudmessagetext:TextField;
public var movefactor:Number;
public var chaindebriss:uint;
public var corpses:uint;
public var zombiedie:Sound;
public var hinges:uint;
public var computers:uint;
public var legsoffset:Number;
public var metalcrash:Sound;
public var bullet:Array;
public var pistolshoot:Sound;
public var bodynormal:Number;
public var crates:uint;
public var grenadeammo:Array;
public var light:Array;
public var shotguns:uint;
public var background:MovieClip;
public var schannel:SoundChannel;
public var textformat1:TextFormat;
public var textformat2:TextFormat;
public var textformat3:TextFormat;
public var megazombieengine:Sound;
public var clicking:Boolean;
public var pickups:uint;
public var vline:Array;
public var barrels:uint;
public var point:Array;
public var hitzone:Array;
public var effectscontainer:Sprite;
public var hudhealthtext:TextField;
public var enemyAs;
public var loopchannel:SoundChannel;
public var particlealphaselection:MovieClip;
public var enemyBs;
public var torso:Array;
public var mytestcontainer:Sprite;
public var enemycontainer:Sprite;
public var weapondisplays:uint;
public var floordoors:uint;
public var reducedbtn0:SimpleButton;
public var reducedbtn1:SimpleButton;
public var reducedbtn4:SimpleButton;
public var physicscontainer:Sprite;
public var reducedbtn2:SimpleButton;
public var pkey1:Boolean;
public var spinlight:Array;
public var spawnfacedirection:Number;
public var pkey8:Boolean;
public var sloth:MovieClip;
public var pkey3:Boolean;
public var pkey4:Boolean;
public var pkey5:Boolean;
public var pkey2:Boolean;
public var loopchannel2:SoundChannel;
public var fire:Array;
public var smgammos:uint;
public var nailgunammos:uint;
public var enemyCs;
public var nailguns:uint;
public var pkey7:Boolean;
public var ammodisplay:MovieClip;
public var playerhasrifle:Boolean;
public var playershotgunammo:uint;
public var megazombies;
public var pkeyd:Boolean;
public var pkey6:Boolean;
public var pkeyq:Boolean;
public var vrope:Array;
public var pkeya:Boolean;
public var pkeyspace:Boolean;
public var upperarm:Array;
public var fade:MovieClip;
public var pkeyw:Boolean;
public var particlealpha:uint;
public var turretbarrels;
public var drawnline:Array;
public var bigcrash:Sound;
public var chain:Array;
public var countedcorpses:uint;
public var ammopickup:Sound;
public var rocket:Array;
public var healthdisplay:MovieClip;
public var bulletcasings:uint;
public var currentnode:int;
public var bulletcasingselection:MovieClip;
public var collisionlines:uint;
public var temppdistance:Number;
public var crowwing:Array;
public var debrisquality:uint;
public var teleport:Sound;
public var playerhasrpg:Boolean;
public var squish:Sound;
public var nailgun:Array;
public var bulletcasing:Array;
public var lowestpnum2:int;
public var gplayerdamage:Number;
public var found:Boolean;
public var weaponpickup:Sound;
public var segments:uint;
public var difficulty:uint;
public var upperlegs:uint;
public var grenadeexplode:Sound;
public var shotgunammo:Array;
public var healthpickup:Sound;
public var chainsawstart:Sound;
public var tsin:Array;
public var vgp:Array;
public var shell1:Sound;
public var shell3:Sound;
public var shell4:Sound;
public var shell5:Sound;
public var shell2:Sound;
public var lightfilter:GlowFilter;
public var rat:Array;
public var megazombieguns;
public var megazombieintro:Sound;
public var backdrop:MovieClip;
public var rightlegdamage:uint;
public var tdistance:Array;
public var wateraffectors:uint;
public var dchance:Number;
public var menubtn:SimpleButton;
public var playerhaschainsaw:Boolean;
public var leftarmdamage:uint;
public var projectilecontainer:Sprite;
public var crows:uint;
public var nailgunshooting:Sound;
public var turretbases;
public var highestchance:int;
public var torsos:uint;
public var deathcounter:uint;
public var rainfall:Sound;
public var waterfall:Sound;
public var beginbtn:SimpleButton;
public var turretshoot:Sound;
public var playerhasnailgun:Boolean;
public var nails:uint;
public var upperarms:uint;
public var foreground:MovieClip;
public var bestcx:Number;
public var bestcy:Number;
public var city:Array;
public var pickuptextdelay:uint;
public var maskmc:MovieClip;
public var hydrantspray:Sound;
public var healthtext:String;
public var playerdamage:Sound;
public var healths:uint;
public var grenadebounce1:Sound;
public var grenadebounce2:Sound;
public var grenadebounce3:Sound;
public var rifleammos:uint;
public var rifleammo:Array;
public var waterpool:Array;
public var messagetext:String;
public var counter1:int;
public var counter2:int;
public var counter3:int;
public var counter4:int;
public var counter5:int;
public var counter6:int;
public var nailhit:Sound;
public var crowcaw:Sound;
public var rpg:Array;
public var turretexplode:Sound;
public var explosiondistance:Number;
public var nail:Array;
public var inmap:Boolean;
public var chainsawrev:Sound;
public var maxmovespeed:Number;
public var movetrails:uint;
public var hitsomething:Boolean;
public var alarm:Sound;
public var lowestframerate:uint;
public var plane:Sound;
public var berserkdisplay:MovieClip;
public var vhinge:Array;
public var foregroundmappropscontainer:Sprite;
public var mytestcontainer2:Sprite;
public var mytestcontainer3:Sprite;
public var playerhassmg:Boolean;
public var crow:Array;
public var rifles:uint;
public var bcchance:Number;
public var deltahs:Number;
public var playerhaspistol:Boolean;
public var bodyA:Array;
public var player:Array;
public var bodyD:Array;
public var bodyB:Array;
public var vdrawnline:Array;
public var bodyC:Array;
public var limbs:uint;
public var optionsbtn:SimpleButton;
public var smallcrash:Sound;
public var hudammotext:TextField;
public var stringdistance:Number;
public var lasers:uint;
public var item:Array;
public var temporaryhs:Number;
public var objectdirection:Number;
public var menubtn2:SimpleButton;
public var menubtn3:SimpleButton;
public var objectlines:uint;
public var cities:uint;
public var bestsurfacedirection:Number;
public var chaindebris:Array;
public var corpse:Array;
public var lowerleg:Array;
public var rain:Array;
public var directiondelta:Number;
public var mapnumber:int;
public var bullets:uint;
public var objectline:Array;
public var foundblast:int;
public var tempdistance:Number;
public var playerrifleammo:uint;
public var shotgunshoot:Sound;
public var linedebriss:uint;
public var impacty:Number;
public var impactx:Number;
public var randsound:int;
public var shotgun:Array;
public var lasershoot:Sound;
public var healthbar:MovieClip;
public var pistolammos:uint;
public var pdistance:Number;
public var deltavs:Number;
public var cy:Number;
public var df:uint;
public var cx:Number;
public var possiblelinenum:Array;
public var weaponscontainer:Sprite;
public var tcos:Array;
public var turretbarrel:Array;
public var fog:MovieClip;
public var pistolammo:Array;
public var backdropcopy:Bitmap;
public var smgs:uint;
public var groundoffset:Number;
public var spinlights:uint;
public var gp:Array;
public var pickupscontainer:Sprite;
public var rats:uint;
public var points:uint;
public var ammotext:String;
public var grenades:uint;
public var fontformat:Font;
public var megazombieexhaust:Sound;
public var megazombie:Array;
public var berserk:Sound;
public var waterpools:uint;
public var megazombiegun:Array;
public var showphysicsobjects:Boolean;
public var smg:Array;
public var grenade:Array;
public var debriscontainer:Sprite;
public var blasts:uint;
public var vcollisionline:Array;
public var ragdolls:uint;
public var crowwings:uint;
public var tempx2:Number;
public var smgammo:Array;
public var tempx1:Number;
public var backgroundcopy:Bitmap;
public var surfacedirection:Number;
public var tempy2:Number;
public var ropes:uint;
public var drawnlines:uint;
public var tempy1:Number;
public var playerhasshotgun:Boolean;
public var deltahs2:Number;
public var box:Array;
public var pistols:uint;
public var head:Array;
public var hudpickuptext:TextField;
public var node:Array;
public var ps:uint;
public var vwaterpool:Array;
public var lights:int;
public var music:Sound;
public var enemies:uint;
public var clickedbutton:Boolean;
public var upperleg:Array;
public var boxdebriss:uint;
public var drip:Sound;
public var rightarmdamage:uint;
public var gundirection:Number;
public var vragdoll:Array;
public var u2:int;
public var collisionline:Array;
public var dryfire:Sound;
public var debugmode:Boolean;
public var ratsqueak:Sound;
public var slothbtn0:SimpleButton;
public var heads:uint;
public var bulletcasingquality:uint;
public var damagetaken:Number;
public var npccontainer:Sprite;
public var mediumbtn:SimpleButton;
public var rifle:Array;
public var laser:Array;
public var pointdebriss:uint;
public var grenadeammos:uint;
public var messagestring:String;
public var legAs:uint;
public var vpoint:Array;
public var smgshoot:Sound;
public var lowestpdistance:Number;
public var walldoors:uint;
public var legBs:uint;
public var lines:uint;
public var playerhasgrenade:Boolean;
public var computer:Array;
public var legCs:uint;
public var weapondisplay:Array;
public var foregroundcopy:Bitmap;
public var legDs:uint;
public var hits:uint;
public var temprotation:Number;
public var ragdoll:Array;
public var qualityselection:MovieClip;
public var cutscene:Boolean;
public var damagezone:Array;
public var barrel:Array;
public var playernailgunammo:uint;
public var particlequality:uint;
public var links:uint;
public var turretbase:Array;
public var limb:Array;
public var winzones:uint;
public var chainsaws:uint;
public var legA:Array;
public var legC:Array;
public var legD:Array;
public var link:Array;
public var legB:Array;
public function MainTimeline(){
pickupg = g;
weapong = g;
playerg = g;
enemyCg = g;
enemyBg = g;
enemyAg = g;
stringg = g;
pointdebrisg = g;
linedebrisg = g;
boxdebrisg = g;
chaindebrisg = g;
limbg = g;
corpseg = g;
bulletcasingg = g;
chaing = g;
grenadeg = (g * 0.5);
ragdollheight = ((((necklength + Math.sqrt((((chestlength * 0.5) * (chestlength * 0.5)) + (chestconstraint * chestconstraint)))) + upperleglength) + lowerleglength) * 0.5);
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9);
}
public function restoreplayerinfo(){
player[0].weapon = playerweapon;
player[0].damage = gplayerdamage;
player[0].rifleammo = playerrifleammo;
player[0].hasrifle = playerhasrifle;
player[0].pistolammo = playerpistolammo;
player[0].haspistol = playerhaspistol;
player[0].grenadeammo = playergrenadeammo;
player[0].hasgrenade = playerhasgrenade;
player[0].shotgunammo = playershotgunammo;
player[0].hasshotgun = playerhasshotgun;
player[0].smgammo = playersmgammo;
player[0].hassmg = playerhassmg;
player[0].nailgunammo = playernailgunammo;
player[0].hasnailgun = playerhasnailgun;
player[0].rpgammo = playerrpgammo;
player[0].hasrpg = playerhasrpg;
player[0].haschainsaw = playerhaschainsaw;
}
public function turretexplosion(_arg1:Number, _arg2:Number){
turretexplode.play();
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 16, 7, 0.4);
q = 0;
while (q < 5) {
creategp(_arg1, _arg2, ((Math.random() * 10) + 10), (Math.random() * 360), ((Math.random() * 1) + 1), 0.95, -0.05, ((Math.random() * 20) + 20), explosionsmokecolor(), true);
q = (q + 1);
};
}
public function explosionsmokecolor():int{
var _local1:int;
_local1 = new int();
_local1 = ((Math.random() * 100) + 30);
return (rgb(_local1, _local1, _local1));
}
public function approxdistance2(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:int;
var _local6:int;
_local5 = Math.round(Math.abs((_arg1 - _arg3)));
_local6 = Math.round(Math.abs((_arg2 - _arg4)));
return (tdistance[_local5][_local6]);
}
public function createcrate(_arg1:Number, _arg2:Number, _arg3:uint){
crate[crates] = new cratemc();
midgroundmappropscontainer.addChild(crate[crates]);
crate[crates].active = true;
crate[crates].visible = true;
crate[crates].x = _arg1;
crate[crates].y = _arg2;
crate[crates].frame = _arg3;
crate[crates].hitzonenum = hitzones;
createhitzone(crate[crates].x, (crate[crates].y + (crateheight * 0.5)), crateradius);
crates = (crates + 1);
}
public function beginbtnclick(_arg1){
gotoAndPlay(8);
}
public function createlowerleg(_arg1){
lowerleg[lowerlegs] = new lowerlegmc();
bodypartscontainer.addChild(lowerleg[lowerlegs]);
lowerleg[lowerlegs].visible = true;
lowerleg[lowerlegs].active = true;
lowerleg[lowerlegs].x = -100;
lowerleg[lowerlegs].y = -100;
lowerleg[lowerlegs].frame = _arg1;
lowerleg[lowerlegs].gotoAndPlay((_arg1 + 1));
lowerlegs = (lowerlegs + 1);
}
public function nailgunmuzzleflash(_arg1:Number, _arg2:Number, _arg3:Number){
q = 0;
while (q < 4) {
creategp(_arg1, _arg2, ((Math.random() * 4) + 4), correctdirection(((_arg3 + (Math.random() * 50)) - 25)), ((Math.random() * 4) + 2), 0.85, -0.05, ((Math.random() * 15) + 15), 0xD0D0D0, true);
q = (q + 1);
};
nailgunshooting.play();
creategp(_arg1, _arg2, ((Math.random() * 6) + 6), 0, 0, 0, 0, 8, 0xD0D0D0, false);
}
public function createspinlight(_arg1:Number, _arg2:Number){
spinlight[spinlights] = new spinlightmc();
backgroundmappropscontainer.addChild(spinlight[spinlights]);
spinlight[spinlights].active = true;
spinlight[spinlights].visible = true;
spinlight[spinlights].x = _arg1;
spinlight[spinlights].y = _arg2;
spinlights = (spinlights + 1);
}
public function tempstep(_arg1){
sloth.alpha = (sloth.alpha - 0.01);
if (sloth.alpha <= 0){
gotoAndPlay(3);
};
}
public function dirtblast(_arg1:Number, _arg2:Number){
q = 0;
while (q < 6) {
creategp(_arg1, _arg2, ((Math.random() * 8) + 12), ((Math.random() * 60) + 69), ((Math.random() * 3) + 1), 0.96, 0.03, ((Math.random() * 20) + 40), 7623990, true);
q = (q + 1);
};
}
public function createhead(_arg1){
head[heads] = new headmc();
bodypartscontainer.addChild(head[heads]);
head[heads].visible = true;
head[heads].active = true;
head[heads].x = -100;
head[heads].y = -100;
head[heads].frame = _arg1;
head[heads].gotoAndPlay((_arg1 + 1));
heads = (heads + 1);
}
public function menustep2(_arg1){
Mouse.show();
if (graphicsquality == 0){
qualityselection.x = fullbtn0.x;
qualityselection.y = fullbtn0.y;
};
if (graphicsquality == 1){
qualityselection.x = reducedbtn0.x;
qualityselection.y = reducedbtn0.y;
};
if (graphicsquality == 2){
qualityselection.x = nonebtn0.x;
qualityselection.y = nonebtn0.y;
};
if (bulletcasingquality == 0){
bulletcasingselection.x = fullbtn1.x;
bulletcasingselection.y = fullbtn1.y;
};
if (bulletcasingquality == 1){
bulletcasingselection.x = reducedbtn1.x;
bulletcasingselection.y = reducedbtn1.y;
};
if (bulletcasingquality == 2){
bulletcasingselection.x = nonebtn1.x;
bulletcasingselection.y = nonebtn1.y;
};
if (debrisquality == 0){
debrisqualityselection.x = fullbtn2.x;
debrisqualityselection.y = fullbtn2.y;
};
if (debrisquality == 1){
debrisqualityselection.x = reducedbtn2.x;
debrisqualityselection.y = reducedbtn2.y;
};
if (particlealpha == 0){
particlealphaselection.x = fullbtn3.x;
particlealphaselection.y = fullbtn3.y;
};
if (particlealpha == 1){
particlealphaselection.x = nonebtn3.x;
particlealphaselection.y = nonebtn3.y;
};
if (particlequality == 0){
particlequalityselection.x = fullbtn4.x;
particlequalityselection.y = fullbtn4.y;
};
if (particlequality == 1){
particlequalityselection.x = reducedbtn4.x;
particlequalityselection.y = reducedbtn4.y;
};
}
public function lightstep(){
var _local1:int;
if (lighting == true){
_local1 = new int();
_local1 = 0;
while (_local1 < lights) {
if (light[_local1].visible == true){
light[_local1].visible = false;
light[_local1].parent.removeChild(light[_local1]);
};
_local1 = (_local1 + 1);
};
};
}
public function megazombieexplosion(_arg1:Number, _arg2:Number){
megazombiedie.play();
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 24, 6, 0.4);
q = 0;
while (q < 4) {
creategp(_arg1, _arg2, ((Math.random() * 4) + 16), (Math.random() * 360), ((Math.random() * 3) + 3), 0.9, -0.03, ((Math.random() * 10) + 40), explosionsmokecolor(), true);
q = (q + 1);
};
q = 0;
while (q < 2) {
creategp(_arg1, _arg2, ((Math.random() * 4) + 16), (Math.random() * 360), ((Math.random() * 3) + 3), 0.9, 0, ((Math.random() * 10) + 10), 0xFFFF00, true);
q = (q + 1);
};
q = 0;
while (q < 2) {
creategp(_arg1, _arg2, ((Math.random() * 4) + 16), (Math.random() * 360), ((Math.random() * 3) + 3), 0.9, 0, ((Math.random() * 10) + 10), 0xFFB300, true);
q = (q + 1);
};
q = 0;
while (q < 8) {
creategp(_arg1, _arg2, ((Math.random() * 4) + 16), (Math.random() * 360), ((Math.random() * 2) + 3), 0.92, 0.03, ((Math.random() * 20) + 50), bloodcolor(), true);
q = (q + 1);
};
}
public function createnode(_arg1:Number, _arg2:Number){
node[nodes] = new Object();
node[nodes].x = _arg1;
node[nodes].y = _arg2;
node[nodes].active = true;
nodes = (nodes + 1);
}
public function kamikazeexplosion(_arg1:Number, _arg2:Number){
grenadeexplode.play();
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 16, 7, 0.4);
q = 0;
while (q < 5) {
creategp(_arg1, _arg2, ((Math.random() * 12) + 16), (Math.random() * 360), ((Math.random() * 3) + 1), 0.92, -0.05, ((Math.random() * 30) + 30), explosionsmokecolor(), true);
q = (q + 1);
};
q = 0;
while (q < 3) {
creategp(_arg1, _arg2, ((Math.random() * 10) + 10), (Math.random() * 360), ((Math.random() * 3) + 1), 0.95, 0, ((Math.random() * 8) + 8), explosionflashcolor(), true);
q = (q + 1);
};
q = 0;
while (q < 3) {
creategp(_arg1, _arg2, ((Math.random() * 6) + 6), (Math.random() * 360), ((Math.random() * 3) + 2), 0.97, 0, ((Math.random() * 10) + 10), bloodcolor(), true);
q = (q + 1);
};
}
public function impactsmokecolor():int{
var _local1:int;
_local1 = new int();
_local1 = (Math.random() * 100);
return (rgb((50 + _local1), (50 + _local1), (50 + _local1)));
}
public function keyup(_arg1:KeyboardEvent){
if (_arg1.keyCode == 32){
pkeyspace = false;
};
if (_arg1.keyCode == 81){
pkeyq = false;
};
if (_arg1.keyCode == 68){
pkeyd = false;
};
if (_arg1.keyCode == 87){
pkeyw = false;
};
if (_arg1.keyCode == 65){
pkeya = false;
};
if (_arg1.keyCode == 49){
pkey1 = false;
};
if (_arg1.keyCode == 50){
pkey2 = false;
};
if (_arg1.keyCode == 51){
pkey3 = false;
};
if (_arg1.keyCode == 52){
pkey4 = false;
};
if (_arg1.keyCode == 53){
pkey5 = false;
};
if (_arg1.keyCode == 54){
pkey6 = false;
};
if (_arg1.keyCode == 55){
pkey7 = false;
};
if (_arg1.keyCode == 56){
pkey8 = false;
};
}
public function createhitzone(_arg1:Number, _arg2:Number, _arg3:Number){
hitzone[hitzones] = new Object();
hitzone[hitzones].x = _arg1;
hitzone[hitzones].y = _arg2;
hitzone[hitzones].active = false;
hitzone[hitzones].radius = _arg3;
hitzones = (hitzones + 1);
}
public function createshotgunammo(_arg1:Number, _arg2:Number, _arg3:Boolean){
shotgunammo[shotgunammos] = new shotgunammomc();
pickupscontainer.addChild(shotgunammo[shotgunammos]);
shotgunammo[shotgunammos].active = true;
shotgunammo[shotgunammos].visible = true;
shotgunammo[shotgunammos].fade = _arg3;
shotgunammo[shotgunammos].x = -500;
shotgunammo[shotgunammos].y = -500;
shotgunammo[shotgunammos].livetime = 0;
shotgunammo[shotgunammos].boxnum = boxes;
shotgunammo[shotgunammos].filters = [pickupglowfilter];
createbox(_arg1, _arg2, shotgunammosidelength, pickupaf, pickupg, pickupf, _arg3, -1, false);
shotgunammos = (shotgunammos + 1);
}
public function controlsbtnclick(_arg1){
gotoAndPlay(7);
}
public function spawnpickups(_arg1:Number, _arg2:Number){
if (countpickups() == 0){
if (Math.floor((Math.random() * itemchance)) == 0){
item = [];
if (player[0].hassmg == true){
item[0] = (((maxsmgammo - player[0].smgammo) / maxsmgammo) * 2);
} else {
item[0] = 0;
};
if (player[0].hasrifle == true){
item[1] = (((maxrifleammo - player[0].rifleammo) / maxrifleammo) * 2);
} else {
item[1] = 0;
};
if (player[0].haspistol == true){
item[2] = (((maxpistolammo - player[0].pistolammo) / maxpistolammo) * 2);
} else {
item[2] = 0;
};
if (player[0].hasshotgun == true){
item[3] = (((maxshotgunammo - player[0].shotgunammo) / maxshotgunammo) * 2);
} else {
item[3] = 0;
};
if (player[0].hasnailgun == true){
item[4] = (((maxnailgunammo - player[0].nailgunammo) / maxnailgunammo) * 2);
} else {
item[4] = 0;
};
item[5] = ((player[0].damage / playerhealth) * 3);
chance = -1;
highestchance = 1;
z = 0;
while (z < 6) {
if (item[z] > highestchance){
chance = z;
highestchance = item[z];
};
z = (z + 1);
};
if (chance == 0){
createsmgammo(_arg1, _arg2, true);
};
if (chance == 1){
createrifleammo(_arg1, _arg2, true);
};
if (chance == 2){
createpistolammo(_arg1, _arg2, true);
};
if (chance == 3){
createshotgunammo(_arg1, _arg2, true);
};
if (chance == 3){
createshotgunammo(_arg1, _arg2, true);
};
if (chance == 4){
createnailgunammo(_arg1, _arg2, true);
};
if (chance == 5){
createhealth(_arg1, _arg2, true);
};
if (chance != -1){
physicspush(_arg1, _arg2, 16, (Math.random() * 360), (Math.random() * 1.5));
teleportsparks(_arg1, _arg2);
};
};
};
}
public function segmentcollide(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Boolean{
var _local5:int;
var _local6:uint;
var _local7:Number;
var _local8:Number;
_local5 = 0;
_local6 = 0;
_local7 = 10000;
_local8 = 10000;
_local6 = 0;
while (_local6 < collisionlines) {
if (collisionline[_local6].active == true){
if (rectcollide(_arg1, _arg2, _arg3, _arg4, collisionline[_local6].x1, collisionline[_local6].y1, collisionline[_local6].x2, collisionline[_local6].y2) == true){
possiblelinenum[_local5] = _local6;
_local5 = (_local5 + 1);
};
};
_local6 = (_local6 + 1);
};
_local6 = 0;
while (_local6 < _local5) {
if (linecollide(_arg1, _arg2, _arg3, _arg4, collisionline[possiblelinenum[_local6]].x1, collisionline[possiblelinenum[_local6]].y1, collisionline[possiblelinenum[_local6]].x2, collisionline[possiblelinenum[_local6]].y2, collisionline[possiblelinenum[_local6]].slope) == true){
_local8 = approxdistance(cx, cy, _arg1, _arg2);
if (_local8 < _local7){
_local7 = _local8;
bestcx = cx;
bestcy = cy;
bestsurfacedirection = surfacedirection;
};
};
_local6 = (_local6 + 1);
};
if (_local7 < 10000){
return (true);
};
return (false);
}
public function createobjectline(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){
objectline[objectlines] = new Object();
vobjectline[objectlines] = new Shape();
physicscontainer.addChild(vobjectline[objectlines]);
objectline[objectlines].xwidth = (_arg3 * 0.25);
objectline[objectlines].x = _arg1;
objectline[objectlines].y = _arg2;
objectline[objectlines].dx = 0;
objectline[objectlines].dy = 0;
objectline[objectlines].yheight = _arg3;
objectline[objectlines].active = true;
objectline[objectlines].firstpnum = ps;
objectline[objectlines].wateraffectornum = wateraffectors;
createp(_arg1, (_arg2 + (_arg3 * 0.5)), _arg1, _arg2, _arg4, _arg5, _arg6, true);
createp(_arg1, (_arg2 + (_arg3 * 0.5)), _arg1, (_arg2 + _arg3), _arg4, _arg5, _arg6, true);
createwateraffector(_arg1, (_arg2 + (_arg3 * 0.5)), (_arg3 * 0.5));
objectlines = (objectlines + 1);
}
public function createlight(_arg1:Sprite, _arg2:Number, _arg3:Number, _arg4:int, _arg5:int, _arg6:Number, _arg7:Number){
var index:int;
var f:int;
var container = _arg1;
var x = _arg2;
var y = _arg3;
var color = _arg4;
var radius = _arg5;
var intensity = _arg6;
var alpha = _arg7;
if (lighting == true){
index = new int();
index = -1;
f = new int();
f = 0;
while (f < lights) {
if (light[f].visible == false){
index = f;
f = lights;
};
f = (f + 1);
};
if (index == -1){
if (lights < maxlights){
index = lights;
lights = (lights + 1);
};
};
if (index != -1){
var _local9 = light[index].graphics;
with (_local9) {
clear();
moveTo(-(radius), -(radius));
lineStyle(1, 0, 0);
beginFill(color, 1);
drawCircle(0, 0, radius);
};
lightfilter.color = color;
lightfilter.alpha = 1;
lightfilter.blurX = (radius * 4);
lightfilter.blurY = (radius * 4);
lightfilter.quality = BitmapFilterQuality.MEDIUM;
lightfilter.strength = intensity;
light[index].visible = true;
light[index].filters = [lightfilter];
light[index].alpha = alpha;
light[index].x = x;
light[index].y = y;
container.addChild(light[index]);
};
};
}
public function finddirection(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (_arg1 - _arg2);
if (_local3 < -180){
_local3 = (_local3 + 360);
};
if (_local3 > 180){
_local3 = (_local3 - 360);
};
return (_local3);
}
public function countweapons(){
weapons = 0;
z = 0;
while (z < rifles) {
if (rifle[z].active == true){
weapons = (weapons + 1);
};
z = (z + 1);
};
z = 0;
while (z < shotguns) {
if (shotgun[z].active == true){
weapons = (weapons + 1);
};
z = (z + 1);
};
z = 0;
while (z < pistols) {
if (pistol[z].active == true){
weapons = (weapons + 1);
};
z = (z + 1);
};
z = 0;
while (z < smgs) {
if (smg[z].active == true){
weapons = (weapons + 1);
};
z = (z + 1);
};
z = 0;
while (z < nailguns) {
if (nailgun[z].active == true){
weapons = (weapons + 1);
};
z = (z + 1);
};
z = 0;
while (z < rpgs) {
if ((((rpg[z].active == true)) && ((rpg[z].dummy == false)))){
weapons = (weapons + 1);
};
z = (z + 1);
};
z = 0;
while (z < grenadeammos) {
if (grenadeammo[z].active == true){
weapons = (weapons + 1);
};
z = (z + 1);
};
return (weapons);
}
public function createpoint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean, _arg7:int, _arg8:Boolean){
var _local9:Number;
var _local10:Number;
_local9 = 0;
_local10 = 0;
point[points] = new Object();
vpoint[points] = new Shape();
physicscontainer.addChild(vpoint[points]);
vpoint[points].x = _arg1;
vpoint[points].y = _arg2;
point[points].restcounter = 0;
if (_arg6 == true){
point[points].atrest = false;
} else {
point[points].atrest = true;
};
point[points].ignorecollisions = _arg8;
point[points].x = _arg1;
point[points].y = _arg2;
vpoint[points].visible = true;
point[points].active = true;
point[points].firstpnum = ps;
point[points].bouncetype = 0;
createp(_arg1, _arg2, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
if (_arg7 > -1){
_local9 = (p[_arg7].x - p[_arg7].lx);
_local10 = (p[_arg7].y - p[_arg7].ly);
p[(ps - 1)].lx = (p[(ps - 1)].lx - _local9);
p[(ps - 1)].ly = (p[(ps - 1)].ly - _local10);
};
points = (points + 1);
}
public function approxdistance(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:Number;
var _local6:Number;
_local5 = Math.abs((_arg1 - _arg3));
_local6 = Math.abs((_arg2 - _arg4));
if (_local5 > _local6){
return ((((_local6 * 1.4) + _local5) - _local6));
};
if (_local6 > _local5){
return ((((_local5 * 1.4) + _local6) - _local5));
};
if (_local5 == _local6){
return ((_local5 * 1.4));
};
}
public function watersplash(_arg1, _arg2, _arg3){
q = 0;
while (q < 3) {
creategp(_arg1, _arg2, ((Math.random() * 5) + 3), ((Math.random() * 30) + 75), ((Math.random() * 3) + 1), 0.96, 0.15, ((Math.random() * 20) + 20), _arg3, true);
q = (q + 1);
};
}
public function makecopies(){
var _local1:Sprite;
var _local2:BitmapData;
var _local3:BitmapData;
var _local4:BitmapData;
mytestcontainer.removeChild(backdropcopy);
mytestcontainer2.removeChild(backgroundcopy);
mytestcontainer3.removeChild(foregroundcopy);
_local1 = new Sprite();
_local2 = new BitmapData(600, 300, true, 0);
_local2.fillRect(new Rectangle(0, 0, 600, 300), 0);
_local1.addChild(backdrop);
_local2.draw(_local1);
_local1.removeChild(backdrop);
backdropcopy = new Bitmap(_local2);
_local3 = new BitmapData(1200, 600, true, 0);
_local3.fillRect(new Rectangle(0, 0, 1200, 600), 0);
_local1.addChild(background);
_local3.draw(_local1);
_local1.removeChild(background);
backgroundcopy = new Bitmap(_local3);
_local4 = new BitmapData(1200, 600, true, 0);
_local4.fillRect(new Rectangle(0, 0, 1200, 600), 0);
_local1.addChild(foreground);
_local4.draw(_local1);
_local1.removeChild(foreground);
foregroundcopy = new Bitmap(_local4);
mytestcontainer.addChild(backdropcopy);
mytestcontainer2.addChild(backgroundcopy);
mytestcontainer3.addChild(foregroundcopy);
mytestcontainer2.scaleX = 0.5;
mytestcontainer2.scaleY = 0.5;
mytestcontainer3.scaleX = 0.5;
mytestcontainer3.scaleY = 0.5;
}
public function explosionflashcolor():int{
var _local1:int;
_local1 = new int();
_local1 = (Math.random() * 100);
return (rgb((150 + _local1), (150 + _local1), _local1));
}
public function computerexplosion(_arg1:Number, _arg2:Number){
electricbuzz.play();
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 12, 7, 0.7);
q = 0;
while (q < 7) {
creategp(_arg1, _arg2, ((Math.random() * 5) + 5), (Math.random() * 360), (Math.random() * 4), 0.99, 0.05, ((Math.random() * 15) + 15), 0xFFFF00, true);
q = (q + 1);
};
q = 0;
while (q < 7) {
creategp(_arg1, _arg2, ((Math.random() * 8) + 8), (Math.random() * 360), Math.random(), 0.96, -0.08, ((Math.random() * 50) + 50), 0x4D4D4D, true);
q = (q + 1);
};
}
public function riflemuzzleflash(_arg1:Number, _arg2:Number, _arg3:Number){
rifleshoot.play();
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 12, 7, 0.6);
q = 0;
while (q < 2) {
creategp(_arg1, _arg2, ((Math.random() * 8) + 8), correctdirection(((_arg3 + (Math.random() * 50)) - 25)), ((Math.random() * 3) + 1), 0.9, -0.05, ((Math.random() * 15) + 15), muzzlesmokecolor(), true);
q = (q + 1);
};
creategp(_arg1, _arg2, ((Math.random() * 8) + 8), 0, 0, 0, 0, 3, muzzleflashcolor(), false);
}
public function shotgunmuzzleflash(_arg1:Number, _arg2:Number, _arg3:Number){
shotgunshoot.play();
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 14, 7, 0.7);
q = 0;
while (q < 3) {
creategp(_arg1, _arg2, ((Math.random() * 10) + 10), correctdirection(((_arg3 + (Math.random() * 50)) - 25)), ((Math.random() * 3) + 1), 0.9, -0.05, ((Math.random() * 15) + 15), muzzlesmokecolor(), true);
q = (q + 1);
};
creategp(_arg1, _arg2, ((Math.random() * 8) + 8), 0, 0, 0, 0, 3, muzzleflashcolor(), false);
}
public function createtorso(_arg1){
torso[torsos] = new torsomc();
bodypartscontainer.addChild(torso[torsos]);
torso[torsos].visible = true;
torso[torsos].active = true;
torso[torsos].x = -100;
torso[torsos].y = -100;
torso[torsos].frame = _arg1;
torso[torsos].gotoAndPlay((_arg1 + 1));
torsos = (torsos + 1);
}
public function lasermuzzleflash(_arg1:Number, _arg2:Number, _arg3:Number){
lasershoot.play();
createlight(lightcontainer, _arg1, _arg2, rgb(40, 0xFF, 40), 6, 8, 0.7);
creategp(((_arg1 + (Math.random() * 8)) - 4), ((_arg2 + (Math.random() * 8)) - 4), ((Math.random() * 4) + 12), 0, 0, 0, 0, 8, 0xFF00, false);
}
public function stoprain(){
z = 0;
while (z < raindrops) {
rain[z].active = false;
rain[z].visible = false;
z = (z + 1);
};
}
public function easybtnclick(_arg1){
difficulty = 0;
wait = -5;
gotoAndPlay(9);
}
public function createpistolammo(_arg1:Number, _arg2:Number, _arg3:Boolean){
pistolammo[pistolammos] = new pistolammomc();
pickupscontainer.addChild(pistolammo[pistolammos]);
pistolammo[pistolammos].active = true;
pistolammo[pistolammos].visible = true;
pistolammo[pistolammos].fade = _arg3;
pistolammo[pistolammos].x = -500;
pistolammo[pistolammos].y = -500;
pistolammo[pistolammos].livetime = 0;
pistolammo[pistolammos].boxnum = boxes;
pistolammo[pistolammos].filters = [pickupglowfilter];
createbox(_arg1, _arg2, pistolammosidelength, pickupaf, pickupg, pickupf, _arg3, -1, false);
pistolammos = (pistolammos + 1);
}
public function createlimb(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:int, _arg5:int, _arg6:int, _arg7:uint){
bloodspray(_arg1, _arg2, 3);
squish.play();
limb[limbs] = new Object();
limb[limbs].active = true;
limb[limbs].visible = true;
limb[limbs].x = -1000;
limb[limbs].y = -1000;
limb[limbs].frame = _arg6;
limb[limbs].livetime = 0;
limb[limbs].segments = _arg4;
limb[limbs].alpha = 1;
limb[limbs].type = _arg3;
limb[limbs].frame = _arg6;
limb[limbs].facedirection = _arg7;
limb[limbs].linenum = -1;
limb[limbs].hingenum = -1;
limb[limbs].firstupperlegnum = -1;
limb[limbs].firstlowerarmnum = -1;
limb[limbs].firstupperarmnum = -1;
limb[limbs].firstlowerlegnum = -1;
if (_arg4 == 1){
limb[limbs].linenum = lines;
if (_arg3 == 0){
createline(_arg1, _arg2, _arg1, (_arg2 + lowerarmlength), limbaf, limbg, limbf, true, _arg5, false);
limb[limbs].firstlowerarmnum = lowerarms;
createlowerarm(_arg6);
};
if (_arg3 == 1){
createline(_arg1, _arg2, _arg1, (_arg2 + lowerleglength), limbaf, limbg, limbf, true, _arg5, false);
limb[limbs].firstlowerlegnum = lowerlegs;
createlowerleg(_arg6);
};
};
if (_arg4 == 2){
limb[limbs].hingenum = hinges;
if (_arg3 == 0){
createhinge(_arg1, _arg2, upperarmlength, lowerarmlength, lowerarmconstraint, limbaf, limbg, limbf, true, _arg5, false);
limb[limbs].firstlowerarmnum = lowerarms;
limb[limbs].firstupperarmnum = upperarms;
createlowerarm(_arg6);
createupperarm(_arg6);
};
if (_arg3 == 1){
createhinge(_arg1, _arg2, upperleglength, lowerleglength, lowerlegconstraint, limbaf, limbg, limbf, true, _arg5, false);
limb[limbs].firstlowerlegnum = lowerlegs;
limb[limbs].firstupperlegnum = upperlegs;
createlowerleg(_arg6);
createupperleg(_arg6);
};
};
limbs = (limbs + 1);
}
public function chainbreak(_arg1:Number, _arg2:Number){
q = 0;
while (q < 3) {
creategp(_arg1, _arg2, ((Math.random() * 2) + 2), (Math.random() * 360), ((Math.random() * 5) + 5), 0.96, 0.1, ((Math.random() * 10) + 10), 0xFFFF00, true);
q = (q + 1);
};
q = 0;
while (q < 5) {
creategp(_arg1, _arg2, ((Math.random() * 3) + 3), (Math.random() * 360), (Math.random() * 3), 0.99, 0.05, ((Math.random() * 15) + 15), 0xFFFF00, true);
q = (q + 1);
};
}
public function getplayerinfo(){
playerweapon = player[0].weapon;
gplayerdamage = player[0].damage;
playerrifleammo = player[0].rifleammo;
playerhasrifle = player[0].hasrifle;
playerpistolammo = player[0].pistolammo;
playerhaspistol = player[0].haspistol;
playergrenadeammo = player[0].grenadeammo;
playerhasgrenade = player[0].hasgrenade;
playershotgunammo = player[0].shotgunammo;
playerhasshotgun = player[0].hasshotgun;
playersmgammo = player[0].smgammo;
playerhassmg = player[0].hassmg;
playernailgunammo = player[0].nailgunammo;
playerhasnailgun = player[0].hasnailgun;
playerrpgammo = player[0].rpgammo;
playerhasrpg = player[0].hasrpg;
playerhaschainsaw = player[0].haschainsaw;
}
public function createlegB(){
legB[legBs] = new legBmc();
bodypartscontainer.addChild(legB[legBs]);
legB[legBs].active = true;
legB[legBs].visible = true;
legB[legBs].x = -100;
legB[legBs].y = -100;
legB[legBs].frame = 0;
legB[legBs].framerate = 1;
legBs = (legBs + 1);
}
public function createlegC(){
legC[legCs] = new legCmc();
bodypartscontainer.addChild(legC[legCs]);
legC[legCs].active = true;
legC[legCs].visible = true;
legC[legCs].x = -100;
legC[legCs].y = -100;
legC[legCs].frame = 0;
legC[legCs].framerate = 1;
legCs = (legCs + 1);
}
public function createlegD(){
legD[legDs] = new legDmc();
bodypartscontainer.addChild(legD[legDs]);
legD[legDs].active = true;
legD[legDs].visible = true;
legD[legDs].x = -100;
legD[legDs].y = -100;
legD[legDs].frame = 0;
legD[legDs].framerate = 1;
legDs = (legDs + 1);
}
public function createnailgun(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:Number, _arg5:Boolean, _arg6:int){
nailgun[nailguns] = new nailgunmc();
weaponscontainer.addChild(nailgun[nailguns]);
nailgun[nailguns].active = true;
nailgun[nailguns].visible = true;
nailgun[nailguns].fade = _arg5;
nailgun[nailguns].facedirection = _arg3;
if (_arg3 == 1){
nailgun[nailguns].scaleX = -1;
};
nailgun[nailguns].x = -1000;
nailgun[nailguns].y = -1000;
nailgun[nailguns].livetime = 0;
nailgun[nailguns].pointdirection = _arg4;
nailgun[nailguns].linenum = lines;
nailgun[nailguns].filters = [weaponglowfilter];
createline((_arg1 - vectorx(_arg4, (nailgunlength * 0.5))), (_arg2 - vectory(_arg4, (nailgunlength * 0.5))), (_arg1 + vectorx(_arg4, (nailgunlength * 0.5))), (_arg2 + vectory(_arg4, (nailgunlength * 0.5))), weaponaf, weapong, weaponf, _arg5, _arg6, false);
nailguns = (nailguns + 1);
}
public function createline(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Boolean, _arg9:int, _arg10:Boolean){
var _local11:Number;
var _local12:Number;
var _local13:uint;
_local11 = 0;
_local12 = 0;
line[lines] = new Object();
vline[lines] = new Shape();
physicscontainer.addChild(vline[lines]);
line[lines].restcounter = 0;
if (_arg8 == true){
line[lines].atrest = false;
} else {
line[lines].atrest = true;
};
line[lines].ignorecollisions = _arg10;
line[lines].x = x;
line[lines].y = y;
line[lines].active = true;
line[lines].linelength = approxdistance(_arg1, _arg2, _arg3, _arg4);
line[lines].firstpnum = ps;
createp(((_arg1 + _arg3) * 0.5), ((_arg2 + _arg4) * 0.5), _arg1, _arg2, _arg5, _arg6, _arg7, _arg8);
createp(((_arg1 + _arg3) * 0.5), ((_arg2 + _arg4) * 0.5), _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
if (_arg9 > -1){
_local11 = (p[_arg9].x - p[_arg9].lx);
_local12 = (p[_arg9].y - p[_arg9].ly);
_local13 = (ps - 2);
_local13 = (ps - 2);
while (_local13 < ps) {
p[_local13].lx = (p[_local13].lx - _local11);
p[_local13].ly = (p[_local13].ly - _local12);
_local13 = (_local13 + 1);
};
};
lines = (lines + 1);
}
public function createlink(_arg1:uint){
link[links] = new linkmc();
debriscontainer.addChild(link[links]);
link[links].active = true;
link[links].visible = true;
link[links].x = -1000;
link[links].y = -1000;
link[links].frame = _arg1;
link[links].alpha = 1;
links = (links + 1);
}
public function createlegA(){
legA[legAs] = new legAmc();
bodypartscontainer.addChild(legA[legAs]);
legA[legAs].active = true;
legA[legAs].visible = true;
legA[legAs].x = -100;
legA[legAs].y = -100;
legA[legAs].frame = 0;
legA[legAs].framerate = 1;
legAs = (legAs + 1);
}
public function createmegazombie(_arg1:Number, _arg2:Number){
megazombie[megazombies] = new megazombiemc();
enemycontainer.addChild(megazombie[megazombies]);
createmegazombiegun((_arg1 + 20), (_arg2 + 10), 270);
megazombie[megazombies].movex = 0;
megazombie[megazombies].movey = 0;
megazombie[megazombies].movedirection = 90;
megazombie[megazombies].movetargetx = 0;
megazombie[megazombies].movetargety = -1;
megazombie[megazombies].shots = 0;
megazombie[megazombies].active = true;
megazombie[megazombies].visible = true;
megazombie[megazombies].x = _arg1;
megazombie[megazombies].y = _arg2;
megazombie[megazombies].cy = _arg2;
megazombie[megazombies].cx = _arg1;
megazombie[megazombies].woundtimer = 0;
megazombie[megazombies].recovertimer = 0;
loopchannel2 = megazombieengine.play(0, 1000);
megazombie[megazombies].sounddelay = 0;
megazombie[megazombies].stucktimer = 0;
megazombie[megazombies].shootdelay = 0;
megazombie[megazombies].burndelay = 0;
megazombie[megazombies].damage = 0;
megazombie[megazombies].targetdirection = 0;
megazombie[megazombies].hastarget = false;
megazombie[megazombies].restdirection = 270;
megazombie[megazombies].pointdirection = 270;
megazombie[megazombies].barrelnum = (megazombieguns - 1);
megazombies = (megazombies + 1);
}
public function createupperleg(_arg1){
upperleg[upperlegs] = new upperlegmc();
bodypartscontainer.addChild(upperleg[upperlegs]);
upperleg[upperlegs].visible = true;
upperleg[upperlegs].active = true;
upperleg[upperlegs].x = -100;
upperleg[upperlegs].y = -100;
upperleg[upperlegs].frame = _arg1;
upperleg[upperlegs].gotoAndPlay((_arg1 + 1));
upperlegs = (upperlegs + 1);
}
public function impactflashcolor():int{
var _local1:int;
_local1 = new int();
_local1 = (Math.random() * 100);
return (rgb((155 + _local1), (155 + _local1), _local1));
}
public function createchain(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Boolean, _arg5:Number, _arg6:Number, _arg7:Boolean, _arg8:Boolean, _arg9:Boolean, _arg10:uint){
chain[chains] = new Object();
chain[chains].active = true;
chain[chains].type = _arg10;
chain[chains].x = -1000;
chain[chains].y = -1000;
chain[chains].ropenum = ropes;
chaindistance = approxdistance(_arg1, _arg2, _arg5, _arg6);
segments = Math.round((chaindistance / chainsegmentlength));
createrope(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, segments, chainsegmentlength, false, chainaf, chaing, chainf, true, -1, _arg9);
chain[chains].linknum = links;
alternatenum = 0;
df = 0;
df = 0;
while (df < (segments - 1)) {
createlink(((_arg10 * 2) + alternatenum));
if (alternatenum == 0){
alternatenum = 1;
} else {
alternatenum = 0;
};
df = (df + 1);
};
chains = (chains + 1);
}
public function reducedbtn1click(_arg1){
bulletcasingquality = 1;
}
public function menubtn2click(_arg1){
gotoAndPlay(5);
}
public function blockdistance(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = Math.abs((_arg1 - _arg3));
_local6 = Math.abs((_arg2 - _arg4));
return ((_local5 + _local6));
}
public function createturretbarrel(_arg1:Number, _arg2:Number, _arg3:Number){
turretbarrel[turretbarrels] = new turretbarrelmc();
enemycontainer.addChild(turretbarrel[turretbarrels]);
turretbarrel[turretbarrels].active = true;
turretbarrel[turretbarrels].visible = true;
turretbarrel[turretbarrels].x = _arg1;
turretbarrel[turretbarrels].y = _arg2;
turretbarrel[turretbarrels].rotation = -(_arg3);
turretbarrels = (turretbarrels + 1);
}
public function verlet(_arg1:uint, _arg2:uint, _arg3:Number){
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local4 = (p[_arg2].x - p[_arg1].x);
_local5 = (p[_arg2].y - p[_arg1].y);
_local6 = tdistance[Math.round(Math.abs(_local4))][Math.round(Math.abs(_local5))];
_local7 = 1;
if (_local6 != 0){
_local7 = ((0.5 * (_local6 - _arg3)) / _local6);
};
_local4 = (_local4 * _local7);
_local5 = (_local5 * _local7);
p[_arg1].x = (p[_arg1].x + _local4);
p[_arg1].y = (p[_arg1].y + _local5);
p[_arg2].x = (p[_arg2].x - _local4);
p[_arg2].y = (p[_arg2].y - _local5);
}
public function fullbtn1click(_arg1){
bulletcasingquality = 0;
}
public function createbarrel(_arg1:Number, _arg2:Number, _arg3:uint){
barrel[barrels] = new barrelmc();
midgroundmappropscontainer.addChild(barrel[barrels]);
barrel[barrels].active = true;
barrel[barrels].visible = true;
barrel[barrels].x = _arg1;
barrel[barrels].y = _arg2;
barrel[barrels].frame = _arg3;
barrel[barrels].hitzonenum = hitzones;
createhitzone(barrel[barrels].x, (barrel[barrels].y + (barrelheight * 0.5)), barrelradius);
barrels = (barrels + 1);
}
public function createrope(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Boolean, _arg5:Number, _arg6:Number, _arg7:Boolean, _arg8:Boolean, _arg9:int, _arg10:Number, _arg11:Boolean, _arg12:Number, _arg13:Number, _arg14:Number, _arg15:Boolean, _arg16:int, _arg17:Boolean){
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:int;
var _local25:uint;
_local18 = 0;
_local19 = 0;
_local20 = 0;
_local21 = 0;
_local22 = 0;
_local23 = 0;
_local24 = 0;
rope[ropes] = new Object();
vrope[ropes] = new Shape();
physicscontainer.addChild(vrope[ropes]);
rope[ropes].restcounter = 0;
if (_arg15 == true){
rope[ropes].atrest = false;
} else {
rope[ropes].atrest = true;
};
rope[ropes].x = ((_arg1 + _arg5) * 0.5);
rope[ropes].y = ((_arg2 + _arg6) * 0.5);
rope[ropes].active = true;
rope[ropes].ignorecollisions = _arg17;
rope[ropes].segmentlength = _arg10;
rope[ropes].segments = _arg9;
rope[ropes].elastic = _arg11;
rope[ropes].firstpnum = ps;
rope[ropes].maxlength = (_arg9 * _arg10);
rope[ropes].attachedtoparticle1 = _arg3;
rope[ropes].attachedtoparticle2 = _arg7;
rope[ropes].locked1 = _arg4;
rope[ropes].lockx1 = _arg1;
rope[ropes].locky1 = _arg2;
rope[ropes].locked2 = _arg8;
rope[ropes].lockx2 = _arg5;
rope[ropes].locky2 = _arg6;
_local20 = (approxdistance(_arg1, _arg2, _arg5, _arg6) / _arg9);
_local21 = directiontopoint(_arg1, _arg2, _arg5, _arg6);
_local22 = _arg1;
_local23 = _arg2;
if (_arg3 == true){
_local24 = findclosestp(_arg1, _arg2);
rope[ropes].attachedparticle1 = _local24;
if (_local24 > -1){
_local22 = p[_local24].x;
_local23 = p[_local24].y;
};
};
createp(((_arg1 + _arg5) * 0.5), ((_arg2 + _arg6) * 0.5), _local22, _local23, _arg12, _arg13, _arg14, _arg15);
_local25 = 0;
_local25 = 0;
while (_local25 < (_arg9 - 2)) {
createp(((_arg1 + _arg5) * 0.5), ((_arg2 + _arg6) * 0.5), (p[(ps - 1)].x + vectorx2(_local21, _local20)), (p[(ps - 1)].y + vectory2(_local21, _local20)), _arg12, _arg13, _arg14, _arg15);
_local25 = (_local25 + 1);
};
_local22 = _arg5;
_local23 = _arg6;
if (_arg7 == true){
_local24 = findclosestp(_arg5, _arg6);
rope[ropes].attachedparticle2 = _local24;
if (_local24 > -1){
_local22 = p[_local24].x;
_local23 = p[_local24].y;
};
};
createp(((_arg1 + _arg5) * 0.5), ((_arg2 + _arg6) * 0.5), _local22, _local23, _arg12, _arg13, _arg14, true);
if (_arg16 > -1){
_local18 = (p[_arg16].x - p[_arg16].lx);
_local19 = (p[_arg16].y - p[_arg16].ly);
_local25 = (ps - _arg9);
while (_local25 < ps) {
p[_local25].lx = (p[_local25].lx - _local18);
p[_local25].ly = (p[_local25].ly - _local19);
_local25 = (_local25 + 1);
};
};
ropes = (ropes + 1);
}
public function pcollisions(_arg1:uint):int{
var _local2:int;
var _local3:Number;
var _local4:uint;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local2 = 0;
_local3 = 10000;
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = 0;
_local9 = 0;
_local10 = 0;
_local4 = 0;
while (_local4 < possiblelines) {
if (linecollide(p[_arg1].sx, p[_arg1].sy, p[_arg1].x, p[_arg1].y, collisionline[possiblelinenum[_local4]].x1, collisionline[possiblelinenum[_local4]].y1, collisionline[possiblelinenum[_local4]].x2, collisionline[possiblelinenum[_local4]].y2, collisionline[possiblelinenum[_local4]].slope) == true){
_local5 = approxdistance(cx, cy, p[_arg1].sx, p[_arg1].sy);
if (_local5 < _local3){
_local3 = _local5;
bestcx = cx;
bestcy = cy;
bestsurfacedirection = surfacedirection;
};
};
_local4 = (_local4 + 1);
};
if (_local3 < 10000){
_local6 = directiontopoint(p[_arg1].sx, p[_arg1].sy, bestcx, bestcy);
_local7 = (approxdistance(p[_arg1].x, p[_arg1].y, p[_arg1].lx, p[_arg1].ly) * p[_arg1].f);
_local8 = (approxdistance(p[_arg1].x, p[_arg1].y, bestcx, bestcy) * p[_arg1].f);
_local9 = correctdirection(((bestsurfacedirection + finddirection((bestsurfacedirection + 90), _local6)) + 270));
_local10 = Math.abs(finddirection((bestsurfacedirection + 90), _local6));
if (_local10 < 90){
_local10 = correctdirection((bestsurfacedirection - 90));
} else {
_local10 = correctdirection((bestsurfacedirection + 90));
};
p[_arg1].sx = (bestcx + vectorx(_local10, safetydisplacement));
p[_arg1].sy = (bestcy + vectory(_local10, safetydisplacement));
p[_arg1].x = (p[_arg1].sx + vectorx(_local9, _local8));
p[_arg1].y = (p[_arg1].sy + vectory(_local9, _local8));
p[_arg1].lx = (p[_arg1].x - vectorx(_local9, _local7));
p[_arg1].ly = (p[_arg1].y - vectory(_local9, _local7));
_local2 = 1;
} else {
p[_arg1].sy = p[_arg1].y;
p[_arg1].sx = p[_arg1].x;
};
_local4 = 0;
while (_local4 < objectlines) {
if (objectline[_local4].active == true){
if (pointcollide(p[_arg1].x, p[_arg1].y, (objectline[_local4].x - (objectline[_local4].xwidth * 0.5)), objectline[_local4].y, (objectline[_local4].x + (objectline[_local4].xwidth * 0.5)), (objectline[_local4].y + objectline[_local4].yheight)) == true){
_local2 = 2;
p[_arg1].x = (p[_arg1].x + (objectline[_local4].dx * characterpushratio));
p[_arg1].y = (p[_arg1].y + (objectline[_local4].dy * characterpushratio));
};
};
_local4 = (_local4 + 1);
};
return (_local2);
}
public function createstring(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11){
vstring[strings] = new Shape();
string[strings] = new Object();
debriscontainer.addChild(vstring[strings]);
string[strings].color = _arg10;
string[strings].alpha = _arg11;
string[strings].active = true;
string[strings].x = -1000;
string[strings].y = -1000;
string[strings].ropenum = ropes;
stringdistance = approxdistance(_arg1, _arg2, _arg5, _arg6);
segments = Math.round((stringdistance / stringsegmentlength));
createrope(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, segments, stringsegmentlength, true, stringaf, stringg, stringf, true, -1, _arg9);
strings = (strings + 1);
}
public function createcomputer(_arg1:Number, _arg2:Number){
computer[computers] = new computermc();
backgroundmappropscontainer.addChild(computer[computers]);
computer[computers].active = true;
computer[computers].visible = true;
computer[computers].x = _arg1;
computer[computers].y = _arg2;
computer[computers].frame = 0;
computer[computers].hitzonenum = hitzones;
createhitzone(computer[computers].x, (computer[computers].y + (computerheight * 0.5)), computerradius);
computers = (computers + 1);
}
public function createrifleammo(_arg1:Number, _arg2:Number, _arg3:Boolean){
rifleammo[rifleammos] = new rifleammomc();
pickupscontainer.addChild(rifleammo[rifleammos]);
rifleammo[rifleammos].active = true;
rifleammo[rifleammos].visible = true;
rifleammo[rifleammos].fade = _arg3;
rifleammo[rifleammos].x = -500;
rifleammo[rifleammos].y = -500;
rifleammo[rifleammos].livetime = 0;
rifleammo[rifleammos].boxnum = boxes;
rifleammo[rifleammos].filters = [pickupglowfilter];
createbox(_arg1, _arg2, rifleammosidelength, pickupaf, pickupg, pickupf, _arg3, -1, false);
rifleammos = (rifleammos + 1);
}
public function teleportsparks(_arg1:Number, _arg2:Number){
teleport.play();
createlight(lightcontainer, _arg1, _arg2, rgb(30, 30, 0xFF), 8, 7, 0.5);
q = 0;
while (q < 4) {
creategp(_arg1, _arg2, ((Math.random() * 4) + 8), (Math.random() * 360), (Math.random() * 2), 0.97, 0, ((Math.random() * 15) + 15), 5658340, true);
q = (q + 1);
};
}
public function createwaterpool(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:int, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number){
var _local12:Number;
var _local13:Number;
var _local14:uint;
_local12 = 0;
_local13 = 0;
_local14 = 0;
waterpool[waterpools] = new Object();
vwaterpool[waterpools] = new Shape();
physicscontainer.addChild(vwaterpool[waterpools]);
waterpool[waterpools].active = true;
waterpool[waterpools].alpha = _arg11;
vwaterpool[waterpools].visible = true;
waterpool[waterpools].watercolor = _arg10;
waterpool[waterpools].windamount = _arg8;
waterpool[waterpools].xwidth = _arg3;
waterpool[waterpools].depth = _arg4;
waterpool[waterpools].windrandomness = (1 / _arg9);
waterpool[waterpools].g = _arg6;
waterpool[waterpools].points = _arg5;
waterpool[waterpools].pointwidth = (_arg3 / _arg5);
waterpool[waterpools].x = _arg1;
waterpool[waterpools].y = _arg2;
vwaterpool[waterpools].x = _arg1;
vwaterpool[waterpools].y = _arg2;
waterpool[waterpools].ffactor = _arg7;
waterpool[waterpools].waterpx = new Array();
waterpool[waterpools].waterpy = new Array();
waterpool[waterpools].waterpvs = new Array();
_local14 = 0;
while (_local14 < _arg5) {
waterpool[waterpools].waterpx[_local14] = (_arg1 + (waterpool[waterpools].pointwidth * _local14));
waterpool[waterpools].waterpy[_local14] = _arg2;
waterpool[waterpools].waterpvs[_local14] = 0;
_local14 = (_local14 + 1);
};
waterpools = (waterpools + 1);
}
function frame2(){
wait = 0;
particlealpha = 0;
particlequality = 0;
debrisquality = 0;
bulletcasingquality = 0;
graphicsquality = 0;
difficulty = 0;
lighting = new Boolean();
lighting = true;
this.x = 0;
this.y = 0;
this.scaleX = 1;
this.scaleY = 1;
stop();
Mouse.show();
sloth.alpha = 1;
this.addEventListener(Event.ENTER_FRAME, tempstep);
}
function frame6(){
stop();
Mouse.show();
fullbtn0.addEventListener(MouseEvent.CLICK, fullbtn0click);
reducedbtn0.addEventListener(MouseEvent.CLICK, reducedbtn0click);
nonebtn0.addEventListener(MouseEvent.CLICK, nonebtn0click);
fullbtn1.addEventListener(MouseEvent.CLICK, fullbtn1click);
reducedbtn1.addEventListener(MouseEvent.CLICK, reducedbtn1click);
nonebtn1.addEventListener(MouseEvent.CLICK, nonebtn1click);
fullbtn2.addEventListener(MouseEvent.CLICK, fullbtn2click);
reducedbtn2.addEventListener(MouseEvent.CLICK, reducedbtn2click);
fullbtn3.addEventListener(MouseEvent.CLICK, fullbtn3click);
nonebtn3.addEventListener(MouseEvent.CLICK, nonebtn3click);
fullbtn4.addEventListener(MouseEvent.CLICK, fullbtn4click);
reducedbtn4.addEventListener(MouseEvent.CLICK, reducedbtn4click);
menubtn.addEventListener(MouseEvent.CLICK, menubtnclick);
this.addEventListener(Event.ENTER_FRAME, menustep2);
}
public function muzzlesmokecolor():int{
var _local1:int;
_local1 = new int();
_local1 = (Math.random() * 100);
return (rgb((100 + _local1), (100 + _local1), (100 + _local1)));
}
function frame7(){
stop();
Mouse.show();
menubtn3.addEventListener(MouseEvent.CLICK, menubtn3click);
}
function frame8(){
stop();
Mouse.show();
menubtn2.addEventListener(MouseEvent.CLICK, menubtn2click);
easybtn.addEventListener(MouseEvent.CLICK, easybtnclick);
mediumbtn.addEventListener(MouseEvent.CLICK, mediumbtnclick);
hardbtn.addEventListener(MouseEvent.CLICK, hardbtnclick);
}
function frame9(){
stop();
debugmode = false;
showphysicsobjects = debugmode;
pickuptextdelay = 0;
pickuptext = "";
messagetextdelay = 0;
messagetext = "";
messagestring = "";
ammotext = "";
healthtext = "";
isplayer = false;
inmap = false;
lowestframerate = 0;
cutscene = false;
deathcounter = 0;
playerhealth = 0;
if (difficulty == 0){
playerhealth = 600;
};
if (difficulty == 1){
playerhealth = 450;
};
if (difficulty == 2){
playerhealth = 300;
};
if (graphicsquality == 0){
StageQuality.BEST;
};
if (graphicsquality == 1){
StageQuality.HIGH;
};
if (graphicsquality == 2){
StageQuality.MEDIUM;
};
foreground = new MovieClip();
background = new MovieClip();
backdrop = new MovieClip();
cursor = new MovieClip();
background = new backgroundmc();
foreground = new foregroundmc();
backdrop = new backdropmc();
background.scaleX = 2;
background.scaleY = 2;
foreground.scaleX = 2;
foreground.scaleY = 2;
cursor = new cursormc();
lightcontainer = new Sprite();
backdropcopy = new Bitmap();
backgroundcopy = new Bitmap();
foregroundcopy = new Bitmap();
mytestcontainer = new Sprite();
mytestcontainer2 = new Sprite();
mytestcontainer3 = new Sprite();
mytestcontainer.addChild(backdropcopy);
mytestcontainer2.addChild(backgroundcopy);
mytestcontainer3.addChild(foregroundcopy);
addChild(mytestcontainer);
addChild(mytestcontainer2);
bool1 = false;
bool2 = false;
bool3 = false;
bool4 = false;
bool5 = false;
bool6 = false;
counter1 = 0;
counter2 = 0;
counter3 = 0;
counter4 = 0;
counter5 = 0;
counter6 = 0;
mapnumber = 0;
xposition = 0;
yposition = 0;
rainfall = new Sound();
rainfall = new rainfallsound();
schannel = new SoundChannel();
loopchannel = new SoundChannel();
loopchannel2 = new SoundChannel();
smgshoot = new Sound();
smgshoot = new smgshootsound();
rifleshoot = new Sound();
rifleshoot = new rifleshootsound();
pistolshoot = new Sound();
pistolshoot = new pistolshootsound();
grenadeexplode = new Sound();
grenadeexplode = new grenadeexplodesound();
nailgunshooting = new Sound();
nailgunshooting = new nailgunshoot();
shotgunshoot = new Sound();
shotgunshoot = new shotgunshootsound();
turretshoot = new Sound();
turretshoot = new turretshootsound();
turretexplode = new Sound();
turretexplode = new turretexplodesound();
shell1 = new Sound();
shell1 = new shell1sound();
shell2 = new Sound();
shell2 = new shell2sound();
shell3 = new Sound();
shell3 = new shell3sound();
shell4 = new Sound();
shell4 = new shell4sound();
shell5 = new Sound();
shell5 = new shell5sound();
berserk = new Sound();
berserk = new berserksound();
teleport = new Sound();
teleport = new teleportsound();
grenadebounce1 = new Sound();
grenadebounce1 = new grenadebounce1sound();
grenadebounce2 = new Sound();
grenadebounce2 = new grenadebounce2sound();
grenadebounce3 = new Sound();
grenadebounce3 = new grenadebounce3sound();
ammopickup = new Sound();
ammopickup = new ammopickupsound();
weaponpickup = new Sound();
weaponpickup = new weaponpickupsound();
healthpickup = new Sound();
healthpickup = new healthpickupsound();
chainsawrev = new Sound();
chainsawrev = new chainsawrevsound();
chainsawstart = new Sound();
chainsawstart = new chainsawstartsound();
squish = new Sound();
squish = new squishsound();
ratsqueak = new Sound();
ratsqueak = new ratsqueaksound();
zombiedie = new Sound();
zombiedie = new zombiediesound();
playerdamage = new Sound();
playerdamage = new playerdamagesound();
crowcaw = new Sound();
crowcaw = new crowcawsound();
explosion = new Sound();
explosion = new explosionsound();
dryfire = new Sound();
dryfire = new dryfiresound();
drip = new Sound();
drip = new dripsound();
smallcrash = new Sound();
smallcrash = new smallcrashsound();
bigcrash = new Sound();
bigcrash = new bigcrashsound();
waterfall = new Sound();
waterfall = new waterfallsound();
waterspray = new Sound();
waterspray = new waterspraysound();
metalcrash = new Sound();
metalcrash = new metalcrashsound();
hydrantspray = new Sound();
hydrantspray = new hydrantspraysound();
electricbuzz = new Sound();
electricbuzz = new electricbuzzsound();
dooropen = new Sound();
dooropen = new dooropensound();
alarm = new Sound();
alarm = new alarmsound();
nailhit = new Sound();
nailhit = new nailhitsound();
music = new Sound();
music = new musicsound();
rocketshoot = new Sound();
rocketshoot = new rocketshootsound();
lasershoot = new Sound();
lasershoot = new lasershootsound();
plane = new Sound();
plane = new planesound();
megazombieintro = new Sound();
megazombieintro = new megazombieintrosound();
megazombiedie = new Sound();
megazombiedie = new megazombiediesound();
megazombieexhaust = new Sound();
megazombieexhaust = new megazombieexhaustsound();
megazombieengine = new Sound();
megazombieengine = new megazombieenginesound();
lightfilter = new GlowFilter();
light = new Array();
lights = new int();
f = new int();
f = 0;
while (f < maxlights) {
light[f] = new Sprite();
f = (f + 1);
};
q = 0;
numberofps = 0;
node = new Array();
nodes = 0;
winzone = new Array();
winzones = 0;
killzone = new Array();
killzones = 0;
damagezone = new Array();
damagezones = 0;
item = new Array();
spawnfacedirection = 0;
spawnpointdirection = 0;
weapons = 0;
pickups = 0;
enemies = 0;
currentnode = 0;
found = false;
chance = 0;
highestchance = 0;
playerweapon = chainsawnum;
gplayerdamage = 0;
playerrifleammo = 0;
playerhasrifle = false;
playerpistolammo = 0;
playerhaspistol = false;
playergrenadeammo = 0;
playerhasgrenade = false;
playershotgunammo = 0;
playerhasshotgun = false;
playersmgammo = 0;
playerhassmg = false;
playernailgunammo = 0;
playerhasnailgun = false;
playerrpgammo = 0;
playerhasrpg = false;
playerhaschainsaw = false;
pickupglowfilter = new GlowFilter(rgb(0, 0, 0xFF), 0.5, 12, 12, 4, 1, false, false);
health = new Array();
healths = 0;
shotgunammo = new Array();
shotgunammos = 0;
smgammo = new Array();
smgammos = 0;
pistolammo = new Array();
pistolammos = 0;
grenadeammo = new Array();
grenadeammos = 0;
rifleammo = new Array();
rifleammos = 0;
nailgunammo = new Array();
nailgunammos = 0;
pickupscontainer = new Sprite();
addChild(pickupscontainer);
weaponglowfilter = new GlowFilter(rgb(0xFF, 0, 0), 0.5, 12, 12, 4, 1, false, false);
rifle = new Array();
rifles = 0;
pistol = new Array();
pistols = 0;
shotgun = new Array();
shotguns = 0;
smg = new Array();
smgs = 0;
nailgun = new Array();
nailguns = 0;
rpg = new Array();
rpgs = 0;
chainsaw = new Array();
chainsaws = 0;
weaponscontainer = new Sprite();
addChild(weaponscontainer);
tempx1 = 0;
tempy1 = 0;
tempx2 = 0;
tempy2 = 0;
temprotation = 0;
players = 0;
player = new Array();
deltahs = 0;
deltavs = 0;
maxmovespeed = 0;
movefactor = 0;
groundoffset = 0;
deltahs2 = 0;
temporaryhs = 0;
bodynormal = 0;
directiondelta = 0;
legsoffset = 0;
gundirection = 0;
enemyC = new Array();
enemyCs = 0;
enemyB = new Array();
enemyBs = 0;
enemyA = new Array();
enemyAs = 0;
turretbarrel = new Array();
turretbarrels = 0;
turretbase = new Array();
turretbases = 0;
megazombie = new Array();
megazombies = 0;
megazombiegun = new Array();
megazombieguns = 0;
enemycontainer = new Sprite();
addChild(enemycontainer);
computer = new Array();
computers = 0;
city = new Array();
cities = 0;
backgroundmappropscontainer = new Sprite();
addChild(backgroundmappropscontainer);
npccontainer = new Sprite();
addChild(npccontainer);
rats = 0;
rat = new Array();
crows = 0;
crow = new Array();
crowwings = 0;
crowwing = new Array();
barrel = new Array();
barrels = 0;
crate = new Array();
crates = 0;
midgroundmappropscontainer = new Sprite();
addChild(midgroundmappropscontainer);
legA = new Array();
legAs = 0;
legB = new Array();
legBs = 0;
legC = new Array();
legCs = 0;
legD = new Array();
legDs = 0;
bodyA = new Array();
bodyAs = 0;
bodyB = new Array();
bodyBs = 0;
bodyC = new Array();
bodyCs = 0;
bodyD = new Array();
bodyDs = 0;
torsos = 0;
torso = new Array();
upperlegs = 0;
upperleg = new Array();
lowerlegs = 0;
lowerleg = new Array();
upperarms = 0;
upperarm = new Array();
lowerarms = 0;
lowerarm = new Array();
heads = 0;
head = new Array();
bodypartscontainer = new Sprite();
addChild(bodypartscontainer);
vstring = new Array();
string = new Array();
strings = 0;
pointdebriss = 0;
pointdebris = new Array();
linedebriss = 0;
linedebris = new Array();
boxdebriss = 0;
boxdebris = new Array();
chaindebriss = 0;
chaindebris = new Array();
limbs = 0;
limb = new Array();
corpses = 0;
corpse = new Array();
bulletcasing = new Array();
bulletcasings = 0;
chain = new Array();
chains = 0;
links = 0;
link = new Array();
debriscontainer = new Sprite();
addChild(debriscontainer);
dchance = 0;
bcchance = 0;
alternatenum = 0;
df = 0;
z = 0;
segments = 0;
chaindistance = 0;
countedcorpses = 0;
stringdistance = 0;
grenades = 0;
grenade = new Array();
nails = 0;
nail = new Array();
lasers = 0;
laser = new Array();
rockets = 0;
rocket = new Array();
movetrails = 0;
movetrail = new Array();
blast = new Array();
blasts = 0;
bullet = new Array();
bullets = 0;
hitzone = new Array();
hitzones = 0;
hit = new Array();
hits = 0;
i = 0;
t = 0;
foundbullet = 0;
foundblast = 0;
impactx = 0;
impacty = 0;
hitsomething = false;
objectdirection = 0;
tempnormal = 0;
tempdistance = 0;
damagetaken = 0;
explosiondistance = 0;
blastdamage = 0;
randsound = 0;
projectilecontainer = new Sprite();
addChild(projectilecontainer);
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
walldoor = new Array();
walldoors = 0;
floordoor = new Array();
floordoors = 0;
spinlight = new Array();
spinlights = 0;
foregroundmappropscontainer = new Sprite();
addChild(foregroundmappropscontainer);
physicscontainer = new Sprite();
addChild(physicscontainer);
tsin = new Array();
tcos = new Array();
o = 0;
u = 0;
o = 0;
while (o <= 360) {
tsin[o] = Math.sin((o * degtorad));
tcos[o] = Math.cos((o * degtorad));
o = (o + 1);
};
tdistance = new Array();
o = 0;
while (o < 100) {
tdistance[o] = new Array();
u = 0;
while (u < 100) {
tdistance[o][u] = Math.sqrt(((o * o) + (u * u)));
u = (u + 1);
};
o = (o + 1);
};
tdtp = new Array();
o = 0;
while (o < 101) {
tdtp[o] = (Math.abs(Math.atan((o / 100))) * radtodeg);
o = (o + 1);
};
wateraffector = new Array();
wateraffectors = 0;
possiblelinenum = new Array();
possiblelines = 0;
p = new Array();
ps = 0;
gp = new Array();
vgp = new Array();
gps = 0;
objectline = new Array();
vobjectline = new Array();
objectlines = 0;
hinge = new Array();
vhinge = new Array();
hinges = 0;
drawnline = new Array();
vdrawnline = new Array();
drawnlines = 0;
point = new Array();
vpoint = new Array();
points = 0;
rope = new Array();
vrope = new Array();
ropes = 0;
line = new Array();
vline = new Array();
lines = 0;
collisionline = new Array();
vcollisionline = new Array();
collisionlines = 0;
waterpool = new Array();
vwaterpool = new Array();
waterpools = 0;
ragdoll = new Array();
vragdoll = new Array();
ragdolls = 0;
box = new Array();
vbox = new Array();
boxes = 0;
bestcx = 0;
bestcy = 0;
bestsurfacedirection = 0;
cx = 0;
cy = 0;
surfacedirection = 0;
addChild(lightcontainer);
addChild(mytestcontainer3);
r = 0;
weapondisplays = 0;
weapondisplay = new Array();
r = 0;
while (r < 8) {
weapondisplay[r] = new weapondisplaymc();
addChild(weapondisplay[r]);
weapondisplay[r].active = true;
weapondisplay[r].frame = r;
weapondisplays = (weapondisplays + 1);
r = (r + 1);
};
ammodisplay = new MovieClip();
healthdisplay = new MovieClip();
healthbar = new MovieClip();
berserkdisplay = new MovieClip();
berserkbar = new MovieClip();
hudpickuptext = new TextField();
hudhealthtext = new TextField();
hudammotext = new TextField();
hudmessagetext = new TextField();
fontformat = new format2class();
textformat1 = new TextFormat();
textformat1.font = fontformat.fontName;
textformat1.align = TextFormatAlign.CENTER;
textformat1.color = 0xFFFFFF;
textformat2 = new TextFormat();
textformat2.font = fontformat.fontName;
textformat2.align = TextFormatAlign.LEFT;
textformat2.color = 0xFFFFFF;
clickedbutton = false;
textformat3 = new TextFormat();
textformat3.font = fontformat.fontName;
textformat3.align = TextFormatAlign.RIGHT;
textformat3.color = 0xFFFFFF;
hudpickuptext.embedFonts = true;
hudhealthtext.embedFonts = true;
hudammotext.embedFonts = true;
hudmessagetext.embedFonts = true;
hudpickuptext.defaultTextFormat = textformat1;
hudhealthtext.defaultTextFormat = textformat2;
hudammotext.defaultTextFormat = textformat2;
hudmessagetext.defaultTextFormat = textformat1;
hudpickuptext.width = 600;
hudhealthtext.width = 200;
hudammotext.width = 200;
hudmessagetext.width = 600;
hudpickuptext.selectable = false;
hudhealthtext.selectable = false;
hudammotext.selectable = false;
hudmessagetext.selectable = false;
berserkdisplay = new berserkdisplaymc();
berserkbar = new berserkbarmc();
berserkbar.fadedirection = 1;
ammodisplay = new ammodisplaymc();
healthdisplay = new healthdisplaymc();
healthbar = new healthbarmc();
addChild(hudpickuptext);
addChild(hudhealthtext);
addChild(healthbar);
addChild(berserkbar);
addChild(healthdisplay);
addChild(berserkdisplay);
addChild(ammodisplay);
addChild(hudammotext);
addChild(hudmessagetext);
addChild(cursor);
effectscontainer = new Sprite();
addChild(effectscontainer);
rain = new Array();
raindrops = 0;
if (particlequality == 0){
raindrops = 16;
} else {
raindrops = 8;
};
z = 0;
while (z < raindrops) {
rain[z] = new rainmc();
effectscontainer.addChild(rain[z]);
rain[z].active = true;
rain[z].visible = true;
rain[z].x = (Math.random() * 600);
rain[z].y = (Math.random() * 300);
rain[z].vs = ((Math.random() * 5) + 3);
rain[z].height = (rain[z].vs * 2);
if (particlealpha == 0){
rain[z].alpha = (rain[z].vs * 0.1);
};
rain[z].alpha = 100;
z = (z + 1);
};
stoprain();
fog = new MovieClip();
fog = new fogmc();
effectscontainer.addChild(fog);
stopfog();
screenflash = new MovieClip();
screenflash = new screenflashmc();
effectscontainer.addChild(screenflash);
stopflash();
fire = new Array();
fires = 0;
berserkscreen = new MovieClip();
berserkscreen = new berserkscreenmc();
effectscontainer.addChild(berserkscreen);
stopberserkscreen();
fade = new MovieClip();
fade = new fademc();
effectscontainer.addChild(fade);
stopfade();
clicking = false;
clicktime = 0;
pkeyq = false;
pkeyspace = false;
pkeya = false;
pkeyd = false;
pkeyw = false;
pkey1 = false;
pkey2 = false;
pkey3 = false;
pkey4 = false;
pkey5 = false;
pkey6 = false;
pkey7 = false;
pkey8 = false;
selectedp = 0;
pdistance = 0;
lowestpnum2 = 0;
lowestpdistance = 0;
u2 = 0;
temppdistance = 0;
this.addEventListener(Event.ENTER_FRAME, step);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mousedown);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseup);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keydown, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_UP, keyup, false, 0, true);
loadmap(1);
}
function frame5(){
stop();
Mouse.show();
optionsbtn.addEventListener(MouseEvent.CLICK, optionsbtnclick);
beginbtn.addEventListener(MouseEvent.CLICK, beginbtnclick);
controlsbtn.addEventListener(MouseEvent.CLICK, controlsbtnclick);
slothbtn0.addEventListener(MouseEvent.CLICK, slothbtn0click);
}
function frame1(){
stage.scaleMode = StageScaleMode.NO_SCALE;
MochiAd.showPreGameAd({clip:root, id:"4a11b858f0c038a0", res:"600x300", background:0, color:0xFF0000, outline:0x660000, no_bg:true});
}
public function countcorpses():int{
countedcorpses = 0;
z = 0;
while (z < corpses) {
if (corpse[z].active == true){
countedcorpses = (countedcorpses + 1);
};
z = (z + 1);
};
return (countedcorpses);
}
public function electricsparks(_arg1:Number, _arg2:Number){
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 6, 8, 0.5);
q = 0;
while (q < 3) {
creategp(_arg1, _arg2, ((Math.random() * 2) + 2), (Math.random() * 360), (Math.random() * 4), 0.99, 0.05, ((Math.random() * 10) + 10), 0xFFFF00, true);
q = (q + 1);
};
}
function frame3(){
this.removeEventListener(Event.ENTER_FRAME, tempstep);
}
public function nuclearblast(_arg1:Number, _arg2:Number){
startflash();
explosion.play();
q = 0;
while (q < 5) {
creategp(_arg1, _arg2, ((Math.random() * 10) + 20), ((Math.random() * 20) + 80), (Math.random() * 10), 0.85, -0.04, ((Math.random() * 50) + 150), explosionsmokecolor(), false);
q = (q + 1);
};
q = 0;
while (q < 15) {
creategp(_arg1, (_arg2 - 30), ((Math.random() * 10) + 20), (Math.random() * 360), ((Math.random() * 5) + 1), 0.92, -0.1, ((Math.random() * 50) + 150), explosionsmokecolor(), false);
q = (q + 1);
};
creategp(_arg1, _arg2, ((Math.random() * 10) + 30), 0, 0, 0.92, -0.12, ((Math.random() * 50) + 100), 0xFFFF00, false);
q = 0;
while (q < 6) {
creategp((_arg1 + 1), (_arg2 - 4), ((Math.random() * 10) + 20), ((Math.random() * 10) - 5), ((Math.random() * 2) + 1), 0.97, -0.005, ((Math.random() * 50) + 100), explosionsmokecolor(), false);
creategp((_arg1 - 1), (_arg2 - 4), ((Math.random() * 10) + 20), ((Math.random() * 10) + 175), ((Math.random() * 2) + 1), 0.97, -0.005, ((Math.random() * 50) + 100), explosionsmokecolor(), false);
q = (q + 1);
};
}
public function fullbtn3click(_arg1){
particlealpha = 0;
}
public function bulletcollide(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:int){
objectdirection = directiontopoint(_arg1, _arg2, _arg3, _arg4);
hitsomething = false;
hits = 0;
t = 0;
while (t < bullets) {
if (bullet[t].active == true){
if (bullet[t].side != _arg5){
if (linecollide(bullet[t].x1, bullet[t].y1, bullet[t].x2, bullet[t].y2, _arg1, _arg2, _arg3, _arg4, objectdirection) == true){
hitsomething = true;
hit[hits] = new Object();
hit[hits].damage = bullet[t].damage;
hit[hits].y = cy;
hit[hits].x = cx;
hit[hits].dismember = bullet[t].dismember;
hit[hits].bulletdirection = directiontopoint(bullet[t].x1, bullet[t].y1, bullet[t].x2, bullet[t].y2);
hits = (hits + 1);
};
};
};
t = (t + 1);
};
return (hitsomething);
}
public function createkillzone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
killzone[killzones] = new Object();
killzone[killzones].x1 = _arg1;
killzone[killzones].y1 = _arg2;
killzone[killzones].x2 = _arg3;
killzone[killzones].y2 = _arg4;
killzone[killzones].active = true;
killzones = (killzones + 1);
}
public function createchaindebris(_arg1:Number, _arg2:Number, _arg3:int){
dchance = 0;
if (debrisquality == 1){
dchance = Math.floor((Math.random() * 2));
};
if (dchance == 0){
chaindebris[chaindebriss] = new Object();
chaindebris[chaindebriss].active = true;
chaindebris[chaindebriss].type = _arg3;
chaindebris[chaindebriss].alpha = 1;
chaindebris[chaindebriss].livetime = 0;
chaindebris[chaindebriss].x = -1000;
chaindebris[chaindebriss].y = -1000;
chaindebris[chaindebriss].frame = _arg3;
chaindebris[chaindebriss].ropenum = ropes;
createrope(_arg1, _arg2, false, false, _arg1, (_arg2 - 1), false, false, chaindebrissegments, chaindebrissegmentlength, false, chaindebrisaf, chaindebrisg, chaindebrisf, true, -1, false);
chaindebris[chaindebriss].linknum = links;
chaindebris[chaindebriss].segments = chaindebrissegments;
alternatenum = 0;
df = 0;
df = 0;
while (df < (chaindebrissegments - 1)) {
createlink(((_arg3 * 2) + alternatenum));
if (alternatenum == 0){
alternatenum = 1;
} else {
alternatenum = 0;
};
df = (df + 1);
};
chaindebriss = (chaindebriss + 1);
};
}
public function nonebtn1click(_arg1){
bulletcasingquality = 2;
}
public function startfog(){
fog.active = true;
fog.visible = true;
fog.y = 230;
fog.x = (Math.random() * -100);
fog.alpha = 0.2;
}
public function createpistol(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:Number, _arg5:Boolean, _arg6:int){
pistol[pistols] = new pistolmc();
weaponscontainer.addChild(pistol[pistols]);
pistol[pistols].active = true;
pistol[pistols].visible = true;
pistol[pistols].fade = _arg5;
pistol[pistols].facedirection = _arg3;
if (_arg3 == 1){
pistol[pistols].scaleX = -1;
};
pistol[pistols].x = -1000;
pistol[pistols].y = -1000;
pistol[pistols].livetime = 0;
pistol[pistols].pointdirection = _arg4;
pistol[pistols].linenum = lines;
pistol[pistols].filters = [weaponglowfilter];
createline((_arg1 - vectorx(_arg4, (pistollength * 0.5))), (_arg2 - vectory(_arg4, (pistollength * 0.5))), (_arg1 + vectorx(_arg4, (pistollength * 0.5))), (_arg2 + vectory(_arg4, (pistollength * 0.5))), weaponaf, weapong, weaponf, _arg5, _arg6, false);
pistols = (pistols + 1);
}
public function createwalldoor(_arg1:Number, _arg2:Number){
walldoor[walldoors] = new walldoormc();
backgroundmappropscontainer.addChild(walldoor[walldoors]);
walldoor[walldoors].active = true;
walldoor[walldoors].visible = true;
walldoor[walldoors].x = _arg1;
walldoor[walldoors].y = _arg2;
walldoors = (walldoors + 1);
}
public function countpickups(){
pickups = 0;
z = 0;
while (z < rifleammos) {
if (rifleammo[z].active == true){
pickups = (pickups + 1);
};
z = (z + 1);
};
z = 0;
while (z < shotgunammos) {
if (shotgunammo[z].active == true){
pickups = (pickups + 1);
};
z = (z + 1);
};
z = 0;
while (z < pistolammos) {
if (pistolammo[z].active == true){
pickups = (pickups + 1);
};
z = (z + 1);
};
z = 0;
while (z < smgammos) {
if (smgammo[z].active == true){
pickups = (pickups + 1);
};
z = (z + 1);
};
z = 0;
while (z < nailgunammos) {
if (nailgunammo[z].active == true){
pickups = (pickups + 1);
};
z = (z + 1);
};
z = 0;
while (z < grenadeammos) {
if (grenadeammo[z].active == true){
pickups = (pickups + 1);
};
z = (z + 1);
};
z = 0;
while (z < healths) {
if (health[z].active == true){
pickups = (pickups + 1);
};
z = (z + 1);
};
return (pickups);
}
public function createdamagezone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
damagezone[damagezones] = new Object();
damagezone[damagezones].damage = _arg5;
damagezone[damagezones].x1 = _arg1;
damagezone[damagezones].y1 = _arg2;
damagezone[damagezones].x2 = _arg3;
damagezone[damagezones].y2 = _arg4;
damagezone[damagezones].active = true;
damagezones = (damagezones + 1);
}
public function bloodcolor():int{
var _local1:int;
_local1 = new int();
_local1 = (Math.random() * 100);
return (rgb((155 + _local1), 0, 0));
}
public function createmegazombiegun(_arg1:Number, _arg2:Number, _arg3:Number){
megazombiegun[megazombieguns] = new megazombiegunmc();
enemycontainer.addChild(megazombiegun[megazombieguns]);
megazombiegun[megazombieguns].active = true;
megazombiegun[megazombieguns].visible = true;
megazombiegun[megazombieguns].x = _arg1;
megazombiegun[megazombieguns].y = _arg2;
megazombiegun[megazombieguns].rotation = -(_arg3);
megazombieguns = (megazombieguns + 1);
}
public function createenemyA(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:Boolean, _arg5:Boolean){
enemyA[enemyAs] = new Object();
enemyA[enemyAs].active = true;
enemyA[enemyAs].shootdelay = 0;
enemyA[enemyAs].onfire = _arg5;
enemyA[enemyAs].damage = 0;
enemyA[enemyAs].framedelay = 0;
enemyA[enemyAs].slow = 0;
enemyA[enemyAs].x = -1000;
enemyA[enemyAs].y = -1000;
enemyA[enemyAs].lastnode = -1;
enemyA[enemyAs].hastarget = false;
enemyA[enemyAs].targetx = 0;
enemyA[enemyAs].targety = 0;
enemyA[enemyAs].movedelay = 0;
enemyA[enemyAs].movedirection = _arg3;
enemyA[enemyAs].patrolling = _arg4;
enemyA[enemyAs].facedirection = _arg3;
enemyA[enemyAs].objectlinenum = objectlines;
createobjectline(_arg1, _arg2, (ragdollheight * 2), enemyAaf, enemyAg, enemyAf);
enemyA[enemyAs].firstlegnum = legBs;
createlegB();
createlegB();
legB[enemyA[enemyAs].firstlegnum].framerate = 0;
legB[(enemyA[enemyAs].firstlegnum + 1)].framerate = 0;
if (_arg3 == 0){
legB[enemyA[enemyAs].firstlegnum].frame = 4;
legB[(enemyA[enemyAs].firstlegnum + 1)].frame = 14;
} else {
legB[enemyA[enemyAs].firstlegnum].frame = 14;
legB[(enemyA[enemyAs].firstlegnum + 1)].frame = 4;
};
enemyA[enemyAs].bodynum = bodyBs;
createbodyB();
enemyAs = (enemyAs + 1);
}
public function createenemyB(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:Boolean, _arg5:Boolean){
enemyB[enemyBs] = new Object();
enemyB[enemyBs].active = true;
enemyB[enemyBs].shootdelay = 0;
enemyB[enemyBs].damage = 0;
enemyB[enemyBs].framedelay = 0;
enemyB[enemyBs].slow = 0;
enemyB[enemyBs].kamikaze = _arg5;
enemyB[enemyBs].x = -1000;
enemyB[enemyBs].y = -1000;
enemyB[enemyBs].lastnode = -1;
enemyB[enemyBs].hastarget = false;
enemyB[enemyBs].targetx = 0;
enemyB[enemyBs].targety = 0;
enemyB[enemyBs].movedelay = 0;
enemyB[enemyBs].movedirection = _arg3;
enemyB[enemyBs].patrolling = _arg4;
enemyB[enemyBs].facedirection = 0;
enemyB[enemyBs].objectlinenum = objectlines;
createobjectline(_arg1, _arg2, (ragdollheight * 2), enemyBaf, enemyBg, enemyBf);
enemyB[enemyBs].firstlegnum = legCs;
createlegC();
createlegC();
legC[enemyB[enemyBs].firstlegnum].framerate = 0;
legC[(enemyB[enemyBs].firstlegnum + 1)].framerate = 0;
if (_arg3 == 0){
legC[enemyB[enemyBs].firstlegnum].frame = 4;
legC[(enemyB[enemyBs].firstlegnum + 1)].frame = 14;
} else {
legC[enemyB[enemyBs].firstlegnum].frame = 14;
legC[(enemyB[enemyBs].firstlegnum + 1)].frame = 4;
};
enemyB[enemyBs].bodynum = bodyCs;
createbodyC();
enemyBs = (enemyBs + 1);
}
public function createenemyC(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:Boolean){
enemyC[enemyCs] = new Object();
enemyC[enemyCs].active = true;
enemyC[enemyCs].shootdelay = 0;
enemyC[enemyCs].damage = 0;
enemyC[enemyCs].framedelay = 0;
enemyC[enemyCs].slow = 0;
enemyC[enemyCs].x = -1000;
enemyC[enemyCs].y = -1000;
enemyC[enemyCs].lastnode = -1;
enemyC[enemyCs].hastarget = false;
enemyC[enemyCs].targetx = 0;
enemyC[enemyCs].targety = 0;
enemyC[enemyCs].movedelay = 0;
enemyC[enemyCs].movedirection = _arg3;
enemyC[enemyCs].patrolling = _arg4;
enemyC[enemyCs].facedirection = 0;
enemyC[enemyCs].objectlinenum = objectlines;
createobjectline(_arg1, _arg2, (ragdollheight * 2), enemyCaf, enemyCg, enemyCf);
enemyC[enemyCs].firstlegnum = legDs;
createlegD();
createlegD();
legD[enemyC[enemyCs].firstlegnum].framerate = 0;
legD[(enemyC[enemyCs].firstlegnum + 1)].framerate = 0;
if (_arg3 == 0){
legD[enemyC[enemyCs].firstlegnum].frame = 4;
legD[(enemyC[enemyCs].firstlegnum + 1)].frame = 14;
} else {
legD[enemyC[enemyCs].firstlegnum].frame = 14;
legD[(enemyC[enemyCs].firstlegnum + 1)].frame = 4;
};
enemyC[enemyCs].bodynum = bodyDs;
createbodyD();
enemyCs = (enemyCs + 1);
}
public function createturretbase(_arg1:Number, _arg2:Number, _arg3:Number){
createturretbarrel(_arg1, _arg2, _arg3);
turretbase[turretbases] = new turretbasemc();
enemycontainer.addChild(turretbase[turretbases]);
turretbase[turretbases].active = true;
turretbase[turretbases].visible = true;
turretbase[turretbases].x = _arg1;
turretbase[turretbases].y = _arg2;
turretbase[turretbases].shootdelay = 0;
turretbase[turretbases].damage = 0;
turretbase[turretbases].targetdirection = _arg3;
turretbase[turretbases].hastarget = false;
turretbase[turretbases].x1 = (_arg1 + vectorx(correctdirection((_arg3 - 90)), (turretbaselength * 0.5)));
turretbase[turretbases].x2 = (_arg1 - vectorx(correctdirection((_arg3 - 90)), (turretbaselength * 0.5)));
turretbase[turretbases].y1 = (_arg2 + vectory(correctdirection((_arg3 - 90)), (turretbaselength * 0.5)));
turretbase[turretbases].y2 = (_arg2 - vectory(correctdirection((_arg3 - 90)), (turretbaselength * 0.5)));
turretbase[turretbases].restdirection = _arg3;
turretbase[turretbases].pointdirection = _arg3;
turretbase[turretbases].barrelnum = (turretbarrels - 1);
turretbase[turretbases].rotation = -(_arg3);
turretbases = (turretbases + 1);
}
public function createrat(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:Boolean){
rat[rats] = new ratmc();
npccontainer.addChild(rat[rats]);
rat[rats].active = true;
rat[rats].visible = true;
rat[rats].x = _arg1;
rat[rats].y = _arg2;
rat[rats].frame = 0;
rat[rats].hitzonenum = hitzones;
createhitzone(rat[rats].x, rat[rats].y, ratradius);
rat[rats].facedirection = _arg3;
if (_arg3 == 1){
rat[rats].scaleX = -1;
};
rat[rats].scared = _arg4;
rats = (rats + 1);
}
public function slothbtn0click(_arg1){
}
public function linecollide(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number):Boolean{
var _local10:Boolean;
var _local11:Number;
var _local12:Number;
var _local13:int;
var _local14:int;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local10 = true;
_local11 = 0;
_local12 = 0;
_local13 = -1;
_local14 = -1;
_local15 = 0;
_local16 = 0;
_local17 = 0;
_local18 = 0;
if ((_arg1 - _arg3) == 0){
_local13 = 1;
};
if ((_arg5 - _arg7) == 0){
_local14 = 1;
};
if ((_arg2 - _arg4) == 0){
_local13 = 0;
};
if ((_arg6 - _arg8) == 0){
_local14 = 0;
};
if ((_local13 + _local14) == -2){
_local15 = ((_arg2 - _arg4) / (_arg1 - _arg3));
_local16 = ((_arg6 - _arg8) / (_arg5 - _arg7));
if ((_local16 - _local15) != 0){
_local17 = ((-(_local15) * _arg1) + _arg2);
_local18 = ((-(_local16) * _arg5) + _arg6);
_local12 = (((_local17 * _local16) - (_local18 * _local15)) / (_local16 - _local15));
_local11 = ((_local18 - _local17) / (_local15 - _local16));
} else {
_local10 = false;
};
} else {
if (_local13 != _local14){
if (((!((_local13 == -1))) && (!((_local14 == -1))))){
if ((((_local13 == 0)) && ((_local14 == 1)))){
_local11 = _arg5;
_local12 = _arg2;
};
if ((((_local13 == 1)) && ((_local14 == 0)))){
_local11 = _arg1;
_local12 = _arg6;
};
} else {
if (_local13 == -1){
_local15 = ((_arg2 - _arg4) / (_arg1 - _arg3));
_local17 = ((-(_local15) * _arg1) + _arg2);
if (_local14 == 0){
_local12 = _arg6;
_local11 = ((_local12 - _local17) / _local15);
} else {
_local11 = _arg5;
_local12 = ((_local15 * _local11) + _local17);
};
} else {
_local16 = ((_arg6 - _arg8) / (_arg5 - _arg7));
_local18 = ((-(_local16) * _arg5) + _arg6);
if (_local13 == 0){
_local12 = _arg2;
_local11 = ((_local12 - _local18) / _local16);
} else {
_local11 = _arg1;
_local12 = ((_local16 * _local11) + _local18);
};
};
};
} else {
_local10 = false;
};
};
if (_arg1 <= _arg3){
if ((((_local11 < _arg1)) || ((_local11 > _arg3)))){
_local10 = false;
};
} else {
if ((((_local11 > _arg1)) || ((_local11 < _arg3)))){
_local10 = false;
};
};
if (_arg2 < _arg4){
if ((((_local12 < _arg2)) || ((_local12 > _arg4)))){
_local10 = false;
};
} else {
if ((((_local12 > _arg2)) || ((_local12 < _arg4)))){
_local10 = false;
};
};
if (_arg5 <= _arg7){
if ((((_local11 < _arg5)) || ((_local11 > _arg7)))){
_local10 = false;
};
} else {
if ((((_local11 > _arg5)) || ((_local11 < _arg7)))){
_local10 = false;
};
};
if (_arg6 <= _arg8){
if ((((_local12 < _arg6)) || ((_local12 > _arg8)))){
_local10 = false;
};
} else {
if ((((_local12 > _arg6)) || ((_local12 < _arg8)))){
_local10 = false;
};
};
if (_local10 == true){
cx = _local11;
cy = _local12;
surfacedirection = _arg9;
return (true);
};
return (false);
}
public function mouseup(_arg1:MouseEvent){
clicking = false;
clicktime = 0;
}
public function rifleimpact(_arg1:Number, _arg2:Number){
q = 0;
while (q < 2) {
creategp(_arg1, _arg2, ((Math.random() * 5) + 5), (Math.random() * 360), ((Math.random() * 5) + 3), 0.5, -0.15, ((Math.random() * 15) + 10), impactsmokecolor(), true);
q = (q + 1);
};
creategp(_arg1, _arg2, ((Math.random() * 6) + 6), 0, 0, 0, 0, 5, impactflashcolor(), false);
}
public function correctdirection(_arg1:Number):Number{
var _local2:Number;
_local2 = _arg1;
while ((((_local2 < 0)) || ((_local2 >= 360)))) {
if (_local2 < 0){
_local2 = (_local2 + 360);
};
if (_local2 >= 360){
_local2 = (_local2 - 360);
};
};
return (_local2);
}
public function createhealth(_arg1:Number, _arg2:Number, _arg3:Boolean){
health[healths] = new healthmc();
pickupscontainer.addChild(health[healths]);
health[healths].active = true;
health[healths].visible = true;
health[healths].fade = _arg3;
health[healths].x = -500;
health[healths].y = -500;
health[healths].livetime = 0;
health[healths].boxnum = boxes;
health[healths].filters = [pickupglowfilter];
createbox(_arg1, _arg2, healthsidelength, pickupaf, pickupg, pickupf, _arg3, -1, false);
healths = (healths + 1);
}
public function nonebtn3click(_arg1){
particlealpha = 1;
}
public function createchainsaw(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:Number, _arg5:Boolean, _arg6:int){
chainsaw[chainsaws] = new chainsawmc();
weaponscontainer.addChild(chainsaw[chainsaws]);
chainsaw[chainsaws].active = true;
chainsaw[chainsaws].visible = true;
chainsaw[chainsaws].fade = _arg5;
chainsaw[chainsaws].facedirection = _arg3;
if (_arg3 == 1){
chainsaw[chainsaws].scaleX = -1;
};
chainsaw[chainsaws].x = -1000;
chainsaw[chainsaws].y = -1000;
chainsaw[chainsaws].livetime = 0;
chainsaw[chainsaws].pointdirection = _arg4;
chainsaw[chainsaws].linenum = lines;
chainsaw[chainsaws].filters = [weaponglowfilter];
createline((_arg1 - vectorx(_arg4, (chainsawlength * 0.5))), (_arg2 - vectory(_arg4, (chainsawlength * 0.5))), (_arg1 + vectorx(_arg4, (chainsawlength * 0.5))), (_arg2 + vectory(_arg4, (chainsawlength * 0.5))), weaponaf, weapong, weaponf, _arg5, _arg6, false);
chainsaws = (chainsaws + 1);
}
public function muzzleflashcolor():int{
var _local1:int;
_local1 = new int();
_local1 = (Math.random() * 55);
return (rgb((200 + _local1), (200 + _local1), _local1));
}
public function hardbtnclick(_arg1){
difficulty = 2;
wait = -5;
gotoAndPlay(9);
}
public function createcollisionline(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
collisionline[collisionlines] = new Object();
vcollisionline[collisionlines] = new Shape();
physicscontainer.addChild(vcollisionline[collisionlines]);
collisionline[collisionlines].x = _arg1;
collisionline[collisionlines].y = _arg2;
vcollisionline[collisionlines].x = _arg1;
vcollisionline[collisionlines].y = _arg2;
vcollisionline[collisionlines].visible = true;
collisionline[collisionlines].active = true;
collisionline[collisionlines].x1 = _arg1;
collisionline[collisionlines].y1 = _arg2;
collisionline[collisionlines].x2 = _arg3;
collisionline[collisionlines].y2 = _arg4;
collisionline[collisionlines].slope = directiontopoint(_arg1, _arg2, _arg3, _arg4);
collisionlines = (collisionlines + 1);
}
public function mousedown(_arg1:MouseEvent){
clicking = true;
clicktime = (clicktime + 1);
}
public function step(_arg1){
var h:uint;
var j:uint;
var z:uint;
var f:uint;
var k:uint;
var s:uint;
var d:uint;
var temporaryx:Number;
var temporaryy:Number;
var tempdx:Number;
var tempdy:Number;
var bouncetype:int;
var checkliquids:Boolean;
var l:uint;
var tempattachp:int;
var hitsomething2:Boolean;
var hitsomething3:Boolean;
var foundplayer:Boolean;
var currentnode:int;
var temptargetdirection:Number;
var mzmovespeed:Number;
var mzmovey:Number;
var currenths:Number;
var currentvs:Number;
var lasths:Number;
var lastvs:Number;
var temprotation:Number;
var battleduration = ??pushnamespace
;
var temporarydistance:Number;
var dx:Number;
var dy:Number;
var d1:Number;
var d2:Number;
var olddirection:Number;
var newdirection:Number;
var currentdirection:Number;
var verletiteration:uint;
var watercolor:*;
var Event = _arg1;
if (wait == -5){
cursor.x = mouseX;
cursor.y = mouseY;
Mouse.hide();
if (cutscene == false){
if ((((player[0].berserk == false)) || ((player[0].active == false)))){
healthtext = "";
} else {
healthtext = "";
};
if ((((player[0].active == true)) && ((mapnumber > 1)))){
if (player[0].berserk == false){
if (player[0].berserkamount > maxberserkamount){
player[0].berserkamount = 0;
player[0].berserk = true;
player[0].berserkcounter = berserkduration;
startberserkscreen();
berserkpuff(player[0].x, (player[0].y + 4));
pickuptext = "Rampage!";
pickuptextdelay = messageduration;
};
if (player[0].berserkamount > 0){
player[0].berserkamount = (player[0].berserkamount - berserkdecay);
};
if (player[0].berserkamount < 0){
player[0].berserkamount = 0;
};
} else {
if (player[0].berserkcounter > 0){
player[0].berserkamount = 0;
berserksparks(player[0].x, (player[0].y + 4));
player[0].berserkcounter = (player[0].berserkcounter - 1);
} else {
player[0].berserk = false;
};
};
} else {
player[0].berserkamount = 0;
};
if (pickuptextdelay == 0){
pickuptext = "";
} else {
pickuptextdelay = (pickuptextdelay - 1);
};
if (player[0].active == false){
if (player[0].damage >= playerhealth){
deathcounter = (deathcounter + 1);
};
};
if (deathcounter > 90){
messagetext = "Press SPACE to restart or Q to quit.";
if (pkeyspace == true){
gplayerdamage = 0;
loadmap(mapnumber);
restoreplayerinfo();
};
if (pkeyq == true){
resetgame();
backdropcopy.visible = false;
backgroundcopy.visible = false;
foregroundcopy.visible = false;
cursor.visible = false;
wait = 0;
x = 0;
y = 0;
scaleX = 1;
scaleY = 1;
backdropcopy.scaleX = 1;
backdropcopy.scaleY = 1;
backdropcopy.x = 0;
backdropcopy.y = 0;
maskmc.x = 0;
maskmc.y = 0;
maskmc.scaleX = 2;
maskmc.scaleY = 2;
gotoAndPlay(4);
};
} else {
messagetext = messagestring;
if (messagetextdelay == 0){
messagetext = "";
} else {
messagetextdelay = (messagetextdelay - 1);
};
};
} else {
healthtext = "";
};
cutscene = false;
cursor.visible = true;
if (mapnumber >= 16){
cursor.visible = false;
cutscene = true;
};
if (wait == -5){
if (cutscene == false){
x = ((-(player[0].x) * 2) + 300);
y = ((-(player[0].y) * 2) + 150);
scaleX = 2;
scaleY = 2;
maskmc.x = (-(x) * 0.5);
maskmc.y = (-(y) * 0.5);
if (maskmc.x < 0){
maskmc.x = 0;
};
if (maskmc.x > 300){
maskmc.x = 300;
};
if (maskmc.y > 150){
maskmc.y = 150;
};
if (maskmc.y < 0){
maskmc.y = 0;
};
if (x > 0){
x = 0;
};
if (x < -600){
x = -600;
};
if (y > 0){
y = 0;
};
if (y < -300){
y = -300;
};
backdropcopy.scaleX = 0.5;
backdropcopy.scaleY = 0.5;
backdropcopy.x = (-0.5 * x);
backdropcopy.y = (-0.5 * y);
} else {
x = 0;
y = 0;
scaleX = 1;
scaleY = 1;
backdropcopy.scaleX = 1;
backdropcopy.scaleY = 1;
backdropcopy.x = 0;
backdropcopy.y = 0;
maskmc.x = 0;
maskmc.y = 0;
maskmc.scaleX = 2;
maskmc.scaleY = 2;
};
};
h = 0;
while (h < weapondisplays) {
if (weapondisplay[h].active == true){
if ((((inmap == true)) && ((cutscene == false)))){
if (player[0].weapon == chainsawnum){
ammodisplay.visible = false;
} else {
ammodisplay.visible = true;
};
weapondisplay[h].x = ((maskmc.x + 20) + (h * 25));
weapondisplay[h].y = (maskmc.y + 5);
weapondisplay[h].visible = true;
weapondisplay[h].gotoAndPlay((weapondisplay[h].frame + 1));
if (weapondisplay[h].frame == 0){
if (player[0].haschainsaw == true){
if (player[0].weapon == chainsawnum){
weapondisplay[h].alpha = 1;
} else {
weapondisplay[h].alpha = 0.5;
};
} else {
weapondisplay[h].alpha = 0;
};
};
if (weapondisplay[h].frame == 1){
if ((((player[0].haspistol == true)) && ((player[0].pistolammo > 0)))){
if (player[0].weapon == pistolnum){
weapondisplay[h].alpha = 1;
} else {
weapondisplay[h].alpha = 0.5;
};
} else {
weapondisplay[h].alpha = 0;
};
};
if (weapondisplay[h].frame == 2){
if ((((player[0].hasrifle == true)) && ((player[0].rifleammo > 0)))){
if (player[0].weapon == riflenum){
weapondisplay[h].alpha = 1;
} else {
weapondisplay[h].alpha = 0.5;
};
} else {
weapondisplay[h].alpha = 0;
};
};
if (weapondisplay[h].frame == 3){
if ((((player[0].hassmg == true)) && ((player[0].smgammo > 0)))){
if (player[0].weapon == smgnum){
weapondisplay[h].alpha = 1;
} else {
weapondisplay[h].alpha = 0.5;
};
} else {
weapondisplay[h].alpha = 0;
};
};
if (weapondisplay[h].frame == 4){
if ((((player[0].hasshotgun == true)) && ((player[0].shotgunammo > 0)))){
if (player[0].weapon == shotgunnum){
weapondisplay[h].alpha = 1;
} else {
weapondisplay[h].alpha = 0.5;
};
} else {
weapondisplay[h].alpha = 0;
};
};
if (weapondisplay[h].frame == 5){
if (player[0].grenadeammo > 0){
if (player[0].weapon == grenadenum){
weapondisplay[h].alpha = 1;
} else {
weapondisplay[h].alpha = 0.5;
};
} else {
weapondisplay[h].alpha = 0;
};
};
if (weapondisplay[h].frame == 6){
if (player[0].nailgunammo > 0){
if (player[0].weapon == nailgunnum){
weapondisplay[h].alpha = 1;
} else {
weapondisplay[h].alpha = 0.5;
};
} else {
weapondisplay[h].alpha = 0;
};
};
if (weapondisplay[h].frame == 7){
if (player[0].rpgammo > 0){
if (player[0].weapon == rpgnum){
weapondisplay[h].alpha = 1;
} else {
weapondisplay[h].alpha = 0.5;
};
} else {
weapondisplay[h].alpha = 0;
};
};
} else {
weapondisplay[h].visible = false;
};
};
h = (h + 1);
};
if ((((inmap == true)) && ((cutscene == false)))){
if (player[0].berserk == false){
berserkbar.alpha = (player[0].berserkamount / maxberserkamount);
berserkbar.scaleX = (player[0].berserkamount / maxberserkamount);
if (berserkbar.scaleX < 0){
berserkbar.scaleX = 0;
};
if (berserkbar.scaleX > 1){
berserkbar.scaleX = 1;
};
} else {
berserkbar.scaleX = 1;
berserkbar.alpha = 1;
};
healthbar.alpha = 0.6;
healthbar.scaleX = ((playerhealth - player[0].damage) / playerhealth);
if (healthbar.scaleX < 0){
healthbar.scaleX = 0;
};
if (healthbar.scaleX <= 0.25){
healthbar.gotoAndPlay(4);
};
if ((((healthbar.scaleX > 0.25)) && ((healthbar.scaleX <= 0.5)))){
healthbar.gotoAndPlay(3);
};
if ((((healthbar.scaleX > 0.5)) && ((healthbar.scaleX <= 0.75)))){
healthbar.gotoAndPlay(2);
};
if ((((healthbar.scaleX > 0.75)) && ((healthbar.scaleX <= 1)))){
healthbar.gotoAndPlay(1);
};
} else {
berserkdisplay.visible = false;
berserkbar.visible = false;
ammodisplay.visible = false;
healthdisplay.visible = false;
healthbar.visible = false;
pickuptext = "";
healthtext = "";
ammotext = "";
messagetext = "";
h = 0;
while (h < weapondisplays) {
(weapondisplay[h].visilbe == false);
h = (h + 1);
};
};
hudpickuptext.text = pickuptext;
hudhealthtext.text = healthtext;
hudammotext.text = ammotext;
hudmessagetext.text = messagetext;
hudpickuptext.x = (maskmc.x - 150);
hudpickuptext.y = (maskmc.y + 100);
hudhealthtext.x = (maskmc.x + 5);
hudhealthtext.y = (maskmc.y + 125);
hudammotext.x = (maskmc.x + 235);
hudammotext.y = (maskmc.y + 125);
hudmessagetext.x = (maskmc.x - 150);
hudmessagetext.y = (maskmc.y + 40);
ammodisplay.x = (maskmc.x + 215);
ammodisplay.y = (maskmc.y + 125);
berserkdisplay.x = (maskmc.x + 229);
berserkdisplay.y = (maskmc.y + 5);
berserkbar.x = (maskmc.x + 261);
berserkbar.y = (maskmc.y + 16);
healthdisplay.x = (maskmc.x + 122);
healthdisplay.y = (maskmc.y + 125);
healthbar.x = (maskmc.x + 144);
healthbar.y = (maskmc.y + 131);
h = 0;
j = 0;
z = 0;
f = 0;
k = 0;
s = 0;
d = 0;
temporaryx = 0;
temporaryy = 0;
tempdx = 0;
tempdy = 0;
bouncetype = 0;
checkliquids = false;
h = 0;
while (h < gps) {
if (gp[h].active == true){
gp[h].vs = (gp[h].vs + gp[h].g);
gp[h].vs = (gp[h].vs * gp[h].af);
gp[h].hs = (gp[h].hs * gp[h].af);
gp[h].x = (gp[h].x + gp[h].hs);
gp[h].y = (gp[h].y + gp[h].vs);
vgp[h].x = gp[h].x;
vgp[h].y = gp[h].y;
gp[h].gptime = (gp[h].gptime - 1);
if (gp[h].gptime <= 0){
gp[h].active = false;
};
if (particlealpha == 0){
vgp[h].alpha = (gp[h].gptime / gp[h].gpstarttime);
};
vgp[h].scaleX = (gp[h].gptime / gp[h].gpstarttime);
vgp[h].scaleY = (gp[h].gptime / gp[h].gpstarttime);
} else {
vgp[h].visible = false;
};
h = (h + 1);
};
if (showphysicsobjects == true){
h = 0;
while (h < collisionlines) {
if (collisionline[h].active == true){
vcollisionline[h].visible = true;
var _local3 = vcollisionline[h].graphics;
with (_local3) {
clear();
lineStyle(1, physicsobjectcolor, 1);
moveTo(0, 0);
lineTo((collisionline[h].x2 - collisionline[h].x1), (collisionline[h].y2 - collisionline[h].y1));
};
} else {
vcollisionline[h].visible = false;
};
h = (h + 1);
};
};
h = 0;
while (h < drawnlines) {
if (drawnline[h].active == true){
drawnline[h].active = false;
} else {
vdrawnline[h].visible = false;
};
h = (h + 1);
};
h = 0;
while (h < points) {
if (point[h].active == true){
if (point[h].atrest == false){
pphysics(point[h].firstpnum, true);
possiblelines = 0;
if (point[h].ignorecollisions == false){
temporaryx = p[point[h].firstpnum].x;
temporaryy = p[point[h].firstpnum].y;
j = 0;
while (j < collisionlines) {
if (collisionline[j].active == true){
if (rectcollide((temporaryx - safetydistance), (temporaryy - safetydistance), (temporaryx + safetydistance), (temporaryy + safetydistance), collisionline[j].x1, collisionline[j].y1, collisionline[j].x2, collisionline[j].y2) == true){
possiblelinenum[possiblelines] = j;
possiblelines = (possiblelines + 1);
};
};
j = (j + 1);
};
point[h].bouncetype = pcollisions(point[h].firstpnum);
};
z = point[h].firstpnum;
while (z < (point[h].firstpnum + 1)) {
j = 0;
while (j < objectlines) {
if (objectline[j].active == true){
if (pointcollide(p[z].x, p[z].y, (objectline[j].x - (objectline[j].xwidth * 0.5)), objectline[j].y, (objectline[j].x + (objectline[j].xwidth * 0.5)), (objectline[j].y + objectline[j].yheight)) == true){
bouncetype = 2;
p[z].x = (p[z].x + (objectline[j].dx * characterpushratio));
p[z].y = (p[z].y + (objectline[j].dy * characterpushratio));
};
};
j = (j + 1);
};
z = (z + 1);
};
if (point[h].ignorecollisions == false){
tempdx = -(point[h].x);
tempdy = -(point[h].y);
point[h].x = p[point[h].firstpnum].x;
point[h].y = p[point[h].firstpnum].y;
tempdx = Math.abs((tempdx + point[h].x));
tempdy = Math.abs((tempdy + point[h].y));
if ((((tempdx <= maxrestdelta)) && ((tempdy <= maxrestdelta)))){
point[h].restcounter = (point[h].restcounter + 1);
} else {
point[h].restcounter = 0;
};
if (point[h].restcounter >= resttime){
point[h].atrest = true;
p[point[h].firstpnum].active = false;
};
};
} else {
point[h].x = p[point[h].firstpnum].x;
point[h].y = p[point[h].firstpnum].y;
};
if (showphysicsobjects == true){
_local3 = vpoint[h].graphics;
with (_local3) {
vpoint[h].x = point[h].x;
vpoint[h].y = point[h].y;
clear();
lineStyle(1, physicsobjectcolor, 100);
moveTo(0, -3);
lineTo(0, 0);
};
};
} else {
if (vpoint[h].parent != null){
vpoint[h].parent.removeChild(vpoint[h]);
};
p[point[h].firstpnum].active = false;
vpoint[h].visible = false;
};
h = (h + 1);
};
h = 0;
while (h < waterpools) {
temporarydistance = 0;
if (waterpool[h].active == true){
f = 1;
while (f < (waterpool[h].points - 2)) {
if (Math.round((Math.random() * waterpool[h].windrandomness)) == 0){
waterpool[h].waterpvs[f] = (waterpool[h].waterpvs[f] + waterpool[h].windamount);
};
f = (f + 1);
};
k = 0;
while (k < wateraffectors) {
if (wateraffector[k].active == true){
if (rectcollide((wateraffector[k].x - wateraffector[k].radius), (wateraffector[k].y - wateraffector[k].radius), (wateraffector[k].x + wateraffector[k].radius), (wateraffector[k].y + wateraffector[k].radius), waterpool[h].x, (waterpool[h].y - (waterpool[h].depth / 3)), (waterpool[h].x + waterpool[h].xwidth), (waterpool[h].y + (waterpool[h].depth / 3))) == true){
f = 1;
while (f < (waterpool[h].points - 2)) {
temporarydistance = blockdistance(wateraffector[k].x, wateraffector[k].y, waterpool[h].waterpx[f], waterpool[h].waterpy[f]);
if (temporarydistance <= wateraffector[k].radius){
waterpool[h].waterpvs[f] = ((wateraffector[k].y - wateraffector[k].ly) * 1.41);
};
f = (f + 1);
};
};
};
k = (k + 1);
};
f = 1;
while (f < (waterpool[h].points - 1)) {
waterpool[h].waterpy[f] = (waterpool[h].waterpy[f] + waterpool[h].waterpvs[f]);
if (waterpool[h].waterpy[f] > waterpool[h].y){
waterpool[h].waterpvs[f] = (waterpool[h].waterpvs[f] - waterpool[h].g);
};
if (waterpool[h].waterpy[f] < waterpool[h].y){
waterpool[h].waterpvs[f] = (waterpool[h].waterpvs[f] + waterpool[h].g);
};
if (waterpool[h].waterpy[f] > (waterpool[h].y + waterpool[h].depth)){
waterpool[h].waterpy[f] = (waterpool[h].y + waterpool[h].depth);
};
if (waterpool[h].waterpy[f] < (waterpool[h].y - waterpool[h].depth)){
waterpool[h].waterpy[f] = (waterpool[h].y - waterpool[h].depth);
};
f = (f + 1);
};
f = 0;
while (f < (waterpool[h].points - 1)) {
dx = 0;
dy = 0;
d1 = 0;
d2 = 0;
dx = (waterpool[h].waterpx[(f + 1)] - waterpool[h].waterpx[f]);
dy = (waterpool[h].waterpy[(f + 1)] - waterpool[h].waterpy[f]);
d1 = (Math.abs(dx) + Math.abs(dy));
d2 = ((0.5 * (d1 - waterpool[h].pointwidth)) / d1);
dx = (dx * d2);
dy = (dy * d2);
waterpool[h].waterpx[f] = (waterpool[h].waterpx[f] + dx);
waterpool[h].waterpy[f] = (waterpool[h].waterpy[f] + dy);
waterpool[h].waterpx[(f + 1)] = (waterpool[h].waterpx[(f + 1)] - dx);
waterpool[h].waterpy[(f + 1)] = (waterpool[h].waterpy[(f + 1)] - dy);
f = (f + 1);
};
waterpool[h].waterpx[(waterpool[h].points - 1)] = (waterpool[h].x + waterpool[h].xwidth);
waterpool[h].waterpx[0] = waterpool[h].x;
waterpool[h].waterpy[0] = waterpool[h].y;
waterpool[h].waterpy[(waterpool[h].points - 1)] = waterpool[h].y;
vwaterpool[h].x = waterpool[h].x;
vwaterpool[h].y = waterpool[h].y;
_local3 = vwaterpool[h].graphics;
with (_local3) {
clear();
lineStyle(1, 0, 0);
beginFill(waterpool[h].watercolor, waterpool[h].alpha);
moveTo(0, 0);
f = 0;
while (f < (waterpool[h].points - 1)) {
lineTo((waterpool[h].waterpx[(f + 1)] - waterpool[h].x), (waterpool[h].waterpy[(f + 1)] - waterpool[h].y));
f = (f + 1);
};
lineTo((waterpool[h].waterpx[(waterpool[h].points - 1)] - waterpool[h].x), ((waterpool[h].waterpy[0] + waterpool[h].depth) - waterpool[h].y));
lineTo((waterpool[h].waterpx[0] - waterpool[h].x), ((waterpool[h].waterpy[0] + waterpool[h].depth) - waterpool[h].y));
endFill();
};
} else {
if (vwaterpool[h].parent != null){
vwaterpool[h].parent.removeChild(vwaterpool[h]);
};
vwaterpool[h].visible = false;
};
h = (h + 1);
};
h = 0;
while (h < boxes) {
if (box[h].active == true){
if (box[h].atrest == false){
temporaryx = ((p[box[h].firstpnum].x + p[(box[h].firstpnum + 2)].x) * 0.5);
temporaryy = ((p[box[h].firstpnum].y + p[(box[h].firstpnum + 2)].y) * 0.5);
checkliquids = false;
d = 0;
while (d < waterpools) {
if (waterpool[d].active == true){
if (rectcollide(waterpool[d].x, waterpool[d].y, (waterpool[d].x + waterpool[d].xwidth), (waterpool[d].y + waterpool[d].depth), (temporaryx - (box[h].sidelength + safetydistance)), (temporaryy - (box[h].sidelength + safetydistance)), (temporaryx + (box[h].sidelength + safetydistance)), (temporaryy + (box[h].sidelength + safetydistance))) == true){
checkliquids = true;
d = (waterpools + 1);
};
};
d = (d + 1);
};
z = box[h].firstpnum;
while (z < (box[h].firstpnum + 4)) {
pphysics(z, checkliquids);
z = (z + 1);
};
if (box[h].ignorecollisions == false){
temporaryx = ((p[box[h].firstpnum].x + p[(box[h].firstpnum + 2)].x) * 0.5);
temporaryy = ((p[box[h].firstpnum].y + p[(box[h].firstpnum + 2)].y) * 0.5);
possiblelines = 0;
j = 0;
while (j < collisionlines) {
if (collisionline[j].active == true){
if (rectcollide((temporaryx - (box[h].sidelength + safetydistance)), (temporaryy - (box[h].sidelength + safetydistance)), (temporaryx + (box[h].sidelength + safetydistance)), (temporaryy + (box[h].sidelength + safetydistance)), collisionline[j].x1, collisionline[j].y1, collisionline[j].x2, collisionline[j].y2) == true){
possiblelinenum[possiblelines] = j;
possiblelines = (possiblelines + 1);
};
};
j = (j + 1);
};
z = box[h].firstpnum;
while (z < (box[h].firstpnum + 4)) {
pcollisions(z);
z = (z + 1);
};
};
z = box[h].firstpnum;
while (z < (box[h].firstpnum + 4)) {
j = 0;
while (j < objectlines) {
if (objectline[j].active == true){
if (pointcollide(p[z].x, p[z].y, (objectline[j].x - (objectline[j].xwidth * 0.5)), objectline[j].y, (objectline[j].x + (objectline[j].xwidth * 0.5)), (objectline[j].y + objectline[j].yheight)) == true){
bouncetype = 2;
p[z].x = (p[z].x + (objectline[j].dx * characterpushratio));
p[z].y = (p[z].y + (objectline[j].dy * characterpushratio));
};
};
j = (j + 1);
};
z = (z + 1);
};
verlet(box[h].firstpnum, (box[h].firstpnum + 1), box[h].sidelength);
verlet((box[h].firstpnum + 1), (box[h].firstpnum + 2), box[h].sidelength);
verlet((box[h].firstpnum + 2), (box[h].firstpnum + 3), box[h].sidelength);
verlet((box[h].firstpnum + 3), box[h].firstpnum, box[h].sidelength);
verlet(box[h].firstpnum, (box[h].firstpnum + 2), (box[h].sidelength * 1.41));
verlet((box[h].firstpnum + 1), (box[h].firstpnum + 3), (box[h].sidelength * 1.41));
wateraffector[box[h].wateraffectornum].ly = wateraffector[box[h].wateraffectornum].y;
wateraffector[box[h].wateraffectornum].x = ((p[box[h].firstpnum].x + p[(box[h].firstpnum + 2)].x) * 0.5);
wateraffector[box[h].wateraffectornum].y = ((p[box[h].firstpnum].y + p[(box[h].firstpnum + 2)].y) * 0.5);
if (box[h].ignorecollisions == false){
tempdx = -(box[h].x);
tempdy = -(box[h].y);
box[h].x = ((p[box[h].firstpnum].x + p[(box[h].firstpnum + 2)].x) * 0.5);
box[h].y = ((p[box[h].firstpnum].y + p[(box[h].firstpnum + 2)].y) * 0.5);
tempdx = Math.abs((tempdx + box[h].x));
tempdy = Math.abs((tempdy + box[h].y));
if ((((tempdx <= maxrestdelta)) && ((tempdy <= maxrestdelta)))){
box[h].restcounter = (box[h].restcounter + 1);
} else {
box[h].restcounter = 0;
};
if (box[h].restcounter >= resttime){
wateraffector[box[h].wateraffectornum].active = false;
box[h].atrest = true;
s = box[h].firstpnum;
while (s < (box[h].firstpnum + 4)) {
p[s].active = false;
s = (s + 1);
};
};
};
} else {
box[h].x = ((p[box[h].firstpnum].x + p[(box[h].firstpnum + 2)].x) * 0.5);
box[h].y = ((p[box[h].firstpnum].y + p[(box[h].firstpnum + 2)].y) * 0.5);
};
if (showphysicsobjects == true){
_local3 = vbox[h].graphics;
with (_local3) {
vbox[h].x = box[h].x;
vbox[h].y = box[h].y;
clear();
lineStyle(1, physicsobjectcolor, 1);
moveTo((p[box[h].firstpnum].x - box[h].x), (p[box[h].firstpnum].y - box[h].y));
lineTo((p[(box[h].firstpnum + 1)].x - box[h].x), (p[(box[h].firstpnum + 1)].y - box[h].y));
lineTo((p[(box[h].firstpnum + 2)].x - box[h].x), (p[(box[h].firstpnum + 2)].y - box[h].y));
lineTo((p[(box[h].firstpnum + 3)].x - box[h].x), (p[(box[h].firstpnum + 3)].y - box[h].y));
lineTo((p[(box[h].firstpnum + 0)].x - box[h].x), (p[(box[h].firstpnum + 0)].y - box[h].y));
};
};
} else {
vbox[h].visible = false;
if (vbox[h].parent != null){
vbox[h].parent.removeChild(vbox[h]);
};
s = box[h].firstpnum;
while (s < (box[h].firstpnum + 4)) {
p[s].active = false;
s = (s + 1);
};
wateraffector[box[h].wateraffectornum].active = false;
};
h = (h + 1);
};
h = 0;
while (h < ragdolls) {
olddirection = 0;
newdirection = 0;
currentdirection = 0;
if (ragdoll[h].active == true){
if (ragdoll[h].atrest == false){
temporaryx = ((p[(ragdoll[h].firstpnum + 4)].x + p[(ragdoll[h].firstpnum + 5)].x) * 0.5);
temporaryy = ((p[(ragdoll[h].firstpnum + 4)].y + p[(ragdoll[h].firstpnum + 5)].y) * 0.5);
checkliquids = false;
d = 0;
while (d < waterpools) {
if (waterpool[d].active == true){
if (rectcollide(waterpool[d].x, waterpool[d].y, (waterpool[d].x + waterpool[d].xwidth), (waterpool[d].y + waterpool[d].depth), (temporaryx - (ragdollheight + safetydistance)), (temporaryy - (ragdollheight + safetydistance)), (temporaryx + (ragdollheight + safetydistance)), (temporaryy + (ragdollheight + safetydistance))) == true){
checkliquids = true;
d = (waterpools + 1);
};
};
d = (d + 1);
};
olddirection = directiontopoint(p[(ragdoll[h].firstpnum + 2)].x, p[(ragdoll[h].firstpnum + 2)].y, p[(ragdoll[h].firstpnum + 3)].x, p[(ragdoll[h].firstpnum + 3)].y);
z = ragdoll[h].firstpnum;
while (z < (ragdoll[h].firstpnum + 14)) {
if (p[z].active == true){
pphysics(z, checkliquids);
};
z = (z + 1);
};
if (ragdoll[h].ignorecollisions == false){
temporaryx = ((p[(ragdoll[h].firstpnum + 4)].x + p[(ragdoll[h].firstpnum + 5)].x) * 0.5);
temporaryy = ((p[(ragdoll[h].firstpnum + 4)].y + p[(ragdoll[h].firstpnum + 5)].y) * 0.5);
possiblelines = 0;
j = 0;
while (j < collisionlines) {
if (collisionline[j].active == true){
if (rectcollide((temporaryx - (ragdollheight + safetydistance)), (temporaryy - (ragdollheight + safetydistance)), (temporaryx + (ragdollheight + safetydistance)), (temporaryy + (ragdollheight + safetydistance)), collisionline[j].x1, collisionline[j].y1, collisionline[j].x2, collisionline[j].y2) == true){
possiblelinenum[possiblelines] = j;
possiblelines = (possiblelines + 1);
};
};
j = (j + 1);
};
z = ragdoll[h].firstpnum;
while (z < (ragdoll[h].firstpnum + 14)) {
if (p[z].active == true){
pcollisions(z);
};
z = (z + 1);
};
};
z = ragdoll[h].firstpnum;
while (z < (ragdoll[h].firstpnum + 14)) {
if (p[z].active == true){
j = 0;
while (j < objectlines) {
if (objectline[j].active == true){
if (pointcollide(p[z].x, p[z].y, (objectline[j].x - (objectline[j].xwidth * 0.5)), objectline[j].y, (objectline[j].x + (objectline[j].xwidth * 0.5)), (objectline[j].y + objectline[j].yheight)) == true){
bouncetype = 2;
p[z].x = (p[z].x + (objectline[j].dx * characterpushratio));
p[z].y = (p[z].y + (objectline[j].dy * characterpushratio));
};
};
j = (j + 1);
};
};
z = (z + 1);
};
verletiteration = 0;
verletiteration = 0;
while (verletiteration < 3) {
if (approxdistance(p[ragdoll[h].firstpnum].x, p[ragdoll[h].firstpnum].y, p[(ragdoll[h].firstpnum + 5)].x, p[(ragdoll[h].firstpnum + 5)].y) < neckconstraint){
verlet((ragdoll[h].firstpnum + 0), (ragdoll[h].firstpnum + 5), neckconstraint);
};
if (approxdistance(p[ragdoll[h].firstpnum].x, p[ragdoll[h].firstpnum].y, p[(ragdoll[h].firstpnum + 4)].x, p[(ragdoll[h].firstpnum + 4)].y) < neckconstraint){
verlet((ragdoll[h].firstpnum + 0), (ragdoll[h].firstpnum + 4), neckconstraint);
};
if (p[(ragdoll[h].firstpnum + 11)].active == true){
if (approxdistance2(p[(ragdoll[h].firstpnum + 11)].x, p[(ragdoll[h].firstpnum + 11)].y, p[(ragdoll[h].firstpnum + 1)].x, p[(ragdoll[h].firstpnum + 1)].y) < upperarmconstraint){
verlet((ragdoll[h].firstpnum + 11), (ragdoll[h].firstpnum + 1), upperarmconstraint);
};
};
if (p[(ragdoll[h].firstpnum + 13)].active == true){
if (approxdistance2(p[(ragdoll[h].firstpnum + 13)].x, p[(ragdoll[h].firstpnum + 13)].y, p[(ragdoll[h].firstpnum + 3)].x, p[(ragdoll[h].firstpnum + 3)].y) < lowerarmconstraint){
verlet((ragdoll[h].firstpnum + 13), (ragdoll[h].firstpnum + 3), lowerarmconstraint);
};
};
if (p[(ragdoll[h].firstpnum + 10)].active == true){
if (approxdistance2(p[(ragdoll[h].firstpnum + 10)].x, p[(ragdoll[h].firstpnum + 10)].y, p[(ragdoll[h].firstpnum + 1)].x, p[(ragdoll[h].firstpnum + 1)].y) < upperarmconstraint){
verlet((ragdoll[h].firstpnum + 10), (ragdoll[h].firstpnum + 1), upperarmconstraint);
};
};
if (p[(ragdoll[h].firstpnum + 12)].active == true){
if (approxdistance2(p[(ragdoll[h].firstpnum + 12)].x, p[(ragdoll[h].firstpnum + 12)].y, p[(ragdoll[h].firstpnum + 2)].x, p[(ragdoll[h].firstpnum + 2)].y) < lowerarmconstraint){
verlet((ragdoll[h].firstpnum + 12), (ragdoll[h].firstpnum + 2), lowerarmconstraint);
};
};
if (p[(ragdoll[h].firstpnum + 8)].active == true){
if (approxdistance2(p[(ragdoll[h].firstpnum + 8)].x, p[(ragdoll[h].firstpnum + 8)].y, p[(ragdoll[h].firstpnum + 4)].x, p[(ragdoll[h].firstpnum + 4)].y) < lowerlegconstraint){
verlet((ragdoll[h].firstpnum + 8), (ragdoll[h].firstpnum + 4), lowerlegconstraint);
};
};
if (p[(ragdoll[h].firstpnum + 9)].active == true){
if (approxdistance2(p[(ragdoll[h].firstpnum + 9)].x, p[(ragdoll[h].firstpnum + 9)].y, p[(ragdoll[h].firstpnum + 5)].x, p[(ragdoll[h].firstpnum + 5)].y) < lowerlegconstraint){
verlet((ragdoll[h].firstpnum + 9), (ragdoll[h].firstpnum + 5), lowerlegconstraint);
};
};
if (p[(ragdoll[h].firstpnum + 7)].active == true){
if (approxdistance2(p[(ragdoll[h].firstpnum + 7)].x, p[(ragdoll[h].firstpnum + 7)].y, p[(ragdoll[h].firstpnum + 1)].x, p[(ragdoll[h].firstpnum + 1)].y) < upperlegconstraint2){
verlet((ragdoll[h].firstpnum + 7), (ragdoll[h].firstpnum + 1), upperlegconstraint2);
};
if (approxdistance2(p[(ragdoll[h].firstpnum + 7)].x, p[(ragdoll[h].firstpnum + 7)].y, p[(ragdoll[h].firstpnum + 2)].x, p[(ragdoll[h].firstpnum + 2)].y) < upperlegconstraint1){
verlet((ragdoll[h].firstpnum + 7), (ragdoll[h].firstpnum + 2), upperlegconstraint1);
};
};
if (p[(ragdoll[h].firstpnum + 6)].active == true){
if (approxdistance2(p[(ragdoll[h].firstpnum + 6)].x, p[(ragdoll[h].firstpnum + 6)].y, p[(ragdoll[h].firstpnum + 1)].x, p[(ragdoll[h].firstpnum + 1)].y) < upperlegconstraint2){
verlet((ragdoll[h].firstpnum + 6), (ragdoll[h].firstpnum + 1), upperlegconstraint2);
};
if (approxdistance2(p[(ragdoll[h].firstpnum + 6)].x, p[(ragdoll[h].firstpnum + 6)].y, p[(ragdoll[h].firstpnum + 3)].x, p[(ragdoll[h].firstpnum + 3)].y) < upperlegconstraint1){
verlet((ragdoll[h].firstpnum + 6), (ragdoll[h].firstpnum + 3), upperlegconstraint1);
};
};
verlet(ragdoll[h].firstpnum, (ragdoll[h].firstpnum + 1), necklength);
verlet((ragdoll[h].firstpnum + 1), (ragdoll[h].firstpnum + 2), chestlength);
verlet((ragdoll[h].firstpnum + 2), (ragdoll[h].firstpnum + 4), chestlength);
verlet((ragdoll[h].firstpnum + 4), (ragdoll[h].firstpnum + 5), chestlength);
verlet((ragdoll[h].firstpnum + 3), (ragdoll[h].firstpnum + 5), chestlength);
verlet((ragdoll[h].firstpnum + 1), (ragdoll[h].firstpnum + 3), chestlength);
verlet((ragdoll[h].firstpnum + 3), (ragdoll[h].firstpnum + 2), chestconstraint);
verlet((ragdoll[h].firstpnum + 1), (ragdoll[h].firstpnum + 5), chestconstraint);
verlet((ragdoll[h].firstpnum + 1), (ragdoll[h].firstpnum + 4), chestconstraint);
verlet((ragdoll[h].firstpnum + 2), (ragdoll[h].firstpnum + 5), chestconstraint);
verlet((ragdoll[h].firstpnum + 3), (ragdoll[h].firstpnum + 4), chestconstraint);
if (p[(ragdoll[h].firstpnum + 11)].active == true){
verlet((ragdoll[h].firstpnum + 3), (ragdoll[h].firstpnum + 11), upperarmlength);
if (p[(ragdoll[h].firstpnum + 13)].active == true){
verlet((ragdoll[h].firstpnum + 11), (ragdoll[h].firstpnum + 13), lowerarmlength);
};
};
if (p[(ragdoll[h].firstpnum + 10)].active == true){
verlet((ragdoll[h].firstpnum + 2), (ragdoll[h].firstpnum + 10), upperarmlength);
if (p[(ragdoll[h].firstpnum + 12)].active == true){
verlet((ragdoll[h].firstpnum + 10), (ragdoll[h].firstpnum + 12), lowerarmlength);
};
};
if (p[(ragdoll[h].firstpnum + 7)].active == true){
verlet((ragdoll[h].firstpnum + 5), (ragdoll[h].firstpnum + 7), upperleglength);
if (p[(ragdoll[h].firstpnum + 9)].active == true){
verlet((ragdoll[h].firstpnum + 7), (ragdoll[h].firstpnum + 9), lowerleglength);
};
};
if (p[(ragdoll[h].firstpnum + 6)].active == true){
verlet((ragdoll[h].firstpnum + 4), (ragdoll[h].firstpnum + 6), upperleglength);
if (p[(ragdoll[h].firstpnum + 8)].active == true){
verlet((ragdoll[h].firstpnum + 6), (ragdoll[h].firstpnum + 8), lowerleglength);
};
};
verletiteration = (verletiteration + 1);
};
currentdirection = directiontopoint(p[(ragdoll[h].firstpnum + 2)].x, p[(ragdoll[h].firstpnum + 2)].y, p[(ragdoll[h].firstpnum + 3)].x, p[(ragdoll[h].firstpnum + 3)].y);
if (Math.abs(finddirection(currentdirection, olddirection)) >= 45){
ragdoll[h].deformed = true;
};
wateraffector[ragdoll[h].wateraffectornum].ly = wateraffector[ragdoll[h].wateraffectornum].y;
wateraffector[ragdoll[h].wateraffectornum].x = ((p[(ragdoll[h].firstpnum + 4)].x + p[(ragdoll[h].firstpnum + 5)].x) * 0.5);
wateraffector[ragdoll[h].wateraffectornum].y = ((p[(ragdoll[h].firstpnum + 4)].y + p[(ragdoll[h].firstpnum + 5)].y) * 0.5);
if (ragdoll[h].ignorecollisions == false){
tempdx = -(ragdoll[h].x);
tempdy = -(ragdoll[h].y);
ragdoll[h].x = ((p[(ragdoll[h].firstpnum + 4)].x + p[(ragdoll[h].firstpnum + 5)].x) * 0.5);
ragdoll[h].y = ((p[(ragdoll[h].firstpnum + 4)].y + p[(ragdoll[h].firstpnum + 5)].y) * 0.5);
tempdx = Math.abs((tempdx + ragdoll[h].x));
tempdy = Math.abs((tempdy + ragdoll[h].y));
if ((((tempdx <= maxrestdelta)) && ((tempdy <= maxrestdelta)))){
ragdoll[h].restcounter = (ragdoll[h].restcounter + 1);
} else {
ragdoll[h].restcounter = 0;
};
if (ragdoll[h].restcounter >= resttime){
wateraffector[ragdoll[h].wateraffectornum].active = false;
ragdoll[h].atrest = true;
s = ragdoll[h].firstpnum;
while (s < (ragdoll[h].firstpnum + 14)) {
p[s].active = false;
s = (s + 1);
};
};
};
} else {
ragdoll[h].x = ((p[(ragdoll[h].firstpnum + 4)].x + p[(ragdoll[h].firstpnum + 5)].x) * 0.5);
ragdoll[h].y = ((p[(ragdoll[h].firstpnum + 4)].y + p[(ragdoll[h].firstpnum + 5)].y) * 0.5);
};
if (showphysicsobjects == true){
_local3 = vragdoll[h].graphics;
with (_local3) {
vragdoll[h].x = ragdoll[h].x;
vragdoll[h].y = ragdoll[h].y;
clear();
lineStyle(1, physicsobjectcolor, 100);
moveTo((p[ragdoll[h].firstpnum] - ragdoll[h].x), (p[ragdoll[h].firstpnum].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 1)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 1)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 2)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 2)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 4)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 4)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 5)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 5)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 3)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 3)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 1)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 1)].y - ragdoll[h].y));
moveTo((p[(ragdoll[h].firstpnum + 3)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 3)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 11)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 11)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 13)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 13)].y - ragdoll[h].y));
moveTo((p[(ragdoll[h].firstpnum + 2)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 2)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 10)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 10)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 12)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 12)].y - ragdoll[h].y));
moveTo((p[(ragdoll[h].firstpnum + 5)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 5)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 7)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 7)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 9)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 9)].y - ragdoll[h].y));
moveTo((p[(ragdoll[h].firstpnum + 4)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 4)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 6)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 6)].y - ragdoll[h].y));
lineTo((p[(ragdoll[h].firstpnum + 8)].x - ragdoll[h].x), (p[(ragdoll[h].firstpnum + 8)].y - ragdoll[h].y));
};
};
} else {
vragdoll[h].visible = false;
if (vragdoll[h].parent != null){
vragdoll[h].parent.removeChild(vragdoll[h]);
};
s = ragdoll[h].firstpnum;
while (s < (ragdoll[h].firstpnum + 14)) {
p[s].active = false;
s = (s + 1);
};
wateraffector[ragdoll[h].wateraffectornum].active = false;
};
h = (h + 1);
};
h = 0;
while (h < lines) {
if (line[h].active == true){
if (line[h].atrest == false){
pphysics(line[h].firstpnum, true);
pphysics((line[h].firstpnum + 1), true);
possiblelines = 0;
if (line[h].ignorecollisions == false){
temporaryx = ((p[line[h].firstpnum].x + p[(line[h].firstpnum + 1)].x) * 0.5);
temporaryy = ((p[line[h].firstpnum].y + p[(line[h].firstpnum + 1)].y) * 0.5);
j = 0;
while (j < collisionlines) {
if (collisionline[j].active == true){
if (rectcollide((temporaryx - (line[h].linelength + safetydistance)), (temporaryy - (line[h].linelength + safetydistance)), (temporaryx + (line[h].linelength + safetydistance)), (temporaryy + (line[h].linelength + safetydistance)), collisionline[j].x1, collisionline[j].y1, collisionline[j].x2, collisionline[j].y2) == true){
possiblelinenum[possiblelines] = j;
possiblelines = (possiblelines + 1);
};
};
j = (j + 1);
};
pcollisions(line[h].firstpnum);
pcollisions((line[h].firstpnum + 1));
};
z = line[h].firstpnum;
while (z < (line[h].firstpnum + 2)) {
j = 0;
while (j < objectlines) {
if (objectline[j].active == true){
if (pointcollide(p[z].x, p[z].y, (objectline[j].x - (objectline[j].xwidth * 0.5)), objectline[j].y, (objectline[j].x + (objectline[j].xwidth * 0.5)), (objectline[j].y + objectline[j].yheight)) == true){
bouncetype = 2;
p[z].x = (p[z].x + (objectline[j].dx * characterpushratio));
p[z].y = (p[z].y + (objectline[j].dy * characterpushratio));
};
};
j = (j + 1);
};
z = (z + 1);
};
verlet(line[h].firstpnum, (line[h].firstpnum + 1), line[h].linelength);
if (line[h].ignorecollisions == false){
tempdx = -(line[h].x);
tempdy = -(line[h].y);
line[h].x = ((p[line[h].firstpnum].x + p[(line[h].firstpnum + 1)].x) * 0.5);
line[h].y = ((p[line[h].firstpnum].y + p[(line[h].firstpnum + 1)].y) * 0.5);
tempdx = Math.abs((tempdx + line[h].x));
tempdy = Math.abs((tempdy + line[h].y));
if ((((tempdx <= maxrestdelta)) && ((tempdy <= maxrestdelta)))){
line[h].restcounter = (line[h].restcounter + 1);
} else {
line[h].restcounter = 0;
};
if (line[h].restcounter >= resttime){
line[h].atrest = true;
p[line[h].firstpnum].active = false;
p[(line[h].firstpnum + 1)].active = false;
};
};
} else {
line[h].x = ((p[line[h].firstpnum].x + p[(line[h].firstpnum + 1)].x) * 0.5);
line[h].y = ((p[line[h].firstpnum].y + p[(line[h].firstpnum + 1)].y) * 0.5);
};
if (showphysicsobjects == true){
_local3 = vline[h].graphics;
with (_local3) {
vline[h].x = line[h].x;
vline[h].y = line[h].y;
clear();
lineStyle(1, physicsobjectcolor, 100);
moveTo((p[line[h].firstpnum].x - line[h].x), (p[line[h].firstpnum].y - line[h].y));
lineTo((p[(line[h].firstpnum + 1)].x - line[h].x), (p[(line[h].firstpnum + 1)].y - line[h].y));
};
};
} else {
vline[h].visible = false;
if (vline[h].parent != null){
vline[h].parent.removeChild(vline[h]);
};
p[line[h].firstpnum].active = false;
p[(line[h].firstpnum + 1)].active = false;
};
h = (h + 1);
};
h = 0;
while (h < objectlines) {
if (objectline[h].active == true){
pphysics(objectline[h].firstpnum, true);
pphysics((objectline[h].firstpnum + 1), true);
possiblelines = 0;
temporaryx = ((p[objectline[h].firstpnum].x + p[(objectline[h].firstpnum + 1)].x) * 0.5);
temporaryy = ((p[objectline[h].firstpnum].y + p[(objectline[h].firstpnum + 1)].y) * 0.5);
j = 0;
while (j < collisionlines) {
if (collisionline[j].active == true){
if (rectcollide((temporaryx - safetydistance), ((temporaryy - (objectline[h].yheight * 0.5)) - safetydistance), (temporaryx + safetydistance), ((temporaryy + (objectline[h].yheight * 0.5)) + safetydistance), collisionline[j].x1, collisionline[j].y1, collisionline[j].x2, collisionline[j].y2) == true){
possiblelinenum[possiblelines] = j;
possiblelines = (possiblelines + 1);
};
};
j = (j + 1);
};
pcollisions2(objectline[h].firstpnum);
pcollisions2((objectline[h].firstpnum + 1));
temporaryx = ((p[objectline[h].firstpnum].x + p[(objectline[h].firstpnum + 1)].x) * 0.5);
temporaryy = ((p[objectline[h].firstpnum].y + p[(objectline[h].firstpnum + 1)].y) * 0.5);
p[objectline[h].firstpnum].x = temporaryx;
p[(objectline[h].firstpnum + 1)].x = temporaryx;
p[objectline[h].firstpnum].y = (temporaryy - (objectline[h].yheight * 0.5));
p[(objectline[h].firstpnum + 1)].y = (temporaryy + (objectline[h].yheight * 0.5));
wateraffector[objectline[h].wateraffectornum].ly = wateraffector[objectline[h].wateraffectornum].y;
wateraffector[objectline[h].wateraffectornum].x = temporaryx;
wateraffector[objectline[h].wateraffectornum].y = temporaryy;
objectline[h].dx = (p[objectline[h].firstpnum].x - objectline[h].x);
objectline[h].dy = (p[objectline[h].firstpnum].y - objectline[h].y);
objectline[h].x = p[objectline[h].firstpnum].x;
objectline[h].y = p[objectline[h].firstpnum].y;
if (showphysicsobjects == true){
_local3 = vobjectline[h].graphics;
with (_local3) {
vobjectline[h].x = objectline[h].x;
vobjectline[h].y = objectline[h].y;
clear();
lineStyle(1, physicsobjectcolor, 100);
moveTo(0, 0);
lineTo((p[(objectline[h].firstpnum + 1)].x - objectline[h].x), (p[(objectline[h].firstpnum + 1)].y - objectline[h].y));
};
};
} else {
vobjectline[h].visible = false;
if (vobjectline[h].parent != null){
vobjectline[h].parent.removeChild(vobjectline[h]);
};
p[objectline[h].firstpnum].active = false;
p[(objectline[h].firstpnum + 1)].active = false;
wateraffector[objectline[h].wateraffectornum].active = false;
};
h = (h + 1);
};
h = 0;
while (h < ropes) {
if (rope[h].active == true){
if (rope[h].atrest == false){
temporaryx = 0;
temporaryy = 0;
d = rope[h].firstpnum;
while (d < (rope[h].firstpnum + rope[h].segments)) {
temporaryx = (temporaryx + p[d].x);
temporaryy = (temporaryy + p[d].y);
d = (d + 1);
};
temporaryx = (temporaryx / rope[h].segments);
temporaryy = (temporaryy / rope[h].segments);
checkliquids = false;
d = 0;
while (d < waterpools) {
if (waterpool[d].active == true){
if (rectcollide(waterpool[d].x, waterpool[d].y, (waterpool[d].x + waterpool[d].xwidth), (waterpool[d].y + waterpool[d].depth), (temporaryx - (rope[h].maxlength + safetydistance)), (temporaryy - (rope[h].maxlength + safetydistance)), (temporaryx + (rope[h].maxlength + safetydistance)), (temporaryy + (rope[h].maxlength + safetydistance))) == true){
checkliquids = true;
d = (waterpools + 1);
};
};
d = (d + 1);
};
z = rope[h].firstpnum;
while (z < (rope[h].firstpnum + rope[h].segments)) {
pphysics(z, checkliquids);
z = (z + 1);
};
if (rope[h].ignorecollisions == false){
possiblelines = 0;
j = 0;
while (j < collisionlines) {
if (collisionline[j].active == true){
if (rectcollide((temporaryx - (rope[h].maxlength + safetydistance)), (temporaryy - (rope[h].maxlength + safetydistance)), (temporaryx + (rope[h].maxlength + safetydistance)), (temporaryy + (rope[h].maxlength + safetydistance)), collisionline[j].x1, collisionline[j].y1, collisionline[j].x2, collisionline[j].y2) == true){
possiblelinenum[possiblelines] = j;
possiblelines = (possiblelines + 1);
};
};
j = (j + 1);
};
z = rope[h].firstpnum;
while (z < (rope[h].firstpnum + rope[h].segments)) {
pcollisions(z);
z = (z + 1);
};
};
z = rope[h].firstpnum;
while (z < (rope[h].firstpnum + rope[h].segments)) {
j = 0;
while (j < objectlines) {
if (objectline[j].active == true){
if (pointcollide(p[z].x, p[z].y, (objectline[j].x - (objectline[j].xwidth * 0.5)), objectline[j].y, (objectline[j].x + (objectline[j].xwidth * 0.5)), (objectline[j].y + objectline[j].yheight)) == true){
bouncetype = 2;
p[z].x = (p[z].x + (objectline[j].dx * characterpushratio));
p[z].y = (p[z].y + (objectline[j].dy * characterpushratio));
};
};
j = (j + 1);
};
z = (z + 1);
};
d = rope[h].firstpnum;
while (d < ((rope[h].firstpnum + rope[h].segments) - 1)) {
if (rope[h].elastic == false){
verlet(d, (d + 1), rope[h].segmentlength);
} else {
if (approxdistance(p[d].x, p[d].y, p[(d + 1)].x, p[(d + 1)].y) > rope[h].segmentlength){
verlet(d, (d + 1), rope[h].segmentlength);
};
};
d = (d + 1);
};
if (rope[h].attachedtoparticle1 == true){
if (p[rope[h].attachedparticle1].active == true){
verlet(rope[h].attachedparticle1, rope[h].firstpnum, 0.1);
} else {
rope[h].attachedtoparticle1 = false;
};
};
if (rope[h].locked1 == true){
p[rope[h].firstpnum].x = rope[h].lockx1;
p[rope[h].firstpnum].y = rope[h].locky1;
};
if (rope[h].attachedtoparticle2 == true){
if (p[rope[h].attachedparticle2].active == true){
verlet(rope[h].attachedparticle2, ((rope[h].firstpnum + rope[h].segments) - 1), 0.1);
} else {
rope[h].attachedtoparticle2 = false;
};
};
if (rope[h].locked2 == true){
p[((rope[h].firstpnum + rope[h].segments) - 1)].x = rope[h].lockx2;
p[((rope[h].firstpnum + rope[h].segments) - 1)].y = rope[h].locky2;
};
tempdx = -(rope[h].x);
tempdy = -(rope[h].y);
temporaryx = 0;
temporaryy = 0;
d = rope[h].firstpnum;
while (d < (rope[h].firstpnum + rope[h].segments)) {
temporaryx = (temporaryx + p[d].x);
temporaryy = (temporaryy + p[d].y);
d = (d + 1);
};
temporaryx = (temporaryx / rope[h].segments);
temporaryy = (temporaryy / rope[h].segments);
rope[h].x = temporaryx;
rope[h].y = temporaryy;
tempdx = Math.abs((tempdx + rope[h].x));
tempdy = Math.abs((tempdy + rope[h].y));
if (rope[h].ignorecollisions == false){
if ((((tempdx <= (maxrestdelta * 0.25))) && ((tempdy <= (maxrestdelta * 0.25))))){
rope[h].restcounter = (rope[h].restcounter + 1);
} else {
rope[h].restcounter = 0;
};
if (rope[h].restcounter >= resttime){
rope[h].atrest = true;
rope[h].attachedtoparticle1 = false;
rope[h].attachedtoparticle2 = false;
s = rope[h].firstpnum;
while (s < (rope[h].firstpnum + rope[h].segments)) {
p[s].active = false;
s = (s + 1);
};
};
};
} else {
temporaryx = 0;
temporaryy = 0;
d = rope[h].firstpnum;
while (d < (rope[h].firstpnum + rope[h].segments)) {
temporaryx = (temporaryx + p[d].x);
temporaryy = (temporaryy + p[d].y);
d = (d + 1);
};
temporaryx = (temporaryx / rope[h].segments);
temporaryy = (temporaryy / rope[h].segments);
rope[h].x = temporaryx;
rope[h].y = temporaryy;
};
if (showphysicsobjects == true){
_local3 = vrope[h].graphics;
with (_local3) {
vrope[h].x = rope[h].x;
vrope[h].y = rope[h].y;
clear();
lineStyle(1, physicsobjectcolor, 100);
moveTo((p[rope[h].firstpnum].x - rope[h].x), (p[rope[h].firstpnum].y - rope[h].y));
d = rope[h].firstpnum;
while (d < ((rope[h].firstpnum + rope[h].segments) - 1)) {
lineTo((p[(d + 1)].x - rope[h].x), (p[(d + 1)].y - rope[h].y));
d = (d + 1);
};
};
};
} else {
if (vrope[h].parent != null){
vrope[h].parent.removeChild(vrope[h]);
};
vrope[h].visible = false;
s = rope[h].firstpnum;
while (s < (rope[h].firstpnum + rope[h].segments)) {
p[s].active = false;
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < hinges) {
if (hinge[h].active == true){
if (hinge[h].atrest == false){
temporaryx = p[(hinge[h].firstpnum + 1)].x;
temporaryy = p[(hinge[h].firstpnum + 1)].y;
checkliquids = false;
d = 0;
while (d < waterpools) {
if (waterpool[d].active == true){
if (rectcollide(waterpool[d].x, waterpool[d].y, (waterpool[d].x + waterpool[d].xwidth), (waterpool[d].y + waterpool[d].depth), (temporaryx - (hinge[h].hingelength + safetydistance)), (temporaryy - (hinge[h].hingelength + safetydistance)), (temporaryx + (hinge[h].hingelength + safetydistance)), (temporaryy + (hinge[h].hingelength + safetydistance))) == true){
checkliquids = true;
d = (waterpools + 1);
};
};
d = (d + 1);
};
z = hinge[h].firstpnum;
while (z < (hinge[h].firstpnum + 3)) {
pphysics(z, checkliquids);
z = (z + 1);
};
if (hinge[h].ignorecollisions == false){
temporaryx = p[(hinge[h].firstpnum + 1)].x;
temporaryy = p[(hinge[h].firstpnum + 1)].y;
possiblelines = 0;
j = 0;
while (j < collisionlines) {
if (collisionline[j].active == true){
if (rectcollide((temporaryx - (hinge[h].hingelength + safetydistance)), (temporaryy - (hinge[h].hingelength + safetydistance)), (temporaryx + (hinge[h].hingelength + safetydistance)), (temporaryy + (hinge[h].hingelength + safetydistance)), collisionline[j].x1, collisionline[j].y1, collisionline[j].x2, collisionline[j].y2) == true){
possiblelinenum[possiblelines] = j;
possiblelines = (possiblelines + 1);
};
};
j = (j + 1);
};
z = hinge[h].firstpnum;
while (z < (hinge[h].firstpnum + 3)) {
pcollisions(z);
z = (z + 1);
};
};
z = hinge[h].firstpnum;
while (z < (hinge[h].firstpnum + 3)) {
j = 0;
while (j < objectlines) {
if (objectline[j].active == true){
if (pointcollide(p[z].x, p[z].y, (objectline[j].x - (objectline[j].xwidth * 0.5)), objectline[j].y, (objectline[j].x + (objectline[j].xwidth * 0.5)), (objectline[j].y + objectline[j].yheight)) == true){
bouncetype = 2;
p[z].x = (p[z].x + (objectline[j].dx * characterpushratio));
p[z].y = (p[z].y + (objectline[j].dy * characterpushratio));
};
};
j = (j + 1);
};
z = (z + 1);
};
verlet(hinge[h].firstpnum, (hinge[h].firstpnum + 1), hinge[h].length1);
verlet((hinge[h].firstpnum + 1), (hinge[h].firstpnum + 2), hinge[h].length2);
if (approxdistance(p[hinge[h].firstpnum].x, p[hinge[h].firstpnum].y, p[(hinge[h].firstpnum + 2)].x, p[(hinge[h].firstpnum + 2)].y) < hinge[h].hingedistance){
verlet(hinge[h].firstpnum, (hinge[h].firstpnum + 2), hinge[h].hingedistance);
};
if (hinge[h].ignorecollisions == false){
tempdx = -(hinge[h].x);
tempdy = -(hinge[h].y);
hinge[h].x = p[(hinge[h].firstpnum + 1)].x;
hinge[h].y = p[(hinge[h].firstpnum + 1)].y;
tempdx = Math.abs((tempdx + hinge[h].x));
tempdy = Math.abs((tempdy + hinge[h].y));
if ((((tempdx <= maxrestdelta)) && ((tempdy <= maxrestdelta)))){
hinge[h].restcounter = (hinge[h].restcounter + 1);
} else {
hinge[h].restcounter = 0;
};
if (hinge[h].restcounter >= resttime){
hinge[h].atrest = true;
s = hinge[h].firstpnum;
while (s < (hinge[h].firstpnum + 3)) {
p[s].active = false;
s = (s + 1);
};
};
};
} else {
hinge[h].x = p[(hinge[h].firstpnum + 1)].x;
hinge[h].y = p[(hinge[h].firstpnum + 1)].y;
};
if (showphysicsobjects == true){
_local3 = vhinge[h].graphics;
with (_local3) {
vhinge[h].x = hinge[h].x;
vhinge[h].y = hinge[h].y;
clear();
lineStyle(1, physicsobjectcolor, 1);
moveTo((p[hinge[h].firstpnum].x - hinge[h].x), (p[hinge[h].firstpnum].y - hinge[h].y));
lineTo((p[(hinge[h].firstpnum + 1)].x - hinge[h].x), (p[(hinge[h].firstpnum + 1)].y - hinge[h].y));
lineTo((p[(hinge[h].firstpnum + 2)].x - hinge[h].x), (p[(hinge[h].firstpnum + 2)].y - hinge[h].y));
};
};
} else {
vhinge[h].visible = false;
if (vhinge[h].parent != null){
vhinge[h].parent.removeChild(vhinge[h]);
};
s = hinge[h].firstpnum;
while (s < (hinge[h].firstpnum + 3)) {
p[s].active = false;
s = (s + 1);
};
};
h = (h + 1);
};
lightstep();
l = 0;
h = 0;
while (h < players) {
if (player[h].active == true){
deltahs = 0;
deltavs = 0;
if (player[h].berserk == true){
maxmovespeed = 5;
} else {
maxmovespeed = playermaxmovespeed;
};
movefactor = playeraircontrolfactor;
d = 0;
while (d < waterpools) {
if ((((((((p[(objectline[player[h].objectlinenum].firstpnum + 1)].x > waterpool[d].x)) && ((p[(objectline[player[h].objectlinenum].firstpnum + 1)].x < (waterpool[d].x + waterpool[d].xwidth))))) && ((p[(objectline[player[h].objectlinenum].firstpnum + 1)].y > waterpool[d].y)))) && ((p[(objectline[player[h].objectlinenum].firstpnum + 1)].y < (waterpool[d].y + waterpool[d].depth))))){
movefactor = playerwatercontrolfactor;
};
d = (d + 1);
};
groundoffset = 0;
if (segmentcollide(p[(objectline[player[h].objectlinenum].firstpnum + 1)].x, p[(objectline[player[h].objectlinenum].firstpnum + 1)].y, p[(objectline[player[h].objectlinenum].firstpnum + 1)].x, (p[(objectline[player[h].objectlinenum].firstpnum + 1)].y + 2)) == true){
movefactor = 1;
groundoffset = (p[(objectline[player[h].objectlinenum].firstpnum + 1)].y - bestcy);
};
if (player[h].damage < 0){
player[h].damage = 0;
};
if (player[h].rifleammo > maxrifleammo){
player[h].rifleammo = maxrifleammo;
};
if (player[h].pistolammo > maxpistolammo){
player[h].pistolammo = maxpistolammo;
};
if (player[h].shotgunammo > maxshotgunammo){
player[h].shotgunammo = maxshotgunammo;
};
if (player[h].smgammo > maxsmgammo){
player[h].smgammo = maxsmgammo;
};
if (player[h].rpgammo > maxrpgammo){
player[h].rpgammo = maxrpgammo;
};
if (player[h].nailgunammo > maxnailgunammo){
player[h].nailgunammo = maxnailgunammo;
};
if (player[h].weapon == riflenum){
ammotext = player[h].rifleammo;
bodyA[player[h].bodynum].frame = rifleframe;
};
if (player[h].weapon == pistolnum){
ammotext = player[h].pistolammo;
bodyA[player[h].bodynum].frame = pistolframe;
};
if (player[h].weapon == grenadenum){
ammotext = player[h].grenadeammo;
if (bodyA[player[h].bodynum].frame > grenadeframe){
player[h].framedelay = (player[h].framedelay - 1);
if (player[h].framedelay <= 0){
bodyA[player[h].bodynum].frame = grenadeframe;
};
} else {
bodyA[player[h].bodynum].frame = grenadeframe;
};
};
if (player[h].weapon == shotgunnum){
ammotext = player[h].shotgunammo;
bodyA[player[h].bodynum].frame = shotgunframe;
};
if (player[h].weapon == smgnum){
ammotext = player[h].smgammo;
bodyA[player[h].bodynum].frame = smgframe;
};
if (player[h].weapon == nailgunnum){
ammotext = player[h].nailgunammo;
bodyA[player[h].bodynum].frame = nailgunframe;
};
if (player[h].weapon == rpgnum){
ammotext = player[h].rpgammo;
bodyA[player[h].bodynum].frame = rpgframe;
};
if (player[h].weapon == chainsawnum){
ammotext = "";
bodyA[player[h].bodynum].frame = chainsawframe;
if (Math.floor((Math.random() * 45)) == 0){
chainsawpuff((player[h].bodyx + vectorx(player[h].gundirection, chainsawbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, chainsawbarreldistance)));
};
};
if (pkey3 == true){
if ((((player[h].hasrifle == true)) && ((player[h].rifleammo > 0)))){
player[h].weapon = riflenum;
};
};
if (pkey2 == true){
if ((((player[h].haspistol == true)) && ((player[h].pistolammo > 0)))){
player[h].weapon = pistolnum;
};
};
if (pkey6 == true){
if ((((player[h].hasgrenade == true)) && ((player[h].grenadeammo > 0)))){
player[h].weapon = grenadenum;
};
};
if (pkey4 == true){
if ((((player[h].hassmg == true)) && ((player[h].smgammo > 0)))){
player[h].weapon = smgnum;
};
};
if (pkey5 == true){
if ((((player[h].hasshotgun == true)) && ((player[h].shotgunammo > 0)))){
player[h].weapon = shotgunnum;
};
};
if (pkey1 == true){
if ((((player[h].haschainsaw == true)) && (!((player[h].weapon == chainsawnum))))){
chainsawstart.play();
player[h].weapon = chainsawnum;
};
};
if (pkey7 == true){
if ((((player[h].hasnailgun == true)) && ((player[h].nailgunammo > 0)))){
player[h].weapon = nailgunnum;
};
};
if (pkey8 == true){
if ((((player[h].hasrpg == true)) && ((player[h].rpgammo > 0)))){
player[h].weapon = rpgnum;
};
};
if (player[h].berserk == true){
if (player[h].weapon != chainsawnum){
schannel.stop();
player[h].weapon = chainsawnum;
};
};
if (clicking == true){
if (player[h].weapon == riflenum){
if ((((player[h].shootdelay == 0)) && ((player[h].rifleammo > 0)))){
if (segmentcollide(player[h].x, (player[h].y + rifleyoffset), (player[h].bodyx + vectorx(player[h].gundirection, riflebarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, riflebarreldistance))) == false){
if (createbullet((player[h].bodyx + vectorx(player[h].gundirection, riflebarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, riflebarreldistance)), ((player[h].lookdirection + (Math.random() * rifleinaccuracy)) - (rifleinaccuracy * 0.5)), rifleshootdistance, rifledamage, playerside, rifletracercolor, rifletraceralpha, false) == true){
rifleimpact(impactx, impacty);
};
player[h].rifleammo = (player[h].rifleammo - 1);
player[h].shootdelay = rifleshootdelay;
bodyA[player[h].bodynum].frame = (rifleframe + 1);
if (Math.floor((Math.random() * riflecasingskip)) == 0){
createbulletcasing((player[h].bodyx + vectorx(player[h].gundirection, riflerecieverdistance)), (player[h].bodyy + vectory(player[h].gundirection, riflerecieverdistance)), riflecasingsize, correctdirection(((player[h].bodynormal + (Math.random() * bulletcasingdirection)) - (bulletcasingdirection * 0.5))), ((Math.random() * bulletcasingspeed) + minbulletcasingspeed), ((Math.random() * bulletcasingrotatespeed) - (bulletcasingrotatespeed * 0.5)), riflecasingframe);
};
riflemuzzleflash((player[h].bodyx + vectorx(player[h].gundirection, (riflebarreldistance + rifleflashdistance))), (player[h].bodyy + vectory(player[h].gundirection, (riflebarreldistance + rifleflashdistance))), player[h].gundirection);
};
} else {
if ((((player[h].rifleammo <= 0)) && ((player[h].shootdelay == 0)))){
player[h].weapon = chainsawnum;
player[h].shootdelay = 30;
dryfire.play();
};
};
};
if (player[h].weapon == pistolnum){
if ((((player[h].shootdelay == 0)) && ((player[h].pistolammo > 0)))){
if (segmentcollide(player[h].x, (player[h].y + pistolyoffset), (player[h].bodyx + vectorx(player[h].gundirection, pistolbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, pistolbarreldistance))) == false){
if (createbullet((player[h].bodyx + vectorx(player[h].gundirection, pistolbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, pistolbarreldistance)), ((player[h].lookdirection + (Math.random() * pistolinaccuracy)) - (pistolinaccuracy * 0.5)), pistolshootdistance, pistoldamage, playerside, pistoltracercolor, pistoltraceralpha, false) == true){
pistolimpact(impactx, impacty);
};
player[h].pistolammo = (player[h].pistolammo - 1);
player[h].shootdelay = pistolshootdelay;
bodyA[player[h].bodynum].frame = (pistolframe + 1);
if (Math.floor((Math.random() * pistolcasingskip)) == 0){
createbulletcasing((player[h].bodyx + vectorx(player[h].gundirection, pistolrecieverdistance)), (player[h].bodyy + vectory(player[h].gundirection, pistolrecieverdistance)), pistolcasingsize, correctdirection(((player[h].bodynormal + (Math.random() * bulletcasingdirection)) - (bulletcasingdirection * 0.5))), ((Math.random() * bulletcasingspeed) + minbulletcasingspeed), ((Math.random() * bulletcasingrotatespeed) - (bulletcasingrotatespeed * 0.5)), pistolcasingframe);
};
pistolmuzzleflash((player[h].bodyx + vectorx(player[h].gundirection, (pistolbarreldistance + pistolflashdistance))), (player[h].bodyy + vectory(player[h].gundirection, (pistolbarreldistance + pistolflashdistance))), player[h].gundirection);
};
} else {
if ((((player[h].pistolammo <= 0)) && ((player[h].shootdelay == 0)))){
player[h].weapon = chainsawnum;
player[h].shootdelay = 30;
dryfire.play();
};
};
};
if (player[h].weapon == grenadenum){
if ((((player[h].shootdelay == 0)) && ((player[h].grenadeammo > 0)))){
if (segmentcollide(player[h].x, (player[h].y + grenadeyoffset), (player[h].bodyx + vectorx(player[h].gundirection, grenadebarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, grenadebarreldistance))) == false){
creategrenade((player[h].bodyx + vectorx(player[h].gundirection, grenadebarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, grenadebarreldistance)), ((player[h].lookdirection + (Math.random() * grenadeinaccuracy)) - (grenadeinaccuracy * 0.5)), grenadeshootdistance, ((Math.random() * grenaderotatespeed) - (grenaderotatespeed * 0.5)), -1);
player[h].grenadeammo = (player[h].grenadeammo - 1);
player[h].shootdelay = grenadeshootdelay;
player[h].framedelay = (grenadeshootdelay * 0.5);
bodyA[player[h].bodynum].frame = (grenadeframe + 1);
if (player[h].grenadeammo == 0){
player[h].weapon = chainsawnum;
player[h].shootdelay = 30;
};
};
};
};
if (player[h].weapon == shotgunnum){
if ((((player[h].shootdelay == 0)) && ((player[h].shotgunammo > 0)))){
if (segmentcollide(player[h].x, (player[h].y + shotgunyoffset), (player[h].bodyx + vectorx(player[h].gundirection, shotgunbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, shotgunbarreldistance))) == false){
l = 0;
while (l < 3) {
if (createbullet((player[h].bodyx + vectorx(player[h].gundirection, shotgunbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, shotgunbarreldistance)), ((player[h].lookdirection + (Math.random() * shotguninaccuracy)) - (shotguninaccuracy * 0.5)), shotgunshootdistance, shotgundamage, playerside, shotguntracercolor, shotguntraceralpha, true) == true){
shotgunimpact(impactx, impacty);
};
l = (l + 1);
};
player[h].shotgunammo = (player[h].shotgunammo - 1);
player[h].shootdelay = shotgunshootdelay;
bodyA[player[h].bodynum].frame = (shotgunframe + 1);
if (Math.floor((Math.random() * shotguncasingskip)) == 0){
createbulletcasing((player[h].bodyx + vectorx(player[h].gundirection, shotgunrecieverdistance)), (player[h].bodyy + vectory(player[h].gundirection, shotgunrecieverdistance)), shotguncasingsize, correctdirection(((player[h].bodynormal + (Math.random() * bulletcasingdirection)) - (bulletcasingdirection * 0.5))), ((Math.random() * bulletcasingspeed) + minbulletcasingspeed), ((Math.random() * bulletcasingrotatespeed) - (bulletcasingrotatespeed * 0.5)), shotguncasingframe);
};
shotgunmuzzleflash((player[h].bodyx + vectorx(player[h].gundirection, (shotgunbarreldistance + shotgunflashdistance))), (player[h].bodyy + vectory(player[h].gundirection, (shotgunbarreldistance + shotgunflashdistance))), player[h].gundirection);
};
} else {
if ((((player[h].shotgunammo <= 0)) && ((player[h].shootdelay == 0)))){
player[h].weapon = chainsawnum;
player[h].shootdelay = 30;
dryfire.play();
};
};
};
if (player[h].weapon == smgnum){
if ((((player[h].shootdelay == 0)) && ((player[h].smgammo > 0)))){
if (segmentcollide(player[h].x, (player[h].y + smgyoffset), (player[h].bodyx + vectorx(player[h].gundirection, smgbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, smgbarreldistance))) == false){
if (createbullet((player[h].bodyx + vectorx(player[h].gundirection, smgbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, smgbarreldistance)), ((player[h].lookdirection + (Math.random() * smginaccuracy)) - (smginaccuracy * 0.5)), smgshootdistance, smgdamage, playerside, smgtracercolor, smgtraceralpha, false) == true){
smgimpact(impactx, impacty);
};
player[h].smgammo = (player[h].smgammo - 1);
player[h].shootdelay = smgshootdelay;
bodyA[player[h].bodynum].frame = (smgframe + 1);
if (Math.floor((Math.random() * smgcasingskip)) == 0){
createbulletcasing((player[h].bodyx + vectorx(player[h].gundirection, smgrecieverdistance)), (player[h].bodyy + vectory(player[h].gundirection, smgrecieverdistance)), smgcasingsize, correctdirection(((player[h].bodynormal + (Math.random() * bulletcasingdirection)) - (bulletcasingdirection * 0.5))), ((Math.random() * bulletcasingspeed) + minbulletcasingspeed), ((Math.random() * bulletcasingrotatespeed) - (bulletcasingrotatespeed * 0.5)), smgcasingframe);
};
smgmuzzleflash((player[h].bodyx + vectorx(player[h].gundirection, (smgbarreldistance + smgflashdistance))), (player[h].bodyy + vectory(player[h].gundirection, (smgbarreldistance + smgflashdistance))), player[h].gundirection);
};
} else {
if ((((player[h].smgammo <= 0)) && ((player[h].shootdelay == 0)))){
player[h].weapon = chainsawnum;
player[h].shootdelay = 30;
dryfire.play();
};
};
};
if (player[h].weapon == rpgnum){
if ((((player[h].shootdelay == 0)) && ((player[h].rpgammo > 0)))){
if (segmentcollide(player[h].x, (player[h].y + rpgyoffset), (player[h].bodyx + vectorx(player[h].gundirection, rpgbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, rpgbarreldistance))) == false){
player[h].weapon = chainsawnum;
player[h].hasrpg = false;
player[h].shootdelay = 30;
dryfire.play();
rocketshoot.play();
createrocket((player[h].bodyx + vectorx(player[h].gundirection, rpgbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, rpgbarreldistance)), ((player[h].lookdirection + (Math.random() * rpginaccuracy)) - (rpginaccuracy * 0.5)), playerside);
player[h].rpgammo = (player[h].rpgammo - 1);
createrpg((player[h].bodyx + vectorx(player[h].gundirection, rpgholddistance)), (player[h].bodyy + vectory(player[h].gundirection, rpgholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum, true);
rpgmuzzleflash((player[h].bodyx + vectorx(player[h].gundirection, (rpgbarreldistance + rpgflashdistance))), (player[h].bodyy + vectory(player[h].gundirection, (rpgbarreldistance + rpgflashdistance))), player[h].gundirection);
rpgmuzzleflash((player[h].bodyx - vectorx(player[h].gundirection, (rpgholddistance + rpgflashdistance))), (player[h].bodyy - vectory(player[h].gundirection, (rpgholddistance + rpgflashdistance))), (player[h].gundirection + 180));
};
} else {
if ((((player[h].rpgammo <= 0)) && ((player[h].shootdelay == 0)))){
player[h].weapon = chainsawnum;
player[h].shootdelay = 30;
dryfire.play();
};
};
};
if (player[h].weapon == nailgunnum){
if ((((player[h].shootdelay == 0)) && ((player[h].nailgunammo > 0)))){
if (segmentcollide(player[h].x, (player[h].y + nailgunyoffset), (player[h].bodyx + vectorx(player[h].gundirection, nailgunbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, nailgunbarreldistance))) == false){
createnail((player[h].bodyx + vectorx(player[h].gundirection, nailgunbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, nailgunbarreldistance)), ((player[h].lookdirection + (Math.random() * nailguninaccuracy)) - (nailguninaccuracy * 0.5)), playerside);
player[h].nailgunammo = (player[h].nailgunammo - 1);
player[h].shootdelay = nailgunshootdelay;
bodyA[player[h].bodynum].frame = (nailgunframe + 1);
if (Math.floor((Math.random() * nailguncasingskip)) == 0){
createbulletcasing((player[h].bodyx + vectorx(player[h].gundirection, nailgunrecieverdistance)), (player[h].bodyy + vectory(player[h].gundirection, nailgunrecieverdistance)), nailguncasingsize, correctdirection(((player[h].bodynormal + (Math.random() * bulletcasingdirection)) - (bulletcasingdirection * 0.5))), ((Math.random() * bulletcasingspeed) + minbulletcasingspeed), ((Math.random() * bulletcasingrotatespeed) - (bulletcasingrotatespeed * 0.5)), nailguncasingframe);
};
nailgunmuzzleflash((player[h].bodyx + vectorx(player[h].gundirection, (nailgunbarreldistance + nailgunflashdistance))), (player[h].bodyy + vectory(player[h].gundirection, (nailgunbarreldistance + nailgunflashdistance))), player[h].gundirection);
};
} else {
if ((((player[h].nailgunammo <= 0)) && ((player[h].shootdelay == 0)))){
player[h].weapon = chainsawnum;
player[h].shootdelay = 30;
dryfire.play();
};
};
};
if (player[h].weapon == chainsawnum){
if (player[h].shootdelay == 0){
if (player[h].berserk == true){
if (createbullet((player[h].bodyx + vectorx(player[h].gundirection, chainsawbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, chainsawbarreldistance)), player[h].lookdirection, chainsawshootdistance, (chainsawdamage * berserkmultiplier), playerside, 0xFFFFFF, 0, false) == true){
chainsawimpact(impactx, impacty);
};
} else {
if (createbullet((player[h].bodyx + vectorx(player[h].gundirection, chainsawbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, chainsawbarreldistance)), player[h].lookdirection, chainsawshootdistance, chainsawdamage, playerside, 0xFFFFFF, 0, true) == true){
chainsawimpact(impactx, impacty);
};
};
chainsawsmoke((player[h].bodyx + vectorx(player[h].gundirection, chainsawbarreldistance)), (player[h].bodyy + vectory(player[h].gundirection, chainsawbarreldistance)));
if (clicktime == 1){
clicktime = 2;
schannel = chainsawrev.play(0, 50);
};
player[h].shootdelay = chainsawshootdelay;
bodyA[player[h].bodynum].frame = (chainsawframe + 1);
player[h].framedelay = 5;
};
};
} else {
if (player[h].shootdelay == -1){
player[h].shootdelay = 0;
};
};
if (clicking == false){
schannel.stop();
};
if (player[h].weapon != chainsawnum){
schannel.stop();
};
if (player[h].shootdelay > 0){
player[h].shootdelay = (player[h].shootdelay - 1);
};
if (pkeya == true){
deltahs = (deltahs - (playermoveacceleration * movefactor));
};
if (pkeyd == true){
deltahs = (deltahs + (playermoveacceleration * movefactor));
};
deltahs2 = 0;
if (player[h].slow > 0){
if (deltahs > 0){
deltahs2 = (-(player[h].slow) * 0.5);
};
if (deltahs < 0){
deltahs2 = (player[h].slow * 0.5);
};
player[h].slow = 0;
};
if (pkeyw == true){
if (((!((movefactor == playeraircontrolfactor))) && ((player[h].jumpdelay == -1)))){
player[h].jumpdelay = playerjumpdelay;
if (player[h].berserk == false){
deltavs = (playerjumpspeed * movefactor);
} else {
deltavs = (-5 * movefactor);
};
if (movefactor == 1){
jumpdust(((player[h].x + (Math.random() * 10)) - 5), (((player[h].y + (ragdollheight * 2)) + (Math.random() * 10)) - 5));
};
};
} else {
if (player[h].jumpdelay == 0){
player[h].jumpdelay = -1;
};
};
if (player[h].jumpdelay > 0){
player[h].jumpdelay = (player[h].jumpdelay - 1);
};
temporaryhs = (p[(objectline[player[h].objectlinenum].firstpnum + 1)].x - p[(objectline[player[h].objectlinenum].firstpnum + 1)].lx);
if (Math.abs(((temporaryhs + deltahs) + deltahs2)) < maxmovespeed){
p[(objectline[player[h].objectlinenum].firstpnum + 1)].x = ((p[(objectline[player[h].objectlinenum].firstpnum + 1)].x + deltahs) + deltahs2);
p[objectline[player[h].objectlinenum].firstpnum].x = ((p[objectline[player[h].objectlinenum].firstpnum].x + deltahs) + deltahs2);
} else {
if (Math.abs(temporaryhs) < maxmovespeed){
if (temporaryhs > 0){
p[(objectline[player[h].objectlinenum].firstpnum + 1)].x = (p[(objectline[player[h].objectlinenum].firstpnum + 1)].lx + maxmovespeed);
p[objectline[player[h].objectlinenum].firstpnum].x = (p[objectline[player[h].objectlinenum].firstpnum].lx + maxmovespeed);
} else {
p[(objectline[player[h].objectlinenum].firstpnum + 1)].x = (p[(objectline[player[h].objectlinenum].firstpnum + 1)].lx - maxmovespeed);
p[objectline[player[h].objectlinenum].firstpnum].x = (p[objectline[player[h].objectlinenum].firstpnum].lx - maxmovespeed);
};
};
};
if (objectline[player[h].objectlinenum].x < 1){
p[objectline[player[h].objectlinenum].firstpnum].x = 1;
p[(objectline[player[h].objectlinenum].firstpnum + 1)].x = 1;
};
if (objectline[player[h].objectlinenum].x > 599){
p[objectline[player[h].objectlinenum].firstpnum].x = 599;
p[(objectline[player[h].objectlinenum].firstpnum + 1)].x = 599;
};
p[(objectline[player[h].objectlinenum].firstpnum + 1)].y = (p[(objectline[player[h].objectlinenum].firstpnum + 1)].y + deltavs);
p[objectline[player[h].objectlinenum].firstpnum].y = (p[objectline[player[h].objectlinenum].firstpnum].y + deltavs);
temporaryhs = Math.abs((p[(objectline[player[h].objectlinenum].firstpnum + 1)].x - p[(objectline[player[h].objectlinenum].firstpnum + 1)].lx));
if (deltahs > 0){
player[h].walkdirection = 0;
};
if (deltahs < 0){
player[h].walkdirection = 1;
};
legA[player[h].firstlegnum].framerate = 1;
if (deltahs == 0){
if (player[h].walkdirection == 0){
if (legA[player[h].firstlegnum].frame == 4){
legA[player[h].firstlegnum].framerate = 0;
};
} else {
if (legA[player[h].firstlegnum].frame == 14){
legA[player[h].firstlegnum].framerate = 0;
};
};
};
if (movefactor == playeraircontrolfactor){
legA[player[h].firstlegnum].framerate = 0;
};
if (player[h].walkdirection == 0){
legA[player[h].firstlegnum].scaleX = 1;
legA[(player[h].firstlegnum + 1)].scaleX = 1;
} else {
legA[player[h].firstlegnum].scaleX = -1;
legA[(player[h].firstlegnum + 1)].scaleX = -1;
};
legA[(player[h].firstlegnum + 1)].frame = (legA[player[h].firstlegnum].frame + 11);
player[h].y = (p[objectline[player[h].objectlinenum].firstpnum].y - groundoffset);
player[h].x = p[objectline[player[h].objectlinenum].firstpnum].x;
gundirection = 0;
if (player[h].weapon == riflenum){
gundirection = directiontopoint(player[h].x, (player[h].y + rifleyoffset), mouseX, mouseY);
};
if (player[h].weapon == pistolnum){
gundirection = directiontopoint(player[h].x, (player[h].y + pistolyoffset), mouseX, mouseY);
};
if (player[h].weapon == grenadenum){
gundirection = directiontopoint(player[h].x, (player[h].y + grenadeyoffset), mouseX, mouseY);
};
if (player[h].weapon == shotgunnum){
gundirection = directiontopoint(player[h].x, (player[h].y + shotgunyoffset), mouseX, mouseY);
};
if (player[h].weapon == smgnum){
gundirection = directiontopoint(player[h].x, (player[h].y + smgyoffset), mouseX, mouseY);
};
if (player[h].weapon == nailgunnum){
gundirection = directiontopoint(player[h].x, (player[h].y + nailgunyoffset), mouseX, mouseY);
};
if (player[h].weapon == rpgnum){
gundirection = directiontopoint(player[h].x, (player[h].y + rpgyoffset), mouseX, mouseY);
};
if (player[h].weapon == chainsawnum){
gundirection = directiontopoint(player[h].x, (player[h].y + chainsawyoffset), mouseX, mouseY);
};
player[h].lookdirection = gundirection;
if (mouseX > player[h].x){
player[h].facedirection = 0;
} else {
player[h].facedirection = 1;
};
if (player[h].facedirection == 0){
directiondelta = finddirection(0, gundirection);
bodyA[player[h].bodynum].scaleX = 1;
} else {
directiondelta = finddirection(180, gundirection);
bodyA[player[h].bodynum].scaleX = -1;
};
if (directiondelta > 0){
if (directiondelta > maxlookdelta){
directiondelta = maxlookdelta;
};
} else {
if (directiondelta < -(maxlookdelta)){
directiondelta = -(maxlookdelta);
};
};
player[h].gundirection = correctdirection(((180 * player[h].facedirection) - directiondelta));
if (player[h].facedirection == 0){
bodynormal = correctdirection((player[h].gundirection + 90));
} else {
bodynormal = correctdirection((player[h].gundirection - 90));
};
bodyA[player[h].bodynum].rotation = directiondelta;
legsoffset = ((ragdollheight * 2) - (upperleglength + lowerleglength));
legA[player[h].firstlegnum].x = (player[h].x - (chestlength * 0.5));
legA[player[h].firstlegnum].y = (player[h].y + legsoffset);
legA[(player[h].firstlegnum + 1)].x = (player[h].x + (chestlength * 0.5));
legA[(player[h].firstlegnum + 1)].y = (player[h].y + legsoffset);
bodyA[player[h].bodynum].y = (player[h].y + legsoffset);
bodyA[player[h].bodynum].x = player[h].x;
if (player[h].weapon == riflenum){
player[h].bodyy = ((player[h].y + legsoffset) + vectory(bodynormal, (legsoffset - rifleyoffset)));
player[h].bodyx = (player[h].x + vectorx(bodynormal, (legsoffset - rifleyoffset)));
};
if (player[h].weapon == pistolnum){
player[h].bodyy = ((player[h].y + legsoffset) + vectory(bodynormal, (legsoffset - pistolyoffset)));
player[h].bodyx = (player[h].x + vectorx(bodynormal, (legsoffset - pistolyoffset)));
};
if (player[h].weapon == grenadenum){
player[h].bodyy = ((player[h].y + legsoffset) + vectory(bodynormal, (legsoffset - grenadeyoffset)));
player[h].bodyx = (player[h].x + vectorx(bodynormal, (legsoffset - grenadeyoffset)));
};
if (player[h].weapon == shotgunnum){
player[h].bodyy = ((player[h].y + legsoffset) + vectory(bodynormal, (legsoffset - shotgunyoffset)));
player[h].bodyx = (player[h].x + vectorx(bodynormal, (legsoffset - shotgunyoffset)));
};
if (player[h].weapon == smgnum){
player[h].bodyy = ((player[h].y + legsoffset) + vectory(bodynormal, (legsoffset - smgyoffset)));
player[h].bodyx = (player[h].x + vectorx(bodynormal, (legsoffset - smgyoffset)));
};
if (player[h].weapon == nailgunnum){
player[h].bodyy = ((player[h].y + legsoffset) + vectory(bodynormal, (legsoffset - nailgunyoffset)));
player[h].bodyx = (player[h].x + vectorx(bodynormal, (legsoffset - nailgunyoffset)));
};
if (player[h].weapon == rpgnum){
player[h].bodyy = ((player[h].y + legsoffset) + vectory(bodynormal, (legsoffset - rpgyoffset)));
player[h].bodyx = (player[h].x + vectorx(bodynormal, (legsoffset - rpgyoffset)));
};
if (player[h].weapon == chainsawnum){
player[h].bodyy = ((player[h].y + legsoffset) + vectory(bodynormal, (legsoffset - chainsawyoffset)));
player[h].bodyx = (player[h].x + vectorx(bodynormal, (legsoffset - chainsawyoffset)));
};
player[h].bodynormal = bodynormal;
} else {
schannel.stop();
objectline[player[h].objectlinenum].active = false;
legA[player[h].firstlegnum].active = false;
legA[(player[h].firstlegnum + 1)].active = false;
bodyA[player[h].bodynum].active = false;
};
h = (h + 1);
};
h = 0;
while (h < torsos) {
if (torso[h].active == true){
torso[h].gotoAndPlay((torso[h].frame + 1));
} else {
if (torso[h].parent != null){
torso[h].parent.removeChild(torso[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < heads) {
if (head[h].active == true){
head[h].gotoAndPlay((head[h].frame + 1));
} else {
if (head[h].parent != null){
head[h].parent.removeChild(head[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < upperarms) {
if (upperarm[h].active == true){
upperarm[h].gotoAndPlay((upperarm[h].frame + 1));
} else {
if (upperarm[h].parent != null){
upperarm[h].parent.removeChild(upperarm[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < upperlegs) {
if (upperleg[h].active == true){
upperleg[h].gotoAndPlay((upperleg[h].frame + 1));
} else {
if (upperleg[h].parent != null){
upperleg[h].parent.removeChild(upperleg[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < lowerlegs) {
if (lowerleg[h].active == true){
lowerleg[h].gotoAndPlay((lowerleg[h].frame + 1));
} else {
if (lowerleg[h].parent != null){
lowerleg[h].parent.removeChild(lowerleg[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < lowerarms) {
if (lowerarm[h].active == true){
lowerarm[h].gotoAndPlay((lowerarm[h].frame + 1));
} else {
if (lowerarm[h].parent != null){
lowerarm[h].parent.removeChild(lowerarm[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < bodyAs) {
if (bodyA[h].active == true){
bodyA[h].gotoAndPlay((bodyA[h].frame + 1));
} else {
if (bodyA[h].parent != null){
bodyA[h].parent.removeChild(bodyA[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < legAs) {
if (legA[h].active == true){
if (legA[h].framerate > 0){
legA[h].frame = (legA[h].frame + 1);
};
if (legA[h].frame > 21){
legA[h].frame = (legA[h].frame - 21);
};
legA[h].gotoAndPlay((legA[h].frame + 1));
} else {
if (legA[h].parent != null){
legA[h].parent.removeChild(legA[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < bodyBs) {
if (bodyB[h].active == true){
bodyB[h].gotoAndPlay((bodyB[h].frame + 1));
} else {
if (bodyB[h].parent != null){
bodyB[h].parent.removeChild(bodyB[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < legBs) {
if (legB[h].active == true){
if (legB[h].framerate > 0){
legB[h].frame = (legB[h].frame + 1);
};
if (legB[h].frame > 21){
legB[h].frame = (legB[h].frame - 21);
};
legB[h].gotoAndPlay((legB[h].frame + 1));
} else {
if (legB[h].parent != null){
legB[h].parent.removeChild(legB[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < bodyCs) {
if (bodyC[h].active == true){
bodyC[h].gotoAndPlay((bodyC[h].frame + 1));
} else {
if (bodyC[h].parent != null){
bodyC[h].parent.removeChild(bodyC[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < legCs) {
if (legC[h].active == true){
if (legC[h].framerate > 0){
legC[h].frame = (legC[h].frame + 1);
};
if (legC[h].frame > 21){
legC[h].frame = (legC[h].frame - 21);
};
legC[h].gotoAndPlay((legC[h].frame + 1));
} else {
if (legC[h].parent != null){
legC[h].parent.removeChild(legC[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < bodyDs) {
if (bodyD[h].active == true){
bodyD[h].gotoAndPlay((bodyD[h].frame + 1));
} else {
if (bodyD[h].parent != null){
bodyD[h].parent.removeChild(bodyD[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < legDs) {
if (legD[h].active == true){
if (legD[h].framerate > 0){
legD[h].frame = (legD[h].frame + 1);
};
if (legD[h].frame > 21){
legD[h].frame = (legD[h].frame - 21);
};
legD[h].gotoAndPlay((legD[h].frame + 1));
} else {
if (legD[h].parent != null){
legD[h].parent.removeChild(legD[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < rifles) {
if (rifle[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((((((rifle[h].x > (player[o].x - chestlength))) && ((rifle[h].x < (player[o].x + chestlength))))) && ((rifle[h].y > (player[o].y - 1))))) && ((rifle[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
if ((((player[o].hasrifle == false)) || ((player[o].rifleammo < maxrifleammo)))){
weaponpickup.play();
player[o].rifleammo = (player[o].rifleammo + riflepickupammo);
line[rifle[h].linenum].active = false;
rifle[h].visible = false;
rifle[h].active = false;
pickuptext = "You picked up a rifle (3)!";
pickuptextdelay = messageduration;
if (player[o].hasrifle == false){
player[o].hasrifle = true;
player[o].weapon = riflenum;
};
};
};
};
o = (o + 1);
};
rifle[h].livetime = (rifle[h].livetime + 1);
if (rifle[h].fade == true){
if (rifle[h].livetime > (weaponlivetime - weaponfadetime)){
rifle[h].alpha = ((weaponlivetime - rifle[h].livetime) / weaponfadetime);
};
if (rifle[h].livetime > weaponlivetime){
rifle[h].active = false;
line[rifle[h].linenum].active = false;
if (rifle[h].parent != null){
rifle[h].parent.removeChild(rifle[h]);
};
};
};
tempx1 = p[line[rifle[h].linenum].firstpnum].x;
tempy1 = p[line[rifle[h].linenum].firstpnum].y;
tempx2 = p[(line[rifle[h].linenum].firstpnum + 1)].x;
tempy2 = p[(line[rifle[h].linenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
rifle[h].x = ((tempx1 + tempx2) * 0.5);
rifle[h].y = ((tempy1 + tempy2) * 0.5);
if (rifle[h].facedirection == 0){
rifle[h].rotation = -(temprotation);
} else {
rifle[h].rotation = (180 - temprotation);
};
};
h = (h + 1);
};
h = 0;
while (h < chainsaws) {
if (chainsaw[h].active == true){
chainsaw[h].livetime = (chainsaw[h].livetime + 1);
if (chainsaw[h].fade == true){
if (chainsaw[h].livetime > (weaponlivetime - weaponfadetime)){
chainsaw[h].alpha = (((weaponlivetime - chainsaw[h].livetime) / weaponfadetime) * 100);
};
if (chainsaw[h].livetime > weaponlivetime){
chainsaw[h].active = false;
line[chainsaw[h].linenum].active = false;
if (chainsaw[h].parent != null){
chainsaw[h].parent.removeChild(chainsaw[h]);
};
};
};
tempx1 = p[line[chainsaw[h].linenum].firstpnum].x;
tempy1 = p[line[chainsaw[h].linenum].firstpnum].y;
tempx2 = p[(line[chainsaw[h].linenum].firstpnum + 1)].x;
tempy2 = p[(line[chainsaw[h].linenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
chainsaw[h].x = ((tempx1 + tempx2) * 0.5);
chainsaw[h].y = ((tempy1 + tempy2) * 0.5);
if (chainsaw[h].facedirection == 0){
chainsaw[h].rotation = -(temprotation);
} else {
chainsaw[h].rotation = (180 - temprotation);
};
};
h = (h + 1);
};
h = 0;
while (h < shotguns) {
if (shotgun[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((player[o].hasshotgun == false)) || ((player[o].shotgunammo < maxshotgunammo)))){
if ((((((((shotgun[h].x > (player[o].x - chestlength))) && ((shotgun[h].x < (player[o].x + chestlength))))) && ((shotgun[h].y > (player[o].y - 1))))) && ((shotgun[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
weaponpickup.play();
player[o].shotgunammo = (player[o].shotgunammo + shotgunpickupammo);
line[shotgun[h].linenum].active = false;
shotgun[h].visible = false;
shotgun[h].active = false;
pickuptext = "You picked up a shotgun (5)!";
pickuptextdelay = messageduration;
if (player[o].hasshotgun == false){
player[o].hasshotgun = true;
player[o].weapon = shotgunnum;
};
};
};
};
o = (o + 1);
};
shotgun[h].livetime = (shotgun[h].livetime + 1);
if (shotgun[h].fade == true){
if (shotgun[h].livetime > (weaponlivetime - weaponfadetime)){
shotgun[h].alpha = (((weaponlivetime - shotgun[h].livetime) / weaponfadetime) * 100);
};
if (shotgun[h].livetime > weaponlivetime){
shotgun[h].active = false;
line[shotgun[h].linenum].active = false;
if (shotgun[h].parent != null){
shotgun[h].parent.removeChild(shotgun[h]);
};
};
};
tempx1 = p[line[shotgun[h].linenum].firstpnum].x;
tempy1 = p[line[shotgun[h].linenum].firstpnum].y;
tempx2 = p[(line[shotgun[h].linenum].firstpnum + 1)].x;
tempy2 = p[(line[shotgun[h].linenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
shotgun[h].x = ((tempx1 + tempx2) * 0.5);
shotgun[h].y = ((tempy1 + tempy2) * 0.5);
if (shotgun[h].facedirection == 0){
shotgun[h].rotation = -(temprotation);
} else {
shotgun[h].rotation = (180 - temprotation);
};
};
h = (h + 1);
};
h = 0;
while (h < pistols) {
if (pistol[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((player[o].haspistol == false)) || ((player[o].pistolammo < maxpistolammo)))){
if ((((((((pistol[h].x > (player[o].x - chestlength))) && ((pistol[h].x < (player[o].x + chestlength))))) && ((pistol[h].y > (player[o].y - 1))))) && ((pistol[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
weaponpickup.play();
pickuptext = "You picked up a pistol (2)!";
pickuptextdelay = messageduration;
player[o].pistolammo = (player[o].pistolammo + pistolpickupammo);
line[pistol[h].linenum].active = false;
pistol[h].visible = false;
pistol[h].active = false;
if (player[o].haspistol == false){
player[o].haspistol = true;
player[o].weapon = pistolnum;
};
};
};
};
o = (o + 1);
};
pistol[h].livetime = (pistol[h].livetime + 1);
if (pistol[h].fade == true){
if (pistol[h].livetime > (weaponlivetime - weaponfadetime)){
pistol[h].alpha = (((weaponlivetime - pistol[h].livetime) / weaponfadetime) * 100);
};
if (pistol[h].livetime > weaponlivetime){
pistol[h].active = false;
line[pistol[h].linenum].active = false;
if (pistol[h].parent != null){
pistol[h].parent.removeChild(pistol[h]);
};
};
};
tempx1 = p[line[pistol[h].linenum].firstpnum].x;
tempy1 = p[line[pistol[h].linenum].firstpnum].y;
tempx2 = p[(line[pistol[h].linenum].firstpnum + 1)].x;
tempy2 = p[(line[pistol[h].linenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
pistol[h].x = ((tempx1 + tempx2) * 0.5);
pistol[h].y = ((tempy1 + tempy2) * 0.5);
if (pistol[h].facedirection == 0){
pistol[h].rotation = -(temprotation);
} else {
pistol[h].rotation = (180 - temprotation);
};
};
h = (h + 1);
};
h = 0;
while (h < smgs) {
if (smg[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((player[o].hassmg == false)) || ((player[o].smgammo < maxsmgammo)))){
if ((((((((smg[h].x > (player[o].x - chestlength))) && ((smg[h].x < (player[o].x + chestlength))))) && ((smg[h].y > (player[o].y - 1))))) && ((smg[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
weaponpickup.play();
player[o].smgammo = (player[o].smgammo + smgpickupammo);
line[smg[h].linenum].active = false;
smg[h].visible = false;
smg[h].active = false;
pickuptext = "You picked up an smg (4)!";
pickuptextdelay = messageduration;
if (player[o].hassmg == false){
player[o].hassmg = true;
player[o].weapon = smgnum;
};
};
};
};
o = (o + 1);
};
smg[h].livetime = (smg[h].livetime + 1);
if (smg[h].fade == true){
if (smg[h].livetime > (weaponlivetime - weaponfadetime)){
smg[h].alpha = (((weaponlivetime - smg[h].livetime) / weaponfadetime) * 100);
};
if (smg[h].livetime > weaponlivetime){
smg[h].active = false;
line[smg[h].linenum].active = false;
if (smg[h].parent != null){
smg[h].parent.removeChild(smg[h]);
};
};
};
tempx1 = p[line[smg[h].linenum].firstpnum].x;
tempy1 = p[line[smg[h].linenum].firstpnum].y;
tempx2 = p[(line[smg[h].linenum].firstpnum + 1)].x;
tempy2 = p[(line[smg[h].linenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
smg[h].x = ((tempx1 + tempx2) * 0.5);
smg[h].y = ((tempy1 + tempy2) * 0.5);
if (smg[h].facedirection == 0){
smg[h].rotation = -(temprotation);
} else {
smg[h].rotation = (180 - temprotation);
};
};
h = (h + 1);
};
h = 0;
while (h < nailguns) {
if (nailgun[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((player[o].hasnailgun == false)) || ((player[o].nailgunammo < maxnailgunammo)))){
if ((((((((nailgun[h].x > (player[o].x - chestlength))) && ((nailgun[h].x < (player[o].x + chestlength))))) && ((nailgun[h].y > (player[o].y - 1))))) && ((nailgun[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
weaponpickup.play();
player[o].nailgunammo = (player[o].nailgunammo + nailgunpickupammo);
line[nailgun[h].linenum].active = false;
nailgun[h].visible = false;
nailgun[h].active = false;
pickuptext = "You picked up a nailgun (7)!";
pickuptextdelay = messageduration;
if (player[o].hasnailgun == false){
player[o].hasnailgun = true;
player[o].weapon = nailgunnum;
};
};
};
};
o = (o + 1);
};
nailgun[h].livetime = (nailgun[h].livetime + 1);
if (nailgun[h].fade == true){
if (nailgun[h].livetime > (weaponlivetime - weaponfadetime)){
nailgun[h].alpha = (((weaponlivetime - nailgun[h].livetime) / weaponfadetime) * 100);
};
if (nailgun[h].livetime > weaponlivetime){
nailgun[h].active = false;
line[nailgun[h].linenum].active = false;
if (nailgun[h].parent != null){
nailgun[h].parent.removeChild(nailgun[h]);
};
};
};
tempx1 = p[line[nailgun[h].linenum].firstpnum].x;
tempy1 = p[line[nailgun[h].linenum].firstpnum].y;
tempx2 = p[(line[nailgun[h].linenum].firstpnum + 1)].x;
tempy2 = p[(line[nailgun[h].linenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
nailgun[h].x = ((tempx1 + tempx2) * 0.5);
nailgun[h].y = ((tempy1 + tempy2) * 0.5);
if (nailgun[h].facedirection == 0){
nailgun[h].rotation = -(temprotation);
} else {
nailgun[h].rotation = (180 - temprotation);
};
};
h = (h + 1);
};
h = 0;
while (h < rpgs) {
if (rpg[h].active == true){
if (rpg[h].dummy == false){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((player[o].hasrpg == false)) || ((player[o].rpgammo < maxrpgammo)))){
if ((((((((rpg[h].x > (player[o].x - chestlength))) && ((rpg[h].x < (player[o].x + chestlength))))) && ((rpg[h].y > (player[o].y - 1))))) && ((rpg[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
weaponpickup.play();
player[o].rpgammo = (player[o].rpgammo + rpgpickupammo);
line[rpg[h].linenum].active = false;
rpg[h].visible = false;
rpg[h].active = false;
pickuptext = "You picked up an rpg (8)!";
pickuptextdelay = messageduration;
if (player[o].hasrpg == false){
player[o].hasrpg = true;
player[o].weapon = rpgnum;
};
};
};
};
o = (o + 1);
};
} else {
if (Math.floor((Math.random() * 12)) == 0){
rpgsmoke(p[line[rpg[h].linenum].firstpnum].x, p[line[rpg[h].linenum].firstpnum].y);
};
if (Math.floor((Math.random() * 12)) == 0){
rpgsmoke(p[(line[rpg[h].linenum].firstpnum + 1)].x, p[(line[rpg[h].linenum].firstpnum + 1)].y);
};
};
rpg[h].livetime = (rpg[h].livetime + 1);
if (rpg[h].fade == true){
if (rpg[h].livetime > (weaponlivetime - weaponfadetime)){
rpg[h].alpha = (((weaponlivetime - rpg[h].livetime) / weaponfadetime) * 100);
};
if (rpg[h].livetime > weaponlivetime){
rpg[h].active = false;
line[rpg[h].linenum].active = false;
if (rpg[h].parent != null){
rpg[h].parent.removeChild(rpg[h]);
};
};
};
tempx1 = p[line[rpg[h].linenum].firstpnum].x;
tempy1 = p[line[rpg[h].linenum].firstpnum].y;
tempx2 = p[(line[rpg[h].linenum].firstpnum + 1)].x;
tempy2 = p[(line[rpg[h].linenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
rpg[h].x = ((tempx1 + tempx2) * 0.5);
rpg[h].y = ((tempy1 + tempy2) * 0.5);
if (rpg[h].facedirection == 0){
rpg[h].rotation = -(temprotation);
} else {
rpg[h].rotation = (180 - temprotation);
};
};
h = (h + 1);
};
tempattachp = -1;
hitsomething2 = false;
hitsomething3 = false;
h = 0;
while (h < movetrails) {
if (movetrail[h].active == true){
if (movetrail[h].livetime < movetrail[h].maxlivetime){
movetrail[h].livetime = (movetrail[h].livetime + 1);
movetrail[h].alpha = (1 - (movetrail[h].livetime / movetrail[h].maxlivetime));
drawline(movetrail[h].x1, movetrail[h].y1, movetrail[h].x2, movetrail[h].y2, movetrail[h].color, movetrail[h].alpha);
} else {
movetrail[h].active = false;
};
};
h = (h + 1);
};
h = 0;
while (h < lasers) {
if (laser[h].active == true){
laser[h].livetime = (laser[h].livetime + 1);
if (laser[h].livetime > laserlivetime){
laser[h].active = false;
laser[h].visible = false;
};
laser[h].lx = laser[h].x;
laser[h].ly = laser[h].y;
laser[h].x = (laser[h].x + laser[h].hs);
laser[h].y = (laser[h].y + laser[h].vs);
if (segmentcollide(laser[h].x, laser[h].y, laser[h].lx, laser[h].ly) == true){
laser[h].active = false;
laser[h].x = bestcx;
laser[h].y = bestcy;
laserimpact(laser[h].x, laser[h].y);
};
createmovetrail(laser[h].lx, laser[h].ly, laser[h].x, laser[h].y, 10, 0xFF00);
};
h = (h + 1);
};
h = 0;
while (h < rockets) {
if (rocket[h].active == true){
rocket[h].livetime = (rocket[h].livetime + 1);
if (rocket[h].livetime > rocketlivetime){
rocket[h].active = false;
rocket[h].visible = false;
};
rocket[h].lx = rocket[h].x;
rocket[h].ly = rocket[h].y;
rocket[h].x = (rocket[h].x + rocket[h].hs);
rocket[h].y = (rocket[h].y + rocket[h].vs);
if (segmentcollide(rocket[h].x, rocket[h].y, rocket[h].lx, rocket[h].ly) == true){
rocket[h].active = false;
rocket[h].x = rocket[h].lx;
rocket[h].y = rocket[h].ly;
createblast(rocket[h].x, rocket[h].y, rocketradius, rocketpush, rocketdamage, rocket[h].side);
grenadeexplosion(rocket[h].x, rocket[h].y);
};
createmovetrail(rocket[h].lx, rocket[h].ly, rocket[h].x, rocket[h].y, 8, 0xFFFF00);
} else {
if (rocket[h].parent != null){
rocket[h].parent.removeChild(rocket[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < nails) {
if (nail[h].active == true){
nail[h].livetime = (nail[h].livetime + 1);
if (nail[h].livetime > (naillivetime - nailfadetime)){
nail[h].alpha = ((naillivetime - nail[h].livetime) / nailfadetime);
};
if (nail[h].livetime > naillivetime){
nail[h].active = false;
nail[h].visible = false;
};
if ((((nail[h].livetime > naildummytime)) && ((nail[h].attachedparticle == -1)))){
if (nail[h].dummy == false){
nail[h].active = false;
};
};
if (nail[h].attachedparticle > -1){
if (nail[h].bleedtime < nailmaxbleedtime){
nail[h].bleedtime = (nail[h].bleedtime + 1);
if (Math.floor((Math.random() * 3)) == 0){
blooddrip(nail[h].x, nail[h].y);
};
};
if (approxdistance(p[nail[h].attachedparticle].x, p[nail[h].attachedparticle].y, nail[h].x, nail[h].y) < 50){
p[nail[h].attachedparticle].x = nail[h].x;
p[nail[h].attachedparticle].y = nail[h].y;
} else {
nail[h].active = false;
};
if (nail[h].dummy == false){
nail[h].hs = (nail[h].hs * nailaf);
nail[h].vs = (nail[h].vs * nailaf);
nail[h].vs = (nail[h].vs + g);
};
};
nail[h].lx = nail[h].x;
nail[h].ly = nail[h].y;
nail[h].x = (nail[h].x + nail[h].hs);
nail[h].y = (nail[h].y + nail[h].vs);
if (segmentcollide(nail[h].x, nail[h].y, nail[h].lx, nail[h].ly) == true){
if (nail[h].madeeffect == false){
nailgunimpact(bestcx, bestcy);
};
nail[h].madeeffect = true;
nail[h].x = bestcx;
nail[h].y = bestcy;
nail[h].dummy = true;
nail[h].hs = 0;
nail[h].vs = 0;
};
if (nail[h].dummy == false){
createmovetrail(nail[h].lx, nail[h].ly, nail[h].x, nail[h].y, 5, 0xE6E6E6);
nail[h].rotation = -(directiontopoint(0, 0, nail[h].hs, nail[h].vs));
};
} else {
if (nail[h].parent != null){
nail[h].parent.removeChild(nail[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < grenades) {
if (grenade[h].active == true){
if (Math.floor((Math.random() * 4)) == 0){
grenadesmoke(grenade[h].x, grenade[h].y);
};
grenade[h].livetime = (grenade[h].livetime + 1);
if (grenade[h].livetime > (grenadelivetime - grenadefadetime)){
grenade[h].alpha = ((grenadelivetime - grenade[h].livetime) / grenadefadetime);
};
if (grenade[h].livetime > grenadelivetime){
grenade[h].active = false;
createblast(grenade[h].x, grenade[h].y, grenaderadius, grenadepush, grenadedamage, grenade[h].side);
point[grenade[h].pointnum].active = false;
grenadeexplosion(grenade[h].x, grenade[h].y);
grenade[h].visible = false;
} else {
if ((((point[grenade[h].pointnum].bouncetype == 2)) && ((grenade[h].livetime > 8)))){
grenade[h].active = false;
createblast(grenade[h].x, grenade[h].y, grenaderadius, grenadepush, grenadedamage, grenade[h].side);
point[grenade[h].pointnum].active = false;
grenadeexplosion(grenade[h].x, grenade[h].y);
grenade[h].visible = false;
};
};
grenade[h].x = p[point[grenade[h].pointnum].firstpnum].x;
grenade[h].y = p[point[grenade[h].pointnum].firstpnum].y;
if (grenade[h].playedsounds < 3){
if (point[grenade[h].pointnum].bouncetype == 1){
randsound = Math.floor((Math.random() * 3));
if (randsound == 0){
grenadebounce1.play();
};
if (randsound == 1){
grenadebounce2.play();
};
if (randsound == 2){
grenadebounce3.play();
};
grenade[h].playedsounds = (grenade[h].playedsounds + 1);
};
};
grenade[h].rotation = (grenade[h].rotation + grenade[h].rotatespeed);
} else {
if (grenade[h].parent != null){
grenade[h].parent.removeChild(grenade[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < megazombies) {
if (megazombie[h].active == true){
s = 0;
while (s < rockets) {
if ((((rocket[s].active == true)) && (!((rocket[s].side == enemyside))))){
if (approxdistance(rocket[s].x, rocket[s].y, megazombie[h].x, (megazombie[h].y + 30)) <= 30){
rocket[s].active = false;
createblast(rocket[s].x, rocket[s].y, rocketradius, rocketpush, rocketdamage, rocket[s].side);
megazombie[h].woundtimer = 120;
megazombie[h].recovertimer = 200;
grenadeexplosion(rocket[s].x, rocket[s].y);
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < megazombies) {
if (megazombie[h].active == true){
if (megazombie[h].woundtimer > 0){
s = 0;
while (s < bullets) {
if (bullet[s].active == true){
tempnormal = (directiontopoint(bullet[s].x1, bullet[s].y1, bullet[s].x2, bullet[s].y2) + 90);
hitsomething3 = false;
if (approxdistance(bullet[s].x1, bullet[s].y1, megazombie[h].x, (megazombie[h].y + 30)) <= 30){
hitsomething3 = true;
};
if (approxdistance(bullet[s].x2, bullet[s].y2, megazombie[h].x, (megazombie[h].y + 30)) <= 30){
hitsomething3 = true;
};
if (linecollide((megazombie[h].x + vectorx2(tempnormal, 30)), ((megazombie[h].y + 30) + vectory2(tempnormal, 30)), (megazombie[h].x - vectorx2(tempnormal, 30)), ((megazombie[h].y + 30) - vectory2(tempnormal, 30)), bullet[s].x1, bullet[s].y1, bullet[s].x2, bullet[s].y2, directiontopoint(bullet[s].x1, bullet[s].y1, bullet[s].x2, bullet[s].y2)) == true){
};
if (hitsomething3 == true){
if ((megazombie[h].damage + 1) > 1){
megazombieexplosion(megazombie[h].x, (megazombie[h].y + 30));
megazombie[h].active = false;
f = 0;
while (f < 3) {
createpointdebris(((megazombie[h].x + Math.random()) - 0.5), (((megazombie[h].y + 30) + Math.random()) - 0.5), 9);
f = (f + 1);
};
f = 0;
while (f < 5) {
createpointdebris(((megazombie[h].x + Math.random()) - 0.5), (((megazombie[h].y + 30) + Math.random()) - 0.5), (3 + Math.floor((Math.random() * 6))));
f = (f + 1);
};
physicsexplosion(megazombie[h].x, (megazombie[h].y + 31), 3, 8);
} else {
bloodspray(((bullet[s].x1 + bullet[s].x2) * 0.5), ((bullet[s].y1 + bullet[s].y2) * 0.5), 5);
megazombieexhaust.play();
megazombiedie.play();
megazombie[h].sounddelay = 90;
megazombie[h].woundtimer = 0;
megazombie[h].recovertimer = (megazombie[h].recovertimer - megazombie[h].woundtimer);
megazombie[h].damage = (megazombie[h].damage + 1);
};
};
};
s = (s + 1);
};
};
};
h = (h + 1);
};
h = 0;
while (h < enemyAs) {
if (enemyA[h].active == true){
s = 0;
while (s < rockets) {
if ((((rocket[s].active == true)) && (!((rocket[s].side == enemyside))))){
hitsomething2 = false;
if (linecollide(rocket[s].x, rocket[s].y, rocket[s].lx, rocket[s].ly, enemyA[h].x, enemyA[h].y, enemyA[h].x, (enemyA[h].y + (ragdollheight * 2)), 90) == true){
hitsomething2 = true;
} else {
if (pointcollide(rocket[s].x, rocket[s].y, (p[objectline[enemyA[h].objectlinenum].firstpnum].x - objectline[enemyA[h].objectlinenum].xwidth), p[objectline[enemyA[h].objectlinenum].firstpnum].y, (p[objectline[enemyA[h].objectlinenum].firstpnum].x + objectline[enemyA[h].objectlinenum].xwidth), (p[objectline[enemyA[h].objectlinenum].firstpnum].y + objectline[enemyA[h].objectlinenum].yheight)) == true){
hitsomething2 = true;
cx = rocket[s].x;
cy = rocket[s].y;
};
};
if (hitsomething2 == true){
rocket[s].x = cx;
rocket[s].y = cy;
rocket[s].active = false;
createblast(cx, cy, rocketradius, rocketpush, rocketdamage, rocket[s].side);
grenadeexplosion(cx, cy);
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < enemyBs) {
if (enemyB[h].active == true){
s = 0;
while (s < rockets) {
if ((((rocket[s].active == true)) && (!((rocket[s].side == enemyside))))){
hitsomething2 = false;
if (linecollide(rocket[s].x, rocket[s].y, rocket[s].lx, rocket[s].ly, enemyB[h].x, enemyB[h].y, enemyB[h].x, (enemyB[h].y + (ragdollheight * 2)), 90) == true){
hitsomething2 = true;
} else {
if (pointcollide(rocket[s].x, rocket[s].y, (p[objectline[enemyB[h].objectlinenum].firstpnum].x - objectline[enemyB[h].objectlinenum].xwidth), p[objectline[enemyB[h].objectlinenum].firstpnum].y, (p[objectline[enemyB[h].objectlinenum].firstpnum].x + objectline[enemyB[h].objectlinenum].xwidth), (p[objectline[enemyB[h].objectlinenum].firstpnum].y + objectline[enemyB[h].objectlinenum].yheight)) == true){
hitsomething2 = true;
cx = rocket[s].x;
cy = rocket[s].y;
};
};
if (hitsomething2 == true){
rocket[s].x = cx;
rocket[s].y = cy;
rocket[s].active = false;
createblast(cx, cy, rocketradius, rocketpush, rocketdamage, rocket[s].side);
grenadeexplosion(cx, cy);
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < enemyCs) {
if (enemyC[h].active == true){
s = 0;
while (s < rockets) {
if ((((rocket[s].active == true)) && (!((rocket[s].side == enemyside))))){
hitsomething2 = false;
if (linecollide(rocket[s].x, rocket[s].y, rocket[s].lx, rocket[s].ly, enemyC[h].x, enemyC[h].y, enemyC[h].x, (enemyC[h].y + (ragdollheight * 2)), 90) == true){
hitsomething2 = true;
} else {
if (pointcollide(rocket[s].x, rocket[s].y, (p[objectline[enemyC[h].objectlinenum].firstpnum].x - objectline[enemyC[h].objectlinenum].xwidth), p[objectline[enemyC[h].objectlinenum].firstpnum].y, (p[objectline[enemyC[h].objectlinenum].firstpnum].x + objectline[enemyC[h].objectlinenum].xwidth), (p[objectline[enemyC[h].objectlinenum].firstpnum].y + objectline[enemyC[h].objectlinenum].yheight)) == true){
hitsomething2 = true;
cx = rocket[s].x;
cy = rocket[s].y;
};
};
if (hitsomething2 == true){
rocket[s].x = cx;
rocket[s].y = cy;
rocket[s].active = false;
createblast(cx, cy, rocketradius, rocketpush, rocketdamage, rocket[s].side);
grenadeexplosion(cx, cy);
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < enemyAs) {
if (enemyA[h].active == true){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
s = 0;
while (s < blasts) {
if ((((blast[s].active == true)) && (!((blast[s].side == enemyside))))){
explosiondistance = approxdistance(blast[s].x, blast[s].y, enemyA[h].x, (enemyA[h].y + ragdollheight));
if (explosiondistance < blast[s].radius){
if (segmentcollide(blast[s].x, blast[s].y, enemyA[h].x, (enemyA[h].y + ragdollheight)) == false){
damagetaken = (((blast[s].radius - explosiondistance) / blast[s].radius) * blast[s].damage);
enemyA[h].damage = (enemyA[h].damage + damagetaken);
leftarmdamage = Math.floor((Math.random() * 3));
rightarmdamage = Math.floor((Math.random() * 3));
leftlegdamage = Math.floor((Math.random() * 3));
rightlegdamage = Math.floor((Math.random() * 3));
bloodspray(enemyA[h].x, (enemyA[h].y + ragdollheight), Math.round(((damagetaken / blast[s].damage) * explosionbloodps)));
};
};
};
s = (s + 1);
};
if (enemyA[h].damage >= enemyAhealth){
enemyA[h].active = false;
createcorpse(enemyA[h].x, enemyA[h].y, true, objectline[enemyA[h].objectlinenum].firstpnum, 1, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
zombiedie.play();
};
};
if (enemyA[h].active == true){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
if (bulletcollide(enemyA[h].x, enemyA[h].y, enemyA[h].x, (enemyA[h].y + (ragdollheight * 2)), enemyside) == true){
s = 0;
while (s < hits) {
if (hit[s].dismember == true){
dismembermentcheck(hit[s].y, enemyA[h].y);
};
if (player[0].berserk == true){
leftarmdamage = Math.floor((Math.random() * 3));
rightarmdamage = Math.floor((Math.random() * 3));
leftlegdamage = Math.floor((Math.random() * 3));
rightlegdamage = Math.floor((Math.random() * 3));
};
if ((((hit[s].y > enemyA[h].y)) && ((hit[s].y < (enemyA[h].y + necklength))))){
enemyA[h].slow = (enemyA[h].slow + (bulletslowamount * 2));
bloodspray(hit[s].x, hit[s].y, hsbloodps);
enemyA[h].damage = (enemyA[h].damage + (hit[s].damage * headshotmultiplier));
} else {
enemyA[h].slow = (enemyA[h].slow + bulletslowamount);
bloodspray(hit[s].x, hit[s].y, bulletbloodps);
enemyA[h].damage = (enemyA[h].damage + hit[s].damage);
};
s = (s + 1);
};
if (enemyA[h].damage >= enemyAhealth){
enemyA[h].active = false;
createcorpse(enemyA[h].x, enemyA[h].y, true, objectline[enemyA[h].objectlinenum].firstpnum, 1, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
s = 0;
while (s < hits) {
physicspush(hit[s].x, hit[s].y, bulletpushradius, bullet[s].direction, bulletpushspeed);
s = (s + 1);
};
zombiedie.play();
};
};
};
if (enemyA[h].active == true){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
s = 0;
while (s < nails) {
if ((((((nail[s].active == true)) && (!((nail[s].side == enemyside))))) && ((nail[s].attachedparticle == -1)))){
hitsomething2 = false;
if (linecollide(nail[s].x, nail[s].y, nail[s].lx, nail[s].ly, enemyA[h].x, enemyA[h].y, enemyA[h].x, (enemyA[h].y + (ragdollheight * 2)), 90) == true){
hitsomething2 = true;
} else {
if (pointcollide(nail[s].x, nail[s].y, (p[objectline[enemyA[h].objectlinenum].firstpnum].x - objectline[enemyA[h].objectlinenum].xwidth), p[objectline[enemyA[h].objectlinenum].firstpnum].y, (p[objectline[enemyA[h].objectlinenum].firstpnum].x + objectline[enemyA[h].objectlinenum].xwidth), (p[objectline[enemyA[h].objectlinenum].firstpnum].y + objectline[enemyA[h].objectlinenum].yheight)) == true){
hitsomething2 = true;
cx = nail[s].x;
cy = nail[s].y;
};
};
if (hitsomething2 == true){
nailhit.play();
if ((((cy > enemyA[h].y)) && ((cy < (enemyA[h].y + necklength))))){
enemyA[h].slow = (enemyA[h].slow + (nailslowamount * 2));
bloodspray(cx, cy, hsbloodps);
enemyA[h].damage = (enemyA[h].damage + (naildamage * headshotmultiplier));
} else {
enemyA[h].slow = (enemyA[h].slow + nailslowamount);
bloodspray(cx, cy, bulletbloodps);
enemyA[h].damage = (enemyA[h].damage + naildamage);
};
if (enemyA[h].damage >= enemyAhealth){
enemyA[h].active = false;
createcorpse(enemyA[h].x, enemyA[h].y, true, objectline[enemyA[h].objectlinenum].firstpnum, 1, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
nail[s].x = cx;
nail[s].y = cy;
nail[s].hs = vectorx2(nail[s].direction, nailpinspeed);
nail[s].vs = vectory2(nail[s].direction, nailpinspeed);
tempattachp = -1;
tempattachp = findclosestp(((nail[s].x + (Math.random() * ragdollheight)) - (ragdollheight * 0.5)), nail[s].y);
if ((((tempattachp >= ragdoll[corpse[(corpses - 1)].ragdollnum].firstpnum)) && ((tempattachp <= (ragdoll[corpse[(corpses - 1)].ragdollnum].firstpnum + 13))))){
nail[s].attachedparticle = tempattachp;
nail[s].x = p[tempattachp].x;
nail[s].y = p[tempattachp].y;
} else {
nailgunimpact(nail[s].x, nail[s].y);
nail[s].active = false;
};
zombiedie.play();
} else {
nail[s].active = false;
};
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < enemyBs) {
if (enemyB[h].active == true){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
s = 0;
while (s < blasts) {
if ((((blast[s].active == true)) && (!((blast[s].side == enemyside))))){
explosiondistance = approxdistance(blast[s].x, blast[s].y, enemyB[h].x, (enemyB[h].y + ragdollheight));
if (explosiondistance < blast[s].radius){
if (segmentcollide(blast[s].x, blast[s].y, enemyB[h].x, (enemyB[h].y + ragdollheight)) == false){
leftarmdamage = Math.floor((Math.random() * 3));
rightarmdamage = Math.floor((Math.random() * 3));
leftlegdamage = Math.floor((Math.random() * 3));
rightlegdamage = Math.floor((Math.random() * 3));
damagetaken = (((blast[s].radius - explosiondistance) / blast[s].radius) * blast[s].damage);
enemyB[h].damage = (enemyB[h].damage + damagetaken);
bloodspray(enemyB[h].x, (enemyB[h].y + ragdollheight), Math.round(((damagetaken / blast[s].damage) * explosionbloodps)));
};
};
};
s = (s + 1);
};
if (enemyB[h].damage >= enemyBhealth){
enemyB[h].active = false;
if (enemyB[h].kamikaze == false){
createcorpse(enemyB[h].x, enemyB[h].y, true, objectline[enemyB[h].objectlinenum].firstpnum, 2, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
zombiedie.play();
createpointdebris(enemyB[h].x, (enemyB[h].y + 8), 11);
} else {
createblast(enemyB[h].x, (enemyB[h].y + 8), kamikazeradius, kamikazepush, kamikazedamage, -1);
kamikazeexplosion(enemyB[h].x, (enemyB[h].y + 8));
};
};
};
if (enemyB[h].active == true){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
if (bulletcollide(enemyB[h].x, enemyB[h].y, enemyB[h].x, (enemyB[h].y + (ragdollheight * 2)), enemyside) == true){
s = 0;
while (s < hits) {
if (hit[s].dismember == true){
dismembermentcheck(hit[s].y, enemyB[h].y);
};
if (player[0].berserk == true){
leftarmdamage = Math.floor((Math.random() * 3));
rightarmdamage = Math.floor((Math.random() * 3));
leftlegdamage = Math.floor((Math.random() * 3));
rightlegdamage = Math.floor((Math.random() * 3));
};
if ((((hit[s].y > enemyB[h].y)) && ((hit[s].y < (enemyB[h].y + necklength))))){
enemyB[h].slow = (enemyB[h].slow + (bulletslowamount * 2));
bloodspray(hit[s].x, hit[s].y, hsbloodps);
enemyB[h].damage = (enemyB[h].damage + (hit[s].damage * headshotmultiplier));
} else {
enemyB[h].slow = (enemyB[h].slow + bulletslowamount);
bloodspray(hit[s].x, hit[s].y, bulletbloodps);
enemyB[h].damage = (enemyB[h].damage + hit[s].damage);
};
s = (s + 1);
};
if (enemyB[h].damage >= enemyBhealth){
enemyB[h].active = false;
if (enemyB[h].kamikaze == false){
createcorpse(enemyB[h].x, enemyB[h].y, true, objectline[enemyB[h].objectlinenum].firstpnum, 2, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
createpointdebris(enemyB[h].x, (enemyB[h].y + 8), 11);
s = 0;
while (s < hits) {
physicspush(hit[s].x, hit[s].y, bulletpushradius, bullet[s].direction, bulletpushspeed);
s = (s + 1);
};
zombiedie.play();
} else {
createblast(enemyB[h].x, (enemyB[h].y + 8), kamikazeradius, kamikazepush, kamikazedamage, -1);
kamikazeexplosion(enemyB[h].x, (enemyB[h].y + 8));
};
};
};
};
if (enemyB[h].active == true){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
s = 0;
while (s < nails) {
if ((((((nail[s].active == true)) && (!((nail[s].side == enemyside))))) && ((nail[s].attachedparticle == -1)))){
hitsomething2 = false;
if (linecollide(nail[s].x, nail[s].y, nail[s].lx, nail[s].ly, enemyB[h].x, enemyB[h].y, enemyB[h].x, (enemyB[h].y + (ragdollheight * 2)), 90) == true){
hitsomething2 = true;
} else {
if (pointcollide(nail[s].x, nail[s].y, (p[objectline[enemyB[h].objectlinenum].firstpnum].x - objectline[enemyB[h].objectlinenum].xwidth), p[objectline[enemyB[h].objectlinenum].firstpnum].y, (p[objectline[enemyB[h].objectlinenum].firstpnum].x + objectline[enemyB[h].objectlinenum].xwidth), (p[objectline[enemyB[h].objectlinenum].firstpnum].y + objectline[enemyB[h].objectlinenum].yheight)) == true){
hitsomething2 = true;
cx = nail[s].x;
cy = nail[s].y;
};
};
if (hitsomething2 == true){
nailhit.play();
if ((((cy > enemyB[h].y)) && ((cy < (enemyB[h].y + necklength))))){
enemyB[h].slow = (enemyB[h].slow + (nailslowamount * 2));
bloodspray(cx, cy, hsbloodps);
enemyB[h].damage = (enemyB[h].damage + (naildamage * headshotmultiplier));
} else {
enemyB[h].slow = (enemyB[h].slow + nailslowamount);
bloodspray(cx, cy, bulletbloodps);
enemyB[h].damage = (enemyB[h].damage + naildamage);
};
if (enemyB[h].damage >= enemyBhealth){
enemyB[h].active = false;
if (enemyB[h].kamikaze == false){
createpointdebris(enemyB[h].x, (enemyB[h].y + 8), 11);
createcorpse(enemyB[h].x, enemyB[h].y, true, objectline[enemyB[h].objectlinenum].firstpnum, 2, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
nail[s].x = cx;
nail[s].y = cy;
nail[s].hs = vectorx2(nail[s].direction, nailpinspeed);
nail[s].vs = vectory2(nail[s].direction, nailpinspeed);
tempattachp = -1;
tempattachp = findclosestp(((nail[s].x + (Math.random() * ragdollheight)) - (ragdollheight * 0.5)), nail[s].y);
if ((((tempattachp >= ragdoll[(ragdolls - 1)].firstpnum)) && ((tempattachp <= (ragdoll[(ragdolls - 1)].firstpnum + 13))))){
nail[s].attachedparticle = tempattachp;
nail[s].x = p[tempattachp].x;
nail[s].y = p[tempattachp].y;
} else {
nailgunimpact(nail[s].x, nail[s].y);
nail[s].active = false;
};
zombiedie.play();
} else {
createblast(enemyB[h].x, (enemyB[h].y + 8), kamikazeradius, kamikazepush, kamikazedamage, -1);
kamikazeexplosion(enemyB[h].x, (enemyB[h].y + 8));
};
} else {
nail[s].active = false;
};
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < enemyCs) {
if (enemyC[h].active == true){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
s = 0;
while (s < blasts) {
if ((((blast[s].active == true)) && (!((blast[s].side == enemyside))))){
explosiondistance = approxdistance(blast[s].x, blast[s].y, enemyC[h].x, (enemyC[h].y + ragdollheight));
if (explosiondistance < blast[s].radius){
if (segmentcollide(blast[s].x, blast[s].y, enemyC[h].x, (enemyC[h].y + ragdollheight)) == false){
leftarmdamage = Math.floor((Math.random() * 3));
rightarmdamage = Math.floor((Math.random() * 3));
leftlegdamage = Math.floor((Math.random() * 3));
rightlegdamage = Math.floor((Math.random() * 3));
damagetaken = (((blast[s].radius - explosiondistance) / blast[s].radius) * blast[s].damage);
enemyC[h].damage = (enemyC[h].damage + damagetaken);
bloodspray(enemyC[h].x, (enemyC[h].y + ragdollheight), Math.round(((damagetaken / blast[s].damage) * explosionbloodps)));
};
};
};
s = (s + 1);
};
if (enemyC[h].damage >= enemyChealth){
enemyC[h].active = false;
createcorpse(enemyC[h].x, enemyC[h].y, true, objectline[enemyC[h].objectlinenum].firstpnum, 3, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
zombiedie.play();
createpointdebris(enemyC[h].x, (enemyC[h].y + 8), 10);
};
};
if (enemyC[h].active == true){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
if (bulletcollide(enemyC[h].x, enemyC[h].y, enemyC[h].x, (enemyC[h].y + (ragdollheight * 2)), enemyside) == true){
s = 0;
while (s < hits) {
if (hit[s].dismember == true){
dismembermentcheck(hit[s].y, enemyC[h].y);
};
if (player[0].berserk == true){
leftarmdamage = Math.floor((Math.random() * 3));
rightarmdamage = Math.floor((Math.random() * 3));
leftlegdamage = Math.floor((Math.random() * 3));
rightlegdamage = Math.floor((Math.random() * 3));
};
if ((((hit[s].y > enemyC[h].y)) && ((hit[s].y < (enemyC[h].y + necklength))))){
enemyC[h].slow = (enemyC[h].slow + (bulletslowamount * 2));
bloodspray(hit[s].x, hit[s].y, hsbloodps);
enemyC[h].damage = (enemyC[h].damage + (hit[s].damage * headshotmultiplier));
} else {
enemyC[h].slow = (enemyC[h].slow + bulletslowamount);
bloodspray(hit[s].x, hit[s].y, bulletbloodps);
enemyC[h].damage = (enemyC[h].damage + hit[s].damage);
};
s = (s + 1);
};
if (enemyC[h].damage >= enemyChealth){
enemyC[h].active = false;
createpointdebris(enemyC[h].x, (enemyC[h].y + 8), 10);
createcorpse(enemyC[h].x, enemyC[h].y, true, objectline[enemyC[h].objectlinenum].firstpnum, 3, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
s = 0;
while (s < hits) {
physicspush(hit[s].x, hit[s].y, bulletpushradius, bullet[s].direction, bulletpushspeed);
s = (s + 1);
};
zombiedie.play();
};
};
};
if (enemyC[h].active == true){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
s = 0;
while (s < nails) {
if ((((((nail[s].active == true)) && (!((nail[s].side == enemyside))))) && ((nail[s].attachedparticle == -1)))){
hitsomething2 = false;
if (linecollide(nail[s].x, nail[s].y, nail[s].lx, nail[s].ly, enemyC[h].x, enemyC[h].y, enemyC[h].x, (enemyC[h].y + (ragdollheight * 2)), 90) == true){
hitsomething2 = true;
} else {
if (pointcollide(nail[s].x, nail[s].y, (p[objectline[enemyC[h].objectlinenum].firstpnum].x - objectline[enemyC[h].objectlinenum].xwidth), p[objectline[enemyC[h].objectlinenum].firstpnum].y, (p[objectline[enemyC[h].objectlinenum].firstpnum].x + objectline[enemyC[h].objectlinenum].xwidth), (p[objectline[enemyC[h].objectlinenum].firstpnum].y + objectline[enemyC[h].objectlinenum].yheight)) == true){
hitsomething2 = true;
cx = nail[s].x;
cy = nail[s].y;
};
};
if (hitsomething2 == true){
nailhit.play();
if ((((cy > enemyC[h].y)) && ((cy < (enemyC[h].y + necklength))))){
enemyC[h].slow = (enemyC[h].slow + (nailslowamount * 2));
bloodspray(cx, cy, hsbloodps);
enemyC[h].damage = (enemyC[h].damage + (naildamage * headshotmultiplier));
} else {
enemyC[h].slow = (enemyC[h].slow + nailslowamount);
bloodspray(cx, cy, bulletbloodps);
enemyC[h].damage = (enemyC[h].damage + naildamage);
};
if (enemyC[h].damage >= enemyChealth){
createpointdebris(enemyC[h].x, (enemyC[h].y + 8), 10);
enemyC[h].active = false;
createcorpse(enemyC[h].x, enemyC[h].y, true, objectline[enemyC[h].objectlinenum].firstpnum, 3, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
nail[s].x = cx;
nail[s].y = cy;
nail[s].hs = vectorx2(nail[s].direction, nailpinspeed);
nail[s].vs = vectory2(nail[s].direction, nailpinspeed);
tempattachp = -1;
tempattachp = findclosestp(((nail[s].x + (Math.random() * ragdollheight)) - (ragdollheight * 0.5)), nail[s].y);
if ((((tempattachp >= ragdoll[(ragdolls - 1)].firstpnum)) && ((tempattachp <= (ragdoll[(ragdolls - 1)].firstpnum + 13))))){
nail[s].attachedparticle = tempattachp;
nail[s].x = p[tempattachp].x;
nail[s].y = p[tempattachp].y;
} else {
nailgunimpact(nail[s].x, nail[s].y);
nail[s].active = false;
};
zombiedie.play();
} else {
nail[s].active = false;
};
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < players) {
if ((((player[h].active == true)) && ((player[h].berserk == false)))){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
s = 0;
while (s < blasts) {
if ((((blast[s].active == true)) && (!((blast[s].side == playerside))))){
explosiondistance = approxdistance(blast[s].x, blast[s].y, player[h].x, (player[h].y + ragdollheight));
if (explosiondistance < blast[s].radius){
if (segmentcollide(blast[s].x, blast[s].y, player[h].x, (player[h].y + ragdollheight)) == false){
leftarmdamage = Math.floor((Math.random() * 3));
rightarmdamage = Math.floor((Math.random() * 3));
leftlegdamage = Math.floor((Math.random() * 3));
rightlegdamage = Math.floor((Math.random() * 3));
playerdamage.play();
damagetaken = (((blast[s].radius - explosiondistance) / blast[s].radius) * blast[s].damage);
player[h].berserkamount = (player[h].berserkamount + damagetaken);
player[h].damage = (player[h].damage + damagetaken);
bloodspray(player[h].x, (player[h].y + ragdollheight), Math.round(((damagetaken / blast[s].damage) * explosionbloodps)));
};
};
};
s = (s + 1);
};
if (player[h].damage >= playerhealth){
player[h].active = false;
if (player[h].weapon == riflenum){
createrifle((player[h].bodyx + vectorx(player[h].gundirection, rifleholddistance)), (player[h].bodyy + vectory(player[h].gundirection, rifleholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == pistolnum){
createpistol((player[h].bodyx + vectorx(player[h].gundirection, pistolholddistance)), (player[h].bodyy + vectory(player[h].gundirection, pistolholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == shotgunnum){
createshotgun((player[h].bodyx + vectorx(player[h].gundirection, shotgunholddistance)), (player[h].bodyy + vectory(player[h].gundirection, shotgunholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == smgnum){
createsmg((player[h].bodyx + vectorx(player[h].gundirection, smgholddistance)), (player[h].bodyy + vectory(player[h].gundirection, smgholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == chainsawnum){
createchainsaw((player[h].bodyx + vectorx(player[h].gundirection, chainsawholddistance)), (player[h].bodyy + vectory(player[h].gundirection, chainsawholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == nailgunnum){
createnailgun((player[h].bodyx + vectorx(player[h].gundirection, nailgunholddistance)), (player[h].bodyy + vectory(player[h].gundirection, nailgunholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == rpgnum){
createrpg((player[h].bodyx + vectorx(player[h].gundirection, rpgholddistance)), (player[h].bodyy + vectory(player[h].gundirection, rpgholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum, false);
};
createcorpse(player[h].x, player[h].y, true, objectline[player[h].objectlinenum].firstpnum, 0, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
};
};
if ((((player[h].active == true)) && ((player[h].berserk == false)))){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
if (bulletcollide(player[h].x, player[h].y, player[h].x, (player[h].y + (ragdollheight * 2)), playerside) == true){
playerdamage.play();
s = 0;
while (s < hits) {
if (hit[s].dismember == true){
dismembermentcheck(hit[s].y, player[h].y);
};
if ((((hit[s].y > player[h].y)) && ((hit[s].y < (player[h].y + necklength))))){
player[h].slow = (player[h].slow + (bulletslowamount * 2));
bloodspray(hit[s].x, hit[s].y, hsbloodps);
player[h].damage = (player[h].damage + (hit[s].damage * headshotmultiplier));
player[h].berserkamount = (player[h].berserkamount + (hit[s].damage * headshotmultiplier));
} else {
player[h].slow = (player[h].slow + bulletslowamount);
bloodspray(hit[s].x, hit[s].y, bulletbloodps);
player[h].damage = (player[h].damage + hit[s].damage);
player[h].berserkamount = (player[h].berserkamount + hit[s].damage);
};
s = (s + 1);
};
if (player[h].damage >= playerhealth){
player[h].active = false;
if (player[h].weapon == riflenum){
createrifle((player[h].bodyx + vectorx(player[h].gundirection, rifleholddistance)), (player[h].bodyy + vectory(player[h].gundirection, rifleholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == pistolnum){
createpistol((player[h].bodyx + vectorx(player[h].gundirection, pistolholddistance)), (player[h].bodyy + vectory(player[h].gundirection, pistolholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == shotgunnum){
createshotgun((player[h].bodyx + vectorx(player[h].gundirection, shotgunholddistance)), (player[h].bodyy + vectory(player[h].gundirection, shotgunholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == smgnum){
createsmg((player[h].bodyx + vectorx(player[h].gundirection, smgholddistance)), (player[h].bodyy + vectory(player[h].gundirection, smgholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == chainsawnum){
createchainsaw((player[h].bodyx + vectorx(player[h].gundirection, chainsawholddistance)), (player[h].bodyy + vectory(player[h].gundirection, chainsawholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == nailgunnum){
createnailgun((player[h].bodyx + vectorx(player[h].gundirection, nailgunholddistance)), (player[h].bodyy + vectory(player[h].gundirection, nailgunholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == rpgnum){
createrpg((player[h].bodyx + vectorx(player[h].gundirection, rpgholddistance)), (player[h].bodyy + vectory(player[h].gundirection, rpgholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum, false);
};
createcorpse(player[h].x, player[h].y, true, objectline[player[h].objectlinenum].firstpnum, 0, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
s = 0;
while (s < hits) {
physicspush(hit[s].x, hit[s].y, bulletpushradius, bullet[s].direction, bulletpushspeed);
s = (s + 1);
};
};
};
};
if (player[h].active == true){
leftarmdamage = 0;
rightarmdamage = 0;
leftlegdamage = 0;
rightlegdamage = 0;
s = 0;
while (s < lasers) {
if ((((laser[s].active == true)) && (!((laser[s].side == playerside))))){
hitsomething2 = false;
if (linecollide(laser[s].x, laser[s].y, laser[s].lx, laser[s].ly, player[h].x, player[h].y, player[h].x, (player[h].y + (ragdollheight * 2)), 90) == true){
hitsomething2 = true;
} else {
if (pointcollide(laser[s].x, laser[s].y, (p[objectline[player[h].objectlinenum].firstpnum].x - objectline[player[h].objectlinenum].xwidth), p[objectline[player[h].objectlinenum].firstpnum].y, (p[objectline[player[h].objectlinenum].firstpnum].x + objectline[player[h].objectlinenum].xwidth), (p[objectline[player[h].objectlinenum].firstpnum].y + objectline[player[h].objectlinenum].yheight)) == true){
hitsomething2 = true;
cx = laser[s].x;
cy = laser[s].y;
};
};
if (hitsomething2 == true){
laser[s].active = false;
if ((((cy > player[h].y)) && ((cy < (player[h].y + necklength))))){
bloodspray(cx, cy, hsbloodps);
player[h].damage = (player[h].damage + (laserdamage * headshotmultiplier));
} else {
bloodspray(cx, cy, bulletbloodps);
player[h].damage = (player[h].damage + laserdamage);
};
if (player[h].damage >= playerhealth){
playerdamage.play();
player[h].active = false;
if (player[h].weapon == riflenum){
createrifle((player[h].bodyx + vectorx(player[h].gundirection, rifleholddistance)), (player[h].bodyy + vectory(player[h].gundirection, rifleholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == pistolnum){
createpistol((player[h].bodyx + vectorx(player[h].gundirection, pistolholddistance)), (player[h].bodyy + vectory(player[h].gundirection, pistolholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == shotgunnum){
createshotgun((player[h].bodyx + vectorx(player[h].gundirection, shotgunholddistance)), (player[h].bodyy + vectory(player[h].gundirection, shotgunholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == smgnum){
createsmg((player[h].bodyx + vectorx(player[h].gundirection, smgholddistance)), (player[h].bodyy + vectory(player[h].gundirection, smgholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == chainsawnum){
createchainsaw((player[h].bodyx + vectorx(player[h].gundirection, chainsawholddistance)), (player[h].bodyy + vectory(player[h].gundirection, chainsawholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == nailgunnum){
createnailgun((player[h].bodyx + vectorx(player[h].gundirection, nailgunholddistance)), (player[h].bodyy + vectory(player[h].gundirection, nailgunholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum);
};
if (player[h].weapon == rpgnum){
createrpg((player[h].bodyx + vectorx(player[h].gundirection, rpgholddistance)), (player[h].bodyy + vectory(player[h].gundirection, rpgholddistance)), player[h].facedirection, player[h].gundirection, true, objectline[player[h].objectlinenum].firstpnum, false);
};
createcorpse(player[h].x, player[h].y, true, objectline[player[h].objectlinenum].firstpnum, 0, (2 - leftarmdamage), (2 - rightarmdamage), (2 - leftlegdamage), (2 - rightlegdamage));
};
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < turretbases) {
if (turretbase[h].active == true){
s = 0;
while (s < blasts) {
if (blast[s].active == true){
explosiondistance = approxdistance(blast[s].x, blast[s].y, ((turretbase[h].x1 + turretbase[h].x2) * 0.5), ((turretbase[h].y1 + turretbase[h].y2) * 0.5));
if (explosiondistance < blast[s].radius){
if (segmentcollide(blast[s].x, blast[s].y, ((turretbase[h].x1 + turretbase[h].x2) * 0.5), ((turretbase[h].y1 + turretbase[h].y2) * 0.5)) == false){
damagetaken = (((blast[s].radius - explosiondistance) / blast[s].radius) * blast[s].damage);
turretbase[h].damage = (turretbase[h].damage + damagetaken);
turrethit(((turretbase[h].x1 + turretbase[h].x2) * 0.5), ((turretbase[h].y1 + turretbase[h].y2) * 0.5));
};
};
};
s = (s + 1);
};
if (bulletcollide(turretbase[h].x1, turretbase[h].y1, turretbase[h].x2, turretbase[h].y2, turretside) == true){
s = 0;
while (s < hits) {
turrethit(hit[s].x, hit[s].y);
turretbase[h].damage = (turretbase[h].damage + hit[s].damage);
s = (s + 1);
};
if (turretbase[h].damage >= turrethealth){
turretbase[h].active = false;
turretbarrel[turretbase[h].barrelnum].active = false;
turretexplosion(turretbase[h].x, turretbase[h].y);
f = 0;
while (f < turretdebrisparticles) {
createpointdebris(((turretbase[h].x + Math.random()) - 0.5), ((turretbase[h].y + Math.random()) - 0.5), 0);
f = (f + 1);
};
physicsexplosion(turretbase[h].x, turretbase[h].y, 2, 5);
};
};
s = 0;
while (s < nails) {
if ((((nail[s].active == true)) && (!((nail[s].side == turretside))))){
if (linecollide(nail[s].x, nail[s].y, nail[s].lx, nail[s].ly, turretbase[h].x1, turretbase[h].y1, turretbase[h].x2, turretbase[h].y2, directiontopoint(turretbase[h].x1, turretbase[h].y1, turretbase[h].x2, turretbase[h].y2)) == true){
nailhit.play();
nail[s].active = false;
nailgunimpact(cx, cy);
turretbase[h].damage = (turretbase[h].damage + naildamage);
if (turretbase[h].damage >= turrethealth){
turretbase[h].active = false;
turretbarrel[turretbase[h].barrelnum].active = false;
turretexplosion(turretbase[h].x, turretbase[h].y);
f = 0;
while (f < turretdebrisparticles) {
createpointdebris(((turretbase[h].x + Math.random()) - 0.5), ((turretbase[h].y + Math.random()) - 0.5), 0);
f = (f + 1);
};
physicsexplosion(turretbase[h].x, turretbase[h].y, 2, 5);
};
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < waterpools) {
if (waterpool[h].active == true){
if (bulletcollide(waterpool[h].x, waterpool[h].y, (waterpool[h].x + waterpool[h].xwidth), waterpool[h].y, -3) == true){
s = 0;
while (s < hits) {
watersplash(hit[s].x, hit[s].y, waterpool[h].watercolor);
s = (s + 1);
};
};
};
h = (h + 1);
};
h = 0;
while (h < waterpools) {
if (waterpool[h].active == true){
s = 0;
while (s < blasts) {
if (blast[s].active == true){
if ((((((((blast[s].x > waterpool[h].x)) && ((blast[s].x < (waterpool[h].x + waterpool[h].xwidth))))) && ((blast[s].y > waterpool[h].y)))) && ((blast[s].y < (waterpool[h].y + waterpool[h].depth))))){
waterexplosion(blast[s].x, waterpool[h].y, waterpool[h].watercolor);
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < hitzones) {
if (hitzone[h].active == false){
s = 0;
while (s < bullets) {
if (bullet[s].active == true){
tempnormal = (directiontopoint(bullet[s].x1, bullet[s].y1, bullet[s].x2, bullet[s].y2) + 90);
if (approxdistance(bullet[s].x1, bullet[s].y1, hitzone[h].x, hitzone[h].y) <= hitzone[h].radius){
hitzone[h].active = true;
};
if (approxdistance(bullet[s].x2, bullet[s].y2, hitzone[h].x, hitzone[h].y) <= hitzone[h].radius){
hitzone[h].active = true;
};
if (linecollide((hitzone[h].x + vectorx2(tempnormal, hitzone[h].radius)), (hitzone[h].y + vectory2(tempnormal, hitzone[h].radius)), (hitzone[h].x - vectorx2(tempnormal, hitzone[h].radius)), (hitzone[h].y - vectory2(tempnormal, hitzone[h].radius)), bullet[s].x1, bullet[s].y1, bullet[s].x2, bullet[s].y2, directiontopoint(bullet[s].x1, bullet[s].y1, bullet[s].x2, bullet[s].y2)) == true){
hitzone[h].active = true;
};
};
s = (s + 1);
};
s = 0;
while (s < nails) {
if ((((nail[s].active == true)) && (!((nail[s].side == turretside))))){
tempnormal = (directiontopoint(nail[s].lx, nail[s].ly, nail[s].x, nail[s].y) + 90);
if (linecollide((hitzone[h].x + vectorx2(tempnormal, hitzone[h].radius)), (hitzone[h].y + vectory2(tempnormal, hitzone[h].radius)), (hitzone[h].x - vectorx2(tempnormal, hitzone[h].radius)), (hitzone[h].y - vectory2(tempnormal, hitzone[h].radius)), nail[s].x, nail[s].y, nail[s].lx, nail[s].ly, directiontopoint(nail[s].x, nail[s].y, nail[s].lx, nail[s].ly)) == true){
hitzone[h].active = true;
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < hitzones) {
if (hitzone[h].active == false){
s = 0;
while (s < blasts) {
if (blast[s].active == true){
tempdistance = approxdistance(blast[s].x, blast[s].y, hitzone[h].x, hitzone[h].y);
if (tempdistance <= (hitzone[h].radius + blast[s].radius)){
hitzone[h].active = true;
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < bullets) {
bullet[h].active = false;
h = (h + 1);
};
h = 0;
while (h < blasts) {
if (blast[h].active == true){
physicsexplosion(blast[h].x, blast[h].y, blast[h].radius, blast[h].push);
blast[h].active = false;
};
h = (h + 1);
};
foundplayer = false;
currentnode = 0;
mzmovespeed = 0;
mzmovey = 0;
h = 0;
while (h < enemyAs) {
if (enemyA[h].active == true){
deltahs = 0;
deltavs = 0;
maxmovespeed = enemyAmaxmovespeed;
if (enemyA[h].onfire == true){
maxmovespeed = 5;
if (Math.floor((Math.random() * 2)) == 0){
zombiefire(enemyA[h].x, (enemyA[h].y + (Math.random() * ragdollheight)));
};
};
movefactor = enemyAaircontrolfactor;
d = 0;
while (d < waterpools) {
if ((((((((p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].x > waterpool[d].x)) && ((p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].x < (waterpool[d].x + waterpool[d].xwidth))))) && ((p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].y > waterpool[d].y)))) && ((p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].y < (waterpool[d].y + waterpool[d].depth))))){
movefactor = enemyAwatercontrolfactor;
};
d = (d + 1);
};
groundoffset = 0;
if (segmentcollide(p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].x, p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].y, p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].x, (p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].y + 2)) == true){
movefactor = 1;
groundoffset = (p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].y - bestcy);
};
if (player[0].active == true){
if ((((approxdistance(enemyA[h].x, enemyA[h].y, player[0].x, player[0].y) < enemyAseedistance)) && ((approxdistance(enemyA[h].x, enemyA[h].y, player[0].x, player[0].y) > 0)))){
foundplayer = true;
enemyA[h].hastarget = true;
enemyA[h].patrolling = false;
enemyA[h].targetx = player[0].x;
enemyA[h].targety = player[0].y;
} else {
foundplayer = false;
};
} else {
foundplayer = false;
enemyA[h].hastarget = false;
};
bodyB[enemyA[h].bodynum].frame = 0;
if (foundplayer == true){
bodyB[enemyA[h].bodynum].frame = 2;
};
if (enemyA[h].hastarget == true){
if (player[0].active == false){
enemyA[h].hastarget = false;
enemyA[h].patrolling = false;
};
if (enemyA[h].x > enemyA[h].targetx){
if ((((enemyA[h].movedelay == 0)) || ((enemyA[h].movedirection == 1)))){
deltahs = (deltahs - (enemyAmoveacceleration * movefactor));
enemyA[h].movedelay = (enemyAmovedelay + Math.round(((Math.random() * enemyAmovedelay) * 0.5)));
enemyA[h].movedirection = 1;
};
} else {
if ((((enemyA[h].movedelay == 0)) || ((enemyA[h].movedirection == 0)))){
deltahs = (deltahs + (enemyAmoveacceleration * movefactor));
enemyA[h].movedelay = (enemyAmovedelay + Math.round(((Math.random() * enemyAmovedelay) * 0.5)));
enemyA[h].movedirection = 0;
};
};
if (enemyA[h].movedelay > 0){
enemyA[h].movedelay = (enemyA[h].movedelay - 1);
};
if (enemyA[h].movedelay == 0){
if (foundplayer == false){
enemyA[h].hastarget = false;
};
};
if (approxdistance(enemyA[h].x, enemyA[h].y, enemyA[h].targetx, enemyA[h].targety) < (enemyAshootdistance * 1.5)){
if (Math.abs((enemyA[h].x - enemyA[h].targetx)) < (enemyAshootdistance * 0.71)){
if ((((((enemyA[h].x > enemyA[h].targetx)) && ((enemyA[h].movedirection == 1)))) || ((((enemyA[h].x < enemyA[h].targetx)) && ((enemyA[h].movedirection == 0)))))){
if (enemyA[h].shootdelay == 0){
bodyB[enemyA[h].bodynum].frame = 3;
enemyA[h].framedelay = (enemyAshootdelay * 0.5);
enemyA[h].shootdelay = enemyAshootdelay;
createbullet(enemyA[h].x, (enemyA[h].y + 12), (((enemyA[h].movedirection * 180) + (Math.random() * enemyAinaccuracy)) - (enemyAinaccuracy * 0.5)), enemyAshootdistance, enemyAdamage, enemyside, 0xFFFFFF, 0, false);
};
};
};
};
if (enemyA[h].shootdelay > 0){
enemyA[h].shootdelay = (enemyA[h].shootdelay - 1);
};
} else {
if (enemyA[h].patrolling == true){
if (enemyA[h].movedirection == 0){
deltahs = (deltahs + (enemyAmoveacceleration * movefactor));
} else {
deltahs = (deltahs - (enemyAmoveacceleration * movefactor));
};
};
};
deltahs2 = 0;
if (enemyA[h].slow > 0){
if (deltahs > 0){
deltahs2 = -(enemyA[h].slow);
};
if (deltahs < 0){
deltahs2 = enemyA[h].slow;
};
enemyA[h].slow = 0;
};
if (enemyA[h].framedelay > 0){
bodyB[enemyA[h].bodynum].frame = 3;
enemyA[h].framedelay = (enemyA[h].framedelay - 1);
};
temporaryhs = (p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].x - p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].lx);
if (Math.abs(((temporaryhs + deltahs) + deltahs2)) < maxmovespeed){
p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].x = ((p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].x + deltahs) + deltahs2);
p[objectline[enemyA[h].objectlinenum].firstpnum].x = ((p[objectline[enemyA[h].objectlinenum].firstpnum].x + deltahs) + deltahs2);
} else {
if (Math.abs(temporaryhs) < maxmovespeed){
if (temporaryhs > 0){
p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].x = (p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].lx + maxmovespeed);
p[objectline[enemyA[h].objectlinenum].firstpnum].x = (p[objectline[enemyA[h].objectlinenum].firstpnum].lx + maxmovespeed);
} else {
p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].x = (p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].lx - maxmovespeed);
p[objectline[enemyA[h].objectlinenum].firstpnum].x = (p[objectline[enemyA[h].objectlinenum].firstpnum].lx - maxmovespeed);
};
};
};
p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].y = (p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].y + deltavs);
p[objectline[enemyA[h].objectlinenum].firstpnum].y = (p[objectline[enemyA[h].objectlinenum].firstpnum].y + deltavs);
temporaryhs = Math.abs((p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].x - p[(objectline[enemyA[h].objectlinenum].firstpnum + 1)].lx));
if (deltahs > 0){
enemyA[h].movedirection = 0;
};
if (deltahs < 0){
enemyA[h].movedirection = 1;
};
legB[enemyA[h].firstlegnum].framerate = 1;
if (deltahs == 0){
if (enemyA[h].movedirection == 0){
if (legB[enemyA[h].firstlegnum].frame == 4){
legB[enemyA[h].firstlegnum].framerate = 0;
};
} else {
if (legB[enemyA[h].firstlegnum].frame == 14){
legB[enemyA[h].firstlegnum].framerate = 0;
};
};
} else {
if (foundplayer == false){
bodyB[enemyA[h].bodynum].frame = 1;
};
};
if (movefactor == enemyAaircontrolfactor){
legB[enemyA[h].firstlegnum].framerate = 0;
};
if (enemyA[h].movedirection == 0){
bodyB[enemyA[h].bodynum].scaleX = 1;
legB[enemyA[h].firstlegnum].scaleX = 1;
legB[(enemyA[h].firstlegnum + 1)].scaleX = 1;
} else {
bodyB[enemyA[h].bodynum].scaleX = -1;
legB[enemyA[h].firstlegnum].scaleX = -1;
legB[(enemyA[h].firstlegnum + 1)].scaleX = -1;
};
legB[(enemyA[h].firstlegnum + 1)].frame = (legB[enemyA[h].firstlegnum].frame + 11);
enemyA[h].y = (p[objectline[enemyA[h].objectlinenum].firstpnum].y - groundoffset);
enemyA[h].x = p[objectline[enemyA[h].objectlinenum].firstpnum].x;
legsoffset = ((ragdollheight * 2) - (upperleglength + lowerleglength));
legB[enemyA[h].firstlegnum].x = (enemyA[h].x - (chestlength * 0.5));
legB[enemyA[h].firstlegnum].y = (enemyA[h].y + legsoffset);
legB[(enemyA[h].firstlegnum + 1)].x = (enemyA[h].x + (chestlength * 0.5));
legB[(enemyA[h].firstlegnum + 1)].y = (enemyA[h].y + legsoffset);
bodyB[enemyA[h].bodynum].y = (enemyA[h].y + legsoffset);
bodyB[enemyA[h].bodynum].x = enemyA[h].x;
} else {
objectline[enemyA[h].objectlinenum].active = false;
legB[enemyA[h].firstlegnum].active = false;
legB[(enemyA[h].firstlegnum + 1)].active = false;
bodyB[enemyA[h].bodynum].active = false;
};
h = (h + 1);
};
h = 0;
while (h < enemyBs) {
if (enemyB[h].active == true){
deltahs = 0;
deltavs = 0;
if (enemyB[h].kamikaze == false){
maxmovespeed = enemyBmaxmovespeed;
} else {
maxmovespeed = (enemyBmaxmovespeed + 1);
};
movefactor = enemyBaircontrolfactor;
d = 0;
while (d < waterpools) {
if ((((((((p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].x > waterpool[d].x)) && ((p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].x < (waterpool[d].x + waterpool[d].xwidth))))) && ((p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].y > waterpool[d].y)))) && ((p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].y < (waterpool[d].y + waterpool[d].depth))))){
movefactor = enemyBwatercontrolfactor;
};
d = (d + 1);
};
groundoffset = 0;
if (segmentcollide(p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].x, p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].y, p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].x, (p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].y + 2)) == true){
movefactor = 1;
groundoffset = (p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].y - bestcy);
};
if (player[0].active == true){
if ((((approxdistance(enemyB[h].x, enemyB[h].y, player[0].x, player[0].y) < enemyBseedistance)) && ((approxdistance(enemyB[h].x, enemyB[h].y, player[0].x, player[0].y) > 0)))){
foundplayer = true;
enemyB[h].hastarget = true;
enemyB[h].patrolling = false;
enemyB[h].targetx = player[0].x;
enemyB[h].targety = player[0].y;
} else {
foundplayer = false;
};
} else {
foundplayer = false;
enemyB[h].hastarget = false;
enemyB[h].patrolling = false;
};
bodyC[enemyB[h].bodynum].frame = 0;
if (foundplayer == true){
bodyC[enemyB[h].bodynum].frame = 2;
};
if (enemyB[h].hastarget == true){
if (player[0].active == false){
enemyB[h].hastarget = false;
};
if (enemyB[h].x > enemyB[h].targetx){
if ((((enemyB[h].movedelay == 0)) || ((enemyB[h].movedirection == 1)))){
deltahs = (deltahs - (enemyBmoveacceleration * movefactor));
enemyB[h].movedelay = (enemyBmovedelay + Math.round(((Math.random() * enemyBmovedelay) * 0.5)));
enemyB[h].movedirection = 1;
};
} else {
if ((((enemyB[h].movedelay == 0)) || ((enemyB[h].movedirection == 0)))){
deltahs = (deltahs + (enemyBmoveacceleration * movefactor));
enemyB[h].movedelay = (enemyBmovedelay + Math.round(((Math.random() * enemyBmovedelay) * 0.5)));
enemyB[h].movedirection = 0;
};
};
if (enemyB[h].movedelay > 0){
enemyB[h].movedelay = (enemyB[h].movedelay - 1);
};
if (enemyB[h].movedelay == 0){
if (foundplayer == false){
enemyB[h].hastarget = false;
};
};
if (enemyB[h].kamikaze == true){
grenadesmoke(((enemyB[h].x + (Math.random() * 12)) - 6), (enemyB[h].y + (Math.random() * 16)));
};
if (approxdistance(enemyB[h].x, enemyB[h].y, enemyB[h].targetx, enemyB[h].targety) < (enemyBshootdistance * 1.5)){
if (Math.abs((enemyB[h].x - enemyB[h].targetx)) < (enemyBshootdistance * 0.71)){
if ((((((enemyB[h].x > enemyB[h].targetx)) && ((enemyB[h].movedirection == 1)))) || ((((enemyB[h].x < enemyB[h].targetx)) && ((enemyB[h].movedirection == 0)))))){
if (enemyB[h].kamikaze == false){
if (enemyB[h].shootdelay == 0){
bodyC[enemyB[h].bodynum].frame = 3;
enemyB[h].framedelay = (enemyBshootdelay * 0.5);
enemyB[h].shootdelay = enemyBshootdelay;
createbullet(enemyB[h].x, (enemyB[h].y + 12), (((enemyB[h].movedirection * 180) + (Math.random() * enemyBinaccuracy)) - (enemyBinaccuracy * 0.5)), enemyBshootdistance, enemyBdamage, enemyside, 0xFFFFFF, 0, false);
};
} else {
createblast(enemyB[h].x, (enemyB[h].y + 8), kamikazeradius, kamikazepush, kamikazedamage, -1);
kamikazeexplosion(enemyB[h].x, (enemyB[h].y + 8));
};
};
};
};
if (enemyB[h].shootdelay > 0){
enemyB[h].shootdelay = (enemyB[h].shootdelay - 1);
};
} else {
if (enemyB[h].patrolling == true){
if (enemyB[h].movedirection == 0){
deltahs = (deltahs + (enemyBmoveacceleration * movefactor));
} else {
deltahs = (deltahs - (enemyBmoveacceleration * movefactor));
};
};
};
deltahs2 = 0;
if (enemyB[h].slow > 0){
if (deltahs > 0){
deltahs2 = -(enemyB[h].slow);
};
if (deltahs < 0){
deltahs2 = enemyB[h].slow;
};
enemyB[h].slow = 0;
};
if (enemyB[h].framedelay > 0){
bodyC[enemyB[h].bodynum].frame = 3;
enemyB[h].framedelay = (enemyB[h].framedelay - 1);
};
temporaryhs = (p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].x - p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].lx);
if (Math.abs(((temporaryhs + deltahs) + deltahs2)) < maxmovespeed){
p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].x = ((p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].x + deltahs) + deltahs2);
p[objectline[enemyB[h].objectlinenum].firstpnum].x = ((p[objectline[enemyB[h].objectlinenum].firstpnum].x + deltahs) + deltahs2);
} else {
if (Math.abs(temporaryhs) < maxmovespeed){
if (temporaryhs > 0){
p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].x = (p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].lx + maxmovespeed);
p[objectline[enemyB[h].objectlinenum].firstpnum].x = (p[objectline[enemyB[h].objectlinenum].firstpnum].lx + maxmovespeed);
} else {
p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].x = (p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].lx - maxmovespeed);
p[objectline[enemyB[h].objectlinenum].firstpnum].x = (p[objectline[enemyB[h].objectlinenum].firstpnum].lx - maxmovespeed);
};
};
};
p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].y = (p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].y + deltavs);
p[objectline[enemyB[h].objectlinenum].firstpnum].y = (p[objectline[enemyB[h].objectlinenum].firstpnum].y + deltavs);
temporaryhs = Math.abs((p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].x - p[(objectline[enemyB[h].objectlinenum].firstpnum + 1)].lx));
if (deltahs > 0){
enemyB[h].movedirection = 0;
};
if (deltahs < 0){
enemyB[h].movedirection = 1;
};
legC[enemyB[h].firstlegnum].framerate = 1;
if (deltahs == 0){
if (enemyB[h].movedirection == 0){
if (legC[enemyB[h].firstlegnum].frame == 4){
legC[enemyB[h].firstlegnum].framerate = 0;
};
} else {
if (legC[enemyB[h].firstlegnum].frame == 14){
legC[enemyB[h].firstlegnum].framerate = 0;
};
};
} else {
if (foundplayer == false){
bodyC[enemyB[h].bodynum].frame = 1;
};
};
if (movefactor == enemyBaircontrolfactor){
legC[enemyB[h].firstlegnum].framerate = 0;
};
if (enemyB[h].kamikaze == true){
bodyC[enemyB[h].bodynum].frame = 4;
};
if (enemyB[h].movedirection == 0){
bodyC[enemyB[h].bodynum].scaleX = 1;
legC[enemyB[h].firstlegnum].scaleX = 1;
legC[(enemyB[h].firstlegnum + 1)].scaleX = 1;
} else {
bodyC[enemyB[h].bodynum].scaleX = -1;
legC[enemyB[h].firstlegnum].scaleX = -1;
legC[(enemyB[h].firstlegnum + 1)].scaleX = -1;
};
legC[(enemyB[h].firstlegnum + 1)].frame = (legC[enemyB[h].firstlegnum].frame + 11);
enemyB[h].y = (p[objectline[enemyB[h].objectlinenum].firstpnum].y - groundoffset);
enemyB[h].x = p[objectline[enemyB[h].objectlinenum].firstpnum].x;
legsoffset = ((ragdollheight * 2) - (upperleglength + lowerleglength));
legC[enemyB[h].firstlegnum].x = (enemyB[h].x - (chestlength * 0.5));
legC[enemyB[h].firstlegnum].y = (enemyB[h].y + legsoffset);
legC[(enemyB[h].firstlegnum + 1)].x = (enemyB[h].x + (chestlength * 0.5));
legC[(enemyB[h].firstlegnum + 1)].y = (enemyB[h].y + legsoffset);
bodyC[enemyB[h].bodynum].y = (enemyB[h].y + legsoffset);
bodyC[enemyB[h].bodynum].x = enemyB[h].x;
} else {
objectline[enemyB[h].objectlinenum].active = false;
legC[enemyB[h].firstlegnum].active = false;
legC[(enemyB[h].firstlegnum + 1)].active = false;
bodyC[enemyB[h].bodynum].active = false;
};
h = (h + 1);
};
h = 0;
while (h < enemyCs) {
if (enemyC[h].active == true){
deltahs = 0;
deltavs = 0;
maxmovespeed = enemyCmaxmovespeed;
movefactor = enemyCaircontrolfactor;
d = 0;
while (d < waterpools) {
if ((((((((p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].x > waterpool[d].x)) && ((p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].x < (waterpool[d].x + waterpool[d].xwidth))))) && ((p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].y > waterpool[d].y)))) && ((p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].y < (waterpool[d].y + waterpool[d].depth))))){
movefactor = enemyCwatercontrolfactor;
};
d = (d + 1);
};
groundoffset = 0;
if (segmentcollide(p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].x, p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].y, p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].x, (p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].y + 2)) == true){
movefactor = 1;
groundoffset = (p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].y - bestcy);
};
if (player[0].active == true){
if ((((approxdistance(enemyC[h].x, enemyC[h].y, player[0].x, player[0].y) < enemyCseedistance)) && ((approxdistance(enemyC[h].x, enemyC[h].y, player[0].x, player[0].y) > 0)))){
foundplayer = true;
enemyC[h].hastarget = true;
enemyC[h].patrolling = false;
enemyC[h].targetx = player[0].x;
enemyC[h].targety = player[0].y;
} else {
foundplayer = false;
};
} else {
foundplayer = false;
enemyC[h].hastarget = false;
enemyC[h].patrolling = false;
};
bodyD[enemyC[h].bodynum].frame = 0;
if (foundplayer == true){
bodyD[enemyC[h].bodynum].frame = 2;
};
if (enemyC[h].hastarget == true){
if (player[0].active == false){
enemyC[h].hastarget = false;
};
if (enemyC[h].x > enemyC[h].targetx){
if ((((enemyC[h].movedelay == 0)) || ((enemyC[h].movedirection == 1)))){
deltahs = (deltahs - (enemyCmoveacceleration * movefactor));
enemyC[h].movedelay = (enemyCmovedelay + Math.round(((Math.random() * enemyCmovedelay) * 0.5)));
enemyC[h].movedirection = 1;
};
} else {
if ((((enemyC[h].movedelay == 0)) || ((enemyC[h].movedirection == 0)))){
deltahs = (deltahs + (enemyCmoveacceleration * movefactor));
enemyC[h].movedelay = (enemyCmovedelay + Math.round(((Math.random() * enemyCmovedelay) * 0.5)));
enemyC[h].movedirection = 0;
};
};
if (enemyC[h].movedelay > 0){
enemyC[h].movedelay = (enemyC[h].movedelay - 1);
};
if (enemyC[h].movedelay == 0){
if (foundplayer == false){
enemyC[h].hastarget = false;
};
};
if (approxdistance(enemyC[h].x, enemyC[h].y, enemyC[h].targetx, enemyC[h].targety) < (enemyCshootdistance * 1.5)){
if (Math.abs((enemyC[h].x - enemyC[h].targetx)) < (enemyCshootdistance * 0.71)){
if ((((((enemyC[h].x > enemyC[h].targetx)) && ((enemyC[h].movedirection == 1)))) || ((((enemyC[h].x < enemyC[h].targetx)) && ((enemyC[h].movedirection == 0)))))){
if (enemyC[h].shootdelay == 0){
bodyD[enemyC[h].bodynum].frame = 3;
enemyC[h].framedelay = (enemyCshootdelay * 0.5);
enemyC[h].shootdelay = enemyCshootdelay;
createbullet(enemyC[h].x, (enemyC[h].y + 12), (((enemyC[h].movedirection * 180) + (Math.random() * enemyCinaccuracy)) - (enemyCinaccuracy * 0.5)), enemyCshootdistance, enemyCdamage, enemyside, 0xFFFFFF, 0, false);
};
};
};
};
if (enemyC[h].shootdelay > 0){
enemyC[h].shootdelay = (enemyC[h].shootdelay - 1);
};
} else {
if (enemyC[h].patrolling == true){
if (enemyC[h].movedirection == 0){
deltahs = (deltahs + (enemyCmoveacceleration * movefactor));
} else {
deltahs = (deltahs - (enemyCmoveacceleration * movefactor));
};
};
};
deltahs2 = 0;
if (enemyC[h].slow > 0){
if (deltahs > 0){
deltahs2 = -(enemyC[h].slow);
};
if (deltahs < 0){
deltahs2 = enemyC[h].slow;
};
enemyC[h].slow = 0;
};
if (enemyC[h].framedelay > 0){
bodyD[enemyC[h].bodynum].frame = 3;
enemyC[h].framedelay = (enemyC[h].framedelay - 1);
};
temporaryhs = (p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].x - p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].lx);
if (Math.abs(((temporaryhs + deltahs) + deltahs2)) < maxmovespeed){
p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].x = ((p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].x + deltahs) + deltahs2);
p[objectline[enemyC[h].objectlinenum].firstpnum].x = ((p[objectline[enemyC[h].objectlinenum].firstpnum].x + deltahs) + deltahs2);
} else {
if (Math.abs(temporaryhs) < maxmovespeed){
if (temporaryhs > 0){
p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].x = (p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].lx + maxmovespeed);
p[objectline[enemyC[h].objectlinenum].firstpnum].x = (p[objectline[enemyC[h].objectlinenum].firstpnum].lx + maxmovespeed);
} else {
p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].x = (p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].lx - maxmovespeed);
p[objectline[enemyC[h].objectlinenum].firstpnum].x = (p[objectline[enemyC[h].objectlinenum].firstpnum].lx - maxmovespeed);
};
};
};
p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].y = (p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].y + deltavs);
p[objectline[enemyC[h].objectlinenum].firstpnum].y = (p[objectline[enemyC[h].objectlinenum].firstpnum].y + deltavs);
temporaryhs = Math.abs((p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].x - p[(objectline[enemyC[h].objectlinenum].firstpnum + 1)].lx));
if (deltahs > 0){
enemyC[h].movedirection = 0;
};
if (deltahs < 0){
enemyC[h].movedirection = 1;
};
legD[enemyC[h].firstlegnum].framerate = 1;
if (deltahs == 0){
if (enemyC[h].movedirection == 0){
if (legD[enemyC[h].firstlegnum].frame == 4){
legD[enemyC[h].firstlegnum].framerate = 0;
};
} else {
if (legD[enemyC[h].firstlegnum].frame == 14){
legD[enemyC[h].firstlegnum].framerate = 0;
};
};
} else {
if (foundplayer == false){
bodyD[enemyC[h].bodynum].frame = 1;
};
};
if (movefactor == enemyCaircontrolfactor){
legD[enemyC[h].firstlegnum].framerate = 0;
};
if (enemyC[h].movedirection == 0){
bodyD[enemyC[h].bodynum].scaleX = 1;
legD[enemyC[h].firstlegnum].scaleX = 1;
legD[(enemyC[h].firstlegnum + 1)].scaleX = 1;
} else {
bodyD[enemyC[h].bodynum].scaleX = -1;
legD[enemyC[h].firstlegnum].scaleX = -1;
legD[(enemyC[h].firstlegnum + 1)].scaleX = -1;
};
legD[(enemyC[h].firstlegnum + 1)].frame = (legD[enemyC[h].firstlegnum].frame + 11);
enemyC[h].y = (p[objectline[enemyC[h].objectlinenum].firstpnum].y - groundoffset);
enemyC[h].x = p[objectline[enemyC[h].objectlinenum].firstpnum].x;
legsoffset = ((ragdollheight * 2) - (upperleglength + lowerleglength));
legD[enemyC[h].firstlegnum].x = (enemyC[h].x - (chestlength * 0.5));
legD[enemyC[h].firstlegnum].y = (enemyC[h].y + legsoffset);
legD[(enemyC[h].firstlegnum + 1)].x = (enemyC[h].x + (chestlength * 0.5));
legD[(enemyC[h].firstlegnum + 1)].y = (enemyC[h].y + legsoffset);
bodyD[enemyC[h].bodynum].y = (enemyC[h].y + legsoffset);
bodyD[enemyC[h].bodynum].x = enemyC[h].x;
} else {
objectline[enemyC[h].objectlinenum].active = false;
legD[enemyC[h].firstlegnum].active = false;
legD[(enemyC[h].firstlegnum + 1)].active = false;
bodyD[enemyC[h].bodynum].active = false;
};
h = (h + 1);
};
h = 0;
while (h < turretbases) {
if (turretbase[h].active == true){
if (approxdistance(turretbase[h].x, turretbase[h].y, player[0].x, (player[0].y + ragdollheight)) < turretseedistance){
if ((((segmentcollide(turretbase[h].x, turretbase[h].y, player[0].x, (player[0].y + ragdollheight)) == false)) && ((player[0].active == true)))){
turretbase[h].targetdirection = directiontopoint(turretbase[h].x, turretbase[h].y, player[0].x, (player[0].y + ragdollheight));
if (Math.abs(finddirection(turretbase[h].targetdirection, turretbase[h].restdirection)) < turretmaxswivel){
turretbase[h].hastarget = true;
} else {
turretbase[h].hastarget = false;
turretbase[h].targetdirection = turretbase[h].restdirection;
};
} else {
turretbase[h].targetdirection = turretbase[h].restdirection;
turretbase[h].hastarget = false;
};
} else {
turretbase[h].targetdirection = turretbase[h].restdirection;
turretbase[h].hastarget = false;
};
if (turretbase[h].pointdirection != turretbase[h].targetdirection){
if (Math.abs(finddirection(turretbase[h].pointdirection, turretbase[h].targetdirection)) <= turretrotatespeed){
turretbase[h].pointdirection = turretbase[h].targetdirection;
} else {
if (finddirection(turretbase[h].pointdirection, turretbase[h].targetdirection) > 0){
turretbase[h].pointdirection = (turretbase[h].pointdirection - turretrotatespeed);
} else {
turretbase[h].pointdirection = (turretbase[h].pointdirection + turretrotatespeed);
};
};
};
if (turretbase[h].hastarget == true){
turretbase[h].gotoAndPlay(1);
if (turretbase[h].pointdirection == turretbase[h].targetdirection){
if (turretbase[h].shootdelay == 0){
turretmuzzleflash((turretbase[h].x + vectorx(turretbase[h].pointdirection, (turretbarreldistance + turretflashdistance))), (turretbase[h].y + vectory(turretbase[h].pointdirection, (turretbarreldistance + turretflashdistance))), turretbase[h].pointdirection);
if (createbullet((turretbase[h].x + vectorx(turretbase[h].pointdirection, turretbarreldistance)), (turretbase[h].y + vectory(turretbase[h].pointdirection, turretbarreldistance)), ((turretbase[h].pointdirection + (Math.random() * turretinaccuracy)) - (turretinaccuracy * 0.5)), turretshootdistance, turretdamage, turretside, turrettracercolor, turrettraceralpha, false) == true){
turretimpact(impactx, impacty);
};
turretbase[h].shootdelay = turretshootdelay;
} else {
turretbase[h].shootdelay = (turretbase[h].shootdelay - 1);
};
};
} else {
turretbase[h].gotoAndPlay(2);
};
turretbarrel[turretbase[h].barrelnum].rotation = -(turretbase[h].pointdirection);
} else {
if (turretbase[h].parent != null){
turretbase[h].parent.removeChild(turretbase[h]);
};
if (turretbarrel[turretbase[h].barrelnum].parent != null){
turretbarrel[turretbase[h].barrelnum].parent.removeChild(turretbarrel[turretbase[h].barrelnum]);
};
};
h = (h + 1);
};
h = 0;
while (h < megazombies) {
if (megazombie[h].active == true){
megazombiegun[h].x = (megazombie[h].x + 20);
megazombiegun[h].y = (megazombie[h].y + 10);
if (megazombie[h].cx < 100){
megazombie[h].cx = 100;
};
if (megazombie[h].cx > 500){
megazombie[h].cx = 500;
};
if (player[0].active == true){
if (megazombie[h].woundtimer <= 0){
if (Math.abs((megazombie[h].cx - player[0].x)) > 0.5){
if (megazombie[h].cx < player[0].x){
megazombie[h].cx = (megazombie[h].cx + 0.5);
} else {
megazombie[h].cx = (megazombie[h].cx - 0.5);
};
} else {
megazombie[h].cx = player[0].x;
};
};
if ((((megazombie[h].woundtimer <= 0)) && ((megazombie[h].recovertimer <= 0)))){
if (Math.abs((megazombie[h].cy - (player[0].y - 60))) > 0.5){
if ((megazombie[h].cy - (player[0].y - 60)) < 0){
megazombie[h].cy = (megazombie[h].cy + 0.5);
} else {
megazombie[h].cy = (megazombie[h].cy - 0.5);
};
} else {
megazombie[h].cy = (player[0].y - 60);
};
};
if (megazombie[h].woundtimer > 0){
if (Math.abs((megazombie[h].cy - (player[0].y - 30))) > 1){
if ((megazombie[h].cy - (player[0].y - 30)) < 0){
megazombie[h].cy = (megazombie[h].cy + 1);
} else {
megazombie[h].cy = (megazombie[h].cy - 1);
};
} else {
megazombie[h].cy = (player[0].y - 30);
};
};
if ((((megazombie[h].woundtimer <= 0)) && ((megazombie[h].recovertimer > 0)))){
if (Math.abs((megazombie[h].cy - (player[0].y - 90))) > 1.5){
if ((megazombie[h].cy - (player[0].y - 90)) < 0){
megazombie[h].cy = (megazombie[h].cy + 1.5);
} else {
megazombie[h].cy = (megazombie[h].cy - 1.5);
};
} else {
megazombie[h].cy = (player[0].y - 90);
};
};
};
megazombie[h].x = megazombie[h].cx;
megazombie[h].y = megazombie[h].cy;
if (megazombie[h].sounddelay > 0){
megazombie[h].sounddelay = (megazombie[h].sounddelay - 1);
};
if ((((megazombie[h].woundtimer <= 0)) && ((megazombie[h].recovertimer <= 0)))){
if ((((((Math.abs(((megazombie[h].x + megazombie[h].movex) - player[0].x)) < 25)) && ((Math.abs(((megazombie[h].y + megazombie[h].movey) - player[0].y)) < 125)))) && ((player[0].active == true)))){
if (megazombie[h].sounddelay <= 0){
megazombieexhaust.play();
megazombie[h].sounddelay = 90;
};
if (Math.floor((Math.random() * 2)) == 0){
megazombiefireexhaustparticles((megazombie[h].x + megazombie[h].movex), ((megazombie[h].y + megazombie[h].movey) + 63));
};
player[0].damage = (player[0].damage + megazombiedamage);
if (((megazombie[h].x + megazombie[h].movex) - player[0].x) > 0){
physicspush((megazombie[h].x + megazombie[h].movex), ((megazombie[h].y + megazombie[h].movey) + 85), 25, 225, 0.5);
} else {
physicspush((megazombie[h].x + megazombie[h].movex), ((megazombie[h].y + megazombie[h].movey) + 85), 25, 315, 0.5);
};
} else {
if (Math.floor((Math.random() * 2)) == 0){
megazombieexhaustparticles((megazombie[h].x + megazombie[h].movex), ((megazombie[h].y + megazombie[h].movey) + 63));
};
};
} else {
if (megazombie[h].woundtimer <= 0){
if (Math.floor((Math.random() * 2)) == 0){
megazombiefireexhaustparticles((megazombie[h].x + megazombie[h].movex), ((megazombie[h].y + megazombie[h].movey) + 63));
};
} else {
if (Math.floor((Math.random() * 4)) == 0){
megazombieexhaustparticles((megazombie[h].x + megazombie[h].movex), ((megazombie[h].y + megazombie[h].movey) + 63));
};
};
};
if (approxdistance(megazombie[h].movex, megazombie[h].movey, megazombie[h].movetargetx, megazombie[h].movetargety) > 0.5){
megazombie[h].movex = (megazombie[h].movex + vectorx2(megazombie[h].movedirection, 0.5));
megazombie[h].movey = (megazombie[h].movey + vectory2(megazombie[h].movedirection, 0.5));
megazombie[h].stucktimer = (megazombie[h].stucktimer + 1);
} else {
megazombie[h].movetargetx = ((Math.random() * 30) - 15);
megazombie[h].movetargety = ((Math.random() * 30) - 15);
megazombie[h].stucktimer = 0;
};
if (megazombie[h].stucktimer >= 80){
megazombie[h].movetargetx = ((Math.random() * 30) - 15);
megazombie[h].movetargety = ((Math.random() * 30) - 15);
megazombie[h].stucktimer = 0;
};
temptargetdirection = directiontopoint(megazombie[h].movex, megazombie[h].movey, megazombie[h].movetargetx, megazombie[h].movetargety);
if (finddirection(megazombie[h].movedirection, temptargetdirection) > 0){
if (Math.abs((megazombie[h].movedirection - temptargetdirection)) > 6){
megazombie[h].movedirection = (megazombie[h].movedirection - 6);
} else {
megazombie[h].movedirection = temptargetdirection;
};
} else {
if (Math.abs((megazombie[h].movedirection - temptargetdirection)) > 6){
megazombie[h].movedirection = (megazombie[h].movedirection + 6);
} else {
megazombie[h].movedirection = temptargetdirection;
};
};
if ((((megazombie[h].woundtimer <= 0)) && ((megazombie[h].recovertimer <= 0)))){
megazombie[h].hastarget = true;
if (approxdistance(megazombie[h].x, megazombie[h].y, player[0].x, (player[0].y + ragdollheight)) < megazombieseedistance){
if ((((segmentcollide(megazombie[h].x, megazombie[h].y, player[0].x, (player[0].y + ragdollheight)) == false)) && ((player[0].active == true)))){
megazombie[h].targetdirection = directiontopoint(megazombie[h].x, megazombie[h].y, player[0].x, (player[0].y + ragdollheight));
} else {
megazombie[h].targetdirection = megazombie[h].restdirection;
megazombie[h].hastarget = false;
};
} else {
megazombie[h].targetdirection = megazombie[h].restdirection;
megazombie[h].hastarget = false;
};
if (megazombie[h].pointdirection != megazombie[h].targetdirection){
if (Math.abs(finddirection(megazombie[h].pointdirection, megazombie[h].targetdirection)) <= megazombierotatespeed){
megazombie[h].pointdirection = megazombie[h].targetdirection;
} else {
if (finddirection(megazombie[h].pointdirection, megazombie[h].targetdirection) > 0){
megazombie[h].pointdirection = (megazombie[h].pointdirection - megazombierotatespeed);
} else {
megazombie[h].pointdirection = (megazombie[h].pointdirection + megazombierotatespeed);
};
};
};
if (megazombie[h].hastarget == true){
if (megazombie[h].pointdirection == megazombie[h].targetdirection){
if (megazombie[h].shootdelay == 0){
megazombie[h].shots = (megazombie[h].shots + 1);
createlaser((megazombiegun[h].x + vectorx(megazombie[h].pointdirection, megazombiegundistance)), (megazombiegun[h].y + vectory(megazombie[h].pointdirection, megazombiegundistance)), ((megazombie[h].pointdirection + (Math.random() * megazombieinaccuracy)) - (megazombieinaccuracy * 0.5)), enemyside);
lasermuzzleflash((megazombiegun[h].x + vectorx(megazombie[h].pointdirection, (megazombiegundistance + megazombieflashdistance))), (megazombiegun[h].y + vectory(megazombie[h].pointdirection, (megazombiegundistance + megazombieflashdistance))), megazombie[h].pointdirection);
megazombie[h].shootdelay = megazombieshootdelay;
} else {
megazombie[h].shootdelay = (megazombie[h].shootdelay - 1);
};
};
};
};
if (megazombie[h].recovertimer > 0){
megazombie[h].recovertimer = (megazombie[h].recovertimer - 1);
};
if (megazombie[h].woundtimer > 0){
megazombie[h].woundtimer = (megazombie[h].woundtimer - 1);
megazombie[h].gotoAndPlay(2);
if (Math.floor((Math.random() * 5)) == 0){
blooddrip((megazombie[h].x + megazombie[h].movex), ((megazombie[h].y + megazombie[h].movey) + 10));
};
} else {
megazombie[h].gotoAndPlay(1);
};
if (megazombie[h].shots >= megazombiemaxshots){
megazombie[h].shots = 0;
megazombie[h].shootdelay = 50;
};
megazombiegun[megazombie[h].barrelnum].rotation = -(megazombie[h].pointdirection);
megazombie[h].x = (megazombie[h].x + megazombie[h].movex);
megazombie[h].y = (megazombie[h].y + megazombie[h].movey);
} else {
loopchannel2.stop();
if (megazombie[h].parent != null){
megazombie[h].parent.removeChild(megazombie[h]);
};
if (megazombiegun[megazombie[h].barrelnum].parent != null){
megazombiegun[megazombie[h].barrelnum].parent.removeChild(megazombiegun[megazombie[h].barrelnum]);
};
};
h = (h + 1);
};
currenths = 0;
currentvs = 0;
lasths = 0;
lastvs = 0;
h = 0;
while (h < chaindebriss) {
if (chaindebris[h].active == true){
chaindebris[h].livetime = (chaindebris[h].livetime + 1);
if (chaindebris[h].livetime > (chaindebrislivetime - chaindebrisfadetime)){
chaindebris[h].alpha = ((chaindebrislivetime - chaindebris[h].livetime) / chaindebrisfadetime);
};
if (chaindebris[h].livetime > chaindebrislivetime){
chaindebris[h].active = false;
};
d = 0;
while (d < (rope[chaindebris[h].ropenum].segments - 1)) {
tempx1 = p[(rope[chaindebris[h].ropenum].firstpnum + d)].x;
tempy1 = p[(rope[chaindebris[h].ropenum].firstpnum + d)].y;
tempx2 = p[((rope[chaindebris[h].ropenum].firstpnum + d) + 1)].x;
tempy2 = p[((rope[chaindebris[h].ropenum].firstpnum + d) + 1)].y;
if (chaindebris[h].frame == 4){
if (Math.floor((Math.random() * 50)) == 0){
blooddrip(((tempx1 + tempx2) * 0.5), ((tempy1 + tempy2) * 0.5));
};
};
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
link[(chaindebris[h].linknum + d)].x = ((tempx1 + tempx2) * 0.5);
link[(chaindebris[h].linknum + d)].y = ((tempy1 + tempy2) * 0.5);
link[(chaindebris[h].linknum + d)].rotation = (270 - temprotation);
link[(chaindebris[h].linknum + d)].alpha = chaindebris[h].alpha;
d = (d + 1);
};
} else {
d = 0;
while (d < (rope[chaindebris[h].ropenum].segments - 1)) {
link[(chaindebris[h].linknum + d)].active = false;
if (link[(chaindebris[h].linknum + d)].parent != null){
link[(chaindebris[h].linknum + d)].parent.removeChild(link[(chaindebris[h].linknum + d)]);
};
d = (d + 1);
};
chaindebris[h].active = false;
rope[chaindebris[h].ropenum].active = false;
};
h = (h + 1);
};
h = 0;
while (h < strings) {
if (string[h].active == true){
vstring[h].visible = true;
string[h].x = rope[string[h].ropenum].x;
string[h].y = rope[string[h].ropenum].y;
_local3 = vstring[h].graphics;
with (_local3) {
vstring[h].x = rope[string[h].ropenum].x;
vstring[h].y = rope[string[h].ropenum].y;
clear();
lineStyle(1, string[h].color, string[h].alpha);
moveTo((p[rope[string[h].ropenum].firstpnum].x - string[h].x), (p[rope[string[h].ropenum].firstpnum].y - string[h].y));
d = rope[string[h].ropenum].firstpnum;
while (d < ((rope[string[h].ropenum].firstpnum + rope[string[h].ropenum].segments) - 1)) {
lineTo((p[(d + 1)].x - string[h].x), (p[(d + 1)].y - string[h].y));
d = (d + 1);
};
};
} else {
if (vstring[h].parent != null){
vstring[h].parent.removeChild(vstring[h]);
};
string[h].active = false;
rope[string[h].ropenum].active = false;
};
h = (h + 1);
};
h = 0;
while (h < pointdebriss) {
if (pointdebris[h].active == true){
pointdebris[h].gotoAndPlay((pointdebris[h].frame + 1));
pointdebris[h].livetime = (pointdebris[h].livetime + 1);
if (pointdebris[h].livetime > (pointdebrislivetime - pointdebrisfadetime)){
pointdebris[h].alpha = ((pointdebrislivetime - pointdebris[h].livetime) / pointdebrisfadetime);
};
if (pointdebris[h].livetime > pointdebrislivetime){
pointdebris[h].active = false;
point[pointdebris[h].pointnum].active = false;
if (pointdebris[h].parent != null){
pointdebris[h].parent.removeChild(pointdebris[h]);
};
};
pointdebris[h].x = p[point[pointdebris[h].pointnum].firstpnum].x;
pointdebris[h].y = p[point[pointdebris[h].pointnum].firstpnum].y;
if (point[pointdebris[h].pointnum].atrest == false){
pointdebris[h].rotation = (pointdebris[h].rotation + pointdebris[h].rotatespeed);
if ((((pointdebris[h].frame >= 3)) && ((pointdebris[h].frame <= 8)))){
if (Math.floor((Math.random() * 12)) == 0){
blooddrip(pointdebris[h].x, pointdebris[h].y);
};
};
if (pointdebris[h].frame == 9){
if (Math.floor((Math.random() * 8)) == 0){
debrisspark(pointdebris[h].x, pointdebris[h].y);
};
};
};
};
h = (h + 1);
};
h = 0;
while (h < linedebriss) {
if (linedebris[h].active == true){
linedebris[h].gotoAndPlay((linedebris[h].frame + 1));
linedebris[h].livetime = (linedebris[h].livetime + 1);
if (linedebris[h].livetime > (linedebrislivetime - linedebrisfadetime)){
linedebris[h].alpha = ((linedebrislivetime - linedebris[h].livetime) / linedebrisfadetime);
};
if (linedebris[h].livetime > linedebrislivetime){
linedebris[h].active = false;
line[linedebris[h].linenum].active = false;
if (linedebris[h].parent != null){
linedebris[h].parent.removeChild(linedebris[h]);
};
};
tempx1 = p[line[linedebris[h].linenum].firstpnum].x;
tempy1 = p[line[linedebris[h].linenum].firstpnum].y;
tempx2 = p[(line[linedebris[h].linenum].firstpnum + 1)].x;
tempy2 = p[(line[linedebris[h].linenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
linedebris[h].x = ((tempx1 + tempx2) * 0.5);
linedebris[h].y = ((tempy1 + tempy2) * 0.5);
linedebris[h].rotation = -(temprotation);
};
h = (h + 1);
};
h = 0;
while (h < boxdebriss) {
if (boxdebris[h].active == true){
boxdebris[h].gotoAndPlay((boxdebris[h].frame + 1));
boxdebris[h].livetime = (boxdebris[h].livetime + 1);
if (boxdebris[h].livetime > (boxdebrislivetime - boxdebrisfadetime)){
boxdebris[h].alpha = ((boxdebrislivetime - boxdebris[h].livetime) / boxdebrisfadetime);
};
if (boxdebris[h].livetime > boxdebrislivetime){
boxdebris[h].active = false;
box[boxdebris[h].boxnum].active = false;
if (boxdebris[h].parent != null){
boxdebris[h].parent.removeChild(boxdebris[h]);
};
};
tempx1 = p[box[boxdebris[h].boxnum].firstpnum].x;
tempy1 = p[box[boxdebris[h].boxnum].firstpnum].y;
tempx2 = p[(box[boxdebris[h].boxnum].firstpnum + 2)].x;
tempy2 = p[(box[boxdebris[h].boxnum].firstpnum + 2)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
boxdebris[h].x = ((tempx1 + tempx2) * 0.5);
boxdebris[h].y = ((tempy1 + tempy2) * 0.5);
boxdebris[h].rotation = (315 - temprotation);
};
h = (h + 1);
};
h = 0;
while (h < corpses) {
if (corpse[h].active == true){
if (corpse[h].fade == true){
corpse[h].livetime = (corpse[h].livetime + 1);
if (corpse[h].livetime > (corpselivetime - corpsefadetime)){
corpse[h].alpha = ((corpselivetime - corpse[h].livetime) / corpsefadetime);
};
if (corpse[h].livetime > corpselivetime){
corpse[h].active = false;
};
};
lasths = (corpse[h].x - corpse[h].lastx);
lastvs = (corpse[h].y - corpse[h].lasty);
corpse[h].lasty = corpse[h].y;
corpse[h].lastx = corpse[h].x;
corpse[h].y = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 1)].y;
corpse[h].x = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 1)].x;
currenths = (corpse[h].x - corpse[h].lastx);
currentvs = (corpse[h].y - corpse[h].lasty);
if (corpse[h].bloodtimer > 0){
corpse[h].bloodtimer = (corpse[h].bloodtimer - 1);
} else {
if (corpse[h].livetime > 5){
if (approxdistance(0, 0, (currenths - lasths), (currentvs - lastvs)) > 3){
corpse[h].bloodtimer = 20;
squish.play();
tempx1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 2)].x;
tempy1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 2)].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 3)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 3)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
bloodspray((((tempx1 + tempx2) * 0.5) + vectorx(correctdirection((temprotation + 90)), 2)), (((tempy1 + tempy2) * 0.5) + vectory(correctdirection((temprotation + 90)), 2)), 2);
};
};
};
if (ragdoll[corpse[h].ragdollnum].deformed == true){
tempx1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 2)].x;
tempy1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 2)].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 3)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 3)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
bloodspray((((tempx1 + tempx2) * 0.5) + vectorx(correctdirection((temprotation + 90)), 2)), (((tempy1 + tempy2) * 0.5) + vectory(correctdirection((temprotation + 90)), 2)), maxbloodps);
createchaindebris((((((tempx1 + tempx2) * 0.5) + vectorx(correctdirection((temprotation + 90)), 2)) + Math.random()) - 0.5), (((((tempy1 + tempy2) * 0.5) + vectory(correctdirection((temprotation + 90)), 2)) + Math.random()) - 0.5), 4);
d = 0;
while (d < corpsegibs) {
createpointdebris((((((tempx1 + tempx2) * 0.5) + vectorx(correctdirection((temprotation + 90)), 2)) + Math.random()) - 0.5), (((((tempy1 + tempy2) * 0.5) + vectory(correctdirection((temprotation + 90)), 2)) + Math.random()) - 0.5), (3 + Math.floor((Math.random() * 6))));
d = (d + 1);
};
physicsexplosion((((tempx1 + tempx2) * 0.5) + vectorx(correctdirection((temprotation + 90)), 2)), (((tempy1 + tempy2) * 0.5) + vectory((correctdirection((temprotation + 90)) + 0.5), 2)), 2, 4);
corpse[h].active = false;
};
tempx1 = p[ragdoll[corpse[h].ragdollnum].firstpnum].x;
tempy1 = p[ragdoll[corpse[h].ragdollnum].firstpnum].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 1)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
head[corpse[h].headnum].x = ((tempx1 + tempx2) * 0.5);
head[corpse[h].headnum].y = ((tempy1 + tempy2) * 0.5);
head[corpse[h].headnum].rotation = (270 - temprotation);
head[corpse[h].headnum].alpha = corpse[h].alpha;
tempx1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 2)].x;
tempy1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 2)].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 3)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 3)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
torso[corpse[h].torsonum].x = (((tempx1 + tempx2) * 0.5) + vectorx(correctdirection((temprotation + 90)), 2));
torso[corpse[h].torsonum].y = (((tempy1 + tempy2) * 0.5) + vectory(correctdirection((temprotation + 90)), 2));
torso[corpse[h].torsonum].rotation = (180 - temprotation);
torso[corpse[h].torsonum].alpha = corpse[h].alpha;
if (corpse[h].leftarmsegments > 0){
tempx1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 3)].x;
tempy1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 3)].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 11)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 11)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
upperarm[corpse[h].firstupperarmnum].x = ((tempx1 + tempx2) * 0.5);
upperarm[corpse[h].firstupperarmnum].y = ((tempy1 + tempy2) * 0.5);
upperarm[corpse[h].firstupperarmnum].rotation = (270 - temprotation);
upperarm[corpse[h].firstupperarmnum].alpha = corpse[h].alpha;
} else {
upperarm[corpse[h].firstupperarmnum].active = false;
};
if (corpse[h].rightarmsegments > 0){
tempx1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 2)].x;
tempy1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 2)].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 10)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 10)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
upperarm[(corpse[h].firstupperarmnum + 1)].x = ((tempx1 + tempx2) * 0.5);
upperarm[(corpse[h].firstupperarmnum + 1)].y = ((tempy1 + tempy2) * 0.5);
upperarm[(corpse[h].firstupperarmnum + 1)].rotation = (270 - temprotation);
upperarm[(corpse[h].firstupperarmnum + 1)].alpha = corpse[h].alpha;
} else {
upperarm[(corpse[h].firstupperarmnum + 1)].active = false;
};
if (corpse[h].leftarmsegments > 1){
tempx1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 11)].x;
tempy1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 11)].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 13)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 13)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
lowerarm[corpse[h].firstlowerarmnum].x = ((tempx1 + tempx2) * 0.5);
lowerarm[corpse[h].firstlowerarmnum].y = ((tempy1 + tempy2) * 0.5);
lowerarm[corpse[h].firstlowerarmnum].rotation = (270 - temprotation);
lowerarm[corpse[h].firstlowerarmnum].alpha = corpse[h].alpha;
} else {
lowerarm[corpse[h].firstlowerarmnum].active = false;
};
if (corpse[h].rightarmsegments > 1){
tempx1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 10)].x;
tempy1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 10)].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 12)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 12)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
lowerarm[(corpse[h].firstlowerarmnum + 1)].x = ((tempx1 + tempx2) * 0.5);
lowerarm[(corpse[h].firstlowerarmnum + 1)].y = ((tempy1 + tempy2) * 0.5);
lowerarm[(corpse[h].firstlowerarmnum + 1)].rotation = (270 - temprotation);
lowerarm[(corpse[h].firstlowerarmnum + 1)].alpha = corpse[h].alpha;
} else {
lowerarm[(corpse[h].firstlowerarmnum + 1)].active = false;
};
if (corpse[h].leftlegsegments > 0){
tempx1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 5)].x;
tempy1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 5)].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 7)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 7)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
upperleg[corpse[h].firstupperlegnum].x = ((tempx1 + tempx2) * 0.5);
upperleg[corpse[h].firstupperlegnum].y = ((tempy1 + tempy2) * 0.5);
upperleg[corpse[h].firstupperlegnum].rotation = (270 - temprotation);
upperleg[corpse[h].firstupperlegnum].alpha = corpse[h].alpha;
} else {
upperleg[corpse[h].firstupperlegnum].active = false;
};
if (corpse[h].rightlegsegments > 0){
tempx1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 4)].x;
tempy1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 4)].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 6)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 6)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
upperleg[(corpse[h].firstupperlegnum + 1)].x = ((tempx1 + tempx2) * 0.5);
upperleg[(corpse[h].firstupperlegnum + 1)].y = ((tempy1 + tempy2) * 0.5);
upperleg[(corpse[h].firstupperlegnum + 1)].rotation = (270 - temprotation);
upperleg[(corpse[h].firstupperlegnum + 1)].alpha = corpse[h].alpha;
} else {
upperleg[(corpse[h].firstupperlegnum + 1)].active = false;
};
if (corpse[h].leftlegsegments > 1){
tempx1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 7)].x;
tempy1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 7)].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 9)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 9)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
lowerleg[corpse[h].firstlowerlegnum].x = ((tempx1 + tempx2) * 0.5);
lowerleg[corpse[h].firstlowerlegnum].y = ((tempy1 + tempy2) * 0.5);
lowerleg[corpse[h].firstlowerlegnum].rotation = (270 - temprotation);
lowerleg[corpse[h].firstlowerlegnum].alpha = corpse[h].alpha;
} else {
lowerleg[corpse[h].firstlowerlegnum].active = false;
};
if (corpse[h].rightlegsegments > 1){
tempx1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 6)].x;
tempy1 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 6)].y;
tempx2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 8)].x;
tempy2 = p[(ragdoll[corpse[h].ragdollnum].firstpnum + 8)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
lowerleg[(corpse[h].firstlowerlegnum + 1)].x = ((tempx1 + tempx2) * 0.5);
lowerleg[(corpse[h].firstlowerlegnum + 1)].y = ((tempy1 + tempy2) * 0.5);
lowerleg[(corpse[h].firstlowerlegnum + 1)].rotation = (270 - temprotation);
lowerleg[(corpse[h].firstlowerlegnum + 1)].alpha = corpse[h].alpha;
} else {
lowerleg[(corpse[h].firstlowerlegnum + 1)].active = false;
};
if (corpse[h].leftarmsegments == 1){
if (Math.floor((Math.random() * 12)) == 0){
blooddrip(p[(ragdoll[corpse[h].ragdollnum].firstpnum + 11)].x, p[(ragdoll[corpse[h].ragdollnum].firstpnum + 11)].y);
};
};
if (corpse[h].leftarmsegments == 0){
if (Math.floor((Math.random() * 12)) == 0){
blooddrip(p[(ragdoll[corpse[h].ragdollnum].firstpnum + 3)].x, p[(ragdoll[corpse[h].ragdollnum].firstpnum + 3)].y);
};
};
if (corpse[h].rightarmsegments == 1){
if (Math.floor((Math.random() * 12)) == 0){
blooddrip(p[(ragdoll[corpse[h].ragdollnum].firstpnum + 10)].x, p[(ragdoll[corpse[h].ragdollnum].firstpnum + 10)].y);
};
};
if (corpse[h].rightarmsegments == 0){
if (Math.floor((Math.random() * 12)) == 0){
blooddrip(p[(ragdoll[corpse[h].ragdollnum].firstpnum + 2)].x, p[(ragdoll[corpse[h].ragdollnum].firstpnum + 2)].y);
};
};
if (corpse[h].leftlegsegments == 1){
if (Math.floor((Math.random() * 12)) == 0){
blooddrip(p[(ragdoll[corpse[h].ragdollnum].firstpnum + 7)].x, p[(ragdoll[corpse[h].ragdollnum].firstpnum + 7)].y);
};
};
if (corpse[h].leftlegsegments == 0){
if (Math.floor((Math.random() * 12)) == 0){
blooddrip(p[(ragdoll[corpse[h].ragdollnum].firstpnum + 5)].x, p[(ragdoll[corpse[h].ragdollnum].firstpnum + 5)].y);
};
};
if (corpse[h].rightlegsegments == 1){
if (Math.floor((Math.random() * 12)) == 0){
blooddrip(p[(ragdoll[corpse[h].ragdollnum].firstpnum + 6)].x, p[(ragdoll[corpse[h].ragdollnum].firstpnum + 6)].y);
};
};
if (corpse[h].rightlegsegments == 0){
if (Math.floor((Math.random() * 12)) == 0){
blooddrip(p[(ragdoll[corpse[h].ragdollnum].firstpnum + 4)].x, p[(ragdoll[corpse[h].ragdollnum].firstpnum + 4)].y);
};
};
} else {
ragdoll[corpse[h].ragdollnum].active = false;
head[corpse[h].headnum].active = false;
torso[corpse[h].torsonum].active = false;
upperarm[corpse[h].firstupperarmnum].active = false;
upperarm[(corpse[h].firstupperarmnum + 1)].active = false;
lowerarm[corpse[h].firstlowerarmnum].active = false;
lowerarm[(corpse[h].firstlowerarmnum + 1)].active = false;
upperleg[corpse[h].firstupperlegnum].active = false;
upperleg[(corpse[h].firstupperlegnum + 1)].active = false;
lowerleg[corpse[h].firstlowerlegnum].active = false;
lowerleg[(corpse[h].firstlowerlegnum + 1)].active = false;
};
h = (h + 1);
};
h = 0;
while (h < limbs) {
if (limb[h].active == true){
limb[h].livetime = (limb[h].livetime + 1);
if (limb[h].livetime > (limblivetime - limbfadetime)){
limb[h].alpha = ((limblivetime - limb[h].livetime) / limbfadetime);
};
if (limb[h].livetime > limblivetime){
limb[h].active = false;
if (limb[h].segments == 1){
line[limb[h].linenum].active = false;
};
if (limb[h].segments == 2){
hinge[limb[h].hingenum].active = false;
};
if (limb[h].type == 0){
if (limb[h].segments == 1){
lowerarm[limb[h].firstlowerarmnum].active = false;
};
if (limb[h].segments == 2){
lowerarm[limb[h].firstlowerarmnum].active = false;
upperarm[limb[h].firstupperarmnum].active = false;
};
};
if (limb[h].type == 1){
if (limb[h].segments == 1){
lowerleg[limb[h].firstlowerlegnum].active = false;
};
if (limb[h].segments == 2){
lowerleg[limb[h].firstlowerlegnum].active = false;
upperleg[limb[h].firstupperlegnum].active = false;
};
};
};
if (limb[h].type == 0){
if (limb[h].segments == 1){
tempx1 = p[line[limb[h].linenum].firstpnum].x;
tempy1 = p[line[limb[h].linenum].firstpnum].y;
tempx2 = p[(line[limb[h].linenum].firstpnum + 1)].x;
tempy2 = p[(line[limb[h].linenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
lowerarm[limb[h].firstlowerarmnum].x = ((tempx1 + tempx2) * 0.5);
lowerarm[limb[h].firstlowerarmnum].y = ((tempy1 + tempy2) * 0.5);
lowerarm[limb[h].firstlowerarmnum].rotation = (270 - temprotation);
lowerarm[limb[h].firstlowerarmnum].alpha = limb[h].alpha;
if (limb[h].facedirection == 1){
lowerarm[limb[h].firstlowerarmnum].scaleX = -1;
};
};
if (limb[h].segments == 2){
tempx1 = p[hinge[limb[h].hingenum].firstpnum].x;
tempy1 = p[hinge[limb[h].hingenum].firstpnum].y;
tempx2 = p[(hinge[limb[h].hingenum].firstpnum + 1)].x;
tempy2 = p[(hinge[limb[h].hingenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
upperarm[limb[h].firstupperarmnum].x = ((tempx1 + tempx2) * 0.5);
upperarm[limb[h].firstupperarmnum].y = ((tempy1 + tempy2) * 0.5);
upperarm[limb[h].firstupperarmnum].rotation = (270 - temprotation);
upperarm[limb[h].firstupperarmnum].alpha = limb[h].alpha;
if (limb[h].facedirection == 1){
upperarm[limb[h].firstupperarmnum].scaleX = -1;
};
tempx1 = p[(hinge[limb[h].hingenum].firstpnum + 1)].x;
tempy1 = p[(hinge[limb[h].hingenum].firstpnum + 1)].y;
tempx2 = p[(hinge[limb[h].hingenum].firstpnum + 2)].x;
tempy2 = p[(hinge[limb[h].hingenum].firstpnum + 2)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
lowerarm[limb[h].firstlowerarmnum].x = ((tempx1 + tempx2) * 0.5);
lowerarm[limb[h].firstlowerarmnum].y = ((tempy1 + tempy2) * 0.5);
lowerarm[limb[h].firstlowerarmnum].rotation = (270 - temprotation);
lowerarm[limb[h].firstlowerarmnum].alpha = limb[h].alpha;
if (limb[h].facedirection == 1){
lowerarm[limb[h].firstlowerarmnum].scaleX = -1;
};
};
};
if (limb[h].type == 1){
if (limb[h].segments == 1){
tempx1 = p[line[limb[h].linenum].firstpnum].x;
tempy1 = p[line[limb[h].linenum].firstpnum].y;
tempx2 = p[(line[limb[h].linenum].firstpnum + 1)].x;
tempy2 = p[(line[limb[h].linenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
lowerleg[limb[h].firstlowerlegnum].x = ((tempx1 + tempx2) * 0.5);
lowerleg[limb[h].firstlowerlegnum].y = ((tempy1 + tempy2) * 0.5);
lowerleg[limb[h].firstlowerlegnum].rotation = (270 - temprotation);
lowerleg[limb[h].firstlowerlegnum].alpha = limb[h].alpha;
if (limb[h].facedirection == 1){
lowerleg[limb[h].firstlowerlegnum].scaleX = -1;
};
};
if (limb[h].segments == 2){
tempx1 = p[hinge[limb[h].hingenum].firstpnum].x;
tempy1 = p[hinge[limb[h].hingenum].firstpnum].y;
tempx2 = p[(hinge[limb[h].hingenum].firstpnum + 1)].x;
tempy2 = p[(hinge[limb[h].hingenum].firstpnum + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
upperleg[limb[h].firstupperlegnum].x = ((tempx1 + tempx2) * 0.5);
upperleg[limb[h].firstupperlegnum].y = ((tempy1 + tempy2) * 0.5);
upperleg[limb[h].firstupperlegnum].rotation = (270 - temprotation);
upperleg[limb[h].firstupperlegnum].alpha = limb[h].alpha;
if (limb[h].facedirection == 1){
upperleg[limb[h].firstupperlegnum].scaleX = -1;
};
tempx1 = p[(hinge[limb[h].hingenum].firstpnum + 1)].x;
tempy1 = p[(hinge[limb[h].hingenum].firstpnum + 1)].y;
tempx2 = p[(hinge[limb[h].hingenum].firstpnum + 2)].x;
tempy2 = p[(hinge[limb[h].hingenum].firstpnum + 2)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
lowerleg[limb[h].firstlowerlegnum].x = ((tempx1 + tempx2) * 0.5);
lowerleg[limb[h].firstlowerlegnum].y = ((tempy1 + tempy2) * 0.5);
lowerleg[limb[h].firstlowerlegnum].rotation = (270 - temprotation);
lowerleg[limb[h].firstlowerlegnum].alpha = limb[h].alpha;
if (limb[h].facedirection == 1){
lowerleg[limb[h].firstlowerlegnum].scaleX = -1;
};
};
};
};
h = (h + 1);
};
h = 0;
while (h < bulletcasings) {
if (bulletcasing[h].active == true){
bulletcasing[h].gotoAndPlay((bulletcasing[h].frame + 1));
bulletcasing[h].livetime = (bulletcasing[h].livetime + 1);
if (bulletcasing[h].livetime > (bulletcasinglivetime - bulletcasingfadetime)){
bulletcasing[h].alpha = ((bulletcasinglivetime - bulletcasing[h].livetime) / bulletcasingfadetime);
};
if (bulletcasing[h].livetime > bulletcasinglivetime){
bulletcasing[h].active = false;
point[bulletcasing[h].pointnum].active = false;
if (bulletcasing[h].parent != null){
bulletcasing[h].parent.removeChild(bulletcasing[h]);
};
};
bulletcasing[h].x = p[point[bulletcasing[h].pointnum].firstpnum].x;
bulletcasing[h].y = p[point[bulletcasing[h].pointnum].firstpnum].y;
if (bulletcasing[h].playedsounds < 3){
if (point[bulletcasing[h].pointnum].bouncetype == 1){
randsound = Math.floor((Math.random() * 5));
if (randsound == 0){
shell1.play();
};
if (randsound == 1){
shell2.play();
};
if (randsound == 2){
shell3.play();
};
if (randsound == 3){
shell4.play();
};
if (randsound == 4){
shell5.play();
};
bulletcasing[h].playedsounds = (bulletcasing[h].playedsounds + 1);
};
};
if (point[bulletcasing[h].pointnum].atrest == false){
bulletcasing[h].rotation = (bulletcasing[h].rotation + bulletcasing[h].rotatespeed);
};
};
h = (h + 1);
};
h = 0;
while (h < chains) {
if (chain[h].active == true){
d = 0;
while (d < (rope[chain[h].ropenum].segments - 1)) {
tempx1 = p[(rope[chain[h].ropenum].firstpnum + d)].x;
tempy1 = p[(rope[chain[h].ropenum].firstpnum + d)].y;
tempx2 = p[((rope[chain[h].ropenum].firstpnum + d) + 1)].x;
tempy2 = p[((rope[chain[h].ropenum].firstpnum + d) + 1)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
link[(chain[h].linknum + d)].x = ((tempx1 + tempx2) * 0.5);
link[(chain[h].linknum + d)].y = ((tempy1 + tempy2) * 0.5);
link[(chain[h].linknum + d)].rotation = (270 - temprotation);
d = (d + 1);
};
} else {
d = 0;
while (d < (rope[chain[h].ropenum].segments - 1)) {
link[(chain[h].linknum + d)].active = false;
if (link[(chain[h].linknum + d)].parent != null){
link[(chain[h].linknum + d)].parent.removeChild(link[(chain[h].linknum + d)]);
};
d = (d + 1);
};
chain[h].active = false;
rope[chain[h].ropenum].active = false;
};
h = (h + 1);
};
h = 0;
while (h < links) {
if (link[h].active == true){
link[h].gotoAndPlay((link[h].frame + 1));
};
h = (h + 1);
};
temprotation = 0;
h = 0;
while (h < healths) {
if (health[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((((((health[h].x > (player[o].x - chestlength))) && ((health[h].x < (player[o].x + chestlength))))) && ((health[h].y > (player[o].y - 1))))) && ((health[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
if (player[o].damage > 0){
healthpickup.play();
health[h].active = false;
box[health[h].boxnum].active = false;
health[h].visible = false;
player[o].damage = (player[o].damage - healthamount);
pickuptext = "You picked up health!";
pickuptextdelay = messageduration;
};
};
};
o = (o + 1);
};
health[h].livetime = (health[h].livetime + 1);
if (health[h].fade == true){
if (health[h].livetime > (pickuplivetime - pickupfadetime)){
health[h].alpha = ((pickuplivetime - health[h].livetime) / pickupfadetime);
};
if (health[h].livetime > pickuplivetime){
box[health[h].boxnum].active = false;
if (health[h].parent != null){
health[h].parent.removeChild(health[h]);
};
health[h].active = false;
};
};
tempx1 = p[box[health[h].boxnum].firstpnum].x;
tempy1 = p[box[health[h].boxnum].firstpnum].y;
tempx2 = p[(box[health[h].boxnum].firstpnum + 2)].x;
tempy2 = p[(box[health[h].boxnum].firstpnum + 2)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
health[h].x = ((tempx1 + tempx2) * 0.5);
health[h].y = ((tempy1 + tempy2) * 0.5);
health[h].rotation = (315 - temprotation);
};
h = (h + 1);
};
h = 0;
while (h < grenadeammos) {
if (grenadeammo[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((((((grenadeammo[h].x > (player[o].x - chestlength))) && ((grenadeammo[h].x < (player[o].x + chestlength))))) && ((grenadeammo[h].y > (player[o].y - 1))))) && ((grenadeammo[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
if (player[o].grenadeammo < maxgrenadeammo){
ammopickup.play();
grenadeammo[h].active = false;
box[grenadeammo[h].boxnum].active = false;
grenadeammo[h].visible = false;
if (player[o].grenadeammo == 0){
player[o].weapon = grenadenum;
};
player[o].grenadeammo = (player[o].grenadeammo + grenadeammoamount);
};
};
};
o = (o + 1);
};
grenadeammo[h].livetime = (grenadeammo[h].livetime + 1);
if (grenadeammo[h].fade == true){
if (grenadeammo[h].livetime > (pickuplivetime - pickupfadetime)){
grenadeammo[h].alpha = ((pickuplivetime - grenadeammo[h].livetime) / pickupfadetime);
};
if (grenadeammo[h].livetime > pickuplivetime){
box[grenadeammo[h].boxnum].active = false;
if (grenadeammo[h].parent != null){
grenadeammo[h].parent.removeChild(grenadeammo[h]);
};
grenadeammo[h].active = false;
};
};
tempx1 = p[box[grenadeammo[h].boxnum].firstpnum].x;
tempy1 = p[box[grenadeammo[h].boxnum].firstpnum].y;
tempx2 = p[(box[grenadeammo[h].boxnum].firstpnum + 2)].x;
tempy2 = p[(box[grenadeammo[h].boxnum].firstpnum + 2)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
grenadeammo[h].x = ((tempx1 + tempx2) * 0.5);
grenadeammo[h].y = ((tempy1 + tempy2) * 0.5);
grenadeammo[h].rotation = (315 - temprotation);
};
h = (h + 1);
};
h = 0;
while (h < rifleammos) {
if (rifleammo[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((((((rifleammo[h].x > (player[o].x - chestlength))) && ((rifleammo[h].x < (player[o].x + chestlength))))) && ((rifleammo[h].y > (player[o].y - 1))))) && ((rifleammo[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
if (player[o].rifleammo < maxrifleammo){
ammopickup.play();
rifleammo[h].active = false;
box[rifleammo[h].boxnum].active = false;
rifleammo[h].visible = false;
pickuptext = "You picked up rifle (3) ammo!";
pickuptextdelay = messageduration;
player[o].rifleammo = (player[o].rifleammo + rifleammoamount);
};
};
};
o = (o + 1);
};
rifleammo[h].livetime = (rifleammo[h].livetime + 1);
if (rifleammo[h].fade == true){
if (rifleammo[h].livetime > (pickuplivetime - pickupfadetime)){
rifleammo[h].alpha = ((pickuplivetime - rifleammo[h].livetime) / pickupfadetime);
};
if (rifleammo[h].livetime > pickuplivetime){
box[rifleammo[h].boxnum].active = false;
if (grenadeammo[h].parent != null){
grenadeammo[h].parent.removeChild(grenadeammo[h]);
};
rifleammo[h].active = false;
};
};
tempx1 = p[box[rifleammo[h].boxnum].firstpnum].x;
tempy1 = p[box[rifleammo[h].boxnum].firstpnum].y;
tempx2 = p[(box[rifleammo[h].boxnum].firstpnum + 2)].x;
tempy2 = p[(box[rifleammo[h].boxnum].firstpnum + 2)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
rifleammo[h].x = ((tempx1 + tempx2) * 0.5);
rifleammo[h].y = ((tempy1 + tempy2) * 0.5);
rifleammo[h].rotation = (315 - temprotation);
};
h = (h + 1);
};
h = 0;
while (h < smgammos) {
if (smgammo[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((((((smgammo[h].x > (player[o].x - chestlength))) && ((smgammo[h].x < (player[o].x + chestlength))))) && ((smgammo[h].y > (player[o].y - 1))))) && ((smgammo[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
if (player[o].smgammo < maxsmgammo){
ammopickup.play();
smgammo[h].active = false;
box[smgammo[h].boxnum].active = false;
smgammo[h].visible = false;
pickuptext = "You picked up smg (4) ammunition!";
pickuptextdelay = messageduration;
player[o].smgammo = (player[o].smgammo + smgammoamount);
};
};
};
o = (o + 1);
};
smgammo[h].livetime = (smgammo[h].livetime + 1);
if (smgammo[h].fade == true){
if (smgammo[h].livetime > (pickuplivetime - pickupfadetime)){
smgammo[h].alpha = ((pickuplivetime - smgammo[h].livetime) / pickupfadetime);
};
if (smgammo[h].livetime > pickuplivetime){
box[smgammo[h].boxnum].active = false;
if (smgammo[h].parent != null){
smgammo[h].parent.removeChild(smgammo[h]);
};
smgammo[h].active = false;
};
};
tempx1 = p[box[smgammo[h].boxnum].firstpnum].x;
tempy1 = p[box[smgammo[h].boxnum].firstpnum].y;
tempx2 = p[(box[smgammo[h].boxnum].firstpnum + 2)].x;
tempy2 = p[(box[smgammo[h].boxnum].firstpnum + 2)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
smgammo[h].x = ((tempx1 + tempx2) * 0.5);
smgammo[h].y = ((tempy1 + tempy2) * 0.5);
smgammo[h].rotation = (315 - temprotation);
};
h = (h + 1);
};
h = 0;
while (h < shotgunammos) {
if (shotgunammo[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((((((shotgunammo[h].x > (player[o].x - chestlength))) && ((shotgunammo[h].x < (player[o].x + chestlength))))) && ((shotgunammo[h].y > (player[o].y - 1))))) && ((shotgunammo[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
if (player[o].shotgunammo < maxshotgunammo){
ammopickup.play();
shotgunammo[h].active = false;
box[shotgunammo[h].boxnum].active = false;
shotgunammo[h].visible = false;
pickuptext = "You picked up shotgun (5) shells!";
pickuptextdelay = messageduration;
player[o].shotgunammo = (player[o].shotgunammo + shotgunammoamount);
};
};
};
o = (o + 1);
};
shotgunammo[h].livetime = (shotgunammo[h].livetime + 1);
if (shotgunammo[h].fade == true){
if (shotgunammo[h].livetime > (pickuplivetime - pickupfadetime)){
shotgunammo[h].alpha = ((pickuplivetime - shotgunammo[h].livetime) / pickupfadetime);
};
if (shotgunammo[h].livetime > pickuplivetime){
box[shotgunammo[h].boxnum].active = false;
if (shotgunammo[h].parent != null){
shotgunammo[h].parent.removeChild(shotgunammo[h]);
};
shotgunammo[h].active = false;
};
};
tempx1 = p[box[shotgunammo[h].boxnum].firstpnum].x;
tempy1 = p[box[shotgunammo[h].boxnum].firstpnum].y;
tempx2 = p[(box[shotgunammo[h].boxnum].firstpnum + 2)].x;
tempy2 = p[(box[shotgunammo[h].boxnum].firstpnum + 2)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
shotgunammo[h].x = ((tempx1 + tempx2) * 0.5);
shotgunammo[h].y = ((tempy1 + tempy2) * 0.5);
shotgunammo[h].rotation = (315 - temprotation);
};
h = (h + 1);
};
h = 0;
while (h < pistolammos) {
if (pistolammo[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((((((pistolammo[h].x > (player[o].x - chestlength))) && ((pistolammo[h].x < (player[o].x + chestlength))))) && ((pistolammo[h].y > (player[o].y - 1))))) && ((pistolammo[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
if (player[o].pistolammo < maxpistolammo){
ammopickup.play();
pistolammo[h].active = false;
box[pistolammo[h].boxnum].active = false;
pistolammo[h].visible = false;
pickuptext = "You picked up pistol (2) rounds!";
pickuptextdelay = messageduration;
player[o].pistolammo = (player[o].pistolammo + pistolammoamount);
};
};
};
o = (o + 1);
};
pistolammo[h].livetime = (pistolammo[h].livetime + 1);
if (pistolammo[h].fade == true){
if (pistolammo[h].livetime > (pickuplivetime - pickupfadetime)){
pistolammo[h].alpha = ((pickuplivetime - pistolammo[h].livetime) / pickupfadetime);
};
if (pistolammo[h].livetime > pickuplivetime){
box[pistolammo[h].boxnum].active = false;
if (pistolammo[h].parent != null){
pistolammo[h].parent.removeChild(pistolammo[h]);
};
pistolammo[h].active = false;
};
};
tempx1 = p[box[pistolammo[h].boxnum].firstpnum].x;
tempy1 = p[box[pistolammo[h].boxnum].firstpnum].y;
tempx2 = p[(box[pistolammo[h].boxnum].firstpnum + 2)].x;
tempy2 = p[(box[pistolammo[h].boxnum].firstpnum + 2)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
pistolammo[h].x = ((tempx1 + tempx2) * 0.5);
pistolammo[h].y = ((tempy1 + tempy2) * 0.5);
pistolammo[h].rotation = (315 - temprotation);
};
h = (h + 1);
};
h = 0;
while (h < nailgunammos) {
if (nailgunammo[h].active == true){
o = 0;
while (o < players) {
if (player[o].active == true){
if ((((((((nailgunammo[h].x > (player[o].x - chestlength))) && ((nailgunammo[h].x < (player[o].x + chestlength))))) && ((nailgunammo[h].y > (player[o].y - 1))))) && ((nailgunammo[h].y < ((player[o].y + (ragdollheight * 2)) + 1))))){
if (player[o].nailgunammo < maxnailgunammo){
ammopickup.play();
nailgunammo[h].active = false;
box[nailgunammo[h].boxnum].active = false;
nailgunammo[h].visible = false;
pickuptext = "You picked up nailgun (7) ammunition!";
pickuptextdelay = messageduration;
player[o].nailgunammo = (player[o].nailgunammo + nailgunammoamount);
};
};
};
o = (o + 1);
};
nailgunammo[h].livetime = (nailgunammo[h].livetime + 1);
if (nailgunammo[h].fade == true){
if (nailgunammo[h].livetime > (pickuplivetime - pickupfadetime)){
nailgunammo[h].alpha = ((pickuplivetime - nailgunammo[h].livetime) / pickupfadetime);
};
if (nailgunammo[h].livetime > pickuplivetime){
box[nailgunammo[h].boxnum].active = false;
if (nailgunammo[h].parent != null){
nailgunammo[h].parent.removeChild(nailgunammo[h]);
};
nailgunammo[h].active = false;
};
};
tempx1 = p[box[nailgunammo[h].boxnum].firstpnum].x;
tempy1 = p[box[nailgunammo[h].boxnum].firstpnum].y;
tempx2 = p[(box[nailgunammo[h].boxnum].firstpnum + 2)].x;
tempy2 = p[(box[nailgunammo[h].boxnum].firstpnum + 2)].y;
temprotation = directiontopoint(tempx1, tempy1, tempx2, tempy2);
nailgunammo[h].x = ((tempx1 + tempx2) * 0.5);
nailgunammo[h].y = ((tempy1 + tempy2) * 0.5);
nailgunammo[h].rotation = (315 - temprotation);
};
h = (h + 1);
};
if (debugmode == true){
h = 0;
while (h < nodes) {
if (node[h].active == true){
drawline((node[h].x - noderadius), (node[h].y - noderadius), (node[h].x + noderadius), (node[h].y + noderadius), 0, 1);
};
h = (h + 1);
};
};
h = 0;
while (h < damagezones) {
if (damagezone[h].active == true){
if (debugmode == true){
drawline(damagezone[h].x1, damagezone[h].y1, damagezone[h].x2, damagezone[h].y2, 0, 1);
};
s = 0;
while (s < players) {
if (player[s].active == true){
if (rectcollide(damagezone[h].x1, damagezone[h].y1, damagezone[h].x2, damagezone[h].y2, (player[s].x - 1), player[s].y, (player[s].x + 1), (player[s].y + (ragdollheight * 2))) == true){
player[s].damage = (player[s].damage + damagezone[h].damage);
if (player[s].damage >= playerhealth){
if (player[s].weapon == pistolnum){
createpistol((player[s].bodyx + vectorx(player[s].gundirection, pistolholddistance)), (player[s].bodyy + vectory(player[s].gundirection, pistolholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == chainsawnum){
createchainsaw((player[s].bodyx + vectorx(player[s].gundirection, chainsawholddistance)), (player[s].bodyy + vectory(player[s].gundirection, chainsawholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == riflenum){
createrifle((player[s].bodyx + vectorx(player[s].gundirection, rifleholddistance)), (player[s].bodyy + vectory(player[s].gundirection, rifleholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == smgnum){
createsmg((player[s].bodyx + vectorx(player[s].gundirection, smgholddistance)), (player[s].bodyy + vectory(player[s].gundirection, smgholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == shotgunnum){
createshotgun((player[s].bodyx + vectorx(player[s].gundirection, shotgunholddistance)), (player[s].bodyy + vectory(player[s].gundirection, shotgunholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == nailgunnum){
createnailgun((player[s].bodyx + vectorx(player[s].gundirection, nailgunholddistance)), (player[s].bodyy + vectory(player[s].gundirection, nailgunholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == rpgnum){
createrpg((player[s].bodyx + vectorx(player[s].gundirection, rpgholddistance)), (player[s].bodyy + vectory(player[s].gundirection, rpgholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum, true);
};
createcorpse(player[s].x, player[s].y, true, objectline[player[s].objectlinenum].firstpnum, 0, 2, 2, 2, 2);
player[s].active = false;
};
};
};
s = (s + 1);
};
s = 0;
while (s < enemyAs) {
if (enemyA[s].active == true){
if (rectcollide(damagezone[h].x1, damagezone[h].y1, damagezone[h].x2, damagezone[h].y2, (enemyA[s].x - 1), enemyA[s].y, (enemyA[s].x + 1), (enemyA[s].y + (ragdollheight * 2))) == true){
enemyA[s].damage = (enemyA[s].damage + damagezone[h].damage);
if (enemyA[s].damage >= enemyAhealth){
enemyA[s].active = false;
createcorpse(enemyA[s].x, enemyA[s].y, true, objectline[enemyA[s].objectlinenum].firstpnum, 1, 2, 2, 2, 2);
zombiedie.play();
};
};
};
s = (s + 1);
};
s = 0;
while (s < enemyBs) {
if (enemyB[s].active == true){
if (rectcollide(damagezone[h].x1, damagezone[h].y1, damagezone[h].x2, damagezone[h].y2, (enemyB[s].x - 1), enemyB[s].y, (enemyB[s].x + 1), (enemyB[s].y + (ragdollheight * 2))) == true){
enemyB[s].damage = (enemyB[s].damage + damagezone[h].damage);
if (enemyB[s].damage >= enemyBhealth){
enemyB[s].active = false;
if (enemyB[s].kamikaze == false){
createpointdebris(enemyB[s].x, (enemyB[s].y + 8), 11);
createcorpse(enemyB[s].x, enemyB[s].y, true, objectline[enemyB[s].objectlinenum].firstpnum, 2, 2, 2, 2, 2);
zombiedie.play();
} else {
createblast(enemyB[s].x, (enemyB[s].y + 8), kamikazeradius, kamikazepush, kamikazedamage, -1);
kamikazeexplosion(enemyB[s].x, (enemyB[s].y + 8));
};
};
};
};
s = (s + 1);
};
s = 0;
while (s < enemyCs) {
if (enemyC[s].active == true){
if (rectcollide(damagezone[h].x1, damagezone[h].y1, damagezone[h].x2, damagezone[h].y2, (enemyC[s].x - 1), enemyC[s].y, (enemyC[s].x + 1), (enemyC[s].y + (ragdollheight * 2))) == true){
enemyC[s].damage = (enemyC[s].damage + damagezone[h].damage);
if (enemyC[s].damage >= enemyChealth){
createpointdebris(enemyC[s].x, (enemyC[s].y + 8), 10);
enemyC[s].active = false;
createcorpse(enemyC[s].x, enemyC[s].y, true, objectline[enemyC[s].objectlinenum].firstpnum, 3, 2, 2, 2, 2);
zombiedie.play();
};
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < winzones) {
if (winzone[h].active == true){
if (debugmode == true){
drawline(winzone[h].x1, winzone[h].y1, winzone[h].x2, winzone[h].y2, 0, 100);
};
s = 0;
while (s < players) {
if (player[s].active == true){
if (rectcollide(winzone[h].x1, winzone[h].y1, winzone[h].x2, winzone[h].y2, (player[s].x - 1), player[s].y, (player[s].x + 1), (player[s].y + (ragdollheight * 2))) == true){
loadmap((mapnumber + 1));
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < killzones) {
if (killzone[h].active == true){
if (debugmode == true){
drawline(killzone[h].x1, killzone[h].y1, killzone[h].x2, killzone[h].y2, 0, 100);
};
s = 0;
while (s < players) {
if (player[s].active == true){
if (rectcollide(killzone[h].x1, killzone[h].y1, killzone[h].x2, killzone[h].y2, (player[s].x - 1), player[s].y, (player[s].x + 1), (player[s].y + (ragdollheight * 2))) == true){
player[s].active = false;
player[s].damage = playerhealth;
if (player[s].weapon == pistolnum){
createpistol((player[s].bodyx + vectorx(player[s].gundirection, pistolholddistance)), (player[s].bodyy + vectory(player[s].gundirection, pistolholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == chainsawnum){
createchainsaw((player[s].bodyx + vectorx(player[s].gundirection, chainsawholddistance)), (player[s].bodyy + vectory(player[s].gundirection, chainsawholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == riflenum){
createrifle((player[s].bodyx + vectorx(player[s].gundirection, rifleholddistance)), (player[s].bodyy + vectory(player[s].gundirection, rifleholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == smgnum){
createsmg((player[s].bodyx + vectorx(player[s].gundirection, smgholddistance)), (player[s].bodyy + vectory(player[s].gundirection, smgholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == shotgunnum){
createshotgun((player[s].bodyx + vectorx(player[s].gundirection, shotgunholddistance)), (player[s].bodyy + vectory(player[s].gundirection, shotgunholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == nailgunnum){
createnailgun((player[s].bodyx + vectorx(player[s].gundirection, nailgunholddistance)), (player[s].bodyy + vectory(player[s].gundirection, nailgunholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum);
};
if (player[s].weapon == rpgnum){
createrpg((player[s].bodyx + vectorx(player[s].gundirection, rpgholddistance)), (player[s].bodyy + vectory(player[s].gundirection, rpgholddistance)), player[s].facedirection, player[s].gundirection, true, objectline[player[s].objectlinenum].firstpnum, true);
};
createcorpse(player[s].x, player[s].y, true, objectline[player[s].objectlinenum].firstpnum, 0, 2, 2, 2, 2);
};
};
s = (s + 1);
};
s = 0;
while (s < enemyAs) {
if (enemyA[s].active == true){
if (rectcollide(killzone[h].x1, killzone[h].y1, killzone[h].x2, killzone[h].y2, (enemyA[s].x - 1), enemyA[s].y, (enemyA[s].x + 1), (enemyA[s].y + (ragdollheight * 2))) == true){
enemyA[s].active = false;
createcorpse(enemyA[s].x, enemyA[s].y, true, objectline[enemyA[s].objectlinenum].firstpnum, 1, 2, 2, 2, 2);
zombiedie.play();
};
};
s = (s + 1);
};
s = 0;
while (s < enemyBs) {
if (enemyB[s].active == true){
if (rectcollide(killzone[h].x1, killzone[h].y1, killzone[h].x2, killzone[h].y2, (enemyB[s].x - 1), enemyB[s].y, (enemyB[s].x + 1), (enemyB[s].y + (ragdollheight * 2))) == true){
enemyB[s].active = false;
if (enemyB[s].kamikaze == false){
createpointdebris(enemyB[s].x, (enemyB[s].y + 8), 11);
createcorpse(enemyB[s].x, enemyB[s].y, true, objectline[enemyB[s].objectlinenum].firstpnum, 2, 2, 2, 2, 2);
zombiedie.play();
} else {
createblast(enemyB[s].x, (enemyB[s].y + 8), kamikazeradius, kamikazepush, kamikazedamage, -1);
kamikazeexplosion(enemyB[s].x, (enemyB[s].y + 8));
};
};
};
s = (s + 1);
};
s = 0;
while (s < enemyCs) {
if (enemyC[s].active == true){
if (rectcollide(killzone[h].x1, killzone[h].y1, killzone[h].x2, killzone[h].y2, (enemyC[s].x - 1), enemyC[s].y, (enemyC[s].x + 1), (enemyC[s].y + (ragdollheight * 2))) == true){
enemyC[s].active = false;
createpointdebris(enemyC[s].x, (enemyC[s].y + 8), 10);
createcorpse(enemyC[s].x, enemyC[s].y, true, objectline[enemyC[s].objectlinenum].firstpnum, 3, 2, 2, 2, 2);
zombiedie.play();
};
};
s = (s + 1);
};
};
h = (h + 1);
};
h = 0;
while (h < crates) {
if (crate[h].active == true){
if (hitzone[crate[h].hitzonenum].active == true){
createpointdebris(((crate[h].x + (Math.random() * crateradius)) - (crateradius * 0.5)), ((crate[h].y + (Math.random() * crateradius)) - (crateradius * 0.5)), 1);
createpointdebris(((crate[h].x + (Math.random() * crateradius)) - (crateradius * 0.5)), ((crate[h].y + (Math.random() * crateradius)) - (crateradius * 0.5)), 1);
createpointdebris(((crate[h].x + (Math.random() * crateradius)) - (crateradius * 0.5)), ((crate[h].y + (Math.random() * crateradius)) - (crateradius * 0.5)), 1);
createlinedebris(((crate[h].x + (Math.random() * crateradius)) - (crateradius * 0.5)), ((crate[h].y + (Math.random() * crateradius)) - (crateradius * 0.5)), 1);
createlinedebris(((crate[h].x + (Math.random() * crateradius)) - (crateradius * 0.5)), ((crate[h].y + (Math.random() * crateradius)) - (crateradius * 0.5)), 1);
physicsexplosion(crate[h].x, (crate[h].y + (crateheight * 0.5)), (crateradius * 2), 5);
crateexplosion(crate[h].x, (crate[h].y + (crateheight * 0.5)));
crate[h].active = false;
};
crate[h].gotoAndPlay((crate[h].frame + 1));
} else {
if (crate[h].parent != null){
crate[h].parent.removeChild(crate[h]);
};
hitzone[crate[h].hitzonenum].active = true;
};
h = (h + 1);
};
h = 0;
while (h < computers) {
if (computer[h].active == true){
if (hitzone[computer[h].hitzonenum].active == true){
if (computer[h].frame == 0){
computerexplosion(computer[h].x, (computer[h].y + (computerheight * 0.5)));
} else {
if (Math.floor((Math.random() * 24)) == 0){
electricsparks(computer[h].x, (computer[h].y + (computerheight * 0.5)));
};
};
computer[h].frame = 1;
};
computer[h].gotoAndPlay((computer[h].frame + 1));
} else {
computer[h].visible = false;
hitzone[computer[h].hitzonenum].active = true;
};
h = (h + 1);
};
h = 0;
while (h < cities) {
if (city[h].active == true){
city[h].gotoAndPlay((city[h].frame + 1));
} else {
city[h].visible = false;
};
h = (h + 1);
};
h = 0;
while (h < barrels) {
if (barrel[h].active == true){
if (hitzone[barrel[h].hitzonenum].active == true){
createpointdebris(((barrel[h].x + (Math.random() * barrelradius)) - (barrelradius * 0.5)), ((barrel[h].y + (Math.random() * barrelradius)) - (barrelradius * 0.5)), 9);
createpointdebris(((barrel[h].x + (Math.random() * barrelradius)) - (barrelradius * 0.5)), ((barrel[h].y + (Math.random() * barrelradius)) - (barrelradius * 0.5)), 9);
createlinedebris(((barrel[h].x + (Math.random() * barrelradius)) - (barrelradius * 0.5)), ((barrel[h].y + (Math.random() * barrelradius)) - (barrelradius * 0.5)), 0);
createblast(barrel[h].x, (barrel[h].y + (barrelheight * 0.5)), grenaderadius, grenadepush, grenadedamage, -1);
barrelexplosion(barrel[h].x, (barrel[h].y + (barrelheight * 0.5)));
createfire(barrel[h].x, ((barrel[h].y + barrelheight) - 8), 150);
barrel[h].active = false;
};
barrel[h].gotoAndPlay((barrel[h].frame + 1));
} else {
if (barrel[h].parent != null){
barrel[h].parent.removeChild(barrel[h]);
};
hitzone[barrel[h].hitzonenum].active = true;
};
h = (h + 1);
};
h = 0;
while (h < spinlights) {
if (spinlight[h].active == true){
spinlight[h].rotation = (spinlight[h].rotation + spinspeed);
} else {
spinlight[h].visible = false;
};
h = (h + 1);
};
h = 0;
while (h < floordoors) {
if (floordoor[h].active == true){
} else {
floordoor[h].visible = false;
};
h = (h + 1);
};
h = 0;
while (h < walldoors) {
if (walldoor[h].active == true){
} else {
walldoor[h].visible = false;
};
h = (h + 1);
};
h = 0;
while (h < raindrops) {
if (rain[h].active == true){
rain[h].y = (rain[h].y + rain[h].vs);
if (rain[h].y > 320){
rain[h].x = (Math.random() * 600);
rain[h].y = -20;
rain[h].vs = ((Math.random() * 5) + 3);
rain[h].height = (rain[h].vs * 2);
if (particlealpha == 0){
rain[h].alpha = (rain[h].vs * 0.1);
} else {
rain[h].alpha = 1;
};
};
} else {
rain[h].visible = false;
};
h = (h + 1);
};
if (screenflash.active == true){
if (screenflash.alpha > 0){
screenflash.alpha = (screenflash.alpha - 0.01);
} else {
screenflash.active = false;
};
} else {
screenflash.visible = false;
};
h = 0;
while (h < fires) {
if (fire[h].active == true){
if (Math.random() < 0.5){
createlight(lightcontainer, fire[h].x, fire[h].y, firecolor(), (4 + (Math.random() * 4)), 7, (0.33 + (Math.random() / 3)));
};
if (fire[h].delay == 0){
fireparticles(fire[h].x, fire[h].y);
fire[h].delay = fireskipnum;
} else {
fire[h].delay = (fire[h].delay - 1);
};
fire[h].livetime = (fire[h].livetime + 1);
if (fire[h].livetime >= fire[h].maxlivetime){
fire[h].active = false;
};
};
h = (h + 1);
};
if (fog.active == true){
fog.x = (fog.x - 1);
if (fog.x < -1600){
fog.x = 600;
};
} else {
fog.visible = false;
};
if (fade.active == true){
if (fade.alpha > 0){
fade.alpha = (fade.alpha - 0.04);
} else {
fade.active = false;
};
} else {
fade.visible = false;
};
if (berserkscreen.active == true){
if (berserkscreen.livetime < 30){
berserkscreen.alpha = (berserkscreen.alpha + 0.01);
};
if ((berserkduration - berserkscreen.livetime) < 30){
berserkscreen.alpha = (berserkscreen.alpha - 0.01);
};
if (berserkscreen.livetime < berserkduration){
berserkscreen.livetime = (berserkscreen.livetime + 1);
} else {
berserkscreen.active = false;
};
} else {
berserkscreen.visible = false;
};
h = 0;
while (h < crowwings) {
if (crowwing[h].active == true){
crowwing[h].scaleY = (crowwing[h].scaleY + crowwing[h].scalespeed);
if (crowwing[h].scaleY >= 1){
crowwing[h].scaleY = 1;
crowwing[h].scalespeed = (-(crowwing[h].scalespeed) * 2);
};
if (crowwing[h].scaleY <= -1){
crowwing[h].scaleY = -1;
crowwing[h].scalespeed = (-(crowwing[h].scalespeed) * 0.5);
};
} else {
if (crowwing[h].parent != null){
crowwing[h].parent.removeChild(crowwing[h]);
};
};
h = (h + 1);
};
h = 0;
while (h < crows) {
if (crow[h].active == true){
crow[h].gotoAndPlay((crow[h].frame + 1));
crow[h].x = (crow[h].x + crow[h].hs);
crow[h].y = (crow[h].y + crow[h].vs);
hitzone[crow[h].hitzonenum].x = crow[h].x;
hitzone[crow[h].hitzonenum].y = crow[h].y;
if (hitzone[crow[h].hitzonenum].active == true){
bloodspray(crow[h].x, crow[h].y, 3);
createpointdebris(crow[h].x, crow[h].y, (3 + Math.floor((Math.random() * 4))));
physicspush(crow[h].x, crow[h].y, 1, (Math.random() * 360), Math.random());
crow[h].active = false;
};
if (crow[h].frame == 0){
crowwing[crow[h].wingnum].visible = false;
crowwing[crow[h].wingnum].scaleY = 0;
} else {
crowwing[crow[h].wingnum].visible = true;
};
if (crow[h].frame == 0){
if (blockdistance(crow[h].x, crow[h].y, player[0].x, player[0].y) < 100){
crow[h].frame = 1;
crowcaw.play();
if (crow[h].facedirection == 0){
crow[h].hs = 5;
crow[h].vs = -0.5;
} else {
crow[h].hs = -5;
crow[h].vs = -0.5;
};
};
};
if ((((crow[h].x > 1200)) || ((crow[h].x < -400)))){
crow[h].active = false;
};
crowwing[crow[h].wingnum].x = crow[h].x;
crowwing[crow[h].wingnum].y = crow[h].y;
} else {
crowwing[crow[h].wingnum].active = false;
if (crow[h].parent != null){
crow[h].parent.removeChild(crow[h]);
};
hitzone[crow[h].hitzonenum].active = true;
};
h = (h + 1);
};
h = 0;
while (h < rats) {
if (rat[h].active == true){
hitzone[rat[h].hitzonenum].x = rat[h].x;
hitzone[rat[h].hitzonenum].y = rat[h].y;
if (hitzone[rat[h].hitzonenum].active == true){
ratsqueak.play();
bloodspray(rat[h].x, rat[h].y, 3);
createpointdebris(rat[h].x, rat[h].y, (3 + Math.floor((Math.random() * 4))));
physicspush(rat[h].x, rat[h].y, 1, (Math.random() * 360), Math.random());
rat[h].active = false;
};
if (rat[h].scared == 1){
if (rat[h].facedirection == 0){
rat[h].x = (rat[h].x + 2.5);
} else {
rat[h].x = (rat[h].x - 2.5);
};
} else {
rat[h].gotoAndPlay((rat[h].frame + 1));
};
if (rat[h].scared == 0){
if (blockdistance(rat[h].x, rat[h].y, player[0].x, player[0].y) < 100){
rat[h].scared = 1;
ratsqueak.play();
};
};
if ((((rat[h].x > 1200)) || ((rat[h].x < -400)))){
rat[h].active = false;
};
} else {
if (rat[h].parent != null){
rat[h].parent.removeChild(rat[h]);
};
hitzone[rat[h].hitzonenum].active = true;
};
h = (h + 1);
};
battleduration = 900;
if ((((((((mapnumber > 2)) && ((counter1 < battleduration)))) && ((counter1 > 0)))) && ((mapnumber < 15)))){
if (((!((mapnumber == 13))) || ((player[0].x < 400)))){
spawnpickups((((-0.5 * this.x) + 200) - (Math.random() * 25)), ((player[0].y - 75) + (Math.random() * 25)));
spawnweapons((((-0.5 * this.x) + 200) - (Math.random() * 25)), ((player[0].y - 75) + (Math.random() * 25)));
};
};
if (mapnumber == 1){
if ((((bool4 == false)) && ((counter3 > 60)))){
bool4 = true;
messagestring = "Use the A and D keys to move and W to jump.";
messagetextdelay = 210;
};
counter3 = (counter3 + 1);
if ((((player[0].x > 400)) && ((bool1 == false)))){
createenemyA(700, 200, 1, true, false);
createenemyA(-100, 200, 0, true, false);
messagestring = "Use the mouse to aim and Mouse 1 to attack.";
messagetextdelay = 210;
bool1 = true;
};
if (bool1 == true){
counter1 = (counter1 + 1);
};
if ((((counter1 > 220)) && ((bool2 == false)))){
createenemyA(700, 200, 1, true, false);
createenemyA(650, 200, 1, true, false);
bool2 = true;
};
if ((((((counter1 > 300)) && ((countenemies() == 0)))) && ((bool3 == false)))){
messagestring = "You can proceed once all enemies have been killed.";
messagetextdelay = 90000;
bool3 = true;
createwinzone(590, 0, 610, 300);
};
};
if (mapnumber == 2){
if ((((counter1 > 40)) && ((bool1 == false)))){
bool1 = true;
messagestring = "Pickups and weapons will randomly spawn around you.";
messagetextdelay = 210;
teleportsparks(100, 200);
createhealth(100, 200, true);
};
counter1 = (counter1 + 1);
if ((((player[0].x > 350)) && ((bool2 == false)))){
bool2 = true;
smallcrash.play();
createenemyA(455, 240, 1, true, false);
physicspush(455, 0x0100, 32, 90, 5);
dirtblast(455, 240);
counter1 = (counter1 + 1);
};
if (bool2 == true){
if (counter2 > 10){
collisionline[2].active = true;
} else {
counter2 = (counter2 + 1);
};
};
if ((((((bool2 == true)) && ((bool3 == false)))) && ((countenemies() == 0)))){
bool3 = true;
createenemyA(650, 200, 1, true, false);
createenemyA(-50, 200, 0, true, false);
createenemyA(-150, 200, 0, true, false);
};
if (bool3 == true){
if ((((counter3 > 90)) && ((bool5 == false)))){
bool5 = true;
player[0].berserkamount = 1000;
messagestring = "When the blue bar is filled...";
messagetextdelay = 210;
};
if ((((countenemies() == 0)) && ((bool4 == false)))){
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(590, 0, 610, 300);
bool4 = true;
};
counter3 = (counter3 + 1);
};
};
if (mapnumber == 3){
if ((((counter1 > 40)) && ((bool1 == false)))){
bool1 = true;
teleportsparks(125, 200);
createpistol(125, 200, 0, 0, true, -1);
createenemyA(650, 200, 1, true, false);
createenemyA(700, 200, 1, true, false);
createenemyA(-50, 200, 0, true, false);
messagestring = "Use number keys 1-8 to switch weapons.";
messagetextdelay = 210;
};
if ((((counter1 > 60)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(-100, 200, 0, 0);
spawnenemies(700, 200, 1, 0);
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(590, 0, 610, 300);
};
};
};
counter1 = (counter1 + 1);
};
if (mapnumber == 4){
if ((((player[0].x > 480)) && ((bool1 == false)))){
bool1 = true;
xposition = 625;
yposition = 220;
createlinedebris((xposition - 15), (yposition - 4), 1);
createpointdebris((xposition - 20), (yposition - 12), 1);
createpointdebris((xposition - 10), (yposition - 8), 1);
physicsexplosion(xposition, yposition, 50, 4);
createenemyA(xposition, (yposition - 20), 1, true, true);
smallcrash.play();
i = 0;
while (i < 5) {
creategp((xposition - 20), yposition, ((Math.random() * 10) + 15), ((Math.random() * 60) + 150), ((Math.random() * 3) + 2), 0.97, 0.08, ((Math.random() * 20) + 20), 7623226, true);
i = (i + 1);
};
};
if (bool1 == true){
counter1 = (counter1 + 1);
};
if ((((counter1 > 30)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(-100, 200, 0, 0);
spawnenemies(700, 200, 1, 0);
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(590, 0, 610, 300);
};
};
};
};
if (mapnumber == 5){
if ((((player[0].x > 500)) && ((bool1 == false)))){
bool1 = true;
xposition = 625;
yposition = 115;
createlinedebris((xposition - 20), (yposition + 4), 1);
createpointdebris((xposition - 10), (yposition - 8), 1);
createpointdebris((xposition - 5), yposition, 1);
physicsexplosion(xposition, yposition, 50, 4);
createenemyA(xposition, (yposition - 20), 1, true, true);
createenemyA(-100, 200, 1, true, true);
smallcrash.play();
i = 0;
while (i < 5) {
creategp((xposition - 20), yposition, ((Math.random() * 10) + 15), ((Math.random() * 60) + 150), ((Math.random() * 3) + 2), 0.97, 0.08, ((Math.random() * 20) + 20), 7623226, true);
i = (i + 1);
};
};
if (bool1 == true){
counter1 = (counter1 + 1);
};
if ((((counter1 > 30)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(-100, 200, 0, 0);
spawnenemies(700, 95, 1, 0);
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(590, 0, 610, 300);
};
};
};
};
if (mapnumber == 6){
if ((((bool5 == false)) && ((counter2 > 30)))){
messagestring = "Crates contain pickups and weapons.";
messagetextdelay = 120;
bool5 = true;
};
counter2 = (counter2 + 1);
if ((((player[0].x > 350)) && ((bool1 == false)))){
bool1 = true;
createenemyA(700, 180, 1, true, true);
createenemyA(-50, 180, 0, true, false);
createenemyA(-150, 180, 0, true, true);
};
if (bool1 == true){
counter1 = (counter1 + 1);
};
if ((((counter1 > 30)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(-100, 180, 0, 0);
spawnenemies(700, 180, 1, 0);
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(590, 0, 610, 300);
};
};
};
};
if (mapnumber == 7){
if ((((player[0].x > 400)) && ((bool1 == false)))){
bool1 = true;
xposition = 550;
yposition = -50;
createlinedebris((xposition - 3), (yposition + 10), 2);
createboxdebris((xposition - 4), (yposition + 8), 2);
createpointdebris((xposition + 2), (yposition + 23), 2);
createpointdebris((xposition + 6), (yposition + 16), 2);
physicsexplosion(xposition, yposition, 50, 3);
bigcrash.play();
i = 0;
while (i < 7) {
creategp((xposition - 20), yposition, ((Math.random() * 10) + 15), ((Math.random() * 40) + 250), ((Math.random() * 3) + 1), 0.97, 0.08, ((Math.random() * 40) + 40), 10263181, true);
i = (i + 1);
};
createenemyA(700, 120, 1, true, false);
createenemyB(-50, 120, 0, true, false);
createenemyB(550, -70, 1, true, false);
};
if (bool1 == true){
counter1 = (counter1 + 1);
};
if ((((counter1 > 30)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(550, -50, 1, Math.floor((Math.random() * 2)));
spawnenemies(-100, 120, 0, Math.floor((Math.random() * 2)));
spawnenemies(700, 120, 1, Math.floor((Math.random() * 2)));
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(590, 0, 610, 300);
};
};
};
};
if (mapnumber == 8){
if ((((counter5 > 40)) && ((bool5 == false)))){
bool5 = true;
messagestring = "Certain objects are destructable...";
messagetextdelay = 210;
} else {
counter5 = (counter5 + 1);
};
watercolor = 6982733;
if (bool3 == false){
if (hitzone[(hitzones - 1)].active == true){
bool4 = true;
bool3 = true;
xposition = 300;
yposition = 140;
createlinedebris((xposition - 8), (yposition + 9), 0);
createlinedebris((xposition + 2), (yposition - 6), 0);
createpointdebris((xposition + 5), (yposition + 12), 0);
createpointdebris((xposition - 3), (yposition - 8), 0);
physicsexplosion(xposition, yposition, 30, 3);
metalcrash.play();
waterspray.play(0, 5);
i = 0;
while (i < 8) {
creategp(xposition, yposition, ((Math.random() * 8) + 16), (Math.random() * 360), ((Math.random() * 3) + 1), 0.97, 0.05, ((Math.random() * 30) + 30), 6982733, true);
i = (i + 1);
};
background.frame = 8;
background.gotoAndStop((background.frame + 1));
makebgcopy();
} else {
if (Math.floor((Math.random() * 90)) == 0){
creategp(300, 160, 2, 270, 0, 0.99, g, 80, 6982733, false);
drip.play();
};
};
};
if (bool4 == true){
counter4 = (counter4 + 1);
if (counter4 < 325){
if (Math.floor((Math.random() * 4)) == 0){
creategp(300, 160, ((Math.random() * 8) + 8), (260 + (Math.random() * 20)), (Math.random() + 1), 0.99, g, 40, watercolor, true);
};
waterpool[0].y = (waterpool[0].y - 0.08);
waterpool[0].depth = (waterpool[0].depth + 0.16);
};
};
if ((((player[0].x > 350)) && ((bool1 == false)))){
bool1 = true;
createenemyA(-125, 160, 0, true, false);
createenemyB(-50, 160, 0, true, false);
createenemyB(650, 160, 1, true, false);
};
if (bool1 == true){
counter1 = (counter1 + 1);
};
if ((((counter1 > 30)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(-100, 160, 0, Math.floor((Math.random() * 2)));
spawnenemies(700, 160, 1, Math.floor((Math.random() * 2)));
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(590, 0, 610, 300);
};
};
};
};
if (mapnumber == 9){
if ((((player[0].x > 150)) && ((bool1 == false)))){
bool1 = true;
xposition = 55;
yposition = 125;
createlinedebris((xposition + 4), (yposition - 4), 0);
createlinedebris((xposition + 10), (yposition - 8), 0);
createpointdebris((xposition + 4), yposition, 0);
createpointdebris((xposition - 4), (yposition + 3), 0);
physicsexplosion(xposition, yposition, 40, 5);
createenemyB((xposition - 50), (yposition - 15), 0, true, false);
createenemyA(-100, 180, 0, true, false);
createenemyB(700, 120, 1, true, false);
metalcrash.play();
};
if (bool1 == true){
counter1 = (counter1 + 1);
};
if ((((counter1 > 30)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(10, 95, 0, Math.floor((Math.random() * 2)));
spawnenemies(-100, 180, 0, Math.floor((Math.random() * 2)));
spawnenemies(700, 110, 1, Math.floor((Math.random() * 2)));
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(510, 0, 610, 300);
};
};
};
};
if (mapnumber == 10){
if (counter3 == 5){
xposition = 235;
yposition = 250;
creategp(xposition, yposition, ((Math.random() * 5) + 10), ((Math.random() * 10) + 85), ((Math.random() * 3) + 5), 0.98, g, ((Math.random() * 20) + 80), 4364733, true);
counter3 = 0;
};
counter3 = (counter3 + 1);
if ((((player[0].x > 260)) && ((bool1 == false)))){
bool1 = true;
createenemyB(650, 218, 1, true, false);
createenemyB(-100, 218, 0, true, false);
createenemyB(700, 218, 1, true, true);
};
if (bool1 == true){
counter1 = (counter1 + 1);
};
if ((((counter1 > 30)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(-100, 218, 0, Math.floor((Math.random() * 2)));
spawnenemies(700, 218, 1, Math.floor((Math.random() * 2)));
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(590, 0, 610, 300);
};
};
};
};
if (mapnumber == 11){
if ((((player[0].x > 450)) && ((bool1 == false)))){
bool1 = true;
xposition = 600;
yposition = 225;
createlinedebris((xposition - 6), (yposition - 4), 2);
createboxdebris((xposition - 4), (yposition - 2), 2);
createpointdebris((xposition - 2), (yposition + 3), 2);
physicsexplosion(xposition, yposition, 50, 3);
bigcrash.play();
i = 0;
while (i < 7) {
creategp((xposition - 10), yposition, ((Math.random() * 15) + 20), ((Math.random() * 60) + 150), ((Math.random() * 3) + 3), 0.97, 0.03, ((Math.random() * 40) + 40), 9935495, true);
i = (i + 1);
};
createenemyB(700, 218, 1, true, true);
createenemyB(-100, 218, 0, true, false);
createenemyC(650, 218, 1, true);
};
if (bool1 == true){
counter1 = (counter1 + 1);
};
if ((((counter1 > 30)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(-100, 218, 0, Math.floor((Math.random() * 2)));
spawnenemies(700, 218, 1, Math.floor((Math.random() * 3)));
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(590, 0, 610, 300);
};
};
};
if (Math.floor((Math.random() * 30)) == 0){
electricsparks(275, 175);
};
};
if (mapnumber == 12){
if ((((player[0].x > 450)) && ((bool1 == false)))){
rope[0].locked2 = false;
bool1 = true;
xposition = 400;
yposition = -30;
createlinedebris((xposition - 6), (yposition + 4), 2);
createlinedebris((xposition - 4), (yposition + 2), 2);
createpointdebris((xposition - 2), (yposition + 3), 2);
physicsexplosion(xposition, yposition, 50, 3);
bigcrash.play();
i = 0;
while (i < 7) {
creategp((xposition - 10), yposition, ((Math.random() * 15) + 20), ((Math.random() * 60) + 240), ((Math.random() * 3) + 3), 0.97, 0.03, ((Math.random() * 40) + 40), 8487787, true);
i = (i + 1);
};
createenemyA(400, -50, 1, true, true);
createenemyA(-100, 118, 0, true, false);
createenemyC(700, 118, 1, true);
};
if (bool1 == true){
counter1 = (counter1 + 1);
if (Math.floor((Math.random() * 10)) == 0){
p[((rope[0].firstpnum + rope[0].segments) - 1)].x = ((p[((rope[0].firstpnum + rope[0].segments) - 1)].x + (Math.random() * 8)) - 4);
p[((rope[0].firstpnum + rope[0].segments) - 1)].y = ((p[((rope[0].firstpnum + rope[0].segments) - 1)].y + (Math.random() * 8)) - 4);
electricsparks(p[((rope[0].firstpnum + rope[0].segments) - 1)].x, p[((rope[0].firstpnum + rope[0].segments) - 1)].y);
};
};
if ((((counter1 > 30)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(-100, 118, 0, (Math.floor((Math.random() * 2)) * 2));
spawnenemies(700, 118, 1, (Math.floor((Math.random() * 2)) * 2));
spawnenemies(400, -50, 1, (Math.floor((Math.random() * 2)) * 2));
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(590, 0, 610, 300);
};
};
};
};
if (mapnumber == 13){
if ((((player[0].x > 450)) && ((bool1 == false)))){
bool1 = true;
createenemyA(-150, 118, 0, true, false);
createenemyA(-120, 118, 0, true, false);
createenemyC(-40, 118, 0, true);
};
if (bool1 == true){
counter1 = (counter1 + 1);
};
if ((((counter1 > 30)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(-100, 118, 0, (Math.floor((Math.random() * 2)) * 2));
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(595, 0, 610, 300);
bool4 = true;
dooropen.play();
};
};
};
if (bool4 == true){
collisionline[3].y2 = (collisionline[3].y2 - 0.25);
walldoor[0].y = (walldoor[0].y - 0.25);
};
};
if (mapnumber == 14){
if ((((player[0].x > 350)) && ((bool1 == false)))){
bool1 = true;
createenemyC(-160, 118, 0, true);
createenemyC(-120, 118, 0, true);
createenemyC(680, 118, 1, true);
};
if (bool1 == true){
counter1 = (counter1 + 1);
};
if (Math.floor((Math.random() * 15)) == 0){
creategp(203, 76, 3, (260 + (Math.random() * 20)), Math.random(), 0.99, g, ((Math.random() * 20) + 20), 1762862, false);
};
if ((((counter1 > 30)) && ((bool2 == false)))){
if (counter1 < battleduration){
spawnenemies(-100, 118, 0, 2);
spawnenemies(700, 118, 1, 2);
} else {
if (countenemies() == 0){
bool2 = true;
messagestring = "Continue.";
messagetextdelay = 900;
createwinzone(590, 0, 610, 300);
};
};
};
if ((((computer[0].frame == 1)) && ((bool3 == false)))){
bool3 = true;
bool4 = true;
spinlight[0].visible = true;
alarm.play(0, 2);
};
if (bool4 == true){
if (collisionline[0].x2 > 300){
collisionline[0].x2 = (collisionline[0].x2 - 5);
floordoor[0].x = (floordoor[0].x - 5);
};
};
};
if (mapnumber == 15){
if ((((player[0].x > 200)) && ((bool1 == false)))){
bool1 = true;
megazombieintro.play();
spinlight[0].visible = true;
electricsparks(372, 233);
messagestring = "Stun him with RPGs first...";
messagetextdelay = 210;
};
if (bool1 == false){
megazombie[0].recovertimer = 80;
megazombie[0].cx = 300;
megazombie[0].cy = 160;
};
if (rope[chain[0].ropenum].locked1 == true){
if (approxdistance(rope[chain[0].ropenum].lockx1, rope[chain[0].ropenum].locky1, rope[chain[0].ropenum].lockx2, rope[chain[0].ropenum].locky2) > (rope[chain[0].ropenum].maxlength * 1.2)){
nailhit.play();
rope[chain[0].ropenum].locked1 = false;
chainbreak(rope[chain[0].ropenum].lockx1, rope[chain[0].ropenum].locky1);
};
};
if (rope[chain[1].ropenum].locked1 == true){
if (approxdistance(rope[chain[1].ropenum].lockx1, rope[chain[1].ropenum].locky1, rope[chain[1].ropenum].lockx2, rope[chain[1].ropenum].locky2) > (rope[chain[1].ropenum].maxlength * 1.2)){
nailhit.play();
rope[chain[1].ropenum].locked1 = false;
chainbreak(rope[chain[1].ropenum].lockx1, rope[chain[1].ropenum].locky1);
};
};
if (rope[chain[2].ropenum].locked2 == true){
if (approxdistance(rope[chain[2].ropenum].lockx1, rope[chain[2].ropenum].locky1, rope[chain[2].ropenum].lockx2, rope[chain[2].ropenum].locky2) > (rope[chain[2].ropenum].maxlength * 1.2)){
nailhit.play();
rope[chain[2].ropenum].locked2 = false;
bloodspray(rope[chain[2].ropenum].lockx2, rope[chain[2].ropenum].locky2, 5);
};
};
if (rope[chain[3].ropenum].locked2 == true){
if (approxdistance(rope[chain[3].ropenum].lockx1, rope[chain[3].ropenum].locky1, rope[chain[3].ropenum].lockx2, rope[chain[3].ropenum].locky2) > (rope[chain[3].ropenum].maxlength * 1.2)){
nailhit.play();
rope[chain[3].ropenum].locked2 = false;
bloodspray(rope[chain[3].ropenum].lockx2, rope[chain[3].ropenum].locky2, 5);
};
};
rope[chain[0].ropenum].lockx2 = ((megazombie[0].cx + megazombie[0].movex) - 8);
rope[chain[0].ropenum].locky2 = (((megazombie[0].cy + megazombie[0].movey) + 30) - 5);
rope[chain[1].ropenum].lockx2 = ((megazombie[0].cx + megazombie[0].movex) + 5);
rope[chain[1].ropenum].locky2 = (((megazombie[0].cy + megazombie[0].movey) + 30) + 14);
rope[chain[2].ropenum].lockx2 = ((megazombie[0].cx + megazombie[0].movex) - 10);
rope[chain[2].ropenum].locky2 = (((megazombie[0].cy + megazombie[0].movey) + 30) + 5);
rope[chain[3].ropenum].lockx2 = ((megazombie[0].cx + megazombie[0].movex) + 3);
rope[chain[3].ropenum].locky2 = (((megazombie[0].cy + megazombie[0].movey) + 30) - 12);
if ((((countweapons() == 0)) && ((player[0].x < 250)))){
createrpg(552, 134, 0, 84, false, -1, false);
};
if ((((countpickups() == 0)) && ((player[0].x > 350)))){
createhealth(50, 105, false);
};
if ((((bool2 == false)) && ((megazombie[0].active == false)))){
bool1 = true;
chain[0].active = false;
chain[1].active = false;
};
if (megazombie[0].active == false){
counter1 = (counter1 + 1);
};
if (counter1 >= 200){
loadmap((mapnumber + 1));
};
};
if (mapnumber == 16){
particlequality = 0;
particlealpha = 0;
if ((((counter1 > 150)) && ((bool1 == false)))){
loadmap((mapnumber + 1));
};
counter1 = (counter1 + 1);
};
if (mapnumber == 17){
if (counter1 == 40){
plane.play();
};
if (counter1 == 200){
nuclearblast(300, 233);
city[0].frame = 1;
};
if (counter2 > 440){
if (bool2 == false){
bool2 = true;
resetgame();
backdrop.visible = false;
background.visible = false;
foreground.visible = false;
cursor.visible = false;
wait = 0;
gotoAndPlay(4);
};
};
counter1 = (counter1 + 1);
counter2 = (counter2 + 1);
};
if (debugmode == true){
if (clicking == true){
pdistance = 0;
lowestpnum2 = -1;
lowestpdistance = 16;
physicspush(mouseX, mouseY, 0, 0, 0);
u2 = 0;
while (u2 < ps) {
if (p[u2].active == true){
temppdistance = approxdistance(mouseX, mouseY, p[u2].x, p[u2].y);
if (temppdistance < lowestpdistance){
lowestpdistance = temppdistance;
lowestpnum2 = u2;
};
};
u2 = (u2 + 1);
};
selectedp = lowestpnum2;
};
if ((((clicking == true)) && ((selectedp > -1)))){
p[selectedp].x = mouseX;
p[selectedp].y = mouseY;
};
};
};
}
public function bloodspray(_arg1:Number, _arg2:Number, _arg3:int){
numberofps = _arg3;
if (numberofps > maxbloodps){
numberofps = maxbloodps;
};
q = 0;
while (q < numberofps) {
if (q == 0){
creategp(_arg1, _arg2, ((Math.random() * 4) + 4), (Math.random() * 360), ((Math.random() * 4) + 1), 0.9, 0.05, ((Math.random() * 8) + 8), bloodcolor(), false);
} else {
creategp(_arg1, _arg2, ((Math.random() * 4) + 4), (Math.random() * 360), ((Math.random() * 4) + 1), 0.9, 0.05, ((Math.random() * 8) + 8), bloodcolor(), true);
};
q = (q + 1);
};
}
public function menubtnclick(_arg1){
this.removeEventListener(Event.ENTER_FRAME, menustep2);
gotoAndPlay(5);
}
public function blooddrip(_arg1:Number, _arg2:Number){
creategp(_arg1, _arg2, ((Math.random() * 2) + 2), ((Math.random() * 90) + 45), Math.random(), 0.97, 0.05, ((Math.random() * 12) + 12), bloodcolor(), true);
}
public function turretmuzzleflash(_arg1:Number, _arg2:Number, _arg3:Number){
turretshoot.play();
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 12, 7, 0.6);
q = 0;
while (q < 4) {
creategp(_arg1, _arg2, ((Math.random() * 8) + 8), correctdirection(((_arg3 + (Math.random() * 50)) - 25)), ((Math.random() * 3) + 1), 0.9, -0.05, ((Math.random() * 15) + 15), muzzlesmokecolor(), true);
q = (q + 1);
};
creategp(_arg1, _arg2, ((Math.random() * 5) + 10), 0, 0, 0, 0, 3, muzzleflashcolor(), false);
}
public function createbodyB(){
bodyB[bodyBs] = new bodyBmc();
bodypartscontainer.addChild(bodyB[bodyBs]);
bodyB[bodyBs].active = true;
bodyB[bodyBs].visible = true;
bodyB[bodyBs].x = -100;
bodyB[bodyBs].y = -100;
bodyB[bodyBs].frame = 0;
bodyBs = (bodyBs + 1);
}
public function createbodyC(){
bodyC[bodyCs] = new bodyCmc();
bodypartscontainer.addChild(bodyC[bodyCs]);
bodyC[bodyCs].active = true;
bodyC[bodyCs].visible = true;
bodyC[bodyCs].x = -100;
bodyC[bodyCs].y = -100;
bodyC[bodyCs].frame = 0;
bodyCs = (bodyCs + 1);
}
public function createbodyD(){
bodyD[bodyDs] = new bodyDmc();
bodypartscontainer.addChild(bodyD[bodyDs]);
bodyD[bodyDs].active = true;
bodyD[bodyDs].visible = true;
bodyD[bodyDs].x = -100;
bodyD[bodyDs].y = -100;
bodyD[bodyDs].frame = 0;
bodyDs = (bodyDs + 1);
}
public function createrpg(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:Number, _arg5:Boolean, _arg6:int, _arg7:Boolean){
rpg[rpgs] = new rpgmc();
weaponscontainer.addChild(rpg[rpgs]);
rpg[rpgs].dummy = _arg7;
rpg[rpgs].active = true;
rpg[rpgs].visible = true;
rpg[rpgs].fade = _arg5;
rpg[rpgs].facedirection = _arg3;
if (_arg3 == 1){
rpg[rpgs].scaleX = -1;
};
rpg[rpgs].x = -1000;
rpg[rpgs].y = -1000;
rpg[rpgs].livetime = 0;
rpg[rpgs].pointdirection = _arg4;
rpg[rpgs].linenum = lines;
if (_arg7 == false){
rpg[rpgs].filters = [weaponglowfilter];
};
createline((_arg1 - vectorx(_arg4, (rpglength * 0.5))), (_arg2 - vectory(_arg4, (rpglength * 0.5))), (_arg1 + vectorx(_arg4, (rpglength * 0.5))), (_arg2 + vectory(_arg4, (rpglength * 0.5))), weaponaf, weapong, weaponf, _arg5, _arg6, false);
rpgs = (rpgs + 1);
}
public function createbodyA(){
bodyA[bodyAs] = new bodyAmc();
bodypartscontainer.addChild(bodyA[bodyAs]);
bodyA[bodyAs].active = true;
bodyA[bodyAs].visible = true;
bodyA[bodyAs].x = -100;
bodyA[bodyAs].y = -100;
bodyA[bodyAs].frame = 0;
bodyAs = (bodyAs + 1);
}
public function createshotgun(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:Number, _arg5:Boolean, _arg6:int){
shotgun[shotguns] = new shotgunmc();
weaponscontainer.addChild(shotgun[shotguns]);
shotgun[shotguns].active = true;
shotgun[shotguns].visible = true;
shotgun[shotguns].fade = _arg5;
shotgun[shotguns].facedirection = _arg3;
if (_arg3 == 1){
shotgun[shotguns].scaleX = -1;
};
shotgun[shotguns].x = -1000;
shotgun[shotguns].y = -1000;
shotgun[shotguns].livetime = 0;
shotgun[shotguns].pointdirection = _arg4;
shotgun[shotguns].linenum = lines;
shotgun[shotguns].filters = [weaponglowfilter];
createline((_arg1 - vectorx(_arg4, (shotgunlength * 0.5))), (_arg2 - vectory(_arg4, (shotgunlength * 0.5))), (_arg1 + vectorx(_arg4, (shotgunlength * 0.5))), (_arg2 + vectory(_arg4, (shotgunlength * 0.5))), weaponaf, weapong, weaponf, _arg5, _arg6, false);
shotguns = (shotguns + 1);
}
public function directiontopoint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (((!((_arg1 == _arg3))) && (!((_arg2 == _arg4))))){
_local5 = Math.abs((_arg4 - _arg2));
_local6 = Math.abs((_arg3 - _arg1));
_local7 = 0;
_local8 = 0;
if (_local6 > _local5){
_local7 = (_local5 / _local6);
_local7 = Math.floor((_local7 * 100));
_local8 = tdtp[_local7];
} else {
_local7 = (_local6 / _local5);
_local7 = Math.floor((_local7 * 100));
_local8 = (90 - tdtp[_local7]);
};
if ((((_arg4 < _arg2)) && ((_arg3 < _arg1)))){
_local8 = (180 - _local8);
};
if ((((_arg4 > _arg2)) && ((_arg3 < _arg1)))){
_local8 = (180 + _local8);
};
if ((((_arg4 > _arg2)) && ((_arg3 > _arg1)))){
_local8 = (360 - _local8);
};
} else {
if ((((_arg3 == _arg1)) && ((_arg4 == _arg2)))){
_local8 = 0;
};
if ((((_arg3 == _arg1)) && ((_arg4 > _arg2)))){
_local8 = 270;
};
if ((((_arg3 == _arg1)) && ((_arg4 < _arg2)))){
_local8 = 90;
};
if ((((_arg4 == _arg2)) && ((_arg3 > _arg1)))){
_local8 = 0;
};
if ((((_arg4 == _arg2)) && ((_arg3 < _arg1)))){
_local8 = 180;
};
};
return (_local8);
}
public function vectory(_arg1:Number, _arg2:Number):Number{
var _local3:uint;
_local3 = Math.round(_arg1);
return ((-(tsin[_local3]) * _arg2));
}
public function vectorx(_arg1:Number, _arg2:Number):Number{
var _local3:uint;
_local3 = Math.round(_arg1);
return ((tcos[_local3] * _arg2));
}
public function laserimpact(_arg1:Number, _arg2:Number){
q = 0;
while (q < 5) {
creategp(_arg1, _arg2, ((Math.random() * 3) + 3), (Math.random() * 360), ((Math.random() * 2) + 2), 0.95, 0, ((Math.random() * 4) + 4), 0xFF00, true);
q = (q + 1);
};
}
public function pphysics(_arg1:uint, _arg2:Boolean){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:uint;
_local3 = 1;
_local4 = 0;
_local5 = 0;
_local6 = p[_arg1].x;
_local7 = p[_arg1].y;
_local8 = 0;
_local4 = (p[_arg1].x - p[_arg1].lx);
_local5 = ((p[_arg1].y - p[_arg1].ly) + p[_arg1].g);
if (_arg2 == true){
_local8 = 0;
while (_local8 < waterpools) {
if (waterpool[_local8].active == true){
if ((((((((p[_arg1].x > waterpool[_local8].x)) && ((p[_arg1].x < (waterpool[_local8].x + waterpool[_local8].xwidth))))) && ((p[_arg1].y > waterpool[_local8].y)))) && ((p[_arg1].y < (waterpool[_local8].y + waterpool[_local8].depth))))){
_local3 = waterpool[_local8].ffactor;
_local8 = (waterpools + 1);
};
};
_local8 = (_local8 + 1);
};
};
_local4 = (_local4 * (p[_arg1].af * _local3));
_local5 = (_local5 * (p[_arg1].af * _local3));
if (Math.abs(_local4) > maxdelta){
if (_local4 > 0){
_local4 = maxdelta;
};
if (_local4 < 0){
_local4 = -(maxdelta);
};
};
if (Math.abs(_local5) > maxdelta){
if (_local5 > 0){
_local5 = maxdelta;
};
if (_local5 < 0){
_local5 = -(maxdelta);
};
};
p[_arg1].x = (p[_arg1].x + _local4);
p[_arg1].y = (p[_arg1].y + _local5);
p[_arg1].lx = _local6;
p[_arg1].ly = _local7;
}
public function waterexplosion(_arg1, _arg2, _arg3){
q = 0;
while (q < 5) {
creategp(_arg1, _arg2, ((Math.random() * 12) + 12), ((Math.random() * 30) + 75), ((Math.random() * 4) + 4), 0.96, 0.15, ((Math.random() * 30) + 30), _arg3, true);
q = (q + 1);
};
}
public function jumpdust(_arg1:Number, _arg2:Number){
q = 0;
while (q < 4) {
creategp(_arg1, _arg2, ((Math.random() * 5) + 8), (Math.random() * 360), Math.random(), 1, 0, ((Math.random() * 15) + 15), 11643546, true);
q = (q + 1);
};
}
public function megazombiefireexhaustparticles(_arg1:Number, _arg2:Number){
creategp(((_arg1 + (Math.random() * 10)) - 5), _arg2, ((Math.random() * 5) + 10), ((Math.random() * 80) + 230), ((Math.random() * 2) + 3), 0.9, 0.01, ((Math.random() * 8) + 16), 0x8C8C8C, true);
creategp(((_arg1 + (Math.random() * 10)) - 5), _arg2, ((Math.random() * 4) + 8), ((Math.random() * 80) + 230), ((Math.random() * 2) + 2), 0.9, 0.01, ((Math.random() * 8) + 12), 0xFFCC00, true);
creategp(((_arg1 + (Math.random() * 10)) - 5), _arg2, ((Math.random() * 3) + 6), ((Math.random() * 80) + 230), ((Math.random() * 2) + 1), 0.9, 0.01, ((Math.random() * 8) + 8), 0xFFFF00, true);
}
public function createlinedebris(_arg1:Number, _arg2:Number, _arg3:uint){
dchance = 0;
if (debrisquality == 1){
dchance = Math.floor((Math.random() * 2));
};
if (dchance == 0){
linedebris[linedebriss] = new linedebrismc();
debriscontainer.addChild(linedebris[linedebriss]);
linedebris[linedebriss].active = true;
linedebris[linedebriss].visible = true;
linedebris[linedebriss].x = -1000;
linedebris[linedebriss].y = -1000;
linedebris[linedebriss].frame = _arg3;
linedebris[linedebriss].livetime = 0;
linedebris[linedebriss].linenum = lines;
createline((_arg1 - (linedebrislength * 0.5)), _arg2, (_arg1 + (linedebrislength * 0.5)), _arg2, linedebrisaf, linedebrisg, linedebrisf, true, -1, false);
linedebriss = (linedebriss + 1);
};
}
public function rpgmuzzleflash(_arg1:Number, _arg2:Number, _arg3:Number){
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 12, 7, 0.6);
q = 0;
while (q < 4) {
creategp(_arg1, _arg2, ((Math.random() * 5) + 5), correctdirection(((_arg3 + (Math.random() * 80)) - 40)), ((Math.random() * 3) + 1), 0.9, -0.05, ((Math.random() * 10) + 20), muzzlesmokecolor(), true);
q = (q + 1);
};
q = 0;
while (q < 2) {
creategp(_arg1, _arg2, ((Math.random() * 3) + 3), correctdirection(((_arg3 + (Math.random() * 30)) - 15)), ((Math.random() * 2) + 2), 0.92, 0, ((Math.random() * 10) + 10), muzzleflashcolor(), false);
q = (q + 1);
};
}
public function pointcollide(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Boolean{
if ((((((((_arg1 > _arg3)) && ((_arg1 < _arg5)))) && ((_arg2 > _arg4)))) && ((_arg2 < _arg6)))){
return (true);
};
return (false);
}
public function createlowerarm(_arg1){
lowerarm[lowerarms] = new lowerarmmc();
bodypartscontainer.addChild(lowerarm[lowerarms]);
lowerarm[lowerarms].visible = true;
lowerarm[lowerarms].active = true;
lowerarm[lowerarms].x = -100;
lowerarm[lowerarms].y = -100;
lowerarm[lowerarms].frame = _arg1;
lowerarm[lowerarms].gotoAndPlay((_arg1 + 1));
lowerarms = (lowerarms + 1);
}
public function chainsawimpact(_arg1:Number, _arg2:Number){
creategp(_arg1, _arg2, ((Math.random() * 5) + 5), (Math.random() * 360), ((Math.random() * 5) + 3), 0.5, -0.15, ((Math.random() * 15) + 10), impactsmokecolor(), true);
creategp(_arg1, _arg2, ((Math.random() * 2) + 2), (Math.random() * 360), ((Math.random() * 3) + 1), 1, 0, ((Math.random() * 5) + 5), 0xFFFF00, true);
}
public function rgb(_arg1:int, _arg2:int, _arg3:int):int{
var _local4:int;
_local4 = new int();
_local4 = 0;
_local4 = (((((_local4 | _arg1) << 8) | _arg2) << 8) | _arg3);
return (_local4);
}
public function startflash(){
screenflash.active = true;
screenflash.visible = true;
screenflash.y = 0;
screenflash.x = 0;
screenflash.alpha = 1;
}
public function creategrenade(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:int){
grenade[grenades] = new grenademc();
projectilecontainer.addChild(grenade[grenades]);
grenade[grenades].active = true;
grenade[grenades].visible = true;
grenade[grenades].side = _arg6;
grenade[grenades].x = _arg1;
grenade[grenades].y = _arg2;
grenade[grenades].rotation = (Math.random() * 360);
grenade[grenades].playedsounds = 0;
grenade[grenades].livetime = 0;
grenade[grenades].rotatespeed = _arg5;
grenade[grenades].pointnum = points;
createpoint(_arg1, _arg2, grenadeaf, grenadeg, grenadef, true, -1, false);
p[point[grenade[grenades].pointnum].firstpnum].x = (p[point[grenade[grenades].pointnum].firstpnum].x + vectorx2(_arg3, _arg4));
p[point[grenade[grenades].pointnum].firstpnum].y = (p[point[grenade[grenades].pointnum].firstpnum].y + vectory2(_arg3, _arg4));
grenades = (grenades + 1);
}
public function createbullet(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:int, _arg7:Number, _arg8:Number, _arg9:Boolean):Boolean{
foundbullet = -1;
i = 0;
while (i < bullets) {
if (bullet[i].active == false){
foundbullet = i;
i = (bullets + 1);
};
i = (i + 1);
};
hitsomething = false;
if (foundbullet > -1){
bullet[foundbullet].x2 = (_arg1 + vectorx2(_arg3, _arg4));
bullet[foundbullet].y2 = (_arg2 + vectory2(_arg3, _arg4));
if (segmentcollide(_arg1, _arg2, bullet[foundbullet].x2, bullet[foundbullet].y2) == true){
hitsomething = true;
bullet[foundbullet].x2 = bestcx;
bullet[foundbullet].y2 = bestcy;
};
bullet[foundbullet].active = true;
bullet[foundbullet].side = _arg6;
bullet[foundbullet].damage = _arg5;
bullet[foundbullet].x1 = _arg1;
bullet[foundbullet].y1 = _arg2;
bullet[foundbullet].dismember = _arg9;
bullet[foundbullet].direction = directiontopoint(bullet[foundbullet].x1, bullet[foundbullet].y1, bullet[foundbullet].x2, bullet[foundbullet].y2);
drawline(bullet[foundbullet].x1, bullet[foundbullet].y1, bullet[foundbullet].x2, bullet[foundbullet].y2, _arg7, _arg8);
} else {
bullet[bullets] = new Object();
bullet[bullets].x2 = (_arg1 + vectorx2(_arg3, _arg4));
bullet[bullets].y2 = (_arg2 + vectory2(_arg3, _arg4));
if (segmentcollide(_arg1, _arg2, bullet[bullets].x2, bullet[bullets].y2) == true){
hitsomething = true;
bullet[bullets].x2 = bestcx;
bullet[bullets].y2 = bestcy;
};
bullet[bullets].active = true;
bullet[bullets].x1 = _arg1;
bullet[bullets].y1 = _arg2;
bullet[bullets].dismember = _arg9;
bullet[bullets].direction = directiontopoint(bullet[bullets].x1, bullet[bullets].y1, bullet[bullets].x2, bullet[bullets].y2);
bullet[bullets].side = _arg6;
bullet[bullets].damage = _arg5;
drawline(bullet[bullets].x1, bullet[bullets].y1, bullet[bullets].x2, bullet[bullets].y2, _arg7, _arg8);
bullets = (bullets + 1);
};
impactx = bestcx;
impacty = bestcy;
return (hitsomething);
}
public function createsmgammo(_arg1:Number, _arg2:Number, _arg3:Boolean){
smgammo[smgammos] = new smgammomc();
pickupscontainer.addChild(smgammo[smgammos]);
smgammo[smgammos].active = true;
smgammo[smgammos].visible = true;
smgammo[smgammos].fade = _arg3;
smgammo[smgammos].x = -500;
smgammo[smgammos].y = -500;
smgammo[smgammos].livetime = 0;
smgammo[smgammos].boxnum = boxes;
smgammo[smgammos].filters = [pickupglowfilter];
createbox(_arg1, _arg2, smgammosidelength, pickupaf, pickupg, pickupf, _arg3, -1, false);
smgammos = (smgammos + 1);
}
public function rpgsmoke(_arg1:Number, _arg2:Number){
creategp(_arg1, _arg2, ((Math.random() * 2) + 2), Math.random(), Math.random(), 0.95, -0.1, ((Math.random() * 10) + 30), muzzlesmokecolor(), true);
}
public function stopflash(){
screenflash.active = false;
screenflash.visible = false;
}
public function createfire(_arg1:Number, _arg2:Number, _arg3:int){
fire[fires] = new Object();
fire[fires].x = _arg1;
fire[fires].y = _arg2;
fire[fires].delay = 0;
fire[fires].active = true;
fire[fires].livetime = 0;
fire[fires].maxlivetime = _arg3;
fires = (fires + 1);
}
public function fireparticles(_arg1:Number, _arg2:Number){
creategp(_arg1, _arg2, ((Math.random() * 4) + 8), (Math.random() * 360), Math.random(), 0.95, -0.1, ((Math.random() * 20) + 40), 0x3C3C3C, false);
creategp(_arg1, (_arg2 + 5), ((Math.random() * 10) + 5), ((Math.random() * 90) + 45), (Math.random() + 1), 0.9, -0.05, ((Math.random() * 10) + 10), 16489988, false);
}
public function optionsbtnclick(_arg1){
gotoAndPlay(6);
}
public function zombiefire(_arg1:Number, _arg2:Number){
createlight(lightcontainer, _arg1, ((_arg2 + (Math.random() * 16)) - 8), firecolor(), (8 + (Math.random() * 4)), 7, (0.33 + (Math.random() / 3)));
creategp(_arg1, _arg2, ((Math.random() * 4) + 8), (Math.random() * 360), Math.random(), 0.95, -0.2, ((Math.random() * 10) + 10), 0x3C3C3C, true);
creategp(_arg1, (_arg2 + 5), ((Math.random() * 4) + 8), (Math.random() * 360), (Math.random() + 1), 0.9, -0.1, ((Math.random() * 5) + 5), 16489988, true);
}
public function pistolimpact(_arg1:Number, _arg2:Number){
q = 0;
while (q < 1) {
creategp(_arg1, _arg2, ((Math.random() * 5) + 5), (Math.random() * 360), ((Math.random() * 5) + 3), 0.5, -0.15, ((Math.random() * 15) + 10), impactsmokecolor(), true);
q = (q + 1);
};
creategp(_arg1, _arg2, ((Math.random() * 5) + 5), 0, 0, 0, 0, 4, impactflashcolor(), false);
}
public function resetgame(){
var _local1:uint;
scaleY = 1;
scaleX = 1;
x = 0;
y = 0;
pickuptextdelay = 0;
pickuptext = "";
messagetextdelay = 0;
messagetext = "";
messagestring = "";
ammotext = "";
healthtext = "";
inmap = false;
deathcounter = 0;
cursor.active = true;
cursor.visible = true;
wateraffectors = 0;
ps = 0;
_local1 = 0;
_local1 = 0;
while (_local1 < drawnlines) {
if (vdrawnline[_local1].parent != null){
vdrawnline[_local1].parent.removeChild(vdrawnline[_local1]);
};
_local1 = (_local1 + 1);
};
drawnlines = 0;
_local1 = 0;
while (_local1 < gps) {
if (vgp[_local1].parent != null){
vgp[_local1].parent.removeChild(vgp[_local1]);
};
_local1 = (_local1 + 1);
};
gps = 0;
_local1 = 0;
while (_local1 < objectlines) {
objectline[_local1].active = false;
if (vobjectline[_local1].parent != null){
vobjectline[_local1].parent.removeChild(vobjectline[_local1]);
};
_local1 = (_local1 + 1);
};
objectlines = 0;
_local1 = 0;
while (_local1 < points) {
point[_local1].active = false;
if (vpoint[_local1].parent != null){
vpoint[_local1].parent.removeChild(vpoint[_local1]);
};
_local1 = (_local1 + 1);
};
points = 0;
_local1 = 0;
while (_local1 < lines) {
if (vline[_local1].parent != null){
vline[_local1].parent.removeChild(vline[_local1]);
};
_local1 = (_local1 + 1);
};
lines = 0;
_local1 = 0;
while (_local1 < ropes) {
if (vrope[_local1].parent != null){
vrope[_local1].parent.removeChild(vrope[_local1]);
};
_local1 = (_local1 + 1);
};
ropes = 0;
_local1 = 0;
while (_local1 < collisionlines) {
if (vcollisionline[_local1].parent != null){
vcollisionline[_local1].parent.removeChild(vcollisionline[_local1]);
};
_local1 = (_local1 + 1);
};
collisionlines = 0;
_local1 = 0;
while (_local1 < boxes) {
if (vbox[_local1].parent != null){
vbox[_local1].parent.removeChild(vbox[_local1]);
};
_local1 = (_local1 + 1);
};
boxes = 0;
_local1 = 0;
while (_local1 < hinges) {
if (vhinge[_local1].parent != null){
vhinge[_local1].parent.removeChild(vhinge[_local1]);
};
_local1 = (_local1 + 1);
};
hinges = 0;
_local1 = 0;
while (_local1 < waterpools) {
if (vwaterpool[_local1].parent != null){
vwaterpool[_local1].parent.removeChild(vwaterpool[_local1]);
};
_local1 = (_local1 + 1);
};
waterpools = 0;
_local1 = 0;
while (_local1 < ragdolls) {
if (vragdoll[_local1].parent != null){
vragdoll[_local1].parent.removeChild(vragdoll[_local1]);
};
_local1 = (_local1 + 1);
};
ragdolls = 0;
players = 0;
_local1 = 0;
while (_local1 < bodyAs) {
if (bodyA[_local1].parent != null){
bodyA[_local1].parent.removeChild(bodyA[_local1]);
};
_local1 = (_local1 + 1);
};
bodyAs = 0;
_local1 = 0;
while (_local1 < bodyBs) {
if (bodyB[_local1].parent != null){
bodyB[_local1].parent.removeChild(bodyB[_local1]);
};
_local1 = (_local1 + 1);
};
bodyBs = 0;
_local1 = 0;
while (_local1 < bodyCs) {
if (bodyC[_local1].parent != null){
bodyC[_local1].parent.removeChild(bodyC[_local1]);
};
_local1 = (_local1 + 1);
};
bodyCs = 0;
_local1 = 0;
while (_local1 < bodyDs) {
if (bodyD[_local1].parent != null){
bodyD[_local1].parent.removeChild(bodyD[_local1]);
};
_local1 = (_local1 + 1);
};
bodyDs = 0;
_local1 = 0;
while (_local1 < legAs) {
if (legA[_local1].parent != null){
legA[_local1].parent.removeChild(legA[_local1]);
};
_local1 = (_local1 + 1);
};
legAs = 0;
_local1 = 0;
while (_local1 < legBs) {
if (legB[_local1].parent != null){
legB[_local1].parent.removeChild(legB[_local1]);
};
_local1 = (_local1 + 1);
};
legBs = 0;
_local1 = 0;
while (_local1 < legCs) {
if (legC[_local1].parent != null){
legC[_local1].parent.removeChild(legC[_local1]);
};
_local1 = (_local1 + 1);
};
legCs = 0;
_local1 = 0;
while (_local1 < legDs) {
if (legD[_local1].parent != null){
legD[_local1].parent.removeChild(legD[_local1]);
};
_local1 = (_local1 + 1);
};
legDs = 0;
_local1 = 0;
while (_local1 < torsos) {
if (torso[_local1].parent != null){
torso[_local1].parent.removeChild(torso[_local1]);
};
_local1 = (_local1 + 1);
};
torsos = 0;
_local1 = 0;
while (_local1 < upperlegs) {
if (upperleg[_local1].parent != null){
upperleg[_local1].parent.removeChild(upperleg[_local1]);
};
_local1 = (_local1 + 1);
};
upperlegs = 0;
_local1 = 0;
while (_local1 < lowerlegs) {
if (lowerleg[_local1].parent != null){
lowerleg[_local1].parent.removeChild(lowerleg[_local1]);
};
_local1 = (_local1 + 1);
};
lowerlegs = 0;
_local1 = 0;
while (_local1 < upperarms) {
if (upperarm[_local1].parent != null){
upperarm[_local1].parent.removeChild(upperarm[_local1]);
};
_local1 = (_local1 + 1);
};
upperarms = 0;
_local1 = 0;
while (_local1 < lowerarms) {
if (lowerarm[_local1].parent != null){
lowerarm[_local1].parent.removeChild(lowerarm[_local1]);
};
_local1 = (_local1 + 1);
};
lowerarms = 0;
_local1 = 0;
while (_local1 < heads) {
if (head[_local1].parent != null){
head[_local1].parent.removeChild(head[_local1]);
};
_local1 = (_local1 + 1);
};
heads = 0;
_local1 = 0;
while (_local1 < rifles) {
if (rifle[_local1].parent != null){
rifle[_local1].parent.removeChild(rifle[_local1]);
};
_local1 = (_local1 + 1);
};
rifles = 0;
_local1 = 0;
while (_local1 < smgs) {
if (smg[_local1].parent != null){
smg[_local1].parent.removeChild(smg[_local1]);
};
_local1 = (_local1 + 1);
};
smgs = 0;
_local1 = 0;
while (_local1 < pistols) {
if (pistol[_local1].parent != null){
pistol[_local1].parent.removeChild(pistol[_local1]);
};
_local1 = (_local1 + 1);
};
pistols = 0;
_local1 = 0;
while (_local1 < chainsaws) {
if (chainsaw[_local1].parent != null){
chainsaw[_local1].parent.removeChild(chainsaw[_local1]);
};
_local1 = (_local1 + 1);
};
chainsaws = 0;
_local1 = 0;
while (_local1 < shotguns) {
if (shotgun[_local1].parent != null){
shotgun[_local1].parent.removeChild(shotgun[_local1]);
};
_local1 = (_local1 + 1);
};
shotguns = 0;
_local1 = 0;
while (_local1 < nailguns) {
if (nailgun[_local1].parent != null){
nailgun[_local1].parent.removeChild(nailgun[_local1]);
};
_local1 = (_local1 + 1);
};
nailguns = 0;
_local1 = 0;
while (_local1 < rpgs) {
if (rpg[_local1].parent != null){
rpg[_local1].parent.removeChild(rpg[_local1]);
};
_local1 = (_local1 + 1);
};
rpgs = 0;
_local1 = 0;
while (_local1 < grenades) {
if (grenade[_local1].parent != null){
grenade[_local1].parent.removeChild(grenade[_local1]);
};
_local1 = (_local1 + 1);
};
_local1 = 0;
while (_local1 < nails) {
if (nail[_local1].parent != null){
nail[_local1].parent.removeChild(nail[_local1]);
};
_local1 = (_local1 + 1);
};
_local1 = 0;
while (_local1 < rockets) {
if (rocket[_local1].parent != null){
rocket[_local1].parent.removeChild(rocket[_local1]);
};
_local1 = (_local1 + 1);
};
lasers = 0;
rockets = 0;
nails = 0;
movetrails = 0;
grenades = 0;
blasts = 0;
bullets = 0;
hitzones = 0;
hits = 0;
enemyAs = 0;
enemyBs = 0;
enemyCs = 0;
_local1 = 0;
while (_local1 < turretbases) {
if (turretbase[_local1].parent != null){
turretbase[_local1].parent.removeChild(turretbase[_local1]);
};
if (turretbarrel[_local1].parent != null){
turretbarrel[_local1].parent.removeChild(turretbarrel[_local1]);
};
_local1 = (_local1 + 1);
};
turretbarrels = 0;
turretbases = 0;
_local1 = 0;
while (_local1 < megazombies) {
if (megazombie[_local1].parent != null){
megazombie[_local1].parent.removeChild(megazombie[_local1]);
};
if (megazombiegun[_local1].parent != null){
megazombiegun[_local1].parent.removeChild(megazombiegun[_local1]);
};
_local1 = (_local1 + 1);
};
megazombies = 0;
megazombieguns = 0;
chaindebriss = 0;
_local1 = 0;
while (_local1 < strings) {
if (vstring[_local1].parent != null){
vstring[_local1].parent.removeChild(vstring[_local1]);
};
_local1 = (_local1 + 1);
};
strings = 0;
_local1 = 0;
while (_local1 < pointdebriss) {
if (pointdebris[_local1].parent != null){
pointdebris[_local1].parent.removeChild(pointdebris[_local1]);
};
_local1 = (_local1 + 1);
};
pointdebriss = 0;
_local1 = 0;
while (_local1 < linedebriss) {
if (linedebris[_local1].parent != null){
linedebris[_local1].parent.removeChild(linedebris[_local1]);
};
_local1 = (_local1 + 1);
};
linedebriss = 0;
_local1 = 0;
while (_local1 < boxdebriss) {
if (boxdebris[_local1].parent != null){
boxdebris[_local1].parent.removeChild(boxdebris[_local1]);
};
_local1 = (_local1 + 1);
};
boxdebriss = 0;
chaindebriss = 0;
limbs = 0;
corpses = 0;
_local1 = 0;
while (_local1 < bulletcasings) {
if (bulletcasing[_local1].parent != null){
bulletcasing[_local1].parent.removeChild(bulletcasing[_local1]);
};
_local1 = (_local1 + 1);
};
bulletcasings = 0;
chains = 0;
_local1 = 0;
while (_local1 < links) {
if (link[_local1].parent != null){
link[_local1].parent.removeChild(link[_local1]);
};
_local1 = (_local1 + 1);
};
links = 0;
_local1 = 0;
while (_local1 < healths) {
if (health[_local1].parent != null){
health[_local1].parent.removeChild(health[_local1]);
};
_local1 = (_local1 + 1);
};
healths = 0;
_local1 = 0;
while (_local1 < shotgunammos) {
if (shotgunammo[_local1].parent != null){
shotgunammo[_local1].parent.removeChild(shotgunammo[_local1]);
};
_local1 = (_local1 + 1);
};
shotgunammos = 0;
_local1 = 0;
while (_local1 < smgammos) {
if (smgammo[_local1].parent != null){
smgammo[_local1].parent.removeChild(smgammo[_local1]);
};
_local1 = (_local1 + 1);
};
smgammos = 0;
_local1 = 0;
while (_local1 < pistolammos) {
if (pistolammo[_local1].parent != null){
pistolammo[_local1].parent.removeChild(pistolammo[_local1]);
};
_local1 = (_local1 + 1);
};
pistolammos = 0;
_local1 = 0;
while (_local1 < grenadeammos) {
if (grenadeammo[_local1].parent != null){
grenadeammo[_local1].parent.removeChild(grenadeammo[_local1]);
};
_local1 = (_local1 + 1);
};
grenadeammos = 0;
_local1 = 0;
while (_local1 < rifleammos) {
if (rifleammo[_local1].parent != null){
rifleammo[_local1].parent.removeChild(rifleammo[_local1]);
};
_local1 = (_local1 + 1);
};
rifleammos = 0;
_local1 = 0;
while (_local1 < nailgunammos) {
if (nailgunammo[_local1].parent != null){
nailgunammo[_local1].parent.removeChild(nailgunammo[_local1]);
};
_local1 = (_local1 + 1);
};
nailgunammos = 0;
schannel.stop();
loopchannel.stop();
loopchannel2.stop();
nodes = 0;
winzones = 0;
killzones = 0;
damagezones = 0;
_local1 = 0;
while (_local1 < walldoors) {
if (walldoor[_local1].parent != null){
walldoor[_local1].parent.removeChild(walldoor[_local1]);
};
_local1 = (_local1 + 1);
};
walldoors = 0;
_local1 = 0;
while (_local1 < floordoors) {
if (floordoor[_local1].parent != null){
floordoor[_local1].parent.removeChild(floordoor[_local1]);
};
_local1 = (_local1 + 1);
};
floordoors = 0;
_local1 = 0;
while (_local1 < spinlights) {
if (spinlight[_local1].parent != null){
spinlight[_local1].parent.removeChild(spinlight[_local1]);
};
_local1 = (_local1 + 1);
};
spinlights = 0;
_local1 = 0;
while (_local1 < barrels) {
if (barrel[_local1].parent != null){
barrel[_local1].parent.removeChild(barrel[_local1]);
};
_local1 = (_local1 + 1);
};
barrels = 0;
_local1 = 0;
while (_local1 < crates) {
if (crate[_local1].parent != null){
crate[_local1].parent.removeChild(crate[_local1]);
};
_local1 = (_local1 + 1);
};
crates = 0;
_local1 = 0;
while (_local1 < computers) {
if (computer[_local1].parent != null){
computer[_local1].parent.removeChild(computer[_local1]);
};
_local1 = (_local1 + 1);
};
computers = 0;
_local1 = 0;
while (_local1 < cities) {
if (city[_local1].parent != null){
city[_local1].parent.removeChild(city[_local1]);
};
_local1 = (_local1 + 1);
};
cities = 0;
stoprain();
stopfade();
stopfog();
stopflash();
stopberserkscreen();
fires = 0;
_local1 = 0;
while (_local1 < rats) {
if (rat[_local1].parent != null){
rat[_local1].parent.removeChild(rat[_local1]);
};
_local1 = (_local1 + 1);
};
rats = 0;
_local1 = 0;
while (_local1 < crows) {
if (crow[_local1].parent != null){
crow[_local1].parent.removeChild(crow[_local1]);
};
if (crowwing[_local1].parent != null){
crowwing[_local1].parent.removeChild(crowwing[_local1]);
};
_local1 = (_local1 + 1);
};
crows = 0;
crowwings = 0;
}
public function megazombieexhaustparticles(_arg1:Number, _arg2:Number){
creategp(_arg1, _arg2, ((Math.random() * 4) + 8), ((Math.random() * 60) + 240), ((Math.random() * 1) + 1), 0.96, 0.01, ((Math.random() * 10) + 20), 0x8C8C8C, true);
}
public function startfade(){
fade.active = true;
fade.visible = true;
fade.y = 0;
fade.x = 0;
fade.alpha = 1;
}
public function physicspush(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
var _local6:Number;
var _local7:uint;
var _local8:uint;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_local6 = _arg5;
_local7 = 0;
_local8 = 0;
_local9 = 0;
_local10 = 0;
_local11 = 0;
if (_local6 > maxdelta){
_local6 = maxdelta;
};
_local7 = 0;
while (_local7 < ropes) {
if (rope[_local7].active == true){
_local9 = 0;
_local10 = 0;
_local8 = rope[_local7].firstpnum;
while (_local8 < (rope[_local7].firstpnum + rope[_local7].segments)) {
_local9 = (_local9 + p[_local8].x);
_local10 = (_local10 + p[_local8].y);
_local8 = (_local8 + 1);
};
_local9 = (_local9 / rope[_local7].segments);
_local10 = (_local10 / rope[_local7].segments);
if (approxdistance(_arg1, _arg2, _local9, _local10) <= ((_arg3 + safetydistance) + rope[_local7].maxlength)){
if (rope[_local7].atrest == false){
_local8 = rope[_local7].firstpnum;
while (_local8 < (rope[_local7].firstpnum + rope[_local7].segments)) {
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
rope[_local7].restcounter = 0;
rope[_local7].atrest = false;
_local8 = rope[_local7].firstpnum;
while (_local8 < (rope[_local7].firstpnum + rope[_local7].segments)) {
p[_local8].active = true;
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
};
_local7 = (_local7 + 1);
};
_local7 = 0;
while (_local7 < ragdolls) {
if (ragdoll[_local7].active == true){
_local9 = ((p[(ragdoll[_local7].firstpnum + 4)].x + p[(ragdoll[_local7].firstpnum + 5)].x) * 0.5);
_local10 = ((p[(ragdoll[_local7].firstpnum + 4)].y + p[(ragdoll[_local7].firstpnum + 5)].y) * 0.5);
if (approxdistance(_arg1, _arg2, _local9, _local10) <= ((_arg3 + safetydistance) + (ragdollheight * 2))){
if (ragdoll[_local7].atrest == false){
_local8 = ragdoll[_local7].firstpnum;
while (_local8 < (ragdoll[_local7].firstpnum + 14)) {
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
ragdoll[_local7].restcounter = 0;
wateraffector[ragdoll[_local7].wateraffectornum].active = true;
ragdoll[_local7].atrest = false;
_local8 = ragdoll[_local7].firstpnum;
while (_local8 < (ragdoll[_local7].firstpnum + 14)) {
if (p[_local8].destroyed == false){
p[_local8].active = true;
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
};
_local8 = (_local8 + 1);
};
};
};
_local7 = (_local7 + 1);
};
_local7 = 0;
while (_local7 < boxes) {
if (box[_local7].active == true){
_local9 = ((p[box[_local7].firstpnum].x + p[(box[_local7].firstpnum + 2)].x) * 0.5);
_local10 = ((p[box[_local7].firstpnum].y + p[(box[_local7].firstpnum + 2)].y) * 0.5);
if (approxdistance(_arg1, _arg2, _local9, _local10) <= ((_arg3 + safetydistance) + box[_local7].sidelength)){
if (box[_local7].atrest == false){
_local8 = box[_local7].firstpnum;
while (_local8 < (box[_local7].firstpnum + 4)) {
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
wateraffector[box[_local7].wateraffectornum].active = true;
box[_local7].restcounter = 0;
box[_local7].atrest = false;
_local8 = box[_local7].firstpnum;
while (_local8 < (box[_local7].firstpnum + 4)) {
p[_local8].active = true;
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
};
_local7 = (_local7 + 1);
};
_local7 = 0;
while (_local7 < hinges) {
if (hinge[_local7].active == true){
_local9 = p[(hinge[_local7].firstpnum + 1)].x;
_local10 = p[(hinge[_local7].firstpnum + 1)].y;
if (approxdistance(_arg1, _arg2, _local9, _local10) <= ((_arg3 + safetydistance) + hinge[_local7].hingelength)){
if (hinge[_local7].atrest == false){
_local8 = hinge[_local7].firstpnum;
while (_local8 < (hinge[_local7].firstpnum + 3)) {
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
hinge[_local7].restcounter = 0;
hinge[_local7].atrest = false;
_local8 = hinge[_local7].firstpnum;
while (_local8 < (hinge[_local7].firstpnum + 3)) {
p[_local8].active = true;
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
};
_local7 = (_local7 + 1);
};
_local7 = 0;
while (_local7 < lines) {
if (line[_local7].active == true){
_local9 = ((p[line[_local7].firstpnum].x + p[(line[_local7].firstpnum + 1)].x) * 0.5);
_local10 = ((p[line[_local7].firstpnum].y + p[(line[_local7].firstpnum + 1)].y) * 0.5);
if (approxdistance(_arg1, _arg2, _local9, _local10) <= ((_arg3 + safetydistance) + line[_local7].linelength)){
if (line[_local7].atrest == false){
_local8 = line[_local7].firstpnum;
while (_local8 < (line[_local7].firstpnum + 2)) {
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
line[_local7].restcounter = 0;
line[_local7].atrest = false;
_local8 = line[_local7].firstpnum;
while (_local8 < (line[_local7].firstpnum + 2)) {
p[_local8].active = true;
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
};
_local7 = (_local7 + 1);
};
_local7 = 0;
while (_local7 < points) {
if (point[_local7].active == true){
_local9 = p[point[_local7].firstpnum].x;
_local10 = p[point[_local7].firstpnum].y;
if (approxdistance(_arg1, _arg2, _local9, _local10) <= (_arg3 + safetydistance)){
if (point[_local7].atrest == false){
_local8 = point[_local7].firstpnum;
while (_local8 < (point[_local7].firstpnum + 1)) {
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
point[_local7].restcounter = 0;
point[_local7].atrest = false;
_local8 = point[_local7].firstpnum;
while (_local8 < (point[_local7].firstpnum + 1)) {
p[_local8].active = true;
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
};
_local7 = (_local7 + 1);
};
_local7 = 0;
while (_local7 < objectlines) {
if (objectline[_local7].active == true){
_local9 = ((p[objectline[_local7].firstpnum].x + p[(objectline[_local7].firstpnum + 1)].x) * 0.5);
_local10 = ((p[objectline[_local7].firstpnum].y + p[(objectline[_local7].firstpnum + 1)].y) * 0.5);
if (approxdistance(_arg1, _arg2, _local9, _local10) <= ((_arg3 + safetydistance) + objectline[_local7].yheight)){
_local8 = objectline[_local7].firstpnum;
while (_local8 < (objectline[_local7].firstpnum + 2)) {
_local11 = approxdistance(_arg1, _arg2, p[_local8].x, p[_local8].y);
if (_local11 < _arg3){
p[_local8].x = (p[_local8].x + vectorx(_arg4, _local6));
p[_local8].y = (p[_local8].y + vectory(_arg4, _local6));
};
_local8 = (_local8 + 1);
};
};
};
_local7 = (_local7 + 1);
};
}
public function findclosestp(_arg1:Number, _arg2:Number):int{
var _local3:Number;
var _local4:int;
var _local5:Number;
var _local6:uint;
_local3 = 0;
_local4 = -1;
_local5 = 10000;
_local6 = 0;
_local6 = 0;
while (_local6 < ps) {
if ((((p[_local6].active == true)) && ((p[_local6].destroyed == false)))){
_local3 = approxdistance(_arg1, _arg2, p[_local6].x, p[_local6].y);
if (_local3 < _local5){
_local5 = _local3;
_local4 = _local6;
};
};
_local6 = (_local6 + 1);
};
return (_local4);
}
public function turretimpact(_arg1:Number, _arg2:Number){
q = 0;
while (q < 3) {
creategp(_arg1, _arg2, ((Math.random() * 5) + 5), (Math.random() * 360), ((Math.random() * 5) + 3), 0.5, -0.15, ((Math.random() * 15) + 10), impactsmokecolor(), true);
q = (q + 1);
};
creategp(_arg1, _arg2, ((Math.random() * 4) + 4), 0, 0, 0, 0, 3, impactflashcolor(), false);
}
public function spawnenemies(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:uint){
if (countenemies() < 3){
if (Math.floor((Math.random() * enemychance)) == 0){
if (_arg4 == 0){
createenemyA(_arg1, _arg2, _arg3, true, false);
};
if (_arg4 == 1){
createenemyB(_arg1, _arg2, _arg3, true, false);
};
if (_arg4 == 2){
createenemyC(_arg1, _arg2, _arg3, true);
};
};
};
}
public function createwateraffector(_arg1:Number, _arg2:Number, _arg3:Number){
wateraffector[wateraffectors] = new Object();
wateraffector[wateraffectors].active = true;
wateraffector[wateraffectors].x = _arg1;
wateraffector[wateraffectors].y = _arg2;
wateraffector[wateraffectors].ly = _arg2;
wateraffector[wateraffectors].radius = _arg3;
wateraffectors = (wateraffectors + 1);
}
public function pcollisions2(_arg1:uint){
var _local2:Number;
var _local3:uint;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local2 = 10000;
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = 0;
_local9 = 0;
_local10 = 0;
_local3 = 0;
while (_local3 < possiblelines) {
if (linecollide(p[_arg1].sx, p[_arg1].sy, p[_arg1].x, p[_arg1].y, collisionline[possiblelinenum[_local3]].x1, collisionline[possiblelinenum[_local3]].y1, collisionline[possiblelinenum[_local3]].x2, collisionline[possiblelinenum[_local3]].y2, collisionline[possiblelinenum[_local3]].slope) == true){
_local4 = approxdistance(cx, cy, p[_arg1].sx, p[_arg1].sy);
if (_local4 < _local2){
_local2 = _local4;
bestcx = cx;
bestcy = cy;
bestsurfacedirection = surfacedirection;
};
};
_local3 = (_local3 + 1);
};
if (_local2 < 10000){
_local5 = directiontopoint(p[_arg1].sx, p[_arg1].sy, bestcx, bestcy);
_local6 = (approxdistance(p[_arg1].x, p[_arg1].y, p[_arg1].lx, p[_arg1].ly) * p[_arg1].f);
_local7 = (approxdistance(p[_arg1].x, p[_arg1].y, bestcx, bestcy) * p[_arg1].f);
_local6 = (_local6 - _local7);
_local8 = Math.abs(finddirection(bestsurfacedirection, _local5));
if (_local8 > 90){
_local8 = correctdirection((bestsurfacedirection + 180));
} else {
_local8 = bestsurfacedirection;
};
_local10 = ((90 - Math.abs(finddirection(_local8, _local5))) / 90);
_local7 = (Math.abs((_local7 * _local10)) + 0.001);
_local6 = (Math.abs((_local6 * _local10)) + 0.001);
_local9 = Math.abs(finddirection((bestsurfacedirection + 90), _local5));
if (_local9 < 90){
_local9 = correctdirection((bestsurfacedirection - 90));
} else {
_local9 = correctdirection((bestsurfacedirection + 90));
};
p[_arg1].sx = (bestcx + vectorx(_local9, 1));
p[_arg1].sy = (bestcy + vectory(_local9, 1));
p[_arg1].x = (p[_arg1].sx + vectorx(_local8, _local7));
p[_arg1].y = (p[_arg1].sy + vectory(_local8, _local7));
p[_arg1].lx = (p[_arg1].sx - vectorx(_local8, _local6));
p[_arg1].ly = (p[_arg1].sy - vectory(_local8, _local6));
} else {
p[_arg1].sy = p[_arg1].y;
p[_arg1].sx = p[_arg1].x;
};
}
public function crateexplosion(_arg1:Number, _arg2:Number){
smallcrash.play();
q = 0;
while (q < 5) {
creategp(_arg1, _arg2, ((Math.random() * 8) + 16), (Math.random() * 360), (Math.random() * 2), 0.975, -0.03, ((Math.random() * 20) + 20), 11643546, true);
q = (q + 1);
};
}
public function reducedbtn0click(_arg1){
graphicsquality = 1;
}
public function createnailgunammo(_arg1:Number, _arg2:Number, _arg3:Boolean){
nailgunammo[nailgunammos] = new nailgunammomc();
pickupscontainer.addChild(nailgunammo[nailgunammos]);
nailgunammo[nailgunammos].active = true;
nailgunammo[nailgunammos].visible = true;
nailgunammo[nailgunammos].fade = _arg3;
nailgunammo[nailgunammos].x = -500;
nailgunammo[nailgunammos].y = -500;
nailgunammo[nailgunammos].livetime = 0;
nailgunammo[nailgunammos].boxnum = boxes;
nailgunammo[nailgunammos].filters = [pickupglowfilter];
createbox(_arg1, _arg2, nailgunammosidelength, pickupaf, pickupg, pickupf, _arg3, -1, false);
nailgunammos = (nailgunammos + 1);
}
public function dismembermentcheck(_arg1:Number, _arg2:Number){
if (Math.floor((Math.random() * 2)) == 0){
if ((((_arg1 >= ((_arg2 + necklength) + vectory(216, chestlength)))) && ((_arg1 < (((_arg2 + necklength) + vectory(216, chestlength)) + upperarmlength))))){
leftarmdamage = 2;
};
if ((((_arg1 >= (((_arg2 + necklength) + vectory(216, chestlength)) + upperarmlength))) && ((_arg1 < ((((_arg2 + necklength) + vectory(216, chestlength)) + upperarmlength) + lowerarmlength))))){
leftarmdamage = 1;
};
} else {
if ((((_arg1 >= ((_arg2 + necklength) + vectory(216, chestlength)))) && ((_arg1 < (((_arg2 + necklength) + vectory(216, chestlength)) + upperarmlength))))){
rightarmdamage = 2;
};
if ((((_arg1 >= (((_arg2 + necklength) + vectory(216, chestlength)) + upperarmlength))) && ((_arg1 < ((((_arg2 + necklength) + vectory(216, chestlength)) + upperarmlength) + lowerarmlength))))){
rightarmdamage = 1;
};
};
if (Math.floor((Math.random() * 2)) == 0){
if ((((_arg1 >= ((_arg2 + necklength) + vectory(288, chestconstraint)))) && ((_arg1 < (((_arg2 + necklength) + vectory(288, chestconstraint)) + upperleglength))))){
leftlegdamage = 2;
};
if ((((_arg1 >= (((_arg2 + necklength) + vectory(288, chestconstraint)) + upperleglength))) && ((_arg1 < ((((_arg2 + necklength) + vectory(288, chestconstraint)) + lowerleglength) + upperleglength))))){
leftlegdamage = 1;
};
} else {
if ((((_arg1 >= ((_arg2 + necklength) + vectory(288, chestconstraint)))) && ((_arg1 < (((_arg2 + necklength) + vectory(288, chestconstraint)) + upperleglength))))){
rightlegdamage = 2;
};
if ((((_arg1 >= (((_arg2 + necklength) + vectory(288, chestconstraint)) + upperleglength))) && ((_arg1 < ((((_arg2 + necklength) + vectory(288, chestconstraint)) + lowerleglength) + upperleglength))))){
rightlegdamage = 1;
};
};
}
public function berserksparks(_arg1:Number, _arg2:Number){
creategp(_arg1, (_arg2 + (Math.random() * 24)), ((Math.random() * 2) + 2), (Math.random() * 360), (Math.random() * 2), 1, 0, ((Math.random() * 5) + 5), 65382, true);
}
public function createsmg(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:Number, _arg5:Boolean, _arg6:int){
smg[smgs] = new smgmc();
weaponscontainer.addChild(smg[smgs]);
smg[smgs].active = true;
smg[smgs].visible = true;
smg[smgs].fade = _arg5;
smg[smgs].facedirection = _arg3;
if (_arg3 == 1){
smg[smgs].scaleX = -1;
};
smg[smgs].x = -1000;
smg[smgs].y = -1000;
smg[smgs].livetime = 0;
smg[smgs].pointdirection = _arg4;
smg[smgs].linenum = lines;
smg[smgs].filters = [weaponglowfilter];
createline((_arg1 - vectorx(_arg4, (smglength * 0.5))), (_arg2 - vectory(_arg4, (smglength * 0.5))), (_arg1 + vectorx(_arg4, (smglength * 0.5))), (_arg2 + vectory(_arg4, (smglength * 0.5))), weaponaf, weapong, weaponf, _arg5, _arg6, false);
smgs = (smgs + 1);
}
public function firecolor():int{
var _local1:int;
_local1 = new int();
_local1 = (Math.random() * 100);
return (rgb((155 + _local1), (100 + _local1), 0));
}
public function createragdoll(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean, _arg7:int, _arg8:Boolean, _arg9:uint, _arg10:uint, _arg11:uint, _arg12:uint){
var _local13:Number;
var _local14:Number;
var _local15:uint;
_local13 = 0;
_local14 = 0;
ragdoll[ragdolls] = new Object();
vragdoll[ragdolls] = new Shape();
physicscontainer.addChild(vragdoll[ragdolls]);
if (_arg6 == true){
ragdoll[ragdolls].atrest = false;
} else {
ragdoll[ragdolls].atrest = true;
};
ragdoll[ragdolls].leftarmsegments = _arg9;
ragdoll[ragdolls].rightarmsegments = _arg10;
ragdoll[ragdolls].leftlegsegments = _arg11;
ragdoll[ragdolls].rightlegsegments = _arg12;
ragdoll[ragdolls].ignorecollisions = _arg8;
ragdoll[ragdolls].restcounter = 0;
ragdoll[ragdolls].deformed = false;
ragdoll[ragdolls].x = _arg1;
ragdoll[ragdolls].y = _arg2;
ragdoll[ragdolls].active = true;
ragdoll[ragdolls].wateraffectornum = wateraffectors;
ragdoll[ragdolls].firstpnum = ps;
createp(_arg1, (_arg2 + ragdollheight), _arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), _arg1, (_arg2 + necklength), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), (_arg1 + vectorx(324, chestlength)), ((_arg2 + necklength) + vectory(324, chestlength)), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), (_arg1 + vectorx(216, chestlength)), ((_arg2 + necklength) + vectory(216, chestlength)), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), (_arg1 + vectorx(288, chestconstraint)), ((_arg2 + necklength) + vectory(288, chestconstraint)), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), (_arg1 + vectorx(252, chestconstraint)), ((_arg2 + necklength) + vectory(252, chestconstraint)), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), p[(ps - 2)].x, (p[(ps - 2)].y + upperleglength), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), p[(ps - 2)].x, (p[(ps - 2)].y + upperleglength), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), p[(ps - 2)].x, (p[(ps - 2)].y + lowerleglength), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), p[(ps - 2)].x, (p[(ps - 2)].y + lowerleglength), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), p[(ps - 8)].x, (p[(ps - 8)].y + upperarmlength), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), p[(ps - 8)].x, (p[(ps - 8)].y + upperarmlength), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), p[(ps - 2)].x, (p[(ps - 2)].y + lowerarmlength), _arg3, _arg4, _arg5, _arg6);
createp(_arg1, (_arg2 + ragdollheight), p[(ps - 2)].x, (p[(ps - 2)].y + lowerarmlength), _arg3, _arg4, _arg5, _arg6);
if (ragdoll[ragdolls].leftarmsegments == 0){
p[(ragdoll[ragdolls].firstpnum + 11)].active = false;
p[(ragdoll[ragdolls].firstpnum + 13)].active = false;
p[(ragdoll[ragdolls].firstpnum + 11)].destroyed = true;
p[(ragdoll[ragdolls].firstpnum + 13)].destroyed = true;
};
if (ragdoll[ragdolls].leftarmsegments == 1){
p[(ragdoll[ragdolls].firstpnum + 13)].active = false;
p[(ragdoll[ragdolls].firstpnum + 13)].destroyed = true;
};
if (ragdoll[ragdolls].rightarmsegments == 0){
p[(ragdoll[ragdolls].firstpnum + 10)].active = false;
p[(ragdoll[ragdolls].firstpnum + 12)].active = false;
p[(ragdoll[ragdolls].firstpnum + 10)].destroyed = true;
p[(ragdoll[ragdolls].firstpnum + 12)].destroyed = true;
};
if (ragdoll[ragdolls].rightarmsegments == 1){
p[(ragdoll[ragdolls].firstpnum + 12)].active = false;
p[(ragdoll[ragdolls].firstpnum + 12)].destroyed = true;
};
if (ragdoll[ragdolls].leftlegsegments == 0){
p[(ragdoll[ragdolls].firstpnum + 7)].active = false;
p[(ragdoll[ragdolls].firstpnum + 9)].active = false;
p[(ragdoll[ragdolls].firstpnum + 7)].destroyed = true;
p[(ragdoll[ragdolls].firstpnum + 9)].destroyed = true;
};
if (ragdoll[ragdolls].leftlegsegments == 1){
p[(ragdoll[ragdolls].firstpnum + 9)].active = false;
p[(ragdoll[ragdolls].firstpnum + 9)].destroyed = true;
};
if (ragdoll[ragdolls].rightlegsegments == 0){
p[(ragdoll[ragdolls].firstpnum + 6)].active = false;
p[(ragdoll[ragdolls].firstpnum + 8)].active = false;
p[(ragdoll[ragdolls].firstpnum + 6)].destroyed = true;
p[(ragdoll[ragdolls].firstpnum + 8)].destroyed = true;
};
if (ragdoll[ragdolls].rightlegsegments == 1){
p[(ragdoll[ragdolls].firstpnum + 8)].active = false;
p[(ragdoll[ragdolls].firstpnum + 8)].destroyed = true;
};
createwateraffector(_arg1, (_arg2 + ragdollheight), ragdollheight);
if (_arg7 > -1){
_local13 = (p[_arg7].x - p[_arg7].lx);
_local14 = (p[_arg7].y - p[_arg7].ly);
_local15 = (ps - 14);
_local15 = (ps - 14);
while (_local15 < ps) {
p[_local15].lx = (p[_local15].lx - _local13);
p[_local15].ly = (p[_local15].ly - _local14);
_local15 = (_local15 + 1);
};
};
ragdolls = (ragdolls + 1);
}
public function fullbtn0click(_arg1){
graphicsquality = 0;
}
public function createrocket(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int){
rocket[rockets] = new rocketmc();
projectilecontainer.addChild(rocket[rockets]);
rocket[rockets].side = _arg4;
rocket[rockets].active = true;
rocket[rockets].visible = true;
rocket[rockets].x = _arg1;
rocket[rockets].y = _arg2;
rocket[rockets].livetime = 0;
rocket[rockets].direction = _arg3;
rocket[rockets].rotation = -(_arg3);
rocket[rockets].side = _arg4;
rocket[rockets].hs = vectorx2(_arg3, rocketspeed);
rocket[rockets].vs = vectory2(_arg3, rocketspeed);
rockets = (rockets + 1);
}
public function chainsawpuff(_arg1:Number, _arg2:Number){
q = 0;
while (q < 3) {
creategp(_arg1, _arg2, ((Math.random() * 3) + 3), (Math.random() * 180), Math.random(), 1, -0.1, ((Math.random() * 10) + 10), impactsmokecolor(), true);
q = (q + 1);
};
}
public function mediumbtnclick(_arg1){
difficulty = 1;
wait = -5;
gotoAndPlay(9);
}
public function drawline(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){
var founddrawnline:int;
var d:uint;
var x1 = _arg1;
var y1 = _arg2;
var x2 = _arg3;
var y2 = _arg4;
var linecolor = _arg5;
var linealpha = _arg6;
founddrawnline = -1;
d = 0;
d = 0;
while (d < drawnlines) {
if (drawnline[d].active == false){
founddrawnline = d;
d = (drawnlines + 1);
};
d = (d + 1);
};
if (founddrawnline > -1){
drawnline[founddrawnline].active = true;
vdrawnline[founddrawnline].visible = true;
drawnline[founddrawnline].x = x1;
drawnline[founddrawnline].y = y1;
vdrawnline[founddrawnline].x = x1;
vdrawnline[founddrawnline].y = y1;
var _local8 = vdrawnline[founddrawnline].graphics;
with (_local8) {
clear();
lineStyle(1, linecolor, linealpha);
lineTo((x2 - x1), (y2 - y1));
};
} else {
vdrawnline[drawnlines] = new Shape();
drawnline[drawnlines] = new Object();
physicscontainer.addChild(vdrawnline[drawnlines]);
_local8 = vdrawnline[drawnlines].graphics;
with (_local8) {
lineStyle(1, linecolor, linealpha);
lineTo((x2 - x1), (y2 - y1));
};
drawnline[drawnlines].active = true;
vdrawnline[drawnlines].visible = true;
drawnline[drawnlines].x = x1;
drawnline[drawnlines].y = y1;
vdrawnline[drawnlines].x = x1;
vdrawnline[drawnlines].y = y1;
drawnlines = (drawnlines + 1);
};
}
public function vectorx2(_arg1:Number, _arg2:Number):Number{
return ((Math.cos((_arg1 * degtorad)) * _arg2));
}
public function createrifle(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:Number, _arg5:Boolean, _arg6:int){
rifle[rifles] = new riflemc();
weaponscontainer.addChild(rifle[rifles]);
rifle[rifles].active = true;
rifle[rifles].visible = true;
rifle[rifles].fade = _arg5;
rifle[rifles].facedirection = _arg3;
if (_arg3 == 1){
rifle[rifles].scaleX = -1;
};
rifle[rifles].x = -1000;
rifle[rifles].y = -1000;
rifle[rifles].livetime = 0;
rifle[rifles].pointdirection = _arg4;
rifle[rifles].linenum = lines;
rifle[rifles].filters = [weaponglowfilter];
createline((_arg1 - vectorx(_arg4, (riflelength * 0.5))), (_arg2 - vectory(_arg4, (riflelength * 0.5))), (_arg1 + vectorx(_arg4, (riflelength * 0.5))), (_arg2 + vectory(_arg4, (riflelength * 0.5))), weaponaf, weapong, weaponf, _arg5, _arg6, false);
rifles = (rifles + 1);
}
public function createlaser(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int){
laser[lasers] = new Object();
laser[lasers].side = _arg4;
laser[lasers].active = true;
laser[lasers].visible = true;
laser[lasers].x = _arg1;
laser[lasers].y = _arg2;
laser[lasers].livetime = 0;
laser[lasers].side = _arg4;
laser[lasers].hs = vectorx2(_arg3, laserspeed);
laser[lasers].vs = vectory2(_arg3, laserspeed);
lasers = (lasers + 1);
}
public function vectory2(_arg1:Number, _arg2:Number):Number{
return ((-(Math.sin((_arg1 * degtorad))) * _arg2));
}
public function createbox(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean, _arg8:int, _arg9:Boolean){
var _local10:Number;
var _local11:Number;
var _local12:uint;
_local10 = 0;
_local11 = 0;
box[boxes] = new Object();
vbox[boxes] = new Shape();
physicscontainer.addChild(vbox[boxes]);
box[boxes].restcounter = 0;
if (_arg7 == true){
box[boxes].atrest = false;
} else {
box[boxes].atrest = true;
};
box[boxes].ignorecollisions = _arg9;
box[boxes].x = _arg1;
box[boxes].y = _arg2;
box[boxes].active = true;
box[boxes].sidelength = _arg3;
box[boxes].firstpnum = ps;
box[boxes].wateraffectornum = wateraffectors;
createp(_arg1, _arg2, (_arg1 - (_arg3 * 0.5)), (_arg2 - (_arg3 * 0.5)), _arg4, _arg5, _arg6, _arg7);
createp(_arg1, _arg2, (_arg1 + (_arg3 * 0.5)), (_arg2 - (_arg3 * 0.5)), _arg4, _arg5, _arg6, _arg7);
createp(_arg1, _arg2, (_arg1 + (_arg3 * 0.5)), (_arg2 + (_arg3 * 0.5)), _arg4, _arg5, _arg6, _arg7);
createp(_arg1, _arg2, (_arg1 - (_arg3 * 0.5)), (_arg2 + (_arg3 * 0.5)), _arg4, _arg5, _arg6, _arg7);
createwateraffector(_arg1, _arg2, _arg3);
if (_arg8 > -1){
_local10 = (p[_arg8].x - p[_arg8].lx);
_local11 = (p[_arg8].y - p[_arg8].ly);
_local12 = (ps - 4);
_local12 = (ps - 4);
while (_local12 < ps) {
p[_local12].lx = (p[_local12].lx - _local10);
p[_local12].ly = (p[_local12].ly - _local11);
_local12 = (_local12 + 1);
};
};
boxes = (boxes + 1);
}
public function createmovetrail(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:uint, _arg6:Number){
var _local7:int;
_local7 = -1;
i = 0;
while (i < movetrails) {
if (movetrail[i].active == false){
_local7 = i;
i = (movetrails + 1);
};
i = (i + 1);
};
if (_local7 > -1){
movetrail[_local7].active = true;
movetrail[_local7].x1 = _arg1;
movetrail[_local7].y1 = _arg2;
movetrail[_local7].x2 = _arg3;
movetrail[_local7].y2 = _arg4;
movetrail[_local7].alpha = 1;
movetrail[_local7].livetime = 0;
movetrail[_local7].maxlivetime = _arg5;
movetrail[_local7].color = _arg6;
} else {
movetrail[movetrails] = new Object();
movetrail[movetrails].active = true;
movetrail[movetrails].x1 = _arg1;
movetrail[movetrails].y1 = _arg2;
movetrail[movetrails].x2 = _arg3;
movetrail[movetrails].y2 = _arg4;
movetrail[movetrails].alpha = 1;
movetrail[movetrails].livetime = 0;
movetrail[movetrails].maxlivetime = _arg5;
movetrail[movetrails].color = _arg6;
movetrails = (movetrails + 1);
};
}
public function createupperarm(_arg1){
upperarm[upperarms] = new upperarmmc();
bodypartscontainer.addChild(upperarm[upperarms]);
upperarm[upperarms].visible = true;
upperarm[upperarms].active = true;
upperarm[upperarms].x = -100;
upperarm[upperarms].y = -100;
upperarm[upperarms].frame = _arg1;
upperarm[upperarms].gotoAndPlay((_arg1 + 1));
upperarms = (upperarms + 1);
}
public function keydown(_arg1:KeyboardEvent){
if (_arg1.keyCode == 32){
pkeyspace = true;
};
if (_arg1.keyCode == 81){
pkeyq = true;
smgshoot.play();
};
if (_arg1.keyCode == 68){
pkeyd = true;
};
if (_arg1.keyCode == 87){
pkeyw = true;
};
if (_arg1.keyCode == 65){
pkeya = true;
};
if (_arg1.keyCode == 49){
pkey1 = true;
};
if (_arg1.keyCode == 50){
pkey2 = true;
};
if (_arg1.keyCode == 51){
pkey3 = true;
};
if (_arg1.keyCode == 52){
pkey4 = true;
};
if (_arg1.keyCode == 53){
pkey5 = true;
};
if (_arg1.keyCode == 54){
pkey6 = true;
};
if (_arg1.keyCode == 55){
pkey7 = true;
};
if (_arg1.keyCode == 56){
pkey8 = true;
};
}
public function reducedbtn2click(_arg1){
debrisquality = 1;
}
public function menubtn3click(_arg1){
gotoAndPlay(5);
}
public function createcrowwing(_arg1:uint){
crowwing[crowwings] = new crowwingmc();
npccontainer.addChild(crowwing[crowwings]);
crowwing[crowwings].active = true;
crowwing[crowwings].visible = true;
crowwing[crowwings].x = -300;
crowwing[crowwings].y = -300;
crowwing[crowwings].scaleY = 0;
if (_arg1 == 1){
crow[crows].scaleX = -1;
};
crowwing[crowwings].scalespeed = 0.2;
crowwings = (crowwings + 1);
}
public function createfloordoor(_arg1:Number, _arg2:Number){
floordoor[floordoors] = new floordoormc();
backgroundmappropscontainer.addChild(floordoor[floordoors]);
floordoor[floordoors].active = true;
floordoor[floordoors].visible = true;
floordoor[floordoors].x = _arg1;
floordoor[floordoors].y = _arg2;
floordoors = (floordoors + 1);
}
public function fullbtn2click(_arg1){
debrisquality = 0;
}
public function pistolmuzzleflash(_arg1:Number, _arg2:Number, _arg3:Number){
pistolshoot.play();
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 8, 8, 0.5);
q = 0;
while (q < 1) {
creategp(_arg1, _arg2, ((Math.random() * 8) + 8), correctdirection(((_arg3 + (Math.random() * 50)) - 25)), ((Math.random() * 3) + 1), 0.9, -0.05, ((Math.random() * 15) + 15), muzzlesmokecolor(), true);
q = (q + 1);
};
creategp(_arg1, _arg2, ((Math.random() * 6) + 6), 0, 0, 0, 0, 3, muzzleflashcolor(), false);
}
public function createcity(_arg1:Number, _arg2:Number){
city[cities] = new citymc();
backgroundmappropscontainer.addChild(city[cities]);
city[cities].active = true;
city[cities].visible = true;
city[cities].x = _arg1;
city[cities].y = _arg2;
city[cities].frame = 0;
cities = (cities + 1);
}
public function nonebtn0click(_arg1){
graphicsquality = 2;
}
public function createpointdebris(_arg1:Number, _arg2:Number, _arg3:uint){
dchance = 0;
if (debrisquality == 1){
dchance = Math.floor((Math.random() * 2));
};
if (dchance == 0){
pointdebris[pointdebriss] = new pointdebrismc();
debriscontainer.addChild(pointdebris[pointdebriss]);
pointdebris[pointdebriss].active = true;
pointdebris[pointdebriss].visible = true;
pointdebris[pointdebriss].x = -1000;
pointdebris[pointdebriss].y = -1000;
pointdebris[pointdebriss].frame = _arg3;
pointdebris[pointdebriss].rotation = (Math.random() * 360);
pointdebris[pointdebriss].livetime = 0;
pointdebris[pointdebriss].rotatespeed = (Math.random() * pointdebrisrotatespeed);
pointdebris[pointdebriss].pointnum = points;
createpoint(_arg1, _arg2, pointdebrisaf, pointdebrisg, pointdebrisf, true, -1, false);
pointdebriss = (pointdebriss + 1);
};
}
public function turrethit(_arg1:Number, _arg2:Number){
q = 0;
while (q < 3) {
creategp(_arg1, _arg2, ((Math.random() * 3) + 3), (Math.random() * 360), ((Math.random() * 4) + 4), 0.8, 0.25, ((Math.random() * 8) + 8), 15829518, true);
q = (q + 1);
};
}
public function makebgcopy(){
var _local1:Sprite;
var _local2:BitmapData;
mytestcontainer2.removeChild(backgroundcopy);
_local1 = new Sprite();
_local2 = new BitmapData(1200, 600, true, 0);
_local2.fillRect(new Rectangle(0, 0, 1200, 600), 0);
_local1.addChild(background);
_local2.draw(_local1);
_local1.removeChild(background);
backgroundcopy = new Bitmap(_local2);
mytestcontainer2.addChild(backgroundcopy);
}
public function physicsexplosion(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:uint;
var _local9:uint;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = 0;
_local9 = 0;
_local10 = 0;
_local11 = 0;
_local12 = 0;
_local8 = 0;
while (_local8 < ropes) {
if (rope[_local8].active == true){
_local10 = 0;
_local11 = 0;
_local9 = rope[_local8].firstpnum;
while (_local9 < (rope[_local8].firstpnum + rope[_local8].segments)) {
_local10 = (_local10 + p[_local9].x);
_local11 = (_local11 + p[_local9].y);
_local9 = (_local9 + 1);
};
_local10 = (_local10 / rope[_local8].segments);
_local11 = (_local11 / rope[_local8].segments);
if (approxdistance(_arg1, _arg2, _local10, _local11) <= ((_arg3 + safetydistance) + rope[_local8].maxlength)){
if (rope[_local8].atrest == false){
_local9 = rope[_local8].firstpnum;
while (_local9 < (rope[_local8].firstpnum + rope[_local8].segments)) {
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
rope[_local8].restcounter = 0;
rope[_local8].atrest = false;
_local9 = rope[_local8].firstpnum;
while (_local9 < (rope[_local8].firstpnum + rope[_local8].segments)) {
p[_local9].active = true;
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
};
_local8 = (_local8 + 1);
};
_local5 = 0;
_local6 = 0;
_local8 = 0;
while (_local8 < ragdolls) {
if (ragdoll[_local8].active == true){
_local10 = ((p[(ragdoll[_local8].firstpnum + 4)].x + p[(ragdoll[_local8].firstpnum + 5)].x) * 0.5);
_local11 = ((p[(ragdoll[_local8].firstpnum + 4)].y + p[(ragdoll[_local8].firstpnum + 5)].y) * 0.5);
if (approxdistance(_arg1, _arg2, _local10, _local11) <= ((_arg3 + safetydistance) + (ragdollheight * 2))){
if (ragdoll[_local8].atrest == false){
_local9 = ragdoll[_local8].firstpnum;
while (_local9 < (ragdoll[_local8].firstpnum + 14)) {
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
wateraffector[ragdoll[_local8].wateraffectornum].active = true;
ragdoll[_local8].restcounter = 0;
ragdoll[_local8].atrest = false;
_local9 = ragdoll[_local8].firstpnum;
while (_local9 < (ragdoll[_local8].firstpnum + 14)) {
if (p[_local9].destroyed == false){
p[_local9].active = true;
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
};
_local9 = (_local9 + 1);
};
};
};
_local8 = (_local8 + 1);
};
_local5 = 0;
_local6 = 0;
_local8 = 0;
while (_local8 < boxes) {
if (box[_local8].active == true){
_local10 = ((p[box[_local8].firstpnum].x + p[(box[_local8].firstpnum + 2)].x) * 0.5);
_local11 = ((p[box[_local8].firstpnum].y + p[(box[_local8].firstpnum + 2)].y) * 0.5);
if (approxdistance(_arg1, _arg2, _local10, _local11) <= ((_arg3 + safetydistance) + box[_local8].sidelength)){
if (box[_local8].atrest == false){
_local9 = box[_local8].firstpnum;
while (_local9 < (box[_local8].firstpnum + 4)) {
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
wateraffector[box[_local8].wateraffectornum].active = true;
box[_local8].restcounter = 0;
box[_local8].atrest = false;
_local9 = box[_local8].firstpnum;
while (_local9 < (box[_local8].firstpnum + 4)) {
p[_local9].active = true;
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
};
_local8 = (_local8 + 1);
};
_local5 = 0;
_local6 = 0;
_local8 = 0;
while (_local8 < hinges) {
if (hinge[_local8].active == true){
_local10 = p[(hinge[_local8].firstpnum + 1)].x;
_local11 = p[(hinge[_local8].firstpnum + 1)].y;
if (approxdistance(_arg1, _arg2, _local10, _local11) <= ((_arg3 + safetydistance) + hinge[_local8].hingelength)){
if (hinge[_local8].atrest == false){
_local9 = hinge[_local8].firstpnum;
while (_local9 < (hinge[_local8].firstpnum + 3)) {
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
hinge[_local8].restcounter = 0;
hinge[_local8].atrest = false;
_local9 = hinge[_local8].firstpnum;
while (_local9 < (hinge[_local8].firstpnum + 3)) {
p[_local9].active = true;
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
};
_local8 = (_local8 + 1);
};
_local5 = 0;
_local6 = 0;
_local8 = 0;
while (_local8 < lines) {
if (line[_local8].active == true){
_local10 = ((p[line[_local8].firstpnum].x + p[(line[_local8].firstpnum + 1)].x) * 0.5);
_local11 = ((p[line[_local8].firstpnum].y + p[(line[_local8].firstpnum + 1)].y) * 0.5);
if (approxdistance(_arg1, _arg2, _local10, _local11) <= ((_arg3 + safetydistance) + line[_local8].linelength)){
if (line[_local8].atrest == false){
_local9 = line[_local8].firstpnum;
while (_local9 < (line[_local8].firstpnum + 2)) {
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
line[_local8].restcounter = 0;
line[_local8].atrest = false;
_local9 = line[_local8].firstpnum;
while (_local9 < (line[_local8].firstpnum + 2)) {
p[_local9].active = true;
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
};
_local8 = (_local8 + 1);
};
_local5 = 0;
_local6 = 0;
_local8 = 0;
while (_local8 < points) {
if (point[_local8].active == true){
_local10 = p[point[_local8].firstpnum].x;
_local11 = p[point[_local8].firstpnum].y;
if (approxdistance(_arg1, _arg2, _local10, _local11) <= (_arg3 + safetydistance)){
if (point[_local8].atrest == false){
_local9 = point[_local8].firstpnum;
while (_local9 < (point[_local8].firstpnum + 1)) {
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
point[_local8].restcounter = 0;
point[_local8].atrest = false;
_local9 = point[_local8].firstpnum;
while (_local9 < (point[_local8].firstpnum + 1)) {
p[_local9].active = true;
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
};
_local8 = (_local8 + 1);
};
_local5 = 0;
_local6 = 0;
_local8 = 0;
while (_local8 < objectlines) {
if (objectline[_local8].active == true){
_local10 = ((p[objectline[_local8].firstpnum].x + p[(objectline[_local8].firstpnum + 1)].x) * 0.5);
_local11 = ((p[objectline[_local8].firstpnum].y + p[(objectline[_local8].firstpnum + 1)].y) * 0.5);
if (approxdistance(_arg1, _arg2, _local10, _local11) <= ((_arg3 + safetydistance) + objectline[_local8].yheight)){
_local9 = objectline[_local8].firstpnum;
while (_local9 < (objectline[_local8].firstpnum + 2)) {
_local5 = approxdistance(_arg1, _arg2, p[_local9].x, p[_local9].y);
if (_local5 < _arg3){
_local6 = directiontopoint(_arg1, _arg2, p[_local9].x, p[_local9].y);
_local7 = (((_arg3 - _local5) / _arg3) * _arg4);
if (_local7 > maxdelta){
_local7 = maxdelta;
};
p[_local9].x = (p[_local9].x + vectorx(_local6, _local7));
p[_local9].y = (p[_local9].y + vectory(_local6, _local7));
};
_local9 = (_local9 + 1);
};
};
};
_local8 = (_local8 + 1);
};
}
public function shotgunimpact(_arg1:Number, _arg2:Number){
q = 0;
while (q < 2) {
creategp(_arg1, _arg2, ((Math.random() * 5) + 5), (Math.random() * 360), ((Math.random() * 5) + 3), 0.5, -0.15, ((Math.random() * 15) + 10), impactsmokecolor(), true);
q = (q + 1);
};
creategp(_arg1, _arg2, ((Math.random() * 3) + 3), 0, 0, 0, 0, 2, impactflashcolor(), false);
}
public function smgimpact(_arg1:Number, _arg2:Number){
q = 0;
while (q < 1) {
creategp(_arg1, _arg2, ((Math.random() * 5) + 5), (Math.random() * 360), ((Math.random() * 5) + 3), 0.5, -0.15, ((Math.random() * 15) + 10), impactsmokecolor(), true);
q = (q + 1);
};
creategp(_arg1, _arg2, ((Math.random() * 4) + 4), 0, 0, 0, 0, 3, impactflashcolor(), false);
}
public function grenadesmoke(_arg1:Number, _arg2:Number){
creategp(_arg1, _arg2, ((Math.random() * 2) + 2), (Math.random() * 360), (Math.random() * 0.5), 1, -0.03, ((Math.random() * 10) + 10), 0x9D9D9D, true);
}
public function startberserkscreen(){
berserkscreen.active = true;
berserkscreen.visible = true;
berserkscreen.y = 0;
berserkscreen.x = 0;
berserkscreen.alpha = 0;
berserkscreen.livetime = 0;
berserk.play();
}
public function chainsawsmoke(_arg1:Number, _arg2:Number){
creategp(_arg1, _arg2, ((Math.random() * 3) + 3), ((Math.random() * 90) + 45), Math.random(), 1, -0.1, ((Math.random() * 5) + 10), impactsmokecolor(), true);
}
public function createwinzone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
winzone[winzones] = new Object();
winzone[winzones].x1 = _arg1;
winzone[winzones].y1 = _arg2;
winzone[winzones].x2 = _arg3;
winzone[winzones].y2 = _arg4;
winzone[winzones].active = true;
winzones = (winzones + 1);
}
public function createnail(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int){
nail[nails] = new nailmc();
projectilecontainer.addChild(nail[nails]);
nail[nails].active = true;
nail[nails].visible = true;
nail[nails].alpha = 1;
nail[nails].x = _arg1;
nail[nails].y = _arg2;
nail[nails].lx = _arg1;
nail[nails].lx = _arg1;
nail[nails].madeeffect = false;
nail[nails].bleedtime = 0;
nail[nails].attachedparticle = -1;
nail[nails].livetime = 0;
nail[nails].direction = _arg3;
nail[nails].dummy = false;
nail[nails].side = _arg4;
nail[nails].hs = vectorx2(_arg3, nailspeed);
nail[nails].vs = vectory2(_arg3, nailspeed);
nails = (nails + 1);
}
public function reducedbtn4click(_arg1){
particlequality = 1;
}
public function nailgunimpact(_arg1:Number, _arg2:Number){
nailhit.play();
q = 0;
while (q < 8) {
creategp(_arg1, _arg2, ((Math.random() * 2) + 1), (Math.random() * 360), ((Math.random() * 3) + 1), 0.9, 0, ((Math.random() * 10) + 5), 0xFFFF00, true);
q = (q + 1);
};
}
public function stopberserkscreen(){
berserkscreen.active = false;
berserkscreen.visible = false;
}
public function stopfog(){
fog.active = false;
fog.visible = false;
}
public function stopfade(){
fade.active = false;
fade.visible = false;
}
public function fullbtn4click(_arg1){
particlequality = 0;
}
public function grenadeexplosion(_arg1:Number, _arg2:Number){
grenadeexplode.play();
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 14, 7, 0.5);
q = 0;
while (q < 5) {
creategp(_arg1, _arg2, ((Math.random() * 8) + 16), (Math.random() * 180), ((Math.random() * 3) + 1), 0.92, -0.05, ((Math.random() * 30) + 30), explosionsmokecolor(), true);
q = (q + 1);
};
q = 0;
while (q < 3) {
creategp(_arg1, _arg2, ((Math.random() * 8) + 8), ((Math.random() * 90) + 45), ((Math.random() * 3) + 1), 0.95, 0, ((Math.random() * 8) + 8), explosionflashcolor(), true);
q = (q + 1);
};
}
public function createboxdebris(_arg1:Number, _arg2:Number, _arg3:uint){
dchance = 0;
if (debrisquality == 1){
dchance = Math.floor((Math.random() * 2));
};
if (dchance == 0){
boxdebris[boxdebriss] = new boxdebrismc();
debriscontainer.addChild(boxdebris[boxdebriss]);
boxdebris[boxdebriss].active = true;
boxdebris[boxdebriss].visible = true;
boxdebris[boxdebriss].x = -1000;
boxdebris[boxdebriss].y = -1000;
boxdebris[boxdebriss].frame = _arg3;
boxdebris[boxdebriss].livetime = 0;
boxdebris[boxdebriss].boxnum = boxes;
createbox(_arg1, _arg2, boxdebrissidelength, boxdebrisaf, boxdebrisg, boxdebrisf, true, -1, false);
boxdebriss = (boxdebriss + 1);
};
}
public function createcrow(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:int){
crow[crows] = new crowmc();
npccontainer.addChild(crow[crows]);
crow[crows].active = true;
crow[crows].visible = true;
crow[crows].x = _arg1;
crow[crows].y = _arg2;
crow[crows].hs = 0;
crow[crows].vs = 0;
crow[crows].hitzonenum = hitzones;
createhitzone(crow[crows].x, crow[crows].y, crowradius);
crow[crows].facedirection = _arg3;
if (_arg3 == 1){
crow[crows].scaleX = -1;
};
if (_arg4 == 1){
if (_arg3 == 0){
crow[crows].hs = 5;
} else {
crow[crows].hs = -5;
};
};
crow[crows].frame = _arg4;
crow[crows].wingnum = crowwings;
createcrowwing(_arg3);
crows = (crows + 1);
}
public function berserkpuff(_arg1:Number, _arg2:Number){
q = 0;
while (q < 4) {
creategp(_arg1, (_arg2 + (Math.random() * 24)), ((Math.random() * 8) + 12), (Math.random() * 360), (Math.random() * 0.5), 0.995, -0.02, ((Math.random() * 20) + 50), 65382, true);
q = (q + 1);
};
}
public function createhinge(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Boolean, _arg10:int, _arg11:Boolean){
var _local12:Number;
var _local13:Number;
var _local14:uint;
_local12 = 0;
_local13 = 0;
hinge[hinges] = new Object();
vhinge[hinges] = new Shape();
physicscontainer.addChild(vhinge[hinges]);
hinge[hinges].restcounter = 0;
if (_arg9 == true){
hinge[hinges].atrest = false;
} else {
hinge[hinges].atrest = true;
};
hinge[hinges].ignorecollisions = _arg11;
hinge[hinges].x = _arg1;
hinge[hinges].y = _arg2;
hinge[hinges].length1 = _arg3;
hinge[hinges].length2 = _arg4;
hinge[hinges].active = true;
hinge[hinges].hingelength = (_arg3 + _arg4);
hinge[hinges].hingedistance = _arg5;
hinge[hinges].firstpnum = ps;
createp(_arg1, _arg2, _arg1, _arg2, _arg6, _arg7, _arg8, _arg9);
createp(_arg1, _arg2, _arg1, (_arg2 + _arg3), _arg6, _arg7, _arg8, _arg9);
createp(_arg1, _arg2, _arg1, ((_arg2 + _arg3) + _arg4), _arg6, _arg7, _arg8, _arg9);
if (_arg10 > -1){
_local12 = (p[_arg10].x - p[_arg10].lx);
_local13 = (p[_arg10].y - p[_arg10].ly);
_local14 = (ps - 3);
_local14 = (ps - 3);
while (_local14 < ps) {
p[_local14].lx = (p[_local14].lx - _local12);
p[_local14].ly = (p[_local14].ly - _local13);
_local14 = (_local14 + 1);
};
};
hinges = (hinges + 1);
}
public function rectcollide(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):Boolean{
var _local9:Boolean;
var _local10:Boolean;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local9 = false;
_local10 = false;
_local11 = 0;
_local12 = 0;
_local13 = 0;
_local14 = 0;
_local15 = 0;
_local16 = 0;
_local17 = 0;
_local18 = 0;
if (_arg3 > _arg1){
_local11 = _arg1;
_local12 = _arg3;
} else {
_local11 = _arg3;
_local12 = _arg1;
};
if (_arg4 > _arg2){
_local13 = _arg2;
_local14 = _arg4;
} else {
_local13 = _arg4;
_local14 = _arg2;
};
if (_arg7 > _arg5){
_local17 = _arg5;
_local18 = _arg7;
} else {
_local17 = _arg7;
_local18 = _arg5;
};
if (_arg8 > _arg6){
_local15 = _arg6;
_local16 = _arg8;
} else {
_local15 = _arg8;
_local16 = _arg6;
};
if ((((_local11 >= _local17)) && ((_local11 <= _local18)))){
_local9 = true;
} else {
if ((((_local12 >= _local17)) && ((_local12 <= _local18)))){
_local9 = true;
} else {
if ((((_local17 >= _local11)) && ((_local17 <= _local12)))){
_local9 = true;
} else {
if ((((_local18 >= _local11)) && ((_local18 <= _local12)))){
_local9 = true;
};
};
};
};
if ((((_local13 >= _local15)) && ((_local13 <= _local16)))){
_local10 = true;
} else {
if ((((_local14 >= _local15)) && ((_local14 <= _local16)))){
_local10 = true;
} else {
if ((((_local15 >= _local13)) && ((_local15 <= _local14)))){
_local10 = true;
} else {
if ((((_local16 >= _local13)) && ((_local16 <= _local14)))){
_local10 = true;
};
};
};
};
if ((((_local9 == true)) && ((_local10 == true)))){
return (true);
};
return (false);
}
public function spawnweapons(_arg1:Number, _arg2:Number){
spawnfacedirection = Math.floor((Math.random() * 2));
spawnpointdirection = (Math.random() * 360);
if (countweapons() == 0){
if (Math.floor((Math.random() * weaponchance)) == 0){
chance = Math.floor((Math.random() * 8));
if (chance == 0){
createpistol(_arg1, _arg2, spawnfacedirection, spawnpointdirection, true, -1);
};
if (chance == 1){
createrifle(_arg1, _arg2, spawnfacedirection, spawnpointdirection, true, -1);
};
if (chance == 2){
createshotgun(_arg1, _arg2, spawnfacedirection, spawnpointdirection, true, -1);
};
if (chance == 3){
createsmg(_arg1, _arg2, spawnfacedirection, spawnpointdirection, true, -1);
};
if (chance == 4){
creategrenadeammo(_arg1, _arg2, true);
};
if (chance == 5){
createnailgun(_arg1, _arg2, spawnfacedirection, spawnpointdirection, true, -1);
};
if (chance >= 6){
createrpg(_arg1, _arg2, spawnfacedirection, spawnpointdirection, true, -1, false);
};
physicspush(_arg1, _arg2, 16, (Math.random() * 360), (Math.random() * 1.5));
teleportsparks(_arg1, _arg2);
};
};
}
public function barrelexplosion(_arg1:Number, _arg2:Number){
explosion.play();
createlight(lightcontainer, _arg1, _arg2, firecolor(), 20, 6, 0.6);
q = 0;
while (q < 3) {
creategp(_arg1, _arg2, ((Math.random() * 6) + 16), (Math.random() * 180), (Math.random() * 3), 0.97, 0.03, ((Math.random() * 30) + 30), 0xFF8000, true);
creategp(_arg1, _arg2, ((Math.random() * 6) + 16), (Math.random() * 180), (Math.random() * 3), 0.97, 0.03, ((Math.random() * 30) + 30), 0xFFFF00, true);
q = (q + 1);
};
}
public function countenemies():uint{
enemies = 0;
z = 0;
while (z < enemyAs) {
if (enemyA[z].active == true){
enemies = (enemies + 1);
};
z = (z + 1);
};
z = 0;
while (z < enemyBs) {
if (enemyB[z].active == true){
enemies = (enemies + 1);
};
z = (z + 1);
};
z = 0;
while (z < enemyCs) {
if (enemyC[z].active == true){
enemies = (enemies + 1);
};
z = (z + 1);
};
return (enemies);
}
public function debrisspark(_arg1:Number, _arg2:Number){
creategp(_arg1, _arg2, ((Math.random() * 3) + 3), (Math.random() * 360), (Math.random() * 2), 1, 0, ((Math.random() * 10) + 5), 0xFFFF00, true);
}
public function createblast(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:int){
foundblast = -1;
i = 0;
while (i < blasts) {
if (blast[i].active == false){
foundblast = i;
i = (blasts + 1);
};
i = (i + 1);
};
if (foundblast > -1){
blast[foundblast].x = _arg1;
blast[foundblast].y = _arg2;
blast[foundblast].active = true;
blast[foundblast].side = _arg6;
blast[foundblast].damage = _arg5;
blast[foundblast].push = _arg4;
blast[foundblast].radius = _arg3;
} else {
blast[blasts] = new Object();
blast[blasts].x = _arg1;
blast[blasts].y = _arg2;
blast[blasts].active = true;
blast[blasts].side = _arg6;
blast[blasts].damage = _arg5;
blast[blasts].push = _arg4;
blast[blasts].radius = _arg3;
blasts = (blasts + 1);
};
}
public function createbulletcasing(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:uint){
bcchance = bulletcasingquality;
if (bulletcasingquality == 1){
bcchance = Math.floor((Math.random() * 2));
};
if (bcchance == 0){
bulletcasing[bulletcasings] = new bulletcasingmc();
debriscontainer.addChild(bulletcasing[bulletcasings]);
bulletcasing[bulletcasings].active = true;
bulletcasing[bulletcasings].visible = true;
bulletcasing[bulletcasings].x = -1000;
bulletcasing[bulletcasings].y = -1000;
bulletcasing[bulletcasings].playedsounds = 0;
bulletcasing[bulletcasings].frame = _arg7;
bulletcasing[bulletcasings].rotation = 0;
bulletcasing[bulletcasings].width = _arg3;
bulletcasing[bulletcasings].rotation = (Math.random() * 360);
bulletcasing[bulletcasings].livetime = 0;
bulletcasing[bulletcasings].rotatespeed = _arg6;
bulletcasing[bulletcasings].pointnum = points;
createpoint(_arg1, _arg2, bulletcasingaf, bulletcasingg, bulletcasingf, true, -1, false);
p[point[bulletcasing[bulletcasings].pointnum].firstpnum].x = (p[point[bulletcasing[bulletcasings].pointnum].firstpnum].x + vectorx2(_arg4, _arg5));
p[point[bulletcasing[bulletcasings].pointnum].firstpnum].y = (p[point[bulletcasing[bulletcasings].pointnum].firstpnum].y + vectory2(_arg4, _arg5));
bulletcasings = (bulletcasings + 1);
};
}
public function creategrenadeammo(_arg1:Number, _arg2:Number, _arg3:Boolean){
grenadeammo[grenadeammos] = new grenadeammomc();
pickupscontainer.addChild(grenadeammo[grenadeammos]);
grenadeammo[grenadeammos].active = true;
grenadeammo[grenadeammos].visible = true;
grenadeammo[grenadeammos].fade = _arg3;
grenadeammo[grenadeammos].x = -500;
grenadeammo[grenadeammos].y = -500;
grenadeammo[grenadeammos].livetime = 0;
grenadeammo[grenadeammos].boxnum = boxes;
grenadeammo[grenadeammos].filters = [pickupglowfilter];
createbox(_arg1, _arg2, grenadeammosidelength, pickupaf, pickupg, pickupf, _arg3, -1, false);
grenadeammos = (grenadeammos + 1);
}
public function loadmap(_arg1:uint){
wait = -5;
isplayer = false;
if (players > 0){
if (player[0].active == true){
isplayer = true;
getplayerinfo();
};
};
resetgame();
startfade();
inmap = true;
mapnumber = _arg1;
bool1 = false;
bool2 = false;
bool3 = false;
bool4 = false;
bool5 = false;
bool6 = false;
counter1 = 0;
counter2 = 0;
counter3 = 0;
counter4 = 0;
counter5 = 0;
counter6 = 0;
backdrop.active = true;
backdrop.visible = true;
background.active = true;
background.visible = true;
foreground.active = true;
foreground.visible = true;
if (_arg1 == 1){
music.play(0, 1);
startfog();
backdrop.frame = 0;
background.frame = 0;
foreground.frame = 0;
createplayer(20, 208, 0);
createcollisionline(-155, 244, 155, 268);
createcollisionline(155, 268, 342, 245);
createcollisionline(342, 245, 466, 264);
createcollisionline(466, 264, 734, 248);
messagetextdelay = 90;
messagestring = "The Cemetary Gates";
};
if (_arg1 == 2){
startfog();
backdrop.frame = 0;
background.frame = 1;
foreground.frame = 1;
createplayer(20, 203, 0);
createcollisionline(-210, 211, 210, 267);
createcollisionline(210, 267, 420, 229);
createcollisionline(420, 229, 780, 289);
collisionline[2].active = false;
createcrow(610, 200, 1, 1);
createcorpse(202, 210, true, -1, 1, 2, 2, 2, 2);
ragdoll[0].ignorecollisions = true;
corpse[0].fade = false;
createchain(195, 161, false, true, 202, 220, true, false, true, 2);
messagetextdelay = 90;
messagestring = "Further Into the Cemetary";
};
if (_arg1 == 3){
startfog();
backdrop.frame = 0;
background.frame = 2;
foreground.frame = 2;
createplayer(20, 203, 0);
createcollisionline(-196, 223, 196, 267);
createcollisionline(196, 267, 395, 248);
createcollisionline(395, 248, 535, 267);
createcollisionline(535, 267, 730, 228);
createcrow(347, 167, 1, 0);
messagetextdelay = 90;
messagestring = "Mausoleum";
};
if (_arg1 == 4){
startfog();
backdrop.frame = 0;
background.frame = 3;
foreground.frame = 3;
createplayer(20, 203, 0);
createcollisionline(-184, 218, 184, 272);
createcollisionline(184, 272, 417, 248);
createcollisionline(417, 248, 473, 0x0100);
createcollisionline(473, 0x0100, 488, 242);
createcollisionline(488, 242, 800, 242);
createcrow(339, 235, 1, 0);
messagetextdelay = 90;
messagestring = "Mansion Entrance";
};
if (_arg1 == 5){
backdrop.frame = 1;
background.frame = 4;
foreground.frame = 4;
createplayer(20, 220, 0);
createcollisionline(-200, 260, 305, 260);
createcollisionline(305, 260, 425, 140);
createcollisionline(425, 140, 800, 140);
messagetextdelay = 90;
messagestring = "The Mansion";
};
if (_arg1 == 6){
createcrate(194, 200, 0);
backdrop.frame = 1;
background.frame = 5;
foreground.frame = 5;
createplayer(20, 180, 0);
createcollisionline(-200, 224, 800, 224);
createfire(0x0202, 210, 90000);
createchain(418, 50, false, true, 450, 175, false, false, true, 1);
createshotgun(194, 212, 0, 315, false, -1);
messagetextdelay = 90;
messagestring = "Further Into the Mansion";
};
if (_arg1 == 7){
backdrop.frame = 2;
background.frame = 6;
foreground.frame = 6;
createrat(200, 150, 0, false);
createcollisionline(-200, 150, 800, 150);
createchain(200, 0, false, true, 205, 115, false, false, true, 0);
createbarrel(450, 130, 1);
xposition = 50;
yposition = -50;
createlinedebris((xposition + 3), (yposition + 10), 2);
createboxdebris((xposition - 4), (yposition + 8), 2);
createpointdebris((xposition + 2), (yposition + 23), 2);
createpointdebris((xposition + 6), (yposition + 16), 2);
physicsexplosion(xposition, yposition, 50, 3);
bigcrash.play();
i = 0;
while (i < 7) {
creategp((xposition - 20), yposition, ((Math.random() * 10) + 15), ((Math.random() * 40) + 250), ((Math.random() * 3) + 1), 0.97, 0.08, ((Math.random() * 40) + 40), 10263181, true);
i = (i + 1);
};
createplayer(50, -70, 0);
messagetextdelay = 90;
messagestring = "Sewers";
};
if (_arg1 == 8){
backdrop.frame = 2;
background.frame = 7;
foreground.frame = 7;
createcollisionline(-200, 200, 182, 200);
createcollisionline(182, 200, 224, 260);
createcollisionline(224, 260, 375, 260);
createcollisionline(375, 260, 417, 200);
createcollisionline(417, 200, 800, 200);
createwaterpool(190, 240, 220, 20, 24, 0.25, 0.9, 2, 0.05, 6982733, 0.4);
createhitzone(300, 140, 20);
createplayer(20, 160, 0);
messagetextdelay = 90;
messagestring = "Further Into the Sewers";
};
if (_arg1 == 9){
backdrop.frame = 2;
background.frame = 9;
foreground.frame = 9;
createrat(250, 0x0100, 1, true);
createcollisionline(-200, 0x0100, 318, 0x0100);
createcollisionline(318, 0x0100, 412, 192);
createcollisionline(412, 192, 800, 192);
createcollisionline(-20, 150, 60, 150);
createcrate(500, 168, 0);
creategrenadeammo(500, 180, false);
createplayer(20, 220, 0);
messagetextdelay = 90;
messagestring = "Sewer Exit";
};
if (_arg1 == 10){
backdrop.frame = 3;
background.frame = 10;
foreground.frame = 10;
startrain();
createcollisionline(-500, 250, 1100, 250);
createcollisionline(233, 250, 264, 211);
createcollisionline(264, 211, 310, 220);
createcollisionline(310, 220, 330, 250);
createplayer(20, 218, 0);
messagetextdelay = 90;
messagestring = "City Streets";
loopchannel = hydrantspray.play(0, 100);
};
if (_arg1 == 11){
backdrop.frame = 3;
background.frame = 11;
foreground.frame = 11;
startrain();
createcollisionline(-500, 250, 1100, 250);
createplayer(20, 218, 0);
messagetextdelay = 90;
messagestring = "Lab Entrance";
createbarrel(120, 230, 0);
createfire(298, 218, 90000);
loopchannel = rainfall.play(0, 100);
};
if (_arg1 == 12){
backdrop.frame = 4;
background.frame = 12;
foreground.frame = 12;
createcollisionline(-500, 150, 1100, 150);
createplayer(20, 118, 0);
messagetextdelay = 90;
messagestring = "Lab";
createstring(450, -15, false, true, 350, -15, false, true, true, 0, 1);
createnailgun(450, 145, 0, 0, false, -1);
};
if (_arg1 == 13){
backdrop.frame = 4;
background.frame = 13;
foreground.frame = 13;
createcollisionline(-500, 150, 1100, 150);
createcollisionline(477, 0, 509.6, 54);
createcollisionline(509.6, 54, 700, 54);
createcollisionline(592, 0, 592, 150);
createcollisionline(-500, 160, 100, 160);
createplayer(20, 118, 0);
messagetextdelay = 90;
messagestring = "Further Into the Lab";
createfire(413, 139, 90000);
createturretbase(555, 59, 270);
createcrate(565, 125, 0);
createsmg(564, 135, 0, 315, false, -1);
createwalldoor(592, 54);
};
if (_arg1 == 14){
backdrop.frame = 4;
background.frame = 14;
foreground.frame = 14;
createcollisionline(-500, 150, 420, 150);
createcollisionline(420, 150, 1200, 150);
createcollisionline(300, 150, 300, 225);
createcollisionline(420, 150, 420, 225);
createcollisionline(300, 225, 420, 225);
createplayer(20, 118, 0);
messagetextdelay = 90;
messagestring = "???";
createcomputer(504, 126);
createspinlight(323, 78);
createfloordoor(296.4, 150);
spinlight[0].visible = false;
createwaterpool(300, 175, 124, 50, 16, 0.15, 0.9, 1, 0.08, 1762862, 0.6);
createdamagezone(300, 175, 420, 300, 5);
};
if (_arg1 == 15){
backdrop.frame = 4;
background.frame = 16;
foreground.frame = 16;
createplayer(20, 116, 0);
createcollisionline(-500, 148, 100, 148);
createcollisionline(100, 148, 200, 248);
createcollisionline(200, 248, 400, 248);
createcollisionline(400, 248, 500, 148);
createcollisionline(500, 148, 800, 148);
createspinlight(300, 128);
spinlight[0].visible = false;
messagetextdelay = 90;
messagestring = "Boss Fight";
createmegazombie(300, 160);
createchain(267, 184, false, true, 330, 184, false, true, false, 1);
createchain(333, 218, false, true, 270, 218, false, true, false, 1);
createchain(267, 218, false, true, 330, 218, false, true, false, 1);
createchain(333, 184, false, true, 270, 184, false, true, false, 1);
playerweapon = chainsawnum;
playerrifleammo = 0;
playerhasrifle = false;
playerpistolammo = 0;
playerhaspistol = false;
playergrenadeammo = 0;
playerhasgrenade = false;
playershotgunammo = 0;
playerhasshotgun = false;
playersmgammo = 0;
playerhassmg = false;
playernailgunammo = 0;
playerhasnailgun = false;
playerrpgammo = 0;
playerhasrpg = false;
playerhaschainsaw = true;
createrpg(552, 134, 0, 84, false, -1, false);
createrpg(559, 134, 0, 89, false, -1, false);
createrpg(566, 134, 0, 91, false, -1, false);
createrpg(573, 134, 0, 94, false, -1, false);
createhealth(50, 105, false);
createhealth(65, 105, false);
createhealth(44, 123, false);
createhealth(62, 123, false);
};
if (_arg1 == 16){
player[0].active = false;
player[0].x = 1000;
player[0].y = 500;
backdrop.frame = 4;
background.frame = 13;
foreground.frame = 13;
createcollisionline(-500, 150, 1100, 150);
createfire(413, 139, 90000);
createenemyA(-160, 100, 0, true, false);
createenemyA(-128, 105, 0, true, false);
createenemyA(-52, 90, 0, true, false);
createenemyA(-143, 99, 0, true, false);
createenemyA(-85, 102, 0, true, false);
createenemyA(-105, 110, 0, true, false);
};
if (_arg1 == 17){
startrain();
backdrop.frame = 5;
background.frame = 15;
foreground.frame = 15;
createcity(300, 250);
};
if (isplayer == true){
restoreplayerinfo();
getplayerinfo();
};
lowestframerate = 30;
backdrop.gotoAndStop((backdrop.frame + 1));
background.gotoAndStop((background.frame + 1));
foreground.gotoAndStop((foreground.frame + 1));
makecopies();
}
public function smgmuzzleflash(_arg1:Number, _arg2:Number, _arg3:Number){
smgshoot.play();
createlight(lightcontainer, _arg1, _arg2, rgb(0xFF, 0xFF, 0), 6, 6, 0.4);
q = 0;
while (q < 1) {
creategp(_arg1, _arg2, ((Math.random() * 8) + 8), correctdirection(((_arg3 + (Math.random() * 50)) - 25)), ((Math.random() * 3) + 1), 0.9, -0.05, ((Math.random() * 15) + 15), muzzlesmokecolor(), true);
q = (q + 1);
};
creategp(_arg1, _arg2, ((Math.random() * 4) + 4), 0, 0, 0, 0, 3, muzzleflashcolor(), false);
}
public function createplayer(_arg1, _arg2, _arg3){
cutscene = false;
player[players] = new Object();
player[players].active = true;
player[players].berserk = false;
player[players].berserkcounter = 0;
player[players].berserkamount = 0;
player[players].slow = 0;
player[players].shootdelay = 0;
player[players].damage = 0;
player[players].weapon = chainsawnum;
player[players].framedelay = 0;
player[players].rifleammo = 0;
player[players].hasrifle = false;
player[players].pistolammo = 0;
player[players].haspistol = false;
player[players].grenadeammo = 0;
player[players].hasgrenade = true;
player[players].shotgunammo = 0;
player[players].hasshotgun = false;
player[players].smgammo = 0;
player[players].hassmg = false;
player[players].nailgunammo = 0;
player[players].hasnailgun = false;
player[players].rpgammo = 0;
player[players].hasrpg = false;
player[players].haschainsaw = true;
player[players].x = -2000;
player[players].y = -2000;
player[players].bodynormal = 90;
player[players].bodyx = -2000;
player[players].bodyy = -2000;
player[players].jumpdelay = 0;
player[players].lookdirection = 0;
player[players].gundirection = 0;
player[players].walkdirection = _arg3;
player[players].facedirection = _arg3;
player[players].objectlinenum = objectlines;
player[players].gundirection = 0;
player[players].lookdirection = 0;
player[players].bodynormal = 90;
createobjectline(_arg1, _arg2, (ragdollheight * 2), playeraf, playerg, playerf);
player[players].firstlegnum = legAs;
createlegA();
createlegA();
legA[(player[players].firstlegnum + 1)].framerate = 0;
legA[player[players].firstlegnum].framerate = 0;
if (_arg3 == 0){
legA[player[players].firstlegnum].frame = 4;
legA[(player[players].firstlegnum + 1)].frame = 14;
} else {
legA[player[players].firstlegnum].frame = 14;
legA[(player[players].firstlegnum + 1)].frame = 4;
};
player[players].bodynum = bodyAs;
createbodyA();
players = (players + 1);
}
public function creategp(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:uint, _arg9:Number, _arg10:Boolean){
var pchance:int;
var foundgp:int;
var j:uint;
var x = _arg1;
var y = _arg2;
var radius = _arg3;
var gpdirection = _arg4;
var speed = _arg5;
var af = _arg6;
var g = _arg7;
var gptime = _arg8;
var gpcolor = _arg9;
var obeyquality = _arg10;
pchance = 0;
if (obeyquality == true){
pchance = 0;
if (particlequality == 1){
pchance = Math.floor((Math.random() * 2));
};
} else {
pchance = 0;
};
if (pchance == 0){
foundgp = -1;
j = 0;
j = 0;
while (j < gps) {
if (gp[j].active == false){
foundgp = j;
j = (gps + 1);
};
j = (j + 1);
};
if (foundgp > -1){
gp[foundgp].x = x;
gp[foundgp].y = y;
gp[foundgp].radius = radius;
gp[foundgp].visible = true;
gp[foundgp].active = true;
gp[foundgp].gpcolor = gpcolor;
gp[foundgp].gptime = gptime;
gp[foundgp].gpstarttime = gptime;
gp[foundgp].af = af;
gp[foundgp].g = g;
gp[foundgp].vs = vectory2(gpdirection, speed);
gp[foundgp].hs = vectorx2(gpdirection, speed);
vgp[foundgp].visible = true;
vgp[foundgp].x = x;
vgp[foundgp].y = y;
var _local12 = vgp[foundgp].graphics;
with (_local12) {
clear();
moveTo(-(radius), -(radius));
lineStyle(1, 0, 0);
beginFill(gpcolor, 1);
drawCircle(0, 0, radius);
};
} else {
gp[gps] = new Object();
vgp[gps] = new Shape();
_local12 = vgp[gps].graphics;
with (_local12) {
moveTo(-(radius), -(radius));
lineStyle(1, 0, 0);
beginFill(gpcolor, 1);
drawCircle(0, 0, radius);
};
vgp[gps].x = x;
vgp[gps].y = y;
physicscontainer.addChild(vgp[gps]);
gp[gps].x = x;
gp[gps].y = y;
gp[gps].radius = radius;
gp[gps].visible = true;
gp[gps].active = true;
gp[gps].gpcolor = gpcolor;
gp[gps].gptime = gptime;
gp[gps].gpstarttime = gptime;
gp[gps].af = af;
gp[gps].g = g;
gp[gps].vs = vectory2(gpdirection, speed);
gp[gps].hs = vectorx2(gpdirection, speed);
gps = (gps + 1);
};
};
}
public function createp(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Boolean){
p[ps] = new Object();
p[ps].x = _arg3;
p[ps].y = _arg4;
p[ps].g = _arg6;
p[ps].af = _arg5;
p[ps].f = _arg7;
p[ps].lx = _arg3;
p[ps].sx = _arg1;
p[ps].ly = _arg4;
p[ps].sy = _arg2;
p[ps].active = _arg8;
p[ps].destroyed = false;
ps = (ps + 1);
}
public function startrain(){
z = 0;
while (z < raindrops) {
rain[z].active = true;
rain[z].visible = true;
z = (z + 1);
};
}
public function checknode(_arg1:Number, _arg2:Number):Boolean{
currentnode = -1;
found = false;
z = 0;
while (z < nodes) {
if (node[z].active == true){
if (approxdistance(_arg1, _arg2, node[z].x, node[z].y) < noderadius){
found = true;
currentnode = z;
z = (nodes + 1);
};
};
z = (z + 1);
};
return (found);
}
public function createcorpse(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:int, _arg5:uint, _arg6:uint, _arg7:uint, _arg8:uint, _arg9:uint){
corpse[corpses] = new Object();
if (_arg5 > 0){
player[0].berserkamount = (player[0].berserkamount + killberserkamount);
};
corpse[corpses].leftarmsegments = _arg6;
corpse[corpses].rightarmsegments = _arg7;
corpse[corpses].leftlegsegments = _arg8;
corpse[corpses].rightlegsegments = _arg9;
corpse[corpses].alpha = 1;
corpse[corpses].active = true;
corpse[corpses].type = _arg5;
corpse[corpses].x = _arg1;
corpse[corpses].y = _arg2;
corpse[corpses].lastx = _arg1;
corpse[corpses].lasty = _arg2;
corpse[corpses].bloodtimer = 0;
corpse[corpses].fade = _arg3;
corpse[corpses].livetime = 0;
corpse[corpses].ragdollnum = ragdolls;
createragdoll(_arg1, _arg2, corpseaf, corpseg, corpsef, _arg3, _arg4, false, _arg6, _arg7, _arg8, _arg9);
if (_arg6 == 0){
createlimb(p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 3)].x, p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 3)].y, 0, (2 - _arg6), _arg4, _arg5, 1);
};
if (_arg6 == 1){
createlimb(p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 11)].x, p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 11)].y, 0, (2 - _arg6), _arg4, _arg5, 1);
};
if (_arg7 == 0){
createlimb(p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 2)].x, p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 2)].y, 0, (2 - _arg7), _arg4, _arg5, 0);
};
if (_arg7 == 1){
createlimb(p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 10)].x, p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 10)].y, 0, (2 - _arg7), _arg4, _arg5, 0);
};
if (_arg8 == 0){
createlimb(p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 5)].x, p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 5)].y, 1, (2 - _arg8), _arg4, _arg5, 1);
};
if (_arg8 == 1){
createlimb(p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 7)].x, p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 7)].y, 1, (2 - _arg8), _arg4, _arg5, 1);
};
if (_arg9 == 0){
createlimb(p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 4)].x, p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 4)].y, 1, (2 - _arg9), _arg4, _arg5, 0);
};
if (_arg9 == 1){
createlimb(p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 6)].x, p[(ragdoll[corpse[corpses].ragdollnum].firstpnum + 6)].y, 1, (2 - _arg9), _arg4, _arg5, 0);
};
corpse[corpses].headnum = heads;
corpse[corpses].torsonum = torsos;
corpse[corpses].firstupperlegnum = upperlegs;
corpse[corpses].firstlowerarmnum = lowerarms;
corpse[corpses].firstupperarmnum = upperarms;
corpse[corpses].firstlowerlegnum = lowerlegs;
createlowerleg(_arg5);
createlowerleg(_arg5);
createupperleg(_arg5);
createupperleg(_arg5);
createtorso(_arg5);
createhead(_arg5);
createlowerarm(_arg5);
createlowerarm(_arg5);
createupperarm(_arg5);
createupperarm(_arg5);
upperarm[corpse[corpses].firstupperarmnum].scaleX = -1;
lowerarm[corpse[corpses].firstlowerarmnum].scaleX = -1;
upperleg[corpse[corpses].firstupperlegnum].scaleX = -1;
lowerleg[corpse[corpses].firstlowerlegnum].scaleX = -1;
if (countcorpses() >= maxcorpses){
ragdoll[corpse[corpses].ragdollnum].deformed = true;
};
corpses = (corpses + 1);
}
}
}//package mainfla_fla
Section 2
//alarmsound (alarmsound)
package {
import flash.media.*;
public dynamic class alarmsound extends Sound {
}
}//package
Section 3
//ammodisplaymc (ammodisplaymc)
package {
import flash.display.*;
public dynamic class ammodisplaymc extends MovieClip {
}
}//package
Section 4
//ammopickupsound (ammopickupsound)
package {
import flash.media.*;
public dynamic class ammopickupsound extends Sound {
}
}//package
Section 5
//backdropmc (backdropmc)
package {
import flash.display.*;
public dynamic class backdropmc extends MovieClip {
}
}//package
Section 6
//backgroundmc (backgroundmc)
package {
import flash.display.*;
public dynamic class backgroundmc extends MovieClip {
}
}//package
Section 7
//barrelmc (barrelmc)
package {
import flash.display.*;
public dynamic class barrelmc extends MovieClip {
}
}//package
Section 8
//berserkbarmc (berserkbarmc)
package {
import flash.display.*;
public dynamic class berserkbarmc extends MovieClip {
}
}//package
Section 9
//berserkdisplaymc (berserkdisplaymc)
package {
import flash.display.*;
public dynamic class berserkdisplaymc extends MovieClip {
}
}//package
Section 10
//berserkscreenmc (berserkscreenmc)
package {
import flash.display.*;
public dynamic class berserkscreenmc extends MovieClip {
}
}//package
Section 11
//berserksound (berserksound)
package {
import flash.media.*;
public dynamic class berserksound extends Sound {
}
}//package
Section 12
//bigcrashsound (bigcrashsound)
package {
import flash.media.*;
public dynamic class bigcrashsound extends Sound {
}
}//package
Section 13
//bodyAmc (bodyAmc)
package {
import flash.display.*;
public dynamic class bodyAmc extends MovieClip {
}
}//package
Section 14
//bodyBmc (bodyBmc)
package {
import flash.display.*;
public dynamic class bodyBmc extends MovieClip {
}
}//package
Section 15
//bodyCmc (bodyCmc)
package {
import flash.display.*;
public dynamic class bodyCmc extends MovieClip {
}
}//package
Section 16
//bodyDmc (bodyDmc)
package {
import flash.display.*;
public dynamic class bodyDmc extends MovieClip {
}
}//package
Section 17
//boxdebrismc (boxdebrismc)
package {
import flash.display.*;
public dynamic class boxdebrismc extends MovieClip {
}
}//package
Section 18
//bulletcasingmc (bulletcasingmc)
package {
import flash.display.*;
public dynamic class bulletcasingmc extends MovieClip {
}
}//package
Section 19
//chainsawmc (chainsawmc)
package {
import flash.display.*;
public dynamic class chainsawmc extends MovieClip {
}
}//package
Section 20
//chainsawrevsound (chainsawrevsound)
package {
import flash.media.*;
public dynamic class chainsawrevsound extends Sound {
}
}//package
Section 21
//chainsawstartsound (chainsawstartsound)
package {
import flash.media.*;
public dynamic class chainsawstartsound extends Sound {
}
}//package
Section 22
//citymc (citymc)
package {
import flash.display.*;
public dynamic class citymc extends MovieClip {
}
}//package
Section 23
//computermc (computermc)
package {
import flash.display.*;
public dynamic class computermc extends MovieClip {
}
}//package
Section 24
//cratemc (cratemc)
package {
import flash.display.*;
public dynamic class cratemc extends MovieClip {
}
}//package
Section 25
//crowcawsound (crowcawsound)
package {
import flash.media.*;
public dynamic class crowcawsound extends Sound {
}
}//package
Section 26
//crowmc (crowmc)
package {
import flash.display.*;
public dynamic class crowmc extends MovieClip {
}
}//package
Section 27
//crowwingmc (crowwingmc)
package {
import flash.display.*;
public dynamic class crowwingmc extends MovieClip {
}
}//package
Section 28
//cursormc (cursormc)
package {
import flash.display.*;
public dynamic class cursormc extends MovieClip {
}
}//package
Section 29
//dooropensound (dooropensound)
package {
import flash.media.*;
public dynamic class dooropensound extends Sound {
}
}//package
Section 30
//dripsound (dripsound)
package {
import flash.media.*;
public dynamic class dripsound extends Sound {
}
}//package
Section 31
//dryfiresound (dryfiresound)
package {
import flash.media.*;
public dynamic class dryfiresound extends Sound {
}
}//package
Section 32
//electricbuzzsound (electricbuzzsound)
package {
import flash.media.*;
public dynamic class electricbuzzsound extends Sound {
}
}//package
Section 33
//explosionsound (explosionsound)
package {
import flash.media.*;
public dynamic class explosionsound extends Sound {
}
}//package
Section 34
//fademc (fademc)
package {
import flash.display.*;
public dynamic class fademc extends MovieClip {
}
}//package
Section 35
//floordoormc (floordoormc)
package {
import flash.display.*;
public dynamic class floordoormc extends MovieClip {
}
}//package
Section 36
//fogmc (fogmc)
package {
import flash.display.*;
public dynamic class fogmc extends MovieClip {
}
}//package
Section 37
//foregroundmc (foregroundmc)
package {
import flash.display.*;
public dynamic class foregroundmc extends MovieClip {
}
}//package
Section 38
//format2class (format2class)
package {
import flash.text.*;
public dynamic class format2class extends Font {
}
}//package
Section 39
//grenadeammomc (grenadeammomc)
package {
import flash.display.*;
public dynamic class grenadeammomc extends MovieClip {
}
}//package
Section 40
//grenadebounce1sound (grenadebounce1sound)
package {
import flash.media.*;
public dynamic class grenadebounce1sound extends Sound {
}
}//package
Section 41
//grenadebounce2sound (grenadebounce2sound)
package {
import flash.media.*;
public dynamic class grenadebounce2sound extends Sound {
}
}//package
Section 42
//grenadebounce3sound (grenadebounce3sound)
package {
import flash.media.*;
public dynamic class grenadebounce3sound extends Sound {
}
}//package
Section 43
//grenadeexplodesound (grenadeexplodesound)
package {
import flash.media.*;
public dynamic class grenadeexplodesound extends Sound {
}
}//package
Section 44
//grenademc (grenademc)
package {
import flash.display.*;
public dynamic class grenademc extends MovieClip {
}
}//package
Section 45
//headmc (headmc)
package {
import flash.display.*;
public dynamic class headmc extends MovieClip {
}
}//package
Section 46
//healthbarmc (healthbarmc)
package {
import flash.display.*;
public dynamic class healthbarmc extends MovieClip {
}
}//package
Section 47
//healthdisplaymc (healthdisplaymc)
package {
import flash.display.*;
public dynamic class healthdisplaymc extends MovieClip {
}
}//package
Section 48
//healthmc (healthmc)
package {
import flash.display.*;
public dynamic class healthmc extends MovieClip {
}
}//package
Section 49
//healthpickupsound (healthpickupsound)
package {
import flash.media.*;
public dynamic class healthpickupsound extends Sound {
}
}//package
Section 50
//hydrantspraysound (hydrantspraysound)
package {
import flash.media.*;
public dynamic class hydrantspraysound extends Sound {
}
}//package
Section 51
//lasershootsound (lasershootsound)
package {
import flash.media.*;
public dynamic class lasershootsound extends Sound {
}
}//package
Section 52
//legAmc (legAmc)
package {
import flash.display.*;
public dynamic class legAmc extends MovieClip {
}
}//package
Section 53
//legBmc (legBmc)
package {
import flash.display.*;
public dynamic class legBmc extends MovieClip {
}
}//package
Section 54
//legCmc (legCmc)
package {
import flash.display.*;
public dynamic class legCmc extends MovieClip {
}
}//package
Section 55
//legDmc (legDmc)
package {
import flash.display.*;
public dynamic class legDmc extends MovieClip {
}
}//package
Section 56
//linedebrismc (linedebrismc)
package {
import flash.display.*;
public dynamic class linedebrismc extends MovieClip {
}
}//package
Section 57
//linkmc (linkmc)
package {
import flash.display.*;
public dynamic class linkmc extends MovieClip {
}
}//package
Section 58
//lowerarmmc (lowerarmmc)
package {
import flash.display.*;
public dynamic class lowerarmmc extends MovieClip {
}
}//package
Section 59
//lowerlegmc (lowerlegmc)
package {
import flash.display.*;
public dynamic class lowerlegmc extends MovieClip {
}
}//package
Section 60
//megazombiediesound (megazombiediesound)
package {
import flash.media.*;
public dynamic class megazombiediesound extends Sound {
}
}//package
Section 61
//megazombieenginesound (megazombieenginesound)
package {
import flash.media.*;
public dynamic class megazombieenginesound extends Sound {
}
}//package
Section 62
//megazombieexhaustsound (megazombieexhaustsound)
package {
import flash.media.*;
public dynamic class megazombieexhaustsound extends Sound {
}
}//package
Section 63
//megazombiegunmc (megazombiegunmc)
package {
import flash.display.*;
public dynamic class megazombiegunmc extends MovieClip {
}
}//package
Section 64
//megazombieintrosound (megazombieintrosound)
package {
import flash.media.*;
public dynamic class megazombieintrosound extends Sound {
}
}//package
Section 65
//megazombiemc (megazombiemc)
package {
import flash.display.*;
public dynamic class megazombiemc extends MovieClip {
}
}//package
Section 66
//metalcrashsound (metalcrashsound)
package {
import flash.media.*;
public dynamic class metalcrashsound extends Sound {
}
}//package
Section 67
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
public class MochiAd {
public static function getVersion():String{
return ("2.2");
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (!this.parent.parent){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 68
//musicsound (musicsound)
package {
import flash.media.*;
public dynamic class musicsound extends Sound {
}
}//package
Section 69
//nailgunammomc (nailgunammomc)
package {
import flash.display.*;
public dynamic class nailgunammomc extends MovieClip {
}
}//package
Section 70
//nailgunmc (nailgunmc)
package {
import flash.display.*;
public dynamic class nailgunmc extends MovieClip {
}
}//package
Section 71
//nailgunshoot (nailgunshoot)
package {
import flash.media.*;
public dynamic class nailgunshoot extends Sound {
}
}//package
Section 72
//nailhitsound (nailhitsound)
package {
import flash.media.*;
public dynamic class nailhitsound extends Sound {
}
}//package
Section 73
//nailmc (nailmc)
package {
import flash.display.*;
public dynamic class nailmc extends MovieClip {
}
}//package
Section 74
//pistolammomc (pistolammomc)
package {
import flash.display.*;
public dynamic class pistolammomc extends MovieClip {
}
}//package
Section 75
//pistolmc (pistolmc)
package {
import flash.display.*;
public dynamic class pistolmc extends MovieClip {
}
}//package
Section 76
//pistolshootsound (pistolshootsound)
package {
import flash.media.*;
public dynamic class pistolshootsound extends Sound {
}
}//package
Section 77
//planesound (planesound)
package {
import flash.media.*;
public dynamic class planesound extends Sound {
}
}//package
Section 78
//playerdamagesound (playerdamagesound)
package {
import flash.media.*;
public dynamic class playerdamagesound extends Sound {
}
}//package
Section 79
//pointdebrismc (pointdebrismc)
package {
import flash.display.*;
public dynamic class pointdebrismc extends MovieClip {
}
}//package
Section 80
//rainfallsound (rainfallsound)
package {
import flash.media.*;
public dynamic class rainfallsound extends Sound {
}
}//package
Section 81
//rainmc (rainmc)
package {
import flash.display.*;
public dynamic class rainmc extends MovieClip {
}
}//package
Section 82
//ratmc (ratmc)
package {
import flash.display.*;
public dynamic class ratmc extends MovieClip {
}
}//package
Section 83
//ratsqueaksound (ratsqueaksound)
package {
import flash.media.*;
public dynamic class ratsqueaksound extends Sound {
}
}//package
Section 84
//rifleammomc (rifleammomc)
package {
import flash.display.*;
public dynamic class rifleammomc extends MovieClip {
}
}//package
Section 85
//riflemc (riflemc)
package {
import flash.display.*;
public dynamic class riflemc extends MovieClip {
}
}//package
Section 86
//rifleshootsound (rifleshootsound)
package {
import flash.media.*;
public dynamic class rifleshootsound extends Sound {
}
}//package
Section 87
//rocketmc (rocketmc)
package {
import flash.display.*;
public dynamic class rocketmc extends MovieClip {
}
}//package
Section 88
//rocketshootsound (rocketshootsound)
package {
import flash.media.*;
public dynamic class rocketshootsound extends Sound {
}
}//package
Section 89
//rpgmc (rpgmc)
package {
import flash.display.*;
public dynamic class rpgmc extends MovieClip {
}
}//package
Section 90
//screenflashmc (screenflashmc)
package {
import flash.display.*;
public dynamic class screenflashmc extends MovieClip {
}
}//package
Section 91
//shell1sound (shell1sound)
package {
import flash.media.*;
public dynamic class shell1sound extends Sound {
}
}//package
Section 92
//shell2sound (shell2sound)
package {
import flash.media.*;
public dynamic class shell2sound extends Sound {
}
}//package
Section 93
//shell3sound (shell3sound)
package {
import flash.media.*;
public dynamic class shell3sound extends Sound {
}
}//package
Section 94
//shell4sound (shell4sound)
package {
import flash.media.*;
public dynamic class shell4sound extends Sound {
}
}//package
Section 95
//shell5sound (shell5sound)
package {
import flash.media.*;
public dynamic class shell5sound extends Sound {
}
}//package
Section 96
//shotgunammomc (shotgunammomc)
package {
import flash.display.*;
public dynamic class shotgunammomc extends MovieClip {
}
}//package
Section 97
//shotgunmc (shotgunmc)
package {
import flash.display.*;
public dynamic class shotgunmc extends MovieClip {
}
}//package
Section 98
//shotgunshootsound (shotgunshootsound)
package {
import flash.media.*;
public dynamic class shotgunshootsound extends Sound {
}
}//package
Section 99
//smallcrashsound (smallcrashsound)
package {
import flash.media.*;
public dynamic class smallcrashsound extends Sound {
}
}//package
Section 100
//smgammomc (smgammomc)
package {
import flash.display.*;
public dynamic class smgammomc extends MovieClip {
}
}//package
Section 101
//smgmc (smgmc)
package {
import flash.display.*;
public dynamic class smgmc extends MovieClip {
}
}//package
Section 102
//smgshootsound (smgshootsound)
package {
import flash.media.*;
public dynamic class smgshootsound extends Sound {
}
}//package
Section 103
//spinlightmc (spinlightmc)
package {
import flash.display.*;
public dynamic class spinlightmc extends MovieClip {
}
}//package
Section 104
//squishsound (squishsound)
package {
import flash.media.*;
public dynamic class squishsound extends Sound {
}
}//package
Section 105
//teleportsound (teleportsound)
package {
import flash.media.*;
public dynamic class teleportsound extends Sound {
}
}//package
Section 106
//torsomc (torsomc)
package {
import flash.display.*;
public dynamic class torsomc extends MovieClip {
}
}//package
Section 107
//turretbarrelmc (turretbarrelmc)
package {
import flash.display.*;
public dynamic class turretbarrelmc extends MovieClip {
}
}//package
Section 108
//turretbasemc (turretbasemc)
package {
import flash.display.*;
public dynamic class turretbasemc extends MovieClip {
}
}//package
Section 109
//turretexplodesound (turretexplodesound)
package {
import flash.media.*;
public dynamic class turretexplodesound extends Sound {
}
}//package
Section 110
//turretshootsound (turretshootsound)
package {
import flash.media.*;
public dynamic class turretshootsound extends Sound {
}
}//package
Section 111
//upperarmmc (upperarmmc)
package {
import flash.display.*;
public dynamic class upperarmmc extends MovieClip {
}
}//package
Section 112
//upperlegmc (upperlegmc)
package {
import flash.display.*;
public dynamic class upperlegmc extends MovieClip {
}
}//package
Section 113
//walldoormc (walldoormc)
package {
import flash.display.*;
public dynamic class walldoormc extends MovieClip {
}
}//package
Section 114
//waterfallsound (waterfallsound)
package {
import flash.media.*;
public dynamic class waterfallsound extends Sound {
}
}//package
Section 115
//waterspraysound (waterspraysound)
package {
import flash.media.*;
public dynamic class waterspraysound extends Sound {
}
}//package
Section 116
//weapondisplaymc (weapondisplaymc)
package {
import flash.display.*;
public dynamic class weapondisplaymc extends MovieClip {
}
}//package
Section 117
//weaponpickupsound (weaponpickupsound)
package {
import flash.media.*;
public dynamic class weaponpickupsound extends Sound {
}
}//package
Section 118
//zombiediesound (zombiediesound)
package {
import flash.media.*;
public dynamic class zombiediesound extends Sound {
}
}//package