Frame 1
function gameMenu(menu, obj) {
getURL (_root.authorsSite, "_blank");
}
_root.externalMusic = 0;
_root.gameTitle = "worm";
_root.gameDesc = "Crazy Wiggling Fun!";
_root.vNum = "v1.0";
_root.flashVersionsNeeded = 8;
_root.legalDomain = "http://uploads.ungrounded.net";
_root.authorName = "Terry Paton";
_root.authorContact = "terry@terrypaton.com";
_root.authorsSite = "http://www.terrypaton.com";
_root.gameLocation = _root._url.substr(0, legalDomain.length);
_root.gameQuality = "AUTO";
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 119 MovieClip in Frame 4
onClipEvent (load) {
var flashVersion = System.capabilities.version;
_root.flashVersionsinstalled = flashVersion.substr(4, 1);
trace(_root.flashVersionsinstalled);
if (_root.flashVersionsNeeded > _root.flashVersionsinstalled) {
_root.stop();
this.gotoAndStop(2);
} else if (_root.gameLocation != _root.legalDomain) {
_root.stop();
this.gotoAndStop(3);
}
}
Frame 6
function flyingBlobClass() {
}
flyingBlobClass.prototype = new MovieClip();
flyingBlobClass.prototype.onLoad = function () {
this.x = -50 - random(300);
this.y = random(480);
this.gotoAndStop(random(5) + 1);
this.speed = random(5) + 2;
this._x = this.x;
this._y = this.y;
};
flyingBlobClass.prototype.onEnterFrame = function () {
this.x = this.x + this.speed;
this._x = this.x;
this._y = this.y;
if (this.x > 680) {
this.x = -50 - random(300);
this.y = random(480);
this.gotoAndStop(random(5) + 1);
this.speed = random(5) + 2;
}
};
Object.registerClass("flyingBlobs", flyingBlobClass);
level1data = new Array(100, 100, 5, 5);
level1quota = 5;
level2quota = 7;
level3quota = 10;
level4quota = 12;
level5quota = 14;
level6quota = 16;
level7quota = 18;
level8quota = 20;
level9quota = 22;
Frame 7
hitWallSnd = new Sound();
hitWallSnd.attachSound("hitWallSound");
sound2 = new Sound();
sound2.attachSound("sound2");
sound3 = new Sound();
sound3.attachSound("sound3");
sound4 = new Sound();
sound4.attachSound("sound4");
sound5 = new Sound();
sound5.attachSound("sound5");
sound6 = new Sound();
sound6.attachSound("sound6");
sound7 = new Sound();
sound7.attachSound("sound7");
sound8 = new Sound();
sound8.attachSound("sound8");
sound9 = new Sound();
sound9.attachSound("sound9");
sound10 = new Sound();
sound10.attachSound("sound10");
speedUpSnd = new Sound();
speedUpSnd.attachSound("speedUpSound");
gameMusic = new Sound();
gameMusic.attachSound("music2");
intromusic = new Sound();
intromusic.attachSound("music1");
Frame 8
function stopmusic() {
gameMusic.stop();
optionsmusic.stop();
intromusic.stop();
gameovermusic.stop();
gamefinishedmusic.stop();
}
function playmusic() {
if (musicstate == 1) {
stopmusic();
trace("playing music");
switch (gameScene) {
case "INTRO" :
intromusic.start(0, 90);
return;
case "GAME" :
gameMusic.start(0, 90);
return;
case "GAME OVER" :
return;
case "CREDITS" :
return;
case "HOW TO PLAY" :
return;
case "GAME FINISHED" :
intromusic.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
function playgame() {
gotoAndPlay (55);
}
function resetlevel() {
this.resetclip.resetclip.gotoAndPlay(2);
storage.data.myhighscore = 0;
yourhigh = 0;
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;
}
_root.level = 1;
delete state;
_quality = "HIGH";
if (level > 1) {
playcont.gotoAndStop(2);
}
gameScene = "INTRO";
playmusic();
i = 0;
while (i < 5) {
i++;
}
i = 0;
while (i < 5) {
i++;
}
if (musicstate == 0) {
this.options.on_off.gotoAndStop(2);
}
Frame 54
stop();
Frame 55
function powerUpClass() {
}
powerUpClass.prototype = new MovieClip();
powerUpClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.yspeed = random(3) + 1;
this.xspeed = random(4) + 1;
this.maxSpeed = 5;
this.starttime = getTimer();
this.state = "normal";
this.typeOfpowerUp = random(4) + 1;
this.pointsawarded = 100;
this._rotation = random(360);
this.gotoAndStop(this.typeOfpowerUp);
};
powerUpClass.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (this.state == "remove") {
removeMovieClip(this);
}
if (_root.state == "playing") {
switch (this.typeOfpowerUp) {
case 1 :
this._rotation = this._rotation + 10;
if (this.y < stageTop) {
this.y = stageTop;
this.yspeed = -this.yspeed;
}
if (this.y > stageBottom) {
this.y = stageBottom;
this.yspeed = -this.yspeed;
}
if (this.x > stageRight) {
this.x = stageRight;
this.xspeed = -this.xspeed;
}
if (this.x < stageLeft) {
this.x = stageLeft;
this.xspeed = -this.xspeed;
}
this.y = this.y + (this.yspeed * speedModifier);
this.x = this.x + (this.xspeed * speedModifier);
break;
case 2 :
break;
case 3 :
this._rotation = this._rotation + 10;
break;
case 4 :
break;
}
if (this.hitTest(_root.player) == true) {
trace("power up has hit player");
switch (this.typeOfpowerUp) {
case 1 :
speedUpSnd.start();
speedupPowerUp();
break;
case 2 :
sound2.start();
slowDownPowerUp();
break;
case 3 :
sound3.start();
superTail();
break;
case 4 :
sound4.start();
shrinkPowerUp();
break;
}
_root.score = _root.score + this.pointsawarded;
state = "playing";
powerUpEffect = this.typeOfpowerUp;
removeMovieClip(this);
}
this._x = int(this.x);
this._y = int(this.y);
}
};
Object.registerClass("powerUp", powerUpClass);
function damagePlayer() {
playerEnergy = playerEnergy - 1;
if (playerEnergy < 0) {
playerEnergy = 0;
}
energyBar.energyBar_Bar._xscale = playerEnergy;
energyBar.energyLoss.gotoAndPlay(2);
if (playerEnergy < 1) {
state = "game over";
}
i = 0;
while (i < 100) {
eval ("playersTrail.pt" + i).gotoAndPlay(2);
i++;
}
}
function playerHitsWall() {
hitWallSnd.start();
playerEnergy = playerEnergy - 10;
if (playerEnergy < 0) {
playerEnergy = 0;
}
energyBar.energyBar_Bar._xscale = playerEnergy;
energyBar.energyLoss.gotoAndPlay(2);
if (playerEnergy < 1) {
state = "game over";
}
i = 0;
while (i < 100) {
eval ("playersTrail.pt" + i).gotoAndPlay(2);
i++;
}
}
function enemy2Class() {
}
enemy2Class.prototype = new MovieClip();
enemy2Class.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.maxSpeed = 5;
this.starttime = getTimer();
this.state = "normal";
};
enemy2Class.prototype.onEnterFrame = function () {
if (this.state == "kill") {
trace("kill");
this.killCount = 10;
this.state = "dying";
}
if (this.state == "dying") {
this._alpha = this._alpha - 10;
this.killCount--;
if (this.killCount < 1) {
removeMovieClip(this);
}
}
if (_root.state == "paused") {
}
if (_root.state == "playing") {
if (this.state == "stun") {
this.stunCount = 60;
this.state = "stun wait";
}
if (this.state == "stun wait") {
this.stunCount--;
if (this.stunCount < 0) {
this.state = "normal";
}
}
if (this.state == "normal") {
this._rotation = this._rotation + 10;
if (this.y < stageTop) {
this.y = stageTop;
this.clip.yspeed = -this.clip.yspeed;
this.clip.xspeed = -this.clip.xspeed;
}
if (this.y > stageBottom) {
this.y = stageBottom;
this.clip.yspeed = -this.clip.yspeed;
this.clip.xspeed = -this.clip.xspeed;
}
if (this.x > stageRight) {
this.x = stageRight;
this.clip.yspeed = -this.clip.yspeed;
this.clip.xspeed = -this.clip.xspeed;
}
if (this.x < stageLeft) {
this.x = stageLeft;
this.clip.yspeed = -this.clip.yspeed;
this.clip.xspeed = -this.clip.xspeed;
}
this.y = this.y + (this.clip.yspeed * speedModifier);
this.x = this.x + (this.clip.xspeed * speedModifier);
this._x = int(this.x);
this._y = int(this.y);
if (Math.abs(this.x - px) < (25 * (playerScale / 100))) {
if (Math.abs(this.y - py) < (25 * (playerScale / 100))) {
sound1.start();
playerEnergy = playerEnergy - 1;
damagePlayer();
}
}
}
}
};
Object.registerClass("enemy1", enemy2Class);
function enemyBClass() {
}
enemyBClass.prototype = new MovieClip();
enemyBClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.maxSpeed = 5;
this.starttime = getTimer();
this.state = "normal";
this.mNum = 0;
trace("level = " + level);
if (level < 5) {
this.bugType = 0;
}
if ((level == 5) || (level == 6)) {
this.bugType = random(2);
}
if (level > 6) {
this.bugType = random(3);
}
this.body.gotoAndStop(this.bugType + 1);
};
enemyBClass.prototype.onEnterFrame = function () {
if (this.state == "kill") {
trace("kill");
this.killCount = 10;
this.state = "dying";
}
if (this.state == "dying") {
this._alpha = this._alpha - 10;
this.killCount--;
if (this.killCount < 1) {
removeMovieClip(this);
}
}
if (_root.state == "paused") {
}
if (_root.state == "playing") {
if (this.state == "stun") {
this.stunCount = 60;
this.state = "stun wait";
}
if (this.state == "stun wait") {
this.stunCount--;
if (this.stunCount < 0) {
this.state = "normal";
}
}
if (this.state == "normal") {
this._rotation = this._rotation + 10;
if (this.y < stageTop) {
this.y = stageTop;
this.clip.yspeed = -this.clip.yspeed;
this.clip.xspeed = -this.clip.xspeed;
}
if (this.y > stageBottom) {
this.y = stageBottom;
this.clip.yspeed = -this.clip.yspeed;
this.clip.xspeed = -this.clip.xspeed;
}
if (this.x > stageRight) {
this.x = stageRight;
this.clip.yspeed = -this.clip.yspeed;
this.clip.xspeed = -this.clip.xspeed;
}
if (this.x < stageLeft) {
this.x = stageLeft;
this.clip.yspeed = -this.clip.yspeed;
this.clip.xspeed = -this.clip.xspeed;
}
if (this.bugType == 0) {
this.mNum = this.mNum + 0.05;
this.y = this.y + ((4 * Math.cos(this.mNum)) * speedModifier);
this.x = this.x + ((4 * Math.sin(this.mNum)) * speedModifier);
}
if (this.bugType == 1) {
this.mNum = this.mNum + 0.05;
this.y = this.y + ((4 * Math.sin(this.mNum)) * speedModifier);
this.x = this.x + ((4 * Math.cos(this.mNum)) * speedModifier);
}
if (this.bugType == 2) {
this.mNum = this.mNum + 0.03;
this.y = this.y + ((3 * Math.cos(this.mNum)) * speedModifier);
this.x = this.x + ((6 * Math.sin(this.mNum)) * speedModifier);
}
this._x = int(this.x);
this._y = int(this.y);
if (Math.abs(this.x - px) < (25 * (playerScale / 100))) {
if (Math.abs(this.y - py) < (25 * (playerScale / 100))) {
sound1.start();
playerEnergy = playerEnergy - 1;
damagePlayer();
}
}
}
}
};
Object.registerClass("enemy2", enemyBClass);
function obstacleTest() {
ytest = py;
xtest = px;
if (pxmove < 0) {
xtest = px - 20;
}
if (pxmove > 0) {
xtest = px + 20;
}
if (pymove < 0) {
ytest = py - 20;
}
if (pymove > 0) {
ytest = py + 20;
}
if (this.LevelObstacles.hitTest(xtest, ytest, true)) {
damagePlayer();
if (pxmove < 0) {
if (py < 240) {
pymove = MaxSpeed;
pxmove = 0;
player._rotation = 180;
} else {
pymove = -MaxSpeed;
pxmove = 0;
player._rotation = 0;
}
}
if (pxmove > 0) {
if (py < 240) {
pymove = MaxSpeed;
pxmove = 0;
player._rotation = 180;
} else {
pymove = -MaxSpeed;
pxmove = 0;
player._rotation = 0;
}
}
if (pymove < 0) {
if (px < 320) {
pxmove = MaxSpeed;
pymove = 0;
player._rotation = 90;
} else {
pxmove = -MaxSpeed;
pymove = 0;
player._rotation = -90;
}
}
if (pymove < 0) {
if (px < 320) {
pxmove = MaxSpeed;
pymove = 0;
player._rotation = 90;
} else {
pxmove = -MaxSpeed;
pymove = 0;
player._rotation = -90;
}
}
}
}
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 pausebtnpress() {
if (_root.state == "playing") {
_root.state = "paused";
attachMovie("paused_clip", "tellPlayer", 9);
tellPlayer._x = 320;
tellPlayer._y = 240;
} else if (_root.state == "paused") {
removeMovieClip("tellPlayer");
_root.state = "playing";
}
}
function frameaction() {
if (state == "start again") {
attachMovie("ready_announce", "tellPlayer", 9);
tellPlayer._x = 320;
tellPlayer._y = 240;
_global.playerState = 1;
attachMovie("player", "player", 180);
player._x = px;
player._y = py;
this.state = "paused";
}
if (state == "paused") {
trace("paused");
}
if (state == "power up wait start") {
pxmove = 0;
pymove = 0;
ptx = px;
pty = py;
powerWaitCount = 0;
powerWaitDelay = 0;
state = "power up wait";
}
if (state == "waiting for player to start") {
leftKeyPress = Key.isDown(leftKey);
rightKeyPress = Key.isDown(rightKey);
downKeyPress = Key.isDown(downKey);
upKeyPress = Key.isDown(upKey);
if (downKeyPress == true) {
xmove = MinSpeed;
ymove = MinSpeed;
state = "playing";
removeMovieClip(tellPlayer);
}
if (rightKeyPress == true) {
xmove = MinSpeed;
ymove = MinSpeed;
state = "playing";
removeMovieClip(tellPlayer);
}
if (leftKeyPress == true) {
xmove = -MinSpeed;
ymove = 0;
state = "playing";
removeMovieClip(tellPlayer);
}
if (upKeyPress == true) {
xmove = 0;
ymove = -MinSpeed;
state = "playing";
removeMovieClip(tellPlayer);
}
}
if (state == "power up wait") {
powerWaitCount++;
if (powerWaitCount > powerWaitDelay) {
state = "playing";
}
}
if (state == "begin") {
setuplevel();
state = "paused";
}
if (state == "playing") {
playerEnergy = playerEnergy - 0.03;
if (playerEnergy < 0) {
playerEnergy = 0;
}
if (playerEnergy < 1) {
state = "game over";
}
energyBar.energyBar_Bar._xscale = playerEnergy;
leftKeyPress = Key.isDown(leftKey);
rightKeyPress = Key.isDown(rightKey);
downKeyPress = Key.isDown(downKey);
upKeyPress = Key.isDown(upKey);
if ((((leftKeyPress == true) && (rightKeyPress == false)) && (upKeyPress == false)) && (downKeyPress == false)) {
if (pxmove < 1) {
pxmove = -MaxSpeed;
pymove = 0;
player._rotation = -90;
}
}
if ((((leftKeyPress == false) && (rightKeyPress == true)) && (upKeyPress == false)) && (downKeyPress == false)) {
if (pxmove > -1) {
pxmove = MaxSpeed;
pymove = 0;
player._rotation = 90;
}
}
if ((((leftKeyPress == false) && (rightKeyPress == false)) && (upKeyPress == true)) && (downKeyPress == false)) {
if (pymove < 1) {
pymove = -MaxSpeed;
pxmove = 0;
player._rotation = 0;
}
}
if ((((leftKeyPress == false) && (rightKeyPress == false)) && (upKeyPress == false)) && (downKeyPress == true)) {
if (pymove > -1) {
pymove = MaxSpeed;
pxmove = 0;
player._rotation = 180;
}
}
px = px + pxmove;
py = py + pymove;
player._x = px;
player._y = py;
if (Math.abs(enemyHolder.levelTarget._x - px) < (30 * (playerScale / 100))) {
if (Math.abs(enemyHolder.levelTarget._y - py) < (30 * (playerScale / 100))) {
sound10.start();
playerEnergy = playerEnergy + 3;
if (playerEnergy > 100) {
playerEnergy = 100;
}
energyBar.energyBar_Bar._xscale = playerEnergy;
energyBar.energyLoss.gotoAndPlay(2);
removeMovieClip("enemyHolder.levelTarget");
player.itemCollected_clip.gotoAndPlay(1);
score = score + 100;
playerscore.gotoAndPlay(2);
currentLevelCollect++;
currentLevelquota = eval (("level" + level) + "quota");
remainObjects = currentLevelquota - currentLevelCollect;
if (currentLevelCollect >= currentLevelquota) {
state = "level complete";
removeMovieClip(player);
playerEnergy = playerEnergy + 15;
if (playerEnergy > 100) {
playerEnergy = 100;
}
energyBar.energyBar_Bar._xscale = playerEnergy;
} else {
MaxSpeed = MaxSpeed + 0.5;
playersTrail.attachMovie("playerSegment", "pt" + pTrailNum, pTrailNum);
pTrailNum++;
playersTrail.attachMovie("playerSegment", "pt" + pTrailNum, pTrailNum);
pTrailNum++;
addTarget();
}
}
}
if (addmoreTails > 0) {
addmoreTails--;
playersTrail.attachMovie("playerSegment", "pt" + pTrailNum, pTrailNum);
pTrailNum++;
}
if (px < stageLeft) {
playerHitsWall();
if (py < 240) {
pymove = MaxSpeed;
pxmove = 0;
player._rotation = 180;
} else {
pymove = -MaxSpeed;
pxmove = 0;
player._rotation = 0;
}
px = stageLeft;
ptx = stageLeft;
}
if (px > stageRight) {
if (py < 240) {
pymove = MaxSpeed;
pxmove = 0;
player._rotation = 180;
} else {
pymove = -MaxSpeed;
pxmove = 0;
player._rotation = 0;
}
playerHitsWall();
px = stageRight;
ptx = stageRight;
}
if (py < stageTop) {
playerHitsWall();
if (px < 320) {
pxmove = MaxSpeed;
pymove = 0;
player._rotation = 90;
} else {
pxmove = -MaxSpeed;
pymove = 0;
player._rotation = -90;
}
py = stageTop;
pty = stageTop;
}
if (py > stageBottom) {
playerHitsWall();
if (px < 320) {
pxmove = MaxSpeed;
pymove = 0;
player._rotation = 90;
} else {
pxmove = -MaxSpeed;
pymove = 0;
player._rotation = -90;
}
py = stageBottom;
pty = stageBottom;
}
xOff = px - lastpx;
yOff = py - lastpy;
tailArray.unshift(px, py);
upTo = pTrailNum;
k = 0;
while (k < (pTrailNum * 2)) {
eval ("playersTrail.pt" + upTo)._x = tailArray[k] + random(2);
eval ("playersTrail.pt" + upTo)._y = tailArray[k + 1] + random(2);
upTo--;
k = k + 2;
}
if (tailArray.length > 250) {
tailArray.pop();
tailArray.pop();
}
ytest = py;
xtest = px;
if (pxmove < 0) {
xtest = px - 30;
}
if (pxmove > 0) {
xtest = px + 30;
}
if (pymove < 0) {
ytest = py - 30;
}
if (pymove > 0) {
ytest = py + 30;
}
if (powerUpWait == 1) {
powerUpWait = 0;
} else if (this.playersTrail.hitTest(xtest, ytest, true)) {
trace(py);
trace(ytest);
trace("HIT OWN TAIL");
state = "game over";
}
obstacleTest();
}
if (state == "level complete") {
i = 0;
while (i < 500) {
removeMovieClip(eval ("enemyHolder.b" + i));
i++;
}
i = 200;
while (i < 220) {
removeMovieClip(eval ("enemyHolder.powerUp" + i));
i++;
}
i = 0;
while (i < 100) {
removeMovieClip(eval ("playersTrail.pt" + i));
i++;
}
attachMovie("level_complete", "tellPlayer", 200);
tellPlayer._x = 320;
tellPlayer._y = 240;
state = "level complete wait";
count = 76;
}
if (state == "level complete wait") {
count--;
if (count < 1) {
state = "next level";
}
}
if (state == "next level") {
level++;
if (level > 9) {
removeMovieClip(player);
gotoAndPlay (96);
} else {
setuplevel();
}
}
if (state == "game over") {
removeMovieClip(player);
gotoAndPlay ("GAMEOVER");
}
}
function addmoreBaddies() {
trace("enemyLevel = " + enemyLevel);
if (level < 3) {
enemyHolder.attachMovie("enemy1", "b" + enemyLevel, enemyLevel);
}
if ((level == 3) || (level == 4)) {
tempG = random(2);
if (tempG == 0) {
enemyHolder.attachMovie("enemy1", "b" + enemyLevel, enemyLevel);
} else {
enemyHolder.attachMovie("enemy2", "b" + enemyLevel, enemyLevel);
}
}
if (level > 4) {
tempG = random(2);
if (tempG == 0) {
enemyHolder.attachMovie("enemy1", "b" + enemyLevel, enemyLevel);
} else {
enemyHolder.attachMovie("enemy2", "b" + enemyLevel, enemyLevel);
}
}
with (eval ("enemyHolder.b" + enemyLevel)) {
c = random(2);
if (c == 0) {
} else {
_x = -20;
_y = findNewYLocation();
}
a = random(4);
switch (a) {
case 0 :
clip.xspeed = -5;
clip.yspeed = -5;
_x = findNewXLocation();
_y = -20;
if (py < 100) {
_y = 500;
}
break;
case 1 :
clip.xspeed = 5;
clip.yspeed = -5;
_x = findNewXLocation();
_y = -20;
if (py < 100) {
_y = 500;
}
break;
case 2 :
clip.xspeed = 0;
clip.yspeed = 5;
_x = findNewXLocation();
_y = -20;
if (py < 100) {
_y = 500;
}
break;
case 3 :
clip.xspeed = 5;
clip.yspeed = 0;
_x = -20;
_y = findNewYLocation();
if (px < 100) {
_x = 660;
}
break;
}
}
trace(eval ("enemyHolder.b" + enemyLevel)._x);
enemyLevel++;
}
function addPowerUp() {
if (level > 1) {
if (random(3) < 2) {
nextClip = 200;
enemyHolder.attachMovie("powerUp", "powerUp" + nextClip, nextClip);
eval ("enemyHolder.powerUp" + nextClip)._x = findNewXLocation();
eval ("enemyHolder.powerUp" + nextClip)._y = findNewYLocation();
trace(eval ("enemyHolder.powerUp" + nextClip)._y);
}
}
}
function findNewXLocation() {
tempXD = 10;
while (tempXD < 150) {
newX = random(520) + 60;
tempXD = Math.abs(px - newX);
}
return(Math.floor(newX));
}
function findNewYLocation() {
tempYD = 10;
while (tempYD < 150) {
newY = random(360) + 60;
tempYD = Math.abs(py - newY);
}
return(Math.floor(newY));
}
function speedupPowerUp() {
attachMovie("starPower", "powerClip", 198);
powerClip._x = px;
powerClip._y = py;
trace("SPEED UP");
MaxSpeed = MaxSpeed * 1.1;
}
function slowDownPowerUp() {
attachMovie("stunPower", "powerClip", 198);
powerClip._x = px;
powerClip._y = py;
trace("slowDown");
MaxSpeed = MaxSpeed * 0.6;
if (MaxSpeed < MinSpeed) {
MaxSpeed = MinSpeed;
}
}
function superTail() {
attachMovie("spiralPower", "powerClip", 198);
powerClip._x = px;
powerClip._y = py;
addmoreTails = 20;
}
function shrinkPowerUp() {
playerEnergy = playerEnergy + 10;
if (playerEnergy > 100) {
playerEnergy = 100;
}
energyBar.energyBar_Bar._xscale = playerEnergy;
attachMovie("shrinkPower", "powerClip", 198);
powerClip._x = px;
powerClip._y = py;
}
function addTarget() {
tx = findNewXLocation();
ty = findNewYLocation();
ta = this.LevelObstacles.hitTest(tx, ty, true);
while (this.LevelObstacles.hitTest(tx, ty, true)) {
tx = findNewXLocation();
ty = findNewYLocation();
}
enemyHolder.attachMovie("levelTarget", "levelTarget", 1000);
enemyHolder.levelTarget._x = tx;
enemyHolder.levelTarget._y = ty;
enemyHolder.levelTarget._rotation = random(360);
addPowerUp();
}
function setup() {
playerEnergy = 100;
level = 1;
_quality = _root.gameQuality;
var _local3 = new Object();
_local3.onMouseDown = function () {
if ((playerState == 1) && (state == "playing")) {
trace("mouse clicked");
}
};
Mouse.addListener(_local3);
extralives = 0;
_root.lives = 2;
_root.score = 0;
_global.playerState = 1;
ptx = px;
pty = py;
trNum = 1;
_global.state = "begin";
acl = 0;
_global.prot = 0;
_root.pnum = 2;
gameScene = "GAME";
}
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 setuplevel() {
enemyLevel = 1;
powerUpEffect = 0;
currentLevelCollect = 0;
currentLevelquota = eval (("level" + level) + "quota");
remainObjects = currentLevelquota - currentLevelCollect;
speedModifier = 1;
playerScale = 100;
px = 320;
py = 400;
ptx = px;
pty = py;
addTarget();
upKey = 38;
downKey = 40;
leftKey = 37;
rightKey = 39;
stageLeft = 20;
stageRight = 620;
stageTop = 20;
stageBottom = 460;
_root.state = "paused";
_root.levelann = "Level " + level;
attachMovie("level_announce", "tellPlayer", 200);
tellPlayer._x = 320;
tellPlayer._y = 240;
background.gotoAndStop(level);
background.back_blobs._rotation = random(360);
attachMovie("player", "player", 196);
player.itemCollected_clip.gotoAndPlay(1);
player._x = px;
player._y = py;
lastpx = px;
lastpy = py;
xOff = px - lastpx;
yOff = py - lastpy;
this.player.playerbody1._x = -xOff;
this.player.playerbody1._y = -yOff;
this.player.playerbody2._x = -(xOff * 2);
this.player.playerbody2._y = -(yOff * 2);
this.player.playerTail._x = -xOff;
this.player.playerTail._y = -yOff;
this.player.playerTail2._x = -(xOff * 2);
this.player.playerTail2._y = -(yOff * 2);
playerState = 1;
playmusic();
pTrailNum = 7;
tailArray = new Array();
i = 1;
while (i < pTrailNum) {
playersTrail.attachMovie("playerSegment", "pt" + i, i);
tpx = px + i;
tailArray.push(tpx);
tpy = py;
tailArray.push(tpy);
eval ("playersTrail.pt" + i)._x = tpx;
eval ("playersTrail.pt" + i)._y = tpy;
i++;
}
lastTailArray = tailArray;
MinSpeed = 8;
MaxSpeed = MinSpeed;
pxmove = 0;
pymove = 0;
leveltargetTell = currentLevelquota + " segments";
LevelObstacles.gotoAndStop(level);
addmoreTails = 0;
}
Instance of Symbol 202 MovieClip in Frame 55
onClipEvent (enterFrame) {
_root.frameaction();
}
Frame 64
setup();
stop();
Frame 66
if (score > yourhigh) {
yourhigh = score;
newscore.gotoAndStop(2);
storage.data.myhighscore = score;
}
storage.data.uptolevel = level;
storage.flush();
gamescene = "game over";
playmusic();
Frame 73
stop();
Frame 74
function gomain() {
_root.state = "start again";
gotoAndPlay (9);
}
gameScene = "CREDITS";
playmusic();
Frame 86
stop();
Frame 87
function gomain() {
_root.state = "start again";
gotoAndPlay (9);
}
if (musicstate == 0) {
this.options.on_off.gotoAndStop(2);
}
gameScene = "HOW TO PLAY";
playmusic();
Frame 95
stop();
Frame 96
if (score > yourhigh) {
yourhigh = score;
storage.data.myhighscore = score;
}
storage.data.uptolevel = 1;
level = 1;
gameScene = "GAME FINISHED";
playmusic();
Frame 110
stop();
Symbol 8 MovieClip Frame 1
_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
gotoAndPlay (1);
Symbol 20 MovieClip Frame 1
stop();
Symbol 21 MovieClip [tell_player] Frame 65
removeMovieClip(this);
Symbol 28 MovieClip [playerSegment] Frame 1
stop();
Symbol 35 MovieClip Frame 12
stop();
Symbol 44 MovieClip [shrinkPower] Frame 30
removeMovieClip(this);
Symbol 46 MovieClip [spiralPower] Frame 30
removeMovieClip(this);
Symbol 48 MovieClip [starPower] Frame 30
removeMovieClip(this);
Symbol 49 MovieClip [stunPower] Frame 30
removeMovieClip(this);
Symbol 54 Button
on (release) {
_root.pausebtnpress();
}
Symbol 55 MovieClip [paused_clip] Frame 30
stop();
Symbol 64 MovieClip [level_announce] Frame 62
_root.state = "waiting for player to start";
stop();
Symbol 68 MovieClip [level_complete] Frame 76
removeMovieClip(this);
Symbol 71 MovieClip Frame 1
stop();
Symbol 73 MovieClip [player] Frame 1
Symbol 82 MovieClip [levelTarget] Frame 15
stop();
Symbol 97 MovieClip Frame 1
stop();
Symbol 105 Button
on (release) {
getURL ("http://www.macromedia.com/go/getflashplayer/", "_blank");
}
Symbol 108 Button
on (release) {
_root.play();
}
Symbol 118 Button
on (release) {
getURL (((("mailto:" + _root.authorContact) + "?subject=") + _root.gameTitle) + " licensing");
}
Symbol 119 MovieClip Frame 1
stop();
Symbol 128 MovieClip Frame 1
_root.stop();
Symbol 128 MovieClip Frame 75
_root.play();
Symbol 140 Button
on (release) {
gotoAndPlay (74);
}
Symbol 144 Button
on (release) {
gotoAndPlay (87);
}
Symbol 149 MovieClip Frame 23
stop();
Symbol 150 Button
on (press) {
_root.musicoff();
this.over.play();
}
Symbol 153 Button
on (press) {
_root.musicon();
this.over.play();
}
Symbol 154 MovieClip Frame 1
stop();
Symbol 161 MovieClip Frame 1
stop();
Symbol 165 Button
on (release) {
_root.resetlevel();
}
Symbol 172 Button
on (press) {
_root.playgame();
}
Symbol 174 MovieClip Frame 1
stop();
Symbol 180 MovieClip Frame 1
stop();
Symbol 192 MovieClip Frame 1
stop();
Symbol 206 MovieClip Frame 1
stop();
Symbol 214 MovieClip Frame 1
stop();
Symbol 219 Button
on (press) {
_root.pausebtnpress();
}
Symbol 231 MovieClip Frame 1
stop();
Symbol 234 MovieClip Frame 1
stop();
Symbol 237 Button
on (release) {
_root.state = "start again";
gotoAndPlay (9);
}
Symbol 243 Button
on (release) {
getURL ("http://www.terrypaton.com", "_blank");
}
Symbol 245 Button
on (release) {
_root.gomain();
}
Symbol 257 Button
on (release) {
gotoAndPlay (9);
}