Frame 1
myURL = _url;
okDomain = "www.miniclip.com";
fscommand ("allowscale", false);
fscommand ("showmenu", false);
Stage.showMenu = false;
_quality = "HIGH";
_global.section = 0;
_global.soundOn = true;
_global.movieHeight = 400;
_global.movieWidth = 500;
_global.surface = "FAIRWAY";
_global.holeNum = 0;
_global.score = 0;
_global.USACard = 0;
_global.EURCard = 0;
_global.pName = "harry";
_global.page = "start";
_global.soundAffect = true;
sndFlip = 1;
myListener = new Object();
myListener.onKeyUp = function () {
var _local1 = _global;
if (Key.getCode() == 72) {
if (((_local1.section == 3) || (_local1.section == 6)) || (_local1.section == 16)) {
playFX("click");
sectionstart(15);
} else if (_local1.section == 15) {
playFX("click");
sectionstart(16);
}
} else if (Key.getCode() == 83) {
if ((((_local1.section == 3) || (_local1.section == 5)) || (_local1.section == 16)) || (_local1.section == 15)) {
sndFlip = ((sndFlip == 1) ? 2 : 1);
soundState(sndFlip);
}
}
};
Key.addListener(myListener);
aEScore = [0, -1, 69, 1, 0, -1, 69, 0, 1, 0, 69, -2, -1, 0, 0, 69, 1, 69];
aUScore = [0, -1, 0, 0, 0, 0, -1, 0, 0, 1, 0, -1, -1, 0, -1, 0, 1, 0];
var s = 0.01;
var d = 0.007;
var a = ((aSlopeType = [[0, 0], [0, -s], [d, -d], [s, 0], [d, d], [0, s], [-d, d], [-s, 0], [-d, -d]]));
delete s;
delete d;
course = {};
course.hole0 = {windDir:15, windStrength:3, holeNum:3, par:4, shotNum:2, clubStart:"iron9", surface:"SAND", startX:73.7, startY:-522.4};
course.hole0.xdiff = 240;
course.hole0.ydiff = 160;
course.hole0.aSlopes = [];
course.hole0.aSlopes.push([a[0], a[0], a[0], a[0], a[6], a[6], a[5]]);
course.hole0.aSlopes.push([a[0], a[8], a[7], a[0], a[6], a[5], a[4]]);
course.hole0.aSlopes.push([a[1], a[1], a[6], a[6], a[5], a[4], a[3]]);
course.hole0.aSlopes.push([a[2], a[2], a[3], a[4], a[4], a[0], a[0]]);
course.hole0.aSlopes.push([a[0], a[2], a[4], a[4], a[0], a[0], a[0]]);
course.hole0.content1 = "And ";
course.hole0.content2 = " has found a bunker. Will it be a chip to the green and a long putt or the more risky punch shot to get closer to the hole...";
course.hole1 = {windDir:190, windStrength:8, holeNum:7, par:4, shotNum:2, clubStart:"iron9", surface:"ROUGH", startX:-492.9, startY:-85.4};
course.hole1.xdiff = 0;
course.hole1.ydiff = 160;
course.hole1.aSlopes = [];
course.hole1.aSlopes.push([a[4], a[4], a[4], a[0], a[0], a[0]]);
course.hole1.aSlopes.push([a[4], a[4], a[5], a[5], a[0], a[0]]);
course.hole1.aSlopes.push([a[4], a[4], a[5], a[5], a[0], a[0]]);
course.hole1.aSlopes.push([a[4], a[5], a[5], a[6], a[6], a[0]]);
course.hole1.aSlopes.push([a[0], a[5], a[6], a[6], a[7], a[7]]);
course.hole1.aSlopes.push([a[0], a[6], a[6], a[7], a[7], a[8]]);
course.hole1.aSlopes.push([a[0], a[6], a[7], a[7], a[8], a[8]]);
course.hole1.aSlopes.push([a[0], a[0], a[6], a[7], a[0], a[0]]);
course.hole1.content1 = "deep in the rough, there are trees obstructing the direct route to the pin, how will ";
course.hole1.content2 = " salvage this one...";
course.hole2 = {windDir:245, windStrength:6, holeNum:11, par:3, shotNum:2, clubStart:"iron9", surface:"SAND", startX:-311.11, startY:31.4};
course.hole2.xdiff = 160;
course.hole2.ydiff = 160;
course.hole2.aSlopes = [];
course.hole2.aSlopes.push([a[0], a[0], a[6], a[5], a[6], a[0]]);
course.hole2.aSlopes.push([a[6], a[7], a[7], a[6], a[7], a[0]]);
course.hole2.aSlopes.push([a[7], a[8], a[8], a[8], a[8], a[0]]);
course.hole2.aSlopes.push([a[3], a[2], a[2], a[1], a[1], a[8]]);
course.hole2.aSlopes.push([a[2], a[1], a[1], a[8], a[8], a[0]]);
course.hole2.aSlopes.push([a[2], a[2], a[1], a[0], a[0], a[0]]);
course.hole2.content1 = "Oh dear, oh dear! ";
course.hole2.content2 = " has drifted wide and dropped it in one of the many gaping bunkers around the green...";
course.hole3 = {windDir:32, windStrength:4, holeNum:16, par:4, shotNum:2, clubStart:"iron9", surface:"FAIRWAY", startX:-477.1, startY:-179.4};
course.hole3.xdiff = -160;
course.hole3.ydiff = 320;
course.hole3.aSlopes = [];
course.hole3.aSlopes.push([a[1], a[8], a[7], a[6], a[5]]);
course.hole3.aSlopes.push([a[1], a[8], a[7], a[7], a[6]]);
course.hole3.aSlopes.push([a[8], a[7], a[7], a[6], a[6]]);
course.hole3.aSlopes.push([a[8], a[7], a[6], a[5], a[0]]);
course.hole3.content1 = "That was a close one! ";
course.hole3.content2 = " has avoided the water but has left a tricky next shot to the green...";
course.hole4 = {windDir:63, windStrength:7, holeNum:18, par:4, shotNum:2, clubStart:"iron9", surface:"ROUGH", startX:-441.1, startY:-350.8};
course.hole4.xdiff = 80;
course.hole4.ydiff = 0;
course.hole4.aSlopes = [];
course.hole4.aSlopes.push([a[1], a[2], a[2], a[3]]);
course.hole4.aSlopes.push([a[2], a[2], a[3], a[4]]);
course.hole4.aSlopes.push([a[2], a[3], a[4], a[5]]);
course.hole4.aSlopes.push([a[3], a[4], a[5], a[4]]);
course.hole4.aSlopes.push([a[2], a[3], a[4], a[4]]);
course.hole4.aSlopes.push([a[3], a[4], a[5], a[4]]);
course.hole4.aSlopes.push([a[2], a[3], a[4], a[5]]);
course.hole4.content1 = "It's the final hole, but the sight of the green is hampered by spectators, this next shot could make or break it for ";
course.hole4.content2 = " and Europe...";
caddy = {};
caddy.wedge = {strength:30, height:40, name:"S WEDGE", rolling:false};
caddy.putter = {strength:20, height:100, name:"PUTTER", rolling:true};
caddy.iron9 = {strength:15, height:30, name:"9 IRON", rolling:false};
caddy.chosen = caddy.wedge;
caddy.collection = [caddy.wedge, caddy.putter, caddy.iron9];
var selectClub = 0;
var spaceDown = true;
var rotAcc = 0;
var power = 0;
var viewRot = 5;
var windSrength = 0;
var windDir = 0;
var windDirDiff = 0;
var holeRes = "";
var selectDown = false;
var spaceDown = false;
var lastTreeHit = 69;
var kl = 37;
var kr = 39;
var ku = 38;
var kd = 40;
var kc = 17;
var ks = 32;
radian = (Math.PI/180);
mRd = math.round;
mRan = math.random;
mMx = math.max;
mMn = math.min;
mAb = math.abs;
mFl = math.floor;
if (myURL.indexOf(okDomain) != -1) {
_root.gotoAndPlay("load");
} else {
stop();
attachMovie("stolen", "stolen", 9999999);
}
var l = attachMovie("loader", "loader", 10);
Frame 2
pd = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
Frame 3
if (pd < 100) {
gotoAndPlay ("load");
} else {
gotoAndPlay ("draw");
}
Frame 5
function sendData(yName, yEmail, message, tName, tEmail) {
trace((((((((yName + " ") + yEmail) + " ") + message) + " ") + tName) + " ") + tEmail);
}
function sendDraw(yName, yEmail) {
trace((yName + " ") + yEmail);
}
stop();
function sectionStart(sectionNum) {
var _local1 = _global;
trace("section: " + sectionNum);
_local1.section = sectionNum;
switch (sectionNum) {
case 1 :
_local1.surface = course["hole" + _local1.holeNum].surface;
if (_local1.soundOn) {
bgSound.start(0, 1000);
}
var t = attachMovie("titleBar", "titleBar", 10000);
slideInPrep(t, "centre");
var t = attachMovie("openingText", "openingText", 9999);
t.stop();
slideInPrep(t, "centre");
populate();
return;
case 2 :
bgSound.stop();
slideOutPrep(titleBar);
slideOutPrep(openingText);
var t = attachMovie("nameBar", "nameBar", 10004);
slideInPrep(t, "centre");
return;
case 3 :
treeOverLap();
_quality = "HIGH";
slideOutPrep(messageBar);
sortLevels();
map.onenterframe = aimShot;
rotacc = 0;
return;
case 4 :
lastShotX = inMap.player._x;
lastShotY = inMap.player._y;
lastSurface = _local1.surface;
_quality = "MEDIUM";
if (caddy.chosen.name == "PUTTER") {
player.gotoandplay("putt");
} else if (power > 180) {
player.gotoandplay("smack");
} else {
player.gotoandplay("chip");
}
playerHoleDist = 200;
map.onenterframe = centrePlayer;
return;
case 5 :
if (_local1.surface == "SAND") {
var s = attachMovie("sandSpray", "sandSpray", 300);
s._x = player._x;
s._y = player._y;
}
renewTrees();
_quality = "MEDIUM";
if ((_local1.surface == "SAND") && (caddy.chosen.name == "9 IRON")) {
power = power / 1.2;
}
var cs = caddy.chosen.strength;
var ch = caddy.chosen.height;
var t = inMap.ballShadow;
var _local2 = 360 - (map.mapRot._rotation + 90);
bounced = false;
viewRot = 0;
viewAcc = 0.01;
rolling = caddy.chosen.rolling;
ball.yAcc = (-power) / ch;
t.xAcc = (power / cs) * Math.cos(radian * _local2);
t.yAcc = (power / cs) * Math.sin(radian * _local2);
windX = windStrength * Math.cos(radian * (_local2 + controlMech.windArrow.windArrowRot._rotation));
windY = windStrength * Math.sin(radian * (_local2 + controlMech.windArrow.windArrowRot._rotation));
if (sliceDir > 0) {
sliceX = mAb(sliceDir / 2) * Math.cos((radian * _local2) - 90);
sliceY = mAb(sliceDir / 2) * Math.sin((radian * _local2) - 90);
} else {
sliceX = mAb(sliceDir / 2) * Math.cos((radian * _local2) + 90);
sliceY = mAb(sliceDir / 2) * Math.sin((radian * _local2) + 90);
}
t.onenterframe = moveBall;
targ = t;
map.onenterframe = followBall;
return;
case 6 :
controlMech.swinger._rotation = 0;
controlMech.swinger.rot = 360;
controlMech.marker._rotation = 0;
controlMech.marker._visible = false;
swingState = 1;
delete controlMech.swinger.onenterframe;
return;
case 7 :
treeOverLap();
lastTreeHit = 69;
delete inMap.ballShadow.onenterframe;
player.gotoandstop(1);
inMap.player._x = inMap.ballShadow._x;
inMap.player._y = inMap.ballShadow._y;
controlMech.swinger._rotation = 0;
controlMech.swinger.rot = 360;
controlMech.marker._rotation = 0;
controlMech.marker._visible = false;
swingState = 1;
sortLevels();
checkGround(ball._x, ball._y);
autoClub();
var t = attachMovie("messageBar", "messageBar", 10002);
course["hole" + _local1.holeNum].shotNum++;
t.content.text = ((" PAR : " + course["hole" + _local1.holeNum].par) + " || SURFACE : ") + _local1.surface;
slideInPrep(t, "centre");
updateClub();
playerHoleDist = getDist();
targ = inMap.player;
targRot = 270 - (Math.atan2(inMap.hole._y - inMap.player._y, inMap.hole._x - inMap.player._x) / radian);
curRot = findNear(targRot);
map.onenterframe = shotLineUp;
return;
case 8 :
_quality = "HIGH";
aEScore[course["hole" + _local1.holeNum].holeNum - 1] = course["hole" + _local1.holeNum].shotNum - course["hole" + _local1.holeNum].par;
var t = attachMovie("scoreCard", "scoreCard", 10003);
updateCard(course["hole" + _local1.holeNum].holeNum + 1);
slideInPrep(t, "centre");
ball._visible = false;
inMap.hole.play();
delete inMap.ballShadow.onenterframe;
inMap.ballShadow._visible = false;
targ = inMap.Hole;
map.onenterframe = attract;
if (_local1.holeNum == 4) {
sectionStart(17);
}
return;
case 9 :
slideOutPrep(scoreCard);
if ((++_local1.holeNum) > 4) {
sectionStart(17);
}
mapAttach();
_local1.surface = course["hole" + _local1.holeNum].surface;
player.gotoandstop(1);
inMap.player._x = (inMap.ballShadow._x = course["hole" + _local1.holeNum].startX);
inMap.player._y = (inMap.ballShadow._y = course["hole" + _local1.holeNum].startY);
inMap.ballShadow._visible = true;
ball._visible = true;
flag._visible = true;
sectionstart(11);
return;
case 10 :
trace("page: " + _local1.page);
slideOutPrep(openingText);
var t = attachMovie("openingText", "openingText", 9999);
t.gotoandstop(_local1.page);
slideInPrep(t, "centre");
return;
case 11 :
playerHoleDist = getDist();
swingState = 1;
targ = inMap.player;
targRot = 270 - (Math.atan2(inMap.hole._y - inMap.player._y, inMap.hole._x - inMap.player._x) / radian);
curRot = findNear(targRot);
map.onenterframe = shotLineUp;
slideOutPrep(nameBar);
var t = attachMovie("comBar", "comBar", 10005);
t.content.text = (course["hole" + _local1.holeNum].content1 + _local1.pName) + course["hole" + _local1.holeNum].content2;
slideInPrep(t, "centre");
t.spCont._visible = false;
caddy.chosen = caddy[course["hole" + _local1.holeNum].clubStart];
var t = attachMovie("messageBar", "messageBar", 10002);
t.content.text = (("HOLE : " + course["hole" + _local1.holeNum].holeNum) + " || PAR : ") + course["hole" + _local1.holeNum].par;
slideInPrep(t, "centre");
var t = attachMovie("controlMech", "controlMech", 10001);
updateClub();
t.swinger._rotation = 0;
t.marker._rotation = 0;
t.swinger.rot = 360;
t.marker._visible = false;
slideInPrep(controlMech, "centre");
windDir = course["hole" + _local1.holeNum].windDir;
windStrength = course["hole" + _local1.holeNum].windStrength;
windDirDiff = map.mapRot._rotation - windDir;
t.windArrow.windArrowRot.cover._y = -((11 * windStrength) - 50);
return;
case 12 :
slideOutPrep(comBar);
return;
case 13 :
ball._visible = false;
delete inMap.ballShadow.onenterframe;
inMap.ballShadow._visible = false;
targ = inMap.splash;
map.onenterframe = attract;
return;
case 14 :
inMap.player._x = (inMap.ballShadow._x = lastShotX);
inMap.player._y = (inMap.ballShadow._y = lastShotY);
treeOverLap();
lastTreeHit = 69;
ball._visible = true;
pBallShadow.x = (pBallShadow.y = 0);
inMap.ballShadow.localToGlobal(pBallShadow);
ball._x = pBallShadow.x;
ball._y = pBallShadow.y;
inMap.ballShadow._visible = true;
player.gotoandstop(1);
controlMech.swinger._rotation = 0;
controlMech.swinger.rot = 360;
controlMech.marker._rotation = 0;
controlMech.marker._visible = false;
swingState = 1;
sortLevels();
checkGround(ball._x, ball._y);
autoClub();
var t = attachMovie("messageBar", "messageBar", 10002);
course["hole" + _local1.holeNum].shotNum++;
t.content.text = "SURFACE : " + _local1.surface;
slideInPrep(t, "centre");
updateClub();
playerHoleDist = getDist();
targ = inMap.player;
targRot = 270 - (Math.atan2(inMap.hole._y - inMap.player._y, inMap.hole._x - inMap.player._x) / radian);
curRot = findNear(targRot);
map.onenterframe = shotLineUp;
return;
case 15 :
var _local3 = attachMovie("gameHelp", "gameHelp", 10006);
slideInPrep(_local3, "centre");
_local3 = attachMovie("scoreCard", "scoreCard", 10003);
updateCard(course["hole" + _local1.holeNum].holeNum);
slideInPrep(_local3, "centre");
map.onenterframe = scoreCardUp;
return;
case 16 :
slideOutPrep(gameHelp);
slideOutPrep(scoreCard);
map.onenterframe = aimShot;
return;
case 17 :
slideOutPrep(controlMech);
_local3 = attachMovie("endCom", "endCom", 10007);
var t;
if ((eTot - uTot) > 0) {
player.gotoandplay("sad");
_local3.flag.gotoandstop(1);
switch (eTot - uTot) {
case 3 :
t = ("With the gap at 3 shots, Team USA pull off a commanding performance. " + _local1.pName) + " looks devastated...";
break;
case 2 :
t = "A close battle but Team USA win with 2 shots spare! Back to the drawing board for Team Europe..";
break;
case 1 :
t = ("Team USA edge it by the narrowest of margins! " + _local1.pName) + " can only wonder what could have been done on that final hole...";
break;
default :
t = "And team USA stroll to victory after a disappointing performance from Europe, looks like the pressure was just too much...";
}
} else {
player.gotoandplay("happy");
_local3.flag.gotoandstop(2);
switch (eTot - uTot) {
case -3 :
t = ("A STUNNING VICTORY FOR EUROPE!! " + _local1.pName) + " has played an incredible round of golf!";
break;
case -2 :
t = ("EUROPE WIN!! With 2 strokes spare " + _local1.pName) + " has pulled off some amazing shots to retain the trophy!";
break;
case -1 :
t = "AND EUROPE WIN THE CUP!! With only 1 shot between them, Team USA is beaten by the mighty skill of " + _local1.pName;
break;
default :
t = "EUROPE RETAIN THE RYDER CUP!! An impressive win over Team USA leaves the crowd applauding loudly!";
}
}
_local3.content.text = t;
slideInPrep(_local3, "centre");
return;
case 18 :
slideOutPrep(endCom);
slideOutPrep(scoreCard);
if (_local1.soundOn) {
bgSound.start(0, 1000);
}
var t = attachMovie("titleBar", "titleBar", 10000);
slideInPrep(t, "centre");
var t = attachMovie("openingText", "openingText", 9999);
t.gotoandstop("hiscoreIn");
slideInPrep(t, "centre");
reset();
mapAttach();
map.onenterframe = attract;
_local1.surface = course["hole" + _local1.holeNum].surface;
player.gotoandstop(1);
inMap.player._x = (inMap.ballShadow._x = course["hole" + _local1.holeNum].startX);
inMap.player._y = (inMap.ballShadow._y = course["hole" + _local1.holeNum].startY);
inMap.ballShadow._visible = true;
ball._visible = true;
flag._visible = true;
return;
case 19 :
slideOutPrep(openingText);
var t = attachMovie("openingText", "openingText", 9999);
t.gotoandstop(_local1.page);
slideInPrep(t, "mid");
}
}
function reset() {
var _local1 = _global;
course.hole0.shotNum = 2;
course.hole1.shotNum = 2;
course.hole2.shotNum = 2;
course.hole3.shotNum = 2;
course.hole4.shotNum = 2;
aEScore = [0, -1, 69, 1, 0, -1, 69, 0, 1, 0, 69, -2, -1, 0, 0, 69, 1, 69];
aUScore = [0, -1, 0, 0, 0, 0, -1, 0, 0, 1, 0, -1, -1, 0, -1, 0, 1, 0];
_local1.holeNum = 0;
_local1.score = 0;
_local1.USACard = 0;
_local1.EURCard = 0;
}
function populate() {
aLevs = new Array();
mapAttach();
targ = inMap.hole;
treeNum = 8;
pPlayer = {x:0, b:0};
pHole = {x:0, b:0};
pBallShadow = {x:0, b:0};
var _local1 = 0;
while (_local1 <= (treeNum - 1)) {
_root["pTree" + _local1] = {x:0, b:0};
var g = attachMovie("tree", "tree" + _local1, 502 + _local1);
aLevs.push(g);
_local1++;
}
var g = attachMovie("guy", "player", 500);
aLevs.push(g);
var g = attachMovie("flag", "flag", 501);
g._xscale = (g._yscale = 70);
aLevs.push(g);
var g = attachMovie("ball", "ball", 2001);
g._x = player._x;
g._y = player._y;
aLevs.push(g);
map.onenterframe = attract;
}
function mapAttach() {
var _local2 = _root;
var _local3 = attachMovie("map" + _global.holeNum, "map", 100);
_local3._yscale = 32;
_local3._x = 250;
_local3._y = 200;
inMap = map.mapRot.mapPos;
inMap.slopes._alpha = 0;
aMapObs = [[inmap.sand, 0.05, 0.6, "SAND", "land_sand"], [inmap.rough, 0.2, 0.9, "ROUGH", "land_ground"], [inmap.green, 0.4, 0.99, "GREEN", "land_ground"], [inmap.water, 0.69, 0.69, "WATER", "water_splash"]];
_local3 = inMap.attachMovie("ballShadow", "ballShadow", 2000);
_local3._x = inMap.player._x;
_local3._y = inMap.player._y;
if (_global.holeNum != 4) {
var _local1 = 0;
while (_local1 <= 4) {
_local2["tree" + _local1].gotoandstop(1);
_local1++;
}
} else {
var _local1 = 0;
while (_local1 <= 4) {
_local2["tree" + _local1].gotoandstop(_local1 + 2);
_local1++;
}
}
}
function autoClub() {
switch (_global.surface) {
case "SAND" :
caddy.chosen = caddy.wedge;
flag._visible = true;
return;
case "ROUGH" :
if (((getDist() * 2) - 400) < 100) {
caddy.chosen = caddy.wedge;
flag._visible = true;
} else {
caddy.chosen = caddy.iron9;
flag._visible = true;
}
caddy.chosen = caddy.iron9;
flag._visible = true;
return;
case "GREEN" :
caddy.chosen = caddy.putter;
flag._visible = false;
return;
case "FAIRWAY" :
if (((getDist() * 2) - 400) < 100) {
caddy.chosen = caddy.putter;
flag._visible = false;
} else {
caddy.chosen = caddy.iron9;
flag._visible = true;
}
}
}
function updateCard(a) {
var _local2 = a;
eTot = 0;
uTot = 0;
var _local1 = 1;
while (_local1 <= 18) {
if (_local1 < _local2) {
eTot = eTot + aEScore[_local1 - 1];
uTot = uTot + aUScore[_local1 - 1];
if (_local1 == 18) {
if (eTot == uTot) {
aUScore[_local1 - 1] = 1;
uTot = uTot + 1;
}
}
scoreCard["e" + _local1].text = aEScore[_local1 - 1];
scoreCard["u" + _local1].text = aUScore[_local1 - 1];
} else {
scoreCard["e" + _local1].text = "--";
scoreCard["u" + _local1].text = "--";
}
_local1++;
}
scoreCard.eTot.text = eTot;
scoreCard.uTot.text = uTot;
}
function updateClub() {
var _local1 = controlMech;
_local1.content1.text = "SHOT " + course["hole" + _global.holeNum].shotNum;
_local1.content2.text = mRd(((getDist() * 2) - 400) / 3) + " YARDS";
_local1.content3.text = caddy.chosen.name;
switch (caddy.chosen.name) {
case "PUTTER" :
maxDist = 70;
break;
case "9 IRON" :
maxDist = 150;
break;
case "S WEDGE" :
maxDist = 80;
}
_local1.clubChoice.gotoandstop(caddy.chosen.name);
trace(caddy.chosen.name);
_local1.content4.text = maxDist;
}
function getDist() {
var _local1 = ((inMap.player._x - inMap.hole._x) * (inMap.player._x - inMap.hole._x)) + ((inMap.player._y - inMap.hole._y) * (inMap.player._y - inMap.hole._y));
var _local2 = (math.sqrt(_local1) * map._yscale) / 100;
return(400 - ((400 - _local2) / 2));
}
function soundPrep() {
createEmptyMovieClip("musicControl", 11);
createEmptyMovieClip("fxControl", 12);
curSound = new Sound(fxControl);
bgSound = new Sound(musicControl);
bgSound.attachSound("bgMusic");
bgSound.setVolume(85);
_global.soundOn = true;
}
function playFX(cur) {
if (_global.soundOn) {
curSound.attachSound(cur);
curSound.start();
}
}
function soundState(n) {
var _local1 = _global;
if (n == 2) {
if ((_local1.section == 1) || (_local1.section == 18)) {
bgSound.setVolume(0);
}
_local1.soundOn = false;
} else {
if ((_local1.section == 1) || (_local1.section == 18)) {
bgSound.setVolume(85);
}
_local1.soundOn = true;
}
}
function slideInPrep(targ, pos) {
var _local1 = targ;
var _local3 = _global;
if (_local1 == openingText) {
_quality = "MEDIUM";
}
if (pos == "centre") {
_local1._y = math.round((_local3.movieHeight - _local1._height) / 2);
} else if (pos == "top") {
_local1._y = 0;
} else if (pos == "mid") {
_local1._y = 63;
}
_local1.endX = math.round((_local3.movieWidth - _local1._width) / 2);
_local1.easeIn = 10;
_local1.easeMulti = 4;
_local1.acc = _local1.easeIn * _local1.easeMulti;
var _local2 = _local1.easeIn;
while (_local2 >= 1) {
_local1.endX = _local1.endX + _local2;
_local2--;
}
_local1._x = (math.round((_local3.movieWidth - _local1.endX) / _local1.acc) * _local1.acc) + _local1.endX;
_local1.onenterframe = slideIn;
}
function slideIn() {
var _local1 = this;
_local1._x = _local1._x - _local1.acc;
if (_local1._x == _local1.endX) {
_local1.acc = _local1.easeIn;
} else if (_local1._x < _local1.endX) {
_local1.acc--;
}
if (_local1.acc == 0) {
if (_local1 == openingText) {
_quality = "HIGH";
}
delete _local1.onenterframe;
}
}
function slideOutPrep(targ) {
var _local1 = targ;
if (_local1 == openingText) {
_quality = "MEDIUM";
}
_local1.acc = 0;
_local1.onenterframe = slideOut;
}
function slideOut() {
var _local1 = this;
_local1._x = _local1._x - _local1.acc;
_local1.acc = _local1.acc + 10;
if (_local1._x < (-_local1._width)) {
if (_local1 == openingText) {
}
_local1.removeMovieClip();
}
}
function attract() {
var _local1 = _global;
this.mapRot._rotation = this.mapRot._rotation + 0.5;
moveTarg();
posBits();
if (key.isDown(ks)) {
if ((_local1.section == 8) && (_local1.holeNum < 4)) {
playFX("click");
sectionStart(9);
} else if (_local1.section == 17) {
playFX("click");
sectionStart(18);
}
}
}
function shotLineUp() {
moveTarg();
rotHole();
posBot();
posBits();
sortLevels();
}
function centrePlayer() {
moveTarg();
posBot();
posBits();
}
function scoreCardUp() {
}
function aimShot() {
if (key.isDown(kl)) {
sortLevels();
rotacc = rotacc + 0.3;
} else if (key.isDown(kr)) {
sortLevels();
rotacc = rotacc - 0.3;
}
if (key.isDown(ku)) {
if (selectDown) {
if ((++selectClub) > (caddy.collection.length - 1)) {
selectClub = 0;
}
caddy.chosen = caddy.collection[selectClub];
updateClub();
}
selectdown = false;
} else if (key.isDown(kd)) {
if (selectDown) {
if ((--selectClub) < 0) {
selectClub = caddy.collection.length - 1;
}
caddy.chosen = caddy.collection[selectClub];
updateClub();
}
selectdown = false;
} else {
selectDown = true;
}
if (key.isDown(kc)) {
inMap.slopes._alpha = 25;
} else {
inMap.slopes._alpha = 0;
}
if (key.isDown(ks)) {
var _local1 = controlMech.swinger;
if ((swingState == 1) && (spaceDown)) {
_local1.acc = 5;
_local1.onenterframe = swing;
swingState = 2;
} else if ((swingState == 2) && (spaceDown)) {
controlMech.marker._rotation = _local1._rotation;
controlMech.marker._visible = true;
swingState = 3;
_local1.acc = -5;
power = _local1.rot - 360;
} else if ((swingState == 3) && (spaceDown)) {
if (((_local1.rot - 360) > -22.5) && ((_local1.rot - 360) < 22.5)) {
sliceDir = _local1.rot - 360;
delete controlMech.swinger.onenterframe;
sectionstart(4);
} else {
sectionStart(6);
}
}
spaceDown = false;
} else {
spaceDown = true;
}
map.mapRot._rotation = map.mapRot._rotation + rotacc;
rotacc = rotacc * 0.6;
posBits();
}
function moveBall() {
var _local1 = this;
map.mapRot._rotation = map.mapRot._rotation + 0.2;
pBallShadow.x = (pBallShadow.y = 0);
inMap.BallShadow.localToGlobal(pBallShadow);
_local1._x = _local1._x + _local1.xAcc;
_local1._y = _local1._y + _local1.yAcc;
ball._x = pBallShadow.x;
_local1.xAcc = _local1.xAcc + ((((map._y - ball._y) / 800) * windX) / 30);
_local1.yAcc = _local1.yAcc + ((((map._y - ball._y) / 800) * windY) / 30);
_local1.xAcc = _local1.xAcc + ((((map._y - ball._y) / 800) * sliceX) / 30);
_local1.Yacc = _local1.Yacc + ((((map._y - ball._y) / 800) * sliceY) / 30);
_local1.xAcc = _local1.xAcc * 0.99;
_local1.yAcc = _local1.yAcc * 0.99;
if (!rolling) {
ball._y = ball._y + ball.yAcc;
ball.yAcc = ball.yAcc + 0.2;
} else {
var _local2 = (_local1.yAcc * _local1.yAcc) + (_local1.xAcc * _local1.xAcc);
if ((_local2 > 0.5) || (_local2 < -0.5)) {
_local1.xAcc = _local1.xAcc + checkSlope(_local1._x, _local1._y, 0);
_local1.yAcc = _local1.yAcc + checkSlope(_local1._x, _local1._y, 1);
} else if ((_local2 < 0.01) && (_local2 > -0.01)) {
if (checkGround(pBallShadow.x, pBallShadow.y) != 0.69) {
sectionStart(7);
}
}
_local1.xAcc = _local1.xAcc * checkRoll(pBallShadow.x, pBallShadow.y);
_local1.yAcc = _local1.yAcc * checkRoll(pBallShadow.x, pBallShadow.y);
ball._y = pBallShadow.y;
}
if (_global.holeNum != 4) {
if (((pBallShadow.y - ball._y) > 30) && ((pBallShadow.y - ball._y) < 120)) {
checkTrees(_local1._x, _local1._y, _local1, 0, 7);
}
} else if ((pBallShadow.y - ball._y) < 30) {
checkTrees(_local1._x, _local1._y, _local1, 0, 4);
} else if (((pBallShadow.y - ball._y) > 30) && ((pBallShadow.y - ball._y) < 120)) {
checkTrees(_local1._x, _local1._y, _local1, 5, 7);
}
if ((ball._y > pBallShadow.y) && (ball.yAcc > 0)) {
bounced = true;
sortLevels();
ball._y = pBallShadow.y;
if ((ball.yAcc > -1) && (ball.yAcc < 1)) {
ball.yAcc = 0;
rolling = true;
} else {
ball.yAcc = ball.yAcc * (-checkGround(pBallShadow.x, pBallShadow.y));
}
_local1.yAcc = _local1.yAcc * checkRoll(pBallShadow.x, pBallShadow.y);
_local1.xAcc = _local1.xAcc * checkRoll(pBallShadow.x, pBallShadow.y);
}
}
function checkTrees(x, y, b, s, f) {
var _local2 = b;
var _local3 = y;
var _local1 = s;
while (_local1 <= f) {
if (_local1 != lastTreeHit) {
if ((x > (inMap["out" + _local1]._x - 25)) && (x < (inMap["out" + _local1]._x + 25))) {
if ((_local3 > (inMap["out" + _local1]._y - 25)) && (_local3 < (inMap["out" + _local1]._y + 25))) {
playFX("hit_tree");
player.gotoandplay("sad");
sortLevels();
_local2.xAcc = (mRan() * _local2.xAcc) - (_local2.xAcc / 2);
_local2.yAcc = (mRan() * _local2.yAcc) - (_local2.yAcc / 2);
ball.yAcc = (mRan() * ball.yAcc) - (ball.yAcc / 2);
_root["tree" + _local1].gotoandplay("knock");
lastTreeHit = _local1;
}
}
}
_local1++;
}
}
function treeOverLap() {
var _local2 = _root;
var _local1 = 0;
while (_local1 <= (treeNum - 1)) {
if (player.hitTest(_local2["tree" + _local1]) && (player._y < _local2["tree" + _local1]._y)) {
_local2["tree" + _local1]._alpha = 50;
}
_local1++;
}
}
function renewTrees() {
var _local2 = _root;
var _local1 = 0;
while (_local1 <= (treeNum - 1)) {
_local2["tree" + _local1]._alpha = 100;
_local1++;
}
}
function checkSlope(x, y, a) {
var _local1 = _global;
return(course["hole" + _local1.holeNum].aSlopes[mFl((x + course["hole" + _local1.holeNum].xdiff) / 80)][mFl((y + course["hole" + _local1.holeNum].ydiff) / 80)][a]);
}
function checkGround(x, y) {
var _local2 = _global;
var _local3 = y;
if (inMap.hole.hittest(x, _local3, true)) {
holeCheck();
}
var _local1 = 0;
while (_local1 <= (aMapObs.length - 1)) {
if (aMapObs[_local1][0].hittest(x, _local3, true)) {
_local2.surface = aMapObs[_local1][3];
if (aMapObs[_local1][3] == "WATER") {
playFX("water_splash");
player.gotoandplay("sad");
inMap.splash.play();
inMap.splash._x = inMap.ballShadow._x;
inMap.splash._y = inMap.ballShadow._y;
sectionStart(13);
}
if (!rolling) {
playFX(aMapObs[_local1][4]);
}
return(aMapObs[_local1][1]);
}
_local1++;
}
if (!rolling) {
playFX("land_ground");
}
_local2.surface = "FAIRWAY";
return(0.3);
}
function checkRoll(x, y) {
var _local2 = y;
var _local3 = x;
if (inMap.hole.hittest(_local3, _local2, true)) {
holeCheck();
}
var _local1 = 0;
while (_local1 <= (aMapObs.length - 1)) {
if (aMapObs[_local1][0].hittest(_local3, _local2, true)) {
return(aMapObs[_local1][2]);
}
_local1++;
}
return(0.97);
}
function holeCheck() {
var _local2 = (inMap.ballShadow.Xacc * inMap.ballShadow.Xacc) + (inMap.ballShadow.Yacc * inMap.ballShadow.Yacc);
var _local3 = math.sqrt(_local2);
if (_local3 < 3) {
playFX("potted");
playFX("applause");
player.gotoandplay("happy");
sectionstart(8);
} else {
playFX("aw");
player.gotoandplay("sad");
var _local1 = (mRan() * 0.4) - 0.2;
inMap.ballShadow.Xacc = inMap.ballShadow.Xacc * _local1;
inMap.ballShadow.Yacc = inMap.ballShadow.Yacc * (_local1 + 1);
}
}
function followBall() {
moveTarg();
posBits();
if (bounced) {
viewRot = viewRot + viewAcc;
if (viewRot > 0.5) {
viewAcc = 0;
viewRot = 0.5;
}
}
}
function swing() {
var _local1 = this;
if (_local1.rot > 640) {
_local1.acc = -5;
}
_local1.rot = _local1.rot + _local1.acc;
_local1._rotation = _local1.rot;
if (swingState == 3) {
_local1.acc = _local1.acc * 1.01;
}
if ((_local1.rot - 360) < -22.5) {
sectionStart(6);
}
}
function rotHole() {
curRot = curRot + ((targRot - curRot) / 7);
map.mapRot._rotation = curRot;
if ((curRot < (targRot + 0.01)) && (curRot > (targRot - 0.01))) {
comBar.spCont._visible = true;
if (_global.section != 11) {
sectionStart(3);
} else if (key.isDown(ks)) {
playFX("click");
sectionStart(12);
}
}
}
function findNear(b) {
a = map.mapRot._rotation;
if ((a - b) > 180) {
return(a - 360);
}
if ((a - b) < -180) {
return(a + 360);
}
return(a);
}
function posBot() {
map._y = map._y + ((playerHoleDist - map._y) / 10);
}
function moveTarg() {
var _local1 = ((-targ._x) - inMap._x) / 5;
var _local2 = ((-targ._y) - inMap._y) / 5;
if ((_local1 > 0.05) || (_local1 < -0.05)) {
inMap._x = inMap._x + _local1;
inMap._y = inMap._y + _local2;
}
}
function posBits() {
var _local3 = _root;
pPlayer.x = (pPlayer.y = 0);
inMap.player.localToGlobal(pPlayer);
player._x = pPlayer.x;
player._y = pPlayer.y;
pHole.x = (pHole.y = 0);
inMap.hole.localToGlobal(pHole);
flag._x = pHole.x;
flag._y = pHole.y;
var _local1 = 0;
while (_local1 <= (treeNum - 1)) {
var _local2 = _local3["pTree" + _local1];
_local2.x = (_local2.y = 0);
inMap["out" + _local1].localToGlobal(_local2);
_local3["tree" + _local1]._x = _local2.x;
_local3["tree" + _local1]._y = _local2.y;
_local1++;
}
if (_global.section != 5) {
pBallShadow.x = (pBallShadow.y = 0);
inMap.ballShadow.localToGlobal(pBallShadow);
ball._x = pBallShadow.x;
ball._y = pBallShadow.y;
}
controlMech.windArrow.windArrowRot._rotation = map.mapRot._rotation + windDirDiff;
}
function sortLevels() {
var _local1 = 0;
while (_local1 <= (aLevs.length - 1)) {
aLevs[_local1].swapdepths(mRd(aLevs[_local1]._y + 500));
_local1++;
}
}
function aim() {
if (key.isdown(key.right)) {
rot++;
} else if (key.isdown(key.left)) {
rot--;
}
if (key.isdown(key.up) && (acc < 35)) {
acc++;
} else if (key.isdown(key.down) && (acc > 0)) {
acc--;
}
map.mapBit._rotation = rot;
sky.tree._x = disp + (rot * 10);
if (sky.tree._x > 500) {
disp = disp - 500;
} else if (sky.tree._x < -50) {
disp = disp + 500;
}
map._yscale = acc;
point1.x = map.mapBit.hole._x;
point1.y = map.mapBit.hole._y;
point2.x = map.mapBit.player._x;
point2.y = map.mapBit.player._y;
map.mapBit.localToGlobal(point1);
map.mapBit.localToGlobal(point2);
flag._x = point1.x;
flag._y = point1.y;
guy._x = point2.x;
guy._y = point2.y;
sky._y = ((-map._yscale) * 5) + 220;
}
Symbol 6 Button
on (release) {
getURL ("mailto:hey@skivecreative.com");
}
Symbol 15 MovieClip [loader] Frame 1
stop();
var smoothPd = 0;
var acc = 0;
cover._x = 102;
this.onenterframe = function () {
if (smoothPd < _parent.pd) {
smoothPd = smoothPd + (acc++);
} else {
smoothPd = math.ceil(_parent.pd);
acc = 0;
}
cover._x = 107 + (3.12 * smoothPd);
loaderText.text = math.min(smoothPd, 100) + "%";
if (smoothPd == 100) {
delete this.onenterframe;
this.play();
}
};
Symbol 15 MovieClip [loader] Frame 16
_parent.soundPrep();
_root.sectionStart(1);
this.removeMovieClip();
Symbol 36 MovieClip Frame 1
stop();
Symbol 56 MovieClip Frame 1
stop();
Symbol 56 MovieClip Frame 80
_root.sectionStart(14);
Symbol 77 MovieClip Frame 1
Symbol 98 MovieClip Frame 1
soundIcon.gotoandstop(1);
sndFlip = 1;
soundBT.onRollOver = (soundBT.onDragOver = function () {
soundIcon.gotoandstop(3);
});
soundBT.onRollOut = (soundBT.onDragOut = function () {
soundIcon.gotoandstop(sndFlip);
});
soundBT.onRelease = function () {
sndFlip = ((sndFlip == 1) ? 2 : 1);
_parent.soundState(sndFlip);
soundIcon.gotoandstop(sndFlip);
};
Symbol 119 MovieClip [titleBar] Frame 1
playBT.onRelease = function () {
_parent.playFX("click");
_root.sectionStart(2);
};
instrBT.onRelease = function () {
_global.page = "instr";
_root.sectionStart(10);
_parent.playFX("click");
};
scoresBT.onRelease = function () {
_global.page = "hiscoreOut";
_root.sectionStart(10);
_parent.playFX("click");
};
Symbol 180 MovieClip [guy] Frame 1
stop();
Symbol 180 MovieClip [guy] Frame 15
_parent.playFX("big_swing");
Symbol 180 MovieClip [guy] Frame 19
_root.sectionStart(5);
Symbol 180 MovieClip [guy] Frame 29
stop();
Symbol 180 MovieClip [guy] Frame 44
_root.sectionStart(5);
_parent.playFX("putt_swing");
Symbol 180 MovieClip [guy] Frame 50
stop();
Symbol 180 MovieClip [guy] Frame 65
_parent.playFX("big_swing");
Symbol 180 MovieClip [guy] Frame 69
_root.sectionStart(5);
Symbol 180 MovieClip [guy] Frame 75
stop();
Symbol 180 MovieClip [guy] Frame 85
stop();
Symbol 180 MovieClip [guy] Frame 95
stop();
Symbol 198 MovieClip [tree] Frame 1
stop();
Symbol 224 MovieClip Frame 1
stop();
Symbol 225 MovieClip [controlMech] Frame 1
stop();
hBut.onRelease = function () {
var _local1 = _global;
if (((_local1.section == 16) || (_local1.section == 3)) || (_local1.section == 6)) {
_parent.playFX("click");
_root.sectionStart(15);
} else if (_local1.section == 15) {
_parent.playFX("click");
_root.sectionStart(16);
}
};
sBut.onRelease = function () {
var _local1 = _parent;
if ((_global.soundAffect = true)) {
_local1.sndFlip = ((_local1.sndFlip == 1) ? 2 : 1);
_local1.soundState(_local1.sndFlip);
}
};
Symbol 283 MovieClip Frame 1
this._visible = false;
Symbol 300 Button
on (release) {
gameURL = ("http://www.miniclip.com/" + gamename) + ".htm";
getURL (gameURL, "_blank");
}
Instance of Symbol 283 MovieClip "mcHighscores" in Symbol 306 MovieClip Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 306 MovieClip Frame 2
if ((_url.indexOf("miniclip.com") == -1) and (_url.indexOf("mclip.vo.llnwd.net") == -1)) {
gotoAndStop(_currentframe + 1);
} else {
var noCache = (getTimer() + random(100000));
mcTarget.loadMovie("http://www.miniclip.com/swfcontent/highscore.swf?" + noCache);
stop();
}
Symbol 306 MovieClip Frame 3
stop();
Instance of Symbol 306 MovieClip "comHighscores" in Symbol 307 MovieClip [openingText] Frame 3
//component parameters
onClipEvent (initialize) {
scoreLocation = "_root.etot";
gamename = "pressureshot";
saveScore = true;
scoreIsTime = false;
scoreReversed = true;
negativeScoreAllowed = true;
}
Instance of Symbol 306 MovieClip "comHighscores" in Symbol 307 MovieClip [openingText] Frame 4
//component parameters
onClipEvent (initialize) {
scoreLocation = "_root.etot";
gamename = "pressureshot";
saveScore = false;
scoreIsTime = false;
scoreReversed = true;
negativeScoreAllowed = true;
}
Symbol 318 MovieClip [nameBar] Frame 1
but.onRelease = function () {
_parent.playFX("click");
_global.pName = n;
_root.sectionStart(11);
};
Symbol 364 MovieClip Frame 1
stop();
Symbol 387 MovieClip Frame 1
dir = true;
Symbol 387 MovieClip Frame 20
dir = false;
Symbol 388 MovieClip [endCom] Frame 1
cup.stop();
cup.onenterframe = function () {
var _local1 = this;
if (_local1.dir) {
_local1.nextFrame();
} else {
_local1.prevFrame();
}
};
Symbol 404 MovieClip [soundHolder] Frame 1
stop();
Symbol 407 MovieClip [sandSpray] Frame 13
this.removeMovieClip();