Instance of Symbol 246 MovieClip [liveinclude] "BiosLoader" in Frame 1
//component parameters
onClipEvent (initialize) {
debug = 0;
minscorevalue = 1;
meterwidthratio = 70;
meterheightratio = 20;
centerx = 350;
centery = 320;
scoresentframe = "gotointro";
metervisible = 1;
custommetercolors = 0;
background = 0;
text1 = 16777215 /* 0xFFFFFF */;
text2 = 16776960 /* 0xFFFF00 */;
text3 = 16777215 /* 0xFFFFFF */;
meter = 10066329 /* 0x999999 */;
marks = 16777215 /* 0xFFFFFF */;
custommetertext = 0;
scoremessage = "Score Pending";
successmessage = "Success Pending";
replaybuttonmessage = "Restart Game";
}
Frame 2
_global.gMyScoringSystem = new _level100.include.ScoringSystem(0);
_global.gMyNeoStatus = new gMyScoringSystem.NeoStatus(0);
fscommand ("trapallkeys", "true");
gemClass = function () {
this.multiple = false;
this.found = false;
this.keyBuffer = "";
this.hiddenGem = "xxx";
this.checkGem = function (char) {
if (this.found) {
return(undefined);
}
this.keyBuffer = this.keyBuffer + String.fromCharCode(Key.getAscii());
var len = this.keyBuffer.length;
if (len == this.hiddenGem.length) {
if (this.keyBuffer == this.hiddenGem) {
this.found = true;
}
} else if (this.keyBuffer.substr(0, len) != this.hiddenGem.substr(0, len)) {
this.keyBuffer = String.fromCharCode(Key.getAscii());
}
if (this.found) {
_global.gGame.resetTime();
if (this.multiple) {
this.found = false;
}
}
};
};
_root.objGem = new gemClass();
_global.edit = 0;
_global.playerSelect = 1;
_global.ballSelect = 1;
_root.playerinfo = "";
_root.ballinfo = "";
_root.iSound = 1;
_root.iMusic = 1;
_root.aSnd = new Array();
_root.aLoops = new Array();
var aSounds = ["olli", "end", "hole", "roll", "hit", "end", "appear"];
var i = 0;
while (i < aSounds.length) {
_root.aSnd.push(new Sound(_root));
_root.aSnd[i].attachSound(aSounds[i]);
i++;
}
_root.aLoops.push(new Sound(_root));
_root.aLoops[0].attachSound("olli");
_root.logoShown = function () {
_global.gMyNeoStatus.sendTag("Sponsor Logo Shown");
};
_root.visitWebsite = function () {
var sponsorURL = "http://www.neopets.com/process_click.phtml?item_id=3266";
trace(sponsorURL);
getURL (sponsorURL, "_blank");
};
_root.showTrailer = function () {
var sponsorURL = "http://www.neopets.com/process_click.phtml?item_id=3111";
trace(sponsorURL);
getURL (sponsorURL, "_blank");
};
_root.sendLog = function (score, body_str) {
var myEmailID = 0;
var aLogStr = (((((((("[" + String(score)) + ",") + "\"") + body_str) + "\"") + ",") + String(myEmailID)) + "]");
var outgoing_lc = new LocalConnection();
outgoing_lc.send("gObjLCLog", "sendLog", aLogStr);
delete outgoing_lc;
};
_root.toggleSound = function () {
};
_root.playSound = function (iSnd, bAnywho) {
if ((_root.iSound == 1) || (bAnywho)) {
if (iSnd >= _root.aSnd.length) {
iSnd = _root.aSnd.length - 1;
} else if (iSnd < 0) {
iSnd = 0;
}
_root.aSnd[iSnd].start();
}
};
_root.stopSnd = function () {
var i = 0;
while (i < _root.aSnd.length) {
_root.aSnd[i].stop();
i++;
}
};
_root.playLoop = function () {
if (_root.iMusic == 1) {
_root.aLoops[0].stop();
_root.aLoops[0].start(0, 999999);
}
};
_root.stopLoop = function () {
_root.aLoops[0].stop();
};
_level0.ttext_help = "Instructions";
_level0.ttext_playgame = "Play Game";
_level0.ttext_website = "Visit Website";
_level0.ttext_trailer = "View Trailer";
_level0.ttext_back = "Back";
_level0.ttext_quitgame = "End Game";
_level0.ttext_quit1 = "Are you sure you want to quit?";
_level0.ttext_quit2 = "No";
_level0.ttext_quit3 = "Yes";
_level0.ttext_restartgame = "Restart Game";
_level0.ttext_sendscore = "Send Score";
_level0.ttext_challenge = "Send a Challenge Card";
Frame 3
gMyScoringSystem.reset();
_root.logoShown();
Frame 4
stop();
Frame 12
stop();
Instance of Symbol 321 MovieClip "player3" in Frame 12
on (release) {
_root.playSound(4);
_global.playerselect = 3;
_root.gotoAndPlay("selectballframe");
}
on (rollOver) {
_root.playerinfo = "Good for long distances. Tends to overshoot the ball though.";
_root.player3.gotoAndStop(2);
}
on (rollOut) {
_root.playerinfo = "";
_root.player3.gotoAndStop(1);
}
Instance of Symbol 324 MovieClip in Frame 12
on (press) {
_root.playSound(0);
_global.playerselect = 4;
_root.gotoAndPlay("selectballframe");
}
Instance of Symbol 331 MovieClip "player1" in Frame 12
on (release) {
_root.playSound(4);
_global.playerselect = 1;
_root.gotoAndPlay("selectballframe");
}
on (rollOver) {
_root.playerinfo = "Excellent for beginners. Good in combination with a Reese's Chocolate Puff.";
_root.player1.gotoAndStop(2);
}
on (rollOut) {
_root.playerinfo = "";
_root.player1.gotoAndStop(1);
}
Instance of Symbol 334 MovieClip "player2" in Frame 12
on (release) {
_root.playSound(4);
_global.playerselect = 2;
_root.gotoAndPlay("selectballframe");
}
on (rollOver) {
_root.playerinfo = "The perfect Mini-Golf player in combination with the right ball.";
_root.player2.gotoAndStop(2);
}
on (rollOut) {
_root.playerinfo = "";
_root.player2.gotoAndStop(1);
}
Frame 13
stop();
Instance of Symbol 324 MovieClip in Frame 13
on (press) {
_root.playSound(0);
_global.playerselect = 4;
_root.gotoAndPlay("gameframe");
}
Instance of Symbol 342 MovieClip "ball2" in Frame 13
on (release) {
_root.playSound(4);
_global.ballselect = 2;
_root.gotoAndPlay("gameframe");
}
on (rollOver) {
_root.ballinfo = "A very light ball. Good for long distances.";
_root.ball2.gotoAndStop(2);
}
on (rollOut) {
_root.ballinfo = "";
_root.ball2.gotoAndStop(1);
}
Instance of Symbol 343 MovieClip "ball3" in Frame 13
on (release) {
_root.playSound(4);
_global.ballselect = 3;
_root.gotoAndPlay("gameframe");
}
on (rollOver) {
_root.ballinfo = "Fancy a challenge? This extremely heavy ball should only be used\nin combination with a strong shooter!";
_root.ball3.gotoAndStop(2);
}
on (rollOut) {
_root.ballinfo = "";
_root.ball3.gotoAndStop(1);
}
Instance of Symbol 347 MovieClip "ball1" in Frame 13
on (release) {
_root.playSound(4);
_global.ballselect = 1;
_root.gotoAndPlay("gameframe");
}
on (rollOver) {
_root.ballinfo = "A good choice for beginners.";
_root.ball1.gotoAndStop(2);
}
on (rollOut) {
_root.ballinfo = "";
_root.ball1.gotoAndStop(1);
}
Frame 14
isometricAS = function (maxx, maxz) {
this.maxx = maxx;
this.maxz = maxz;
this.theta = 30;
this.alpha = 45;
this.theta = this.theta * (Math.PI/180);
this.alpha = this.alpha * (Math.PI/180);
this.sinTheta = Math.sin(this.theta);
this.cosTheta = Math.cos(this.theta);
this.sinAlpha = Math.sin(this.alpha);
this.cosAlpha = Math.cos(this.alpha);
};
isometricAS.prototype.mapToScreen = function (xpp, ypp, zpp) {
var yp = ypp;
var xp = ((xpp * this.cosAlpha) + (zpp * this.sinAlpha));
var zp = ((zpp * this.cosAlpha) - (xpp * this.sinAlpha));
var x = xp;
var y = ((yp * this.cosTheta) - (zp * this.sinTheta));
return([x, y]);
};
isometricAS.prototype.mapToIsoWorld = function (screenX, screenY) {
var z = (((screenX / this.cosAlpha) - (screenY / (this.sinAlpha * this.sinTheta))) * (1 / ((this.cosAlpha / this.sinAlpha) + (this.sinAlpha / this.cosAlpha))));
var x = ((1 / this.cosAlpha) * (screenX - (z * this.sinAlpha)));
return([x, z]);
};
isometricAS.prototype.calculateDepth = function (x, y, z) {
x++;
z++;
var leeway = 20;
var x = (Math.abs(x) * leeway);
var y = Math.abs(y);
var z = (Math.abs(z) * leeway);
var a = this.maxx;
var b = this.maxz;
var floor = ((a * (b - 1)) + x);
var depth = (((a * (z - 1)) + x) + (floor * y));
return(depth);
};
isometricAS.prototype.calcDepth2 = function (x, y, z) {
var leeway = 1;
var x = (Math.abs(x) * leeway);
var y = Math.abs(y);
var z = (Math.abs(z) * leeway);
var a = this.maxx;
var b = this.maxz;
var floor = ((a * (b - 1)) + x);
var depth = (((a * (z - 1)) + x) + (floor * y));
return(depth);
};
T_FLAT = 1;
T_SOLID = 2;
T_HILL = 3;
T_STEEP = 4;
T_HOLE = 5;
T_WATER = 6;
T_SAND = 7;
T_BELT1 = 8;
T_BELT2 = 9;
T_BELT3 = 10;
T_BELT4 = 11;
T_FAN1 = 12;
T_FAN2 = 13;
tileClass = function (tt, x1, x2, x3, x4, st) {
this.ttype = tt;
this.corner1 = x1;
this.corner2 = x2;
this.corner3 = x3;
this.corner4 = x4;
this.incline = st;
};
gAllTiles = [];
gAllTiles.push(new tileClass(T_FLAT, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_FLAT, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_FLAT, 0, 0, 0, 0, 0));
var i = 1;
while (i <= 8) {
gAllTiles.push(new tileClass(T_SOLID, 0, 0, 0, 0, 0));
i++;
}
gAllTiles.push(new tileClass(T_SOLID, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_SOLID, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_HILL, 23, 23, 23, 23, 0));
gAllTiles.push(new tileClass(T_STEEP, 23, 23, 0, 0, 1));
gAllTiles.push(new tileClass(T_STEEP, 0, 0, 23, 23, 3));
gAllTiles.push(new tileClass(T_STEEP, 23, 0, 0, 23, 4));
gAllTiles.push(new tileClass(T_STEEP, 0, 23, 23, 0, 2));
gAllTiles.push(new tileClass(T_HOLE, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_WATER, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_SAND, 0, 0, 0, 0, 0));
var i = 1;
while (i <= 14) {
gAllTiles.push(new tileClass(T_SOLID, 0, 0, 0, 0, 0));
i++;
}
gAllTiles.push(new tileClass(T_SOLID, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_BELT1, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_BELT2, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_BELT3, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_BELT4, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_HILL, 23, 23, 23, 23, 0));
gAllTiles.push(new tileClass(T_HILL, 23, 23, 23, 23, 0));
gAllTiles.push(new tileClass(T_HILL, 23, 23, 23, 23, 0));
gAllTiles.push(new tileClass(T_HILL, 23, 23, 23, 23, 0));
gAllTiles.push(new tileClass(T_HILL, 23, 23, 23, 23, 0));
var i = 1;
while (i <= 4) {
gAllTiles.push(new tileClass(T_SOLID, 0, 0, 0, 0, 0));
i++;
}
var i = 1;
while (i <= 4) {
gAllTiles.push(new tileClass(T_SOLID, 0, 0, 0, 0, 0));
i++;
}
gAllTiles.push(new tileClass(T_FAN1, 0, 0, 0, 0, 0));
gAllTiles.push(new tileClass(T_FAN2, 0, 0, 0, 0, 0));
OBJ_BALL_ = 1;
OBJ_HOLE_ = 2;
OBJ_FIELD_ = 3;
H_END = 1;
H_PORT = 2;
H_WMILL = 3;
extraClass = function (z, x, mc) {
this.zpos = z;
this.xpos = x;
this.mcname = mc;
};
cellClass = function (z, x, t) {
this.gridZ = z;
this.gridX = x;
this.tile = t;
};
holeClass = function (aHole) {
this.htype = aHole[0];
this.zpos = aHole[1];
this.ypos = aHole[2];
this.xpos = aHole[3];
this.zvel = aHole[4];
this.yvel = aHole[5];
this.xvel = aHole[6];
this.xfld = aHole[7];
this.yfld = aHole[8];
};
objectClass = function (z, y, x, ot) {
this.zpos = z;
this.ypos = y;
this.xpos = x;
this.objType = ot;
this.objHole = {};
};
levelClass = function () {
this.aLevels = [];
this.aObjects = [];
this.aExtras = [];
this.maxLevels = 0;
this.maxz = 0;
this.maxx = 0;
this.init = function (mz, mx, bShowLevel) {
this.maxz = mz;
this.maxx = mx;
this.createLevels();
this.maxLevels = this.aLevels.length;
if (bShowLevel) {
var level = 0;
while (level < this.maxLevels) {
trace((("level_" + (level + 1)) + ": ") + this.aLevels[level]);
var cell = 0;
while (cell < this.aLevels[level].length) {
trace(((" cell_" + (cell + 1)) + "_Z : ") + this.aLevels[level][cell].gridZ);
trace(((" cell_" + (cell + 1)) + "_X : ") + this.aLevels[level][cell].gridX);
trace(((" cell_" + (cell + 1)) + "_Tile : ") + this.aLevels[level][cell].tile);
cell++;
}
level++;
}
}
};
this.returnLevel = function (iLevel) {
if (iLevel > this.maxLevels) {
iLevel = 1;
}
return([this.aLevels[iLevel - 1], this.aObjects[iLevel - 1], this.aExtras[iLevel - 1]]);
};
this.returnEmptyLevel = function () {
aTemp = [];
var row = 0;
while (row < this.maxz) {
aTemp.push([]);
var col = 0;
while (col < this.maxx) {
aTemp[row].push(new cellClass(-1, -1, -1));
col++;
}
row++;
}
return(aTemp);
};
this.createLevels = function () {
this.aLevels = [];
this.aObjects = [];
this.aExtras = [];
var objCell = {};
var objObj = {};
var aTemp = this.getLevels();
var aLevs = aTemp[0];
var aObjs = aTemp[1];
var aXtras = aTemp[2];
var oneCell = [];
var oneObj = [];
var holeObj = [];
var level = 0;
while (level < aLevs.length) {
this.aLevels.push([]);
var cell = 0;
while (cell < aLevs[level].length) {
oneCell = aLevs[level][cell];
objCell = new cellClass(oneCell[0], oneCell[1], oneCell[2]);
this.aLevels[level].push(objCell);
cell++;
}
level++;
}
var level = 0;
while (level < aObjs.length) {
this.aObjects.push([]);
var object = 0;
while (object < aObjs[level].length) {
oneObj = aObjs[level][object];
objObj = new objectClass(oneObj[0], oneObj[1], oneObj[2], oneObj[3]);
if (oneObj[3] == OBJ_HOLE_) {
holeObj = new holeClass(oneObj[4]);
objObj.objHole = holeObj;
}
this.aObjects[level].push(objObj);
object++;
}
level++;
}
var level = 0;
while (level < aXtras.length) {
this.aExtras.push([]);
var cell = 0;
while (cell < aXtras[level].length) {
oneCell = aXtras[level][cell];
objCell = new extraClass(oneCell[0], oneCell[1], oneCell[2]);
this.aExtras[level].push(objCell);
cell++;
}
level++;
}
};
this.getLevels = function () {
var aTemp = [];
var aGrid = [];
var aObjs = [];
var aXtras = [];
aGrid.push([[4, 6, 12], [4, 7, 4], [4, 8, 4], [4, 9, 4], [4, 10, 12], [5, 6, 3], [5, 7, 18], [5, 8, 1], [5, 9, 1], [5, 10, 5], [6, 6, 3], [6, 7, 1], [6, 8, 20], [6, 9, 1], [6, 10, 5], [7, 5, 12], [7, 6, 9], [7, 7, 1], [7, 8, 1], [7, 9, 1], [7, 10, 5], [8, 5, 3], [8, 6, 1], [8, 7, 1], [8, 8, 1], [8, 9, 1], [8, 10, 5], [9, 5, 3], [9, 6, 1], [9, 7, 1], [9, 8, 1], [9, 9, 7], [9, 10, 12], [10, 5, 3], [10, 6, 1], [10, 7, 20], [10, 8, 1], [10, 9, 5], [11, 5, 3], [11, 6, 1], [11, 7, 1], [11, 8, 1], [11, 9, 5], [12, 5, 3], [12, 6, 1], [12, 7, 1], [12, 8, 1], [12, 9, 5], [13, 5, 3], [13, 6, 1], [13, 7, 2], [13, 8, 1], [13, 9, 5], [14, 5, 12], [14, 6, 6], [14, 7, 6], [14, 8, 6], [14, 9, 12]]);
aObjs.push([[-205, 0, 410, OBJ_FIELD_], [-806, 0, 446, OBJ_BALL_], [-318, 0, 438, OBJ_HOLE_, [H_END, 0, 0, 0, 0, 0, 0, 0, 0]]]);
aXtras.push([[-4, 8, "bigsign"], [-8, 5, "bush1"], [-9, 10, "bush1"], [-4, 9, "tree4"], [-12, 5, "tree2"], [-9, 12, "tree4"], [-8, 12, "tree2"], [-8, 13, "tree4"], [-7, 6, "tree4"], [-13, 4, "tree4"], [-14, 5, "bush2"], [-5, 10, "bush2"], [-9, 13, "bush2"], [-13, 5, "bush1"]]);
aGrid.push([[5, 9, 12], [6, 6, 12], [6, 7, 4], [6, 8, 4], [6, 9, 4], [6, 10, 4], [6, 11, 4], [6, 12, 4], [6, 13, 12], [6, 14, 12], [7, 5, 12], [7, 6, 9], [7, 7, 1], [7, 8, 1], [7, 9, 1], [7, 10, 1], [7, 11, 20], [7, 12, 1], [7, 13, 10], [7, 14, 12], [8, 5, 3], [8, 6, 1], [8, 7, 1], [8, 8, 1], [8, 9, 1], [8, 10, 1], [8, 11, 1], [8, 12, 1], [8, 13, 1], [8, 14, 5], [9, 5, 3], [9, 6, 1], [9, 7, 1], [9, 8, 1], [9, 9, 7], [9, 10, 8], [9, 11, 1], [9, 12, 1], [9, 13, 1], [9, 14, 5], [10, 5, 3], [10, 6, 1], [10, 7, 1], [10, 8, 1], [10, 9, 5], [10, 10, 3], [10, 11, 1], [10, 12, 2], [10, 13, 7], [10, 14, 12], [11, 5, 3], [11, 6, 1], [11, 7, 20], [11, 8, 1], [11, 9, 5], [11, 10, 12], [11, 11, 6], [11, 12, 6], [11, 13, 12], [12, 5, 3], [12, 6, 1], [12, 7, 1], [12, 8, 1], [12, 9, 5], [13, 5, 3], [13, 6, 18], [13, 7, 1], [13, 8, 7], [13, 9, 12], [14, 5, 12], [14, 6, 6], [14, 7, 6], [14, 8, 12]]);
aObjs.push([[-240, 0, 380, OBJ_FIELD_], [-626, 0, 746, OBJ_BALL_], [-798, 0, 378, OBJ_HOLE_, [H_END, 0, 0, 0, 0, 0, 0, 0, 0]]]);
aXtras.push([[-5, 9, "vending"], [-5, 10, "tree4"], [-7, 14, "tree2"], [-10, 10, "tree4"], [-13, 5, "tree2"], [-13, 8, "bush2"], [-5, 8, "bush2"], [-9, 5, "bush2"], [-12, 5, "tree4"], [-7, 13, "tree4"], [-6, 7, "bush1"], [-11, 10, "bush1"]]);
aGrid.push([[7, 7, 12], [7, 8, 24], [7, 9, 24], [7, 10, 33], [7, 11, 4], [7, 12, 4], [7, 13, 4], [7, 14, 12], [8, 7, 23], [8, 8, 13], [8, 9, 13], [8, 10, 16], [8, 11, 1], [8, 12, 1], [8, 13, 1], [8, 14, 5], [9, 7, 23], [9, 8, 13], [9, 9, 13], [9, 10, 16], [9, 11, 20], [9, 12, 1], [9, 13, 2], [9, 14, 5], [10, 7, 27], [10, 8, 14], [10, 9, 14], [10, 10, 45], [10, 11, 6], [10, 12, 6], [10, 13, 6], [10, 14, 12], [11, 7, 3], [11, 8, 1], [11, 9, 20], [11, 10, 5], [12, 7, 3], [12, 8, 1], [12, 9, 1], [12, 10, 5], [13, 7, 3], [13, 8, 1], [13, 9, 18], [13, 10, 5], [14, 7, 12], [14, 8, 6], [14, 9, 6], [14, 10, 12]]);
aObjs.push([[-240, 0, 350, OBJ_FIELD_], [-566, 0, 806, OBJ_BALL_], [-798, 0, 558, OBJ_HOLE_, [H_END, 0, 0, 0, 0, 0, 0, 0, 0]]]);
aXtras.push([[-11, 6, "arrow_top"], [-6, 10, "arrow_right"], [-7, 14, "tree2"], [-10, 7, "bush2"], [-8, 6, "tree4"], [-9, 6, "tree2"], [-12, 12, "tree4"], [-12, 13, "bush1"], [-7, 11, "bush2"], [-8, 14, "bush2"], [-14, 7, "bush1"], [-7, 7, "tree4"], [-8, 15, "tree4"]]);
aGrid.push([[5, 7, 12], [5, 8, 4], [5, 9, 12], [6, 7, 3], [6, 8, 19], [6, 9, 5], [7, 7, 3], [7, 8, 1], [7, 9, 5], [8, 7, 3], [8, 8, 1], [8, 9, 5], [9, 3, 12], [9, 4, 4], [9, 5, 4], [9, 6, 4], [9, 7, 48], [9, 8, 15], [9, 9, 47], [9, 10, 4], [9, 11, 4], [9, 12, 4], [9, 13, 4], [9, 14, 12], [10, 3, 3], [10, 4, 20], [10, 5, 1], [10, 6, 1], [10, 7, 17], [10, 8, 40], [10, 9, 16], [10, 10, 1], [10, 11, 1], [10, 12, 1], [10, 13, 20], [10, 14, 5], [11, 3, 12], [11, 4, 6], [11, 5, 6], [11, 6, 6], [11, 7, 46], [11, 8, 14], [11, 9, 45], [11, 10, 6], [11, 11, 6], [11, 12, 6], [11, 13, 6], [11, 14, 12], [12, 7, 3], [12, 8, 1], [12, 9, 5], [13, 7, 3], [13, 8, 1], [13, 9, 5], [14, 7, 3], [14, 8, 1], [14, 9, 5], [15, 7, 3], [15, 8, 2], [15, 9, 5], [16, 7, 12], [16, 8, 6], [16, 9, 12]]);
aObjs.push([[-240, 0, 430, OBJ_FIELD_], [-926, 0, 506, OBJ_BALL_], [-618, 0, 498, OBJ_HOLE_, [H_END, 0, 0, 0, 0, 0, 0, 0, 0]]]);
aXtras.push([[-8, 11, "bigsign"], [-7, 10, "tree4"], [-8, 12, "tree4"], [-8, 5, "tree4"], [-13, 6, "tree4"], [-8, 13, "bush2"], [-12, 9, "bush2"], [-15, 7, "bush2"], [-13, 5, "tree2"], [-8, 6, "tree2"], [-6, 10, "tree2"], [-6, 7, "bush1"], [-8, 4, "bush1"]]);
aGrid.push([[6, 4, 12], [6, 5, 4], [6, 6, 4], [6, 7, 4], [6, 8, 4], [6, 9, 4], [6, 10, 11], [7, 4, 3], [7, 5, 1], [7, 6, 1], [7, 7, 1], [7, 8, 1], [7, 9, 18], [7, 10, 5], [8, 4, 3], [8, 5, 18], [8, 6, 7], [8, 7, 8], [8, 8, 1], [8, 9, 7], [8, 10, 12], [9, 4, 12], [9, 5, 6], [9, 6, 12], [9, 7, 29], [9, 8, 15], [9, 9, 28], [9, 10, 12], [9, 11, 22], [9, 12, 4], [9, 13, 4], [9, 14, 4], [9, 15, 12], [10, 7, 23], [10, 8, 41], [10, 9, 25], [10, 10, 21], [10, 11, 1], [10, 12, 1], [10, 13, 1], [10, 14, 1], [10, 15, 5], [11, 7, 23], [11, 8, 41], [11, 9, 25], [11, 10, 3], [11, 11, 20], [11, 12, 7], [11, 13, 8], [11, 14, 18], [11, 15, 5], [12, 7, 27], [12, 8, 14], [12, 9, 30], [12, 10, 12], [12, 11, 6], [12, 12, 12], [12, 13, 12], [12, 14, 6], [12, 15, 12], [13, 7, 3], [13, 8, 1], [13, 9, 5], [14, 7, 3], [14, 8, 2], [14, 9, 5], [15, 7, 12], [15, 8, 6], [15, 9, 12]]);
aTemp = [[-200, 0, 400, OBJ_FIELD_], [-866, 0, 506, OBJ_BALL_]];
aTemp.push([-498, 0, 316, OBJ_HOLE_, [H_PORT, -626, 0, 660, 0, 0, 4, 320, -320]]);
aTemp.push([-438, 0, 558, OBJ_HOLE_, [H_PORT, -600, 0, 686, -4, 0, 0, 320, -320]]);
aTemp.push([-678, 0, 858, OBJ_HOLE_, [H_END, 0, 0, 0, 0, 0, 0, 0, 0]]);
aObjs.push(aTemp);
aXtras.push([[-8, 13, "palace"], [-10, 17, "arrow_top"], [-8, 14, "tree2"], [-8, 15, "tree4"], [-8, 4, "tree4"], [-7, 10, "tree2"], [-15, 7, "tree4"], [-12, 10, "tree4"], [-11, 12, "bush2"], [-9, 15, "bush2"], [-10, 6, "bush2"], [-10, 5, "tree2"], [-6, 6, "bush1"], [-14, 11, "tree2"], [-14, 12, "bush1"]]);
aGrid.push([[6, 5, 12], [6, 6, 4], [6, 7, 4], [6, 8, 4], [6, 9, 4], [6, 10, 34], [6, 11, 24], [6, 12, 33], [6, 13, 4], [6, 14, 12], [7, 5, 21], [7, 6, 1], [7, 7, 1], [7, 8, 1], [7, 9, 38], [7, 10, 17], [7, 11, 41], [7, 12, 16], [7, 13, 18], [7, 14, 5], [8, 5, 12], [8, 6, 6], [8, 7, 8], [8, 8, 1], [8, 9, 7], [8, 10, 31], [8, 11, 26], [8, 12, 32], [8, 13, 6], [8, 14, 12], [9, 7, 3], [9, 8, 1], [9, 9, 10], [9, 10, 4], [9, 11, 12], [10, 5, 12], [10, 6, 12], [10, 7, 9], [10, 8, 1], [10, 9, 1], [10, 10, 20], [10, 11, 10], [10, 12, 4], [10, 13, 12], [11, 5, 12], [11, 6, 11], [11, 7, 20], [11, 8, 1], [11, 9, 1], [11, 10, 1], [11, 11, 1], [11, 12, 2], [11, 13, 5], [12, 5, 12], [12, 6, 12], [12, 7, 8], [12, 8, 54], [12, 9, 1], [12, 10, 1], [12, 11, 7], [12, 12, 6], [12, 13, 12], [13, 7, 3], [13, 8, 1], [13, 9, 1], [13, 10, 1], [13, 11, 10], [13, 12, 12], [13, 19, 12], [14, 7, 3], [14, 8, 1], [14, 9, 1], [14, 10, 1], [14, 11, 18], [14, 12, 5], [14, 16, 12], [14, 17, 4], [14, 18, 4], [14, 19, 4], [14, 20, 12], [15, 7, 12], [15, 8, 6], [15, 9, 6], [15, 10, 6], [15, 11, 6], [15, 12, 12], [15, 14, 12], [15, 15, 4], [15, 16, 9], [15, 17, 1], [15, 18, 1], [15, 19, 18], [15, 20, 5], [16, 14, 21], [16, 15, 1], [16, 16, 1], [16, 17, 1], [16, 18, 7], [16, 19, 6], [16, 20, 12], [17, 14, 12], [17, 15, 6], [17, 16, 6], [17, 17, 6], [17, 18, 12]]);
aTemp = [[-250, 0, 360, OBJ_FIELD_], [-686, 0, 746, OBJ_BALL_]];
aTemp.push([-858, 0, 678, OBJ_HOLE_, [H_PORT, -446, 0, 360, 0, 0, 38, 360, -250]]);
aTemp.push([-438, 0, 798, OBJ_HOLE_, [H_PORT, -986, 0, 900, 0, 0, 4, 360, -490]]);
aTemp.push([-918, 0, 1158, OBJ_HOLE_, [H_END, 0, 0, 0, 0, 0, 0, 0, 0]]);
aObjs.push(aTemp);
aXtras.push([[-13, 19, "vending"], [-9, 6, "bush1"], [-15, 10, "bush2"], [-9, 12, "bush1"], [-6, 8, "bush2"], [-12, 7, "tree4"], [-6, 12, "tree4"], [-9, 7, "tree4"], [-12, 5, "tree2"], [-6, 14, "tree2"], [-13, 20, "tree4"], [-13, 18, "tree2"], [-18, 15, "tree4"], [-18, 16, "bush1"], [-14, 21, "bush1"]]);
aGrid.push([[3, 6, 12], [3, 7, 12], [3, 8, 12], [4, 6, 12], [4, 7, 11], [4, 8, 12], [5, 6, 3], [5, 7, 18], [5, 8, 5], [5, 10, 12], [5, 11, 12], [5, 12, 12], [6, 6, 29], [6, 7, 15], [6, 8, 28], [6, 10, 12], [6, 11, 11], [6, 12, 12], [7, 6, 23], [7, 7, 41], [7, 8, 52], [7, 9, 33], [7, 10, 9], [7, 11, 20], [7, 12, 10], [7, 13, 4], [7, 14, 12], [8, 6, 23], [8, 7, 41], [8, 8, 41], [8, 9, 16], [8, 10, 1], [8, 11, 1], [8, 12, 1], [8, 13, 1], [8, 14, 5], [9, 6, 23], [9, 7, 41], [9, 8, 49], [9, 9, 32], [9, 10, 8], [9, 11, 1], [9, 12, 20], [9, 13, 2], [9, 14, 5], [10, 6, 27], [10, 7, 14], [10, 8, 30], [10, 10, 12], [10, 11, 6], [10, 12, 6], [10, 13, 6], [10, 14, 12], [11, 6, 3], [11, 7, 18], [11, 8, 5], [12, 6, 12], [12, 7, 11], [12, 8, 12], [13, 6, 12], [13, 7, 12], [13, 8, 12], [14, 10, 12], [14, 13, 4], [14, 14, 4], [14, 15, 4], [14, 16, 4], [14, 17, 4], [14, 18, 4], [14, 19, 12], [15, 10, 3], [15, 13, 18], [15, 14, 1], [15, 15, 20], [15, 16, 1], [15, 17, 1], [15, 18, 1], [15, 19, 5], [16, 10, 3], [16, 11, 1], [16, 12, 1], [16, 13, 11], [16, 14, 1], [16, 15, 1], [16, 16, 1], [16, 17, 1], [16, 18, 20], [16, 19, 5], [17, 10, 3], [17, 11, 1], [17, 12, 1], [17, 13, 1], [17, 14, 1], [17, 15, 1], [17, 16, 1], [17, 17, 1], [17, 18, 1], [17, 19, 5], [18, 10, 12], [18, 11, 6], [18, 12, 6], [18, 13, 6], [18, 14, 6], [18, 15, 6], [18, 16, 6], [18, 17, 6], [18, 18, 6], [18, 19, 12]]);
aTemp = [[-200, 0, 310, OBJ_FIELD_], [-566, 0, 806, OBJ_BALL_]];
aTemp.push([-678, 0, 438, OBJ_HOLE_, [H_PORT, -960, 0, 715, 0.5, 0, 0, 410, -480]]);
aTemp.push([-318, 0, 438, OBJ_HOLE_, [H_PORT, -960, 0, 715, -4, 0, 0, 410, -480]]);
aTemp.push([-918, 0, 798, OBJ_HOLE_, [H_END, 0, 0, 0, 0, 0, 0, 0, 0]]);
aObjs.push(aTemp);
aXtras.push([[-15, 11, "pyramid1"], [-7, 14, "arrow_right"], [-13, 6, "tree4"], [-10, 10, "tree4"], [-6, 13, "tree4"], [-4, 8, "tree4"], [-15, 10, "tree4"], [-13, 17, "tree4"], [-14, 8, "tree2"], [-5, 13, "tree2"], [-4, 9, "tree2"], [-13, 18, "tree2"], [-7, 10, "bush2"], [-9, 6, "tree4"], [-9, 9, "bush1"], [-14, 14, "bush2"], [-18, 11, "bush2"], [-14, 18, "bush1"]]);
aGrid.push([[5, 7, 12], [5, 8, 4], [5, 9, 4], [5, 10, 4], [5, 11, 4], [5, 12, 4], [5, 13, 4], [5, 14, 12], [6, 6, 12], [6, 7, 9], [6, 8, 1], [6, 9, 1], [6, 10, 1], [6, 11, 1], [6, 12, 1], [6, 13, 1], [6, 14, 5], [7, 6, 3], [7, 7, 1], [7, 8, 1], [7, 9, 53], [7, 10, 1], [7, 11, 20], [7, 12, 1], [7, 13, 2], [7, 14, 5], [8, 6, 3], [8, 7, 1], [8, 8, 1], [8, 9, 1], [8, 10, 1], [8, 11, 1], [8, 12, 1], [8, 13, 1], [8, 14, 5], [9, 6, 3], [9, 7, 1], [9, 8, 1], [9, 9, 7], [9, 10, 6], [9, 11, 6], [9, 12, 6], [9, 13, 6], [9, 14, 12], [10, 6, 3], [10, 7, 1], [10, 8, 1], [10, 9, 10], [10, 10, 12], [10, 11, 12], [10, 12, 22], [10, 13, 12], [10, 14, 12], [11, 6, 3], [11, 7, 1], [11, 8, 1], [11, 9, 1], [11, 10, 5], [11, 11, 3], [11, 12, 1], [11, 13, 10], [11, 14, 12], [12, 6, 3], [12, 7, 1], [12, 8, 54], [12, 9, 1], [12, 10, 5], [12, 11, 3], [12, 12, 1], [12, 13, 18], [12, 14, 5], [13, 6, 3], [13, 7, 20], [13, 8, 1], [13, 9, 18], [13, 10, 5], [13, 11, 12], [13, 12, 11], [13, 13, 1], [13, 14, 5], [14, 6, 12], [14, 7, 6], [14, 8, 6], [14, 9, 6], [14, 10, 12], [14, 11, 12], [14, 12, 12], [14, 13, 6], [14, 14, 12]]);
aTemp = [[-270, 0, 330, OBJ_FIELD_], [-446, 0, 806, OBJ_BALL_]];
aTemp.push([-798, 0, 558, OBJ_HOLE_, [H_PORT, -660, 0, 746, -4, 0, 0, 330, -350]]);
aTemp.push([-738, 0, 798, OBJ_HOLE_, [H_END, 0, 0, 0, 0, 0, 0, 0, 0]]);
aObjs.push(aTemp);
aXtras.push([[-10, 13, "arrow_right"], [-6, 7, "bush1"], [-14, 12, "bush2"], [-10, 13, "bush1"], [-11, 6, "bush2"], [-11, 15, "tree4"], [-12, 6, "tree4"], [-5, 12, "tree2"], [-15, 12, "tree2"], [-10, 10, "tree4"], [-10, 11, "bush2"], [-5, 11, "bush1"], [-14, 15, "bush1"]]);
aGrid.push([[5, 8, 12], [5, 9, 4], [5, 10, 4], [5, 11, 4], [5, 12, 4], [5, 13, 4], [5, 14, 12], [6, 8, 11], [6, 9, 20], [6, 10, 1], [6, 11, 1], [6, 12, 1], [6, 13, 2], [6, 14, 5], [7, 8, 3], [7, 9, 1], [7, 10, 1], [7, 11, 7], [7, 12, 6], [7, 13, 6], [7, 14, 12], [8, 8, 9], [8, 9, 1], [8, 10, 1], [8, 11, 5], [9, 4, 12], [9, 5, 4], [9, 6, 4], [9, 7, 12], [9, 8, 1], [9, 9, 1], [9, 10, 53], [9, 11, 5], [10, 8, 8], [10, 9, 1], [10, 10, 1], [10, 11, 5], [11, 8, 3], [11, 9, 1], [11, 10, 1], [11, 11, 10], [11, 12, 12], [12, 8, 11], [12, 9, 1], [12, 10, 1], [12, 11, 20], [12, 12, 5], [13, 8, 12], [13, 9, 6], [13, 10, 6], [13, 11, 6], [13, 12, 12], [14, 18, 11], [14, 19, 12], [14, 20, 4], [14, 21, 4], [14, 22, 4], [14, 23, 4], [14, 24, 12], [15, 14, 12], [15, 15, 4], [15, 16, 4], [15, 17, 4], [15, 18, 12], [15, 19, 3], [15, 20, 1], [15, 21, 1], [15, 22, 1], [15, 23, 1], [15, 24, 5], [15, 25, 12], [16, 14, 21], [16, 15, 1], [16, 16, 1], [16, 17, 1], [16, 18, 5], [16, 19, 3], [16, 20, 1], [16, 21, 7], [16, 22, 8], [16, 23, 1], [16, 24, 10], [16, 25, 4], [16, 26, 12], [17, 14, 12], [17, 15, 6], [17, 16, 8], [17, 17, 1], [17, 18, 10], [17, 19, 9], [17, 20, 1], [17, 21, 5], [17, 22, 3], [17, 23, 1], [17, 24, 1], [17, 25, 18], [17, 26, 5], [18, 16, 3], [18, 17, 1], [18, 18, 1], [18, 19, 1], [18, 20, 1], [18, 21, 5], [18, 22, 12], [18, 23, 6], [18, 24, 6], [18, 25, 6], [18, 26, 12], [19, 16, 12], [19, 17, 6], [19, 18, 6], [19, 19, 6], [19, 20, 6], [19, 21, 12]]);
aTemp = [[-240, 0, 290, OBJ_FIELD_], [-386, 0, 806, OBJ_BALL_]];
aTemp.push([-555, 0, 468, OBJ_HOLE_, [H_PORT, -986, 0, 900, 0, 0, 4, 200, -630]]);
aTemp.push([-1038, 0, 1518, OBJ_HOLE_, [H_END, 0, 0, 0, 0, 0, 0, 0, 0]]);
aObjs.push(aTemp);
aXtras.push([[-9, 8, "main_pyramid"], [-15, 25, "vending"], [-7, 7, "tree4"], [-12, 7, "tree2"], [-4, 12, "tree4"], [-4, 11, "tree2"], [-14, 19, "tree4"], [-15, 26, "tree2"], [-18, 15, "tree4"], [-20, 17, "tree2"], [-15, 15, "bush2"], [-16, 18, "bush1"], [-17, 22, "bush2"], [-19, 22, "bush1"], [-13, 9, "bush2"], [-5, 13, "bush1"], [-9, 11, "bush2"], [-11, 13, "bush1"]]);
return([aGrid, aObjs, aXtras]);
};
};
birdClass = function () {
this.mc = _root.bird;
this.xpos = 0;
this.ypos = 0;
this.xvel = 0;
this.yvel = 0;
this.frame = 1;
this.maxfr = 10;
this.moving = false;
this.start = function () {
this.xpos = 0;
this.ypos = 40;
this.xvel = 10;
this.yvel = -1;
this.frame = 1;
this.moving = true;
};
this.stopIt = function () {
this.xpos = -100;
this.ypos = -100;
this.mc._x = this.xpos;
this.mc._y = this.ypos;
this.xvel = 0;
this.yvel = 0;
this.frame = 1;
this.moving = true;
};
this.move = function () {
this.xpos = this.xpos + this.xvel;
this.ypos = this.ypos + this.yvel;
this.frame = ((this.frame < this.maxfr) ? (this.frame + 2) : 1);
this.mc._x = this.xpos;
this.mc._y = this.ypos;
this.mc.gotoAndStop(this.frame);
if (this.xpos > 700) {
this.stopIt();
}
};
};
ballClass = function () {
this.aRollDecay = [0.97, 0.98, 0.94];
this.aWallDecay = [0.9, 0.9, 1];
this.hillDecay = 0.85;
this.waterDecay = 0.85;
this.sandDecay = 0.7;
this.gravity = 1.2;
this.zPos = 0;
this.xPos = 0;
this.yPos = 0;
this.lastzPos = 0;
this.lastxPos = 0;
this.lastyPos = 0;
this.zVelocity = 0;
this.xVelocity = 0;
this.yVelocity = 0;
this.mass = 1;
this.ballWidth = 8;
this.ballRad = this.ballWidth / 2;
this.lastRow = 0;
this.lastCol = 0;
this.lastTopRow = 0;
this.lastTopCol = 0;
this.lastBotRow = 0;
this.lastBotCol = 0;
this.holeX = 0;
this.holeY = 0;
this.holeZ = 0;
this.htype = 0;
this.aPortHoles = [];
this.hill = false;
this.moving = false;
this.ballType = 1;
this.ballMC = undefined;
this.cellW = 0;
this.backdrop = 0.7;
this.kickback = this.backdrop * 1.1;
this.init = function (mc, cw, bt) {
this.ballMC = mc;
this.cellW = cw;
this.ballType = bt;
this.moving = false;
};
this.setPosition = function (z, y, x) {
this.zPos = z;
this.yPos = y;
this.xPos = x;
this.zVelocity = 0;
this.yVelocity = 0;
this.xVelocity = 0;
this.trackBallGrid();
this.move();
};
this.showIt = function (bShow) {
this.ballMC._visible = bShow;
};
this.trackBallGrid = function () {
var row = int(Math.abs(this.zPos) / this.cellW);
var col = int(this.xPos / this.cellW);
var row2 = int((Math.abs(this.zPos) + this.ballWidth) / this.cellW);
var col2 = int((this.xPos + this.ballWidth) / this.cellW);
var aTiles = _global.gGame.returnTiles(row, col, row2, col2);
if (((((aTiles[0] == -1) || (gAllTiles[aTiles[0]].ttype == T_SOLID)) || ((aTiles[1] == -1) || (gAllTiles[aTiles[1]].ttype == T_SOLID))) || ((aTiles[2] == -1) || (gAllTiles[aTiles[2]].ttype == T_SOLID))) || ((aTiles[3] == -1) || (gAllTiles[aTiles[3]].ttype == T_SOLID))) {
trace("--------------------------------- trapped ---------------------------------");
this.zPos = this.lastzPos;
this.xPos = this.lastxPos;
this.yPos = this.lastyPos;
} else {
this.lastRow = int((Math.abs(this.zPos) + this.ballRad) / this.cellW);
this.lastCol = int((Math.abs(this.xPos) + this.ballRad) / this.cellW);
this.lastTopRow = row;
this.lastTopCol = col;
this.lastBotRow = row2;
this.lastBotCol = col2;
this.lastzPos = this.zPos;
this.lastxPos = this.xPos;
this.lastyPos = this.yPos;
}
};
this.resetObjects = function () {
this.aPortHoles = [];
};
this.setEndHole = function (hz, hy, hx, ht) {
this.holeX = hx;
this.holeY = hy;
this.holeZ = hz;
this.htype = ht;
};
this.setPortHole = function (holeObj) {
this.aPortHoles.push(holeObj);
};
this.setRandomSpeed = function () {
this.zVelocity = 5 + random(10);
this.xVelocity = 5 + random(10);
if (random(10) > 4) {
this.zVelocity = this.zVelocity * -1;
}
if (random(20) > 9) {
this.xVelocity = this.xVelocity * -1;
}
};
this.setXSpeed = function (xs) {
this.xVelocity = (5 + random(10)) * xs;
};
this.setYSpeed = function (zs) {
this.zVelocity = (5 + random(10)) * zs;
};
this.move = function () {
var hitTarget = false;
this.zVelocity = this.zVelocity * this.aRollDecay[this.ballType - 1];
this.xVelocity = this.xVelocity * this.aRollDecay[this.ballType - 1];
this.yVelocity = this.yVelocity * this.gravity;
this.xPos = this.xPos + this.xVelocity;
this.zPos = this.zPos + this.zVelocity;
this.yPos = this.yPos + this.yVelocity;
if (this.yPos > 0) {
this.yVelocity = 0;
this.yPos = 0;
}
var collision = false;
if (!this.ballInEndHole()) {
if (!this.ballInPortHole()) {
this.objectCollisionDetection();
}
} else {
hitTarget = true;
}
var aTemp = _global.gGame.iso.mapToScreen(this.xPos, this.yPos, this.zPos);
this.ballMC._x = aTemp[0];
this.ballMC._y = aTemp[1];
this.setNewDepth();
if (Math.abs(this.zVelocity) < 0.25) {
this.zVelocity = 0;
}
if (Math.abs(this.yVelocity) < 0.25) {
this.yVelocity = 0;
}
if (Math.abs(this.xVelocity) < 0.25) {
this.xVelocity = 0;
}
if (((this.zVelocity == 0) && (this.yVelocity == 0)) && (this.xVelocity == 0)) {
this.objectCollisionDetection();
}
if ((((!this.hill) && (this.zVelocity == 0)) && (this.yVelocity == 0)) && (this.xVelocity == 0)) {
this.moving = false;
} else {
this.moving = true;
}
this.trackBallGrid();
return(hitTarget);
};
this.ballInEndHole = function () {
var bBullseye = false;
if (Math.abs(this.xVelocity >= 20) || (Math.abs(this.zVelocity >= 20))) {
return(false);
}
var x1 = (this.xPos + 4);
var x2 = (this.holeX + 12);
var y1 = (Math.abs(this.zPos) + 4);
var y2 = (Math.abs(this.holeZ) + 12);
var dist = math.sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
if (dist <= 7) {
bBullseye = true;
} else if (dist <= 12) {
var distX = (x2 - x1);
var distY = (y2 - y1);
var grav = (160 / ((dist * 2) * 5));
var xGrav = (grav * (distX / dist));
var yGrav = (grav * (distY / dist));
var xAccel = (xGrav / 2);
var yAccel = (yGrav / 2);
this.xVelocity = this.xVelocity + xAccel;
this.zVelocity = this.zVelocity + (-yAccel);
}
return(bBullseye);
};
this.ballInPortHole = function () {
var bPort = false;
if (Math.abs(this.xVelocity >= 20) || (Math.abs(this.zVelocity >= 20))) {
return(false);
}
var x1 = (this.xPos + 4);
var y1 = (Math.abs(this.zPos) + 4);
var obj = {};
var h = 0;
while (h < this.aPortHoles.length) {
obj = this.aPortHoles[h];
var x2 = (obj.xpos + 12);
var y2 = (Math.abs(obj.zpos) + 12);
var dist = math.sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
if (dist <= 7) {
if (_global.gGame.curLevel == 9) {
var pos = _root.playField.main_pyramid.door._currentframe;
if ((pos <= 6) || (pos >= 40)) {
bPort = true;
} else {
_root.playSound(4);
}
} else {
bPort = true;
}
if (bPort) {
this.ballMC._visible = false;
this.setNewPosition(obj.objHole);
break;
}
} else if (dist <= 12) {
var distX = (x2 - x1);
var distY = (y2 - y1);
var grav = (160 / ((dist * 2) * 5));
var xGrav = (grav * (distX / dist));
var yGrav = (grav * (distY / dist));
var xAccel = (xGrav / 2);
var yAccel = (yGrav / 2);
this.xVelocity = this.xVelocity + xAccel;
this.zVelocity = this.zVelocity + (-yAccel);
}
h++;
}
return(bPort);
};
this.setNewPosition = function (obj) {
this.xpos = obj.xpos;
this.ypos = obj.ypos;
this.zpos = obj.zpos;
this.xVelocity = obj.xvel;
this.yVelocity = obj.yvel;
this.zVelocity = obj.zvel;
_global.gGame.scrollScreen(obj.xfld, obj.yfld);
};
this.objectCollisionDetection = function () {
var zCollision = false;
var xCollision = false;
var row = int(Math.abs(this.zPos) / this.cellW);
var col = int(this.xPos / this.cellW);
var row2 = int((Math.abs(this.zPos) + this.ballWidth) / this.cellW);
var col2 = int((this.xPos + this.ballWidth) / this.cellW);
var aTiles = _global.gGame.returnTiles(row, col, row2, col2);
var collide = false;
var outside = false;
var lev = _global.gGame.aLevel;
var wallDecay = this.aWallDecay[this.ballType - 1];
if (((((aTiles[0] == -1) || (gAllTiles[aTiles[0]].ttype == T_SOLID)) && ((aTiles[1] == -1) || (gAllTiles[aTiles[1]].ttype == T_SOLID))) && ((aTiles[2] == -1) || (gAllTiles[aTiles[2]].ttype == T_SOLID))) && ((aTiles[3] == -1) || (gAllTiles[aTiles[3]].ttype == T_SOLID))) {
outside = true;
var currow = int((Math.abs(this.zPos) + this.ballRad) / this.cellW);
var curcol = int((Math.abs(this.xPos) + this.ballRad) / this.cellW);
if ((currow < this.lastRow) && (curcol < this.lastCol)) {
this.xPos = (this.lastCol * this.cellW) + 1;
this.zPos = -((this.lastRow * this.cellW) + 1);
var tile = lev[this.lastRow - 1][this.lastCol].tile;
if (gAllTiles[tile].ttype != T_SOLID) {
this.xVelocity = this.xVelocity * (-wallDecay);
} else {
this.zVelocity = this.zVelocity * (-wallDecay);
}
} else if ((currow < this.lastRow) && (curcol > this.lastCol)) {
this.xPos = ((this.lastCol + 1) * this.cellW) - (this.ballWidth + 1);
this.zPos = -((this.lastRow * this.cellW) + 1);
var tile = lev[this.lastRow - 1][this.lastCol].tile;
if (gAllTiles[tile].ttype != T_SOLID) {
this.xVelocity = this.xVelocity * (-wallDecay);
} else {
this.zVelocity = this.zVelocity * (-wallDecay);
}
} else if ((currow > this.lastRow) && (curcol > this.lastCol)) {
this.xPos = ((this.lastCol + 1) * this.cellW) - (this.ballWidth + 1);
this.zPos = -(((this.lastRow + 1) * this.cellW) - (this.ballWidth + 1));
var tile = lev[this.lastRow + 1][this.lastCol].tile;
if (gAllTiles[tile].ttype != T_SOLID) {
this.xVelocity = this.xVelocity * (-wallDecay);
} else {
this.zVelocity = this.zVelocity * (-wallDecay);
}
} else if ((currow > this.lastRow) && (curcol < this.lastCol)) {
this.xPos = (this.lastCol * this.cellW) + 1;
this.zPos = -(((this.lastRow + 1) * this.cellW) - (this.ballWidth + 1));
var tile = lev[this.lastRow + 1][this.lastCol].tile;
if (gAllTiles[tile].ttype != T_SOLID) {
this.xVelocity = this.xVelocity * (-wallDecay);
} else {
this.zVelocity = this.zVelocity * (-wallDecay);
}
} else if (curcol < this.lastCol) {
this.xPos = (this.lastCol * this.cellW) + 1;
this.xVelocity = this.xVelocity * (-wallDecay);
} else if (curcol > this.lastCol) {
this.xPos = ((this.lastCol + 1) * this.cellW) - (this.ballWidth + 1);
this.xVelocity = this.xVelocity * (-wallDecay);
} else if (currow < this.lastRow) {
this.zPos = -((this.lastRow * this.cellW) + 1);
this.zVelocity = this.zVelocity * (-wallDecay);
} else if (currow > this.lastRow) {
this.zPos = -(((this.lastRow + 1) * this.cellW) - (this.ballWidth + 1));
this.zVelocity = this.zVelocity * (-wallDecay);
}
}
if (!outside) {
if ((((aTiles[0] == -1) || (gAllTiles[aTiles[0]].ttype == T_SOLID)) && ((aTiles[1] == -1) || (gAllTiles[aTiles[1]].ttype == T_SOLID))) && ((aTiles[3] == -1) || (gAllTiles[aTiles[3]].ttype == T_SOLID))) {
outside = true;
this.xPos = (col2 * this.cellW) + 1;
this.xVelocity = this.xVelocity * (-wallDecay);
this.zPos = -((row2 * this.cellW) + 1);
this.zVelocity = this.zVelocity * (-wallDecay);
} else if ((((aTiles[0] == -1) || (gAllTiles[aTiles[0]].ttype == T_SOLID)) && ((aTiles[1] == -1) || (gAllTiles[aTiles[1]].ttype == T_SOLID))) && ((aTiles[2] == -1) || (gAllTiles[aTiles[2]].ttype == T_SOLID))) {
outside = true;
this.xPos = ((col + 1) * this.cellW) - (this.ballWidth + 1);
this.xVelocity = this.xVelocity * (-wallDecay);
this.zPos = -((row2 * this.cellW) + 1);
this.zVelocity = this.zVelocity * (-wallDecay);
} else if ((((aTiles[1] == -1) || (gAllTiles[aTiles[1]].ttype == T_SOLID)) && ((aTiles[2] == -1) || (gAllTiles[aTiles[2]].ttype == T_SOLID))) && ((aTiles[3] == -1) || (gAllTiles[aTiles[3]].ttype == T_SOLID))) {
outside = true;
this.xPos = ((col + 1) * this.cellW) - (this.ballWidth + 1);
this.xVelocity = this.xVelocity * (-wallDecay);
this.zPos = -(((row + 1) * this.cellW) - (this.ballWidth + 1));
this.zVelocity = this.zVelocity * (-wallDecay);
} else if ((((aTiles[0] == -1) || (gAllTiles[aTiles[0]].ttype == T_SOLID)) && ((aTiles[2] == -1) || (gAllTiles[aTiles[2]].ttype == T_SOLID))) && ((aTiles[3] == -1) || (gAllTiles[aTiles[3]].ttype == T_SOLID))) {
outside = true;
this.xPos = (col2 * this.cellW) + 1;
this.xVelocity = this.xVelocity * (-wallDecay);
this.zPos = -(((row + 1) * this.cellW) - (this.ballWidth + 1));
this.zVelocity = this.zVelocity * (-wallDecay);
}
}
if (!outside) {
if (((aTiles[0] == -1) || (gAllTiles[aTiles[0]].ttype == T_SOLID)) && ((aTiles[3] == -1) || (gAllTiles[aTiles[3]].ttype == T_SOLID))) {
outside = true;
if ((col < this.lastTopCol) && (currow > this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col + 1) * this.cellW) + 1;
} else if ((col < this.lastTopCol) && (currow == this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col + 1) * this.cellW) + 1;
} else if ((col < this.lastTopCol) && (currow < this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col + 1) * this.cellW) + 1;
} else if ((col == this.lastTopCol) && (currow > this.lasttRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -((row * this.cellW) - (this.ballWidth + 1));
} else if ((col == this.lastTopCol) && (currow < this.lastRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -(((row + 1) * this.cellW) + 1);
} else if ((col > this.lastTopCol) && (currow > this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col * this.cellW) - (this.ballWidth + 1);
} else if ((col > this.lastTopCol) && (currow == this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col * this.cellW) - (this.ballWidth + 1);
} else if ((col > this.lastTopCol) && (currow < this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col * this.cellW) - (this.ballWidth + 1);
}
} else if (((aTiles[1] == -1) || (gAllTiles[aTiles[1]].ttype == T_SOLID)) && ((aTiles[2] == -1) || (gAllTiles[aTiles[2]].ttype == T_SOLID))) {
outside = true;
if ((col2 < this.lastBotCol) && (currow > this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col2 + 1) * this.cellW) + 1;
} else if ((col2 < this.lastBotCol) && (currow == this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col2 + 1) * this.cellW) + 1;
} else if ((col2 < this.lastBotCol) && (currow < this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col2 + 1) * this.cellW) + 1;
} else if ((col2 == this.lastBotCol) && (currow > this.lasttRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -((row * this.cellW) - (this.ballWidth + 1));
} else if ((col2 == this.lastBotCol) && (currow < this.lastRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -(((row + 1) * this.cellW) + 1);
} else if ((col2 > this.lastBotCol) && (currow > this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col2 * this.cellW) - (this.ballWidth + 1);
} else if ((col2 > this.lastBotCol) && (currow == this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col2 * this.cellW) - (this.ballWidth + 1);
} else if ((col2 > this.lastBotCol) && (currow < this.lastRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col2 * this.cellW) - (this.ballWidth + 1);
}
} else if (((aTiles[0] == -1) || (gAllTiles[aTiles[0]].ttype == T_SOLID)) && ((aTiles[1] == -1) || (gAllTiles[aTiles[1]].ttype == T_SOLID))) {
outside = true;
if ((col < this.lastTopCol) && (row > this.lastTopRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col + 1) * this.cellW) + 1;
} else if ((col < this.lastTopCol) && (row == this.lastTopRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col + 1) * this.cellW) + 1;
} else if ((col < this.lastTopCol) && (row < this.lastTopRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -(((row + 1) * this.cellW) + 1);
} else if ((col == this.lastTopCol) && (row > this.lastTopRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -((row * this.cellW) - (this.ballWidth + 1));
} else if ((col == this.lastTopCol) && (row < this.lastTopRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -(((row + 1) * this.cellW) + 1);
} else if ((col > this.lastTopCol) && (row > this.lastTopRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col * this.cellW) - (this.ballWidth + 1);
} else if ((col > this.lastTopCol) && (row == this.lastTopRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col * this.cellW) - (this.ballWidth + 1);
} else if ((col > this.lastTopCol) && (row < this.lastTopRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -(((row + 1) * this.cellW) + 1);
}
} else if (((aTiles[2] == -1) || (gAllTiles[aTiles[2]].ttype == T_SOLID)) && ((aTiles[3] == -1) || (gAllTiles[aTiles[3]].ttype == T_SOLID))) {
outside = true;
if ((col < this.lastTopCol) && (row2 > this.lastBotRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -((row2 * this.cellW) - (this.ballWidth + 1));
} else if ((col < this.lastTopCol) && (row2 == this.lastBotRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col + 1) * this.cellW) + 1;
} else if ((col < this.lastTopCol) && (row2 < this.lastBotRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col + 1) * this.cellW) + 1;
} else if ((col == this.lastTopCol) && (row2 > this.lastBotRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -((row2 * this.cellW) - (this.ballWidth + 1));
} else if ((col == this.lastTopCol) && (row2 < this.lastBotRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -(((row2 + 1) * this.cellW) + 1);
} else if ((col > this.lastTopCol) && (row2 > this.lastBotRow)) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -((row2 * this.cellW) - (this.ballWidth + 1));
} else if ((col > this.lastTopCol) && (row2 == this.lastBotRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col * this.cellW) - (this.ballWidth + 1);
} else if ((col > this.lastTopCol) && (row2 < this.lastBotRow)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col * this.cellW) - (this.ballWidth + 1);
}
}
}
if (!outside) {
if ((aTiles[0] == -1) || (gAllTiles[aTiles[0]].ttype == T_SOLID)) {
outside = true;
if ((row != this.lastTopRow) && (col != this.lastTopCol)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.zVelocity = this.zVelocity * (-wallDecay);
this.xPos = ((col + 1) * this.cellW) + 1;
this.zPos = -(((row + 1) * this.cellW) + 1);
} else if (col != this.lastTopCol) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col + 1) * this.cellW) + 1;
} else if (row != this.lastTopRow) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -(((row + 1) * this.cellW) + 1);
}
} else if ((aTiles[1] == -1) || (gAllTiles[aTiles[1]].ttype == T_SOLID)) {
outside = true;
if ((row != this.lastTopRow) && (col2 != this.lastBotCol)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.zVelocity = this.zVelocity * (-wallDecay);
this.xPos = (col2 * this.cellW) - (this.ballWidth + 1);
this.zPos = -(((row + 1) * this.cellW) + 1);
} else if (col2 != this.lastBotCol) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col2 * this.cellW) - (this.ballWidth + 1);
} else if (row != this.lastTopRow) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -(((row + 1) * this.cellW) + 1);
}
} else if ((aTiles[2] == -1) || (gAllTiles[aTiles[2]].ttype == T_SOLID)) {
outside = true;
if ((row2 != this.lastBotRow) && (col2 != this.lastBotCol)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.zVelocity = this.zVelocity * (-wallDecay);
this.xPos = (col2 * this.cellW) - (this.ballWidth + 1);
this.zPos = -((row2 * this.cellW) - (this.ballWidth + 1));
} else if (col2 != this.lastBotCol) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = (col2 * this.cellW) - (this.ballWidth + 1);
} else if (row2 != this.lastBotRow) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -((row2 * this.cellW) - (this.ballWidth + 1));
}
} else if ((aTiles[3] == -1) || (gAllTiles[aTiles[3]].ttype == T_SOLID)) {
outside = true;
if ((row2 != this.lastBotRow) && (col != this.lastTopCol)) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.zVelocity = this.zVelocity * (-wallDecay);
this.xPos = ((col + 1) * this.cellW) + 1;
this.zPos = -((row2 * this.cellW) - (this.ballWidth + 1));
} else if (col != this.lastTopCol) {
this.xVelocity = this.xVelocity * (-wallDecay);
this.xPos = ((col + 1) * this.cellW) + 1;
} else if (row2 != this.lastBotRow) {
this.zVelocity = this.zVelocity * (-wallDecay);
this.zPos = -((row2 * this.cellW) - (this.ballWidth + 1));
}
}
}
row = int((Math.abs(this.zPos) + this.ballRad) / this.cellW);
col = int((this.xPos + this.ballRad) / this.cellW);
var tile = _global.gGame.aLevel[row][col].tile;
var objtile = gAllTiles[tile];
var diff = 0;
var perc = 0;
var height = 0;
this.hill = false;
if (objtile.ttype == T_WATER) {
this.zVelocity = this.zVelocity * this.waterDecay;
this.xVelocity = this.xVelocity * this.waterDecay;
} else if (objtile.ttype == T_SAND) {
this.zVelocity = this.zVelocity * this.sandDecay;
this.xVelocity = this.xVelocity * this.sandDecay;
} else if (objtile.ttype == T_HILL) {
height = -objtile.corner1;
} else if (objtile.ttype == T_BELT1) {
this.xVelocity = this.xVelocity * 0.5;
this.zVelocity = this.zVelocity + -2.5;
} else if (objtile.ttype == T_BELT2) {
this.zVelocity = this.zVelocity * 0.5;
this.xVelocity = this.xVelocity + 2.5;
} else if (objtile.ttype == T_BELT3) {
this.zVelocity = this.zVelocity * 0.5;
this.xVelocity = this.xVelocity + -2.5;
} else if (objtile.ttype == T_BELT4) {
this.xVelocity = this.xVelocity * 0.5;
this.zVelocity = this.zVelocity + 2.5;
} else if (objtile.ttype == T_FAN1) {
this.xVelocity = this.xVelocity + -1.5;
this.zVelocity = this.zVelocity + -1.5;
} else if (objtile.ttype == T_FAN2) {
this.xVelocity = this.xVelocity + 1.5;
this.zVelocity = this.zVelocity + 1.5;
} else if (objtile.ttype == T_STEEP) {
if (objtile.incline == 1) {
if (this.zVelocity > this.backdrop) {
this.zVelocity = this.zVelocity * this.hillDecay;
} else if (this.zVelocity <= (-this.backdrop)) {
this.zVelocity = this.zVelocity * this.gravity;
} else {
this.zVelocity = -this.kickback;
}
diff = objtile.corner1 - objtile.corner4;
perc = 100 - ((((Math.abs(this.zPos) + this.ballRad) - (row * this.cellW)) * 100) / this.cellW);
} else if (objtile.incline == 3) {
if (this.zVelocity <= (-this.backdrop)) {
this.zVelocity = this.zVelocity * this.hillDecay;
} else if (this.zVelocity > this.backdrop) {
this.zVelocity = this.zVelocity * this.gravity;
} else {
this.zVelocity = this.kickback;
}
diff = objtile.corner4 - objtile.corner1;
perc = (((Math.abs(this.zPos) + this.ballRad) - (row * this.cellW)) * 100) / this.cellW;
} else if (objtile.incline == 2) {
if (this.xVelocity > this.backdrop) {
this.xVelocity = this.xVelocity * this.hillDecay;
} else if (this.xVelocity <= (-this.backdrop)) {
this.xVelocity = this.xVelocity * this.gravity;
} else {
this.xVelocity = -this.kickback;
}
diff = objtile.corner2 - objtile.corner1;
perc = (((Math.abs(this.xPos) + this.ballRad) - (col * this.cellW)) * 100) / this.cellW;
} else if (objtile.incline == 4) {
if (this.xVelocity <= (-this.backdrop)) {
this.xVelocity = this.xVelocity * this.hillDecay;
} else if (this.xVelocity > this.backdrop) {
this.xVelocity = this.xVelocity * this.gravity;
} else {
this.xVelocity = this.kickback;
}
diff = objtile.corner1 - objtile.corner2;
perc = 100 - ((((Math.abs(this.xPos) + this.ballRad) - (col * this.cellW)) * 100) / this.cellW);
}
height = -((diff / 100) * perc);
this.hill = true;
}
this.yPos = height;
};
this.setNewDepth = function () {
var row = int(((Math.abs(this.zPos) + this.ballRad) + 2) / this.cellW);
var col = int(((this.xPos + this.ballRad) + 2) / this.cellW);
var d = (((row * 300) + (col * 5)) + 4);
this.ballMC.swapDepths(d);
};
};
_global.gGameClass = function () {
this.edit = _global.edit;
this.markerPos = [0, 0];
this.ST_GAME = 1;
this.ST_BALLROLLS = 2;
this.ST_GAMEOVER = 3;
this.ST_CREATELEVEL = 4;
this.ST_CLEANUP = 5;
this.ST_NEXTLEVEL = 6;
this.ST_PREVLEVEL = 7;
this.ST_RESTART = 8;
this.ST_SCROLLSCREEN = 9;
this.ST_BALLINHOLE = 10;
this.ST_BALLINHOLE2 = 11;
this.ST_SHOWSCORE = 12;
this.rnr = 10 + random(100);
this.game_state = 999;
this.next_game_state = 999;
this.save_game_state = 999;
this.maxz = 30;
this.maxx = 30;
this.tileW = 60;
this.worldW = this.maxx * this.tileW;
this.worldL = (-this.maxz) * this.tileW;
this.maxTiles = gAllTiles.length;
this.objLevel = new levelClass();
this.objLevel.init(this.maxz, this.maxx, false);
this.curLevel = 0;
this.aLevel = [];
this.aObjects = [];
this.aExtras = [];
this.mcF = _root.playField;
this.aPars = [2, 2, 2, 3, 4, 3, 4, 3, 5];
this.aStrokes = [];
this.aScores = [];
this.targetX = 0;
this.targetY = 0;
this.scrollX = 0;
this.scrollY = 0;
this.scrollSound = false;
this.aBalltypes = ["peanut butter puff", "chocolate puff", "concrete ball"];
this.ballType = _global.ballSelect;
this.ball = new ballClass();
this.ball.init(this.mcF.theBall, this.tileW, this.ballType);
this.aMCs = [];
this.iso = new isometricAS(this.maxx, this.maxz);
this.player = _global.playerSelect;
this.bird = new birdClass();
this.birdTimer = 0;
this.init = function () {
_global.gMyNeoStatus.sendTag("Game Started");
_root.logoShown();
_root.GAMESCORE = new Evar(0, "GAMESCORE", "THE OVERALL SCORE");
_root.STROKES = new Evar(0, "STROKES", "THE STROKES");
this.mcF.theBall.gotoAndStop(this.ballType);
_root.scoreboard.mugshots.gotoAndStop(this.player);
this.mcF.theLine.swapDepths(7000);
this.mcF.theLine._visible = false;
this.mcF.theBall._visible = false;
this.game_state = this.ST_NEXTLEVEL;
};
this.quitGame = function () {
if (this.game_state == this.ST_BALLROLLS) {
return(-1);
}
var clip = _root.attachMovie("quitscreen", "quitscreen", 9000);
this.aMCs.push(clip);
_root.quitscreen._x = 143;
_root.quitscreen._y = 113;
this.save_game_state = this.game_state;
this.game_state = 999;
};
this.continueGame = function () {
_root.quitscreen.removeMovieClip();
this.game_state = this.save_game_state;
};
this.endGame = function () {
_global.gMyNeoStatus.sendTag("Game Finished");
_root.showtext = "Cleaning up the course - Please wait";
this.game_state = this.ST_CLEANUP;
this.next_game_state = this.ST_GAMEOVER;
};
this.createWorld = function () {
this.aMCs = [];
if (this.edit == 1) {
var clip = this.mcF.attachMovie("marker", "marker", 9999);
this.aMCs.push(clip);
var temp = this.iso.mapToScreen(0, 0, 0);
clip._x = temp[0];
clip._y = temp[1];
}
var row = 0;
while (row < this.maxz) {
var col = 0;
while (col < this.maxx) {
if (this.aLevel[row][col].tile != -1) {
this.createGridCell(this.aLevel[row][col]);
}
col++;
}
row++;
}
};
this.createGridCell = function (objCell) {
var depth = ((objCell.gridZ * 300) + (objCell.gridX * 5));
var name = ((("cell" + objCell.gridZ) + "_") + objCell.gridX);
var clip = this.mcF.attachMovie("theTiles", name, depth);
this.aMCs.push(clip);
var temp = this.iso.mapToScreen(objCell.gridX * this.tileW, height, (-objCell.gridZ) * this.tileW);
clip._x = temp[0];
clip._y = temp[1];
clip.gotoAndStop(objCell.tile);
};
this.setObjects = function () {
var o = {};
this.ball.resetObjects();
var i = 0;
while (i < this.aObjects.length) {
o = this.aObjects[i];
if (o.objType == OBJ_FIELD_) {
this.mcF._x = o.xpos;
this.mcF._y = o.zpos;
} else if (o.objType == OBJ_BALL_) {
this.ball.setPosition(o.zpos, o.ypos, o.xpos);
} else if (o.objType == OBJ_HOLE_) {
if ((o.objHole.htype == H_END) || (o.objHole.htype == H_WMILL)) {
this.ball.setEndHole(o.zpos, o.ypos, o.xpos, o.objHole.htype);
} else if (o.objHole.htype == H_PORT) {
this.ball.setPortHole(o);
}
}
i++;
}
};
this.setExtras = function () {
var o = {};
var clip = undefined;
var temp = undefined;
var depth = 0;
var i = 0;
while (i < this.aExtras.length) {
o = this.aExtras[i];
depth = ((Math.abs(o.zpos) * 300) + (o.xpos * 5)) + 2;
clip = this.mcF.attachMovie(o.mcname, o.mcname, depth);
this.aMCs.push(clip);
temp = this.iso.mapToScreen(o.xpos * this.tileW, 0, o.zpos * this.tileW);
clip._x = temp[0];
clip._y = temp[1];
i++;
}
};
this.returnTiles = function (row, col, row2, col2) {
var aTiles = [-1, -1, -1, -1];
if ((row >= 0) && (col >= 0)) {
aTiles[0] = this.aLevel[row][col].tile;
}
if ((row >= 0) && (col2 < this.maxx)) {
aTiles[1] = this.aLevel[row][col2].tile;
}
if ((row2 < this.maxz) && (col2 < this.maxx)) {
aTiles[2] = this.aLevel[row2][col2].tile;
}
if ((row2 < this.maxz) && (col >= 0)) {
aTiles[3] = this.aLevel[row2][col].tile;
}
return(aTiles);
};
this.mainLoop = function () {
t = getTimer();
if (t < this.timer) {
return(-1);
}
this.timer = t + 0;
if ((this.birdTimer > 0) && (this.birdTimer < t)) {
this.birdTimer = 0;
this.bird.start();
}
if (this.bird.moving) {
this.bird.move();
}
switch (this.game_state) {
case this.ST_GAME :
this.setHitVars();
return;
case this.ST_BALLROLLS :
if (this.ball.move()) {
this.mcF.theLine._visible = false;
this.rewardPoints();
_root.playSound(2);
this.game_state = this.ST_BALLINHOLE;
this.next_game_state = this.ST_CLEANUP;
} else if (!this.ball.moving) {
if (_root.STROKES.show() >= 10) {
this.timer = t + 500;
this.rewardPoints();
_root.showtext = "You reached the maximum number of 10 strokes for a hole";
this.game_state = this.ST_CLEANUP;
this.next_game_state = this.ST_SHOWSCORE;
} else {
this.game_state = this.ST_GAME;
this.mcF.theLine._visible = true;
}
}
return;
case this.ST_BALLINHOLE :
this.timer = t + 500;
this.scrollSound = false;
this.ball.showIt(false);
this.game_state = this.next_game_state;
if (this.next_game_state == this.ST_CLEANUP) {
this.next_game_state = this.ST_SHOWSCORE;
}
return;
case this.ST_BALLINHOLE2 :
_root.playSound(6);
this.ball.showIt(true);
this.game_state = this.ST_BALLROLLS;
return;
case this.ST_SHOWSCORE :
if (this.bird.moving) {
this.bird.stopIt();
}
_root.playSound(1);
this.showParBoard();
this.game_state = 999;
return;
case this.ST_NEXTLEVEL :
if (this.bird.moving) {
this.bird.stopIt();
}
if (this.curLevel >= this.objLevel.maxLevels) {
this.game_state = this.ST_GAMEOVER;
} else {
_root.showtext = ("Loading hole " + (this.curLevel + 1)) + " - Please wait";
this.nextLevel();
this.game_state = this.ST_CREATELEVEL;
}
return;
case this.ST_CREATELEVEL :
this.aLevel = this.objLevel.returnEmptyLevel();
var aTemp = this.objLevel.returnLevel(this.curLevel);
var i = 0;
while (i < aTemp[0].length) {
var cell = aTemp[0][i];
this.aLevel[cell.gridZ][cell.gridX] = cell;
i++;
}
this.aObjects = aTemp[1];
this.aExtras = aTemp[2];
this.createWorld();
this.setObjects();
this.setExtras();
if (random(5) == 2) {
this.birdTimer = t + 10000;
} else {
this.birdTimer = 0;
}
this.ball.showIt(true);
this.mcF.theLine._visible = true;
this.game_state = this.ST_GAME;
return;
case this.ST_SCROLLSCREEN :
if (this.bird.moving) {
this.bird.stopIt();
}
if (!this.scrollSound) {
this.scrollSound = true;
_root.playSound(3);
}
if (this.scrollIt()) {
this.game_state = this.ST_BALLINHOLE;
this.next_game_state = this.ST_BALLINHOLE2;
}
return;
case this.ST_CLEANUP :
if (this.bird.moving) {
this.bird.stopIt();
}
this.ball.showIt(false);
this.cleanUp();
if (this.next_game_state == this.ST_GAMEOVER) {
this.timer = getTimer() + 1000;
}
this.game_state = this.next_game_state;
return;
case this.ST_GAMEOVER :
this.game_state = 999;
_root.gotoAndStop("gameoverframe");
return;
case 999 :
if (!this.bird.moving) {
break;
}
this.bird.stopIt();
}
};
this.scrollScreen = function (x, y) {
_root.playSound(2);
var stepX = (Math.abs(x - this.mcF._x) / 7);
var stepY = (Math.abs(y - this.mcF._y) / 7);
this.targetX = x;
this.targetY = y;
if (x > this.mcF._x) {
this.scrollX = stepX;
} else {
this.scrollX = -stepX;
}
if (y > this.mcF._y) {
this.scrollY = stepY;
} else {
this.scrollY = -stepY;
}
this.game_state = this.ST_BALLINHOLE;
this.next_game_state = this.ST_SCROLLSCREEN;
};
this.scrollIt = function () {
var bDone = false;
this.mcF._x = this.mcF._x + this.scrollX;
this.mcF._y = this.mcF._y + this.scrollY;
if ((this.scrollX > 0) && (this.mcF._x >= this.targetX)) {
this.mcF._x = this.targetX;
this.scrollX = 0;
} else if ((this.scrollX < 0) && (this.mcF._x <= this.targetX)) {
this.mcF._x = this.targetX;
this.scrollX = 0;
}
if ((this.scrollY > 0) && (this.mcF._y >= this.targetY)) {
this.mcF._y = this.targetY;
this.scrollY = 0;
} else if ((this.scrollY < 0) && (this.mcF._y <= this.targetY)) {
this.mcF._y = this.targetY;
this.scrollY = 0;
}
if ((this.scrollX == 0) && (this.scrollY == 0)) {
bDone = true;
}
return(bDone);
};
this.setHitVars = function () {
var aPower = [0.85, 1, 1.15, 1.5];
var world2D = this.iso.mapToIsoWorld(this.mcF._xmouse, this.mcF._ymouse);
var mxpos = world2D[0];
var mzpos = Math.abs(world2D[1]);
world2D = this.iso.mapToIsoWorld(this.mcF.theBall._x, this.mcF.theBall._y);
var bxpos = world2D[0];
var bzpos = Math.abs(world2D[1]);
var xdiff = (mxpos - bxpos);
var ydiff = (mzpos - bzpos);
var angle = Math.atan2(ydiff, xdiff);
var power = ((Math.abs(this.mcF._xmouse - this.mcF.theBall._x) + Math.abs(this.mcF._ymouse - this.mcF.theBall._y)) / 3);
if (power > 22) {
power = 22;
} else if (power < 2) {
power = 2;
}
var power2 = (power * aPower[this.player - 1]);
if (power2 > 30) {
power2 = 30;
}
this.ball.xVelocity = -(power2 * Math.cos(angle));
this.ball.zVelocity = power2 * Math.sin(angle);
xdiff = this.mcF._xmouse - this.mcF.theBall._x;
ydiff = this.mcF._ymouse - this.mcF.theBall._y;
angle = Math.atan2(ydiff, xdiff);
this.mcF.theLine._xscale = power * 10;
this.mcF.theLine._yscale = power * 10;
this.mcF.theLine._x = this.mcF.theBall._x;
this.mcF.theLine._y = this.mcF.theBall._y;
angle = (angle * 180) / Math.PI;
this.mcF.theLine._rotation = angle - 90;
_root.showtext = "Click the mouse to shoot the " + this.aBalltypes[this.ballType - 1];
};
this.nextLevel = function () {
this.curLevel = ((this.curLevel < this.objLevel.maxLevels) ? (this.curLevel + 1) : 1);
_global.gMyNeoStatus.sendTag("Reached Level " + this.curLevel);
_root.showhole = String(this.curLevel);
_root.showpar = this.aPars[this.curLevel - 1];
_root.STROKES.changeTo(0);
_root.showstrokes = "0";
};
this.prevLevel = function () {
this.curLevel = ((this.curLevel > 0) ? (this.curLevel - 1) : (this.objLevel.maxLevels));
};
this.keyIsDown = function () {
if (this.game_state != this.ST_GAME) {
return(-1);
}
if (Key.isDown(32)) {
if (this.edit == 1) {
this.outputLevel();
}
} else if (Key.isDown(90)) {
if (this.edit == 1) {
this.game_state = this.ST_CLEANUP;
this.next_game_state = this.ST_NEXTLEVEL;
}
} else if (Key.isDown(65)) {
if (this.edit == 1) {
this.ball.setXSpeed(-1);
}
} else if (Key.isDown(83)) {
if (this.edit == 1) {
this.ball.setXSpeed(1);
}
} else if (Key.isDown(68)) {
if (this.edit == 1) {
this.ball.setYSpeed(1);
}
} else if (Key.isDown(70)) {
if (this.edit == 1) {
this.ball.setYSpeed(-1);
}
} else if (Key.isDown(37)) {
if (this.edit == 1) {
this.mcF._x = this.mcF._x + 10;
}
trace((("world pos x: " + this.mcF._x) + ", y: ") + this.mcF._y);
} else if (Key.isDown(38)) {
if (this.edit == 1) {
this.mcF._y = this.mcF._y + 10;
}
trace((("world pos x: " + this.mcF._x) + ", y: ") + this.mcF._y);
}
if (Key.isDown(39)) {
if (this.edit == 1) {
this.mcF._x = this.mcF._x - 10;
}
trace((("world pos x: " + this.mcF._x) + ", y: ") + this.mcF._y);
}
if (Key.isDown(40)) {
if (this.edit == 1) {
this.mcF._y = this.mcF._y - 10;
}
trace((("world pos x: " + this.mcF._x) + ", y: ") + this.mcF._y);
} else if (Key.isDown(110)) {
if (this.edit == 1) {
var z = this.markerPos[0];
var x = this.markerPos[1];
var name = ((("cell" + z) + "_") + x);
var clip = this.mcF[name];
if (clip != undefined) {
var mc = 0;
while (mc < this.aMCs.length) {
if (this.aMCs[mc] == clip) {
this.aMCs.splice(mc, 1);
break;
}
mc++;
}
clip.removeMovieClip();
this.aLevel[z][x].gridZ = -1;
this.aLevel[z][x].gridX = -1;
this.aLevel[z][x].tile = -1;
}
}
}
};
this.mouseClick = function () {
if (this.game_state != this.ST_GAME) {
return(-1);
}
if (this.edit == 0) {
if (this.game_state == this.ST_GAME) {
_root.playSound(4);
_root.STROKES.changeBy(1);
_root.showstrokes = _root.STROKES.show();
_root.showtext = ("Wait for the " + this.aBalltypes[this.ballType - 1]) + " to stop";
this.mcF.theLine._visible = false;
this.game_state = this.ST_BALLROLLS;
}
} else {
var world2D = this.iso.mapToIsoWorld(this.mcF._xmouse, this.mcF._ymouse);
var x = (Math.ceil(world2D[0] / this.tileW) - 1);
var z = Math.abs(Math.ceil(world2D[1] / this.tileW));
var name = ((("cell" + z) + "_") + x);
var clip = this.mcF[name];
var bSetMarker = false;
if (clip != undefined) {
if ((this.markerPos[0] == z) && (this.markerPos[1] == x)) {
var f = clip._currentframe;
f = ((f < this.maxTiles) ? (f + 1) : 1);
clip.gotoAndStop(f);
this.aLevel[z][x].tile = f;
} else {
bSetMarker = true;
}
} else {
bSetMarker = true;
var objCell = new cellClass(z, x, 1);
this.aLevel[z][x] = objCell;
this.createGridCell(objCell);
}
if (bSetMarker) {
this.markerPos = [z, x];
trace((((((("marker is at row_" + z) + ", col_") + x) + ", zpos: ") + (-(z * this.tileW))) + ", xpos: ") + (x * this.tileW));
var temp = this.iso.mapToScreen(x * this.tileW, 0, (-z) * this.tileW);
this.mcF.marker._x = temp[0];
this.mcF.marker._y = temp[1];
}
}
};
this.rewardPoints = function () {
par = this.aPars[this.curLevel - 1];
s = _root.STROKES.show();
p = 0;
if (s == 1) {
p = p + 50;
} else if (s < par) {
p = p + ((par - s) * 20);
} else if (s == par) {
p = p + 15;
} else if (s > par) {
p = p + 5;
}
this.setPoints(p);
this.aStrokes.push(s * this.rnr);
this.aScores.push(p);
var cTxt = "";
var txtAdd = (" on hole " + this.curLevel);
if (s == 1) {
cTxt = "Hole in one" + txtAdd;
} else {
var st = (par - s);
switch (st) {
case -2 :
cTxt = "Double Bogey" + txtAdd;
break;
case -1 :
cTxt = "Bogey" + txtAdd;
break;
case 0 :
cTxt = "Par" + txtAdd;
break;
case 1 :
cTxt = "Birdie" + txtAdd;
break;
case 2 :
cTxt = "Eagle" + txtAdd;
break;
default :
cTxt = "You need more practice";
}
}
_root.showtext = cTxt;
};
this.setPoints = function (pAdd) {
_root.showscore = pAdd;
_root.GAMESCORE.changeby(_root.showScore);
if (_root.GAMESCORE.show() > (this.objLevel.maxLevels * 50)) {
_root.GAMESCORE.changeto(this.objLevel.maxLevels * 50);
}
_root.showmainscore = _root.GAMESCORE.show();
};
this.cleanUp = function () {
this.mcF.theLine._visible = false;
var mc = 0;
while (mc < this.aMCs.length) {
this.aMCs[mc].removeMovieClip();
mc++;
}
};
this.outputLevel = function () {
var c;
var str = "";
var count = 0;
var row = 0;
while (row < this.maxz) {
var col = 0;
while (col < this.maxx) {
c = this.aLevel[row][col];
if (c.tile != -1) {
count++;
str = str + (((((("[" + c.gridZ) + ",") + c.gridX) + ",") + c.tile) + "],");
}
col++;
}
row++;
}
trace(("[" + str) + "]");
};
this.showParBoard = function () {
var clip = _root.attachMovie("parboard", "parboardscreen", 6000);
_root.parboardscreen._x = 70;
_root.parboardscreen._y = 25;
this.aMCs.push(clip);
var par_total = 0;
var str_total = 0;
var score_total = 0;
var i = 1;
while (i <= this.objLevel.maxLevels) {
par_total = par_total + this.aPars[i - 1];
_root.parboardscreen.card.fields["par_" + i].text = this.aPars[i - 1];
i++;
}
i = 1;
while (i <= this.aStrokes.length) {
str_total = str_total + (this.aStrokes[i - 1] / this.rnr);
_root.parboardscreen.card.fields["str_" + i].text = this.aStrokes[i - 1] / this.rnr;
i++;
}
i = 1;
while (i <= this.aScores.length) {
score_total = score_total + this.aScores[i - 1];
_root.parboardscreen.card.fields["score_" + i].text = this.aScores[i - 1];
i++;
}
_root.parboardscreen.card.fields.par_total.text = par_total;
_root.parboardscreen.card.fields.str_total.text = str_total;
_root.parboardscreen.card.fields.score_total.text = score_total;
};
this.removeParboardScreen = function () {
_root.parboardscreen.removeMovieClip();
this.game_state = this.ST_NEXTLEVEL;
};
this.sendChallengeCard = function () {
var clip = _root.attachMovie("challenge", "challenge", 7000);
this.aMCs.push(clip);
_root.challenge._x = 196;
_root.challenge._y = 56;
};
this.removeChallengeScreen = function () {
_root.challenge.removeMovieClip();
};
};
stop();
_root.showtext = "";
_root.showpar = "0";
_root.showhole = "1";
_root.showstrokes = "0";
_root.showmainscore = "0";
_root.helptext = "";
_global.gGame = new gGameClass();
_global.gGame.init();
Instance of Symbol 380 MovieClip in Frame 14
onClipEvent (enterFrame) {
_global.gGame.mainLoop();
}
onClipEvent (keyDown) {
_global.gGame.keyIsDown();
}
Frame 24
stop();
_root.logoShown();
Frame 25
prevFrame();
Frame 26
stop();
gMyScoringSystem.setScore(_root.GAMESCORE.show());
gMyScoringSystem.submitScore();
Frame 27
_root.gotoAndPlay("resetallframe");
Symbol 84 MovieClip [theTiles] Frame 1
stop();
Symbol 84 MovieClip [theTiles] Frame 55
stop();
Symbol 152 Button
on (press) {
_root.playSound(5);
_root.showtext = "";
_parent.gotoAndPlay(10);
}
Symbol 154 MovieClip [parboard] Frame 10
stop();
Symbol 154 MovieClip [parboard] Frame 20
_global.gGame.removeParboardScreen();
Symbol 189 MovieClip Frame 1
stop();
Symbol 189 MovieClip Frame 2
stop();
Symbol 192 MovieClip Frame 1
stop();
Symbol 196 Button
on (press) {
_root.playSound(4);
_global.gGame.removeChallengeScreen();
}
Symbol 200 Button
on (release, keyPress "<Enter>") {
_root.playSound(4);
var errorMsg = [];
if (this.senderName == undefined) {
errorMsg.push("Your Name");
}
if (this.senderEmail == undefined) {
errorMsg.push("Your Email");
}
if (this.friendName == undefined) {
errorMsg.push("Friend's Name");
}
if (this.friendEmail == undefined) {
errorMsg.push("Friend's Email");
}
if (errorMsg.length > 0) {
var max = errorMsg.length;
var message = "You forgot the following information:\n ";
var x = 0;
while (x < max) {
message = message + errorMsg[x];
if (x < (max - 1)) {
message = message + ", ";
}
x++;
}
this.errorMessage.play();
this.errorMessage.bg.gotoAndStop("error");
this.errorMessage.tText = ("<P ALIGN='CENTER'>Error. " + message) + "</P>";
return(undefined);
}
if (this.dataListener != undefined) {
this.dataListener.removeMovieClip();
}
this.createEmptyMovieClip("dataListener", 9999);
this.dataListener.onData = function () {
trace("this.success: " + this.success);
var message = "";
if (this.success != 1) {
message = this.error_str;
var messageBox = this._parent.errorMessage;
messageBox.play();
messageBox.bg.gotoAndStop("error");
messageBox.tText = ("<P ALIGN='CENTER'>Error. " + message) + "</P>";
return(undefined);
}
var messageBox = this._parent.errorMessage;
messageBox.play();
messageBox.tText = "<P ALIGN='CENTER'>Challenge Card Sent</P>";
messageBox.bg.gotoAndStop("success");
this._parent.senderName = "";
this._parent.senderEmail = "";
this._parent.friendEmail = "";
this._parent.friendName = "";
};
var x_senderName = this.senderName;
var x_senderEmail = this.senderEmail;
var x_score = _root.eScore.show();
var x_recipient = this.friendName;
var x_email = this.friendEmail;
var x_pictureID = 627;
var x_extra_text = (((("I got to hole " + _global.gGame.curLevel) + " and got ") + _root.GAMESCORE.show()) + " points in Reese's Puffs Mini-Golf. See what you can do!");
var theurl = ((((((((((("http://www.neopets.com/process_sendgreeting.phtml?flash=1&sender_email=" + x_senderEmail) + "&recipient_name=") + x_recipient) + "+&recipient_email=") + x_email) + "&sender_name=") + x_senderName) + "&extra_text=") + x_extra_text) + "&picture_id=") + x_pictureID);
trace("URL = " + theurl);
loadVariables (theurl, this.dataListener, "POST");
}
Symbol 221 Button
on (release) {
_root.playSound(4);
_global.gGame.continueGame();
}
Symbol 225 Button
on (release) {
_root.playSound(4);
_global.gGame.endGame();
}
Symbol 246 MovieClip [liveinclude] Frame 1
this.loadBios = function () {
this.url = "http://images.neopets.com/games/utilities/flash_bios/bios.swf";
System.security.allowDomain("neopets.com");
this.bios.loadMovie(this.url);
};
this._visible = 0;
this.stop();
this._parent.stop();
this.loadBios();
Symbol 263 MovieClip Frame 1
stop();
Symbol 263 MovieClip Frame 5
stop();
Symbol 281 Button
on (release) {
_root.playSound(1);
_root.help_tween.gotoAndPlay(11);
}
Symbol 283 MovieClip Frame 1
stop();
Symbol 283 MovieClip Frame 2
play();
Symbol 283 MovieClip Frame 10
stop();
Symbol 283 MovieClip Frame 11
play();
Symbol 283 MovieClip Frame 19
gotoAndStop (1);
Symbol 291 Button
on (release) {
if (_root.help_tween._currentframe == 1) {
_root.playSound(1);
_root.help_tween.gotoAndPlay(2);
}
}
Symbol 295 Button
on (release) {
_root.playSound(4);
_global.edit = 0;
_root.gotoAndPlay("selectplayerframe");
}
Symbol 299 Button
on (release) {
_root.playSound(4);
_root.visitWebsite();
}
Symbol 304 Button
on (release) {
_root.playSound(4);
_root.showTrailer();
}
Symbol 305 Button
on (release) {
_global.edit = 1;
_root.gotoAndPlay("selectplayerframe");
}
Symbol 310 Button
on (release) {
_root.playSound(4);
_root.gotoAndPlay("introframe");
}
Symbol 321 MovieClip Frame 1
stop();
Symbol 331 MovieClip Frame 1
stop();
Symbol 334 MovieClip Frame 1
stop();
Symbol 335 Button
on (release) {
_root.playSound(4);
_root.gotoAndPlay("selectplayerframe");
}
Symbol 342 MovieClip Frame 1
stop();
Symbol 343 MovieClip Frame 1
stop();
Symbol 347 MovieClip Frame 1
stop();
Symbol 359 MovieClip Frame 1
stop();
Symbol 370 Button
on (release) {
_root.playSound(4);
_global.gGame.quitGame();
}
Symbol 375 MovieClip Frame 1
stop();
Symbol 378 Button
on (press) {
_global.gGame.mouseClick();
}
Symbol 384 Button
on (release) {
_root.playSound(4);
_global.gGame.cleanUp();
_root.gotoAndPlay("resetallframe");
}
Symbol 390 MovieClip Frame 1
this._visible = 0;
Symbol 391 Button
on (release) {
_global.edit = 1;
_root.gotoAndPlay("gameframe");
}