Combined Code
movieClip 5 {
frame 1 {
type = 1;
_root.naming(this);
}
}
movieClip 6 {
}
// unknown tag 88 length 231
movieClip 17 {
}
movieClip 19 {
}
movieClip 20 {
}
movieClip 22 {
}
movieClip 23 {
}
movieClip 24 {
}
movieClip 25 {
}
movieClip 29 {
}
button 31 {
on (release) {
getURL('http://www.armorgames.com/', '_blank');
}
}
movieClip 36 {
}
movieClip 40 {
}
movieClip 41 {
frame 1 {
this.onEnterFrame = function () {
++this._rotation;
};
}
}
movieClip 44 {
}
movieClip 46 {
}
movieClip 48 {
}
movieClip 50 {
}
movieClip 51 {
frame 1 {
}
frame 15 {
_root.dropBall(this._parent);
}
frame 39 {
stop();
}
}
movieClip 52 {
frame 1 {
_root.addStart(this);
}
}
movieClip 53 {
frame 1 {
_root.addPortal(this);
}
}
movieClip 54 {
}
movieClip 55 {
frame 1 {
_root.addOrb(this);
}
}
movieClip 57 levelMenu {
}
movieClip 59 {
}
movieClip 60 {
}
movieClip 61 whiteFlash {
frame 15 {
stop();
this.removeMovieClip();
}
}
movieClip 63 {
}
movieClip 64 orbExplode {
frame 40 {
this.removeMovieClip();
}
}
movieClip 66 {
}
movieClip 67 strokeIn {
frame 50 {
this.removeMovieClip();
}
}
movieClip 69 {
}
movieClip 70 {
frame 39 {
stop();
}
}
movieClip 73 {
}
// unknown tag 88 length 63
button 79 {
on (release) {
this.removeMovieClip();
}
}
movieClip 83 gotEgg {
frame 1 {
levelCompleteInfo.text = 'Level ' + (_root.level + 1) + ' Complete!';
strokes.text = _root.levelStrokes;
par.text = _root.parScores[_root.level];
}
}
button 85 {
on (release) {
this.removeMovieClip();
}
}
movieClip 87 youWin {
frame 1 {
levelCompleteInfo.text = 'Level ' + (_root.level + 1) + ' Complete!';
strokes.text = _root.levelStrokes;
par.text = _root.parScores[_root.level];
}
}
button 89 {
on (release) {
_root.newData();
this.removeMovieClip();
}
}
button 91 {
on (release) {
this.removeMovieClip();
}
}
movieClip 93 wantErase {
frame 1 {
levelCompleteInfo.text = 'Level ' + (_root.level + 1) + ' Complete!';
strokes.text = _root.levelStrokes;
par.text = _root.parScores[_root.level];
}
}
movieClip 96 {
}
movieClip 97 debrisPart {
}
movieClip 99 {
}
movieClip 108 {
frame 1 {
stop();
}
}
movieClip 120 {
}
button 126 {
on (release) {
goArmor();
}
}
movieClip 127 scoreCard {
frame 1 {
function init() {
totPar = 0;
totScore = 0;
i = 0;
while (i < 30) {
curLevel = this['l' + i];
curLevel.levelNum.text = i + 1;
curLevel.parScore.text = _root.parScores[i];
if (_root.playerScores[i] == 0) {
curLevel.playerScore.text = ' ';
curLevel.pButton._visible = false;
} else {
totScore += _root.playerScores[i];
totPar += _root.parScores[i];
assignButton(curLevel, i);
if (_root.playerScores[i] > _root.parScores[i]) {
tempColour = 'CC0000';
} else {
if (_root.playerScores[i] < _root.parScores[i]) {
tempColour = '00CC00';
} else {
if (_root.playerScores[i] == _root.parScores[i]) {
tempColour = 'FFFFFF';
}
}
}
curLevel.playerScore.htmlText = '<font color=\'#' + tempColour + '\'>' + _root.playerScores[i] + '</font>';
}
++i;
}
i = 0;
while (i < 30) {
if (_root.playerScores[i] == 0) {
this['l' + i].pButton._visible = true;
assignButton(this['l' + i], i);
break;
}
++i;
}
tempColour = 'FFFFFF';
dispScore = Number(totScore - totPar);
if (dispScore == 0) {
tempString = '+' + dispScore;
tempColour = 'FFFFFF';
} else {
if (dispScore > 0) {
tempString = '+' + dispScore;
tempColour = 'CC0000';
} else {
if (dispScore < 0) {
tempString = String(dispScore);
tempColour = '00CC00';
}
}
}
againstPar.htmlText = '<font color=\'#' + tempColour + '\'>' + tempString + '</font>';
dispScore = totScore;
if (dispScore == totPar) {
tempString = String(dispScore);
tempColour = 'FFFFFF';
} else {
if (dispScore > totPar) {
tempString = String(dispScore);
tempColour = 'CC0000';
} else {
if (dispScore < totPar) {
tempString = String(dispScore);
tempColour = 'FFFFFF';
}
}
}
if (_root.playerScores[29] > 0) {
levelStar.gotoAndStop(2);
if (Number(totScore - totPar) < 0) {
parStar.gotoAndStop(2);
}
}
if (_root.egg) {
eggStar.gotoAndStop(2);
}
ticky.htmlText = '<font color=\'#' + tempColour + '\'>' + tempString + '/' + totPar + '</font>';
}
function assignButton(cL, num) {
cL.num = num;
cL.pButton.onRelease = function () {
trace('HYI');
_root.gamePaused = false;
_root.loadLevel(this._parent.num);
_root.unloadScoreCard();
trace(this._parent.num);
};
}
var totScore = 0;
var totPar = 0;
var overallScore = 0;
init();
}
}
button 130 {
on (release) {
_root.unloadScoreCard();
}
}
button 132 {
on (release) {
_root.goMenu();
}
}
movieClip 133 scoreCard-flyUp {
}
button 140 {
on (release) {
++_root.level;
_root.loadLevel(_root.level);
}
}
button 142 {
on (release) {
_root.spawnScoreCard();
}
}
button 146 {
on (release) {
_root.goArmor();
}
}
movieClip 147 {
frame 1 {
levelCompleteInfo.text = 'Level ' + (_root.level + 1) + ' Complete!';
strokes.text = _root.levelStrokes;
par.text = _root.parScores[_root.level];
}
}
movieClip 149 levelComplete {
frame 24 {
stop();
}
}
frame 1 {
function goArmor() {
getURL('http://armorgames.com/', '_blank');
}
function dist(x1, y1, x2, y2) {
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
stop();
var myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
_root.menu = myMenu;
k = 0;
onEnterFrame = function () {
var v2 = Math.floor(framesLoaded / 4) - 1;
afw._x -= 0.3 * ((afw._x - _root['b' + v2]._x) / 2);
afw._y -= 0.3 * ((afw._y - _root['b' + v2]._y) / 2);
cat.removeMovieClip();
createEmptyMovieClip('cat', k++);
cat.lineStyle(1, 16777215, 20);
loaded = _root.getBytesLoaded();
total = _root.getBytesTotal();
framesLoaded = Math.ceil((loaded / total) * 100);
if (framesLoaded >= 100 && playMe.act == false) {
playMe.act = true;
playMe.play();
}
perDisp = framesLoaded + '%';
i = 0;
while (i < 25) {
if (framesLoaded >= i * 4) {
_root['b' + i]._alpha -= 0.08 * ((_root['b' + i]._alpha - 100) / 2);
_root['b' + i]._x -= 0.3 * ((_root['b' + i]._x - _root['b' + i].mainX) / 2);
_root['b' + i]._y -= 0.3 * ((_root['b' + i]._y - _root['b' + i].mainY) / 2);
if (i != 0) {
cat.moveTo(_root['b' + i]._x, _root['b' + i]._y);
cat.lineTo(_root['b' + (i - 1)]._x, _root['b' + (i - 1)]._y);
}
}
base = 1.5;
if (_root['b' + i].hitTest(_xmouse, _ymouse)) {
if (_xmouse - _root['b' + i]._x > 0) {
t = 0;
while (t < 25) {
_root['b' + (i - t)]._x -= base / (t + 1);
_root['b' + (i + t)]._x -= base / (t + 1);
++t;
}
} else {
if (_xmouse - _root['b' + i]._x <= 0) {
t = 0;
while (t < 25) {
_root['b' + (i - t)]._x += base / (t + 1);
_root['b' + (i + t)]._x += base / (t + 1);
++t;
}
}
}
if (_ymouse - _root['b' + i]._y > 0) {
t = 0;
while (t < 25) {
_root['b' + (i - t)]._y -= base / (t + 1);
_root['b' + (i + t)]._y -= base / (t + 1);
++t;
}
} else {
if (_ymouse - _root['b' + i]._y <= 0) {
t = 0;
while (t < 25) {
_root['b' + (i - t)]._y += base / (t + 1);
_root['b' + (i + t)]._y += base / (t + 1);
++t;
}
}
}
}
++i;
}
};
i = 0;
while (i < 25) {
_root['b' + i].mainX = _root['b' + i]._x;
_root['b' + i].mainY = _root['b' + i]._y;
_root['b' + i]._x = random(Stage.width);
_root['b' + i]._y = random(Stage.height);
_root['b' + i]._alpha = 0;
_root['b' + i].act = true;
++i;
}
}
movieClip 152 {
}
movieClip 153 {
}
movieClip 155 {
}
movieClip 157 {
}
// unknown tag 88 length 83
button 163 {
on (release) {
_root.killAd();
_root.play();
}
}
movieClip 164 {
frame 1 {
stop();
act = false;
}
frame 10 {
stop();
}
}
frame 2 {
function saveGame() {
if (level < 0) {
return undefined;
}
savefile.data.playerScores = playerScores;
savefile.data.saved = true;
savefile.flush();
trace('Game Saved!');
trace('savefile.data.playerScores: ' + savefile.data.playerScores);
}
function newData() {
playerScores.splice(0, playerScores.length);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
playerScores.push(0);
saveGame();
}
stop();
var savefile = SharedObject.getLocal('portalGolf');
var playerScores = new Array();
if (savefile.data.saved != true || savefile.data.saved == undefined) {
trace('Can\'t find new data.');
newData();
} else {
playerScores = savefile.data.playerScores;
trace('Game Loaded!');
trace('playerScores: ' + playerScores);
}
var levelNames = new Array();
var parScores = new Array();
parScores.push(1);
parScores.push(2);
parScores.push(1);
parScores.push(1);
parScores.push(4);
levelNames.push('Baby Steps');
levelNames.push('Portal Steps');
levelNames.push('Infinity');
levelNames.push('Automatic');
levelNames.push('Collector');
parScores.push(1);
parScores.push(4);
parScores.push(3);
parScores.push(1);
parScores.push(3);
levelNames.push('Shot Put');
levelNames.push('No Gravity');
levelNames.push('RGB');
levelNames.push('Easy Peasy');
levelNames.push('Vortex');
parScores.push(2);
parScores.push(2);
parScores.push(1);
parScores.push(1);
parScores.push(1);
levelNames.push('Triple');
levelNames.push('Push');
levelNames.push('Ponies');
levelNames.push('Staircase');
levelNames.push('Flower');
parScores.push(3);
parScores.push(1);
parScores.push(6);
parScores.push(4);
parScores.push(2);
levelNames.push('Stockpile');
levelNames.push('Neighbor');
levelNames.push('Slick');
levelNames.push('Sticky');
levelNames.push('Monkeys');
parScores.push(3);
parScores.push(1);
parScores.push(4);
parScores.push(1);
parScores.push(4);
levelNames.push('Ease Up');
levelNames.push('Teeth');
levelNames.push('Floopy');
levelNames.push('Wallpaper');
levelNames.push('Stoplight');
parScores.push(7);
parScores.push(1);
parScores.push(5);
parScores.push(4);
parScores.push(4);
levelNames.push('Lighthouse');
levelNames.push('Hoops');
levelNames.push('Rooms');
levelNames.push('Vertigo');
levelNames.push('Pain');
}
movieClip 171 {
}
button 173 {
on (press) {
getURL('http://www.armorgames.com', '_blank');
}
}
// unknown tag 88 length 269
// unknown tag 88 length 131
movieClip 177 {
}
movieClip 178 {
frame 1 {
gotoAndPlay(2);
}
frame 177 {
_root.play();
}
}
movieClip 180 {
}
movieClip 182 {
frame 1 {
stop();
}
frame 15 {
stop();
}
}
movieClip 183 {
frame 1 {
_root.addDoor(this);
}
}
movieClip 185 level0 {
}
movieClip 186 {
}
movieClip 188 level1 {
}
movieClip 189 {
}
movieClip 192 {
}
movieClip 193 {
frame 1 {
_root.addGravityWell(this, 'attract');
}
}
movieClip 194 level10 {
}
movieClip 195 {
}
movieClip 197 {
frame 1 {
_root.addGravityWell(this, 'repel');
}
}
movieClip 198 level11 {
}
movieClip 199 {
}
movieClip 201 level12 {
}
movieClip 203 {
}
movieClip 204 {
frame 1 {
_root.addSpikes(this);
}
}
movieClip 205 {
}
movieClip 207 level13 {
}
movieClip 209 {
}
movieClip 210 {
frame 1 {
_root.addSandTrap(this);
}
}
movieClip 211 {
}
movieClip 213 level14 {
}
movieClip 214 {
}
movieClip 215 level15 {
}
movieClip 216 {
frame 1 {
_root.addSpikes(this);
}
}
movieClip 217 {
}
movieClip 218 level16 {
}
movieClip 219 {
}
movieClip 221 level17 {
}
movieClip 222 {
}
movieClip 224 level18 {
}
movieClip 225 {
}
movieClip 227 level19 {
}
movieClip 228 {
}
movieClip 230 level2 {
}
movieClip 231 {
}
movieClip 233 level20 {
}
movieClip 234 {
}
movieClip 236 level21 {
}
movieClip 237 {
}
movieClip 239 level22 {
}
movieClip 240 {
}
movieClip 242 level23 {
}
movieClip 243 {
}
movieClip 245 level24 {
}
movieClip 246 {
}
movieClip 248 level25 {
}
movieClip 249 {
frame 1 {
_root.addSpikes(this);
}
}
movieClip 250 {
}
movieClip 252 level26 {
}
movieClip 253 {
}
movieClip 255 level27 {
}
movieClip 256 {
}
movieClip 258 level28 {
}
movieClip 259 {
}
movieClip 261 level29 {
}
movieClip 262 {
}
movieClip 264 level3 {
}
movieClip 265 {
}
movieClip 267 level4 {
}
movieClip 268 {
}
movieClip 270 level5 {
}
movieClip 271 {
}
movieClip 273 level6 {
}
movieClip 274 {
}
movieClip 276 level7 {
}
movieClip 277 {
}
movieClip 279 level8 {
}
movieClip 280 {
}
movieClip 282 level9 {
}
movieClip 283 {
frame 1 {
stop();
}
}
frame 3 {
stop();
}
// unknown tag 88 length 98
movieClip 287 {
}
movieClip 289 {
}
movieClip 291 {
}
movieClip 292 {
frame 1 {
gotoAndPlay(2);
}
frame 101 {
_root.play();
}
}
frame 4 {
function addDebris() {
af = drawArea.attachMovie('debrisPart', 'd' + k, k++);
af._x = player._x - player._width / 2 + random(player._width);
af._y = player._y - random(player._height);
af.xVel = random(20) - 10;
af.yVel = random(20) - 10;
af.xMax = 30;
af.yMax = 30;
af.gra._rotation = random(360);
af.life = 10;
af.lifeCounter = 300;
debris.push(af);
}
function handleDebris() {
d = 0;
while (d < debris.length) {
curDebris = debris[d];
normalVertical(curDebris);
handlePortals(curDebris);
bounding(curDebris);
drawLine(curDebris);
curDebris.gra._rotation += curDebris.xVel;
--curDebris.lifeCounter;
if (curDebris.lifeCounter < 100) {
curDebris._alpha = curDebris.lifeCounter;
} else {
if (Math.abs(curDebris.xVel) < 1 && Math.abs(curDebris.yVel) < 1) {
--curDebris.life;
curDebris._alpha = curDebris.life * 10;
} else {
curDebris.life = 10;
curDebris._alpha = curDebris.life * 10;
}
}
if (curDebris.life < 0 || curDebris.lifeCounter < 0) {
curDebris.removeMovieClip();
debris.splice(d, 1);
}
++d;
}
}
function addSpikes(mov) {
spikes.push(mov);
}
function handleSpikes(mov) {
i = 0;
while (i < spikes.length) {
curSpike = spikes[i];
curSpike._alpha -= 0.2;
if (curSpike._alpha < 50) {
curSpike._alpha = 50;
}
if (curSpike.hitTest(mov)) {
respawn();
curSpike._alpha = 100;
}
++i;
}
}
function addGravityWell(mov, tp) {
gravityWells.push(mov);
mov.type = tp;
}
function handleGravityWells(mov) {
i = 0;
while (i < gravityWells.length) {
curWell = gravityWells[i];
tDist = dist(curWell._x, curWell._y, mov._x, mov._y);
tRange = 300;
tRatio = 1 - tDist / tRange;
if (tDist < tRange) {
if (mov == player) {
curWell._alpha += 3;
if (tRatio > 0.5) {
curWell.voider._alpha -= 5;
}
if (curWell._alpha > 100) {
curWell._alpha = 100;
}
if (curWell.voider._alpha < 50) {
curWell.voider._alpha = 50;
}
}
tVel = tRatio * 1.75;
tAng = rotateTo(curWell._x, curWell._y, mov._x, mov._y);
if (curWell.type == 'attract') {
yV = tVel * Math.cos(tAng * 0.0174532925199433);
xV = -(tVel * Math.sin(tAng * 0.0174532925199433));
} else {
yV = -(tVel * Math.cos(tAng * 0.0174532925199433));
xV = tVel * Math.sin(tAng * 0.0174532925199433);
}
mov.xVel -= xV;
mov.yVel -= yV;
} else {
--curWell._alpha;
++curWell.voider._alpha;
if (curWell._alpha < 50) {
curWell._alpha = 50;
}
if (curWell.voider._alpha > 100) {
curWell.voider._alpha = 100;
}
}
++i;
}
}
function spawnScoreCard() {
gamePaused = true;
attachMovie('scoreCard-flyUp', 'scoreCard', k++);
}
function unloadScoreCard() {
scoreCard.removeMovieClip();
gamePaused = false;
}
function loadLevel(num) {
if (cStatus == 5) {
levelComplete.removeMovieClip();
}
clearBitmap();
levelStrokes = 0;
e = 0;
while (e < portals.length) {
portals[e].removeMovieClip();
++e;
}
portals.splice(0, portals.length);
e = 0;
while (e < orbs.length) {
orbs[e].removeMovieClip();
++e;
}
activeOrbs.splice(0, orbs.length);
orbs.splice(0, orbs.length);
e = 0;
while (e < sandTraps.length) {
sandTraps[e].removeMovieClip();
++e;
}
sandTraps.splice(0, sandTraps.length);
e = 0;
while (e < gravityWells.length) {
gravityWells[e].removeMovieClip();
++e;
}
gravityWells.splice(0, gravityWells.length);
e = 0;
while (e < debris.length) {
debris[e].removeMovieClip();
++e;
}
debris.splice(0, debris.length);
e = 0;
while (e < spikes.length) {
spikes[e].removeMovieClip();
++e;
}
spikes.splice(0, spikes.length);
curLevel.removeMovieClip();
tripSpecial = false;
if (level == 30) {
num = -1;
trace('WEFE');
tripSpecial = true;
}
level = num;
trace('Load level ' + level);
levelDisp = level + 1;
parDisp = parScores[level];
if (level == -1) {
curLevel = attachMovie('levelMenu', 'curLevel', k++);
bPanel._visible = false;
} else {
curLevel = attachMovie('level' + level, 'curLevel', k++);
bPanel._visible = true;
}
drawArea.swapDepths(k++);
bPanel.swapDepths(k++);
player.swapDepths(k++);
ball.swapDepths(k++);
ball._visible = false;
updateUI();
if (tripSpecial) {
attachMovie('youWin', 'youWin', k++);
}
canDraw = false;
clearBitmap();
}
function updateUI() {
if (levelStrokes > _root.parScores[level]) {
tempColour = 'CC0000';
} else {
if (levelStrokes < _root.parScores[level]) {
tempColour = '00CC00';
} else {
if (levelStrokes == _root.parScores[level]) {
tempColour = 'FFFFFF';
}
}
}
bPanel.levelName.text = levelNames[level];
bPanel.strokeDisp.htmlText = '<font color=\'#' + tempColour + '\'>' + levelStrokes + '</font>';
parDisp = parScores[level];
}
function dropBall(mov) {
ball.swapDepths(k++);
ball._visible = true;
player._x = mov._x;
player._y = mov._y;
player.xVel = 0;
player.yVel = 3;
cStatus = 2;
player.oldX = player._x;
player.oldY = player._y;
canDraw = true;
}
function addSandTrap(mov) {
mov.type = 'sandTrap';
sandTraps.push(mov);
mov._alpha = 50;
}
function restartLevel() {
loadLevel(level);
}
function bitmapLine(startx, starty, endx, endy, colour) {
myX = Array();
myY = Array();
x3 = (endx - startx) / 100;
y3 = (endy - starty) / 100;
a = 1;
while (a < 101) {
startx += x3;
starty += y3;
myX.push(startx);
myY.push(starty);
++a;
}
a = 1;
while (a < 101) {
bmp1.setPixel32(Math.round(myX[a - 1]), Math.round(myY[a - 1]), colour);
++a;
}
}
function clearBitmap() {
bmp1.fillRect(new flash.geom.Rectangle(0, 0, 750, 500), 0);
}
function muteHandler() {
mute = !mute;
trace('WEFWEFWE');
if (mute) {
s.setVolume(0);
} else {
s.setVolume(100);
}
}
function gotoMenu() {
for (i in _root) {
if (typeof _root[i] == 'movieclip') {
_root[i].removeMovieClip();
}
}
stopAllSounds();
gotoAndStop('menu');
}
function gotoEnding() {
for (i in _root) {
if (typeof _root[i] == 'movieclip') {
_root[i].removeMovieClip();
}
}
stopAllSounds();
gotoAndStop('ending');
}
function addPortal(mov) {
mov.letter = mov._name.substr(0, 1);
if (mov._name.length == 2) {
mov.partner = curLevel[mov.letter];
} else {
mov.partner = curLevel[mov.letter + '_'];
}
if (mov._name == 'portPlay') {
mov.onEnterFrame = function () {
if (player.hitTest(this)) {
loadLevel(0);
}
};
}
if (mov._name == 'portErase') {
mov.onEnterFrame = function () {
if (player.hitTest(this) && cStatus == 2) {
attachMovie('wantErase', 'wantErase', k++);
cStatus = 0;
respawn();
}
};
}
if (mov._name == 'portVisit') {
mov.onEnterFrame = function () {
if (player.hitTest(this) && cStatus == 2) {
goArmor();
trace('GO ARMOR GAMES!');
cStatus = 0;
respawn();
}
};
}
mov.colour = colourByLetter(mov.inners, mov.letter);
portals.push(mov);
}
function colourByLetter(mc, str) {
switch (str) {
case 'a':
setMCColour(mc, letterColours[0]);
return letterColours[0];
break;
case 'b':
setMCColour(mc, letterColours[1]);
return letterColours[1];
break;
case 'c':
setMCColour(mc, letterColours[2]);
return letterColours[2];
break;
case 'd':
setMCColour(mc, letterColours[3]);
return letterColours[3];
break;
case 'e':
setMCColour(mc, letterColours[4]);
return letterColours[4];
}
}
function setColour() {
setMCColour(bg.bg, curColour);
}
function handleSandTraps(mov) {
i = 0;
while (i < sandTraps.length) {
curST = sandTraps[i];
if (mov.hitTest(curST)) {
if (mov == player) {
++curST._alpha;
}
if (curST._alpha > 100) {
curST._alpha = 100;
}
mov.yVel -= yGrav;
} else {
--curST._alpha;
if (curST._alpha < 50) {
curST._alpha = 50;
}
}
++i;
}
}
function fadeBitmap() {
var v1 = 0.99;
var v2 = new flash.geom.ColorTransform(1, 1, 1, v1, 0, 0, 0, 0);
bmp1.colorTransform(bmp1.rectangle, v2);
}
function drawLine(mov) {
var v2 = mov._y - mov._height / 2;
if (mov.oldX == undefined) {
mov.oldX = mov._x;
mov.oldY = v2;
}
if (mov.type == 'orb') {
bitmapLine(mov._x, mov._y, mov.oldX, mov.oldY, 872415231);
mov.oldX = mov._x;
mov.oldY = mov._y;
return undefined;
}
if (!mov.lastHitPortal) {
bitmapLine(mov._x, v2, mov.oldX, mov.oldY, 4294967295.0);
} else {
bitmapLine(mov._x, v2, mov.oldX, mov.oldY, 2852126720.0 + mov.bannedPortal.colour);
}
mov.oldX = mov._x;
mov.oldY = v2;
}
function addDoor(mov) {
door = mov;
door.ready = false;
}
function addStart(mov) {
startDoor = mov;
}
function checkOrbCount() {
if (orbs.length == activeOrbs.length && door.ready == false) {
door.anim.play();
door.ready = true;
}
if (!egg && level == -1 && orbs.length == activeOrbs.length) {
++eggCounter;
if (eggCounter > 10) {
attachMovie('gotEgg', 'gotEgg', k++);
egg = true;
}
}
}
function handleOrbs() {
i = 0;
while (i < orbs.length) {
if (orbs[i].hitTest(player) && !orbs[i].active) {
orbs[i].active = true;
collectSound.start(0, 1);
setMCColour(orbs[i], 16777215);
shel = drawArea.attachMovie('orbExplode', 'exp' + k, k++);
shel._x = orbs[i]._x;
shel._y = orbs[i]._y;
activeOrbs.push(orbs[i]);
}
++i;
}
f = 0;
while (f < activeOrbs.length) {
var v1 = activeOrbs[f];
bounding(v1);
drawLine(v1);
if (f == 0) {
prevOrb = player;
modY = -(player._height / 2);
} else {
prevOrb = activeOrbs[f - 1];
modY = 0;
}
drawArea.lineStyle(3, 16777215, 30);
drawArea.moveTo(prevOrb._x, prevOrb._y + modY);
drawArea.lineTo(v1._x, v1._y);
sp = 0.1;
if (dist(v1._x, v1._y, prevOrb._x, prevOrb._y) < 140) {
--v1._alpha;
if (v1._alpha < 30) {
v1._alpha = 30;
}
} else {
v1._alpha += 10;
if (v1._alpha > 100) {
v1._alpha = 100;
}
if (v1._x < prevOrb._x) {
v1.xVel += sp;
} else {
v1.xVel -= sp;
}
if (v1._y < prevOrb._y + modY) {
v1.yVel += sp;
} else {
v1.yVel -= sp;
}
}
elasticX(v1, prevOrb._x, 0.06, 0.7);
elasticY(v1, prevOrb._y, 0.06, 0.7);
++f;
}
}
function addOrb(mov) {
mov.active = false;
orbs.push(mov);
mov.type = 'orb';
switch (random(5)) {
case 0:
mov.colour = 3394815;
break;
case 1:
mov.colour = 3407871;
break;
case 2:
mov.colour = 6737151;
break;
case 3:
mov.colour = 10079487;
break;
case 4:
mov.colour = 6737100;
}
setMCColour(mov, mov.colour);
mov.yVel = 0;
mov.xVel = 0;
mov.xMax = 30;
mov.yMax = 50;
}
function handlePortals(mov) {
if (!mov.hitTest(mov.bannedPortal)) {
mov.bannedPortal = null;
}
mov.lastHitPortal = false;
i = 0;
while (i < portals.length) {
curPortal = portals[i];
newPortal = curPortal.partner;
if (curPortal.hitTest(mov._x, mov._y) && mov.bannedPortal != curPortal) {
mov.lastHitPortal = true;
if (mov == player) {
pipeSound.start(0, 1);
shel = curLevel.attachMovie('whiteFlash', 'w' + k, k++);
shel._x = curPortal._x;
shel._y = curPortal._y;
shel._rotation = curPortal._rotation;
colourByLetter(shel.wisp.inside, curPortal.letter);
shel = curLevel.attachMovie('whiteFlash', 'w' + k, k++);
shel._x = newPortal._x;
shel._y = newPortal._y;
shel._rotation = newPortal._rotation;
colourByLetter(shel.wisp.inside, newPortal.letter);
}
tX = mov._x - curPortal._x;
tY = mov._y - curPortal._y;
tH = dist(mov._x, mov._y, curPortal._x, curPortal._y);
tAng = Math.atan2(tY, tX) * 57.29577951308232;
fAng = curPortal._rotation - 90 - Math.atan2(mov.yVel, mov.xVel) * 57.29577951308232;
xOffset = tH * Math.cos(fAng * 0.0174532925199433);
yOffset = tH * Math.sin(fAng * 0.0174532925199433);
mov._x = newPortal._x;
mov._y = newPortal._y;
mov.bannedPortal = newPortal;
v = Math.sqrt(mov.xVel * mov.xVel + mov.yVel * mov.yVel);
dyV = mov._y - mov.pX;
tempAng = curPortal._rotation - Math.atan2(mov.yVel, mov.xVel) * 57.29577951308232;
if (mov == tippy) {
}
ang = -newPortal._rotation - 90 + tempAng;
xV = v * Math.sin(ang * 0.0174532925199433);
yV = v * Math.cos(ang * 0.0174532925199433);
mov.xVel = xV;
mov.yVel = yV;
mov.pX = mov._x;
mov.pY = mov._y;
}
++i;
}
}
function drawForceLine() {
drawArea.lineStyle(4, 16777215, 100);
tpY = player._y - player._height / 2;
drawArea.moveTo(player._x, player._y - player._height / 2);
drawArea.lineStyle(1, 16777215, 50);
i = 0;
while (i < Math.min(curDist, 100)) {
drawCircle(drawArea, player._x, player._y - player._height / 2, i);
i += 50;
}
drawArea.lineStyle(1, 16777215, 25);
i = 0;
while (i < Math.min(curDist, 100)) {
drawCircle(drawArea, player._x, player._y - player._height / 2, i);
i += 25;
}
ang = 180 - rotateTo(player._x, player._y, _xmouse, _ymouse);
vel = Math.min(100, dist(player._x, player._y, _xmouse, _ymouse));
xV = vel * Math.sin(ang * 0.0174532925199433);
yV = vel * Math.cos(ang * 0.0174532925199433);
tippy.xVel = -(xV / 4);
tippy.yVel = -(yV / 4);
tippy.bannedPortal = null;
tOldX = player._x;
tOldY = player._y - player._height / 2;
tippy._x = player._x;
tippy._y = player._y;
h = 0;
while (h < 20) {
drawArea.lineStyle((1 - h / 20) * 20, 5658198, 100);
normalVertical(tippy);
handlePortals(tippy);
handleSandTraps(tippy);
bounding(tippy);
handleGravityWells(tippy);
drawArea.moveTo(tOldX, tOldY);
if (!tippy.lastHitPortal) {
drawArea.lineTo(tippy._x, tippy._y - player._height / 2);
}
tOldX = tippy._x;
tOldY = tippy._y - player._height / 2;
++h;
}
}
function skinning(skinMC, targMC) {
targMC._visible = false;
skinMC._x = targMC._x;
skinMC._y = targMC._y;
skinMC.filters = new Array(new flash.filters.BlurFilter(Math.abs(targMC.xVel / 2), Math.abs(targMC.yVel / 2), 5));
}
function normalVertical(mc) {
mc.yVel += yGrav;
}
function playerQualities() {
if (Math.abs(player.xVel) < 1 && Math.abs(player.yVel) < 1) {
++inActionCounter;
if (inActionCounter == 10) {
nextShot();
}
} else {
inActionCounter = 0;
}
if (door.ready == true && dist(player._x, player._y - player._height / 2, door._x, door._y) < 50) {
winLevel();
}
}
function respawn() {
if (gamePaused) {
return undefined;
}
if (cStatus < 3 && ball._visible) {
startDoor.anim.gotoAndPlay(2);
reboot.start(0, 1);
shel = drawArea.attachMovie('orbExplode', 'o' + k, k++);
shel._x = player._x;
shel._y = player._y;
cStatus = 0;
ball._visible = false;
o = 0;
while (o < 5) {
addDebris();
++o;
}
}
}
function nextShot() {
cStatus = 0;
}
function winLevel() {
w = 0;
while (w < 3) {
player._x = door._x;
player._y = door._y;
drawLine(player);
++w;
}
ball._visible = false;
cStatus = 5;
if (levelStrokes < playerScores[level] || playerScores[level] == 0) {
playerScores[level] = levelStrokes;
}
saveGame();
attachMovie('levelComplete', 'levelComplete', k++);
}
function naming(mov) {
mov._x = Math.round(mov._x);
mov._y = Math.round(mov._y);
mov.posX = Math.floor(mov._x / _root.tileSize);
mov.posY = Math.floor(mov._y / _root.tileSize);
mov.touched = false;
if (mov.type !== 1) {
} else {
mov._name = 'tile' + mov.posX + 'x' + mov.posY;
}
}
function basicMovement(mc) {
if (mc.xVel * 0 != 0) {
mc.xVel = 0;
}
if (mc.yVel * 0 != 0) {
mc.yVel = 0;
}
mc._x += mc.xVel;
mc._y += mc.yVel;
if (mc.xVel > mc.xMax) {
mc.xVel = mc.xMax;
}
if (mc.xVel < -mc.xMax) {
mc.xVel = -mc.xMax;
}
if (mc.yVel > mc.yMax) {
mc.yVel = mc.yMax;
}
if (mc.yVel < -mc.yMax) {
mc.yVel = -mc.yMax;
}
}
function bounding(mc) {
locOkay = false;
if (mc.xVel * 0 != 0) {
mc.xVel = 0;
}
if (mc.yVel * 0 != 0) {
mc.yVel = 0;
}
blockPath = curLevel.blocks;
if (mc.yVel < 0) {
if (checkCoords(mc, mc._x, mc._y + mc.yVel, 0, blockPath) || locOkay) {
mc._y += mc.yVel;
} else {
mc.xVel *= xF;
mc.yVel *= bounce;
mc.rotSpeed *= -1;
mc._y = mc.tr._y + tileSize + mc._height;
if (mc.yVel < thudTresh && mc.yVel > -thudTresh && (xGrav != 0 || yGrav != 0)) {
mc.yVel = 0;
}
}
} else {
if (mc.yVel > 0) {
if (checkCoords(mc, mc._x, mc._y + mc.yVel, 1, blockPath) || locOkay) {
mc._y += mc.yVel;
} else {
if (mc._name == 'player' && mc.yVel > bounceTolerance) {
bounceSound.start(0, 1);
} else {
if (mc.yVel > bounceTolerance) {
bulletDropSound.start(0, 1);
}
}
mc.xVel *= xF;
mc.yVel *= bounce;
jumping = false;
mc._y = mc.br._y;
if (mc.yVel < thudTresh && mc.yVel > -thudTresh && (xGrav != 0 || yGrav != 0)) {
mc.yVel = 0;
}
if (Math.abs(mc.yVel) > 6) {
mc.rotSpeed *= random(8) - 4;
} else {
mc.rotSpeed *= 0.5;
}
}
}
}
if (mc.xVel < 0) {
if (checkCoords(mc, mc._x + mc.xVel, mc._y, 3, blockPath) || locOkay) {
mc._x += mc.xVel;
if (mc.type == 'runner') {
mc._xscale = -100;
}
} else {
mc.yVel *= yF;
if (mc.type == 'runner') {
mc.xVel *= -1;
mc._x += mc.xVel;
} else {
mc.xVel *= bounce;
if (mc._name == 'player' && mc.xVel < bounceTolerance) {
bounceSound.start(0, 1);
}
mc._x = mc.bl._x + mc._width / 2 + tileSize;
}
if (mc == player && mc.xVel < thudTresh && mc.xVel > -thudTresh && (xGrav != 0 || yGrav != 0)) {
mc.xVel = 0;
}
}
} else {
if (mc.xVel > 0) {
if (checkCoords(mc, mc._x + mc.xVel, mc._y, 2, blockPath) || locOkay) {
mc._x += mc.xVel;
if (mc.type == 'runner') {
mc._xscale = 100;
}
} else {
mc.yVel *= yF;
if (mc.type == 'runner') {
mc.xVel *= -1;
mc._x += mc.xVel;
} else {
mc.xVel *= bounce;
if (mc._name == 'player' && mc.xVel > bounceTolerance) {
bounceSound.start(0, 1);
}
mc._x = mc.br._x - mc._width / 2;
}
if (mc == player && mc.xVel < thudTresh && mc.xVel > -thudTresh && (xGrav != 0 || yGrav != 0)) {
mc.xVel = 0;
}
}
}
}
if (mc.xVel > mc.xMax) {
mc.xVel = mc.xMax;
}
if (mc.xVel < -mc.xMax) {
mc.xVel = -mc.xMax;
}
if (mc.yVel > mc.yMax) {
mc.yVel = mc.yMax;
}
if (mc.yVel < -mc.yMax) {
mc.yVel = -mc.yMax;
}
}
function checkCoords(mc, x, y, direction, holder) {
mc.ctlx = x - mc._width / 2 + 1;
mc.ctly = y - mc._height + 1;
mc.ctrx = x + mc._width / 2 - 1;
mc.ctry = y - mc._height + 1;
mc.cbrx = x + mc._width / 2 - 1;
mc.cbry = y + mc._height * 0 - 1;
mc.cblx = x - mc._width / 2 + 1;
mc.cbly = y + mc._height * 0 - 1;
mc.clmx = x - mc._width / 2 + 1;
mc.clmy = y - mc._height / 2 + 1;
mc.ctmx = x + 1;
mc.ctmy = y - mc._height + 1;
mc.crmx = x + mc._width / 2 - 1;
mc.crmy = y - mc._height / 2 + 1;
mc.cbmx = x + 1;
mc.cbmy = y + mc._height * 0 - 1;
mc.cbmx = x + 1;
mc.cmx = x + 1;
mc.cmy = y - mc._height / 2 + 1;
mc.tl = holder['tile' + Math.floor(mc.ctlx / tileSize) + 'x' + Math.floor(mc.ctly / tileSize)];
mc.tr = holder['tile' + Math.floor(mc.ctrx / tileSize) + 'x' + Math.floor(mc.ctry / tileSize)];
mc.br = holder['tile' + Math.floor(mc.cbrx / tileSize) + 'x' + Math.floor(mc.cbry / tileSize)];
mc.bl = holder['tile' + Math.floor(mc.cblx / tileSize) + 'x' + Math.floor(mc.cbly / tileSize)];
mc.tm = holder['tile' + Math.floor(mc.ctmx / tileSize) + 'x' + Math.floor(mc.ctmy / tileSize)];
mc.lm = holder['tile' + Math.floor(mc.clmx / tileSize) + 'x' + Math.floor(mc.clmy / tileSize)];
mc.bm = holder['tile' + Math.floor(mc.cbmx / tileSize) + 'x' + Math.floor(mc.cbmy / tileSize)];
mc.rm = holder['tile' + Math.floor(mc.crmx / tileSize) + 'x' + Math.floor(mc.crmy / tileSize)];
mc.mb = holder['tile' + Math.floor(mc.cbmx / tileSize) + 'x' + Math.floor(mc.cbly / tileSize)];
if (mc.tl.type == 1) {
guyTL = true;
foundWhat = mc.tl;
pass(mc.tl);
} else {
guyTL = false;
}
if (mc.tr.type == 1) {
guyTR = true;
foundWhat = mc.tr;
pass(mc.tr);
} else {
guyTR = false;
}
if (mc.br.type == 1) {
guyBR = true;
foundWhat = mc.br;
pass(mc.br);
} else {
if (mc.br.type == 2 && mc.yVel > 0) {
guyBR = true;
foundWhat = mc.br;
} else {
guyBR = false;
}
}
if (mc.bl.type == 1) {
guyBL = true;
foundWhat = mc.bl;
pass(mc.bl);
} else {
if (mc.bl.type == 2 && mc.yVel > 0) {
guyBL = true;
foundWhat = mc.bl;
} else {
guyBL = false;
}
}
if (mc.tm.type == 1) {
guyTM = true;
foundWhat = mc.tm;
pass(mc.tm);
} else {
guyTM = false;
}
if (mc.bm.type == 1) {
guyBM = true;
foundWhat = mc.bm;
pass(mc.bm);
} else {
guyBM = false;
}
if (mc.lm.type == 1) {
guyLM = true;
foundWhat = mc.lm;
pass(mc.lm);
} else {
guyLM = false;
}
if (mc.rm.type == 1) {
guyRM = true;
foundWhat = mc.rm;
pass(mc.rm);
} else {
guyRM = false;
}
if (player == mc && guyBM || guyBL || guyBR) {
mc.yLove = 0;
holdCounter = 0;
}
if (player == mc && (guyBM && guyBL || guyBM && guyBR)) {
jumpLevel = true;
}
switch (direction) {
return true;
case 0:
if (guyTL || guyTR) {
return false;
}
case 1:
if (guyBR || guyBL) {
return false;
}
case 2:
if (guyTR || guyBR) {
return false;
}
case 3:
if (!(guyTL || guyBL)) break;
return false;
}
return true;
}
function goMenu() {
_root.gamePaused = false;
_root.loadLevel(-1);
_root.unloadScoreCard();
}
function cash(num) {
if (num == Math.floor(num)) {
return commaSnob(num) + '.00';
} else {
if (Math.floor((num - Math.floor(num)) * 100) == 0) {
return commaSnob(Math.floor(num)) + '.' + Math.floor((num - Math.floor(num)) * 100) + '0';
} else {
return commaSnob(Math.floor(num)) + '.' + Math.floor((num - Math.floor(num)) * 100);
}
}
}
function dist(x1, y1, x2, y2) {
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
function commaSnob(num) {
if (num < 1000) {
return String(num);
}
var v3 = (String(num)).length;
var v4 = new Array();
var v1 = 0;
while (v1 < v3) {
v4.push((String(num)).charAt(v3 - 1 - v1));
++v1;
}
var v2 = new String();
v1 = 0;
while (v1 < v3) {
if (v1 % 3 == 0 && v1 != 0) {
v2 = v4[v1] + ',' + v2;
} else {
v2 = v4[v1] + v2;
}
++v1;
}
return v2;
}
function setMCColour(mc, c) {
altColor = new Color(mc);
altColor.setRGB(c);
}
function rotateTo(x1, y1, x2, y2) {
return -Math.atan2(x2 - x1, y2 - y1) * 180 / Math.PI;
}
function drawCircle(mc, x, y, r) {
mc.moveTo(x + r, y);
mc.curveTo(r + x, 0.4142135623730951 * r + y, Math.SQRT1_2 * r + x, Math.SQRT1_2 * r + y);
mc.curveTo(0.4142135623730951 * r + x, r + y, x, r + y);
mc.curveTo(-0.4142135623730951 * r + x, r + y, -Math.SQRT1_2 * r + x, Math.SQRT1_2 * r + y);
mc.curveTo(-r + x, 0.4142135623730951 * r + y, -r + x, y);
mc.curveTo(-r + x, -0.4142135623730951 * r + y, -Math.SQRT1_2 * r + x, -Math.SQRT1_2 * r + y);
mc.curveTo(-0.4142135623730951 * r + x, -r + y, x, -r + y);
mc.curveTo(0.4142135623730951 * r + x, -r + y, Math.SQRT1_2 * r + x, -Math.SQRT1_2 * r + y);
mc.curveTo(r + x, -0.4142135623730951 * r + y, r + x, y);
}
function elasticX(mc, targt, accel, friction) {
if (mc.qxSpeed == undefined) {
mc.qxSpeed = 0;
}
mc.qxSpeed += (targt - mc._x) * accel;
mc.qxSpeed *= friction;
mc._x += mc.qxSpeed;
}
function elasticY(mc, targt, accel, friction) {
if (mc.qySpeed == undefined) {
mc.qySpeed = 0;
}
mc.qySpeed += (targt - mc._y) * accel;
mc.qySpeed *= friction;
mc._y += mc.qySpeed;
}
stop();
var curLevel = level0;
var k = 0;
var yGrav = 0.6;
var xGrav = 0;
player.xVel = 0;
var tileSize = 25;
var bounce = -0.3;
var thudTresh = 1;
var xF = 0.75;
var yF = 0.75;
var easePoint = 0;
var jumpCounter = 0;
player.yVel = 0;
player.xVel = 0;
player.xMax = 30;
player.yMax = 50;
player._visible = true;
player.yLove = 0;
holdUp = false;
playerJump = false;
jumpLevel = false;
var levelDisp;
var parDisp;
var pipeSound = new Sound(this);
pipeSound.attachSound('pipe');
var collectSound = new Sound(this);
collectSound.attachSound('ding12');
var reboot = new Sound(this);
reboot.attachSound('miscCracker');
var portals = new Array();
var orbs = new Array();
var sandTraps = new Array();
var gravityWells = new Array();
var debris = new Array();
var spikes = new Array();
var levelStrokes = 0;
var door = new MovieClip();
var startDoor = new MovieClip();
var level = -1;
var letterColours = new Array(16711680, 65280, 255, 16763955, 13369548);
var bmp1 = new flash.display.BitmapData(750, 500, true, 0);
drawArea.attachBitmap(bmp1, k++);
var gamePaused = false;
onEnterFrame = function () {
if (!gamePaused) {
drawArea.clear();
if (cStatus == 0) {
}
if (cStatus == 1) {
drawForceLine();
}
if (cStatus == 2) {
normalVertical(player);
handlePortals(player);
bounding(player);
if (canDraw) {
drawLine(player);
}
playerQualities();
checkOrbCount();
handleSandTraps(player);
handleGravityWells(player);
handleSpikes(player);
}
handleOrbs();
handleDebris();
updateUI();
skinning(ball, player);
fadeBitmap();
}
};
var egg = false;
var canDraw = false;
loadLevel(-1);
var mute = false;
var s = new Sound(this);
var cStatus = 0;
onMouseDown = function () {
if (player.hitTest(_xmouse, _ymouse) && cStatus == 0) {
cStatus = 1;
}
};
onMouseUp = function () {
if (cStatus == 1) {
cStatus = 2;
drawArea.clear();
ang = 180 - rotateTo(player._x, player._y, _xmouse, _ymouse);
vel = Math.min(100, dist(player._x, player._y, _xmouse, _ymouse));
xV = vel * Math.sin(ang * 0.0174532925199433);
yV = vel * Math.cos(ang * 0.0174532925199433);
player.xVel = -(xV / 4);
player.yVel = -(yV / 4);
++levelStrokes;
shel = drawArea.attachMovie('strokeIn', 'strokeIn' + k, k++);
shel._x = player._x;
shel._y = player._y;
}
};
var eggCounter = 0;
var activeOrbs = new Array();
var upKey = false;
var leftKey = false;
var rightKey = false;
var inActionCounter = 0;
stop();
}
movieClip 293 {
}
movieClip 294 {
}
movieClip 295 {
}
movieClip 296 {
}
button 308 {
on (release) {
_root.respawn();
}
}
button 312 {
on (release, keyPress '<Escape>') {
_root.restartLevel();
}
}
button 315 {
on (release) {
_root.muteHandler();
}
}
movieClip 316 {
}