[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Frame 1 (684 B)
function gameMenu(menu, obj) {
getURL (_root.authorsSite, "_blank");
}
var devMode = 1;
var externalMusic = 0;
var gameTitle = "SPANG!";
var gameDesc = "BUBBLE POPPING FUN!";
var vNum = "1.1";
var flashVersionsNeeded = 8;
var legalDomain = "http://www.terrypaton.com";
var authorName = "Terry Paton";
var authorContact = "terry@terrypaton.com";
var authorsSite = "http://www.terrypaton.com";
var gameLocation = _root._url.substr(0, legalDomain.length);
var gameQuality = "MEDIUM";
var menu_cm = new ContextMenu();
menu_cm.customItems.push(new ContextMenuItem(gameTitle, gameMenu));
menu_cm.hideBuiltInItems();
_root.menu = menu_cm;
fscommand ("fullscreen", true);
Instance of Symbol 149 MovieClip in Frame 4 (21 B)
/* no clip actions */
Frame 6 (5.48 KiB) ● ●
function ballClass() {
}
ballClass.prototype = new MovieClip();
ballClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.maxSpeed = 20;
this.yspeed = -5;
this.bstate = "setup";
};
ballClass.prototype.onEnterFrame = function () {
if (this.bstate == "setup") {
this.gotoAndStop(this.clip.ballType);
this.gravity = 1 - (this.clip.ballType / 9);
this.bstate = "normal";
this.bRadius = this._width / 2;
this.xspeed = this.clip.xspeed;
switch (this.clip.ballType) {
case 1 :
this.upBounce = -19;
break;
case 2 :
this.upBounce = -20;
break;
case 3 :
this.upBounce = -20;
break;
case 4 :
this.upBounce = -20;
break;
case 5 :
this.upBounce = -20;
break;
default :
this.upBounce = -10;
}
}
if (gameState == "paused") {
}
if (this.bState == "remove") {
this.c = 0;
this.bState = "removeWait";
}
if (this.bState == "removeWait") {
this.c++;
this._alpha = this._alpha - 10;
if (this.c > 10) {
removeMovieClip(this);
}
}
if ((gameState == "playing") || (gameState == "timeFrozen")) {
i = 0;
while (i < 10) {
if (this.hitTest(eval (("enemyHolder.bullet" + i) + ".clip")) == true) {
popSnd();
splitBall(this.clip.ballType, this._name, i);
}
i++;
}
}
if ((gameState == "playing") && (this.bState != "removeWait")) {
if (this.hitTest(player) == true) {
hurtPlayer();
}
j = 0;
while (j < 30) {
if (this.hitTest(eval ("enemyHolder.levelB" + j)) == true) {
boingSnd();
if (eval (("enemyHolder.levelB" + j) + ".brState") != "destroy") {
this.hitTestY = eval ("enemyHolder.levelB" + j)._y;
this.hitTestX = eval ("enemyHolder.levelB" + j)._x;
this.hitTestH = eval ("enemyHolder.levelB" + j)._height;
this.hitTestW = eval ("enemyHolder.levelB" + j)._width;
if (this.hitTestY > this.y) {
this.yspeed = -this.yspeed;
this.y = this.hitTestY - this.bRadius;
this._yscale = 70;
break;
}
if (this.hitTestY < this.y) {
this.yspeed = -this.yspeed;
this.y = (this.hitTestY + this.bRadius) + this.hitTestH;
this._yscale = 70;
break;
}
}
}
j++;
}
if (this.yspeed > this.maxSpeed) {
this.yspeed = this.maxSpeed;
} else if (this.yspeed < (-this.maxSpeed)) {
this.yspeed = -this.maxSpeed;
}
this.y = this.y + this.yspeed;
if (this.yspeed > 0) {
if (this.y > (ground - this.bRadius)) {
boingSnd();
this.y = (ground - (this.bRadius / 2)) - 1;
this.yspeed = this.upBounce;
this._yscale = 50;
}
}
if (this._yscale < 100) {
this._yscale = this._yscale * 1.1;
if (this._yscale > 100) {
this._yscale = 100;
}
}
if (this.x > (rightWall - this.bRadius)) {
this.x = rightWall - this.bRadius;
this.xspeed = -this.xspeed;
boingSnd();
}
if (this.x < (leftWall + this.bRadius)) {
this.x = leftWall + this.bRadius;
this.xspeed = -this.xspeed;
boingSnd();
}
this.yspeed = this.yspeed + this.gravity;
this.x = this.x + this.xspeed;
this._x = int(this.x);
this._y = int(this.y);
}
};
Object.registerClass("ball_clip", ballClass);
function boingSnd() {
tS = random(3);
switch (tS) {
case 0 :
boing1.start();
return;
case 1 :
boing2.start();
return;
case 1 :
boing3.start();
return;
default :
boing1.start();
}
}
level1data = new Array("br1", 10, 200, "br1", 60, 200, "br1", 580, 200, "br1", 530, 200, "ball", 4, 300);
level2data = new Array("br1", 60, 200, "br1", 110, 200, "br2", 160, 200, "br2", 210, 200, "br1", 540, 200, "br1", 490, 200, "br2", 440, 200, "br2", 390, 200, "ball", 3, 400, "ball", 3, 100);
level3data = new Array("br1", 110, 90, "br1", 110, 220, "br1", 160, 220, "br2", 210, 220, "br2", 260, 220, "br2", 340, 220, "br1", 490, 220, "br1", 490, 90, "br2", 440, 220, "br2", 390, 220, "ball", 3, 400, "ball", 3, 100, "bird", 0, 0);
level4data = new Array("br2", 110, 300, "br2", 160, 300, "br2", 210, 300, "br2", 260, 300, "br2", 340, 300, "br2", 490, 300, "br2", 440, 300, "br2", 390, 300, "br2", 110, 100, "br2", 160, 100, "br2", 210, 100, "br2", 260, 100, "br2", 340, 100, "br2", 490, 100, "br2", 440, 100, "br2", 390, 100, "ball", 3, 400, "ball", 3, 100, "bird", 0, 0, "snail", 0, 0);
level5data = new Array("br1", 110, 280, "br1", 160, 280, "br2", 210, 300, "br2", 260, 300, "br2", 340, 300, "br2", 490, 300, "br1", 440, 280, "br1", 390, 280, "br1", 110, 120, "br1", 160, 120, "br2", 210, 100, "br2", 260, 100, "br2", 340, 100, "br2", 490, 100, "br1", 440, 120, "br1", 390, 120, "ball", 2, 400, "ball", 2, 300, "ball", 2, 200, "ball", 2, 100, "bird", 0, 0, "snail", 0, 0);
level6data = new Array("br1", 210, 100, "br1", 310, 100, "br2", 10, 280, "br2", 60, 280, "br2", 110, 280, "br2", 160, 280, "br2", 210, 280, "br2", 260, 280, "br2", 310, 280, "br2", 360, 280, "br2", 410, 280, "br2", 460, 280, "br2", 510, 280, "br2", 560, 280, "ball", 4, 400, "ball", 4, 300, "ball", 4, 200, "ball", 5, 100, "bird", 0, 0, "snail", 0, 0);
level7data = new Array("br2", 10, 100, "br2", 60, 100, "br2", 110, 100, "br2", 160, 100, "br2", 210, 100, "br2", 260, 100, "br2", 260, 280, "br2", 310, 280, "br2", 360, 280, "br2", 410, 280, "br2", 460, 280, "br2", 510, 280, "br2", 560, 280, "ball", 3, 400, "ball", 3, 300, "ball", 5, 500, "bird", 0, 0, "snail", 0, 0);
ground = 470;
rightWall = 630;
leftWall = 10;
Frame 7 (1.03 KiB) ●
collectSound = new Sound();
collectSound.attachSound("collectSnd");
playerExplosionSnd = new Sound();
playerExplosionSnd.attachSound("playerExplosion_Snd");
boing1 = new Sound();
boing1.attachSound("boing1Snd");
boing2 = new Sound();
boing2.attachSound("boing2Snd");
boing3 = new Sound();
boing3.attachSound("boing3Snd");
tackSnd = new Sound();
tackSnd.attachSound("tack");
hurtSnd = new Sound();
hurtSnd.attachSound("hurt");
pop1Snd = new Sound();
pop1Snd.attachSound("pop1");
pop2Snd = new Sound();
pop2Snd.attachSound("pop2");
pop3Snd = new Sound();
pop3Snd.attachSound("pop3");
hitCreatSnd = new Sound();
hitCreatSnd.attachSound("hitCreatureSound");
stringSnd = new Sound();
stringSnd.attachSound("fireString");
bulletSnd = new Sound();
bulletSnd.attachSound("fireBullet");
music1 = new Sound();
music1.attachSound("music1");
music2 = new Sound();
music2.attachSound("music2");
intromusic = new Sound();
intromusic.attachSound("intromusic");
gamefinishedmusic = new Sound();
gamefinishedmusic.attachSound("intromusic");
Frame 8 (1.04 KiB) ●
function stopmusic() {
music1.stop();
music2.stop();
music3.stop();
intromusic.stop();
gamefinishedmusic.stop();
}
function playmusic() {
if (musicstate == 1) {
stopmusic();
trace("playing music");
switch (gameScene) {
case "INTRO" :
intromusic.start(0, 90);
return;
case "GAME" :
b = level - (int(level / 2) * 2);
switch (b) {
case 0 :
music1.start(0, 30);
break;
case 1 :
music2.start(0, 30);
break;
default :
music1.start(0, 30);
}
return;
case "GAME FINISHED" :
gamefinishedmusic.start(0, 90);
return;
}
}
}
storage = SharedObject.getLocal("store");
level = storage.data.uptolevel;
if (level == undefined) {
storage.data.uptolevel = 1;
level = 1;
}
yourhigh = storage.data.myhighscore;
if (yourhigh == undefined) {
storage.data.myhighscore = 0;
yourhigh = 0;
}
musicstate = storage.data.musicsetting;
if ((musicstate == undefined) || (musicstate == 2)) {
musicstate = 1;
storage.data.musicsetting = 1;
}
Frame 9 (942 B)
function musicon() {
this.options.on_off.gotoAndStop(1);
musicstate = 1;
storage.data.musicsetting = 1;
playmusic();
}
function musicoff() {
stopmusic();
this.options.on_off.gotoAndStop(2);
musicstate = 0;
storage.data.musicsetting = 0;
}
function playgame() {
gotoAndPlay (18);
}
function resetlevel() {
_root.level = 1;
highestClip.resetclip.gotoAndPlay(2);
storage.data.myhighscore = 0;
storage.flush();
yourhigh = 0;
}
if (musicstate == 0) {
this.options.on_off.gotoAndStop(2);
}
_quality = "HIGH";
gameScene = "INTRO";
playmusic();
gameState = "playing";
ballHolder.attachMovie("ball_clip", "ball1", 1);
with (ballHolder.ball1) {
_x = 200;
_y = 30;
clip.ballType = 4;
clip.xspeed = 3;
clip.bstate = "normal";
}
ballHolder.attachMovie("ball_clip", "ball2", 2);
with (ballHolder.ball2) {
_x = 300;
_y = 60;
clip.ballType = 2;
clip.xspeed = 4;
clip.bstate = "normal";
}
Frame 17 (8 B)
stop();
Frame 18 (28.53 KiB) ● ● ●
function popSnd() {
tS = random(3);
switch (tS) {
case 0 :
pop1Snd.start();
return;
case 1 :
pop2Snd.start();
return;
case 1 :
pop3Snd.start();
return;
default :
pop1Snd.start();
}
}
function replaceSnail() {
removeMovieClip(enemyHolder.snail);
ta = random(2);
if (ta == 0) {
ta = -100;
}
if (ta == 1) {
ta = 740;
}
enemyHolder.attachMovie("snail", "snail", enemyLevel);
with (enemyHolder.snail) {
_x = ta;
_y = ground;
}
if (ta > 600) {
enemyHolder.snail._xscale = -100;
}
enemyLevel++;
}
function replaceBird() {
removeMovieClip(enemyHolder.bird);
ta = random(2);
if (ta == 0) {
ta = -100;
}
if (ta == 1) {
ta = 740;
}
enemyHolder.attachMovie("bird", "bird", enemyLevel);
with (enemyHolder.bird) {
_x = ta;
_y = 200;
}
if (ta > 600) {
enemyHolder.bird._xscale = -100;
}
enemyLevel++;
}
function collectPowerUp(num) {
collectSound.start();
if (num == 1) {
maxBullets = 1;
trace("more energy collected");
playerHealth = playerHealth + 8;
if (playerHealth > 100) {
playerHealth = 100;
}
score = score + 150;
this.lifeMeter_clip.life_bar_clip._xscale = playerHealth;
} else if (num == 2) {
trace("double shot");
maxBullets = 2;
playerBulletType = 1;
score = score + 150;
CurrentWeapon_Clip.gotoAndStop(2);
} else if (num == 3) {
trace("time freeze");
attachMovie("timeFreezeCount", "timeFreezeCount", 100);
timeFreezeCount._x = 320;
timeFreezeCount._y = 200;
timeFreezeDelay = 90;
gameState = "timeFrozen";
score = score + 150;
} else if (num == 4) {
trace("gun");
playerBulletType = 2;
maxBullets = 5;
score = score + 150;
CurrentWeapon_Clip.gotoAndStop(3);
} else if (num == 5) {
trace("1000 points");
score = score + 1000;
}
playerscore.gotoAndPlay(2);
player.collect.gotoAndPlay(2);
collectSound.start();
}
function bulletClass() {
}
bulletClass.prototype = new MovieClip();
bulletClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.maxSpeed = 20;
this.yspeed = -8;
this.lbState = "normal";
this.lifeWait = 2;
this.lifeCount = 0;
};
bulletClass.prototype.onEnterFrame = function () {
if (gameState == "paused") {
}
if (this.lbState == "remove") {
removeMovieClip(this);
}
if ((gameState == "playing") || (gameState == "timeFrozen")) {
if (this.lbState == "normal") {
if (this.y > 10) {
this.y = this.y + this.yspeed;
if (this.hitTest(enemyHolder.bird) == true) {
trace("hit bird");
trace(enemyHolder.bird.lbState);
if (enemyHolder.bird.lbState == "fly") {
this.lbState = "start fade";
enemyHolder.bird.lbState = "destroy";
}
}
if (this.hitTest(enemyHolder.snail) == true) {
trace("hit snail");
if (enemyHolder.snail.lbState == "move") {
this.lbState = "start fade";
enemyHolder.snail.lbState = "destroy";
}
}
j = 0;
while (j < 20) {
if (this.hitTest(eval ("enemyHolder.levelB" + j)) == true) {
if (eval (("enemyHolder.levelB" + j) + ".clip.lbType") == 1) {
trace("arrow hits block");
this.hitTestY = eval ("enemyHolder.levelB" + j)._y;
this.hitTestX = eval ("enemyHolder.levelB" + j)._x;
this.hitTestH = eval ("enemyHolder.levelB" + j)._height;
this.y = this.hitTestY + this.hitTestH;
this.lbState = "waiting";
break;
}
if (eval (("enemyHolder.levelB" + j) + ".clip.lbType") == 2) {
trace("arrow hits destrucible block");
eval ("enemyHolder.levelB" + j).brState = "destroy";
this.hitTestY = eval ("enemyHolder.levelB" + j)._y;
this.hitTestX = eval ("enemyHolder.levelB" + j)._x;
this.hitTestH = eval ("enemyHolder.levelB" + j)._height;
this.y = this.hitTestY + this.hitTestH;
this.lbState = "start fade";
break;
}
}
j++;
}
} else {
this.lbState = "waiting";
}
this._x = int(this.x);
this._y = int(this.y);
}
if (this.lbState == "waiting") {
this.lifeCount++;
if (this.lifeCount > this.lifeWait) {
this.lbState = "start fade";
}
}
if (this.lbState == "start fade") {
this.fadeCount = 0;
this.fadeWait = 20;
firedBullets--;
if (firedBullets < 0) {
firedBullets = 0;
}
this.lbState = "fade";
}
if (this.lbState == "fade") {
this._alpha = this._alpha - 20;
this.fadeCount++;
if (this.fadeCount > this.fadeWait) {
removeMovieClip(this);
}
}
}
};
Object.registerClass("bulletClip", bulletClass);
function birdClass() {
}
birdClass.prototype = new MovieClip();
birdClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.maxSpeed = 20;
this.yspeed = -8;
this.lbState = "waiting";
this.Wait = 60 + random(300);
this.Count = 0;
};
birdClass.prototype.onEnterFrame = function () {
if (gameState == "paused") {
}
if (this.lbState == "remove") {
removeMovieClip(this);
}
if (gameState == "playing") {
if (this.lbState == "fly") {
this.x = this.x + this.xspeed;
this.yc = this.yc + 0.1;
this.y = this.y + (2 * Math.cos(this.yc));
this._x = int(this.x);
this._y = int(this.y);
if (this.xspeed > 0) {
if (this.x > 670) {
this.lbstate = "waiting";
this.x = this.startx;
}
}
if (this.xspeed < 0) {
if (this.x < -10) {
this.lbstate = "waiting";
this.x = this.startx;
}
}
}
if (this.lbState == "waiting") {
this.Count++;
if (this.Count > this.Wait) {
this.lbState = "fly";
this.Count = 0;
this.yc = 0.1;
if (this.x < 0) {
this.xspeed = 3;
} else {
this.xspeed = -3;
}
}
}
if (this.lbState == "destroy") {
addPointsBonus(this.x, this.y);
score = score + 500;
playerscore.gotoAndPlay(2);
this.lbState = "start fade";
}
if (this.lbState == "start fade") {
this.fadeCount = 0;
this.fadeWait = 20;
this.lbState = "fade";
}
if (this.lbState == "fade") {
this._alpha = this._alpha - 5;
this.fadeCount++;
if (this.fadeCount > this.fadeWait) {
replaceBird();
trace("BIRD");
}
}
}
};
Object.registerClass("bird", birdClass);
function arrowClass() {
}
arrowClass.prototype = new MovieClip();
arrowClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.maxSpeed = 20;
this.yspeed = -8;
this.lbState = "normal";
this.lifeWait = 60;
this.lifeCount = 0;
};
arrowClass.prototype.onEnterFrame = function () {
if (gameState == "paused") {
}
if (this.lbState == "remove") {
removeMovieClip(this);
}
if ((gameState == "playing") || (gameState == "timeFrozen")) {
if (this.lbState == "normal") {
if (this.y > 10) {
this.y = this.y + this.yspeed;
this.clip._height = Math.abs(this.y - ground);
if (this.hitTest(enemyHolder.bird) == true) {
trace("hit bird");
if (enemyHolder.bird.lbState == "fly") {
this.lbState = "start fade";
enemyHolder.bird.lbState = "destroy";
hitCreatSnd.start();
}
}
if (this.hitTest(enemyHolder.snail) == true) {
trace("hit snail");
if (enemyHolder.snail.lbState == "move") {
this.lbState = "start fade";
enemyHolder.snail.lbState = "destroy";
hitCreatSnd.start();
}
}
j = 1;
while (j < 70) {
if (this.hitTest(eval ("enemyHolder.levelB" + j)) == true) {
if (eval (("enemyHolder.levelB" + j) + ".clip.lbType") == 1) {
trace("arrow hits block");
this.hitTestY = eval ("enemyHolder.levelB" + j)._y;
this.hitTestX = eval ("enemyHolder.levelB" + j)._x;
this.hitTestH = eval ("enemyHolder.levelB" + j)._height;
this.y = this.hitTestY + this.hitTestH;
this.lbState = "waiting";
tackSnd.start();
break;
}
if (eval (("enemyHolder.levelB" + j) + ".clip.lbType") == 2) {
trace("arrow hits destrucible block");
eval ("enemyHolder.levelB" + j).brState = "destroy";
this.hitTestY = eval ("enemyHolder.levelB" + j)._y;
this.hitTestX = eval ("enemyHolder.levelB" + j)._x;
this.hitTestH = eval ("enemyHolder.levelB" + j)._height;
this.y = this.hitTestY + this.hitTestH;
this.lbState = "start fade";
tackSnd.start();
break;
}
}
j++;
}
} else {
this.lbState = "waiting";
}
this._x = int(this.x);
this._y = int(this.y);
}
if (this.lbState == "waiting") {
if (this.hitTest(enemyHolder.bird) == true) {
trace("hit bird");
if (enemyHolder.bird.lbState == "fly") {
this.lbState = "start fade";
enemyHolder.bird.lbState = "destroy";
tackSnd.start();
}
}
if (this.hitTest(enemyHolder.snail) == true) {
trace("hit snail");
if (enemyHolder.snail.lbState == "move") {
this.lbState = "start fade";
enemyHolder.snail.lbState = "destroy";
tackSnd.start();
}
}
this.lifeCount++;
if (this.lifeCount > this.lifeWait) {
this.lbState = "start fade";
}
}
if (this.lbState == "start fade") {
this.fadeCount = 0;
this.fadeWait = 20;
firedBullets--;
if (firedBullets < 0) {
firedBullets = 0;
}
this.lbState = "fade";
}
if (this.lbState == "fade") {
this._alpha = this._alpha - 5;
this.fadeCount++;
if (this.fadeCount > this.fadeWait) {
removeMovieClip(this);
}
}
}
};
Object.registerClass("arrowBullet", arrowClass);
function hurtPlayer() {
hurtSnd.start();
playerHealth = playerHealth - hurtDamage;
testiflifelost();
player.playerHitClip.gotoAndPlay(2);
}
function customFunction(varName) {
if (_root.state == "paused") {
}
if (_root.state == "playing") {
i = 0;
while (i < 100) {
i++;
}
if (varName == 3) {
}
switch (varName) {
case 1 :
break;
case 2 :
break;
case 3 :
break;
case 4 :
break;
case 5 :
break;
case 6 :
break;
}
savegame.flush();
i = 1;
while (i < 500) {
removeMovieClip(eval ("holder.clip" + i));
i++;
}
switch (varName) {
case 10 :
tellplayer(1);
break;
case 20 :
tellplayer(2);
break;
case 30 :
tellplayer(3);
break;
case 40 :
tellplayer(4);
break;
case 50 :
tellplayer(5);
break;
case 60 :
tellplayer(6);
}
attachMovie("clip", "clip", clipLevel);
with (clip) {
_x = 320;
_y = 430;
}
state = "begin";
if ((score > 30000) && (extralives == 0)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 60000) && (extralives == 1)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 90000) && (extralives == 2)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 120000) && (extralives == 3)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 150000) && (extralives == 4)) {
extralives++;
lives++;
tellplayer(9);
}
score = score + 500;
if (lives < 0) {
state = "game over";
} else {
state = "paused";
}
}
}
function brickClass() {
}
brickClass.prototype = new MovieClip();
brickClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.brState = "normal";
this.lifeWait = 60;
this.lifeCount = 0;
this.gotoAndStop(this.clip.lbType);
};
brickClass.prototype.onEnterFrame = function () {
if (gameState == "paused") {
}
if (gameState == "playing") {
if (this.brState == "normal") {
}
if (this.brState == "destroy") {
this.fadeCount = 0;
this.fadeWait = 20;
firedBullets--;
if (firedBullets < 0) {
firedBullets = 0;
}
this.brState = "fade";
}
if (this.brState == "fade") {
this._alpha = this._alpha - 5;
this.fadeCount++;
if (this.fadeCount > this.fadeWait) {
removeMovieClip(this);
}
}
}
};
Object.registerClass("level_blocks", brickClass);
function firePlayersGun() {
if (playerBulletType == 2) {
maxBullets = 5;
}
if (firedBullets < maxBullets) {
player.fireIt.gotoAndPlay(2);
firedBullets++;
tnum = enemyHolder.getNextHighestDepth();
switch (playerBulletType) {
case 1 :
stringSnd.start();
enemyHolder.attachMovie("arrowBullet", "bullet" + bulletNum, bulletNum + 100);
break;
case 2 :
bulletSnd.start();
enemyHolder.attachMovie("bulletClip", "bullet" + bulletNum, bulletNum + 100);
break;
}
with (eval ("enemyHolder.bullet" + bulletNum)) {
_x = px;
_y = py;
}
bulletNum++;
if (bulletNum > 9) {
bulletNum = 0;
}
}
}
function levelComplete() {
i = 0;
while (i < 500) {
removeMovieClip(eval ("enemyHolder.ball" + i));
removeMovieClip(eval ("enemyHolder.levelB" + i));
removeMovieClip(eval ("enemyHolder.bullet" + i));
removeMovieClip(enemyHolder.snail);
removeMovieClip(enemyHolder.bird);
removeMovieClip(eval ("enemyHolder.powerUp" + i));
i++;
}
trace("LEVEL IS COMPLETE");
level++;
gameState = "begin";
playerHealth = playerHealth + 10;
if (playerHealth > 100) {
playerHealth = 100;
}
this.lifeMeter_clip.life_bar_clip._xscale = playerHealth;
storage.flush();
}
function frameaction() {
if (gameState == "start again") {
attachMovie("ready_announce", "tellPlayer", 9);
tellPlayer._x = 320;
tellPlayer._y = 240;
_global.playerState = 1;
attachMovie("player", "player", 199);
player._x = 320;
player._y = 430;
this.state = "paused";
}
if (gameState == "paused") {
}
if (gameState == "begin") {
if (level > 7) {
removeMovieClip(player);
gotoAndPlay (55);
} else {
setuplevel();
}
gameState = "paused";
}
if ((gameState == "playing") || (gameState == "timeFrozen")) {
if (playerState == 5) {
}
tx = int(_root._xmouse);
acl = px - tx;
px = px - (acl / 5);
if (px < 15) {
px = 15;
}
if (px > 615) {
px = 615;
}
prot = int((-acl) / 2);
if (prot > 30) {
prot = 30;
}
if (prot < -30) {
prot = -30;
}
lastprot = prot;
player._x = px;
player._y = py;
player.playerBody._rotation = prot;
}
if (gameState == "timeFrozen") {
timeFreezeDelay--;
trace(timeFreezeDelay);
timeFdisplay = timeFreezeDelay;
if (timeFreezeDelay < 1) {
removeMovieClip(timeFreezeCount);
gameState = "playing";
}
}
if (gameState == "game over") {
trace("STATE = game over");
removeMovieClip(player);
gotoAndPlay ("GAMEOVER");
}
}
function PointsUpClass() {
}
PointsUpClass.prototype = new MovieClip();
PointsUpClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.maxSpeed = 5;
this.yspeed = 3;
this.pstate = "normal";
this.life = 60;
this.lifeC = 0;
};
PointsUpClass.prototype.onEnterFrame = function () {
if (gameState == "paused") {
}
if (gameState == "playing") {
if (this.pstate == "normal") {
if (this.hitTest(player) == true) {
collectPowerUp(5);
removeMovieClip(this);
}
this.y = this.y + this.yspeed;
if (this.y > (ground - 10)) {
this.y = ground - 10;
this._y = int(this.y);
this.pstate = "waiting";
}
this._y = int(this.y);
}
if (this.pstate == "waiting") {
this.lifeC++;
this._alpha = this._alpha - 1.5;
if (this.hitTest(player) == true) {
collectPowerUp(5);
removeMovieClip(this);
}
if (this.lifeC > this.life) {
removeMovieClip(this);
}
}
}
};
Object.registerClass("PointsPowerUp", PointsUpClass);
function powerUpClass() {
}
powerUpClass.prototype = new MovieClip();
powerUpClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.maxSpeed = 5;
this.yspeed = 3;
if (level < 4) {
this.typeOf = random(2) + 1;
} else if ((level > 3) && (level < 7)) {
this.typeOf = random(3) + 1;
} else {
this.typeOf = random(4) + 1;
}
this.gotoAndStop(this.typeOf);
this.pstate = "normal";
this.life = 60;
this.lifeC = 0;
};
powerUpClass.prototype.onEnterFrame = function () {
if (gameState == "paused") {
}
if ((gameState == "playing") || (gameState == "timeFrozen")) {
if (this.pstate == "normal") {
if (this.hitTest(player) == true) {
collectPowerUp(this.typeOf);
removeMovieClip(this);
}
this.y = this.y + this.yspeed;
if (this.y > (ground - 10)) {
this.y = ground - 10;
this._y = int(this.y);
this.pstate = "waiting";
}
this._y = int(this.y);
}
if (this.pstate == "waiting") {
this.lifeC++;
this._alpha = this._alpha - 1.5;
if (this.hitTest(player) == true) {
collectPowerUp(this.typeOf);
removeMovieClip(this);
}
if (this.lifeC > this.life) {
removeMovieClip(this);
}
}
}
};
Object.registerClass("powerUp", powerUpClass);
function object1Class() {
}
object1Class.prototype = new MovieClip();
object1Class.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.maxSpeed = 5;
this.yspeed = 0;
this.xspeed = 0;
this.starttime = getTimer();
this.state = "normal";
};
object1Class.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (this.state == "remove") {
removeMovieClip(this);
}
if (_root.state == "playing") {
this.i = 0;
while (this.i < 100) {
this.i++;
}
this.timeTemp = getTimer();
if ((this.timeTemp - this.lastTime) > 200) {
this.lastTime = this.timeTemp;
}
if (this.varName == 0) {
}
switch (this.varName) {
case 1 :
break;
case 2 :
break;
case 3 :
break;
case 4 :
break;
case 5 :
break;
case 6 :
break;
}
switch (this.varName) {
case 10 :
_root.tellplayer(1);
break;
case 20 :
_root.tellplayer(2);
break;
case 30 :
_root.tellplayer(3);
break;
case 40 :
_root.tellplayer(4);
break;
case 50 :
_root.tellplayer(5);
break;
case 60 :
_root.tellplayer(6);
}
if (this.hitTest(_root.objectName) == true) {
}
if (_root.object.hitTest(this.x, this.y, true) == true) {
}
if ((this.y < -10) || (this.y > 490)) {
removeMovieClip(this);
}
if ((this.x < -10) || (this.x > 640)) {
removeMovieClip(this);
}
if (this.xspeed > this.maxSpeed) {
this.xspeed = this.maxSpeed;
} else if (this.xspeed < (-this.maxSpeed)) {
this.xspeed = -this.maxSpeed;
}
if (this.yspeed > this.maxSpeed) {
this.yspeed = this.maxSpeed;
} else if (this.yspeed < (-this.maxSpeed)) {
this.yspeed = -this.maxSpeed;
}
this.y = this.y + this.yspeed;
this.x = this.x + this.xspeed;
this._x = int(this.x);
this._y = int(this.y);
}
};
Object.registerClass("object", object1Class);
function pausebtnpress() {
if (gameState == "playing") {
gameState = "paused";
attachMovie("paused_clip", "tellPlayer", 9);
tellPlayer._x = 320;
tellPlayer._y = 240;
} else if (gameState == "paused") {
removeMovieClip("tellPlayer");
gameState = "playing";
}
}
function setup() {
gameState = "begin";
hurtDamage = 3;
level = 1;
_quality = _root.gameQuality;
var _local3 = new Object();
_local3.onMouseDown = function () {
if ((gameState == "playing") || (gameState == "timeFrozen")) {
trace("mouse clicked");
firePlayersGun();
}
};
Mouse.addListener(_local3);
extralives = 0;
_root.lives = 0;
_root.score = 0;
_global.playerState = 1;
_global.px = 200;
_global.py = 450;
_global.gameState = "begin";
acl = 0;
_global.prot = 0;
_root.pnum = 2;
gameScene = "GAME";
playmusic();
}
function musicon() {
this.on_off.gotoAndStop(1);
musicstate = 1;
storage.data.musicsetting = 1;
playmusic();
}
function musicoff() {
stopmusic();
this.on_off.gotoAndStop(2);
musicstate = 0;
storage.data.musicsetting = 0;
}
if (musicstate == 0) {
this.on_off.gotoAndStop(2);
}
function snailClass() {
}
snailClass.prototype = new MovieClip();
snailClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.maxSpeed = 20;
this.lbState = "waiting";
this.Wait = 60 + random(300);
this.Count = 0;
};
snailClass.prototype.onEnterFrame = function () {
if (gameState == "paused") {
}
if (this.lbState == "remove") {
removeMovieClip(this);
}
if (gameState == "playing") {
if (this.lbState == "move") {
this.x = this.x + this.xspeed;
this._x = int(this.x);
if (this.hitTest(player) == true) {
hurtPlayer();
}
if (this.xspeed > 0) {
if (this.x > 670) {
this.lbstate = "waiting";
this.x = this.startx;
}
}
if (this.xspeed < 0) {
if (this.x < -10) {
this.lbstate = "waiting";
this.x = this.startx;
}
}
}
if (this.lbState == "waiting") {
this.Count++;
if (this.Count > this.Wait) {
this.lbState = "move";
this.Count = 0;
this.yc = 0.1;
if (this.x < 0) {
this.xspeed = 1.5;
} else {
this.xspeed = -1.5;
}
}
}
if (this.lbState == "destroy") {
addPointsBonus(this.x, this.y);
score = score + 500;
playerscore.gotoAndPlay(2);
this.lbState = "start fade";
}
if (this.lbState == "start fade") {
this.fadeCount = 0;
this.fadeWait = 20;
this.lbState = "fade";
}
if (this.lbState == "fade") {
this._alpha = this._alpha - 5;
this.fadeCount++;
if (this.fadeCount > this.fadeWait) {
replaceSnail();
}
}
}
};
Object.registerClass("snail", snailClass);
function addBonus(posx, posy) {
enemyHolder.attachMovie("powerUp", "powerUp" + enemyLevel, enemyLevel);
eval ("enemyHolder.powerUp" + enemyLevel)._x = posx;
eval ("enemyHolder.powerUp" + enemyLevel)._y = posy;
enemyLevel++;
}
function addPointsBonus(posx, posy) {
enemyHolder.attachMovie("PointsPowerUp", "powerUp" + enemyLevel, enemyLevel);
eval ("enemyHolder.powerUp" + enemyLevel)._x = posx;
eval ("enemyHolder.powerUp" + enemyLevel)._y = posy;
enemyLevel++;
}
function splitBall(tnumb, bname, stringName) {
switch (tnumb) {
case 1 :
score = score + 300;
break;
case 2 :
score = score + 250;
break;
case 3 :
score = score + 200;
break;
case 4 :
score = score + 150;
break;
case 5 :
score = score + 100;
break;
default :
score = score + 50;
}
playerscore.gotoAndPlay(2);
posx = eval ("enemyHolder." + bname)._x;
posy = eval ("enemyHolder." + bname)._y;
bdir = eval ("enemyHolder." + bname).xspeed;
if (random(3) == 1) {
trace("adding powerup2");
enemyHolder.attachMovie("powerUp", "powerUp" + enemyLevel, enemyLevel);
eval ("enemyHolder.powerUp" + enemyLevel)._x = posx;
eval ("enemyHolder.powerUp" + enemyLevel)._y = posy;
enemyLevel++;
}
if (tnumb > 1) {
switch (tnumb - 1) {
case 1 :
apart = 15;
break;
case 2 :
apart = 30;
break;
case 3 :
apart = 50;
break;
case 4 :
apart = 65;
break;
default :
apart = 10;
}
enemyHolder.attachMovie("ball_clip", "ball" + enemyLevel, enemyLevel);
with (eval ("enemyHolder.ball" + enemyLevel)) {
_x = posx - (apart / 2);
_y = posy;
clip.ballType = tnumb - 1;
clip.xspeed = (-Math.abs(bdir)) - 0.5;
clip.bstate = "normal";
}
enemyLevel++;
enemyHolder.attachMovie("ball_clip", "ball" + enemyLevel, enemyLevel);
with (eval ("enemyHolder.ball" + enemyLevel)) {
_x = posx + (apart / 2);
_y = posy;
clip.ballType = tnumb - 1;
clip.xspeed = Math.abs(bdir) + 0.5;
clip.bstate = "normal";
}
_root.enemyLevel++;
}
removeMovieClip(eval ("enemyHolder.bullet" + stringName));
firedBullets--;
if (firedBullets < 0) {
firedBullets = 0;
}
removeMovieClip(eval ("enemyHolder." + bname));
tBallCount = 0;
j = 1;
while (j < 150) {
if (eval ("enemyHolder.ball" + j)._x != undefined) {
tBallCount++;
}
j++;
}
if (tBallCount == 0) {
levelComplete();
}
trace("tBallCount = " + tBallCount);
}
function tellplayer(num) {
attachMovie("tell_player", "tellPlayer", 9);
with (tellPlayer) {
_x = 320;
_y = 240;
clip.gotoAndStop(num);
}
_root.playerscore.gotoAndPlay(2);
if (num == 9) {
extralife_snd.start();
}
switch (num) {
case 1 :
_root.score = _root.score + 500;
_root.sound1.start();
return;
case 2 :
_root.score = _root.score + 750;
_root.sound2.start();
return;
case 3 :
_root.score = _root.score + 1000;
_root.sound3.start();
return;
case 4 :
_root.score = _root.score + 2000;
_root.sound4.start();
return;
case 5 :
_root.score = _root.score + 3000;
_root.sound5.start();
return;
case 6 :
_root.score = _root.score + 4000;
_root.sound6.start();
return;
}
}
function setuplevel() {
playerHealth = 100;
gameState = "paused";
levelann = "Level " + level;
attachMovie("level_announce", "tellPlayer", 9);
tellPlayer._x = 320;
tellPlayer._y = 240;
background.gotoAndStop(level);
i = 0;
while (i < 500) {
removeMovieClip(eval ("holder.clip" + i));
i++;
}
attachMovie("player", "player", 199);
player._x = 320;
player._y = 455;
playerState = 1;
temparray = eval (("level" + level) + "data");
_root.enemyLevelStart = 1;
_root.enemyLevel = _root.enemyLevelStart;
_root.gameArray = new Array();
levelBalls = 0;
j = 0;
while (j < temparray.length) {
tItem = temparray[j];
tItemA = temparray[j + 1];
tItemB = temparray[j + 2];
if (tItem == "br1") {
enemyHolder.attachMovie("level_blocks", "levelB" + enemyLevel, enemyLevel);
with (eval ("enemyHolder.levelB" + enemyLevel)) {
_x = tItemA;
_y = tItemB;
clip.lbType = 1;
}
enemyLevel++;
}
if (tItem == "br2") {
enemyHolder.attachMovie("level_blocks", "levelB" + enemyLevel, enemyLevel);
with (eval ("enemyHolder.levelB" + enemyLevel)) {
_x = tItemA;
_y = tItemB;
clip.lbType = 2;
}
enemyLevel++;
}
if (tItem == "snail") {
ta = random(2);
if (ta == 0) {
ta = -100;
}
if (ta == 1) {
ta = 740;
}
enemyHolder.attachMovie("snail", "snail", enemyLevel);
with (enemyHolder.snail) {
_x = ta;
_y = ground;
}
if (ta > 600) {
enemyHolder.snail._xscale = -100;
}
enemyLevel++;
}
if (tItem == "bird") {
ta = random(2);
if (ta == 0) {
ta = -100;
}
if (ta == 1) {
ta = 740;
}
enemyHolder.attachMovie("bird", "bird", enemyLevel);
with (enemyHolder.bird) {
_x = ta;
_y = 200;
}
if (ta > 600) {
enemyHolder.bird._xscale = -100;
}
enemyLevel++;
}
if (tItem == "ball") {
enemyHolder.attachMovie("ball_clip", "ball" + enemyLevel, enemyLevel);
with (eval ("enemyHolder.ball" + enemyLevel)) {
_x = tItemB;
_y = 150;
clip.ballType = tItemA;
clip.xspeed = 3;
clip.bstate = "normal";
}
switch (tItemA) {
case 1 :
levelBalls = levelBalls + 1;
break;
case 2 :
levelBalls = levelBalls + 3;
break;
case 3 :
levelBalls = levelBalls + 7;
break;
case 4 :
levelBalls = levelBalls + 15;
break;
case 5 :
levelBalls = levelBalls + 31;
break;
default :
levelBalls = levelBalls + 1;
}
enemyLevel++;
}
j = j + 3;
}
if (level == 1) {
levelBalls = 14;
}
if (level == 2) {
levelBalls = 14;
}
playerGun = 1;
maxBullets = 1;
trace("AMOUNT TO KILL = " + levelBalls);
playerBulletType = 1;
CurrentWeapon_Clip.gotoAndStop(1);
if (playerBulletType == 2) {
CurrentWeapon_Clip.gotoAndStop(3);
maxBullets = 5;
}
bulletNum = 0;
firedBullets = 0;
playmusic();
}
function testiflifelost() {
if (playerHealth < 0) {
playerHealth = 0;
n = getNextHighestDepth();
displayHolder.attachMovie("lifelost", "ll", n);
displayHolder.ll._x = 320;
displayHolder.ll._y = 240;
attachMovie("playerExplosion", "playerExplosion", 7);
playerExplosion._x = px;
playerExplosion._y = py;
playerExplosionSnd.start();
lives--;
if (lives < 0) {
trace("game over");
gameState = "game over";
} else {
gameState = "paused";
}
}
this.lifeMeter_clip.life_bar_clip._xscale = playerHealth;
}
Frame 27 (18 B)
setup();
stop();
Instance of Symbol 235 MovieClip in Frame 27 (50 B)
onClipEvent (enterFrame) {
_root.frameaction();
}
Frame 29 (217 B)
if (score > yourhigh) {
yourhigh = score;
storage.data.myhighscore = score;
} else {
newHighScore_clip._y = 500;
}
storage.data.uptolevel = level;
storage.flush();
gamescene = "game over";
playmusic();
Frame 36 (8 B)
stop();
Frame 37 (522 B)
function gomain() {
_root.state = "start again";
gotoAndPlay (9);
}
function savetilechoice() {
storage.data.mytileset = tileset;
storage.flush();
}
function musicon() {
this.options.on_off.gotoAndStop(1);
musicstate = 1;
storage.data.musicsetting = 1;
playmusic();
}
function musicoff() {
stopmusic();
this.options.on_off.gotoAndStop(2);
musicstate = 0;
storage.data.musicsetting = 0;
}
if (musicstate == 0) {
this.options.on_off.gotoAndStop(2);
}
gameScene = "OPTIONS";
playmusic();
Frame 45 (8 B)
stop();
Frame 46 (180 B)
function gomain() {
_root.state = "start again";
gotoAndPlay (9);
}
if (musicstate == 0) {
this.options.on_off.gotoAndStop(2);
}
gameScene = "HOW TO PLAY";
playmusic();
Frame 54 (8 B)
stop();
Frame 55 (171 B)
if (score > yourhigh) {
yourhigh = score;
storage.data.myhighscore = score;
}
storage.data.uptolevel = 1;
level = 1;
gameScene = "GAME FINISHED";
playmusic();
Frame 63 (8 B)
stop();
Symbol 8 MovieClip Frame 1 (202 B)
_root.stop();
PercentLoaded = Math.floor((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (PercentLoaded != 100) {
setProperty(bar, _xscale , PercentLoaded);
} else {
_root.play();
}
Symbol 8 MovieClip Frame 2 (17 B)
gotoAndPlay (1);
Symbol 20 MovieClip Frame 1 (8 B)
stop();
Symbol 21 MovieClip [tell_player] Frame 65 (23 B)
removeMovieClip(this);
Symbol 25 MovieClip [ready_announce] Frame 76 (49 B)
_root.state = "playing";
removeMovieClip(this);
Symbol 27 MovieClip Frame 1 (8 B)
stop();
Symbol 29 MovieClip Frame 1 (8 B)
stop();
Symbol 31 MovieClip Frame 1 (8 B)
stop();
Symbol 38 MovieClip [player] Frame 1 (8 B)
stop();
Symbol 43 Button (40 B)
on (release) {
_root.pausebtnpress();
}
Symbol 44 MovieClip [paused_clip] Frame 30 (8 B)
stop();
Symbol 46 MovieClip [lifelost] Frame 80 (59 B)
_parent.gameState = "start again";
removeMovieClip(this);
Symbol 51 MovieClip [level_announce] Frame 77 (55 B)
_parent.gameState = "playing";
removeMovieClip(this);
Symbol 80 MovieClip [playerExplosion] Frame 31 (8 B)
stop();
Symbol 84 MovieClip [arrowBullet] Frame 1 (8 B)
stop();
Symbol 125 MovieClip Frame 1 (8 B)
stop();
Symbol 135 Button (84 B)
on (release) {
getURL ("http://www.macromedia.com/go/getflashplayer/", "_blank");
}
Symbol 138 Button (31 B)
on (release) {
_root.play();
}
Symbol 148 Button (112 B)
on (release) {
getURL (((("mailto:" + _root.authorContact) + "?subject=") + _root.gameTitle) + " licensing");
}
Symbol 149 MovieClip Frame 1 (8 B)
stop();
Symbol 157 MovieClip Frame 1 (14 B)
_root.stop();
Symbol 157 MovieClip Frame 96 (14 B)
_root.play();
Symbol 161 MovieClip Frame 1 (8 B)
stop();
Symbol 175 MovieClip Frame 23 (8 B)
stop();
Symbol 176 Button (35 B)
on (release) {
gotoAndPlay (37);
}
Symbol 180 Button (35 B)
on (release) {
gotoAndPlay (46);
}
Symbol 183 MovieClip Frame 1 (8 B)
stop();
Symbol 188 Button (37 B)
on (release) {
_root.resetlevel();
}
Symbol 194 Button (33 B)
on (press) {
_root.playgame();
}
Symbol 199 Button (33 B)
on (press) {
_root.playgame();
}
Symbol 202 MovieClip Frame 1 (8 B)
stop();
Symbol 206 Button (52 B)
on (press) {
_root.musicoff();
this.over.play();
}
Symbol 209 Button (51 B)
on (press) {
_root.musicon();
this.over.play();
}
Symbol 210 MovieClip Frame 1 (8 B)
stop();
Symbol 216 MovieClip Frame 1 (8 B)
stop();
Symbol 220 Button (38 B)
on (press) {
_root.pausebtnpress();
}
Symbol 233 MovieClip Frame 1 (8 B)
stop();
Symbol 247 Button (64 B)
on (release) {
_root.state = "start again";
gotoAndPlay (9);
}
Symbol 249 MovieClip Frame 1 (8 B)
stop();
Symbol 250 Button (33 B)
on (release) {
_root.gomain();
}
Symbol 255 Button (65 B)
on (release) {
getURL ("http://www.terrypaton.com", "_blank");
}
Symbol 258 MovieClip Frame 1 (8 B)
stop();
Symbol 263 MovieClip Frame 1 (8 B)
stop();
Symbol 264 Button (34 B)
on (release) {
gotoAndPlay (9);
}