Frame 1
var LOCAL = true;
var domXML = new XML();
if (LOCAL) {
gotoAndPlay (2);
} else {
domXML.load("http://www.cartoonnetwork.com/crossdomain.xml");
}
domXML.onLoad = function () {
if (domXML.childNodes.length == 0) {
getURL ("http://www.cartoonnetwork.com");
stop();
} else {
gotoAndPlay (2);
}
};
Frame 3
function loadGame() {
var _local2 = Math.floor((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (_local2 > 1) {
Preloader.gotoAndStop(20 + _local2);
Preloader.counter_txt.text = _local2 + "%";
}
if (_local2 >= 100) {
clearInterval(loadInt);
gotoAndStop (10);
}
}
loadInt = setInterval(loadGame, 50);
stop();
Frame 5
Frame 9
stop();
Symbol 57 MovieClip Frame 20
stop();
Symbol 57 MovieClip Frame 120
stop();
Symbol 79 MovieClip Frame 15
stop();
Symbol 79 MovieClip Frame 30
stop();
Symbol 233 MovieClip [_glow] Frame 2
stop();
Symbol 233 MovieClip [_glow] Frame 26
stop();
Symbol 233 MovieClip [_glow] Frame 50
stop();
Symbol 233 MovieClip [_glow] Frame 74
stop();
Symbol 233 MovieClip [_glow] Frame 98
stop();
Symbol 233 MovieClip [_glow] Frame 122
stop();
Symbol 233 MovieClip [_glow] Frame 146
stop();
Symbol 233 MovieClip [_glow] Frame 170
stop();
Symbol 233 MovieClip [_glow] Frame 194
stop();
Symbol 233 MovieClip [_glow] Frame 218
stop();
Symbol 313 MovieClip Frame 36
stop();
Symbol 328 MovieClip Frame 25
stop();
Symbol 352 MovieClip Frame 41
stop();
Symbol 374 MovieClip Frame 53
stop();
Symbol 415 MovieClip [__Packages.Base.GameEntry] Frame 0
class Base.GameEntry extends MovieClip
{
static var _gamePaused, _gameOver;
var _multiplayer, _timeMgr, _padMgr, _gameMgr, _parent, _gameData, _background, onEnterFrame;
function GameEntry () {
super();
_multiplayer = false;
if (_multiplayer) {
if (_root.gameName == undefined) {
_root.gameName = "mpdemo";
}
if (_root.host == undefined) {
_root.host = "localhost";
}
if (_root.port == undefined) {
_root.port = 5678;
}
if (_root.conference == undefined) {
_root.conference = "conference.adultswim.com";
}
if (_root.roomName == undefined) {
_root.roomName = "game1";
}
if (_root.loginName == undefined) {
_root.loginName = "test";
}
if (_root.userName == undefined) {
_root.userName = _root.loginName;
}
if (_root.password == undefined) {
_root.password = "test";
}
if (_root.resource == undefined) {
_root.resource = "Flash";
}
if (_root.chanId == undefined) {
_root.chanId = -1;
}
}
_gamePaused = false;
_gameOver = false;
_timeMgr = new Base.Time();
_padMgr = new Pad.PadManager();
_gameMgr = new Game.GameManager(_parent);
_gameData = new Game.GameData(this);
_background = new Game.Background(this);
onEnterFrame = Update;
}
function getDT() {
return(_timeMgr.getElapsedTime());
}
function getParent() {
return(_parent);
}
function getTimeManager() {
return(_timeMgr);
}
function getGameManager() {
return(_gameMgr);
}
function getPadManager() {
return(_padMgr);
}
function getGameData() {
return(_gameData);
}
function isMultiplayer() {
return(_multiplayer);
}
function Update() {
_timeMgr.markTimeThisTick();
_padMgr.Update(this);
_gameMgr.Update(this);
_background.moveBack(this);
return(undefined);
}
}
Symbol 416 MovieClip [__Packages.Game.GameData] Frame 0
class Game.GameData
{
var soundList, _cursor, _musicSprite, _gameContext, _movementMechanic, PLAYER_ON_TOP, PLAYER_ON_BOTTOM, PIECE_ON_TOP, PIECE_ON_BOTTOM, SELECT_SQUARE, JUMP_SQUARE, WHITE_SQUARE, BLACK_SQUARE, TITLECARD, _players, _checkerBoard, _checkerBoardCopy, _totalNumCaptured, _boardBaseX, _boardBaseY, _teamDir, _resetGameToNetwork, _playingMultiplayer, _avatarOnPiece, _boardSprite, _kings, _boardPositions, _messageShown, _avatarMoved, _numMessageMoves, _musicOn, _character, _difficultyLevel, _cpuVScpu, _numMoves, _numPlayers, _whosTurn, _numReady, _numLost, _movingPiece, _jumpedID, _pieceMoved, _pieceMoving, _pieceDestX, _pieceDestY, _playerReadyForMove, _bestMoveGuy, _bestMoveScore, _jumpedGuy, _someoneCanJump, _avatarClicked, _avatarMoving, _mouseOverAvatar, _squareIsHighlighted, _piecePreSelected, _pieceSelectedThisTurn, _winner, _gameReady, _cursorOn, _move, _numCaptured, _gotKinged, _jumpingAgain, _mouseIsOverMusic, _clockFrame, _entityToHighlight, _interface, _gameboard, _previousPieceAvatarOn, _gameOver, _avatarToMove, _soundModule, _soundMC;
function GameData (gameContext) {
_global.MUSIC_MUTE = false;
_global.MUSIC_VOL = 40;
_global.SND_BTN1 = 0;
_global.SND_BTN2 = 1;
_global.SND_BTN3 = 2;
_global.SND_BTN4 = 3;
_global.SND_CLINK1 = 4;
_global.SND_CLINK2 = 5;
_global.SND_CLINK3 = 6;
_global.SND_CLINK4 = 7;
_global.SND_CLINK5 = 8;
_global.SND_CLINK6 = 9;
_global.SND_CLINK7 = 10;
_global.SND_DROP1 = 11;
_global.SND_CLINK1 = 12;
_global.SND_TITLE = 13;
_global.SND_GAME = 14;
_global.SND_JUMP1 = 15;
_global.SND_FROM1 = 16;
_global.SND_TO2 = 17;
_global.SND_BS_CAP = 18;
_global.SND_BS_CAP2 = 19;
_global.SND_BS_JUMP = 20;
_global.SND_BS_SLIDE = 21;
_global.SND_JUMP2 = 22;
_global.SND_JUMP3 = 23;
_global.SND_JUMP_AVATAR = 24;
_global.SND_KINGED = 25;
_global.SND_LOSE_01 = 26;
_global.SND_LOSE_02 = 27;
_global.SND_WIN = 28;
_global.SND_TIMECOUNTDOWN = 29;
_global.SND_TIMEUP = 30;
soundList = ["bs_checkers_btn1.wav", "bs_checkers_btn2.wav", "bs_checkers_btn3.wav", "bs_checkers_btn4.wav", "checkers_clink1.wav", "checkers_clink2.wav", "checkers_clink4.wav", "checkers_clink5.wav", "checkers_clink6.wav", "checkers_clink7.wav", "checkers_drop1.wav", "checkers_tally.wav", "music_title_2.wav", "music_game_2.wav", "sting_jump1.mp3", "bs_checkers_from1.wav", "bs_checkers_to2.wav", "bs_checkers_bigshot_cap.wav", "bs_checkers_bigshot_cap2.wav", "bs_checkers_bigshot_jump.wav", "bs_checkers_slide1.wav", "sting_jump2.mp3", "sting_jump3.mp3", "sting_jump_avatar.mp3", "sting_kinged.wav", "sting_lose_01.wav", "sting_lose_02.wav", "sting_win.wav", "time_countdown.wav", "time_up.wav"];
setUpSoundsFx();
stopAllSounds();
_cursor = new Base.SpriteEntity(gameContext, 5, 100, "cursor", "titlecard", 50500, 0, 0, 2, -1, -1);
_cursor.setVisibility(false);
_musicSprite = new Base.SpriteEntity(gameContext, 7, 101, "MusicON", "musicSprite", 50400, 5, 370, 2, -1, -1);
_musicSprite.moveToFrame(1);
_musicSprite.setVisibility(false);
_gameContext = gameContext;
_movementMechanic = 2;
PLAYER_ON_TOP = 0;
PLAYER_ON_BOTTOM = 1;
PIECE_ON_TOP = 2;
PIECE_ON_BOTTOM = 3;
SELECT_SQUARE = 4;
JUMP_SQUARE = 5;
WHITE_SQUARE = 6;
BLACK_SQUARE = 7;
TITLECARD = 8;
_players = [];
_checkerBoard = [];
_checkerBoardCopy = [];
_totalNumCaptured = new Array(0, 0);
_boardBaseX = BOARD_BASE_OFFSET_X;
_boardBaseY = BOARD_BASE_OFFSET_Y;
_teamDir = new Array(2);
_resetGameToNetwork = false;
_playingMultiplayer = false;
_avatarOnPiece = new Array(2, 21);
_boardSprite = [];
_kings = new Array(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);
_boardPositions = new Array(new Array(_boardBaseX, _boardBaseY), new Array(_boardBaseX + (SQUARE_WIDTH * 2), _boardBaseY), new Array(_boardBaseX + (SQUARE_WIDTH * 4), _boardBaseY), new Array(_boardBaseX + (SQUARE_WIDTH * 6), _boardBaseY), new Array(_boardBaseX + SQUARE_WIDTH, _boardBaseY + SQUARE_HEIGHT), new Array(_boardBaseX + (SQUARE_WIDTH * 3), _boardBaseY + SQUARE_HEIGHT), new Array(_boardBaseX + (SQUARE_WIDTH * 5), _boardBaseY + SQUARE_HEIGHT), new Array(_boardBaseX + (SQUARE_WIDTH * 7), _boardBaseY + SQUARE_HEIGHT), new Array(_boardBaseX, _boardBaseY + (SQUARE_HEIGHT * 2)), new Array(_boardBaseX + (SQUARE_WIDTH * 2), _boardBaseY + (SQUARE_HEIGHT * 2)), new Array(_boardBaseX + (SQUARE_WIDTH * 4), _boardBaseY + (SQUARE_HEIGHT * 2)), new Array(_boardBaseX + (SQUARE_WIDTH * 6), _boardBaseY + (SQUARE_HEIGHT * 2)), new Array(_boardBaseX + SQUARE_WIDTH, _boardBaseY + (SQUARE_HEIGHT * 5)), new Array(_boardBaseX + (SQUARE_WIDTH * 3), _boardBaseY + (SQUARE_HEIGHT * 5)), new Array(_boardBaseX + (SQUARE_WIDTH * 5), _boardBaseY + (SQUARE_HEIGHT * 5)), new Array(_boardBaseX + (SQUARE_WIDTH * 7), _boardBaseY + (SQUARE_HEIGHT * 5)), new Array(_boardBaseX, _boardBaseY + (SQUARE_HEIGHT * 6)), new Array(_boardBaseX + (SQUARE_WIDTH * 2), _boardBaseY + (SQUARE_HEIGHT * 6)), new Array(_boardBaseX + (SQUARE_WIDTH * 4), _boardBaseY + (SQUARE_HEIGHT * 6)), new Array(_boardBaseX + (SQUARE_WIDTH * 6), _boardBaseY + (SQUARE_HEIGHT * 6)), new Array(_boardBaseX + SQUARE_WIDTH, _boardBaseY + (SQUARE_HEIGHT * 7)), new Array(_boardBaseX + (SQUARE_WIDTH * 3), _boardBaseY + (SQUARE_HEIGHT * 7)), new Array(_boardBaseX + (SQUARE_WIDTH * 5), _boardBaseY + (SQUARE_HEIGHT * 7)), new Array(_boardBaseX + (SQUARE_WIDTH * 7), _boardBaseY + (SQUARE_HEIGHT * 7)));
_messageShown = false;
_avatarMoved = false;
_numMessageMoves = 0;
_musicOn = true;
_character = 0;
_difficultyLevel = 0;
_cpuVScpu = false;
Init();
}
function isCPUvsCPU() {
return(_cpuVScpu);
}
function isMessageShown() {
return(_messageShown);
}
function setMessageShown() {
_messageShown = true;
}
function isAvatarMoved() {
return(_avatarMoved);
}
function setAvatarMoved() {
_avatarMoved = true;
}
function getNumMessageMoves() {
return(_numMessageMoves);
}
function Init() {
_numMoves = 0;
_numPlayers = 0;
_whosTurn = 1;
_numReady = 0;
_numLost = 0;
_movingPiece = -1;
_jumpedID = -1;
_teamDir[0] = 1;
_teamDir[1] = -1;
_pieceMoved = -1;
_pieceMoving = -1;
_pieceDestX = 0;
_pieceDestY = 0;
_playerReadyForMove = false;
_bestMoveGuy = -1;
_bestMoveScore = -1;
_jumpedGuy = -1;
_someoneCanJump = false;
_avatarClicked = -1;
_avatarMoving = -1;
_mouseOverAvatar = -1;
_squareIsHighlighted = 0;
_piecePreSelected = -1;
_pieceSelectedThisTurn = -1;
_winner = -1;
_gameReady = true;
_cursorOn = false;
_move = -1;
_numCaptured = 0;
_gotKinged = false;
_totalNumCaptured[0] = 0;
_totalNumCaptured[1] = 0;
_avatarOnPiece[0] = 2;
_avatarOnPiece[1] = 21;
_jumpingAgain = -1;
_mouseIsOverMusic = false;
_clockFrame = 1;
var _local2 = 0;
while (_local2 < 24) {
_kings[_local2] = false;
_local2++;
}
_numMoves = 0;
}
function cursorOn() {
if (_cursorOn == true) {
return(undefined);
}
_cursorOn = true;
updateCursor();
_cursor.setVisibility(true);
Mouse.hide();
}
function cursorOff() {
if (_cursorOn == false) {
return(undefined);
}
_cursorOn = false;
_cursor.setVisibility(false);
Mouse.show();
}
function updateCursor() {
if (_cursorOn) {
_cursor.setPositionX(_gameContext.getPadManager().getMousePosX());
_cursor.setPositionY(_gameContext.getPadManager().getMousePosY());
}
}
function showMusicSprite() {
_musicSprite.setVisibility(true);
}
function hideMusicSprite() {
_musicSprite.setVisibility(false);
}
function updateMusicButton() {
if (_musicSprite.isMouseOver()) {
if (_musicSprite.isMouseRollOn()) {
cursorOn();
_musicSprite.moveToFrame(2);
}
if (_gameContext.getPadManager().getMouseJustPressed()) {
if (_musicOn) {
_musicOn = false;
_musicSprite.changeSprite("MusicOFF", "musicSprite");
getSoundModule().StopMusic();
} else {
_musicOn = true;
_musicSprite.changeSprite("MusicON", "musicSprite");
getSoundModule().PlayMusic("game_2.wav");
}
_musicSprite.moveToFrame(1);
}
_mouseIsOverMusic = true;
} else if (_mouseIsOverMusic) {
_mouseIsOverMusic = false;
cursorOff();
_musicSprite.moveToFrame(1);
}
}
function getMusicOn() {
return(_musicOn);
}
function isSquareHighlighted() {
return(_squareIsHighlighted > 0);
}
function setPiecePreSelected(toSet) {
_piecePreSelected = toSet;
}
function getPiecePreSelected() {
return(_piecePreSelected);
}
function setPieceSelectedThisTurn(toSet) {
_pieceSelectedThisTurn = toSet;
}
function getPieceSelectedThisTurn() {
return(_pieceSelectedThisTurn);
}
function setEntityToHighlight(entity) {
_entityToHighlight = entity;
}
function getEntityToHighlight() {
return(_entityToHighlight);
}
function getMouseOnSquare(entity) {
var _local2 = _gameContext.getPadManager().getMousePosX();
var _local3 = _gameContext.getPadManager().getMousePosY();
var _local5 = entity.getPositionX();
var _local4 = entity.getPositionY();
if (_local2 < _local5) {
return(false);
}
if (_local2 > (_local5 + SQUARE_WIDTH)) {
return(false);
}
if (_local3 < _local4) {
return(false);
}
if (_local3 > (_local4 + SQUARE_HEIGHT)) {
return(false);
}
return(true);
}
function playAnimation(animType, entity) {
var _local1 = 0;
while (_local1 < NUM_ANIMS) {
if ((_animData[_local1].animAction == animType) && (_animData[_local1].entType == entity.getType())) {
var _local2 = _animData[_local1].startFrame;
var _local4 = _animData[_local1].endFrame;
var _local5 = _animData[_local1].frameRate;
var _local3 = _animData[_local1].looping;
entity.startAnimating(_local2, _local4, _local5, _local3);
return(undefined);
}
_local1++;
}
}
function getNextAnim(animPlaying) {
var _local1 = 0;
while (_local1 < NUM_ANIMS) {
if (_animData[_local1].nextPlaying == _animData[_local1].anim) {
return(_animData[_local1].nextAnim);
}
_local1++;
}
}
function mouseOverAvatar(toSet) {
_mouseOverAvatar = toSet;
}
function getMouseOverAvatar() {
return(_mouseOverAvatar);
}
function setDifficultyLevel(toSet) {
_difficultyLevel = toSet;
}
function setCharacter(toSet) {
_character = toSet;
}
function getDifficultyLevel() {
return(_difficultyLevel);
}
function getCharacter() {
return(_character);
}
function getAvatarStartingGridPosX(idx) {
return(_avatarStartingGridPos[idx].x);
}
function getAvatarStartingGridPosY(idx) {
return(_avatarStartingGridPos[idx].y);
}
function getSpriteName(idx) {
return(_gameData[idx].spriteName);
}
function getClipName(idx) {
return(_gameData[idx].clipName);
}
function getSpriteDepth(idx) {
return(_gameData[idx].depth);
}
function getPositionX(idx) {
return(_gameData[idx].posX);
}
function getPositionY(idx) {
return(_gameData[idx].posY);
}
function getSquareWidth() {
return(SQUARE_WIDTH);
}
function getSquareHeight() {
return(SQUARE_HEIGHT);
}
function setSomeoneCanJump(toSet) {
_someoneCanJump = toSet;
}
function getSomeoneCanJump() {
return(_someoneCanJump);
}
function getMoveMechanic() {
return(_movementMechanic);
}
function createBoard() {
var _local3 = 0;
while (_local3 < 8) {
_checkerBoard[_local3] = new Array(8);
_checkerBoardCopy[_local3] = new Array(8);
var _local2 = 0;
while (_local2 < 8) {
_boardSprite.push(new Base.SpriteEntity(_gameContext, 0, (_local3 * 10) + _local2, "_glow", "square", (100 + (_local3 * 10)) + _local2, _boardBaseX + (_local3 * SQUARE_WIDTH), _boardBaseY + (_local2 * SQUARE_HEIGHT), 1, -1, -1));
_checkerBoard[_local3][_local2] = -1;
_checkerBoardCopy[_local3][_local2] = -1;
_boardSprite[(8 * _local3) + _local2].setVisibility(false);
_local2++;
}
_local3++;
}
_interface = new Base.SpriteEntity(_gameContext, 7, 300, "gui_mc", "interface", 3, 0, 44, 2, -1, -1);
var _local4 = ((_character == 0) ? "BLOO" : "MAC");
var _local5 = ((_character == 0) ? 1 : 2);
_interface.getMovieClip().player_one.gui_checkers_captured_mc.gotoAndStop(1);
_interface.getMovieClip().player_one.checkers_captured.text = " ";
_interface.getMovieClip().player_one.avatar_frame_colors.gotoAndStop(((_character == 0) ? 2 : 1));
_interface.getMovieClip().player_one.avatar_picture.gotoAndStop(_local5);
_interface.getMovieClip().player_one.player_frame.gotoAndStop(1);
_interface.getMovieClip().player_one.avatar_frame_highlight.gotoAndStop(((_character == 0) ? 1 : 2));
_interface.getMovieClip().player_one.player_name.gotoAndStop(1);
_interface.getMovieClip().player_one.player_name.charName.text = _local4;
_interface.getMovieClip().player_one.player_name.gotoAndStop(2);
_interface.getMovieClip().player_one.player_name.charName.text = _local4;
_clockFrame = 1;
_interface.getMovieClip().clock.gotoAndStop(_clockFrame);
_interface.getMovieClip().messages.gotoAndStop(1);
_interface.getMovieClip().messages.moveText.text = " ";
_interface.getMovieClip().arrow_turn.gotoAndStop(15);
_local4 = ((_character == 1) ? "BLOO" : "MAC");
_local5 = ((_character == 1) ? 1 : 2);
_interface.getMovieClip().player_two.gui_checkers_captured_mc.gotoAndStop(1);
_interface.getMovieClip().player_two.checkers_captured.text = " ";
_interface.getMovieClip().player_two.avatar_frame_colors.gotoAndStop(((_character == 0) ? 1 : 2));
_interface.getMovieClip().player_two.avatar_picture.gotoAndStop(_local5);
_interface.getMovieClip().player_two.player_frame.gotoAndStop(((_character == 0) ? 1 : 3));
_interface.getMovieClip().player_two.avatar_frame_highlight.gotoAndStop(((_character == 0) ? 2 : 3));
_interface.getMovieClip().player_two.player_name.gotoAndStop(1);
_interface.getMovieClip().player_two.player_name.charName.text = _local4;
_interface.getMovieClip().player_two.player_name.gotoAndStop(2);
_interface.getMovieClip().player_two.player_name.charName.text = _local4;
_gameboard = new Base.SpriteEntity(_gameContext, 5, 100, "gameboard_and_logo_mc", "gameboard", 4, 0, 0, 2, -1, -1);
return(undefined);
}
function cleanupPieces() {
var _local4 = _boardSprite.length - 1;
var _local3 = _local4;
while (_local3 >= 0) {
_boardSprite[_local3].removeSprite();
_boardSprite.pop();
_local3--;
}
_local3 = 1;
while (_local3 >= 0) {
_players[_local3].killPieces();
_players[_local3].getAvatar().removeSprite();
delete eval (_players[_local3].getAvatar());
_players.pop();
_local3--;
}
_local3 = 0;
while (_local3 < 8) {
var _local2 = 0;
while (_local2 < 8) {
delete _checkerBoard[_local3][_local2];
delete _checkerBoardCopy[_local3][_local2];
_local2++;
}
_local3++;
}
}
function cleanupBoard() {
_gameboard.removeSprite();
delete _gameboard;
_interface.removeSprite();
delete _interface;
}
function setPlayerFrame(num) {
var _local2 = 0;
var _local4 = 1;
var _local3;
if (_whosTurn == num) {
if (_whosTurn == 1) {
_local2 = ((_character == 0) ? 2 : 3);
_local3 = ((_character == 0) ? "MAC" : "BLOO");
} else {
_local2 = ((_character == 1) ? 2 : 3);
_local3 = ((_character == 1) ? "MAC" : "BLOO");
}
_local4 = 2;
} else {
_local2 = 1;
if (_whosTurn == 1) {
_local3 = ((_character == 0) ? "BLOO" : "MAC");
} else {
_local3 = ((_character == 1) ? "BLOO" : "MAC");
}
}
if (num == 1) {
_interface.getMovieClip().player_two.player_frame.gotoAndStop(_local2);
_interface.getMovieClip().player_two.avatar_frame_highlight.gotoAndStop(_local2);
_interface.getMovieClip().player_two.player_name.gotoAndStop(_local4);
_interface.getMovieClip().player_two.player_name.charName.text = _local3;
} else {
_interface.getMovieClip().player_one.player_frame.gotoAndStop(_local2);
_interface.getMovieClip().player_one.avatar_frame_highlight.gotoAndStop(_local2);
_interface.getMovieClip().player_one.player_name.gotoAndStop(_local4);
_interface.getMovieClip().player_one.player_name.charName.text = _local3;
}
}
function updateClockTimer(amountToRotate) {
_interface.getMovieClip().clock.clock_hand._rotation = _interface.getMovieClip().clock.clock_hand._rotation + amountToRotate;
}
function getClockHandRotation() {
return(_interface.getMovieClip().clock.clock_hand._rotation);
}
function blinkClockTimer() {
_clockFrame = _clockFrame ^ 1;
_interface.getMovieClip().clock.gotoAndStop(_clockFrame + 1);
}
function resetClockTimer() {
_clockFrame = 1;
_interface.getMovieClip().clock.gotoAndStop(_clockFrame);
_interface.getMovieClip().clock.clock_hand._rotation = 270;
}
function updateCPUThinking() {
_interface.getMovieClip().clock.gotoAndStop(6);
_interface.getMovieClip().clock.clock_dial._rotation = _interface.getMovieClip().clock.clock_dial._rotation + 5;
}
function stopCPUThinking() {
_interface.getMovieClip().clock.gotoAndStop(1);
}
function updateArrow(frame) {
_interface.getMovieClip().arrow_turn.gotoAndStop(frame);
}
function addPlayer(playerName, idx, charIdx, cpuControlled, netControlled) {
_numPlayers++;
_players.push(new Game.Player(_gameContext, playerName, idx, charIdx, cpuControlled, netControlled));
}
function addPlayers() {
addPlayer("player_0", 0, _character ^ 1, true, false);
addPlayer("player_1", 1, _character, _cpuVScpu, false);
}
function setPlayerReadyForMove(toSet) {
_playerReadyForMove = toSet;
}
function getPlayerReadyForMove() {
return(_playerReadyForMove);
}
function areOpponents(id1, id2) {
if (id1 < 0) {
return(false);
}
if (id2 < 0) {
return(false);
}
if (((id1 < 32) && (id2 < 32)) && (((id1 < 12) && (id2 < 12)) || ((id1 >= 12) && (id2 >= 12)))) {
return(false);
}
if (((((id1 < 12) && (id2 == 32)) || ((id2 < 12) && (id1 == 32))) || ((id1 >= 12) && (id2 == 33))) || ((id2 >= 12) && (id1 == 33))) {
return(false);
}
return(true);
}
function getProperBoardPositionX(posX) {
var _local2 = Math.floor((posX - _boardBaseX) / SQUARE_WIDTH);
return(_boardBaseX + (_local2 * SQUARE_WIDTH));
}
function getProperBoardPositionY(posY) {
var _local2 = Math.floor((posY - _boardBaseY) / SQUARE_HEIGHT);
return(_boardBaseY + (_local2 * SQUARE_HEIGHT));
}
function getBoardSquare(posX, posY) {
var _local3 = Math.round((posX - _boardBaseX) / SQUARE_WIDTH);
var _local2 = Math.round((posY - _boardBaseY) / SQUARE_HEIGHT);
return(_local2 + (_local3 * 8));
}
function getGridX(posX) {
return(Math.round((posX - _boardBaseX) / SQUARE_WIDTH));
}
function getGridY(posY) {
return(Math.round((posY - _boardBaseY) / SQUARE_HEIGHT));
}
function getAvatarSelected(idx) {
var _local2 = ((idx < 12) ? 0 : 1);
if (idx == _avatarOnPiece[_local2]) {
return(true);
}
return(false);
}
function setAvatarClicked(idx) {
_avatarClicked = idx;
}
function getAvatarClicked() {
return(_avatarClicked);
}
function getAvatarOnPiece(idx) {
return(_avatarOnPiece[idx]);
}
function setAvatarOnPiece(idx, currentX, currentY) {
var _local2 = Math.floor((currentX - _boardBaseX) / SQUARE_WIDTH);
var _local3 = Math.floor((currentY - _boardBaseY) / SQUARE_HEIGHT);
_previousPieceAvatarOn = _avatarOnPiece[idx];
_avatarOnPiece[idx] = _checkerBoard[_local2][_local3];
}
function getPreviousPieceAvatarOn(idx) {
return(_previousPieceAvatarOn);
}
function switchKings(oldKing, newKing) {
_kings[oldKing] = false;
_kings[newKing] = true;
}
function setGameOver(whoLost) {
_gameOver = whoLost;
}
function getGameOver() {
return(_gameOver);
}
function resetAvatarPosition(entity) {
var _local8 = entity.getID() - 32;
var _local9 = new Array(4, 2, 6, 0, 3, 5, 1, 7);
var _local2 = ((_local8 == 0) ? 0 : 4);
if (_local8 == 0) {
var _local6 = 0;
while (_local6 < 8) {
var _local5 = 0;
while (_local5 < 4) {
var _local7 = _local9[_local2];
var _local3 = _checkerBoard[_local7][_local6];
if ((_local3 == -1) || (_local3 > 11)) {
_local2++;
_local2 = _local2 % 8;
} else {
_avatarOnPiece[_local8] = _local3;
entity.setPositionX(_boardBaseX + (_local7 * SQUARE_WIDTH));
entity.setPositionY(_boardBaseY + (_local6 * SQUARE_HEIGHT));
return(true);
}
_local5++;
}
_local6++;
}
} else {
var _local6 = 7;
while (_local6 >= 0) {
var _local5 = 0;
while (_local5 < 4) {
var _local7 = _local9[_local2];
var _local3 = _checkerBoard[_local7][_local6];
if ((_local3 == -1) || (_local3 < 12)) {
_local2++;
_local2 = _local2 % 8;
} else {
_avatarOnPiece[_local8] = _local3;
entity.setPositionX(_boardBaseX + (_local7 * SQUARE_WIDTH));
entity.setPositionY(_boardBaseY + (_local6 * SQUARE_HEIGHT));
return(true);
}
_local5++;
}
_local6--;
}
}
return(false);
}
function movingOnPiece(currentX, currentY) {
var _local2 = Math.round((currentX - _boardBaseX) / SQUARE_WIDTH);
var _local3 = Math.round((currentY - _boardBaseY) / SQUARE_HEIGHT);
if (_checkerBoard[_local2][_local3] != -1) {
return(true);
}
return(false);
}
function canJump(gridX, gridY, idx) {
var _local2 = ((idx < 12) ? 1 : -1);
var _local7 = pieceInFrontRight(gridX, gridY, _local2, 1);
var _local5 = pieceInFrontRight(gridX, gridY, _local2, 2);
if (_local5 > -2) {
if (areOpponents(_local7, idx) && (_local5 == -1)) {
return(true);
}
}
_local7 = pieceInFrontLeft(gridX, gridY, _local2, 1);
_local5 = pieceInFrontLeft(gridX, gridY, _local2, 2);
if (_local5 > -2) {
if (areOpponents(_local7, idx) && (_local5 == -1)) {
return(true);
}
}
if (isKing(idx)) {
var _local8 = pieceInBackRight(gridX, gridY, _local2, 1);
_local5 = pieceInBackRight(gridX, gridY, _local2, 2);
if (_local5 > -2) {
if (areOpponents(_local8, idx) && (_local5 == -1)) {
return(true);
}
}
_local8 = pieceInBackLeft(gridX, gridY, _local2, 1);
_local5 = pieceInBackLeft(gridX, gridY, _local2, 2);
if (_local5 > -2) {
if (areOpponents(_local8, idx) && (_local5 == -1)) {
return(true);
}
}
}
return(false);
}
function amJumping(currentGridX, currentGridY, destGridX, destGridY) {
if (Math.abs(currentGridX - destGridX) == 2) {
return(true);
}
return(false);
}
function isValidMove(entity, currentX, currentY, moveGuy, highlightJump) {
var _local19 = entity.getPositionX();
var _local18 = entity.getPositionY();
var _local10 = entity.getID();
var _local5 = Math.floor((_local19 - _boardBaseX) / SQUARE_WIDTH);
var _local4 = Math.floor((_local18 - _boardBaseY) / SQUARE_HEIGHT);
var _local2 = Math.floor((currentX - _boardBaseX) / SQUARE_WIDTH);
var _local3 = Math.floor((currentY - _boardBaseY) / SQUARE_HEIGHT);
if (((_local2 % 2) && (!(_local3 % 2))) || ((!(_local2 % 2)) && (_local3 % 2))) {
return(false);
}
if ((_local2 == _local5) || (_local3 == _local4)) {
return(false);
}
if ((((_local2 < 0) || (_local3 < 0)) || (_local2 > 7)) || (_local3 > 7)) {
return(false);
}
if (canJump(_local5, _local4, _local10) && (!amJumping(_local5, _local4, _local2, _local3))) {
return(false);
}
if (_checkerBoard[_local2][_local3] != -1) {
if ((((_local10 == 32) || (getAvatarSelected(_local10) && (_local10 < 12))) && (_checkerBoard[_local2][_local3] < 12)) || (((_local10 == 33) || (getAvatarSelected(_local10) && (_local10 > 11))) && (_checkerBoard[_local2][_local3] > 11))) {
if ((Math.abs(_local2 - _local5) <= 1) && (Math.abs(_local3 - _local4) <= 1)) {
return(true);
}
return(false);
}
return(false);
}
var _local7 = _teamDir[_whosTurn];
var _local13 = _local5 + 1;
var _local12 = _local5 - 1;
var _local8 = _local4 + _local7;
if (((_local7 > 0) && (_local4 < _local3)) || ((_local7 < 0) && (_local4 > _local3))) {
if (((_local13 == _local2) || (_local12 == _local2)) && (_local8 == _local3)) {
return(true);
}
if (areOpponents(entity.getID(), _checkerBoard[_local13][_local8])) {
if ((_local2 == (_local13 + 1)) && (_local3 == (_local8 + _local7))) {
var _local17 = _checkerBoard[_local13][_local8];
if (highlightJump) {
highlightSquare(_local3 + (_local2 * 8));
}
if (moveGuy) {
setJumpedID(_local17);
_checkerBoard[_local13][_local8] = -1;
_checkerBoard[_local5][_local4] = -1;
_checkerBoard[_local2][_local3] = entity.getID();
}
return(true);
}
}
if (areOpponents(entity.getID(), _checkerBoard[_local12][_local8])) {
if ((_local2 == (_local12 - 1)) && (_local3 == (_local8 + _local7))) {
var _local17 = _checkerBoard[_local12][_local8];
if (moveGuy) {
}
if (highlightJump) {
highlightSquare(_local3 + (_local2 * 8));
}
if (moveGuy) {
setJumpedID(_local17);
_checkerBoard[_local12][_local8] = -1;
_checkerBoard[_local5][_local4] = -1;
_checkerBoard[_local2][_local3] = entity.getID();
}
return(true);
}
}
} else {
_local7 = _local7 * -1;
var _local15 = _local5 + 1;
var _local14 = _local5 - 1;
var _local9 = _local4 + _local7;
if (!isKing(entity.getID())) {
if (moveGuy) {
}
return(false);
}
if (((_local15 == _local2) || (_local14 == _local2)) && (_local9 == _local3)) {
if (moveGuy) {
_checkerBoard[_local5][_local4] = -1;
_checkerBoard[_local2][_local3] = entity.getID();
}
return(true);
}
if (areOpponents(entity.getID(), _checkerBoard[_local15][_local9])) {
if ((_local2 == (_local15 + 1)) && (_local3 == (_local9 + _local7))) {
var _local17 = _checkerBoard[_local15][_local9];
if (moveGuy) {
}
if (highlightJump) {
highlightSquare(_local3 + (_local2 * 8));
}
if (moveGuy) {
setJumpedID(_local17);
_checkerBoard[_local15][_local9] = -1;
_checkerBoard[_local5][_local4] = -1;
_checkerBoard[_local2][_local3] = entity.getID();
}
return(true);
}
}
if (areOpponents(entity.getID(), _checkerBoard[_local14][_local9])) {
if ((_local2 == (_local14 - 1)) && (_local3 == (_local9 + _local7))) {
var _local17 = _checkerBoard[_local14][_local9];
if (moveGuy) {
}
if (highlightJump) {
highlightSquare(_local3 + (_local2 * 8));
}
if (moveGuy) {
setJumpedID(_local17);
_checkerBoard[_local14][_local9] = -1;
_checkerBoard[_local5][_local4] = -1;
_checkerBoard[_local2][_local3] = entity.getID();
}
return(true);
}
}
}
return(false);
}
function handleJumpedGuy(gridX, gridY) {
var _local2 = _checkerBoard[gridX][gridY];
setJumpedID(_local2);
_checkerBoard[gridX][gridY] = -1;
}
function setClearSquare(entity) {
var _local2 = entity.getPositionX();
var _local3 = entity.getPositionY();
var _local5 = getBoardSquare(_local2, _local3);
_boardSprite[_local5].setVisibility(false);
_local2 = entity.getPositionX() + (SQUARE_WIDTH * 2);
_local3 = entity.getPositionY() + (SQUARE_HEIGHT * 2);
if (isValidMove(entity, _local2, _local3, false, false)) {
_local5 = getBoardSquare(_local2, _local3);
_boardSprite[_local5].doneAnimating();
}
_local2 = entity.getPositionX() + (SQUARE_WIDTH * 2);
_local3 = entity.getPositionY() - (SQUARE_HEIGHT * 2);
if (isValidMove(entity, _local2, _local3, false, false)) {
_local5 = getBoardSquare(_local2, _local3);
_boardSprite[_local5].doneAnimating();
}
_local2 = entity.getPositionX() - (SQUARE_WIDTH * 2);
_local3 = entity.getPositionY() + (SQUARE_HEIGHT * 2);
if (isValidMove(entity, _local2, _local3, false, false)) {
_local5 = getBoardSquare(_local2, _local3);
_boardSprite[_local5].doneAnimating();
}
_local2 = entity.getPositionX() - (SQUARE_WIDTH * 2);
_local3 = entity.getPositionY() - (SQUARE_HEIGHT * 2);
if (isValidMove(entity, _local2, _local3, false, false)) {
_local5 = getBoardSquare(_local2, _local3);
_boardSprite[_local5].doneAnimating();
}
}
function highlightSquareUsingEntity(entity) {
var _local3 = entity.getPositionX();
var _local2 = entity.getPositionY();
var _local5 = getBoardSquare(_local3, _local2);
highlightSquare(_local5);
_local3 = entity.getPositionX() + (SQUARE_WIDTH * 2);
_local2 = entity.getPositionY() + (SQUARE_HEIGHT * 2);
if (isValidMove(entity, _local3, _local2, false, false)) {
_local5 = getBoardSquare(_local3, _local2);
animateSquare(_local5);
}
_local3 = entity.getPositionX() + (SQUARE_WIDTH * 2);
_local2 = entity.getPositionY() - (SQUARE_HEIGHT * 2);
if (isValidMove(entity, _local3, _local2, false, false)) {
_local5 = getBoardSquare(_local3, _local2);
animateSquare(_local5);
}
_local3 = entity.getPositionX() - (SQUARE_WIDTH * 2);
_local2 = entity.getPositionY() + (SQUARE_HEIGHT * 2);
if (isValidMove(entity, _local3, _local2, false, false)) {
_local5 = getBoardSquare(_local3, _local2);
animateSquare(_local5);
}
_local3 = entity.getPositionX() - (SQUARE_WIDTH * 2);
_local2 = entity.getPositionY() - (SQUARE_HEIGHT * 2);
if (isValidMove(entity, _local3, _local2, false, false)) {
_local5 = getBoardSquare(_local3, _local2);
animateSquare(_local5);
}
}
function highlightMoveSquares(entity) {
var _local5;
var _local3 = entity.getPositionX() + SQUARE_WIDTH;
var _local2 = entity.getPositionY() + SQUARE_HEIGHT;
var _local6 = false;
if (isValidMove(entity, _local3, _local2, false, false)) {
_local5 = getBoardSquare(_local3, _local2);
animateSquare(_local5);
_local6 = true;
}
_local3 = entity.getPositionX() + SQUARE_WIDTH;
_local2 = entity.getPositionY() - SQUARE_HEIGHT;
if (isValidMove(entity, _local3, _local2, false, false)) {
_local5 = getBoardSquare(_local3, _local2);
animateSquare(_local5);
_local6 = true;
}
_local3 = entity.getPositionX() - SQUARE_WIDTH;
_local2 = entity.getPositionY() + SQUARE_HEIGHT;
if (isValidMove(entity, _local3, _local2, false, false)) {
_local5 = getBoardSquare(_local3, _local2);
animateSquare(_local5);
_local6 = true;
}
_local3 = entity.getPositionX() - SQUARE_WIDTH;
_local2 = entity.getPositionY() - SQUARE_HEIGHT;
if (isValidMove(entity, _local3, _local2, false, false)) {
_local5 = getBoardSquare(_local3, _local2);
animateSquare(_local5);
_local6 = true;
}
if (_local6) {
_local3 = entity.getPositionX();
_local2 = entity.getPositionY();
_local5 = getBoardSquare(_local3, _local2);
highlightSquare(_local5);
}
return(_local6);
}
function canIMove(entity) {
var _local6;
var _local3 = entity.getPositionX() + SQUARE_WIDTH;
var _local2 = entity.getPositionY() + SQUARE_HEIGHT;
var _local5 = false;
if (isValidMove(entity, _local3, _local2, false, false)) {
_local6 = getBoardSquare(_local3, _local2);
_local5 = true;
}
_local3 = entity.getPositionX() + SQUARE_WIDTH;
_local2 = entity.getPositionY() - SQUARE_HEIGHT;
if (isValidMove(entity, _local3, _local2, false, false)) {
_local6 = getBoardSquare(_local3, _local2);
_local5 = true;
}
_local3 = entity.getPositionX() - SQUARE_WIDTH;
_local2 = entity.getPositionY() + SQUARE_HEIGHT;
if (isValidMove(entity, _local3, _local2, false, false)) {
_local6 = getBoardSquare(_local3, _local2);
_local5 = true;
}
_local3 = entity.getPositionX() - SQUARE_WIDTH;
_local2 = entity.getPositionY() - SQUARE_HEIGHT;
if (isValidMove(entity, _local3, _local2, false, false)) {
_local6 = getBoardSquare(_local3, _local2);
_local5 = true;
}
return(_local5);
}
function iCanWin(entity, gridX, gridY) {
var _local6 = _teamDir[_whosTurn];
var _local2 = 1;
var _local5 = 1;
if (canJump(gridX, gridY, entity.getID())) {
_local2 = 2;
_local5 = 3;
} else if (_local6 > 0) {
if (gridY == (7 - _local2)) {
if (gridX < (7 - _local2)) {
if (_checkerBoard[gridX + _local2][gridY + _local2] == -1) {
return(_local5);
}
} else if (gridX > _local2) {
if (_checkerBoard[gridX - _local2][gridY + _local2] == -1) {
return(_local5 + 1);
}
}
}
} else if (gridY == _local2) {
if (gridX < (7 - _local2)) {
if (_checkerBoard[gridX + _local2][gridY - _local2] == -1) {
return(_local5);
}
} else if (gridX > _local2) {
if (_checkerBoard[gridX - _local2][gridY - _local2] == -1) {
return(_local5 + 1);
}
}
}
return(-1);
}
function canJumpAgain(entity, posX, posY, highlightJump) {
var _local2 = 0;
if (isValidMove(entity, posX + (SQUARE_WIDTH * 2), posY + (SQUARE_HEIGHT * 2), false, highlightJump)) {
_local2 = 100;
}
if (isValidMove(entity, posX + (SQUARE_WIDTH * 2), posY - (SQUARE_HEIGHT * 2), false, highlightJump)) {
_local2 = 100;
}
if (isValidMove(entity, posX - (SQUARE_WIDTH * 2), posY + (SQUARE_HEIGHT * 2), false, highlightJump)) {
_local2 = 100;
}
if (isValidMove(entity, posX - (SQUARE_WIDTH * 2), posY - (SQUARE_HEIGHT * 2), false, highlightJump)) {
_local2 = 100;
}
return(_local2);
}
function animateSquare(squareNum) {
_squareIsHighlighted++;
_boardSprite[squareNum].setVisibility(true);
_boardSprite[squareNum].startAnimating(218, 245, 48, true);
return(undefined);
}
function animateSquares() {
var _local2 = 0;
while (_local2 < _boardSprite.length) {
if (_boardSprite[_local2].isAnimating()) {
_boardSprite[_local2].animateSprite();
}
_local2++;
}
}
function highlightSquare(squareNum) {
_squareIsHighlighted++;
_boardSprite[squareNum].setVisibility(true);
_boardSprite[squareNum].moveToFrame(245);
return(undefined);
}
function unHighlightSquare(squareNum) {
_squareIsHighlighted--;
_boardSprite[squareNum].setVisibility(false);
}
function showMessage() {
var _local2;
var _local3;
if (_whosTurn == 1) {
_local2 = "YOU ";
_local3 = ((_character == 0) ? 2 : 3);
} else {
_local2 = "YOUR OPPONENT ";
_local3 = ((_character == 1) ? 2 : 3);
}
_interface.getMovieClip().messages.gotoAndStop(_local3);
if ((_whosTurn == 0) && (_gotKinged == true)) {
_interface.getMovieClip().messages.moveText.text = _local2 + "GETS KINGED";
return(undefined);
}
if (_numCaptured == 0) {
if (_whosTurn == 1) {
_interface.getMovieClip().messages.moveText.text = _local2 + "Move a piece";
} else {
_interface.getMovieClip().messages.moveText.text = _local2 + "MOVES A PIECE";
}
} else if (_whosTurn == 1) {
if (_numCaptured == 1) {
_interface.getMovieClip().messages.moveText.text = ((_local2 + "Capture ") + _numCaptured) + " PIECE";
} else {
_interface.getMovieClip().messages.moveText.text = ((_local2 + "CAPTURE ") + _numCaptured) + " PIECES";
}
} else if (_numCaptured == 1) {
_interface.getMovieClip().messages.moveText.text = ((_local2 + "CAPTURES ") + _numCaptured) + " PIECE";
} else {
_interface.getMovieClip().messages.moveText.text = ((_local2 + "CAPTURES ") + _numCaptured) + " PIECES";
}
if (_gotKinged == true) {
if (_whosTurn == 1) {
_interface.getMovieClip().messages.moveText.text = _interface.getMovieClip().messages.moveText.text + ". GET KINGED";
} else {
_interface.getMovieClip().messages.moveText.text = _interface.getMovieClip().messages.moveText.text + ". GETS KINGED";
}
}
}
function showMessageString(msg, whosMessage) {
_interface.getMovieClip().messages.gotoAndStop(whosMessage);
_interface.getMovieClip().messages.moveText.text = msg;
}
function setMove(toSet) {
_move = toSet;
}
function incNumCaptured() {
_numCaptured++;
_totalNumCaptured[_whosTurn]++;
if (_whosTurn == 0) {
_interface.getMovieClip().player_one.checkers_captured.text = "X " + _totalNumCaptured[_whosTurn];
_interface.getMovieClip().player_one.gui_checkers_captured_mc.gotoAndStop(_character + 2);
} else {
_interface.getMovieClip().player_two.checkers_captured.text = "X " + _totalNumCaptured[_whosTurn];
_interface.getMovieClip().player_two.gui_checkers_captured_mc.gotoAndStop((_character ^ 1) + 2);
}
}
function clearMessage() {
_move = -1;
_numCaptured = 0;
_gotKinged = false;
}
function handleTurnOver() {
showMessage();
clearMessage();
switchTurns();
return(undefined);
}
function setWhosTurn(turn) {
_whosTurn = turn;
}
function setMovingPiece(idx) {
_movingPiece = idx;
}
function setPieceOnBoard(idx, x, y) {
var _local3 = Math.round((x - _boardBaseX) / SQUARE_WIDTH);
var _local2 = Math.round((y - _boardBaseY) / SQUARE_HEIGHT);
_checkerBoard[_local3][_local2] = idx;
return(undefined);
}
function setJumpedID(num) {
_jumpedID = num;
_jumpedGuy = num;
}
function setNumPlayers(num) {
_numPlayers = num;
}
function incNumPlayers() {
_numPlayers++;
}
function setPlayingMultiplayer(toSet) {
_playingMultiplayer = toSet;
}
function setBestMove(idx, score) {
_bestMoveGuy = idx;
_bestMoveScore = score;
}
function setJumpedGuy(idx) {
_jumpedGuy = idx;
}
function setAvatarMoving(toSet) {
_avatarMoving = toSet;
_avatarToMove = -1;
}
function getWhosTurn() {
return(_whosTurn);
}
function getBoardBaseX() {
return(_boardBaseX);
}
function getBoardBaseY() {
return(_boardBaseY);
}
function getNumPlayers() {
return(_numPlayers);
}
function getBoardPosition(x, y) {
return(_boardPositions[x][y]);
}
function getMovingPiece() {
return(_movingPiece);
}
function getAvatarMoving() {
return(_avatarMoving);
}
function isPieceMoving() {
if ((_movingPiece > -1) || (_avatarMoving > -1)) {
return(true);
}
return(false);
}
function isAvatarMoving() {
return(((_avatarMoving > -1) ? true : false));
}
function getJumpedID() {
return(_jumpedID);
}
function isMyTurn(idx) {
return(idx == _whosTurn);
}
function switchTurns() {
if (_whosTurn == 0) {
_numMoves++;
_numMessageMoves++;
}
_whosTurn = _whosTurn ^ 1;
}
function getNumMoves() {
return(_numMoves);
}
function decNumReady() {
_numReady--;
}
function incNumReady() {
_numReady++;
}
function incNumLost() {
_numLost++;
}
function setGameReady(toSet) {
_gameReady = toSet;
}
function isGameReady() {
return(_gameReady);
}
function getNumReady() {
return(_numReady);
}
function setPieceMoved(idx) {
_pieceMoved = idx;
}
function setPieceMoving(idx) {
_movingPiece = idx;
}
function getPieceMoved() {
return(_pieceMoved);
}
function getPieceMoving() {
return(_pieceMoving);
}
function getPieceDestX() {
return(_pieceDestX);
}
function getPieceDestY() {
return(_pieceDestY);
}
function isPlayingMultiplayer() {
return(_playingMultiplayer);
}
function getPlayer(num) {
return(_players[num]);
}
function setResetGameToNetwork() {
_resetGameToNetwork = true;
}
function getResetGameToNetwork() {
return(_resetGameToNetwork);
}
function getTeamDir(idx) {
return(_teamDir[idx]);
}
function getBestMoveGuy() {
return(_bestMoveGuy);
}
function getBestMoveScore() {
return(_bestMoveScore);
}
function getJumpedGuy() {
return(_jumpedGuy);
}
function changeCPUPlayerToNetworkPlayer(num) {
var _local3 = 0;
while (_local3 < 8) {
var _local2 = 0;
while (_local2 < 8) {
_checkerBoard[_local3][_local2] = -1;
_local2++;
}
_local3++;
}
setPlayingMultiplayer(true);
_whosTurn = 1;
_numReady = 0;
_numLost = 0;
_movingPiece = -1;
_jumpedID = -1;
_teamDir[0] = 1;
_teamDir[1] = -1;
_pieceMoved = -1;
_pieceMoving = -1;
_playingMultiplayer = true;
_players[0].removePieces();
_players[0].Init();
_players[1].removePieces();
_numPlayers--;
delete _players[num];
_players.splice(num, 1);
}
function shouldBeKinged(entity) {
if (isKing(entity.getID())) {
return(false);
}
var _local2 = _teamDir[_whosTurn];
var _local3 = Math.round((entity.getPositionY() - _boardBaseY) / SQUARE_HEIGHT);
var _local4 = ((_local2 > 0) ? 7 : 0);
if (_local3 == _local4) {
return(true);
}
return(false);
}
function setKinged(idx) {
_kings[idx] = true;
}
function isPieceKinged(idx) {
if (_kings[idx] == true) {
return(true);
}
}
function isKing(idx) {
if (_kings[idx] == true) {
return(true);
}
if (getAvatarSelected(idx)) {
return(true);
}
return(false);
}
function wasKing(idx) {
return(_kings[idx]);
}
function kingMe(entity) {
entity.startAnimating(323, 350, 24, false);
setKinged(entity.getID());
}
function handleReceivedMsg(alias, msg) {
var _local2 = msg.firstChild;
var _local3 = msg.firstChild.nodeName;
switch (_local3) {
case "MADE_MOVE" :
setMoveMadeInfo(_local2.attributes.pieceIdx, _local2.attributes.posX, _local2.attributes.posY);
break;
case "SYNCED_AND_READY" :
setMoveMadeInfo(_local2.attributes.ready);
break;
}
}
function setMoveMadeInfo(idx, xPos, yPos) {
_pieceMoved = Number(idx);
_pieceDestX = Number(xPos);
_pieceDestY = Number(yPos);
return(undefined);
}
function setMovingPieceInfo(idx, xPos, yPos) {
_pieceMoving = Number(idx);
_pieceDestX = Number(xPos);
_pieceDestY = Number(yPos);
return(undefined);
}
function setClearHighlightedSquares() {
_squareIsHighlighted = 0;
var _local2 = 0;
while (_local2 < 64) {
_boardSprite[_local2].setVisibility(false);
_boardSprite[_local2].doneAnimating();
_local2++;
}
}
function updateBoard(entity) {
var _local7 = entity.getDestPosX();
var _local6 = entity.getDestPosY();
var _local3 = entity.getPositionX();
var _local10 = entity.getPositionY();
var _local9 = Math.floor((_local3 - _boardBaseX) / SQUARE_WIDTH);
var _local8 = Math.floor((_local10 - _boardBaseY) / SQUARE_HEIGHT);
var _local4 = Math.floor((_local7 - _boardBaseX) / SQUARE_WIDTH);
var _local5 = Math.floor((_local6 - _boardBaseY) / SQUARE_HEIGHT);
_checkerBoard[_local9][_local8] = -1;
_checkerBoard[_local4][_local5] = entity.getID();
}
function isWinner() {
return(false);
}
function setWinner(winner) {
_winner = winner;
}
function getWinner() {
return(_winner);
}
function getSoundModule() {
return(_soundModule);
}
function setUpSoundsFx() {
_soundMC = _root.createEmptyMovieClip("sound_mc", 12000);
_soundModule = new Game.SoundModule(_soundMC);
var _local3 = 0;
while (_local3 < soundList.length) {
var _local4 = _soundModule.LoadSound(soundList[_local3]);
_local4.attachSound(soundList[_local3]);
_local3++;
}
}
function StopAllSounds() {
var _local2 = 0;
while (_local2 < soundList.length) {
_soundModule.StopSound(soundList[_local2]);
_local2++;
}
}
function playSound(soundNum) {
var _local3;
var _local4 = 0;
switch (soundNum) {
case _global.SND_BTN1 :
_local3 = "bs_checkers_btn1.wav";
break;
case _global.SND_BTN2 :
_local3 = "bs_checkers_btn2.wav";
break;
case _global.SND_BTN3 :
_local3 = "bs_checkers_btn3.wav";
break;
case _global.SND_BTN4 :
_local3 = "bs_checkers_btn4.wav";
break;
case _global.SND_CLINK1 :
_local3 = "checkers_clink1.wav";
break;
case _global.SND_CLINK2 :
_local3 = "checkers_clink2.wav";
break;
case _global.SND_CLINK3 :
_local3 = "checkers_clink3.wav";
break;
case _global.SND_CLINK4 :
_local3 = "checkers_clink4.wav";
break;
case _global.SND_CLINK5 :
_local3 = "checkers_clink5.wav";
break;
case _global.SND_CLINK6 :
_local3 = "checkers_clink6.wav";
break;
case _global.SND_CLINK7 :
_local3 = "checkers_clink7.wav";
break;
case _global.SND_DROP1 :
_local3 = "checkers_drop1.wav";
break;
case _global.SND_CLINK1 :
_local3 = "checkers_tally.wav";
break;
case _global.SND_TITLE :
_local3 = "music_title_2.wav";
break;
case _global.SND_GAME :
_local3 = "music_game_2.wav";
_local4 = 1;
break;
case _global.SND_JUMP1 :
_local3 = "sting_jump1.mp3";
break;
case _global.SND_FROM1 :
_local3 = "bs_checkers_from1.wav";
break;
case _global.SND_TO2 :
_local3 = "bs_checkers_to2.wav";
break;
case _global.SND_BS_CAP :
_local3 = "bs_checkers_bigshot_cap.wav";
break;
case _global.SND_BS_CAP2 :
_local3 = "bs_checkers_bigshot_cap2.wav";
break;
case _global.SND_BS_JUMP :
_local3 = "bs_checkers_bigshot_jump.wav";
break;
case _global.SND_BS_SLIDE :
_local3 = "bs_checkers_slide1.wav";
break;
case _global.SND_JUMP2 :
_local3 = "sting_jump2.mp3";
break;
case _global.SND_JUMP3 :
_local3 = "sting_jump3.mp3";
break;
case _global.SND_JUMP_AVATAR :
_local3 = "sting_jump_avatar.mp3";
break;
case _global.SND_KINGED :
_local3 = "sting_kinged.wav";
break;
case _global.SND_LOSE_01 :
_local3 = "sting_lose_01.wav";
break;
case _global.SND_LOSE_02 :
_local3 = "sting_lose_02.wav";
break;
case _global.SND_WIN :
_local3 = "sting_win.wav";
break;
case _global.SND_TIMECOUNTDOWN :
_local3 = "time_countdown.wav";
break;
case _global.SND_TIMEUP :
_local3 = "time_up.wav";
break;
default :
_local3 = "checkers_drop1";
}
_soundModule.PlaySound(_local3, 100, 0, 0, 1);
}
function canTradePiece(piece, currentGridX, currentGridY, dir) {
copyBoard();
copyBoard();
return(false);
}
function sacrificePieceToMoveAvatarBackward(piece, currentGridX, currentGridY, dir) {
if (((dir < 0) && (currentGridY < 4)) || ((dir > 0) && (currentGridY > 3))) {
return(false);
}
if (areOpponents(_checkerBoard[currentGridX - 1][currentGridY - dir], piece.getID()) && ((_checkerBoard[currentGridX + 1][currentGridY + dir] == -1) || (_checkerBoard[currentGridX + 1][currentGridY + dir] == piece.getID()))) {
if (getAvatarSelected(piece.getID()) && (_checkerBoard[currentGridX][currentGridY] != -1)) {
} else if (getAvatarSelected(_checkerBoard[currentGridX - 1][currentGridY - dir])) {
return(true);
}
}
if (areOpponents(_checkerBoard[currentGridX + 1][currentGridY - dir], piece.getID()) && ((_checkerBoard[currentGridX - 1][currentGridY + dir] == -1) || (_checkerBoard[currentGridX - 1][currentGridY + dir] == piece.getID()))) {
if (getAvatarSelected(piece.getID()) && (_checkerBoard[currentGridX][currentGridY] != -1)) {
} else if (getAvatarSelected(_checkerBoard[currentGridX + 1][currentGridY - dir])) {
return(true);
}
}
}
function movePieceOnBoardCopy(id, gridX, gridY) {
var _local3 = 0;
while (_local3 < 8) {
var _local2 = 0;
while (_local2 < 8) {
if (_checkerBoardCopy[_local3][_local2] == id) {
_checkerBoardCopy[_local3][_local2] = -1;
_checkerBoardCopy[gridX][gridY] = id;
return(undefined);
}
_local2++;
}
_local3++;
}
}
function willGetJumped(piece, currentGridX, currentGridY, dir) {
if ((((currentGridX == 0) || (currentGridX == 7)) || (currentGridY == 0)) || (currentGridY == 7)) {
return(0);
}
var _local6 = 0;
var _local7 = 0;
if (areOpponents(_checkerBoard[currentGridX - 1][currentGridY + dir], piece.getID()) && ((_checkerBoard[currentGridX + 1][currentGridY - dir] == -1) || (_checkerBoard[currentGridX + 1][currentGridY - dir] == piece.getID()))) {
if (getAvatarSelected(piece.getID()) && (_checkerBoard[currentGridX][currentGridY] != -1)) {
} else {
copyBoard();
movePieceOnBoardCopy(piece.getID(), currentGridX, currentGridY);
if (getJumpValue(_checkerBoard[currentGridX - 1][currentGridY + dir], currentGridX - 1, currentGridY + dir, dir * -1) > 100) {
_local7 = 1;
}
_local6 = 1;
}
}
if (areOpponents(_checkerBoard[currentGridX + 1][currentGridY + dir], piece.getID()) && ((_checkerBoard[currentGridX - 1][currentGridY - dir] == -1) || (_checkerBoard[currentGridX - 1][currentGridY - dir] == piece.getID()))) {
if (getAvatarSelected(piece.getID()) && (_checkerBoard[currentGridX][currentGridY] != -1)) {
} else {
copyBoard();
movePieceOnBoardCopy(piece.getID(), currentGridX, currentGridY);
if (getJumpValue(_checkerBoard[currentGridX + 1][currentGridY + dir], currentGridX + 1, currentGridY + dir, dir * -1) > 100) {
_local7 = 1;
}
_local6 = 1;
}
}
if ((areOpponents(_checkerBoard[currentGridX - 1][currentGridY - dir], piece.getID()) && (isKing(_checkerBoard[currentGridX - 1][currentGridY - dir]))) && ((_checkerBoard[currentGridX + 1][currentGridY + dir] == -1) || (_checkerBoard[currentGridX + 1][currentGridY + dir] == piece.getID()))) {
if (getAvatarSelected(piece.getID()) && (_checkerBoard[currentGridX][currentGridY] != -1)) {
} else {
_local6 = 1;
}
}
if ((areOpponents(_checkerBoard[currentGridX + 1][currentGridY - dir], piece.getID()) && (isKing(_checkerBoard[currentGridX + 1][currentGridY - dir]))) && ((_checkerBoard[currentGridX - 1][currentGridY + dir] == -1) || (_checkerBoard[currentGridX - 1][currentGridY + dir] == piece.getID()))) {
if (getAvatarSelected(piece.getID()) && (_checkerBoard[currentGridX][currentGridY] != -1)) {
} else {
_local6 = 1;
}
}
return(_local6 + _local7);
}
function pieceToRight(currentGridX, currentGridY, dir, numAway) {
if ((currentGridX + numAway) > 7) {
return(-2);
}
return(_checkerBoard[currentGridX + numAway][currentGridY]);
}
function pieceToLeft(currentGridX, currentGridY, dir, numAway) {
if ((currentGridX - numAway) < 0) {
return(-2);
}
return(_checkerBoard[currentGridX - numAway][currentGridY]);
}
function pieceInFrontRight(currentGridX, currentGridY, dir, numAway) {
if ((((currentGridX + numAway) > 7) || ((currentGridY + (numAway * dir)) > 7)) || ((currentGridY + (numAway * dir)) < 0)) {
return(-2);
}
return(_checkerBoard[currentGridX + numAway][currentGridY + (numAway * dir)]);
}
function pieceInFrontLeft(currentGridX, currentGridY, dir, numAway) {
if ((((currentGridX - numAway) < 0) || ((currentGridY + (numAway * dir)) > 7)) || ((currentGridY + (numAway * dir)) < 0)) {
return(-2);
}
return(_checkerBoard[currentGridX - numAway][currentGridY + (numAway * dir)]);
}
function pieceInBackRight(currentGridX, currentGridY, dir, numAway) {
if ((((currentGridX + numAway) > 7) || ((currentGridY - (numAway * dir)) > 7)) || ((currentGridY - (numAway * dir)) < 0)) {
return(-2);
}
return(_checkerBoard[currentGridX + numAway][currentGridY - (numAway * dir)]);
}
function pieceInBackLeft(currentGridX, currentGridY, dir, numAway) {
if ((((currentGridX - numAway) < 0) || ((currentGridY - (numAway * dir)) > 7)) || ((currentGridY - (numAway * dir)) < 0)) {
return(-2);
}
return(_checkerBoard[currentGridX - numAway][currentGridY - (numAway * dir)]);
}
function pieceInFront(currentGridX, currentGridY, dir, numAway) {
if (((currentGridY + (numAway * dir)) < 0) || ((currentGridY + (numAway * dir)) > 7)) {
return(-2);
}
return(_checkerBoard[currentGridX][currentGridY + (numAway * dir)]);
}
function pieceInBack(currentGridX, currentGridY, dir, numAway) {
if (((currentGridY + (numAway * dir)) < 0) || ((currentGridY + (numAway * dir)) > 7)) {
return(-2);
}
return(_checkerBoard[currentGridX][currentGridY - (numAway * dir)]);
}
function inPositionToInduceMultipleJump(piece, currentX, currentY, dir) {
var _local6 = false;
if (areOpponents(pieceInFrontRight(currentX, currentY, dir, 1), piece.getID()) && (areOpponents(pieceInFrontLeft(currentX, currentY, dir, 1), piece.getID()))) {
if ((pieceInBackLeft(currentX, currentY, dir, 1) == -1) || (pieceInBackLeft(currentX, currentY, dir, 1) == piece.getID())) {
if (((pieceInBackLeft(currentX, currentY, dir, 2) > -1) && (pieceInBackLeft(currentX, currentY, dir, 3) != -1)) && (!areOpponents(pieceInBackLeft(currentX, currentY, dir, 2), piece.getID()))) {
if (pieceInBack(currentX, currentY, dir, 2) <= -1) {
_local6 = true;
}
}
}
if ((pieceInBackRight(currentX, currentY, dir, 1) == -1) || (pieceInBackRight(currentX, currentY, dir, 1) == piece.getID())) {
if (((pieceInBackRight(currentX, currentY, dir, 2) > -1) && (pieceInBackRight(currentX, currentY, dir, 3) != -1)) && (!areOpponents(pieceInBackRight(currentX, currentY, dir, 2), piece.getID()))) {
_local6 = true;
}
}
}
return(_local6);
}
function canMoveToKingRow(piece, currentGridX, currentGridY, dir) {
if ((currentGridY == 0) && (dir < 0)) {
return(100);
}
if ((currentGridY == 7) && (dir > 0)) {
return(100);
}
return(0);
}
function aboutToGetJumped(piece, currentX, currentY, dir) {
var _local2 = Math.floor((currentX - _boardBaseX) / SQUARE_WIDTH);
var _local3 = Math.floor((currentY - _boardBaseY) / SQUARE_HEIGHT);
if ((((_local2 == 0) || (_local2 == 7)) || (_local3 == 0)) || (_local3 == 7)) {
return(0);
}
if (areOpponents(_checkerBoard[_local2 - 1][_local3 + dir], piece.getID()) && (_checkerBoard[_local2 + 1][_local3 - dir] == -1)) {
return(2);
}
if (areOpponents(_checkerBoard[_local2 + 1][_local3 + dir], piece.getID()) && (_checkerBoard[_local2 - 1][_local3 - dir] == -1)) {
return(1);
}
if ((areOpponents(_checkerBoard[_local2 - 1][_local3 - dir], piece.getID()) && (isKing(_checkerBoard[_local2 - 1][_local3 - dir]))) && (_checkerBoard[_local2 + 1][_local3 + dir] == -1)) {
return(2);
}
if ((areOpponents(_checkerBoard[_local2 + 1][_local3 - dir], piece.getID()) && (isKing(_checkerBoard[_local2 + 1][_local3 - dir]))) && (_checkerBoard[_local2 - 1][_local3 + dir] == -1)) {
return(1);
}
return(0);
}
function wasBlockingJump(currentGridX, currentGridY, dir, id) {
var _local2 = pieceInFrontRight(currentGridX, currentGridY, dir, 1);
var _local3 = pieceInFrontRight(currentGridX, currentGridY, dir, 2);
if ((_local2 > -1) && (!areOpponents(_local2, id))) {
if ((_local3 > -1) && (areOpponents(_local3, id))) {
return(true);
}
}
_local2 = pieceInFrontLeft(currentGridX, currentGridY, dir, 1);
_local3 = pieceInFrontLeft(currentGridX, currentGridY, dir, 2);
if ((_local2 > -1) && (!areOpponents(_local2, id))) {
if ((_local3 > -1) && (areOpponents(_local3, id))) {
return(true);
}
}
return(false);
}
function canICreateAlleyForAvatar(piece, currentGridX, currentGridY, dir) {
var _local7 = pieceToLeft(currentGridX, currentGridY, dir, 2);
var _local8 = pieceToRight(currentGridX, currentGridY, dir, 2);
var _local6 = pieceInFront(currentGridX, currentGridY, dir, 2);
var _local10 = pieceInFrontRight(currentGridX, currentGridY, dir, 1);
var _local11 = pieceInFrontLeft(currentGridX, currentGridY, dir, 1);
var _local2 = piece.getID();
var _local9 = pieceInFrontLeft(currentGridX, currentGridY, dir, 2);
if (getAvatarSelected(_local7) && (!areOpponents(_local7, _local2))) {
if ((_local6 >= -1) && (!areOpponents(_local6, _local2))) {
if (_local11 == -1) {
if (areOpponents(_local9, _local2)) {
return(100);
}
}
}
}
_local9 = pieceInFrontRight(currentGridX, currentGridY, dir, 2);
if (getAvatarSelected(_local8) && (!areOpponents(_local8, _local2))) {
if ((_local6 >= -1) && (!areOpponents(_local6, _local2))) {
if (_local10 == -1) {
if (areOpponents(_local9, _local2)) {
return(100);
}
}
}
}
return(0);
}
function canIBridgeAvatar(piece, currentGridX, currentGridY, dir) {
var _local4 = pieceToLeft(currentGridX, currentGridY, dir, 2);
var _local5 = pieceToRight(currentGridX, currentGridY, dir, 2);
var _local8 = pieceInFront(currentGridX, currentGridY, dir, 2);
var _local9 = pieceInFrontRight(currentGridX, currentGridY, dir, 1);
var _local10 = pieceInFrontLeft(currentGridX, currentGridY, dir, 1);
var _local2 = piece.getID();
if (getAvatarSelected(_local4) && (!areOpponents(_local4, _local2))) {
if ((_local8 >= -1) && (areOpponents(_local4, _local2))) {
if (_local10 == -1) {
return(100);
}
}
}
if (getAvatarSelected(_local5) && (!areOpponents(_local5, _local2))) {
if ((_local8 >= -1) && (areOpponents(_local5, _local2))) {
if (_local9 == -1) {
return(100);
}
}
}
return(0);
}
function myTeamHasMorePieces(idx) {
var _local2 = Math.floor(idx / 12);
if (_totalNumCaptured[_local2] > _totalNumCaptured[_local2 ^ 1]) {
return(true);
}
return(false);
}
function teamHasPieceOnKingRow(idx, dir) {
var _local3 = ((dir > 0) ? 7 : 0);
var _local2 = 0;
while (_local2 < 8) {
if ((_checkerBoard[_local2][_local3] != -1) && (_checkerBoard[_local2][_local3] != idx)) {
if (!areOpponents(_checkerBoard[_local2][_local3], idx)) {
return(true);
}
}
_local2++;
}
return(false);
}
function numOnKingRow(idx, dir) {
var _local3 = ((dir > 0) ? 7 : 0);
var _local5 = 0;
var _local2 = 0;
while (_local2 < 8) {
if ((_checkerBoard[_local2][_local3] != -1) && (_checkerBoard[_local2][_local3] != idx)) {
if (!areOpponents(_checkerBoard[_local2][_local3], idx)) {
_local5++;
}
}
_local2++;
}
return(_local5);
}
function sacrificePieceToReappearOnKing(idx, dir) {
if ((!myTeamHasMorePieces(idx)) && (teamHasPieceOnKingRow(idx, dir))) {
return(true);
}
return(false);
}
function considerConsequences(piece, currentX, currentY, dir, movingForward) {
var _local3 = Math.floor((currentX - _boardBaseX) / SQUARE_WIDTH);
var _local5 = Math.floor((currentY - _boardBaseY) / SQUARE_HEIGHT);
var _local4 = 0;
var _local10 = piece.getID();
var _local9 = willGetJumped(piece, _local3, _local5, dir);
if (_local9 > 0) {
_local4 = -50;
if (getAvatarSelected(_local10)) {
}
if (_difficultyLevel >= 1) {
if (sacrificePieceToReappearOnKing(_local10, dir)) {
_local4 = 450;
} else if ((_local9 > 1) && (_difficultyLevel == 2)) {
_local4 = -100;
}
if (_difficultyLevel == 2) {
if (sacrificePieceToMoveAvatarBackward(piece, _local3, _local5, dir)) {
_local4 = _local4 + 500;
}
}
}
} else if (_checkerBoard[_local3][_local5] == -1) {
var _local7 = pieceInFrontRight(_local3, _local5, dir, 1);
var _local8 = pieceInFrontRight(_local3, _local5, dir, 2);
if ((_local7 > -1) && (!areOpponents(_local7, piece.getID()))) {
if ((_local8 > -1) && (areOpponents(_local8, piece.getID()))) {
_local4 = 200;
}
}
_local7 = pieceInFrontLeft(_local3, _local5, dir, 1);
_local8 = pieceInFrontLeft(_local3, _local5, dir, 2);
if ((_local7 > -1) && (!areOpponents(_local7, piece.getID()))) {
if ((_local8 > -1) && (areOpponents(_local8, piece.getID()))) {
_local4 = 200;
}
}
if (_difficultyLevel >= 1) {
_local4 = _local4 + canICreateAlleyForAvatar(piece, _local3, _local5, dir);
if (((_local3 == 0) || (_local3 == 7)) && ((_local5 >= 1) || (_local3 <= 6))) {
_local4 = _local4 + 125;
}
if ((_numMoves > 5) && (getAvatarSelected(piece.getID()) && (movingForward))) {
_local4 = _local4 + 150;
}
} else if (getAvatarSelected(piece.getID()) && (movingForward)) {
_local4 = _local4 + 150;
}
_local4 = _local4 + canMoveToKingRow(piece, _local3, _local5, dir);
if (!getAvatarSelected(piece.getID())) {
_local4 = _local4 + canIBridgeAvatar(piece, _local3, _local5, dir);
}
}
return(_local4);
}
function setGotKinged() {
_gotKinged = true;
}
function setJumpingAgain(idx) {
_jumpingAgain = idx;
}
function getJumpingAgain() {
return(_jumpingAgain);
}
function copyBoard() {
var _local3 = 0;
while (_local3 < 8) {
var _local2 = 0;
while (_local2 < 8) {
_checkerBoardCopy[_local3][_local2] = _checkerBoard[_local3][_local2];
_local2++;
}
_local3++;
}
}
function canJumpAgainFromHere(myID, startingGridX, startingGridY, currentGridX, currentGridY) {
if ((((currentGridX < 0) || (currentGridY < 0)) || (currentGridX > 7)) || (currentGridY > 7)) {
return(false);
}
var _local3 = (startingGridX + currentGridX) / 2;
var _local4 = (startingGridY + currentGridY) / 2;
var _local7 = _checkerBoardCopy[_local3][_local4];
if (_local7 < 0) {
return(false);
}
if (!areOpponents(myID, _local7)) {
return(false);
}
if (_checkerBoardCopy[currentGridX][currentGridY] != -1) {
return(false);
}
_checkerBoardCopy[_local3][_local4] = -1;
return(true);
}
function getJumpValue(myID, currentX, currentY, dir) {
var _local6 = currentX;
var _local5 = currentY;
var _local3;
var _local4;
var _local10 = getSquareWidth();
var _local9 = getSquareHeight();
var _local7 = 0;
_local3 = _local6 + 2;
_local4 = _local5 + (2 * dir);
if (canJumpAgainFromHere(myID, _local6, _local5, _local3, _local4)) {
_local7 = _local7 + 100;
_local7 = _local7 + getJumpValue(myID, _local3, _local4, dir);
}
_local3 = _local6 - 2;
_local4 = _local5 + (2 * dir);
if (canJumpAgainFromHere(myID, _local6, _local5, _local3, _local4)) {
_local7 = _local7 + 100;
_local7 = _local7 + getJumpValue(myID, _local3, _local4, dir);
}
if (isKing(myID)) {
_local3 = _local6 + 2;
_local4 = _local5 - (2 * dir);
if (canJumpAgainFromHere(myID, _local6, _local5, _local3, _local4)) {
_local7 = _local7 + 100;
_local7 = _local7 + getJumpValue(myID, _local3, _local4, dir);
}
_local3 = _local6 - 2;
_local4 = _local5 - (2 * dir);
if (canJumpAgainFromHere(myID, _local6, _local5, _local3, _local4)) {
_local7 = _local7 + 100;
_local7 = _local7 + getJumpValue(myID, _local3, _local4, dir);
}
}
return(_local7);
}
static var BOARD_WIDTH = 448;
static var BOARD_HEIGHT = 336;
static var SQUARE_WIDTH = BOARD_WIDTH / 8;
static var SQUARE_HEIGHT = BOARD_HEIGHT / 8;
static var BOARD_BASE_OFFSET_X = 132;
static var BOARD_BASE_OFFSET_Y = 44;
static var NUM_ANIMS = 30;
static var MOVE_MOVE_FORWARD = 0;
static var MOVE_MOVE_BACKWARD = 1;
static var MOVE_CAPTURE_PIECE = 2;
static var _avatarStartingGridPos = [{x:4, y:0}, {x:3, y:7}];
static var _gameData = [{spriteName:"checker_blue_mc", clipName:"checker_blue", depth:1000, posX:300, posY:300}, {spriteName:"checker_red_mc", clipName:"checker_red", depth:1001, posX:200, posY:200}, {spriteName:"_mac", clipName:"mac", depth:1001, posX:200, posY:200}, {spriteName:"_bloo", clipName:"bloo", depth:1000, posX:300, posY:300}, {spriteName:"SelectSquare", clipName:"select", depth:1001, posX:200, posY:200}, {spriteName:"yellowSquare", clipName:"yellow", depth:1001, posX:200, posY:200}, {spriteName:"square_white", clipName:"square", depth:1001, posX:200, posY:200}, {spriteName:"square_dark", clipName:"square", depth:1001, posX:200, posY:200}, {spriteName:"_Titlecard", clipName:"titlecard", depth:1001, posX:200, posY:200}];
static var NUM_AVATAR_ANIMS = 8;
static var NUM_PIECE_ANIMS = 7;
static var _animData = [{anim:"MacIdle", animAction:"Idle", startFrame:2, endFrame:17, looping:true, frameRate:24, nextAnim:"null", entType:0}, {anim:"MacJumpForPiece", animAction:"JumpBackwardNoPiece", startFrame:82, endFrame:107, looping:false, frameRate:48, nextAnim:"null", entType:0}, {anim:"MacJumpTakeoff1", animAction:"JumpForwardNoPiece", startFrame:108, endFrame:133, looping:false, frameRate:48, nextAnim:"null", entType:0}, {anim:"MacJumpTakeoff2", animAction:"JumpBackwardPiece", startFrame:134, endFrame:165, looping:false, frameRate:48, nextAnim:"MacJumpHold2", entType:0}, {anim:"MacJumpHold2", animAction:"JumpForwardPiece", startFrame:166, endFrame:198, looping:false, frameRate:48, nextAnim:"MacJumpLand2", entType:0}, {anim:"MacSlide", animAction:"Slide", startFrame:18, endFrame:23, looping:false, frameRate:24, nextAnim:"null", entType:0}, {anim:"MacDisappear", animAction:"Disappear", startFrame:42, endFrame:61, looping:false, frameRate:48, nextAnim:"null", entType:0}, {anim:"MacReappear", animAction:"Reappear", startFrame:62, endFrame:81, looping:false, frameRate:48, nextAnim:"null", entType:0}, {anim:"BlooIdle", animAction:"Idle", startFrame:2, endFrame:17, looping:true, frameRate:24, nextAnim:"null", entType:1}, {anim:"BlooJumpTakeoff1", animAction:"JumpForwardNoPiece", startFrame:108, endFrame:133, looping:false, frameRate:24, nextAnim:"null", entType:1}, {anim:"BlooJumpForPiece", animAction:"JumpBackwardNoPiece", startFrame:82, endFrame:107, looping:false, frameRate:24, nextAnim:"null", entType:1}, {anim:"BlooJumpTakeoff2", animAction:"JumpBackwardPiece", startFrame:134, endFrame:165, looping:false, frameRate:48, nextAnim:"BlooJumpHold2", entType:1}, {anim:"BlooJumpHold2", animAction:"JumpForwardPiece", startFrame:166, endFrame:198, looping:false, frameRate:48, nextAnim:"BlooJumpLand2", entType:1}, {anim:"BlooSlide", animAction:"Slide", startFrame:18, endFrame:23, looping:false, frameRate:24, nextAnim:"null", entType:1}, {anim:"BlooDisappear", animAction:"Disappear", startFrame:42, endFrame:61, looping:false, frameRate:48, nextAnim:"null", entType:1}, {anim:"BlooReappear", animAction:"Reappear", startFrame:62, endFrame:81, looping:false, frameRate:48, nextAnim:"null", entType:1}, {anim:"pieceIdle", animAction:"Idle", startFrame:2, endFrame:2, looping:false, frameRate:24, nextAnim:"null", entType:2}, {anim:"pieceOver", animAction:"Over", startFrame:11, endFrame:11, looping:false, frameRate:24, nextAnim:"null", entType:2}, {anim:"pieceJumpRU", animAction:"JumpRightUp", startFrame:21, endFrame:37, looping:false, frameRate:48, nextAnim:"null", entType:2}, {anim:"pieceJumpRD", animAction:"JumpRightDown", startFrame:55, endFrame:71, looping:false, frameRate:48, nextAnim:"null", entType:2}, {anim:"pieceJumpLU", animAction:"JumpLeftUp", startFrame:89, endFrame:105, looping:false, frameRate:48, nextAnim:"null", entType:2}, {anim:"pieceJumpLD", animAction:"JumpLeftDown", startFrame:123, endFrame:139, looping:false, frameRate:48, nextAnim:"null", entType:2}, {anim:"pieceDisappear", animAction:"Disappear", startFrame:190, endFrame:243, looping:false, frameRate:24, nextAnim:"null", entType:2}, {anim:"pieceKingIdle", animAction:"KingIdle", startFrame:7, endFrame:7, looping:false, frameRate:48, nextAnim:"null", entType:2}, {anim:"pieceKingOver", animAction:"KingOver", startFrame:15, endFrame:15, looping:false, frameRate:48, nextAnim:"null", entType:2}, {anim:"pieceKingJumpRU", animAction:"JumpKingRightUp", startFrame:38, endFrame:54, looping:false, frameRate:48, nextAnim:"null", entType:2}, {anim:"pieceKingJumpRD", animAction:"JumpKingRightDown", startFrame:72, endFrame:88, looping:false, frameRate:48, nextAnim:"null", entType:2}, {anim:"pieceKingJumpLU", animAction:"JumpKingLeftUp", startFrame:106, endFrame:122, looping:false, frameRate:48, nextAnim:"null", entType:2}, {anim:"pieceKingJumpLD", animAction:"JumpKingLeftDown", startFrame:140, endFrame:156, looping:false, frameRate:48, nextAnim:"null", entType:2}, {anim:"pieceKingDisappear", animAction:"KingDisappear", startFrame:269, endFrame:322, looping:false, frameRate:24, nextAnim:"null", entType:2}, {anim:"pieceKinged", animAction:"Kinged", startFrame:323, endFrame:350, looping:false, frameRate:24, nextAnim:"null", entType:2}];
}
Symbol 417 MovieClip [__Packages.Base.SpriteEntity] Frame 0
class Base.SpriteEntity
{
var _entityType, _id, _spName, _clName, _gameContext, _mc, _clipWidth, _clipHeight, _centerPoint, _startFrame, _endFrame, _framerate, _loopAnim, _animate, _animateTimer, _lastFrame, _c, _flipped, _mouseIsOver, _mouseRollOn, _mouseRollOff, _children, _moveSpeed, _destPosX, _destPosY, _startingPositionX, _startingPositionY, _faceDir;
function SpriteEntity (gameContext, eType, id, spName, clName, depth, posX, posY, centerPoint, wth, hgt) {
_entityType = eType;
_id = id;
_spName = spName;
_clName = clName;
_gameContext = gameContext;
_mc = gameContext.getParent().attachMovie(spName, clName, depth);
_mc._visible = true;
_mc._x = posX;
_mc._y = posY;
_clipWidth = ((wth > 0) ? (wth) : (_mc._width));
_clipHeight = ((hgt > 0) ? (hgt) : (_mc._height));
_centerPoint = centerPoint;
_startFrame = 0;
_endFrame = 0;
_framerate = 30;
_loopAnim = false;
_animate = false;
_animateTimer = 0;
_lastFrame = 0;
_c = 1;
_flipped = false;
_mc.gotoAndStop(_c);
_mouseIsOver = false;
_mouseRollOn = false;
_mouseRollOff = false;
_children = [];
}
function setMoveSpeed(speed) {
_moveSpeed = speed;
}
function setDestPosX(pos) {
_destPosX = pos;
}
function setDestPosY(pos) {
_destPosY = pos;
}
function setStartingPositionToPosition() {
_startingPositionX = getPositionX();
_startingPositionY = getPositionY();
}
function getMoveSpeed() {
return(_moveSpeed);
}
function getDestPosX() {
return(_destPosX);
}
function getDestPosY() {
return(_destPosY);
}
function getStartingPositionX() {
return(_startingPositionX);
}
function getStartingPositionY() {
return(_startingPositionY);
}
function isAtDestination() {
return((((_mc._x == _destPosX) && (_mc._y == _destPosY)) ? true : false));
}
function addChild(childName, upperLeftX, upperLeftY, w, h) {
_children.push(childName);
_mc[childName]._animiateChild = false;
_mc[childName]._lastChildFrame = 0;
_mc[childName]._startChildFrame = 1;
_mc[childName]._endChildFrame = 1;
_mc[childName]._childFramerate = 0;
_mc[childName]._childAnimateTimer = 0;
_mc[childName]._looping = false;
_mc[childName]._currentChildFrame = 0;
_mc[childName]._upperLeftX = upperLeftX;
_mc[childName]._upperLeftY = upperLeftY;
_mc[childName]._w = w;
_mc[childName]._h = h;
_mc[childName].gotoAndStop(_mc[childName]._startChildFrame);
}
function getMovieClip() {
return(_mc);
}
function getType() {
return(_entityType);
}
function setZDepth(depth) {
_mc.swapDepths(depth);
}
function getZDepth() {
return(_mc.getDepth());
}
function moveToFrame(frame) {
_mc.gotoAndStop(frame);
_lastFrame = frame;
}
function getCurrentFrame() {
return(_mc._currentframe);
}
function setPosition(x, y) {
_mc._x = x;
_mc._y = y;
}
function setPositionX(x) {
_mc._x = x;
}
function setPositionY(y) {
_mc._y = y;
}
function setPositionXY(x, y) {
setPositionX(x);
setPositionY(y);
}
function setVisibility(vis) {
_mc._visible = vis;
}
function setRotation(angle) {
_mc._rotation = angle;
}
function setFaceDir(num) {
_faceDir = num;
}
function getFaceDir() {
return(_faceDir);
}
function setFlipped() {
_flipped = (_flipped ? false : true);
_mc._xscale = _mc._xscale * -1;
}
function isFlipped() {
return(_flipped);
}
function playFlipped() {
if (_flipped) {
return(undefined);
}
_flipped = true;
_mc._xscale = _mc._xscale * -1;
}
function playUnflipped() {
if (_flipped) {
_mc._xscale = _mc._xscale * -1;
}
_flipped = false;
}
function changeSprite(spName, clName) {
var _local4 = _mc.getDepth();
var _local3 = _mc._x;
var _local2 = _mc._y;
_mc.removeMovieClip();
_spName = spName;
_clName = clName;
_mc = _gameContext.getParent().attachMovie(spName, clName, _local4);
_mc._visible = true;
_mc._x = _local3;
_mc._y = _local2;
}
function startAnimating(startFrame, endFrame, framerate, loopAnim) {
_c = startFrame;
_startFrame = startFrame;
_endFrame = endFrame;
_framerate = 1 / framerate;
_loopAnim = loopAnim;
_animate = true;
_animateTimer = _framerate;
moveToFrame(startFrame);
}
function getStartFrame() {
return(_startFrame);
}
function animateSprite() {
_animateTimer = _animateTimer - _gameContext.getDT();
if (_animateTimer <= 0) {
_animateTimer = _framerate;
if (_startFrame <= _endFrame) {
_c++;
if (_c > _endFrame) {
if (_loopAnim) {
_c = _startFrame;
} else {
doneAnimating();
_c = _endFrame;
return(1);
}
}
} else {
_c--;
if (_c < _endFrame) {
if (_loopAnim) {
_c = _startFrame;
} else {
doneAnimating();
_c = _endFrame;
return(1);
}
}
}
moveToFrame(_c);
}
return(0);
}
function isAnimating() {
return(_animate);
}
function doneAnimating() {
_animate = false;
}
function startAnimatingChild(child, startFrame, endFrame, framerate, looping) {
_mc[child]._startChildFrame = startFrame;
_mc[child]._endChildFrame = endFrame;
_mc[child]._childFramerate = 1 / framerate;
_mc[child]._childAnimateTimer = 0;
_mc[child]._looping = looping;
_mc[child]._currentChildFrame = startFrame;
_mc[child]._animateChild = true;
_mc[child]._childAnimateTimer = _mc[child]._childFramerate;
_mc[child].gotoAndStop(_mc[child]._startFrame);
}
function animateChild(child) {
if (!_mc[child]._animateChild) {
return(undefined);
}
_mc[child]._childAnimateTimer = _mc[child]._childAnimateTimer - _gameContext.getDT();
if (_mc[child]._childAnimateTimer <= 0) {
_mc[child]._childAnimateTimer = _mc[child]._childFramerate;
if (_mc[child]._startChildFrame < _mc[child]._endChildFrame) {
_mc[child]._currentChildFrame++;
if (_mc[child]._currentChildFrame > _mc[child]._endChildFrame) {
if (_mc[child]._looping) {
_mc[child]._currentChildFrame = _mc[child]._startChildFrame;
} else {
childDoneAnimating(child);
_mc[child]._currentChildFrame = _mc[child]._endChildFrame;
}
}
} else {
_mc[child]._currentChildFrame--;
if (_mc[child]._currentChildFrame < _mc[child]._endChildFrame) {
if (_mc[child]._looping) {
_mc[child]._currentChildFrame = _mc[child]._startChildFrame;
} else {
childDoneAnimating(child);
_mc[child]._currentChildFrame = _mc[child]._endChildFrame;
}
}
}
_mc[child].gotoAndStop(_mc[child]._currentChildFrame);
}
}
function isMouseOverChild(child) {
if (_mc[child]._visible == false) {
return(false);
}
var _local4 = (_mc._x + _mc[child]._x) + _mc[child]._upperLeftX;
var _local6 = _local4 + _mc[child]._w;
var _local3 = (_mc._y + _mc[child]._y) + _mc[child]._upperLeftY;
var _local5 = _local3 + _mc[child]._h;
if ((((_gameContext.getPadManager().getMousePosX() < _local4) || (_gameContext.getPadManager().getMousePosX() > _local6)) || (_gameContext.getPadManager().getMousePosY() < _local3)) || (_gameContext.getPadManager().getMousePosY() > _local5)) {
return(false);
}
return(true);
}
function handCursor(child, use) {
_mc[child].useHandCursor = use;
}
function getChildMouseIsOver() {
var _local3 = _children.length;
var _local2 = 0;
while (_local2 < _local3) {
if (isMouseOverChild(_children[_local2])) {
return(_children[_local2]);
}
_local2++;
}
return(null);
}
function getChildCurrentAnimFrame(child) {
return(_mc[child]._currentChildFrame);
}
function childDoneAnimating(child) {
_mc[child]._animateChild = false;
}
function isChildAnimating(child) {
return(_mc[child]._animateChild);
}
function moveChildToFrame(child, frame) {
_mc[child].gotoAndStop(frame);
}
function getID() {
return(_id);
}
function getGameContext() {
return(_gameContext);
}
function getPositionX() {
return(_mc._x);
}
function getPositionY() {
return(_mc._y);
}
function getArea() {
return(_clipWidth * _clipHeight);
}
function getWidth() {
return(_clipWidth);
}
function getHeight() {
return(_clipHeight);
}
function getClipName() {
return(_clName);
}
function isVisible() {
return(_mc._visible);
}
function scaleSprite(scale) {
_mc._xscale = _mc._xscale * scale;
_mc._yscale = _mc._yscale * scale;
}
function removeSprite() {
_mc.removeMovieClip();
}
function isMouseRollOn() {
return(_mouseRollOn);
}
function isMouseRollOff() {
return(_mouseRollOff);
}
function isMouseOver() {
var _local6 = false;
if (_mouseIsOver) {
_mouseRollOn = false;
_local6 = true;
} else {
_mouseRollOn = true;
}
_mouseRollOff = false;
_mouseIsOver = false;
if (_mc._visible == false) {
return(false);
}
var _local4 = _mc._x - (_clipWidth / 2);
var _local5 = _mc._x + (_clipWidth / 2);
var _local2 = _mc._y - _clipHeight;
var _local3 = _mc._y;
if (_centerPoint == 1) {
_local2 = _mc._y - (_clipHeight / 2);
_local3 = _mc._y + (_clipHeight / 2);
}
if (_centerPoint == 2) {
_local4 = _mc._x;
_local5 = _mc._x + _clipWidth;
_local2 = _mc._y;
_local3 = _mc._y + _clipHeight;
}
if (_centerPoint == 3) {
_local4 = _mc.x - _clipWidth;
_local5 = _mc.x;
_local2 = _mc._y - (_clipHeight / 2);
_local3 = _mc._y + (_clipHeight / 2);
}
if (_centerPoint == 4) {
_local4 = _mc._x + 10;
_local5 = _mc._x + 40;
_local2 = _mc._y - 35;
_local3 = _mc._y + 35;
}
if ((((_gameContext.getPadManager().getMousePosX() < _local4) || (_gameContext.getPadManager().getMousePosX() > _local5)) || (_gameContext.getPadManager().getMousePosY() < _local2)) || (_gameContext.getPadManager().getMousePosY() > _local3)) {
if (_local6) {
_mouseRollOff = true;
}
return(false);
}
_mouseIsOver = true;
return(true);
}
}
Symbol 418 MovieClip [__Packages.Base.Entity] Frame 0
class Base.Entity
{
var _cpuControlled, _gameContext, _currentAIState, _nextAIState, _id, _followingAIState, _networkControlled, _moveSpeed, _destPosX, _destPosY, _startingPositionX, _startingPositionY;
function Entity (gameContext, entType, id, cpuControlled, networkControlled, state) {
_cpuControlled = cpuControlled;
_gameContext = gameContext;
_currentAIState = null;
_nextAIState = new state[undefined](this);
_id = id;
}
function setNextState(state) {
_nextAIState = new state[undefined](this);
}
function setFollowingState(state) {
_followingAIState = state;
}
function getFollowingState() {
return(_followingAIState);
}
function getID() {
return(_id);
}
function isCPUControlled() {
return(_cpuControlled);
}
function isNetworkControlled() {
return(_networkControlled);
}
function setMoveSpeed(speed) {
_moveSpeed = speed;
}
function setDestPosX(pos) {
_destPosX = pos;
}
function setDestPosY(pos) {
_destPosY = pos;
}
function setStartingPositionToPosition() {
_startingPositionX = 0;
_startingPositionY = 0;
}
function getMoveSpeed() {
return(_moveSpeed);
}
function getDestPosX() {
return(_destPosX);
}
function getDestPosY() {
return(_destPosY);
}
function getStartingPositionX() {
return(_startingPositionX);
}
function getStartingPositionY() {
return(_startingPositionY);
}
function isAtDestination() {
return(true);
}
function Update() {
if (_currentAIState != _nextAIState) {
_currentAIState = _nextAIState;
_currentAIState.Entry(_gameContext);
} else if (_currentAIState == _nextAIState) {
if (_cpuControlled) {
_currentAIState.CPUDecision(_gameContext);
} else if (_networkControlled) {
_currentAIState.NetworkDecision(_gameContext);
} else {
_currentAIState.PadInput(_gameContext);
}
_currentAIState.Update(_gameContext);
if (_currentAIState != _nextAIState) {
_currentAIState.Exit(_gameContext);
delete _currentAIState;
if (!_nextAIState) {
return(1);
}
}
}
return(0);
}
}
Symbol 419 MovieClip [__Packages.Base.State] Frame 0
class Base.State
{
function State () {
}
function CPUDecision(gameContext) {
return(undefined);
}
function NetworkDecision(gameContext) {
return(undefined);
}
function PadInput(gameContext) {
return(undefined);
}
function Entry(gameContext) {
return(undefined);
}
function Update(gameContext) {
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
}
Symbol 420 MovieClip [__Packages.Base.AIState] Frame 0
class Base.AIState extends Base.State
{
function AIState () {
super();
}
function CPUDecision(gameContext) {
return(undefined);
}
function NetworkDecision(gameContext) {
return(undefined);
}
function PadInput(gameContext) {
return(undefined);
}
function Entry(gameContext) {
return(undefined);
}
function Update(gameContext) {
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
}
Symbol 421 MovieClip [__Packages.Game.SoundModule] Frame 0
class Game.SoundModule
{
var _mc, _hash, _num, _active_sounds, _fade_interval, _music_mute, _defaultVol, _curr_music, _fade_interval2;
function SoundModule (mc) {
_mc = mc;
_hash = {};
_num = 0;
_active_sounds = [];
_fade_interval = null;
_music_mute = _global.MUSIC_MUTE;
_defaultVol = 70;
}
function SoundAvailable() {
return(_active_sounds.length < 8);
}
function LoadSound(sound_name) {
_num++;
var _local3 = "mySound" + _num;
_mc.createEmptyMovieClip(_local3, _num);
var _local2 = new Sound(_mc[_local3]);
_local2.parent = this;
_local2.lastStart = 0;
_local2.onSoundComplete = function () {
this.parent.DeactivateSound(sound_name);
};
_hash[sound_name] = _local2;
return(_local2);
}
function SetMusicMute(oBool) {
_music_mute = oBool;
if (_music_mute == true) {
StopMusic();
} else {
PlayMusic(_curr_music);
}
}
function GetMusicMute() {
return(_music_mute);
}
function StopMusic() {
var _local2 = _active_sounds.length;
while (_local2--) {
if (_active_sounds[_local2].indexOf("music") != -1) {
StopSound(_active_sounds[_local2]);
break;
}
}
}
function GetCurMusic(Void) {
return(_curr_music);
}
function PlayMusic(str) {
if (str == "none") {
FadeSound("music_" + _curr_music, _global.MUSIC_VOL, 0, 0.5);
} else {
CrossFade("music_" + _curr_music, "music_" + str, 0.5);
_curr_music = str;
}
}
function DeactivateSound(snd) {
var _local2 = _active_sounds.length;
while (_local2--) {
if (snd == _active_sounds[_local2]) {
_active_sounds.splice(_local2, 1);
break;
}
}
}
function DeactivateAllSounds() {
_active_sounds = [];
}
function StopSound(snd) {
var _local2 = _hash[snd];
_local2.stop();
DeactivateSound(snd);
}
function soundIsPlaying(snd) {
for (var _local2 in _active_sounds) {
if (_active_sounds[_local2] == snd) {
return(true);
}
}
return(false);
}
function PlaySound(snd, vol, pan, offset, loop) {
if ((snd.indexOf("music") != -1) && (_music_mute == true)) {
return(undefined);
}
if ((snd.indexOf("collect") == -1) && (snd.indexOf("bonus") == -1)) {
for (var _local3 in _active_sounds) {
if (_active_sounds[_local3] == snd) {
return(undefined);
}
}
} else {
StopSound(snd);
}
if (_active_sounds.length < MAX_SOUNDS) {
var _local4 = _hash[snd];
if (vol == null) {
_local4.setVolume(_defaultVol);
} else {
_local4.setVolume(vol);
}
if (pan != null) {
_local4.setPan(pan);
}
if (offset == null) {
offset = 0;
}
if (loop == null) {
loop = 0;
}
_local4.start(offset, loop);
_active_sounds.push(snd);
}
}
function CrossFade(snd1, snd2, dur) {
FadeSound(snd1, _global.MUSIC_VOL, 0, dur);
PlaySound(snd2, 0, 0, 0, 9999);
FadeSound2(snd2, 0, _global.MUSIC_VOL, dur);
}
function FadeSound(snd, startVol, endVol, duration) {
if (_fade_interval != null) {
clearInterval(_fade_interval);
}
_hash[snd].setVolume(startVol);
if (endVol < startVol) {
var _local5 = -1;
} else {
var _local5 = 1;
}
var _local4 = (duration / Math.abs(endVol - startVol)) * 1000;
_fade_interval = setInterval(this, "Fade_Sound_Update", _local4, [snd, endVol, _local5]);
}
function FadeSound2(snd, startVol, endVol, duration) {
if (_fade_interval2 != null) {
clearInterval(_fade_interval2);
}
_hash[snd].setVolume(startVol);
if (endVol < startVol) {
var _local5 = -1;
} else {
var _local5 = 1;
}
var _local4 = (duration / Math.abs(endVol - startVol)) * 1000;
_fade_interval2 = setInterval(this, "Fade_Sound_Update2", _local4, [snd, endVol, _local5]);
}
function Fade_Sound_Update(sndAr) {
var _local3 = sndAr[0];
var _local5 = sndAr[1];
var _local4 = sndAr[2];
var _local2 = _hash[_local3].getVolume() + _local4;
if (((_local4 > 0) && (_local2 <= _local5)) || ((_local4 < 0) && (_local2 >= _local5))) {
_hash[_local3].setVolume(_local2);
if (_local2 <= 0) {
StopSound(_local3);
}
} else {
clearInterval(_fade_interval);
}
}
function Fade_Sound_Update2(sndAr) {
var _local3 = sndAr[0];
var _local5 = sndAr[1];
var _local4 = sndAr[2];
var _local2 = _hash[_local3].getVolume() + _local4;
if (((_local4 > 0) && (_local2 <= _local5)) || ((_local4 < 0) && (_local2 >= _local5))) {
_hash[_local3].setVolume(_local2);
if (_local2 <= 0) {
StopSound(_local3);
}
} else {
clearInterval(_fade_interval2);
}
}
function getSound(snd) {
return(_hash[snd]);
}
function toString() {
return("SoundModule()");
}
function unload() {
for (var _local3 in _hash) {
delete _hash[_local3];
}
var _local2 = 0;
while (_local2 < _num) {
_mc["mySound" + _num].removeMovieClip();
_local2++;
}
delete _hash;
}
static var MAX_SOUNDS = 16;
}
Symbol 422 MovieClip [__Packages.Game.Player] Frame 0
class Game.Player extends Base.Entity
{
var _gameContext, _idx, _charIdx, _controllingPiece, _numPieces, _playerName, _pieces, _pieceMoving, _moveTime, _pieceSelected, _avatar, _cpuControlled, _networkControlled;
function Player (gameContext, playerName, idx, charIdx, cpuControlled, networkControlled) {
super(gameContext, 0, idx, cpuControlled, networkControlled, Game.AIStates.InitPositionState);
_gameContext = gameContext;
_idx = idx;
_charIdx = charIdx;
_controllingPiece = -1;
_numPieces = 0;
_playerName = playerName;
_pieces = [];
_pieceMoving = -1;
_moveTime = 600;
Init();
}
function setPieceSelected(toSet) {
_pieceSelected = toSet;
}
function getPieceSelected() {
return(_pieceSelected);
}
function getNumPieces() {
return(_numPieces);
}
function getIndex() {
return(_idx);
}
function getID() {
return(_idx);
}
function getPiece(num) {
return(_pieces[num]);
}
function getAvatar() {
return(_avatar);
}
function oneOfMyPieces(num) {
var _local2 = false;
if (((num < 12) && (!_idx)) || ((num > 11) && (_idx == 1))) {
_local2 = true;
}
return(_local2);
}
function removePieces() {
var _local3 = _numPieces;
var _local2 = 0;
while (_local2 < _local3) {
removePiece(0);
_local2++;
}
}
function changeCPUPlayerToNetworkPlayer() {
_cpuControlled = false;
_networkControlled = true;
_controllingPiece = -1;
}
function Init() {
var _local10;
var _local9;
var _local7;
var _local8;
var _local2 = 0;
while (_local2 < 12) {
_local7 = _gameContext.getGameData().getSpriteName(_gameContext.getGameData().PLAYER_ON_TOP + _charIdx);
_local8 = _gameContext.getGameData().getClipName(_gameContext.getGameData().PLAYER_ON_TOP + _charIdx) + _local2;
var _local4 = _gameContext.getGameData().getBoardPosition(_local2 + (_idx * 12), 0);
var _local3 = _gameContext.getGameData().getBoardPosition(_local2 + (_idx * 12), 1);
var _local6 = Math.round((_local4 - _gameContext.getGameData().getBoardBaseX()) / _gameContext.getGameData().getSquareWidth());
var _local5 = Math.round((_local3 - _gameContext.getGameData().getBoardBaseY()) / _gameContext.getGameData().getSquareHeight());
if ((_local6 == _gameContext.getGameData().getAvatarStartingGridPosX(_idx)) && (_local5 == _gameContext.getGameData().getAvatarStartingGridPosY(_idx))) {
_local10 = _local4;
_local9 = _local3;
}
_pieces.push(new Base.SpriteEntity(_gameContext, 2, _local2 + (_idx * 12), _local7, _local8, 10000 + (_local2 + (_idx * 12)), _local4, _local3, 2, _gameContext.getGameData().getSquareWidth(), _gameContext.getGameData().getSquareHeight()));
_numPieces++;
_pieces[_local2].moveToFrame(2);
_pieces[_local2].inPlay = true;
_gameContext.getGameData().setPieceOnBoard(_local2 + (_idx * 12), _local4, _local3);
_local2++;
}
_local7 = _gameContext.getGameData().getSpriteName(_gameContext.getGameData().PIECE_ON_TOP + _charIdx);
_local8 = _gameContext.getGameData().getClipName(_gameContext.getGameData().PIECE_ON_TOP + _charIdx) + _charIdx;
_avatar = new Base.SpriteEntity(_gameContext, _idx, 32 + _idx, _local7, _local8, 11032 + _idx, _local10, _local9, 4, -1, -1);
_avatar.moveToFrame(2);
}
function removePiece(idx) {
_numPieces--;
_pieces[idx].removeSprite();
_pieces[idx].inPlay = false;
}
function killPieces() {
var _local3 = _pieces.length - 1;
var _local2 = _local3;
while (_local2 >= 0) {
_pieces[_local2].removeSprite();
_pieces[_local2].inPlay = false;
_pieces.pop();
_local2--;
}
}
}
Symbol 423 MovieClip [__Packages.Game.AIStates.InitPositionState] Frame 0
class Game.AIStates.InitPositionState extends Base.AIState
{
var _entity;
function InitPositionState (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
return(undefined);
}
function Update(gameContext) {
if (gameContext.getGameData().isMyTurn(_entity.getID())) {
_entity.setNextState(Game.AIStates.WaitForSelectState);
} else {
_entity.setNextState(Game.AIStates.WaitingForTurnState);
}
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
}
Symbol 424 MovieClip [__Packages.Game.AIStates.WaitForSelectState] Frame 0
class Game.AIStates.WaitForSelectState extends Base.AIState
{
var _entity, _someoneCanJump, _moveTimer, _mouseOverPiece, _piecePreSelected, _pieceSelected, _updateClockTimer, _sparklyDews, _reminderOn, _avatarRaised, _showMessageTimer, _timeToUpdateClock, _numTimesUpdated, _squaresHighlighted, _arrowSpeed, _arrowTimer, _blinkClockTimer, _startArrowFrame, _endArrowFrame, _currentArrowFrame, _numPiecesLeft, _onlyPieceLeft, _reminder;
function WaitForSelectState (entity) {
super();
_entity = entity;
_someoneCanJump = false;
_moveTimer = 10;
_mouseOverPiece = -1;
_piecePreSelected = -1;
_pieceSelected = -1;
_updateClockTimer = 2;
_sparklyDews = [];
}
function Entry(gameContext) {
var _local9 = true;
_reminderOn = false;
if (_entity.isCPUControlled()) {
_local9 = false;
if (gameContext.getGameData().getJumpingAgain() == -1) {
_moveTimer = 1 + (Math.random() * 2);
} else {
_moveTimer = 0;
}
} else {
_moveTimer = 600;
}
_avatarRaised = false;
_showMessageTimer = 4;
_timeToUpdateClock = _moveTimer / 360;
_numTimesUpdated = 0;
_updateClockTimer = _timeToUpdateClock;
gameContext.getGameData().playAnimation("Idle", _entity.getAvatar());
gameContext.getGameData().resetClockTimer();
_mouseOverPiece = -1;
_piecePreSelected = -1;
_pieceSelected = -1;
_squaresHighlighted = false;
_arrowSpeed = 2;
_arrowTimer = 2;
_blinkClockTimer = 0.25;
if (_entity.getID() == 1) {
_startArrowFrame = 1;
_endArrowFrame = 15;
} else {
_startArrowFrame = 16;
_endArrowFrame = 30;
}
_currentArrowFrame = _startArrowFrame;
gameContext.getGameData().updateArrow(_currentArrowFrame);
_numPiecesLeft = 0;
_onlyPieceLeft = -1;
var _local2 = 0;
while (_local2 < 12) {
if (!_entity.getPiece(_local2).inPlay) {
} else if ((gameContext.getGameData().getJumpingAgain() > -1) && (gameContext.getGameData().getJumpingAgain() != _entity.getPiece(_local2).getID())) {
} else {
_numPiecesLeft++;
_onlyPieceLeft = _entity.getPiece(_local2).getID();
if (gameContext.getGameData().canJumpAgain(_entity.getPiece(_local2), _entity.getPiece(_local2).getPositionX(), _entity.getPiece(_local2).getPositionY(), _local9)) {
_someoneCanJump = true;
var _local7 = _sparklyDews.length;
var _local8 = _local7 + 15;
var _local3 = _local7;
while (_local3 < _local8) {
var _local6 = _entity.getPiece(_local2).getPositionX() + (Math.random() * gameContext.getGameData().getSquareWidth());
var _local5 = _entity.getPiece(_local2).getPositionY() + (Math.random() * gameContext.getGameData().getSquareHeight());
_sparklyDews.push(new Base.SpriteEntity(gameContext, 5, 100, "sparkly_dews", "dews", 50600 + _sparklyDews.length, _local6, _local5, 2, -1, -1));
_sparklyDews[_local3].startAnimating(1, 12, 5 + (Math.random() * 50), false);
_sparklyDews[_local3].xBase = _entity.getPiece(_local2).getPositionX();
_sparklyDews[_local3].yBase = _entity.getPiece(_local2).getPositionY();
_sparklyDews[_local3].setVisibility(false);
_local3++;
}
}
}
_local2++;
}
return(undefined);
}
function NetworkDecision(gameContext) {
return(undefined);
}
function CPUDecision(gameContext) {
if (_moveTimer > 0) {
_moveTimer = _moveTimer - gameContext.getDT();
gameContext.getGameData().updateCPUThinking();
if (_moveTimer <= 0) {
gameContext.getGameData().stopCPUThinking();
}
return(undefined);
}
var _local4 = gameContext.getGameData().getTeamDir(_entity.getID());
var _local10 = gameContext.getGameData().getSquareWidth();
var _local9 = gameContext.getGameData().getSquareHeight();
var _local6 = 0;
var _local17 = 0;
var _local16 = 0;
var _local2;
var _local8 = 0;
var _local14 = false;
var _local12 = 0;
while (_local12 < 12) {
var _local3 = 0;
_local14 = false;
_local6 = 0;
_local2 = _entity.getPiece(_local12);
if (!_entity.getPiece(_local12).inPlay) {
} else if ((gameContext.getGameData().getJumpingAgain() > -1) && (gameContext.getGameData().getJumpingAgain() != _entity.getPiece(_local12).getID())) {
} else if (_someoneCanJump && (!gameContext.getGameData().canJumpAgain(_entity.getPiece(_local12), _entity.getPiece(_local12).getPositionX(), _entity.getPiece(_local12).getPositionY()))) {
} else {
var _local11 = gameContext.getGameData().getGridX(_local2.getPositionX());
var _local7 = gameContext.getGameData().getGridY(_local2.getPositionY());
if (gameContext.getGameData().isValidMove(_local2, _local2.getPositionX() + _local10, _local2.getPositionY() + (_local9 * _local4), false, false)) {
_local3 = 50 + (Math.random() * 50);
var _local15 = gameContext.getGameData().aboutToGetJumped(_entity.getPiece(_local12), _entity.getPiece(_local12).getPositionX(), _entity.getPiece(_local12).getPositionY(), _local4);
if (_local15 == 2) {
if (gameContext.getGameData().sacrificePieceToReappearOnKing(_local2.getID(), _local4)) {
_local3 = 1;
} else {
_local3 = _local3 + 50;
}
}
_local3 = _local3 + gameContext.getGameData().considerConsequences(_local2, _local2.getPositionX() + _local10, _local2.getPositionY() + (_local9 * _local4), _local4, true);
if (gameContext.getGameData().wasBlockingJump(_local11, _local7, _local4, _local2.getID())) {
_local3 = 1;
}
if (!_someoneCanJump) {
if (((_local4 > 0) && (_local7 == 6)) || ((_local4 < 0) && (_local7 == 1))) {
_local3 = 3000;
}
_local6 = _local3;
_local8 = MOVE_FORWARD_AND_RIGHT;
}
if (_local6 < 1) {
_local6 = 1;
_local8 = MOVE_FORWARD_AND_RIGHT;
}
}
if (gameContext.getGameData().isValidMove(_local2, _local2.getPositionX() - _local10, _local2.getPositionY() + (_local9 * _local4), false, false)) {
_local3 = 50 + (Math.random() * 50);
var _local15 = gameContext.getGameData().aboutToGetJumped(_entity.getPiece(_local12), _entity.getPiece(_local12).getPositionX(), _entity.getPiece(_local12).getPositionY(), _local4);
if (_local15 == 1) {
if (gameContext.getGameData().sacrificePieceToReappearOnKing(_local2.getID(), _local4)) {
_local3 = 1;
} else {
_local3 = _local3 + 50;
}
}
_local3 = _local3 + gameContext.getGameData().considerConsequences(_local2, _local2.getPositionX() - _local10, _local2.getPositionY() + (_local9 * _local4), _local4, true);
if (gameContext.getGameData().wasBlockingJump(_local11, _local7, _local4, _local2.getID())) {
_local3 = 1;
}
if ((!_someoneCanJump) && (_local3 > _local6)) {
_local6 = _local3;
_local8 = MOVE_FORWARD_AND_LEFT;
}
if (_local6 < 1) {
_local6 = 1;
_local8 = MOVE_FORWARD_AND_LEFT;
}
}
if (gameContext.getGameData().isKing(_local2.getID())) {
if (gameContext.getGameData().isValidMove(_local2, _local2.getPositionX() + _local10, _local2.getPositionY() - (_local9 * _local4), false, false)) {
_local3 = 50 + (Math.random() * 50);
if (gameContext.getGameData().numOnKingRow(_local2.getID(), _local4) == 0) {
_local3 = 1;
}
if (gameContext.getGameData().getAvatarSelected(_local2.getID())) {
_local3 = 2;
}
_local3 = _local3 + gameContext.getGameData().considerConsequences(_local2, _local2.getPositionX() + _local10, _local2.getPositionY() - (_local9 * _local4), _local4, false);
if ((!_someoneCanJump) && (_local3 > _local6)) {
if (((_local4 > 0) && (_local7 == 6)) || ((_local4 < 0) && (_local7 == 1))) {
_local3 = 3000;
}
_local6 = _local3;
_local8 = MOVE_BACKWARD_AND_RIGHT;
}
if (_local6 < 1) {
_local6 = 1;
_local8 = MOVE_BACKWARD_AND_RIGHT;
}
}
if (gameContext.getGameData().isValidMove(_local2, _local2.getPositionX() - _local10, _local2.getPositionY() - (_local9 * _local4), false, false)) {
_local3 = 50 + (Math.random() * 50);
if (gameContext.getGameData().numOnKingRow(_local2.getID(), _local4) == 0) {
_local3 = 1;
}
if (gameContext.getGameData().getAvatarSelected(_local2.getID())) {
_local3 = 2;
}
_local3 = _local3 + gameContext.getGameData().considerConsequences(_local2, _local2.getPositionX() - _local10, _local2.getPositionY() - (_local9 * _local4), _local4, false);
if ((!_someoneCanJump) && (_local3 > _local6)) {
_local6 = _local3;
_local8 = MOVE_BACKWARD_AND_LEFT;
}
if (_local6 < 1) {
_local6 = 1;
_local8 = MOVE_BACKWARD_AND_LEFT;
}
}
}
var _local13 = false;
if (gameContext.getGameData().isValidMove(_local2, _local2.getPositionX() + (_local10 * 2), _local2.getPositionY() + ((_local9 * 2) * _local4), false, false)) {
_local3 = 550 + (Math.random() * 100);
_local13 = true;
if (((_local7 + (2 * _local4)) == 7) || ((_local7 + (2 * _local4)) == 0)) {
_local3 = _local3 + 1000;
}
gameContext.getGameData().copyBoard();
_local3 = _local3 + gameContext.getGameData().getJumpValue(_local2.getID(), _local11 + 2, _local7 + (2 * _local4), _local4);
if (((_local4 > 0) && (_local7 == 5)) || ((_local4 < 0) && (_local7 == 2))) {
_local3 = 3000;
}
if (_local3 > _local6) {
_local6 = _local3;
_local8 = JUMP_FORWARD_AND_RIGHT;
}
if (_local6 < 1) {
_local6 = 1;
_local8 = JUMP_FORWARD_AND_RIGHT;
}
}
if (gameContext.getGameData().isValidMove(_local2, _local2.getPositionX() - (_local10 * 2), _local2.getPositionY() + ((_local9 * 2) * _local4), false, false)) {
_local3 = 550 + (Math.random() * 100);
_local13 = true;
if (((_local7 + (2 * _local4)) == 7) || ((_local7 + (2 * _local4)) == 0)) {
_local3 = _local3 + 1000;
}
gameContext.getGameData().copyBoard();
_local3 = _local3 + gameContext.getGameData().getJumpValue(_local2.getID(), _local11 - 2, _local7 + (2 * _local4), _local4);
if (((_local4 > 0) && (_local7 == 5)) || ((_local4 < 0) && (_local7 == 2))) {
_local3 = 3000;
}
if (_local3 > _local6) {
_local6 = _local3;
_local8 = JUMP_FORWARD_AND_LEFT;
}
if (_local6 < 1) {
_local6 = 1;
_local8 = JUMP_FORWARD_AND_LEFT;
}
}
if (gameContext.getGameData().isKing(_local2.getID())) {
if (gameContext.getGameData().isValidMove(_local2, _local2.getPositionX() + (_local10 * 2), _local2.getPositionY() - ((_local9 * 2) * _local4), false, false)) {
_local3 = 550 + (Math.random() * 100);
gameContext.getGameData().copyBoard();
_local3 = _local3 + gameContext.getGameData().getJumpValue(_local2.getID(), _local11 + 2, _local7 - (2 * _local4), _local4);
if (_local3 > _local6) {
_local6 = _local3;
_local8 = JUMP_BACKWARD_AND_RIGHT;
}
if (_local6 < 1) {
_local6 = 1;
_local8 = JUMP_BACKWARD_AND_RIGHT;
}
_local14 = true;
}
if (gameContext.getGameData().isValidMove(_local2, _local2.getPositionX() - (_local10 * 2), _local2.getPositionY() - ((_local9 * 2) * _local4), false, false)) {
_local3 = 550 + (Math.random() * 100);
gameContext.getGameData().copyBoard();
_local3 = _local3 + gameContext.getGameData().getJumpValue(_local2.getID(), _local11 - 2, _local7 - (2 * _local4), _local4);
if (_local3 > _local6) {
_local6 = _local3;
_local8 = JUMP_BACKWARD_AND_LEFT;
}
if (_local6 < 1) {
_local6 = 1;
_local8 = JUMP_BACKWARD_AND_LEFT;
}
_local14 = true;
}
}
if (_local6 > _local16) {
_local16 = _local6;
_local17 = _local8;
_pieceSelected = _local12;
}
}
_local12++;
}
if ((_numPiecesLeft == 1) && (_local8 == 0)) {
gameContext.getGameData().setWinner(_entity.getID() ^ 1);
var _local18 = _sparklyDews.length;
_local12 = 0;
while (_local12 < _local18) {
_sparklyDews[_local12].removeSprite();
_sparklyDews[0].pop;
_local12++;
}
return(undefined);
}
switch (_local17) {
case MOVE_FORWARD_AND_RIGHT :
_entity.getPiece(_pieceSelected).setDestPosX(_entity.getPiece(_pieceSelected).getPositionX() + _local10);
_entity.getPiece(_pieceSelected).setDestPosY(_entity.getPiece(_pieceSelected).getPositionY() + (_local9 * _local4));
break;
case MOVE_FORWARD_AND_LEFT :
_entity.getPiece(_pieceSelected).setDestPosX(_entity.getPiece(_pieceSelected).getPositionX() - _local10);
_entity.getPiece(_pieceSelected).setDestPosY(_entity.getPiece(_pieceSelected).getPositionY() + (_local9 * _local4));
break;
case JUMP_FORWARD_AND_RIGHT :
_entity.getPiece(_pieceSelected).setDestPosX(_entity.getPiece(_pieceSelected).getPositionX() + (_local10 * 2));
_entity.getPiece(_pieceSelected).setDestPosY(_entity.getPiece(_pieceSelected).getPositionY() + ((_local9 * 2) * _local4));
break;
case JUMP_FORWARD_AND_LEFT :
_entity.getPiece(_pieceSelected).setDestPosX(_entity.getPiece(_pieceSelected).getPositionX() - (_local10 * 2));
_entity.getPiece(_pieceSelected).setDestPosY(_entity.getPiece(_pieceSelected).getPositionY() + ((_local9 * 2) * _local4));
break;
case MOVE_BACKWARD_AND_RIGHT :
_entity.getPiece(_pieceSelected).setDestPosX(_entity.getPiece(_pieceSelected).getPositionX() + _local10);
_entity.getPiece(_pieceSelected).setDestPosY(_entity.getPiece(_pieceSelected).getPositionY() - (_local9 * _local4));
break;
case MOVE_BACKWARD_AND_LEFT :
_entity.getPiece(_pieceSelected).setDestPosX(_entity.getPiece(_pieceSelected).getPositionX() - _local10);
_entity.getPiece(_pieceSelected).setDestPosY(_entity.getPiece(_pieceSelected).getPositionY() - (_local9 * _local4));
break;
case JUMP_BACKWARD_AND_RIGHT :
_entity.getPiece(_pieceSelected).setDestPosX(_entity.getPiece(_pieceSelected).getPositionX() + (_local10 * 2));
_entity.getPiece(_pieceSelected).setDestPosY(_entity.getPiece(_pieceSelected).getPositionY() - ((_local9 * 2) * _local4));
break;
case JUMP_BACKWARD_AND_LEFT :
_entity.getPiece(_pieceSelected).setDestPosX(_entity.getPiece(_pieceSelected).getPositionX() - (_local10 * 2));
_entity.getPiece(_pieceSelected).setDestPosY(_entity.getPiece(_pieceSelected).getPositionY() - ((_local9 * 2) * _local4));
break;
}
return(undefined);
}
function PadInput(gameContext) {
var _local6 = 11;
var _local7 = 2;
var _local12 = 1;
gameContext.getGameData().updateCursor();
if (((gameContext.getGameData().getNumMessageMoves() == 10) && (!gameContext.getGameData().isMessageShown())) && (!gameContext.getGameData().isAvatarMoved())) {
if (!_reminderOn) {
_reminder = new Base.SpriteEntity(gameContext, 5, 100, "PopUp", "reminder", 50499, 210, 130, 2, -1, -1);
_reminder.addChild("btn_play", 5, 5, 110, 40);
_reminderOn = true;
}
var _local17 = _reminder.getChildMouseIsOver();
var _local10 = 1;
var _local11 = 10;
if (_reminder.isMouseOverChild("btn_play")) {
if ((!_reminder.isChildAnimating("btn_play")) && (_reminder.getChildCurrentAnimFrame("btn_play") <= 1)) {
_reminder.startAnimatingChild("btn_play", _local10, _local11, 60, false);
gameContext.getGameData().cursorOn();
}
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().cursorOff();
gameContext.getGameData().playSound(_global.SND_BTN2);
gameContext.getGameData().setMessageShown();
_reminder.removeSprite();
delete _reminder;
}
} else if ((!_reminder.isChildAnimating("btn_play")) && (_reminder.getChildCurrentAnimFrame("btn_play") == 10)) {
_local10 = 10;
_local11 = 1;
gameContext.getGameData().cursorOff();
_reminder.startAnimatingChild("btn_play", _local10, _local11, 60, false);
}
if (_reminder.isChildAnimating("btn_play")) {
_reminder.animateChild("btn_play");
}
return(undefined);
}
if (((_numPiecesLeft == 1) && (!gameContext.getGameData().canIMove(_entity.getPiece(_onlyPieceLeft % 12)))) && (!_someoneCanJump)) {
gameContext.getGameData().setWinner(_entity.getID() ^ 1);
var _local8 = _sparklyDews.length;
var _local5 = 0;
while (_local5 < _local8) {
_sparklyDews[_local5].removeSprite();
_sparklyDews[0].pop;
_local5++;
}
return(undefined);
}
if (_moveTimer > 0) {
_moveTimer = _moveTimer - gameContext.getDT();
_numTimesUpdated++;
var _local16 = gameContext.getDT() / _timeToUpdateClock;
gameContext.getGameData().updateClockTimer(_local16);
if (_moveTimer < 30) {
_blinkClockTimer = _blinkClockTimer - gameContext.getDT();
if (_blinkClockTimer < 0) {
_blinkClockTimer = 0.25;
gameContext.getGameData().blinkClockTimer();
gameContext.getGameData().playSound(_global.SND_TIMECOUNTDOWN);
}
}
if (_moveTimer <= 0) {
gameContext.getGameData().playSound(_global.SND_TIMEUP);
gameContext.getGameData().setWinner(_entity.getID() ^ 1);
var _local8 = _sparklyDews.length;
var _local5 = 0;
while (_local5 < _local8) {
_sparklyDews[_local5].removeSprite();
_sparklyDews[0].pop;
_local5++;
}
return(undefined);
}
}
if (_showMessageTimer > 0) {
_showMessageTimer = _showMessageTimer - gameContext.getDT();
if (_showMessageTimer <= 0) {
var _local13;
if (gameContext.getGameData().getCharacter() == 0) {
_local12 = 2;
} else {
_local12 = 3;
}
if (_someoneCanJump) {
_local13 = "YOU MUST JUMP PIECE";
} else {
_local13 = "Your turn to make a move";
}
gameContext.getGameData().showMessageString(_local13, _local12);
}
}
if (_piecePreSelected < 0) {
var _local4;
var _local5 = 0;
while (_local5 < 12) {
_local4 = _entity.getPiece(_local5);
if (!_entity.getPiece(_local5).inPlay) {
} else if ((gameContext.getGameData().getJumpingAgain() > -1) && (gameContext.getGameData().getJumpingAgain() != _entity.getPiece(_local5).getID())) {
} else if (_someoneCanJump && (!gameContext.getGameData().canJumpAgain(_local4, _local4.getPositionX(), _local4.getPositionY(), false))) {
} else {
var _local9 = true;
if (gameContext.getGameData().getAvatarSelected(_local4.getID())) {
_local9 = false;
}
_local6 = 11;
_local7 = 2;
if (_local9 && (gameContext.getGameData().isKing(_local4.getID()))) {
_local6 = 15;
_local7 = 7;
}
if (_local4.isMouseOver()) {
if ((_mouseOverPiece > -1) && (_mouseOverPiece != _local5)) {
if ((!gameContext.getGameData().getAvatarSelected(_entity.getPiece(_mouseOverPiece).getID())) && gameContext.getGameData().isKing(_entity.getPiece(_mouseOverPiece).getID())) {
_entity.getPiece(_mouseOverPiece).moveToFrame(7);
} else {
if (_avatarRaised && gameContext.getGameData().getAvatarSelected(_entity.getPiece(_mouseOverPiece).getID())) {
_avatarRaised = false;
_entity.getAvatar().setPositionY(_entity.getAvatar().getPositionY() + 5);
}
_entity.getPiece(_mouseOverPiece).moveToFrame(2);
}
}
if (_someoneCanJump || (gameContext.getGameData().canIMove(_local4))) {
gameContext.getGameData().cursorOn();
if (_local4.isMouseRollOn()) {
gameContext.getGameData().playSound(_global.SND_BTN2);
}
if ((!_local9) && (!_avatarRaised)) {
_avatarRaised = true;
_entity.getAvatar().setPositionY(_entity.getAvatar().getPositionY() - 5);
}
_local4.moveToFrame(_local6);
_mouseOverPiece = _local5;
}
} else if (_mouseOverPiece == _local5) {
gameContext.getGameData().cursorOff();
_local4.moveToFrame(_local7);
if (!_local9) {
if (_avatarRaised) {
_entity.getAvatar().setPositionY(_entity.getAvatar().getPositionY() + 5);
_avatarRaised = false;
}
}
_mouseOverPiece = -1;
}
}
_local5++;
}
if (_mouseOverPiece > -1) {
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().playSound(_global.SND_CLINK4);
var _local9 = true;
if (gameContext.getGameData().getAvatarSelected(_entity.getPiece(_mouseOverPiece).getID())) {
_local9 = false;
}
if (_local9 && (gameContext.getGameData().isKing(_entity.getPiece(_mouseOverPiece).getID()))) {
_entity.getPiece(_mouseOverPiece).moveToFrame(7);
} else {
_entity.getPiece(_mouseOverPiece).moveToFrame(2);
}
_piecePreSelected = _mouseOverPiece;
if (!_local9) {
if (_avatarRaised) {
_entity.getAvatar().setPositionY(_entity.getAvatar().getPositionY() + 5);
_avatarRaised = false;
}
}
if (!_someoneCanJump) {
_squaresHighlighted = true;
gameContext.getGameData().highlightMoveSquares(_entity.getPiece(_mouseOverPiece));
} else {
gameContext.getGameData().highlightSquareUsingEntity(_entity.getPiece(_mouseOverPiece));
}
}
}
} else {
gameContext.getGameData().animateSquares();
if (gameContext.getPadManager().getMouseJustPressed()) {
var _local15 = gameContext.getGameData().getProperBoardPositionX(gameContext.getPadManager().getMousePosX());
var _local14 = gameContext.getGameData().getProperBoardPositionY(gameContext.getPadManager().getMousePosY());
_entity.getPiece(_mouseOverPiece).setDestPosX(_local15);
_entity.getPiece(_mouseOverPiece).setDestPosY(_local14);
if (!gameContext.getGameData().isValidMove(_entity.getPiece(_mouseOverPiece), _local15, _local14, false, false)) {
if (_entity.getPiece(_piecePreSelected).isMouseOver()) {
if (!_someoneCanJump) {
gameContext.getGameData().setClearHighlightedSquares();
} else {
gameContext.getGameData().setClearSquare(_entity.getPiece(_piecePreSelected));
}
_mouseOverPiece = -1;
_piecePreSelected = -1;
gameContext.getGameData().setPiecePreSelected(-1);
}
return(undefined);
}
_pieceSelected = _piecePreSelected;
gameContext.getGameData().cursorOff();
}
}
return(undefined);
}
function Update(gameContext) {
if (gameContext.getGameData().getWinner() > -1) {
return(undefined);
}
var _local3 = 0;
while (_local3 < _sparklyDews.length) {
_sparklyDews[_local3].setPositionY(_sparklyDews[_local3].getPositionY() - 1);
_sparklyDews[_local3].animateSprite();
if (!_sparklyDews[_local3].isAnimating()) {
var _local6 = _sparklyDews[_local3].xBase + (Math.random() * gameContext.getGameData().getSquareWidth());
var _local5 = _sparklyDews[_local3].yBase + (Math.random() * gameContext.getGameData().getSquareHeight());
_sparklyDews[_local3].setPositionX(_local6);
_sparklyDews[_local3].setPositionY(_local5);
_sparklyDews[_local3].startAnimating(1, 12, 15 + (Math.random() * 15), false);
_sparklyDews[_local3].setVisibility(true);
}
_local3++;
}
_entity.getAvatar().animateSprite();
if (_arrowTimer > 0) {
_arrowTimer = _arrowTimer - gameContext.getDT();
if (_currentArrowFrame < _endArrowFrame) {
_currentArrowFrame++;
if (_currentArrowFrame == (_endArrowFrame - 1)) {
var _local15 = ((_entity.getID() == 0) ? 3 : 2);
gameContext.getGameData().setPlayerFrame(_entity.getID());
gameContext.getGameData().setPlayerFrame(_entity.getID() ^ 1);
}
gameContext.getGameData().updateArrow(_currentArrowFrame);
}
if (_currentArrowFrame != _endArrowFrame) {
_arrowTimer = _arrowSpeed;
}
}
var _local14 = _entity.getPiece(_pieceSelected).getDestPosX();
var _local10 = _entity.getPiece(_pieceSelected).getDestPosY();
if (_pieceSelected > -1) {
gameContext.getGameData().setPieceMoved(-1);
gameContext.getGameData().setMovingPiece(_pieceSelected);
var _local9 = _entity.getPiece(_pieceSelected).getDestPosX() - _entity.getPiece(_pieceSelected).getPositionX();
var _local8 = _entity.getPiece(_pieceSelected).getDestPosY() - _entity.getPiece(_pieceSelected).getPositionY();
var _local11 = Math.sqrt((_local9 * _local9) + (_local8 * _local8));
_entity.setPieceSelected(_pieceSelected);
gameContext.getGameData().setClearHighlightedSquares();
if (gameContext.getGameData().getAvatarSelected(_entity.getPiece(_pieceSelected).getID())) {
if (_entity.getPiece(_pieceSelected).getPositionX() > _local14) {
_entity.getAvatar().playFlipped();
} else {
_entity.getAvatar().playUnflipped();
}
if (_local11 > 75) {
var _local7 = "JumpForwardPiece";
if (_local9 < 0) {
_entity.getAvatar().setPositionX(_entity.getAvatar().getPositionX() + 56);
}
if (_local8 < 0) {
_local7 = "JumpBackwardPiece";
}
gameContext.getGameData().updateBoard(_entity.getPiece(_pieceSelected));
gameContext.getGameData().incNumCaptured();
gameContext.getGameData().playAnimation(_local7, _entity.getAvatar());
_entity.setNextState(Game.AIStates.AnimateToSpotState);
} else {
var _local7 = "JumpForwardNoPiece";
if (_local9 < 0) {
_entity.getAvatar().setPositionX(_entity.getAvatar().getPositionX() + 56);
}
if (_local8 < 0) {
_local7 = "JumpBackwardNoPiece";
}
if (gameContext.getGameData().movingOnPiece(_local14, _local10)) {
gameContext.getGameData().playAnimation(_local7, _entity.getAvatar());
gameContext.getGameData().playSound(_global.SND_BS_JUMP);
_entity.setNextState(Game.AIStates.AnimateToSpotState);
} else {
gameContext.getGameData().playAnimation("Slide", _entity.getAvatar());
gameContext.getGameData().playSound(_global.SND_BS_SLIDE);
gameContext.getGameData().updateBoard(_entity.getPiece(_pieceSelected));
_entity.setNextState(Game.AIStates.MovingPieceState);
}
if (_entity.getID() == 1) {
gameContext.getGameData().setAvatarMoved();
}
}
return(undefined);
}
gameContext.getGameData().updateBoard(_entity.getPiece(_pieceSelected));
if (_local11 > 75) {
var _local7 = "JumpLeftUp";
_local14 = _entity.getPiece(_pieceSelected).getDestPosX();
_local10 = _entity.getPiece(_pieceSelected).getDestPosY();
var _local13 = _entity.getPiece(_pieceSelected).getPositionX();
var _local12 = _entity.getPiece(_pieceSelected).getPositionY();
if (_local14 < _local13) {
if (_local10 < _local12) {
_local7 = "JumpLeftUp";
if (gameContext.getGameData().isKing(_entity.getPiece(_pieceSelected).getID())) {
_local7 = "JumpKingLeftUp";
}
} else {
_local7 = "JumpLeftDown";
if (gameContext.getGameData().isKing(_entity.getPiece(_pieceSelected).getID())) {
_local7 = "JumpKingLeftDown";
}
}
} else if (_local10 < _local12) {
_local7 = "JumpRightUp";
if (gameContext.getGameData().isKing(_entity.getPiece(_pieceSelected).getID())) {
_local7 = "JumpKingRightUp";
}
} else {
_local7 = "JumpRightDown";
if (gameContext.getGameData().isKing(_entity.getPiece(_pieceSelected).getID())) {
_local7 = "JumpKingRightDown";
}
}
gameContext.getGameData().incNumCaptured();
gameContext.getGameData().playAnimation(_local7, _entity.getPiece(_pieceSelected));
_entity.setNextState(Game.AIStates.AnimateToSpotState);
return(undefined);
}
_entity.setNextState(Game.AIStates.MovingPieceState);
}
return(undefined);
}
function Exit(gameContext) {
var _local3 = _sparklyDews.length;
var _local2 = 0;
while (_local2 < _local3) {
_sparklyDews[_local2].removeSprite();
_sparklyDews[0].pop;
_local2++;
}
return(undefined);
}
static var MOVE_FORWARD_AND_RIGHT = 1;
static var MOVE_FORWARD_AND_LEFT = 2;
static var JUMP_FORWARD_AND_RIGHT = 3;
static var JUMP_FORWARD_AND_LEFT = 4;
static var MOVE_BACKWARD_AND_RIGHT = 5;
static var MOVE_BACKWARD_AND_LEFT = 6;
static var JUMP_BACKWARD_AND_RIGHT = 7;
static var JUMP_BACKWARD_AND_LEFT = 8;
}
Symbol 425 MovieClip [__Packages.Game.AIStates.AnimateToSpotState] Frame 0
class Game.AIStates.AnimateToSpotState extends Base.AIState
{
var _entity, _pieceSelected, _depth, _startingX, _jumpingPiece, _startingGridX, _startingGridY, _jumpingWithoutCoin, _avatarDepth;
function AnimateToSpotState (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
_pieceSelected = _entity.getPiece(_entity.getPieceSelected());
_depth = _pieceSelected.getZDepth();
_depth = _depth + 50000;
_pieceSelected.setZDepth(_depth);
_startingX = _pieceSelected.getPositionX();
_jumpingPiece = false;
var _local5 = _pieceSelected.getDestPosX() - _pieceSelected.getPositionX();
var _local4 = _pieceSelected.getDestPosY() - _pieceSelected.getPositionY();
var _local6 = Math.sqrt((_local5 * _local5) + (_local4 * _local4));
if (_local6 > 75) {
_jumpingPiece = true;
}
_startingGridX = gameContext.getGameData().getGridX(_pieceSelected.getPositionX());
_startingGridY = gameContext.getGameData().getGridY(_pieceSelected.getPositionY());
_jumpingWithoutCoin = false;
if (gameContext.getGameData().getAvatarSelected(_pieceSelected.getID())) {
_avatarDepth = _entity.getAvatar().getZDepth();
_avatarDepth = _avatarDepth + 50000;
_entity.getAvatar().setZDepth(_avatarDepth);
_jumpingWithoutCoin = true;
} else {
gameContext.getGameData().playSound(_global.SND_JUMP2);
}
gameContext.getGameData().setJumpingAgain(-1);
return(undefined);
}
function NetworkDecision(gameContext) {
}
function CPUDecision(gameContext) {
}
function PadInput(gameContext) {
}
function Update(gameContext) {
if (_jumpingWithoutCoin) {
_entity.getAvatar().animateSprite();
if (_entity.getAvatar().isAnimating()) {
if ((_entity.getAvatar().getCurrentFrame() == 140) || (_entity.getAvatar().getCurrentFrame() == 172)) {
_pieceSelected.setVisibility(false);
}
if ((_entity.getAvatar().getCurrentFrame() == 158) || (_entity.getAvatar().getCurrentFrame() == 190)) {
_pieceSelected.setPosition(_pieceSelected.getDestPosX(), _pieceSelected.getDestPosY());
_pieceSelected.setVisibility(true);
gameContext.getGameData().playSound(_global.SND_JUMP1);
}
return(undefined);
}
var _local4 = 0;
if (_jumpingPiece) {
var _local6 = gameContext.getGameData().getGridX(_pieceSelected.getPositionX());
var _local7 = gameContext.getGameData().getGridY(_pieceSelected.getPositionY());
gameContext.getGameData().handleJumpedGuy((_startingGridX + _local6) / 2, (_startingGridY + _local7) / 2);
if ((_entity.getID() == 0) && (_local7 == 7)) {
gameContext.getGameData().setWinner(0);
}
if ((_entity.getID() == 1) && (_local7 == 0)) {
gameContext.getGameData().setWinner(1);
}
} else if (_pieceSelected.getPositionX() < _startingX) {
_local4 = 112;
}
gameContext.getGameData().playAnimation("Idle", _entity.getAvatar());
_entity.getAvatar().playUnflipped();
_entity.getAvatar().setPosition(_pieceSelected.getDestPosX() + _local4, _pieceSelected.getDestPosY());
_pieceSelected.setZDepth(_depth - 50000);
_entity.getAvatar().setZDepth(_avatarDepth - 50000);
gameContext.getGameData().setAvatarOnPiece(_entity.getID(), _pieceSelected.getDestPosX(), _pieceSelected.getDestPosY());
if (!_jumpingPiece) {
if (gameContext.getGameData().isPieceKinged(gameContext.getGameData().getAvatarOnPiece(_entity.getID()))) {
_entity.setNextState(Game.AIStates.JumpedToKingState);
return(undefined);
}
if (gameContext.getGameData().wasKing(gameContext.getGameData().getPreviousPieceAvatarOn(_entity.getID()))) {
_entity.setNextState(Game.AIStates.JumpedFromKingState);
return(undefined);
}
}
if ((gameContext.getGameData().getJumpedID() >= 0) && (gameContext.getGameData().canJumpAgain(_pieceSelected, _pieceSelected.getPositionX(), _pieceSelected.getPositionY()))) {
gameContext.getGameData().setJumpingAgain(_pieceSelected.getID());
_entity.setNextState(Game.AIStates.WaitForReadyState);
return(undefined);
}
} else {
_pieceSelected.animateSprite();
if (_pieceSelected.isAnimating()) {
return(undefined);
}
_pieceSelected.setZDepth(_depth - 50000);
var _local4 = 0;
if (_pieceSelected.getPositionX() < _startingX) {
_local4 = 112;
}
var _local5 = "Idle";
if (gameContext.getGameData().isKing(_pieceSelected.getID())) {
_local5 = "KingIdle";
}
gameContext.getGameData().playAnimation(_local5, _pieceSelected);
_pieceSelected.playUnflipped();
_pieceSelected.setPosition(_pieceSelected.getDestPosX() + _local4, _pieceSelected.getDestPosY());
if (_jumpingPiece) {
var _local6 = gameContext.getGameData().getGridX(_pieceSelected.getPositionX());
var _local7 = gameContext.getGameData().getGridY(_pieceSelected.getPositionY());
gameContext.getGameData().handleJumpedGuy((_startingGridX + _local6) / 2, (_startingGridY + _local7) / 2);
}
if (gameContext.getGameData().shouldBeKinged(_pieceSelected)) {
gameContext.getGameData().kingMe(_pieceSelected);
_entity.setNextState(Game.AIStates.KingPieceState);
return(undefined);
}
if ((gameContext.getGameData().getJumpedID() >= 0) && (gameContext.getGameData().canJumpAgain(_pieceSelected, _pieceSelected.getPositionX(), _pieceSelected.getPositionY()))) {
gameContext.getGameData().setJumpingAgain(_pieceSelected.getID());
_entity.setNextState(Game.AIStates.WaitForReadyState);
return(undefined);
}
}
gameContext.getGameData().handleTurnOver();
_entity.setNextState(Game.AIStates.WaitingForTurnState);
return(undefined);
}
function Exit(gameContext) {
gameContext.getGameData().getPiece(_pieceSelected).setMovingPiece(-1);
return(undefined);
}
}
Symbol 426 MovieClip [__Packages.Game.AIStates.JumpedToKingState] Frame 0
class Game.AIStates.JumpedToKingState extends Base.AIState
{
var _entity, _pieceToKing, _pieceJumpedTo;
function JumpedToKingState (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
_pieceToKing = _entity.getPiece(gameContext.getGameData().getPreviousPieceAvatarOn(_entity.getID()) % 12);
_pieceJumpedTo = _entity.getPiece(gameContext.getGameData().getAvatarOnPiece(_entity.getID()) % 12);
_pieceToKing.startAnimating(351, 356, 24, false);
_pieceJumpedTo.startAnimating(356, 351, 24, false);
return(undefined);
}
function Update(gameContext) {
var _local2 = true;
if (_pieceToKing.isAnimating()) {
_pieceToKing.animateSprite();
_local2 = false;
}
if (_pieceJumpedTo.isAnimating()) {
_pieceJumpedTo.animateSprite();
_local2 = false;
}
if (!_local2) {
return(undefined);
}
_pieceToKing.moveToFrame(7);
gameContext.getGameData().switchKings(_pieceJumpedTo.getID(), _pieceToKing.getID());
if (((_entity.getID() == 1) && (gameContext.getGameData().getGridY(_entity.getAvatar().getPositionY()) == 0)) || ((_entity.getID() == 0) && (gameContext.getGameData().getGridY(_entity.getAvatar().getPositionY()) == 7))) {
gameContext.getGameData().setWinner(_entity.getID());
}
gameContext.getGameData().handleTurnOver();
_entity.setNextState(Game.AIStates.WaitingForTurnState);
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
}
Symbol 427 MovieClip [__Packages.Game.AIStates.WaitingForTurnState] Frame 0
class Game.AIStates.WaitingForTurnState extends Base.AIState
{
var _entity;
function WaitingForTurnState (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
gameContext.getGameData().playAnimation("Idle", _entity.getAvatar());
gameContext.getGameData().setGameReady(true);
return(undefined);
}
function PadInput(gameContext) {
}
function Update(gameContext) {
_entity.getAvatar().animateSprite();
if ((gameContext.getGameData().getJumpedID() > -1) && (_entity.oneOfMyPieces(gameContext.getGameData().getJumpedID()))) {
gameContext.getGameData().setGameReady(false);
_entity.setNextState(Game.AIStates.GotJumpedState);
return(undefined);
}
if (gameContext.getGameData().isMyTurn(_entity.getID())) {
_entity.setNextState(Game.AIStates.WaitForSelectState);
}
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
}
Symbol 428 MovieClip [__Packages.Game.AIStates.GotJumpedState] Frame 0
class Game.AIStates.GotJumpedState extends Base.AIState
{
var _entity, _jumpedPiece;
function GotJumpedState (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
_jumpedPiece = _entity.getPiece(gameContext.getGameData().getJumpedGuy() % 12);
if (gameContext.getGameData().isKing(_jumpedPiece.getID()) && (!gameContext.getGameData().getAvatarSelected(_jumpedPiece.getID()))) {
_jumpedPiece.startAnimating(269, 322, 40, false);
} else {
_jumpedPiece.startAnimating(190, 243, 40, false);
}
_jumpedPiece.setZDepth(_jumpedPiece.getZDepth() + 50000);
if (gameContext.getGameData().getAvatarSelected(_jumpedPiece.getID())) {
_entity.getAvatar().setZDepth(_entity.getAvatar().getZDepth() + 50000);
gameContext.getGameData().playSound(_global.SND_JUMP_AVATAR);
gameContext.getGameData().playSound(_global.SND_BS_CAP);
_entity.getAvatar().startAnimating(42, 61, 40, false);
}
return(undefined);
}
function Update(gameContext) {
var _local2 = true;
_jumpedPiece.animateSprite();
if (_jumpedPiece.isAnimating()) {
_local2 = false;
}
if (gameContext.getGameData().getAvatarSelected(_jumpedPiece.getID())) {
_entity.getAvatar().animateSprite();
if (_entity.getAvatar().isAnimating()) {
_local2 = false;
} else {
_entity.getAvatar().setVisibility(false);
}
}
if (!_local2) {
return(undefined);
}
gameContext.getGameData().incNumLost();
_entity.removePiece(_jumpedPiece.getID() % 12);
if (gameContext.getGameData().getAvatarSelected(_jumpedPiece.getID())) {
_entity.setNextState(Game.AIStates.ResetAvatarState);
} else {
_entity.setNextState(Game.AIStates.WaitingForTurnState);
}
return(undefined);
}
function Exit(gameContext) {
gameContext.getGameData().setJumpedID(-1);
return(undefined);
}
}
Symbol 429 MovieClip [__Packages.Game.AIStates.ResetAvatarState] Frame 0
class Game.AIStates.ResetAvatarState extends Base.AIState
{
var _entity, _timer, _didDisappear, _gameOver, _stage, _avatarOnPieceID;
function ResetAvatarState (entity) {
super();
_entity = entity;
_timer = 0;
_didDisappear = false;
}
function Entry(gameContext) {
_gameOver = false;
_stage = 0;
_timer = 2;
if (gameContext.getGameData().resetAvatarPosition(_entity.getAvatar())) {
_entity.getAvatar().setVisibility(true);
gameContext.getGameData().playSound(_global.SND_BS_CAP2);
gameContext.getGameData().playAnimation("Reappear", _entity.getAvatar());
} else {
_gameOver = true;
gameContext.getGameData().setWinner(_entity.getID() ^ 1);
}
_avatarOnPieceID = gameContext.getGameData().getAvatarOnPiece(_entity.getID());
return(undefined);
}
function Update(gameContext) {
if (_gameOver) {
gameContext.getGameData().setGameOver();
}
switch (_stage) {
case 0 :
_entity.getAvatar().animateSprite();
if (_entity.getAvatar().isAnimating()) {
return(undefined);
}
if (_entity.getPiece(_avatarOnPieceID % 12).getCurrentFrame() == 7) {
_stage++;
_entity.getPiece(_avatarOnPieceID % 12).startAnimating(356, 351, 24, false);
return(undefined);
}
break;
case 1 :
_entity.getPiece(_avatarOnPieceID % 12).animateSprite();
if (!_entity.getPiece(_avatarOnPieceID % 12).isAnimating()) {
break;
}
return(undefined);
}
_entity.getAvatar().setZDepth(_entity.getAvatar().getZDepth() - 50000);
if (((_entity.getID() == 1) && (gameContext.getGameData().getGridY(_entity.getAvatar().getPositionY()) == 0)) || ((_entity.getID() == 0) && (gameContext.getGameData().getGridY(_entity.getAvatar().getPositionY()) == 7))) {
gameContext.getGameData().setWinner(_entity.getID());
}
_entity.setNextState(Game.AIStates.WaitingForTurnState);
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
}
Symbol 430 MovieClip [__Packages.Game.AIStates.JumpedFromKingState] Frame 0
class Game.AIStates.JumpedFromKingState extends Base.AIState
{
var _entity, _pieceToKing;
function JumpedFromKingState (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
_pieceToKing = _entity.getPiece(gameContext.getGameData().getPreviousPieceAvatarOn(_entity.getID()) % 12);
_pieceToKing.startAnimating(351, 356, 24, false);
return(undefined);
}
function Update(gameContext) {
var _local2 = true;
if (_pieceToKing.isAnimating()) {
_pieceToKing.animateSprite();
_local2 = false;
}
if (!_local2) {
return(undefined);
}
_pieceToKing.moveToFrame(7);
gameContext.getGameData().handleTurnOver();
_entity.setNextState(Game.AIStates.WaitingForTurnState);
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
}
Symbol 431 MovieClip [__Packages.Game.AIStates.WaitForReadyState] Frame 0
class Game.AIStates.WaitForReadyState extends Base.AIState
{
var _entity;
function WaitForReadyState (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
return(undefined);
}
function Update(gameContext) {
if (!gameContext.getGameData().isGameReady()) {
return(undefined);
}
_entity.setNextState(Game.AIStates.WaitForSelectState);
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
}
Symbol 432 MovieClip [__Packages.Game.AIStates.KingPieceState] Frame 0
class Game.AIStates.KingPieceState extends Base.AIState
{
var _entity, _pieceSelected;
function KingPieceState (entity) {
super();
_entity = entity;
}
function Entry(gameContext) {
_pieceSelected = _entity.getPiece(_entity.getPieceSelected());
_pieceSelected.setZDepth(_pieceSelected.getZDepth() + 50000);
gameContext.getGameData().playSound(_global.SND_KINGED);
return(undefined);
}
function Update(gameContext) {
_pieceSelected.animateSprite();
if (_pieceSelected.isAnimating()) {
return(undefined);
}
gameContext.getGameData().moveToFrame(7);
gameContext.getGameData().setGotKinged();
gameContext.getGameData().handleTurnOver();
_entity.setNextState(Game.AIStates.WaitingForTurnState);
return(undefined);
}
function Exit(gameContext) {
_pieceSelected.setZDepth(_pieceSelected.getZDepth() - 50000);
}
}
Symbol 433 MovieClip [__Packages.Game.AIStates.MovingPieceState] Frame 0
class Game.AIStates.MovingPieceState extends Base.AIState
{
var _entity, _finishedMoving, _positionX, _positionY, _pieceSelected, _currentX, _currentY, _jumpingPiece, _angle, _canJumpAgain;
function MovingPieceState (entity) {
super();
_entity = entity;
_finishedMoving = false;
_positionX = 0;
_positionY = 0;
}
function Entry(gameContext) {
_pieceSelected = _entity.getPiece(_entity.getPieceSelected());
_finishedMoving = false;
_positionX = _pieceSelected.getPositionX();
_positionY = _pieceSelected.getPositionY();
_pieceSelected.setMoveSpeed(300);
_currentX = _pieceSelected.getPositionX();
_currentY = _pieceSelected.getPositionY();
var _local4 = _pieceSelected.getDestPosX() - _currentX;
var _local5 = _pieceSelected.getDestPosY() - _currentY;
var _local3 = Math.sqrt((_local4 * _local4) + (_local5 * _local5));
if (_local3 > 75) {
_jumpingPiece = true;
} else {
_jumpingPiece = false;
}
_angle = Math.acos(_local4 / _local3);
gameContext.getGameData().setBestMove(-1, -1);
_canJumpAgain = false;
gameContext.getGameData().playSound(_global.SND_FROM1);
return(undefined);
}
function Update(gameContext) {
var _local4 = _pieceSelected.getDestPosX();
var _local3 = _pieceSelected.getDestPosY();
var _local16 = _local4 - _currentX;
var _local15 = _local3 - _currentY;
var _local19 = ((_local16 < 0) ? -1 : 1);
var _local14 = ((_local15 < 0) ? -1 : 1);
var _local10 = gameContext.getDT();
var _local18 = 1 / _local10;
var _local13 = _pieceSelected.getMoveSpeed();
var _local7 = _local13 * _local10;
var _local12 = _local7 * Math.cos(_angle);
var _local11 = _local7 * Math.sin(_angle);
var _local6 = _currentX + _local12;
var _local5 = _currentY + (_local11 * _local14);
if (Math.round(_local6) == Math.round(_local4)) {
_positionX = _local4;
_pieceSelected.setPositionX(_local4);
}
if (Math.floor(_local5) == Math.floor(_local3)) {
_positionY = _local3;
_pieceSelected.setPositionY(_local3);
}
if ((_currentX < _local4) && (_local6 >= _local4)) {
_positionX = _local4;
_pieceSelected.setPositionX(_local4);
}
if ((_currentY < _local3) && (_local5 >= _local3)) {
_positionY = _local3;
_pieceSelected.setPositionY(_local3);
}
if ((_currentX > _local4) && (_local6 <= _local4)) {
_positionX = _local4;
_pieceSelected.setPositionX(_local4);
}
if ((_currentY > _local3) && (_local5 <= _local3)) {
_positionY = _local3;
_pieceSelected.setPositionY(_local3);
}
if (_pieceSelected.isAtDestination()) {
_finishedMoving = true;
} else {
_currentX = _local6;
_currentY = _local5;
_positionX = Math.round(_local6);
_positionY = Math.round(_local5);
}
_pieceSelected.setPosition(_positionX, _positionY);
_pieceSelected.animateSprite();
if (gameContext.getGameData().getAvatarSelected(_pieceSelected.getID())) {
_entity.getAvatar().animateSprite();
var _local9 = 0;
if (_entity.getAvatar().isFlipped()) {
_local9 = 56;
}
_entity.getAvatar().setPosition(_positionX + _local9, _positionY);
}
if (_finishedMoving) {
if (gameContext.getGameData().getAvatarSelected(_pieceSelected.getID())) {
var _local17 = gameContext.getGameData().getGridX(_pieceSelected.getPositionX());
var _local8 = gameContext.getGameData().getGridY(_pieceSelected.getPositionY());
if ((_entity.getID() == 0) && (_local8 == 7)) {
gameContext.getGameData().setWinner(0);
}
if ((_entity.getID() == 1) && (_local8 == 0)) {
gameContext.getGameData().setWinner(1);
}
if (_entity.getAvatar().isFlipped()) {
_entity.getAvatar().setPositionX(_entity.getAvatar().getPositionX() - 56);
}
gameContext.getGameData().playAnimation("Idle", _entity.getAvatar());
_entity.getAvatar().playUnflipped();
}
gameContext.getGameData().setMovingPiece(-1);
if (gameContext.getGameData().shouldBeKinged(_pieceSelected)) {
gameContext.getGameData().kingMe(_pieceSelected);
_entity.setNextState(Game.AIStates.KingPieceState);
return(undefined);
}
if ((gameContext.getGameData().getJumpedID() >= 0) && (gameContext.getGameData().canJumpAgain(_pieceSelected, _pieceSelected.getPositionX(), _pieceSelected.getPositionY()))) {
_entity.setNextState(Game.AIStates.WaitForReadyState);
return(undefined);
}
if ((_entity.getID() < 32) && (gameContext.getGameData().getAvatarMoving() == -1)) {
gameContext.getGameData().handleTurnOver();
_entity.setNextState(Game.AIStates.WaitingForTurnState);
}
}
return(undefined);
}
function Exit(gameContext) {
gameContext.getGameData().playSound(_global.SND_TO2);
return(undefined);
}
}
Symbol 434 MovieClip [__Packages.Base.Time] Frame 0
class Base.Time
{
var _currentTime, _timeLastTick, _gameSpeed, _startTime, _averageTime, _currentPlaceInAvgArray;
function Time () {
_currentTime = 0;
_timeLastTick = 0.001;
_gameSpeed = INITIAL_GAME_SPEED;
_startTime = (getTimer() * INITIAL_GAME_SPEED) / 1000;
_averageTime = new Array(0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666);
_currentPlaceInAvgArray = 0;
}
function getElapsedTime() {
return(_timeLastTick);
}
function getCurTime() {
return(_currentTime);
}
function getGameSpeed() {
return(_gameSpeed);
}
function getAverageTime() {
var _local3 = 0;
var _local2 = 0;
while (_local2 < 10) {
_local3 = _local3 + _averageTime[_local2];
_local2++;
}
_local3 = _local3 / 10;
return(_local3);
}
function markTimeThisTick() {
var _local2 = ((getTimer() * _gameSpeed) / 1000) - _startTime;
_timeLastTick = _local2 - _currentTime;
_currentTime = _local2;
_averageTime[_currentPlaceInAvgArray++] = _timeLastTick;
if (_currentPlaceInAvgArray >= 10) {
_currentPlaceInAvgArray = 0;
}
if (_timeLastTick <= 0) {
_timeLastTick = 0.001;
}
}
function setGameSpeed(speed) {
_gameSpeed = speed;
if (_gameSpeed < MIN_GAME_SPEED) {
_gameSpeed = MIN_GAME_SPEED;
} else if (_gameSpeed > MAX_GAME_SPEED) {
_gameSpeed = MIN_GAME_SPEED;
}
}
static var INITIAL_GAME_SPEED = 1;
static var MIN_GAME_SPEED = 0.001;
static var MAX_GAME_SPEED = 100;
}
Symbol 435 MovieClip [__Packages.Pad.PadManager] Frame 0
class Pad.PadManager
{
var _padData, _mouseData, _lastKeyPressed;
function PadManager () {
_padData = new Array();
_mouseData = new Object();
var _local2 = 0;
while (_local2 < 26) {
_padData[_local2] = {keyPressed:false, keyReleased:false, keyStillPressed:false, timePressed:Number};
_local2++;
}
_mouseData.mouseJustPressed = false;
_mouseData.mouseStillPressed = false;
_mouseData.mouseReleased = false;
_mouseData.mouseTimePressed = 0;
_mouseData.mousePressedPosX = 0;
_mouseData.mousePressedPosY = 0;
_mouseData.mousePosX = 0;
_mouseData.mousePosY = 0;
_lastKeyPressed = 0;
Init();
}
function getPadData() {
return(_padData);
}
function getPadDataLength() {
return(_padData.length);
}
function getKeyJustPressed(id) {
return(_padData[id].keyPressed);
}
function getKeyStillPressed(id) {
return(_padData[id].keyStillPressed);
}
function getMouseJustPressed() {
return(_mouseData.mouseJustPressed);
}
function getMouseStillPressed() {
return(_mouseData.mouseStillPressed);
}
function getMouseReleased() {
return(_mouseData.mouseReleased);
}
function getMouseTimePressed() {
return(_mouseData.mouseTimePressed);
}
function getMousePressedPosX() {
return(_mouseData.mousePressedPosX);
}
function getMousePressedPosY() {
return(_mouseData.mousePressedPosY);
}
function getMousePosX() {
return(_mouseData.mousePosX);
}
function getMousePosY() {
return(_mouseData.mousePosY);
}
function Init() {
mouseListener.onMouseDown = function () {
_global.handleMousePress = true;
return(undefined);
};
mouseListener.onMouseUp = function () {
_global.handleMouseRelease = true;
return(undefined);
};
mouseListener.onMouseMove = null;
Mouse.addListener(mouseListener);
return(undefined);
}
function Update(gameContext) {
var _local5 = Key.getCode();
if (_mouseData.mouseReleased) {
_mouseData.mouseReleased = false;
}
if (_global.handleMouseRelease) {
_global.handleMouseRelease = false;
_mouseData.mouseJustPressed = false;
_mouseData.mouseStillPressed = false;
_mouseData.mouseReleased = true;
} else {
if (_mouseData.mouseJustPressed) {
_mouseData.mouseJustPressed = false;
_mouseData.mouseReleased = false;
_mouseData.mouseStillPressed = true;
}
if (_mouseData.mouseStillPressed) {
_mouseData.mouseTimePressed = _mouseData.mouseTimePressed + gameContext.getDT();
}
}
if (_global.handleMousePress) {
_global.handleMousePress = false;
_mouseData.mouseJustPressed = true;
_mouseData.mousePressedPosX = _xmouse;
_mouseData.mousePressedPosY = _ymouse;
_mouseData.mouseReleased = false;
_mouseData.mouseStillPressed = false;
_mouseData.mouseTimePressed = 0;
}
_mouseData.mousePosX = _xmouse;
_mouseData.mousePosY = _ymouse;
var _local3 = 0;
while (_local3 < 26) {
if (Key.isDown(_local3 + 65)) {
if ((!_padData[_local3].keyPressed) && (!_padData[_local3].keyStillPressed)) {
_padData[_local3].keyPressed = true;
_padData[_local3].keyStillPressed = false;
_padData[_local3].keyReleased = false;
_padData[_local3].timePressed = 0;
} else if (_padData[_local3].keyPressed || (_padData[_local3].keyStillPressed)) {
_padData[_local3].keyPressed = false;
_padData[_local3].keyStillPressed = true;
_padData[_local3].keyReleased = false;
_padData[_local3].timePressed = _padData[_local3].timePressed + gameContext.getDT();
}
} else if (_padData[_local3].keyStillPressed || (_padData[_local3].keyPressed)) {
_padData[_local3].keyPressed = false;
_padData[_local3].keyStillPressed = false;
_padData[_local3].keyReleased = true;
}
_local3++;
}
return(undefined);
}
var mouseListener = new Object();
}
Symbol 436 MovieClip [__Packages.Game.GameManager] Frame 0
class Game.GameManager
{
var _currentGameState, _nextGameState;
function GameManager (parentMC) {
_currentGameState = null;
setNextState(Game.GameStates.TitleCardState);
}
function setNextState(state) {
_nextGameState = new state[undefined]();
}
function Update(gameContext) {
if (_currentGameState != _nextGameState) {
_currentGameState = _nextGameState;
_currentGameState.Entry(gameContext);
} else if (_currentGameState == _nextGameState) {
_currentGameState.Update(gameContext);
if (_currentGameState != _nextGameState) {
_currentGameState.Exit(gameContext);
delete _currentGameState;
if (!_nextGameState) {
}
}
}
}
}
Symbol 437 MovieClip [__Packages.Base.GameState] Frame 0
class Base.GameState extends Base.State
{
static var _screenFade, _fadeSpeed, _levelToReach, _currentAlphaVal, _isFading;
function GameState () {
super();
}
function CPUDecision(gameContext) {
return(undefined);
}
function NetworkDecision(gameContext) {
return(undefined);
}
function PadInput(gameContext) {
return(undefined);
}
function Entry(gameContext) {
return(undefined);
}
function Update(gameContext) {
return(undefined);
}
function Exit(gameContext) {
return(undefined);
}
function startFadeOut(gameContext, spriteName, clipName, depth, fadeSpeed, level) {
_screenFade = new Base.SpriteEntity(gameContext, 5, 100, spriteName, clipName, depth, 0, 0, 2, -1, -1);
_fadeSpeed = fadeSpeed;
_levelToReach = level;
_currentAlphaVal = 0;
_isFading = true;
_screenFade.getMovieClip()._alpha = _currentAlphaVal;
}
function handleFadeOut() {
if (_isFading) {
_currentAlphaVal = _currentAlphaVal + _fadeSpeed;
if (_currentAlphaVal >= _levelToReach) {
_currentAlphaVal = _levelToReach;
_isFading = false;
}
_screenFade.getMovieClip()._alpha = _currentAlphaVal;
}
}
function continueFadeOut(fadeSpeed, level) {
_isFading = true;
_levelToReach = level;
}
function startFadeIn(fadeSpeed) {
_isFading = true;
_levelToReach = 0;
_fadeSpeed = fadeSpeed;
}
function handleFadeIn() {
_currentAlphaVal = _currentAlphaVal - _fadeSpeed;
if (_currentAlphaVal <= _levelToReach) {
_currentAlphaVal = _levelToReach;
_isFading = false;
_screenFade.removeSprite();
delete _screenFade;
}
_screenFade.getMovieClip()._alpha = _currentAlphaVal;
}
function isFading() {
return(_isFading);
}
function setFadeDepth(depth) {
_screenFade.setZDepth(depth);
}
}
Symbol 438 MovieClip [__Packages.Game.GameStates.TitleCardState] Frame 0
class Game.GameStates.TitleCardState extends Base.GameState
{
var _depth, _mc, _numSprite, _filter, _titlecardScreen;
function TitleCardState () {
super();
}
function Entry(gameContext) {
_depth = 100;
_mc = [];
_numSprite = 0;
_filter = new Base.SpriteEntity(gameContext, 5, 100, "gameboard_filter", "filter", 2, 0, 0, 2, 600, 400);
_titlecardScreen = new Base.SpriteEntity(gameContext, 5, 100, "_Titlecard", "titlecard", 50000, 0, 0, 2, -1, -1);
_titlecardScreen.addChild("btn_start", 0, 0, 200, 75);
gameContext.getGameData().getSoundModule().PlayMusic("title_2.wav");
}
function Update(gameContext) {
var _local4 = 1;
var _local5 = 10;
var _local6 = _titlecardScreen.getChildMouseIsOver();
gameContext.getGameData().updateCursor();
if (_titlecardScreen.isMouseOverChild("btn_start")) {
if ((!_titlecardScreen.isChildAnimating("btn_start")) && (_titlecardScreen.getChildCurrentAnimFrame("btn_start") <= 1)) {
gameContext.getGameData().cursorOn();
_titlecardScreen.startAnimatingChild("btn_start", _local4, _local5, 60, false);
}
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().cursorOff();
gameContext.getGameData().playSound(_global.SND_BTN2);
gameContext.getGameManager().setNextState(Game.GameStates.InstructionsGameState);
}
} else if ((!_titlecardScreen.isChildAnimating("btn_start")) && (_titlecardScreen.getChildCurrentAnimFrame("btn_start") == 10)) {
_local4 = 10;
_local5 = 1;
gameContext.getGameData().cursorOff();
_titlecardScreen.startAnimatingChild("btn_start", _local4, _local5, 60, false);
}
if (_titlecardScreen.isChildAnimating("btn_start")) {
_titlecardScreen.animateChild("btn_start");
}
return(undefined);
}
function Exit(gameContext) {
_titlecardScreen.removeSprite();
delete _titlecardScreen;
}
}
Symbol 439 MovieClip [__Packages.Game.GameStates.InstructionsGameState] Frame 0
class Game.GameStates.InstructionsGameState extends Base.GameState
{
var _screen;
function InstructionsGameState () {
super();
}
function Entry(gameContext) {
_screen = new Base.SpriteEntity(gameContext, 5, 100, "_Instructions", "instructions", 50000, 0, 0, 2, -1, -1);
_screen.addChild("btn_play", 0, 10, 195, 70);
}
function Update(gameContext) {
var _local4 = 1;
var _local5 = 10;
var _local6 = _screen.getChildMouseIsOver();
gameContext.getGameData().updateCursor();
if (_screen.isMouseOverChild("btn_play")) {
if ((!_screen.isChildAnimating("btn_play")) && (_screen.getChildCurrentAnimFrame("btn_play") <= 1)) {
_screen.startAnimatingChild("btn_play", _local4, _local5, 60, false);
gameContext.getGameData().cursorOn();
}
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().cursorOff();
gameContext.getGameData().playSound(_global.SND_BTN2);
gameContext.getGameManager().setNextState(Game.GameStates.ChooseCharacterScreenGameState);
}
} else if ((!_screen.isChildAnimating("btn_play")) && (_screen.getChildCurrentAnimFrame("btn_play") == 10)) {
_local4 = 10;
_local5 = 1;
gameContext.getGameData().cursorOff();
_screen.startAnimatingChild("btn_play", _local4, _local5, 60, false);
}
if (_screen.isChildAnimating("btn_play")) {
_screen.animateChild("btn_play");
}
return(undefined);
}
function Exit(gameContext) {
_screen.removeSprite();
delete _screen;
}
}
Symbol 440 MovieClip [__Packages.Game.GameStates.ChooseCharacterScreenGameState] Frame 0
class Game.GameStates.ChooseCharacterScreenGameState extends Base.GameState
{
var _screen, _charOffset, _character, _levelOffset, _difficultyLevel, _children;
function ChooseCharacterScreenGameState () {
super();
}
function Entry(gameContext) {
_screen = new Base.SpriteEntity(gameContext, 5, 100, "_Choosecharacter", "choosecharacter", 50000, 0, 0, 2, -1, -1);
_charOffset = 0;
_character = gameContext.getGameData().getCharacter();
_levelOffset = 2;
_difficultyLevel = gameContext.getGameData().getDifficultyLevel();
_children = [{buttonName:"btn_mac", startFrame:1, endFrame:2, upperLeftX:25, upperLeftY:0, w:95, h:185}, {buttonName:"btn_bloo", startFrame:1, endFrame:2, upperLeftX:25, upperLeftY:0, w:95, h:185}, {buttonName:"btn_normal", startFrame:1, endFrame:2, upperLeftX:15, upperLeftY:10, w:130, h:45}, {buttonName:"btn_hard", startFrame:1, endFrame:2, upperLeftX:15, upperLeftY:10, w:130, h:45}, {buttonName:"btn_bigshot", startFrame:1, endFrame:2, upperLeftX:15, upperLeftY:10, w:130, h:45}, {buttonName:"btn_playnow", startFrame:1, endFrame:10, upperLeftX:18, upperLeftY:10, w:310, h:70}];
var _local2 = 0;
while (_local2 < 6) {
_screen.addChild(_children[_local2].buttonName, _children[_local2].upperLeftX, _children[_local2].upperLeftY, _children[_local2].w, _children[_local2].h);
_local2++;
}
_screen.moveChildToFrame("btn_mac", ((_character == 0) ? 2 : 1));
_screen.moveChildToFrame("btn_bloo", ((_character == 1) ? 2 : 1));
_screen.moveChildToFrame("btn_normal", ((_difficultyLevel == 0) ? 2 : 1));
_screen.moveChildToFrame("btn_hard", ((_difficultyLevel == 1) ? 2 : 1));
_screen.moveChildToFrame("btn_bigshot", ((_difficultyLevel == 2) ? 2 : 1));
}
function Update(gameContext) {
if (gameContext.getGameData().isCPUvsCPU()) {
gameContext.getGameManager().setNextState(Game.GameStates.Init);
return(undefined);
}
var _local5 = 1;
var _local6 = 10;
var _local4 = _screen.getChildMouseIsOver();
gameContext.getGameData().updateCursor();
if (_local4 != null) {
gameContext.getGameData().cursorOn();
if (_local4 == "btn_mac") {
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().playSound(_global.SND_BTN2);
_screen.moveChildToFrame("btn_mac", 2);
_screen.moveChildToFrame("btn_bloo", 1);
_character = 0;
}
} else if (_local4 == "btn_bloo") {
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().playSound(_global.SND_BTN2);
_screen.moveChildToFrame("btn_mac", 1);
_screen.moveChildToFrame("btn_bloo", 2);
_character = 1;
}
} else if (_local4 == "btn_normal") {
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().playSound(_global.SND_BTN2);
_screen.moveChildToFrame("btn_normal", 2);
_screen.moveChildToFrame("btn_hard", 1);
_screen.moveChildToFrame("btn_bigshot", 1);
_difficultyLevel = 0;
}
} else if (_local4 == "btn_hard") {
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().playSound(_global.SND_BTN2);
_screen.moveChildToFrame("btn_normal", 1);
_screen.moveChildToFrame("btn_hard", 2);
_screen.moveChildToFrame("btn_bigshot", 1);
_difficultyLevel = 1;
}
} else if (_local4 == "btn_bigshot") {
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().playSound(_global.SND_BTN2);
_screen.moveChildToFrame("btn_normal", 1);
_screen.moveChildToFrame("btn_hard", 1);
_screen.moveChildToFrame("btn_bigshot", 2);
_difficultyLevel = 2;
}
}
} else {
gameContext.getGameData().cursorOff();
}
if ((_local4 == "btn_playnow") && (_screen.isMouseOverChild(_local4))) {
if ((!_screen.isChildAnimating(_local4)) && (_screen.getChildCurrentAnimFrame(_local4) <= _children[5].startFrame)) {
gameContext.getGameData().cursorOn();
_screen.startAnimatingChild(_local4, _local5, _local6, 60, false);
}
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().cursorOff();
gameContext.getGameData().playSound(_global.SND_BTN2);
gameContext.getGameManager().setNextState(Game.GameStates.Init);
}
} else if ((!_screen.isChildAnimating("btn_playnow")) && (_screen.getChildCurrentAnimFrame("btn_playnow") == _children[5].endFrame)) {
_local5 = _children[5].endFrame;
_local6 = _children[5].startFrame;
gameContext.getGameData().cursorOff();
_screen.startAnimatingChild("btn_playnow", _local5, _local6, 60, false);
}
if (_screen.isChildAnimating("btn_playnow")) {
_screen.animateChild("btn_playnow");
}
return(undefined);
}
function Exit(gameContext) {
gameContext.getGameData().setDifficultyLevel(_difficultyLevel);
gameContext.getGameData().setCharacter(_character);
if (gameContext.getGameData().getMusicOn()) {
gameContext.getGameData().getSoundModule().PlayMusic("game_2.wav");
}
_screen.removeSprite();
delete _screen;
}
}
Symbol 441 MovieClip [__Packages.Game.GameStates.Init] Frame 0
class Game.GameStates.Init extends Base.GameState
{
function Init () {
super();
}
function Entry(gameContext) {
gameContext.getGameData().createBoard();
}
function Update(gameContext) {
gameContext.getGameData().addPlayers();
gameContext.getGameManager().setNextState(Game.GameStates.InPlay);
return(undefined);
}
function Exit(gameContext) {
var _local1 = new Date().getTime();
loadMovieNum ("tracker.swf?" + _local1, 100000);
}
}
Symbol 442 MovieClip [__Packages.Game.GameStates.InPlay] Frame 0
class Game.GameStates.InPlay extends Base.GameState
{
var _cpuControl;
function InPlay () {
super();
}
function Entry(gameContext) {
gameContext.getGameData().showMusicSprite();
}
function Update(gameContext) {
if (gameContext.getPadManager().getKeyStillPressed(0) && (gameContext.getPadManager().getKeyJustPressed(2))) {
if (gameContext.getGameData()._players[0]._cpuControlled) {
gameContext.getGameData()._players[0]._cpuControlled = false;
_cpuControl = new Base.SpriteEntity(gameContext, 7, 101, "cpuControl", "cpuControl", 70400, 75, 383, 2, -1, -1);
} else {
gameContext.getGameData()._players[0]._cpuControlled = true;
_cpuControl.removeSprite();
delete _cpuControl;
}
}
var _local3 = 0;
while (_local3 < gameContext.getGameData().getNumPlayers()) {
gameContext.getGameData()._players[_local3].Update(gameContext.getGameData()._players[_local3]._cpuControlled, gameContext.getGameData()._players[_local3]._networkControlled);
if (gameContext.getGameData().getWinner() > -1) {
gameContext.getGameManager().setNextState(Game.GameStates.ShowAvatarCrownGameState);
break;
}
_local3++;
}
gameContext.getGameData().updateMusicButton();
return(undefined);
}
function Exit(gameContext) {
gameContext.getGameData().hideMusicSprite();
}
}
Symbol 443 MovieClip [__Packages.Game.GameStates.ShowAvatarCrownGameState] Frame 0
class Game.GameStates.ShowAvatarCrownGameState extends Base.GameState
{
var _stage, _timeToAnimate, _winner, _pieceToMove, _positionX, _positionY, _currentX, _currentY, _angle, _moveSpeed, startFadeOut, _checkerToMove, _particles, handleFadeOut, setFadeDepth, continueFadeOut, isFading;
function ShowAvatarCrownGameState () {
super();
}
function Entry(gameContext) {
var _local5 = 0;
_stage = 0;
_timeToAnimate = 5;
_winner = gameContext.getGameData().getWinner();
_pieceToMove = gameContext.getGameData().getPlayer(_winner).getAvatar();
_positionX = _pieceToMove.getPositionX();
_positionY = _pieceToMove.getPositionY();
_pieceToMove.setDestPosX(326);
_pieceToMove.setDestPosY(200);
_currentX = _pieceToMove.getPositionX();
_currentY = _pieceToMove.getPositionY();
var _local8 = _pieceToMove.getDestPosX() - _currentX;
var _local11 = _pieceToMove.getDestPosY() - _currentY;
var _local6 = Math.sqrt((_local8 * _local8) + (_local11 * _local11));
_angle = Math.acos(_local8 / _local6);
_moveSpeed = _local6;
var _local10;
var _local9;
var _local7;
var _local4;
if (_winner == 1) {
_local10 = "You are";
_local7 = ((gameContext.getGameData().getCharacter() == 0) ? "_mac" : "_bloo");
_local4 = ((gameContext.getGameData().getCharacter() == 0) ? "checker_blue_mc" : "checker_red_mc");
_local5 = ((gameContext.getGameData().getCharacter() == 0) ? 2 : 3);
_local9 = _global.SND_WIN;
} else {
_local10 = "Your opponent is";
_local7 = ((gameContext.getGameData().getCharacter() == 1) ? "_mac" : "_bloo");
_local4 = ((gameContext.getGameData().getCharacter() == 1) ? "checker_blue_mc" : "checker_red_mc");
_local5 = ((gameContext.getGameData().getCharacter() == 1) ? 2 : 3);
_local9 = _global.SND_LOSE_01;
}
gameContext.getGameData().playSound(_local9);
gameContext.getGameData().showMessageString(_local10 + " the winner", _local5);
startFadeOut(gameContext, "whiteBG", "whiteFilter", 60000, 1.25, 45);
_pieceToMove = new Base.SpriteEntity(gameContext, 5, 100, _local7, _local7, 60500, _currentX, _currentY, 4, -1, -1);
_checkerToMove = new Base.SpriteEntity(gameContext, 5, 100, _local4, _local4, 60498, _currentX, _currentY, 4, -1, -1);
_pieceToMove.setDestPosX(326);
_pieceToMove.setDestPosY(200);
_pieceToMove.moveToFrame(2);
_checkerToMove.moveToFrame(2);
_particles = [];
gameContext.getGameData().cleanupPieces();
}
function Update(gameContext) {
switch (_stage) {
case 0 :
handleFadeOut();
if (MoveAvatarToCenter(gameContext.getDT())) {
_stage++;
}
break;
case 1 :
_stage++;
_timeToAnimate = 6;
_pieceToMove.startAnimating(31, 35, 12, true);
var _local9 = _particles.length;
var _local10 = _local9 + 60;
var _local3 = _local9;
while (_local3 < _local10) {
var _local4 = ((_local3 * 6) * Math.PI) / 180;
var _local7 = (_pieceToMove.getPositionX() + (35 * Math.sin(_local4))) + (_pieceToMove.getWidth() / 2);
var _local6 = _pieceToMove.getPositionY() + (35 * (-Math.cos(_local4)));
var _local5 = 60499 + (_particles.length * ((_local6 <= _pieceToMove.getPositionY()) ? -2 : 2));
_particles.push(new Base.SpriteEntity(gameContext, 5, 100, "sparkly_dews", "dews", _local5, _local7, _local6, 2, -1, -1));
_particles[_local3].startAnimating(1, 12, 5 + (Math.random() * 50), false);
_particles[_local3].xBase = _local7;
_particles[_local3].yBase = _local6;
_particles[_local3].setVisibility(false);
_local3++;
}
break;
case 2 :
_pieceToMove.animateSprite();
var _local2 = 0;
while (_local2 < _particles.length) {
_particles[_local2].setPositionY(_particles[_local2].getPositionY() - 1);
_particles[_local2].animateSprite();
if (!_particles[_local2].isAnimating()) {
var _local7 = _particles[_local2].xBase;
var _local6 = _particles[_local2].yBase;
_particles[_local2].setPositionX(_local7);
_particles[_local2].setPositionY(_local6);
_particles[_local2].startAnimating(1, 12, 5 + (Math.random() * 10), false);
_particles[_local2].setVisibility(true);
}
_local2++;
}
_timeToAnimate = _timeToAnimate - gameContext.getDT();
if (_timeToAnimate > 0) {
return(undefined);
}
setFadeDepth(60700);
continueFadeOut(5, 100);
_stage++;
break;
case 3 :
handleFadeOut();
if (isFading()) {
return(undefined);
}
_stage++;
break;
case 4 :
gameContext.getGameManager().setNextState(Game.GameStates.WinScreenGameState);
}
return(undefined);
}
function Exit(gameContext) {
gameContext.getGameData().cleanupBoard();
_pieceToMove.removeSprite();
delete _pieceToMove;
_checkerToMove.removeSprite();
delete _checkerToMove;
var _local3 = _particles.length;
var _local2 = 0;
while (_local2 < _local3) {
_particles[_local2].removeSprite();
_particles[0].pop;
_local2++;
}
}
function MoveAvatarToCenter(gameTime) {
var _local3 = _pieceToMove.getDestPosX();
var _local2 = _pieceToMove.getDestPosY();
var _local11 = _local3 - _currentX;
var _local10 = _local2 - _currentY;
var _local13 = ((_local11 < 0) ? -1 : 1);
var _local9 = ((_local10 < 0) ? -1 : 1);
var _local12 = 1 / gameTime;
var _local6 = _moveSpeed * gameTime;
var _local8 = _local6 * Math.cos(_angle);
var _local7 = _local6 * Math.sin(_angle);
var _local5 = _currentX + _local8;
var _local4 = _currentY + (_local7 * _local9);
if (Math.round(_local5) == Math.round(_local3)) {
_positionX = _local3;
_pieceToMove.setPositionX(_local3);
}
if (Math.floor(_local4) == Math.floor(_local2)) {
_positionY = _local2;
_pieceToMove.setPositionY(_local2);
}
if ((_currentX < _local3) && (_local5 >= _local3)) {
_positionX = _local3;
_pieceToMove.setPositionX(_local3);
}
if ((_currentY < _local2) && (_local4 >= _local2)) {
_positionY = _local2;
_pieceToMove.setPositionY(_local2);
}
if ((_currentX > _local3) && (_local5 <= _local3)) {
_positionX = _local3;
_pieceToMove.setPositionX(_local3);
}
if ((_currentY > _local2) && (_local4 <= _local2)) {
_positionY = _local2;
_pieceToMove.setPositionY(_local2);
}
if (_pieceToMove.isAtDestination()) {
return(true);
}
_currentX = _local5;
_currentY = _local4;
_positionX = Math.round(_local5);
_positionY = Math.round(_local4);
_pieceToMove.setPosition(_positionX, _positionY);
_checkerToMove.setPosition(_positionX, _positionY);
return(false);
}
}
Symbol 444 MovieClip [__Packages.Game.GameStates.WinScreenGameState] Frame 0
class Game.GameStates.WinScreenGameState extends Base.GameState
{
var _depth, _mc, _numSprite, _playAgainChild, _screenName, _animChild, _screen, startFadeIn, isFading, handleFadeIn;
function WinScreenGameState () {
super();
}
function Entry(gameContext) {
_depth = 100;
_mc = [];
_numSprite = 0;
var _local5 = gameContext.getGameData().getWinner();
var _local4 = gameContext.getGameData().getCharacter();
_playAgainChild = "btn_playagain";
var _local2 = 0;
if (_local5 == 1) {
if (_local4 == 0) {
_screenName = "_Winmac";
_animChild = "macWin";
_local2 = 53;
} else {
_screenName = "_Winbloo";
_animChild = "blooWin";
_local2 = 41;
}
} else if (_local4 == 0) {
_screenName = "_Losemac";
_animChild = "macLose";
_local2 = 25;
} else {
_screenName = "_Losebloo";
_animChild = "blooLose";
_local2 = 36;
}
_screen = new Base.SpriteEntity(gameContext, 5, 100, _screenName, "screen", 50000, 0, 0, 2, -1, -1);
_screen.addChild(_playAgainChild, 10, 10, 330, 75);
_screen.addChild(_animChild, 0, 0, 197, 217);
_screen.startAnimatingChild(_animChild, 1, _local2, 24, false);
if (gameContext.getGameData().getMusicOn()) {
gameContext.getGameData().getSoundModule().PlayMusic("title_2.wav");
}
startFadeIn(5);
}
function Update(gameContext) {
if (isFading()) {
handleFadeIn();
return(undefined);
}
if (gameContext.getGameData().isCPUvsCPU()) {
gameContext.getGameManager().setNextState(Game.GameStates.ChooseCharacterScreenGameState);
return(undefined);
}
var _local4 = 1;
var _local5 = 10;
if (_screen.isChildAnimating(_animChild)) {
_screen.animateChild(_animChild);
}
gameContext.getGameData().updateCursor();
var _local6 = _screen.getChildMouseIsOver();
if (_screen.isMouseOverChild(_playAgainChild)) {
if ((!_screen.isChildAnimating(_playAgainChild)) && (_screen.getChildCurrentAnimFrame(_playAgainChild) <= 1)) {
gameContext.getGameData().cursorOn();
_screen.startAnimatingChild(_playAgainChild, _local4, _local5, 60, false);
}
if (gameContext.getPadManager().getMouseJustPressed()) {
gameContext.getGameData().cursorOff();
gameContext.getGameData().playSound(_global.SND_BTN2);
gameContext.getGameManager().setNextState(Game.GameStates.InstructionsGameState);
}
} else if ((!_screen.isChildAnimating(_playAgainChild)) && (_screen.getChildCurrentAnimFrame(_playAgainChild) == 10)) {
_local4 = 10;
_local5 = 1;
gameContext.getGameData().cursorOff();
_screen.startAnimatingChild(_playAgainChild, _local4, _local5, 60, false);
}
if (_screen.isChildAnimating(_playAgainChild)) {
_screen.animateChild(_playAgainChild);
}
return(undefined);
}
function Exit(gameContext) {
gameContext.getGameData().Init();
_screen.removeSprite();
delete _screen;
}
}
Symbol 445 MovieClip [__Packages.Game.Background] Frame 0
class Game.Background
{
var _gameContext, _num, _scrollSpeed, _backgroundTimer, fg_bmp, fg_clipRect, fg;
function Background (gameContext) {
_gameContext = gameContext;
_num = 196;
_scrollSpeed = 0.05;
_backgroundTimer = _scrollSpeed;
initBack();
}
function initBack() {
fg_bmp = flash.display.BitmapData.loadBitmap("checkers_bg.png");
fg_clipRect = new flash.geom.Rectangle(0, 0, 600, 400);
fg = _gameContext.getParent().createEmptyMovieClip("ck_bg", 1);
fg.attachBitmap(fg_bmp, 1);
fg.rect = fg_clipRect;
fg.bmp = fg_bmp;
}
function scrollClip(mc, x, y) {
mc.rect.offset(x, y);
if (mc.rect.x <= 0) {
mc.rect.x = 600;
} else if (mc.rect.right > mc.bmp.width) {
mc.rect.x = 0;
}
mc.scrollRect = mc.rect;
}
function moveBack(gameContext) {
_backgroundTimer = _backgroundTimer - _gameContext.getDT();
if (_backgroundTimer >= 0) {
return(undefined);
}
_backgroundTimer = _scrollSpeed;
scrollClip(fg, 1, 0);
return(undefined);
}
function cleanBack() {
_root.back.removeMovieClip();
}
}
Symbol 414 MovieClip [GameEntry] Frame 1
#initclip 32
Object.registerClass("GameEntry", Base.GameEntry);
#endinitclip