Frame 1
function init() {
Button.prototype.tabEnabled = false;
MovieClip.prototype.tabEnabled = false;
_global.g_kApplication.m_kSettings = new Settings();
_global.g_kApplication.m_kApplicationState = new ApplicationState();
_global.g_kApplication.m_kGameTimer = new LRG.Utils.LRGGameTimer();
LRG.Utils.LRGGameTimer(_global.getGameTimer()).startClock(true);
_global.g_kApplication.stop();
if (_root.m_sPath == undefined) {
_root.m_sPath = "";
}
}
function start() {
_global.g_kApplication.m_kGui.m_kPlayGui.gotoAndStop("Hide");
_global.g_kApplication.m_kGui.m_kPlayGui._visible = false;
_global.g_kApplication.m_kGui.m_kGameSummaryPanel.gotoAndStop("Hide");
_global.g_kApplication.m_kGui.m_kGameSummaryPanel._visible = false;
_global.g_kApplication.m_kGui.m_kHelpPanel.gotoAndStop("Hide");
_global.g_kApplication.m_kGui.m_kHelpPanel._visible = false;
_global.g_kApplication.m_kGui.m_kCloseUpScreen.gotoAndStop("Hide");
_global.g_kApplication.m_kGui.m_kCloseUpScreen._visible = false;
_global.getApplicationState().setState(_global.getApplicationState().AS_PRE_GAME);
_global.getApplicationState().setPaused(true);
this.onEnterFrame = function () {
_global.g_kApplication.m_kGui.m_kSplashScreen.gotoAndStop("Show");
_global.g_kApplication.m_kGui.m_kSplashScreen._visible = true;
_global.g_kApplication.m_kGui.m_kSplashScreen.onShow();
this.onEnterFrame = undefined;
};
}
if (_global.LRG == undefined) {
_global.LRG = new Object();
}
if (_global.LRG.Utils == undefined) {
_global.LRG.Utils = new Object();
}
Array.prototype.getIndex = function (item) {
var _local2 = 0;
while (_local2 < this.length) {
if (this[_local2] == item) {
return(_local2);
}
_local2++;
}
return(-1);
};
Array.prototype.removeIndex = function (fIndex) {
var _local2 = this.slice(0, fIndex);
_local2 = _local2.concat(this.slice(fIndex + 1, this.length));
return(_local2);
};
Array.prototype.removeData = function (item) {
var _local2 = this.getIndex(item);
if (_local2 > -1) {
return(this.removeIndex(_local2));
}
return(this.slice(0));
};
Array.prototype.getRandom = function () {
var _local2 = Math.floor(Math.floor(Math.random() * 1000) % this.length);
return(this[_local2]);
};
if (_global.LRG.Utils.Vector2D == undefined) {
_global.LRG.Utils.Vector2D = new Object();
}
_global.LRG.Utils.Vector2D.magnitude = function (fX, fY) {
return(Math.sqrt((fX * fX) + (fY * fY)));
};
_global.LRG.Utils.Vector2D.normalize = function (fX, fY) {
var _local2 = new Object();
var _local3 = _global.LRG.Utils.Vector2D.magnitude(fX, fY);
_local2.x = fX / _local3;
_local2.y = fY / _local3;
return(_local2);
};
_global.LRG.Utils.Vector2D.dot = function (fX1, fY1, fX2, fY2) {
return((fX1 * fX2) + (fY1 * fY2));
};
_global.playSound = function (soundID, loops, targetClip, pan, volume) {
if (ApplicationState(_global.getApplicationState()).isMuted()) {
trace("is muted so we should not play a sound");
return(undefined);
}
if (typeof(targetClip) == "undefined") {
targetClip = _global.g_kApplication.m_kSoundPlayer;
}
if (typeof(loops) == "undefined") {
loops = 1;
}
if (typeof(pan) == "undefined") {
pan = 0;
}
if (pan < -100) {
pan = -100;
} else if (pan > 100) {
pan = 100;
}
if (volume == undefined) {
volume = 100;
}
var _local3 = new Sound(targetClip);
_local3.setPan(pan);
_local3.setVolume(volume);
_local3.attachSound(soundID);
_local3.start(0, loops);
mLastSoundID = soundID;
};
_global.stopSound = function (soundID, targetClip) {
if (typeof(targetClip) == "undefined") {
targetClip = this;
}
var _local3 = this.getSoundObject(targetClip[soundID]);
_local3.stop([soundID]);
};
_global.getSoundObject = function (targetClip) {
if (typeof(this.mSoundObjectArray) == "undefined") {
this.mSoundObjectArray = new Array();
}
if (typeof(this.mSoundObjectArray[targetClip]) == "undefined") {
this.mSoundObjectArray[targetClip] = new Sound(targetClip);
}
return(this.mSoundObjectArray[targetClip]);
};
if (_global.LRG == undefined) {
_global.LRG = new Object();
}
if (_global.LRG.LRGMusic == undefined) {
_global.LRG.LRGMusic = new Object();
}
_global.LRG.LRGMusic.m_bGameHasMusic = true;
_global.LRG.LRGMusic.m_bMuted = false;
_global.LRG.LRGMusic.startMusic = function (kPlayList) {
if (!_global.LRG.LRGMusic.m_bGameHasMusic) {
return(undefined);
}
trace("startMusic() called");
if (_global.LRG.LRGMusic.m_kMusic == undefined) {
kEmptyClip = _global.g_kApplication.createEmptyMovieClip("m_kMusicClip", _global.g_kApplication.getNextHighestDepth());
_global.LRG.LRGMusic.m_kMusic = new Sound(kEmptyClip);
}
if (kPlayList != undefined) {
_global.LRG.LRGMusic.m_pLoopList = kPlayList;
} else {
_global.LRG.LRGMusic.m_pLoopList = new Array();
}
_global.LRG.LRGMusic.m_kMusic.m_sLastLoop = undefined;
_global.LRG.LRGMusic.m_kFadeTimerClip.onEnterFrame = undefined;
_global.LRG.LRGMusic.stop();
if (_global.LRG.LRGMusic.m_bMuted) {
_global.LRG.LRGMusic.m_kMusic.setVolume(0);
} else {
_global.LRG.LRGMusic.m_kMusic.setVolume(100);
}
_global.LRG.LRGMusic.m_kMusic.onSoundComplete = _global.LRG.LRGMusic.playMusicLoop;
_global.LRG.LRGMusic.playMusicLoop();
};
_global.LRG.LRGMusic.setPlaylist = function (kPlayList) {
_global.LRG.LRGMusic.m_pLoopList = kPlayList;
_global.LRG.LRGMusic.m_kMusic.m_sLastLoop = undefined;
};
_global.LRG.LRGMusic.stopMusic = function () {
if (!_global.LRG.LRGMusic.m_bGameHasMusic) {
return(undefined);
}
_global.LRG.LRGMusic.m_kMusic.stop();
_global.LRG.LRGMusic.m_kFadeTimerClip.onEnterFrame = undefined;
};
_global.LRG.LRGMusic.endMusic = function () {
if (!_global.LRG.LRGMusic.m_bGameHasMusic) {
return(undefined);
}
_global.LRG.LRGMusic.m_kMusic.onSoundComplete = undefined;
if (_global.LRG.LRGMusic.m_kFadeTimerClip == undefined) {
_global.LRG.LRGMusic.m_kFadeTimerClip = _root.createEmptyMovieClip(m_kMusicFadeTimer, _root.getNextHighestDepth());
}
_global.LRG.LRGMusic.m_kFadeTimerClip.m_fStartTime = getTimer();
_global.LRG.LRGMusic.m_kFadeTimerClip.m_fFadePeriod = 1000;
_global.LRG.LRGMusic.m_kFadeTimerClip.onEnterFrame = function () {
var _local5 = getTimer();
var _local3 = (_local5 - this.m_fStartTime) / this.m_fFadePeriod;
if (_local3 >= 1) {
trace("stop the fade out please");
_global.LRG.LRGMusic.m_kMusic.stop();
this.onEnterFrame = undefined;
} else {
var _local4;
if (_global.LRG.LRGMusic.m_bMuted) {
_local4 = 0;
} else {
_local4 = Math.min(100, 100 * (1 - _local3));
}
_global.LRG.LRGMusic.m_kMusic.setVolume(_local4);
}
};
};
_global.LRG.LRGMusic.playMusicLoop = function () {
if (!_global.LRG.LRGMusic.m_bGameHasMusic) {
return(undefined);
}
var _local3 = "";
if (_global.LRG.LRGMusic.m_kMusic.m_sLastLoop != undefined) {
var _local6 = _global.LRG.LRGMusic.m_pLoopList.removeData(_root.m_sLastLoop);
_local3 = _local6.getRandom();
} else {
_local3 = _global.LRG.LRGMusic.m_pLoopList.getRandom();
}
var _local4 = Math.round(Math.random() * 1000) % 2;
var _local5 = 1 + _local4;
_global.LRG.LRGMusic.m_kMusic.attachSound(_local3);
_global.LRG.LRGMusic.m_kMusic.start(0, _local5);
_global.LRG.LRGMusic.m_kMusic.m_sLastLoop = _local3;
};
_global.LRG.LRGMusic.muteMusic = function (bMuteMusic) {
_global.LRG.LRGMusic.m_bMuted = bMuteMusic;
if (_global.LRG.LRGMusic.m_bMuted) {
_global.LRG.LRGMusic.m_kMusic.setVolume(0);
} else {
_global.LRG.LRGMusic.m_kMusic.setVolume(100);
}
};
_global.g_kApplication = this;
_global.g_kApplication.m_kSettings = null;
_global.g_kApplication.m_kApplicationState = null;
_global.g_kApplication.m_kGameTimer = null;
_global.getSettings = function () {
return(_global.g_kApplication.m_kSettings);
};
_global.getApplicationState = function () {
return(_global.g_kApplication.m_kApplicationState);
};
_global.getGameTimer = function () {
return(_global.g_kApplication.m_kGameTimer);
};
this._lockroot = false;
if (_root == this) {
this.init();
this.start();
}
init();
_global.setBreakPoint = function () {
trace("Break point reached.");
};
Symbol 61 MovieClip [s_FPSDisplay] Frame 1
#initclip 35
Object.registerClass("s_FPSDisplay", LRG.Utils.FPSDisplay);
#endinitclip
Symbol 70 MovieClip [s_soundHolder] Frame 1
#initclip 23
Object.registerClass("s_soundHolder", LRG.LRGMovieClip);
#endinitclip
Symbol 73 MovieClip [s_Lightning] Frame 1
#initclip 24
Object.registerClass("s_Lightning", LRG.LRGMovieClip);
#endinitclip
Symbol 106 MovieClip [s_PlayerRight] Frame 1
#initclip 25
Object.registerClass("s_PlayerRight", Player);
#endinitclip
Symbol 121 MovieClip [s_PlayerLeft] Frame 1
#initclip 26
Object.registerClass("s_PlayerLeft", Player);
#endinitclip
Symbol 141 MovieClip [s_Ball] Frame 1
#initclip 27
Object.registerClass("s_Ball", Ball);
#endinitclip
Symbol 143 MovieClip [s_GameScreen] Frame 1
#initclip 28
Object.registerClass("s_GameScreen", TomGoesToTheMayorGame);
#endinitclip
Symbol 158 MovieClip [s_PlayGui] Frame 1
#initclip 29
Object.registerClass("s_PlayGui", PlayGui);
#endinitclip
Symbol 170 MovieClip [s_CloseUpScreen] Frame 1
#initclip 30
Object.registerClass("s_CloseUpScreen", CloseUpScreen);
#endinitclip
Symbol 178 MovieClip [s_HelpPanel] Frame 1
#initclip 31
Object.registerClass("s_HelpPanel", HelpPanel);
#endinitclip
Symbol 197 MovieClip [s_GameSummaryPanel] Frame 1
#initclip 32
Object.registerClass("s_GameSummaryPanel", GameSummaryPanel);
#endinitclip
Symbol 201 MovieClip [s_SplashScreen] Frame 1
#initclip 33
Object.registerClass("s_SplashScreen", SplashScreen);
#endinitclip
Symbol 202 MovieClip [s_Gui] Frame 1
#initclip 34
Object.registerClass("s_Gui", Gui);
#endinitclip
Symbol 203 MovieClip [__Packages.ApplicationState] Frame 0
class ApplicationState
{
var m_bMuted, m_eState;
function ApplicationState () {
init();
}
function init() {
m_bMuted = false;
m_eState = AS_APP_STARTED;
}
function getState() {
return(m_eState);
}
function setState(eState) {
m_eState = eState;
}
function isCurrentState(eState) {
return(m_eState == eState);
}
function setPaused(bPaused) {
if (bPaused && (!isPaused())) {
trace("PAUSE");
LRG.Utils.LRGGameTimer(_global.getGameTimer()).stopClock();
} else if ((!bPaused) && (isPaused())) {
trace("RESUME");
LRG.Utils.LRGGameTimer(_global.getGameTimer()).startClock(false);
}
}
function isPaused() {
return(!LRG.Utils.LRGGameTimer(_global.getGameTimer()).isRunning());
}
function setMuted(bMuted) {
if (isMuted() && (!bMuted)) {
m_bMuted = false;
_global.LRG.LRGMusic.startMusic();
} else if ((!isMuted()) && (bMuted)) {
_global.LRG.LRGMusic.stopMusic();
m_bMuted = true;
}
}
function isMuted() {
return(m_bMuted);
}
var AS_APP_STARTED = 0;
var AS_PRE_GAME = 1;
var AS_GAME_RUNNING = 2;
var AS_BETWEEN_ROUNDS = 3;
var AS_GAME_OVER = 4;
}
Symbol 204 MovieClip [__Packages.LRG.Utils.LRGGameTimer] Frame 0
class LRG.Utils.LRGGameTimer extends MovieClip
{
var m_fOffsetTime, m_fStartedTime, m_fStoppedTime, m_fCurrentTime, m_pClockListeners, m_fIntervalId, m_fTimeToRun;
function LRGGameTimer () {
super();
init();
}
function init() {
m_fOffsetTime = 0;
m_fStartedTime = undefined;
m_fStoppedTime = undefined;
m_fCurrentTime = undefined;
m_pClockListeners = new Array();
m_fIntervalId = undefined;
m_fTimeToRun = Infinity;
}
function getTime() {
return(m_fCurrentTime);
}
function isRunning() {
return(m_fIntervalId != undefined);
}
function stopClock() {
if (isRunning()) {
clearInterval(m_fIntervalId);
m_fIntervalId = undefined;
m_fStoppedTime = getTimer() / 1000;
var _local2 = 0;
while (_local2 < m_pClockListeners.length) {
m_pClockListeners[_local2].doOnClockStopped(this);
_local2++;
}
}
}
function startClock(bReset) {
if (bReset || (m_fCurrentTime == undefined)) {
resetClock();
} else {
m_fOffsetTime = m_fOffsetTime + ((getTimer() / 1000) - m_fStoppedTime);
m_fCurrentTime = (getTimer() / 1000) - m_fOffsetTime;
}
var _local2 = 0;
while (_local2 < m_pClockListeners.length) {
m_pClockListeners[_local2].doOnClockStarted(this);
_local2++;
}
m_fIntervalId = setInterval(this, "updateClock", 8.33333333333333);
}
function resetClock() {
m_fCurrentTime = 0;
m_fOffsetTime = getTimer() / 1000;
}
function setTimeToRun(fTime) {
m_fTimeToRun = fTime;
}
function addListener(kListener) {
m_pClockListeners.push(kListener);
}
function removeListener(kListener) {
var _local2 = m_pClockListeners;
m_pClockListeners = _local2.removeData(kListener);
}
function updateClock() {
m_fCurrentTime = (getTimer() / 1000) - m_fOffsetTime;
if (m_fCurrentTime >= m_fTimeToRun) {
stopClock();
}
}
}
Symbol 205 MovieClip [__Packages.Settings] Frame 0
class Settings
{
var BALL_OFFSET_START, BALL_SPEED_LIMIT, BALL_NORMAL_DRAG, BALL_BRAINSTORM_DRAG, BALL_NORMAL_GRAVITY, BALL_BRAINSTORM_GRAVITY, BRAINSTORM_MIN_INIT_VEL, BALL_BOUNCE, BALL_BOUNCE2, BALL_BOUNCE_DRIFT, BALL_HEIGHT_ABOVE_SERVING_PLAYER, AI_JUMP_HEIGHT, PLAYER_HORIZONTAL_VELOCITY, PLAYER_JUMPING_UP_ADDITIONAL_FORCE, PLAYER_FALLING_DOWN_ADDITIONAL_FORCE, PLAYER_JUMPING_SPEED, PLAYER_FALLING_SPEED, PLAYER_TIME_TO_FALL, PLAYER_DELAY_BEFORE_FALL, PLAYER_SPIKING_SPEED, PLAYER_UNSPIKING_SPEED, PLAYER_SPIKING_ADDITIONAL_FORCE_X, PLAYER_SPIKING_ADDITIONAL_FORCE_Y, END_ROUND_FPS, HITS_TO_BRAINSTORM, HIDE_BOUNDARIES;
function Settings () {
init();
}
function init() {
BALL_OFFSET_START = 28;
BALL_SPEED_LIMIT = 800;
BALL_NORMAL_DRAG = 0.4;
BALL_BRAINSTORM_DRAG = 0.42;
BALL_NORMAL_GRAVITY = 165;
BALL_BRAINSTORM_GRAVITY = 80;
BRAINSTORM_MIN_INIT_VEL = 200;
BALL_BOUNCE = 0.75;
BALL_BOUNCE2 = 0.825;
BALL_BOUNCE_DRIFT = 10;
BALL_HEIGHT_ABOVE_SERVING_PLAYER = 25;
AI_JUMP_HEIGHT = 10;
PLAYER_HORIZONTAL_VELOCITY = 215;
PLAYER_JUMPING_UP_ADDITIONAL_FORCE = -180;
PLAYER_FALLING_DOWN_ADDITIONAL_FORCE = 200;
PLAYER_JUMPING_SPEED = 50;
PLAYER_FALLING_SPEED = 45;
PLAYER_TIME_TO_FALL = 0.75;
PLAYER_DELAY_BEFORE_FALL = 0.5;
PLAYER_SPIKING_SPEED = 135;
PLAYER_UNSPIKING_SPEED = 130;
PLAYER_SPIKING_ADDITIONAL_FORCE_X = 800;
PLAYER_SPIKING_ADDITIONAL_FORCE_Y = 600;
END_ROUND_FPS = 40;
HITS_TO_BRAINSTORM = 10;
HIDE_BOUNDARIES = true;
}
function getSetting(sSettingName) {
return(this[sSettingName]);
}
}
Symbol 206 MovieClip [__Packages.LRG.LRGMovieClip] Frame 0
class LRG.LRGMovieClip extends MovieClip
{
var _name, stop, m_kActionsList, m_pActiveActions, m_kClipClock, onEnterFrame, _totalframes, _parent;
function LRGMovieClip () {
super();
if (_name == "m_kUpsellBackground") {
trace("created a m_kUpsellBackground");
}
stop();
init();
}
function init() {
m_kActionsList = new Object();
m_pActiveActions = new Array();
m_kClipClock = undefined;
}
function setClock(kClockObject) {
m_kClipClock = kClockObject;
}
function getClock() {
return(m_kClipClock);
}
function addAction(kActionObject) {
if (m_kActionsList[kActionObject.getName()] != undefined) {
removeAction(kActionObject.getName());
}
m_kActionsList[kActionObject.getName()] = kActionObject;
}
function removeAction(sActionKey) {
if (m_kActionsList[sActionKey] != undefined) {
if (m_pActiveActions.getIndex(sActionKey) != -1) {
stopAction(sActionKey, false);
}
delete m_kActionsList[sActionKey];
if (m_pActiveActions.length <= 0) {
onEnterFrame = undefined;
}
}
}
function removeAllActions() {
var _local3 = new Array();
for (var _local4 in m_kActionsList) {
_local3.push(_local4);
}
var _local2 = 0;
while (_local2 < _local3.length) {
removeAction(_local3[_local2]);
_local2++;
}
}
function startAction(sActionKey, kActionParams, bExclusiveType) {
if (sActionKey == "THROB_IN") {
trace("starting THROB_IN");
}
var _local3;
_local3 = m_kActionsList[sActionKey];
if (_local3 == undefined) {
trace((this + ": An attempt was made to start the undefined action ") + sActionKey);
return(undefined);
}
if (m_pActiveActions.getIndex(sActionKey) != -1) {
return(undefined);
}
if (bExclusiveType) {
stopActionsOfType(_local3.getType());
}
_local3.reset(getClipTime(), kActionParams);
m_pActiveActions.push(sActionKey);
if (sActionKey == "THROB_IN") {
trace("pushed " + m_pActiveActions);
}
onEnterFrame = LRGOnEnterFrame;
}
function stopActionsOfType(sActionType) {
var _local5 = m_pActiveActions.slice(0);
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2];
var _local4 = m_kActionsList[_local3];
if (_local4.getType() == sActionType) {
stopAction(_local3, false);
}
_local2++;
}
}
function stopAction(sActionKey, bCompleted) {
var _local2 = m_pActiveActions.removeData(sActionKey);
delete m_pActiveActions;
m_pActiveActions = _local2;
if (!isActionActive()) {
onEnterFrame = undefined;
}
if (bCompleted) {
onActionCompleted(sActionKey);
}
}
function stopAllActions() {
var _local3 = m_pActiveActions.slice(0);
var _local2 = 0;
while (_local2 < _local3.length) {
stopAction(_local3[_local2], false);
_local2++;
}
}
function getActionsList() {
return(m_kActionsList);
}
function getActiveActions() {
return(m_pActiveActions);
}
function getAction(sActionKey) {
return(m_kActionsList[sActionKey]);
}
function isActionActive() {
return(m_pActiveActions.length >= 1);
}
function playAnimation(sName, fFps, fStartFrame, fEndFrame, bLoop, fDirection, bFrameSkip) {
if (bFrameSkip == undefined) {
bFrameSkip = true;
}
var _local2 = new Object();
_local2.m_sName = sName;
_local2.m_fFPS = fFps;
_local2.m_fStartFrame = fStartFrame;
_local2.m_fEndFrame = fEndFrame;
_local2.m_bLoop = bLoop;
_local2.m_fDirection = fDirection;
_local2.m_bFrameSkip = bFrameSkip;
var _local4 = new LRG.LRGAnimationAction(_local2);
addAction(_local4);
startAction(sName, null, true);
}
function play(fFps, bLoop) {
if (_name == "m_kAnimation") {
trace("LRGMovieclip play for mk animation");
}
if (fFps == undefined) {
fFps = 30;
}
if (bLoop == undefined) {
bLoop = false;
}
playAnimation("DEFAULT_FULL_FRAME_ANIMATION", fFps, 1, _totalframes, bLoop, 1);
}
function LRGOnEnterFrame() {
if (isClockRunning()) {
LRGUpdateActions();
doEnterFrame();
}
}
function LRGUpdateActions() {
var _local8 = getClipTime();
var _local5 = new Array();
var _local6 = new Array();
var _local4;
var _local3 = 0;
while (_local3 < m_pActiveActions.length) {
_local4 = m_pActiveActions[_local3];
var _local7 = m_kActionsList[_local4].update(_local8, this);
if (_local7) {
_local5.push(_local4);
var _local2 = m_kActionsList[_local4].getNext();
if ((_local2 != undefined) && (m_kActionsList[_local2] != undefined)) {
_local6.push(_local2);
}
}
_local3++;
}
_local3 = 0;
while (_local3 < _local5.length) {
stopAction(_local5[_local3], true);
_local3++;
}
_local3 = 0;
while (_local3 < _local6.length) {
startAction(_local6[_local3]);
_local3++;
}
}
function onActionCompleted(sActionKey) {
_parent.onActionCompleted(sActionKey);
}
function doEnterFrame() {
}
function getClipTime() {
if (m_kClipClock) {
return(m_kClipClock.getTime());
}
return(getTimer() / 1000);
}
function isClockRunning() {
if (!m_kClipClock) {
return(true);
}
return(m_kClipClock.isRunning());
}
}
Symbol 207 MovieClip [__Packages.LRG.LRGAction] Frame 0
class LRG.LRGAction
{
var m_sName, m_fLastUpdateTime, m_fSPF, m_fFPS, m_fTotalActionTime, m_sNextAction, m_sActionType;
function LRGAction (kActionParams) {
}
function init(kActionParams) {
if (kActionParams.m_sName != undefined) {
m_sName = kActionParams.m_sName;
}
m_fLastUpdateTime = 0;
if (kActionParams.m_fSPF != undefined) {
m_fSPF = kActionParams.m_fSPF;
m_fFPS = 1 / m_fSPF;
} else if (kActionParams.m_fFPS != undefined) {
m_fFPS = kActionParams.m_fFPS;
m_fSPF = 1 / m_fFPS;
}
if (kActionParams.m_fTotalActionTime != undefined) {
m_fTotalActionTime = kActionParams.m_fTotalActionTime;
}
if (kActionParams.m_sNext != undefined) {
m_sNextAction = kActionParams.m_sNext;
}
if (m_sActionType == undefined) {
if (kActionParams.m_sType == undefined) {
m_sActionType = "DEFAULT";
} else {
m_sActionType = kActionParams.m_sType;
}
} else if (kActionParams.m_sType != undefined) {
m_sActionType = kActionParams.m_sType;
}
}
function getName() {
return(m_sName);
}
function getType() {
return(m_sActionType);
}
function getNext() {
return(m_sNextAction);
}
function setNext(sNextAction) {
m_sNextAction = sNextAction;
}
function reset(fCurrTime, kActionParams) {
if (kActionParams) {
init(kActionParams);
}
m_fLastUpdateTime = fCurrTime;
}
function update(fCurrTime, kClip) {
if (m_fLastUpdateTime == 0) {
m_fLastUpdateTime = fCurrTime;
return(false);
}
var _local2 = fCurrTime - m_fLastUpdateTime;
if (_local2 >= m_fSPF) {
m_fLastUpdateTime = fCurrTime;
return(doUpdate(fCurrTime, _local2, kClip));
}
return(false);
}
function doUpdate(fCurrTime, fDeltaTimeSecs, kClip) {
return(true);
}
}
Symbol 208 MovieClip [__Packages.LRG.LRGAnimationAction] Frame 0
class LRG.LRGAnimationAction extends LRG.LRGAction
{
var m_sActionType, m_pFrameList, m_sName, m_fDirection, m_fCurrentFrameIndex, m_bIsLooping, m_bFrameSkip, m_fFPS;
function LRGAnimationAction (kAnimationParams) {
super();
init(kAnimationParams);
}
function init(kAnimationParams) {
if ((kAnimationParams.m_sType == undefined) && ((m_sActionType == undefined) || (m_sActionType == "DEFAULT"))) {
kAnimationParams.m_sType = "FRAME_ANIMATION";
}
super.init(kAnimationParams);
if ((kAnimationParams.m_fStartFrame != undefined) && (kAnimationParams.m_fEndFrame != undefined)) {
if (m_pFrameList == undefined) {
m_pFrameList = new Array();
}
m_pFrameList.splice(0);
var _local3 = kAnimationParams.m_fStartFrame;
while (_local3 <= kAnimationParams.m_fEndFrame) {
m_pFrameList.push(_local3);
_local3++;
}
} else if (kAnimationParams.m_pFrameList != undefined) {
delete m_pFrameList;
m_pFrameList = kAnimationParams.m_pFrameList.slice(0);
} else if (m_pFrameList == undefined) {
trace(("Animation action " + m_sName) + " specified with no frame list.");
}
if (kAnimationParams.m_fDirection != undefined) {
m_fDirection = kAnimationParams.m_fDirection;
} else if (m_fDirection == undefined) {
m_fDirection = 1;
}
m_fCurrentFrameIndex = 0;
if (kAnimationParams.m_bLoop != undefined) {
m_bIsLooping = kAnimationParams.m_bLoop;
} else if (m_bIsLooping == undefined) {
m_bIsLooping = false;
}
if (kAnimationParams.m_bFrameSkip != undefined) {
m_bFrameSkip = kAnimationParams.m_bFrameSkip;
} else if (m_bFrameSkip == undefined) {
m_bFrameSkip = false;
}
}
function reset(fCurrTime, kAnimationParams) {
super.reset(fCurrTime, kAnimationParams);
if (m_fDirection > 0) {
m_fCurrentFrameIndex = 0;
} else {
m_fCurrentFrameIndex = m_pFrameList.length - 1;
}
}
function doUpdate(fCurrTime, fDeltaTimeSecs, kClip) {
var _local2;
if (m_bFrameSkip) {
var _local3 = fDeltaTimeSecs * m_fFPS;
m_fCurrentFrameIndex = m_fCurrentFrameIndex + (m_fDirection * _local3);
var _local4 = Math.round(m_fCurrentFrameIndex);
if (_local4 < m_pFrameList.length) {
_local2 = m_pFrameList[Math.round(m_fCurrentFrameIndex)];
} else {
_local2 = m_pFrameList[m_pFrameList.length - 1];
}
} else {
_local2 = m_pFrameList[m_fCurrentFrameIndex];
m_fCurrentFrameIndex = m_fCurrentFrameIndex + m_fDirection;
}
kClip.gotoAndStop(_local2);
if (!m_bIsLooping) {
if ((m_fCurrentFrameIndex < 0) || (m_fCurrentFrameIndex >= m_pFrameList.length)) {
return(true);
}
} else if (m_fCurrentFrameIndex < 0) {
m_fCurrentFrameIndex = m_pFrameList.length - 1;
} else if (m_fCurrentFrameIndex >= m_pFrameList.length) {
m_fCurrentFrameIndex = 0;
}
return(false);
}
}
Symbol 209 MovieClip [__Packages.Player] Frame 0
class Player extends LRG.LRGMovieClip
{
var setClock, addAction, m_kController, m_fVelocityX, m_fLastUpdateTime, m_bLeftPlayer, m_bJumping, m_bHanging, m_bPreFall, m_bSpiking, m_bUnspiking, m_bSpikeOnHang, m_bSpeaking, m_kSpeech, createEmptyMovieClip, getNextHighestDepth, m_kSpeechSound, m_kPlayerBody, m_kMovementRange, startAction, m_bServing, m_fScore, stopAction, _y, _x, _parent, gotoAndStop, getActiveActions, getClipTime, m_fHangTimeStart;
function Player () {
super();
}
function init() {
super.init();
setClock(_global.getGameTimer());
var _local4 = new Object();
_local4.m_sName = "GENERIC";
_local4.m_fFPS = 120;
var _local5 = new LRG.LRGGenericAction(_local4);
addAction(_local5);
setScore(0);
m_kController = undefined;
m_fVelocityX = 0;
m_fLastUpdateTime = 0;
m_bLeftPlayer = undefined;
m_bJumping = false;
m_bHanging = false;
m_bPreFall = false;
m_bSpiking = false;
m_bUnspiking = false;
m_bSpikeOnHang = false;
m_bSpeaking = false;
m_kSpeech = createEmptyMovieClip("m_kSpeech", getNextHighestDepth());
m_kSpeechSound = new Sound(m_kSpeech);
}
function setupAnimationActions() {
var _local5 = new Object();
_local5.m_sName = "JUMP";
_local5.m_fFPS = Settings(_global.getSettings()).getSetting("PLAYER_JUMPING_SPEED");
_local5.m_fStartFrame = 11;
_local5.m_fEndFrame = 20;
_local5.m_bLoop = false;
_local5.m_fDirection = 1;
var _local11 = new LRG.LRGAnimationAction(_local5);
addAction(_local11);
var _local7 = new Object();
_local7.m_sName = "PRE_FALL";
_local7.m_fTotalActionTime = Settings(_global.getSettings()).getSetting("PLAYER_DELAY_BEFORE_FALL");
var _local10 = new LRG.LRGWaitAction(_local7);
addAction(_local10);
var _local6 = new Object();
_local6.m_sName = "FALL";
_local6.m_fFPS = Settings(_global.getSettings()).getSetting("PLAYER_FALLING_SPEED");
_local6.m_fStartFrame = 25;
_local6.m_fEndFrame = 35;
_local6.m_bLoop = false;
_local6.m_fDirection = 1;
var _local8 = new LRG.LRGAnimationAction(_local6);
addAction(_local8);
var _local3 = new Object();
_local3.m_sName = "SPIKE";
_local3.m_fFPS = Settings(_global.getSettings()).getSetting("PLAYER_SPIKING_SPEED");
_local3.m_fStartFrame = 36;
_local3.m_fEndFrame = 65;
_local3.m_bLoop = false;
_local3.m_fDirection = 1;
_local3.m_bFrameSkip = true;
var _local12 = new LRG.LRGAnimationAction(_local3);
addAction(_local12);
var _local4 = new Object();
_local4.m_sName = "UNSPIKE";
_local4.m_fFPS = Settings(_global.getSettings()).getSetting("PLAYER_UNSPIKING_SPEED");
_local4.m_fStartFrame = 66;
_local4.m_fEndFrame = 95;
_local4.m_bLoop = false;
_local4.m_fDirection = 1;
_local4.m_bFrameSkip = true;
var _local9 = new LRG.LRGAnimationAction(_local4);
addAction(_local9);
}
function onStartGame() {
setupAnimationActions();
m_kController.onStartGame();
if (Settings(_global.getSettings()).getSetting("HIDE_BOUNDARIES")) {
m_kPlayerBody.m_kCollision._visible = false;
m_kMovementRange._visible = false;
}
setScore(0);
if (isLeftPlayer()) {
m_kSpeechSound.setVolume(900);
sayLine("tossIdeas.wav", true, true);
} else {
m_kSpeechSound.setVolume(300);
}
}
function onStartRound() {
m_kPlayerBody.gotoAndStop("Normal");
m_fLastUpdateTime = 0;
m_bSpikeOnHang = false;
startAction("GENERIC", null, true);
m_kController.onStartRound();
m_bSpeaking = false;
if (TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen).getServingPlayer() == this) {
m_bServing = true;
if ((Math.random() > 0.5) && (m_fScore > 0)) {
if (isLeftPlayer()) {
switch (Math.floor(Math.random() * 2)) {
case 0 :
sayLine("gotOne.wav", true, true);
break;
case 1 :
sayLine("thought.wav", true, true);
}
}
}
}
}
function onPreEndRound(bWon) {
if (bWon) {
m_kPlayerBody.gotoAndStop("Won");
if (isLeftPlayer()) {
switch (Math.floor(Math.random() * 2)) {
case 0 :
sayLine("ohTerrific.wav", true);
break;
case 1 :
sayLine("thankyou.wav", true);
}
} else {
switch (Math.floor(Math.random() * 5)) {
case 0 :
sayLine("laugh.wav", true, true);
break;
case 1 :
sayLine("laugh2.wav", true, true);
break;
case 2 :
sayLine("laugh3.wav", true, true);
break;
case 3 :
sayLine("laugh4.wav", true, true);
break;
case 4 :
sayLine("laugh5.wav", true, true);
}
}
} else {
m_kPlayerBody.gotoAndStop("Lost");
if (isLeftPlayer()) {
switch (Math.floor(Math.random() * 8)) {
case 0 :
sayLine("awShirt.wav", true, true);
break;
case 1 :
sayLine("crackets.wav", true, true);
break;
case 2 :
sayLine("crickets.wav", true, true);
break;
case 3 :
sayLine("dontunderstand.wav", true, true);
break;
case 4 :
sayLine("ohCrickets.wav", true, true);
break;
case 5 :
sayLine("ohCrickets2.wav", true, true);
break;
case 6 :
sayLine("shirt.wav", true, true);
break;
case 7 :
sayLine("shirt2.wav", true, true);
}
} else {
switch (Math.floor(Math.random() * 2)) {
case 0 :
sayLine("fine.wav", true);
break;
case 1 :
sayLine("nonono.wav", true);
}
}
}
}
function onEndRound() {
m_kController.onEndRound();
stopAction("GENERIC", false);
}
function isSpeaking() {
return(m_bSpeaking);
}
function sayLine(sSymbolName, bInterrupt, bOverlapOther, bDontReduceVolumeOnOverlap) {
if (bInterrupt === undefined) {
bInterrupt = false;
} else if (bInterrupt) {
m_kSpeechSound.stop();
m_bSpeaking = false;
}
if (bDontReduceVolumeOnOverlap == undefined) {
bDontReduceVolumeOnOverlap = false;
}
if (bOverlapOther == undefined) {
bOverlapOther = false;
}
if (!bOverlapOther) {
if (TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen).getOtherPlayer(this).isSpeaking()) {
return(undefined);
}
}
if (m_bSpeaking) {
return(undefined);
}
if (bOverlapOther && (!bDontReduceVolumeOnOverlap)) {
if (isLeftPlayer()) {
m_kSpeechSound.setVolume(450);
} else {
m_kSpeechSound.setVolume(150);
}
} else if (isLeftPlayer()) {
m_kSpeechSound.setVolume(900);
} else {
m_kSpeechSound.setVolume(300);
}
m_bSpeaking = true;
var _local5 = {x:_x, y:_y};
_parent.localToGlobal(_local5);
var _local3 = (_local5.x / 3) - 100;
if (_local3 < -100) {
_local3 = -100;
} else if (_local3 > 100) {
_local3 = 100;
}
m_kSpeechSound.setPan(_local3);
m_kSpeechSound.attachSound(sSymbolName);
m_kSpeechSound.start();
m_kSpeechSound.kSpeakingPlayer = this;
m_kSpeechSound.onSoundComplete = function () {
this.kSpeakingPlayer.m_bSpeaking = false;
};
}
function setController(kController) {
m_kController = kController;
m_kController.setPlayer(this);
}
function setScore(fScore) {
m_fScore = fScore;
if (isLeftPlayer()) {
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setLeftScore(m_fScore);
} else {
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setRightScore(m_fScore);
}
}
function getScore(fScore) {
return(m_fScore);
}
function setLeftPlayer(bLeftPlayer) {
m_bLeftPlayer = bLeftPlayer;
}
function isLeftPlayer() {
return(m_bLeftPlayer);
}
function isRightPlayer() {
return(!m_bLeftPlayer);
}
function setVelocityX(fVel) {
m_fVelocityX = fVel;
}
function getVelocityX() {
return(m_fVelocityX);
}
function jump() {
if (TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen).getBall().isCountdown()) {
return(undefined);
}
if (isLeftPlayer() && (Math.random() < 0.1)) {
sayLine("jumpIn.wav");
}
var _local3 = {x:_x, y:_y};
_parent.localToGlobal(_local3);
var _local4 = (_local3.x / 3) - 100;
_global.playSound("tom_chair_up.wav", 1, this, _local4);
startAction("JUMP", null, true);
m_bJumping = true;
}
function abortJump() {
stopAction("JUMP", false);
stopAction("FALL", false);
gotoAndStop("Normal");
m_bJumping = false;
m_bHanging = false;
}
function isJumping() {
return(m_bJumping);
}
function isJumpingUp() {
return(getActiveActions().getIndex("JUMP") != -1);
}
function isHanging() {
return(m_bHanging);
}
function isFallingDown() {
return(getActiveActions().getIndex("FALL") != -1);
}
function spike() {
if ((!(m_bHanging || (m_bPreFall))) || (TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen).getBall().isCountdown())) {
if (!m_bSpikeOnHang) {
if (isJumpingUp()) {
m_bSpikeOnHang = true;
}
}
return(undefined);
}
var _local3 = {x:_x, y:_y};
_parent.localToGlobal(_local3);
var _local4 = (_local3.x / 3) - 100;
_global.playSound("tom_chair_up.wav", 1, this, _local4);
startAction("SPIKE", null, true);
m_bSpiking = true;
if (!TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen).isPreEndRound()) {
m_kPlayerBody.gotoAndStop("Spike");
}
}
function abortSpike() {
stopAction("SPIKE", false);
stopAction("UNSPIKE", false);
gotoAndStop("Normal");
m_bSpiking = false;
m_bUnspiking = false;
}
function isSpiking() {
return(m_bSpiking);
}
function isUnspiking() {
return(m_bUnspiking);
}
function isServing() {
return(m_bServing);
}
function getCollisionObject() {
return(m_kPlayerBody.m_kCollision);
}
function onHitBall() {
m_kController.onHitBall();
}
function onBallCrossedToPlayerSide() {
m_bServing = false;
var _local3 = _global.g_kApplication.m_kGameScreen;
if (_local3.getBall().isCountdown() || (_local3.isPreEndRound())) {
return(undefined);
}
if (Math.random() < 0.2) {
return(undefined);
}
if (isLeftPlayer()) {
switch (Math.floor(Math.random() * 7)) {
case 0 :
sayLine("fantastic.wav");
break;
case 1 :
sayLine("great.wav");
break;
case 2 :
sayLine("ohFairEnough.wav");
break;
case 3 :
sayLine("ohBoy.wav");
break;
case 4 :
sayLine("uhHuh.wav");
break;
case 5 :
sayLine("yes.wav");
break;
case 6 :
sayLine("notgettingIt.wav");
}
} else {
switch (Math.floor(Math.random() * 11)) {
case 0 :
sayLine("bupbupbup.wav");
break;
case 1 :
sayLine("fairEnough.wav");
break;
case 2 :
sayLine("niceOne.wav");
break;
case 3 :
sayLine("right.wav");
break;
case 4 :
sayLine("sure.wav");
break;
case 5 :
sayLine("sure2.wav");
break;
case 6 :
sayLine("thatSoundsGreat.wav");
break;
case 7 :
sayLine("wonderful.wav");
break;
case 8 :
sayLine("wow.wav");
break;
case 9 :
sayLine("wow2.wav");
break;
case 10 :
sayLine("wowTom.wav");
}
}
}
function onPreBrainstorm() {
switch (Math.floor(Math.random() * 3)) {
case 0 :
sayLine("letsBrainStorm.wav", true, true, true);
break;
case 1 :
sayLine("stormItUp.wav", true, true, true);
break;
case 2 :
sayLine("stormItUp2.wav", true, true, true);
}
}
function doEnterFrame() {
var _local12 = getClipTime() - m_fLastUpdateTime;
m_fLastUpdateTime = getClipTime();
if ((ApplicationState(_global.getApplicationState()).isPaused() || (m_bLeftPlayer == undefined)) || (TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen).getBall().isCountdown())) {
return(undefined);
}
m_kController.update(_local12);
_x = _x + (m_fVelocityX * _local12);
if (m_bSpeaking) {
var _local10 = {x:_x, y:_y};
_parent.localToGlobal(_local10);
var _local5 = (_local10.x / 3) - 100;
if (_local5 < -100) {
_local5 = -100;
} else if (_local5 > 100) {
_local5 = 100;
}
m_kSpeechSound.setPan(_local5);
}
var _local3 = _global.g_kApplication.m_kGameScreen;
var _local4 = m_kMovementRange.getBounds(_local3);
var _local11 = _x - _local4.xMin;
var _local7 = _x - _local4.xMax;
var _local9 = _local3.getLeftWall().getBounds(_local3);
var _local8 = _local3.getRightWall().getBounds(_local3);
var _local6 = _local3.getDesk().m_kDivider.getBounds(_local3);
if (isLeftPlayer()) {
if (_local4.xMin < _local9.xMax) {
_x = _local9.xMax + _local11;
} else if (_local4.xMax > _local6.xMin) {
_x = _local6.xMin + _local7;
}
} else if (_local4.xMin < _local6.xMax) {
_x = _local6.xMax + _local11;
} else if (_local4.xMax > _local8.xMin) {
_x = _local8.xMin + _local7;
}
if (m_bHanging && (!m_bPreFall)) {
if ((!m_kController.isShouldStayUp()) || ((getClipTime() - m_fHangTimeStart) >= Settings(_global.getSettings()).getSetting("PLAYER_TIME_TO_FALL"))) {
m_bPreFall = true;
startAction("PRE_FALL", null, false);
}
}
}
function onActionCompleted(sActionKey) {
if (sActionKey == "JUMP") {
m_bHanging = true;
m_fHangTimeStart = getClipTime();
if (m_bSpikeOnHang) {
m_bSpikeOnHang = false;
spike();
}
} else if (sActionKey == "SPIKE") {
startAction("UNSPIKE", null, true);
m_bUnspiking = true;
} else if (sActionKey == "UNSPIKE") {
if (!TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen).isPreEndRound()) {
m_kPlayerBody.gotoAndStop("Normal");
}
m_bSpiking = false;
m_bUnspiking = false;
m_bPreFall = false;
var _local4 = {x:_x, y:_y};
_parent.localToGlobal(_local4);
var _local5 = (_local4.x / 3) - 100;
_global.playSound("tom_chair_down.wav", 1, this, _local5);
startAction("FALL", null, true);
m_bHanging = false;
} else if (sActionKey == "PRE_FALL") {
if (!m_bSpiking) {
m_bPreFall = false;
var _local4 = {x:_x, y:_y};
_parent.localToGlobal(_local4);
var _local5 = (_local4.x / 3) - 100;
_global.playSound("tom_chair_down.wav", 1, this, _local5);
startAction("FALL", null, true);
m_bHanging = false;
}
} else if (sActionKey == "FALL") {
m_bJumping = false;
}
}
}
Symbol 210 MovieClip [__Packages.LRG.LRGGenericAction] Frame 0
class LRG.LRGGenericAction extends LRG.LRGAction
{
var init;
function LRGGenericAction (kActionParams) {
super();
init(kActionParams);
}
function doUpdate(fCurrTime, fDeltaTimeSecs, kClip) {
return(false);
}
}
Symbol 211 MovieClip [__Packages.LRG.LRGWaitAction] Frame 0
class LRG.LRGWaitAction extends LRG.LRGAction
{
var m_fTotalActionTime, m_sActionType;
function LRGWaitAction (kAnimationParams) {
super();
init(kAnimationParams);
}
function init(kActionParams) {
if ((kActionParams.m_fTotalActionTime == undefined) && (m_fTotalActionTime == undefined)) {
kActionParams.m_fTotalActionTime = 0;
trace(("Wait action " + kActionParams.m_sName) + " created with no wait time specified.");
}
kActionParams.m_fSPF = kActionParams.m_fTotalActionTime;
if ((kActionParams.m_sType == undefined) && ((m_sActionType == undefined) || (m_sActionType == "DEFAULT"))) {
kActionParams.m_sType = "WAIT";
}
super.init(kActionParams);
}
function reset(fCurrTime, kActionParams) {
super.reset(fCurrTime, kActionParams);
}
function doUpdate(fCurrTime, fDeltaTimeSecs, kClip) {
if (fDeltaTimeSecs >= m_fTotalActionTime) {
return(true);
}
return(false);
}
}
Symbol 212 MovieClip [__Packages.TomGoesToTheMayorGame] Frame 0
class TomGoesToTheMayorGame extends LRG.LRGMovieClip
{
var m_kServingPlayer, onEnterFrame, m_fMusicToPlay, m_kPlayerLeft, m_kPlayerRight, m_pBallList, m_kLightning, stopAction, m_kFloor, m_kLeftWall, m_kRightWall, m_kDesk, m_bPreEndRound, m_kBall, m_kBallContainer, m_kCeiling, globalToLocal;
function TomGoesToTheMayorGame () {
super();
}
function init() {
super.init();
m_kServingPlayer = null;
onEnterFrame = function () {
this.setClock(_global.getGameTimer());
this.m_pBallList = new Array();
this.m_kBall = this.m_kBallContainer.m_kBall;
this.m_pBallList.push(this.m_kBall);
this.m_kPlayerLeft.setController(new HumanPlayerController());
this.m_kPlayerLeft.setLeftPlayer(true);
this.m_kPlayerRight.setController(new ComputerPlayerController());
this.m_kPlayerRight.setLeftPlayer(false);
this.onEnterFrame = undefined;
if (Settings(_global.getSettings()).getSetting("HIDE_BOUNDARIES")) {
this.m_kDesk.m_kDivider._visible = false;
this.m_kCeiling._visible = false;
this.m_kLeftWall._visible = false;
this.m_kRightWall._visible = false;
this.m_kFloor._visible = false;
}
var _local3 = new Object();
_local3.m_sName = "REPEAT_LIGHTNING";
_local3.m_fSPF = 13;
_local3.m_kCallback = this.repeatLightningCallback;
var _local4 = new LRG.LRGRepeatedCallbackAction(_local3);
this.addAction(_local4);
};
}
function startGame() {
var _local4 = new Date().getTime();
loadMovieNum ("tracker.swf?" + _local4, 10000);
m_fMusicToPlay = 1;
_global.getApplicationState().setState(_global.getApplicationState().AS_GAME_RUNNING);
_global.getApplicationState().setPaused(false);
_global.g_kApplication.m_kGui.m_kPlayGui.gotoAndStop("Show");
_global.g_kApplication.m_kGui.m_kPlayGui._visible = true;
_global.g_kApplication.m_kGui.m_kPlayGui.onShow();
m_kPlayerLeft.onStartGame();
m_kPlayerRight.onStartGame();
var _local3 = 0;
while (_local3 < m_pBallList.length) {
Ball(m_pBallList[_local3]).onStartGame();
_local3++;
}
m_kServingPlayer = m_kPlayerLeft;
startRound();
}
function endGame() {
_global.LRG.LRGMusic.endMusic();
_global.getApplicationState().setPaused(true);
_global.g_kApplication.m_kGui.m_kPlayGui.gotoAndStop("Hide");
_global.g_kApplication.m_kGui.m_kPlayGui._visible = false;
_global.g_kApplication.m_kGui.m_kGameSummaryPanel.gotoAndStop("Show");
_global.g_kApplication.m_kGui.m_kGameSummaryPanel._visible = true;
_global.g_kApplication.m_kGui.m_kGameSummaryPanel.onShow();
}
function startRound() {
_global.LRG.LRGMusic.stopMusic();
if (m_fMusicToPlay == 4) {
_global.LRG.LRGMusic.startMusic(["tom_titlescreen_music.wav"]);
} else {
_global.LRG.LRGMusic.startMusic([("tom_game_music" + m_fMusicToPlay) + ".wav"]);
}
m_fMusicToPlay++;
if (m_fMusicToPlay > 4) {
m_fMusicToPlay = 1;
}
trace("TomGoesToTheMayorGame::startRound()");
_global.getApplicationState().setPaused(false);
m_kLightning.stopAction("LIGHTNING_FLASH", false);
stopAction("REPEAT_LIGHTNING", false);
m_kLightning.gotoAndStop("Hide");
var _local8 = m_kFloor.getBounds(this);
var _local7 = m_kLeftWall.getBounds(this);
var _local9 = m_kRightWall.getBounds(this);
var _local4 = m_kDesk.m_kDivider.getBounds(this);
var _local5 = m_kPlayerLeft.getBounds(this);
var _local6 = m_kPlayerRight.getBounds(this);
var _local15 = m_kPlayerLeft.m_kPlayerChairBase.getBounds(this);
var _local11 = m_kPlayerRight.m_kPlayerChairBase.getBounds(this);
var _local10 = ((_local4.xMin - _local7.xMax) / 2) + _local7.xMax;
var _local13 = ((_local5.xMax - _local5.xMin) / 2) + _local5.xMin;
m_kPlayerLeft._x = m_kPlayerLeft._x + (_local10 - _local13);
m_kPlayerLeft._y = m_kPlayerLeft._y + (_local8.yMin - _local15.yMax);
var _local12 = ((_local9.xMin - _local4.xMax) / 2) + _local4.xMax;
var _local14 = ((_local6.xMax - _local6.xMin) / 2) + _local6.xMin;
m_kPlayerRight._x = m_kPlayerRight._x + (_local12 - _local14);
m_kPlayerRight._y = m_kPlayerRight._y + (_local8.yMin - _local11.yMax);
m_kPlayerLeft.onStartRound();
m_kPlayerRight.onStartRound();
var _local3 = 0;
while (_local3 < m_pBallList.length) {
Ball(m_pBallList[_local3]).onStartRound();
_local3++;
}
m_bPreEndRound = false;
}
function preEndRound(kWinningPlayer) {
_global.LRG.LRGMusic.endMusic();
_global.playSound("tom_whistle.wav", 1, this);
m_bPreEndRound = true;
var _local3 = 0;
while (_local3 < m_pBallList.length) {
if (!Ball(m_pBallList[_local3]).isDissolving()) {
Ball(m_pBallList[_local3]).dissolve(false);
}
_local3++;
}
kWinningPlayer.setScore(kWinningPlayer.getScore() + 1);
if ((kWinningPlayer == getPlayerRight()) || (Math.random() < 0.5)) {
kWinningPlayer.onPreEndRound(true);
getOtherPlayer(kWinningPlayer).onPreEndRound(false);
} else {
getOtherPlayer(kWinningPlayer).onPreEndRound(false);
kWinningPlayer.onPreEndRound(true);
}
}
function isPreEndRound() {
return(m_bPreEndRound);
}
function endRound(kWinningPlayer) {
m_bPreEndRound = false;
_global.getApplicationState().setPaused(true);
var _local3 = 0;
while (_local3 < m_pBallList.length) {
if (m_pBallList[_local3] != m_kBall) {
Ball(m_pBallList[_local3]).removeMovieClip();
}
_local3++;
}
delete m_pBallList;
m_pBallList = new Array();
m_pBallList.push(m_kBall);
m_kPlayerLeft.onEndRound();
m_kPlayerRight.onEndRound();
_local3 = 0;
while (_local3 < m_pBallList.length) {
Ball(m_pBallList[_local3]).onEndRound();
_local3++;
}
m_kServingPlayer = kWinningPlayer;
if (kWinningPlayer.getScore() >= 11) {
endGame();
return(undefined);
}
_global.g_kApplication.m_kGameScreen.startRound();
}
function brainstorm() {
_global.LRG.LRGMusic.stopMusic();
_global.LRG.LRGMusic.startMusic(["tom_brainstorm_music.wav"]);
m_kLightning.playAnimation("LIGHTNING_FLASH", 120, 11, 30, false, 1, false);
m_pBallList[1] = m_kBallContainer.attachMovie("s_Ball", "m_kBall1", m_kBallContainer.getNextHighestDepth());
Ball(m_pBallList[1])._x = m_kBall._x;
Ball(m_pBallList[1])._y = m_kBall._y;
m_pBallList[2] = m_kBallContainer.attachMovie("s_Ball", "m_kBall2", m_kBallContainer.getNextHighestDepth());
Ball(m_pBallList[2])._x = m_kBall._x;
Ball(m_pBallList[2])._y = m_kBall._y;
onEnterFrame = function () {
this.m_kBall.startBrainstorm();
if (this.m_kBall.getVelocityX() > 0) {
this.m_kBall._x = this.m_kBall._x + 10;
} else {
this.m_kBall._y = this.m_kBall._y + 10;
}
Ball(this.m_pBallList[1]).startBrainstorm();
Ball(this.m_pBallList[1]).setVelocityX(this.m_kBall.getVelocityX());
if (Ball(this.m_pBallList[1]).getVelocityX() < Settings(_global.getSettings()).getSetting("BRAINSTORM_MIN_INIT_VEL")) {
Ball(this.m_pBallList[1]).setVelocityX(Settings(_global.getSettings()).getSetting("BRAINSTORM_MIN_INIT_VEL"));
}
if (Ball(this.m_pBallList[1]).getVelocityX() > 0) {
Ball(this.m_pBallList[1])._x = Ball(this.m_pBallList[1])._x + 10;
} else {
Ball(this.m_pBallList[1])._x = Ball(this.m_pBallList[1])._x - 10;
}
Ball(this.m_pBallList[1])._y = Ball(this.m_pBallList[1])._y - 10;
Ball(this.m_pBallList[1]).setVelocityY(0);
Ball(this.m_pBallList[2]).startBrainstorm();
Ball(this.m_pBallList[2]).setVelocityX(-this.m_kBall.getVelocityX());
if (Ball(this.m_pBallList[2]).getVelocityX() > (-Settings(_global.getSettings()).getSetting("BRAINSTORM_MIN_INIT_VEL"))) {
Ball(this.m_pBallList[2]).setVelocityX(-Settings(_global.getSettings()).getSetting("BRAINSTORM_MIN_INIT_VEL"));
}
if (Ball(this.m_pBallList[2]).getVelocityX() > 0) {
Ball(this.m_pBallList[2])._x = Ball(this.m_pBallList[2])._x + 10;
} else {
Ball(this.m_pBallList[2])._x = Ball(this.m_pBallList[2])._x - 10;
}
Ball(this.m_pBallList[2])._y = Ball(this.m_pBallList[2])._y - 10;
Ball(this.m_pBallList[2]).setVelocityY(0);
this.onEnterFrame = undefined;
this.startAction("REPEAT_LIGHTNING", null, false);
};
}
function repeatLightningCallback() {
m_kLightning.playAnimation("LIGHTNING_FLASH", 120, 11, 30, false, 1, false);
}
function getPlayerLeft() {
return(m_kPlayerLeft);
}
function getPlayerRight() {
return(m_kPlayerRight);
}
function getServingPlayer() {
return(m_kServingPlayer);
}
function getBallAtIndex(fIndex) {
return(m_pBallList[fIndex]);
}
function getNumberBalls() {
return(m_pBallList.length);
}
function getBall() {
return(m_kBall);
}
function getDesk() {
return(m_kDesk);
}
function getFloor() {
return(m_kFloor);
}
function getCeiling() {
return(m_kCeiling);
}
function getLeftWall() {
return(m_kLeftWall);
}
function getRightWall() {
return(m_kRightWall);
}
function getOtherPlayer(kPlayer) {
return(((m_kPlayerRight == kPlayer) ? (m_kPlayerLeft) : (m_kPlayerRight)));
}
function collideBall(kBall) {
var _local4 = new Object();
_local4.m_kObject = null;
_local4.m_fVelocityX = 1;
_local4.m_fVelocityY = 1;
var _local13 = m_kFloor.getBounds(this);
var _local12 = m_kCeiling.getBounds(this);
var _local11 = m_kLeftWall.getBounds(this);
var _local10 = m_kRightWall.getBounds(this);
var _local9 = {x:m_kPlayerLeft.m_kPlayerBody.m_kCenterPoint._x, y:m_kPlayerLeft.m_kPlayerBody.m_kCenterPoint._y};
m_kPlayerLeft.m_kPlayerBody.localToGlobal(_local9);
globalToLocal(_local9);
var _local8 = {x:m_kPlayerRight.m_kPlayerBody.m_kCenterPoint._x, y:m_kPlayerRight.m_kPlayerBody.m_kCenterPoint._y};
m_kPlayerRight.m_kPlayerBody.localToGlobal(_local8);
globalToLocal(_local8);
if ((kBall._y > _local13.yMin) && (kBall.getVelocityY() > 0)) {
_local4.m_kObject = m_kFloor;
_local4.m_fVelocityX = (kBall.getVelocityX() + (Math.random() * Settings(_global.getSettings()).getSetting("BALL_BOUNCE_DRIFT"))) - (Settings(_global.getSettings()).getSetting("BALL_BOUNCE_DRIFT") / 2);
_local4.m_fVelocityY = (-1 * kBall.getVelocityY()) * Settings(_global.getSettings()).getSetting("BALL_BOUNCE");
} else if ((kBall._y < _local12.yMax) && (kBall.getVelocityY() < 0)) {
_local4.m_kObject = m_kCeiling;
_local4.m_fVelocityX = (kBall.getVelocityX() + (Math.random() * Settings(_global.getSettings()).getSetting("BALL_BOUNCE_DRIFT"))) - (Settings(_global.getSettings()).getSetting("BALL_BOUNCE_DRIFT") / 2);
_local4.m_fVelocityY = (-1 * kBall.getVelocityY()) * Settings(_global.getSettings()).getSetting("BALL_BOUNCE");
} else if ((kBall._x < _local11.xMax) && (kBall.getVelocityX() < 0)) {
_local4.m_kObject = m_kLeftWall;
_local4.m_fVelocityX = (-1 * kBall.getVelocityX()) * Settings(_global.getSettings()).getSetting("BALL_BOUNCE");
_local4.m_fVelocityY = (kBall.getVelocityY() + (Math.random() * Settings(_global.getSettings()).getSetting("BALL_BOUNCE_DRIFT"))) - (Settings(_global.getSettings()).getSetting("BALL_BOUNCE_DRIFT") / 2);
} else if ((kBall._x > _local10.xMin) && (kBall.getVelocityX() > 0)) {
_local4.m_kObject = m_kRightWall;
_local4.m_fVelocityX = (-1 * kBall.getVelocityX()) * Settings(_global.getSettings()).getSetting("BALL_BOUNCE");
_local4.m_fVelocityY = (kBall.getVelocityY() + (Math.random() * Settings(_global.getSettings()).getSetting("BALL_BOUNCE_DRIFT"))) - (Settings(_global.getSettings()).getSetting("BALL_BOUNCE_DRIFT") / 2);
} else if (collideBallWithClip(kBall, m_kPlayerLeft.getCollisionObject(), _local9.x, _local9.y, m_kPlayerLeft, _local4)) {
_local4.m_kObject = m_kPlayerLeft;
} else if (collideBallWithClip(kBall, m_kPlayerRight.getCollisionObject(), _local8.x, _local8.y, m_kPlayerRight, _local4)) {
_local4.m_kObject = m_kPlayerRight;
} else if (collideBallWithClip(kBall, m_kDesk.m_kDivider, m_kDesk._x + m_kDesk.m_kCenterPoint._x, m_kDesk._y + m_kDesk.m_kCenterPoint._y, null, _local4)) {
_local4.m_kObject = m_kDesk;
} else {
var _local7 = 0;
while (_local7 < m_pBallList.length) {
var _local5 = Ball(m_pBallList[_local7]);
if (_local5 == kBall) {
} else if (collideBallWithClip(kBall, _local5, _local5._x, _local5._y, null, _local4)) {
var _local6 = new Object();
_local6.m_kObject = null;
_local6.m_fVelocityX = 1;
_local6.m_fVelocityY = 1;
collideBallWithClip(_local5, kBall, kBall._x, kBall._y, null, _local6, true);
_local4.m_kObject = _local5;
kBall.onHitBall(_local4);
_local6.m_kObject = kBall;
_local5.onHitBall(_local6);
_local4.m_kObject = null;
return(_local4);
}
_local7++;
}
}
return(_local4);
}
function collideBallWithClip(kBall, kClip, fClipCenterX, kClipCenterY, kPlayer, kCollisionResult, bForceResolveCollision) {
if (!bForceResolveCollision) {
if (!kClip.hitTest(kBall._x, kBall._y, true)) {
return(false);
}
}
var _local7;
var _local4;
if (kPlayer) {
if (kPlayer.isSpiking()) {
var _local5 = {x:kBall._x, y:kBall._y};
kBall._parent.localToGlobal(_local5);
kPlayer.m_kPlayerBody.globalToLocal(_local5);
var _local8 = false;
if (kPlayer.isLeftPlayer()) {
_local8 = _local5.x > kPlayer.m_kPlayerBody.m_kCenterPoint._x;
} else {
_local8 = _local5.x < kPlayer.m_kPlayerBody.m_kCenterPoint._x;
}
if (_local8) {
if (kPlayer.isLeftPlayer()) {
kCollisionResult.m_fVelocityX = Settings(_global.getSettings()).getSetting("PLAYER_SPIKING_ADDITIONAL_FORCE_X");
} else {
kCollisionResult.m_fVelocityX = -Settings(_global.getSettings()).getSetting("PLAYER_SPIKING_ADDITIONAL_FORCE_X");
}
kCollisionResult.m_fVelocityY = Settings(_global.getSettings()).getSetting("PLAYER_SPIKING_ADDITIONAL_FORCE_Y");
return(true);
}
}
_local7 = kPlayer.getVelocityX();
if (kPlayer.isJumping()) {
if (kPlayer.isJumpingUp()) {
_local4 = Settings(_global.getSettings()).getSetting("PLAYER_JUMPING_UP_ADDITIONAL_FORCE");
} else if (kPlayer.isFallingDown()) {
_local4 = Settings(_global.getSettings()).getSetting("PLAYER_FALLING_DOWN_ADDITIONAL_FORCE");
} else {
_local4 = 0;
}
} else {
_local4 = 0;
}
} else if (kClip.getVelocityX && (kClip.getVelocityY)) {
_local7 = kClip.getVelocityX();
_local4 = kClip.getVelocityY();
} else {
_local7 = 0;
_local4 = 0;
}
var _local14 = _local7 - kBall.getVelocityX();
var _local13 = _local4 - kBall.getVelocityY();
if (_global.LRG.Utils.Vector2D.magnitude(_local14, _local13) < 1) {
return(false);
}
var _local18 = kBall._x - fClipCenterX;
var _local17 = kBall._y - kClipCenterY;
var _local6 = _global.LRG.Utils.Vector2D.normalize(_local18, _local17);
var _local12 = _global.LRG.Utils.Vector2D.dot(_local14, _local13, _local6.x, _local6.y);
if (_local12 <= 0) {
return(false);
}
var _local11 = (1 + Settings(_global.getSettings()).getSetting("BALL_BOUNCE2")) * _local12;
var _local16 = _local6.x * _local11;
var _local15 = _local6.y * _local11;
kCollisionResult.m_fVelocityX = kBall.getVelocityX() + _local16;
kCollisionResult.m_fVelocityY = kBall.getVelocityY() + _local15;
return(true);
}
}
Symbol 213 MovieClip [__Packages.PlayerController] Frame 0
class PlayerController
{
var m_kPlayer;
function PlayerController () {
init();
}
function init() {
m_kPlayer = undefined;
}
function setPlayer(kPlayer) {
m_kPlayer = kPlayer;
}
function onStartGame() {
}
function onStartRound() {
}
function onHitBall() {
}
function onEndRound() {
}
function isShouldStayUp() {
return(false);
}
function update(fDeltaSecs) {
}
}
Symbol 214 MovieClip [__Packages.HumanPlayerController] Frame 0
class HumanPlayerController extends PlayerController
{
var m_kPlayer, m_bUpKeyPressed, m_bDownKeyPressed;
function HumanPlayerController () {
super();
}
function init() {
super.init();
Key.addListener(this);
}
function onStartGame() {
}
function onStartRound() {
m_kPlayer.abortJump();
m_kPlayer.abortSpike();
m_kPlayer.setVelocityX(0);
}
function onEndRound() {
}
function isShouldStayUp() {
if (Key.isDown(38)) {
return(true);
}
return(false);
}
function onKeyDown() {
if (Key.isDown(38)) {
if ((!m_bUpKeyPressed) && (!m_kPlayer.isJumping())) {
m_kPlayer.jump();
}
m_bUpKeyPressed = true;
} else {
m_bUpKeyPressed = false;
}
if (Key.isDown(40)) {
if ((!m_bDownKeyPressed) && (!m_kPlayer.isSpiking())) {
m_kPlayer.spike();
}
m_bDownKeyPressed = true;
} else {
m_bDownKeyPressed = false;
}
}
function onKeyUp() {
if (Key.isDown(38)) {
m_bUpKeyPressed = true;
} else {
m_bUpKeyPressed = false;
}
if (Key.isDown(40)) {
m_bDownKeyPressed = true;
} else {
m_bDownKeyPressed = false;
}
}
function update(fDeltaSecs) {
if (ApplicationState(_global.getApplicationState()).isPaused()) {
return(undefined);
}
if (Key.isDown(37)) {
m_kPlayer.setVelocityX(-Settings(_global.getSettings()).getSetting("PLAYER_HORIZONTAL_VELOCITY"));
} else if (Key.isDown(39)) {
m_kPlayer.setVelocityX(Settings(_global.getSettings()).getSetting("PLAYER_HORIZONTAL_VELOCITY"));
} else {
m_kPlayer.setVelocityX(0);
}
}
}
Symbol 215 MovieClip [__Packages.ComputerPlayerController] Frame 0
class ComputerPlayerController extends PlayerController
{
var m_bBallOnOurSide, m_kPlayer, m_bHitBallSinceJump, m_fLastUpdateGoalsTime, m_fUpdateGoalsInterval, m_fTargetX, m_bMoveBackForHighThrows, m_fOffsetX, m_fJumpTime, m_fJumpStartTime;
function ComputerPlayerController () {
super();
}
function init() {
super.init();
Key.addListener(this);
}
function onStartGame() {
m_bBallOnOurSide = false;
updateGoals();
}
function onStartRound() {
m_kPlayer.abortJump();
m_kPlayer.abortSpike();
m_kPlayer.setVelocityX(0);
m_bBallOnOurSide = TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen).getServingPlayer() == m_kPlayer;
updateGoals();
}
function onHitBall() {
m_bHitBallSinceJump = true;
}
function onEndRound() {
}
function updateGoals() {
m_fLastUpdateGoalsTime = m_kPlayer.getClipTime();
m_fUpdateGoalsInterval = (Math.random() * 1.15) + 0.75;
var _local3 = _global.g_kApplication.m_kGameScreen;
var _local5 = _local3.m_kRightWall.getBounds(_local3);
var _local4 = _local3.m_kDesk.m_kDivider.getBounds(_local3);
m_fTargetX = (Math.random() * (_local5.xMin - _local4.xMax)) + _local4.xMax;
if (m_kPlayer.isServing() || (_local3.getPlayerRight().getScore() < _local3.getPlayerLeft().getScore())) {
m_bMoveBackForHighThrows = true;
m_fOffsetX = (Math.random() * 9) + 3;
} else if ((_local3.getPlayerRight().getScore() == _local3.getPlayerLeft().getScore()) || (_local3.getPlayerRight().getScore() == (_local3.getPlayerLeft().getScore() + 1))) {
m_bMoveBackForHighThrows = false;
m_fOffsetX = Math.random() * 50;
} else if (_local3.getPlayerRight().getScore() == (_local3.getPlayerLeft().getScore() + 2)) {
m_bMoveBackForHighThrows = false;
m_fOffsetX = Math.random() * 65;
} else if (_local3.getPlayerRight().getScore() == (_local3.getPlayerLeft().getScore() + 3)) {
m_bMoveBackForHighThrows = false;
m_fOffsetX = Math.random() * 75;
} else {
m_bMoveBackForHighThrows = false;
m_fOffsetX = Math.random() * 85;
}
}
function isShouldStayUp() {
if (m_bHitBallSinceJump && ((m_kPlayer.getClipTime() - m_fJumpStartTime) >= m_fJumpTime)) {
return(false);
}
var _local3 = _global.g_kApplication.m_kGameScreen;
var _local9 = _local3.m_kRightWall.getBounds(_local3);
var _local4 = _local3.m_kDesk.m_kDivider.getBounds(_local3);
var _local6 = m_kPlayer.getBounds(_local3);
var _local7 = (_local6.xMax + _local6.xMin) / 2;
var _local8 = (_local4.xMax + _local4.xMin) / 2;
var _local5 = _local3.getBall();
if (_local5._x < _local8) {
return(false);
}
if (_local5._x <= _local7) {
return(true);
}
return(false);
}
function update(fDeltaSecs) {
if (ApplicationState(_global.getApplicationState()).isPaused()) {
return(undefined);
}
var _local5 = _global.g_kApplication.m_kGameScreen;
var _local11 = _local5.m_kDesk.m_kDivider.getBounds(_local5);
var _local8 = (_local11.xMax + _local11.xMin) / 2;
var _local6 = _local5.getBallAtIndex(0);
var _local7 = false;
var _local4 = 0;
while (_local4 < _local5.getNumberBalls()) {
var _local3 = _local5.getBallAtIndex(_local4);
if (_local3._x > _local8) {
_local7 = true;
if (_local3._y > _local6._y) {
_local6 = _local3;
}
}
_local4++;
}
if ((m_bBallOnOurSide && (!_local7)) || ((m_kPlayer.getClipTime() - m_fLastUpdateGoalsTime) >= m_fUpdateGoalsInterval)) {
updateGoals();
}
m_bBallOnOurSide = _local7;
var _local10 = m_kPlayer.getBounds(_local5);
var _local9 = (_local10.xMax + _local10.xMin) / 2;
var _local12;
if (m_bBallOnOurSide) {
_local10 = m_kPlayer.getBounds(_local5);
var _local13 = 0;
if (m_bMoveBackForHighThrows && (_local6._y < _local10.yMin)) {
_local13 = _local13 + (_local10.yMin - _local6._y);
}
_local12 = (_local6._x + m_fOffsetX) + _local13;
if (!m_kPlayer.isJumping()) {
if (((_local10.yMin - _local6._y) < Settings(_global.getSettings()).getSetting("AI_JUMP_HEIGHT")) && (_local10.yMin > _local6._y)) {
m_kPlayer.jump();
m_fJumpStartTime = m_kPlayer.getClipTime();
m_fJumpTime = Math.random() * 0.5;
m_bHitBallSinceJump = false;
var _local14 = _local5.getRightWall().getBounds(_local5);
if (_local9 < ((_local11.xMax + _local14.xMin) / 2)) {
if (_local6._x < _local9) {
if (Math.random() > 0.75) {
m_kPlayer.spike();
}
}
}
}
}
} else {
_local12 = m_fTargetX;
}
if (_local9 > (_local12 + 5)) {
m_kPlayer.setVelocityX(-Settings(_global.getSettings()).getSetting("PLAYER_HORIZONTAL_VELOCITY"));
} else if (_local9 < (_local12 - 5)) {
m_kPlayer.setVelocityX(Settings(_global.getSettings()).getSetting("PLAYER_HORIZONTAL_VELOCITY"));
} else {
m_kPlayer.setVelocityX(m_kPlayer.getVelocityX() * 0.15);
}
}
}
Symbol 216 MovieClip [__Packages.Ball] Frame 0
class Ball extends LRG.LRGMovieClip
{
var setClock, addAction, m_pBubbleList, m_fVelocityX, m_fVelocityY, m_fGravity, m_fDrag, m_kLastImpactPlayer, m_fNumberPlayerImpacts, m_fHitsSinceLastBrainstorm, m_bPreBrainstorm, m_bBrainstorm, m_fLastUpdateTime, getClipTime, m_fLastPlayerHitTime, m_bCountdown, m_kWinningPlayer, m_bDissolving, _x, _y, gotoAndStop, playAnimation, stopAction, _parent, m_fLastNoCollisionX, m_fLastNoCollisionY, startAction;
function Ball () {
super();
}
function init() {
super.init();
setClock(_global.getGameTimer());
var _local4 = new Object();
_local4.m_sName = "GENERIC";
_local4.m_fFPS = 120;
var _local5 = new LRG.LRGGenericAction(_local4);
addAction(_local5);
m_pBubbleList = new Array();
m_fVelocityX = 0;
m_fVelocityY = 0;
m_fGravity = 0;
m_fDrag = 0;
m_kLastImpactPlayer = null;
m_fNumberPlayerImpacts = 0;
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setHits(m_fNumberPlayerImpacts);
m_fHitsSinceLastBrainstorm = 0;
m_bPreBrainstorm = false;
m_bBrainstorm = false;
m_fLastUpdateTime = getClipTime();
m_fLastPlayerHitTime = getClipTime();
m_bCountdown = false;
m_kWinningPlayer = null;
m_bDissolving = false;
}
function onStartGame() {
m_fHitsSinceLastBrainstorm = 0;
}
function onStartRound() {
trace("Ball::onStartRound()");
showBubbles();
var _local9 = new Sound(this);
_local9.setPan(0);
var _local3 = _global.g_kApplication.m_kGameScreen;
var _local10 = _local3.getServingPlayer();
var _local4 = _local10.getBounds(_local3);
var _local5 = ((_local4.xMax - _local4.xMin) / 2) + _local4.xMin;
var _local6 = _local3.m_kDesk.m_kDivider.getBounds(_local3);
var _local7 = (_local6.xMax + _local6.xMin) / 2;
if (_local5 < _local7) {
_x = _local5 + Settings(_global.getSettings()).getSetting("BALL_OFFSET_START");
} else {
_x = _local5 - Settings(_global.getSettings()).getSetting("BALL_OFFSET_START");
}
_y = _local4.yMin - Settings(_global.getSettings()).getSetting("BALL_HEIGHT_ABOVE_SERVING_PLAYER");
_local6 = _local3.getDesk().m_kDivider.getBounds(_local3);
var _local8 = (_local6.xMin + _local6.xMax) / 2;
if (_x < _local8) {
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setBallOnLeft(true);
gotoAndStop(100);
playAnimation("BALLSTART", 5, 100, 114, false, 1);
} else {
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setBallOnLeft(false);
gotoAndStop(115);
playAnimation("BALLSTART", 5, 115, 128, false, 1);
}
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setHits(m_fNumberPlayerImpacts);
m_bCountdown = true;
m_kWinningPlayer = null;
m_bDissolving = false;
}
function onEndRound() {
trace("Ball::onEndRound()");
stopAction("GENERIC", false);
hideBubbles();
m_fVelocityX = 0;
m_fVelocityY = 0;
m_fGravity = 0;
m_fDrag = 0;
if (m_bPreBrainstorm) {
abortBrainstorm();
m_fHitsSinceLastBrainstorm = 0;
}
if (m_bBrainstorm) {
endBrainstorm(false);
m_fHitsSinceLastBrainstorm = 0;
}
m_kLastImpactPlayer = null;
m_fNumberPlayerImpacts = 0;
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setHits(m_fNumberPlayerImpacts);
}
function startBrainstorm() {
m_bPreBrainstorm = false;
m_bBrainstorm = true;
m_fGravity = Settings(_global.getSettings()).getSetting("BALL_BRAINSTORM_GRAVITY");
m_fDrag = Settings(_global.getSettings()).getSetting("BALL_BRAINSTORM_DRAG");
hideBubbles();
playAnimation("BRAINSTORM", 10, 73, 83, true, 1);
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).hideHitIndicator(true);
}
function abortBrainstorm() {
m_bPreBrainstorm = false;
stopAction("PREBRAINSTORM", false);
gotoAndStop("Normal");
m_fHitsSinceLastBrainstorm = 0;
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).hideHitIndicator(false);
}
function endBrainstorm(bShowBubbles) {
m_bBrainstorm = false;
stopAction("BRAINSTORM", false);
stopAction("BRAINSTORMIMPACT", false);
gotoAndStop("Normal");
m_fGravity = Settings(_global.getSettings()).getSetting("BALL_NORMAL_GRAVITY");
m_fDrag = Settings(_global.getSettings()).getSetting("BALL_NORMAL_DRAG");
if (bShowBubbles) {
showBubbles();
}
m_fHitsSinceLastBrainstorm = 0;
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).hideHitIndicator(false);
}
function isCountdown() {
return(m_bCountdown);
}
function setVelocityX(fVel) {
m_fVelocityX = fVel;
}
function getVelocityX() {
return(m_fVelocityX);
}
function setVelocityY(fVel) {
m_fVelocityY = fVel;
}
function getVelocityY() {
return(m_fVelocityY);
}
function doEnterFrame() {
if (m_bCountdown || (ApplicationState(_global.getApplicationState()).isPaused())) {
return(undefined);
}
var _local8 = _x;
var _local7 = getClipTime() - m_fLastUpdateTime;
m_fVelocityY = m_fVelocityY + (m_fGravity * _local7);
m_fVelocityX = m_fVelocityX - ((m_fVelocityX * m_fDrag) * _local7);
m_fVelocityY = m_fVelocityY - ((m_fVelocityY * m_fDrag) * _local7);
var _local5 = Settings(_global.getSettings()).getSetting("BALL_SPEED_LIMIT");
if ((m_fVelocityX > 0) && (m_fVelocityX > _local5)) {
m_fVelocityX = _local5;
} else if ((m_fVelocityX < 0) && (m_fVelocityX < (-_local5))) {
m_fVelocityX = -_local5;
}
if ((m_fVelocityY > 0) && (m_fVelocityY > _local5)) {
m_fVelocityY = _local5;
} else if ((m_fVelocityY < 0) && (m_fVelocityY < (-_local5))) {
m_fVelocityY = -_local5;
}
var _local16 = m_fVelocityX * _local7;
var _local15 = m_fVelocityY * _local7;
_x = _x + _local16;
_y = _y + _local15;
var _local3 = TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen);
var _local4 = _local3.collideBall(this);
if (_local4.m_kObject) {
var _local10 = {x:_x, y:_y};
_parent.localToGlobal(_local10);
var _local11 = (_local10.x / 3) - 100;
if (!m_bDissolving) {
_global.playSound("tom_ball_hit.wav", 1, this, _local11);
}
m_fVelocityX = _local4.m_fVelocityX;
m_fVelocityY = _local4.m_fVelocityY;
if ((!m_bPreBrainstorm) && (!m_bDissolving)) {
if (m_bBrainstorm) {
playAnimation("BRAINSTORMIMPACT", 60, 92, 99, false, 1, false);
} else {
playAnimation("IMPACT", 60, 84, 91, false, 1, false);
}
}
} else {
m_fLastNoCollisionX = _x;
m_fLastNoCollisionY = _y;
}
if (_local4.m_kObject == _local3.getFloor()) {
var _local17 = _local3.getFloor().getBounds(_local3);
_y = _local17.yMin;
var _local9 = _local3.getDesk().m_kDivider.getBounds(_local3);
var _local6 = (_local9.xMin + _local9.xMax) / 2;
if (!m_bDissolving) {
if (_x < _local6) {
m_kWinningPlayer = _local3.getPlayerRight();
} else {
m_kWinningPlayer = _local3.getPlayerLeft();
}
_local3.preEndRound(m_kWinningPlayer);
dissolve(true);
}
return(undefined);
}
if (_local4.m_kObject == _local3.getCeiling()) {
var _local14 = _local3.getCeiling().getBounds(_local3);
_y = _local14.yMax;
} else if (_local4.m_kObject == _local3.getLeftWall()) {
var _local13 = _local3.getLeftWall().getBounds(_local3);
_x = _local13.xMax;
} else if (_local4.m_kObject == _local3.getRightWall()) {
var _local12 = _local3.getRightWall().getBounds(_local3);
_x = _local12.xMin;
} else if ((_local4.m_kObject == _local3.getPlayerLeft()) || (_local4.m_kObject == _local3.getPlayerRight())) {
onHitPlayer(_local4.m_kObject);
}
var _local9 = _local3.getDesk().m_kDivider.getBounds(_local3);
var _local6 = (_local9.xMin + _local9.xMax) / 2;
if (((_local8 <= _local6) && (_x > _local6)) || ((_local8 > _local6) && (_x <= _local6))) {
m_fNumberPlayerImpacts = 0;
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setHits(m_fNumberPlayerImpacts);
m_kLastImpactPlayer = null;
if (_local8 > _local6) {
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setBallOnLeft(true);
_local3.getPlayerLeft().onBallCrossedToPlayerSide();
} else {
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setBallOnLeft(false);
_local3.getPlayerRight().onBallCrossedToPlayerSide();
}
}
m_fLastUpdateTime = getClipTime();
}
function onHitPlayer(kPlayer) {
if (m_bDissolving || ((getClipTime() - m_fLastPlayerHitTime) < 0.35)) {
return(undefined);
}
kPlayer.onHitBall();
var _local3 = {x:_x, y:_y};
_parent.localToGlobal(_local3);
var _local6 = (_local3.x / 3) - 100;
_global.playSound("tom_ball_hit.wav", 1, this, _local6);
m_fLastPlayerHitTime = getClipTime();
if (kPlayer == m_kLastImpactPlayer) {
m_fNumberPlayerImpacts++;
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setHits(m_fNumberPlayerImpacts);
} else {
m_kLastImpactPlayer = kPlayer;
m_fNumberPlayerImpacts = 1;
PlayGui(_global.g_kApplication.m_kGui.m_kPlayGui).setHits(m_fNumberPlayerImpacts);
}
if ((m_fNumberPlayerImpacts >= 4) && (!m_bBrainstorm)) {
var _local5 = _global.g_kApplication.m_kGameScreen;
m_kWinningPlayer = _local5.getOtherPlayer(kPlayer);
dissolve(true);
_local5.preEndRound(m_kWinningPlayer);
return(undefined);
}
m_fHitsSinceLastBrainstorm++;
if (((!m_bPreBrainstorm) && (!m_bBrainstorm)) && (m_fHitsSinceLastBrainstorm >= Settings(_global.getSettings()).getSetting("HITS_TO_BRAINSTORM"))) {
preBrainstorm();
}
}
function onHitBall(kCollision) {
var _local3 = {x:_x, y:_y};
_parent.localToGlobal(_local3);
var _local4 = (_local3.x / 3) - 100;
_global.playSound("tom_ball_hit.wav", 1, this, _local4);
m_fVelocityX = kCollision.m_fVelocityX;
m_fVelocityY = kCollision.m_fVelocityY;
}
function isDissolving() {
return(m_bDissolving);
}
function dissolve(bRoundEnding) {
m_bDissolving = true;
var _local3 = (bRoundEnding ? "DISSOLVE" : "DISSOLVE_NO_END_ROUND");
var _local4 = Settings(_global.getSettings()).getSetting("END_ROUND_FPS");
if (m_bBrainstorm) {
stopAction("BRAINSTORM", false);
playAnimation(_local3, _local4, 180, 228, false, 1);
} else {
abortBrainstorm();
playAnimation(_local3, _local4, 129, 179, false, 1);
}
}
function preBrainstorm() {
if (m_bDissolving) {
return(undefined);
}
m_fHitsSinceLastBrainstorm = 0;
m_bPreBrainstorm = true;
m_bBrainstorm = false;
playAnimation("PREBRAINSTORM", 15, 11, 72, false, 1, false);
TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen).getPlayerRight().onPreBrainstorm();
}
function onActionCompleted(sActionKey) {
if (sActionKey == "BALLSTART") {
m_fGravity = Settings(_global.getSettings()).getSetting("BALL_NORMAL_GRAVITY");
m_fDrag = Settings(_global.getSettings()).getSetting("BALL_NORMAL_DRAG");
gotoAndStop("Normal");
startAction("GENERIC", false);
m_fLastUpdateTime = getClipTime();
m_fLastPlayerHitTime = getClipTime();
m_bCountdown = false;
} else if (sActionKey == "PREBRAINSTORM") {
var _local4 = _global.g_kApplication.m_kGameScreen;
_local4.brainstorm();
} else if (sActionKey == "BRAINSTORMIMPACT") {
if (m_bBrainstorm && (!m_bDissolving)) {
playAnimation("BRAINSTORM", 10, 73, 83, true, 1);
} else {
gotoAndStop("Normal");
}
} else if (sActionKey == "IMPACT") {
if ((!m_bBrainstorm) && (!m_bPreBrainstorm)) {
gotoAndStop("Normal");
}
} else if (sActionKey == "DISSOLVE") {
var _local4 = TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen);
_local4.endRound(m_kWinningPlayer);
}
}
function showBubbles() {
}
function hideBubbles() {
}
function updateBubbles(fDeltaSecs, fDeltaX, fDeltaY, fSpeed) {
var _local3 = 0;
while (_local3 < m_pBubbleList.length) {
m_pBubbleList[_local3]._x = m_pBubbleList[_local3]._x - fDeltaX;
m_pBubbleList[_local3]._y = m_pBubbleList[_local3]._y - fDeltaY;
var _local10 = _global.LRG.Utils.Vector2D.normalize(fDeltaX, fDeltaY);
var _local4;
if (_local3 == 0) {
_local4 = 40;
} else if (_local3 == 1) {
_local4 = 60;
} else if (_local3 == 2) {
_local4 = 70;
}
var _local13 = (-_local10.x) * _local4;
var _local12 = (-_local10.y) * _local4;
var _local6 = _local13 - m_pBubbleList[_local3]._x;
var _local5 = _local12 - m_pBubbleList[_local3]._y;
var _local11 = _global.LRG.Utils.Vector2D.normalize(_local6, _local5);
var _local9 = fSpeed;
var _local8 = (_local9 * fDeltaSecs) * _local11.x;
var _local7 = (_local9 * fDeltaSecs) * _local11.y;
if (Math.abs(_local8) > Math.abs(_local6)) {
_local8 = _local6;
}
if (Math.abs(_local7) > Math.abs(_local5)) {
_local7 = _local5;
}
m_pBubbleList[_local3]._x = m_pBubbleList[_local3]._x + _local8;
m_pBubbleList[_local3]._y = m_pBubbleList[_local3]._y + _local7;
_local3++;
}
}
}
Symbol 217 MovieClip [__Packages.PlayGui] Frame 0
class PlayGui extends LRG.LRGMovieClip
{
var m_kMuteButtonHolder, m_kPlayerLeftScore, m_kPlayerRightScore, m_bBallOnLeft, m_kHitsIndicator;
function PlayGui () {
super();
}
function init() {
super.init();
}
function onShow() {
updateMuteButton();
}
function updateMuteButton() {
if (_global.LRG.LRGMusic.m_bMuted) {
m_kMuteButtonHolder.gotoAndStop("SoundOff");
} else {
m_kMuteButtonHolder.gotoAndStop("SoundOn");
}
m_kMuteButtonHolder.m_kMusicIsOn.onRelease = function () {
_global.LRG.LRGMusic.muteMusic(true);
this._parent._parent.updateMuteButton();
};
m_kMuteButtonHolder.m_kMusicIsOff.onRelease = function () {
_global.LRG.LRGMusic.muteMusic(false);
this._parent._parent.updateMuteButton();
};
}
function setLeftScore(fScore) {
m_kPlayerLeftScore.m_kNumber.m_kText.text = "" + fScore;
m_kPlayerLeftScore.m_kNumber.m_kTextDrop.text = "" + fScore;
}
function setRightScore(fScore) {
m_kPlayerRightScore.m_kNumber.m_kText.text = "" + fScore;
m_kPlayerRightScore.m_kNumber.m_kTextDrop.text = "" + fScore;
}
function setBallOnLeft(bOn) {
m_bBallOnLeft = bOn;
if (bOn) {
m_kHitsIndicator.m_kLeftArrow.gotoAndStop("On");
m_kHitsIndicator.m_kRightArrow.gotoAndStop("Off");
} else {
m_kHitsIndicator.m_kLeftArrow.gotoAndStop("Off");
m_kHitsIndicator.m_kRightArrow.gotoAndStop("On");
}
}
function setHits(fHits) {
var _local2;
if (m_bBallOnLeft) {
_local2 = "tom";
} else {
_local2 = "mayor";
}
switch (fHits) {
case 0 :
m_kHitsIndicator.gotoAndStop("None");
break;
case 1 :
m_kHitsIndicator.gotoAndStop(_local2 + "One");
break;
case 2 :
m_kHitsIndicator.gotoAndStop(_local2 + "Two");
break;
case 3 :
m_kHitsIndicator.gotoAndStop(_local2 + "Three");
}
}
function hideHitIndicator(bHide) {
m_kHitsIndicator._visible = !bHide;
}
}
Symbol 218 MovieClip [__Packages.LRG.LRGRepeatedCallbackAction] Frame 0
class LRG.LRGRepeatedCallbackAction extends LRG.LRGAction
{
var m_fSPF, m_sActionType, m_kCallback, m_sName;
function LRGRepeatedCallbackAction (kAnimationParams) {
super();
init(kAnimationParams);
}
function init(kActionParams) {
if ((kActionParams.m_fSPF == undefined) && (m_fSPF == undefined)) {
kActionParams.m_fSPF = 0;
trace(("Repeated callback action " + kActionParams.m_sName) + " created with no SPF specified.");
}
if ((kActionParams.m_sType == undefined) && ((m_sActionType == undefined) || (m_sActionType == "DEFAULT"))) {
kActionParams.m_sType = "REPEATED_CALLBACK";
}
super.init(kActionParams);
if (kActionParams.m_kCallback != undefined) {
m_kCallback = kActionParams.m_kCallback;
} else if (m_kCallback == undefined) {
trace(("LRGRepeatedCallbackAction " + m_sName) + " initialized without callback.");
}
}
function reset(fCurrTime, kActionParams) {
super.reset(fCurrTime, kActionParams);
}
function doUpdate(fCurrTime, fDeltaTimeSecs, kClip) {
if (fDeltaTimeSecs >= m_fSPF) {
m_kCallback.apply(kClip);
}
return(false);
}
}
Symbol 219 MovieClip [__Packages.CloseUpScreen] Frame 0
class CloseUpScreen extends LRG.LRGMovieClip
{
var m_kBackground, m_kTomPoint, m_kMayorPoint, m_kOkButton;
function CloseUpScreen () {
super();
}
function init() {
super.init();
}
function onShow(bHumanWon) {
m_kBackground.onPress = function () {
};
m_kBackground.onRelease = function () {
};
m_kBackground.useHandCursor = false;
var _local3 = TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen);
if (bHumanWon) {
m_kTomPoint._visible = true;
m_kMayorPoint._visible = false;
} else {
m_kTomPoint._visible = false;
m_kMayorPoint._visible = true;
}
m_kOkButton.onRelease = function () {
_global.playSound("tom_button.wav", 1, _global.g_kApplication);
_global.g_kApplication.m_kGui.m_kCloseUpScreen.gotoAndStop("Hide");
_global.g_kApplication.m_kGui.m_kCloseUpScreen._visible = false;
_global.g_kApplication.m_kGameScreen.startRound();
};
}
}
Symbol 220 MovieClip [__Packages.HelpPanel] Frame 0
class HelpPanel extends LRG.LRGMovieClip
{
var m_kBackground, m_kOkButton;
function HelpPanel () {
super();
}
function init() {
super.init();
}
function onShow() {
_global.getApplicationState().setPaused(true);
m_kBackground.onPress = function () {
};
m_kBackground.onRelease = function () {
};
m_kBackground.useHandCursor = false;
m_kOkButton.onRelease = function () {
this.onKeyUp = undefined;
Key.removeListener(this);
_global.playSound("tom_button.wav", 1, _global.g_kApplication);
_global.g_kApplication.m_kGui.m_kHelpPanel.gotoAndStop("Hide");
_global.g_kApplication.m_kGui.m_kHelpPanel._visible = false;
if (_global.getApplicationState().isCurrentState(_global.getApplicationState().AS_PRE_GAME)) {
_global.g_kApplication.m_kGameScreen.startGame();
} else {
_global.g_kApplication.m_kGameScreen.startGame();
}
};
Key.addListener(m_kOkButton);
m_kOkButton.onKeyUp = function () {
if (Key.getCode() == 13) {
this.onRelease();
}
};
}
}
Symbol 221 MovieClip [__Packages.GameSummaryPanel] Frame 0
class GameSummaryPanel extends LRG.LRGMovieClip
{
var m_kBackground, gotoAndStop, playAnimation, m_kOkButton, m_kHelpButton;
function GameSummaryPanel () {
super();
}
function init() {
super.init();
}
function onShow() {
m_kBackground.onPress = function () {
};
m_kBackground.onRelease = function () {
};
m_kBackground.useHandCursor = false;
var _local3 = TomGoesToTheMayorGame(_global.g_kApplication.m_kGameScreen);
if (_local3.getPlayerLeft().getScore() >= 11) {
gotoAndStop("Won");
playAnimation("PLAYERWIN", 45, 1, 30, false, 1);
_global.playSound("GreatIdeaTom.wav", 1, this, 0, 600);
} else {
gotoAndStop("Lost");
playAnimation("NPCWIN", 45, 31, 60, false, 1);
_global.playSound("not.wav", 1, this, 0, 600);
}
m_kOkButton.onRelease = function () {
this.onKeyUp = undefined;
Key.removeListener(this);
_global.playSound("tom_button.wav", 1, _global.g_kApplication);
_global.g_kApplication.m_kGui.m_kGameSummaryPanel.gotoAndStop("Hide");
_global.g_kApplication.m_kGui.m_kGameSummaryPanel._visible = false;
_global.g_kApplication.m_kGameScreen.startGame();
};
Key.addListener(m_kOkButton);
m_kOkButton.onKeyUp = function () {
if (Key.getCode() == 13) {
this.onRelease();
}
};
m_kHelpButton.onRelease = function () {
_global.playSound("tom_button.wav", 1, _global.g_kApplication);
_global.g_kApplication.m_kGui.m_kGameSummaryPanel.gotoAndStop("Hide");
_global.g_kApplication.m_kGui.m_kGameSummaryPanel._visible = false;
_global.g_kApplication.m_kGui.m_kHelpPanel.gotoAndStop("Hide");
_global.g_kApplication.m_kGui.m_kHelpPanel._visible = false;
_global.g_kApplication.m_kGui.m_kHelpPanel.onShow();
};
}
}
Symbol 222 MovieClip [__Packages.SplashScreen] Frame 0
class SplashScreen extends LRG.LRGMovieClip
{
var m_kBackground, m_kStartButton;
function SplashScreen () {
super();
}
function init() {
super.init();
}
function onShow() {
_global.LRG.LRGMusic.startMusic(["tom_titlescreen_music.wav"]);
m_kBackground.onPress = function () {
};
m_kBackground.onRelease = function () {
};
m_kBackground.useHandCursor = false;
m_kStartButton.onRelease = function () {
this.onKeyUp = undefined;
Key.removeListener(this);
_global.playSound("tom_button.wav", 1, _global.g_kApplication);
_global.g_kApplication.m_kGui.m_kSplashScreen.gotoAndStop("Hide");
_global.g_kApplication.m_kGui.m_kSplashScreen._visible = false;
_global.g_kApplication.m_kGui.m_kHelpPanel.gotoAndStop("Show");
_global.g_kApplication.m_kGui.m_kHelpPanel._visible = true;
_global.g_kApplication.m_kGui.m_kHelpPanel.onShow();
};
Key.addListener(m_kStartButton);
m_kStartButton.onKeyUp = function () {
if (Key.getCode() == 13) {
this.onRelease();
}
};
}
}
Symbol 223 MovieClip [__Packages.Gui] Frame 0
class Gui extends LRG.LRGMovieClip
{
function Gui () {
super();
}
}
Symbol 224 MovieClip [__Packages.LRG.Utils.FPSDisplay] Frame 0
class LRG.Utils.FPSDisplay extends MovieClip
{
var m_fUpdatePeriod, m_fNumUpdates, m_fTotalFramesTime, m_fLastTime, m_fLastUpdateTime, onEnterFrame, m_kTimeDisplay;
function FPSDisplay () {
super();
init();
}
function init() {
m_fUpdatePeriod = 250;
m_fNumUpdates = 0;
m_fTotalFramesTime = 0;
m_fLastTime = getTimer();
m_fLastUpdateTime = getTimer();
onEnterFrame = updateFPS;
}
function updateFPS() {
m_fNumUpdates++;
var _local2 = getTimer();
m_fTotalFramesTime = m_fTotalFramesTime + (_local2 - m_fLastTime);
m_fLastTime = _local2;
if ((_local2 - m_fLastUpdateTime) > m_fUpdatePeriod) {
m_fLastUpdateTime = _local2;
var _local3 = m_fTotalFramesTime / m_fNumUpdates;
var _local4 = 1000 / _local3;
m_fNumUpdates = 0;
m_fTotalFramesTime = 0;
m_kTimeDisplay.text = "fps: " + Math.floor(_local4);
}
}
}