Frame 1
function reSize() {
_root.preloader._x = int(Stage.width / 2);
_root.preloader._y = int(Stage.height / 2);
}
stop();
Stage.align = "LT";
Stage.scaleMode = "noScale";
reSize();
resizeListener = new Object();
resizeListener.onResize = function () {
reSize();
};
Stage.addListener(resizeListener);
_global.tweenManager = new Object();
tweenManager.grow = function (clip, vTo, vFrames) {
clip._xscaleTween.stop();
clip._yscaleTween.stop();
var _local3 = clip._xscale;
var _local2 = mx.transitions.easing.Strong.easeOut;
_local2 = mx.transitions.easing.Elastic.easeOut;
clip._xscaleTween = new mx.transitions.Tween(clip, "_xscale", _local2, _local3, vTo, vFrames);
clip._yscaleTween = new mx.transitions.Tween(clip, "_yscale", _local2, _local3, vTo, vFrames);
};
tweenManager.shrink = function (clip, vTo, vFrames) {
clip._xscaleTween.stop();
delete clip._xscaleTween;
clip._yscaleTween.stop();
delete clip._yscaleTween;
var _local3 = clip._xscale;
var _local2 = mx.transitions.easing.Elastic.easeOut;
clip._xscaleTween = new mx.transitions.Tween(clip, "_xscale", _local2, _local3, vTo, vFrames);
clip._yscaleTween = new mx.transitions.Tween(clip, "_yscale", _local2, _local3, vTo, vFrames);
};
tweenManager.scale = function (clip, vTo, vFrames, elastic) {
function die() {
delete clip._xscaleTween;
delete clip._yscaleTween;
}
clip._xscaleTween.stop();
clip._yscaleTween.stop();
die();
var _local2 = clip._xscale;
var _local1 = (elastic ? (mx.transitions.easing.Elastic.easeOut) : (mx.transitions.easing.Strong.easeOut));
clip._xscaleTween = new mx.transitions.Tween(clip, "_xscale", _local1, _local2, vTo, vFrames);
clip._yscaleTween = new mx.transitions.Tween(clip, "_yscale", _local1, _local2, vTo, vFrames);
clip._xscaleTween.onMotionFinished = die;
};
tweenManager.rotate = function (clip, vTo, vFrames, elastic) {
function die() {
delete clip._rotationTween;
}
clip._rotationTween.stop();
die();
var _local2 = clip._rotation;
var _local1 = (elastic ? (mx.transitions.easing.Elastic.easeOut) : (mx.transitions.easing.Strong.easeOut));
clip._rotationTween = new mx.transitions.Tween(clip, "_rotation", _local1, _local2, vTo, vFrames);
clip._rotationTween.onMotionFinished = die;
};
tweenManager.move = function (clip, vTo, vFrames, elastic) {
function die() {
delete clip._xTween;
delete clip._yTween;
}
clip._xTween.stop();
clip._yTween.stop();
die();
var _local2 = [clip._x, clip._y];
var _local1 = (elastic ? (mx.transitions.easing.Elastic.easeOut) : (mx.transitions.easing.Strong.easeOut));
clip._xTween = new mx.transitions.Tween(clip, "_x", _local1, _local2[0], vTo[0], vFrames);
clip._yTween = new mx.transitions.Tween(clip, "_y", _local1, _local2[1], vTo[1], vFrames);
clip._xTween.onMotionFinished = die;
};
tweenManager.animate = function (clip, prop, vTo, vFrames, elastic) {
function die() {
delete clip[prop + "Tween"];
}
clip[prop + "Tween"].stop();
die();
var _local2 = clip[prop];
var _local1 = (elastic ? (mx.transitions.easing.Elastic.easeOut) : (mx.transitions.easing.Strong.easeOut));
clip[prop + "Tween"] = new mx.transitions.Tween(clip, prop, _local1, _local2, vTo, vFrames);
clip[prop + "Tween"].onMotionFinished = die;
};
Frame 2
function reSize() {
_root.main._x = int(Stage.width / 2);
_root.main._y = int(Stage.height / 2);
}
stop();
Stage.align = "LT";
Stage.scaleMode = "noScale";
reSize();
resizeListener = new Object();
resizeListener.onResize = function () {
reSize();
};
Stage.addListener(resizeListener);
Symbol 8 MovieClip Frame 1
onEnterFrame = function () {
var _local3 = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
percent = _local3;
if (_local3 == 100) {
tweenManager.scale(this, 1000, 5, false);
delete onEnterFrame;
}
};
Symbol 8 MovieClip Frame 5
_root.play();
Symbol 9 MovieClip Frame 2
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
_root.play();
}
Symbol 9 MovieClip Frame 3
tweenManager.scale(preloadText, 100, 50, true);
stop();
Symbol 129 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 130 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 131 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var version = "1.1.0.52";
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 132 MovieClip [__Packages.mx.transitions.easing.Elastic] Frame 0
class mx.transitions.easing.Elastic
{
function Elastic () {
}
static function easeIn(t, b, c, d, a, p) {
if (t == 0) {
return(b);
}
t = t / d;
if (t == 1) {
return(b + c);
}
if (!p) {
p = d * 0.3;
}
if ((!a) || (a < Math.abs(c))) {
a = c;
var _local7 = p / 4;
} else {
var _local7 = (p / (Math.PI*2)) * Math.asin(c / a);
}
t = t - 1;
return((-((a * Math.pow(2, 10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p))) + b);
}
static function easeOut(t, b, c, d, a, p) {
if (t == 0) {
return(b);
}
t = t / d;
if (t == 1) {
return(b + c);
}
if (!p) {
p = d * 0.3;
}
if ((!a) || (a < Math.abs(c))) {
a = c;
var _local7 = p / 4;
} else {
var _local7 = (p / (Math.PI*2)) * Math.asin(c / a);
}
return((((a * Math.pow(2, -10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p)) + c) + b);
}
static function easeInOut(t, b, c, d, a, p) {
if (t == 0) {
return(b);
}
t = t / (d / 2);
if (t == 2) {
return(b + c);
}
if (!p) {
p = d * 0.45;
}
if ((!a) || (a < Math.abs(c))) {
a = c;
var _local7 = p / 4;
} else {
var _local7 = (p / (Math.PI*2)) * Math.asin(c / a);
}
if (t < 1) {
t = t - 1;
return((-0.5 * ((a * Math.pow(2, 10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p))) + b);
}
t = t - 1;
return(((((a * Math.pow(2, -10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p)) * 0.5) + c) + b);
}
static var version = "1.1.0.52";
}
Symbol 133 MovieClip [__Packages.mx.transitions.easing.Strong] Frame 0
class mx.transitions.easing.Strong
{
function Strong () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return((((((c * t) * t) * t) * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = (t / d) - 1;
return((c * (((((t * t) * t) * t) * t) + 1)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return(((((((c / 2) * t) * t) * t) * t) * t) + b);
}
t = t - 2;
return(((c / 2) * (((((t * t) * t) * t) * t) + 2)) + b);
}
static var version = "1.1.0.52";
}
Symbol 22 MovieClip Frame 1
_root.main.whip.start();
Symbol 28 Button
on (release) {
_parent.mySound.setVolume(0);
gotoAndStop (2);
}
Symbol 30 Button
on (release) {
_parent.mySound.setVolume(100);
gotoAndStop (1);
}
Symbol 31 MovieClip Frame 1
stop();
Symbol 31 MovieClip Frame 2
stop();
Symbol 56 Button
on (release) {
gotoAndStop ("gamescript");
}
Symbol 64 MovieClip Frame 18
if (!sitting) {
gotoAndPlay ("loop");
}
Symbol 64 MovieClip Frame 25
stop();
sitting = true;
wait = 2500;
sitTime = setInterval(function () {
gotoAndPlay ("getup");
clearInterval(sitTime);
}, wait);
Symbol 64 MovieClip Frame 30
this.onEnterFrame = function () {
_parent.moveOtis();
};
trace("otis is on the move");
gotoAndPlay ("loop");
sitting = false;
Symbol 64 MovieClip Frame 90
Symbol 64 MovieClip Frame 95
_parent.moo.start();
Symbol 75 MovieClip Frame 1
levelText.textfield.text = "NIGHT " + (_parent.level + 1);
scoreText.textfield.text = _parent.scoreText;
tweenManager.scale(levelText, 100, 24, true);
tweenManager.scale(scoreText, 50, 27, true);
_parent.loop1.setVolume(0);
Symbol 75 MovieClip Frame 39
_parent.loop1.setVolume(100);
_parent.gotoAndStop("game");
Symbol 97 MovieClip Frame 1
stop();
Symbol 102 MovieClip Frame 1
stop();
Symbol 102 MovieClip Frame 59
_parent.gotoAndStop("letsgo");
Symbol 103 MovieClip Frame 1
stop();
Symbol 103 MovieClip Frame 8
play();
Symbol 103 MovieClip Frame 16
gotoAndPlay ("powerup");
Symbol 103 MovieClip Frame 25
gotoAndPlay ("shine");
Symbol 104 MovieClip Frame 1
stop();
var awaitedKey = 37;
var speed = 0;
var charging = true;
keyListener = new Object();
Key.addListener(keyListener);
keyListener.onKeyDown = function () {
if (Key.getCode() == awaitedKey) {
speed = speed + 7.5;
if (awaitedKey == 37) {
tweenManager.rotate(_parent.farmer.torch, 15, 20, true);
awaitedKey = 39;
} else {
tweenManager.rotate(_parent.farmer.torch, -15, 20, true);
awaitedKey = 37;
}
} else if (((Key.getCode() == 32) && (batteryCharged)) && (_parent.shining == false)) {
_parent.shineTorch();
}
};
this.onEnterFrame = function () {
if (charging) {
if (speed < 100) {
speed = speed * ((98 - (_parent.level / 5)) / 100);
} else {
speed = 100;
tweenManager.animate(_parent.farmer.torch.glow, "_alpha", 100, 10, true);
beamOn = true;
_parent.keys.gotoAndPlay("shine");
_parent.otisAware();
batteryCharged = true;
charging = false;
}
power._xscale = speed;
glow._alpha = speed;
}
if (draining) {
trace("draining");
if (power._xscale > 0) {
power._xscale = power._xscale - 10;
} else {
draining = false;
}
}
};
Symbol 110 MovieClip Frame 59
_parent.play();
Symbol 119 Button
on (release) {
_parent._parent.gotoAndPlay("gamescript");
}
Symbol 121 MovieClip Frame 118
tooSlow._visible = true;
tooSlow.play();
_parent.boing.start();
_parent.loop1.setVolume(100);
tweenManager.scale(tooSlow.white, 100, 40, true);
tweenManager.scale(tooSlow.blue, 100, 43, true);
stop();
Symbol 121 MovieClip Frame 119
_parent.boing.start();
tweenManager.scale(playAgain.white, 100, 40, true);
tweenManager.scale(playAgain.red, 100, 43, true);
stop();
nights = (_parent.level - 1) + " NIGHTS";
points = _parent.score + " POINTS";
Symbol 128 MovieClip Frame 1
Sound.prototype.fade = function (fadeType, fadeDuration) {
this.fadeDuration = (fadeDuration * 1000) / 100;
this.fadeType = fadeType;
this.currentVolume = _root.getVolume();
this.intID = setInterval(function (thisObj) {
thisObj.doFade(thisObj.fadeType);
}, this.fadeDuration, this);
this.doFade = function (fadeType) {
if (fadeType == "out") {
this.setVolume(this.currentVolume--);
if (_root.getVolume() <= 0) {
this.onFadeComplete();
clearInterval(this.intID);
}
} else if (fadetype == "in") {
this.setVolume(this.currentVolume++);
if (_root.getVolume() >= 100) {
this.onFadeComplete();
clearInterval(this.intID);
}
}
};
};
mySound = new Sound(_root);
moo = new Sound(createEmptyMovieClip("moo", this.getNextHighestDepth()));
moo.attachSound("moo");
boing = new Sound(createEmptyMovieClip("boing", this.getNextHighestDepth()));
boing.attachSound("boing");
boing.setVolume(60);
loop1 = new Sound(createEmptyMovieClip("loop1", this.getNextHighestDepth()));
loop1.attachSound("loop1");
whip = new Sound(createEmptyMovieClip("whip", this.getNextHighestDepth()));
whip.attachSound("whip");
whip.setVolume(60);
tweenManager.scale(inner, 100, 40, true);
tweenManager.scale(base, 100, 43, true);
loop1.stop();
loop1.start(0, 99999);
boing.start();
Symbol 128 MovieClip Frame 14
tweenManager.scale(title, 100, 25, true);
Symbol 128 MovieClip Frame 31
stop();
Symbol 128 MovieClip Frame 41
var level = 0;
var otisStart = 150;
var otisEnd = -280;
var otisProgress = 0;
var otisMoving = true;
var distance = 430;
var score = 0;
var legacyScore = 0;
var scoreText = "SCORE = 0";
var otisSiting = false;
myColor = new Color(otis);
startLevel = function () {
shining = false;
niceWork._visible = false;
tooSlow._visible = false;
legacyScore = score;
score = 0;
keys.gotoAndPlay("powerup");
level++;
otisProgress = 0;
otis._x = otisStart;
myColor.setBrightness(-50);
trace("starting level " + level);
otis.onEnterFrame = function () {
moveOtis();
};
};
moveOtis = function () {
var _local1 = 1 + level;
otis._x = otis._x - _local1;
score = int(((distance - otisProgress) / 10) * level) + legacyScore;
scoreText = "SCORE = " + score;
otisProgress = otisProgress + _local1;
if (otisProgress >= distance) {
gotoAndStop ("gameover");
}
};
Color.prototype.setBrightness = function (bright) {
var _local5 = 100 - Math.abs(bright);
var _local3 = 0;
if (bright > 0) {
_local3 = 256 * (bright / 100);
}
var _local2 = new Object();
_local2.ra = (_local2.ga = (_local2.ba = _local5));
_local2.rb = (_local2.gb = (_local2.bb = _local3));
this.setTransform(_local2);
};
shineTorch = function () {
farmer.gotoAndStop("facing");
farmer.swapDepths(otis);
myColor.setBrightness(0);
shining = true;
if (otis.sitting) {
turnBack = setInterval(function () {
farmer.gotoAndStop("backturned");
myColor.setBrightness(-50);
clearInterval(turnBack);
}, 1000);
} else {
levelComplete();
}
};
levelComplete = function () {
keys.gotoAndStop("rest");
otis.gotoAndStop("stand");
delete otis.onEnterFrame;
trace("well done, starting next level");
textNice = setInterval(function () {
niceWork._visible = true;
niceWork.play();
boing.start();
tweenManager.scale(niceWork.white, 100, 40, true);
tweenManager.scale(niceWork.red, 100, 43, true);
clearInterval(textNice);
}, 1000);
};
gotoAndStop ("letsgo");
Symbol 128 MovieClip Frame 51
stop();
Symbol 128 MovieClip Frame 61
stop();
startLevel();
Symbol 128 MovieClip Frame 72
stop();
loop1.setVolume(0);
farmer.torch._visible = false;
farmer.gotoAndStop("facing");