Frame 1
gameOn = false;
stop();
Instance of Symbol 26 MovieClip in Frame 2
onClipEvent (enterFrame) {
percentLoaded = int((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
this.gotoAndStop(percentLoaded);
}
Frame 4
stop();
Frame 5
function newGame() {
skillLevel = 0;
shipZ = new Array(0, 7, 8, 9);
shipLevels = new Array(0, 0, 0, 0);
score = 0;
damage = 0;
newLevel();
}
function newLevel() {
skillLevel++;
shipsLeft = 10 + (skillLevel * 5);
gameOn = true;
}
function gameOver(winlose) {
gameOn = false;
pirate.active = false;
if (winlose == "lose") {
pirate.gotoAndPlay("lose");
} else {
pirate.gotoAndPlay("win");
}
}
function fire() {
ballX = -75 + (canonActive * 175);
ball._x = ballX;
ball.shotNum = canonFrame;
ball.gotoAndPlay("shot" + canonFrame);
}
function setShipDepth() {
j = 1;
while (j <= 3) {
ship1 = eval ("s" + j);
i = 1;
while (i <= 2) {
k = j + i;
if (k > 3) {
k = k - 3;
}
ship2 = eval ("s" + k);
if ((shipLevels[j] > shipLevels[k]) && (shipZ[j] < shipZ[k])) {
ship1.swapDepths(ship2);
temp = shipZ[k];
shipZ[k] = shipZ[j];
shipZ[j] = temp;
}
i++;
}
j++;
}
}
if (!gameOn) {
newGame();
}
stop();
Instance of Symbol 101 MovieClip "s1" in Frame 5
onClipEvent (load) {
function reset() {
_x = 1000;
_parent.shipLevels[num] = 0;
active = false;
shot = false;
chest = false;
sinkin = false;
shootin = false;
this.gotoAndPlay("loop");
}
num = substring(this._name, 2, 1);
reset();
}
onClipEvent (enterFrame) {
if (num == 1) {
chance = 1;
} else if ((num > 2) && (_parent.shipsLeft > 15)) {
chance = 10000;
} else {
chance = _parent.shipsLeft * 10;
}
if (((_parent.gameOn && (!active)) && (_parent.shipsLeft > 0)) && (random(chance) == 0)) {
do {
levelMatch = false;
yLevel = random(10) + 1;
i = 1;
while (i <= 3) {
dN = Math.abs(yLevel - _parent.shipLevels[i]);
if (dN < 2) {
levelMatch = true;
}
i++;
}
} while (levelMatch);
_parent.shipLevels[num] = yLevel;
scale = 50 + (yLevel * 5);
_y = (yLevel * 25);
_yscale = scale;
if (random(2) == 0) {
_x = -90;
_xscale = (-scale);
dx = 1 + (yLevel / 6);
} else {
_x = 640;
_xscale = scale;
dx = -1 - (yLevel / 6);
}
dx = dx * (_parent.skillLevel * 0.5);
shipScore = 600 - (yLevel * 20);
_parent.shipsLeft--;
_parent.setShipDepth();
shot = false;
sinkin = false;
shootin = false;
active = true;
} else if ((!sinkin) && (!shootin)) {
if ((((dx > 0) && (_x > 275)) && (_x < 550)) || (((dx < 0) && (_x > 0)) && (_x < 275))) {
if ((random(50) == 0) && (!shot)) {
shootin = true;
shot = true;
this.gotoAndPlay("shoot");
}
}
if (!shootin) {
shipScore--;
_x = (_x + dx);
if ((_x < -100) || (_x > 650)) {
reset();
}
}
}
}
Instance of Symbol 101 MovieClip "s2" in Frame 5
onClipEvent (load) {
function reset() {
_x = 1000;
_parent.shipLevels[num] = 0;
active = false;
shot = false;
chest = false;
sinkin = false;
shootin = false;
this.gotoAndPlay("loop");
}
num = substring(this._name, 2, 1);
reset();
}
onClipEvent (enterFrame) {
if (num == 1) {
chance = 1;
} else if ((num > 2) && (_parent.shipsLeft > 15)) {
chance = 10000;
} else {
chance = _parent.shipsLeft * 10;
}
if (((_parent.gameOn && (!active)) && (_parent.shipsLeft > 0)) && (random(chance) == 0)) {
do {
levelMatch = false;
yLevel = random(10) + 1;
i = 1;
while (i <= 3) {
dN = Math.abs(yLevel - _parent.shipLevels[i]);
if (dN < 2) {
levelMatch = true;
}
i++;
}
} while (levelMatch);
_parent.shipLevels[num] = yLevel;
scale = 50 + (yLevel * 5);
_y = (yLevel * 25);
_yscale = scale;
if (random(2) == 0) {
_x = -90;
_xscale = (-scale);
dx = 1 + (yLevel / 6);
} else {
_x = 640;
_xscale = scale;
dx = -1 - (yLevel / 6);
}
dx = dx * (_parent.skillLevel * 0.5);
shipScore = 600 - (yLevel * 20);
_parent.shipsLeft--;
_parent.setShipDepth();
shot = false;
sinkin = false;
shootin = false;
active = true;
} else if ((!sinkin) && (!shootin)) {
if ((((dx > 0) && (_x > 275)) && (_x < 550)) || (((dx < 0) && (_x > 0)) && (_x < 275))) {
if ((random(50) == 0) && (!shot)) {
shootin = true;
shot = true;
this.gotoAndPlay("shoot");
}
}
if (!shootin) {
shipScore--;
_x = (_x + dx);
if ((_x < -100) || (_x > 650)) {
reset();
}
}
}
}
Instance of Symbol 101 MovieClip "s3" in Frame 5
onClipEvent (load) {
function reset() {
_x = 1000;
_parent.shipLevels[num] = 0;
active = false;
shot = false;
chest = false;
sinkin = false;
shootin = false;
this.gotoAndPlay("loop");
}
num = substring(this._name, 2, 1);
reset();
}
onClipEvent (enterFrame) {
if (num == 1) {
chance = 1;
} else if ((num > 2) && (_parent.shipsLeft > 15)) {
chance = 10000;
} else {
chance = _parent.shipsLeft * 10;
}
if (((_parent.gameOn && (!active)) && (_parent.shipsLeft > 0)) && (random(chance) == 0)) {
do {
levelMatch = false;
yLevel = random(10) + 1;
i = 1;
while (i <= 3) {
dN = Math.abs(yLevel - _parent.shipLevels[i]);
if (dN < 2) {
levelMatch = true;
}
i++;
}
} while (levelMatch);
_parent.shipLevels[num] = yLevel;
scale = 50 + (yLevel * 5);
_y = (yLevel * 25);
_yscale = scale;
if (random(2) == 0) {
_x = -90;
_xscale = (-scale);
dx = 1 + (yLevel / 6);
} else {
_x = 640;
_xscale = scale;
dx = -1 - (yLevel / 6);
}
dx = dx * (_parent.skillLevel * 0.5);
shipScore = 600 - (yLevel * 20);
_parent.shipsLeft--;
_parent.setShipDepth();
shot = false;
sinkin = false;
shootin = false;
active = true;
} else if ((!sinkin) && (!shootin)) {
if ((((dx > 0) && (_x > 275)) && (_x < 550)) || (((dx < 0) && (_x > 0)) && (_x < 275))) {
if ((random(50) == 0) && (!shot)) {
shootin = true;
shot = true;
this.gotoAndPlay("shoot");
}
}
if (!shootin) {
shipScore--;
_x = (_x + dx);
if ((_x < -100) || (_x > 650)) {
reset();
}
}
}
}
Instance of Symbol 111 MovieClip "ball" in Frame 5
onClipEvent (load) {
function hitCheck() {
i = 1;
while (i <= 3) {
if (_parent.shipLevels[i] > 0) {
ship = eval ("_parent.s" + i);
shipWidth = ship._width * 0.7;
dX = Math.abs(_x - ship._x) * 2;
dN = Math.abs(shotNum - _parent.shipLevels[i]);
if ((dN <= 1) && (dX < shipWidth)) {
if (ship.chest) {
ship.chest = false;
ship.gotoAndPlay("chestExplode");
} else {
_parent.scoreDisplay._x = ship._x;
_parent.scoreDisplay._y = ship._y;
_parent.scoreDisplay.score = ship.shipScore;
_parent.scoreDisplay.gotoAndPlay(2);
_parent.score = _parent.score + ship.shipScore;
ship.gotoAndPlay("sink");
}
}
}
i++;
}
this.gotoAndPlay("boom");
}
_y = 265.4;
}
Instance of Symbol 112 MovieClip "c2" in Frame 5
onClipEvent (load) {
this.gotoAndStop(1);
num = substring(this._name, 2, 1);
}
onClipEvent (enterFrame) {
if (_parent.canonActive == num) {
light._visible = true;
} else {
light._visible = false;
}
}
Instance of Symbol 112 MovieClip "c3" in Frame 5
onClipEvent (load) {
this.gotoAndStop(1);
num = substring(this._name, 2, 1);
}
onClipEvent (enterFrame) {
if (_parent.canonActive == num) {
light._visible = true;
} else {
light._visible = false;
}
}
Instance of Symbol 112 MovieClip "c1" in Frame 5
onClipEvent (load) {
this.gotoAndStop(1);
num = substring(this._name, 2, 1);
}
onClipEvent (enterFrame) {
if (_parent.canonActive == num) {
light._visible = true;
} else {
light._visible = false;
}
}
Instance of Symbol 171 MovieClip "pirate" in Frame 5
onClipEvent (load) {
function fire() {
var _local1 = _parent;
boomX = -75 + (canonActive * 175);
boomY = 270 + (cFrame * 3.4);
_local1.boom._x = boomX;
_local1.boom._y = boomY;
_local1.boom.gotoAndPlay(2);
}
active = true;
action = "still";
dx = 0;
dir = "left";
this.gotoAndPlay("still");
}
onClipEvent (enterFrame) {
if (_parent.gameOn && (active)) {
if (Key.isDown(37)) {
dir = "left";
this._xscale = 100;
dx = -5;
if (action == "still") {
this.play();
action = "walk";
}
} else if (Key.isDown(39)) {
dir = "right";
this._xscale = -100;
dx = 5;
if (action == "still") {
this.play();
action = "walk";
}
} else if (action != "still") {
dx = 0;
action = "still";
this.gotoAndPlay("still");
}
_x = (_x + dx);
if (_x < 0) {
_x = 0;
} else if (_x > 550) {
_x = 550;
}
canonActive = 0;
i = 1;
while (i <= 3) {
if (dir == "left") {
cMin = (175 * i) - 25;
} else {
cMin = 175 * (i - 1);
}
cMax = cMin + 50;
if ((_x > cMin) && (_x < cMax)) {
canonActive = i;
break;
}
i++;
}
_parent.canonActive = canonActive;
if (canonActive > 0) {
canonMC = eval ("_parent.c" + canonActive);
cFrame = canonMC._currentframe;
_parent.canonFrame = cFrame;
if (Key.isDown(38)) {
if (cFrame > 1) {
canonMC.prevFrame();
}
} else if (Key.isDown(40)) {
if (cFrame < 10) {
canonMC.nextFrame();
}
} else if (Key.isDown(32)) {
active = false;
this.gotoAndPlay("swipe");
action = "swipe";
}
}
}
}
Instance of Symbol 176 MovieClip "damageMC" in Frame 5
onClipEvent (enterFrame) {
if (_parent.gameOn) {
if (_parent.damage >= 8) {
_parent.gameOver("lose");
} else if (_parent.shipsLeft <= 0) {
allGone = true;
i = 1;
while (i <= 3) {
if (_parent.shipLevels[i] > 0) {
allGone = false;
}
i++;
}
if (allGone) {
if (_parent.skillLevel == 5) {
_parent.gameOver("win");
} else {
_parent.gotoAndStop("newlevel");
}
}
}
this.gotoAndStop(_parent.damage + 1);
}
}
Frame 9
levelInfo = "Level " + (skillLevel + 1);
stop();
Frame 14
gameOn = false;
stopAllSounds();
stop();
Frame 19
gameOn = false;
stopAllSounds();
stop();
Symbol 15 MovieClip Frame 99
_root.gotoAndPlay("Loading");
stop();
Symbol 25 Button
on (release) {
stopAllSounds();
_parent.play();
}
Symbol 26 MovieClip Frame 1
stop();
Symbol 29 Button
on (release) {
getURL ("http://www.miniclip.com", "_blank");
}
Symbol 43 Button
on (release) {
nextFrame();
}
Symbol 45 Button
on (release) {
getURL ("http://www.miniclip.com", "_blank");
}
Symbol 47 Button
on (release) {
getURL ("http://www.miniclip.com/download_cannonblast.htm", "_blank");
}
Symbol 49 Button
on (release) {
getURL ("http://www.miniclip.com/signup2.htm", "_blank");
}
Symbol 77 Button
on (release) {
prevFrame();
}
Symbol 79 Button
on (release) {
nextFrame();
}
Symbol 86 MovieClip Frame 1
stop();
Symbol 89 MovieClip Frame 1
play();
Symbol 89 MovieClip Frame 149
gotoAndPlay (1);
Symbol 101 MovieClip Frame 1
play();
Symbol 101 MovieClip Frame 9
if ((!sinkin) && (!shootin)) {
gotoAndPlay ("loop");
}
Symbol 101 MovieClip Frame 10
temp = _parent.shipLevels[num];
_parent.shipLevels[num] = 0;
sinkin = true;
Symbol 101 MovieClip Frame 21
if (random(6) == 0) {
chest = true;
_parent.shipLevels[num] = temp;
gotoAndPlay ("chest");
} else {
reset();
}
Symbol 101 MovieClip Frame 22
play();
Symbol 101 MovieClip Frame 42
_parent.damage++;
_parent.bigboom.gotoAndPlay(2);
shootin = false;
gotoAndPlay ("loop");
Symbol 101 MovieClip Frame 51
loopcount = 3;
play();
Symbol 101 MovieClip Frame 79
if ((loopcount > 0) && (chest)) {
gotoAndPlay ("chestloop");
}
loopcount--;
Symbol 101 MovieClip Frame 89
reset();
Symbol 101 MovieClip Frame 90
play();
Symbol 101 MovieClip Frame 95
if (_parent.damage > 0) {
_parent.damage--;
}
Symbol 101 MovieClip Frame 125
reset();
Symbol 104 MovieClip Frame 1
stop();
Symbol 104 MovieClip Frame 2
play();
Symbol 104 MovieClip Frame 30
gotoAndStop (1);
Symbol 107 MovieClip Frame 1
stop();
Symbol 107 MovieClip Frame 2
play();
Symbol 107 MovieClip Frame 30
_parent.gotoAndStop("gameoverLose");
stop();
Symbol 109 MovieClip Frame 1
stop();
Symbol 109 MovieClip Frame 2
play();
Symbol 109 MovieClip Frame 4
_parent.fire();
Symbol 109 MovieClip Frame 11
gotoAndStop (1);
Symbol 111 MovieClip Frame 1
boomY = new Array(0, -214.9, -187.1, -160.7, -134.3, -104.9, -78.5, -49.1, -21.2, 5.2, 28.6);
stop();
Symbol 111 MovieClip Frame 19
hitCheck();
Symbol 111 MovieClip Frame 33
hitCheck();
Symbol 111 MovieClip Frame 47
hitCheck();
Symbol 111 MovieClip Frame 57
hitCheck();
Symbol 111 MovieClip Frame 66
hitCheck();
Symbol 111 MovieClip Frame 75
hitCheck();
Symbol 111 MovieClip Frame 84
hitCheck();
Symbol 111 MovieClip Frame 93
hitCheck();
Symbol 111 MovieClip Frame 102
hitCheck();
Symbol 111 MovieClip Frame 111
hitCheck();
Symbol 111 MovieClip Frame 115
explosion._y = boomY[shotNum];
explosion.gotoAndPlay(2);
play();
Symbol 111 MovieClip Frame 122
gotoAndStop (1);
Symbol 112 MovieClip Frame 1
stop();
Symbol 112 MovieClip Frame 12
play();
Symbol 112 MovieClip Frame 40
stop();
Symbol 171 MovieClip Frame 11
play();
Symbol 171 MovieClip Frame 19
fire();
Symbol 171 MovieClip Frame 28
active = true;
action = "still";
gotoAndPlay ("still");
Symbol 171 MovieClip Frame 49
if (active) {
gotoAndPlay(action);
}
Symbol 171 MovieClip Frame 53
if (action == "still") {
stop();
}
Symbol 171 MovieClip Frame 55
if (active) {
gotoAndPlay(action);
}
Symbol 171 MovieClip Frame 60
play();
Symbol 171 MovieClip Frame 166
_parent.gotoAndStop("gameoverWin");
stop();
Symbol 171 MovieClip Frame 170
play();
Symbol 171 MovieClip Frame 270
_parent.deck.gotoAndPlay("sink");
_parent.c1.gotoAndPlay("sink");
_parent.c2.gotoAndPlay("sink");
_parent.c3.gotoAndPlay("sink");
stop();
Symbol 173 MovieClip Frame 1
stop();
Symbol 173 MovieClip Frame 2
play();
Symbol 173 MovieClip Frame 11
gotoAndStop (1);
Symbol 176 MovieClip Frame 1
stop();
Symbol 185 Button
on (release) {
newLevel();
gotoAndStop ("game");
}
Symbol 190 Button
on (release) {
gotoAndStop ("ready");
}
Symbol 192 Button
on (release) {
getURL ("http://www.miniclip.com/cannonblast.htm", "_blank");
}