Frame 1
Stage.showMenu = false;
jvs1.onRelease = function () {
getURL ("http://www.java-gaming.com", "_blank");
};
stop();
ctrbutton.onRelease = function () {
gotoAndPlay (17);
};
playbutton.onRelease = function () {
gotoAndPlay (2);
};
hscoresbutton.onRelease = function () {
gotoAndPlay (18);
};
fncbutton.onRelease = function () {
getURL ("http://www.flashninjaclan.com", "_blank");
};
Frame 2
stop();
playsounds = new Sound(this);
playsounds.attachSound("music1");
playsounds.start(0, 20000);
stop();
numwmd = 5;
i = 2;
while (i <= numwmd) {
wmd.duplicateMovieClip("wmd" + i, i + 1000, wmd);
i++;
}
life = 5;
score = 0;
lastgain = 0;
photon = 1;
bigshots = 0;
stop();
Instance of Symbol 36 MovieClip "gun" in Frame 2
onClipEvent (load) {
_root.bullets._visible = false;
_root.bigshot._visible = false;
photonshot = 0;
bigshotcount = 1;
bulletcount = 1;
photoncount = 1;
_root.photonlaser._visible = false;
}
onClipEvent (enterFrame) {
if (Key.isDown(39)) {
if (_rotation < 80) {
_rotation = (_rotation + 15);
}
}
if (Key.isDown(37)) {
if (_rotation > -80) {
_rotation = (_rotation - 15);
}
}
if (Key.isDown(32)) {
if (_root.bigshots > 0) {
_root.bigshots--;
bigshotcount++;
if ((bigshotcount % 3) == 0) {
playsounds = new Sound(this);
playsounds.attachSound("GUN1");
playsounds.start(0, 1);
_root.bigshot.duplicateMovieClip("bigshot" + bigshotcount, bigshotcount);
_root["bigshot" + bigshotcount]._visible = true;
}
} else {
bulletcount++;
if ((bulletcount % 3) == 0) {
playsounds = new Sound(this);
playsounds.attachSound("GUN1");
playsounds.start(0, 1);
_root.bullets.duplicateMovieClip("bullets" + bulletcount, bulletcount);
_root["bullets" + bulletcount]._visible = true;
}
}
}
if (Key.isDown(17)) {
if ((_root.photon > 0) && ((photonshot % 3) == 0)) {
playlaser = new Sound(this);
playlaser.attachSound("Laser");
playlaser.start(0, 1);
_root.photonlaser.duplicateMovieClip("photonlaser" + photoncount, photoncount);
_root["photonlaser" + photoncount]._visible = true;
_root.photon--;
}
photonshot++;
}
needgain = _root.lastgain + 6900;
if (_root.score > needgain) {
_root.lastgain = _root.score;
_root.life++;
_root.photon++;
}
}
Instance of Symbol 38 MovieClip "nuke" in Frame 2
onClipEvent (load) {
function reset() {
this._x = random(550);
this._y = -700;
speed = 8;
this.gotoAndPlay(1);
}
reset();
}
onClipEvent (enterFrame) {
this._y = this._y + speed;
if (this._y > 330) {
_root.life = 0;
this.removeMovieClip();
} else if ((this._y > 295) && ((this._x > 159) && (this._x < 300))) {
_root.life = 0;
this.removeMovieClip();
}
}
Instance of Symbol 41 MovieClip "wmd" in Frame 2
onClipEvent (load) {
function reset() {
randval = _root.score / 4000;
this._y = -30;
this._x = random(551);
speed = 5 + random(randval);
this.gotoAndStop(1);
lifedes = 1;
}
reset();
}
onClipEvent (enterFrame) {
this._y = this._y + speed;
if (this._y > 430) {
reset();
}
if (this._y > 340) {
if (lifedes == 1) {
_root.life = _root.life - 1;
lifedes--;
}
this.gotoAndPlay(2);
} else if ((this._y > 325) && ((this._x > 159) && (this._x < 333))) {
if (lifedes == 1) {
_root.life = _root.life - 1;
lifedes--;
}
this.gotoAndPlay(2);
}
if (_root.life == 0) {
_root.wmd.removeMovieClip();
_root.wmd1.removeMovieClip();
_root.wmd2.removeMovieClip();
_root.wmd3.removeMovieClip();
_root.wmd4.removeMovieClip();
_root.wmd5.removeMovieClip();
_root.wmd6.removeMovieClip();
_root.gotoAndPlay(5);
}
}
Instance of Symbol 44 MovieClip "bigshot" in Frame 2
onClipEvent (load) {
shotMoveSpeed = 40;
this._x = _root.gun._x + (60 * Math.sin(_root.gun._rotation * (Math.PI/180)));
this._y = _root.gun._y - (60 * Math.cos(_root.gun._rotation * (Math.PI/180)));
}
onClipEvent (enterFrame) {
if (_root.life == 0) {
this.removeMovieClip();
}
this._x = this._x + (shotMoveSpeed * Math.sin(_root.gun._rotation * (Math.PI/180)));
this._y = this._y - (shotMoveSpeed * Math.cos(_root.gun._rotation * (Math.PI/180)));
if ((this._x > 550) || (this._x < 0)) {
this.removeMovieClip();
}
if (this._y < -20) {
this.removeMovieClip();
}
if (this._name != "bigshot") {
if (this.hitTest(_root.wmd)) {
_root.score = _root.score + 100;
_root.wmd.gotoAndPlay(2);
}
i = 1;
while (i <= _root.numwmd) {
if (this.hitTest(_root["wmd" + i])) {
_root.score = _root.score + 100;
_root["wmd" + i].gotoAndPlay(2);
}
i++;
}
if (this.hitTest(_root.nuke)) {
_root.score = _root.score + 300;
_root.nuke.gotoAndPlay(2);
}
if (this.hitTest(_root.powerup)) {
_root.bigshots = _root.bigshots + 30;
_root.powerup.reset();
}
}
}
Instance of Symbol 46 MovieClip "powerup" in Frame 2
onClipEvent (load) {
function reset() {
this._y = -600;
this._x = random(550);
speed = 9;
this.gotoAndPlay(1);
}
reset();
}
onClipEvent (enterFrame) {
this._y = this._y + speed;
if (this._y > 450) {
reset();
}
if (_root.life == 0) {
this.removeMovieClip();
}
}
Instance of Symbol 48 MovieClip "bullets" in Frame 2
onClipEvent (load) {
shotMoveSpeed = 40;
this._x = _root.gun._x + (60 * Math.sin(_root.gun._rotation * (Math.PI/180)));
this._y = _root.gun._y - (60 * Math.cos(_root.gun._rotation * (Math.PI/180)));
}
onClipEvent (enterFrame) {
if (_root.life == 0) {
this.removeMovieClip();
}
this._x = this._x + (shotMoveSpeed * Math.sin(_root.gun._rotation * (Math.PI/180)));
this._y = this._y - (shotMoveSpeed * Math.cos(_root.gun._rotation * (Math.PI/180)));
if ((this._x > 570) || (this._x < -20)) {
this.removeMovieClip();
}
if (this._y < 0) {
this.removeMovieClip();
}
if (this._name != "bullets") {
if (this.hitTest(_root.wmd)) {
_root.score = _root.score + 100;
_root.wmd.gotoAndPlay(2);
}
i = 1;
while (i <= _root.numwmd) {
if (this.hitTest(_root["wmd" + i])) {
_root.score = _root.score + 100;
_root["wmd" + i].gotoAndPlay(2);
}
i++;
}
if (this.hitTest(_root.nuke)) {
_root.score = _root.score + 300;
_root.nuke.gotoAndPlay(2);
}
if (this.hitTest(_root.powerup)) {
_root.bigshots = _root.bigshots + 30;
_root.powerup.reset();
}
}
}
Instance of Symbol 50 MovieClip "photonlaser" in Frame 2
onClipEvent (load) {
shotMoveSpeed = 40;
this._x = _root.gun._x;
this._y = _root.gun._y;
}
onClipEvent (enterFrame) {
this._y = this._y - shotMoveSpeed;
if (this._y < -30) {
this.removeMovieClip();
}
if (this._name != "photonlaser") {
if (this.hitTest(_root.wmd)) {
_root.score = _root.score + 100;
_root.wmd.gotoAndPlay(2);
}
i = 1;
while (i <= _root.numwmd) {
if (this.hitTest(_root["wmd" + i])) {
_root.score = _root.score + 100;
_root["wmd" + i].gotoAndPlay(2);
}
i++;
}
if (this.hitTest(_root.nuke)) {
_root.score = _root.score + 300;
_root.nuke.gotoAndPlay(2);
}
}
}
Frame 6
playsounds.stop();
playsounds1 = new Sound(this);
playsounds1.attachSound("implosion");
playsounds1.start(0, 1);
Frame 16
stop();
ok2.onRelease = function () {
score = _root.score;
_root.thename = _root.scorename;
_root.gameover = 1;
};
Frame 17
stop();
ok1.onRelease = function () {
gotoAndPlay (1);
};
Frame 18
loadVariablesNum ("http://www.flashninjaclan.com/games/homedefense/scores.php", 0);
stop();
ok3.onRelease = function () {
gotoAndPlay (1);
};
Symbol 16 MovieClip Frame 1
if (this.sessionstarted != 1) {
this.arcade = new LoadVars();
this.sessionvars = new LoadVars();
this.arcade.gamename = "hdefense";
this.arcade.sessdo = "sessionstart";
this.arcade.sendAndLoad("arcade.php", sessionvars, "POST");
if (this.sessionvars.sessiontype != 2) {
_root.is_a_challenge = 0;
} else {
_root.is_a_challenge = 1;
}
this.sessionstarted = 1;
}
if (_root.gameover == 1) {
if ((this.askpermission != 1) && (this.sessionvars.connStatus == 1)) {
this.prequestvars = new LoadVars();
this.pranswer = new LoadVars();
this.prequestvars.gametime = this.sessionvars.gametime;
this.prequestvars.fakekey = this.sessionvars.initbar;
_root.score = int(Number(_root.score));
if (_root.score != 0) {
this.prequestvars.score = _root.score;
} else {
this.prequestvars.score = -1;
}
this.prequestvars.id = this.sessionvars.lastid;
this.prequestvars.sessdo = "permrequest";
this.prequestvars.note = (this.prequestvars.id * this.prequestvars.score) * this.prequestvars.fakekey;
this.prequestvars.sendAndLoad("./arcade.php", this.pranswer, "POST");
this.askpermission = 1;
}
if ((this.pranswer.validate == 1) && (this.finalsent != 1)) {
this.burnscore = new LoadVars();
this.burnscore.microone = this.pranswer.microone;
this.burnscore.gametime = this.prequestvars.gametime;
this.burnscore.id = this.prequestvars.id;
if (_root.score == 0) {
this.burnscore.noscore = 1;
}
this.burnscore.sessdo = "burn";
this.burnscore.send("./arcade.php", "_self", "POST");
this.finalsent = 1;
}
}
Symbol 38 MovieClip Frame 1
stop();
Symbol 38 MovieClip Frame 3
this.reset();
stop();
Symbol 41 MovieClip Frame 1
stop();
Symbol 41 MovieClip Frame 3
stop();
this.reset();
Symbol 50 MovieClip Frame 1
stop();