Symbol 36 MovieClip [Flower] Frame 1
#initclip 33
Object.registerClass("Flower", com.king.rubberduck.Flower);
#endinitclip
Symbol 41 MovieClip [Leaf1] Frame 1
stop();
Symbol 44 MovieClip [Leaf2] Frame 1
stop();
Symbol 48 MovieClip Frame 1
function onEnterFrame() {
gotoAndStop((int((getTimer() * 25) / 1000) % 50) + 1);
}
Symbol 49 MovieClip [Twirl] Frame 1
#initclip 24
Object.registerClass("Twirl", com.king.rubberduck.Twirl);
#endinitclip
Symbol 54 MovieClip [SpeedBonus] Frame 1
#initclip 25
Object.registerClass("SpeedBonus", com.king.rubberduck.SpeedBonus);
#endinitclip
Symbol 64 MovieClip [FreezeBonus] Frame 1
#initclip 26
Object.registerClass("FreezeBonus", com.king.rubberduck.FreezeBonus);
#endinitclip
Symbol 73 MovieClip [Bee] Frame 1
#initclip 27
Object.registerClass("Bee", com.king.rubberduck.Bee);
#endinitclip
Symbol 88 MovieClip [Fish] Frame 1
#initclip 28
Object.registerClass("Fish", com.king.rubberduck.Fish);
#endinitclip
Symbol 96 MovieClip [Turtle] Frame 1
#initclip 29
Object.registerClass("Turtle", com.king.rubberduck.Turtle);
#endinitclip
Symbol 112 MovieClip [InstructionsLevel] Frame 1
#initclip 30
Object.registerClass("InstructionsLevel", com.king.rubberduck.InstructionsLevel);
#endinitclip
Symbol 126 MovieClip [Level] Frame 1
#initclip 31
Object.registerClass("Level", com.king.rubberduck.Level);
#endinitclip
Symbol 152 Button
on (press) {
_parent.buttonPressed();
}
Symbol 209 Button
on (press) {
toggleSound();
}
Symbol 213 Button
on (press) {
endGamePressed();
}
Symbol 216 Button
on (press) {
toggleSound();
}
Symbol 217 MovieClip [GamePanel] Frame 1
#initclip 32
Object.registerClass("GamePanel", com.king.rubberduck.GamePanel);
#endinitclip
Symbol 223 MovieClip [__Packages.com.king.rubberduck.Twirl] Frame 0
class com.king.rubberduck.Twirl extends MovieClip
{
var gotoAndStop;
function Twirl () {
super();
}
function onEnterFrame() {
(gotoAndStop((int((getTimer() * 25) / 1000) % 200) + 1));// not popped
}
var takeTime = 0;
}
Symbol 224 MovieClip [__Packages.com.king.rubberduck.SpeedBonus] Frame 0
class com.king.rubberduck.SpeedBonus extends MovieClip
{
var gotoAndStop;
function SpeedBonus () {
super();
}
function onEnterFrame() {
(gotoAndStop((int((getTimer() * 25) / 1000) % 50) + 1));// not popped
}
function take() {
takeTime = getTimer();
onEnterFrame = function () {
var _local3 = getTimer() - this.takeTime;
var _local2 = int(((_local3 * 25) / 1000) + 60);
if (_local2 < 85) {
(this.gotoAndStop(_local2));// not popped
} else {
this.removeMovieClip();
}
};
}
var takeTime = 0;
}
Symbol 225 MovieClip [__Packages.com.king.rubberduck.FreezeBonus] Frame 0
class com.king.rubberduck.FreezeBonus extends MovieClip
{
var gotoAndStop;
function FreezeBonus () {
super();
}
function onEnterFrame() {
(gotoAndStop((int((getTimer() * 25) / 1000) % 50) + 1));// not popped
}
function take() {
takeTime = getTimer();
onEnterFrame = function () {
var _local3 = getTimer() - this.takeTime;
var _local2 = int(((_local3 * 25) / 1000) + 60);
if (_local2 < 85) {
(this.gotoAndStop(_local2));// not popped
} else {
this.removeMovieClip();
}
};
}
var takeTime = 0;
}
Symbol 226 MovieClip [__Packages.com.king.rubberduck.Bee] Frame 0
class com.king.rubberduck.Bee extends MovieClip
{
var freezeTime, tPaths, pathPoints, xPaths, yPaths, pos, subPos, levelItem, x, y, xa, ya, rot, animStep, wrapper, _rotation, _x, _y, body;
function Bee () {
super();
}
function init(levelItem, x, y, random) {
freezeTime = -1;
tPaths = new Array();
var _local16 = 0;
pathPoints = random.nextInt(4) + 3;
if (pathPoints == 5) {
pathPoints = 2;
}
if (pathPoints == 6) {
pathPoints = 32;
}
do {
xPaths = new Array();
yPaths = new Array();
if (_local16 == 0) {
var _local11 = (random.nextDouble() * (com.king.rubberduck.Level.LEVEL_WIDTH - 16)) + 8;
var _local10 = (random.nextDouble() * (com.king.rubberduck.Level.LEVEL_HEIGHT - 16)) + 8;
var _local4 = (random.nextDouble() * 100) + 60;
var _local3 = (random.nextDouble() * 100) + 60;
if (pathPoints == 2) {
_local4 = _local4 * 1.5;
_local3 = _local3 * 1.5;
}
var _local14 = random.nextDouble() * Math.PI;
var _local5 = Math.sin(_local14);
var _local6 = Math.cos(_local14);
var _local2 = 0;
while (_local2 < pathPoints) {
var _local15 = (((_local2 * Math.PI) * 2) / pathPoints) + (Math.PI/4);
var _local8 = (_local11 + ((Math.sin(_local15) * _local4) * _local5)) + ((Math.cos(_local15) * _local3) * _local6);
var _local7 = (_local10 + ((Math.cos(_local15) * _local3) * _local5)) - ((Math.sin(_local15) * _local4) * _local6);
xPaths.push(_local8);
yPaths.push(_local7);
_local2++;
}
}
} while (!isPathOk());
var _local2 = 0;
while (_local2 < pathPoints) {
var _local12 = xPaths[_local2] - xPaths[(_local2 + 1) % pathPoints];
var _local13 = yPaths[_local2] - yPaths[(_local2 + 1) % pathPoints];
var _local15 = Math.sqrt((_local12 * _local12) + (_local13 * _local13));
tPaths.push(int(_local15 / 15) + 1);
_local2++;
}
pos = (subPos = 0);
this.levelItem = levelItem;
this.x = x;
this.y = y;
xa = 0;
ya = 0;
rot = 0;
animStep = 0;
tick();
xa = 0;
ya = 0;
}
function isPathOk() {
var _local2 = 0;
while (_local2 < pathPoints) {
if (!isOkPathPoint2(xPaths[_local2], yPaths[_local2])) {
return(false);
}
var _local3 = xPaths[_local2] - xPaths[(_local2 + 1) % pathPoints];
var _local4 = yPaths[_local2] - yPaths[(_local2 + 1) % pathPoints];
if (com.king.rubberduck.VecMath.simpleCollide(xPaths[_local2], yPaths[_local2], com.king.rubberduck.Level.LEVEL_WIDTH / 2, com.king.rubberduck.Level.LEVEL_HEIGHT / 2, -_local3, -_local4, 0, 0, 50, 1)) {
return(false);
}
_local2++;
}
return(true);
}
function isOkPathPoint2(x, y) {
if ((((x < 8) || (y < 8)) || (x > (com.king.rubberduck.Level.LEVEL_WIDTH - 8))) || (y > (com.king.rubberduck.Level.LEVEL_HEIGHT - 8))) {
return(false);
}
var _local1 = x - (com.king.rubberduck.Level.LEVEL_WIDTH / 2);
var _local2 = y - (com.king.rubberduck.Level.LEVEL_HEIGHT / 2);
var _local3 = 40;
if (((_local1 * _local1) + (_local2 * _local2)) < (_local3 * _local3)) {
return(false);
}
return(true);
}
function isOkPathPoint(x, y) {
var _local2 = 0;
while (_local2 < xPaths.length) {
var _local5 = x - xPaths[_local2];
var _local6 = y - yPaths[_local2];
var _local7 = 60;
if (((_local5 * _local5) + (_local6 * _local6)) < (_local7 * _local7)) {
return(false);
}
_local2++;
}
var _local5 = x - (com.king.rubberduck.Level.LEVEL_WIDTH / 2);
var _local6 = y - (com.king.rubberduck.Level.LEVEL_HEIGHT / 2);
var _local7 = 40;
if (((_local5 * _local5) + (_local6 * _local6)) < (_local7 * _local7)) {
return(false);
}
return(true);
}
function renderPath(mc) {
mc.lineStyle(1, 16777215, 33);
mc.moveTo(xPaths[0], yPaths[0]);
var _local2 = 0;
while (_local2 < pathPoints) {
var _local5 = xPaths[(_local2 + 1) % pathPoints];
var _local4 = yPaths[(_local2 + 1) % pathPoints];
mc.lineTo(_local5, _local4);
if (pathPoints < 10) {
var _local3 = mc.attachMovie("PathPoint", "pathpoint" + _local2, _local2);
_local3._x = _local5;
_local3._y = _local4;
}
_local2++;
}
}
function tick() {
animStep++;
if (freezeTime < 0) {
wrapper._visible = false;
subPos++;
if (subPos >= tPaths[pos]) {
pos = (pos + 1) % pathPoints;
subPos = 0;
}
var _local4 = xPaths[pos];
var _local2 = yPaths[pos];
var _local6 = xPaths[(pos + 1) % pathPoints];
var _local5 = yPaths[(pos + 1) % pathPoints];
var _local3 = tPaths[pos];
xa = (_local6 - _local4) / _local3;
ya = (_local5 - _local2) / _local3;
x = _local4 + (xa * subPos);
y = _local2 + (ya * subPos);
rot = Math.atan2(xa, -ya);
} else {
wrapper._visible = true;
freezeTime--;
if (freezeTime > (2 * com.king.rubberduck.Level.TICKS_PER_SECOND)) {
wrapper.gotoAndStop(1);
} else {
wrapper.gotoAndStop((int((freezeTime * 4) / com.king.rubberduck.Level.TICKS_PER_SECOND) % 2) + 2);
}
xa = 0;
ya = 0;
}
levelItem.x = x;
levelItem.y = y;
levelItem.xa = xa;
levelItem.ya = ya;
}
function stopMoving() {
xa = 0;
ya = 0;
levelItem.xa = 0;
levelItem.ya = 0;
}
function freeze() {
freezeTime = 7 * com.king.rubberduck.Level.TICKS_PER_SECOND;
}
function isHarmful() {
return(freezeTime < 0);
}
function render(alpha) {
_rotation = (rot * 180) / Math.PI;
_x = x + (xa * alpha);
_y = y + (ya * alpha);
if (freezeTime < 0) {
body.gotoAndStop((int((animStep + alpha) * 4) % 25) + 1);
}
}
}
Symbol 227 MovieClip [__Packages.com.king.rubberduck.LevelItem] Frame 0
class com.king.rubberduck.LevelItem
{
var mc, x, y, type, radius, xa, ya;
function LevelItem (mc, x, y, type, radius) {
this.mc = mc;
this.x = x;
this.y = y;
this.type = type;
this.radius = radius;
xa = 0;
ya = 0;
}
static var TYPE_FLOWER_0 = 0;
static var TYPE_FLOWER_1 = 1;
static var TYPE_FLOWER_2 = 2;
static var TYPE_FLOWER_3 = 3;
static var TYPE_SPEED_BONUS = 4;
static var TYPE_FREEZE_BONUS = 5;
static var TYPE_TWIRL = 6;
static var TYPE_BEE = 7;
}
Symbol 228 MovieClip [__Packages.com.king.rubberduck.Level] Frame 0
class com.king.rubberduck.Level extends MovieClip
{
static var DEBUG_DATAS;
var currentLevel, mouseOver, mouseDown, lives, _parent, xDuckI, yDuckI, rDuckI, score, startTime, endTime, timeLeft, random, bonusRandom, objectLayer, speedBonusTime, animTime, animSpeed, flowerSeries, lastFlowerType, dead, deadTime, remainingFlowers, levelItems, twirls, bees, bumpers, levelTime, flowerRespawns, currentTick, addBonusTimes, bonusIds, encoder, decoder, immortalTime, background, lastEncodedXMouse, lastEncodedYMouse, _xmouse, _ymouse, mousePointer, xDuck, yDuck, xDuckA, yDuckA, rDuck, bgLayer, realHider, hiderLayer, duck;
function Level () {
super();
DEBUG_DATAS = new Array("", "", "");
currentLevel = 0;
mouseOver = false;
mouseDown = false;
lives = 3;
var _local3 = 0;
while (_local3 < 3) {
_parent["lifeMeter" + _local3].gotoAndStop(1);
_local3++;
}
xDuckI = new com.midasplayer.timing.IFloat(0);
yDuckI = new com.midasplayer.timing.IFloat(0);
rDuckI = new com.midasplayer.timing.IRotFloat(0);
score = 0;
startTime = -2;
endTime = -1;
timeLeft = 45 * TICKS_PER_SECOND;
updateScoreText();
updateTimerText();
_parent.levelMeter.text = 1;
}
function nextLevel(random) {
this.random = random;
bonusRandom = new com.midasplayer.util.Random(random.nextInt(2147483647));
for (var _local6 in objectLayer) {
if (typeof(objectLayer[_local6]) == "movieclip") {
objectLayer[_local6].removeMovieClip();
}
}
speedBonusTime = -1;
animTime = 0;
animSpeed = 0;
flowerSeries = 0;
lastFlowerType = -1;
dead = false;
deadTime = -1;
startTime = -2;
endTime = -1;
remainingFlowers = 0;
levelItems = new Array();
twirls = new Array();
bees = new Array();
bumpers = new Array();
if (currentLevel == 0) {
levelTime = 45 * TICKS_PER_SECOND;
flowerRespawns = 0;
spawnLeaves(1, 0, 5);
spawnFlowers(50, 1, false);
} else if (currentLevel == 1) {
levelTime = 60 * TICKS_PER_SECOND;
flowerRespawns = 0;
spawnLeaves(0, 2, 5);
spawnBees(1, 6);
spawnFlowers(75, 1, false);
} else if (currentLevel == 2) {
levelTime = 75 * TICKS_PER_SECOND;
flowerRespawns = 50;
spawnLeaves(1, 1, 5);
spawnTwirls(1, 0);
spawnBees(1, 6);
spawnFlowers(50, 1, false);
}
currentTick = -1;
addBonusTimes = new Array();
var _local5 = random.nextInt(4) + 1;
bonusIds = new Array(_local5);
var _local2 = 0;
while (_local2 < _local5) {
var _local3 = random.nextInt(int(levelTime / 2)) + int(levelTime / 6);
addBonusTimes.push(_local3);
_local2++;
}
timeLeft = levelTime;
encoder = new com.midasplayer.util.Encoder();
decoder = new com.midasplayer.util.Decoder(DEBUG_DATAS[currentLevel]);
updateScoreText();
updateTimerText();
spawnDuck();
immortalTime = 0;
currentLevel++;
background.gotoAndStop(currentLevel);
_parent.levelMeter.text = currentLevel;
lastEncodedXMouse = 0;
lastEncodedYMouse = 0;
}
function preStartLevel() {
startTime = -1;
}
function startLevel() {
startTime = 0;
currentTick = -1;
}
function stopLevel() {
startTime = -1;
var _local2 = 0;
while (_local2 < bees.length) {
bees[_local2].stopMoving();
_local2++;
}
endTime = 0;
}
function spawnLeaves(largeLeafCount, smallLeafCount, depth) {
var _local5 = 0;
while (_local5 < (largeLeafCount + smallLeafCount)) {
var _local6 = ((_local5 < largeLeafCount) ? 1 : 0);
var _local4 = objectLayer.attachMovie("Leaf" + (_local6 + 1), "leaf" + _local5, _local5 + (100 * depth));
var _local3 = 0;
var _local2 = 0;
do {
_local3 = (random.nextDouble() * (LEVEL_WIDTH - 160)) + 80;
_local2 = (random.nextDouble() * (LEVEL_HEIGHT - 160)) + 80;
} while (!isFree(_local3, _local2, ((_local6 == 0) ? 22 : 30) + 40));
if (_local6 == 0) {
_local4._x = _local3 - 28;
_local4._y = _local2 - 29;
bumpers.push(new com.king.rubberduck.Bumper(_local4, _local3, _local2, 22));
} else {
_local4._x = _local3 - 35;
_local4._y = _local2 - 38;
bumpers.push(new com.king.rubberduck.Bumper(_local4, _local3, _local2, 30));
}
_local5++;
}
}
function spawnTwirls(twirlCount, depth) {
var _local4 = 0;
while (_local4 < twirlCount) {
var _local5 = objectLayer.attachMovie("Twirl", "twirl" + _local4, _local4 + (100 * depth));
_local5.cacheAsBitmap = true;
var _local3 = 0;
var _local2 = 0;
do {
_local3 = (random.nextDouble() * (LEVEL_WIDTH - 100)) + 50;
_local2 = (random.nextDouble() * (LEVEL_HEIGHT - 100)) + 50;
} while (!isFree(_local3, _local2, 50));
_local5._x = _local3;
_local5._y = _local2;
var _local6 = new com.king.rubberduck.LevelItem(_local5, _local3, _local2, com.king.rubberduck.LevelItem.TYPE_TWIRL, 0);
levelItems.push(_local6);
twirls.push(_local6);
_local4++;
}
}
function spawnFreezeBonuses(i, depth) {
var _local4 = objectLayer.attachMovie("FreezeBonus", "freezebonus" + i, i + (100 * depth));
var _local3 = 0;
var _local2 = 0;
do {
_local3 = (random.nextDouble() * (LEVEL_WIDTH - 80)) + 40;
_local2 = (random.nextDouble() * (LEVEL_HEIGHT - 80)) + 40;
} while (!isFree(_local3, _local2, 17));
_local4._x = _local3 - 17;
_local4._y = _local2 - 17;
var _local5 = new com.king.rubberduck.LevelItem(_local4, _local3, _local2, com.king.rubberduck.LevelItem.TYPE_FREEZE_BONUS, 17);
levelItems.push(_local5);
return(_local5);
}
function spawnSpeedBonuses(i, depth) {
var _local4 = objectLayer.attachMovie("SpeedBonus", "speedbonus" + i, i + (100 * depth));
var _local3 = 0;
var _local2 = 0;
do {
_local3 = (random.nextDouble() * (LEVEL_WIDTH - 80)) + 40;
_local2 = (random.nextDouble() * (LEVEL_HEIGHT - 80)) + 40;
} while (!isFree(_local3, _local2, 17));
_local4._x = _local3 - 17;
_local4._y = _local2 - 17;
var _local5 = new com.king.rubberduck.LevelItem(_local4, _local3, _local2, com.king.rubberduck.LevelItem.TYPE_SPEED_BONUS, 17);
levelItems.push(_local5);
return(_local5);
}
function spawnFlowers(flowerCount, depth, spawnAnim) {
var _local7 = random.nextInt(9) * 2;
var _local8 = _local7 + 1;
var _local5 = 0;
while (_local5 < flowerCount) {
var _local4 = objectLayer.attachMovie("Flower", "flower" + _local5, _local5 + (100 * depth));
var _local3 = 0;
var _local2 = 0;
do {
_local3 = (random.nextDouble() * (LEVEL_WIDTH - 32)) + 16;
_local2 = (random.nextDouble() * (LEVEL_HEIGHT - 32)) + 16;
} while (!isFree(_local3, _local2, 7));
_local4._x = _local3 - 7;
_local4._y = _local2 - 7;
if (spawnAnim) {
_local4.startSpawnAnim(random.nextDouble());
}
var _local6 = random.nextInt(2);
_local4.gotoAndStop(((_local6 == 0) ? (_local7) : (_local8)) + 1);
levelItems.push(new com.king.rubberduck.LevelItem(_local4, _local3, _local2, _local6, 7));
remainingFlowers++;
_local5++;
}
}
function spawnBees(beeCount, depth) {
var _local2 = 0;
while (_local2 < beeCount) {
var _local7 = objectLayer.createEmptyMovieClip("beepath" + _local2, (_local2 * 2) + (100 * depth));
var _local3 = objectLayer.attachMovie("Bee", "bee" + _local2, ((_local2 * 2) + (100 * depth)) + 1);
var _local5 = (random.nextDouble() * (LEVEL_WIDTH - 80)) + 40;
var _local4 = (random.nextDouble() * (LEVEL_HEIGHT - 80)) + 40;
_local3._x = _local5 - 17;
_local3._y = _local4 - 17;
var _local6 = new com.king.rubberduck.LevelItem(_local3, _local5, _local4, com.king.rubberduck.LevelItem.TYPE_BEE, 7);
levelItems.push(_local6);
_local3.init(_local6, _local5, _local4, random);
_local3.renderPath(_local7);
bees.push(_local3);
_local2++;
}
}
function isFree(x, y, radius) {
var _local2 = 0;
while (_local2 < bumpers.length) {
var _local6 = x - bumpers[_local2].x;
var _local7 = y - bumpers[_local2].y;
var _local8 = radius + bumpers[_local2].radius;
if (((_local6 * _local6) + (_local7 * _local7)) < (_local8 * _local8)) {
return(false);
}
_local2++;
}
_local2 = 0;
while (_local2 < twirls.length) {
var _local6 = x - twirls[_local2].x;
var _local7 = y - twirls[_local2].y;
var _local8 = radius + 50;
if (((_local6 * _local6) + (_local7 * _local7)) < (_local8 * _local8)) {
return(false);
}
_local2++;
}
_local2 = 0;
while (_local2 < levelItems.length) {
if (((levelItems[_local2].type != com.king.rubberduck.LevelItem.TYPE_SPEED_BONUS) && (levelItems[_local2].type != com.king.rubberduck.LevelItem.TYPE_FREEZE_BONUS)) && (levelItems[_local2].type != com.king.rubberduck.LevelItem.TYPE_BEE)) {
var _local6 = x - levelItems[_local2].x;
var _local7 = y - levelItems[_local2].y;
var _local8 = radius + levelItems[_local2].radius;
if (((_local6 * _local6) + (_local7 * _local7)) < (_local8 * _local8)) {
return(false);
}
}
_local2++;
}
var _local6 = x - (LEVEL_WIDTH / 2);
var _local7 = y - (LEVEL_HEIGHT / 2);
var _local8 = radius + 40;
if (((_local6 * _local6) + (_local7 * _local7)) < (_local8 * _local8)) {
return(false);
}
return(true);
}
function onMouseDown() {
if ((((_xmouse > 0) && (_ymouse > 0)) && (_xmouse < LEVEL_WIDTH)) && (_ymouse < LEVEL_HEIGHT)) {
mouseDown = true;
} else {
mouseDown = false;
}
}
function onMouseUp() {
mouseDown = false;
}
function onRollOut() {
setMouseOver(false);
}
function onDragOut() {
setMouseOver(false);
}
function onMouseMove() {
setMouseOver(true);
}
function setMouseOver(mouseOver) {
mouseOver = (((mouseOver && (_xmouse > 0)) && (_ymouse > 0)) && (_xmouse < LEVEL_WIDTH)) && (_ymouse < LEVEL_HEIGHT);
if ((startTime < 20) || (endTime >= 0)) {
mouseOver = false;
}
if (this.mouseOver != mouseOver) {
this.mouseOver = mouseOver;
if (mouseOver) {
Mouse.hide();
} else {
Mouse.show();
}
}
mousePointer._visible = mouseOver;
}
function spawnDuck() {
xDuck = LEVEL_WIDTH / 2;
yDuck = LEVEL_HEIGHT / 2;
xDuckA = 0;
yDuckA = 0;
rDuck = 180;
dead = false;
deadTime = -1;
speedBonusTime = -1;
flowerSeries = 0;
lastFlowerType = -1;
immortalTime = TICKS_PER_SECOND * 2;
xDuckI.resetTo(xDuck);
yDuckI.resetTo(yDuck);
rDuckI.resetTo(rDuck);
}
function tick(tick) {
if (startTime == -2) {
return(undefined);
}
currentTick++;
if (tick > potentialSpawnTime) {
potentialSpawnTime = tick + (TICKS_PER_SECOND * 5);
if (Math.random() < 0.5) {
potentialSpawnTime = tick + (TICKS_PER_SECOND * 7);
var _local18 = bgLayer.attachMovie(((Math.random() < 0.5) ? "Fish" : "Turtle"), "fish" + bgSpawnId, bgSpawnId);
bgSpawnId++;
_local18.init(Math.random() * LEVEL_WIDTH, Math.random() * LEVEL_HEIGHT);
_local18.onEnterFrame();
}
}
if ((currentTick % TICKS_PER_SECOND) == 0) {
if (mouseOver) {
Mouse.hide();
} else {
Mouse.show();
}
}
if ((startTime >= 0) && (startTime <= 30)) {
startTime++;
}
if (endTime >= 0) {
endTime++;
if (endTime == 30) {
_parent.levelOver();
}
animTime = animTime + animSpeed;
animSpeed = 1.2;
var _local7 = 0;
while (_local7 < bees.length) {
bees[_local7].stopMoving();
_local7++;
}
} else if (startTime > 30) {
var _local7 = 0;
while (_local7 < addBonusTimes.length) {
var _local9 = random;
random = bonusRandom;
if (currentTick == addBonusTimes[_local7]) {
if ((random.nextDouble() < 0.5) && (currentLevel > 1)) {
bonusIds[_local7] = spawnFreezeBonuses(_local7, 3);
} else {
bonusIds[_local7] = spawnSpeedBonuses(_local7, 4);
}
}
if (currentTick == (addBonusTimes[_local7] + (10 * TICKS_PER_SECOND))) {
var _local2 = 0;
while (_local2 < levelItems.length) {
if (levelItems[_local2] == bonusIds[_local7]) {
levelItems[_local2].mc.removeMovieClip();
levelItems.splice(_local2--, 1);
}
_local2++;
}
}
random = _local9;
_local7++;
}
var _local11 = xDuck + 2000;
var _local10 = yDuck + 2000;
if (DECODE_MODE) {
if (decoder.hasNext()) {
var _local17 = decoder.next();
if (_local17 == 0) {
mouseDown = true;
_local11 = lastEncodedXMouse;
_local10 = lastEncodedYMouse;
} else if (_local17 == 63) {
mouseDown = false;
} else {
mouseDown = true;
var _local20 = decoder.next();
var _local21 = decoder.next();
var _local19 = decoder.next();
_local11 = (_local17 << 6) + _local20;
_local10 = (_local21 << 6) + _local19;
lastEncodedXMouse = _local11;
lastEncodedYMouse = _local10;
}
}
} else {
if (mouseDown) {
_local11 = int(_xmouse + 2000);
_local10 = int(_ymouse + 2000);
}
if (_local11 < 64) {
_local11 = 64;
}
if (_local10 < 64) {
_local10 = 64;
}
if (_local11 > 4000) {
_local11 = 4000;
}
if (_local10 > 4000) {
_local10 = 4000;
}
if (mouseDown) {
if ((_local11 == lastEncodedXMouse) && (_local10 == lastEncodedYMouse)) {
encoder.append(0);
} else {
lastEncodedXMouse = _local11;
lastEncodedYMouse = _local10;
encoder.append(int(_local11 >> 6));
encoder.append(int(_local11 & 63));
encoder.append(int(_local10 >> 6));
encoder.append(int(_local10 & 63));
}
} else {
encoder.append(63);
}
}
_local11 = _local11 - 2000;
_local10 = _local10 - 2000;
var _local13 = (_local11 - xDuck) * DRAG_SCALE;
var _local12 = (_local10 - yDuck) * DRAG_SCALE;
var _local15 = Math.sqrt((_local13 * _local13) + (_local12 * _local12));
if (_local15 < 1) {
_local15 = 1;
}
var _local16 = _local15;
if (_local16 > MAX_DRAG_DISTANCE) {
_local16 = MAX_DRAG_DISTANCE;
}
var _local14 = (1 / _local15) * _local16;
if (!dead) {
if (speedBonusTime > 0) {
xDuckA = (xDuckA * DUCK_INERTIA_SPEED_BONUS) + ((_local13 * DUCK_ACCELERATION_SPEED_BONUS) * _local14);
yDuckA = (yDuckA * DUCK_INERTIA_SPEED_BONUS) + ((_local12 * DUCK_ACCELERATION_SPEED_BONUS) * _local14);
} else {
xDuckA = (xDuckA * DUCK_INERTIA) + ((_local13 * DUCK_ACCELERATION) * _local14);
yDuckA = (yDuckA * DUCK_INERTIA) + ((_local12 * DUCK_ACCELERATION) * _local14);
}
} else {
deadTime++;
xDuckA = (xDuckA * DUCK_INERTIA) * 0.8;
yDuckA = (yDuckA * DUCK_INERTIA) * 0.8;
if (deadTime == (TICKS_PER_SECOND * 2)) {
if (lives > 0) {
spawnDuck();
} else {
com.king.rubberduck.Sounds.get("musicLoop").stop();
com.king.rubberduck.Sounds.get("gameOverSong").play();
com.king.rubberduck.Sounds.get("noTimeSound").stop();
levelComplete();
}
}
}
_local7 = 0;
while (_local7 < twirls.length) {
var _local4 = xDuck - twirls[_local7].x;
var _local5 = yDuck - twirls[_local7].y;
var _local6 = 100;
var _local3 = (_local4 * _local4) + (_local5 * _local5);
if (_local3 < (_local6 * _local6)) {
_local3 = 1 - (Math.sqrt(_local3) / _local6);
_local3 = (_local3 * _local3) * 8;
var _local8 = Math.sqrt((_local4 * _local4) + (_local5 * _local5));
xDuckA = xDuckA - ((_local4 / _local8) * _local3);
yDuckA = yDuckA - ((_local5 / _local8) * _local3);
}
_local7++;
}
_local7 = 0;
while (_local7 < bees.length) {
bees[_local7].tick();
_local7++;
}
moveDuck(xDuckA, yDuckA, 1);
if (speedBonusTime > 0) {
speedBonusTime--;
}
if (immortalTime > 0) {
immortalTime--;
}
if (!dead) {
if (((_local13 * _local13) + (_local12 * _local12)) > 9) {
rDuck = ((-Math.atan2(_local13, _local12)) * 180) / Math.PI;
}
} else {
rDuck = rDuck + 10;
}
if ((lives > 0) && (endTime == -1)) {
timeLeft--;
if (timeLeft == ((TICKS_PER_SECOND * 5) + int(TICKS_PER_SECOND / 2))) {
com.king.rubberduck.Sounds.get("noTimeSound").play();
}
if (timeLeft == 0) {
com.king.rubberduck.Sounds.get("musicLoop").stop();
com.king.rubberduck.Sounds.get("gameOverSong").play();
com.king.rubberduck.Sounds.get("noTimeSound").stop();
levelComplete();
}
if ((timeLeft % TICKS_PER_SECOND) == 0) {
updateTimerText();
}
}
animTime = animTime + animSpeed;
animSpeed = (Math.sqrt(_local16) / 5) + 1;
} else {
animTime = animTime + animSpeed;
animSpeed = 1.2;
}
xDuckI.set(xDuck);
yDuckI.set(yDuck);
rDuckI.set(rDuck);
}
function updateTimerText() {
var _local2 = int(timeLeft / TICKS_PER_SECOND);
var _local3 = int(_local2 / 60);
_local2 = _local2 % 60;
_parent.timeMeter.text = ((_local3 + ":") + ((_local2 < 10) ? "0" : "")) + _local2;
}
function updateScoreText() {
_parent.scoreMeter.text = score;
}
function moveDuck(xa, ya, iteration) {
var _local3 = 2;
var _local7;
var _local2 = 0;
while (_local2 < bumpers.length) {
var _local4 = com.king.rubberduck.VecMath.collide(xDuck, yDuck, bumpers[_local2].x, bumpers[_local2].y, xa, ya, 0, 0, DUCK_RADIUS, bumpers[_local2].radius);
if (_local4 < _local3) {
_local3 = _local4;
_local7 = bumpers[_local2];
}
_local2++;
}
var _local4 = _local3;
if (_local4 >= 1) {
checkItemCollide(xDuck, yDuck, xa, ya);
xDuck = xDuck + xa;
yDuck = yDuck + ya;
} else {
var _local8 = (xDuckA * xDuckA) + (yDuckA * yDuckA);
if (_local8 > 20) {
com.king.rubberduck.Sounds.get("bounceSound").playOffsVolPan(0, 80, ((xDuck * 100) / LEVEL_WIDTH) - 50);
}
if (_local4 < 0) {
_local4 = 0;
}
if (_local4 > 0) {
checkItemCollide(xDuck, yDuck, xa * _local4, ya * _local4);
xDuck = xDuck + (xa * _local4);
yDuck = yDuck + (ya * _local4);
}
deflect(xDuck, yDuck, _local7.x, _local7.y, xa, ya, 0, 0);
if (iteration < MAX_COLLIDE_ITERATIONS) {
moveDuck(xDuckA * (1 - _local4), yDuckA * (1 - _local4), iteration++);
}
_local7.mc.gotoAndPlay(2);
}
if (xDuck < 16) {
if ((xDuckA * xDuckA) > 10) {
com.king.rubberduck.Sounds.get("bounceSound").playOffsVolPan(0, 80, ((xDuck * 100) / LEVEL_WIDTH) - 50);
}
xDuck = 16;
xDuckA = -xDuckA;
}
if (xDuck > (LEVEL_WIDTH - 16)) {
if ((xDuckA * xDuckA) > 10) {
com.king.rubberduck.Sounds.get("bounceSound").playOffsVolPan(0, 80, ((xDuck * 100) / LEVEL_WIDTH) - 50);
}
xDuck = LEVEL_WIDTH - 16;
xDuckA = -xDuckA;
}
if (yDuck < 16) {
if ((yDuckA * yDuckA) > 10) {
com.king.rubberduck.Sounds.get("bounceSound").playOffsVolPan(0, 80, ((xDuck * 100) / LEVEL_WIDTH) - 50);
}
yDuck = 16;
yDuckA = -yDuckA;
}
if (yDuck > (LEVEL_HEIGHT - 16)) {
if ((yDuckA * yDuckA) > 10) {
com.king.rubberduck.Sounds.get("bounceSound").playOffsVolPan(0, 80, ((xDuck * 100) / LEVEL_WIDTH) - 50);
}
yDuck = LEVEL_HEIGHT - 16;
yDuckA = -yDuckA;
}
}
function checkItemCollide(x, y, xa, ya) {
if (dead) {
return(undefined);
}
var _local2 = 0;
while (_local2 < levelItems.length) {
var _local6 = com.king.rubberduck.VecMath.simpleCollide(x, y, levelItems[_local2].x, levelItems[_local2].y, xa, ya, levelItems[_local2].xa, levelItems[_local2].ya, DUCK_RADIUS, levelItems[_local2].radius);
if (_local6) {
var _local5 = levelItems[_local2].type;
switch (_local5) {
case com.king.rubberduck.LevelItem.TYPE_FLOWER_0 :
case com.king.rubberduck.LevelItem.TYPE_FLOWER_1 :
case com.king.rubberduck.LevelItem.TYPE_FLOWER_2 :
case com.king.rubberduck.LevelItem.TYPE_FLOWER_3 :
if (lastFlowerType != levelItems[_local2].type) {
flowerSeries = 0;
lastFlowerType = levelItems[_local2].type;
}
var _local4 = 50 + (flowerSeries * 1);
score = score + _local4;
updateScoreText();
flowerSeries++;
com.king.rubberduck.Sounds.get("catchSound" + (_local5 & 1)).playOffsVolPan(0.2, 50 + (Math.random() * 20), ((levelItems[_local2].x * 100) / LEVEL_WIDTH) - 50);
levelItems[_local2].mc.take(_local4);
levelItems.splice(_local2--, 1);
remainingFlowers--;
if (remainingFlowers == 0) {
if (flowerRespawns == 0) {
com.king.rubberduck.Sounds.get("musicLoop").stop();
com.king.rubberduck.Sounds.get("levelEndSong").play();
com.king.rubberduck.Sounds.get("noTimeSound").stop();
levelComplete();
return(undefined);
}
com.king.rubberduck.Sounds.get("flowerRechargeSound").play();
spawnFlowers(flowerRespawns, 2, true);
flowerSeries = 0;
flowerRespawns = 0;
lastFlowerType = -1;
}
break;
case com.king.rubberduck.LevelItem.TYPE_SPEED_BONUS :
levelItems[_local2].mc.take(_local4);
com.king.rubberduck.Sounds.get("takeBonusSound").playOffsVolPan(0, 80, ((levelItems[_local2].x * 100) / LEVEL_WIDTH) - 50);
speedBonusTime = 5 * TICKS_PER_SECOND;
levelItems.splice(_local2--, 1);
break;
case com.king.rubberduck.LevelItem.TYPE_FREEZE_BONUS :
levelItems[_local2].mc.take(_local4);
com.king.rubberduck.Sounds.get("takeBonusSound").playOffsVolPan(0, 80, ((levelItems[_local2].x * 100) / LEVEL_WIDTH) - 50);
var _local3 = 0;
while (_local3 < bees.length) {
bees[_local3].freeze();
_local3++;
}
levelItems.splice(_local2--, 1);
break;
case com.king.rubberduck.LevelItem.TYPE_BEE :
if (levelItems[_local2].mc.isHarmful() && (immortalTime <= 0)) {
com.king.rubberduck.Sounds.get("dieSound").play();
xDuckA = xDuckA + levelItems[_local2].xa;
yDuckA = yDuckA + levelItems[_local2].ya;
die();
return(undefined);
}
break;
case com.king.rubberduck.LevelItem.TYPE_TWIRL :
if (immortalTime > 0) {
break;
}
com.king.rubberduck.Sounds.get("dieSound").play();
die();
return(undefined);
}
}
_local2++;
}
}
function die() {
if (!dead) {
lives--;
_parent["lifeMeter" + lives].gotoAndStop(2);
dead = true;
deadTime = 0;
}
}
function levelComplete() {
var _local2 = 0;
while (_local2 < bees.length) {
bees[_local2].stopMoving();
_local2++;
}
endTime = 0;
}
function deflect(xp0, yp0, xp1, yp1, xd0, yd0, xd1, yd1) {
var _local2 = xp0 - xp1;
var _local3 = yp0 - yp1;
var _local5 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
_local2 = _local2 / _local5;
_local3 = _local3 / _local5;
var _local9 = xd0 - xd1;
var _local10 = yd0 - yd1;
var _local7 = (xd0 * _local2) + (yd0 * _local3);
var _local6 = (xd1 * _local2) + (yd1 * _local3);
var _local8 = 0.5;
var _local4 = (_local7 - _local6) + ((_local7 - _local6) * _local8);
_local2 = _local2 * _local4;
_local3 = _local3 * _local4;
xDuckA = xDuckA - (_local2 * 1);
yDuckA = yDuckA - (_local3 * 1);
}
function render(tick, alpha) {
if (startTime == -2) {
realHider._visible = true;
hiderLayer._visible = false;
return(undefined);
}
if ((startTime >= 30) && (endTime <= 0)) {
realHider._visible = false;
hiderLayer._visible = false;
} else {
var _local4 = ((startTime + alpha) / 20) + 0.4;
if (startTime <= 0) {
_local4 = 0.4;
}
if (endTime >= 0) {
_local4 = ((30 - endTime) - alpha) / 20;
}
if (_local4 < 0.1) {
realHider._visible = true;
hiderLayer._visible = false;
} else {
_local4 = ((_local4 * _local4) * 3000) + 30;
realHider._visible = false;
hiderLayer._visible = _local4 < 10000;
if (_local4 < 10000) {
hiderLayer.transitionEffect._x = xDuckI.get(alpha);
hiderLayer.transitionEffect._y = yDuckI.get(alpha);
hiderLayer.transitionEffect._xscale = _local4;
hiderLayer.transitionEffect._yscale = _local4;
}
}
}
var _local2 = 0;
while (_local2 < bees.length) {
bees[_local2].render(alpha);
_local2++;
}
mousePointer._x = _xmouse;
mousePointer._y = _ymouse;
mousePointer.gotoAndStop((mouseDown ? (((speedBonusTime > 0) ? 3 : 2)) : 1));
duck._visible = (immortalTime <= 0) || ((int(getTimer() / 100) & 1) == 0);
if (!dead) {
var _local5 = animTime + (animSpeed * alpha);
duck.gotoAndStop((int(_local5) % 25) + 1);
duck._x = xDuckI.get(alpha) - (Math.sin((rDuckI.get(alpha) * Math.PI) / 180) * 10);
duck._y = yDuckI.get(alpha) + (Math.cos((rDuckI.get(alpha) * Math.PI) / 180) * 10);
duck._rotation = rDuckI.get(alpha);
} else {
duck._x = xDuckI.get(alpha);
duck._y = yDuckI.get(alpha);
duck._rotation = 0;
duck.gotoAndStop(26);
duck.deathAnim.gotoAndStop(int((((deadTime + alpha) * 25) / 20) + 1));
}
}
function getRoundData() {
return(encoder.res);
}
static var DECODE_MODE = false;
static var TICKS_PER_SECOND = 20;
static var MAX_COLLIDE_ITERATIONS = 2;
static var LEVEL_WIDTH = 552;
static var LEVEL_HEIGHT = 452;
static var DUCK_RADIUS = 16;
static var MAX_DRAG_DISTANCE = 400;
static var DRAG_SCALE = 4;
static var DUCK_INERTIA = 0.85;
static var DUCK_ACCELERATION = 0.007;
static var DUCK_INERTIA_SPEED_BONUS = 0.6;
static var DUCK_ACCELERATION_SPEED_BONUS = 0.02;
var bgSpawnId = 0;
var potentialSpawnTime = 0;
}
Symbol 229 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 230 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 231 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 232 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 233 MovieClip [__Packages.com.midasplayer.util.Encoder] Frame 0
class com.midasplayer.util.Encoder
{
var res;
function Encoder () {
res = "";
}
function append(value) {
res = res + BASE_64_CHARS.charAt(value);
}
static var BASE_64_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#!";
}
Symbol 234 MovieClip [__Packages.com.midasplayer.util.Decoder] Frame 0
class com.midasplayer.util.Decoder
{
var res, p;
function Decoder (res) {
this.res = res;
p = 0;
}
function hasNext() {
return(p < (res.length - 1));
}
function next() {
return(BASE_64_CHARS.indexOf(res.charAt(p++)));
}
static var BASE_64_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#!";
}
Symbol 235 MovieClip [__Packages.com.king.rubberduck.Bumper] Frame 0
class com.king.rubberduck.Bumper
{
var mc, x, y, radius;
function Bumper (mc, x, y, radius) {
this.mc = mc;
this.x = x;
this.y = y;
this.radius = radius;
}
}
Symbol 236 MovieClip [__Packages.com.king.rubberduck.Sounds] Frame 0
class com.king.rubberduck.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.rubberduck.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 playOffsVolPan(offs, vol, pan) {
sound.start(offs, 0);
sound.setVolume(vol);
sound.setPan(pan);
}
function play() {
sound.start(0);
}
function stop() {
sound.stop();
}
static var soundMap = new Object();
static var soundOn = true;
}
Symbol 237 MovieClip [__Packages.com.king.rubberduck.VecMath] Frame 0
class com.king.rubberduck.VecMath
{
function VecMath () {
}
static function simpleCollide(xp0, yp0, xp1, yp1, xd0, yd0, xd1, yd1, r0, r1) {
var _local3 = xp0 - xp1;
var _local4 = yp0 - yp1;
var _local2 = xd1 - xd0;
var _local1 = yd1 - yd0;
if (((_local2 * _local2) + (_local1 * _local1)) == 0) {
return(false);
}
var _local7 = (_local2 * _local3) + (_local1 * _local4);
if (_local7 < 0) {
return(false);
}
var _local11 = (_local2 * _local2) + (_local1 * _local1);
var _local8 = r0 + r1;
var _local10 = ((_local3 * _local3) + (_local4 * _local4)) - (_local8 * _local8);
var _local6 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
_local2 = _local2 / _local6;
_local1 = _local1 / _local6;
var _local5 = (_local2 * _local3) + (_local1 * _local4);
_local7 = (_local5 * _local5) - _local10;
if (_local7 <= 0) {
return(false);
}
var _local9 = _local5 - Math.sqrt(_local7);
if ((_local9 * _local9) > _local11) {
return(false);
}
return(true);
}
static function collide(xp0, yp0, xp1, yp1, xd0, yd0, xd1, yd1, r0, r1) {
var _local2 = xp0 - xp1;
var _local3 = yp0 - yp1;
var _local7 = xd1 - xd0;
var _local6 = yd1 - yd0;
if (((_local7 * _local7) + (_local6 * _local6)) == 0) {
return(1);
}
var _local4 = (_local7 * _local2) + (_local6 * _local3);
if (_local4 < 0) {
return(1);
}
var _local19 = Math.sqrt((_local7 * _local7) + (_local6 * _local6));
var _local5 = r0 + r1;
var _local18 = ((_local2 * _local2) + (_local3 * _local3)) - (_local5 * _local5);
var _local17 = Math.sqrt((_local7 * _local7) + (_local6 * _local6));
_local7 = _local7 / _local17;
_local6 = _local6 / _local17;
var _local16 = (_local7 * _local2) + (_local6 * _local3);
_local4 = (_local16 * _local16) - _local18;
if (_local4 <= 0) {
return(1);
}
var _local1 = (_local16 - Math.sqrt(_local4)) / _local19;
if (_local1 > 1) {
return(1);
}
do {
_local2 = (xp0 + (xd0 * _local1)) - (xp1 + (xd1 * _local1));
_local3 = (yp0 + (yd0 * _local1)) - (yp1 + (yd1 * _local1));
_local4 = (_local2 * _local2) + (_local3 * _local3);
if (_local4 > (_local5 * _local5)) {
return(_local1);
}
_local1 = _local1 - 0.1;
} while (_local1 > 0);
return(0);
}
}
Symbol 238 MovieClip [__Packages.com.king.rubberduck.Fish] Frame 0
class com.king.rubberduck.Fish extends MovieClip
{
var startTime, timeOffs, dir, lifeTime, size, startX, startY, _x, _y, _rotation, _alpha, _xscale, _yscale, removeMovieClip, gotoAndStop;
function Fish () {
super();
}
function init(x, y) {
startTime = getTimer();
timeOffs = Math.random() * 10000;
dir = (Math.random() * Math.PI) * 2;
lifeTime = (Math.random() * 10000) + 10000;
size = (Math.random() * 50) + 30;
startX = x + (((Math.sin(dir) * lifeTime) / 2) * SPEED);
startY = y + (((Math.cos(dir) * lifeTime) / 2) * SPEED);
}
function onEnterFrame() {
var _local2 = getTimer() - startTime;
_x = startX - ((Math.sin(dir) * _local2) * SPEED);
_y = startY - ((Math.cos(dir) * _local2) * SPEED);
_rotation = ((-dir) * 180) / Math.PI;
if (_local2 < 3000) {
_alpha = (_local2 / 3000) * 15;
_xscale = (_yscale = size * ((_local2 / 6000) + 0.5));
} else if (_local2 > (lifeTime - 3000)) {
_alpha = ((lifeTime - _local2) / 3000) * 15;
_xscale = (_yscale = size * (((lifeTime - _local2) / 6000) + 0.5));
} else {
_xscale = (_yscale = size);
_alpha = 15;
}
if (_local2 > lifeTime) {
removeMovieClip();
}
(gotoAndStop((int(((getTimer() * 25) / 1000) + timeOffs) % 25) + 1));// not popped
}
var takeTime = 0;
static var SPEED = 0.05;
}
Symbol 239 MovieClip [__Packages.com.king.rubberduck.Turtle] Frame 0
class com.king.rubberduck.Turtle extends MovieClip
{
var startTime, timeOffs, dir, lifeTime, size, startX, startY, _x, _y, _rotation, _alpha, _xscale, _yscale, removeMovieClip, gotoAndStop;
function Turtle () {
super();
}
function init(x, y) {
startTime = getTimer();
timeOffs = Math.random() * 10000;
dir = (Math.random() * Math.PI) * 2;
lifeTime = (Math.random() * 10000) + 10000;
size = (Math.random() * 30) + 30;
startX = x + (((Math.sin(dir) * lifeTime) / 2) * SPEED);
startY = y + (((Math.cos(dir) * lifeTime) / 2) * SPEED);
}
function onEnterFrame() {
var _local3 = Math.sin(((((((getTimer() * 25) / 1000) + timeOffs) / 50) * Math.PI) * 2) - 1.2) * 150;
var _local2 = getTimer() - startTime;
_x = startX - ((Math.sin(dir) * (_local2 + _local3)) * SPEED);
_y = startY - ((Math.cos(dir) * (_local2 + _local3)) * SPEED);
_rotation = ((-dir) * 180) / Math.PI;
if (_local2 < 3000) {
_alpha = (_local2 / 3000) * 15;
_xscale = (_yscale = size * ((_local2 / 6000) + 0.5));
} else if (_local2 > (lifeTime - 3000)) {
_alpha = ((lifeTime - _local2) / 3000) * 15;
_xscale = (_yscale = size * (((lifeTime - _local2) / 6000) + 0.5));
} else {
_xscale = (_yscale = size);
_alpha = 15;
}
if (_local2 > lifeTime) {
removeMovieClip();
}
(gotoAndStop((int(((getTimer() * 25) / 1000) + timeOffs) % 50) + 1));// not popped
}
var takeTime = 0;
static var SPEED = 0.02;
}
Symbol 240 MovieClip [__Packages.com.king.rubberduck.InstructionsLevel] Frame 0
class com.king.rubberduck.InstructionsLevel extends MovieClip
{
var xMouseI, yMouseI, currentLevel, mouseOver, mouseDown, lives, _parent, xDuckI, yDuckI, rDuckI, score, startTime, endTime, random, bonusRandom, objectLayer, speedBonusTime, animTime, animSpeed, flowerSeries, lastFlowerType, dead, deadTime, remainingFlowers, encoder, decoder, levelItems, currentTick, immortalTime, background, lastEncodedXMouse, lastEncodedYMouse, xDuck, yDuck, xDuckA, yDuckA, rDuck, _xmouse, _ymouse, mousePointer, duck;
function InstructionsLevel () {
super();
xMouseI = new com.midasplayer.timing.IFloat(0);
yMouseI = new com.midasplayer.timing.IFloat(0);
currentLevel = 0;
mouseOver = false;
mouseDown = false;
lives = 3;
var _local3 = 0;
while (_local3 < 3) {
_parent["lifeMeter" + _local3].gotoAndStop(1);
_local3++;
}
xDuckI = new com.midasplayer.timing.IFloat(0);
yDuckI = new com.midasplayer.timing.IFloat(0);
rDuckI = new com.midasplayer.timing.IRotFloat(0);
score = 0;
startTime = -1;
endTime = -1;
_parent.levelMeter.text = 1;
}
function onMouseDown() {
mouseDown = true;
}
function onMouseUp() {
mouseDown = false;
}
function nextLevel(random) {
this.random = random;
bonusRandom = new com.midasplayer.util.Random(random.nextInt(2147483647));
for (var _local2 in objectLayer) {
if (typeof(objectLayer[_local2]) == "movieclip") {
objectLayer[_local2].removeMovieClip();
}
}
speedBonusTime = -1;
animTime = 0;
animSpeed = 0;
flowerSeries = 0;
lastFlowerType = -1;
dead = false;
deadTime = -1;
startTime = -1;
endTime = -1;
remainingFlowers = 0;
encoder = new com.midasplayer.util.Encoder();
decoder = new com.midasplayer.util.Decoder(DECODE_DATA);
levelItems = new Array();
spawnFlowers(10, 1, false);
currentTick = -1;
spawnDuck();
immortalTime = 0;
currentLevel++;
background.gotoAndStop(currentLevel);
_parent.levelMeter.text = currentLevel;
lastEncodedXMouse = 0;
lastEncodedYMouse = 0;
}
function startLevel() {
startTime = 0;
currentTick = -1;
}
function spawnFlowers(flowerCount, depth, spawnAnim) {
var _local7 = random.nextInt(9) * 2;
var _local8 = _local7 + 1;
var _local5 = 0;
while (_local5 < flowerCount) {
var _local4 = objectLayer.attachMovie("Flower", "flower" + _local5, _local5 + (100 * depth));
var _local3 = 0;
var _local2 = 0;
do {
_local3 = (random.nextDouble() * (LEVEL_WIDTH - 32)) + 16;
_local2 = (random.nextDouble() * (LEVEL_HEIGHT - 32)) + 16;
} while (!isFree(_local3, _local2, 7));
_local4._x = _local3 - 7;
_local4._y = _local2 - 7;
if (spawnAnim) {
_local4.startSpawnAnim(random.nextDouble());
}
var _local6 = random.nextInt(2);
_local4.gotoAndStop(((_local6 == 0) ? (_local7) : (_local8)) + 1);
levelItems.push(new com.king.rubberduck.LevelItem(_local4, _local3, _local2, _local6, 7));
remainingFlowers++;
_local5++;
}
}
function isFree(x, y, radius) {
var _local2 = 0;
while (_local2 < levelItems.length) {
if (((levelItems[_local2].type != com.king.rubberduck.LevelItem.TYPE_SPEED_BONUS) && (levelItems[_local2].type != com.king.rubberduck.LevelItem.TYPE_FREEZE_BONUS)) && (levelItems[_local2].type != com.king.rubberduck.LevelItem.TYPE_BEE)) {
var _local6 = x - levelItems[_local2].x;
var _local7 = y - levelItems[_local2].y;
var _local8 = radius + levelItems[_local2].radius;
if (((_local6 * _local6) + (_local7 * _local7)) < (_local8 * _local8)) {
return(false);
}
}
_local2++;
}
var _local6 = x - (LEVEL_WIDTH / 2);
var _local7 = y - (LEVEL_HEIGHT / 2);
var _local8 = radius + 40;
if (((_local6 * _local6) + (_local7 * _local7)) < (_local8 * _local8)) {
return(false);
}
return(true);
}
function spawnDuck() {
xDuck = LEVEL_WIDTH / 2;
yDuck = LEVEL_HEIGHT / 2;
xDuckA = 0;
yDuckA = 0;
rDuck = 180;
dead = false;
deadTime = -1;
speedBonusTime = -1;
flowerSeries = 0;
lastFlowerType = -1;
immortalTime = TICKS_PER_SECOND * 2;
xDuckI.resetTo(xDuck);
yDuckI.resetTo(yDuck);
rDuckI.resetTo(rDuck);
}
function tick(tick) {
currentTick++;
var _local3 = xDuck + 2000;
var _local2 = yDuck + 2000;
if (DECODE_MODE) {
if (decoder.hasNext()) {
mouseDown = decoder.next() == 0;
var _local14 = decoder.next();
var _local12 = decoder.next();
var _local13 = decoder.next();
var _local11 = decoder.next();
_local3 = (_local14 << 6) + _local12;
_local2 = (_local13 << 6) + _local11;
lastEncodedXMouse = _local3;
lastEncodedYMouse = _local2;
}
} else {
_local3 = int(_xmouse + 2000);
_local2 = int(_ymouse + 2000);
}
if (_local3 < 64) {
_local3 = 64;
}
if (_local2 < 64) {
_local2 = 64;
}
if (_local3 > 4000) {
_local3 = 4000;
}
if (_local2 > 4000) {
_local2 = 4000;
}
var _local8 = int(_xmouse + 2000);
var _local9 = int(_ymouse + 2000);
lastEncodedXMouse = _local8;
lastEncodedYMouse = _local9;
encoder.append((mouseDown ? 0 : 63));
encoder.append(int(_local8 >> 6));
encoder.append(int(_local8 & 63));
encoder.append(int(_local9 >> 6));
encoder.append(int(_local9 & 63));
_local3 = _local3 - 2000;
_local2 = _local2 - 2000;
xMouseI.set(_local3);
yMouseI.set(_local2);
if (!mouseDown) {
_local3 = xDuck;
_local2 = yDuck;
}
var _local5 = (_local3 - xDuck) * DRAG_SCALE;
var _local4 = (_local2 - yDuck) * DRAG_SCALE;
var _local6 = Math.sqrt((_local5 * _local5) + (_local4 * _local4));
if (_local6 < 1) {
_local6 = 1;
}
var _local7 = _local6;
if (_local7 > MAX_DRAG_DISTANCE) {
_local7 = MAX_DRAG_DISTANCE;
}
var _local10 = (1 / _local6) * _local7;
xDuckA = (xDuckA * DUCK_INERTIA) + ((_local5 * DUCK_ACCELERATION) * _local10);
yDuckA = (yDuckA * DUCK_INERTIA) + ((_local4 * DUCK_ACCELERATION) * _local10);
moveDuck(xDuckA, yDuckA, 1);
if (((_local5 * _local5) + (_local4 * _local4)) > 9) {
rDuck = ((-Math.atan2(_local5, _local4)) * 180) / Math.PI;
}
animTime = animTime + animSpeed;
animSpeed = (Math.sqrt(_local7) / 5) + 1;
xDuckI.set(xDuck);
yDuckI.set(yDuck);
rDuckI.set(rDuck);
}
function moveDuck(xa, ya, iteration) {
var _local4 = 2;
var _local5;
checkItemCollide(xDuck, yDuck, xa, ya);
xDuck = xDuck + xa;
yDuck = yDuck + ya;
if (xDuck < 16) {
xDuck = 16;
xDuckA = -xDuckA;
}
if (xDuck > (LEVEL_WIDTH - 16)) {
xDuck = LEVEL_WIDTH - 16;
xDuckA = -xDuckA;
}
if (yDuck < 16) {
yDuck = 16;
yDuckA = -yDuckA;
}
if (yDuck > (LEVEL_HEIGHT - 16)) {
yDuck = LEVEL_HEIGHT - 16;
yDuckA = -yDuckA;
}
}
function checkItemCollide(x, y, xa, ya) {
if (dead) {
return(undefined);
}
var _local2 = 0;
while (_local2 < levelItems.length) {
var _local4 = com.king.rubberduck.VecMath.simpleCollide(x, y, levelItems[_local2].x, levelItems[_local2].y, xa, ya, levelItems[_local2].xa, levelItems[_local2].ya, DUCK_RADIUS, levelItems[_local2].radius);
if (_local4) {
var _local5 = levelItems[_local2].type;
switch (_local5) {
case com.king.rubberduck.LevelItem.TYPE_FLOWER_0 :
case com.king.rubberduck.LevelItem.TYPE_FLOWER_1 :
case com.king.rubberduck.LevelItem.TYPE_FLOWER_2 :
case com.king.rubberduck.LevelItem.TYPE_FLOWER_3 :
if (lastFlowerType != levelItems[_local2].type) {
flowerSeries = 0;
lastFlowerType = levelItems[_local2].type;
}
var _local3 = 50 + (flowerSeries * 1);
flowerSeries++;
levelItems[_local2].mc.take(_local3);
levelItems.splice(_local2--, 1);
remainingFlowers--;
}
}
_local2++;
}
}
function deflect(xp0, yp0, xp1, yp1, xd0, yd0, xd1, yd1) {
var _local2 = xp0 - xp1;
var _local3 = yp0 - yp1;
var _local5 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
_local2 = _local2 / _local5;
_local3 = _local3 / _local5;
var _local9 = xd0 - xd1;
var _local10 = yd0 - yd1;
var _local7 = (xd0 * _local2) + (yd0 * _local3);
var _local6 = (xd1 * _local2) + (yd1 * _local3);
var _local8 = 0.5;
var _local4 = (_local7 - _local6) + ((_local7 - _local6) * _local8);
_local2 = _local2 * _local4;
_local3 = _local3 * _local4;
xDuckA = xDuckA - (_local2 * 1);
yDuckA = yDuckA - (_local3 * 1);
}
function render(tick, alpha) {
mousePointer._visible = true;
mousePointer._x = xMouseI.get(alpha);
mousePointer._y = yMouseI.get(alpha);
mousePointer.gotoAndStop((mouseDown ? (((speedBonusTime > 0) ? 3 : 2)) : 1));
_parent.mouse._x = 235 + (xMouseI.get(alpha) / 3);
_parent.mouse._y = 110 + (yMouseI.get(alpha) / 3);
_parent.mouse.gotoAndStop((mouseDown ? 2 : 1));
var _local3 = animTime + (animSpeed * alpha);
duck.gotoAndStop((int(_local3) % 25) + 1);
duck._x = xDuckI.get(alpha) - (Math.sin((rDuckI.get(alpha) * Math.PI) / 180) * 10);
duck._y = yDuckI.get(alpha) + (Math.cos((rDuckI.get(alpha) * Math.PI) / 180) * 10);
duck._rotation = rDuckI.get(alpha);
}
static var DECODE_MODE = true;
static var DECODE_DATA = "!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WpWY!WoWY!WhWW!WVWV!WOWU!WJWT!WDWR!WCWR0WCWR0W6WN0W2WK0W0WJ0W0WJ0V!WJ0V!WJ0VzWK0VwWX0W0Wq0W8X30WDXA0WEXA!WEXA!WUXH!WVXI0WVXI0WmXT0WmXT0WpXU0WtXV!WtXV!X9XV!XLXV!XOXU!XTXP!XUXO!XUXO0XUXO0XIXB0XFX5!XFX5!X7Wo!XBWx!XCX5!X7X5!X5X5!WoWb!WYW6!WQVq!WMVl0WMVl0WMVl0WXVj0WkVe0WpVd0WvVa0WyVY0W#VX0X1VX!X1VX!X1VX!XFWA!XVWT!XYWU!XcWW!XkWb!XlWc0XlWc0Y7WX0Y9WX0YAWd0YAWi!YAWi!YAWi!YDWi!YIWd!YPWY!YUWT!YRW0!YRW0!YRW0!YEVa!YEVW!YFVS0YFVS0YGVS0YGVS0YGVX0YGVe0YGVn0YGWD0YGWW0YGWe!YGWe0YCWw0XkXA0XgXB0XgXB0XdXB0XbXB0XbXB0XWX70XCWj0XCWj0X7WV!X7WV!X7WD0X7WD0X4W00W!Vs0WqVi0WnVc0WiVX0WcVW0W9VZ0VuVd!VuVd!VuVg!VwVg!VwVg!VtVh!VnVl!VbVt!VYVv0VYVv0VTW80VSWD0VTWH!VTWH!VZWM!VaWN!VcWN!VdWN!VqWP!W7WZ!WRWp!WbWy!WcW#0WcW#0WvX50X1X80X7XA0XEXA0XLX80XOX6!XOX6!XXX1!XZWz!XaWy!XaWx!XbWw!XeWs!XfWo!XcWe!XXWY!XUWU!XSWR!XPWP!XNWN!XNWN!XNWM!XNWM!XOWL!XSWK0XSWK0XTWJ0XTWG0XOW80X4W30WrW30WjW60WbWC0WbWC0WOWe0WOWe0WQWt0WZX30WnX90X3XB0XCXC0XOX90XgWt0XjWa0XfWE0XYW10XIVv0WcVz0WIWC0WAWV0WCWx0WWXH0WzXP0XTXF0XmWm0XjWL0XNVz0X1Vr0WhVu0WMWB0WHWe0WVX00XXW#0XrWV0XlVz0X7Vb0WcVg0V#WN0VvX50WnXY0YEX70YOWK0X6Vc0V!W30W6X80XVXf0YZWn0XAVb0VrWV0WQX70YgWf0Y!WN!Y!WN!YFW#!Y6Xs!YIYL!YNYX!YNYg!YLYj";
static var TICKS_PER_SECOND = 20;
static var MAX_COLLIDE_ITERATIONS = 2;
static var LEVEL_WIDTH = 208;
static var LEVEL_HEIGHT = 158;
static var DUCK_RADIUS = 16;
static var MAX_DRAG_DISTANCE = 400;
static var DRAG_SCALE = 4;
static var DUCK_INERTIA = 0.85;
static var DUCK_ACCELERATION = 0.007;
static var DUCK_INERTIA_SPEED_BONUS = 0.6;
static var DUCK_ACCELERATION_SPEED_BONUS = 0.02;
}
Symbol 241 MovieClip [__Packages.com.midasplayer.timing.Timeable] Frame 0
interface com.midasplayer.timing.Timeable
{
}
Symbol 242 MovieClip [__Packages.com.king.rubberduck.GamePanel] Frame 0
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.king) {
_global.com.king = new Object();
}
if (!_global.com.king.rubberduck) {
_global.com.king.rubberduck = new Object();
}
if (!_global.com.king.rubberduck.GamePanel) {
var _local1 = function () {
super();
this.timer = new com.midasplayer.timing.Timer(this, com.king.rubberduck.Level.TICKS_PER_SECOND);
this.soundOn = true;
this.soundOnButton._visible = !this.soundOn;
this.soundOffButton._visible = this.soundOn;
this.infoPanel.gotoAndStop(1);
this.gameOver = false;
this.communicator = new com.king.rubberduck.Communicator();
this.state = com.king.rubberduck.GamePanel.STATE_WAIT_FOR_GAME_DATA;
_root.hider.gotoAndStop(1);
};
_global.com.king.rubberduck.GamePanel = _local1;
//_global.com.king.rubberduck.GamePanel extends MovieClip
var _local2 = _local1.prototype;
//_global.com.king.rubberduck.GamePanel implements _global.com.midasplayer.timing.Timeable
_local2.onEnterFrame = function () {
if (this.shouldReveal) {
_root.hider._visible = false;
this.shouldReveal = false;
}
if (com.king.rubberduck.GamePanel.DEBUG_MODE && (_root.gameData != undefined)) {
_root.hider._visible = true;
_root.hider.gotoAndStop(2);
}
this.timer.advanceTime2();
if (this.state == com.king.rubberduck.GamePanel.STATE_WAIT_FOR_GAME_DATA) {
if (com.king.rubberduck.GamePanel.DEBUG_MODE || (_root.gameData != undefined)) {
if (com.king.rubberduck.GamePanel.DEBUG_MODE) {
this.communicator.parseGameData(com.king.rubberduck.GamePanel.DEBUG_GAME_DATA);
} else {
this.communicator.parseGameData(_root.gameData);
}
this.communicator.gameStarted();
this.random = new com.midasplayer.util.Random(this.communicator.randomSeed);
com.king.rubberduck.Sounds.get("introSong").play();
this.state = com.king.rubberduck.GamePanel.STATE_SHOW_INSTRUCTIONS;
this.countdownTime = getTimer() + 13000;
this.countdownMessage = _global.textMappings.game_starts_in;
_root.txt_instructionsHeader = _global.textMappings.instructions_header;
_root.txt_instructions = _global.textMappings.instructions_text_1;
_root.txt_button = _global.textMappings.start_button;
_root.txt_sound_button = _global.textMappings.sound_on;
_root.txt_exit_button = _global.textMappings.exit_game;
_root.txt_score_label = _global.textMappings.score;
_root.txt_time_label = _global.textMappings.time_left;
_root.txt_level = _global.textMappings.level;
_root.txt_speed_bonus = _global.textMappings.speed_bonus;
_root.txt_total_score = _global.textMappings.total_score;
_root.txt_good = _global.textMappings.good;
_root.txt_obstacles = _global.textMappings.obstacles;
_root.txt_bad = _global.textMappings.bad;
this.communicator.sendGameVersion();
this.shouldReveal = true;
this.infoPanel.instructionsLevel.nextLevel(new com.midasplayer.util.Random(0));
this.infoPanel.instructionsLevel.startLevel();
}
} else if ((this.state == com.king.rubberduck.GamePanel.STATE_SHOW_SIGN) || (this.state == com.king.rubberduck.GamePanel.STATE_SHOW_INSTRUCTIONS)) {
var _local4 = int(((this.countdownTime - getTimer()) / 1000) + 1);
if (this.state == com.king.rubberduck.GamePanel.STATE_SHOW_INSTRUCTIONS) {
var _local5 = ((((this.countdownTime - getTimer()) / 1000) + 1) - 7) * 2;
_root.txt_instructions = _global.textMappings["instructions_text_" + ((_local5 < 0) ? 2 : 1)];
if ((_local5 > -1) && (_local5 < 1)) {
this.infoPanel.hider._alpha = 100 - (Math.abs(_local5 * _local5) * 100);
this.infoPanel.hider._visible = true;
} else {
this.infoPanel.hider._visible = false;
}
this.infoPanel.gotoAndStop(((_local5 < 0) ? 2 : 1));
}
if (_local4 < 0) {
_local4 = 0;
}
_root.txt_countdown = this.countdownMessage.split("{0}").join(_local4);
if (_local4 == 0) {
this.buttonPressed();
}
} else if (this.state == com.king.rubberduck.GamePanel.STATE_LEVEL_INTRO) {
var _local6 = (getTimer() - this.levelIntroTime) / 1000;
this.infoPanel._y = 100 + (((_local6 * _local6) * _local6) * 1500);
if (_local6 > 0.65) {
this.state = com.king.rubberduck.GamePanel.STATE_PLAY_LEVEL;
this.infoPanel._visible = false;
this.level.startLevel();
}
} else if (this.state == com.king.rubberduck.GamePanel.STATE_LEVEL_OVER) {
var _local6 = (getTimer() - this.levelIntroTime) / 1000;
var _local5 = 0.65 - _local6;
this.infoPanel._y = 100 - (((_local5 * _local5) * _local5) * 1500);
if (_local6 > 0.65) {
this.state = com.king.rubberduck.GamePanel.STATE_SHOW_SIGN;
this.countdownTime = getTimer() + 5000;
this.level.updateScoreText();
}
}
};
_local2.levelOver = function () {
if (this.state == com.king.rubberduck.GamePanel.STATE_PLAY_LEVEL) {
var _local4 = 0;
_root.txt_button = _global.textMappings.end_button;
if (this.level.lives == 0) {
_root.txt_gameoverReason = _global.textMappings.out_of_lives;
this.countdownMessage = _global.textMappings.game_ends_in;
this.gameOver = true;
} else if (this.level.timeLeft == 0) {
_root.txt_gameoverReason = _global.textMappings.out_of_time;
this.countdownMessage = _global.textMappings.game_ends_in;
this.gameOver = true;
} else if ((this.level.currentLevel == 3) || (_global.shortGameMode)) {
_local4 = int((this.level.timeLeft * com.king.rubberduck.GamePanel.TIME_BONUS) / this.level.levelTime);
_root.txt_gameoverReason = _global.textMappings.game_over;
this.countdownMessage = _global.textMappings.game_ends_in;
this.gameOver = true;
} else {
_local4 = int((this.level.timeLeft * com.king.rubberduck.GamePanel.TIME_BONUS) / this.level.levelTime);
_root.txt_gameoverReason = _global.textMappings.level_completed;
_root.txt_button = _global.textMappings.start_button;
this.countdownMessage = _global.textMappings.game_starts_in;
this.gameOver = false;
}
_root.txt_score = this.level.score;
_root.txt_timebonus = _local4;
this.level.score = this.level.score + _local4;
_root.txt_totalscore = this.level.score;
this.communicator.sendRoundData(this.level.getRoundData(), this.level.score - this.lastSentScore);
this.lastSentScore = this.level.score;
this.levelIntroTime = getTimer();
this.state = com.king.rubberduck.GamePanel.STATE_LEVEL_OVER;
this.infoPanel._visible = true;
this.infoPanel.gotoAndStop(3);
if (this.gameOver) {
this.communicator.gameEnd(this.level.score);
}
}
};
_local2.buttonPressed = function () {
if ((this.state == com.king.rubberduck.GamePanel.STATE_SHOW_SIGN) || (this.state == com.king.rubberduck.GamePanel.STATE_SHOW_INSTRUCTIONS)) {
com.king.rubberduck.Sounds.get("introSong").stop();
com.king.rubberduck.Sounds.get("gameOverSong").stop();
com.king.rubberduck.Sounds.get("levelEndSong").stop();
if (!this.gameOver) {
com.king.rubberduck.Sounds.get("levelStartSound").play();
com.king.rubberduck.Sounds.get("musicLoop").playLooping();
this.levelIntroTime = getTimer();
this.state = com.king.rubberduck.GamePanel.STATE_LEVEL_INTRO;
this.level.nextLevel(new com.midasplayer.util.Random(this.random.nextInt(2147483647)));
this.level.preStartLevel();
} else {
this.communicator.gameQuit();
}
}
};
_local2.tick = function (tick) {
if ((tick % com.king.rubberduck.Level.TICKS_PER_SECOND) == 0) {
_root.debugPanel.text = "Fps: " + this.frames;
this.frames = 0;
}
this.lastTick = tick;
if (this.state == com.king.rubberduck.GamePanel.STATE_SHOW_INSTRUCTIONS) {
this.infoPanel.instructionsLevel.tick(tick);
}
this.level.tick(tick);
};
_local2.render = function (tick, alpha) {
this.frames = this.frames + 1;
this.level.render(tick, alpha);
if (this.state == com.king.rubberduck.GamePanel.STATE_SHOW_INSTRUCTIONS) {
this.infoPanel.instructionsLevel.render(tick, alpha);
}
};
_local2.toggleSound = function () {
this.soundOn = !this.soundOn;
if (this.soundOn) {
_root.txt_sound_button = _global.textMappings.sound_on;
} else {
_root.txt_sound_button = _global.textMappings.sound_off;
}
this.soundOnButton._visible = !this.soundOn;
this.soundOffButton._visible = this.soundOn;
com.king.rubberduck.Sounds.toggleSound();
};
_local2.endGamePressed = function () {
if ((this.gameOver || (this.state == com.king.rubberduck.GamePanel.STATE_WAIT_FOR_GAME_DATA)) || ((this.state == com.king.rubberduck.GamePanel.STATE_PLAY_LEVEL) && (this.level.remainingFlowers == 0))) {
return(undefined);
}
this.gameOver = true;
com.king.rubberduck.Sounds.get("introSong").stop();
com.king.rubberduck.Sounds.get("gameOverSong").stop();
com.king.rubberduck.Sounds.get("levelEndSong").stop();
if (this.state == com.king.rubberduck.GamePanel.STATE_PLAY_LEVEL) {
this.level.stopLevel();
this.communicator.sendRoundData(this.level.getRoundData(), this.level.score - this.lastSentScore);
this.lastSentScore = this.level.score;
}
this.communicator.sendEndGamePressed();
this.levelIntroTime = getTimer();
this.state = com.king.rubberduck.GamePanel.STATE_LEVEL_OVER;
this.infoPanel._visible = true;
this.infoPanel.gotoAndStop(3);
_root.txt_gameoverReason = _global.textMappings.game_over;
_root.txt_score = this.level.score;
_root.txt_timebonus = 0;
_root.txt_totalscore = this.level.score;
this.communicator.gameEnd(this.level.score);
this.countdownMessage = _global.textMappings.game_ends_in;
_root.txt_button = _global.textMappings.end_button;
};
_local1.DEBUG_MODE = true;
_local1.DEBUG_GAME_DATA = (((((((((((((((((("<gamedata randomseed=\"551643350\" timelimit=\"300\"><text id=\"level\">L\u00CBVEL</text><text id=\"out_of_lives\">OUT OF LIVES!</text><text id=\"instructions_header\">INSTR\u00DCCTI\u00D6NS</text><text id=\"start_button\">ST\u00C4RT</text>" + "<text id=\"game_starts_in\">G\u00C4ME ST\u00C4RTS IN {0} SEC\u00D6NDS</text>") + "<text id=\"obstacles\">\u00D6BSTACLES</text>") + "<text id=\"instructions_text_2\">Pick up the sn\u00F6wfl\u00E4ke and s\u00F6!</text>") + "<text id=\"end_button\">\u00CBND</text>") + "<text id=\"level_completed\">L\u00CBVEL C\u00D6MPLETED!</text>") + "<text id=\"sound_on\">S\u00D6UND \u00D6N</text>") + "<text id=\"game_over\">GAME \u00D6VER!</text>") + "<text id=\"instructions_text_1\">M\u00F6ve your d\u00FCck!</text>") + "<text id=\"exit_game\">\u00CBXIT G\u00C4ME</text>") + "<text id=\"bad\">B\u00C4D</text>") + "<text id=\"score\">SC\u00D6RE</text>") + "<text id=\"out_of_time\">\u00D6UT OF TIM\u00CB!</text>") + "<text id=\"game_ends_in\">GAME ENDS IN {0} SEC\u00D6NDS</text>") + "<text id=\"good\">GO\u00D6D</text>") + "<text id=\"time_left\">TIME L\u00CBFT</text>") + "<text id=\"sound_off\">S\u00D6UND \u00D6FF</text>") + "<text id=\"speed_bonus\">SP\u00CB\u00CBD B\u00D6N\u00DCS</text>") + "<text id=\"total_score\">T\u00D6T\u00C4L SC\u00D6RE</text>") + "</gamedata>";
_local2.levelIntroTime = 0;
_local1.STATE_WAIT_FOR_GAME_DATA = 0;
_local1.STATE_SHOW_INSTRUCTIONS = 1;
_local1.STATE_SHOW_SIGN = 2;
_local1.STATE_LEVEL_INTRO = 3;
_local1.STATE_PLAY_LEVEL = 4;
_local1.STATE_LEVEL_OVER = 5;
_local1.TIME_BONUS = 500;
_local2.shouldReveal = false;
_local2.lastSentScore = 0;
_local2.frames = 0;
_local2.lastTick = 0;
(ASSetPropFlags(_global.com.king.rubberduck.GamePanel.prototype, null, 1));// not popped
}
#endinitclip
Symbol 243 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 244 MovieClip [__Packages.com.king.rubberduck.Communicator] Frame 0
class com.king.rubberduck.Communicator
{
var randomSeed;
function Communicator () {
}
function gameStarted() {
fscommand ("gameStart");
fscommand ("playData", (((CMD_VERSION + ",") + VERSION) + "=") + 0);
}
function gameEnd(score) {
if (!hasSentGameEnd) {
hasSentGameEnd = true;
fscommand ("gameEnd", score);
}
}
function gameQuit() {
if (!hasSentGameOver) {
hasSentGameOver = true;
fscommand ("gameQuit");
}
}
function sendRoundData(roundData, roundScore) {
while (roundData.length > MAX_PLAYDATA_LENGTH) {
fscommand ("playData", (((CMD_ROUND_GAME_DATA_PARTIAL + ",") + roundData.substring(0, MAX_PLAYDATA_LENGTH)) + "=") + 0);
roundData = roundData.substring(MAX_PLAYDATA_LENGTH);
}
fscommand ("playData", (((CMD_ROUND_GAME_DATA + ",") + roundData) + "=") + roundScore);
}
function sendEndGamePressed() {
fscommand ("playData", CMD_END_GAME_PRESSED + "=0");
}
function parseGameData(gameData) {
var _local5 = new XML(gameData);
_global.shortGameMode = new String(_local5.childNodes[0].attributes.mode) == "short";
_global.textMappings = new Object();
var _local4 = _local5.childNodes[0].childNodes;
randomSeed = new Number(_local5.childNodes[0].attributes.randomseed).valueOf();
var _local3 = 0;
while (_local3 < _local4.length) {
if (_local4[_local3].nodeName == "text") {
_global.textMappings[_local4[_local3].attributes.id] = new String(_local4[_local3].firstChild.nodeValue);
}
_local3++;
}
}
var hasSentGameEnd = false;
var hasSentGameOver = false;
static var VERSION = 1;
static var CMD_VERSION = 341;
static var CMD_END_GAME_PRESSED = 107;
static var CMD_ROUND_GAME_DATA_PARTIAL = 290;
static var CMD_ROUND_GAME_DATA = 882;
static var MAX_PLAYDATA_LENGTH = 200;
}
Symbol 245 MovieClip [__Packages.com.king.rubberduck.Flower] Frame 0
class com.king.rubberduck.Flower extends MovieClip
{
var spawnTime, spawnSpeed, _alpha, onEnterFrame, dieTime, gotoAndStop, deathAnim;
function Flower () {
super();
}
function startSpawnAnim(delay) {
spawnTime = (getTimer() + (delay * 800)) + 500;
spawnSpeed = 0.5;
_alpha = 0;
onEnterFrame = function () {
var _local2 = (getTimer() - this.spawnTime) / this.spawnSpeed;
if (_local2 > 100) {
this._alpha = 100;
this.onEnterFrame = undefined;
} else if (_local2 < 0) {
this._alpha = 0;
} else {
this._alpha = _local2;
}
};
}
function take(scoreGained) {
_alpha = 100;
dieTime = getTimer();
(gotoAndStop(40));// not popped
deathAnim.score.scoreText.text = scoreGained;
onEnterFrame = function () {
var _local2 = int(((getTimer() - this.dieTime) / 50) + 1);
if (_local2 >= 25) {
this.removeMovieClip();
} else {
this.deathAnim.gotoAndStop(_local2);
}
};
}
}