Frame 1
ifFrameLoaded (40) {
gotoAndPlay (2);
}
Frame 2
playermode = 0;
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
stop();
Instance of Symbol 25 MovieClip "rocket" in Frame 2
/* no clip actions */
Frame 3
function shipparent() {
this.rotation = 0;
this.xpos = 461;
this.ypos = 58;
this.xlration = 0;
this.rockets = 1;
this.xspeed = 0;
this.yspeed = 0;
this.hitstatus = 0;
}
function rocketparent() {
this.rotation = 0;
this.xpos = -50;
this.ypos = -50;
this.xlration = 0;
this.distancetravelled = 0;
this.xspeedship = 0;
this.yspeedship = 0;
this.xspeed = 0;
this.yspeed = 0;
}
function rightturn() {
ship.rotation = ship.rotation + 5;
}
function leftturn() {
ship.rotation = ship.rotation - 5;
}
function forward() {
tellTarget (car) {
gotoAndPlay (5);
};
if (7 >= ship.xlration) {
ship.xlration = ship.xlration + 0.2;
}
}
function slowdown() {
if (0 < ship.xlration) {
ship.xlration = ship.xlration - 0.1;
}
}
function fire() {
if (counter >= 30) {
counter = 0;
if (ship.rockets < 100) {
rocketarray.unshift(ship.rockets);
rocket[ship.rockets].xspeedship = ship.xspeed;
rocket[ship.rockets].yspeedship = ship.yspeed;
setProperty(rocket add ship.rockets, _rotation , ship.rotation);
setProperty(rocket add ship.rockets, _x , ship.xpos);
setProperty(rocket add ship.rockets, _y , ship.ypos);
rocket[ship.rockets].rotation = ship.rotation;
ship.rockets = ship.rockets + 1;
rocketsleft = rocketsleft - 1;
tellTarget (_root.firesound) {
gotoAndPlay (2);
};
}
}
}
function moverockets() {
x = 0;
while (rocketarray.length >= x) {
i = rocketarray[x];
if (eval (rocket add i).hitTest(_root.enemy)) {
blah = rocketarray.pop();
tellTarget (rocket add i) {
play();
};
}
rocket[i].xpos = getProperty(rocket add i, _x);
rocket[i].ypos = getProperty(rocket add i, _y);
rocket[i].xlration = rocket[i].xlration + 0.5;
rocket[i].xspeed = Math.sin((Math.PI/180) * rocket[i].rotation) + rocket[i].xspeedship;
rocket[i].yspeed = (-Math.cos((Math.PI/180) * rocket[i].rotation)) + rocket[i].yspeedship;
rocket[i].xpos = rocket[i].xpos + (rocket[i].xspeed * rocket[i].xlration);
rocket[i].ypos = rocket[i].ypos + (rocket[i].yspeed * rocket[i].xlration);
setProperty(rocket add i, _x , rocket[i].xpos);
setProperty(rocket add i, _y , rocket[i].ypos);
rocket[i].distancetravelled = rocket[i].distancetravelled + 1;
if (140 < rocket[i].distancetravelled) {
blah = rocketarray.pop();
tellTarget (rocket add i) {
gotoAndStop (50);
};
}
x++;
}
}
function moveship() {
dir = car._rotation + 180;
ship.xspeed = newsin[dir] * (-ship.xlration);
ship.yspeed = newcos[dir] * ship.xlration;
ship.xpos = ship.xpos + ship.xspeed;
ship.ypos = ship.ypos + ship.yspeed;
if (ship.xpos >= 650) {
ship.xpos = -40;
} else if (-40 >= ship.xpos) {
ship.xpos = 650;
}
if (ship.ypos >= 400) {
ship.ypos = -40;
} else if (-40 >= ship.ypos) {
ship.ypos = 400;
}
setProperty(car, _rotation , ship.rotation);
setProperty(car, _x , ship.xpos);
setProperty(car, _y , ship.ypos);
}
ship = new shipparent();
i = 1;
while (100 >= i) {
rocket[i] = new rocketparent();
duplicateMovieClip (rocket, "rocket" add i, i);
i++;
}
shipscore = 0;
rocketsleft = 49;
rocketarray = [];
counter = 0;
statecounter = 0;
statelength = 0;
newsin = [];
newcos = [];
i = 1;
while (360 >= i) {
newsin[i] = Math.sin((Math.PI/180) * i);
newcos[i] = Math.cos((Math.PI/180) * i);
i++;
}
Frame 4
function enemyparent() {
this.rotation = 0;
this.xpos = 151;
this.ypos = 57;
this.speed = 0;
this.xlration = 0;
this.rockets = 1;
this.xspeed = 0;
this.yspeed = 0;
}
function enemyrocketparent() {
this.rotation = 0;
this.xpos = 200;
this.ypos = 200;
this.speed = 0;
this.xlration = 0;
this.hitstatus = 0;
this.distancetravelled = 0;
this.xspeed = 0;
this.yspeed = 0;
this.xspeedship = 0;
this.yspeedship = 0;
}
function enemyrightturn() {
enemyship.rotation = enemyship.rotation + 5;
}
function enemyleftturn() {
enemyship.rotation = enemyship.rotation - 5;
}
function enemyforward() {
tellTarget (enemy) {
gotoAndPlay (5);
};
if (7 >= enemyship.xlration) {
enemyship.xlration = enemyship.xlration + 0.2;
}
}
function enemyslowdown() {
if (0 < enemyship.xlration) {
enemyship.xlration = enemyship.xlration - 0.1;
}
}
function enemyfire() {
if (enemycounter >= 30) {
enemycounter = 0;
if (enemyship.rockets < 100) {
enemyrocketarray.unshift(enemyship.rockets);
enemyrocket[enemyship.rockets].xspeedship = enemyship.xspeed;
enemyrocket[enemyship.rockets].yspeedship = enemyship.yspeed;
setProperty(enemyrocket add enemyship.rockets, _rotation , enemyship.rotation);
setProperty(enemyrocket add enemyship.rockets, _x , enemyship.xpos);
setProperty(enemyrocket add enemyship.rockets, _y , enemyship.ypos);
enemyrocket[enemyship.rockets].rotation = enemyship.rotation;
enemyship.rockets = enemyship.rockets + 1;
tellTarget (_root.firesound) {
gotoAndPlay (2);
};
}
}
}
function enemymoverockets() {
x = 0;
while (enemyrocketarray.length >= x) {
i = enemyrocketarray[x];
if (eval (enemyrocket add i).hitTest(_root.car)) {
enemyblah = enemyrocketarray.pop();
tellTarget (enemyrocket add i) {
play();
};
}
enemyrocket[i].xpos = getProperty(enemyrocket add i, _x);
enemyrocket[i].ypos = getProperty(enemyrocket add i, _y);
enemyrocket[i].xlration = enemyrocket[i].xlration + 0.5;
enemyrocket[i].xspeed = Math.sin((Math.PI/180) * enemyrocket[i].rotation) + enemyrocket[i].xspeedship;
enemyrocket[i].yspeed = (-Math.cos((Math.PI/180) * enemyrocket[i].rotation)) + enemyrocket[i].yspeedship;
enemyrocket[i].xpos = enemyrocket[i].xpos + (enemyrocket[i].xspeed * enemyrocket[i].xlration);
enemyrocket[i].ypos = enemyrocket[i].ypos + (enemyrocket[i].yspeed * enemyrocket[i].xlration);
setProperty(enemyrocket add i, _x , enemyrocket[i].xpos);
setProperty(enemyrocket add i, _y , enemyrocket[i].ypos);
enemyrocket[i].distancetravelled = enemyrocket[i].distancetravelled + 1;
if (140 < enemyrocket[i].distancetravelled) {
enemyblah = enemyrocketarray.pop();
}
x++;
}
}
function enemymoveship() {
enemydir = enemy._rotation + 180;
enemyship.xspeed = newsin[enemydir] * (-enemyship.xlration);
enemyship.yspeed = newcos[enemydir] * enemyship.xlration;
enemyship.xpos = enemyship.xpos + enemyship.xspeed;
enemyship.ypos = enemyship.ypos + enemyship.yspeed;
if (enemyship.xpos >= 650) {
enemyship.xpos = -40;
} else if (-40 >= enemyship.xpos) {
enemyship.xpos = 650;
}
if (enemyship.ypos >= 400) {
enemyship.ypos = -40;
} else if (-40 >= enemyship.ypos) {
enemyship.ypos = 400;
}
setProperty(enemy, _rotation , enemyship.rotation);
setProperty(enemy, _x , enemyship.xpos);
setProperty(enemy, _y , enemyship.ypos);
}
enemyship = new enemyparent();
i = 1;
while (100 >= i) {
enemyrocket[i] = new enemyrocketparent();
duplicateMovieClip (enemyrocket, "enemyrocket" add i, i + 100);
i++;
}
enemyscore = 0;
enemyrocketarray = [];
enemycounter = 0;
Frame 5
function choosestate() {
statecounter = statecounter + 1;
if (statecounter >= statelength) {
changestate();
statecounter = 0;
statelength = random(100);
}
}
function changestate() {
chance = random(10);
if (chance >= 6) {
state = "attack";
} else if (chance >= 2) {
state = "defend";
} else if (chance >= 0) {
state = "idle";
}
}
function fight() {
if (state == "attack") {
attack();
} else if (state == "defend") {
defend();
} else if (state == "idle") {
idle();
}
}
function idle() {
enemyslowdown();
}
function attack() {
homein();
enemyfire();
}
function defend() {
enemyforward();
}
function homein() {
if ((ship.xpos < enemyship.xpos) and (ship.ypos < enemyship.ypos)) {
angle = Math.atan(Math.abs(ship.ypos - enemyship.ypos) / Math.abs(ship.xpos - enemyship.xpos));
angletoenemy = -90 + ((angle * 180) / Math.pi);
} else if ((ship.xpos < enemyship.xpos) and (enemyship.ypos < ship.ypos)) {
angle = Math.atan(Math.abs(ship.ypos - enemyship.ypos) / Math.abs(ship.xpos - enemyship.xpos));
angletoenemy = -90 - ((angle * 180) / Math.pi);
} else if ((enemyship.xpos < ship.xpos) and (ship.ypos < enemyship.ypos)) {
angle = Math.atan(Math.abs(ship.xpos - enemyship.xpos) / Math.abs(ship.ypos - enemyship.ypos));
angletoenemy = (angle * 180) / Math.pi;
} else if ((enemyship.xpos < ship.xpos) and (enemyship.ypos < ship.ypos)) {
angle = Math.atan(Math.abs(ship.ypos - enemyship.ypos) / Math.abs(ship.xpos - enemyship.xpos));
angletoenemy = 90 + ((angle * 180) / Math.pi);
}
if (angletoenemy >= enemyship.rotation) {
enemyrightturn();
}
if (enemyship.rotation >= angletoenemy) {
enemyleftturn();
}
}
if (playermode == 2) {
gotoAndPlay (9);
}
Frame 6
if (Key.isDown(Key.DOWN) == true) {
fire();
}
if (Key.isDown(Key.RIGHT) == true) {
rightturn();
}
if (Key.isDown(Key.LEFT) == true) {
leftturn();
}
if (Key.isDown(Key.UP) == true) {
forward();
} else {
slowdown();
}
moverockets();
counter = counter + 1;
moveship();
enemymoverockets();
enemycounter = enemycounter + 1;
enemymoveship();
choosestate();
fight();
if (enemyscore == 10) {
tellTarget ("car") {
gotoAndPlay (20);
};
gotoAndPlay (40);
}
if (shipscore == 10) {
tellTarget ("enemy") {
gotoAndPlay (20);
};
gotoAndPlay (40);
}
Frame 7
gotoAndPlay (6);
Frame 9
stop();
Frame 10
if (Key.isDown(Key.DOWN) == true) {
fire();
}
if (Key.isDown(Key.RIGHT) == true) {
rightturn();
}
if (Key.isDown(Key.LEFT) == true) {
leftturn();
}
if (Key.isDown(Key.UP) == true) {
forward();
} else {
slowdown();
}
if (Key.isDown(83) == true) {
enemyfire();
}
if (Key.isDown(68) == true) {
enemyrightturn();
}
if (Key.isDown(65) == true) {
enemyleftturn();
}
if (Key.isDown(87) == true) {
enemyforward();
} else {
enemyslowdown();
}
moverockets();
counter = counter + 1;
moveship();
enemymoverockets();
enemycounter = enemycounter + 1;
enemymoveship();
if (enemyscore == 10) {
tellTarget ("car") {
gotoAndPlay (20);
};
gotoAndPlay (40);
}
if (shipscore == 10) {
tellTarget ("enemy") {
gotoAndPlay (20);
};
gotoAndPlay (40);
}
Frame 11
gotoAndPlay (10);
Frame 40
stop();
Symbol 12 MovieClip Frame 1
stop();
Symbol 12 MovieClip Frame 3
stop();
Symbol 14 MovieClip Frame 1
stop();
Symbol 14 MovieClip Frame 3
stop();
Symbol 22 MovieClip Frame 1
stop();
Symbol 22 MovieClip Frame 6
gotoAndPlay (1);
Symbol 22 MovieClip Frame 86
stop();
Symbol 25 MovieClip Frame 1
stop();
Symbol 25 MovieClip Frame 2
tellTarget (_root.rocketsound) {
gotoAndPlay (2);
};
Symbol 25 MovieClip Frame 13
_root.shipscore = _root.shipscore + 1;
setProperty(_root.enemystatus, _xscale , (10 - _root.shipscore) * 10);
stop();
Symbol 29 MovieClip Frame 1
stop();
Symbol 29 MovieClip Frame 6
gotoAndPlay (1);
Symbol 29 MovieClip Frame 70
stop();
Symbol 30 MovieClip Frame 1
stop();
Symbol 30 MovieClip Frame 2
tellTarget (_root.rocketsound) {
gotoAndPlay (2);
};
Symbol 30 MovieClip Frame 11
_root.enemyscore = _root.enemyscore + 1;
setProperty(_root.shipstatus, _xscale , (10 - _root.enemyscore) * 10);
stop();
Symbol 41 Button
on (release) {
gotoAndPlay (3);
}
Symbol 45 Button
on (release) {
playermode = 2;
gotoAndPlay (3);
}
Symbol 63 Button
on (release) {
gotoAndPlay (10);
}
Symbol 78 Button
on (release) {
gotoAndPlay (1);
}