Frame 1
nbDScores = 10;
nbScores = 20;
var userData = new Object();
userData.present = false;
var initDone = false;
this._quality = "high";
nbLevels = 5;
Instance of Symbol 13 MovieClip "bar" in Frame 1
onClipEvent (enterFrame) {
}
Instance of Symbol 20 MovieClip "backend" in Frame 1
onClipEvent (load) {
Settings_Filename = "backend.cfg";
GameId = 120503040810;
}
Instance of Symbol 35 MovieClip "errorHandler" in Frame 1
onClipEvent (load) {
function setTimer(eventDescription) {
trace("errorHandler.setTimer().. event:" + eventDescription);
counter = 0;
event = eventDescription;
}
function stopTimer() {
trace("errorHandler.stopTimer().. time used:" + counter);
counter = -99;
event = "none";
}
function showError(title, errMessage) {
errorPop._visible = true;
errorPop.titleTxt = title;
errorPop.messageTxt = errMessage;
}
counter = -99;
event = "none";
timeOutFrameCount = 100;
errorPop._visible = false;
errorPop._x = 220;
errorPop._y = 250;
}
onClipEvent (enterFrame) {
if (counter >= 0) {
counter++;
if (timeOutFrameCount < counter) {
showError("timed out", ("timed out waiting for '" + event) + "'");
event = "none";
counter = -99;
}
}
}
Frame 2
function splashInit() {
trace("-------------------------------");
trace("initDone = " + initDone);
trace("-------------------------------");
if (!initDone) {
initDone = true;
if (typeof(_level0.emptyListItem) == "undefined") {
_level0.emptyListItem = "noname";
trace("WARRRRNINNG.. language file not present or _level0.emptyListItem not defined!!!! baaaad dog.");
}
if ((typeof(_level0.username) == "undefined") || (_level0.username == "")) {
errorHandler.showError("validateUser", "Sending user to login page!");
getURL ("login.htm", "_top");
} else {
errorHandler.setTimer("initialize backend... loading config textfile");
backend.setListener(this);
}
} else {
errorHandler.setTimer("get Hiscores from TRIAD");
backend.getScores();
}
}
function backendIniDone() {
errorHandler.stopTimer();
}
function validateUserDone(result, errorMessage) {
if (result) {
trace("user is logged in");
userData.nickname = backend.data.col_nickname;
userData.firstname = backend.data.col_firstname;
userData.lastname = backend.data.col_lastname;
userData.birthday = backend.data.col_birthday;
userData.sex = backend.data.col_sex;
userData.address = backend.data.col_address;
userData.email = backend.data.col_email;
userData.url = backend.data.col_url;
userData.phone = backend.data.col_phone;
userData.zipcode = backend.data.col_zipcode;
userData.city = backend.data.col_city;
userData.state = backend.data.col_state;
userData.activated = backend.data.col_activated;
userData.present = true;
} else {
trace("not logged in");
errorHandler.showError("validateUser", errorMessage);
}
}
function submitScoreDone() {
errorHandler.stopTimer();
errorHandler.setTimer("get Hiscores from TRIAD");
backend.getScores();
}
function hiscoresRecieved(mc) {
trace("hiscoresRecieved().. data is in:" + mc);
errorHandler.stopTimer();
alltimeScores = "";
todayScores = "";
alltimeScores = new Array();
todayScores = new Array();
tmpAmount = Number(mc.num_scores);
trace("amount of highscores from DB= " + tmpAmount);
var i = 0;
while (i < tmpAmount) {
var tmpName = new Array();
tmpName = eval ("mc.all_col_nickname" + i);
tmpScore = eval ("mc.all_col_score" + i);
Name = ((0 < tmpName.length) ? (tmpName) : (_level0.emptyListItem));
Score = ((0 < tmpScore) ? (tmpScore) : "0");
alltimeScores[i] = new Object();
alltimeScores[i].score = Score;
alltimeScores[i].name = Name;
i++;
}
var i = 0;
while (i < tmpAmount) {
var tmpName = new Array();
tmpName = eval ("mc.today_col_nickname" + i);
tmpScore = eval ("mc.today_col_score" + i);
Name = ((0 < tmpName.length) ? (tmpName) : (_level0.emptyListItem));
Score = ((0 < tmpScore) ? (tmpScore) : "0");
todayScores[i] = new Object();
todayScores[i].score = Score;
todayScores[i].name = Name;
i++;
}
gotoAndPlay (9);
}
function onBackend(mode, arg1, arg2, arg3) {
trace("Mode: " + mode);
if (mode == "READY") {
backendIniDone();
errorHandler.setTimer("check if user is logged in");
backend.validateUser();
} else if (mode == "VALIDATEUSER") {
var result = arg1;
var errorMessage = arg2;
validateUserDone(result, errorMessage);
if (arg1) {
errorHandler.setTimer("get Hiscores from TRIAD");
backend.getScores();
}
} else if (mode == "GETSCORES") {
trace("Highscores recieved");
hiscoresRecieved(backend.data);
} else if (mode == "SENDMAIL") {
trace("sender.friend. " + sender.friend._x);
sender.friend.gotoAndStop("done");
errorHandler.stopTimer();
} else if (mode == "ISHISCORE") {
if (arg1) {
trace("From arcade highscore - ok");
gameoverlist.gotoAndStop("entername");
} else {
trace("From arcade highscore - nix");
gameoverlist.gotoAndStop("showscore");
}
} else if (mode == "SETSCORE") {
submitScoreDone();
} else if (mode == "SENDDATA") {
trace("Send data done succesful");
}
}
function onBackendError() {
sender.friend.gotoAndStop("servererror");
trace("onBackendError()... Error!");
}
var gotHigh = false;
var gotReply = false;
var highScoreLoaded = false;
splashInit();
Frame 3
BytesLoaded = _root.getBytesLoaded();
BytesTotal = _root.getBytesTotal();
if ((BytesLoaded >= BytesTotal) && (400 < BytesTotal)) {
gotoAndPlay (5);
} else {
bar._xscale = (BytesLoaded / BytesTotal) * 100;
}
Frame 4
gotoAndPlay (3);
Frame 5
var Randbgnum = (1 + Math.floor(Math.random() * 2.99));
loadMovie (("bg" + RandBgNum) + ".swf", "bg");
play();
Frame 6
BytesLoaded = bg.getBytesLoaded();
BytesTotal = bg.getBytesTotal();
if ((BytesLoaded >= BytesTotal) && (100 < BytesTotal)) {
gotoAndPlay (9);
} else {
bar._xscale = (BytesLoaded / BytesTotal) * 100;
}
Frame 7
gotoAndPlay (6);
Frame 9
this._quality = "high";
score = 0;
level = 1;
Health = 100;
Frame 18
HiScoreMC.gotoAndPlay("showit");
stop();
Instance of Symbol 90 MovieClip "HiScoreMC" in Frame 18
onClipEvent (load) {
function fillList() {
trace("::::: fill list :::: HISCORETYPE = " + HISCORETYPE);
row = new Array();
var t = 0;
while (t < 30) {
removeMovieClip("dataloader.row" + t);
t++;
}
posi = 2;
if (HISCORETYPE == "day") {
var scores = _level0.todayScores;
} else {
var scores = _level0.alltimeScores;
}
var t = 0;
while (t < scores.length) {
dataloader.attachMovie("textrow", "row" + t, t);
row[t] = eval ("dataloader.row" + t);
row[t].number = t + 1;
row[t].name = scores[t].name;
row[t].score = scores[t].score;
row[t]._y = posi;
row[t].um._visible = false;
posi = posi + 15;
t++;
}
dataloader.sc.ini();
}
HISCORETYPE = "day";
todayScores = new Array();
alltimeScores = new Array();
}
Frame 27
stop();
trace("selection is : " + Sel);
this.gotoAndPlay(Sel);
Frame 36
stop();
Instance of Symbol 76 MovieClip "sc" in Frame 44
onClipEvent (load) {
scrollclip = "howto";
scrollarea = "scrollarea1";
orientation = "vertical";
stepscrollunits = 1;
ifSmallClip = "transparent";
}
Frame 45
stop();
trace("selection is : " + Sel);
this.gotoAndPlay(Sel);
Frame 54
stop();
Frame 63
stop();
trace("selection is : " + Sel);
this.gotoAndPlay(Sel);
Frame 64
score = 0;
level = 1;
Health = 100;
Instance of Symbol 398 MovieClip in Frame 64
onClipEvent (enterFrame) {
if (GameState == "ON") {
solve();
}
}
Frame 65
stop();
Frame 70
this.play();
Instance of Symbol 413 MovieClip "gameoverlist" in Frame 70
onClipEvent (load) {
function init() {
SubmitScorePath = "http://www.titoonic.dk/scripts/spider_SetHighScore_url.asp";
GameID = "spider1";
UserScore = _parent.Score;
scoretxt = UserScore;
nbDScores = _parent.nbDscores;
nbScores = _parent.nbScores;
trace("hiscore initializing");
trace("userscore = " + UserScore);
CheckScore();
}
function PlayAgain() {
trace("hello from 'PlayAgain'");
_parent.gotoAndStop("game");
}
function requestData() {
}
function SubmitScore() {
var postvars = ("?GameID=" + GameID);
postvars = postvars + ("&submitname=" + Nametxt);
postvars = postvars + ("&submitscore=" + UserScore);
postvars = postvars + ("&submitUrl=" + UrlTxt);
trace("submitting to highscoreList");
trace("postvars = " + postvars);
type = "SUBMITSCORE";
loadVariables (SubmitScorePath + postvars, "");
}
function CheckScore() {
if ((_parent.HiScores[nbScores] < UserScore) || (_parent.DayHiScores[nbDScores] < UserScore)) {
trace("he made the highscore");
this.gotoAndStop("entername");
} else {
this.gotoAndStop("showscore");
}
}
function UseData() {
if (type == "SUBMITSCORE") {
trace("server responded to submit");
_parent.gotoAndStop("splash");
}
}
function ShowHighScore(Reloadit) {
trace("yahooooo in ShowHighScore");
_parent.gotoAndStop("splash");
}
init();
}
onClipEvent (data) {
UseData();
}
Frame 80
stop();
Instance of Symbol 413 MovieClip "gameoverlist" in Frame 80
onClipEvent (load) {
function submitButtonClicked() {
this.gotoAndStop("nobutton");
_parent.backend.setScore(UserScore);
}
if (typeof(_level0.userName) != "undefined") {
nameTxt = _level0.userData.nickname;
}
UserScore = _parent.score;
trace("userscore = " + UserScore);
if (0 < UserScore) {
_parent.backend.isHiscore(UserScore);
} else {
this.gotoAndStop("showscore");
}
}
Frame 89
gotoAndPlay (9);
Instance of Symbol 413 MovieClip "gameoverlist" in Frame 89
onClipEvent (load) {
function init() {
SubmitScorePath = "http://www.titoonic.dk/titoonia/asp/SetHighScore_url.asp";
GameID = "spider1";
UserScore = _parent.Score;
scoretxt = UserScore;
nbDScores = _parent.nbDscores;
nbScores = _parent.nbScores;
trace("hiscore initializing");
trace("userscore = " + UserScore);
CheckScore();
}
function PlayAgain() {
trace("hello from 'PlayAgain'");
_parent.gotoAndStop("game");
}
function requestData() {
}
function SubmitScore() {
var postvars = ("?GameID=" + GameID);
postvars = postvars + ("&submitname=" + Nametxt);
postvars = postvars + ("&submitscore=" + UserScore);
postvars = postvars + ("&submitUrl=" + UrlTxt);
trace("submitting to highscoreList");
trace("postvars = " + postvars);
type = "SUBMITSCORE";
loadVariables (SubmitScorePath + postvars, "");
}
function CheckScore() {
if ((_parent.HiScores[nbScores] < UserScore) || (_parent.DayHiScores[nbDScores] < UserScore)) {
trace("he made the highscore");
this.gotoAndStop("entername");
} else {
this.gotoAndStop("showscore");
}
}
function UseData() {
if (type == "SUBMITSCORE") {
trace("server responded to submit");
_parent.gotoAndStop("splash");
}
}
function ShowHighScore(Reloadit) {
trace("yahooooo in ShowHighScore");
_parent.gotoAndStop("splash");
}
init();
}
onClipEvent (data) {
UseData();
}
Symbol 7 MovieClip [smoke] Frame 1
_rotation = ((Math.random() - 0.5) * 36);
_yscale = (70 + (Math.random() * 76));
_xscale = (70 + (Math.random() * 76));
Symbol 7 MovieClip [smoke] Frame 40
stop();
Symbol 11 MovieClip [pointsMC] Frame 26
this._visible = false;
this.gotoAndStop(1);
Symbol 20 MovieClip Frame 1
function userExists(theName) {
trace("\t>>>\t userExists()");
callUrl(userExistsProc, "checkuser", "name=" + theName);
}
function userExistsProc(d) {
trace("\t>>>\t userExistsProc()");
if (d.result == "OK") {
backendListener.onBackend("USEREXISTS", true, d.verbose);
} else {
backendListener.onBackend("USEREXISTS", false, d.verbose);
}
}
function login(theName, thePassword) {
trace("\t>>>\t login()");
callUrl(loginProc, "login", (("name=" + theName) + "&password=") + thePassword);
}
function loginProc(d) {
trace("\t>>>\t loginProc()");
if (d.result == "OK") {
trace("User logged in. Verbose: " + d.verbose);
backendListener.onBackend("LOGIN", d.verbose);
} else {
trace("User not logged in. Verbose: " + d.verbose);
backendListener.onBackendError("LOGIN", d.result, d.verbose);
}
}
function logout() {
trace("\t>>>\t logout()");
callUrl(logoutProc, "logout", "");
}
function logoutProc(d) {
trace("\t>>>\t logoutProc()");
if (d.result == "OK") {
trace("User logged out. Verbose: " + d.verbose);
backendListener.onBackend("LOGOUT", d.verbose);
} else {
trace("Error logging out. Verbose: " + d.verbose);
backendListener.onBackendError("LOGOUT", d.result, d.verbose);
}
}
function register(theName, thePassword, thePasswordVerify, theEmail) {
trace("\t>>>\t register()");
callUrl(registerProc, "register", (((((("name=" + theName) + "&password=") + thePassword) + "&password_verify=") + thePasswordVerify) + "&email=") + theEmail);
}
function registerProc(d) {
trace("\t>>>\t registerProc()");
if (d.result == "OK") {
trace("User registered. Verbose: " + d.verbose);
backendListener.onBackend("REGISTER", true, d.verbose);
} else if (d.result == "VALIDATE") {
trace("Registered user. Must be validated.");
backendListener.onBackend("REGISTER", "VALIDATE", d.verbose);
} else {
trace((("Error registering user: " + d.error) + ". Verbose: ") + d.verbose);
backendListener.onBackendError("REGISTER", d.result, d.verbose);
}
}
function forceActivateUser(nick) {
trace("\t>>>\t forceActivateUser()");
trace("Activating " + nick);
callUrl(forceActivateUserProc, "forceactivateuser", "nickname=" + nick);
}
function forceActivateUserProc(d) {
trace("\t>>>\t forceActivateUserProc()");
if (d.result == "OK") {
trace("forceActivateUser callback: " + typeof(backendListener.onBackend));
backendListener.onBackend("FORCEACTIVATEUSER", d.verbose);
} else {
trace("forceActivateUser failed. Verbose: " + d.verbose);
backendListener.onBackendError("FORCEACTIVATEUSER", d.result, d.verbose);
}
}
function forgotPassword(theName, theEmail) {
trace("\t>>>\t forgotPassword()");
callUrl(forgotPasswordProc, "forgotpassword", (("name=" + theName) + "&email=") + theEmail);
}
function forgotPasswordProc(d) {
trace("\t>>>\t forgotPasswordProc()");
if (d.result == "OK") {
backendListener.onBackend("FORGOTPASSWORD", true, d.verbose);
} else {
backendListener.onBackendError("FORGOTPASSWORD", d.result, d.verbose);
}
}
function setUserInfo(info) {
trace("\t>>>\t setUserInfo()");
var args = "";
for (item in info) {
args = args + (((item + "=") + info[item]) + "&");
}
callUrl(setUserInfoProc, "setuserinfo", args);
}
function setUserInfoProc(d) {
trace("\t>>>\t setUserInfoProc()");
if (d.result == "OK") {
trace("Info saved. Verbose: " + d.verbose);
backendListener.onBackend("SETUSERINFO", d.verbose);
} else {
trace("Problem saving info. Verbose: " + d.verbose);
backendListener.onBackendError("SETUSERINFO", d.result, d.verbose);
}
}
function tipAFriend(theToName, theToEmail) {
trace("\t>>>\t tipAFriend()");
callUrl(tipAFriendProc, "tipafriend", (((("gameId=" + gameId) + "&to_name=") + theToName) + "&to_email=") + theToEmail);
}
function tipAFriendProc(d) {
trace("\t>>>\t tipAFriendProc()");
if (d.result == "OK") {
trace("Friend tipped: " + d.verbose);
backendListener.onBackend("TIPAFRIEND", d.verbose);
} else {
trace("Problem tipping friend. Verbose: " + d.verbose);
backendListener.onBackendError("TIPAFRIEND", d.result, d.verbose);
}
}
function getData(theString) {
trace("\t>>>\t isHiscore()");
callUrl(getDataProc, "getgamedata", (("tsql=" + theString) + "&gameId=") + gameId);
}
function getDataProc(d) {
trace("\t>>>\t getDataProc()");
if (d.result == "OK") {
backendListener.onBackend("GETDATA", d.id, d.verbose);
} else {
backendListener.onBackendError("GETDATA", d.result, d.verbose);
}
}
function sendData(theString) {
trace("\t>>>\t isHiscore()");
callUrlPOST(sendDataProc, "setgamedata", (theString + "&gameId=") + gameId);
}
function sendDataProc(d) {
trace("\t>>>\t sendDataProc()");
if (d.result == "OK") {
backendListener.onBackend("SENDDATA", d.id, d.verbose);
} else {
backendListener.onBackendError("SENDDATA", d.result, d.verbose);
}
}
function setRelay(theData, srcId, srcName, srcEmail, dstId, dstName, dstEmail, message) {
trace("\t>>>\t setRelay()");
callUrl(setRelayProc, "setrelay", (((((((((((((("data=" + theData) + "&srcid=") + srcId) + "&srcname=") + srcname) + "&srcemail=") + srcEmail) + "&dstid=") + dstId) + "&dstname=") + dstName) + "&dstemail=") + dstEmail) + "&gameId=") + gameId);
}
function setRelayProc(d) {
trace("\t>>>\t setRelayProc()");
if (d.result == "OK") {
backendListener.onBackend("SETRELAY", d.id, d.verbose);
} else {
backendListener.onBackendError("SETRELAY", d.result, d.verbose);
}
}
function getRelay(theId) {
trace("\t>>>\t getRelay()");
callUrl(getRelayProc, "getrelay", "id=" + theId);
}
function getRelayProc(d) {
trace("\t>>>\t getRelayProc()");
if (d.result == "OK") {
backendListener.onBackend("GETRELAY", d.data, d.verbose);
} else {
backendListener.onBackendError("GETRELAY", d.result, d.verbose);
}
}
function safe_add(x, y) {
var lsw = ((x & 65535) + (y & 65535));
var msw = (((x >> 16) + (y >> 16)) + (lsw >> 16));
return((msw << 16) | (lsw & 65535));
}
function rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
function cmn(q, a, b, x, s, t) {
return(safe_add(rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b));
}
function ff(a, b, c, d, x, s, t) {
return(cmn((b & c) | ((~b) & d), a, b, x, s, t));
}
function gg(a, b, c, d, x, s, t) {
return(cmn((b & d) | (c & (~d)), a, b, x, s, t));
}
function hh(a, b, c, d, x, s, t) {
return(cmn((b ^ c) ^ d, a, b, x, s, t));
}
function ii(a, b, c, d, x, s, t) {
return(cmn(c ^ (b | (~d)), a, b, x, s, t));
}
function coreMD5(x) {
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
i = 0;
while (i < x.length) {
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
a = ff(a, b, c, d, x[i + 0], 7, -680876936);
d = ff(d, a, b, c, x[i + 1], 12, -389564586);
c = ff(c, d, a, b, x[i + 2], 17, 606105819);
b = ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = ff(a, b, c, d, x[i + 4], 7, -176418897);
d = ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = ff(b, c, d, a, x[i + 7], 22, -45705983);
a = ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = ff(c, d, a, b, x[i + 10], 17, -42063);
b = ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = ff(d, a, b, c, x[i + 13], 12, -40341101);
c = ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = gg(a, b, c, d, x[i + 1], 5, -165796510);
d = gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = gg(c, d, a, b, x[i + 11], 14, 643717713);
b = gg(b, c, d, a, x[i + 0], 20, -373897302);
a = gg(a, b, c, d, x[i + 5], 5, -701558691);
d = gg(d, a, b, c, x[i + 10], 9, 38016083);
c = gg(c, d, a, b, x[i + 15], 14, -660478335);
b = gg(b, c, d, a, x[i + 4], 20, -405537848);
a = gg(a, b, c, d, x[i + 9], 5, 568446438);
d = gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = gg(c, d, a, b, x[i + 3], 14, -187363961);
b = gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = gg(d, a, b, c, x[i + 2], 9, -51403784);
c = gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = hh(a, b, c, d, x[i + 5], 4, -378558);
d = hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = hh(b, c, d, a, x[i + 14], 23, -35309556);
a = hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = hh(c, d, a, b, x[i + 7], 16, -155497632);
b = hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = hh(a, b, c, d, x[i + 13], 4, 681279174);
d = hh(d, a, b, c, x[i + 0], 11, -358537222);
c = hh(c, d, a, b, x[i + 3], 16, -722521979);
b = hh(b, c, d, a, x[i + 6], 23, 76029189);
a = hh(a, b, c, d, x[i + 9], 4, -640364487);
d = hh(d, a, b, c, x[i + 12], 11, -421815835);
c = hh(c, d, a, b, x[i + 15], 16, 530742520);
b = hh(b, c, d, a, x[i + 2], 23, -995338651);
a = ii(a, b, c, d, x[i + 0], 6, -198630844);
d = ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = ii(b, c, d, a, x[i + 5], 21, -57434055);
a = ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = ii(c, d, a, b, x[i + 10], 15, -1051523);
b = ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = ii(d, a, b, c, x[i + 15], 10, -30611744);
c = ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = ii(a, b, c, d, x[i + 4], 6, -145523070);
d = ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = ii(c, d, a, b, x[i + 2], 15, 718787259);
b = ii(b, c, d, a, x[i + 9], 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
i = i + 16;
}
return([a, b, c, d]);
}
function binl2hex(binarray) {
var hex_tab = "0123456789abcdef";
var str = "";
var i = 0;
while (i < (binarray.length * 4)) {
str = str + (hex_tab.charAt((binarray[i >> 2] >> (((i % 4) * 8) + 4)) & 15) + hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 15));
i++;
}
return(str);
}
function binl2b64(binarray) {
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
var i = 0;
while (i < (binarray.length * 4)) {
x = binarray[i >> 2];
alert(binarray[i >> 6]);
str = str + tab.charAt(((binarray[i >> 5] << (i % 32)) & 63) | ((binarray[i >> 6] >> (32 - (i % 32))) & 63));
i = i + 3;
}
return(str);
}
function binb2b64(binarray) {
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
var i = 0;
while (i < (binarray.length * 32)) {
alert(binarray[i >> 6]);
str = str + tab.charAt(((binarray[i >> 5] << (i % 32)) & 63) | ((binarray[i >> 6] >> (32 - (i % 32))) & 63));
i = i + 6;
}
return(str);
}
function str2binl(str) {
var nblk = (((str.length + 8) >> 6) + 1);
var blks = new Array(nblk * 16);
var i = 0;
while (i < (nblk * 16)) {
blks[i] = 0;
i++;
}
var i = 0;
while (i < str.length) {
blks[i >> 2] = blks[i >> 2] | ((str.charCodeAt(i) & 255) << ((i % 4) * 8));
i++;
}
blks[i >> 2] = blks[i >> 2] | (128 << ((i % 4) * 8));
blks[(nblk * 16) - 2] = str.length * 8;
return(blks);
}
function strw2binl(str) {
var nblk = (((str.length + 4) >> 5) + 1);
var blks = new Array(nblk * 16);
var i = 0;
while (i < (nblk * 16)) {
blks[i] = 0;
i++;
}
var i = 0;
while (i < str.length) {
blks[i >> 1] = blks[i >> 1] | (str.charCodeAt(i) << ((i % 2) * 16));
i++;
}
blks[i >> 1] = blks[i >> 1] | (128 << ((i % 2) * 16));
blks[(nblk * 16) - 2] = str.length * 16;
return(blks);
}
function hexMD5(str) {
return(binl2hex(coreMD5(str2binl(str))));
}
function hexMD5w(str) {
return(binl2hex(coreMD5(strw2binl(str))));
}
function b64MD5(str) {
return(binl2b64(coreMD5(str2binl(str))));
}
function b64MD5w(str) {
return(binl2b64(coreMD5(strw2binl(str))));
}
function calcMD5(str) {
return(binl2hex(coreMD5(str2binl(str))));
}
function onDataReceived() {
isBusy = false;
trace((((("\t>>>\t onDataReceived: result: " + data.result) + ", error: ") + data.error) + ", verbose: ") + data.verbose);
_parent.debug = _parent.debug + ((((("\t>>>\tData Received: result: " + data.result) + ", error: ") + data.error) + ", verbose: ") + data.verbose);
if (typeof(currentProc) != "function") {
trace(("onDataReceived().. WARNING.. currentProc is NOT a function.. typeof(currentProc): '" + typeof(currentProc)) + "'");
}
currentProc(data);
}
function callUrl(theProc, theUrl, theArgs) {
trace("\t>>>\t callUrl()");
if (isBusy) {
trace("***ERROR: Titoonic Backend> Attempt made to call function while module was busy. Revise code.");
return(undefined);
}
currentProc = theProc;
isBusy = true;
var resUrl = (((((theUrl + settings.extension) + "?") + theArgs) + "&osteloebe=") + Math.random());
_parent.debug = _parent.debug + ("\t>>>\tCalling URL: " + resUrl);
trace("\t>>>\t Calling URL: " + resUrl);
loadVariables (settings.backendURL + resUrl, "DATA");
}
function callUrlPOST(theProc, theUrl, theArgs) {
trace("\t>>>\t callUrlPOST()");
if (isBusy) {
trace("***ERROR: Titoonic Backend> Attempt made to call function while module was busy. Revise code.");
return(undefined);
}
currentProc = theProc;
datapost.varString = theArgs;
trace("datapost.varString = " + datapost.varString);
isBusy = true;
datapost.submitVars(settings.backendURL + theUrl);
}
function setListener(theListener) {
trace("\t>>>\tsetListener(): " + theListener);
backendListener = theListener;
if (!isBusy) {
backendListener.onBackend("READY");
}
}
function isHiscore(theScore) {
trace("\t>>>\t isHiscore()");
callUrl(isHiscoreProc, "checkscore", (("gameId=" + gameId) + "&score=") + theScore);
}
function isArcadeHiscore(theScore) {
trace("\t>>>\t isArcadeHiscore()");
callUrl(isArcadeHiscoreProc, "arcade_checkscore", (("gameId=" + gameId) + "&score=") + theScore);
}
function isHiscoreProc(d) {
trace("\t>>>\t isHiscoreProc()");
trace(d.result);
if (d.result == "YES") {
backendListener.onBackend("ISHISCORE", true, d.verbose);
} else {
backendListener.onBackend("ISHISCORE", false, d.verbose);
}
}
function isArcadeHiscoreProc(d) {
trace("\t>>>\t isArcadeHiscoreProc()");
trace(d.result);
if (d.result == "YES") {
backendListener.onBackend("ISARCADEHISCORE", true, d.verbose);
} else {
backendListener.onBackend("ISARCADEHISCORE", false, d.verbose);
}
}
function validateUser() {
trace("\t>>>\t isLogged()");
callUrl(validateUserProc, "validateuser", "username=" + _level0.username);
}
function validateUserProc(d) {
trace("\t>>>\t validateUserProc()");
if ((d.result == "OK") || (d.result == "ok")) {
backendListener.onBackend("VALIDATEUSER", true, d.verbose);
} else {
backendListener.onBackend("VALIDATEUSER", false, d.verbose);
}
}
function getScores() {
trace("\t>>>\t getScores()");
callUrl(getScoresProc, "getscores", "gameId=" + gameId);
}
function getScoresProc(d) {
trace("\t>>>\t getScoresProc()");
if (d.result == "OK") {
var allstars = new Array();
var todaystars = new Array();
var i = 0;
while (typeof(d["all_col_nickname" + i]) != "undefined") {
var star = new Object();
star.name = d["all_col_nickname" + i];
star.score = d["all_col_score" + i];
star.url = d["all_col_url" + i];
star.date = d["all_col_date" + i];
allstars[i] = star;
i++;
}
var i = 0;
while (typeof(d["today_col_nickname" + i]) != "undefined") {
var star = new Object();
star.name = d["today_col_nickname" + i];
star.score = d["today_col_score" + i];
star.url = d["today_col_url" + i];
star.date = d["today_col_date" + i];
todaystars[i] = star;
i++;
}
backendListener.onBackend("GETSCORES", allstars, todaystars, d.verbose);
} else {
backendListener.onBackendError("GETSCORES", d.verbose);
}
}
function arcade_getScores() {
trace("\t>>>\t arcade_getScores()");
var i = 0;
while (i < 30) {
data["all_col_firstname" + i] = "";
data["all_col_firstname" + i] = "";
data["all_col_lastname" + i] = "";
data["all_col_nickname" + i] = "";
data["all_col_email" + i] = "";
data["all_col_score" + i] = 0;
data["all_col_date" + i] = "";
data["today_col_firstname" + i] = "";
data["today_col_lastname" + i] = "";
data["today_col_nickname" + i] = "";
data["today_col_email" + i] = "";
data["today_col_score" + i] = 0;
data["today_col_date" + i] = "";
i++;
}
callUrl(arcade_getScoresProc, "arcade_getscores", "gameId=" + gameId);
}
function arcade_getScoresProc(d) {
trace("\t>>>\t arcade_getScoresProc() typeof(d): " + typeof(d));
trace("d.result: " + d.result);
if (d.result == "OK") {
allstars = new Array();
todaystars = new Array();
var i = 0;
while (typeof(d["all_col_firstname" + i]) != "undefined") {
var star = new Object();
star.firstname = d["all_col_firstname" + i];
star.lastname = d["all_col_lastname" + i];
star.nickname = d["all_col_nickname" + i];
star.email = d["all_col_email" + i];
star.score = d["all_col_score" + i];
star.date = d["all_col_date" + i];
allstars[i] = star;
i++;
}
var i = 0;
while (typeof(d["all_col_firstname" + i]) != "undefined") {
var star = new Object();
star.firstname = d["today_col_firstname" + i];
star.lastname = d["today_col_lastname" + i];
star.nickname = d["today_col_nickname" + i];
star.email = d["today_col_email" + i];
star.score = d["today_col_score" + i];
star.date = d["today_col_date" + i];
todaystars[i] = star;
i++;
}
backendListener.onBackend("arcade_GETSCORES", allstars, todaystars, d.verbose);
} else {
backendListener.onBackendError("arcade_GETSCORES", d.verbose);
}
}
function setArcadeScore(theScore, firstname, lastname, email) {
trace("\t>>>\t setArcadeScore()");
var cs = (Number(theScore) + 90293468);
cs = calcMD5(new String(cs));
callUrl(setArcadeScoreProc, "arcade_setscore", (((((((((("firstname=" + firstname) + "&lastname=") + lastname) + "&email=") + email) + "&score=") + theScore) + "&gameId=") + gameId) + "&checksum=") + cs);
}
function setArcadeScoreProc(d) {
trace("\t>>>\t setArcadeScoreProc()");
if (d.result == "OK") {
trace("Score registered. Verbose: " + d.verbose);
trace("setScore callback: " + typeof(backendListener.onBackend));
backendListener.onBackend("SETARCADESCORE", d.verbose);
} else {
trace("Score not registered. Verbose: " + d.verbose);
backendListener.onBackendError("SETARCADESCORE", d.result, d.verbose);
}
}
function sendMail(receiver_name, receiver_email, sender_name, sender_email, subject, mailbody) {
trace("\t>>>\t sendMail()");
callUrl(sendMailProc, "simplemailer", (((((((((((("receiver_name=" + receiver_name) + "&receiver_email=") + receiver_email) + "&sender_name=") + sender_name) + "&sender_email=") + sender_email) + "&subject=") + subject) + "&gameId=") + gameId) + "&mailbody=") + mailbody);
}
function sendMailProc(d) {
trace("\t>>>\t sendMailProc()");
if (d.result == "OK") {
trace("Mail sent. Verbose: " + d.verbose);
backendListener.onBackend("SENDMAIL", d.verbose);
} else {
trace("Mail not sent. Verbose: " + d.verbose);
backendListener.onBackendError("SENDMAIL", d.result, d.verbose);
}
}
function setScore(theScore) {
trace("\t>>>\t setScore()");
var cs = (Number(theScore) + 90293468);
cs = calcMD5(new String(cs));
callUrl(setScoreProc, "setscore", (((("score=" + theScore) + "&gameId=") + gameId) + "&checksum=") + cs);
}
function setScoreProc(d) {
trace("\t>>>\t setScoreProc()");
if (d.result == "OK") {
trace("Score registered. Verbose: " + d.verbose);
trace("setScore callback: " + typeof(backendListener.onBackend));
backendListener.onBackend("SETSCORE", d.verbose);
} else {
trace("Score not registered. Verbose: " + d.verbose);
backendListener.onBackendError("SETSCORE", d.result, d.verbose);
}
}
var version = "1.5 Flash 5 Version";
var isBusy = true;
var submitObj = new Object();
loadVariables (Settings_Filename, "settings");
trace(("*** Titoonic Backend Module v" + version) + " initialized ***");
Instance of Symbol 19 MovieClip "data" in Symbol 20 MovieClip Frame 1
onClipEvent (data) {
trace("onData event in data MC triggered");
_parent.onDataReceived();
}
Instance of Symbol 19 MovieClip "datapost" in Symbol 20 MovieClip Frame 1
onClipEvent (load) {
function submitVars(theURL) {
gameId = _parent.gameId;
if (typeof(_parent._parent.userData.userid) == "undefined") {
trace("ERROR : In backend datapost module userdata object is undefined");
}
userId = _parent._parent.userData.userid;
rowId = _parent._parent.data.clickedOpponentID;
allURL = (theURL + ".php?osteloebe=") + Math.random();
loadVariables (allURL, _parent.data, "POST");
}
var varString = "";
var gameId = -1;
var userId = -1;
var rowId = 0;
}
Instance of Symbol 19 MovieClip "settings" in Symbol 20 MovieClip Frame 1
onClipEvent (data) {
extension = ".php";
trace("Settings for backend is loaded. Backend URL is " + this.backendURL);
_parent.baseUrl = this.backendURL;
this.configLoaded = true;
_parent.isBusy = false;
if (_parent.backendListener) {
trace("Backendlistener already listening. Notifying.");
_parent.backendListener.onBackend("READY");
}
}
Symbol 26 Button
on (press) {
startDrag (this);
}
on (release) {
stopDrag();
}
Symbol 30 Button
on (release) {
this._visible = false;
}
Symbol 31 Button
on (release) {
this._visible = false;
_level0.gotoAndPlay(1);
}
Symbol 49 MovieClip Frame 1
stop();
Symbol 49 MovieClip Frame 42
stop();
Symbol 49 MovieClip Frame 81
stop();
Symbol 49 MovieClip Frame 106
stop();
Symbol 49 MovieClip Frame 149
stop();
Symbol 49 MovieClip Frame 208
stop();
Symbol 49 MovieClip Frame 218
stop();
Symbol 49 MovieClip Frame 226
stop();
Symbol 49 MovieClip Frame 233
stop();
Symbol 49 MovieClip Frame 240
stop();
Symbol 55 MovieClip Frame 1
stop();
Symbol 55 MovieClip Frame 19
stop();
Symbol 55 MovieClip Frame 35
stop();
Symbol 55 MovieClip Frame 58
stop();
Symbol 55 MovieClip Frame 75
stop();
Instance of Symbol 51 MovieClip in Symbol 56 MovieClip Frame 1
onClipEvent (enterFrame) {
RanCount++;
if ((75 < RanCount) && (0.955 < Math.random())) {
PlayRandomAnimal();
RanCount = 0;
}
}
onClipEvent (load) {
function PlayRandomAnimal() {
id = random(8) + 1;
rand.gotoAndPlay("s" + id);
}
}
Symbol 63 Button
on (press) {
_parent.jumpscroll();
}
Symbol 65 Button
on (press) {
_parent.dragstart();
}
on (release, releaseOutside) {
_parent.dragend();
}
Symbol 71 Button
on (press) {
_parent.stepscroll("plus");
}
Symbol 73 Button
on (press) {
_parent.stepscroll("minus");
}
Symbol 76 MovieClip Frame 1
function ini() {
trace("ini()");
if (orientation == "vertical") {
heightwidth = "._height";
xy = "._y";
}
if (orientation == "horisontal") {
heightwidth = "._width";
xy = "._x";
}
dragging = false;
dragoffset = 0;
scrollcliptop = eval (("_parent." add scrollarea) add xy);
scrollclipbot = scrollcliptop + ((eval (("_parent." add scrollclip) add heightwidth) - eval (("_parent." add scrollarea) add heightwidth)) * -1);
slider._height = (sliderareabox._height * eval (("_parent." add scrollarea) add heightwidth)) / eval (("_parent." add scrollclip) add heightwidth);
slidermax = sliderareabox._height - slider._height;
sliderx = sliderareabox._width / 2;
if (orientation == "vertical") {
setProperty("_parent." add scrollclip, _y , scrollcliptop);
}
if (orientation == "horisontal") {
setProperty("_parent." add scrollclip, _x , scrollcliptop);
}
slider._x = sliderx;
slider._y = 0;
if (eval (("_parent." add scrollclip) add heightwidth) < eval (("_parent." add scrollarea) add heightwidth)) {
if (ifSmallClip == "transparent") {
slider._visible = false;
_alpha = 50;
}
if (ifSmallClip == "invisible") {
this._visible = false;
}
} else {
slider._visible = true;
}
}
function dragstart() {
dragging = true;
dragoffset = this._ymouse - slider._y;
}
function dragit() {
if ((0 < (this._yMouse - dragoffset)) && ((this._yMouse - dragoffset) < slidermax)) {
slider._y = this._yMouse - dragoffset;
}
if ((this._yMouse - dragoffset) < 0) {
slider._y = 0;
}
if (slidermax < (this._yMouse - dragoffset)) {
slider._y = slidermax;
}
if (orientation == "vertical") {
setProperty("_parent." add scrollclip, _y , ((scrollclipbot - scrollcliptop) * (slider._y / slidermax)) + scrollcliptop);
}
if (orientation == "horisontal") {
setProperty("_parent." add scrollclip, _x , ((scrollclipbot - scrollcliptop) * (slider._y / slidermax)) + scrollcliptop);
}
}
function jumpscroll() {
if (this._yMouse < slider._y) {
slider._y = slider._y - Math.min(slider._height, slider._y);
}
if ((slider._y + slider._height) < this._yMouse) {
slider._y = slider._y + Math.min(slider._height, slidermax - slider._y);
}
if (orientation == "vertical") {
setProperty("_parent." add scrollclip, _y , ((scrollclipbot - scrollcliptop) * (slider._y / slidermax)) + scrollcliptop);
}
if (orientation == "horisontal") {
setProperty("_parent." add scrollclip, _x , ((scrollclipbot - scrollcliptop) * (slider._y / slidermax)) + scrollcliptop);
}
}
function stepscroll(plusminus) {
if (plusminus == "plus") {
slider._y = Math.min(slider._y + stepscrollunits, slidermax);
}
if (plusminus == "minus") {
slider._y = Math.max(slider._y - stepscrollunits, 0);
}
if (orientation == "vertical") {
setProperty("_parent." add scrollclip, _y , ((scrollclipbot - scrollcliptop) * (slider._y / slidermax)) + scrollcliptop);
}
if (orientation == "horisontal") {
setProperty("_parent." add scrollclip, _x , ((scrollclipbot - scrollcliptop) * (slider._y / slidermax)) + scrollcliptop);
}
}
function dragend() {
dragging = false;
}
Instance of Symbol 67 MovieClip "slider" in Symbol 76 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_parent.dragging == true) {
_parent.dragit();
}
}
Symbol 76 MovieClip Frame 2
stop();
ini();
Symbol 81 MovieClip Frame 2
init();
stop();
Symbol 85 Button
on (release) {
_parent.HISCORETYPE = "all";
_parent.gotoAndPlay("showit");
}
Symbol 88 Button
on (release) {
_parent.HISCORETYPE = "day";
_parent.gotoAndPlay("showit");
}
Symbol 89 MovieClip Frame 1
stop();
Symbol 90 MovieClip Frame 3
stop();
Symbol 90 MovieClip Frame 10
if (HISCORETYPE == "day") {
buttons.gotoAndStop(1);
} else {
buttons.gotoAndStop(2);
}
stop();
Instance of Symbol 76 MovieClip "sc" in Symbol 90 MovieClip Frame 10
onClipEvent (load) {
scrollclip = "dataloader";
scrollarea = "scrollarea1";
orientation = "vertical";
stepscrollunits = 1;
ifSmallClip = "transparent";
}
Instance of Symbol 81 MovieClip "dataloader" in Symbol 90 MovieClip Frame 10
onClipEvent (load) {
_parent.filllist();
}
Symbol 93 Button
on (release) {
getURL ("http://www.titoonic.dk", "_blank");
}
Symbol 94 Button
on (release) {
this.play();
Sel = "sendto";
}
Symbol 96 Button
on (release) {
this.play();
Sel = "howto";
}
Symbol 98 Button
on (release) {
this.play();
Sel = "game";
}
Symbol 114 MovieClip Frame 2
stop();
Instance of Symbol 116 MovieClip in Symbol 120 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(5) + 1);
}
Instance of Symbol 116 MovieClip in Symbol 120 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(5) + 1);
}
Symbol 147 MovieClip Frame 1
stop();
Symbol 147 MovieClip Frame 4
gotoAndStop (1);
Symbol 147 MovieClip Frame 11
_parent._parent.OpenMouth();
Instance of Symbol 137 MovieClip in Symbol 148 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(15));
}
Instance of Symbol 137 MovieClip in Symbol 148 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(15));
}
Symbol 161 MovieClip Frame 22
stop();
Symbol 164 MovieClip Frame 1
stop();
Instance of Symbol 152 MovieClip in Symbol 164 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(5) + 1);
}
Instance of Symbol 152 MovieClip in Symbol 164 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(5) + 1);
}
Symbol 164 MovieClip Frame 2
stop();
crumbs.gotoAndPlay(1);
Symbol 164 MovieClip Frame 3
stop();
crumbs.gotoAndPlay(1);
Symbol 164 MovieClip Frame 4
stop();
crumbs.gotoAndPlay(1);
Symbol 164 MovieClip Frame 5
stop();
Symbol 164 MovieClip Frame 6
stop();
Symbol 164 MovieClip Frame 7
stop();
Symbol 164 MovieClip Frame 8
stop();
Symbol 164 MovieClip Frame 9
stop();
Symbol 164 MovieClip Frame 10
stop();
Symbol 164 MovieClip Frame 11
stop();
Symbol 164 MovieClip Frame 12
stop();
Instance of Symbol 168 MovieClip in Symbol 170 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(6) + 1);
}
Instance of Symbol 168 MovieClip in Symbol 170 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(6) + 1);
}
Instance of Symbol 168 MovieClip in Symbol 176 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(15));
}
Instance of Symbol 168 MovieClip in Symbol 176 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(15));
}
Symbol 189 MovieClip Frame 1
stop();
Instance of Symbol 114 MovieClip in Symbol 189 MovieClip Frame 1
onClipEvent (enterFrame) {
count++;
if (80 < count) {
count = 0;
_parent.play();
}
}
Symbol 189 MovieClip Frame 6
stop();
Symbol 189 MovieClip Frame 13
stop();
Symbol 189 MovieClip Frame 20
stop();
Symbol 189 MovieClip Frame 26
stop();
Symbol 189 MovieClip Frame 33
stop();
Symbol 189 MovieClip Frame 39
stop();
Symbol 191 MovieClip Frame 1
stop();
Instance of Symbol 76 MovieClip "sc" in Symbol 191 MovieClip Frame 1
onClipEvent (load) {
scrollclip = "howto";
scrollarea = "scrollarea1";
orientation = "vertical";
stepscrollunits = 1;
ifSmallClip = "transparent";
}
Symbol 192 Button
on (release) {
this.play();
Sel = "splash";
}
Symbol 195 Button
on (press) {
_parent._parent.backend.sendMail(to_name, to_email, from_name, from_email, "", message1);
this.gotoAndPlay("sendit");
}
Symbol 208 Button
on (release) {
gotoAndStop (1);
}
Symbol 216 MovieClip Frame 1
var from_name = _parent._parent.userData.nickname;
var from_email = _parent._parent.userData.email;
stop();
Symbol 216 MovieClip Frame 17
play();
Symbol 216 MovieClip Frame 23
if (Status ne "") {
gotoAndStop (1);
}
Symbol 216 MovieClip Frame 29
gotoAndPlay (23);
Symbol 223 Button
on (press) {
_parent.GrabSpider();
}
on (release, releaseOutside) {
_parent.MouseRelease();
}
Symbol 230 MovieClip Frame 1
stop();
Symbol 236 MovieClip Frame 1
stop();
Instance of Symbol 137 MovieClip in Symbol 236 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(15));
}
Symbol 247 MovieClip Frame 3
_parent._parent.ShockLegs();
Symbol 247 MovieClip Frame 13
_parent._parent.body.animstate = "";
_parent._parent.body.gotoAndStop(1);
Symbol 273 MovieClip Frame 7
_parent._parent.EatBounce();
Symbol 273 MovieClip Frame 13
_parent._parent.EatBounce();
Symbol 273 MovieClip Frame 19
_parent._parent.EatBounce();
Symbol 273 MovieClip Frame 25
_parent._parent.EatBounce();
Symbol 273 MovieClip Frame 45
_parent._parent.SpitRed();
Symbol 273 MovieClip Frame 46
_parent._parent.XBounce(25);
Symbol 273 MovieClip Frame 50
_parent.gotoAndStop(1);
_parent.animState = "";
Instance of Symbol 116 MovieClip in Symbol 283 MovieClip Frame 1
onClipEvent (enterFrame) {
}
Symbol 283 MovieClip Frame 7
_parent._parent.EatBounce();
Instance of Symbol 116 MovieClip in Symbol 283 MovieClip Frame 7
onClipEvent (enterFrame) {
}
Symbol 283 MovieClip Frame 13
_parent._parent.EatBounce();
Symbol 283 MovieClip Frame 19
_parent._parent.EatBounce();
Symbol 283 MovieClip Frame 25
_parent._parent.EatBounce();
Instance of Symbol 116 MovieClip in Symbol 283 MovieClip Frame 27
onClipEvent (enterFrame) {
}
Symbol 283 MovieClip Frame 32
_parent.gotoAndStop(1);
_parent.animState = "";
Instance of Symbol 137 MovieClip in Symbol 290 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(15));
}
Symbol 290 MovieClip Frame 7
_parent._parent.EatBounce();
Symbol 290 MovieClip Frame 13
_parent._parent.EatBounce();
Symbol 290 MovieClip Frame 14
_parent.gotoAndStop(1);
_parent.animState = "";
Symbol 304 MovieClip Frame 7
_parent._parent.EatBounce();
Symbol 304 MovieClip Frame 13
_parent._parent.EatBounce();
Symbol 304 MovieClip Frame 19
_parent._parent.EatBounce();
Symbol 304 MovieClip Frame 25
_parent._parent.EatBounce();
Symbol 304 MovieClip Frame 52
_parent.gotoAndStop(1);
_parent.animState = "";
Symbol 369 MovieClip Frame 85
stop();
Symbol 371 MovieClip Frame 1
stop();
Instance of Symbol 116 MovieClip in Symbol 371 MovieClip Frame 18
onClipEvent (enterFrame) {
}
Symbol 375 MovieClip Frame 1
stop();
Instance of Symbol 116 MovieClip in Symbol 377 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(5) + 1);
}
Instance of Symbol 116 MovieClip in Symbol 377 MovieClip Frame 1
onClipEvent (enterFrame) {
this.gotoAndStop(random(5) + 1);
}
Symbol 378 MovieClip Frame 1
stop();
Symbol 378 MovieClip Frame 6
stop();
Symbol 378 MovieClip Frame 13
stop();
Symbol 378 MovieClip Frame 20
stop();
Symbol 378 MovieClip Frame 26
stop();
Symbol 378 MovieClip Frame 33
stop();
Symbol 395 MovieClip Frame 11
this._visible = false;
Symbol 397 MovieClip Frame 75
tiptext = "";
Symbol 398 MovieClip Frame 1
function UpdateFly(id) {
OldXvel = fly[t].xvel;
var t = id;
if (fly[t].type == "type1") {
with (eval (fly[t])) {
if (state == "fly") {
if ((0 < dir) && (xvel < 0)) {
Xacc = Math.random() * 2;
} else if ((0 < dir) && (xvel < 0)) {
Xacc = (-Math.random()) * 2;
} else {
Xacc = ((Math.random() - 0.2) * 12) * dir;
}
if ((FyMin + 200) < _y) {
yacc = ((-Math.random()) * 2) - 1;
} else if (_y < (FyMin - 80)) {
yacc = (Math.random() * 2) + 1;
} else {
yacc = (Math.random() - 0.5) * 8;
}
if (((FxMax < _x) && (0 < dir)) || ((_x < FxMin) && (dir < 0))) {
_visible = false;
state = "inactive";
}
xvel = (xvel + Xacc) * 0.9;
yvel = (yvel + Yacc) * 0.9;
_x = _x + xvel;
_y = _y + yvel;
statecount++;
if ((25 < statecount) && (0.97 < Math.Random())) {
state = "hold";
statecount = 0;
x = _x;
y = _y;
}
} else if (state == "hold") {
xvel = xvel + (((Math.random() - 0.5) * 2) + ((x - _x) / 3));
yvel = yvel + (((Math.random() - 0.5) * 2) + ((y - _y) / 3));
_x = _x + xvel;
_y = _y + yvel;
statecount++;
if ((15 < statecount) && (0.95 < Math.Random())) {
state = "fly";
statecount = 0;
}
}
}
} else if (fly[t].type == "type2") {
with (eval (fly[t])) {
if (state == "fly") {
if ((0 < dir) && (xvel < 0)) {
Xacc = Math.random() * 4;
} else if ((0 < dir) && (xvel < 0)) {
Xacc = (-Math.random()) * 4;
} else {
Xacc = (Math.random() * 6) * dir;
}
if (FyMax < _y) {
yacc = -2 - (Math.random() * 5);
} else if (_y < FyMin) {
yacc = 2 + (Math.random() * 5);
} else {
yacc = (Math.random() - 0.5) * 5;
}
if (((FxMax < _x) && (0 < dir)) || ((_x < FxMin) && (dir < 0))) {
_visible = false;
state = "inactive";
}
xvel = (xvel + Xacc) * 0.92;
yvel = (yvel + Yacc) * 0.92;
_x = _x + xvel;
_y = _y + yvel;
statecount++;
if ((25 < statecount) && (0.93 < Math.Random())) {
state = "hold";
statecount = 0;
x = _x;
y = _y;
}
} else if (state == "hold") {
xvel = xvel + (((Math.random() - 0.5) * 6) + ((x - _x) / 3));
yvel = yvel + (((Math.random() - 0.5) * 8) + ((y - _y) / 3));
_x = _x + xvel;
_y = _y + yvel;
statecount++;
if ((15 < statecount) && (0.93 < Math.Random())) {
state = "fly";
statecount = 0;
}
}
}
fly[t].skin.legs._rotation = ((fly[t].xvel - OldXvel) * 2) * fly[t].dir;
} else if (fly[t].type == "type3") {
with (eval (fly[t])) {
if (state == "fly") {
DirCount++;
if ((9 < DirCount) && (0.7 < Math.random())) {
DirCount = 0;
Xvel = ((Math.random() - 0.3) * dir) * 70;
Yvel = (Math.random() - 0.5) * 80;
}
if (FyMax < _y) {
yvel = -0.5 - (Math.random() * 5);
} else if (_y < FyMin) {
yvel = 0.5 + (Math.random() * 5);
}
if ((FxMax < _x) && (0 < dir)) {
_visible = false;
state = "inactive";
} else if ((_x < FxMin) && (dir < 0)) {
_visible = false;
state = "inactive";
}
_x = _x + xvel;
_y = _y + yvel;
statecount++;
if ((125 < statecount) && (0.93 < Math.Random())) {
state = "hold";
statecount = 0;
xvel = (yvel = 0);
x = _x;
y = _y;
}
} else if (state == "hold") {
var xtmp = (x - _x);
xtmp = xtmp / 3;
xvel = xvel + (((Math.random() - 0.5) * 5) + (x - _x));
var ytmp = (y - _y);
ytmp = ytmp / 3;
yvel = yvel + (((Math.random() - 0.5) * 5) + (y - _y));
_x = _x + xvel;
_y = _y + yvel;
statecount++;
if ((15 < statecount) && (0.93 < Math.Random())) {
state = "fly";
statecount = 0;
}
}
}
fly[t].skin.legs._rotation = ((fly[t].xvel - OldXvel) * 2) * fly[t].dir;
} else if (fly[t].type == "type4") {
if (fly[t].state == "fly") {
with (eval (fly[t])) {
if ((dir * 0.1) < xvel) {
xacc = 1 * dir;
}
if (FyMax < _y) {
yacc = -1 - (Math.random() * 2);
} else if (_y < FyMin) {
yacc = 1 + (Math.random() * 2);
} else {
yacc = (Math.random() - 0.5) * 6;
}
if ((FxMax < _x) && (0 < dir)) {
_visible = false;
state = "inactive";
} else if ((_x < FxMin) && (dir < 0)) {
_visible = false;
state = "inactive";
}
Xacc = Xacc + ((Math.random() - 0.5) * 0.2);
Xacc = Xacc + ((Math.random() - 0.5) * 0.1);
Xvel = (Xvel + Xacc) * 0.9;
Yvel = (Yvel + Yacc) * 0.9;
_x = _x + xvel;
_y = _y + yvel;
statecount++;
}
}
fly[t].skin.body._rotation = (fly[t].xvel - OldXvel) * fly[t].dir;
} else if (fly[t].type == "type5") {
with (eval (fly[t])) {
if (state == "fly") {
if ((0 < dir) && (xvel < 0)) {
Xacc = Math.random() / 2;
} else if ((0 < dir) && (xvel < 0)) {
Xacc = (-Math.random()) / 2;
} else {
Xacc = (Math.random() * 4) * dir;
}
if ((FyMax + 100) < _y) {
yacc = ((-Math.random()) * 2) - 2;
} else if (_y < (FyMax - 20)) {
yacc = (Math.random() * 2) + 2;
} else {
yacc = yacc + ((Math.random() - 0.5) * 4);
}
if ((FxMax < _x) && (0 < dir)) {
_visible = false;
state = "inactive";
} else if ((_x < FxMin) && (dir < 0)) {
_visible = false;
state = "inactive";
}
xvel = (xvel + Xacc) * 0.9;
yvel = (yvel + Yacc) * 0.9;
_x = _x + xvel;
_y = _y + yvel;
statecount++;
if ((5 < statecount) && (0.96 < Math.Random())) {
state = "hold";
statecount = 0;
x = _x;
y = _y;
}
} else if (state == "hold") {
xacc = (0.2 * (x - _x)) + ((Math.Random() - 0.5) * 4);
yacc = (0.2 * (y - _y)) + ((Math.Random() - 0.5) * 4);
xvel = (xvel * 0.99) + xacc;
yvel = (yvel * 0.99) + yacc;
_x = _x + xvel;
_y = _y + yvel;
statecount++;
if ((5 < statecount) && (0.96 < Math.Random())) {
state = "fly";
statecount = 0;
}
}
}
} else if (fly[t].type == "type6") {
with (eval (fly[t])) {
Xacc = (2 + (Math.random() * 6)) * dir;
Xdiff = body._x - _x;
Ydiff = 0;
if (((Xdiff < 0) && (dir < 0)) || ((0 < Xdiff) && (0 < dir))) {
if (Math.abs(Xdiff) < 480) {
Ydiff = body._y - _y;
} else {
Ydiff = body._y - (_y / 100);
}
}
yvel = (Ydiff * 0.12071) + ((Math.random() - 0.5) * 1);
if ((FxMax < _x) && (0 < dir)) {
_visible = false;
state = "inactive";
} else if ((_x < FxMin) && (dir < 0)) {
_visible = false;
state = "inactive";
}
xvel = (xvel + Xacc) * 0.9;
yvel = (yvel + Yacc) * 0.7;
_x = _x + xvel;
_y = _y + yvel;
}
} else if (fly[t].type == "type7") {
with (eval (fly[t])) {
if (state == "fly") {
DirCount++;
if ((9 < DirCount) && (0.7 < Math.random())) {
DirCount = 0;
Xvel = ((Math.random() - 0.3) * dir) * 70;
Yvel = (Math.random() - 0.5) * 80;
}
if (FyMax < _y) {
yvel = -0.5 - (Math.random() * 5);
} else if (_y < FyMin) {
yvel = 0.5 + (Math.random() * 5);
}
if ((FxMax < _x) && (0 < dir)) {
_visible = false;
state = "inactive";
} else if ((_x < FxMin) && (dir < 0)) {
_visible = false;
state = "inactive";
}
_x = _x + xvel;
_y = _y + yvel;
statecount++;
if ((125 < statecount) && (0.93 < Math.Random())) {
state = "hold";
statecount = 0;
xvel = (yvel = 0);
x = _x;
y = _y;
}
} else if (state == "hold") {
var xtmp = (x - _x);
xtmp = xtmp / 3;
xvel = xvel + (((Math.random() - 0.5) * 5) + (x - _x));
var ytmp = (y - _y);
ytmp = ytmp / 3;
yvel = yvel + (((Math.random() - 0.5) * 5) + (y - _y));
_x = _x + xvel;
_y = _y + yvel;
statecount++;
if ((15 < statecount) && (0.93 < Math.Random())) {
state = "fly";
statecount = 0;
}
}
}
fly[t].skin.legs._rotation = ((fly[t].xvel - OldXvel) * 2) * fly[t].dir;
} else if (fly[t].type == "type12") {
with (eval (fly[t])) {
Xacc = (1 + (Math.random() * 4)) * dir;
Xdiff = body._x - _x;
Ydiff = 0;
if (((Xdiff < 0) && (dir < 0)) || ((0 < Xdiff) && (0 < dir))) {
if (Math.abs(Xdiff) < 280) {
Ydiff = body._y - _y;
} else {
Ydiff = body._y - (_y / 100);
}
}
yAcc = (Ydiff * 0.13) + ((Math.random() - 0.5) * 1);
if ((FxMax < _x) && (0 < dir)) {
_visible = false;
state = "inactive";
} else if ((_x < FxMin) && (dir < 0)) {
_visible = false;
state = "inactive";
}
xvel = (xvel + Xacc) * 0.9;
yvel = (yvel + Yacc) * 0.7;
_x = _x + xvel;
_y = _y + yvel;
}
} else if (fly[t].type == "type13") {
with (eval (fly[t])) {
Xacc = (4 + (Math.random() * 7)) * dir;
Xdiff = body._x - _x;
Ydiff = 0;
if (((Xdiff < 0) && (dir < 0)) || ((0 < Xdiff) && (0 < dir))) {
if (Math.abs(Xdiff) < 280) {
Ydiff = body._y - _y;
} else {
Ydiff = (body._y - _y) / 3;
}
}
yAcc = (Ydiff * 0.11) + ((Math.random() - 0.5) * 1);
if ((FxMax < _x) && (0 < dir)) {
_visible = false;
state = "inactive";
} else if ((_x < FxMin) && (dir < 0)) {
_visible = false;
state = "inactive";
}
xvel = (xvel + Xacc) * 0.9;
yvel = (yvel + Yacc) * 0.7;
_x = _x + xvel;
_y = _y + yvel;
}
}
}
function InitPoints() {
NbPoints = 7;
NextPoint = 0;
point = new Array(NbPoints);
var t = 0;
while (t < nbPoints) {
attachMovie("pointsMC", "point" + t, t + 888);
point[t] = eval ("point" + t);
t++;
}
}
function SetPoint(val) {
trace("setting point!!!!________");
point[NextPoint]._x = body._x + 50;
point[NextPoint]._y = body._y - 80;
point[NextPoint]._visible = true;
point[NextPoint].ani.txt = val;
point[NextPoint].play();
NextPoint++;
if (NextPoint >= NbPoints) {
NextPoint = 0;
}
score = score + val;
}
Instance of Symbol 371 MovieClip "body" in Symbol 398 MovieClip Frame 1
onClipEvent (keyDown) {
if (Key.getCode() == 49) {
_parent.CreateThisFly("type1");
} else if (Key.getCode() == 50) {
_parent.CreateThisFly("type2");
} else if (Key.getCode() == 51) {
_parent.CreateThisFly("type3");
} else if (Key.getCode() == 52) {
_parent.CreateThisFly("type4");
} else if (Key.getCode() == 53) {
_parent.CreateThisFly("type5");
} else if (Key.getCode() == 54) {
_parent.CreateThisFly("type6");
} else if (Key.getCode() == 55) {
_parent.CreateThisFly("type7");
} else if (Key.getCode() == 32) {
if ((_parent.state == "dead") && (_parent.deadcount >= 70)) {
_parent.ReviveSpider();
}
} else if (Key.getCode() == 81) {
_parent._parent.gotoAndPlay("gameover");
} else if (Key.getCode() == 107) {
_parent.AddLeg();
} else if (Key.getCode() == 109) {
_parent.DelLeg();
}
trace("keycode == " + Key.getCode());
}
Symbol 398 MovieClip Frame 2
function GameMainInit() {
SpiderLivesUsed = 0;
TotalLives = 3;
Score = _parent.Score;
SetRandomFlyTypeChances(6, 8, 5, 4, 5, 6, 0, 0, 0);
}
function Init() {
NbGs = 30;
Gs = new Array(0);
var t = 0;
while (NbGs >= t) {
Gs[t] = new O_Vector();
Gs[t].x = eval (("_parent.bg.hold.g" + t) + "._x");
Gs[t].y = eval (("_parent.bg.hold.g" + t) + "._y");
t++;
}
FxMin = _parent.bg.hold.topleft._x;
FxMax = _parent.bg.hold.lowright._x;
FyMax = _parent.bg.hold.lowright._y;
FyMin = _parent.bg.hold.topleft._y;
InitSpider();
FlyCount = 0;
NbFlysInLevel = 28;
LevelLoops = 0;
flyVal = new Array();
flyVal[1] = 10;
flyVal[2] = 8;
flyVal[3] = 3;
flyVal[4] = 15;
flyVal[5] = 0;
flyVal[6] = 0;
flyVal[7] = 0;
TIPmain = 0;
TIPjumphigh = false;
TIPeathead = false;
InitFlys();
InitPoints();
GameState = "ON";
}
function InitSpider() {
SpreadMax = 150;
SpreadMin = 40;
StepSize = 60;
readytojump = false;
body.AnimState = "";
body._x = 120;
body._y = -500;
state = "falling";
BodyOffsetY = 40;
SetBars();
InitLeg();
FREEZE = false;
JustSHockedByID = -5;
FreezeCount = 0;
SmokeCount = 999;
ShockCount = 0;
deadcount = 0;
PupOffX = body.eyes.pupils._x;
PupOffY = body.eyes.pupils._y;
}
function ReviveSpider() {
body.AnimState = "free";
state = "falling";
_parent.Health = 100;
deadcount = 0;
}
function InitLeg() {
NbLegs = 4;
Leg = new Array(0);
Leg[0] = new O_Leg(0, "right", 7, 2, 80, YGround, 100, 145);
Leg[1] = new O_Leg(1, "left", -7, 2, -65, YGround, 99, 145);
Leg[2] = new O_Leg(2, "right", 11, 0, 60, YGround, 92, 145);
Leg[3] = new O_Leg(3, "left", -11, 0, -113, YGround, 90, 145);
Leg[4] = new O_Leg(4, "right", 14, -3, 85, YGround, 87, 145);
Leg[5] = new O_Leg(5, "left", -15, -3, -123, YGround, 83, 145);
Leg[6] = new O_Leg(6, "right", 20, -5, 54, YGround, 111, 145);
Leg[7] = new O_Leg(7, "left", -21, -5, -65, YGround, 111, 145);
var t = 0;
while (t < NbLegs) {
Leg[t].end.Y = getY(body._x + Leg[t].end.x);
t++;
}
var t = NbLegs;
while (t < 8) {
eval (("lin" + t) + "a")._visible = false;
eval (("lin" + t) + "b")._visible = false;
t++;
}
}
function AddLeg() {
if (NbLegs < 8) {
eval (("lin" + NbLegs) + "a")._visible = true;
eval (("lin" + NbLegs) + "b")._visible = true;
NbLegs++;
}
}
function DelLeg() {
if (2 < NbLegs) {
eval (("lin" + (NbLegs - 1)) + "a")._visible = false;
eval (("lin" + (NbLegs - 1)) + "b")._visible = false;
NbLegs--;
}
}
function O_leg(id, side, offx, offy, endX, endY, len, dist) {
this.off = new O_Vector(offX, offY);
this.hip = new O_Vector(hipX, hipY);
this.end = new O_Vector(endX, endY);
this.len = len;
this.dist = dist;
this.state = "resting";
this.movedir = 0;
duplicateMovieClip ("lin_org", ("lin" + id) + "a", id * 2);
duplicateMovieClip ("lin_org", ("lin" + id) + "b", (id * 2) + 1);
this.side = 1;
if (side == "left") {
this.side = -1;
}
}
function InitFlys() {
nbFlys = 8;
fstate = "none";
fcount = 70;
fly = new Array();
var t = 0;
while (t < NbFlys) {
duplicateMovieClip ("fly_org", "fly" + t, 20 + t);
fly[t] = eval ("fly" + t);
fly[t].type = 0;
fly[t].x = 0;
fly[t].y = 0;
fly[t].xvel = 0;
fly[t].yvel = 0;
fly[t].busy = "false";
fly[t].state = "inactive";
fly[t]._visible = false;
t++;
}
}
function SetBars() {
if (_parent.health < 0) {
_parent.health = 0;
} else if (100 < _parent.health) {
_parent.health = 100;
}
gui.bar._xscale = Math.floor(_parent.health);
gui.health = _parent.health;
gui.score = score;
gui.level = _parent.level + (5 * levelloops);
}
function ShowTip(txt) {
tip.tiptext = txt;
tip.gotoAndPlay(1);
}
function AnimTimer() {
tiptimer++;
if (25 < tiptimer) {
tipcount++;
tiptimer = 0;
if ((5 < tipcount) && (TIPmain == 0)) {
ShowTip("Click and drag the spider to move it around...");
TIPmain = 0.1;
} else if ((10 < tipcount) && (TIPmain == 1)) {
ShowTip("You can make it jump by pulling it down and releasing the mousebutton.");
TIPmain = 1.1;
} else if ((15 < tipcount) && (TIPmain == 2)) {
ShowTip("try to jump up and catch some of the insects");
TIPmain = 2.1;
} else if (((20 < tipcount) && (TIPmain == 3)) && (TIPjumphigh == false)) {
ShowTip("You can Jump even higher by pulling down and releasing quickly..");
TIPmain = 3.1;
}
}
if (FREEZE) {
freezeCount++;
if (7 < FreezeCount) {
FREEZE = false;
FreezeCount = 0;
}
}
AdminCount++;
if (5 < AdminCount) {
AdminCount = 0;
SpiderAdmin();
}
if (JustSHockedByID >= 0) {
if (ShockCount == 0) {
trace("in shock... ShockCount == " + ShockCount);
SmokeCount = 0;
puffit = 0;
NbPuffs = 0;
}
ShockCount++;
if (9 < ShockCount) {
ShockCount = 0;
JustSHockedByID = -5;
}
}
if (SmokeCount < 25) {
if (puffit == 0) {
puffit = 0;
this.attachMovie("smoke", "puff" + NbPuffs, NbPuffs + 555);
setProperty("puff" + NbPuffs, _x , body._x);
setProperty("puff" + NbPuffs, _y , body._y);
NbPuffs++;
}
SmokeCount++;
}
}
function GetY(Xval) {
var id = 0;
var t = 1;
while (NbGs >= t) {
if (Xval < Gs[t + 1].x) {
id = t;
t = 100;
}
t++;
}
result = Gs[id].y + (((Xval - Gs[id].x) * (Gs[id + 1].y - Gs[id].y)) / (Gs[id + 1].x - Gs[id].x));
return(result);
}
function ShockLegs() {
var t = 0;
while (t < NbLegs) {
with (eval (("lin" + t) + "a")) {
gotoAndPlay(random(2) + 1);
}
with (eval (("lin" + t) + "b")) {
gotoAndPlay(random(2) + 1);
}
t++;
}
}
function AdjustBodyHeight() {
var accum = 0;
var t = 0;
while (t < NbLegs) {
accum = accum + leg[t].end.y;
t++;
}
BodyNeutralY = (accum / NbLegs) - BodyOffsetY;
JumpTrigger = BodyNeutralY + 15;
}
function HitTestFly(id) {
if (fly[id].hitTest(body)) {
if ((state == "falling") || (state == "jumping")) {
if (TIPmain < 3) {
if (TIPmain == 2.1) {
ShowTip("Exactly..");
}
TIPmain = 3;
}
HiMod = Math.ceil((FYmax - body._y) / 100);
if (HiMod < 1) {
HiMod = 1;
}
CatchFly(id);
} else if ((state == "free") || (state == "drag")) {
if ((((fly[id].type == "type5") || (fly[id].type == "type6")) || (fly[id].type == "type12")) || (fly[id].type == "type13")) {
CatchFly(id);
} else {
body.gotoAndStop("openR");
body.AnimState = "openR";
if (3 < body.MouthOpenCount) {
CatchFly(id);
if (body.flyInMouthType != "type5") {
EatFly();
}
}
body.MouthOpenCount++;
}
}
}
}
function CatchFly(id) {
if (fly[id].type == "type1") {
fly[id]._visible = false;
fly[id].state = "inactive";
body.gotoAndStop("gotit" + fly[id].type);
body.AnimState = "gotit";
trace("GOT THE GODDAMN FLY!!!!");
body.flyInMouthType = fly[id].type;
SetPoint(55 * HiMod);
} else if (fly[id].type == "type2") {
fly[id]._visible = false;
fly[id].state = "inactive";
body.gotoAndStop("gotit" + fly[id].type);
body.AnimState = "gotit";
trace("GOT THE GODDAMN FLY!!!!");
body.flyInMouthType = fly[id].type;
SetPoint(65 * HiMod);
} else if (fly[id].type == "type3") {
fly[id]._visible = false;
fly[id].state = "inactive";
body.gotoAndStop("gotit" + fly[id].type);
body.AnimState = "gotit";
trace("GOT THE GODDAMN FLY!!!!");
body.flyInMouthType = fly[id].type;
SetPoint(100 * HiMod);
} else if (fly[id].type == "type4") {
fly[id].skin.play();
body.gotoAndStop("gotit" + fly[id].type);
body.AnimState = "gotit";
trace("GOT THE GODDAMN FLY!!!!");
body.flyInMouthType = fly[id].type;
fly[id].yvel = -25;
fly[id].xvel = fly[id].xvel + (12 * fly[id].dir);
SetPoint(30 * HiMod);
} else if (fly[id].type == "type5") {
if (JustSHockedByID != id) {
FREEZE = true;
body.gotoAndStop("shock");
JustSHockedByID = id;
body.AnimState = "shock";
trace("GOT SHOCKED by firefly.....");
SYvel = 5;
_parent.Health = _parent.Health - 55;
}
} else if (fly[id].type == "type6") {
if (JustSHockedByID != id) {
FREEZE = true;
body.gotoAndStop("shock");
JustSHockedByID = id;
body.AnimState = "shock";
trace("GOT SHOCKED by FAST firefly.....");
_parent.Health = _parent.Health - 33;
}
} else if (fly[id].type == "type7") {
fly[id]._visible = false;
fly[id].state = "inactive";
body.gotoAndStop("gotit" + fly[id].type);
body.AnimState = "gotit";
trace("GOT THE GODDAMN FLY!!!!");
body.flyInMouthType = fly[id].type;
SetPoint(30 * HiMod);
} else if ((fly[id].type == "type12") || (fly[id].type == "type13")) {
if (JustSHockedByID != id) {
FREEZE = true;
body.gotoAndStop("shock");
JustSHockedByID = id;
body.AnimState = "shock";
trace("GOT SHOCKED by FAST firefly.....");
_parent.Health = _parent.Health - 33;
}
}
}
function EatFly() {
var id = (substring(body.flyInMouthType, 5, 1));
body.gotoAndStop("eat" + id);
body.AnimState = "eat";
trace("eating the fly with id:" + id);
_parent.health = _parent.health + 4;
}
function DoFlys() {
fcount++;
if (40 < fcount) {
if (0.97 < Math.random()) {
createFly();
fcount = 0;
}
}
if (fstate == "buzz") {
var t = 0;
while (t < nbFlys) {
if (fly[t].state != "inactive") {
HitTestFly(t);
UpdateFly(t);
}
t++;
}
}
}
function createFly() {
var f = -5;
var t = 0;
while (t < NbFlys) {
if (fly[t].state == "inactive") {
f = t;
}
t++;
}
if ((f >= 0) && (FlyCount < NbFlysInLevel)) {
FlyCount++;
fly[f].type = GetRandomFlyType();
fly[f].dir = 1;
fly[f]._x = FxMin - 100;
if (FlyCount == NbFlysInLevel) {
if (_parent.level == 1) {
_parent.level++;
FlyCount = 0;
SetRandomFlyTypeChances(6, 8, 5, 4, 5, 3, 8, 0, 5);
} else if (_parent.level == 2) {
_parent.level++;
FlyCount = 0;
SetRandomFlyTypeChances(2, 8, 5, 8, 5, 2, 4, 13, 0);
} else if (_parent.level == 3) {
_parent.level++;
FlyCount = 0;
SetRandomFlyTypeChances(5, 2, 5, 2, 5, 11, 11, 22, 5);
} else if (_parent.level == 4) {
_parent.level++;
FlyCount = 0;
SetRandomFlyTypeChances(1, 0, 5, 0, 5, 6, 6, 6, 0);
} else if (_parent.level == 5) {
_parent.level = 1;
LevelLoops++;
FlyCount = 0;
SetRandomFlyTypeChances(6, 8, 5, 4, 5, 6, 0, 0, 0);
}
} else if (0.5 < Math.random()) {
fly[f].dir = -1;
fly[f]._x = FxMax + 100;
}
fly[f].gotoAndStop(fly[f].type);
trace("creating fly");
fly[f]._xscale = 100 * fly[f].dir;
fly[f]._y = (((Math.random() + Math.random()) / 2) * (FyMax - FyMin)) + FyMin;
fly[f].xvel = 12 * fly[f].dir;
fly[f].yvel = 0;
fly[f].Xacc = 0;
fly[f].Yacc = 0;
fly[f].state = "fly";
fly[f].statecount = 0;
fly[f].fspeed = 3 * fly[f].dir;
fstate = "buzz";
fly[f]._visible = true;
}
}
function SetRandomFlyTypeChances(red, mosq, tiny, biig, fire, fire1, fire2, fire3, but) {
Chance = new Array(9);
TypeName = new Array(9);
Chance[0] = red;
TypeName[0] = "type1";
Chance[1] = mosq;
TypeName[1] = "type2";
Chance[2] = tiny;
TypeName[2] = "type3";
Chance[3] = biig;
TypeName[3] = "type4";
Chance[4] = fire;
TypeName[4] = "type5";
Chance[5] = fire1;
TypeName[5] = "type6";
Chance[6] = fire2;
TypeName[6] = "type12";
Chance[7] = fire3;
TypeName[7] = "type13";
Chance[8] = but;
TypeName[8] = "type7";
}
function GetRandomFlyType() {
var accum = 0;
var t = 0;
while (t < 9) {
accum = accum + Chance[t];
t++;
}
var rand = (Math.random() * accum);
accum = 0;
var t = 0;
while (t < 9) {
if ((accum < rand) && (rand < (accum + Chance[t]))) {
var typen = TypeName[t];
t = 10;
}
accum = accum + Chance[t];
t++;
}
trace("random fidus returnere : " + typen);
return(typen);
}
function AttachWeb() {
web._visible = true;
}
function DetachWeb() {
web._visible = false;
web._x = -400;
}
function Expression() {
if (state == "drag") {
body.eyes.pupils._X = pupOffX + ((this._xMouse - body._x) / 30);
}
}
function GrabSpider() {
if ((state == "dead") && (deadcount >= 70)) {
ReviveSpider();
} else if ((state != "dead") && (state != "dying")) {
if (TIPmain < 1) {
if (TIPmain == 0.1) {
ShowTip("Yup... Thats it.");
}
TIPmain = 1;
}
state = "drag";
AttachWeb();
}
}
function Solve() {
AnimTimer();
Expression();
AdjustBodyHeight();
MoveBody();
updateLegs();
setBars();
if ((state != "dead") && (state != "dying")) {
if (0 >= _parent.health) {
KillSpider();
}
MoveFeet();
}
DoFlys();
var t = 0;
while (t < Nblegs) {
with (leg[t]) {
var dir = new O_Vector();
var DirVecN = new O_Vector();
var Knee = new O_Vector();
var heel = new O_Vector();
dir.x = end.x - hip.x;
dir.y = end.y - hip.y;
DirVecN = Normalize_V(dir);
dist = DistPoints(hip.x, hip.y, end.x, end.y);
if (dist >= (2 * len)) {
var kneex = (hip.x + (DirVecN.x * len));
var kneey = (hip.y + (DirVecN.y * len));
var heelx = (hip.x + ((DirVecN.x * len) * 2));
var heely = (hip.y + ((DirVecN.y * len) * 2));
} else {
var midx = (hip.x + (Dir.x / 2));
var midy = (hip.y + (Dir.y / 2));
var heelx = end.x;
var heely = end.y;
var Ldist = (dist / 2);
var OffDist = Math.sqrt((len * Len) - (Ldist * Ldist));
var kneex = (midx + ((DirVecN.y * OffDist) * side));
var kneey = (midy - ((DirVecN.x * OffDist) * side));
}
setProperty(("lin" + t) + "a", _x , hip.x);
setProperty(("lin" + t) + "a", _y , hip.y);
setProperty(("lin" + t) + "a", _xscale , kneex - hip.x);
setProperty(("lin" + t) + "a", _yscale , kneey - hip.y);
setProperty(("lin" + t) + "b", _x , kneex);
setProperty(("lin" + t) + "b", _y , kneey);
setProperty(("lin" + t) + "b", _xscale , heelx - kneex);
setProperty(("lin" + t) + "b", _yscale , heely - kneey);
}
t++;
}
}
function MoveFeet() {
var t = 0;
while (t < NbLegs) {
with (leg[t]) {
if (state == "moved") {
state = "resting";
end.y = GetY(end.x);
}
if (state == "up") {
state = "moved";
end.x = body._x + (side * (40 + (Math.random() * 105)));
}
var Spread = (end.x - body._x);
var AbsSpread = Math.abs(Spread);
if (state == "resting") {
if (side == 1) {
if (SpreadMax < Spread) {
state = "up";
end.y = end.y - (2 + (Math.random() * 11));
} else if (Spread < SpreadMin) {
state = "up";
end.y = end.y - (2 + (Math.random() * 11));
}
} else if (side == -1) {
if (Spread < (-SpreadMax)) {
state = "up";
end.y = end.y - (2 + (Math.random() * 11));
} else if ((-SpreadMin) < Spread) {
state = "up";
end.y = end.y - (2 + (Math.random() * 11));
}
}
}
}
t++;
}
}
function MouseRelease() {
if (state == "drag") {
DetachWeb();
if (readytojump) {
Jump();
} else {
state = "free";
}
}
}
function Jump() {
if (TIPmain < 2) {
if (TIPmain == 1.1) {
ShowTip("you got it...");
}
TIPmain = 2;
}
state = "jumping";
var tmpBod_Y = body._y;
SYvel = -80 - (3 * (tmpBod_Y - Jumptrigger));
if (SYvel < -160) {
SYvel = -160;
}
SXacc = SXacc * 2;
}
function EatBounce() {
SYvel = SYvel - 55.5;
}
function XBounce(val) {
trace("xbouncing : " + val);
SXvel = SXvel + val;
}
function SpitRed(val) {
redSpit._visible = true;
redspit._x = body._x;
redspit._y = body._y;
}
function MoveBody() {
MaxXacc = 14;
MaxSYMacc = 10;
if (state == "drag") {
musseX = this._xMouse;
if (musseX < (FXmin + 170)) {
musseX = FXmin + 170;
} else if ((FXmax - 170) < musseX) {
musseX = FXmax - 170;
}
SXacc = (musseX - body._x) / 30;
if (MaxXacc < SXacc) {
SXacc = MaxXacc;
}
SXvel = (SXvel * 0.8) + SXacc;
body._x = body._x + SXvel;
var delta = (this._yMouse - body._y);
if (0 < delta) {
delta = delta * 8;
}
SYMacc = delta / 20;
if (MaxSYMacc < SYMacc) {
SYMacc = MaxSYMacc;
}
SYspring = (BodyNeutralY - body._y) * 0.32;
SYvel = ((SYvel * 0.83) + SYMacc) + SYspring;
body._y = body._y + SYvel;
if (JumpTrigger < body._y) {
readytojump = true;
body.eyes.gotoAndPlay("readytojump");
} else {
readytojump = false;
}
setProperty("web", _x , body._x);
setProperty("web", _y , body._y);
setProperty("web", _xscale , this._xmouse - body._x);
setProperty("web", _yscale , this._ymouse - body._y);
} else if ((state == "jumping") && (!FREEZE)) {
SXacc = SXacc * 0.9;
SXvel = (SXvel * 0.8) + SXacc;
body._x = body._x + SXvel;
SYMacc = 14;
SYvel = SYvel + SYMacc;
body._y = body._y + SYvel;
if (0 < SYvel) {
if (body._y < (FYmin - 50)) {
TIPjumphigh = true;
}
state = "falling";
readytojump = false;
}
} else if ((state == "falling") && (!FREEZE)) {
SXacc = SXacc * 0.9;
SXvel = (SXvel * 0.8) + SXacc;
body._x = body._x + SXvel;
SYMacc = 33;
SYvel = SYvel + SYMacc;
body._y = body._y + SYvel;
if ((BodyNeutralY - 0) < body._y) {
_parent.sound.efx.gotoAndPlay("land");
state = "free";
if (body.AnimState == "gotit") {
eatfly();
} else if (body.AnimState == "shock") {
} else {
body.gotoAndStop(1);
body.eyes.gotoAndPlay(1);
}
}
} else if ((state == "free") && (!FREEZE)) {
SXacc = SXacc * 0.9;
SXvel = (SXvel * 0.8) + SXacc;
body._x = body._x + SXvel;
SYMacc = SYMacc * 0.8;
SYspring = (BodyNeutralY - body._y) * 0.32;
SYvel = ((SYvel * 0.53) + SYMacc) + SYspring;
body._y = body._y + SYvel;
if (Math.random() < 0.03) {
SXacc = (Math.random() - 0.5) * 25;
}
if (Math.random() < 0.023) {
BodyOffsetY = 30 + (Math.random() * 15);
}
if (body._x < (FXmin + 80)) {
SXacc = 5;
}
if ((FXmax - 80) < body._x) {
SXacc = -5;
}
} else if (state == "dying") {
tmpGy = gety(body._x);
if (tmpGy < body._y) {
body._y = tmpGy;
SYvel = (-Syvel) * 0.92;
if ((Math.abs(SYvel) + Math.abs(SXvel)) < 21) {
state = "dead";
body.gotoAndStop("dead");
}
} else {
SXacc = SXacc * 0.9;
SXvel = (SXvel * 0.8) + SXacc;
body._x = body._x + SXvel;
Grav = 20;
SYvel = (SYvel * 0.93) + Grav;
body._y = body._y + SYvel;
}
} else if (state == "dead") {
deadcount++;
if (deadcount == 70) {
SpiderLivesUsed++;
ShowTip(("Click the spider or press spacebar revive it.. you now have " + (TotalLives - SpiderLivesUsed)) + " lifes left ");
if (TotalLives == SpiderLivesUsed) {
_parent.score = score;
_parent.gotoAndPlay("GameOver");
}
}
} else {
trace(("error.state not reckognized: '" + state) + "'");
}
if (!readytojump) {
if (0.95 < Math.random()) {
body.eyes.play();
}
}
}
function KillSpider() {
state = "dying";
body.gotoAndStop("dying");
DetachWeb();
}
function OpenMouth() {
if ((state != "drag") && (state != "free")) {
if (SXvel >= 0) {
body.gotoAndStop("openR");
} else {
body.gotoAndStop("openL");
}
}
}
function UpdateLegs() {
var t = 0;
while (t < NbLegs) {
with (leg[t]) {
hip.x = Off.x + body._x;
hip.y = Off.y + body._y;
}
t++;
}
}
function DistPoints(x1, y1, x2, y2) {
var tmp1 = ((x1 - x2) * (x1 - x2));
var tmp2 = ((y1 - y2) * (y1 - y2));
var result = Math.sqrt(tmp1 + tmp2);
return(result);
}
function Normalize(x, y) {
var result = new O_Vector();
var len = Math.sqrt((x * x) + (y * y));
result.x = x / len;
result.y = y / len;
return(result);
}
function Normalize_V(v) {
var result = new O_Vector();
var len = Math.sqrt((v.x * v.x) + (v.y * v.y));
result.x = v.x / len;
result.y = v.y / len;
return(result);
}
function O_Vector(X, Y) {
this.X = X;
this.Y = Y;
}
function Subtract(Avec, Bvec) {
Result = new O_vector();
Result.x = Avec.x - Bvec.x;
Result.y = Avec.y - Bvec.y;
return(Result);
}
this._quality = "medium";
GameMainInit();
Symbol 398 MovieClip Frame 5
stop();
init();
Symbol 406 Button
on (press) {
submitButtonClicked();
gotoAndStop (17);
}
Symbol 411 Button
on (press) {
_parent.gotoAndStop("splash");
}
Symbol 413 MovieClip Frame 3
stop();
Symbol 413 MovieClip Frame 16
var nametxt = _parent.userData.nickname;
trace("UserScore is still = " + UserScore);
var scoretxt = UserScore;
stop();