Frame 1
function unlockMedal(inMedal) {
com.newgrounds.API.unlockMedal(inMedal);
}
_quality = "MEDIUM";
var myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
_root.menu = myMenu;
Frame 6
stop();
var myMusic = new Sound();
myMusic.attachSound("song_1");
myMusic.stop();
myMusic.start(0, 9999999);
Frame 8
function tick() {
if (_root.mouse_down == true) {
_root.mouse_down_clicked++;
} else {
_root.mouse_up_clicked++;
}
}
function object_scale_finder(this_mc) {
var _local3 = _root.world_mc.vanish_point._y;
var _local4 = _root.world_mc.y_plane._y;
var _local5 = _local4 - _local3;
this_mc._yscale = ((this_mc._y - _local3) / _local5) * 100;
if (this_mc._yscale > 110) {
this_mc._yscale = 110;
}
this_mc._xscale = this_mc._yscale;
}
function distance_make_visible(this_mc) {
var _local4 = _root.world_mc.horizon_line._y;
var _local5 = 5;
if (this_mc._y < _local4) {
this_mc._visible = false;
} else {
this_mc._visible = true;
}
if (this_mc.track_pos < (_root.world_mc.hunter.track_pos - 300)) {
this_mc._visible = false;
}
var _local3 = ((this_mc._y - _local4) / _local5) * 100;
if (_local3 > 100) {
_local3 = 100;
}
this_mc._alpha = _local3;
}
function move_object(this_mc) {
var _local5 = _root.world_mc.vanish_point._y;
var _local8 = _root.world_mc.endpoint_line._y;
var _local6 = _root.world_mc.y_plane._y;
var _local3 = new Number();
var _local4 = (this_mc.track_pos - _root.world_mc.hunter.track_pos) / _root.spawn_distance;
if (_local4 > 0) {
_local3 = 1 - Math.sqrt(_local4);
} else {
_local3 = Math.pow(1 - _local4, 20);
}
var _local7 = 4;
this_mc._y = _local5 + ((_local6 - _local5) * Math.pow(_local3, _local7));
_root.adjust_object_x(this_mc);
_root.object_scale_finder(this_mc);
_root.distance_make_visible(this_mc);
_root.off_the_map_removal(this_mc);
}
function adjust_object_x(this_mc) {
var _local2 = _root.world_mc.vanish_point._x;
var _local4 = _root.world_mc.vanish_point._y;
var _local7 = _root.world_mc.endpoint_line._y;
var _local5 = 1 - ((_root.world_mc.hunter.track_pos - this_mc.track_pos) / _root.spawn_distance);
var _local6 = 1;
this_mc._x = _local2 + ((((this_mc._y - _local4) / (_local7 - _local4)) * (this_mc.my_endpoint - _local2)) * Math.pow(_local5, _local6));
}
function adjust_depth(this_mc) {
}
function off_the_map_removal(this_mc) {
if (this_mc._y > _root.world_mc.removal_line._y) {
if (!(this_mc.permanant === true)) {
this_mc.killMe("");
}
}
}
function createDisplay(inType) {
var _local1 = attachMovie("madness_display", "display" + SwainMath.randomNumber(0, 99999999999), getNextHighestDepth());
_local1.init(inType);
}
function playAudio(inSound, inPlayer) {
if (this[inPlayer].lastPlayer != inSound) {
this[inPlayer].gotoAndStop(inSound);
this[inPlayer].lastPlayed = inSound;
}
}
myMusic.attachSound("song_2");
myMusic.stop();
myMusic.start(0, 9999999);
var totalPoints = 0;
var currentWave = 1;
var shake_camera = 0;
var default_speed = 100;
var spawn_distance = 4000;
var game_started = false;
var game_ended = false;
var press_mouse = new Object();
var release_mouse = new Object();
world_mc.init();
world_mc.hunter.init();
press_mouse.onMouseDown = function () {
_root.mouse_down = true;
_root.mouse_down_clicked = 0;
};
release_mouse.onMouseUp = function () {
_root.mouse_down = false;
_root.mouse_up_clicked = 0;
};
Mouse.addListener(press_mouse);
Mouse.addListener(release_mouse);
onEnterFrame = tick;
Frame 15
gotoAndStop ("game");
Symbol 22 MovieClip Frame 1
_visible = false;
Symbol 28 MovieClip Frame 1
gotoAndStop(_parent._parent.mySpriteDir);
Symbol 48 MovieClip [bullet_anim] Frame 4
this.removeMovieClip();
this._rotation = startRot + SwainMath.randomNumber(-10, 10);
Instance of Symbol 48 MovieClip [bullet_anim] in Symbol 50 MovieClip Frame 1
onClipEvent (load) {
var startRot = _rotation;
}
Symbol 50 MovieClip Frame 5
_parent._parent._parent._parent._parent.makeDebris("shell", false, _parent._parent._parent._parent.track_pos + 22, _parent._parent._parent._parent.my_endpoint, _parent._parent._parent._parent.my_speed);
Instance of Symbol 48 MovieClip [bullet_anim] in Symbol 54 MovieClip Frame 1
onClipEvent (load) {
var startRot = _rotation;
}
Symbol 54 MovieClip Frame 5
_parent._parent._parent._parent._parent.makeDebris("shell", false, _parent._parent._parent._parent.track_pos + 22, _parent._parent._parent._parent.my_endpoint, _parent._parent._parent._parent.my_speed);
Symbol 55 MovieClip Frame 1
totalIdleFrames = 24;
Symbol 55 MovieClip Frame 24
if (_parent._parent._parent.shootTimer < _parent._parent._parent.shootDifficulty) {
gotoAndPlay ("idle");
}
Symbol 79 MovieClip Frame 36
stop();
Symbol 89 MovieClip Frame 29
stop();
Symbol 90 MovieClip Frame 1
gotoAndStop(_parent._parent.mySpriteDir);
Symbol 100 MovieClip Frame 1
gotoAndStop(_parent._parent.mySpriteDir);
Symbol 112 MovieClip Frame 1
gotoAndStop(_parent._parent.mySpriteDir);
Symbol 133 MovieClip Frame 1
_visible = false;
Symbol 193 MovieClip Frame 1
myReady = false;
myHealth = 0;
amShooting = false;
checkHit = false;
Symbol 193 MovieClip Frame 2
myHealth = 30;
Symbol 193 MovieClip Frame 16
amShooting = true;
Symbol 193 MovieClip Frame 42
checkHit = true;
Symbol 193 MovieClip Frame 43
checkHit = false;
Symbol 193 MovieClip Frame 48
checkHit = true;
Symbol 193 MovieClip Frame 49
checkHit = false;
Symbol 193 MovieClip Frame 54
checkHit = true;
Symbol 193 MovieClip Frame 55
checkHit = false;
Symbol 193 MovieClip Frame 71
if (myHealth > 0) {
gotoAndPlay ("ready");
}
Symbol 193 MovieClip Frame 72
amShooting = false;
Symbol 193 MovieClip Frame 80
myReady = true;
Symbol 193 MovieClip Frame 81
myReady = false;
Symbol 205 MovieClip Frame 1
stop();
Symbol 205 MovieClip Frame 23
stop();
Symbol 205 MovieClip Frame 24
_parent._parent._parent._parent.doorStatus == "closing";
Symbol 205 MovieClip Frame 47
_parent._parent._parent._parent.doorStatus = "closed";
_parent._parent._parent._parent.myMission = "outrun";
Symbol 211 MovieClip Frame 1
stop();
myReady = false;
Symbol 211 MovieClip Frame 17
myReady = true;
Symbol 230 MovieClip Frame 1
stop();
myReady = false;
Symbol 230 MovieClip Frame 20
myReady = true;
Symbol 243 MovieClip Frame 23
stop();
Symbol 259 MovieClip Frame 6
stop();
Symbol 260 MovieClip Frame 15
stop();
Symbol 289 MovieClip Frame 18
stop();
if (_name != "mySmoke") {
_parent.killMe();
}
Symbol 308 MovieClip Frame 67
if (_parent.shootTimer == 0) {
gotoAndPlay ("idle");
}
Symbol 308 MovieClip Frame 78
_parent._parent.makeDebris("chute", false, _parent.track_pos, _parent.my_endpoint, _parent.my_speed * 2);
Symbol 308 MovieClip Frame 87
_parent.shootTimer = 2;
Symbol 308 MovieClip Frame 88
_parent._parent.makeDebris(_parent.myChar, false, _parent.track_pos + 15, _parent.my_endpoint, _parent.hunter.my_relative_speed + 1);
Symbol 308 MovieClip Frame 89
_parent.killMe("none");
Symbol 315 MovieClip [madness_badguy] Frame 1
#initclip 40
Object.registerClass("madness_badguy", MadnessBadguy);
#endinitclip
Symbol 320 MovieClip Frame 1
stop();
gotoAndStop(SwainMath.randomNumber(1, _totalframes - 1));
Symbol 326 MovieClip Frame 1
stop();
gotoAndStop(SwainMath.randomNumber(1, _totalframes));
Symbol 332 MovieClip Frame 1
gotoAndStop(SwainMath.randomNumber(1, _totalframes));
Symbol 338 MovieClip Frame 1
gotoAndStop(SwainMath.randomNumber(1, _totalframes));
Symbol 346 MovieClip Frame 1
gotoAndStop(SwainMath.randomNumber(1, _totalframes));
Symbol 365 MovieClip Frame 9
stop();
Symbol 373 MovieClip Frame 1
stop();
_visible = false;
Symbol 375 MovieClip Frame 1
myBody.gotoAndStop(SwainMath.randomNumber(1, myBody._totalframes));
Instance of Symbol 365 MovieClip in Symbol 375 MovieClip Frame 1
onClipEvent (load) {
this._rotation = SwainMath.randomNumber(-90, 90);
}
Instance of Symbol 373 MovieClip in Symbol 375 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_visible == false) {
_visible = true;
gotoAndPlay (2);
}
}
Symbol 375 MovieClip Frame 18
_parent._parent.debrisContainer.makeDebris("splat", false, _parent.track_pos, _parent.my_endpoint, 0);
_parent.my_speed = _parent.my_speed * 0.7;
myBody.gotoAndStop(SwainMath.randomNumber(1, myBody._totalframes));
_root.playAudio("hit7", "sound_impacts");
Instance of Symbol 373 MovieClip in Symbol 375 MovieClip Frame 18
onClipEvent (enterFrame) {
if (_visible == false) {
_visible = true;
gotoAndPlay (2);
}
}
Symbol 375 MovieClip Frame 26
_parent._parent.debrisContainer.makeDebris("splat", false, _parent.track_pos, _parent.my_endpoint, 0);
_parent.my_speed = _parent.my_speed * 0.7;
myBody.gotoAndStop(SwainMath.randomNumber(1, myBody._totalframes));
Symbol 375 MovieClip Frame 29
myBody.gotoAndStop(2);
Symbol 375 MovieClip Frame 34
_parent.my_speed = 0;
_parent._parent.debrisContainer.makeDebris("splat", false, _parent.track_pos, _parent.my_endpoint, 0);
Symbol 375 MovieClip Frame 66
stop();
Symbol 383 MovieClip Frame 1
myBody.gotoAndStop(SwainMath.randomNumber(1, myBody._totalframes));
Instance of Symbol 365 MovieClip in Symbol 383 MovieClip Frame 1
onClipEvent (load) {
this._rotation = SwainMath.randomNumber(-90, 90);
}
Instance of Symbol 373 MovieClip in Symbol 383 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_visible == false) {
_visible = true;
gotoAndPlay (2);
}
}
Symbol 383 MovieClip Frame 18
_parent._parent.debrisContainer.makeDebris("splat2", false, _parent.track_pos, _parent.my_endpoint, 0);
_parent.my_speed = _parent.my_speed * 0.7;
myBody.gotoAndStop(SwainMath.randomNumber(1, myBody._totalframes));
_root.playAudio("hit7", "sound_impacts");
Instance of Symbol 373 MovieClip in Symbol 383 MovieClip Frame 18
onClipEvent (enterFrame) {
if (_visible == false) {
_visible = true;
gotoAndPlay (2);
}
}
Symbol 383 MovieClip Frame 26
_parent._parent.debrisContainer.makeDebris("splat2", false, _parent.track_pos, _parent.my_endpoint, 0);
_parent.my_speed = _parent.my_speed * 0.7;
myBody.gotoAndStop(SwainMath.randomNumber(1, myBody._totalframes));
Symbol 383 MovieClip Frame 29
myBody.gotoAndStop(2);
Symbol 383 MovieClip Frame 34
_parent.my_speed = 0;
_parent._parent.debrisContainer.makeDebris("splat2", false, _parent.track_pos, _parent.my_endpoint, 0);
Symbol 383 MovieClip Frame 66
stop();
Symbol 408 MovieClip Frame 1
myBody.gotoAndStop(SwainMath.randomNumber(1, myBody._totalframes));
Instance of Symbol 365 MovieClip in Symbol 408 MovieClip Frame 1
onClipEvent (load) {
this._rotation = SwainMath.randomNumber(-90, 90);
}
Instance of Symbol 373 MovieClip in Symbol 408 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_visible == false) {
_visible = true;
gotoAndPlay (2);
}
}
Symbol 408 MovieClip Frame 18
_parent._parent.debrisContainer.makeDebris("splat", false, _parent.track_pos, _parent.my_endpoint, 0);
_parent.my_speed = _parent.my_speed * 0.7;
var i = 0;
while (i < 9) {
_parent._parent.debrisContainer.makeDebris("zombie_part", false, _parent.track_pos, _parent.my_endpoint, _parent.my_speed * (SwainMath.randomNumber(80, 120) / 100));
i++;
}
Instance of Symbol 373 MovieClip in Symbol 408 MovieClip Frame 18
onClipEvent (enterFrame) {
if (_visible == false) {
_visible = true;
gotoAndPlay (2);
}
}
Symbol 408 MovieClip Frame 19
stop();
_parent.killMe();
Symbol 430 MovieClip Frame 1
myBody.gotoAndStop(SwainMath.randomNumber(1, myBody._totalframes));
Instance of Symbol 365 MovieClip in Symbol 430 MovieClip Frame 1
onClipEvent (load) {
this._rotation = SwainMath.randomNumber(-90, 90);
}
Instance of Symbol 373 MovieClip in Symbol 430 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_visible == false) {
_visible = true;
gotoAndPlay (2);
}
}
Symbol 430 MovieClip Frame 18
_parent._parent.debrisContainer.makeDebris("splat", false, _parent.track_pos, _parent.my_endpoint, 0);
_parent.my_speed = _parent.my_speed * 0.7;
myBody.gotoAndStop(SwainMath.randomNumber(1, myBody._totalframes));
Instance of Symbol 373 MovieClip in Symbol 430 MovieClip Frame 18
onClipEvent (enterFrame) {
if (_visible == false) {
_visible = true;
gotoAndPlay (2);
}
}
Symbol 430 MovieClip Frame 26
_parent._parent.debrisContainer.makeDebris("splat", false, _parent.track_pos, _parent.my_endpoint, 0);
_parent.my_speed = _parent.my_speed * 0.7;
myBody.gotoAndStop(SwainMath.randomNumber(1, myBody._totalframes));
Symbol 430 MovieClip Frame 29
myBody.gotoAndStop(2);
Symbol 430 MovieClip Frame 34
_parent.my_speed = 0;
_parent._parent.debrisContainer.makeDebris("splat", false, _parent.track_pos, _parent.my_endpoint, 0);
Symbol 430 MovieClip Frame 66
stop();
Symbol 438 MovieClip Frame 10
stop();
_parent.killMe();
Symbol 441 MovieClip Frame 17
_parent.my_speed = _parent.my_speed * 0.7;
Symbol 441 MovieClip Frame 27
_parent.my_speed = _parent.my_speed * 0.7;
Symbol 441 MovieClip Frame 32
stop();
_parent.my_speed = 0;
Symbol 453 MovieClip Frame 13
stop();
Symbol 473 MovieClip Frame 1
stop();
Symbol 473 MovieClip Frame 18
_parent.myState = "active";
stop();
Symbol 477 MovieClip Frame 20
stop();
if (_name != "mySmoke") {
_parent.killMe();
}
Symbol 480 MovieClip Frame 11
_parent._parent.debrisContainer.makeDebris("agent", false, _parent.track_pos, _parent.my_endpoint, _parent.my_speed * 1.2);
_root.playAudio("hit5", "sound_impacts");
Symbol 480 MovieClip Frame 12
_parent.killMe();
Symbol 482 MovieClip Frame 22
stop();
Symbol 489 MovieClip Frame 11
_parent.killMe();
Symbol 500 MovieClip Frame 14
_parent.killMe();
Symbol 518 MovieClip Frame 1
gotoAndStop(_parent.randomPart);
Symbol 519 MovieClip Frame 1
function myMove() {
if (myPart._visible == true) {
if (!done) {
nextFrame();
}
_parent.my_speed = _parent.my_speed * 0.8;
myPart._y = myPart._y + myJump;
myJump = myJump + 3.3;
if (myPart._y > 0) {
myPart._y = 0;
myJump = myJump * -0.75;
if (myJump > -2) {
myJump = 0;
}
}
if (myJump == 0) {
myPart._alpha = myPart._alpha - 20;
}
if (myPart._alpha <= 0) {
myPart._visible = false;
}
myPart._x = myPart._x + mySpeed;
mySpeed = mySpeed * 0.9;
myPart._x._rotation = myPart._x._rotation + myRotate;
myRotate = myRotate * 0.95;
}
}
var randomPart = SwainMath.randomNumber(1, myPart._totalframes);
var mySpeed = (SwainMath.randomNumber(-150, 150) / 10);
var myJump = SwainMath.randomNumber(-10, -30);
var myRotation = SwainMath.randomNumber(-180, 180);
var myRotate = (SwainMath.randomNumber(-200, 200) / 10);
myPart._rotation = myRotation;
var done = false;
onEnterFrame = myMove;
Symbol 526 MovieClip Frame 1
gotoAndStop(_parent.randomPart);
Symbol 527 MovieClip Frame 1
function myMove() {
if (myPart._visible == true) {
if (!done) {
nextFrame();
}
_parent.my_speed = _parent.my_speed * 0.97;
myPart._y = myPart._y + myJump;
myJump = myJump + 3.3;
if (myPart._y > 0) {
myPart._y = 0;
myJump = myJump * -0.75;
if (myJump > -2) {
myJump = 0;
}
}
if (myJump == 0) {
myPart._alpha = myPart._alpha - 20;
}
if (myPart._alpha <= 0) {
myPart._visible = false;
}
myPart._x = myPart._x + mySpeed;
mySpeed = mySpeed * 0.9;
myPart._x._rotation = myPart._x._rotation + myRotate;
myRotate = myRotate * 0.95;
}
}
var randomPart = SwainMath.randomNumber(1, myPart._totalframes);
var mySpeed = (SwainMath.randomNumber(-150, 150) / 10);
var myJump = SwainMath.randomNumber(-10, -30);
var myRotation = SwainMath.randomNumber(-180, 180);
var myRotate = (SwainMath.randomNumber(-400, 400) / 10);
myPart._rotation = myRotation;
var done = false;
onEnterFrame = myMove;
Symbol 536 MovieClip Frame 1
gotoAndStop(_parent.randomPart);
Symbol 537 MovieClip Frame 1
function myMove() {
if (myPart._visible == true) {
if (!done) {
nextFrame();
}
_parent.my_speed = _parent.my_speed * 0.97;
myPart._y = myPart._y + myJump;
myJump = myJump + 3.3;
if (myPart._y > 0) {
myPart._y = 0;
myJump = myJump * -0.75;
if (myJump > -2) {
myJump = 0;
}
}
if (myJump == 0) {
myPart._alpha = myPart._alpha - 20;
}
if (myPart._alpha <= 0) {
myPart._visible = false;
}
myPart._x = myPart._x + mySpeed;
mySpeed = mySpeed * 0.9;
myPart._x._rotation = myPart._x._rotation + myRotate;
myRotate = myRotate * 0.95;
}
}
var randomPart = SwainMath.randomNumber(1, myPart._totalframes);
var mySpeed = (SwainMath.randomNumber(-150, 150) / 10);
var myJump = SwainMath.randomNumber(-10, -30);
var myRotation = SwainMath.randomNumber(-180, 180);
var myRotate = (SwainMath.randomNumber(-400, 400) / 10);
myPart._rotation = myRotation;
var done = false;
onEnterFrame = myMove;
Symbol 542 MovieClip Frame 1
gotoAndStop(_parent.randomPart);
Symbol 543 MovieClip Frame 1
function myMove() {
if (myPart._visible == true) {
if (!done) {
nextFrame();
}
_parent.my_speed = _parent.my_speed * 0.99;
myPart._y = myPart._y + myJump;
myJump = myJump + 3.3;
if (myPart._y > 0) {
myPart._y = 0;
myJump = myJump * -0.75;
if (myJump > -2) {
myJump = 0;
}
}
if (myJump == 0) {
myPart._alpha = myPart._alpha - 20;
}
if (myPart._alpha <= 0) {
myPart._visible = false;
}
myPart._x = myPart._x + mySpeed;
mySpeed = mySpeed * 0.9;
myPart._x._rotation = myPart._x._rotation + myRotate;
myRotate = myRotate * 0.95;
}
}
var randomPart = SwainMath.randomNumber(1, myPart._totalframes);
var mySpeed = (SwainMath.randomNumber(-150, 150) / 10);
var myJump = SwainMath.randomNumber(-10, -30);
var myRotation = SwainMath.randomNumber(-180, 180);
var myRotate = (SwainMath.randomNumber(-400, 400) / 10);
myPart._rotation = myRotation;
var done = false;
onEnterFrame = myMove;
Symbol 556 MovieClip Frame 1
gotoAndStop(_parent.randomPart);
Symbol 557 MovieClip Frame 1
function myMove() {
if (myPart._visible == true) {
if (!done) {
nextFrame();
}
_parent.my_speed = _parent.my_speed * 0.96;
myPart._y = myPart._y + myJump;
myJump = myJump + 3.3;
if (myPart._y > 0) {
myPart._y = 0;
myJump = myJump * -0.75;
if (myJump > -2) {
myJump = 0;
}
}
if (myJump == 0) {
myPart._alpha = myPart._alpha - 20;
}
if (myPart._alpha <= 0) {
myPart._visible = false;
}
myPart._x = myPart._x + mySpeed;
mySpeed = mySpeed * 0.9;
myPart._x._rotation = myPart._x._rotation + myRotate;
myRotate = myRotate * 0.95;
}
}
var randomPart = SwainMath.randomNumber(1, myPart._totalframes);
var mySpeed = (SwainMath.randomNumber(-150, 150) / 10);
var myJump = SwainMath.randomNumber(-10, -30);
var myRotation = SwainMath.randomNumber(-180, 180);
var myRotate = (SwainMath.randomNumber(-400, 400) / 10);
myPart._rotation = myRotation;
var done = false;
onEnterFrame = myMove;
Symbol 564 MovieClip Frame 1
gotoAndStop(_parent.randomPart);
Symbol 565 MovieClip Frame 1
function myMove() {
if (myPart._visible == true) {
if (!done) {
nextFrame();
}
_parent.my_speed = _parent.my_speed * 0.96;
myPart._y = myPart._y + myJump;
myJump = myJump + 3.3;
if (myPart._y > 0) {
myPart._y = 0;
myJump = myJump * -0.75;
if (myJump > -2) {
myJump = 0;
}
}
if (myJump == 0) {
myPart._alpha = myPart._alpha - 20;
}
if (myPart._alpha <= 0) {
myPart._visible = false;
}
myPart._x = myPart._x + mySpeed;
mySpeed = mySpeed * 0.9;
myPart._x._rotation = myPart._x._rotation + myRotate;
myRotate = myRotate * 0.95;
}
}
var randomPart = SwainMath.randomNumber(1, myPart._totalframes);
var mySpeed = (SwainMath.randomNumber(-150, 150) / 10);
var myJump = SwainMath.randomNumber(-10, -30);
var myRotation = SwainMath.randomNumber(-180, 180);
var myRotate = (SwainMath.randomNumber(-400, 400) / 10);
myPart._rotation = myRotation;
var done = false;
onEnterFrame = myMove;
Symbol 576 MovieClip Frame 1
gotoAndStop(_parent._parent.myPowerup);
Symbol 581 MovieClip Frame 1
stop();
Symbol 581 MovieClip Frame 49
_root.world_mc.makeDebris(_parent.myPowerup, false, _parent.track_pos, _parent.my_endpoint, 10);
Symbol 581 MovieClip Frame 94
stop();
if (_name != "mySmoke") {
_parent.killMe();
}
Symbol 582 MovieClip [madness_debris] Frame 1
#initclip 34
Object.registerClass("madness_debris", MadnessDebris);
#endinitclip
Instance of Symbol 326 MovieClip in Symbol 582 MovieClip [madness_debris] Frame 2
onClipEvent (load) {
this._x = SwainMath.randomNumber(-200, 200);
}
Instance of Symbol 289 MovieClip in Symbol 582 MovieClip [madness_debris] Frame 9
onClipEvent (load) {
_y = (_y + SwainMath.randomNumber(-300, 0));
}
Symbol 589 MovieClip [madness_leap] Frame 1
#initclip 35
Object.registerClass("madness_leap", MadnessLeap);
#endinitclip
Symbol 593 MovieClip Frame 37
stop();
Symbol 601 MovieClip Frame 17
gotoAndPlay (1);
Symbol 602 MovieClip Frame 15
gotoAndPlay ("loop");
Symbol 606 MovieClip Frame 37
stop();
Symbol 617 MovieClip Frame 15
gotoAndPlay ("loop");
Symbol 620 MovieClip Frame 31
_parent.removeMovieClip();
Symbol 625 MovieClip Frame 31
_parent.removeMovieClip();
Symbol 628 MovieClip Frame 31
_parent.removeMovieClip();
Symbol 631 MovieClip Frame 31
_parent.removeMovieClip();
Symbol 641 MovieClip Frame 91
_parent.removeMovieClip();
Symbol 644 MovieClip Frame 67
_parent.removeMovieClip();
Symbol 667 MovieClip Frame 1
gotoAndStop(_root.currentWave);
Symbol 669 MovieClip Frame 1
if (_root.currentWave > 10) {
this._visible = true;
} else {
this._visible = false;
}
Symbol 670 MovieClip Frame 25
stop();
Symbol 675 MovieClip Frame 8
stop();
Symbol 687 MovieClip Frame 21
stop();
Symbol 687 MovieClip Frame 34
_root.createDisplay("start");
_parent.removeMovieClip();
Symbol 699 Button
on (release) {
_parent._parent.pressReplay();
}
Symbol 702 Button
on (release) {
_parent._parent.pressMenu();
}
Symbol 704 MovieClip Frame 5
stop();
Symbol 705 MovieClip [madness_display] Frame 1
#initclip 36
Object.registerClass("madness_display", MadnessDisplay);
#endinitclip
Symbol 787 MovieClip Frame 1
function gunCheck() {
gotoAndStop(_root.world_mc.hunter.myGun);
}
onEnterFrame = gunCheck;
Symbol 870 MovieClip Frame 28
stop();
Symbol 874 MovieClip Frame 1
stop();
Symbol 874 MovieClip Frame 2
if (myPowerup == "auto") {
myPowerup = "Auto Rifle!";
}
if (myPowerup == "grenade") {
myPowerup = "Grenade Launcher!";
}
if (myPowerup == "shotgun") {
myPowerup = "Shotgun!";
}
if (myPowerup == "health") {
myPowerup = "Health!";
}
if (myPowerup == "invincible") {
myPowerup = "Invincible!";
}
Symbol 1005 MovieClip Frame 1
function gunCheck() {
gotoAndStop(_root.world_mc.hunter.myGun);
}
onEnterFrame = gunCheck;
Symbol 1038 MovieClip [MadnessHunter] Frame 1
#initclip 37
Object.registerClass("MadnessHunter", MadnessHunter);
#endinitclip
Symbol 1068 MovieClip Frame 5
if (SwainMath.randomNumber(0, 30) == 0) {
} else {
gotoAndPlay (1);
}
Symbol 1074 MovieClip Frame 1
stop();
Symbol 1089 MovieClip [world_mc] Frame 1
#initclip 38
Object.registerClass("world_mc", MadWorld);
#endinitclip
Instance of Symbol 1082 MovieClip "debrisContainer" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
function makeDebris(inType, inDanger, inTrack, inEndpoint, inSpeed) {
var _local1 = attachMovie("madness_debris", "debris" + SwainMath.randomNumber(0, 99999999999), getNextHighestDepth());
_local1.init(inType, inDanger, inTrack, inEndpoint, inSpeed);
}
var i = -20;
while (i <= _root.spawn_distance) {
makeDebris("mountain", false, i, -500, 0);
if (SwainMath.randomNumber(0, 30) == 0) {
makeDebris("nasty", false, i, 0, 0);
}
i = i + 100;
}
var i = -20;
while (i <= _root.spawn_distance) {
makeDebris("cliff", false, i, 1200, 0);
i = i + 100;
}
var i = -20;
while (i <= _root.spawn_distance) {
makeDebris("swoosh", false, i, 0, 0);
if (SwainMath.randomNumber(0, 30) == 0) {
makeDebris("nasty", false, i, 0, 0);
}
i = i + 150;
}
}
Instance of Symbol 1084 MovieClip "x_max" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1084 MovieClip "x_min" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1086 MovieClip "vanish_point" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1088 MovieClip "horizon_line" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1084 MovieClip "y_plane" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1088 MovieClip "endpoint_line" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1084 MovieClip "endpoint_min_A" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1084 MovieClip "endpoint_max_A" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1084 MovieClip "endpoint_min_B" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1084 MovieClip "endpoint_max_B" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1088 MovieClip "removal_line" in Symbol 1089 MovieClip [world_mc] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 1097 MovieClip Frame 1
stop();
Symbol 1107 MovieClip Frame 1
stop();
Symbol 1108 MovieClip [Preloader] Frame 1
function enterFrameHandler() {
var _local2 = 0;
_local2 = _root.getBytesLoaded() / _root.getBytesTotal();
if (loadingBar) {
loadingBar.gotoAndStop(Number(_local2 * (loadingBar.totalFrames - 1)) + 1);
}
if (_local2 >= 1) {
onEnterFrame = null;
gotoAndStop ("loaded");
}
}
stop();
var autoPlay;
var className;
onEnterFrame = enterFrameHandler;
Symbol 1108 MovieClip [Preloader] Frame 10
function _onPlayClick() {
_parent._parent.nextFrame();
_parent._parent.play();
_parent._onLoaded();
}
if (playButton) {
playButton.onRelease = _onPlayClick;
playButton.stop();
}
if (autoPlay) {
_onPlayClick(null);
}
Symbol 1113 MovieClip [Newgrounds API Classes] Frame 1
#initclip 33
Object.registerClass("Newgrounds API Classes", com.newgrounds.shims.APIShim);
#endinitclip
Symbol 1168 MovieClip [FlashAd] Frame 1
#initclip 39
Object.registerClass("FlashAd", com.newgrounds.components.FlashAdBase);
#endinitclip
stop();
Symbol 1169 MovieClip [APIConnector] Frame 1
function _onLoaded() {
gotoAndStop ("invisible");
if (_redirect) {
com.newgrounds.API.loadOfficialVersion();
}
}
function _apiConnect() {
var _local2 = com.newgrounds.API;
if (_local2 && (!_local2.connected)) {
if (!apiId) {
com.newgrounds.Logger.logError("No API ID entered in the API Connector component.", "You can create an API ID for this submission at http://newgrounds.com/account/flashapi", "Enter your API ID into the API Connector using the Component Inspector (Window -> Component Inspector).");
return(undefined);
}
switch (debugMode) {
case "Off" :
default :
_local2.debugMode = _local2.RELEASE_MODE;
break;
case "Simulate Logged-in User" :
_local2.debugMode = _local2.DEBUG_MODE_LOGGED_IN;
break;
case "Simulate Logged-out User" :
_local2.debugMode = _local2.DEBUG_MODE_LOGGED_OUT;
break;
case "Simulate New Version" :
_local2.debugMode = _local2.DEBUG_MODE_NEW_VERSION;
break;
case "Simulate Host Blocked" :
_local2.debugMode = _local2.DEBUG_MODE_HOST_BLOCKED;
}
_local2.addEventListener(com.newgrounds.APIEvent.API_CONNECTED, _onConnected);
_local2.connect(_root, apiId, encryptionKey, movieVersion);
}
}
function _onConnected(event) {
if ((redirectOnNewVersion && (event.__get__success())) && (event.__get__data().newVersion)) {
_redirect = true;
}
if ((redirectOnHostBlocked && (!event.__get__success())) && (event.__get__error() == com.newgrounds.APIEvent.ERROR_HOST_BLOCKED)) {
_redirect = true;
}
if (_redirect) {
gotoAndStop ("adPreloader");
forceAlwaysOnTop();
}
}
function forceAlwaysOnTop() {
var _local2 = getNextHighestDepth();
swapDepths(_local2);
if (Stage) {
_x = ((Stage.width - _width) / 2);
_y = ((Stage.height - _height) / 2);
_visible = true;
}
if (_root && (_root instanceof MovieClip)) {
MovieClip(_root).stop();
}
}
stop();
if (_root && (_root instanceof MovieClip)) {
MovieClip(_root).stop();
}
var apiId;
var encryptionKey;
var movieVersion;
var debugMode;
var connectorType;
var redirectOnHostBlocked;
var redirectOnNewVersion;
var _redirect;
_x = Number(_x);
_y = Number(_y);
if (!debugMode) {
debugMode = "Simulate Logged-in User";
}
if (!connectorType) {
connectorType = "Flash Ad + Preloader";
}
switch (connectorType) {
case "Flash Ad + Preloader" :
gotoAndStop ("adPreloader");
break;
case "Flash Ad Only" :
gotoAndStop ("ad");
break;
case "Invisible" :
gotoAndStop ("invisible");
}
_apiConnect();
Instance of Symbol 1168 MovieClip [FlashAd] "ad" in Symbol 1169 MovieClip [APIConnector] Frame 1
//component parameters
onClipEvent (construct) {
apiId = "";
showBorder = true;
}
Instance of Symbol 1108 MovieClip [Preloader] "loader" in Symbol 1169 MovieClip [APIConnector] Frame 1
//component parameters
onClipEvent (construct) {
autoPlay = false;
mainClass = "";
}
Symbol 1173 Button
on (release) {
getURL ("http://www.newgrounds.com/collection/madnessday2011", "_blank");
}
Symbol 1175 Button
on (release) {
getURL ("http://www.newgrounds.com/collection/madness", "_blank");
}
Symbol 1178 Button
on (release) {
getURL ("http://www.newgrounds.com/art/view/thepsychosheep/see-the-madness", "_blank");
}
Symbol 1183 MovieClip Frame 1
stop();
Instance of Symbol 1169 MovieClip [APIConnector] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (construct) {
apiId = "20552:ajKp6Wae";
encryptionKey = "EkzX0rqtsILkvkw4oJlaGsG0DUlKiF4X";
debugMode = "Simulate Logged-in User";
movieVersion = "";
connectorType = "Flash Ad + Preloader";
redirectOnNewVersion = true;
redirectOnHostBlocked = true;
}
Symbol 1183 MovieClip Frame 15
_root.gotoAndStop("menu");
Symbol 1357 MovieClip [__Packages.SwainMath] Frame 0
class SwainMath
{
function SwainMath () {
}
static function calculate_rotation(source_x, source_y, target_x, target_y) {
Xd = target_x - source_x;
Yd = target_y - source_y;
radAngle = Math.atan2(Yd, Xd);
rotation_result = int(((radAngle * 360) / (Math.PI*2)) + 90);
if (rotation_result > 180) {
rotation_result = -180 + (rotation_result - 180);
}
return(rotation_result);
}
static function move_me(this_mc, this_rotation, this_speed) {
if (this_rotation > 180) {
this_mc._y = this_mc._y + (this_speed * Math.cos((Math.PI/180) * this_rotation));
this_mc._x = this_mc._x - (this_speed * Math.sin((Math.PI/180) * this_rotation));
} else {
this_mc._y = this_mc._y - (this_speed * Math.cos((Math.PI/180) * this_rotation));
this_mc._x = this_mc._x + (this_speed * Math.sin((Math.PI/180) * this_rotation));
}
}
static function move_me2(this_axis, this_rotation, this_speed) {
if (this_rotation > 180) {
if (this_axis == "y") {
return(this_speed * Math.cos((Math.PI/180) * this_rotation));
}
if (this_axis == "x") {
return(-(this_speed * Math.sin((Math.PI/180) * this_rotation)));
}
} else {
if (this_axis == "y") {
return(-(this_speed * Math.cos((Math.PI/180) * this_rotation)));
}
if (this_axis == "x") {
return(this_speed * Math.sin((Math.PI/180) * this_rotation));
}
}
}
static function get_position(startX, startY, this_rotation, this_distance, this_axis) {
if (this_axis == "x") {
if (this_rotation > 180) {
return(startX - (this_distance * Math.sin((Math.PI/180) * this_rotation)));
}
return(startX + (this_distance * Math.sin((Math.PI/180) * this_rotation)));
}
if (this_axis == "y") {
if (this_rotation > 180) {
return(startY + (this_distance * Math.cos((Math.PI/180) * this_rotation)));
}
return(startY - (this_distance * Math.cos((Math.PI/180) * this_rotation)));
}
}
static function get_distance(mc_1, mc_2) {
point_this.x = mc_1._x;
point_this.y = mc_1._y;
point_target.x = mc_2._x;
point_target.y = mc_2._y;
this_distance = flash.geom.Point.distance(point_this, point_target);
return(this_distance);
}
static function get_distance2(mc_1_x, mc_1_y, mc_2_x, mc_2_y) {
point_this.x = mc_1_x;
point_this.y = mc_1_y;
point_target.x = mc_2_x;
point_target.y = mc_2_y;
this_distance = flash.geom.Point.distance(point_this, point_target);
return(this_distance);
}
static function randomNumber(min, max) {
var _local1 = Math.floor(Math.random() * ((max - min) + 1)) + min;
return(_local1);
}
static function getAxisDistance(inStart, inEnd) {
var _local1 = inStart - inEnd;
if (inStart < inEnd) {
_local1 = _local1 * -1;
}
return(_local1);
}
static function getRotDistance(inRot1, inRot2) {
var _local1;
if (inRot1 < (inRot2 - 180)) {
inRot1 = inRot1 + 360;
}
if (inRot1 > (inRot2 + 180)) {
inRot1 = inRot1 - 360;
}
_local1 = inRot1 - inRot2;
if (_local1 < 0) {
_local1 = _local1 * -1;
}
return(_local1);
}
static var point_this = new flash.geom.Point(0, 0);
static var point_target = new flash.geom.Point(0, 0);
static var this_distance = new Number();
static var Xd = new Number();
static var Yd = new Number();
static var radAngle = new Number();
static var rotation_result = new Number();
}
Symbol 1121 MovieClip [__Packages.com.newgrounds.APIConnection] Frame 0
class com.newgrounds.APIConnection
{
var _hostURL, hostDomain, sessionId, publisherId, encryptionKey, userEmail, username, userId, userpageFormat, initialized;
function APIConnection () {
reset();
}
function get hostURL() {
return(_hostURL);
}
function set hostURL(value) {
_hostURL = value;
hostDomain = null;
if (_hostURL) {
var _local2 = _hostURL.split("/");
if ((_local2[0] != "file:") && (_hostURL != "localhost")) {
hostDomain = _local2[2];
}
}
if (!hostDomain) {
hostDomain = "localhost";
}
//return(hostURL);
}
function get sandboxType() {
return(System.security.sandboxType);
}
function get isNetworkHost() {
switch (sandboxType) {
case "localWithFile" :
case "localWithNetwork" :
case "localTrusted" :
case "application" :
return(false);
case "remote" :
}
return(true);
}
function get hasUserSession() {
return(((sessionId != null) && (sessionId != "")) && (publisherId != 0));
}
function get connected() {
return(connectionState == CONNECTED);
}
function reset() {
connectionState = NOT_CONNECTED;
encryptionKey = null;
sessionId = null;
userEmail = null;
username = null;
userId = 0;
userpageFormat = 0;
}
function assertInitialized() {
if (!initialized) {
com.newgrounds.Logger.logError("You must initialized the API using API.connect() before using this command.");
return(false);
}
return(true);
}
function assertConnected() {
if ((!connectionState) == CONNECTED) {
com.newgrounds.Logger.logError("You must establish a connection using API.connect() before using this command.");
return(false);
}
return(true);
}
function sendSimpleCommand(command, completeHandler, parameters, secureParameters) {
if (parameters == undefined) {
parameters = null;
}
if (secureParameters == undefined) {
secureParameters = null;
}
var _local2 = new com.newgrounds.APICommand(command);
_local2.__set__parameters(parameters);
_local2.__set__secureParameters(secureParameters);
if (completeHandler != null) {
_local2.addEventListener(com.newgrounds.APIEvent.COMMAND_COMPLETE, completeHandler);
}
_local2.send(this);
}
function sendCommand(command) {
command.send(this);
}
function loadInBrowser(command, newWindow, parameters) {
if (newWindow == undefined) {
newWindow = true;
}
if (parameters == undefined) {
parameters = null;
}
var _local2 = new com.newgrounds.APICommand(command);
_local2.__set__parameters(parameters);
_local2.loadInBrowser(this, newWindow);
}
static var NOT_CONNECTED = "notConnected";
static var CONNECTING = "connecting";
static var CONNECTED = "connected";
var connectionState = NOT_CONNECTED;
var apiURL = "http://www.ngads.com/gateway_v2.php";
}
Symbol 1115 MovieClip [__Packages.com.newgrounds.EventDispatcher] Frame 0
class com.newgrounds.EventDispatcher
{
var _listeners;
function EventDispatcher () {
_listeners = {};
}
function addEventListener(type, listener) {
if (!_listeners[type]) {
_listeners[type] = [];
}
if (typeof(listener) == "function") {
_listeners[type].push({target:null, func:listener});
} else {
_listeners[type].push(listener);
}
}
function removeEventListener(type, listener) {
var _local3 = _listeners[type];
if (_local3) {
var _local5 = _local3.length;
var _local2 = 0;
while (_local2 < _local5) {
if ((_local3[_local2].func == listener) || (_local3[_local2] == listener)) {
_local3.splice(_local2, 1);
return(undefined);
}
_local2++;
}
}
}
function dispatchEvent(event) {
var _local4 = _listeners[event.__get__type()];
if (_local4) {
var _local5 = _local4.length;
var _local2 = 0;
while (_local2 < _local5) {
var _local3 = _local4[_local2];
_local3.func.call(_local3.target, event);
_local2++;
}
}
return(true);
}
}
Symbol 1114 MovieClip [__Packages.com.newgrounds.Event] Frame 0
class com.newgrounds.Event
{
var _type;
function Event (type) {
_type = type;
}
function get type() {
return(_type);
}
}
Symbol 1116 MovieClip [__Packages.com.newgrounds.APIEventDispatcher] Frame 0
class com.newgrounds.APIEventDispatcher extends com.newgrounds.EventDispatcher
{
static var _globalDispatcher;
function APIEventDispatcher () {
super();
}
static function get globalDispatcher() {
return(_globalDispatcher);
}
static function set globalDispatcher(value) {
_globalDispatcher = value;
//return(globalDispatcher);
}
static function initEventQueue() {
setInterval(runEventQueue, 50);
return([]);
}
function dispatchEvent(event) {
_eventQueue.push({dispatcher:this, event:event});
return(true);
}
function actualDispatchEvent(event) {
var _local3 = super.dispatchEvent(event);
if (_globalDispatcher && (this != _globalDispatcher)) {
_globalDispatcher.dispatchEvent(event);
}
}
static function runEventQueue(event) {
var _local3 = _eventQueue.length;
if (_local3) {
var _local4 = _eventQueue;
_eventQueue = [];
var _local1 = 0;
while (_local1 < _local3) {
var _local2 = _local4[_local1];
_local2.dispatcher.actualDispatchEvent(_local2.event);
_local1++;
}
}
}
static var _eventQueue = initEventQueue();
}
Symbol 1119 MovieClip [__Packages.com.newgrounds.encoders.BaseN] Frame 0
class com.newgrounds.encoders.BaseN
{
var _hash, _base, _reverseHash;
function BaseN (hash) {
if (hash) {
_hash = hash;
} else {
_hash = DEFAULT_HASH;
}
_base = _hash.length;
_reverseHash = new Object();
var _local2 = 0;
while (_local2 < _hash.length) {
_reverseHash[_hash.charAt(_local2)] = _local2;
_local2++;
}
}
function encodeUint(number, minimumChars) {
if (minimumChars == undefined) {
minimumChars = 1;
}
var _local2 = "";
var _local3 = number;
while (_local3 != 0) {
_local2 = _hash.charAt(_local3 % _base) + _local2;
_local3 = _local3 / _base;
_local3 = int(_local3);
}
while (_local2.length < minimumChars) {
_local2 = _hash.charAt(0) + _local2;
}
return(_local2);
}
function decodeUint(encodedNumber) {
var _local3 = 0;
var _local2 = 0;
while (_local2 < encodedNumber.length) {
_local3 = _local3 * _base;
_local3 = _local3 + _reverseHash[encodedNumber.charAt(_local2)];
_local2++;
}
return(_local3);
}
static var DEFAULT_HASH = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~@#$%^&*()+|;/";
}
Symbol 1125 MovieClip [__Packages.com.newgrounds.APICommand] Frame 0
class com.newgrounds.APICommand extends com.newgrounds.APIEventDispatcher
{
static var bridge;
var _command, _parameters, _secureParameters, _hasTimeout, _preventCache, _files, _loader, _timeoutTimer, dispatchEvent;
function APICommand (command) {
super();
_command = command;
_parameters = new Object();
_secureParameters = new Object();
_hasTimeout = true;
}
static function stopPendingCommands() {
for (var _local2 in _pendingCommands) {
var _local1 = _pendingCommands[_local2];
_local1.close();
}
_pendingCommands = [];
}
static function onThrottleTimer(event) {
if (_throttleCount > 0) {
_throttleCount--;
}
if (_commandQueue.length) {
var _local1 = _commandQueue.shift();
_local1.command.send(_local1.connection);
}
}
static function encryptHex(hexValue) {
var _local4 = hexValue.length % 6;
var _local3 = "";
var _local1 = 0;
while (_local1 < hexValue.length) {
_local3 = _local3 + _encryptor.encodeUint(int("0x" + hexValue.substr(_local1, 6)), 4);
_local1 = _local1 + 6;
}
return(_local4.toString() + _local3);
}
function get command() {
return(_command);
}
function set command(value) {
_command = value;
//return(command);
}
function get hasTimeout() {
return(_hasTimeout);
}
function set hasTimeout(val) {
_hasTimeout = val;
//return(hasTimeout);
}
function get parameters() {
return(_parameters);
}
function set parameters(object) {
_parameters = new Object();
if (object) {
for (var _local3 in object) {
_parameters[_local3] = object[_local3];
}
}
//return(parameters);
}
function get preventCache() {
return(_preventCache);
}
function set preventCache(value) {
_preventCache = value;
//return(preventCache);
}
function get secureParameters() {
return(_secureParameters);
}
function set secureParameters(object) {
_secureParameters = new Object();
if (object) {
for (var _local3 in object) {
_secureParameters[_local3] = object[_local3];
}
}
//return(secureParameters);
}
function get hasSecureParameters() {
for (var _local2 in _secureParameters) {
return(true);
}
return(false);
}
function addFile(filename, data, dataField, contentType) {
if (contentType == undefined) {
contentType = "application/octet-stream";
}
if (!_files) {
_files = new Object();
}
var _local3 = {filename:filename, data:data, dataField:dataField, contentType:contentType};
_files[filename] = _local3;
}
function removeFile(filename) {
if (_files) {
delete _files[filename];
}
}
function clearFiles() {
_files = null;
}
function close() {
if (_loader) {
clearInterval(_timeoutTimer);
var _local2 = 0;
while (_local2 < _pendingCommands.length) {
if (_pendingCommands[_local2] == this) {
_pendingCommands.splice(_local2, 1);
break;
}
_local2++;
}
_loader = null;
}
}
function loadInBrowser(connection, newWindow) {
_parameters.command_id = _command;
_parameters.tracker_id = (connection.apiId ? (connection.apiId) : 1);
if (connection.debug) {
_parameters.debug = 1;
}
var _local3 = (connection.apiURL + "?host=") + escape(connection.hostDomain);
for (var _local4 in _parameters) {
_local3 = _local3 + ((("&" + escape(_local4)) + "=") + escape(_parameters[_local4]));
}
var _local6;
if (newWindow) {
_local6 = "_blank";
} else {
_local6 = "_top";
}
_root.getURL(_local3, _local6);
}
function send(connection) {
if (_throttleCount >= THROTTLE_THRESHOLD) {
_commandQueue.push({connection:connection, command:this});
} else {
sendInternal(connection);
}
}
function sendInternal(connection) {
var _local4;
_local4 = new LoadVars();
_local4.command_id = _command;
_local4.tracker_id = connection.apiId;
if (connection.debug) {
_local4.debug = 1;
}
if (_preventCache) {
_local4.seed = Math.random();
}
var _local2;
var _local3;
var _local7;
for (_local2 in _parameters) {
_local3 = _parameters[_local2];
if (_local3 != null) {
if (typeof(_local3) == "boolean") {
_local4[_local2] = int(_local3);
} else {
_local4[_local2] = _local3;
}
}
}
if (hasSecureParameters) {
var _local6 = new Object();
for (_local2 in _secureParameters) {
_local3 = _secureParameters[_local2];
if (_local3 != null) {
if (typeof(_local3) == "boolean") {
_local6[_local2] = int(_local3);
} else {
_local6[_local2] = _local3;
}
}
}
var _local8 = "";
_local7 = 0;
while (_local7 < 16) {
_local8 = _local8 + ENCRYPTOR_RADIX.charAt(int(Math.random() * ENCRYPTOR_RADIX.length));
_local7++;
}
_local4.command_id = "securePacket";
_local6.command_id = _command;
_local6.as_version = 3;
_local6.session_id = connection.sessionId;
_local6.user_email = connection.userEmail;
_local6.publisher_id = connection.publisherId;
_local6.seed = _local8;
var _local13 = com.newgrounds.crypto.MD5.hash(_local8);
var _local11 = com.newgrounds.crypto.RC4.encrypt(com.newgrounds.encoders.json.JSON.encode(_local6), connection.encryptionKey);
_local4.secure = encryptHex(_local13 + _local11);
}
com.newgrounds.Logger.logInternal("Sending packet:", _local4);
var _local12;
_local12 = "application/x-www-form-urlencoded";
for (_local2 in _local4) {
if (typeof(_local4[_local2]) == "object") {
_local4[_local2] = com.newgrounds.encoders.json.JSON.encode(_local4[_local2]);
}
}
if (_files) {
for (var _local10 in _files) {
var _local5 = _files[_local10];
if (typeof(_local5.data) == "string") {
_local4[_local10] = _local5.data;
} else {
_local4[_local10] = com.newgrounds.encoders.json.JSON.encode(_local5.data);
}
}
}
_pendingCommands.push(this);
_throttleCount++;
startLoader(connection.apiURL, _local4, _local12);
}
function startLoader(url, data, contentType) {
_loader = LoadVars(data);
_loader.onData = as2CompleteHandler;
_loader.contentType = contentType;
_loader.sendAndLoad(url, _loader, "POST");
if (_hasTimeout) {
setInterval(this, onTimeout, TIMEOUT_INTERVAL);
}
}
function as2CompleteHandler(data) {
var _local3;
var _local2 = 0;
while (_local2 < _pendingCommands.length) {
if (_pendingCommands[_local2]._loader == this) {
_local3 = _pendingCommands[_local2];
break;
}
_local2++;
}
_local3.onComplete(data);
}
function onTimeout(event) {
close();
com.newgrounds.Logger.logError("Command timed out.");
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, null, com.newgrounds.APIEvent.ERROR_TIMED_OUT));
}
function onError(error) {
com.newgrounds.Logger.logError("Error when sending command:", error);
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, null, com.newgrounds.APIEvent.ERROR_UNKNOWN));
close();
}
function onComplete(data) {
try {
if ((!data) || (data == "")) {
throw new Error();
}
com.newgrounds.Logger.logInternal("Received packet:", data);
var _local2 = com.newgrounds.encoders.json.JSON.decode(data);
if (!_local2) {
throw new Error();
}
if (bridge) {
bridge.sendEvent(_local2.command_id, _local2);
}
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, _local2, ((_local2 && (_local2.success)) ? (com.newgrounds.APIEvent.ERROR_NONE) : (com.newgrounds.APIEvent.ERROR_COMMAND_FAILED))));
} catch(e) {
com.newgrounds.Logger.logError("Invalid response returned from server: " + data);
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, null, com.newgrounds.APIEvent.ERROR_BAD_RESPONSE));
}
close();
}
static var TIMEOUT_INTERVAL = 10000;
static var THROTTLE_INTERVAL = 5000;
static var THROTTLE_THRESHOLD = 7;
static var _throttleCount = 0;
static var _commandQueue = [];
static var _throttleTimer = setInterval(onThrottleTimer, THROTTLE_INTERVAL);
static var ENCRYPTOR_RADIX = "/g8236klvBQ#&|;Zb*7CEA59%s`Oue1wziFp$rDVY@TKxUPWytSaGHJ>dmoMR^<0~4qNLhc(I+fjn)X";
static var _encryptor = new com.newgrounds.encoders.BaseN(ENCRYPTOR_RADIX);
static var _pendingCommands = [];
static var CRLF = "\r\n";
}
Symbol 1120 MovieClip [__Packages.com.newgrounds.Bridge] Frame 0
class com.newgrounds.Bridge
{
var _widgetId, _inConnection, _outConnection;
function Bridge (id) {
_widgetId = id;
_inConnection = new LocalConnection();
_outConnection = new LocalConnection();
_inConnection.receiveEvent = receiveEvent;
try {
_inConnection.connect("rec_" + _widgetId);
} catch(error) {
}
com.newgrounds.Logger.addEventListener(com.newgrounds.APIEvent.LOG, {target:this, func:onLogMessage});
}
function onLogMessage(event) {
try {
_outConnection.send(_widgetId, "sendEvent", "trace", String(event.__get__data()));
} catch(error) {
}
}
function sendEvent(command, parameters) {
if (_outConnection) {
parameters = {data:parameters};
_outConnection.send(_widgetId, "sendEvent", command, parameters);
}
}
function receiveEvent(event, parameters) {
}
function onStatus(event) {
}
}
Symbol 1117 MovieClip [__Packages.com.newgrounds.APIEvent] Frame 0
class com.newgrounds.APIEvent extends com.newgrounds.Event
{
var _error, _success, _data, __get__type;
function APIEvent (type, data, error) {
super(type);
if (data == undefined) {
data = null;
}
if (error == undefined) {
error = null;
}
if (((!error) || (error == "")) || (error == ERROR_NONE)) {
_error = ERROR_NONE;
_success = true;
} else {
_error = error;
_success = false;
}
if (data) {
_data = data;
} else {
_data = {};
}
}
function clone() {
return(new com.newgrounds.APIEvent(__get__type(), _data, _error));
}
function get success() {
return(_success);
}
function get data() {
return(_data);
}
function get error() {
return(_error);
}
static var COMMAND_COMPLETE = "commandComplete";
static var MEDAL_UNLOCK_CONFIRMED = "medalUnlockConfirmed";
static var ICON_LOADED = "iconLoaded";
static var API_CONNECTED = "movieConnected";
static var LOG = "log";
static var MEDAL_UNLOCKED = "medalUnlocked";
static var SCORES_LOADED = "scoresLoaded";
static var SCORE_POSTED = "scorePosted";
static var QUERY_COMPLETE = "queryComplete";
static var FILE_LOADED = "fileLoaded";
static var FILE_SAVED = "fileSaved";
static var FILE_REQUESTED = "fileRequested";
static var VOTE_COMPLETE = "voteComplete";
static var ERROR_NONE = "noError";
static var ERROR_UNKNOWN = "unknownError";
static var ERROR_COMMAND_FAILED = "commandFailed";
static var ERROR_NOT_CONNECTED = "notConnected";
static var ERROR_INVALID_ARGUMENT = "invalidArgument";
static var ERROR_TIMED_OUT = "timedOut";
static var ERROR_BAD_FILE = "badFile";
static var ERROR_BAD_RESPONSE = "badResponse";
static var ERROR_SENDING_COMMAND = "errorSendingCommand";
static var ERROR_HOST_BLOCKED = "hostBlocked";
static var ERROR_ALREADY_VOTED = "alreadyVoted";
static var ERROR_NOT_LOGGED_IN = "notLoggedIn";
}
Symbol 1136 MovieClip [__Packages.com.newgrounds.API] Frame 0
class com.newgrounds.API
{
static var _adFeedURL, _movieVersion, _bridge, _requestedSaveGroupId, _requestedSaveFileId, _movieName, _newVersion, _saveFilePath, _imageFilePath;
function API () {
}
static function get connected() {
return(_connection.__get__connected());
}
static function get isNetworkHost() {
return(_connection.__get__isNetworkHost());
}
static function get apiId() {
_connection.assertInitialized();
return(_connection.apiId);
}
static function get debugMode() {
return(_debugMode);
}
static function set debugMode(val) {
_debugMode = val;
//return(debugMode);
}
static function get publisherId() {
_connection.assertInitialized();
return(_connection.publisherId);
}
static function get sessionId() {
_connection.assertInitialized();
return(_connection.sessionId);
}
static function get hostDomain() {
_connection.assertInitialized();
return(_connection.hostDomain);
}
static function get hostURL() {
_connection.assertInitialized();
return(_connection.__get__hostURL());
}
static function get isNewgrounds() {
return(_connection.publisherId == 1);
}
static function get hasUserSession() {
_connection.assertInitialized();
return(_connection.__get__hasUserSession());
}
static function get username() {
_connection.assertInitialized();
return(_connection.username);
}
static function get userId() {
_connection.assertInitialized();
return(_connection.userId);
}
static function assertConnected(eventType) {
if (eventType == undefined) {
eventType = null;
}
if (_connection.assertConnected()) {
return(true);
}
if (eventType) {
dispatchEvent(eventType, null, com.newgrounds.APIEvent.ERROR_NOT_CONNECTED);
}
return(false);
}
static function get adsApproved() {
return(_adsApproved);
}
static function get adFeedURL() {
return(_adFeedURL);
}
static function get medals() {
return(_medalsArray);
}
static function get scoreBoards() {
return(_scoreBoardsArray);
}
static function get saveGroups() {
return(_saveGroupsArray);
}
static function connect(_root, apiId, encryptionKey, movieVersion) {
if (encryptionKey == undefined) {
encryptionKey = null;
}
if (movieVersion == undefined) {
movieVersion = "";
}
com.newgrounds.APIEventDispatcher.__set__globalDispatcher(_dispatcher);
System.security.loadPolicyFile("http://apifiles.ngfiles.com/crossdomain.xml");
if (_connection.initialized) {
com.newgrounds.Logger.logError("Connection already in progress. Please call API.disconnect() before attempting another connection.");
dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, false, com.newgrounds.APIEvent.ERROR_NOT_CONNECTED);
return(undefined);
}
if ((!apiId) || (apiId == "")) {
com.newgrounds.Logger.logError("No apiId given. Please use the API ID from your API settings page.");
dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, false, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT);
return(undefined);
}
com.newgrounds.Logger.logMessage(("====== Newgrounds API v" + VERSION) + " ======");
_connection.connectionState = com.newgrounds.APIConnection.CONNECTING;
_root=_root;//parameter overwritten
_movieVersion = movieVersion;
_connection.apiId = apiId;
var _local3 = apiId.indexOf(":");
if (_local3 != -1) {
_connection.trackerId = int(apiId.substring(0, _local3));
} else {
_connection.trackerId = int(apiId);
}
if (!_connection.trackerId) {
com.newgrounds.Logger.logError("Invalid API ID: " + apiId);
dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, false, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT);
return(undefined);
}
_connection.encryptionKey = encryptionKey;
_connection.initialized = true;
_connection.__set__hostURL(_root._url);
doConnect(_root);
}
static function doConnect(flashVars) {
if (isNetworkHost && (_debugMode != RELEASE_MODE)) {
com.newgrounds.Logger.logMessage("Live file detected, turning off debug mode.");
_debugMode = RELEASE_MODE;
}
if (flashVars && (flashVars.NewgroundsAPI_SandboxID)) {
_bridge = new com.newgrounds.Bridge(flashVars.NewgroundsAPI_SandboxID);
com.newgrounds.APICommand.bridge = _bridge;
}
if (_debugMode == RELEASE_MODE) {
if (flashVars) {
if (flashVars.NewgroundsAPI_UserName) {
_connection.username = flashVars.NewgroundsAPI_UserName;
}
if (flashVars.NewgroundsAPI_UserID) {
_connection.userId = flashVars.NewgroundsAPI_UserID;
}
if (flashVars.NewgroundsAPI_PublisherID) {
_connection.publisherId = flashVars.NewgroundsAPI_PublisherID;
}
if (flashVars.NewgroundsAPI_UserpageFormat) {
_connection.userpageFormat = flashVars.NewgroundsAPI_UserpageFormat;
}
if (flashVars.NewgroundsAPI_SessionID) {
_connection.sessionId = flashVars.NewgroundsAPI_SessionID;
}
if (flashVars.NewgroundsAPI_SaveGroupID) {
_requestedSaveGroupId = flashVars.NewgroundsAPI_SaveGroupID;
}
if (flashVars.NewgroundsAPI_SaveFileID) {
_requestedSaveFileId = flashVars.NewgroundsAPI_SaveFileID;
}
}
} else {
_connection.debug = true;
if ((_debugMode == DEBUG_MODE_LOGGED_IN) || (_debugMode == DEBUG_MODE_LOGGED_OUT)) {
_connection.publisherId = 1;
}
if (_debugMode == DEBUG_MODE_LOGGED_IN) {
_connection.sessionId = "D3bu64p1U53R";
_connection.userId = 10;
_connection.username = "API-Debugger";
}
}
_connection.sendSimpleCommand("connectMovie", onConnect, {host:_connection.hostDomain, movie_version:_movieVersion, publisher_id:_connection.publisherId});
}
static function onConnect(event) {
var _local1 = event.__get__data();
if (!event.__get__success()) {
com.newgrounds.Logger.logError("Unable to connect to the API.");
_connection.reset();
dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, event.__get__data(), event.__get__error());
return(undefined);
}
if (debugMode != RELEASE_MODE) {
_adFeedURL = TEST_AD_FEED_URL;
} else if (_local1.ad_url) {
_adFeedURL = unescape(_local1.ad_url);
}
switch (_local1.ad_status) {
case -1 :
com.newgrounds.Logger.logWarning("Your movie is not approved to run Flash Ads.");
break;
case 0 :
com.newgrounds.Logger.logWarning("Your movie is still awaiting approval to run Flash Ads.");
break;
case 1 :
com.newgrounds.Logger.logMessage("Your movie is approved to run Flash Ads!");
}
_adsApproved = _local1.ad_status == 1;
if ((_debugMode == DEBUG_MODE_HOST_BLOCKED) || (_local1.deny_host)) {
com.newgrounds.Logger.logWarning(_connection.hostDomain + " does not have permission to host this movie!", "Update your API configuration to allow this host.");
dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, {officialURL:unescape(_local1.movie_url)}, com.newgrounds.APIEvent.ERROR_HOST_BLOCKED);
_connection.reset();
return(undefined);
}
_movieName = (_local1.movieName ? (_local1.movieName) : "");
com.newgrounds.Logger.logMessage("Connecting to the Newgrounds API Gateway...", ("----- " + _local1.movie_name) + " -----");
if (_debugMode == DEBUG_MODE_NEW_VERSION) {
_local1.movie_version = "Debug Mode";
}
if (_local1.movie_version) {
com.newgrounds.Logger.logMessage("A new version of this movie is available.", "Current version:\t" + _movieVersion, "Newest version:\t" + _local1.movie_version, "Use API.loadOfficialVersion() to link to the latest version.");
_newVersion = true;
} else {
_newVersion = false;
}
if (_local1.request_portal_url) {
_connection.sendSimpleCommand("setPortalID", null, {portal_url:_connection.__get__hostURL()});
}
_connection.sendSimpleCommand("preloadSettings", onMetadataLoaded, {publisher_id:_connection.publisherId, user_id:_connection.userId});
}
static function onMetadataLoaded(event) {
var _local11 = event.__get__data();
var _local1;
var _local7;
if (!event.__get__success()) {
com.newgrounds.Logger.logWarning("Unable to load movie metadata.");
disconnect();
dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, null, event.__get__error());
return(undefined);
}
var _local10 = 0;
if (_local11.medals) {
_local10 = _local11.medals.length;
var _local17;
if (hasUserSession) {
_local17 = loadLocal("medals_unlocked_" + username);
} else {
_local17 = loadLocal("medals_unlocked");
}
_local1 = 0;
while (_local1 < _local10) {
var _local6 = _local11.medals[_local1];
var _local14 = _local6.medal_unlocked;
var _local16 = _local17 && (_local17[_local6.medal_id]);
var _local4 = new com.newgrounds.Medal(_connection, _local6.medal_id, _local6.medal_name, (hasUserSession ? (_local14) : (_local16)), _local6.medal_value, _local6.medal_difficulty, _local6.medal_icon);
_local4.addEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCKED, onMedalUnlocked, false, 0, true);
_local4.addEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCK_CONFIRMED, onMedalUnlockConfirmed, false, 0, true);
_medals[_local4.__get__name()] = _local4;
_medalsArray.push(_local4);
com.newgrounds.Logger.logMessage(_local4);
if ((hasUserSession && (_local16)) && (!_local14)) {
com.newgrounds.Logger.logMessage(("Server missed the \"" + _local4.__get__name()) + "\" unlock. Resending...");
_local4.unlock();
}
_local1++;
}
}
com.newgrounds.Logger.logMessage(((_local10 + " medal") + ((_local10 != 1) ? "s" : "")) + " initialized.");
_local10 = 0;
if (_local11.score_boards) {
_local10 = _local11.score_boards.length;
_local1 = 0;
while (_local1 < _local10) {
var _local15 = _local11.score_boards[_local1];
var _local9 = new com.newgrounds.ScoreBoard(_connection, _local15.name, _local15.id);
_scoreBoards[_local9.__get__name()] = _local9;
_scoreBoardsArray.push(_local9);
com.newgrounds.Logger.logMessage(_local9);
_local1++;
}
}
com.newgrounds.Logger.logMessage(((_local10 + " scoreboard") + ((_local10 != 1) ? "s" : "")) + " initialized.");
_local10 = 0;
if (_local11.save_groups) {
_local10 = _local11.save_groups.length;
_local1 = 0;
while (_local1 < _local10) {
var _local2 = _local11.save_groups[_local1];
var _local13 = [];
if (_local2.keys) {
_local7 = 0;
while (_local7 < _local2.keys.length) {
var _local5 = _local2.keys[_local7];
_local13.push(new com.newgrounds.SaveKey(_local5.name, _local5.id, _local5.type));
_local7++;
}
}
var _local12 = [];
if (_local2.ratings) {
_local1 = 0;
while (_local1 < _local2.ratings.length) {
var _local3 = _local2.ratings[_local1];
_local12.push(new com.newgrounds.SaveRating(_local3.name, _local3.id, _local3.float, _local3.min, _local3.max));
_local1++;
}
}
var _local8 = new com.newgrounds.SaveGroup(_connection, _local2.group_name, _local2.group_id, _local2.group_type, _local13, _local12);
_saveGroups[_local8.__get__name()] = _local8;
_saveGroupsArray.push(_local8);
com.newgrounds.Logger.logMessage(_local8);
_local1++;
}
}
com.newgrounds.Logger.logMessage(((_local10 + " save group") + ((_local10 != 1) ? "s" : "")) + " initialized.");
if (_local11.save_file_path) {
_saveFilePath = _local11.save_file_path + "/";
com.newgrounds.SaveFile._saveFilePath = _saveFilePath;
com.newgrounds.Logger.logInternal("Save file path: " + _saveFilePath);
}
if (_local11.image_file_path) {
_imageFilePath = _local11.image_file_path + "/";
com.newgrounds.SaveFile._imageFilePath = _imageFilePath;
com.newgrounds.Logger.logInternal("Image file path: " + _imageFilePath);
}
com.newgrounds.Logger.logMessage("Connection complete!");
_connection.connectionState = com.newgrounds.APIConnection.CONNECTED;
dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, {movieName:_movieName, newVersion:_newVersion});
if (_requestedSaveFileId && (_requestedSaveGroupId)) {
addEventListener(com.newgrounds.APIEvent.FILE_LOADED, onRequestedFileLoaded);
loadSaveFile(_requestedSaveFileId, false);
}
}
static function disconnect() {
if (!_connection.__get__connected()) {
com.newgrounds.Logger.logWarning("The Newgrounds API is already disconnected.");
return(undefined);
}
_connection.reset();
for (var _local2 in _medals) {
var _local1 = _medals[_local2];
_local1.removeEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCKED, onMedalUnlocked);
_local1.removeEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCK_CONFIRMED, onMedalUnlockConfirmed);
}
_newVersion = false;
_medals = new Object();
_medalsArray = [];
_scoreBoards = new Object();
_scoreBoardsArray = [];
_saveGroups = new Object();
_saveGroupsArray = [];
_sharedObjects = new Object();
_imageFilePath = null;
_saveFilePath = null;
com.newgrounds.Logger.logMessage("Disconnected from the Newgrounds API.");
}
static function loadNewgrounds() {
_connection.loadInBrowser("loadNewgrounds");
}
static function loadOfficialVersion() {
if (_connection.assertInitialized()) {
_connection.loadInBrowser("loadOfficialVersion", false);
}
}
static function loadMySite() {
if (_connection.assertInitialized()) {
_connection.loadInBrowser("loadMySite");
}
}
static function loadCustomLink(linkName) {
if (_connection.assertInitialized()) {
_connection.loadInBrowser("loadCustomLink", true, {link:linkName});
}
}
static function getMedal(medalName) {
return(_medals[medalName]);
}
static function unlockMedal(medalName) {
if (!assertConnected()) {
return(undefined);
}
var _local1 = _medals[medalName];
if (!_local1) {
com.newgrounds.Logger.logError(("No medal named \"" + medalName) + "\" w.");
return(undefined);
}
_local1.unlock();
}
static function onMedalUnlocked(event) {
if (event.__get__success()) {
var _local2 = com.newgrounds.Medal(event.__get__data());
var _local1;
if (hasUserSession) {
_local1 = loadLocal("medals_unlocked_" + username);
if (!_local1) {
_local1 = new Object();
}
_local1[_local2.__get__id()] = true;
saveLocal("medals_unlocked_" + username, _local1);
} else {
_local1 = loadLocal("medals_unlocked");
if (!_local1) {
_local1 = new Object();
}
_local1[com.newgrounds.Medal(event.__get__data()).__get__id()] = true;
saveLocal("medals_unlocked", _local1);
com.newgrounds.Logger.logMessage(("User instanceof not logged in. Medal \"" + _local2.__get__name()) + "\" unlocked locally.");
}
}
}
static function onMedalUnlockConfirmed(event) {
if (hasUserSession) {
var _local1 = loadLocal("medals_unlocked_" + username);
if (!_local1) {
_local1 = new Object();
} else {
delete _local1[com.newgrounds.Medal(event.__get__data()).__get__id()];
}
saveLocal("medals_unlocked_" + username, _local1);
}
}
static function getScoreBoard(scoreBoardName) {
if (!assertConnected()) {
return(null);
}
return(_scoreBoards[scoreBoardName]);
}
static function loadScores(scoreBoardName, period, firstResult, numResults, tag) {
if (period == undefined) {
period = "All-Time";
}
if (firstResult == undefined) {
firstResult = 1;
}
if (numResults == undefined) {
numResults = 10;
}
if (tag == undefined) {
tag = null;
}
if (!assertConnected()) {
return(null);
}
var _local1 = _scoreBoards[scoreBoardName];
if (!_local1) {
com.newgrounds.Logger.logError(("No scoreboard named \"" + scoreBoardName) + "\" w.");
dispatchEvent(com.newgrounds.APIEvent.SCORES_LOADED, null, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT);
return(null);
}
_local1.__set__period(period);
_local1.__set__firstResult(firstResult);
_local1.__set__numResults(numResults);
_local1.__set__tag(tag);
_local1.loadScores();
return(_local1);
}
static function postScore(scoreBoardName, numericScore, tag) {
if (tag == undefined) {
tag = null;
}
if (!assertConnected()) {
return(undefined);
}
if (!hasUserSession) {
com.newgrounds.Logger.logError("The user must be logged-in to post a score.");
dispatchEvent(com.newgrounds.APIEvent.SCORES_LOADED, null, com.newgrounds.APIEvent.ERROR_NOT_LOGGED_IN);
return(undefined);
}
var _local1 = _scoreBoards[scoreBoardName];
if (!_local1) {
com.newgrounds.Logger.logError(("No scoreboard named \"" + scoreBoardName) + "\" w.");
dispatchEvent(com.newgrounds.APIEvent.SCORES_LOADED, null, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT);
return(undefined);
}
_local1.postScore(numericScore, tag);
}
static function getSaveGroup(groupName) {
if (!assertConnected()) {
return(null);
}
return(_saveGroups[groupName]);
}
static function getSaveGroupById(id) {
for (var _local3 in _saveGroups) {
var _local1 = _saveGroups[_local3];
if (_local1.__get__id() == id) {
return(_local1);
}
}
return(null);
}
static function createSaveFile(groupName) {
if (!assertConnected()) {
return(null);
}
var _local1 = getSaveGroup(groupName);
if (!_local1) {
com.newgrounds.Logger.logError(("The save group \"" + groupName) + "\" w found.");
return(null);
}
return(new com.newgrounds.SaveFile(_local1));
}
static function loadSaveFile(saveId, loadContents) {
if (loadContents == undefined) {
loadContents = true;
}
_connection.sendSimpleCommand("loadSaveFile", onFileLoaded, {save_id:saveId, get_contents:loadContents});
}
static function onFileLoaded(event) {
var _local2;
if (event.__get__success()) {
_local2 = com.newgrounds.SaveFile.fromObject(getSaveGroupById(event.__get__data().group_id), event.__get__data().file);
if (event.__get__data().get_contents) {
_local2.load();
} else {
dispatchEvent(com.newgrounds.APIEvent.FILE_LOADED, _local2);
}
} else {
com.newgrounds.Logger.logError("Unable to load file:", event.__get__error());
dispatchEvent(com.newgrounds.APIEvent.FILE_LOADED, null, event.__get__error());
}
}
static function createSaveQuery(groupName) {
if (!assertConnected()) {
return(null);
}
var _local1 = getSaveGroup(groupName);
if (!_local1) {
com.newgrounds.Logger.logError(("The save group \"" + groupName) + "\" w found.");
return(null);
}
var _local2 = new com.newgrounds.SaveQuery(_local1);
return(_local2);
}
static function createSaveQueryByDate(groupName, sortDescending) {
if (sortDescending == undefined) {
sortDescending = true;
}
var _local1 = createSaveQuery(groupName);
if (!_local1) {
return(null);
}
_local1.sortOn(com.newgrounds.SaveQuery.CREATED_ON, sortDescending);
return(_local1);
}
static function createSaveQueryByName(groupName, filename, exactMatch, sortDescending) {
if (exactMatch == undefined) {
exactMatch = false;
}
if (sortDescending == undefined) {
sortDescending = true;
}
var _local1 = createSaveQuery(groupName);
_local1.addCondition(com.newgrounds.SaveQuery.FILE_NAME, (exactMatch ? (com.newgrounds.SaveQuery.OPERATOR_EQUAL) : (com.newgrounds.SaveQuery.OPERATOR_CONTAINS)), filename);
return(_local1);
}
static function createSaveQueryByRating(groupName, ratingName, sortDescending) {
if (sortDescending == undefined) {
sortDescending = true;
}
var _local1 = createSaveQuery(groupName);
_local1.sortOn(ratingName, sortDescending);
return(_local1);
}
static function onRequestedFileLoaded(event) {
removeEventListener(com.newgrounds.APIEvent.FILE_LOADED, onRequestedFileLoaded);
if (event.__get__success()) {
var _local1 = event.__get__data();
if (_local1) {
dispatchEvent(com.newgrounds.APIEvent.FILE_REQUESTED, _local1);
}
}
}
static function addEventListener(eventType, listener, useCapture, priority, useWeakReference) {
if (useCapture == undefined) {
useCapture = false;
}
if (priority == undefined) {
priority = 0;
}
if (useWeakReference == undefined) {
useWeakReference = true;
}
_dispatcher.addEventListener(eventType, listener, useCapture, priority, useWeakReference);
}
static function removeEventListener(eventType, listener, useCapture) {
if (useCapture == undefined) {
useCapture = false;
}
_dispatcher.removeEventListener(eventType, listener);
}
static function dispatchEvent(event, data, error) {
if (data == undefined) {
data = null;
}
if (error == undefined) {
error = null;
}
_dispatcher.dispatchEvent(new com.newgrounds.APIEvent(event, data, error));
}
static function saveLocal(saveId, saveData) {
try {
var _local3;
var _local2 = (("ng_ap_secure_" + _connection.trackerId) + "_") + com.newgrounds.crypto.RC4.encrypt(saveId, _connection.encryptionKey);
if (!_sharedObjects[saveId]) {
_sharedObjects[saveId] = SharedObject.getLocal(_local2);
}
_local3 = _sharedObjects[saveId];
_local3.data.data = encodeData(saveData);
} catch(_local) {
if (Error( /* Error999 */
) != null) {
var error = Error( /* Error999 */
);
com.newgrounds.Logger.logError("Unable to save local data.", error);
return(false);
}
Error( /* Error999 */
);
throw /* Error999 */
;
}
return(true);
}
static function loadLocal(saveId) {
try {
var _local1;
var _local3 = (("ng_ap_secure_" + _connection.trackerId) + "_") + com.newgrounds.crypto.RC4.encrypt(saveId, _connection.encryptionKey);
if (!_sharedObjects[saveId]) {
_sharedObjects[saveId] = SharedObject.getLocal(_local3);
}
_local1 = _sharedObjects[saveId];
if ((_local1 && (_local1.data)) && (_local1.data.data)) {
return(decodeData(_local1.data.data));
}
return(null);
} catch(error:Error) {
com.newgrounds.Logger.logError("Unable to load local data.", error);
}
return(null);
}
static function logCustomEvent(eventName) {
if (assertConnected()) {
com.newgrounds.Logger.logMessage("Logged event: " + eventName);
_connection.sendSimpleCommand("logCustomEvent", null, {event:eventName});
}
}
static function encodeData(data) {
if (!_connection.assertInitialized()) {
return(null);
}
return(com.newgrounds.crypto.RC4.encrypt(com.newgrounds.encoders.json.JSON.encode(data), _connection.encryptionKey));
}
static function decodeData(data) {
if (!_connection.assertInitialized()) {
return(null);
}
try {
return(com.newgrounds.encoders.json.JSON.decode(com.newgrounds.crypto.RC4.decrypt(data, _connection.encryptionKey)));
} catch(error:Error) {
}
return(null);
}
static function stopPendingCommands() {
com.newgrounds.APICommand.stopPendingCommands();
com.newgrounds.Logger.logMessage("Pending commands stopped.");
}
static function setFont(textField, font) {
if (textField && (font)) {
var _local2 = textField.getTextFormat();
var _local4 = textField.embedFonts;
var _local3 = new TextFormat(font);
textField.setNewTextFormat(_local3);
textField.setTextFormat(_local3);
textField.embedFonts = true;
if (textField.textWidth == 0) {
textField.embedFonts = _local4;
textField.setTextFormat(_local2);
textField.setNewTextFormat(_local2);
} else {
textField.antiAliasType = "advanced";
textField.sharpness = 120;
}
}
}
static var VERSION = "3.0.4.1 beta AS2";
static var RELEASE_MODE = "releaseMode";
static var DEBUG_MODE_LOGGED_IN = "debugModeLoggedIn";
static var DEBUG_MODE_LOGGED_OUT = "debugModeLoggedOut";
static var DEBUG_MODE_NEW_VERSION = "debugModeNewVersion";
static var DEBUG_MODE_HOST_BLOCKED = "debugModeHostBlocked";
static var TEST_AD_FEED_URL = "http://www.ngads.com/adtest.php";
static var _dispatcher = new com.newgrounds.APIEventDispatcher();
static var _connection = new com.newgrounds.APIConnection();
static var _debugMode = DEBUG_MODE_LOGGED_IN;
static var _adsApproved = false;
static var _medals = new Object();
static var _medalsArray = [];
static var _scoreBoards = new Object();
static var _scoreBoardsArray = [];
static var _saveGroups = new Object();
static var _saveGroupsArray = [];
static var _sharedObjects = new Object();
}
Symbol 1133 MovieClip [__Packages.com.newgrounds.encoders.ImageScanner] Frame 0
class com.newgrounds.encoders.ImageScanner
{
var _baseN, _encodeAlpha, _maxPerChannel;
function ImageScanner (hashLength, charsPerPixel) {
if (hashLength) {
_hash = DEFAULT_HASH.substr(0, hashLength);
}
_baseN = new com.newgrounds.encoders.BaseN(_hash);
if (charsPerPixel) {
_charsPerPixel = charsPerPixel;
}
encodeAlpha = (false);
}
function get encodeAlpha() {
return(_encodeAlpha);
}
function set encodeAlpha(v) {
_encodeAlpha = v;
_maxPerChannel = int(Math.pow(_hash.length, _charsPerPixel / (_encodeAlpha ? 4 : 3)));
if (_maxPerChannel > 256) {
_maxPerChannel = 256;
}
//return(encodeAlpha);
}
function encode(source, callbackFunction, callbackObject) {
var _local4 = {callbackFunction:callbackFunction, callbackObject:callbackObject, source:source, x:0, y:0, output:null};
var _local2 = source.width.toString();
var _local3 = source.height.toString();
while (_local2.length < 3) {
_local2 = "0" + _local2;
}
while (_local3.length < 3) {
_local3 = "0" + _local3;
}
_local4.output = _local2 + _local3;
var _local6 = setInterval(this, "doEncode", WORK_INTERVAL, _local4);
_local4.interval = _local6;
}
function decode(source, callbackFunction, callbackObject) {
var _local2 = {callbackFunction:callbackFunction, callbackObject:callbackObject, source:source, i:6, x:0, y:0, output:null};
var _local5 = int(source.substr(0, 3));
var _local6 = int(source.substr(3, 3));
_local2.output = new flash.display.BitmapData(_local5, _local6, _encodeAlpha);
var _local4 = setInterval(this, "doDecode", WORK_INTERVAL, _local2);
_local2.interval = _local4;
}
function doEncode(state) {
var _local3 = getTimer();
while ((state.y < state.source.height) && ((getTimer() - _local3) < WORK_INTERVAL)) {
state.output = state.output + encodePixel(state.source.getPixel32(state.x, state.y));
state.x++;
if (state.x == state.source.width) {
state.x = 0;
state.y++;
}
}
if (state.y == state.source.height) {
clearInterval(state.interval);
state.callbackFunction.call(state.callbackObject, state.output);
}
}
function doDecode(state) {
var _local4 = getTimer();
while ((state.y < state.output.height) && ((getTimer() - _local4) < WORK_INTERVAL)) {
var _local3 = decodePixel(state.source.substr(state.i, _charsPerPixel));
state.output.setPixel32(state.x, state.y, _local3);
state.i = state.i + _charsPerPixel;
state.x++;
if (state.x == state.output.width) {
state.x = 0;
state.y++;
}
}
if (state.y == state.output.height) {
clearInterval(state.interval);
state.callbackFunction.call(state.callbackObject, state.output);
}
}
function encodePixel(pixel) {
var _local3 = (pixel >> 24) & 255;
var _local4 = (pixel >> 16) & 255;
var _local5 = (pixel >> 8) & 255;
var _local2 = pixel & 255;
_local3 = int((_local3 / 256) * _maxPerChannel);
_local4 = int((_local4 / 256) * _maxPerChannel);
_local5 = int((_local5 / 256) * _maxPerChannel);
_local2 = int((_local2 / 256) * _maxPerChannel);
var _local7 = (((_local4 * _maxPerChannel) * _maxPerChannel) + (_local5 * _maxPerChannel)) + _local2;
if (_encodeAlpha) {
_local7 = _local7 + (((_local3 * _maxPerChannel) * _maxPerChannel) * _maxPerChannel);
}
return(_baseN.encodeUint(_local7, _charsPerPixel));
}
function decodePixel(encodedPixel) {
var _local3 = 255;
var _local5;
var _local6;
var _local4;
var _local7 = 0;
var _local2 = _baseN.decodeUint(encodedPixel);
_local4 = _local2 % _maxPerChannel;
_local2 = _local2 / int(_maxPerChannel);
_local6 = _local2 % _maxPerChannel;
_local2 = _local2 / int(_maxPerChannel);
_local5 = _local2 % _maxPerChannel;
_local2 = _local2 / int(_maxPerChannel);
if (_encodeAlpha) {
_local3 = _local2 % _maxPerChannel;
_local2 = _local2 / int(_maxPerChannel);
}
return((((_local3 << 24) | (_local5 << 16)) | (_local6 << 8)) | _local4);
}
static var DEFAULT_HASH = "0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ<>?:;-_=+()!&";
var _hash = DEFAULT_HASH;
var _charsPerPixel = 2;
static var WORK_INTERVAL = 33.3333333333333;
}
Symbol 1134 MovieClip [__Packages.com.newgrounds.SaveFile] Frame 0
class com.newgrounds.SaveFile extends com.newgrounds.APIEventDispatcher
{
static var _currentFile;
var _iconLoader, _group, _name, _description, _id, _data, _dataLoader, _fileSize, _readOnly, _draft, _authorId, _authorName, _views, _createdDate, _modifiedDate, dispatchEvent, _encodedIcon, _encodedData, _encoderQueue, _encoding, _dataLoaded, _encodingParent, _encodingProperty, _dataURL;
function SaveFile (group) {
super();
_iconLoader = new com.newgrounds.BitmapLoader(DEFAULT_ICON, null);
_group = group;
}
static function get currentFile() {
return(_currentFile);
}
static function fromObject(group, fileData) {
var _local4 = new com.newgrounds.SaveFile(group);
_local4._name = fileData.filename;
_local4._description = fileData.description;
_local4._id = fileData.save_id;
_local4._authorId = fileData.user_id;
_local4._authorName = fileData.user_name;
_local4._createdDate = fileData.created;
_local4._modifiedDate = fileData.last_update;
_local4._views = fileData.views;
if (fileData.thumb && (fileData.thumb != "")) {
_local4._iconLoader.__set__url(_imageFilePath + fileData.thumb);
}
_local4._dataURL = _saveFilePath + fileData.file;
_local4._fileSize = fileData.file_size;
_local4._approved = fileData.status != STATUS_UNAPPROVED;
_local4._readOnly = false;
_local4._public = (fileData.status != STATUS_PRIVATE) && (fileData.status != STATUS_UNAPPROVED);
for (var _local8 in fileData.keys) {
var _local6 = fileData.keys[_local8];
var _local2 = group.getKeyById(_local6.id);
if (_local2) {
_local4._keys[_local2.__get__name()] = _local2.validateValue(_local6.value);
}
}
for (var _local9 in fileData.ratings) {
var _local5 = fileData.ratings[_local9];
var _local3 = group.getRatingById(_local5.id);
if (_local3) {
_local4._ratings[_local3.__get__name()] = _local3.validateValue(_local5.score);
}
}
return(_local4);
}
function get group() {
return(_group);
}
function get name() {
return(_name);
}
function set name(val) {
_name = val;
//return(name);
}
function get description() {
return(_description);
}
function set description(val) {
_description = val;
//return(description);
}
function get id() {
return(_id);
}
function get data() {
return(_data);
}
function set data(val) {
_data = val;
//return(data);
}
function get bytesLoaded() {
if (_data) {
return(bytesTotal);
}
if (!_dataLoader) {
return(0);
}
return(_dataLoader.getBytesLoaded());
}
function get bytesTotal() {
return(_fileSize);
}
function get readOnly() {
return(_readOnly);
}
function get draft() {
return(_draft);
}
function set draft(v) {
_draft = v;
//return(draft);
}
function get authorId() {
return(_authorId);
}
function get authorName() {
return(_authorName);
}
function get keys() {
return(_keys);
}
function get ratings() {
return(_ratings);
}
function get views() {
return(_views);
}
function get createdDate() {
return(_createdDate);
}
function get updatedDate() {
return(_modifiedDate);
}
function toString() {
return("Save File: " + _name);
}
function get icon() {
return(_iconLoader.__get__bitmapData());
}
function set icon(v) {
createIcon(v);
//return(icon);
}
function get iconLoaded() {
return(_iconLoader.__get__loaded());
}
function createIcon(source) {
var _local9 = new flash.display.BitmapData(ICON_WIDTH, ICON_HEIGHT, false, 0);
var _local6;
var _local5;
var _local10 = 0;
var _local8 = 0;
if (source instanceof flash.display.BitmapData) {
_local6 = source.width;
_local5 = source.height;
} else if (source instanceof MovieClip) {
_local6 = source._width;
_local5 = source._height;
var _local7 = MovieClip(source).getBounds(source);
_local10 = _local7.xMin;
_local8 = _local7.yMin;
}
var _local3 = new flash.geom.Matrix();
var _local4;
_local4 = Math.min(ICON_WIDTH / _local6, ICON_HEIGHT / _local5);
_local3.translate(-_local10, -_local8);
_local3.scale(_local4, _local4);
_local3.translate((ICON_WIDTH - (_local6 * _local4)) / 2, (ICON_HEIGHT - (_local5 * _local4)) / 2);
_local9.draw(source, _local3);
_iconLoader.__set__bitmapData(_local9);
}
function attachIcon(parent) {
if (_iconLoader) {
return(_iconLoader.attachBitmap(parent));
}
com.newgrounds.Logger.logError("No icon available for this sumbission.");
return(null);
}
function save() {
if (!_group.__get__connection().__get__hasUserSession()) {
com.newgrounds.Logger.logError("The user must be logged-in to save a file.");
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_SAVED, null, com.newgrounds.APIEvent.ERROR_NOT_LOGGED_IN));
return(undefined);
}
com.newgrounds.BitmapLoader._cacheSeed++;
_currentFile = this;
if (iconLoaded) {
ICON_IMAGE_SCANNER.encode(icon, onIconEncoded, this);
} else {
encodeData(true);
}
}
function onIconEncoded(encodedIcon) {
_encodedIcon = encodedIcon;
encodeData(true);
}
function doSave() {
var _local4 = new com.newgrounds.APICommand("saveFile");
_local4.__get__secureParameters().group = _group.id;
_local4.__get__secureParameters().user_name = _group.__get__connection().username;
_local4.__get__secureParameters().filename = _name;
_local4.__get__secureParameters().description = _description;
if (_draft) {
_local4.__get__secureParameters().draft = true;
}
if (_id && (!_readOnly)) {
_local4.__get__secureParameters().overwrite = 1;
_local4.__get__secureParameters().save_id = _id;
}
var _local8 = [];
for (var _local9 in _keys) {
var _local2 = _group.getKey(_local9);
if (_local2) {
_local8.push({id:_local2.__get__id(), value:_local2.validateValue(_keys[_local9])});
} else {
com.newgrounds.Logger.logError(((("No key named \"" + _local9) + "\" in save group \"") + _group.__get__name()) + "\".");
}
}
_local4.__get__secureParameters().keys = _local8;
var _local7 = [];
for (var _local10 in _ratings) {
var _local3 = _group.getRating(_local10);
if (_local3) {
_local7.push({id:_local3.__get__id(), value:_local3.validateValue(_ratings[_local10])});
} else {
com.newgrounds.Logger.logError(((("No rating named \"" + _local10) + "\" in save group \"") + _group.__get__name()) + "\".");
}
}
_local4.__get__secureParameters().ratings = _local7;
if (typeof(_encodedData) == "string") {
_local4.addFile("file", _encodedData, "file");
} else {
_local4.addFile("file", com.newgrounds.encoders.json.JSON.encode(_encodedData), "file");
}
if (iconLoaded) {
_local4.addFile("thumbnail", _encodedIcon, "thumbnail");
}
_local4.addEventListener(com.newgrounds.APIEvent.COMMAND_COMPLETE, {target:this, func:onSaveComplete});
_group.__get__connection().sendCommand(_local4);
}
function encodeData(encode) {
_encoderQueue = [];
_encoding = encode;
if (encode) {
_encodedData = _data;
preEncodeObject(this, "_encodedData");
} else {
preEncodeObject(this, "_data");
}
encodeObject();
}
function preEncodeObject(parent, property) {
var _local3 = parent[property];
var _local5;
try {
if (_encoding) {
_local5 = _local3 instanceof flash.display.BitmapData;
} else {
_local5 = _local3.type == "__bitmap";
}
} catch(error) {
}
var _local2 = _local3;
var _local8;
if (_local5) {
_encoderQueue.push({parent:parent, property:property});
} else if ((typeof(_local3) == "object") && (!_local8)) {
if (_encoding) {
if (_local3 instanceof Array) {
_local2 = [];
} else {
_local2 = {};
}
for (var _local4 in _local3) {
_local2[_local4] = _local3[_local4];
}
parent[property] = _local2;
}
for (var _local4 in _local2) {
preEncodeObject(_local2, _local4);
}
}
}
function encodeObject() {
if (!_encoderQueue.length) {
if (_encoding) {
doSave();
} else {
_dataLoaded = true;
checkLoadComplete();
}
return(undefined);
}
var _local6 = _encoderQueue.pop();
var _local4 = _local6.parent;
var _local3 = _local6.property;
var _local2 = _local4[_local3];
var _local5;
if (_encoding) {
_local5 = {type:"__bitmap", width:_local2.width, height:_local2.height, transparent:_local2.transparent};
_local4[_local3] = _local5;
_encodingParent = _local5;
_encodingProperty = "data";
DATA_IMAGE_SCANNER.__set__encodeAlpha(_local2.transparent);
DATA_IMAGE_SCANNER.encode(flash.display.BitmapData(_local2), encodeBitmapComplete, this);
} else {
_encodingParent = _local4;
_encodingProperty = _local3;
DATA_IMAGE_SCANNER.__set__encodeAlpha(_local2.transparent);
DATA_IMAGE_SCANNER.decode(String(_local2.data), encodeBitmapComplete, this);
}
}
function encodeBitmapComplete(data) {
_encodingParent[_encodingProperty] = data;
encodeObject();
}
function load() {
_currentFile = this;
_dataLoaded = false;
_data = null;
if (!iconLoaded) {
_iconLoader.addEventListener(com.newgrounds.APIEvent.ICON_LOADED, {target:this, func:onIconLoaded});
_iconLoader.load();
}
_dataLoader = new LoadVars();
var file = this;
_dataLoader.onData = function (data) {
file.onDataLoaded(data);
};
_dataLoader.load(_dataURL);
}
function onIconLoaded(event) {
if ((!event.__get__success()) && (_iconLoader.__get__url())) {
com.newgrounds.Logger.logWarning("Unable to load the icon for this save file.");
}
_iconLoader.removeEventListener(com.newgrounds.APIEvent.ICON_LOADED, onIconLoaded);
checkLoadComplete();
}
function checkLoadComplete() {
if (_dataLoaded && (iconLoaded)) {
com.newgrounds.Logger.logMessage("Data loaded.");
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_LOADED, this));
}
}
function onDataLoaded(data) {
try {
if (data) {
if (data.charAt(0) == "{") {
_data = com.newgrounds.encoders.json.JSON.decode(String(data));
} else {
_data = String(data);
}
encodeData(false);
}
} catch(error:Error) {
com.newgrounds.Logger.logError("Error while loading data:", error);
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_LOADED, this, com.newgrounds.APIEvent.ERROR_BAD_FILE));
}
}
function onDataError(error) {
com.newgrounds.Logger.logError("Unable to load data:", error);
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_LOADED, this, com.newgrounds.APIEvent.ERROR_BAD_FILE));
}
function onSaveComplete(event) {
if (event.__get__success()) {
com.newgrounds.Logger.logMessage(("File \"" + _name) + "\" saved!");
if (event.__get__data()) {
_id = event.__get__data().save_id;
_dataURL = unescape(event.__get__data().file_url);
}
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_SAVED, this));
} else {
com.newgrounds.Logger.logError(("Error saving file \"" + _name) + "\":", event.__get__error());
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_SAVED, this, event.__get__error()));
}
}
function sendVote(ratingName, vote) {
var _local2 = _group.getRating(ratingName);
if (!_local2) {
com.newgrounds.Logger.logError(("No save rating named \"" + ratingName) + "\" exists for this save group.");
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.VOTE_COMPLETE, {}, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT));
return(undefined);
}
vote = _local2.validateValue(vote);
if (isNaN(vote)) {
com.newgrounds.Logger.logError(((((((("Invalid vote (" + vote) + "). ") + ratingName) + " allows a range of ") + _local2.__get__minimum()) + "-") + _local2.__get__maximum()) + ".");
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.VOTE_COMPLETE, {}, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT));
return(undefined);
}
com.newgrounds.Logger.logMessage(((((("Voting " + vote) + " for ") + ratingName) + " on ") + _name) + "...");
_group.__get__connection().sendSimpleCommand("rateSaveFile", {target:this, func:onVoteComplete}, null, {group:_group.__get__id(), save_id:_id, rating_id:_local2.__get__id(), vote:vote});
}
function onVoteComplete(event) {
var _local2 = event.__get__error();
if (event.__get__data().already_voted) {
com.newgrounds.Logger.logError("Vote failed. You've already voted on this rating today.");
_local2 = com.newgrounds.APIEvent.ERROR_ALREADY_VOTED;
}
if (_local2 == com.newgrounds.APIEvent.ERROR_NONE) {
var _local3 = _group.getRatingById(event.__get__data().rating_id);
if (_local3) {
_ratings[_local3.__get__name()] = _local3.validateValue(event.__get__data().score);
}
}
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.VOTE_COMPLETE, this, _local2));
}
function clone() {
var _local3 = new com.newgrounds.SaveFile(_group);
_local3._data = _data;
_local3._description = _description;
_local3._draft = _draft;
_local3._fileSize = _fileSize;
_local3._iconLoader.__set__bitmapData(_iconLoader.bitmapData);
var _local2;
for (_local2 in _keys) {
_local3._keys[_local2] = _keys[_local2];
}
for (_local2 in _ratings) {
_local3._ratings[_local2] = _ratings[_local2];
}
_local3._name = _name;
return(_local3);
}
static var ICON_WIDTH = 90;
static var ICON_HEIGHT = 90;
static var DEFAULT_ICON = flash.display.BitmapData.loadBitmap("DefaultSaveIcon");
static var STATUS_PRIVATE = 0;
static var STATUS_SHARED = 1;
static var STATUS_UNAPPROVED = 2;
static var STATUS_APPROVED = 3;
static var _imageFilePath = "";
static var _saveFilePath = "";
static var ICON_IMAGE_SCANNER = new com.newgrounds.encoders.ImageScanner();
static var DATA_IMAGE_SCANNER = new com.newgrounds.encoders.ImageScanner(64, 6);
var _keys = new Object();
var _ratings = new Object();
}
Symbol 1132 MovieClip [__Packages.com.newgrounds.SaveGroup] Frame 0
class com.newgrounds.SaveGroup
{
var _connection, _id, _name, _type, _keysArray, _ratingsArray, _keys, _ratings;
function SaveGroup (connection, name, id, type, keys, ratings) {
_connection = connection;
_id = id;
_name = name;
_type = type;
_keysArray = keys;
_ratingsArray = ratings;
_keys = new Object();
_ratings = new Object();
var _local11;
for (var _local7 in keys) {
var _local2 = keys[_local7];
_keys[_local2.__get__name()] = _local2;
}
for (var _local6 in ratings) {
var _local3 = ratings[_local6];
_ratings[_local3.__get__name()] = _local3;
}
}
function get connection() {
return(_connection);
}
function get name() {
return(_name);
}
function get type() {
return(_type);
}
function get id() {
return(_id);
}
function get keys() {
return(_keysArray);
}
function get ratings() {
return(_ratingsArray);
}
function getKey(name) {
return(_keys[name]);
}
function getRating(name) {
return(_ratings[name]);
}
function getKeyById(id) {
for (var _local4 in _keys) {
var _local2 = _keys[_local4];
if (_local2.__get__id() == id) {
return(_local2);
}
}
return(null);
}
function getRatingById(id) {
for (var _local4 in _ratings) {
var _local2 = _ratings[_local4];
if (_local2.__get__id() == id) {
return(_local2);
}
}
return(null);
}
function toString() {
return((((("SaveGroup: " + name) + " Keys: ") + _keysArray) + " Ratings: ") + _ratingsArray);
}
static var TYPE_SYSTEM = 0;
static var TYPE_PRIVATE = 1;
static var TYPE_PUBLIC = 2;
static var TYPE_MODERATED = 3;
}
Symbol 1130 MovieClip [__Packages.com.newgrounds.SaveKey] Frame 0
class com.newgrounds.SaveKey
{
var _name, _id, _type;
function SaveKey (name, id, type) {
_name = name;
_id = id;
_type = type;
}
function get name() {
return(_name);
}
function get id() {
return(_id);
}
function get type() {
return(_type);
}
function validateValue(value) {
switch (_type) {
case TYPE_INTEGER :
value = Number(value);
if (!isNaN(value)) {
var _local3 = int(value);
if (_local3 != value) {
com.newgrounds.Logger.logWarning(((((("Float value " + value) + " given for integer key \"") + _name) + "\". Clamping to ") + _local3) + ".");
}
return(_local3);
}
break;
case TYPE_FLOAT :
value = Number(value);
if (!isNaN(value)) {
return(isNaN(Number(value)));
}
break;
case TYPE_BOOLEAN :
return(Boolean(value));
case TYPE_STRING :
return((value ? (value.toString()) : ""));
}
return(null);
}
function toString() {
return(_name);
}
static var TYPE_FLOAT = 1;
static var TYPE_INTEGER = 2;
static var TYPE_STRING = 3;
static var TYPE_BOOLEAN = 4;
}
Symbol 1131 MovieClip [__Packages.com.newgrounds.SaveRating] Frame 0
class com.newgrounds.SaveRating
{
var _name, _id, _isFloat, _minimum, _maximum;
function SaveRating (name, id, isFloat, minimum, maximum) {
_name = name;
_id = id;
_isFloat = isFloat;
_minimum = minimum;
_maximum = maximum;
}
function get name() {
return(_name);
}
function get id() {
return(_id);
}
function get isFloat() {
return(_isFloat);
}
function get minimum() {
return(_minimum);
}
function get maximum() {
return(_maximum);
}
function validateValue(value) {
var _local2 = Number(value);
if (isNaN(_local2)) {
com.newgrounds.Logger.logError(("Invalid value for rating \"" + _name) + "\".");
return(NaN);
}
if (_local2 < _minimum) {
com.newgrounds.Logger.logWarning(((((_local2 + " is out of acceptable range for rating \"") + _name) + "\". Clamping to ") + _minimum) + ".");
return(_minimum);
}
if (_local2 > _maximum) {
com.newgrounds.Logger.logWarning(((((_local2 + " is out of acceptable range for rating \"") + _name) + "\". Clamping to ") + _maximum) + ".");
return(_maximum);
}
if (!isFloat) {
var _local3 = int(_local2);
if (_local3 != _local2) {
com.newgrounds.Logger.logWarning(((((("Float value " + _local2) + " given for integer rating \"") + _name) + "\". Clamping to ") + _local3) + ".");
}
return(_local3);
}
return(_local2);
}
function toString() {
return(_name);
}
}
Symbol 1126 MovieClip [__Packages.com.newgrounds.BitmapLoader] Frame 0
class com.newgrounds.BitmapLoader extends com.newgrounds.APIEventDispatcher
{
var _bitmapData, _url, _loader, _loaderClip, dispatchEvent;
function BitmapLoader (defaultBitmap, url) {
super();
_bitmapData = defaultBitmap;
_url = url;
}
function get url() {
return(_url);
}
function set url(v) {
_loaded = false;
_url = v;
//return(url);
}
function get bitmapData() {
return(_bitmapData);
}
function set bitmapData(v) {
_bitmapData = v;
_loaded = true;
//return(bitmapData);
}
function get loaded() {
return(_loaded);
}
function disposeLoader() {
if (_loader) {
if (_loaderClip._parent == _root) {
_loader.unloadClip(_loaderClip.bitmap);
_loaderClip.removeMovieClip();
}
_loader = null;
_loaderClip = null;
}
}
function load() {
if ((!_url) || (_url == "")) {
onLoadComplete();
return(undefined);
}
_loaded = false;
if (_bitmapData) {
_bitmapData.dispose();
_bitmapData = null;
}
disposeLoader();
attachBitmap(null);
}
function attachBitmap(parent) {
if (!parent) {
parent = _root;
}
var _local5 = parent.getNextHighestDepth();
var _local3 = parent.createEmptyMovieClip("__bitmap" + _local5, _local5);
if (((!_loaded) && (_url)) && (_url != "")) {
_local3.createEmptyMovieClip("bitmap", 0);
_loader = new MovieClipLoader();
_loaderClip = _local3;
if (parent == _root) {
_loaderClip._visible = false;
}
var thisObj = this;
_loaderClip.onEnterFrame = function () {
thisObj.pollLoad();
};
_loader.addListener({onLoadError:function () {
thisObj.onLoadComplete();
}});
_loader.loadClip(_url, _local3.bitmap);
} else {
_local3.attachBitmap(_bitmapData, 0);
}
return(_local3);
}
function pollLoad() {
if (_loaderClip._width) {
onLoadComplete();
}
}
function onLoadComplete() {
var _local2;
if ((_loader && (_loaderClip)) && (_loaderClip._width)) {
try {
_loaderClip.onEnterFrame = null;
_local2 = new flash.display.BitmapData(_loaderClip._width, _loaderClip._height, true, 0);
_local2.draw(_loaderClip);
_bitmapData = _local2;
_loaded = true;
} catch(error) {
if (_local2) {
_local2.dispose();
}
}
}
disposeLoader();
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.ICON_LOADED, this, (_loaded ? null : (com.newgrounds.APIEvent.ERROR_BAD_FILE))));
}
static var _cacheSeed = 0;
var _loaded = true;
}
Symbol 1135 MovieClip [__Packages.com.newgrounds.SaveQuery] Frame 0
class com.newgrounds.SaveQuery extends com.newgrounds.APIEventDispatcher
{
var _group, _connection, dispatchEvent;
function SaveQuery (group) {
super();
_group = group;
_connection = group.connection;
includeAllFields();
}
function get group() {
return(_group);
}
function get resultsPerPage() {
return(_resultsPerPage);
}
function set resultsPerPage(val) {
_resultsPerPage = Math.min(Math.max(val, 1), 100);
//return(resultsPerPage);
}
function get page() {
return(_page);
}
function set page(val) {
_page = Math.max(val, 1);
//return(page);
}
function prevPage() {
page = ((page-1));
}
function nextPage() {
page = ((page+1));
}
function get isRandomized() {
return(_isRandomized);
}
function set isRandomized(val) {
_isRandomized = val;
//return(isRandomized);
}
function get files() {
return(_files);
}
function reset() {
_page = 1;
_resultsPerPage = 10;
_isRandomized = false;
_lookupKeys = [];
_lookupRatings = [];
_fileConditions = [];
_keyConditions = [];
_ratingConditions = [];
_files = [];
includeAllFields();
}
function clone() {
var _local2 = new com.newgrounds.SaveQuery(_group);
_local2._page = _page;
_local2._resultsPerPage = _resultsPerPage;
_local2._isRandomized = _isRandomized;
_local2._lookupKeys = _lookupKeys.concat();
_local2._lookupRatings = _lookupRatings.concat();
_local2._fileConditions = _fileConditions.concat();
_local2._keyConditions = _keyConditions.concat();
_local2._ratingConditions = _ratingConditions.concat();
return(_local2);
}
function includeAllFields() {
for (var _local5 in _group.__get__keys()) {
var _local2 = _group.__get__keys()[_local5];
_lookupKeys.push(_local2.__get__id());
}
for (var _local4 in _group.__get__ratings()) {
var _local3 = _group.__get__ratings()[_local4];
_lookupRatings.push(_local3.__get__id());
}
}
function addCondition(field, operator, value) {
var _local2;
_local2 = 0;
while (_local2 < FILE_FIELDS.length) {
if (FILE_FIELDS[_local2] == field) {
break;
}
_local2++;
}
if (_local2 == FILE_FIELDS.length) {
_local2 = -1;
}
if (_local2 >= 0) {
_fileConditions.push({field:_local2, operator:operator, value:value});
} else {
var _local3 = _group.getKey(field);
if (_local3) {
value = _local3.validateValue(value);
_keyConditions.push({key_id:_local3.__get__id(), operator:operator, value:value});
return(undefined);
}
var _local4 = field.split(".");
var _local6 = _group.getRating(_local4[0]);
if (_local6) {
value = _local6.validateValue(value);
_ratingConditions.push({rating_id:_local6.__get__id(), operator:operator, value:value, column:(_local4[1] ? (_local4[1]) : "score")});
return(undefined);
}
com.newgrounds.Logger.logError(((("The save group \"" + _group.__get__name()) + "\" does not have a field named \"") + field) + "\".");
}
}
function sortOn(field, sortDescending) {
if (sortDescending == undefined) {
sortDescending = false;
}
var _local2;
_local2 = 0;
while (_local2 < FILE_FIELDS.length) {
if (FILE_FIELDS[_local2] == field) {
break;
}
_local2++;
}
if (_local2 == FILE_FIELDS.length) {
_local2 = -1;
}
if (_local2 >= 0) {
_sortFields.push({table:TABLE_FILES, field:_local2, desc:sortDescending});
} else {
var _local5 = _group.getKey(field);
if (_local5) {
_sortFields.push({table:TABLE_KEYS, field:_local5.__get__id(), desc:sortDescending});
return(undefined);
}
var _local3 = field.split(".");
var _local6 = _group.getRating(_local3[0]);
if (_local6) {
_sortFields.push({table:TABLE_RATINGS, field:_local6.__get__id(), desc:sortDescending, extra:(_local3[1] ? (_local3[1]) : "score")});
return(undefined);
}
com.newgrounds.Logger.logError(((("The save group \"" + _group.__get__name()) + "\" does not have a field named \"") + field) + "\".");
}
}
function execute() {
var _local5 = {};
_local5.page = _page;
_local5.num_results = _resultsPerPage;
if (_isRandomized) {
_local5.randomize = 1;
}
if (_lookupKeys && (_lookupKeys.length)) {
_local5.lookup_keys = _lookupKeys;
}
if (_lookupRatings && (_lookupRatings.length)) {
_local5.lookup_ratings = _lookupRatings;
}
if (_fileConditions && (_fileConditions.length)) {
_local5.file_conditions = _fileConditions;
}
if (_keyConditions && (_keyConditions.length)) {
_local5.key_conditions = _keyConditions;
}
if (_ratingConditions && (_ratingConditions.length)) {
_local5.rating_conditions = _ratingConditions;
}
if (_sortFields && (_sortFields.length)) {
_local5.sort_conditions = _sortFields;
}
_connection.sendSimpleCommand("lookupSaveFiles", {target:this, func:onQueryComplete}, {publisher_id:_connection.publisherId, group_id:_group.__get__id(), query:_local5});
}
function onQueryComplete(event) {
if (event.__get__success()) {
var _local4 = event.__get__data();
_files = [];
if (_local4.files) {
var _local2 = 0;
while (_local2 < _local4.files.length) {
var _local3 = com.newgrounds.SaveFile.fromObject(_group, _local4.files[_local2]);
if (_local3) {
_files.push(_local3);
}
_local2++;
}
}
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.QUERY_COMPLETE, this));
} else {
com.newgrounds.Logger.logError("Query failed: " + event.__get__error());
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.QUERY_COMPLETE, this, event.__get__error()));
}
}
static var FILE_ID = "fileId";
static var AUTHOR_ID = "authorId";
static var AUTHOR_NAME = "authorName";
static var FILE_NAME = "fileName";
static var CREATED_ON = "createdOn";
static var UPDATED_ON = "updatedOn";
static var FILE_VIEWS = "fileViews";
static var FILE_STATUS = "fileStatus";
static var FILE_FIELDS = [FILE_ID, AUTHOR_ID, AUTHOR_NAME, FILE_NAME, CREATED_ON, UPDATED_ON, FILE_VIEWS, FILE_STATUS];
static var OPERATOR_EQUAL = "=";
static var OPERATOR_LESS_THAN = "<";
static var OPERATOR_GREATER_THAN = ">";
static var OPERATOR_NOT_EQUAL = "!=";
static var OPERATOR_LESS_OR_EQUAL = "<=";
static var OPERATOR_GREATER_OR_EQUAL = ">=";
static var OPERATOR_CONTAINS = "*";
static var OPERATOR_NOT_CONTAINS = "!*";
static var OPERATOR_NOT_BEGINS_WITH = "!*=";
static var OPERATOR_NOT_ENDS_WITH = "!=*";
static var OPERATOR_BEGINS_WITH = "*=";
static var OPERATOR_ENDS_WITH = "=*";
static var TABLE_FILES = 1;
static var TABLE_KEYS = 2;
static var TABLE_RATINGS = 3;
var _page = 1;
var _resultsPerPage = 10;
var _isRandomized = false;
var _files = [];
var _lookupKeys = [];
var _lookupRatings = [];
var _fileConditions = [];
var _keyConditions = [];
var _ratingConditions = [];
var _sortFields = [];
}
Symbol 1127 MovieClip [__Packages.com.newgrounds.Medal] Frame 0
class com.newgrounds.Medal extends com.newgrounds.APIEventDispatcher
{
var _connection, _id, _name, _unlocked, _value, _difficulty, _iconLoader, dispatchEvent;
function Medal (connection, id, name, unlocked, value, difficultyId, iconURL) {
super();
_connection = connection;
_id = id;
_name = name;
_unlocked = unlocked;
_value = value;
_difficulty = DIFFICULTIES[difficultyId];
_iconLoader = new com.newgrounds.BitmapLoader(DEFAULT_ICON, iconURL);
_iconLoader.load();
}
function get difficulty() {
return(_difficulty);
}
function get icon() {
return(_iconLoader.__get__bitmapData());
}
function get id() {
return(_id);
}
function get name() {
return(_name);
}
function get unlocked() {
return(_unlocked);
}
function get value() {
return(_value);
}
function toString() {
return((((((("Medal: " + _name) + "\t\t(") + (_unlocked ? "unlocked, " : "locked, ")) + _value) + "pts, ") + _difficulty) + ")");
}
function attachIcon(parent) {
return(_iconLoader.attachBitmap(parent));
}
function unlock() {
if ((!_connection.debug) && (_unlocked)) {
com.newgrounds.Logger.logWarning(("Medal \"" + _name) + "\" is already unlocked.");
return(undefined);
}
com.newgrounds.Logger.logMessage(("Unlocking medal \"" + name) + "\"...");
_unlocked = true;
_connection.sendSimpleCommand("unlockMedal", {target:this, func:onUnlockConfirmed}, null, {medal_id:id});
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.MEDAL_UNLOCKED, this));
}
function onUnlockConfirmed(event) {
if (event.__get__success()) {
com.newgrounds.Logger.logMessage(("Medal \"" + name) + "\" unlocked.");
} else {
com.newgrounds.Logger.logError(("Failed to unlock \"" + name) + "\"!");
}
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.MEDAL_UNLOCK_CONFIRMED, this, event.__get__error()));
}
static var ICON_WIDTH = 50;
static var ICON_HEIGHT = 50;
static var DEFAULT_ICON = flash.display.BitmapData.loadBitmap("DefaultMedalIcon");
static var DIFFICULTY_EASY = "Easy";
static var DIFFICULTY_MODERATE = "Moderate";
static var DIFFICULTY_CHALLENGING = "Challenging";
static var DIFFICULTY_DIFFICULT = "Difficult";
static var DIFFICULTY_BRUTAL = "Brutal";
static var DIFFICULTIES = ["Unknown", DIFFICULTY_EASY, DIFFICULTY_MODERATE, DIFFICULTY_CHALLENGING, DIFFICULTY_DIFFICULT, DIFFICULTY_BRUTAL];
}
Symbol 1129 MovieClip [__Packages.com.newgrounds.ScoreBoard] Frame 0
class com.newgrounds.ScoreBoard extends com.newgrounds.APIEventDispatcher
{
var _connection, _name, _id, _scores, _tag, dispatchEvent;
function ScoreBoard (connection, name, id) {
super();
_connection = connection;
_name = name;
_id = id;
}
function get name() {
return(_name);
}
function get scores() {
return(_scores);
}
function get period() {
return(_period);
}
function set period(val) {
_period = val;
//return(period);
}
function get firstResult() {
return(_firstResult);
}
function set firstResult(val) {
_firstResult = Math.max(1, val);
//return(firstResult);
}
function get numResults() {
return(_numResults);
}
function set numResults(val) {
_numResults = val;
//return(numResults);
}
function get tag() {
return(_tag);
}
function set tag(val) {
_tag = val;
//return(tag);
}
function get page() {
return(Math.ceil((_firstResult - 1) / _numResults) + 1);
}
function prevPage() {
if (firstResult > _numResults) {
firstResult = firstResult - _numResults;
}
}
function nextPage() {
firstResult = firstResult + _numResults;
}
function loadScores() {
_connection.sendSimpleCommand("loadScores", {target:this, func:onScoresLoaded}, {publisher_id:_connection.publisherId, board:_id, page:((_firstResult - 1) / _numResults) + 1, num_results:_numResults, period:_period, tag:_tag});
}
function postScore(numericScore, tag) {
if (tag == undefined) {
tag = null;
}
if (isNaN(numericScore)) {
com.newgrounds.Logger.logError("Cannot post invalid score: " + numericScore);
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.SCORE_POSTED, null, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT));
return(undefined);
}
com.newgrounds.Logger.logMessage(((((("Posting a score of " + numericScore) + " by ") + _connection.username) + " to scoreboard \"") + _name) + "\"...");
_connection.sendSimpleCommand("postScore", {target:this, func:onScorePosted}, null, {user_name:_connection.username, board:_id, value:numericScore, tag:tag});
}
function onScoresLoaded(event) {
var _local4 = event.__get__data();
_scores = [];
var _local5;
if (_local4.first_result) {
_local5 = _local4.first_result;
} else {
_local5 = _firstResult;
}
if (_local4.scores) {
var _local3 = 0;
while (_local3 < _local4.scores.length) {
var _local2 = _local4.scores[_local3];
if (_local2) {
_scores[_local3] = new com.newgrounds.Score(_local5, _local2.username, _local2.value, _local2.numeric_value, _local2.tag);
}
_local3++;
_local5++;
}
}
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.SCORES_LOADED, this));
}
function onScorePosted(event) {
if (event.__get__success()) {
com.newgrounds.Logger.logMessage("Score posted!");
var _local4 = event.__get__data();
var _local2 = {};
_local2.score = _local4.value;
_local2.scoreBoard = this;
} else {
com.newgrounds.Logger.logError("Error posting score: " + event.__get__error());
}
dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.SCORE_POSTED, _local2, event.__get__error()));
}
function toString() {
return("Scoreboard: " + _name);
}
static var TODAY = "Today";
static var THIS_WEEK = "This Week";
static var THIS_MONTH = "This Month";
static var THIS_YEAR = "This Year";
static var ALL_TIME = "All-Time";
var _period = ALL_TIME;
var _firstResult = 1;
var _numResults = 10;
}
Symbol 1118 MovieClip [__Packages.com.newgrounds.Logger] Frame 0
class com.newgrounds.Logger
{
function Logger () {
}
static function logInternal() {
var _local2 = arguments;
log(PRIORITY_INTERNAL, _local2);
}
static function logMessage() {
var _local2 = arguments;
log(PRIORITY_MESSAGE, _local2);
}
static function logWarning() {
var _local2 = arguments;
log(PRIORITY_WARNING, _local2);
}
static function logError() {
var _local2 = arguments;
log(PRIORITY_ERROR, _local2);
}
static function log(priority, messages) {
if (priority == undefined) {
priority = PRIORITY_MESSAGE;
}
if (messages == undefined) {
messages = null;
}
if (priority >= _messageLevel) {
var _local1 = 0;
while (_local1 < messages.length) {
trace(HEADER + messages[_local1]);
_eventDispatcher.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.LOG, messages[_local1]));
_local1++;
}
}
if (priority >= _throwLevel) {
throw new Error(messages.join(newline));
}
}
static function addEventListener(event, listener) {
_eventDispatcher.addEventListener(event, listener, false, 0, false);
}
static var PRIORITY_INTERNAL = 0;
static var PRIORITY_MESSAGE = 1;
static var PRIORITY_WARNING = 2;
static var PRIORITY_ERROR = 3;
static var PRIORITY_MAX = 4;
static var HEADER = "[Newgrounds API] :: ";
static var _eventDispatcher = new com.newgrounds.EventDispatcher();
static var _messageLevel = PRIORITY_MESSAGE;
static var _throwLevel = PRIORITY_MAX;
}
Symbol 1358 MovieClip [__Packages.MadnessDebris] Frame 0
class MadnessDebris extends MovieClip
{
var onEnterFrame, _visible, _parent, _name, swapDepths, gotoAndStop, mySprite, myHit, _currentframe, removeMovieClip;
function MadnessDebris () {
super();
onEnterFrame = tick;
}
function init(inType, inDanger, inTrack, inEndpoint, inSpeed) {
myDanger = inDanger;
myType = inType;
track_pos = inTrack;
my_endpoint = inEndpoint;
my_speed = inSpeed;
_visible = false;
_root.object_scale_finder(this);
myState = "inactive";
if (((((((((((((((((myType == "powerup_chute") || (myType == "auto")) || (myType == "shotgun")) || (myType == "grenade")) || (myType == "health")) || (myType == "invincible")) || (myType == "rock")) || (myType == "rock")) || (myType == "cone")) || (myType == "roadblock")) || (myType == "barrel")) || (myType == "agent_truck")) || (myType == "zombie")) || (myType == "zombie_fall")) || (myType == "agent")) || (myType == "soldier")) || (myType == "chute")) {
depthValid = true;
} else {
depthValid = false;
}
if ((_parent._name == "world_mc") && (depthValid)) {
debrisAll.push(this);
}
if (myType == "zombie") {
zombiesAll.push(this);
}
if ((myType == "cliff") || (myType == "mountain")) {
if (_parent[myType + "Count"] == undefined) {
_parent[myType + "Count"] = 0;
}
_name = myType + _parent[myType + "Count"];
var _local3 = _parent[myType + "Count"] - 100;
while (_parent[myType + String(_local3)] != this) {
if (_parent[myType + String(_local3)] != undefined) {
swapDepths(_parent[myType + String(_local3)]);
}
_local3++;
}
_parent[myType + "Count"]++;
}
if (inType == "barrel") {
myDamage = 3;
myExplosion = "explosion";
totalExplosions = 1;
} else if (inType == "rock") {
myDamage = 4;
myExplosion = "rock_part";
totalExplosions = 5;
} else if (inType == "roadblock") {
myDamage = 2;
myExplosion = "roadblock_part";
totalExplosions = 5;
} else if (inType == "cone") {
myDamage = 0;
myExplosion = "cone_part";
totalExplosions = 1;
} else if (inType == "zombie") {
myDamage = 0;
myExplosion = "zombie_part";
totalExplosions = 6;
}
if (myType.substr(0, 7) == "powerup") {
myPowerup = myType.substr(8);
myType = "powerup_chute";
}
gotoAndStop(myType);
}
function tick() {
if (myType == "powerup_chute") {
if ((mySprite._currentframe == 1) && (track_pos < (_parent.hunter.track_pos + 700))) {
mySprite.gotoAndPlay(2);
}
my_speed = _parent.hunter.my_relative_speed * 0.6;
}
if (((((myType == "auto") || (myType == "shotgun")) || (myType == "grenade")) || (myType == "invincible")) || (myType == "health")) {
my_speed = _parent.hunter.my_relative_speed * 0.6;
if (myHit.hitTest(_parent.hunter.myHit)) {
if (myType == "health") {
_parent.hunter.myHealth = _parent.hunter.myHealth + 10;
if (_parent.hunter.myHealth > _parent.hunter.myHealthMax) {
_parent.hunter.myHealth = _parent.hunter.myHealthMax;
}
}
if ((((myType == "auto") || (myType == "shotgun")) || (myType == "grenade")) || (myType == "invincible")) {
_parent.hunter.equipGun(myType);
}
if (myType == "invincible") {
_parent.hunter.invincibleTimer = 240;
}
var _local3 = 0;
while (_local3 < 20) {
_parent.makeDebris("power_part", false, track_pos + 12, my_endpoint, _parent.hunter.my_relative_speed * (SwainMath.randomNumber(110, 130) / 100));
_local3++;
}
_parent.hunter.myPickup.myPowerup = myType;
_parent.hunter.myPickup.gotoAndPlay(2);
if ((myType == "health") || (myType == "invincible")) {
_root.playAudio("powerup_health", "sound_cars");
} else {
_root.playAudio("powerup_gun", "sound_cars");
}
killMe();
}
}
if ((((myType == "rock") || (myType == "roadblock")) || (myType == "zombie")) && (MadnessBadguy.currentTruck != undefined)) {
if ((((track_pos < (MadnessBadguy.currentTruck.track_pos + 200)) && (MadnessBadguy.currentTruck.track_pos < (_parent.hunter.track_pos + 900))) && (my_endpoint < ((MadnessBadguy.currentTruck.my_endpoint + MadnessBadguy.currentTruck.myGirth) + 90))) && (my_endpoint > ((MadnessBadguy.currentTruck.my_endpoint - MadnessBadguy.currentTruck.myGirth) - 90))) {
var _local3 = 0;
while (_local3 < totalExplosions) {
_parent.debrisContainer.makeDebris(myExplosion, false, track_pos + 8, my_endpoint, MadnessBadguy.currentTruck.my_speed * (SwainMath.randomNumber(70, 90) / 100));
_local3++;
}
_root.playAudio(myType + "hit", "sound_impacts");
killMe();
}
}
if ((((myType == "barrel") || (myType == "rock")) || (myType == "roadblock")) || (myType == "cone")) {
if (_currentframe > 4) {
my_speed = my_speed * 0.97;
if (track_pos < (_parent.hunter.track_pos + 40)) {
if (myHit.hitTest(_parent.hunter.myHit)) {
_parent.hunter.myBumpY = 15;
if (_root.shake_camera < 10) {
_root.shake_camera = 10;
}
if ((_parent.hunter.invincibleTimer <= 0) && (!_parent.wavePause)) {
_parent.hunter.myHealth = _parent.hunter.myHealth - myDamage;
if (myDamage > 0) {
_parent.hunter.colorTimer = 0;
}
}
if (myType == "barrel") {
_parent.makeDebris("explosion", false, _parent.hunter.track_pos + 8, my_endpoint, _parent.hunter.my_relative_speed * 0.9);
} else {
var _local3 = 0;
while (_local3 < totalExplosions) {
_parent.debrisContainer.makeDebris(myExplosion, false, track_pos + 8, my_endpoint, _parent.hunter.my_relative_speed * (SwainMath.randomNumber(100, 130) / 100));
_local3++;
}
}
_root.playAudio(myType + "hit", "sound_impacts");
killMe();
}
}
}
}
if (myType == "agent_truck") {
if (my_speed > 10) {
my_speed = my_speed - 0.1;
}
if (((my_endpoint < (_parent.hunter.my_endpoint + 50)) && (my_endpoint > (_parent.hunter.my_endpoint - 50))) && (track_pos < (_parent.hunter.track_pos + 3))) {
track_pos = _parent.hunter.track_pos;
}
if (_currentframe > 8) {
if (myHit.hitTest(_parent.hunter.myHit)) {
if (my_endpoint < _parent.hunter.my_endpoint) {
if ((_parent.hunter.grabberLeftHealth <= 0) && (_parent.hunter.invincibleTimer <= 0)) {
_parent.hunter.grabberLeftHealth = 50;
if (_root.shakeDisplay == undefined) {
_root.createDisplay("shake");
}
_root.playAudio("hit3", "sound_impacts");
} else {
_parent.makeDebris("agent", false, track_pos, my_endpoint - 10, _parent.hunter.my_relative_speed * 1.1);
if (_parent.hunter.invincibleTimer <= 0) {
_parent.hunter.myHealth = _parent.hunter.myHealth - 3;
_parent.hunter.colorTimer = 0;
}
_root.playAudio("hit3", "sound_impacts");
}
} else if ((_parent.hunter.grabberRightHealth <= 0) && (_parent.hunter.invincibleTimer <= 0)) {
_parent.hunter.grabberRightHealth = 50;
if (_root.shakeDisplay == undefined) {
_root.createDisplay("shake");
}
_root.playAudio("hit3", "sound_impacts");
} else {
_parent.makeDebris("agent", false, track_pos, my_endpoint + 10, _parent.hunter.my_relative_speed * 1.1);
if (_parent.hunter.invincibleTimer <= 0) {
_parent.hunter.myHealth = _parent.hunter.myHealth - 3;
_parent.hunter.colorTimer = 0;
}
_root.playAudio("hit3", "sound_impacts");
}
killMe();
}
}
}
if (myType == "zombie") {
if ((myState == "inactive") && (track_pos < ((_parent.hunter.track_pos + 200) + (_parent.hunter.my_relative_speed * 10)))) {
mySprite.gotoAndPlay(2);
myState = "spawn";
}
if (myState == "active") {
if (my_endpoint < (_parent.hunter.my_endpoint - 30)) {
my_endpoint = my_endpoint + 5;
}
if (my_endpoint > (_parent.hunter.my_endpoint + 30)) {
my_endpoint = my_endpoint - 5;
}
if ((track_pos < (_parent.hunter.track_pos + 100)) && (track_pos > _parent.hunter.track_pos)) {
my_speed = my_speed + ((_parent.hunter.my_relative_speed - my_speed) / 10);
}
if ((((track_pos < ((_parent.hunter.track_pos + 2) - (45 * _parent.hunter.positionOFFSET))) && (track_pos > ((_parent.hunter.track_pos - 15) - (30 * _parent.hunter.positionOFFSET)))) && (my_endpoint > ((_parent.hunter.my_endpoint - _parent.hunter.myGirth) + 13))) && (my_endpoint < ((_parent.hunter.my_endpoint + _parent.hunter.myGirth) + 25))) {
if ((((_parent.hunter.invincibleTimer > 0) || (my_endpoint < ((_parent.hunter.my_endpoint - (_parent.hunter.myGirth * 0.5)) + 45))) || (my_endpoint > ((_parent.hunter.my_endpoint + (_parent.hunter.myGirth * 0.5)) + 10))) || (_parent.hunter.grabberFrontHealth > 0)) {
_parent.makeDebris("zombie_fall", false, track_pos, my_endpoint, _parent.hunter.my_relative_speed * 1.5);
_parent.hunter.activateImpact("spray");
_parent.hunter.bloodLevelB = 120;
_parent.hunter.myBumpY = 15;
} else {
_parent.hunter.grabberFrontHealth = 60;
if (_root.shake2Display == undefined) {
_root.createDisplay("shake2");
}
}
if (_root.shake_camera < 6) {
_root.shake_camera = 6;
}
_parent.hunter.zombieKills++;
_root.playAudio("hit3", "sound_impacts");
killMe();
}
}
if (_parent.hunter.gameOverSpeed < 1) {
my_speed = my_speed * 0.8;
}
}
track_pos = track_pos + my_speed;
_root.move_object(this);
if (_parent._name == "world_mc") {
if (depthValid) {
_parent.adjustDepth(this);
}
}
if (track_pos < (_parent.hunter.track_pos - 150)) {
killMe();
}
}
function killMe() {
var _local3 = new Array();
_local3 = debrisAll;
var _local4 = 0;
while (_local4 < _local3.length) {
if (_local3[_local4] == undefined) {
_local3.splice(_local4, 1);
}
if (_local3[_local4] == this) {
_local3.splice(_local4, 1);
break;
}
_local4++;
}
if (myType == "zombie") {
_local3 = zombiesAll;
_local4 = 0;
while (_local4 < _local3.length) {
if (_local3[_local4] == undefined) {
_local3.splice(_local4, 1);
}
if (_local3[_local4] == this) {
_local3.splice(_local4, 1);
break;
}
_local4++;
}
if ((zombiesAll.length == 0) && (_parent.hunter.zombieKills == 0)) {
_root.unlockMedal("Atheist");
}
}
removeMovieClip();
}
static var debrisAll = new Array();
static var zombiesAll = new Array();
var myDanger = new Boolean();
var myType = new String();
var my_speed = new Number();
var permanant = false;
var track_pos = new Number();
var my_endpoint = new Number();
var myState = new String();
var depthValid = new Boolean();
var myExplosion = new String();
var totalExplosions = new Number();
var myDamage = new Number();
var myPowerup = new String();
}
Symbol 1359 MovieClip [__Packages.MadnessBadguy] Frame 0
class MadnessBadguy extends MovieClip
{
static var currentJesus, currentTruck, currentCiv;
var onEnterFrame, myColor, _visible, gotoAndStop, _name, _parent, mySprite, mySmoke, _x, _y, myHit, inRange, myMissionTEXT, removeMovieClip;
function MadnessBadguy () {
super();
hunter = _root.world_mc.hunter;
speed_mod = (Math.floor(SwainMath.randomNumber(1, 5)) / 6) * 3;
y_plane = _root.world_mc.y_plane._y;
left_limit = _root.world_mc.x_min._x;
right_limit = _root.world_mc.x_max._x;
path_width = right_limit - left_limit;
onEnterFrame = tick;
}
function init(inType, inChar, inStart) {
myColor = new Color(this);
colorTimer = 999;
_visible = false;
myType = inType;
myChar = inChar;
carLocked = false;
track_pos = hunter.track_pos + inStart;
if (myType == "aim") {
gotoAndStop(myType);
myMission = "aim";
my_accel = 0;
my_speed = 0;
myHealth = 1000000 /* 0x0F4240 */;
_name = "playerAim";
_visible = false;
}
if (myType == "chute") {
gotoAndStop(myType);
myHealth = 99999 /* 0x01869F */;
my_speed = hunter.my_relative_speed / 2;
my_topspeed = 25;
my_accel = 0.04;
myGirth = 10;
dodgeSkill = 0.1;
maxDodge = 3;
my_endpoint = SwainMath.randomNumber(_parent.leftBorder + 20, _parent.rightBorder);
targetTrackPos = SwainMath.randomNumber(200, 400);
targetEndpoint = my_endpoint;
myMission = "float";
jumpDifficulty = 20;
balanceDifficulty = 15;
shootDifficulty = 35;
shootingTime = 20;
myRange = 200;
sidleDifficulty = 150;
dustFrequency = 3;
permanant = false;
allChutes.push(this);
}
if (myType == "jesus") {
if (currentJesus != undefined) {
currentJesus.killMe("none");
}
currentJesus = this;
gotoAndStop(myType);
myHealth = 1E18;
my_speed = hunter.my_relative_speed;
my_topspeed = 50;
my_accel = 0.1;
myGirth = 10;
dodgeSkill = 0.1;
maxDodge = 3;
my_endpoint = SwainMath.randomNumber(-100, 100);
targetTrackPos = SwainMath.randomNumber(200, 400);
targetEndpoint = my_endpoint;
myMission = "summon";
jumpDifficulty = 20;
balanceDifficulty = 15;
shootDifficulty = 60;
shootingTime = 90;
myRange = 200;
sidleDifficulty = 150;
dustFrequency = 3;
}
if (myType == "truck") {
if (currentTruck != undefined) {
currentTruck.killMe("none");
}
currentTruck = this;
myChar = "none";
gotoAndStop(myType);
myHealth = 1000 + (_root.currentWave * 100);
my_speed = hunter.my_relative_speed;
my_topspeed = 25;
my_accel = 0.05;
myGirth = 230;
dodgeSkill = 0.1;
maxDodge = 3;
my_endpoint = SwainMath.randomNumber(_parent.leftBorder + 20, _parent.rightBorder);
targetTrackPos = SwainMath.randomNumber(200, 400);
targetEndpoint = my_endpoint;
myMission = "outrun";
jumpDifficulty = 20;
balanceDifficulty = 15;
shootDifficulty = 120;
shootingTime = 240;
myRange = 300;
sidleDifficulty = 150;
dustFrequency = 3;
doorStatus = "closed";
}
if (myType == "bike") {
gotoAndStop((myType + "_") + myChar);
if (myChar == "agent") {
_root.playAudio("spawn", "sound_cars");
myHealth = 60;
my_speed = hunter.my_relative_speed;
my_topspeed = 25;
my_accel = 0.15;
myGirth = 10;
dodgeSkill = 0.1;
maxDodge = 3;
allBikes.push(this);
myMission = "spawn";
} else if (myChar == "soldier") {
_root.playAudio("spawn", "sound_cars");
myHealth = 120;
my_speed = hunter.my_relative_speed;
my_topspeed = 35;
my_accel = 0.17;
myGirth = 10;
dodgeSkill = 0.15;
maxDodge = 4;
allBikes.push(this);
myMission = "spawn";
} else if (myChar == "civ") {
myHealth = 30;
my_speed = 10;
my_topspeed = 10;
my_accel = 0.1;
myGirth = 10;
dodgeSkill = 0.1;
maxDodge = 2;
currentCiv = this;
myMission = "meander";
}
my_endpoint = SwainMath.randomNumber(_parent.leftBorder + 20, _parent.rightBorder);
targetTrackPos = SwainMath.randomNumber(200, 400);
targetEndpoint = my_endpoint;
jumpDifficulty = 20;
balanceDifficulty = 15;
shootDifficulty = 35;
shootingTime = 20;
myRange = 200;
sidleDifficulty = 150;
dustFrequency = 3;
}
lastSidleTimer = 9999999 /* 0x98967F */;
dodging = 1;
}
function tick() {
if (myMission == "aim") {
track_pos = hunter.track_pos + hunter.gunRangeY;
my_endpoint = hunter.my_endpoint;
}
if (myMission == "meander") {
my_speed = 10;
if (SwainMath.randomNumber(0, 90) == 0) {
targetEndpoint = SwainMath.randomNumber(_parent.leftBorder + 20, _parent.rightBorder);
}
if (currentTruck != undefined) {
if ((((track_pos < (currentTruck.track_pos + 200)) && (currentTruck.track_pos < (_parent.hunter.track_pos + 900))) && (my_endpoint < (currentTruck.my_endpoint + currentTruck.myGirth))) && (my_endpoint > (currentTruck.my_endpoint - currentTruck.myGirth))) {
killMe("explosion");
}
}
}
if (myMission == "float") {
if ((hunter.myHealth <= 0) && (my_speed > -20)) {
my_speed = my_speed - 1;
}
if (my_speed > (hunter.my_relative_speed * 0.75)) {
my_speed = hunter.my_relative_speed * 0.75;
}
if (track_pos < (hunter.track_pos + 700)) {
targetTrackPos = hunter.track_pos;
targetEndpoint = hunter.my_endpoint;
if (endpoint_vel > 12) {
endpoint_vel = 12;
}
if (endpoint_vel < -12) {
endpoint_vel = -12;
}
}
if ((track_pos < ((hunter.track_pos - 60) + (hunter.my_relative_speed * 7))) && (shootTimer == 0)) {
shootTimer = 1;
mySprite.gotoAndPlay("jump");
}
if (((shootTimer == 2) && (track_pos < ((hunter.track_pos + 5) - (25 * _parent.hunter.positionOFFSET)))) && (track_pos > ((hunter.track_pos - 20) - (25 * _parent.hunter.positionOFFSET)))) {
if ((my_endpoint < ((hunter.my_endpoint + hunter.myGirth) + 20)) && (my_endpoint > ((hunter.my_endpoint - hunter.myGirth) - 20))) {
if (my_endpoint < hunter.my_endpoint) {
if (hunter.grabberLeftHealth > 0) {
hitPlayer(1);
} else {
hunter.grabberLeftHealth = 50;
if (_root.shakeDisplay == undefined) {
_root.createDisplay("shake");
}
if (_root.shake_camera < 5) {
_root.shake_camera = 5;
}
killMe("none");
}
} else if (hunter.grabberRightHealth > 0) {
hitPlayer(1);
} else {
if (_root.shakeDisplay == undefined) {
_root.createDisplay("shake");
}
hunter.grabberRightHealth = 50;
if (_root.shake_camera < 5) {
_root.shake_camera = 5;
}
killMe("none");
}
}
}
if (shootTimer == 3) {
}
}
if (myMission == "summon") {
if (shootTimer == 0) {
if (_root.shake_camera < 20) {
_root.shake_camera = 20;
}
}
shootTimer++;
if (shootTimer == shootDifficulty) {
var _local5 = 450;
var _local3 = 0;
while (_local3 < (10 + _root.currentWave)) {
_parent.makeDebris("zombie", false, hunter.track_pos + _local5, SwainMath.randomNumber(_parent.leftBorder, _parent.rightBorder), 0);
_local5 = _local5 + SwainMath.randomNumber(100, 600);
_local3++;
}
hunter.zombieTarget = MadnessDebris.zombiesAll.length;
}
if (shootTimer > shootDifficulty) {
if (shootTimer == (shootDifficulty + shootingTime)) {
mySmoke.gotoAndPlay(1);
mySprite._visible = false;
if (_root.shake_camera < 20) {
_root.shake_camera = 20;
}
}
if (shootTimer > (shootDifficulty + shootingTime)) {
if (mySmoke._currentframe > 16) {
currentJesus = undefined;
killMe("none");
}
}
}
if (my_speed > (hunter.my_relative_speed * 1.2)) {
my_speed = hunter.my_relative_speed * 1.2;
}
targetEndpoint = hunter.my_endpoint;
targetTrackPos = 200;
}
if (myMission.substr(0, 6) == "outrun") {
if (myMission.length == 7) {
targetEndpoint = hunter.my_endpoint;
if (targetEndpoint < ((_parent.leftBorder + myGirth) + 20)) {
targetEndpoint = (_parent.leftBorder + myGirth) + 20;
}
if (targetEndpoint > (_parent.rightBorder - myGirth)) {
targetEndpoint = _parent.rightBorder - myGirth;
}
targetTrackPos = SwainMath.randomNumber(150, 400);
} else {
if (SwainMath.randomNumber(0, 90) == 0) {
targetEndpoint = SwainMath.randomNumber((_parent.leftBorder + myGirth) + 20, _parent.rightBorder - myGirth);
}
if (SwainMath.randomNumber(0, 90) == 0) {
targetTrackPos = SwainMath.randomNumber(400, 600);
}
}
if (myHealth > 600) {
mySprite.spriteCar.myCar.myCracks._alpha = 0;
} else {
mySprite.spriteCar.myCar.myCracks._alpha = 100 - (100 * ((myHealth / 2) / 300));
}
if (myHealth < 300) {
mySprite.spriteCar.myCar.fire1._visible = true;
} else {
mySprite.spriteCar.myCar.fire1._visible = false;
}
if (myHealth < 250) {
mySprite.spriteCar.myCar.fire2a._visible = true;
} else {
mySprite.spriteCar.myCar.fire2a._visible = false;
}
if (myHealth < 250) {
mySprite.spriteCar.myCar.fire2b._visible = true;
} else {
mySprite.spriteCar.myCar.fire2b._visible = false;
}
if (myHealth < 180) {
mySprite.spriteCar.myCar.fire3a._visible = true;
} else {
mySprite.spriteCar.myCar.fire3a._visible = false;
}
if (myHealth < 180) {
mySprite.spriteCar.myCar.fire3b._visible = true;
} else {
mySprite.spriteCar.myCar.fire3b._visible = false;
}
if (track_pos < (hunter.track_pos + 400)) {
shootTimer++;
if (shootTimer > shootDifficulty) {
if (doorStatus == "closed") {
if (_root.currentWave <= 2) {
myMission = "outrun3";
} else if (_root.currentWave == 3) {
myMission = "outrun" + String(SwainMath.randomNumber(2, 3));
} else {
myMission = "outrun" + String(SwainMath.randomNumber(1, 3));
}
mySprite.spriteCar.spriteTactics.gotoAndStop(myMission);
doorStatus = "open";
mySprite.spriteCar.spriteTactics.spriteDoor.gotoAndPlay(2);
} else if (shootTimer >= (shootDifficulty + shootingTime)) {
mySprite.spriteCar.spriteTactics.spriteDoor.play();
shootTimer = 0;
}
}
}
if (mySprite.spriteCar.spriteTactics.spriteDoor._currentframe == 1) {
mySprite.spriteCar.spriteTactics.gotoAndStop("outrun");
}
if (shootTimer > shootDifficulty) {
sidleTimer++;
if (myMission == "outrun1") {
if (((mySprite.spriteCar.spriteTactics.shooter2.checkHit && (hunter.my_endpoint < (my_endpoint - 175))) && (hunter.my_endpoint > ((my_endpoint - myGirth) - hunter.myGirth))) && (hunter.track_pos > (track_pos - myRange))) {
hitPlayer(1);
}
if (((mySprite.spriteCar.spriteTactics.shooter1.checkHit && (hunter.my_endpoint > (my_endpoint + 140))) && (hunter.my_endpoint < ((my_endpoint + myGirth) + hunter.myGirth))) && (hunter.track_pos > (track_pos - myRange))) {
hitPlayer(1);
}
if (sidleTimer == 1) {
mySprite.spriteCar.spriteTactics.shooter1.stop();
mySprite.spriteCar.spriteTactics.shooter2.stop();
}
if (sidleTimer == 7) {
mySprite.spriteCar.spriteTactics.shooter1.play();
mySprite.spriteCar.spriteTactics.shooter2.play();
}
if (doorStatus == "closing") {
if ((mySprite.spriteCar.spriteTactics.shooter1.myHealth > 0) && (mySprite.spriteCar.spriteTactics.shooter1.amShooting)) {
mySprite.spriteCar.spriteTactics.shooter1.myHealth = 9999;
mySprite.spriteCar.spriteTactics.shooter1.gotoAndStop("ready");
}
if ((mySprite.spriteCar.spriteTactics.shooter2.myHealth > 0) && (mySprite.spriteCar.spriteTactics.shooter2.amShooting)) {
mySprite.spriteCar.spriteTactics.shooter2.myHealth = 9999;
mySprite.spriteCar.spriteTactics.shooter2.gotoAndStop("ready");
}
}
if ((mySprite.spriteCar.spriteTactics.shooter1.myHealth < 0) && (mySprite.spriteCar.spriteTactics.shooter1.amShooting)) {
mySprite.spriteCar.spriteTactics.shooter1.gotoAndPlay("dead");
}
if (((mySprite.spriteCar.spriteTactics.shooter1._currentframe == 1) && (doorStatus == "open")) && (mySprite.spriteCar.spriteTactics._currentframe > 6)) {
mySprite.spriteCar.spriteTactics.shooter1.gotoAndPlay(2);
}
if ((mySprite.spriteCar.spriteTactics.shooter2.myHealth < 0) && (mySprite.spriteCar.spriteTactics.shooter2.amShooting)) {
mySprite.spriteCar.spriteTactics.shooter2.gotoAndPlay("dead");
}
if (((mySprite.spriteCar.spriteTactics.shooter2._currentframe == 1) && (doorStatus == "open")) && (mySprite.spriteCar.spriteTactics._currentframe > 6)) {
mySprite.spriteCar.spriteTactics.shooter2.gotoAndPlay(2);
}
if (mySprite.spriteCar.spriteTactics.shooter1.myReady == true) {
_parent.makeDebris("soldier", false, track_pos - 1, my_endpoint - 140, my_speed - 5);
}
if (mySprite.spriteCar.spriteTactics.shooter2.myReady == true) {
_parent.makeDebris("soldier", false, track_pos - 1, my_endpoint + 140, my_speed - 5);
}
}
if (myMission == "outrun2") {
if ((shootTimer < ((shootDifficulty + shootingTime) - 12)) && (doorStatus == "open")) {
if (sidleTimer > 20) {
mySprite.spriteCar.spriteTactics.thrower1.gotoAndPlay(2);
sidleTimer = 0;
}
}
if (mySprite.spriteCar.spriteTactics.thrower1.myReady == true) {
_parent.makeDebris("barrel", false, track_pos - 3, my_endpoint, my_speed - 5);
}
}
if (myMission == "outrun3") {
if ((shootTimer < ((shootDifficulty + shootingTime) - 12)) && (doorStatus == "open")) {
if (sidleTimer > 25) {
mySprite.spriteCar.spriteTactics["jumper" + String(SwainMath.randomNumber(1, 2))].gotoAndPlay(2);
sidleTimer = 0;
}
}
if (mySprite.spriteCar.spriteTactics.jumper1.myReady == true) {
_parent.makeDebris("agent_truck", false, track_pos - 3, my_endpoint - 70, my_speed - 5);
}
if (mySprite.spriteCar.spriteTactics.jumper2.myReady == true) {
_parent.makeDebris("agent_truck", false, track_pos - 3, my_endpoint + 80, my_speed - 5);
}
}
} else {
sidleTimer = 0;
}
if (myHealth < 0) {
if (doorStatus == "open") {
mySprite.spriteCar.spriteTactics.spriteDoor.play();
}
targetEndpoint = 800;
endpoint_vel = endpoint_vel + 0.8;
if (endpoint_vel > 25) {
endpoint_vel = 25;
}
targetTrackPos = -300;
my_speed = my_speed - 0.4;
if (my_endpoint > 1600) {
if (_root.shake_camera < 80) {
_root.shake_camera = 80;
}
_root.playAudio("boom2", "sound_impacts");
_root.world_mc.advanceWave();
_root.unlockMedal("Truckstopper");
killMe("none");
}
}
}
if (myMission == "intercept") {
lastSidleTimer++;
if ((SwainMath.randomNumber(0, 90) == 0) || ((myChar == "soldier") && (SwainMath.randomNumber(0, 40) == 0))) {
targetEndpoint = SwainMath.randomNumber(_parent.leftBorder + 20, _parent.rightBorder);
}
if ((SwainMath.randomNumber(0, 90) == 0) || ((myChar == "soldier") && (SwainMath.randomNumber(0, 40) == 0))) {
targetTrackPos = SwainMath.randomNumber(250, 600);
}
if (_parent.startupTimer != -1) {
targetTrackPos = 10000;
} else if (targetTrackPos == 10000) {
targetTrackPos = SwainMath.randomNumber(500, 600);
}
if (((hunter.act == "shooting") && (track_pos > hunter.track_pos)) && (track_pos < (hunter.track_pos + hunter.gunRangeY))) {
if (dodging < maxDodge) {
dodging = dodging + dodgeSkill;
}
while ((hunter.my_endpoint > (((targetEndpoint - hunter.gunRangeX) - myGirth) - 120)) && (hunter.my_endpoint < (((targetEndpoint + hunter.gunRangeX) + myGirth) - 70))) {
targetEndpoint = SwainMath.randomNumber(_parent.leftBorder, _parent.rightBorder);
}
} else if (track_pos < (hunter.track_pos + ((hunter.my_speed - my_speed) * 75))) {
if ((my_endpoint > ((hunter.my_endpoint - myGirth) - hunter.myGirth)) && (my_endpoint < ((hunter.my_endpoint + myGirth) + hunter.myGirth))) {
while ((targetEndpoint > (((hunter.my_endpoint - myGirth) - hunter.myGirth) - 120)) && (targetEndpoint < (((hunter.my_endpoint + myGirth) + hunter.myGirth) - 70))) {
targetEndpoint = SwainMath.randomNumber(_parent.leftBorder + 20, _parent.rightBorder);
}
if (dodging < maxDodge) {
dodging = dodging + dodgeSkill;
}
}
} else {
dodging = 1;
}
if (myChar == "soldier") {
if ((((my_endpoint < ((hunter.my_endpoint + hunter.myGirth) + 35)) && (my_endpoint > ((hunter.my_endpoint - hunter.myGirth) - 35))) && (track_pos > (hunter.track_pos + 10))) && (track_pos <= (hunter.track_pos + myRange))) {
shootTimer++;
if (shootTimer > shootDifficulty) {
hitTimer++;
if (((hitTimer >= 7) && (my_endpoint < ((hunter.my_endpoint + hunter.myGirth) + 10))) && (my_endpoint > ((hunter.my_endpoint - hunter.myGirth) - 10))) {
hitTimer = 0;
hitPlayer(1);
if (!hunter.ramWarning) {
_root.createDisplay("ram");
hunter.ramWarning = true;
}
}
} else {
hitTimer = 0;
}
if (shootTimer > (shootDifficulty + shootingTime)) {
shootTimer = 0;
}
} else {
shootTimer = 0;
hitTimer = 0;
}
}
if (currentTruck != undefined) {
if ((((track_pos < (currentTruck.track_pos + 700)) && (track_pos > (currentTruck.track_pos - 15))) && ((my_endpoint - myGirth) < (currentTruck.my_endpoint + currentTruck.myGirth))) && ((my_endpoint + myGirth) > (currentTruck.my_endpoint - currentTruck.myGirth))) {
if (my_endpoint < currentTruck.my_endpoint) {
endpoint_vel = -20;
} else {
endpoint_vel = 20;
}
if ((track_pos > (currentTruck.track_pos - 20)) && (my_speed > (currentTruck.my_speed - 5))) {
my_speed = currentTruck.my_speed - 5;
}
if ((track_pos > (currentTruck.track_pos - 10)) && (track_pos < (currentTruck.track_pos + 300))) {
track_pos = track_pos - my_speed;
}
}
if ((hunter.track_pos + targetTrackPos) > (currentTruck.track_pos - 20)) {
targetTrackPos = (currentTruck.track_pos - hunter.track_pos) - 20;
}
}
if ((((SwainMath.randomNumber(0, 100 + (allBikes.length * 6)) == 0) && (shootTimer <= shootDifficulty)) && (lastSidleTimer > 120)) && (_parent.startupTimer == -1)) {
var _local4 = 0;
var _local3 = 0;
while (_local3 < allBikes.length) {
if (allBikes[_local3].myMission == "sidle") {
_local4++;
}
if (_local4 >= (allBikes.length / 3)) {
break;
}
_local3++;
}
if (_local4 < (allBikes.length / 3)) {
myMission = "sidle";
jumpTimer = 0;
shootTimer = 0;
balanceTimer = 0;
}
}
}
if (myMission == "sidle") {
lastSidleTimer = 0;
if ((((my_speed < (hunter.my_relative_speed + 4)) && (my_speed > (hunter.my_relative_speed - 4))) && (track_pos < ((hunter.track_pos + 2) - 20))) && (track_pos > ((hunter.track_pos - 2) - 20))) {
} else if (SwainMath.randomNumber(0, 120) == 0) {
}
targetTrackPos = -30;
if (my_endpoint < hunter.my_endpoint) {
}
if (carLocked) {
my_speed = 0;
}
if (myChar == "agent") {
if ((balanceTimer > 0) || (carLocked && ((my_endpoint < ((hunter.my_endpoint + hunter.myGirth) + 50)) || (my_endpoint > ((hunter.my_endpoint - hunter.myGirth) - 50))))) {
if (((my_endpoint < hunter.my_endpoint) && (hunter.grabberLeftHealth <= 0)) || ((my_endpoint > hunter.my_endpoint) && (hunter.grabberRightHealth <= 0))) {
jumpTimer++;
if (jumpTimer >= jumpDifficulty) {
if (balanceTimer < balanceDifficulty) {
balanceTimer++;
}
targetEndpoint = hunter.my_endpoint;
} else {
if (my_endpoint < hunter.my_endpoint) {
targetEndpoint = hunter.my_endpoint - 220;
}
if (my_endpoint > hunter.my_endpoint) {
targetEndpoint = hunter.my_endpoint + 370;
}
}
}
} else if (balanceTimer == 0) {
jumpTimer = 0;
}
if (balanceTimer >= balanceDifficulty) {
myMission = "abandoned";
jumpTimer = 0;
balanceTimer = 0;
my_speed = 0;
my_accel = 0.5;
_parent.createJumper(my_endpoint < hunter.my_endpoint, myChar, _x, _y);
}
} else if (myChar == "soldier") {
if (my_endpoint < hunter.my_endpoint) {
targetEndpoint = hunter.my_endpoint - 220;
}
if (my_endpoint > hunter.my_endpoint) {
targetEndpoint = hunter.my_endpoint + 370;
}
if ((shootTimer > 0) || (carLocked && ((my_endpoint < ((hunter.my_endpoint + hunter.myGirth) + 50)) || (my_endpoint > ((hunter.my_endpoint - hunter.myGirth) - 50))))) {
shootTimer++;
if (shootTimer > shootDifficulty) {
hitTimer++;
if (((hitTimer >= 7) && ((my_endpoint + 550) > hunter.my_endpoint)) && ((my_endpoint - 550) < hunter.my_endpoint)) {
hitTimer = 0;
hitPlayer(1);
if (!hunter.ramWarning) {
_root.createDisplay("ram");
hunter.ramWarning = true;
}
}
} else {
hitTimer = 0;
}
if (shootTimer > (shootDifficulty + shootingTime)) {
shootTimer = 0;
}
}
if (carLocked) {
sidleTimer++;
if (((sidleTimer >= sidleDifficulty) && (shootTimer < shootDifficulty)) || (shootTimer < (-shootDifficulty))) {
sidleTimer = 0;
myMission = "intercept";
targetTrackPos = 500;
my_speed = my_speed + 10;
}
}
}
}
if (myMission == "flee") {
my_speed = my_speed + 0.5;
dodging = maxDodge;
if (track_pos > (1000 + hunter.track_pos)) {
killMe("none");
}
}
if (myMission == "spawn") {
if (track_pos > (hunter.track_pos - 8)) {
myMission = "intercept";
} else {
my_speed = hunter.my_relative_speed + ((hunter.track_pos - track_pos) / 10);
}
if ((targetEndpoint > (hunter.my_endpoint - 140)) && (targetEndpoint < (hunter.my_endpoint + 140))) {
if (targetEndpoint < hunter.my_endpoint) {
targetEndpoint = targetEndpoint - 50;
} else {
targetEndpoint = targetEndpoint + 50;
}
}
dodging = 10;
}
if (myMission == "abandoned") {
jumpTimer = jumpTimer + 0.07;
if (track_pos < (hunter.track_pos - 40)) {
killMe("none");
}
my_speed = my_speed - jumpTimer;
track_pos = (hunter.track_pos + 3) + my_speed;
}
if (hunter.gameOverSpeed < 1) {
if (myMission == "sidle") {
myMission = "intercept";
}
if ((myMission != "abandoned") && (myMission != "float")) {
targetTrackPos = 99999999 /* 0x5F5E0FF */;
if (my_speed > (10 + (20 * hunter.gameOverSpeed))) {
my_speed = 10 + (20 * hunter.gameOverSpeed);
}
} else {
targetTrackPos = -500;
}
}
if (((track_pos < (hunter.track_pos + 60)) && (myType != "jesus")) && (myType != "chute")) {
if (myHit.hitTest(hunter.myHit)) {
if (!carLocked) {
if ((track_pos + 20) > hunter.track_pos) {
hunter.myBumpY = 20;
hunter.sparkTimerFront = 6;
if ((my_speed < hunter.my_relative_speed) && (myMission != "spawn")) {
if (myChar != "soldier") {
myHealth = myHealth - ((hunter.my_relative_speed - my_speed) * 4);
colorTimer = 0;
}
jumpTimer = 0;
shootTimer = shootTimer - 5;
_root.playAudio("hit2", "sound_cars");
hunter.damageGrabber("front", 2);
}
if (_root.shake_camera < 5) {
_root.shake_camera = 5;
}
}
if (myMission != "spawn") {
my_speed = hunter.my_relative_speed + ((hunter.my_relative_speed - my_speed) * 0.2);
}
}
if ((track_pos + my_speed) < (hunter.track_pos + hunter.myLength)) {
my_endpoint = my_endpoint + ((((hunter.target_x - hunter._x) / hunter.my_speed) + hunter.myBumpX) * 0.8);
if (my_endpoint < hunter.my_endpoint) {
endpoint_vel = -12;
hunter.myBumpX = 20;
hunter.sparkTimerLeft = 6;
if (_root.shake_camera < 5) {
_root.shake_camera = 5;
}
if (myMission != "spawn") {
if (myChar != "soldier") {
myHealth = myHealth - 5;
colorTimer = 0;
}
jumpTimer = 0;
shootTimer = shootTimer - 5;
_root.playAudio("grind", "sound_cars");
}
hunter.damageGrabber("left", 2);
shootTimer = shootTimer - 10;
} else {
endpoint_vel = 12;
hunter.myBumpX = -20;
hunter.sparkTimerRight = 6;
if (_root.shake_camera < 5) {
_root.shake_camera = 5;
}
if (myMission != "spawn") {
if (myChar != "soldier") {
myHealth = myHealth - 5;
colorTimer = 0;
}
jumpTimer = 0;
shootTimer = shootTimer - 5;
_root.playAudio("grind", "sound_cars");
}
hunter.damageGrabber("right", 2);
}
}
}
}
if ((my_endpoint + (endpoint_vel * 12)) < targetEndpoint) {
endpoint_vel = endpoint_vel + ((my_accel * 10) * dodging);
}
if ((my_endpoint + (endpoint_vel * 12)) > targetEndpoint) {
endpoint_vel = endpoint_vel - ((my_accel * 10) * dodging);
}
if (my_endpoint < (targetEndpoint - my_endpoint)) {
}
if (my_endpoint > (targetEndpoint + my_endpoint)) {
}
my_endpoint = my_endpoint + endpoint_vel;
if (my_endpoint < (_parent.leftBorder + myGirth)) {
endpoint_vel = 0;
my_endpoint = _parent.leftBorder + myGirth;
targetEndpoint = my_endpoint;
}
if ((my_endpoint > (_parent.rightBorder - myGirth)) && (myHealth > 0)) {
endpoint_vel = 0;
my_endpoint = _parent.rightBorder - myGirth;
targetEndpoint = my_endpoint;
}
mySprite.spriteCar.brake._visible = false;
if (((track_pos + (my_speed * 14)) < (hunter.track_pos + targetTrackPos)) && (!(myMission === "abandoned"))) {
my_speed = my_speed + (my_accel * 1);
}
if (((track_pos + (my_speed * 14)) > (hunter.track_pos + targetTrackPos)) && (myMission != "abandoned")) {
my_speed = my_speed - (my_accel * 1);
mySprite.spriteCar.brake._visible = true;
}
if ((((my_speed < hunter.my_relative_speed) && (track_pos > hunter.track_pos)) && (track_pos < hunter.track_pos)) && (myMission != "abandoned")) {
my_speed = my_speed + (((hunter.my_relative_speed - my_speed) * (hunter.track_pos / track_pos)) * 0.8);
} else if (((my_speed < hunter.my_relative_speed) && (track_pos < hunter.track_pos)) && (myMission != "abandoned")) {
my_speed = my_speed + ((hunter.my_relative_speed - my_speed) * 0.2);
}
if (_x < left_limit) {
_x = left_limit;
}
if ((_x > right_limit) && (myHealth > 0)) {
_x = right_limit;
}
if (_y < (y_plane - 30)) {
_y = y_plane - 30;
}
if (_y > (y_plane + 30)) {
_y = y_plane + 30;
}
track_pos = track_pos + my_speed;
if (track_pos > (hunter.track_pos + 5000)) {
track_pos = hunter.track_pos + 5000;
}
if (((track_pos < (hunter.track_pos + 75)) && (hunter.my_relative_speed > my_speed)) && ((myMission.substr(0, 6) == "outrun") || (myMission == "summon"))) {
my_speed = my_speed + ((hunter.my_relative_speed - my_speed) / 5);
}
if ((track_pos < (hunter.track_pos + 45)) && (myMission.substr(0, 6) == "outrun")) {
track_pos = (hunter.track_pos + 45) - (25 * _parent.hunter.positionOFFSET);
if (my_speed < hunter.my_relative_speed) {
my_speed = hunter.my_relative_speed;
}
my_speed = my_speed + (my_accel * 1);
} else if ((myMission == "float") && (hunter.gameOverSpeed == 1)) {
if ((track_pos < (hunter.track_pos + 85)) && (shootTimer < 4)) {
my_speed = my_speed + ((hunter.my_relative_speed - my_speed) / 5);
if (track_pos < (hunter.track_pos + 3)) {
track_pos = hunter.track_pos + 3;
my_speed = hunter.my_relative_speed;
}
}
} else if ((((track_pos < ((hunter.track_pos + 2) - (50 * _parent.hunter.positionOFFSET))) && (myMission != "spawn")) && (myMission != "abandoned")) && (myMission != "meander")) {
if ((myMission == "sidle") && (!carLocked)) {
carLocked = true;
}
track_pos = (hunter.track_pos + 2) - (25 * _parent.hunter.positionOFFSET);
if (my_speed < hunter.my_relative_speed) {
my_speed = hunter.my_relative_speed;
}
my_speed = my_speed + (my_accel * 1);
}
if (my_endpoint < ((_parent.leftBorder + ((_parent.rightBorder - _parent.leftBorder) / 3)) - 30)) {
mySpriteDir = "left";
} else if (my_endpoint <= ((_parent.leftBorder + (((_parent.rightBorder - _parent.leftBorder) / 3) * 2)) + 30)) {
mySpriteDir = "center";
} else {
mySpriteDir = "right";
}
if (((myType == "truck") && (myHealth < 0)) && (my_endpoint > 750)) {
mySpriteDir = "dead";
}
mySprite.spriteCar.gotoAndStop(mySpriteDir);
if (balanceTimer > 0) {
if (my_endpoint < hunter.my_endpoint) {
mySpriteDir = "balance_right";
} else {
mySpriteDir = "balance_left";
}
mySprite.spriteBody.spriteBalance.gotoAndStop(balanceTimer);
}
mySprite.spriteBody.gotoAndStop(mySpriteDir);
if ((myType == "jesus") && (shootTimer < shootDifficulty)) {
mySprite.spriteBody.gotoAndStop(1);
}
if (myType == "jesus") {
mySprite.spriteBody._rotation = 0 + (endpoint_vel * 1.2);
}
if ((myType == "chute") && (shootTimer == 0)) {
mySprite._rotation = 0 + (endpoint_vel * 2);
}
if ((myType == "chute") && (shootTimer == 1)) {
mySprite._rotation = mySprite._rotation * 0.5;
}
if (((myType == "chute") && (shootTimer == 0)) && (track_pos > ((hunter.track_pos + 750) + (hunter.my_relative_speed * 10)))) {
mySprite.gotoAndPlay("start");
}
if (shootTimer >= shootDifficulty) {
if ((myMission == "intercept") && (my_endpoint <= hunter.my_endpoint)) {
mySprite.spriteBody.spriteHands.gotoAndStop("shoot_backright");
} else if ((myMission == "intercept") && (my_endpoint >= hunter.my_endpoint)) {
mySprite.spriteBody.spriteHands.gotoAndStop("shoot_backleft");
} else if ((myMission == "sidle") && (my_endpoint <= hunter.my_endpoint)) {
mySprite.spriteBody.spriteHands.gotoAndStop("shoot_right");
} else if ((myMission == "sidle") && (my_endpoint >= hunter.my_endpoint)) {
mySprite.spriteBody.spriteHands.gotoAndStop("shoot_left");
}
if ((myMission == "summon") && (mySprite.spriteBody._currentframe == 1)) {
mySprite.spriteBody.gotoAndPlay(2);
}
} else if (mySprite.spriteBody.spriteHands._currentFrame > mySprite.spriteBody.spriteHands.totalIdleFrames) {
mySprite.spriteBody.spriteHands.gotoAndPlay("idle");
}
if (((((hunter.track_pos < track_pos) && (my_endpoint > (hunter.my_endpoint - 50))) && (my_endpoint < (hunter.my_endpoint + 50))) && (myChar != "soldier")) || (((((hunter.track_pos < track_pos) && (my_endpoint > (hunter.my_endpoint - 50))) && (my_endpoint < (hunter.my_endpoint + 50))) && (myChar == "soldier")) && (shootTimer < shootDifficulty))) {
mySprite.spriteHead.gotoAndStop(2);
mySprite.spriteBody.spriteHead.gotoAndStop(7);
} else if (hunter.my_endpoint < my_endpoint) {
mySprite.spriteHead.gotoAndStop(3);
if (track_pos > (hunter.track_pos + 50)) {
mySprite.spriteBody.spriteHead.gotoAndStop(3);
} else if (track_pos > (hunter.track_pos + 20)) {
mySprite.spriteBody.spriteHead.gotoAndStop(2);
} else {
mySprite.spriteBody.spriteHead.gotoAndStop(1);
}
} else {
mySprite.spriteHead.gotoAndStop(1);
if (track_pos > (hunter.track_pos + 50)) {
mySprite.spriteBody.spriteHead.gotoAndStop(4);
} else if (track_pos > (hunter.track_pos + 20)) {
mySprite.spriteBody.spriteHead.gotoAndStop(5);
} else {
mySprite.spriteBody.spriteHead.gotoAndStop(6);
}
}
colorTimer++;
if (myType == "truck") {
bossTimer++;
if (myHealth < 0) {
bossTimer = 11;
} else if ((myHealth < 100) && (bossTimer > 5)) {
bossTimer = 0;
} else if ((myHealth < 300) && (bossTimer > 10)) {
bossTimer = 0;
} else if ((myHealth < 600) && (bossTimer > 15)) {
bossTimer = 0;
}
if (bossTimer < 11) {
bossColor = 10 * (10 - bossTimer);
} else {
bossColor = 0;
}
} else {
bossColor = 0;
}
if (colorTimer < 10) {
myColorTransform = {rb:(255 / colorTimer) + bossColor, gb:bossColor / 2, bb:0};
myColor.setTransform(myColorTransform);
} else {
myColorTransform = {rb:bossColor, gb:bossColor / 2, bb:0};
myColor.setTransform(myColorTransform);
}
if (myMission == "abandoned") {
mySprite.spriteBody._visible = false;
}
if ((dustFrequency > 0) && ((myType == "bike") || (myType == "jesus"))) {
dustTimer++;
if (dustTimer == dustFrequency) {
dustTimer = 0;
_parent.debrisContainer.makeDebris("puff", false, track_pos - 3, my_endpoint, my_speed / 2);
}
}
if (track_pos < (hunter.track_pos - 500)) {
permanant = false;
}
if (myHealth <= 0) {
if (myMission.substr(0, 6) == "outrun") {
myHealth = myHealth - 1;
if ((SwainMath.randomNumber(0, 2) == 0) && (_x < (right_limit + 150))) {
if (_root.shake_camera < 15) {
_root.shake_camera = 15;
}
_root.playAudio("boom1", "sound_impacts");
}
_parent.makeDebris("explosion2", false, track_pos, my_endpoint + SwainMath.randomNumber(-myGirth, myGirth), (my_speed * 0.1) + (hunter.my_relative_speed * 0.5), 0, 0);
if (myHealth <= -50) {
}
} else {
if ((((track_pos < (hunter.track_pos + 45)) && (track_pos > (hunter.track_pos - 5))) && (my_endpoint < ((hunter.my_endpoint + hunter.myGirth) + 30))) && (my_endpoint > ((hunter.my_endpoint - hunter.myGirth) - 30))) {
if (myChar == "soldier") {
_parent.hunter.bloodLevelA = _parent.hunter.bloodLevelA + 180;
}
if (myChar == "agent") {
_parent.hunter.bloodLevelB = _parent.hunter.bloodLevelB + 180;
}
}
killMe("explosion");
}
}
_root.object_scale_finder(this);
_root.move_object(this);
_parent.adjustDepth(this);
if (myMission == "aim") {
if (hunter.myGun == "grenade") {
_visible = true;
} else {
_visible = false;
}
}
if ((track_pos > hunter.track_pos) && (track_pos < (hunter.track_pos + hunter.gunRangeY))) {
inRange.gotoAndStop(2);
} else {
inRange.gotoAndStop(1);
}
myMissionTEXT.text = myMission;
}
function killMe(inEffect) {
var _local4 = new Array();
if (myType === "bike") {
_local4 = allBikes;
}
if (myType === "chute") {
_local4 = allChutes;
}
var _local3 = 0;
while (_local3 < _local4.length) {
if (_local4[_local3] == this) {
_local4.splice(_local3, 1);
break;
}
_local3++;
}
if ((inEffect != "none") && (myMission != "abandoned")) {
_parent.spawnTimer = 0;
if (myType == "bike") {
_root.playAudio("boom1", "sound_impacts");
_root.playAudio("hit2", "sound_impacts");
_parent.streakKills++;
if (hunter.myGun == "default") {
hunter.pistolKills++;
} else {
hunter.pistolKills = 0;
}
}
_parent.waveKills++;
}
if (this == currentJesus) {
currentJesus = undefined;
}
if (this == currentTruck) {
currentTruck = undefined;
}
if (this == currentCiv) {
currentCiv = undefined;
}
if (inEffect != "none") {
if (myType == "bike") {
_local3 = 0;
while (_local3 < 6) {
_parent.debrisContainer.makeDebris("bike_part", false, track_pos, my_endpoint, hunter.my_relative_speed * (SwainMath.randomNumber(80, 120) / 100));
_local3++;
}
}
_parent.makeDebris(inEffect, false, track_pos, my_endpoint, (my_speed * 0.1) + (hunter.my_relative_speed * 0.5), 0, 0);
_parent.makeDebris(myChar, false, track_pos, my_endpoint, my_speed);
if (_root.shake_camera < 8) {
_root.shake_camera = 8;
}
}
removeMovieClip();
}
function hitPlayer(inDamage) {
if (hunter.invincibleTimer <= 0) {
hunter.myHealth = hunter.myHealth - inDamage;
_parent.hunter.colorTimer = 0;
}
}
static var allBikes = new Array();
static var allChutes = new Array();
var hunter = new Object();
var left_limit = new Number();
var right_limit = new Number();
var path_width = 410;
var targetEndpoint = new Number();
var targetTrackPos = new Number();
var endpoint_vel = new Number();
var dodging = new Number();
var dodgeSkill = new Number();
var maxDodge = new Number();
var myGirth = new Number();
var carLocked = new Boolean();
var x_min = 100;
var x_max = 380;
var y_min = 1;
var y_max = 1;
var mouse_width = 280;
var y_plane = new Number();
var act = "running";
var track_pos = new Number();
var my_speed = new Number();
var my_topspeed = new Number();
var my_accel = new Number();
var permanant = true;
var my_endpoint = new Number();
var speed_mod = new Number();
var my_dodge = new String();
var myChar = new String();
var myType = new String();
var myHealth = new Number();
var mySpriteDir = new String();
var myHeadDir = new Number();
var myMission = new String();
var jumpTimer = new Number();
var jumpDifficulty = new Number();
var balanceTimer = new Number();
var balanceDifficulty = new Number();
var dustTimer = new Number();
var dustFrequency = new Number();
var shootTimer = new Number();
var shootDifficulty = new Number();
var shootingTime = new Number();
var myRange = new Number();
var sidleTimer = new Number();
var sidleDifficulty = new Number();
var lastSidleTimer = new Number();
var doorStatus = new String();
var myColorTransform = new Object();
var colorTimer = new Number();
var bossColor = new Number();
var bossTimer = new Number();
var hitTimer = new Number();
}
Symbol 1360 MovieClip [__Packages.MadnessLeap] Frame 0
class MadnessLeap extends MovieClip
{
var onEnterFrame, _x, _y, gotoAndStop, removeMovieClip, _parent, myHit;
function MadnessLeap () {
super();
onEnterFrame = tick;
}
function init(inLeftSide, inType, inX, inY) {
myType = inType;
_x = inX;
_y = inY - 15;
startY = inY;
my_speed = -22;
my_jump = 12;
if (inLeftSide == "down") {
myDir = "Down";
my_speed = 0;
} else if (inLeftSide) {
myDir = "Right";
my_speed = my_speed * -1;
} else {
myDir = "Left";
}
gotoAndStop((myType + "_") + myDir);
if (myType == "agent") {
myHealth = 50;
}
if (myType == "zombie") {
myHealth = 80;
}
left_limit = _root.world_mc.x_min._x;
right_limit = _root.world_mc.x_max._x;
path_width = right_limit - left_limit;
}
function tick() {
if (amDoomed) {
removeMovieClip();
} else if (_y >= (startY + 5)) {
var _local3 = 0.95 * (_parent.leftBorder + ((_parent.rightBorder - _parent.leftBorder) * ((_x - left_limit) / path_width)));
_parent.makeDebris("agent", false, _parent.hunter.track_pos - 4, _local3, _parent.hunter.my_relative_speed + 1);
amDoomed = true;
} else {
_x = _x + my_speed;
_y = _y - my_jump;
my_jump = my_jump + myGravity;
if (myHit.hitTest(_parent.hunter.myHit) && (((myDir == "Right") && (_x < _parent.hunter._x)) || ((myDir == "Left") && (_x > _parent.hunter._x)))) {
if (myDir == "Right") {
if ((_parent.hunter.grabberLeftHealth <= 0) && (_parent.hunter.invincibleTimer <= 0)) {
_parent.hunter.grabberLeftHealth = myHealth;
if (_root.shakeDisplay == undefined) {
_root.createDisplay("shake");
}
} else {
_parent.makeDebris("agent", false, _parent.hunter.track_pos - 3, _parent.hunter.my_endpoint - 20, _parent.hunter.my_relative_speed + 1);
}
} else if ((_parent.hunter.grabberRightHealth <= 0) && (_parent.hunter.invincibleTimer <= 0)) {
_parent.hunter.grabberRightHealth = myHealth;
if (_root.shakeDisplay == undefined) {
_root.createDisplay("shake");
}
} else {
_parent.makeDebris("agent", false, _parent.hunter.track_pos - 3, _parent.hunter.my_endpoint + 20, _parent.hunter.my_relative_speed + 1);
}
if (_root.shake_camera < 5) {
_root.shake_camera = 5;
}
removeMovieClip();
}
}
_parent.adjustDepth(this);
}
static var myGravity = -2.6;
var my_jump = new Number();
var my_speed = new Number();
var myType = new String();
var startY = new Number();
var myDir = new String();
var myHealth = new Number();
var amDoomed = false;
var left_limit = new Number();
var right_limit = new Number();
var path_width = new Number();
}
Symbol 1361 MovieClip [__Packages.MadnessDisplay] Frame 0
class MadnessDisplay extends MovieClip
{
var onEnterFrame, gotoAndStop, _name, mySprite, _alpha, removeMovieClip, _x, _y;
function MadnessDisplay () {
super();
onEnterFrame = tick;
}
function init(inType) {
myType = inType;
gotoAndStop(myType);
_name = myType + "Display";
adjustPlacement(myType);
if (myType == "start") {
myLifespan = 40;
}
if (myType == "complete") {
myLifespan = 110;
}
}
function tick() {
if (lifespanTimer != -1) {
lifespanTimer++;
}
if ((lifespanTimer >= myLifespan) && (myLifespan > 0)) {
lifespanTimer = -1;
if (myType == "complete") {
mySprite.gotoAndPlay("done");
}
}
if (lifespanTimer == -1) {
if (myType == "start") {
_alpha = _alpha - 20;
}
if (_alpha <= 0) {
_root.world_mc.wavePause = false;
removeMovieClip();
}
}
if ((val4Display == 0) && (val4 != 0)) {
val4Display = val4;
}
if (lifespanTimer == 30) {
if (val1Display < val1) {
val1Display = val1Display + Math.ceil((val1 - val1Display) * 0.1);
} else {
val1Display = val1;
}
if (val1Display == val1) {
if (Math.ceil(val2Display) < val2) {
val2Display = val2Display + Math.ceil((val2 - val2Display) * 0.1);
} else {
val2Display = val2;
}
}
if (val2Display == val2) {
if (Math.ceil(val3Display) < val3) {
val3Display = val3Display + Math.ceil((val3 - val3Display) * 0.1);
} else {
val3Display = val3;
}
}
if (((val1Display == val1) && (val2Display == val2)) && (val3Display == val3)) {
} else {
lifespanTimer--;
}
}
if (lifespanTimer == 40) {
val4 = _root.totalPoints + (((val1 + val2) * val3) * 100);
if (Math.ceil(val4Display) < val4) {
val4Display = val4Display + Math.ceil((val4 - val4Display) * 0.1);
} else {
val4Display = val4;
}
if (val4Display != val4) {
lifespanTimer--;
} else {
_root.totalPoints = _root.totalPoints + (((val1 + val2) * val3) * 100);
}
}
mySprite.displaySprite.val1Text.text = val1Display;
mySprite.displaySprite.val2Text.text = val2Display;
mySprite.displaySprite.val3Text.text = "x" + String(val3Display);
mySprite.displaySprite.val4Text.text = val4Display;
mySprite.displaySprite.val5Text.text = val5;
mySprite.displaySprite.val6Text.text = val6;
if ((((myType == "shake") && (_root.world_mc.hunter.grabberLeftHealth <= 0)) && (_root.world_mc.hunter.grabberRightHealth <= 0)) || ((myType == "shake2") && (_root.world_mc.hunter.grabberFrontHealth <= 0))) {
removeMovieClip();
}
}
function adjustPlacement(inType) {
if (((inType == "gameover") || (inType == "complete")) || (inType == "start")) {
_x = 310;
_y = 260;
}
if ((((inType == "killstreak") || (inType == "ruthless")) || (inType == "unstoppable")) || (inType == "awesome")) {
_x = 210;
_y = 110;
}
if (inType == "shake") {
_x = 135;
_y = 620;
}
if (inType == "shake2") {
_x = 480;
_y = 610;
}
if (inType == "ram") {
_x = 310;
_y = 460;
}
if (inType == "lowhealth") {
_x = 310;
_y = 100;
}
}
function pressReplay() {
_root.gotoAndStop("restart");
removeMovieClip();
}
function pressMenu() {
_root.gotoAndStop("menu");
removeMovieClip();
}
function continueGame() {
}
var lifespanTimer = new Number();
var myLifespan = new Number();
var myType = new String();
var val1 = new Number();
var val2 = new Number();
var val3 = new Number();
var val4 = new Number();
var val5 = new Number();
var val6 = new Number();
var val1Display = new Number();
var val2Display = new Number();
var val3Display = new Number();
var val4Display = new Number();
var val5Display = new Number();
var val6Display = new Number();
}
Symbol 1362 MovieClip [__Packages.MadnessHunter] Frame 0
class MadnessHunter extends MovieClip
{
var onEnterFrame, myColor, mySprite, gotoAndStop, _parent, _x, _y, brake1, brake2, myAim2, myAim, grabLeft, grabRight, grabFront, throwFront, myChar, myShoot, sparkFront, sparkLeft, sparkRight, mySpray;
function MadnessHunter () {
super();
onEnterFrame = tick;
}
function init() {
myColor = new Color(mySprite);
colorTimer = 999;
y_plane = _root.world_mc.y_plane._y;
left_limit = _root.world_mc.x_min._x;
right_limit = _root.world_mc.x_max._x;
path_width = right_limit - left_limit;
gotoAndStop("stand");
gunRangeY = 200;
gunRangeX = 40;
equipGun("default");
myGirth = 150;
myLength = 10;
myHealth = 120;
myHealthMax = myHealth;
gameOverSpeed = 1;
invincibleSpeed = 1;
mySprite.myCar.myArmor._visible = false;
ramWarning = false;
healthWarning = false;
gameOverSound = false;
}
function tick() {
if (!_parent.playerPause) {
if (_root.invincible) {
myHealth = myHealthMax;
}
if (invincibleTimer > 0) {
equipGun("invincible");
invincibleTimer--;
if (invincibleSpeed < 1.3) {
invincibleSpeed = invincibleSpeed + 0.01;
}
} else {
if (myGun == "invincible") {
equipGun("default");
}
if (invincibleSpeed > 1) {
invincibleSpeed = invincibleSpeed - 0.05;
}
}
if ((myHealth <= 0) && (!gameOverSound)) {
gameOverSound = true;
_root.playAudio("gameover", "sound_cars");
}
if ((MadnessDebris.zombiesAll.length == 0) && (zombieKills > 0)) {
if (zombieKills == zombieTarget) {
_root.unlockMedal("Undertaker");
}
zombieKills = 0;
zombieTarget = 0;
}
if ((myBumpX <= 1) && (myBumpX >= -1)) {
myBumpX = 0;
} else {
myBumpX = myBumpX * 0.9;
}
if (myBumpY <= 1) {
myBumpY = 0;
} else {
myBumpY = myBumpY * 0.9;
}
if ((!healthWarning) && (myHealth < 30)) {
_root.createDisplay("lowhealth");
healthWarning = true;
}
if (!(act === "standing")) {
realMouseX = _root._xmouse;
realMouseY = _root._ymouse;
if (realMouseY < 300) {
realMouseY = 300;
}
x_was = target_x;
target_x = left_limit + ((realMouseX - (_parent.default_x - x_min)) * (path_width / mouse_width));
y_was = target_y;
target_y = y_plane + ((realMouseY - 500) * 0.6);
if (target_y >= (0.5 + y_was)) {
braking = true;
} else {
braking = false;
}
_x = _x + ((((target_x - _x) / my_speed) + myBumpX) * gameOverSpeed);
_y = _y + ((((target_y - _y) / (my_speed * 0.5)) + myBumpY) * gameOverSpeed);
track_OFFSET = _y - 200;
} else if (!(_root.game_ended === true)) {
act = "running";
}
if (_x < left_limit) {
_x = left_limit;
}
if (_x > right_limit) {
_x = right_limit;
}
if (_y < (y_plane - 40)) {
_y = y_plane - 40;
}
if (_y > (y_plane + 40)) {
_y = y_plane + 40;
}
my_endpoint = _parent.leftBorder + ((_parent.rightBorder - _parent.leftBorder) * ((_x - left_limit) / path_width));
positionOFFSET = ((_y - y_plane) + 40) / 400;
my_endpoint = my_endpoint - (my_endpoint * positionOFFSET);
if (my_endpoint < _parent.leftBorder) {
my_endpoint = _parent.leftBorder;
}
if (my_endpoint > _parent.rightBorder) {
my_endpoint = _parent.rightBorder;
}
myROFTimer++;
if (act == "running") {
if (_root.mouse_down == true) {
act = "shooting";
}
}
if ((grabberFrontHealth > 0) || (throwTimer < 9)) {
act = "zombie";
} else if (act == "zombie") {
act = "running";
}
if ((act == "shooting") && (((_root.completeDisplay != undefined) || (gameOverSpeed == 0)) || (_root.startDisplay != undefined))) {
act = "running";
}
myROFTimer++;
if ((myROFTimer > myROF) && (myAmmo == 0)) {
equipGun("default");
}
if ((act == "shooting") && (myROFTimer > myROF)) {
myROFTimer = 1;
braking = true;
if ((myGun == "shotgun") || (myGun == "grenade")) {
if (_root.shake_camera < 8) {
_root.shake_camera = 8;
}
}
if ((myGun != "default") && (myGun != "invincible")) {
myAmmo = myAmmo - 1;
}
if (myGun == "default") {
_root.playAudio("shot7", "sound_guns");
}
if (myGun == "shotgun") {
_root.playAudio("shot6", "sound_guns");
}
if (myGun == "auto") {
_root.playAudio("shot5", "sound_guns");
}
if (myGun == "grenade") {
_root.playAudio("boom1", "sound_guns");
}
if (myGun == "invincible") {
_root.playAudio("shot4", "sound_guns");
}
_parent.makeDebris("shell", false, track_pos + 15, my_endpoint, my_relative_speed * 0.9);
_parent.createBullet(_x, _y - 110, _parent.playerAim._x, _parent.playerAim._y - 30, 100);
if (myGun == "shotgun") {
var _local3 = 0;
while (_local3 < 6) {
_parent.createBullet(_x + (SwainMath.randomNumber(-50, 50) / 10), _y - 110, _parent.playerAim._x + (SwainMath.randomNumber(-500, 500) / 10), _parent.playerAim._y - 30, 100);
_local3++;
}
}
targetList = new Array();
var _local3 = 0;
while (_local3 < MadnessBadguy.allBikes.length) {
if ((myGun == "grenade") && (SwainMath.get_distance(_parent.playerAim, MadnessBadguy.allBikes[_local3]) < gunRangeX)) {
targetList.push(MadnessBadguy.allBikes[_local3]);
} else if ((MadnessBadguy.allBikes[_local3].track_pos > (track_pos - (4 * positionOFFSET))) && (MadnessBadguy.allBikes[_local3].track_pos < ((track_pos + gunRangeY) - (20 * positionOFFSET)))) {
if ((MadnessBadguy.allBikes[_local3].my_endpoint > (((my_endpoint - gunRangeX) - MadnessBadguy.allBikes[_local3].myGirth) + 35)) && (MadnessBadguy.allBikes[_local3].my_endpoint < (((my_endpoint + gunRangeX) + MadnessBadguy.allBikes[_local3].myGirth) + 35))) {
targetList.push(MadnessBadguy.allBikes[_local3]);
}
}
_local3++;
}
if ((MadnessBadguy.currentTruck != undefined) && (MadnessBadguy.currentTruck.myHealth > 0)) {
if ((myGun == "grenade") && (SwainMath.get_distance(_parent.playerAim, MadnessBadguy.currentTruck) < gunRangeX)) {
targetList.push(MadnessBadguy.currentTruck);
} else if ((MadnessBadguy.currentTruck.track_pos > (track_pos - (4 * positionOFFSET))) && (MadnessBadguy.currentTruck.track_pos < ((track_pos + gunRangeY) - (20 * positionOFFSET)))) {
if ((MadnessBadguy.currentTruck.my_endpoint > (((my_endpoint - gunRangeX) - MadnessBadguy.currentTruck.myGirth) - 30)) && (MadnessBadguy.currentTruck.my_endpoint < (((my_endpoint + gunRangeX) + MadnessBadguy.currentTruck.myGirth) + 50))) {
targetList.push(MadnessBadguy.currentTruck);
}
}
}
if ((MadnessBadguy.currentCiv != undefined) && (MadnessBadguy.currentCiv.myHealth > 0)) {
if ((myGun == "grenade") && (SwainMath.get_distance(_parent.playerAim, MadnessBadguy.currentCiv) < gunRangeX)) {
targetList.push(MadnessBadguy.currentCiv);
} else if ((MadnessBadguy.currentCiv.track_pos > ((track_pos - 8) - (4 * positionOFFSET))) && (MadnessBadguy.currentCiv.track_pos < ((track_pos + gunRangeY) - (20 * positionOFFSET)))) {
if ((MadnessBadguy.currentCiv.my_endpoint > (((my_endpoint - gunRangeX) - MadnessBadguy.currentCiv.myGirth) + 35)) && (MadnessBadguy.currentCiv.my_endpoint < (((my_endpoint + gunRangeX) + MadnessBadguy.currentCiv.myGirth) + 35))) {
targetList.push(MadnessBadguy.currentCiv);
}
}
}
if (((myGun == "default") || (myGun == "auto")) || (myGun == "invincible")) {
targetDistance = track_pos + 10000000000;
_local3 = 0;
while (_local3 < targetList.length) {
if (targetList[_local3].track_pos > targetDistance) {
targetDistance = targetList[_local3].track_post;
targetCurrent = _local3;
}
_local3++;
}
if (targetList[targetCurrent].myHealth > 0) {
_parent.makeDebris("burst", false, targetList[targetCurrent].track_pos - 2, my_endpoint, targetList[targetCurrent].my_speed * 0.7);
targetList[targetCurrent].myHealth = targetList[targetCurrent].myHealth - myDamage;
targetList[targetCurrent].colorTimer = 0;
if (targetList[targetCurrent].myHealth < 0) {
targetList[targetCurrent].myHealth = 0;
}
if (targetList[targetCurrent] == MadnessBadguy.currentTruck) {
if ((my_endpoint < (MadnessBadguy.currentTruck.my_endpoint - 175)) && (MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter1.amShooting == true)) {
MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter1.myHealth = MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter1.myHealth - myDamage;
}
if ((my_endpoint > (MadnessBadguy.currentTruck.my_endpoint + 140)) && (MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter2.amShooting == true)) {
MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter2.myHealth = MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter2.myHealth - myDamage;
}
}
}
} else if ((myGun == "shotgun") || (myGun == "grenade")) {
if (myGun == "grenade") {
_parent.makeDebris("explosion_big", false, _parent.playerAim.track_pos, _parent.playerAim.my_endpoint, my_relative_speed * 0.8);
}
_local3 = 0;
while (_local3 < targetList.length) {
_parent.makeDebris("burst", false, targetList[_local3].track_pos - 2, my_endpoint, targetList[_local3].my_speed * 0.7);
targetList[_local3].myHealth = targetList[_local3].myHealth - myDamage;
targetList[_local3].colorTimer = 0;
if (targetList[_local3].myHealth < 0) {
targetList[_local3].myHealth = 0;
}
if (targetList[_local3] == MadnessBadguy.currentTruck) {
if ((my_endpoint < (MadnessBadguy.currentTruck.my_endpoint - 175)) && (MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter1.amShooting == true)) {
MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter1.myHealth = MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter1.myHealth - myDamage;
}
if ((my_endpoint > (MadnessBadguy.currentTruck.my_endpoint + 140)) && (MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter2.amShooting == true)) {
MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter2.myHealth = MadnessBadguy.currentTruck.mySprite.spriteCar.spriteTactics.shooter2.myHealth - myDamage;
}
}
_local3++;
}
}
}
if (_root.mouse_down == false) {
act = "running";
}
if (((_x < target_x) && (_x > x_was)) || ((_x > target_x) && (_x < x_was))) {
damageGrabber("left", 5);
damageGrabber("right", 5);
}
if (((_y < target_y) && (_y > y_was)) || ((_y > target_y) && (_y < y_was))) {
damageGrabber("front", 5);
}
if ((grabberLeftHealth > 0) || (grabberRightHealth > 0)) {
grabDamageTimer++;
} else {
grabDamageTimer = 0;
}
if (((grabDamageTimer > 20) && ((grabberLeftHealth > 0) || (grabberRightHealth > 0))) || (((grabDamageTimer > 10) && (grabberLeftHealth > 0)) && (grabberRightHealth > 0))) {
grabDamageTimer = 0;
if (invincibleTimer <= 0) {
myHealth = myHealth - 1;
_parent.hunter.colorTimer = 0;
_root.playAudio("hit3", "sound_impacts");
}
}
if (invincibleTimer > 0) {
damageGrabber("left", 9999);
damageGrabber("right", 9999);
damageGrabber("front", 9999);
}
if ((gameOverSpeed < 1) && (gameOverSpeed > 0)) {
gameOverSpeed = gameOverSpeed - 0.01;
}
if (myHealth <= 0) {
if (gameOverSpeed == 1) {
gameOverSpeed = 0.99;
}
}
if (gameOverSpeed <= 0) {
if (_root.gameoverDisplay == undefined) {
_root.createDisplay("gameover");
_parent.totalKills = _parent.totalKills + _parent.waveKills;
_root.totalPoints = _root.totalPoints + (Math.floor(Number(milesTraveled) - Number(_parent.previousMiles)) + Number(_parent.waveKills));
_root.gameoverDisplay.val5 = _parent.totalKills;
_root.gameoverDisplay.val6 = _root.totalPoints;
}
gameOverSpeed = 0;
mySprite.stop();
mySprite.myCar.stop();
mySprite.myCar.window.stop();
mySprite.dirt1._visible = false;
mySprite.dirt2._visible = false;
mySprite.dirt3._visible = false;
mySprite.tires1.stop();
mySprite.tires2.stop();
gameOverTimer++;
if (gameOverTimer >= 20) {
gameOverTimer = 0;
}
}
my_relative_speed = (my_speed + (0.5 * (my_speed * (1 - (((_y - y_plane) + 30) / 60))))) * invincibleSpeed;
if (act == "shooting") {
if (my_relative_speed > (my_speed * 0.75)) {
}
}
track_pos = track_pos + (my_relative_speed * gameOverSpeed);
gotoAndStop("pose_" + Math.ceil(0.5 + (((my_endpoint - _parent.leftBorder) / (_parent.rightBorder - _parent.leftBorder)) * 8)));
if (braking && (gameOverSpeed == 1)) {
brake1._visible = true;
brake2._visible = true;
} else {
brake1._visible = false;
brake2._visible = false;
}
if (_root.mouse_down == true) {
aimTimer++;
if (aimTimer > 20) {
aimTimer = 20;
}
} else {
aimTimer = 1;
}
if (myGun == "shotgun") {
myAim2._rotation = SwainMath.calculate_rotation(_x, _y, _parent.playerAim._x, _parent.playerAim._y);
myAim2.gotoAndStop(aimTimer);
myAim._visible = false;
myAim2._visible = true;
} else {
myAim._rotation = SwainMath.calculate_rotation(_x, _y, _parent.playerAim._x, _parent.playerAim._y);
myAim.gotoAndStop(aimTimer);
myAim2._visible = false;
myAim._visible = true;
}
if (grabberLeftHealth > 0) {
grabLeft._visible = true;
} else {
grabLeft._visible = false;
}
if (grabberRightHealth > 0) {
grabRight._visible = true;
} else {
grabRight._visible = false;
}
if (grabberFrontHealth > 0) {
grabFront._visible = true;
throwFront._visible = false;
myChar._visible = false;
myShoot._visible = false;
throwTimer = 0;
} else if (throwTimer < 9) {
throwTimer++;
grabFront._visible = false;
throwFront._visible = true;
throwFront.gotoAndStop(throwTimer);
myChar._visible = false;
myShoot._visible = false;
} else {
grabFront._visible = false;
throwFront._visible = false;
if ((myROFTimer <= myROF) && (myROFTimer <= 6)) {
myChar._visible = false;
myShoot._visible = true;
myShoot.gotoAndStop(myGun);
myShoot.shootSprite.gotoAndStop(myROFTimer);
} else {
myChar._visible = true;
myShoot._visible = false;
}
}
if (bloodLevelA > 180) {
bloodLevelA = 180;
}
if (bloodLevelB > 180) {
bloodLevelB = 180;
}
if (bloodLevelA > 0) {
bloodLevelA = bloodLevelA - 2;
}
if (bloodLevelB > 0) {
bloodLevelB = bloodLevelB - 2;
}
mySprite.myCar.bloodA._alpha = bloodLevelA;
mySprite.myCar.bloodB._alpha = bloodLevelB;
mySprite.myCar.damageSprite._alpha = 100 - (100 * (myHealth / myHealthMax));
if ((((target_x - _x) / my_speed) + myBumpX) < -12) {
_root.UI.blinker1.play();
} else if (gameOverSpeed != 0) {
_root.UI.blinker1.gotoAndPlay(1);
}
if ((((target_x - _x) / my_speed) + myBumpX) > 12) {
_root.UI.blinker2.play();
} else if (gameOverSpeed != 0) {
_root.UI.blinker2.gotoAndPlay(1);
}
_root.UI.mph.mphText.text = Math.floor((my_relative_speed * 3.7) * gameOverSpeed);
if ((myGun == "default") || (myGun == "invincible")) {
_root.UI.ammo.gotoAndStop(2);
} else {
_root.UI.ammo.gotoAndStop(1);
}
_root.UI.ammo.ammoText.text = myAmmo;
if ((myHealth / myHealthMax) >= 0.85) {
_root.UI.health1.gotoAndStop(1);
_root.UI.health2.gotoAndStop(6);
_root.UI.health3.gotoAndStop(6);
} else if ((myHealth / myHealthMax) >= 0.7) {
_root.UI.health1.play();
_root.UI.health2.gotoAndStop(6);
_root.UI.health3.gotoAndStop(6);
} else if ((myHealth / myHealthMax) >= 0.55) {
_root.UI.health1.gotoAndStop(6);
_root.UI.health2.gotoAndStop(1);
_root.UI.health3.gotoAndStop(6);
} else if ((myHealth / myHealthMax) >= 0.4) {
_root.UI.health1.gotoAndStop(6);
_root.UI.health2.play();
_root.UI.health3.gotoAndStop(6);
} else if ((myHealth / myHealthMax) >= 0.25) {
_root.UI.health1.gotoAndStop(6);
_root.UI.health2.gotoAndStop(6);
_root.UI.health3.gotoAndStop(1);
} else {
_root.UI.health1.gotoAndStop(6);
_root.UI.health2.gotoAndStop(6);
_root.UI.health3.play();
}
milesTraveled = Math.floor(track_pos / 5) / 400;
_root.UI.odometer.num1._y = 230 - (200 * (milesTraveled - Math.floor(milesTraveled)));
var _local3 = 2;
while (_local3 <= 13) {
_root.UI.odometer["num" + String(_local3)]._y = 230 - (Math.floor(10 * ((milesTraveled / Math.pow(10, _local3 - 1)) - Math.floor(milesTraveled / Math.pow(10, _local3 - 1)))) * 20);
if (_root.UI.odometer["num" + String(_local3 - 1)]._y < 50) {
_root.UI.odometer["num" + String(_local3)]._y = _root.UI.odometer["num" + String(_local3)]._y - (50 - _root.UI.odometer["num" + String(_local3 - 1)]._y);
}
_local3++;
}
if (MadnessBadguy.currentTruck == undefined) {
_root.UI.sensor.myBar._xscale = 0;
_root.UI.sensor.boss._visible = false;
} else {
_root.UI.sensor.myBar._xscale = 100 * ((MadnessBadguy.currentTruck.track_pos - track_pos) / _root.spawn_distance);
_root.UI.sensor.boss._visible = true;
_root.UI.sensor.boss._x = _root.UI.sensor.myBar._x + (144 * ((MadnessBadguy.currentTruck.track_pos - track_pos) / _root.spawn_distance));
if (_root.UI.sensor.boss._x > (_root.UI.sensor.myBar._x + 144)) {
_root.UI.sensor.boss._x = _root.UI.sensor.myBar._x + 144;
}
}
if (gameOverSpeed < 1) {
smokeTimer++;
mySprite.myCar.myHood._visible = true;
if (smokeTimer > 30) {
smokeTimer = 1;
}
mySprite.myCar.myHood.mySmoke.gotoAndStop(smokeTimer);
} else {
mySprite.myCar.myHood._visible = false;
}
if (gameOverSpeed == 0) {
_root.UI.sensor._visible = false;
_root.UI.blinker1.play();
_root.UI.blinker2.gotoAndStop(_root.UI.blinker1._currentframe);
if (_root.UI.blinker1._currentframe >= 5) {
brake1._visible = true;
brake2._visible = true;
} else {
brake1._visible = false;
brake2._visible = false;
}
_root.UI.health3.gotoAndStop(5);
}
colorTimer++;
if (colorTimer < 10) {
myColorTransform = {rb:255 / colorTimer, gb:0, bb:0};
myColor.setTransform(myColorTransform);
} else {
myColorTransform = {rb:0 / colorTimer, gb:0, bb:0};
myColor.setTransform(myColorTransform);
}
if (invincibleTimer >= 20) {
mySprite.myCar.myArmor._visible = true;
mySprite.myCar.myArmor._alpha = 100;
} else {
if (invincibleTimer < 20) {
mySprite.myCar.myArmor._alpha = invincibleTimer * 5;
}
if (mySprite.myCar.myArmor._alpha <= 0) {
mySprite.myCar.myArmor._alpha = 0;
mySprite.myCar.myArmor._visible = false;
} else {
mySprite.myCar.myArmor._visible = true;
}
}
if (sparkTimerFront > 0) {
sparkTimerFront--;
sparkFront._visible = true;
sparkFront._alpha = sparkTimerFront * 20;
} else {
sparkFront._visible = false;
}
if (sparkTimerLeft > 0) {
sparkTimerLeft--;
sparkLeft._visible = true;
sparkLeft._alpha = sparkTimerLeft * 20;
} else {
sparkLeft._visible = false;
}
if (sparkTimerRight > 0) {
sparkTimerRight--;
sparkRight._visible = true;
sparkRight._alpha = sparkTimerRight * 20;
} else {
sparkRight._visible = false;
}
if ((_root.completeDisplay != undefined) || (gameOverSpeed < 0.5)) {
damageGrabber("left", 100000000);
damageGrabber("right", 100000000);
damageGrabber("front", 100000000);
}
_root.object_scale_finder(this);
_parent.adjustDepth(this);
_root.debrisText.text = MadnessDebris.debrisAll.length;
_root.chuteText.text = MadnessBadguy.allChutes.length;
}
}
function fire_weapon(this_mc, charge_time) {
_root.shoot_arrow(this_mc, charge_time);
}
function damageGrabber(inDir, inDamage) {
if ((inDir == "left") && (grabberLeftHealth > 0)) {
grabberLeftHealth = grabberLeftHealth - inDamage;
if (grabberLeftHealth <= 0) {
_parent.makeDebris("agent", false, track_pos + 5, my_endpoint - myGirth, my_relative_speed + 1);
}
}
if ((inDir == "right") && (grabberRightHealth > 0)) {
grabberRightHealth = grabberRightHealth - inDamage;
if (grabberRightHealth <= 0) {
_parent.makeDebris("agent", false, track_pos + 5, my_endpoint + myGirth, my_relative_speed + 1);
}
}
if ((inDir == "front") && (grabberFrontHealth > 0)) {
grabberFrontHealth = grabberFrontHealth - inDamage;
if (grabberFrontHealth <= 0) {
_parent.makeDebris("zombie_fall", false, track_pos + 5, my_endpoint + 20, my_relative_speed + 10);
}
}
}
function activateImpact(inType) {
if (inType == "spray") {
if (mySpray._visible == false) {
mySpray.gotoAndPlay(2);
mySpray._visible = true;
}
}
}
function equipGun(inGun) {
if (inGun == "default") {
myAmmo = 24;
myDamage = 30;
myROF = 15;
gunRangeY = 200;
gunRangeX = 40;
myGun = inGun;
}
if ((inGun == "shotgun") && (myGun != "invincible")) {
myAmmo = 12;
myDamage = 31;
myROF = 20;
gunRangeY = 180;
gunRangeX = 200;
myGun = inGun;
}
if ((inGun == "auto") && (myGun != "invincible")) {
myAmmo = 60;
myDamage = 20;
myROF = 5;
gunRangeY = 200;
gunRangeX = 40;
myGun = inGun;
}
if ((inGun == "grenade") && (myGun != "invincible")) {
myAmmo = 8;
myDamage = 70;
myROF = 45;
gunRangeY = 180;
gunRangeX = 130;
myGun = inGun;
}
if ((inGun == "invincible") && (myGun != "invincible")) {
myAmmo = 8;
myDamage = 10;
myROF = 4;
gunRangeY = 200;
gunRangeX = 40;
myGun = inGun;
}
}
var act = "standing";
var my_endpoint = new Number();
var myType = "hunter";
var braking = new Boolean();
var y_was = new Number();
var x_was = new Number();
var track_pos = 0;
var my_speed = 14;
var my_relative_speed = 6;
var x_min = 100;
var x_max = 380;
var y_min = 1;
var y_max = 1;
var mouse_width = 280;
var left_limit = new Number();
var right_limit = new Number();
var path_width = new Number();
var y_plane = new Number();
var target_x = new Number();
var target_y = new Number();
var myROF = new Number();
var myROFTimer = new Number();
var gunRangeX = new Number();
var gunRangeY = new Number();
var myGun = new String();
var myAmmo = new Number();
var myDamage = new Number();
var aimTimer = new Number();
var myGirth = new Number();
var myLength = new Number();
var myBumpX = new Number();
var myBumpY = new Number();
var track_OFFSET = new Number();
var positionOFFSET = new Number();
var targetList = new Array();
var targetDistance = new Number();
var targetCurrent = new Number();
var grabberLeftHealth = new Number();
var grabberRightHealth = new Number();
var grabberFrontHealth = new Number();
var grabDamageTimer = new Number();
var bloodLevelA = new Number();
var bloodLevelB = new Number();
var myHealth = new Number();
var myHealthMax = new Number();
var milesTraveled = new Number();
var gameOverSpeed = new Number();
var gameOverTimer = new Number();
var realMouseX = new Number();
var realMouseY = new Number();
var shakeWarning1 = false;
var shakeWarning2 = false;
var throwTimer = 9;
var myColorTransform = new Object();
var colorTimer = new Number();
var invincibleTimer = new Number();
var invincibleSpeed = new Number();
var sparkTimerFront = new Number();
var sparkTimerLeft = new Number();
var sparkTimerRight = new Number();
var smokeTimer = new Number();
var ramWarning = new Boolean();
var healthWarning = new Boolean();
var pistolKills = new Number();
var zombieKills = new Number();
var zombieTarget = new Number();
var gameOverSound = new Boolean();
}
Symbol 1363 MovieClip [__Packages.MadWorld] Frame 0
class MadWorld extends MovieClip
{
var onEnterFrame, hunter, _x, _y, skyIntro, debrisContainer, _rotation, _xscale, _yscale, horizon_line, attachMovie, getNextHighestDepth, BG_Plane;
function MadWorld () {
super();
onEnterFrame = tick;
}
function init() {
MadnessBadguy.allBikes = new Array();
MadnessBadguy.allChutes = new Array();
MadnessBadguy.currentCiv = undefined;
MadnessBadguy.currentJesus = undefined;
MadnessBadguy.currentTruck = undefined;
MadnessBadguy.playerAim = undefined;
hunter.swapDepths(100);
hunter.gotoAndStop("pose_5");
hunter.mySprite.myCar.damageSprite._alpha = 0;
hunter.mySprite.myCar.bloodA._alpha = 0;
hunter.mySprite.myCar.bloodB._alpha = 0;
hunter.throwFront.gotoAndStop(1);
hunter.myAim2.gotoAndStop(1);
hunter.myAim.gotoAndStop(1);
hunter.mySprite.myCar.myHood._visible = false;
hunter.grabLeft._visible = false;
hunter.grabRight._visible = false;
hunter.grabFront._visible = false;
hunter.throwFront._visible = false;
hunter.myShoot._visible = false;
hunter.sparkRight._visible = false;
hunter.sparkLeft._visible = false;
hunter.sparkFront._visible = false;
hunter._y = 650;
_root.UI._alpha = 0;
playerPause = true;
default_x = _x;
default_y = _y;
left_limit = _root.world_mc.x_min._x;
right_limit = _root.world_mc.x_max._x;
}
function tick() {
if (startupTimer != -1) {
startupTimer++;
if (!_root.startTransition.cueMotion) {
_y = default_y + 1150;
} else {
if (_y != default_y) {
if (introPanMult < 1) {
introPanMult = introPanMult + 0.05;
}
_y = _y - ((_y - default_y) * (0.07 * introPanMult));
}
if (_y < (default_y + 1)) {
_y = default_y;
skyIntro._visible = false;
}
}
if (startupTimer == (_root.startTransition._totalframes - 15)) {
while (MadnessBadguy.allBikes.length < 3) {
makeBadGuy("bike", "agent", SwainMath.randomNumber(-60, -40));
}
_root.playAudio("spawn2", "sound_cars");
}
if (startupTimer == (_root.startTransition._totalframes - 8)) {
_root.shake_camera = 15;
makeBadGuy("aim", "none", SwainMath.randomNumber(100, 100));
}
if (startupTimer > (_root.startTransition._totalframes + 30)) {
hunter._y = hunter._y - 54;
if (hunter._y <= 220) {
hunter._y = 220;
playerPause = false;
}
_root.object_scale_finder(hunter);
}
if (!playerPause) {
_root.UI._alpha = _root.UI._alpha + 10;
}
if (_root.UI._alpha >= 100) {
_root.UI._alpha = 100;
startupTimer = -1;
}
wavePause = false;
}
regulateWaves();
if (startupTimer == -1) {
spawnTimer++;
}
if ((((spawnTimer > 45) && (MadnessBadguy.allBikes.length < spawnMax)) && (!wavePause)) || ((MadnessBadguy.allBikes.length < 0) && (MadnessBadguy.currentTruck == undefined))) {
if (streakKills > 8) {
_root.createDisplay("unstoppable");
if (hunter.pistolKills > 8) {
_root.unlockMedal("Sharpshooter");
}
} else if (streakKills > 6) {
_root.createDisplay("ruthless");
} else if (streakKills > 4) {
_root.createDisplay("awesome");
} else if (streakKills > 2) {
_root.createDisplay("killstreak");
}
streakKills = 0;
if ((SwainMath.randomNumber(0, 2) > 0) && (spawnAgents > 0)) {
makeBadGuy("bike", "agent", SwainMath.randomNumber(-60, -40));
spawnAgents--;
} else if (spawnSoldiers > 0) {
makeBadGuy("bike", "soldier", SwainMath.randomNumber(-60, -40));
spawnSoldiers--;
}
}
if (MadnessBadguy.currentCiv == undefined) {
makeBadGuy("bike", "civ", 3000);
}
if ((wallTimer + 100) <= hunter.track_pos) {
debrisContainer.makeDebris("mountain", false, hunter.track_pos + _root.spawn_distance, -500, 0);
debrisContainer.makeDebris("cliff", false, hunter.track_pos + _root.spawn_distance, 1200, 0);
wallTimer = hunter.track_pos;
}
if ((swooshTimer + 150) <= hunter.track_pos) {
debrisContainer.makeDebris("swoosh", false, hunter.track_pos + _root.spawn_distance, 0, 0);
swooshTimer = hunter.track_pos;
}
if (SwainMath.randomNumber(0, 30) == 0) {
debrisContainer.makeDebris("nasty", false, hunter.track_pos + _root.spawn_distance, 0, 0);
}
if (playerPause) {
_rotation = 0;
} else {
_rotation = ((right_limit - (path_width / 2)) - hunter._x) / 30;
}
_x = default_x - (hunter._x / 2);
if (!playerPause) {
_y = default_y;
}
_xscale = 100;
_yscale = 100;
if (_root.world_mc.hunter.act == "shooting") {
var _local8 = 0.2;
var _local3 = 140;
var _local4 = 0;
if (_local4 > ((_local3 - 100) * 0.45)) {
_local4 = (_local3 - (((_local3 - 100) * 0.55) / (_root.mouse_down_clicked * 0.05))) - 89;
}
var _local7 = _local4;
_xscale = _xscale + _local4;
_yscale = _yscale + _local7;
if (_yscale > _local3) {
_yscale = _local3;
}
if (_xscale > _local3) {
_xscale = _local3;
}
var _local5 = (((_yscale * 0.01) - 1) * (_root.world_mc.x_min._y - horizon_line._y)) / 2.5;
var _local6 = ((_xscale * 0.01) - 1) * ((right_limit - (path_width / 1.3)) - (horizon_line._x * 2.5));
_x = _x + _local6;
_y = _y + _local5;
}
if (_root.shake_camera > 0) {
if (_root.shake_camera > 80) {
_root.shake_camera = 80;
}
_x = _x + (Math.floor(Math.random() * ((_root.shake_camera - (_root.shake_camera * -1)) + 1)) + (_root.shake_camera * -1));
_y = _y + (Math.floor(Math.random() * ((_root.shake_camera - (_root.shake_camera * -1)) + 1)) + (_root.shake_camera * -1));
_root.shake_camera = _root.shake_camera - 1.7;
if (_root.shake_camera > 30) {
_root.shake_camera = _root.shake_camera - 1.5;
}
} else {
_root.shake_camera = 0;
}
}
function move_object(this_mc) {
var _local5 = _root.world_mc.vanish_point._y;
var _local8 = _root.world_mc.endpoint_line._y;
var _local6 = _root.world_mc.y_plane._y;
var _local3 = new Number();
var _local4 = (this_mc.track_pos - _root.world_mc.hunter.track_pos) / _root.spawn_distance;
if (_local4 >= 0) {
_local3 = 1 - Math.sqrt(_local4);
} else {
_local3 = Math.pow(1 - _local4, 30);
}
var _local7 = 3;
this_mc._y = _local5 + ((_local6 - _local5) * Math.pow(_local3, _local7));
_root.adjust_object_x(this_mc);
_root.object_scale_finder(this_mc);
_root.distance_make_visible(this_mc);
_root.off_the_map_removal(this_mc);
}
function makeBadGuy(inType, inChar, inStart) {
var _local2 = attachMovie("madness_badguy", "baddie" + SwainMath.randomNumber(0, 99999999999), getNextHighestDepth());
_local2.init(inType, inChar, inStart);
}
function makeDebris(inType, inDanger, inTrack, inEndpoint, inSpeed) {
var _local2 = attachMovie("madness_debris", "debris" + SwainMath.randomNumber(0, 99999999999), getNextHighestDepth());
_local2.init(inType, inDanger, inTrack, inEndpoint, inSpeed);
}
function createJumper(inLeftSide, inType, inX, inY) {
var _local2 = attachMovie("madness_leap", "jumper" + SwainMath.randomNumber(0, 99999999999), getNextHighestDepth());
_local2.init(inLeftSide, inType, inX, inY);
}
function adjustDepth(inObject) {
if ((inObject._y < hunter._y) && (inObject.getDepth() > inObject.hunter.getDepth())) {
inObject.swapDepths(hunter);
}
var _local3 = 0;
while (_local3 < MadnessBadguy.allChutes.length) {
if ((inObject._y < MadnessBadguy.allChutes[_local3]._y) && (inObject.getDepth() > MadnessBadguy.allChutes[_local3].getDepth())) {
inObject.swapDepths(MadnessBadguy.allChutes[_local3]);
}
_local3++;
}
_local3 = 0;
while (_local3 < MadnessBadguy.allBikes.length) {
if ((inObject._y < MadnessBadguy.allBikes[_local3]._y) && (inObject.getDepth() > MadnessBadguy.allBikes[_local3].getDepth())) {
inObject.swapDepths(MadnessBadguy.allBikes[_local3]);
}
_local3++;
}
_local3 = 0;
while (_local3 < MadnessDebris.debrisAll.length) {
if ((inObject._y < MadnessDebris.debrisAll[_local3]._y) && (inObject.getDepth() > MadnessDebris.debrisAll[_local3].getDepth())) {
inObject.swapDepths(MadnessDebris.debrisAll[_local3]);
}
_local3++;
}
if ((inObject._y < MadnessBadguy.currentTruck._y) && (inObject.getDepth() > MadnessBadguy.currentTruck.getDepth())) {
inObject.swapDepths(MadnessBadguy.currentTruck);
}
if ((inObject._y < MadnessBadguy.currentJesus._y) && (inObject.getDepth() > MadnessBadguy.currentJesus.getDepth())) {
inObject.swapDepths(MadnessBadguy.currentJesus);
}
if ((inObject._y < MadnessBadguy.currentCiv._y) && (inObject.getDepth() > MadnessBadguy.currentCiv.getDepth())) {
inObject.swapDepths(MadnessBadguy.currentCiv);
}
}
function advanceWave() {
while (MadnessBadguy.allBikes.length > 0) {
MadnessBadguy.allBikes[0].myMission = "flee";
MadnessBadguy.allBikes.splice(0, 1);
}
_root.createDisplay("complete");
_root.completeDisplay.val1 = Math.floor(hunter.milesTraveled - previousMiles);
_root.completeDisplay.val2 = waveKills;
_root.completeDisplay.val3 = _root.currentWave;
_root.completeDisplay.val4 = _root.totalPoints;
_root.currentWave++;
if (_root.currentWave == 11) {
_root.unlockMedal("Improbability Drive");
}
eventTimer = 0;
totalKills = totalKills + waveKills;
waveKills = 0;
previousMiles = hunter.milesTraveled;
spawnTimer = 0;
wavePause = true;
subWave = 0;
spawnAgents = 0;
spawnSoldiers = 0;
}
function regulateWaves() {
if (_root.completeDisplay == undefined) {
spawnMax = _root.currentWave + 2;
if (_root.currentWave < 4) {
}
if (((((((startupTimer == -1) && (spawnAgents == 0)) && (spawnSoldiers == 0)) && (MadnessBadguy.currentJesus == undefined)) && (MadnessBadguy.currentTruck == undefined)) && (MadnessBadguy.allBikes.length == 0)) && (MadnessBadguy.allChutes.length == 0)) {
subWave++;
madeJesus = false;
madeChutes = false;
if (_root.currentWave == 1) {
if (subWave == 0) {
}
if (subWave == 1) {
spawnAgents = 10;
}
if (subWave == 2) {
advanceWave();
}
}
if (_root.currentWave == 2) {
if (subWave == 0) {
}
if (subWave == 1) {
spawnAgents = 13;
makeDebris("powerup_auto", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 1) {
spawnAgents = 8;
spawnSoldiers = 2;
makeDebris("powerup_health", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 2) {
spawnAgents = 20;
makeBadGuy("truck", "agent", _root.spawn_distance);
}
}
if (_root.currentWave == 3) {
if (subWave == 0) {
}
if (subWave == 1) {
spawnAgents = 14;
makeDebris("powerup_shotgun", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 2) {
makeChutes(_root.currentWave);
spawnAgents = 8;
spawnSoldiers = 3;
makeDebris("powerup_invincible", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 3) {
spawnAgents = 8;
spawnSoldiers = 3;
makeDebris("powerup_health", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 4) {
spawnAgents = 20;
spawnSoldiers = 3;
makeBadGuy("truck", "agent", _root.spawn_distance);
makeDebris("powerup_auto", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
}
if (_root.currentWave == 4) {
if (subWave == 0) {
}
if (subWave == 1) {
makeChutes(_root.currentWave);
spawnAgents = 10;
spawnSoldiers = 5;
makeDebris("powerup_grenade", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 2) {
makeChutes(_root.currentWave);
spawnSoldiers = 6;
makeDebris("powerup_health", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 3) {
spawnAgents = 12;
spawnSoldiers = 5;
makeDebris("powerup_shotgun", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 4) {
makeChutes(_root.currentWave);
spawnAgents = 20;
spawnSoldiers = 5;
makeBadGuy("truck", "agent", _root.spawn_distance);
makeDebris("powerup_auto", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
}
if (_root.currentWave == 5) {
if (subWave == 0) {
}
if (subWave == 1) {
spawnAgents = 5;
makeDebris("powerup_shotgun", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 2) {
_root.world_mc.makeBadGuy("jesus", "none", 50);
spawnAgents = 20;
spawnSoldiers = 10;
makeDebris("powerup_auto", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 3) {
spawnAgents = 20;
makeDebris("powerup_health", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 4) {
spawnAgents = 30;
spawnSoldiers = 18;
makeBadGuy("truck", "agent", _root.spawn_distance);
makeDebris("powerup_grenade", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
}
if (_root.currentWave == 6) {
if (subWave == 0) {
}
if (subWave == 1) {
spawnAgents = 35;
spawnSoldiers = 12;
makeDebris("powerup_invincible", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 2) {
spawnAgents = 35;
spawnSoldiers = 12;
makeDebris("powerup_auto", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 3) {
spawnAgents = 35;
spawnSoldiers = 22;
makeBadGuy("truck", "agent", _root.spawn_distance);
}
}
if (_root.currentWave == 7) {
if (subWave == 0) {
}
if (subWave == 1) {
spawnAgents = 35;
spawnSoldiers = 15;
makeDebris("powerup_shotgun", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 2) {
spawnAgents = 35;
spawnSoldiers = 15;
makeDebris("powerup_auto", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 3) {
spawnAgents = 35;
spawnSoldiers = 15;
makeDebris("powerup_health", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 4) {
spawnAgents = 40;
spawnSoldiers = 20;
makeBadGuy("truck", "agent", _root.spawn_distance);
}
}
if (_root.currentWave == 8) {
if (subWave == 0) {
}
if (subWave == 1) {
spawnAgents = 40;
spawnSoldiers = 16;
makeDebris("powerup_auto", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 2) {
spawnAgents = 40;
spawnSoldiers = 16;
makeDebris("powerup_health", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 3) {
spawnAgents = 40;
spawnSoldiers = 16;
makeDebris("powerup_shotgun", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 4) {
spawnAgents = 40;
spawnSoldiers = 30;
makeBadGuy("truck", "agent", _root.spawn_distance);
makeDebris("powerup_grenade", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
}
if (_root.currentWave == 9) {
if (subWave == 0) {
}
if (subWave == 1) {
spawnAgents = 25;
spawnSoldiers = 20;
makeDebris("powerup_health", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 2) {
spawnAgents = 25;
spawnSoldiers = 20;
makeDebris("powerup_invincible", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 3) {
spawnAgents = 25;
spawnSoldiers = 20;
makeDebris("powerup_auto", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
if (subWave == 4) {
spawnAgents = 25;
spawnSoldiers = 20;
makeBadGuy("truck", "agent", _root.spawn_distance);
makeDebris("powerup_grenade", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
}
if (_root.currentWave >= 10) {
if (subWave == 1) {
spawnAgents = 25 + (_root.currentWave * 2);
spawnSoldiers = _root.currentWave * 2;
}
if (subWave == 2) {
spawnAgents = 25 + (_root.currentWave * 2);
spawnSoldiers = _root.currentWave * 2;
if (SwainMath.randomNumber(0, 2) == 0) {
makeDebris("powerup_auto", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
} else if (SwainMath.randomNumber(0, 1) == 0) {
makeDebris("powerup_shotgun", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
} else {
makeDebris("powerup_grenade", false, hunter.track_pos + 1200, SwainMath.randomNumber(leftBorder, rightBorder), 10);
}
}
if (subWave == 3) {
spawnAgents = 25 + (_root.currentWave * 3);
spawnSoldiers = _root.currentWave * 3;
makeBadGuy("truck", "agent", _root.spawn_distance);
}
}
}
if (((((_root.currentWave == 5) && (subWave == 2)) || ((_root.currentWave == 6) && ((subWave == 1) || (subWave == 3)))) || ((_root.currentWave == 8) && ((subWave == 2) || (subWave == 4)))) || ((_root.currentWave >= 9) && ((subWave == 1) || (subWave == 3)))) {
if (((eventTimer > 120) && (MadnessBadguy.allChutes.length == 0)) && (SwainMath.randomNumber(0, 200 - (_root.currentWave * 10)) == 0)) {
makeChutes(_root.currentWave);
eventTimer = 0;
}
}
if ((((((_root.currentWave == 5) && (subWave == 3)) || ((_root.currentWave == 6) && (subWave == 2))) || (_root.currentWave == 7)) || ((_root.currentWave == 8) && (subWave == 3))) || ((_root.currentWave >= 9) && ((subWave == 2) || (subWave == 4)))) {
if ((((eventTimer > 120) && (MadnessBadguy.currentJesus == undefined)) && (MadnessDebris.zombiesAll.length == 0)) && ((_root.currentWave > 12) || (SwainMath.randomNumber(0, 200 - (_root.currentWave * 10)) == 0))) {
_root.world_mc.makeBadGuy("jesus", "none", 50);
eventTimer = 0;
}
}
if (!wavePause) {
eventTimer++;
}
if ((((SwainMath.randomNumber(0, 30) == 0) && (!playerPause)) && (obstacleTimer > (90 - (_root.currentWave * 3)))) && (!wavePause)) {
startPos = hunter.track_pos + 1500;
var _local3 = 0;
while (_local3 < (_root.currentWave + 1)) {
makeDebris(obstacleArray[SwainMath.randomNumber(0, 2)], false, startPos, SwainMath.randomNumber(leftBorder, rightBorder), 0);
startPos = startPos + SwainMath.randomNumber(300 - (_root.currentWave * 3), 600 - (_root.currentWave * 6));
_local3++;
}
obstacleTimer = 0;
}
if (((SwainMath.randomNumber(0, 420) == 0) && (!playerPause)) && (!wavePause)) {
startPos = hunter.track_pos + 1500;
var _local4 = SwainMath.randomNumber(leftBorder, rightBorder);
var _local3 = 0;
while (_local3 < 5) {
makeDebris("cone", false, startPos, _local4, 0);
startPos = startPos + 40;
_local3++;
}
}
if (hunter.track_pos > startPos) {
obstacleTimer++;
}
}
}
function makeChutes(inChutes) {
BG_Plane.gotoAndPlay(2);
var _local3 = 2300;
var _local2 = 0;
while (_local2 < inChutes) {
makeBadGuy("chute", "agent", _local3);
_local3 = _local3 + SwainMath.randomNumber(250, 400);
_local2++;
}
}
function createBullet(sourceX, sourceY, destX, destY, myScale) {
var _local2 = attachMovie("bullet_anim", "bullet" + String(SwainMath.randomNumber(0, 999999999999)), getNextHighestDepth());
_local2._x = sourceX;
_local2._y = sourceY;
_local2._rotation = SwainMath.calculate_rotation(sourceX, sourceY, destX, destY);
_local2._xscale = myScale;
_local2._yscale = myScale;
}
var shake_camera = 0;
var default_speed = 100;
var spawn_distance = 600;
var game_started = false;
var game_ended = false;
var leftBorder = -450;
var rightBorder = 450;
var debrisTimer = new Number();
var wallTimer = new Number();
var swooshTimer = new Number();
var cliffTimer = new Number();
var default_x = new Number();
var default_y = new Number();
var left_limit = new Number();
var right_limit = new Number();
var path_width = 410;
var startupTimer = new Number();
var playerPause = new Boolean();
var spawnAgents = new Number();
var spawnSoldiers = new Number();
var spawnTimer = new Number();
var spawnMax = new Number();
var streakKills = new Number();
var waveKills = new Number();
var totalKills = new Number();
var previousMiles = new Number();
var wavePause = new Boolean();
var subWave = new Number();
var madeJesus = new Boolean();
var madeChutes = new Boolean();
var introPanMult = new Number();
var eventTimer = new Number();
var obstacleTimer = new Number();
var obstacleArray = ["cone", "roadblock", "rock"];
var startPos = new Number();
}
Symbol 1137 MovieClip [__Packages.com.newgrounds.components.FlashAdBase] Frame 0
class com.newgrounds.components.FlashAdBase extends MovieClip
{
var _x, _y, stop, onUnload, _adListener, adContainer, newgroundsButton, _showBorder, _ad, gotoAndStop, _adFeedLoader;
function FlashAdBase () {
super();
try {
System.security.allowDomain("server.cpmstar.com");
System.security.allowInsecureDomain("server.cpmstar.com");
} catch(error) {
}
_x = int(_x);
_y = int(_y);
stop();
if (_newgroundsButton) {
_newgroundsButton.onRelease = onNGClick;
}
onUnload = removeAd;
var _local4 = this;
_adListener = {onLoadError:function (target, error, httpStatus) {
target._parent.onAdError(target, error, httpStatus);
}};
if (com.newgrounds.API.__get__adFeedURL()) {
loadAdFeed();
} else {
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.API_CONNECTED, {target:this, func:loadAdFeed});
}
}
function get _adContainer() {
return(adContainer);
}
function get _newgroundsButton() {
return(newgroundsButton);
}
function get showBorder() {
return(_showBorder);
}
function set showBorder(value) {
_showBorder = value;
if (_showBorder) {
if (_ad) {
var _local2 = _ad.getProgress(_adContainer);
if (_local2.bytesLoaded >= _local2.bytesTotal) {
gotoAndStop("loaded");
} else {
gotoAndStop("loading");
}
} else {
gotoAndStop("idle");
}
} else {
gotoAndStop("noBorder");
}
//return(showBorder);
}
function loadAdFeed(event) {
if (event == undefined) {
event = null;
}
_adFeedLoader = new LoadVars();
var target = this;
_adFeedLoader.onData = function (data) {
target.onAdFeedLoaded(data);
};
_adFeedLoader.load(com.newgrounds.API.__get__adFeedURL(), _adFeedLoader);
}
function onAdFeedLoaded(data) {
if (data && (data != "")) {
loadAd(data);
} else {
onAdError();
}
}
function loadAd(adURL) {
_ad = new MovieClipLoader();
_ad.addListener(_adListener);
_adContainer._lockroot = true;
_ad.loadClip(adURL, _adContainer);
}
function removeAd() {
_adFeedLoader.onData = null;
_adFeedLoader = null;
_ad.removeListener(_adListener);
if (_adContainer) {
_ad.unloadClip(_adContainer);
}
_ad = null;
}
function onAdError(target, error, httpStatus) {
com.newgrounds.Logger.logError("Unable to load ad.");
removeAd();
}
function onNGClick() {
com.newgrounds.API.loadNewgrounds();
}
}
Symbol 1109 MovieClip [__Packages.com.newgrounds.shims.APIShim] Frame 0
class com.newgrounds.shims.APIShim extends MovieClip
{
function APIShim () {
super();
}
}
Symbol 1122 MovieClip [__Packages.com.newgrounds.crypto.MD5] Frame 0
class com.newgrounds.crypto.MD5
{
function MD5 () {
}
static function hash(src) {
return(hex_md5(src));
}
static function hex_md5(src) {
return(binl2hex(core_md5(str2binl(src), src.length * 8)));
}
static function core_md5(x, len) {
x[len >> 5] = x[len >> 5] | (128 << (len % 32));
x[(((len + 64) >>> 9) << 4) + 14] = len;
var _local4 = 1732584193 /* 0x67452301 */;
var _local3 = -271733879;
var _local2 = -1732584194;
var _local1 = 271733878 /* 0x10325476 */;
var _local5 = 0;
while (_local5 < x.length) {
var _local10 = _local4;
var _local9 = _local3;
var _local8 = _local2;
var _local7 = _local1;
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 0], 7, -680876936);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 1], 12, -389564586);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 2], 17, 606105819);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 3], 22, -1044525330);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 4], 7, -176418897);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 5], 12, 1200080426);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 6], 17, -1473231341);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 7], 22, -45705983);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 8], 7, 1770035416);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 9], 12, -1958414417);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 10], 17, -42063);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 11], 22, -1990404162);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 12], 7, 1804603682);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 13], 12, -40341101);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 14], 17, -1502002290);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 15], 22, 1236535329);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 1], 5, -165796510);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 6], 9, -1069501632);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 11], 14, 643717713);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 0], 20, -373897302);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 5], 5, -701558691);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 10], 9, 38016083);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 15], 14, -660478335);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 4], 20, -405537848);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 9], 5, 568446438);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 14], 9, -1019803690);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 3], 14, -187363961);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 8], 20, 1163531501);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 13], 5, -1444681467);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 2], 9, -51403784);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 7], 14, 1735328473);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 12], 20, -1926607734);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 5], 4, -378558);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 8], 11, -2022574463);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 11], 16, 1839030562);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 14], 23, -35309556);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 1], 4, -1530992060);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 4], 11, 1272893353);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 7], 16, -155497632);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 10], 23, -1094730640);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 13], 4, 681279174);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 0], 11, -358537222);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 3], 16, -722521979);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 6], 23, 76029189);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 9], 4, -640364487);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 12], 11, -421815835);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 15], 16, 530742520);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 2], 23, -995338651);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 0], 6, -198630844);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 7], 10, 1126891415);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 14], 15, -1416354905);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 5], 21, -57434055);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 12], 6, 1700485571);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 3], 10, -1894986606);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 10], 15, -1051523);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 1], 21, -2054922799);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 8], 6, 1873313359);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 15], 10, -30611744);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 6], 15, -1560198380);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 13], 21, 1309151649);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 4], 6, -145523070);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 11], 10, -1120210379);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 2], 15, 718787259);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 9], 21, -343485551);
_local4 = safe_add(_local4, _local10);
_local3 = safe_add(_local3, _local9);
_local2 = safe_add(_local2, _local8);
_local1 = safe_add(_local1, _local7);
_local5 = _local5 + 16;
}
return(new Array(_local4, _local3, _local2, _local1));
}
static function md5_cmn(q, a, b, x, s, t) {
return(safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b));
}
static function md5_ff(a, b, c, d, x, s, t) {
return(md5_cmn((b & c) | ((~b) & d), a, b, x, s, t));
}
static function md5_gg(a, b, c, d, x, s, t) {
return(md5_cmn((b & d) | (c & (~d)), a, b, x, s, t));
}
static function md5_hh(a, b, c, d, x, s, t) {
return(md5_cmn((b ^ c) ^ d, a, b, x, s, t));
}
static function md5_ii(a, b, c, d, x, s, t) {
return(md5_cmn(c ^ (b | (~d)), a, b, x, s, t));
}
static function bit_rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
static function safe_add(x, y) {
var _local1 = (x & 65535) + (y & 65535);
var _local2 = ((x >> 16) + (y >> 16)) + (_local1 >> 16);
return((_local2 << 16) | (_local1 & 65535));
}
static function str2binl(str) {
var _local3 = new Array();
var _local4 = 255;
var _local1 = 0;
while (_local1 < (str.length * 8)) {
_local3[_local1 >> 5] = _local3[_local1 >> 5] | ((str.charCodeAt(_local1 / 8) & _local4) << (_local1 % 32));
_local1 = _local1 + 8;
}
return(_local3);
}
static function binl2hex(binarray) {
var _local4 = new String("");
var _local3 = new String("0123456789abcdef");
var _local1 = 0;
while (_local1 < (binarray.length * 4)) {
_local4 = _local4 + (_local3.charAt((binarray[_local1 >> 2] >> (((_local1 % 4) * 8) + 4)) & 15) + _local3.charAt((binarray[_local1 >> 2] >> ((_local1 % 4) * 8)) & 15));
_local1++;
}
return(_local4);
}
}
Symbol 1123 MovieClip [__Packages.com.newgrounds.crypto.RC4] Frame 0
class com.newgrounds.crypto.RC4
{
function RC4 () {
}
static function encrypt(src, key) {
var _local3 = strToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(charsToHex(_local2));
}
static function encryptbin(src, key) {
var _local3 = strToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(_local2);
}
static function decrypt(src, key) {
var _local3 = hexToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(charsToStr(_local2));
}
static function initialize(pwd) {
var _local2 = 0;
var _local3;
var _local4 = pwd.length;
var _local1 = 0;
while (_local1 <= 255) {
mykey[_local1] = pwd[_local1 % _local4];
sbox[_local1] = _local1;
_local1++;
}
_local1 = 0;
while (_local1 <= 255) {
_local2 = ((_local2 + sbox[_local1]) + mykey[_local1]) % 256;
_local3 = sbox[_local1];
sbox[_local1] = sbox[_local2];
sbox[_local2] = _local3;
_local1++;
}
}
static function calculate(plaintxt, psw) {
initialize(psw);
var _local1 = 0;
var _local2 = 0;
var _local9 = new Array();
var _local7;
var _local5;
var _local6;
var _local3 = 0;
while (_local3 < plaintxt.length) {
_local1 = (_local1 + 1) % 256;
_local2 = (_local2 + sbox[_local1]) % 256;
_local5 = sbox[_local1];
sbox[_local1] = sbox[_local2];
sbox[_local2] = _local5;
var _local4 = (sbox[_local1] + sbox[_local2]) % 256;
_local7 = sbox[_local4];
_local6 = plaintxt[_local3] ^ _local7;
_local9.push(_local6);
_local3++;
}
return(_local9);
}
static function charsToHex(chars) {
var _local4 = new String("");
var _local3 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
var _local1 = 0;
while (_local1 < chars.length) {
_local4 = _local4 + (_local3[chars[_local1] >> 4] + _local3[chars[_local1] & 15]);
_local1++;
}
return(_local4);
}
static function hexToChars(hex) {
var _local3 = new Array();
var _local1 = ((hex.substr(0, 2) == "0x") ? 2 : 0);
while (_local1 < hex.length) {
_local3.push(parseInt(hex.substr(_local1, 2), 16));
_local1 = _local1 + 2;
}
return(_local3);
}
static function charsToStr(chars) {
var _local3 = new String("");
var _local1 = 0;
while (_local1 < chars.length) {
_local3 = _local3 + String.fromCharCode(chars[_local1]);
_local1++;
}
return(_local3);
}
static function strToChars(str) {
var _local3 = new Array();
var _local1 = 0;
while (_local1 < str.length) {
_local3.push(str.charCodeAt(_local1));
_local1++;
}
return(_local3);
}
static var sbox = new Array(255);
static var mykey = new Array(255);
}
Symbol 1124 MovieClip [__Packages.com.newgrounds.encoders.json.JSON] Frame 0
class com.newgrounds.encoders.json.JSON
{
static var start, cache, interval;
function JSON () {
}
static function encode(arg, noquotes) {
var _local3;
var _local2;
var _local6;
var _local1 = "";
var _local4;
if (arg.isSServerVar()) {
var _local8 = "sservervariable";
} else {
var _local8 = typeof(arg);
}
switch (_local8) {
case "sservervariable" :
return("?" + arg.getEncodedValue());
case "object" :
if (arg) {
if (arg instanceof Array) {
_local2 = 0;
while (_local2 < arg.length) {
_local4 = encode(arg[_local2]);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + _local4;
_local2++;
}
return(("[" + _local1) + "]");
}
if (typeof(arg.toString) != "undefined") {
for (_local2 in arg) {
_local4 = arg[_local2];
if ((typeof(_local4) != "undefined") && (typeof(_local4) != "function")) {
_local4 = encode(_local4);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + ((encode(_local2) + ":") + _local4);
}
}
return(("{" + _local1) + "}");
}
}
return("null");
case "number" :
return((isFinite(arg) ? (String(arg)) : "null"));
case "string" :
_local6 = arg.length;
if (noquotes) {
var _local7 = "";
} else {
var _local7 = "\"";
}
_local1 = _local7;
_local2 = 0;
while (_local2 < _local6) {
_local3 = arg.charAt(_local2);
if (_local3 >= " ") {
if ((_local3 == "\\") || (_local3 == "\"")) {
_local1 = _local1 + "\\";
}
_local1 = _local1 + _local3;
} else {
switch (_local3) {
case "\b" :
_local1 = _local1 + "\\b";
break;
case "\f" :
_local1 = _local1 + "\\f";
break;
case newline :
_local1 = _local1 + "\\n";
break;
case "\r" :
_local1 = _local1 + "\\r";
break;
case "\t" :
_local1 = _local1 + "\\t";
break;
default :
_local3 = _local3.charCodeAt();
_local1 = _local1 + (("\\u00" + Math.floor(_local3 / 16).toString(16)) + (_local3 % 16).toString(16));
}
}
_local2 = _local2 + 1;
}
return(_local1 + _local7);
case "boolean" :
return(String(arg));
}
return("null");
}
static function background_encode(arg, callback) {
if (busy) {
trace("[Newgrounds Encoder] :: Cannot encode a new file until the previous file is completed");
return(false);
}
if (!callback) {
trace("[Newgrounds Encoder] :: Missing a callback function, skipping encode");
return(false);
}
busy = true;
var _local2 = new Date();
start = _local2.getTime();
cache = {busy:false, complete:false, arg:arg, target:arg, parents:[], encoded:"", callback:callback, encode_chunk:function () {
com.newgrounds.encoders.json.JSON.encode_chunk();
}};
if (getType(arg) == "object") {
cache.encoded = "{";
} else if (getType(arg) == "array") {
cache.encoded = "[";
}
interval = setInterval(cache, "encode_chunk", 25);
return(true);
}
static function background_decode(arg, callback) {
if (busy) {
trace("[Newgrounds Encoder] :: Cannot decode a new file until the previous file is completed");
return(false);
}
if (!callback) {
trace("[Newgrounds Encoder] :: Missing a callback function, skipping decode");
return(false);
}
busy = true;
var _local1 = new Date();
start = _local1.getTime();
cache = {busy:false, callback:callback, complete:false, arg:arg, pos:0, parents:["root"], target:null, scratch:"", decode_chunk:function () {
com.newgrounds.encoders.json.JSON.decode_chunk();
}};
interval = setInterval(cache, "decode_chunk", 25);
return(true);
}
static function decode(text) {
var at = 0;
var ch = " ";
var _value;
var _error = function (m) {
throw {name:"JSONError", message:m, at:at - 1, text:text};
};
var _next = function () {
ch = text.charAt(at);
at = at + 1;
return(ch);
};
var _white = function () {
while (ch) {
if (ch <= " ") {
_next();
} else if (ch == "/") {
switch (_next()) {
case "/" :
while ((_next() && (ch != newline)) && (ch != "\r")) {
}
break;
case "*" :
_next();
for(;;){
if (ch) {
if (ch == "*") {
if (_next() == "/") {
_next();
// unexpected jump
}
} else {
_next();
}
} else {
_error("Unterminated comment");
}
};
break;
default :
_error("Syntax error");
}
} else {
return;
}
}
};
var _string = function () {
var _local4;
var _local1 = "";
var _local3;
var _local2;
var _local5 = false;
if (ch == "\"") {
while (_next()) {
if (ch == "\"") {
_next();
return(_local1);
}
if (ch == "\\") {
switch (_next()) {
case "b" :
_local1 = _local1 + "\b";
break;
case "f" :
_local1 = _local1 + "\f";
break;
case "n" :
_local1 = _local1 + newline;
break;
case "r" :
_local1 = _local1 + "\r";
break;
case "t" :
_local1 = _local1 + "\t";
break;
case "u" :
_local2 = 0;
_local4 = 0;
while (_local4 < 4) {
_local3 = parseInt(_next(), 16);
if (!isFinite(_local3)) {
_local5 = true;
break;
}
_local2 = (_local2 * 16) + _local3;
_local4 = _local4 + 1;
}
if (_local5) {
_local5 = false;
break;
}
_local1 = _local1 + String.fromCharCode(_local2);
break;
default :
_local1 = _local1 + ch;
}
} else {
_local1 = _local1 + ch;
}
}
}
_error("Bad string");
};
var _array = function () {
var _local1 = [];
if (ch == "[") {
_next();
_white();
if (ch == "]") {
_next();
return(_local1);
}
while (ch) {
_local1.push(_value());
_white();
if (ch == "]") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad array");
};
var _object = function () {
var _local2;
var _local1 = {};
if (ch == "{") {
_next();
_white();
if (ch == "}") {
_next();
return(_local1);
}
while (ch) {
_local2 = _string();
_white();
if (ch != ":") {
break;
}
_next();
_local1[_local2] = _value();
_white();
if (ch == "}") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad object");
};
var _number = function () {
var _local1 = "";
var _local2;
if (ch == "-") {
_local1 = "-";
_next();
}
while ((ch >= "0") && (ch <= "9")) {
_local1 = _local1 + ch;
_next();
}
if (ch == ".") {
_local1 = _local1 + ".";
while ((_next() && (ch >= "0")) && (ch <= "9")) {
_local1 = _local1 + ch;
}
}
_local2 = 1 * _local1;
if (!isFinite(_local2)) {
_error("Bad number");
} else {
return(_local2);
}
};
var _word = function () {
switch (ch) {
case "t" :
if (((_next() == "r") && (_next() == "u")) && (_next() == "e")) {
_next();
return(true);
}
break;
case "f" :
if ((((_next() == "a") && (_next() == "l")) && (_next() == "s")) && (_next() == "e")) {
_next();
return(false);
}
break;
case "n" :
if (!(((_next() == "u") && (_next() == "l")) && (_next() == "l"))) {
break;
}
_next();
return(null);
}
_error("Syntax error");
};
_value = function () {
_white();
switch (ch) {
case "{" :
return(_object());
case "[" :
return(_array());
case "\"" :
return(_string());
case "-" :
return(_number());
}
return((((ch >= "0") && (ch <= "9")) ? (_number()) : (_word())));
};
return(_value());
}
static function getType(v) {
if (v instanceof Array) {
return("array");
}
return(typeof(v));
}
static function decode_chunk() {
if ((!cache.busy) && (!cache.complete)) {
cache.busy = true;
var _local1 = 0;
while (_local1 < decode_chunks) {
chunk_decoder();
if (cache.complete) {
break;
}
_local1++;
}
trace(Math.round((cache.pos / cache.arg.length) * 100) + "% decoded");
cache.busy = false;
}
if (cache.complete) {
var _local2 = new Date();
busy = false;
clearInterval(interval);
cache.callback(cache.root, _local2.getTime() - start);
cache.arg = "";
}
}
static function encode_chunk() {
if ((!cache.busy) && (!cache.complete)) {
cache.busy = true;
var _local1 = 0;
while (_local1 < encode_chunks) {
chunk_encoder();
if (cache.complete) {
break;
}
_local1++;
}
cache.busy = false;
}
if (cache.complete) {
var _local3 = new Date();
var _local2 = _local3.getTime();
busy = false;
clearInterval(interval);
cache.callback(cache.encoded, _local2 - start);
cache.encoded = "";
}
}
static function chunk_decoder() {
function _object() {
var _local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (!com.newgrounds.encoders.json.JSON.cache.mode) {
com.newgrounds.encoders.json.JSON.cache.mode = "object";
com.newgrounds.encoders.json.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (_local1 != "\"") {
throw "Malformed object key in encoded string. Keys must be wrapped in quotes (\"\")";
}
com.newgrounds.encoders.json.JSON.cache.scratch = "";
_setTargetValue({});
} else if (_local1 == ",") {
com.newgrounds.encoders.json.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (_local1 != "\"") {
throw "Malformed object key in encoded string. Keys must be wrapped in quotes (\"\")";
}
com.newgrounds.encoders.json.JSON.cache.scratch = "";
} else if (_local1 == "}") {
_useParent();
} else if (_local1 == "\"") {
com.newgrounds.encoders.json.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (_local1 != ":") {
throw "Malformed object notation. Object keys and values must be separated by colons(:)";
}
_addParent(com.newgrounds.encoders.json.JSON.cache.scratch);
com.newgrounds.encoders.json.JSON.cache.mode = null;
} else {
if (_local1 == "\\") {
com.newgrounds.encoders.json.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
}
com.newgrounds.encoders.json.JSON.cache.scratch = com.newgrounds.encoders.json.JSON.cache.scratch + _local1;
}
com.newgrounds.encoders.json.JSON.cache.pos++;
}
function _array() {
var _local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (!com.newgrounds.encoders.json.JSON.cache.mode) {
com.newgrounds.encoders.json.JSON.cache.mode = "array";
com.newgrounds.encoders.json.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
_setTargetValue([]);
if (_local1 != "]") {
_addArrayKey();
} else {
_useParent();
}
return(undefined);
}
if (_local1 == ",") {
_addArrayKey();
} else if (_local1 == "]") {
_useParent();
}
com.newgrounds.encoders.json.JSON.cache.pos++;
}
function _boolean() {
var _local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (_local1 == "t") {
_setTargetValue(true);
com.newgrounds.encoders.json.JSON.cache.pos = com.newgrounds.encoders.json.JSON.cache.pos + 3;
} else if (_local1 == "f") {
_setTargetValue(false);
com.newgrounds.encoders.json.JSON.cache.pos = com.newgrounds.encoders.json.JSON.cache.pos + 4;
} else {
throw "Bool values must be true or false";
}
_useParent();
}
function _null() {
var _local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (_local1 == "n") {
_setTargetValue(null);
com.newgrounds.encoders.json.JSON.cache.pos = com.newgrounds.encoders.json.JSON.cache.pos + 2;
} else {
throw "Null values must be null";
}
_useParent();
}
function _string() {
var _local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (!com.newgrounds.encoders.json.JSON.cache.mode) {
if (_local1 != "\"") {
throw "Strings must be wrapped in quotes (\"\")";
}
com.newgrounds.encoders.json.JSON.cache.scratch = "";
com.newgrounds.encoders.json.JSON.cache.mode = "string";
} else if (_local1 == "\"") {
_setTargetValue(com.newgrounds.encoders.json.JSON.cache.scratch);
_useParent();
} else {
if (_local1 == "\\") {
com.newgrounds.encoders.json.JSON.cache.pos++;
_local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
switch (_local1) {
case "n" :
_local1 = newline;
break;
case "r" :
_local1 = newline;
break;
case "t" :
_local1 = "\t";
break;
case "u" :
_local1 = "\\" + _local1;
}
}
com.newgrounds.encoders.json.JSON.cache.scratch = com.newgrounds.encoders.json.JSON.cache.scratch + _local1;
}
com.newgrounds.encoders.json.JSON.cache.pos++;
}
function _number() {
var _local1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
var _local2 = "01234567890.-";
if (!com.newgrounds.encoders.json.JSON.cache.mode) {
com.newgrounds.encoders.json.JSON.cache.mode = "number";
com.newgrounds.encoders.json.JSON.cache.scratch = "";
}
if (_local2.indexOf(_local1) < 0) {
_setTargetValue(Number(com.newgrounds.encoders.json.JSON.cache.scratch));
_useParent();
} else {
com.newgrounds.encoders.json.JSON.cache.scratch = com.newgrounds.encoders.json.JSON.cache.scratch + _local1;
com.newgrounds.encoders.json.JSON.cache.pos++;
}
}
function _setTargetValue(newval) {
var _local2 = _getParent().obj;
var _local1 = com.newgrounds.encoders.json.JSON.cache.parents[com.newgrounds.encoders.json.JSON.cache.parents.length - 1];
_local2[_local1] = newval;
}
function _useParent() {
com.newgrounds.encoders.json.JSON.cache.mode = com.newgrounds.encoders.json.JSON.getType(_getParent().obj);
com.newgrounds.encoders.json.JSON.cache.parents.pop();
}
function _getParent() {
var _local2 = com.newgrounds.encoders.json.JSON.cache;
var _local1 = 0;
while (_local1 < (com.newgrounds.encoders.json.JSON.cache.parents.length - 1)) {
_local2 = _local2[com.newgrounds.encoders.json.JSON.cache.parents[_local1]];
_local1++;
}
return({obj:_local2, name:com.newgrounds.encoders.json.JSON.cache.parents[_local1]});
}
function _getCurrent() {
var _local2 = com.newgrounds.encoders.json.JSON.cache;
var _local1 = 0;
while (_local1 < com.newgrounds.encoders.json.JSON.cache.parents.length) {
_local2 = _local2[com.newgrounds.encoders.json.JSON.cache.parents[_local1]];
_local1++;
}
return({obj:_local2, name:com.newgrounds.encoders.json.JSON.cache.parents[_local1]});
}
function _addParent(child) {
com.newgrounds.encoders.json.JSON.cache.parents.push(child);
}
function _addArrayKey() {
var _local1 = _getCurrent().obj.length;
com.newgrounds.encoders.json.JSON.cache.parents.push(_local1);
com.newgrounds.encoders.json.JSON.cache.mode = null;
}
if (cache.pos >= cache.arg.length) {
cache.complete = true;
return(undefined);
}
if (cache.mode) {
eval ("_" + cache.mode)();
} else {
var char = cache.arg.charAt(cache.pos);
switch (char) {
case "{" :
_object();
return;
case "[" :
_array();
return;
case "\"" :
_string();
return;
case "n" :
_null();
return;
case "t" :
_boolean();
return;
case "f" :
_boolean();
return;
default :
_number();
}
}
}
static function chunk_encoder() {
if (cache.complete) {
return(undefined);
}
var _local2 = getType(cache.target);
switch (_local2) {
case "number" :
cache.encoded = cache.encoded + cache.target;
getParent();
break;
case "string" :
cache.encoded = cache.encoded + (("\"" + cache.target.split("\"").join("\\\"")) + "\"");
getParent();
break;
case "boolean" :
cache.encoded = cache.encoded + ((cache.target == true) ? "true" : "false");
getParent();
break;
case "null" :
cache.encoded = cache.encoded + "null";
getParent();
break;
case "array" :
if (cache.target.length < 1) {
cache.encoded = cache.encoded + "]";
getParent();
} else {
cache.parents.push(cache.target);
cache.target = cache.target[0];
if (getType(cache.target) == "array") {
cache.encoded = cache.encoded + "[";
} else if (getType(cache.target) == "object") {
cache.encoded = cache.encoded + "{";
}
}
break;
case "object" :
for (var _local1 in cache.target) {
break;
}
if (_local1 === undefined) {
cache.encoded = cache.encoded + "}";
getParent();
} else {
cache.parents.push(cache.target);
cache.target = cache.target[_local1];
cache.encoded = cache.encoded + (("\"" + _local1.split("\"").join("\\\"")) + "\":");
if (getType(cache.target) == "array") {
cache.encoded = cache.encoded + "[";
} else if (getType(cache.target) == "object") {
cache.encoded = cache.encoded + "{";
}
}
break;
default :
cache.encoded = cache.encoded + "null";
getParent();
}
}
static function getParent() {
if (cache.parents.length > 0) {
var _local1 = cache.parents.pop();
if (getType(_local1) == "array") {
_local1.shift();
} else {
for (var _local3 in _local1) {
delete _local1[_local3];
break;
}
}
if ((getType(_local1) == "object") or (getType(_local1) == "array")) {
for (var _local2 in _local1) {
break;
}
if (!(_local2 === undefined)) {
cache.encoded = cache.encoded + ",";
}
}
cache.target = _local1;
} else {
cache.complete = true;
}
}
static var encode_chunks = 20000;
static var decode_chunks = 20000;
static var busy = false;
}
Symbol 1128 MovieClip [__Packages.com.newgrounds.Score] Frame 0
class com.newgrounds.Score
{
var _rank, _username, _score, _numericValue, _tag;
function Score (rank, username, score, numericValue, tag) {
(_rank = rank);
(_username = username);
_score = score;
_numericValue = numericValue;
_tag = tag;
}
function get numericValue() {
return(_numericValue);
}
function get rank() {
return(_rank);
}
function get score() {
return(_score);
}
function get tag() {
return(_tag);
}
function get username() {
return(_username);
}
function toString() {
return((((_rank + ".\t") + _username) + "\t") + _score);
}
}
Symbol 1206 MovieClip Frame 2
function tick() {
gotoAndStop (1);
lastPlayer = undefined;
}
onEnterFrame = tick;
Symbol 1209 Button
on (release) {
gotoAndStop ("game");
}
Symbol 1215 Button
on (release) {
getURL ("http://the-swain.newgrounds.com", "_blank");
}
Symbol 1219 Button
on (release) {
getURL ("http://luis.newgrounds.com", "_blank");
}
Symbol 1223 Button
on (release) {
getURL ("http://the-swain.newgrounds.com", "_blank");
}
Symbol 1234 Button
on (release) {
_root.gotoAndStop("game");
}
Symbol 1237 Button
on (release) {
if (_root.displayInstructions._currentframe == 1) {
_root.displayInstructions.gotoAndPlay(2);
}
}
Symbol 1240 Button
on (release) {
getURL ("http://www.newgrounds.com/collection/madness", "_blank");
}
Symbol 1242 MovieClip Frame 46
stop();
Symbol 1246 Button
on (release) {
getURL ("http://www.newgrounds.com/audio/listen/446034", "_blank");
}
Symbol 1272 MovieClip Frame 1
stop();
Symbol 1272 MovieClip Frame 6
_root.introTitle.buttonStart._visible = false;
_root.introTitle.buttonInstructions._visible = false;
_root.introTitle.buttonMoarMadness._visible = false;
Symbol 1272 MovieClip Frame 8
stop();
Symbol 1332 Button
on (press) {
_root._quality = "HIGH";
qH.gotoAndStop(2);
qM.gotoAndStop(1);
qL.gotoAndStop(1);
}
Symbol 1333 Button
on (press) {
_root._quality = "MEDIUM";
qH.gotoAndStop(1);
qM.gotoAndStop(2);
qL.gotoAndStop(1);
}
Symbol 1334 Button
on (press) {
_root._quality = "LOW";
qH.gotoAndStop(1);
qM.gotoAndStop(1);
qL.gotoAndStop(2);
}
Instance of Symbol 1327 MovieClip "qM" in Symbol 1335 MovieClip Frame 1
onClipEvent (load) {
if (_root._quality == "MEDIUM") {
gotoAndStop (2);
} else {
gotoAndStop (1);
}
}
Instance of Symbol 1327 MovieClip "qH" in Symbol 1335 MovieClip Frame 1
onClipEvent (load) {
if (_root._quality == "HIGH") {
gotoAndStop (2);
} else {
gotoAndStop (1);
}
}
Instance of Symbol 1327 MovieClip "qL" in Symbol 1335 MovieClip Frame 1
onClipEvent (load) {
if (_root._quality == "LOW") {
gotoAndStop (2);
} else {
gotoAndStop (1);
}
}
Symbol 1336 Button
on (press) {
_root.world_mc.makeBadGuy("jesus", "none", 50);
}
Symbol 1338 Button
on (press) {
world_mc.hunter.myHealth = world_mc.hunter.myHealth + 10;
if (world_mc.hunter.myHealth > world_mc.hunter.myHealthMax) {
world_mc.hunter.myHealth = world_mc.hunter.myHealthMax;
}
}
Symbol 1339 Button
on (press) {
world_mc.hunter.myHealth = world_mc.hunter.myHealth - 10;
if (world_mc.hunter.myHealth < 0) {
world_mc.hunter.myHealth = 0;
}
}
Symbol 1340 Button
on (press) {
_root.world_mc.makeBadGuy("truck", "agent", _root.spawn_distance * 0.05);
}
Symbol 1341 Button
on (press) {
_root.world_mc.BG_Plane.gotoAndPlay(2);
startTrack = 2300;
var i = 0;
while (i < 5) {
world_mc.makeBadGuy("chute", "agent", startTrack);
startTrack = startTrack + SwainMath.randomNumber(250, 400);
i++;
}
}
Symbol 1350 MovieClip Frame 1
gotoAndPlay (2);
var cueMotion = false;
Symbol 1350 MovieClip Frame 116
cueMotion = true;
Symbol 1350 MovieClip Frame 156
stop();
Symbol 1351 Button
on (press) {
_root.world_mc.hunter.equipGun("default");
}
Symbol 1352 Button
on (press) {
_root.world_mc.hunter.equipGun("shotgun");
}
Symbol 1353 Button
on (press) {
_root.world_mc.hunter.equipGun("auto");
}
Symbol 1354 Button
on (press) {
_root.world_mc.hunter.equipGun("grenade");
}
Symbol 1355 Button
on (press) {
_root.world_mc.hunter.invincibleTimer = 240;
}