Symbol 23 MovieClip [waterRing] Frame 1
#initclip 23
Object.registerClass("waterRing", com.king.animalathletes.WaterRing);
#endinitclip
Symbol 65 MovieClip [GolfEvent] Frame 1
#initclip 18
Object.registerClass("GolfEvent", com.king.animalathletes.GolfEvent);
#endinitclip
Symbol 153 MovieClip [DownhillEvent] Frame 1
#initclip 19
Object.registerClass("DownhillEvent", com.king.animalathletes.DownhillEvent);
#endinitclip
Symbol 200 MovieClip [PenguinJumpEvent] Frame 1
#initclip 20
Object.registerClass("PenguinJumpEvent", com.king.animalathletes.PenguinJumpEvent);
#endinitclip
Symbol 250 MovieClip Frame 25
stop();
Symbol 252 MovieClip Frame 25
stop();
Symbol 254 MovieClip Frame 25
stop();
Symbol 255 MovieClip Frame 1
stop();
Symbol 258 MovieClip [IceJumpEvent] Frame 1
#initclip 21
Object.registerClass("IceJumpEvent", com.king.animalathletes.IceJumpEvent);
#endinitclip
Symbol 279 Button
on (press) {
_root.gamePanel.endGame();
}
Symbol 281 MovieClip Frame 1
onEnterFrame();
gotoAndStop(_parent.currentState);
Symbol 281 MovieClip Frame 2
onEnterFrame();
gotoAndStop(_parent.currentState);
Symbol 282 Button
on (press) {
_root.gamePanel.toggleSound();
}
Symbol 417 MovieClip Frame 1
stop();
Symbol 418 MovieClip [gamePanel] Frame 1
#initclip 22
Object.registerClass("gamePanel", com.king.animalathletes.GamePanel);
#endinitclip
Symbol 421 MovieClip [__Packages.com.king.animalathletes.Event] Frame 0
class com.king.animalathletes.Event extends MovieClip
{
function Event () {
super();
}
function tick(tick) {
}
function render(tick, alpha) {
}
function init(communicator, seed) {
}
}
Symbol 422 MovieClip [__Packages.com.king.animalathletes.GolfEvent] Frame 0
class com.king.animalathletes.GolfEvent extends com.king.animalathletes.Event
{
var communicator, nextSeed, round, scores, bestScore, random, decoder, nextTick, xBall, xBallA, xBallI, yBall, yBallA, yBallI, rBallI, xBallAI, timeLeft, mouseDown, _parent, bgItemPos, launchTime, launchTime2, fireTime, doGameOver, jumpClicks, jumping, gameTick, encoder, clickDelay, _xmouse, _ymouse, clickAlpha, alpha, nextRoundIn, gameOverTime, bgItem, launcher, ball, batter, shadow;
function GolfEvent () {
super();
}
function init(communicator, seed) {
this.communicator = communicator;
nextSeed = seed;
round = -1;
scores = new Array("--", "--", "--", "--", "--");
bestScore = 0;
nextRound();
}
function nextRound() {
random = new com.midasplayer.util.Random(nextSeed);
nextSeed = random.nextInt(10000000);
if (REPLAY_MODE) {
decoder = new com.king.animalathletes.Decoder(PLAYBACK_DATA);
nextTick = decoder.next();
}
round++;
xBall = 0;
xBallA = 0;
xBallI = new com.midasplayer.timing.IFloat();
yBall = 0;
yBallA = 0;
yBallI = new com.midasplayer.timing.IFloat();
rBallI = new com.midasplayer.timing.IRotFloat();
xBallAI = new com.midasplayer.timing.IFloat();
timeLeft = TIME_PER_ROUND;
mouseDown = false;
_parent.popup._visible = false;
bgItemPos = 0;
launchTime = 0;
launchTime2 = 0;
fireTime = 0;
doGameOver = false;
jumpClicks = 2;
jumping = false;
gameTick = 0;
encoder = new com.king.animalathletes.Encoder();
clickDelay = -1;
}
function onMouseDown() {
if (((((!REPLAY_MODE) && (_xmouse >= 0)) && (_ymouse >= 0)) && (_xmouse < 500)) && (_ymouse < 500)) {
if ((((xBall == 0) && (timeLeft > 0)) && (launchTime == 0)) && (launchTime2 == 0)) {
clickDelay = getTimer() + (Math.random() * 500);
launchTime2 = 1;
} else if (clickDelay == 0) {
mouseDown = true;
clickAlpha = Math.floor(alpha * 256) << 0;
}
}
}
function tick(tick) {
_parent.hider._visible = false;
var _local5 = (((-Math.atan2(_xmouse - 410, _ymouse - 370)) * 180) / Math.PI) - 90;
if (_local5 < -180) {
_local5 = 90;
}
if (_local5 < 20) {
_local5 = 20;
}
_local5 = Math.floor((_local5 + 90) * 20) << 0;
if (((timeLeft > 0) && (xBall == 0)) && (xBallA == 0)) {
timeLeft--;
if (timeLeft == 0) {
setGameOver(_global.textMappings.out_of_time);
}
}
while (REPLAY_MODE && (nextTick == gameTick)) {
var _local4 = decoder.nextShort();
if (_local4 == 0) {
mouseDown = true;
clickAlpha = decoder.next();
}
if (_local4 == 1) {
_local5 = decoder.next();
}
nextTick = decoder.next();
}
if (mouseDown) {
encoder.append(gameTick);
encoder.appendShort(0);
encoder.append(clickAlpha);
}
if (mouseDown && (timeLeft > 0)) {
if (((xBall != 0) && (jumpClicks > 0)) && (!jumping)) {
if ((yBall < 50) && (yBallA < 0)) {
jumping = true;
}
jumpClicks--;
}
}
xBall = xBall + xBallA;
yBall = yBall + yBallA;
yBallA = yBallA - 2;
if (yBall < 0) {
var _local12 = xBallA == 0;
yBall = 0;
if (jumping) {
xBallA = xBallA * 0.9;
yBallA = yBallA * -0.9;
jumping = false;
if (xBallA != 0) {
com.king.animalathletes.Sounds.get("BounceSound").play();
}
} else {
xBallA = xBallA * 0.8;
yBallA = yBallA * -0.4;
}
yBallA = yBallA - 8;
if (((!_local12) && (Math.abs(xBallA) < 0.1)) && (xBall != 0)) {
xBallA = 0;
setGameOver(_global.textMappings.won);
}
}
if (launchTime > 0) {
launchTime++;
}
if (launchTime2 > 0) {
launchTime2++;
}
if (fireTime > 0) {
fireTime++;
if (((fireTime == 3) && (xBall == 0)) && (timeLeft > 0)) {
encoder.append(gameTick);
encoder.appendShort(1);
encoder.append(_local5);
var _local9 = (_local5 / 20) - 90;
var _local10 = ((_local9 * 130) / 90) - 20;
var _local11 = 40;
var _local8 = yBall + ((yBallA * clickAlpha) / 256);
if ((_local8 > (_local10 - _local11)) && (_local8 < (_local10 + _local11))) {
com.king.animalathletes.Sounds.get("FlySound").play();
var _local6 = Math.abs((_local8 - _local10) / _local11);
_local6 = 1 - (_local6 * _local6);
xBallA = ((-Math.cos((_local9 * Math.PI) / 180)) * 50) * _local6;
yBallA = (Math.sin((_local9 * Math.PI) / 180) * 50) * _local6;
}
} else if (fireTime == 5) {
fireTime = 0;
launchTime = 0;
launchTime2 = 0;
}
}
if ((mouseDown && (xBall == 0)) && (timeLeft > 0)) {
if (launchTime == 0) {
launchTime = 1;
if ((yBall < 20) && (xBall == 0)) {
yBallA = 25;
com.king.animalathletes.Sounds.get("PloppSound").play();
}
} else if (fireTime == 0) {
com.king.animalathletes.Sounds.get("SwishSound").play();
fireTime = 1;
}
}
xBallAI.set((xBallAI.get(1) * 0.95) + (xBallA * 0.05));
xBallI.set(xBall);
yBallI.set(yBall);
if (yBall == 0) {
rBallI.set((Math.atan2(xBallA - 5, yBallA + 3.2) * 180) / Math.PI);
} else {
rBallI.set((Math.atan2(xBallA - 5, yBallA) * 180) / Math.PI);
}
_parent.timeText.text = (_global.textMappings.time_left + ": ") + Math.floor((timeLeft + 19) / 20);
var _local7 = Math.floor((-xBall) / 2);
_parent.scoreText.text = (_global.textMappings.score + ": ") + _local7;
_parent.miscText.text = (_global.textMappings.distance + ": ") + Math.floor((-xBall) / 20);
if (doGameOver) {
_root.debugText.text = encoder.res;
doGameOver = false;
if (bestScore < _local7) {
bestScore = _local7;
}
scores[round] = _local7;
communicator.sendEventData(encoder.res, _local7);
com.king.animalathletes.Sounds.get("EventOverSound").play();
var _local17 = _global.textMappings.attempt_num.split("{0}").join("1");
var _local16 = _global.textMappings.attempt_num.split("{0}").join("2");
var _local15 = _global.textMappings.attempt_num.split("{0}").join("3");
var _local14 = _global.textMappings.attempt_num.split("{0}").join("4");
var _local13 = _global.textMappings.attempt_num.split("{0}").join("5");
_parent.popup.attemptNameTexts.text = (((((((_local17 + newline) + _local16) + newline) + _local15) + newline) + _local14) + newline) + _local13;
_parent.popup.attemptScoreTexts.text = (((((((scores[0] + newline) + scores[1]) + newline) + scores[2]) + newline) + scores[3]) + newline) + scores[4];
_parent.popup.bestScoreText.text = _global.textMappings.best_score;
_parent.popup.bestScore.text = bestScore;
_parent._parent.setScore(2, bestScore);
}
if (mouseDown || (getTimer() > nextRoundIn)) {
if ((((xBallA == 0) && (xBall != 0)) || (timeLeft == 0)) && ((getTimer() - gameOverTime) > 500)) {
com.king.animalathletes.Sounds.get("EventOverSound").stop();
if (round < 4) {
nextRound();
} else {
_parent._parent.nextEvent();
}
return(undefined);
}
}
mouseDown = false;
gameTick++;
}
function setGameOver(reason) {
nextRoundIn = getTimer() + 5000;
gameOverTime = getTimer();
doGameOver = true;
_parent.popup._visible = true;
_parent.popup.gotoAndStop(2);
_parent.popup.titleText.text = reason;
}
function onPress() {
}
function render(tick, alpha) {
if ((clickDelay > 0) && (getTimer() > clickDelay)) {
clickDelay = 0;
mouseDown = true;
clickAlpha = Math.floor(alpha * 256) << 0;
}
this.alpha = alpha;
var _local2 = ((-xBallI.get(alpha)) * 0.95) + (xBallAI.get(alpha) * 2);
while ((bgItemPos + _local2) > 1000) {
bgItemPos = bgItemPos - 1000;
}
bgItem._x = bgItemPos + _local2;
launcher._x = 317 + _local2;
launcher.spring.gotoAndStop(launchTime + 1);
ball.gotoAndStop(((yBall != 0) ? 2 : 1));
ball._x = (340 + xBallI.get(alpha)) + _local2;
ball._y = (440 - yBallI.get(alpha)) - 8;
ball._rotation = (((yBall != 0) && (xBall != 0)) ? (rBallI.get(alpha) + 90) : 0);
var _local4 = (((-Math.atan2(_xmouse - 410, _ymouse - 370)) * 180) / Math.PI) - 90;
if (_local4 < -180) {
_local4 = 90;
}
if (_local4 < 20) {
_local4 = 20;
}
batter._x = 380 + _local2;
batter._y = 350;
batter.head._rotation = _local4;
if (fireTime == 0) {
batter.head.trunk.gotoAndStop(Math.max(6 - launchTime2, 1));
} else {
batter.head.trunk.gotoAndStop(Math.min(Math.floor((fireTime + alpha) * 2), 7));
}
shadow._x = (340 + xBallI.get(alpha)) + _local2;
shadow._y = 445;
shadow._alpha = 25 - (yBallI.get(alpha) / 40);
shadow._xScale = 80 - (yBallI.get(alpha) / 8);
shadow._yScale = 80 - (yBallI.get(alpha) / 8);
}
static var PLAYBACK_DATA = "700z0S00U0U01#jA1073n10A0";
static var REPLAY_MODE = false;
static var TIME_PER_ROUND = 100;
}
Symbol 423 MovieClip [__Packages.com.midasplayer.util.Random] Frame 0
class com.midasplayer.util.Random
{
var mta, mti, lastSeed;
function Random (aSeed) {
mta = new Array(N);
mti = N + 1;
if (aSeed != undefined) {
init_genrand(aSeed);
}
}
function set seed(s) {
init_genrand(s);
//return(seed);
}
function get seed() {
return(lastSeed);
}
function nextInt(n) {
return((genrand_int32() & 2147483647) % n);
}
function nextFloat() {
return(next(24) / 16777216);
}
function nextDouble() {
return(next(24) / 16777216);
}
function next(bits) {
if (bits < 32) {
return(genrand_int32() & ((1 << bits) - 1));
}
return(genrand_int32());
}
function init_genrand(s) {
s = int(s);
trace("Random::init_genrand(): seed=" + s);
var _local5 = getTimer();
lastSeed = s;
mta[0] = s;
var _local2 = s;
var _local3 = new com.midasplayer.util.Integer64();
mti = 1;
while (mti < N) {
_local3.init32((_local2 >>> 30) ^ _local2);
_local3.mulu32(1812433253);
_local2 = (mta[mti] = int(_local3.lsb + mti));
mti++;
}
var _local6 = getTimer();
trace(("Random::init_genrand(): initialization ~" + (_local6 - _local5)) + "ms");
}
function genrand_int32() {
var _local3 = 0;
if (mti >= N) {
if (mti == (N + 1)) {
init_genrand(5489);
}
var _local4 = getTimer();
var _local2 = 0;
_local2 = 0;
while (_local2 < (N - M)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + M] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
while (_local2 < (N - 1)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + (M - N)] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
_local3 = (mta[N - 1] & UPPER_MASK) | (mta[0] & LOWER_MASK);
mta[N - 1] = (mta[M - 1] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
mti = 0;
var _local5 = getTimer();
trace(((("Random::genrand_int32(): precalc " + N) + " new numbers ~") + (_local5 - _local4)) + "ms");
}
_local3 = mta[mti++];
_local3 = _local3 ^ (_local3 >>> 11);
_local3 = _local3 ^ ((_local3 << 7) & 2636928640);
_local3 = _local3 ^ ((_local3 << 15) & 4022730752);
_local3 = _local3 ^ (_local3 >>> 18);
return(_local3);
}
static var N = 624;
static var M = 397;
static var MATRIX_A = 2567483615;
static var UPPER_MASK = 2147483648;
static var LOWER_MASK = 2147483647;
static var mag01 = [0, 2567483615];
}
Symbol 424 MovieClip [__Packages.com.midasplayer.util.Integer64] Frame 0
class com.midasplayer.util.Integer64
{
var r, p, s;
function Integer64 (lowInt) {
r = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]];
p = [0, 0, 0, 0, 0];
s = [0, 0, 0];
if (lowInt != undefined) {
merge(lowInt);
}
}
function init(v) {
var _local2 = 0;
while (_local2 < p.length) {
p[_local2] = v.p[_local2];
_local2++;
}
}
function init32(n) {
p[0] = n & 32767;
n = n >>> 15;
p[1] = n & 32767;
n = n >>> 15;
p[2] = n & 3;
p[3] = 0;
p[4] = 0;
}
function get lsb() {
return((p[0] | (p[1] << SH)) | ((p[2] & 3) << 30));
}
function get msb() {
return((((p[2] >> 2) | ((p[3] << SH) >> 2)) | ((p[4] << (SH * 2)) >> 2)) & 2147483647);
}
function binaryShiftLeft(step) {
var _local2 = 0;
while (_local2 < step) {
shl();
_local2++;
}
}
function binaryShiftRight(step) {
var _local4 = (step / SH) >> 0;
var _local5 = step - (_local4 * SH);
var _local2 = p.length - 1;
while (_local2 > 0) {
var _local3 = 0;
while (_local3 < _local4) {
p[_local3] = p[_local3 + 1];
_local3++;
}
p[_local2--] = 0;
}
if (_local5 > 0) {
var _local3 = 0;
while (_local3 < _local5) {
shr();
_local3++;
}
}
}
function binaryNot(o) {
p[0] = p[0] ^ o.p[0];
p[1] = p[1] ^ o.p[1];
p[2] = p[2] ^ o.p[2];
p[3] = p[3] ^ o.p[3];
p[4] = p[4] ^ o.p[4];
}
function add64(o) {
var _local4 = 0;
var _local3 = 1;
var _local2 = 0;
while ((_local3 < p.length) && (o.p[_local2] != 0)) {
_local3++;
}
_local2 = 0;
while (_local2 < _local3) {
_local4 = _local4 + (p[_local2] + o.p[_local2]);
p[_local2] = _local4 & MASK;
_local4 = _local4 >> SH;
_local2++;
}
}
function add32(num) {
var _local2 = 0;
var _local5 = num & MASK;
num = num >> SH;
var _local6 = num & MASK;
num = num >> SH;
var _local4 = num & 3;
_local2 = _local2 + (p[0] + _local5);
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[1] + _local6);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[2] + _local4);
p[2] = _local2 & MASK;
}
function mulu32(num) {
var _local3 = 0;
s[0] = num & MASK;
num = num >>> 15;
s[1] = num & MASK;
num = num >>> 15;
s[2] = num & 3;
var _local2 = 0;
while (_local2 < 3) {
var _local4 = s[_local2];
_local3 = _local4 * p[0];
r[_local2][0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[1]);
r[_local2][1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[2]);
r[_local2][2] = _local3 & 3;
_local2++;
}
_local3 = r[0][0];
p[0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (r[0][1] + r[1][0]);
p[1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local3 & 3;
p[3] = 0;
p[4] = 0;
}
function mul64(o) {
var _local2 = 0;
var _local3 = 0;
while (_local3 < 5) {
var _local4 = o.p[_local3];
_local2 = _local4 * p[0];
r[_local3][0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[1]);
r[_local3][1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[2]);
r[_local3][2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[3]);
r[_local3][3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[4]);
r[_local3][4] = _local2 & MASK;
_local3++;
}
_local2 = r[0][0];
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (r[0][1] + r[1][0]);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (((r[0][3] + r[1][2]) + r[2][1]) + r[3][0]);
p[3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((((r[0][4] + r[1][3]) + r[2][2]) + r[3][1]) + r[4][0]);
p[4] = _local2 & 7;
}
function mul32(value) {
mul64(new com.midasplayer.util.Integer64(value));
}
function merge(a) {
var _local2 = 0;
while (_local2 < 3) {
p[_local2] = p[_local2] + (a & 32767);
a = a >>> 15;
_local2++;
}
return(a);
}
function shl() {
var _local5 = 0;
var _local4 = 0;
var _local2 = 0;
var _local3 = p.length;
while (_local2 < _local3) {
_local5 = (p[_local2] & 16384) >> 14;
p[_local2] = p[_local2] << 1;
p[_local2] = (p[_local2] | _local4) & 32767;
_local2++;
_local4 = _local5;
}
}
function shr() {
var _local4 = 0;
var _local3 = 0;
var _local2 = p.length - 1;
while (_local2 >= 0) {
_local4 = (p[_local2] & 1) << 14;
p[_local2] = p[_local2] >> 1;
p[_local2] = (p[_local2] | _local3) & 32767;
_local2--;
_local3 = _local4;
}
}
static var MASK = 32767;
static var SH = 15;
}
Symbol 425 MovieClip [__Packages.com.king.animalathletes.Decoder] Frame 0
class com.king.animalathletes.Decoder
{
var res, p;
function Decoder (res) {
this.res = res;
p = 0;
}
function next() {
var _local2 = BASE_64_CHARS.indexOf(res.charAt(p++));
_local2 = _local2 + (BASE_64_CHARS.indexOf(res.charAt(p++)) * 64);
return(_local2);
}
function nextShort(value) {
return(BASE_64_CHARS.indexOf(res.charAt(p++)));
}
static var BASE_64_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#!";
}
Symbol 426 MovieClip [__Packages.com.midasplayer.timing.IFloat] Frame 0
class com.midasplayer.timing.IFloat
{
var value, lastValue;
function IFloat (initial) {
if (initial == undefined) {
initial = 0;
}
value = initial;
lastValue = initial;
}
function resetTo(initial) {
value = initial;
lastValue = initial;
}
function set(newValue) {
lastValue = value;
value = newValue;
}
function get(alpha) {
return(lastValue + ((value - lastValue) * alpha));
}
}
Symbol 427 MovieClip [__Packages.com.midasplayer.timing.IRotFloat] Frame 0
class com.midasplayer.timing.IRotFloat extends com.midasplayer.timing.IFloat
{
var lastValue, value;
function IRotFloat () {
super();
}
function set(newValue) {
lastValue = value;
value = newValue;
value = value - (Math.floor((value + 180) / 360) * 360);
lastValue = lastValue + (Math.floor(((value - lastValue) + 180) / 360) * 360);
}
}
Symbol 428 MovieClip [__Packages.com.king.animalathletes.Encoder] Frame 0
class com.king.animalathletes.Encoder
{
var res;
function Encoder () {
res = "";
}
function append(value) {
res = res + BASE_64_CHARS.charAt(value % 64);
res = res + BASE_64_CHARS.charAt(value / 64);
}
function appendShort(value) {
res = res + BASE_64_CHARS.charAt(value);
}
static var BASE_64_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#!";
}
Symbol 429 MovieClip [__Packages.com.king.animalathletes.Sounds] Frame 0
class com.king.animalathletes.Sounds
{
static var globalSound;
var soundMc, sound;
function Sounds (ownerMc, soundName) {
var _local2 = ownerMc.getNextHighestDepth();
soundMc = ownerMc.createEmptyMovieClip("soundMcc" + _local2, _local2);
sound = new Sound(soundMc);
sound.attachSound(soundName);
}
static function get(resourceName) {
var _local2 = soundMap[resourceName];
if ((_local2 == undefined) || (_local2 == null)) {
_local2 = new com.king.animalathletes.Sounds(_root, resourceName);
soundMap[resourceName] = _local2;
}
return(_local2);
}
static function toggleSound() {
if (globalSound == undefined) {
globalSound = new Sound(_root);
}
soundOn = !soundOn;
globalSound.setVolume((soundOn ? 100 : 0));
}
function setVolume(volume) {
sound.setVolume(volume);
}
function playLooping() {
sound.start(0, 9999999);
}
function stopAndPlayOffs(offs) {
sound.stop();
sound.start(offs, 0);
}
function stopAndPlay() {
sound.stop();
sound.start(0);
}
function playOffs(offs) {
sound.start(offs, 0);
}
function play() {
sound.start(0);
}
function stop() {
sound.stop();
}
static var soundMap = new Object();
static var soundOn = true;
}
Symbol 430 MovieClip [__Packages.com.king.animalathletes.DownhillEvent] Frame 0
class com.king.animalathletes.DownhillEvent extends com.king.animalathletes.Event
{
var nextSeed, communicator, scores, round, bestScore, random, decoder, nextTick, mouseDown, canClick, xPos, xPosI, yPos, yPosA, yPosI, speed, speedI, slope, slopeI, accel, accelI, armRot, armRotI, friction, obstaclePos, slimed, animTime, baseScore, score, mouseVisible, mouseHidden, timeLeft, obstacle, player, frontPine, backPine1, backPine2, accuracyTime, gameTick, dieTime, encoder, doGameOver, _parent, currentSlideSound, _xmouse, _ymouse, accuracyMeter, animSpeed, nextRoundIn, gameOverTime, snow, pointer, shadow, goal, goalStop;
function DownhillEvent () {
super();
}
function init(communicator, seed) {
nextSeed = seed;
this.communicator = communicator;
scores = new Array("--", "--", "--");
round = -1;
bestScore = 0;
nextRound();
}
function nextRound() {
random = new com.midasplayer.util.Random(nextSeed);
nextSeed = random.nextInt(10000000);
round++;
if (REPLAY_MODE) {
decoder = new com.king.animalathletes.Decoder(PLAYBACK_DATA);
nextTick = decoder.next();
}
mouseDown = false;
canClick = false;
xPos = 0;
xPosI = new com.midasplayer.timing.IFloat();
yPos = 0;
yPosA = 0;
yPosI = new com.midasplayer.timing.IFloat();
speed = 0;
speedI = new com.midasplayer.timing.IFloat();
slope = 0;
slopeI = new com.midasplayer.timing.IFloat();
accel = 0;
accelI = new com.midasplayer.timing.IFloat();
armRot = 0;
armRotI = new com.midasplayer.timing.IRotFloat();
friction = 1;
obstaclePos = 300 + (random.nextDouble() * 200);
slimed = 0;
animTime = 0;
baseScore = 0;
score = 0;
mouseVisible = true;
mouseHidden = false;
timeLeft = TIME_PER_ROUND;
obstacle.gotoAndStop(Math.floor(Math.random() * 2) + 1);
player.gotoAndStop(1);
frontPine.gotoAndStop(Math.floor(Math.random() * 3) + 1);
backPine1.gotoAndStop(Math.floor(Math.random() * 3) + 1);
backPine2.gotoAndStop(Math.floor(Math.random() * 3) + 1);
frontPine.po = 0;
backPine1.po = 0;
backPine2.po = 0;
accuracyTime = getTimer() - 10000;
gameTick = 0;
dieTime = 0;
encoder = new com.king.animalathletes.Encoder();
doGameOver = false;
_parent.popup._visible = false;
currentSlideSound = -1;
}
function onMouseDown() {
if (((((!REPLAY_MODE) && (_xmouse >= 0)) && (_ymouse >= 0)) && (_xmouse < 500)) && (_ymouse < 500)) {
mouseVisible = true;
mouseDown = true;
}
}
function tick(tick) {
_parent.hider._visible = false;
if (REPLAY_MODE) {
if (nextTick == gameTick) {
mouseDown = !mouseDown;
}
}
if (((timeLeft > 0) && (slimed == 0)) && (xPos < LEVEL_LENGTH)) {
timeLeft--;
if (timeLeft == 0) {
gameOver(_global.textMappings.out_of_time);
die();
}
}
if (mouseDown) {
if ((((yPos <= 0) && (slimed == 0)) && (xPos < LEVEL_LENGTH)) && (timeLeft > 0)) {
var _local8 = false;
if (REPLAY_MODE) {
_local8 = decoder.nextShort() == 0;
nextTick = decoder.next();
} else {
var _local24 = player._x - _xmouse;
var _local14 = player._y - _ymouse;
_local8 = _local14 > -10;
}
encoder.append(gameTick);
if (_local8) {
encoder.appendShort(0);
com.king.animalathletes.Sounds.get("JumpSound2").play();
yPosA = 20;
mouseDown = false;
animTime = 0;
} else {
encoder.appendShort(1);
if ((((armRot + 20) < 65) && ((armRot + 20) > -65)) && (canClick)) {
var _local3 = (armRot + 20) / 65;
_local3 = Math.abs(_local3);
var _local5 = Math.floor(_local3 * 3.9);
if (_local5 > 2) {
_local5 = 2;
}
accuracyMeter.gotoAndStop(_local5 + 1);
com.king.animalathletes.Sounds.get("PowerSound" + _local5).play();
accuracyTime = getTimer();
_local3 = (_local3 * 0.5) + 0.5;
friction = friction * _local3;
canClick = false;
}
}
}
}
var _local16 = speed;
var _local17 = Math.tan((((Math.atan2(slope, 400) * 40) + 10) / 180) * Math.PI);
yPos = yPos + yPosA;
yPosA = yPosA - 3;
yPosA = yPosA * 0.95;
if (yPos <= 0) {
if (xPos < LEVEL_LENGTH) {
armRot = armRot + ((speed * 2) + 10);
} else {
armRot = (armRot * 0.5) + 20;
}
if (slimed > 0) {
speed = speed * (1 - (slimed / 200));
} else if (xPos >= LEVEL_LENGTH) {
speed = speed * 0.92;
} else {
speed = speed + _local17;
speed = speed * (1 - ((friction * 0.1) + 0.01));
}
yPos = 0;
yPosA = 0;
var _local11 = xPos - obstaclePos;
if (((((_local11 > -15) && (_local11 < 15)) && (slimed == 0)) && (xPos < LEVEL_LENGTH)) && (timeLeft > 0)) {
com.king.animalathletes.Sounds.get("OuchSound").play();
die();
gameOver(_global.textMappings.hit_obstacle);
}
} else {
armRot = (armRot * 0.5) + ((40 - (yPosA * 5)) * 0.5);
}
var _local18 = 1;
var _local12 = 0.008;
friction = (friction * (1 - _local12)) + (_local18 * _local12);
var _local19 = _local16 - speed;
accel = _local19 * 30;
if (slimed > 0) {
accel = dieTime * 4;
var _local10 = (Math.atan2(slope, 400) * 40) + 60;
if (accel > _local10) {
accel = _local10;
}
dieTime++;
}
var _local15 = xPos < LEVEL_LENGTH;
var _local13 = xPos < obstaclePos;
xPos = xPos + speed;
var _local20 = xPos < obstaclePos;
if ((((_local13 && (!_local20)) && (xPos < LEVEL_LENGTH)) && (slimed == 0)) && (timeLeft > 0)) {
baseScore = baseScore + JUMP_SCORE;
}
if (((_local15 && (xPos >= LEVEL_LENGTH)) && (slimed == 0)) && (timeLeft > 0)) {
var _local6 = ((timeLeft * SPEED_BONUS) / TIME_PER_ROUND) >> 0;
if (_local6 < 0) {
_local6 = 0;
}
baseScore = baseScore + _local6;
gameOver(_global.textMappings.won);
}
slope = xPos / SLOPE_FACTOR;
if (armRot > 180) {
armRot = armRot - 360;
canClick = true;
}
if (xPos > (obstaclePos + 100)) {
obstaclePos = obstaclePos + (300 + (random.nextDouble() * 300));
if (obstaclePos > (LEVEL_LENGTH - 100)) {
obstaclePos = obstaclePos + 1000;
}
obstacle.gotoAndStop(Math.floor(Math.random() * 2) + 1);
}
var _local4 = -1;
if (slimed > 0) {
player.gotoAndStop(4);
animSpeed = 1.5;
} else if (yPos <= 0) {
_local4 = Math.floor(speed / 2);
if (_local4 > 4) {
_local4 = 4;
}
player.gotoAndStop(((speed > 6) ? 2 : 1));
animSpeed = speed * 0.5;
} else {
player.gotoAndStop(3);
animSpeed = 1.5;
}
if (((timeLeft <= 0) || (slimed != 0)) || (xPos >= LEVEL_LENGTH)) {
_local4 = -1;
}
if (currentSlideSound != _local4) {
if (currentSlideSound >= 0) {
com.king.animalathletes.Sounds.get("SlideLoop" + currentSlideSound).stop();
}
currentSlideSound = _local4;
if (currentSlideSound >= 0) {
com.king.animalathletes.Sounds.get("SlideLoop" + currentSlideSound).playLooping();
}
}
animTime = animTime + animSpeed;
var _local7 = ((xPos * DISTANCE_BONUS) / LEVEL_LENGTH) >> 0;
if (_local7 > DISTANCE_BONUS) {
_local7 = DISTANCE_BONUS;
}
score = baseScore + _local7;
if (xPos > (LEVEL_LENGTH + 90)) {
xPos = LEVEL_LENGTH + 90;
}
xPosI.set(xPos);
yPosI.set(yPos);
speedI.set(speed);
slopeI.set(slope);
accelI.set(accel);
armRotI.set(armRot);
_parent.timeText.text = (_global.textMappings.time_left + ": ") + Math.floor((timeLeft + 19) / 20);
_parent.scoreText.text = (_global.textMappings.score + ": ") + score;
var _local9 = Math.floor((xPos * 100) / LEVEL_LENGTH);
if (_local9 > 100) {
_local9 = 100;
}
_parent.miscText.text = ((_global.textMappings.distance + ": ") + _local9) + "%";
gameTick++;
if (doGameOver) {
if (bestScore < score) {
bestScore = score;
}
scores[round] = score;
doGameOver = false;
communicator.sendEventData(encoder.res, score);
com.king.animalathletes.Sounds.get("EventOverSound").play();
com.king.animalathletes.Sounds.get("SlideLoop" + currentSlideSound).stop();
var _local23 = _global.textMappings.attempt_num.split("{0}").join("1");
var _local22 = _global.textMappings.attempt_num.split("{0}").join("2");
var _local21 = _global.textMappings.attempt_num.split("{0}").join("3");
_parent.popup.attemptNameTexts.text = ((((newline + _local23) + newline) + _local22) + newline) + _local21;
_parent.popup.attemptScoreTexts.text = ((((newline + scores[0]) + newline) + scores[1]) + newline) + scores[2];
_parent.popup.bestScoreText.text = _global.textMappings.best_score;
_parent.popup.bestScore.text = bestScore;
_parent._parent.setScore(1, bestScore);
}
if (mouseDown || (getTimer() > nextRoundIn)) {
if ((((slimed != 0) || (xPos >= LEVEL_LENGTH)) || (timeLeft <= 0)) && ((getTimer() - gameOverTime) > 500)) {
com.king.animalathletes.Sounds.get("EventOverSound").stop();
if (round < 2) {
nextRound();
} else {
_parent._parent.nextEvent();
}
return(undefined);
}
}
mouseDown = false;
}
function gameOver(reason) {
nextRoundIn = getTimer() + 5000;
gameOverTime = getTimer();
doGameOver = true;
_parent.popup._visible = true;
_parent.popup.gotoAndStop(2);
_parent.popup.titleText.text = reason;
}
function die() {
if (slimed == 0) {
yPosA = 25;
slimed = 10;
animTime = 0;
}
}
function onPress() {
mouseVisible = true;
}
function onDragOver() {
mouseVisible = true;
}
function onRollOver() {
mouseVisible = true;
}
function onDragOut() {
mouseVisible = false;
}
function onRollOut() {
mouseVisible = false;
}
function render(tick, alpha) {
snow._rotation = (Math.atan2(slopeI.get(alpha), 400) * 40) + 10;
var _local3 = Math.tan((snow._rotation / 180) * Math.PI);
if (_parent.popup._visible) {
mouseVisible = false;
}
if ((((mouseVisible && (_xmouse > 0)) && (_ymouse > 0)) && (_xmouse < 500)) && (_ymouse < 500)) {
if (!mouseHidden) {
pointer._visible = true;
accuracyMeter._visible = true;
Mouse.hide();
mouseHidden = true;
}
} else if (mouseHidden) {
pointer._visible = false;
accuracyMeter._visible = false;
Mouse.show();
mouseHidden = false;
}
var _local8 = getTimer() - accuracyTime;
if (_local8 > 500) {
accuracyMeter.gotoAndStop(5);
}
pointer._x = _xmouse;
pointer._y = _ymouse;
var _local9 = player._x - _xmouse;
var _local7 = player._y - _ymouse;
if (_local7 > -10) {
pointer.gotoAndStop(2);
} else {
pointer.gotoAndStop(1);
}
accuracyMeter._x = pointer._x - 32;
accuracyMeter._y = pointer._y - 10;
shadow._x = 200 - (speedI.get(alpha) * 8);
shadow._y = (340 + ((shadow._x - 250) * _local3)) + 17;
shadow._rotation = snow._rotation;
player.skiAnim0.gotoAndStop((Math.floor(animTime + (animSpeed * alpha)) % 25) + 1);
player.skiAnim1.gotoAndStop((Math.floor(animTime + (animSpeed * alpha)) % 25) + 1);
player.jumpAnim.gotoAndStop((Math.floor(animTime + (animSpeed * alpha)) % 25) + 1);
player.deathAnim.gotoAndStop(Math.floor(animTime + (animSpeed * alpha)) + 1);
player._x = 200 - (speedI.get(alpha) * 8);
player._y = (340 + ((player._x - 250) * _local3)) - (yPosI.get(alpha) * 1.2);
player._rotation = accelI.get(alpha);
player.arm._rotation = armRotI.get(alpha);
if (slimed > 0) {
var _local4 = (dieTime + alpha) * 4;
if (_local4 > 40) {
_local4 = 40;
}
player._y = player._y + _local4;
}
var _local6 = LEVEL_LENGTH - xPosI.get(alpha);
goal._x = player._x + (_local6 * 4);
goal._y = 350 + ((goal._x - 250) * _local3);
_local6 = (LEVEL_LENGTH + 100) - xPosI.get(alpha);
goalStop._x = player._x + (_local6 * 4);
goalStop._y = 350 + ((goal._x - 250) * _local3);
_local6 = obstaclePos - xPosI.get(alpha);
obstacle._x = player._x + (_local6 * 4);
obstacle._rotation = snow._rotation;
obstacle._y = 350 + ((obstacle._x - 250) * _local3);
_local6 = xPosI.get(alpha) * 10;
var _local5 = Math.floor(_local6 / 800);
if (frontPine.po != _local5) {
frontPine.gotoAndStop(Math.floor(Math.random() * 3) + 1);
frontPine.po = _local5;
}
_local6 = _local6 - (_local5 * 800);
frontPine._x = 650 - _local6;
frontPine._y = (300 + ((frontPine._x - 250) * _local3)) + 380;
_local6 = xPosI.get(alpha) * 3;
_local5 = Math.floor(_local6 / 800);
if (backPine1.po != _local5) {
backPine1.gotoAndStop(Math.floor(Math.random() * 3) + 1);
backPine1.po = _local5;
}
_local6 = _local6 - (_local5 * 800);
backPine1._x = 650 - _local6;
backPine1._y = (300 + ((backPine1._x - 250) * _local3)) + 50;
_local6 = (xPosI.get(alpha) * 3) + 400;
_local5 = Math.floor(_local6 / 800);
if (backPine2.po != _local5) {
backPine2.gotoAndStop(Math.floor(Math.random() * 3) + 1);
backPine2.po = _local5;
}
_local6 = _local6 - (_local5 * 800);
backPine2._x = 650 - _local6;
backPine2._y = (300 + ((backPine2._x - 250) * _local3)) + 50;
}
static var PLAYBACK_DATA = "U01u01F11a11u11120R21k21031D30c31u31";
static var REPLAY_MODE = false;
static var LEVEL_LENGTH = 2000;
static var DISTANCE_BONUS = 400;
static var SPEED_BONUS = 3500;
static var JUMP_SCORE = 25;
static var TIME_PER_ROUND = 500;
static var SLOPE_FACTOR = 20;
}
Symbol 431 MovieClip [__Packages.com.king.animalathletes.PenguinJumpEvent] Frame 0
class com.king.animalathletes.PenguinJumpEvent extends com.king.animalathletes.Event
{
var random, mouseDown, jumping, xSpeed, ySpeed, onBlock, powerTime, rPenguin, rPenguinI, xPos, yPos, xPosI, yPosI, xSpeedI, ySpeedI, interpSpeed, iceBlocks, aimatron, _xmouse, _ymouse, useHandCursor, penguin, powertron;
function PenguinJumpEvent () {
super();
}
function init(communicator, seed) {
random = new com.midasplayer.util.Random(seed);
mouseDown = false;
jumping = false;
xSpeed = 0;
ySpeed = 0;
onBlock = -1;
powerTime = -1;
rPenguin = 0;
rPenguinI = new com.midasplayer.timing.IRotFloat();
rPenguinI.set(rPenguin);
rPenguinI.set(rPenguin);
xPos = 400;
yPos = 468;
xPosI = new com.midasplayer.timing.IFloat();
xPosI.set(xPos);
xPosI.set(xPos);
yPosI = new com.midasplayer.timing.IFloat();
yPosI.set(yPos);
yPosI.set(yPos);
xSpeed = 400;
ySpeed = 468;
xSpeedI = new com.midasplayer.timing.IFloat();
xSpeedI.set(xSpeed);
xSpeedI.set(xSpeed);
ySpeedI = new com.midasplayer.timing.IFloat();
ySpeedI.set(ySpeed);
ySpeedI.set(ySpeed);
interpSpeed = 0.5;
iceBlocks = new Array();
var _local2 = 0;
while (_local2 < 10) {
var _local4 = 0;
var _local3 = 0;
if (_local2 < 3) {
_local4 = 50;
_local3 = ((((_local2 + 0.5) / 3) * 400) + 25) + (random.nextDouble() * 50);
} else if (_local2 < 6) {
_local4 = 450 - widths[_local2];
_local3 = ((((_local2 - 3) / 3) * 400) + 25) + (random.nextDouble() * 50);
} else {
_local4 = (random.nextDouble() * (300 - widths[_local2])) + 100;
_local3 = ((((_local2 + 0.5) / 4) * 400) + 25) + (random.nextDouble() * 50);
}
this["block" + _local2]._x = _local4;
this["block" + _local2]._y = _local3 + 8;
var _local5 = new Object();
_local5.x = _local4;
_local5.y = _local3;
iceBlocks.push(_local5);
_local2++;
}
aimatron._visible = true;
}
function onMouseDown() {
mouseDown = true;
}
function tick(tick) {
var _local2 = 6;
while (_local2 < 10) {
if (iceBlocks[_local2].y > 500) {
iceBlocks[_local2].x = (random.nextDouble() * (300 - widths[_local2])) + 100;
iceBlocks[_local2].y = iceBlocks[_local2].y - 600;
if (onBlock == _local2) {
onBlock = -1;
}
}
if (onBlock == _local2) {
yPos = iceBlocks[_local2].y;
}
this["block" + _local2]._x = iceBlocks[_local2].x;
this["block" + _local2]._y = iceBlocks[_local2].y + 8;
_local2++;
}
if ((!jumping) && (mouseDown)) {
if (powerTime == -1) {
powerTime = 0;
} else {
var _local3 = rPenguin;
while (_local3 < -180) {
_local3 = _local3 + 360;
}
while (_local3 >= 180) {
_local3 = _local3 - 360;
}
if (_local3 > 0) {
if (_local3 < MIN_JUMP_ANGLE) {
_local3 = MIN_JUMP_ANGLE;
}
if (_local3 > MAX_JUMP_ANGLE) {
_local3 = MAX_JUMP_ANGLE;
}
} else {
if (_local3 > (-MIN_JUMP_ANGLE)) {
_local3 = -MIN_JUMP_ANGLE;
}
if (_local3 < (-MAX_JUMP_ANGLE)) {
_local3 = -MAX_JUMP_ANGLE;
}
}
var _local14 = Math.sin((_local3 * Math.PI) / 180);
var _local15 = Math.cos((_local3 * Math.PI) / 180);
var _local12 = getPower(powerTime);
_local12 = Math.sqrt(_local12) * JUMP_FORCE;
jumping = true;
aimatron._visible = false;
xSpeed = (-_local14) * _local12;
ySpeed = ((-_local15) * _local12) - (_local12 / 2);
interpSpeed = 0.5;
powerTime = -1;
}
}
if (powerTime >= 0) {
powerTime++;
if (powerTime == POWER_BUILDUP_TIME) {
powerTime = 0;
}
}
var _local11 = 0;
if (jumping) {
_local11 = 45;
var _local5 = yPos;
var _local9 = xPos;
xPos = xPos + xSpeed;
yPos = yPos + ySpeed;
if (xPos < 60) {
xPos = 60;
xSpeed = xSpeed * -0.5;
}
if (xPos > 440) {
xPos = 440;
xSpeed = xSpeed * -0.5;
}
var _local10 = false;
onBlock = 0;
_local2 = 0;
while (_local2 < 10) {
if ((_local5 <= iceBlocks[_local2].y) && (yPos > iceBlocks[_local2].y)) {
var _local7 = yPos - _local5;
var _local6 = iceBlocks[_local2].y - _local5;
var _local8 = _local6 / _local7;
var _local4 = _local9 + ((xPos - _local9) * _local8);
if ((_local4 > (iceBlocks[_local2].x + 10)) && (_local4 < ((iceBlocks[_local2].x + widths[_local2]) - 10))) {
_local10 = true;
yPos = iceBlocks[_local2].y;
jumping = false;
aimatron._visible = true;
interpSpeed = 0;
}
}
_local2++;
}
if (yPos > 468) {
_local10 = true;
yPos = 468;
jumping = false;
aimatron._visible = true;
interpSpeed = 0;
}
if (!_local10) {
ySpeed = ySpeed + 1;
}
_local11 = (Math.atan2(-xSpeed, -ySpeed) * 180) / Math.PI;
} else {
xSpeed = 0;
ySpeed = 0;
var _local14 = xPos - _xmouse;
var _local15 = yPos - _ymouse;
_local11 = (Math.atan2(_local14, _local15) * 180) / Math.PI;
interpSpeed = (interpSpeed * 0.8) + 0.1;
}
if (powerTime == -1) {
_local11 = _local11 - (Math.floor((_local11 - 180) / 360) * 360);
rPenguin = rPenguin - (Math.floor((rPenguin - 180) / 360) * 360);
var _local13 = _local11 - rPenguin;
if (_local13 >= 180) {
_local13 = _local13 - 360;
}
if (_local13 < -180) {
_local13 = _local13 + 360;
}
rPenguin = rPenguin + (_local13 * interpSpeed);
}
rPenguinI.set(rPenguin);
mouseDown = false;
xPosI.set(xPos);
yPosI.set(yPos);
xSpeedI.set(xSpeed);
ySpeedI.set(ySpeed);
}
function getPower(time) {
var _local1 = time / POWER_BUILDUP_TIME;
_local1 = ((-Math.cos((_local1 * Math.PI) * 2)) * 0.5) + 0.5;
return(_local1);
}
function onPress() {
}
function render(tick, alpha) {
var _local8 = xPos - _xmouse;
var _local9 = yPos - _ymouse;
useHandCursor = !jumping;
var _local2 = rPenguinI.get(alpha);
var _local7 = _local2 < 0;
if (_local7) {
_local2 = -_local2;
}
penguin._rotation = Math.sin((tick + alpha) / 12) * 4;
var _local5 = 0;
if (_local2 < 90) {
_local5 = (((45 - _local2) / 45) * 15) + 10;
} else {
_local5 = (((_local2 - 135) / 45) * 15) + 10;
}
penguin._x = xPosI.get(alpha);
penguin._y = yPosI.get(alpha);
powertron._x = penguin._x - 22;
powertron._y = penguin._y + 15;
powertron._xscale = getPower(powerTime + alpha) * 100;
powertron._visible = powerTime >= 0;
aimatron._x = penguin._x;
aimatron._y = penguin._y;
var _local3 = rPenguinI.get(alpha);
if (_local3 > 0) {
if (_local3 < MIN_JUMP_ANGLE) {
_local3 = MIN_JUMP_ANGLE;
}
if (_local3 > MAX_JUMP_ANGLE) {
_local3 = MAX_JUMP_ANGLE;
}
} else {
if (_local3 > (-MIN_JUMP_ANGLE)) {
_local3 = -MIN_JUMP_ANGLE;
}
if (_local3 < (-MAX_JUMP_ANGLE)) {
_local3 = -MAX_JUMP_ANGLE;
}
}
aimatron._rotation = -_local3;
penguin._rotation = penguin._rotation + _local5;
_local2 = _local2 + _local5;
if (_local2 > 160) {
_local2 = 160;
}
penguin.head._rotation = (((-_local2) + 90) - penguin._rotation) + _local5;
penguin.head._y = -26 + (((_local2 - 90) / 90) * 2);
if (jumping) {
var _local4 = ySpeedI.get(alpha) * 15;
if (_local4 > 50) {
_local4 = 50;
}
if (_local4 < -50) {
_local4 = -50;
}
penguin.wing._rotation = ((-_local4) * 0.6) - 50;
penguin.foot1._rotation = _local4 - (_local4 / 5);
penguin.foot2._rotation = _local4 + (_local4 / 5);
} else {
penguin.wing._rotation = -penguin._rotation;
penguin.foot1._rotation = -penguin._rotation;
penguin.foot2._rotation = -penguin._rotation;
}
if (_local7) {
penguin._xScale = -100;
penguin._rotation = penguin._rotation * -1;
} else {
penguin._xScale = 100;
}
}
static var POWER_BUILDUP_TIME = 40;
static var MIN_JUMP_ANGLE = 45;
static var MAX_JUMP_ANGLE = 90;
static var JUMP_FORCE = 13;
var widths = [80, 130, 95, 160, 114, 120, 150, 150, 130, 80];
}
Symbol 432 MovieClip [__Packages.com.king.animalathletes.IceJumpEvent] Frame 0
class com.king.animalathletes.IceJumpEvent extends com.king.animalathletes.Event
{
var communicator, nextSeed, round, scores, bestScore, random, iceBlocks, decoder, nextTick, xBonus1, xBonus2, bonusTarget1, bonusTarget2, jumpLength, jumpTime, drownTime, aimTime, score, lastOnIceNum, timeLeft, gameOver, gameTick, iceBlockCount, sinkTime, jumps, xCritter, yCritter, zCritter, zCritterA, zCritterI, xCritterI, yCritterI, rCritter, rCritterI, onIceNum, mouseDown, encoder, doGameOver, _parent, _xmouse, _ymouse, xJumpDir, yJumpDir, jumper, nextRoundIn, gameOverTime, splashLayer, useHandCursor, jumperShadow, jumperD, aimCircle, waterOverlay;
function IceJumpEvent () {
super();
}
function init(communicator, seed) {
this.communicator = communicator;
nextSeed = seed;
round = -1;
scores = new Array("--", "--", "--");
bestScore = 0;
nextRound();
}
function nextRound() {
random = new com.midasplayer.util.Random(nextSeed);
nextSeed = random.nextInt(10000000);
round++;
iceBlocks = new Array();
if (REPLAY_MODE) {
decoder = new com.king.animalathletes.Decoder(PLAYBACK_DATA);
nextTick = decoder.next();
}
xBonus1 = (random.nextDouble() * 150) + 50;
xBonus2 = (random.nextDouble() * 150) + 300;
bonusTarget1._x = xBonus1;
bonusTarget2._x = xBonus2;
bonusTarget1._y = BONUS_Y;
bonusTarget2._y = BONUS_Y;
bonusTarget1.gotoAndStop(1);
bonusTarget2.gotoAndStop(1);
jumpLength = 0;
jumpTime = 0;
drownTime = 0;
aimTime = 0;
score = 0;
lastOnIceNum = -1;
timeLeft = 20 * SECONDS_PER_ROUND;
gameOver = false;
gameTick = 0;
iceBlockCount = BLOCK_COUNT;
sinkTime = 0;
jumps = 0;
var _local2 = 0;
while (_local2 < 10) {
this["ice" + _local2]._visible = false;
this["shade" + _local2]._visible = false;
_local2++;
}
_local2 = 0;
while (_local2 < iceBlockCount) {
this["shade" + _local2]._xScale = 90;
this["shade" + _local2]._yScale = 90;
var _local4 = new Object();
iceBlocks.push(_local4);
_local4.type = random.nextInt(10);
this["ice" + _local2].gotoAndStop(iceBlocks[_local2].type + 1);
this["shade" + _local2].gotoAndStop(iceBlocks[_local2].type + 1);
this["ice" + _local2]._visible = true;
this["shade" + _local2]._visible = true;
var _local7 = true;
while (_local7 == true) {
_local4.x = (random.nextDouble() * (500 - widths[iceBlocks[_local2].type])) + (widths[iceBlocks[_local2].type] / 2);
_local4.y = ((random.nextDouble() * (400 - heights[iceBlocks[_local2].type])) + (heights[iceBlocks[_local2].type] / 2)) + 50;
_local7 = false;
var _local3 = 0;
while ((_local3 < _local2) && (!_local7)) {
var _local9 = iceBlocks[_local2].x - iceBlocks[_local3].x;
var _local10 = iceBlocks[_local2].y - iceBlocks[_local3].y;
var _local6 = _local9 / ((widths[iceBlocks[_local2].type] + widths[iceBlocks[_local3].type]) / 2);
var _local5 = _local10 / ((heights[iceBlocks[_local2].type] + heights[iceBlocks[_local3].type]) / 2);
var _local8 = (_local6 * _local6) + (_local5 * _local5);
if (_local8 < 1) {
_local7 = true;
}
_local3++;
}
}
_local4.xI = new com.midasplayer.timing.IFloat();
_local4.yI = new com.midasplayer.timing.IFloat();
_local4.xI.set(_local4.x);
_local4.xI.set(_local4.x);
_local4.yI.set(_local4.y);
_local4.yI.set(_local4.y);
_local4.dip = 0;
_local4.dipa = 0;
_local4.dipI = new com.midasplayer.timing.IFloat();
var _local11 = (random.nextDouble() * Math.PI) * 2;
_local4.xa = Math.sin(_local11);
_local4.ya = Math.cos(_local11);
_local2++;
}
xCritter = 250;
yCritter = 475;
zCritter = 0;
zCritterA = 0;
zCritterI = new com.midasplayer.timing.IFloat();
xCritterI = new com.midasplayer.timing.IFloat();
yCritterI = new com.midasplayer.timing.IFloat();
xCritterI.set(xCritter);
xCritterI.set(xCritter);
yCritterI.set(yCritter);
yCritterI.set(yCritter);
zCritterI.set(zCritter);
zCritterI.set(zCritter);
rCritter = 180;
rCritterI = new com.midasplayer.timing.IRotFloat();
rCritterI.set(rCritter);
rCritterI.set(rCritter);
onIceNum = -1;
mouseDown = false;
encoder = new com.king.animalathletes.Encoder();
doGameOver = false;
_parent.popup._visible = false;
}
function onMouseDown() {
if (((((!REPLAY_MODE) && (_xmouse >= 0)) && (_ymouse >= 0)) && (_xmouse < 500)) && (_ymouse < 500)) {
mouseDown = true;
}
}
function onMouseUp() {
if (!REPLAY_MODE) {
mouseDown = false;
}
}
function tick(tick) {
_parent.hider._visible = false;
if (REPLAY_MODE) {
if (nextTick == gameTick) {
mouseDown = !mouseDown;
}
}
if (!gameOver) {
timeLeft--;
_parent.timeText.text = (_global.textMappings.time_left + ": ") + Math.floor((timeLeft + 19) / 20);
if (timeLeft == 0) {
setGameOver(_global.textMappings.out_of_time);
gameOver = true;
doGameOver = true;
}
if ((zCritter == 0) && (drownTime == 0)) {
if (mouseDown) {
if (aimTime == 0) {
encoder.append(gameTick);
if (REPLAY_MODE) {
nextTick = decoder.next();
}
}
aimTime++;
} else if (aimTime > 0) {
encoder.append(gameTick);
var _local16 = (((rCritter * 2048) / 360) >> 0) & 2047;
rCritter = (_local16 * 360) / 2048;
encoder.append(_local16);
if (REPLAY_MODE) {
rCritter = (decoder.next() * 360) / 2048;
}
com.king.animalathletes.Sounds.get("JumpSound").play();
var _local21 = (getAimSize(aimTime) / 50) + 0.8;
xJumpDir = 0;
yJumpDir = 0;
aimTime = 0;
onIceNum = -1;
sinkTime = 0;
zCritterA = _local21;
jumps++;
}
}
} else {
aimTime = 0;
}
var _local5 = 0;
while (_local5 < iceBlockCount) {
var _local3 = _local5 + 1;
while (_local3 < iceBlockCount) {
var _local17 = iceBlocks[_local5].x - iceBlocks[_local3].x;
var _local18 = iceBlocks[_local5].y - iceBlocks[_local3].y;
var _local7 = _local17 / ((widths[iceBlocks[_local5].type] + widths[iceBlocks[_local3].type]) / 2);
var _local6 = _local18 / ((heights[iceBlocks[_local5].type] + heights[iceBlocks[_local3].type]) / 2);
var _local13 = (_local7 * _local7) + (_local6 * _local6);
if (_local13 < 1) {
var _local4 = Math.atan2(_local7, _local6);
iceBlocks[_local5].xa = Math.sin(_local4);
iceBlocks[_local5].ya = Math.cos(_local4);
iceBlocks[_local3].xa = -Math.sin(_local4);
iceBlocks[_local3].ya = -Math.cos(_local4);
}
_local3++;
}
_local5++;
}
_local5 = 0;
while (_local5 < iceBlockCount) {
iceBlocks[_local5].dip = iceBlocks[_local5].dip + iceBlocks[_local5].dipa;
if (onIceNum == _local5) {
sinkTime++;
if ((iceBlocks[_local5].dip > 5) && (drownTime == 0)) {
drownTime = 1;
}
iceBlocks[_local5].dipa = iceBlocks[_local5].dipa - ((iceBlocks[_local5].dip - (sinkTime * SINK_SPEED)) * 0.2);
} else {
iceBlocks[_local5].dipa = iceBlocks[_local5].dipa - (iceBlocks[_local5].dip * 0.2);
}
iceBlocks[_local5].dipa = iceBlocks[_local5].dipa * 0.8;
iceBlocks[_local5].dipI.set(iceBlocks[_local5].dip);
iceBlocks[_local5].x = iceBlocks[_local5].x + (iceBlocks[_local5].xa * ICEBLOCK_SPEED);
iceBlocks[_local5].y = iceBlocks[_local5].y + (iceBlocks[_local5].ya * ICEBLOCK_SPEED);
if ((jumpTime == 0) && (onIceNum == _local5)) {
xCritter = xCritter + (iceBlocks[_local5].xa * ICEBLOCK_SPEED);
yCritter = yCritter + (iceBlocks[_local5].ya * ICEBLOCK_SPEED);
}
if (iceBlocks[_local5].x < (widths[iceBlocks[_local5].type] / 2)) {
iceBlocks[_local5].x = widths[iceBlocks[_local5].type] / 2;
iceBlocks[_local5].xa = iceBlocks[_local5].xa * -1;
}
if (iceBlocks[_local5].x > (500 - (widths[iceBlocks[_local5].type] / 2))) {
iceBlocks[_local5].x = 500 - (widths[iceBlocks[_local5].type] / 2);
iceBlocks[_local5].xa = iceBlocks[_local5].xa * -1;
}
if (iceBlocks[_local5].y < (50 + (heights[iceBlocks[_local5].type] / 2))) {
iceBlocks[_local5].y = 50 + (heights[iceBlocks[_local5].type] / 2);
iceBlocks[_local5].ya = iceBlocks[_local5].ya * -1;
}
if (iceBlocks[_local5].y > (450 - (heights[iceBlocks[_local5].type] / 2))) {
iceBlocks[_local5].y = 450 - (heights[iceBlocks[_local5].type] / 2);
iceBlocks[_local5].ya = iceBlocks[_local5].ya * -1;
}
iceBlocks[_local5].xI.set(iceBlocks[_local5].x);
iceBlocks[_local5].yI.set(iceBlocks[_local5].y);
_local5++;
}
if (!gameOver) {
if (drownTime > 0) {
drownTime++;
if (drownTime > 20) {
setGameOver(_global.textMappings.drowned);
doGameOver = true;
gameOver = true;
}
} else if ((zCritterA != 0) || (zCritter != 0)) {
zCritter = zCritter + zCritterA;
if (zCritter == 0) {
if (onIceNum >= 0) {
var _local27 = Math.sqrt((xJumpDir * xJumpDir) + (yJumpDir * yJumpDir));
iceBlocks[onIceNum].dipa = 1;
addSplash(onIceNum);
}
}
xCritter = xCritter + xJumpDir;
yCritter = yCritter + yJumpDir;
zCritter = zCritter + zCritterA;
zCritterA = zCritterA * 0.8;
zCritterA = zCritterA - 0.25;
if ((zCritterA < 0) && (zCritter <= 0)) {
zCritter = 0;
zCritterA = 0;
var _local8 = 1;
onIceNum = -1;
sinkTime = 0;
if (yCritter < 65) {
setGameOver(_global.textMappings.won);
doGameOver = true;
var _local23 = ((timeLeft * SPEED_BONUS) / (SECONDS_PER_ROUND * 20)) >> 0;
score = score + _local23;
var _local20 = xCritter - xBonus1;
var _local19 = xCritter - xBonus2;
var _local18 = yCritter - BONUS_Y;
var _local12 = (_local20 * _local20) + (_local18 * _local18);
var _local15 = (_local19 * _local19) + (_local18 * _local18);
if ((_local12 < (ACCURACY_RADIUS * ACCURACY_RADIUS)) || (_local15 < (ACCURACY_RADIUS * ACCURACY_RADIUS))) {
if (_local12 < _local15) {
bonusTarget1.gotoAndStop(2);
} else {
bonusTarget2.gotoAndStop(2);
_local12 = _local15;
}
var _local22 = (((ACCURACY_RADIUS - Math.sqrt(_local12)) * ACCURACY_BONUS) / ACCURACY_RADIUS) >> 0;
score = score + _local22;
}
gameOver = true;
}
if ((yCritter > 65) && (yCritter < 435)) {
_local5 = 0;
while (_local5 < iceBlockCount) {
var _local17 = iceBlocks[_local5].x - xCritter;
var _local18 = iceBlocks[_local5].y - yCritter;
var _local7 = _local17 / ((widths[iceBlocks[_local5].type] / 2) + CRITTER_RADIUS);
var _local6 = _local18 / ((heights[iceBlocks[_local5].type] / 2) + CRITTER_RADIUS);
var _local13 = (_local7 * _local7) + (_local6 * _local6);
if (_local13 < _local8) {
_local8 = _local13;
onIceNum = _local5;
sinkTime = 0;
}
_local5++;
}
if (onIceNum >= 0) {
var _local27 = Math.sqrt((xJumpDir * xJumpDir) + (yJumpDir * yJumpDir));
addSplash(onIceNum);
iceBlocks[onIceNum].dipa = 1;
if (onIceNum != lastOnIceNum) {
lastOnIceNum = onIceNum;
score = score + 50;
}
if (REPLAY_MODE) {
nextTick = decoder.next();
}
com.king.animalathletes.Sounds.get("IceLandSound").play();
} else {
com.king.animalathletes.Sounds.get("SplashSound").play();
drownTime = 1;
addSplash2(jumper, -40, -40);
}
} else {
com.king.animalathletes.Sounds.get("IceLandSound").play();
if (REPLAY_MODE) {
nextTick = decoder.next();
}
}
}
}
var _local11 = _xmouse << 0;
var _local10 = _ymouse << 0;
if (REPLAY_MODE) {
_local11 = 0;
_local10 = 0;
}
if (zCritter > 0) {
if (REPLAY_MODE) {
_local11 = decoder.next() - 1000;
_local10 = decoder.next() - 1000;
}
encoder.append(_local11 + 1000);
encoder.append(_local10 + 1000);
}
var _local9 = 0;
var _local14 = (Math.atan2(_local11 - xCritter, _local10 - yCritter) * 180) / Math.PI;
_local14 = _local14 - (Math.floor((_local14 - 180) / 360) * 360);
rCritter = rCritter - (Math.floor((rCritter - 180) / 360) * 360);
_local9 = _local14 - rCritter;
if (_local9 >= 180) {
_local9 = _local9 - 360;
}
if (_local9 < -180) {
_local9 = _local9 + 360;
}
if (_local9 > 45) {
_local9 = 45;
}
if (_local9 < -45) {
_local9 = -45;
}
if (zCritter > 0) {
var _local17 = _local11 - xCritter;
var _local18 = _local10 - yCritter;
var _local13 = Math.sqrt((_local17 * _local17) + (_local18 * _local18)) / 50;
if (_local13 > 1) {
_local13 = 1;
}
_local9 = _local9 * 0.5;
xJumpDir = xJumpDir + (Math.sin((rCritter / 180) * Math.PI) * _local13);
yJumpDir = yJumpDir + (Math.cos((rCritter / 180) * Math.PI) * _local13);
xJumpDir = xJumpDir * 0.9;
yJumpDir = yJumpDir * 0.9;
}
if (drownTime <= 0) {
rCritter = rCritter + (_local9 * 0.5);
}
}
if (drownTime > 0) {
rCritter = rCritter + 10;
}
rCritterI.set(rCritter);
xCritterI.set(xCritter);
yCritterI.set(yCritter);
zCritterI.set(zCritter);
_parent.scoreText.text = (_global.textMappings.score + ": ") + score;
_parent.miscText.text = (_global.textMappings.jumps + ": ") + jumps;
gameTick++;
if (doGameOver) {
doGameOver = false;
communicator.sendEventData(encoder.res, score);
if (bestScore < score) {
bestScore = score;
}
scores[round] = score;
com.king.animalathletes.Sounds.get("EventOverSound").play();
var _local26 = _global.textMappings.attempt_num.split("{0}").join("1");
var _local25 = _global.textMappings.attempt_num.split("{0}").join("2");
var _local24 = _global.textMappings.attempt_num.split("{0}").join("3");
_parent.popup.attemptNameTexts.text = ((((newline + _local26) + newline) + _local25) + newline) + _local24;
_parent.popup.attemptScoreTexts.text = ((((newline + scores[0]) + newline) + scores[1]) + newline) + scores[2];
_parent.popup.bestScoreText.text = _global.textMappings.best_score;
_parent.popup.bestScore.text = bestScore;
_parent._parent.setScore(0, bestScore);
}
if ((gameOver && (mouseDown || (getTimer() > nextRoundIn))) && ((getTimer() - gameOverTime) > 500)) {
com.king.animalathletes.Sounds.get("EventOverSound").stop();
if (round < 2) {
nextRound();
} else {
_parent._parent.nextEvent();
}
return(undefined);
}
}
function setGameOver(reason) {
nextRoundIn = getTimer() + 5000;
gameOverTime = getTimer();
_parent.popup._visible = true;
_parent.popup.gotoAndStop(2);
_parent.popup.titleText.text = reason;
}
function addSplash(iceNum) {
addSplash2(this["ice" + iceNum], widths[iceBlocks[iceNum].type], heights[iceBlocks[iceNum].type]);
}
function addSplash2(target, width, height) {
var _local3 = 0;
while (_local3 < 3) {
var _local4 = splashLayer.getNextHighestDepth();
var _local2 = splashLayer.attachMovie("waterRing", "splash" + _local4, _local4);
_local2.startTime = getTimer() + (_local3 * 250);
_local2.target = target;
_local2.width = width;
_local2.height = height;
_local2.render();
_local3++;
}
}
function getAimSize(aimTime) {
var _local1 = Math.sqrt(aimTime * 200);
if (_local1 > 80) {
_local1 = 80;
}
return(((Math.cos((aimTime / 10) + Math.PI) + 1) * 80) + _local1);
}
function onPress() {
}
function render(tick, alpha) {
var _local12 = xCritter - _xmouse;
var _local13 = yCritter - _ymouse;
useHandCursor = (zCritter == 0) && (drownTime == 0);
var _local11 = tick + alpha;
jumper._x = xCritterI.get(alpha);
jumper._y = yCritterI.get(alpha);
jumper._rotation = 180 - rCritterI.get(alpha);
jumperShadow._x = xCritterI.get(alpha);
jumperShadow._y = yCritterI.get(alpha);
jumperShadow._rotation = 180 - rCritterI.get(alpha);
jumperD._x = xCritterI.get(alpha);
jumperD._y = yCritterI.get(alpha);
jumperD._rotation = 180 - rCritterI.get(alpha);
jumper._visible = drownTime == 0;
jumperD._visible = drownTime > 0;
aimCircle._visible = false;
jumperShadow._visible = false;
if (drownTime > 0) {
jumperD._xScale = 100 - (drownTime + alpha);
jumperD._yScale = 100 - (drownTime + alpha);
jumperD._alpha = 50 - ((drownTime + alpha) * 2);
jumperD.gotoAndStop(2);
jumperD._y = jumperD._y + ((drownTime + alpha) / 2);
if (onIceNum >= 0) {
var _local3 = iceBlocks[onIceNum].dipI.get(alpha);
jumper._y = jumper._y + (_local3 * 2);
}
} else if (zCritter > 0) {
var _local9 = (zCritterI.get(alpha) * zCritterI.get(alpha)) / 100;
jumper._xScale = 100 + _local9;
jumper._yScale = 100 + _local9;
jumper._y = jumper._y - zCritterI.get(alpha);
jumper.gotoAndStop(2);
jumperShadow.gotoAndStop(2);
jumperShadow._xScale = 100 - (_local9 / 2);
jumperShadow._yScale = 100 - (_local9 / 2);
jumperShadow._visible = true;
} else {
if (onIceNum >= 0) {
var _local3 = iceBlocks[onIceNum].dipI.get(alpha);
jumper._y = jumper._y + (_local3 * 2);
}
jumperShadow.gotoAndStop(1);
jumper.gotoAndStop(1);
jumper._xScale = 100;
jumper._yScale = 100;
aimCircle._visible = aimTime > 0;
aimCircle._x = xCritterI.get(alpha);
aimCircle._y = yCritterI.get(alpha);
var _local10 = getAimSize(aimTime + alpha);
aimCircle._xScale = _local10;
aimCircle._yScale = _local10;
}
waterOverlay._alpha = (Math.sin(_local11 / 20) * 50) + 50;
var _local2 = 0;
while (_local2 < iceBlockCount) {
var _local6 = iceBlocks[_local2].xI.get(alpha);
var _local5 = iceBlocks[_local2].yI.get(alpha);
var _local8 = widths[iceBlocks[_local2].type] / 2;
var _local7 = heights[iceBlocks[_local2].type] / 2;
var _local3 = iceBlocks[_local2].dipI.get(alpha);
this["ice" + _local2]._x = _local6 - (widths[iceBlocks[_local2].type] / 2);
this["ice" + _local2]._y = (_local5 + (_local3 * 2)) - (heights[iceBlocks[_local2].type] / 2);
if (_local3 > 4) {
this["ice" + _local2]._alpha = 50 - ((_local3 - 4) * 50);
this["shade" + _local2]._visible = false;
} else {
this["ice" + _local2]._alpha = 100;
this["shade" + _local2]._x = ((_local6 + 15) - (widths[iceBlocks[_local2].type] / 2)) - (_local3 * 1.75);
this["shade" + _local2]._y = ((_local5 + 20) - (heights[iceBlocks[_local2].type] / 2)) - (_local3 * 2);
this["shade" + _local2]._visible = true;
}
_local2++;
}
}
static var PLAYBACK_DATA = "90M0UHGJ7MGJ8MGJ8MGJ8MGJ8MGJ8MGJ8MGJ8MGJ8MGJ8MGJ8MGJ8MGJ8MGJ6MFJ1MFJ#Lj0!0jFRJBKRJBKTJAKVJ9KXJ8KbJ4KeJ0KhJxJjJtJlJnJoJeJsJWJ#JKJDK4JMK#IWKtIaKpIiKiIlKgImKeIK1l1ZCALUIALUIALUIALUIBLUIDLUIELTIELTIELTIELTIELTIGLSIGLRIGLNIILBIKL2IMLwHMLuHPLnHULdHZLUHdLNHmLBHyLxGBMkGDMjGB2a2zC9MzGAMzGBMyGCMyGCMyGCMyGCMyGDMyGFMzGHM0HHM3HHM5HHM7HHMAHIMCHJMDHKMEHKMEHJMAHDM#G3MnG!LfGyLbGhLVGULRG#2G3QMmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7GmK7G";
static var REPLAY_MODE = false;
static var SECONDS_PER_ROUND = 30;
static var BLOCK_COUNT = 10;
static var CRITTER_RADIUS = 0;
static var ICEBLOCK_SPEED = 0.75;
static var SPEED_BONUS = 1700;
static var ACCURACY_BONUS = 200;
static var ACCURACY_RADIUS = 40;
static var BONUS_Y = 28;
static var SINK_SPEED = 0.05;
var widths = [61, 58, 59, 43, 51, 58, 53, 64, 88, 77];
var heights = [58, 61, 60, 43, 71, 85, 72, 38, 64, 64];
}
Symbol 433 MovieClip [__Packages.com.midasplayer.timing.Timeable] Frame 0
interface com.midasplayer.timing.Timeable
{
}
Symbol 434 MovieClip [__Packages.com.king.animalathletes.GamePanel] Frame 0
class com.king.animalathletes.GamePanel extends MovieClip implements com.midasplayer.timing.Timeable
{
var scores, state, communicator, totalScore, eventHolder, soundButton, showIntroTime, showInstructionsTime, currentEvent, timer, seed, currentEventNum, eventIndicator0, eventIndicator1, eventIndicator2, gameTitle0, gameTitle1, gameTitle2, fullScoreLabel, toggleSoundLabel, exitGameLabel, gameEndTime, fullScoreText;
function GamePanel () {
super();
scores = new Array(0, 0, 0);
state = STATE_WAIT_FOR_GAMEDATA;
communicator = new com.king.animalathletes.Communicator();
totalScore = 0;
eventHolder.timeText.text = "";
eventHolder.scoreText.text = "";
eventHolder.miscText.text = "";
eventHolder.popup.gotoAndStop(1);
soundButton.currentState = 1;
}
function onMouseDown() {
if (state == STATE_SHOW_GAME_INTRO) {
showIntroTime = getTimer() - 50000;
}
if (state == STATE_SHOW_GAME_INSTRUCTIONS) {
showInstructionsTime = getTimer() - 50000;
}
}
function onEnterFrame() {
switch (state) {
case STATE_WAIT_FOR_GAMEDATA :
currentEvent = undefined;
if (DEBUG_MODE) {
_root.gameData = DEBUG_GAME_DATA;
}
if (_root.gameData != undefined) {
_root.hider._visible = false;
communicator.parseGameData(_root.gameData);
communicator.gameStarted();
timer = new com.midasplayer.timing.Timer(this, 20);
seed = communicator.randomSeed;
currentEventNum = -1;
if (DEBUG_MODE) {
currentEventNum = -1;
}
eventIndicator0.gotoAndStop(2);
eventIndicator1.gotoAndStop(2);
eventIndicator2.gotoAndStop(2);
gameTitle0.text = _global.textMappings.event_1_name;
gameTitle1.text = _global.textMappings.event_2_name;
gameTitle2.text = _global.textMappings.event_3_name;
fullScoreLabel.text = _global.textMappings.total_score;
toggleSoundLabel.text = _global.textMappings.sound_on;
exitGameLabel.text = _global.textMappings.end_game;
soundButton.def.gotoAndStop(1);
com.king.animalathletes.Sounds.get("GameIntroSound").play();
eventHolder.popup.instructionsTitle.text = _global.textMappings.game_instructions_title;
eventHolder.popup.instructionsText.text = _global.textMappings.game_instructions_text;
state = STATE_SHOW_GAME_INTRO;
showIntroTime = getTimer();
communicator.sendGameVersion();
}
break;
case STATE_SHOW_GAME_INTRO :
var _local4 = (showIntroTime + 10000) - getTimer();
if (_local4 < 0) {
nextEvent();
com.king.animalathletes.Sounds.get("GameIntroSound").stop();
} else {
eventHolder.popup.instructionsCountdown.text = _global.textMappings.game_start_in.split("{0}").join("" + Math.floor((_local4 + 999) / 1000));
}
break;
case STATE_SHOW_GAME_INSTRUCTIONS :
currentEvent = undefined;
var _local5 = 150;
if (currentEventNum == 0) {
_local5 = 150;
} else if (currentEventNum == 2) {
_local5 = 125;
} else if (currentEventNum == 3) {
_local5 = 100;
}
var _local6 = Math.floor((getTimer() - showInstructionsTime) / 30) % _local5;
eventHolder.popup["instr" + currentEventNum].gotoAndStop(_local6 + 1);
_local4 = (showInstructionsTime + 5000) - getTimer();
if (_local4 < 0) {
state = STATE_PLAY_GAME;
seed = seed + 978387;
communicator.sendStartEvent(currentEventNum);
eventHolder.gotoAndStop(currentEventNum + 2);
doEventInit = true;
} else {
eventHolder.popup.instructionsCountdown.text = _global.textMappings.game_start_in.split("{0}").join("" + Math.floor((_local4 + 999) / 1000));
}
break;
case STATE_PLAY_GAME :
if (doEventInit) {
com.king.animalathletes.Sounds.get("EventStartSound").stop();
doEventInit = false;
currentEvent = eventHolder.event;
_root.debugText.text = "Seed: " + seed;
currentEvent.init(communicator, seed);
}
break;
case STATE_END_GAME :
currentEvent = undefined;
if (getTimer() <= gameEndTime) {
break;
}
communicator.gameQuit();
_root.hider._visible = true;
state = STATE_GAME_ENDED;
}
timer.advanceTime2();
}
function nextEvent() {
if (state >= STATE_END_GAME) {
return(undefined);
}
var _local3 = currentEventNum;
if (_local3 == 0) {
_local3 = 1;
}
this["eventIndicator" + (_local3 - 1)].gotoAndStop(3);
currentEventNum++;
if (currentEventNum == 1) {
currentEventNum++;
}
if (currentEventNum == 4) {
com.king.animalathletes.Sounds.get("GameOverSound").play();
doEndGame(8000);
eventHolder.popup.gotoAndStop(2);
eventHolder.popup.titleText.text = _global.textMappings.game_over;
var _local4 = _global.textMappings.event_num.split("{0}").join("1");
var _local5 = _global.textMappings.event_num.split("{0}").join("2");
var _local6 = _global.textMappings.event_num.split("{0}").join("3");
eventHolder.popup.attemptNameTexts.text = ((((newline + _local4) + newline) + _local5) + newline) + _local6;
eventHolder.popup.attemptScoreTexts.text = ((((newline + scores[0]) + newline) + scores[1]) + newline) + scores[2];
eventHolder.popup.bestScoreText.text = _global.textMappings.total_score;
eventHolder.popup.bestScore.text = totalScore;
} else {
com.king.animalathletes.Sounds.get("EventStartSound").play();
state = STATE_SHOW_GAME_INSTRUCTIONS;
var _local7 = currentEventNum;
if (_local7 == 0) {
_local7 = 1;
}
this["eventIndicator" + (_local7 - 1)].gotoAndStop(1);
eventHolder.popup.gotoAndStop(currentEventNum + 3);
eventHolder.popup.instructionsTitle.text = _global.textMappings[("event_" + _local7) + "_name"];
eventHolder.popup.instructionsText.text = _global.textMappings[("event_" + _local7) + "_instructions"];
eventHolder.popup.instructionsCountdown.text = _global.textMappings.game_start_in.split("{0}").join("5");
eventHolder.popup.instr2.jumpTxt = _global.textMappings.jump;
eventHolder.popup.instr2.speedTxt = _global.textMappings.speed;
eventHolder.hider._visible = true;
eventHolder.timeText.text = "";
eventHolder.scoreText.text = "";
eventHolder.miscText.text = "";
showInstructionsTime = getTimer();
}
currentEvent = null;
}
function tick(tick) {
if (currentEvent != undefined) {
currentEvent.tick(tick);
}
}
function render(tick, alpha) {
if (currentEvent != undefined) {
currentEvent.render(tick, alpha);
}
}
function setScore(eventNum, score) {
this["gameScore" + eventNum].text = score;
scores[eventNum] = score;
totalScore = 0;
var _local4 = 0;
while (_local4 < 3) {
totalScore = totalScore + scores[_local4];
_local4 = _local4 + 1;
}
fullScoreText.text = totalScore;
}
function endGame() {
if (state == STATE_PLAY_GAME) {
communicator.sendEndGamePressed();
doEndGame(2000);
_root.hider._visible = true;
}
}
function toggleSound() {
soundOn = !soundOn;
com.king.animalathletes.Sounds.toggleSound();
if (soundOn) {
soundButton.currentState = 2;
toggleSoundLabel.text = _global.textMappings.sound_off;
} else {
soundButton.currentState = 1;
toggleSoundLabel.text = _global.textMappings.sound_on;
}
}
function doEndGame(time) {
if (state == STATE_PLAY_GAME) {
communicator.gameEnd(totalScore);
eventHolder.gotoAndStop(6);
state = STATE_END_GAME;
gameEndTime = getTimer() + time;
}
}
static var DEBUG_MODE = true;
static var DEBUG_GAME_DATA = ((((((((((((((((((((("<gamedata randomseed=\"1880611892\" timelimit=\"660\"><text id=\"event_1_name\">Icej\u00FCmp</text><text id=\"event_2_name\">Skij\u00FCmp</text><text id=\"event_3_name\">G\u00F6lf</text><text id=\"event_1_instructions\">Icej\u00FCmp instructions</text><text id=\"event_2_instructions\">Skij\u00FCmp instructions</text><text id=\"event_3_instructions\">G\u00F6lf instructions</text>" + "<text id=\"event_num\">EV\u00CBNT {0}</text>") + "<text id=\"game_over\">G\u00C4ME OVER</text>") + "<text id=\"total_score\">T\u00D6TAL SCORE</text>") + "<text id=\"game_start_in\">G\u00C4ME STARTS IN {0} SECONDS</text>") + "<text id=\"time_left\">Tim\u00EB left</text>") + "<text id=\"out_of_time\">\u00D6UT OF TIME</text>") + "<text id=\"won\">YOU W\u00D6N</text>") + "<text id=\"drowned\">DR\u00D6WNED</text>") + "<text id=\"score\">Sc\u00F6re</text>") + "<text id=\"jumps\">J\u00FCmps</text>") + "<text id=\"best_score\">BEST SC\u00D6RE</text>") + "<text id=\"attempt_num\">\u00C4TTEMPT {0}</text>") + "<text id=\"hit_obstacle\">\u00D6BSTACLED</text>") + "<text id=\"distance\">Dist\u00E4nce</text>") + "<text id=\"end_game\">END G\u00C4ME</text>") + "<text id=\"sound_on\">S\u00D6UND ON</text>") + "<text id=\"sound_off\">S\u00D6UND OFF</text>") + "<text id=\"game_instructions_title\">G\u00C4ME INSTRUCTIONS</text>") + "<text id=\"game_instructions_text\">DEB\u00DCG VERSION! If this is on the live or test server, someone uploaded the wrong version!</text>") + "<text id=\"speed\">SP\u00CB\u00CBD</text>") + "<text id=\"jump\">J\u00DCMP</text>") + "</gamedata>";
var doEventInit = false;
var soundOn = true;
static var STATE_WAIT_FOR_GAMEDATA = 0;
static var STATE_SHOW_GAME_INTRO = 1;
static var STATE_SHOW_GAME_INSTRUCTIONS = 2;
static var STATE_PLAY_GAME = 3;
static var STATE_END_GAME = 4;
static var STATE_GAME_ENDED = 5;
}
Symbol 435 MovieClip [__Packages.com.midasplayer.timing.Timer] Frame 0
class com.midasplayer.timing.Timer
{
var timeable;
function Timer (timeable, gameTicksPerSecond) {
millisPerGameTick = 1000 / gameTicksPerSecond;
this.timeable = timeable;
maxTickTime = 500;
}
function getMillisPerTick() {
return(millisPerGameTick);
}
function setMaxTickTime(millis) {
maxTickTime = millis;
}
function advanceTime2() {
var _local3 = getTimer();
if (startTime < 0) {
startTime = _local3;
unprocessedTime = millisPerGameTick;
}
time = _local3 - startTime;
var _local4 = time - lastTime;
lastTime = time;
unprocessedTime = unprocessedTime + _local4;
if (unprocessedTime >= millisPerGameTick) {
var _local2 = maxTickTime + _local3;
do {
timeable.tick(tick);
tick++;
unprocessedTime = unprocessedTime - millisPerGameTick;
} while ((unprocessedTime >= millisPerGameTick) && (getTimer() < _local2));
}
var _local5 = (unprocessedTime % millisPerGameTick) / millisPerGameTick;
timeable.render(tick, _local5);
}
function advanceTime() {
time = getTimer();
var _local3 = time - lastTime;
lastTime = time;
unprocessedTime = unprocessedTime + _local3;
var _local2 = 0;
while (unprocessedTime > millisPerGameTick) {
unprocessedTime = unprocessedTime - millisPerGameTick;
timeable.tick(tick);
tick++;
_local2++;
if (_local2 >= 10) {
unprocessedTime = 0;
}
}
var _local4 = unprocessedTime / millisPerGameTick;
timeable.render(tick, _local4);
}
var time = 0;
var startTime = -1;
var lastTime = 0;
var unprocessedTime = 0;
var tick = 0;
var millisPerGameTick = 0;
var maxTickTime = -1;
}
Symbol 436 MovieClip [__Packages.com.king.animalathletes.Communicator] Frame 0
class com.king.animalathletes.Communicator
{
var randomSeed;
function Communicator () {
}
function gameStarted() {
fscommand ("gameStart");
}
function gameEnd(score) {
if (!hasSentGameEnd) {
hasSentGameEnd = true;
fscommand ("gameEnd", score);
}
}
function gameQuit() {
if (!hasSentGameOver) {
hasSentGameOver = true;
fscommand ("gameQuit");
}
}
function sendEndGamePressed() {
fscommand ("playData", CMD_END_GAME_PRESSED + "=0");
}
function sendStartEvent(eventNum) {
fscommand ("playData", ((CMD_START_EVENT + ",") + eventNum) + "=0");
}
function sendEventData(eventData, scoreGained) {
fscommand ("playData", (((CMD_EVENT_DATA + ",") + eventData) + "=") + scoreGained);
}
function parseGameData(gameData) {
var _local6 = new XML(_root.gameData);
_global.textMappings = new Object();
var _local5 = _local6.childNodes[0].childNodes;
randomSeed = new Number(_local6.childNodes[0].attributes.randomseed).valueOf();
var _local4 = 0;
while (_local4 < _local5.length) {
if (_local5[_local4].nodeName == "text") {
_global.textMappings[_local5[_local4].attributes.id] = new String(_local5[_local4].firstChild.nodeValue);
}
_local4++;
}
}
var hasSentGameEnd = false;
var hasSentGameOver = false;
static var VERSION_NUM = 0;
static var CMD_INIT = 229;
static var CMD_START_EVENT = 473;
static var CMD_EVENT_DATA = 821;
static var CMD_END_GAME_PRESSED = 736;
}
Symbol 437 MovieClip [__Packages.com.king.animalathletes.WaterRing] Frame 0
class com.king.animalathletes.WaterRing extends MovieClip
{
var _x, target, _y, width, height, startTime, _visible, _xscale, _yscale, _alpha, removeMovieClip;
function WaterRing () {
super();
}
function onEnterFrame() {
render();
}
function render() {
_x = target._x;
_y = target._y;
if (width >= 0) {
_x = _x + (width / 2);
_y = _y + (height / 2);
}
var _local2 = getTimer() - startTime;
if (_local2 < 0) {
_visible = false;
} else {
_visible = true;
_xscale = ((100 + (_local2 / 5)) * width) / 50;
_yscale = ((100 + (_local2 / 5)) * height) / 50;
var _local3 = 1 - (_local2 / 1000);
_alpha = (_local3 * _local3) * 100;
if (_local2 > 1000) {
removeMovieClip();
}
}
}
}