Frame 1
_root.exitButtonText = "EXIT GAME";
Symbol 444 MovieClip [rainbow_lock_effect] Frame 1
stop();
Symbol 511 MovieClip [Game] Frame 1
#initclip 53
Object.registerClass("Game", com.king.Chuzzle.Game);
#endinitclip
Symbol 512 MovieClip [Chuzzle] Frame 1
#initclip 52
Object.registerClass("Chuzzle", com.king.Chuzzle.Chuzzle);
#endinitclip
Symbol 531 MovieClip Frame 536
stop();
Symbol 719 MovieClip [__Packages.com.king.timing.Timeable] Frame 0
interface com.king.timing.Timeable
{
}
Symbol 720 MovieClip [__Packages.com.king.Chuzzle.Chuzzle] Frame 0
class com.king.Chuzzle.Chuzzle extends MovieClip implements com.king.timing.Timeable
{
static var log;
var level, renderFPS, tickFPS, m_mainTimer, communicator, gameState, onEnterFrame, gameTick, tickStartTime, tickCounter, screenPlayer, seed, Game_mc, currentTick, renderStartTime, soundOn;
function Chuzzle () {
super();
_root.StarScreen_mc._visible = false;
com.king.Chuzzle.Input.setup();
disableExitGameButton();
disableSoundButtons();
level = 0;
renderFPS = 0;
tickFPS = 0;
m_mainTimer = new com.king.timing.Timer(this, TICKS_PER_SEC);
communicator = new com.king.util.Communicator();
gameState = STATE_WAIT_FOR_GAMEDATA;
setupButtons();
onEnterFrame = mx.utils.Delegate.create(this, drive);
gameTick = 0;
}
function drive() {
m_mainTimer.advanceTime2();
}
function tick(tick) {
com.king.Chuzzle.Input.setMousePos(_root._xmouse, _root._ymouse);
if (tickFPS == 0) {
tickStartTime = getTimer();
} else {
var _local4 = (getTimer() - tickStartTime) / 1000;
if (_local4 >= 1) {
_root.txtTime.text = String(tickFPS);
tickFPS = -1;
}
}
tickFPS = tickFPS + 1;
tickCounter = tickCounter + 1;
_root.Hint_btn.enabled = false;
switch (gameState) {
case STATE_WAIT_FOR_GAMEDATA :
if (DEBUG_MODE) {
_root.gameData = DEBUG_GAME_DATA;
}
if (_root.gameData != undefined) {
communicator.parseGameData(_root.gameData);
FREE_GAME = communicator.freeGame;
RELAX_GAME = communicator.relaxGame;
if (RELAX_GAME) {
MONEY = false;
}
if (MONEY) {
getURL("FSCommand:playData", ("11," + clientVersion) + ",0=0");
}
log;
log = log + (("Client version: " + clientVersion) + newline);
screenPlayer = new com.king.Chuzzle.ScreenPlayer(null);
seed = communicator.randomSeed;
_root.Seed_txt.text = seed;
com.king.util.SoundManager.play("Chuzzle6", 100, true);
Game_mc.initGame(seed, MONEY, RELAX_GAME);
initLevel();
tickCounter = 0;
screenPlayer.setGameStartsIn(SHOW_HOW_TO_SCREEN_TIME + SHOW_INFO_SCREEN_TIME);
screenPlayer.introScreenShow();
gameState = STATE_SHOW_INFO_SCREEN;
Game_mc.tick(gameTick);
gameTick = gameTick + 1;
}
break;
case STATE_SHOW_INFO_SCREEN :
var _local5 = (SHOW_HOW_TO_SCREEN_TIME + SHOW_INFO_SCREEN_TIME) - tickCounter;
screenPlayer.setGameStartsIn(_local5);
if (tickCounter == SHOW_INFO_SCREEN_TIME) {
toShowHowTo();
}
break;
case STATE_SHOW_HOW_TO_SCREEN :
_local5 = (SHOW_HOW_TO_SCREEN_TIME + SHOW_INFO_SCREEN_TIME) - tickCounter;
screenPlayer.setGameStartsIn(_local5);
if (tickCounter == (SHOW_HOW_TO_SCREEN_TIME + SHOW_INFO_SCREEN_TIME)) {
toStarTransPlayGame();
}
break;
case STATE_STAR_TRANSITION_PLAY_GAME :
if (tickCounter == 9) {
screenPlayer.howToScreenHide();
currentTick = 1;
communicator.gameStarted();
Game_mc.start();
gameState = STATE_PLAY_GAME;
com.king.util.SoundManager.play("Chuzzle5", 70, true);
enableExitGameButton();
} else if (tickCounter >= 25) {
}
break;
case STATE_PLAY_GAME :
_root.Hint_btn.enabled = true;
Game_mc.tick(gameTick);
gameTick = gameTick + 1;
break;
case STATE_BETWEEN_ROUNDS :
Game_mc.addScore(screenPlayer.deltaBonus, true);
if (tickCounter == 76) {
}
if (tickCounter == 77) {
com.king.util.SoundManager.play("ReleaseChuzzles", 100, false);
}
if (tickCounter == 202) {
com.king.util.SoundManager.play("GameSelect");
initLevel();
}
if (tickCounter == 241) {
com.king.util.SoundManager.play("Go");
com.king.util.SoundManager.play("Chuzzle5", 70, true);
}
if (tickCounter >= 268) {
screenPlayer.levelUpHide();
Game_mc.inGameGUI.showBottle();
gameState = STATE_PLAY_GAME;
Game_mc.tick(gameTick);
gameTick = gameTick + 1;
if (FREE_GAME) {
communicator.gameEnd(Game_mc.getScore());
tickCounter = 0;
screenPlayer.showFreeSign();
gameState = STATE_FREE_GAME_ENDING;
} else {
Game_mc.start();
}
break;
}
if (tickCounter >= 202) {
Game_mc.tick(gameTick);
gameTick = gameTick + 1;
}
break;
case STATE_STAR_TRANSITION_END_GAME :
if (tickCounter >= 9) {
disableExitGameButton();
tickCounter = 0;
screenPlayer.trophiesScreenShow(Game_mc.getScore());
setTropies();
gameState = STATE_SHOW_TROPHIES;
com.king.util.SoundManager.play("Chuzzle6", 100, true);
communicator.gameEnd(Game_mc.getScore());
}
break;
case STATE_END_GAME :
_local5 = (SHOW_TROPHIES_TIME + SHOW_GAME_OVER_TIME) - tickCounter;
screenPlayer.setGameEndsIn(_local5);
if (tickCounter == (SHOW_TROPHIES_TIME + SHOW_GAME_OVER_TIME)) {
communicator.gameQuit();
gameState = STATE_GAME_QUIT_HAS_BEEN_SENT;
}
break;
case STATE_SHOW_TROPHIES :
_local5 = (SHOW_TROPHIES_TIME + SHOW_GAME_OVER_TIME) - tickCounter;
screenPlayer.setGameEndsIn(_local5);
if (tickCounter == SHOW_TROPHIES_TIME) {
toShowEndGame();
}
break;
case STATE_NOT_RUNNING :
break;
case STATE_GAME_QUIT_HAS_BEEN_SENT :
break;
case STATE_FREE_GAME_ENDING :
_local5 = SHOW_FREE_GAME_END_TIME - tickCounter;
screenPlayer.setFreeGameEndsIn(_local5);
if (tickCounter == SHOW_FREE_GAME_END_TIME) {
communicator.gameQuit();
gameState = STATE_GAME_QUIT_HAS_BEEN_SENT;
}
Game_mc.tick(gameTick);
gameTick = gameTick + 1;
}
screenPlayer.tick(tick);
com.king.Chuzzle.Input.reset();
}
function render(tick, alpha) {
if (renderFPS == 0) {
renderStartTime = getTimer();
} else {
var _local5 = (getTimer() - renderStartTime) / 1000;
if (_local5 >= 1) {
_root.txtFPS.text = String(renderFPS);
renderFPS = -1;
}
}
renderFPS = renderFPS + 1;
switch (gameState) {
case STATE_WAIT_FOR_GAMEDATA :
_root._quality = "HIGH";
break;
case STATE_SHOW_INFO_SCREEN :
_root._quality = "HIGH";
break;
case STATE_SHOW_HOW_TO_SCREEN :
_root._quality = "HIGH";
break;
case STATE_STAR_TRANSITION_PLAY_GAME :
_root._quality = "HIGH";
break;
case STATE_PLAY_GAME :
_root._quality = "LOW";
break;
case STATE_BETWEEN_ROUNDS :
_root._quality = "HIGH";
break;
case STATE_STAR_TRANSITION_END_GAME :
_root._quality = "HIGH";
break;
case STATE_SHOW_TROPHIES :
_root._quality = "HIGH";
break;
case STATE_NOT_RUNNING :
_root._quality = "HIGH";
break;
case STATE_END_GAME :
_root._quality = "HIGH";
break;
case STATE_NOT_RUNNING :
_root._quality = "HIGH";
break;
case STATE_FREE_GAME_ENDING :
_root._quality = "HIGH";
}
Game_mc.render(tick, alpha);
screenPlayer.render(tick, alpha);
}
function endLevel() {
if (gameState == STATE_PLAY_GAME) {
screenPlayer.levelUpStart(level);
tickCounter = 0;
gameState = STATE_BETWEEN_ROUNDS;
com.king.util.SoundManager.stop("Chuzzle5");
com.king.util.SoundManager.play("LevelUp");
}
}
function endGame() {
tickCounter = 0;
screenPlayer.starScreenShow();
gameState = STATE_STAR_TRANSITION_END_GAME;
com.king.util.SoundManager.stop("Chuzzle5");
com.king.util.SoundManager.play("Transition");
}
function initLevel() {
level = level + 1;
switch (level) {
case 1 :
break;
case 2 :
case 3 :
}
Game_mc.initLevel(level);
}
function startLevel() {
communicator.gameStarted();
Game_mc.start();
}
function onMouseUp() {
com.king.Chuzzle.Input.mouseReleased();
}
function onMouseDown() {
com.king.Chuzzle.Input.mousePressed();
if ((gameState == STATE_SHOW_INFO_SCREEN) && (tickCounter > 2)) {
toShowHowTo();
} else if ((gameState == STATE_SHOW_HOW_TO_SCREEN) && (tickCounter > 2)) {
if (_root.ButtonsArea_mc.hitTest(_root._xmouse, _root._ymouse, true)) {
toStarTransPlayGame();
}
} else if (gameState == STATE_END_GAME) {
if (_root.ButtonsArea_mc.hitTest(_root._xmouse, _root._ymouse, true)) {
if (tickCounter > 75) {
communicator.gameQuit();
gameState = STATE_GAME_QUIT_HAS_BEEN_SENT;
}
}
} else if (gameState == STATE_SHOW_TROPHIES) {
if (_root.ButtonsArea_mc.hitTest(_root._xmouse, _root._ymouse, true)) {
toShowEndGame();
}
} else if (gameState != STATE_PLAY_GAME) {
if (gameState == STATE_FREE_GAME_ENDING) {
if (_root.ButtonsArea_mc.hitTest(_root._xmouse, _root._ymouse, true)) {
if (tickCounter > 75) {
communicator.gameQuit();
gameState = STATE_GAME_QUIT_HAS_BEEN_SENT;
}
}
}
}
}
function onDragOut() {
if ((((_root._xmouse <= 0) || (_root._xmouse >= 720)) || (_root._ymouse <= 0)) || (_root._ymouse >= 540)) {
onMouseUp();
com.king.Chuzzle.Input.mouseReleased();
}
}
function toShowHowTo() {
screenPlayer.introScreenHide();
screenPlayer.howToScreenShow();
soundButtonsSetup();
gameState = STATE_SHOW_HOW_TO_SCREEN;
}
function toStarTransPlayGame() {
tickCounter = 0;
screenPlayer.starScreenShow();
gameState = STATE_STAR_TRANSITION_PLAY_GAME;
com.king.util.SoundManager.stop("Chuzzle6");
com.king.util.SoundManager.play("Transition");
}
function toShowEndGame() {
screenPlayer.gameOverScreenShow(Game_mc.getScore());
gameState = STATE_END_GAME;
screenPlayer.trophiesScreenHide();
}
function setTropies() {
if (Game_mc.quadBoomer) {
screenPlayer.quadBoomerShow();
}
if (Game_mc.tripleBoomer) {
screenPlayer.tripleBoomerShow();
}
if (Game_mc.tripleCombo) {
screenPlayer.tripleComboShow();
}
if (Game_mc.reactor) {
screenPlayer.reactorShow();
}
if (Game_mc.quadCombo) {
screenPlayer.quadComboShow();
}
if (Game_mc.sevenAtOnce) {
screenPlayer.sevenAtOnceShow();
}
}
function hintButtonPressed() {
if (gameState == STATE_PLAY_GAME) {
Game_mc.hintButtonPressed();
}
}
function soundButtonsSetup() {
soundOn = true;
_root.SoundOn_btn._visible = false;
_root.SoundOn_btn.enabled = false;
_root.SoundOff_btn._visible = true;
_root.SoundOff_btn.enabled = true;
}
function soundOffButtonPressed() {
if (soundOn) {
soundOn = false;
com.king.util.SoundManager.toggleSound();
_root.SoundOff_btn._visible = false;
_root.SoundOff_btn.enabled = false;
_root.SoundOn_btn._visible = true;
_root.SoundOn_btn.enabled = true;
}
}
function soundOnButtonPressed() {
if (soundOn) {
soundOn = true;
com.king.util.SoundManager.toggleSound();
_root.SoundOn_btn._visible = false;
_root.SoundOn_btn.enabled = false;
_root.SoundOff_btn._visible = true;
_root.SoundOff_btn.enabled = true;
}
}
function exitGameButtonPressed() {
Game_mc.finishGame();
}
function disableSoundButtons() {
_root.SoundOff_btn._visible = false;
_root.SoundOff_btn.enabled = false;
_root.SoundOn_btn._visible = false;
_root.SoundOn_btn.enabled = false;
}
function disableExitGameButton() {
_root.ExitGame_btn.enabled = false;
_root.ExitGame_btn._visible = false;
}
function enableExitGameButton() {
_root.ExitGame_btn.enabled = true;
_root.ExitGame_btn._visible = true;
}
function setupButtons() {
_root.Hint_btn.onRelease = function () {
_root.Chuzzle_mc.hintButtonPressed();
};
_root.SoundOff_btn.onRelease = function () {
_root.Chuzzle_mc.soundOffButtonPressed();
};
_root.SoundOn_btn.onRelease = function () {
_root.Chuzzle_mc.soundOnButtonPressed();
};
_root.ExitGame_btn.onRelease = function () {
_root.Chuzzle_mc.exitGameButtonPressed();
};
}
function traceDiplomas() {
}
function clearThreeFatDiploma() {
return(Math.floor(Game_mc.bigsDeleatedInGame / 3));
}
function fourCascadeDiploma() {
return(Game_mc.diplomaFourCascade);
}
function hundredChuzzlesDiploma() {
var _local2 = level - 1;
if (_local2 < 0) {
_local2 = 0;
}
return(_local2);
}
function blastASuperDiploma() {
return(Game_mc.diplomaBlastASuper);
}
function diplomaTripleCombo() {
return(Game_mc.diplomaTripleCombo);
}
function diplomaTrophies() {
var _local2 = 0;
if (Game_mc.quadBoomer) {
_local2 = _local2 + 1;
}
if (Game_mc.tripleBoomer) {
_local2 = _local2 + 1;
}
if (Game_mc.tripleCombo) {
_local2 = _local2 + 1;
}
if (Game_mc.reactor) {
_local2 = _local2 + 1;
}
if (Game_mc.quadCombo) {
_local2 = _local2 + 1;
}
if (Game_mc.sevenAtOnce) {
_local2 = _local2 + 1;
}
return(_local2);
}
var clientVersion = "22";
static var MONEY = true;
var FREE_GAME = false;
var RELAX_GAME = false;
static var DEBUG_MODE = true;
static var DEBUG_GAME_DATA = ("<gamedata randomseed=\"" + Math.round(5000 * Math.random())) + "\" timelimit=\"660\" lang=\"de\" relaxMode=\"false\"><text id=\"game_starts_in\">Game starts in [0] seconds</text><text id=\"how_to_heading\">How to play</text><text id=\"how_to\">Click and drag rows of Chuzzles to make groups of three or more!</text><text id=\"trophies_title\">Trophies</text><text id=\"final_score\">Final score</text><text id=\"game_ends_in\">Game ends in [0] seconds</text><text id=\"game_over\">Game\nOver</text><text id=\"7_at_once\">7 at once</text><text id=\"triple_combo\">Triple combo</text><text id=\"quad_combo\">Quad combo</text><text id=\"triple_boomer\">Triple Boomer</text><text id=\"quad_boomer\">Quad Boomer</text><text id=\"reactor\">Reactor</text><text id=\"7_at_once_text\">For popping seven Chuzzles as one group!</text><text id=\"triple_combo_text\">For making a triple combo!</text><text id=\"quad_combo_text\">For making a quadruple combo!</text><text id=\"triple_boomer_text\">For exploding three Super Chuzzles at once!</text><text id=\"quad_boomer_text\">For exploding four Super Chuzzles at once!</text><text id=\"reactor_text\">For causing a seven-step cascade!</text><text id=\"exit_game\">Exit Game</text><text id=\"super_pop\">Super</text><text id=\"combo_pop\">Combo</text><text id=\"level\">LEVEL</text><text id=\"scramble\">Scramble</text><text id=\"level_up\">Level\nUp!</text><text id=\"bonus\">Bonus</text><text id=\"ready\">Ready</text><text id=\"go\">Go</text><text id=\"the_end\">The End</text><text id=\"free_game\">Registreara dig</text><userType id=\"0\">1</userType></gamedata>";
static var SHOW_INFO_SCREEN_TIME = 125;
static var SHOW_HOW_TO_SCREEN_TIME = 250;
static var SHOW_GAME_OVER_TIME = 125;
static var SHOW_TROPHIES_TIME = 125;
static var SHOW_FREE_GAME_END_TIME = 250;
static var TICKS_PER_SEC = 25;
static var GAME_PLAY_TIME = 550;
static var STATE_WAIT_FOR_GAMEDATA = 0;
static var STATE_SHOW_INFO_SCREEN = 1;
static var STATE_SHOW_HOW_TO_SCREEN = 2;
static var STATE_STAR_TRANSITION_PLAY_GAME = 3;
static var STATE_PLAY_GAME = 4;
static var STATE_BETWEEN_ROUNDS = 5;
static var STATE_STAR_TRANSITION_END_GAME = 6;
static var STATE_END_GAME = 7;
static var STATE_SHOW_TROPHIES = 8;
static var STATE_NOT_RUNNING = 9;
static var STATE_GAME_QUIT_HAS_BEEN_SENT = 10;
static var STATE_FREE_GAME_ENDING = 11;
}
Symbol 721 MovieClip [__Packages.com.king.Chuzzle.ScreenPlayer] Frame 0
class com.king.Chuzzle.ScreenPlayer
{
var trophyHeadingTextData, trophyInfoTextData, levelUpLightHandler, howToScreenVisible, howToTickCounter, deltaBonus, levelUpVisible, levelUpTickCounter, bottleTickCounter, levelUpBonusCounter, level, levelUpBonusCounterString, starScreenVisible, starScreenFrameCounter, quadBoomerHighlight, tripleBoomerHighlight, tripleComboHighlight, reactorHighlight, quadComboHighlight, sevenAtOnceHighlight, quadBoomerVisible, quadBoomerFrame, tripleBoomerVisible, tripleBoomerFrame, tripleComboVisible, tripleComboFrame, reactorVisible, reactorFrame, quadComboVisible, quadComboFrame, sevenAtOnceVisible, sevenAtOnceFrame, introScreenVisible, gameOverScreenVisible, gameOverScore, trophiesScreenVisible, trophiesScore;
function ScreenPlayer (parentClip) {
levelUpClip = _root.LevelUp_mc;
levelUpLightClip = _root.LevelUpLight_mc;
introScreenClip = _root.IntroScreen_mc;
howToScreenClip = _root.HowToScreen_mc;
howToMovieClip = howToScreenClip.HowToMovie_mc;
gameOverClip = _root.GameOverScreen_mc;
trophiesClip = _root.TrophiesScreen_mc;
starScreenClip = _root.StarScreen_mc;
bottleShakeClip = _root.BottleShake_mc;
bottleInnerClip = bottleShakeClip.InnerBottle_mc;
freeSignClip = _root.FreeSign_mc;
levelUpHide();
introScreenHide();
howToScreenHide();
gameOverScreenHide();
trophiesScreenHide();
starScreenHide();
hideFreeSign();
quadBoomerHide();
tripleBoomeHide();
tripleComboHide();
reactorHide();
quadComboHide();
sevenAtOnceHide();
trophyHeadingTextData = new Array(7);
trophyHeadingTextData[0] = "";
trophyHeadingTextData[1] = com.king.Chuzzle.TextProperties.SEVEN_AT_ONCE;
trophyHeadingTextData[2] = com.king.Chuzzle.TextProperties.TRIPLE_BOOMER;
trophyHeadingTextData[3] = com.king.Chuzzle.TextProperties.QUAD_BOOMER;
trophyHeadingTextData[4] = com.king.Chuzzle.TextProperties.TRIPLE_COMBO;
trophyHeadingTextData[5] = com.king.Chuzzle.TextProperties.QUAD_COMBO;
trophyHeadingTextData[6] = com.king.Chuzzle.TextProperties.REACTOR;
trophyInfoTextData = new Array(7);
trophyInfoTextData[0] = "";
trophyInfoTextData[1] = com.king.Chuzzle.TextProperties.SEVEN_AT_ONCE_TEXT;
trophyInfoTextData[2] = com.king.Chuzzle.TextProperties.TRIPLE_BOOMER_TEXT;
trophyInfoTextData[3] = com.king.Chuzzle.TextProperties.QUAD_BOOMER_TEXT;
trophyInfoTextData[4] = com.king.Chuzzle.TextProperties.TRIPLE_COMBO_TEXT;
trophyInfoTextData[5] = com.king.Chuzzle.TextProperties.QUAD_COMBO_TEXT;
trophyInfoTextData[6] = com.king.Chuzzle.TextProperties.REACTOR_TEXT;
levelUpLightHandler = new com.king.Chuzzle.LevelUpLightHandler(_root.Game3_mc);
introScreenClip.game_starts_in_txt.text = com.king.Chuzzle.TextProperties.GAME_STARTS_IN;
howToScreenClip.game_starts_in_txt.text = com.king.Chuzzle.TextProperties.GAME_STARTS_IN;
gameOverClip.game_ends_in_txt.text = com.king.Chuzzle.TextProperties.GAME_ENDS_IN;
trophiesClip.game_ends_in_txt.text = com.king.Chuzzle.TextProperties.GAME_ENDS_IN;
howToScreenClip.how_to_heading_txt.text = com.king.Chuzzle.TextProperties.HOW_TO_HEADING;
howToScreenClip.how_to_txt.text = com.king.Chuzzle.TextProperties.HOW_TO;
trophiesClip.trophies_heading_txt.text = com.king.Chuzzle.TextProperties.TROPHIES_HEADING;
gameOverClip.GameOver_mc.game_over_txt.text = com.king.Chuzzle.TextProperties.GAME_OVER;
_root.exitButtonText = com.king.Chuzzle.TextProperties.EXIT_GAME;
_root.Level_mc.level_txt.text = com.king.Chuzzle.TextProperties.LEVEL;
_root.ScrambleSign_mc.scramble_txt.text = com.king.Chuzzle.TextProperties.SCRAMBLE;
freeSignClip.freeplay_txt.text = com.king.Chuzzle.TextProperties.FREE_PLAY_TEXT;
}
function setGameStartsIn(tick) {
var _local3 = Math.floor(tick / 25);
if (_local3 < 0) {
_local3 = 0;
}
var _local4 = String(_local3);
var _local2 = com.king.Chuzzle.TextProperties.GAME_STARTS_IN;
_local2 = _local2.split("[0]").join(_local4);
introScreenClip.game_starts_in_txt.text = _local2;
howToScreenClip.game_starts_in_txt.text = _local2;
}
function setGameEndsIn(tick) {
var _local3 = Math.floor(tick / 25);
if (_local3 < 0) {
_local3 = 0;
}
var _local4 = String(_local3);
var _local2 = com.king.Chuzzle.TextProperties.GAME_ENDS_IN;
_local2 = _local2.split("[0]").join(_local4);
trophiesClip.game_ends_in_txt.text = _local2;
gameOverClip.game_ends_in_txt.text = _local2;
}
function setFreeGameEndsIn(tick) {
var _local2 = Math.floor(tick / 25);
if (_local2 < 0) {
_local2 = 0;
}
var _local4 = String(_local2);
var _local3 = com.king.Chuzzle.TextProperties.GAME_ENDS_IN;
_local3 = _local3.split("[0]").join(_local4);
freeSignClip.game_ends_txt.text = _local3;
}
function tick(tick) {
if (howToScreenVisible) {
howToTickCounter = howToTickCounter + 3;
if (howToTickCounter >= 560) {
howToTickCounter = 0;
}
}
deltaBonus = 0;
if (levelUpVisible) {
if (levelUpTickCounter == 1) {
levelUpLightHandler.startGenerate();
}
levelUpLightHandler.update();
deltaBonus = 0;
levelUpTickCounter = levelUpTickCounter + 2;
bottleTickCounter = bottleTickCounter + 2;
if (bottleTickCounter > 350) {
bottleTickCounter = 350;
}
if (levelUpTickCounter >= 535) {
levelUpTickCounter = 535;
}
if (levelUpTickCounter < 154) {
levelUpBonusCounter = 0;
} else if ((levelUpTickCounter >= 154) && (levelUpTickCounter <= 295)) {
deltaBonus = 15 * level;
levelUpBonusCounter = levelUpBonusCounter + deltaBonus;
}
if (levelUpBonusCounter >= (1000 * level)) {
deltaBonus = deltaBonus - (levelUpBonusCounter - (1000 * level));
levelUpBonusCounter = 1000 * level;
}
if (levelUpBonusCounter == 0) {
levelUpBonusCounterString = "";
} else {
levelUpBonusCounterString = String(levelUpBonusCounter);
}
}
if (starScreenVisible) {
starScreenClip.gotoAndStop(starScreenFrameCounter);
if (starScreenFrameCounter > 25) {
starScreenVisible = false;
}
starScreenFrameCounter = starScreenFrameCounter + 1;
}
if (quadBoomerClip.hitTest(_root._xmouse, _root._ymouse, true)) {
quadBoomerHighlight = true;
trophyHeader.text = trophyHeadingTextData[3];
trophyInfo.text = trophyInfoTextData[3];
} else if (tripleBoomerClip.hitTest(_root._xmouse, _root._ymouse, true)) {
tripleBoomerHighlight = true;
trophyHeader.text = trophyHeadingTextData[2];
trophyInfo.text = trophyInfoTextData[2];
} else if (tripleComboClip.hitTest(_root._xmouse, _root._ymouse, true)) {
tripleComboHighlight = true;
trophyHeader.text = trophyHeadingTextData[4];
trophyInfo.text = trophyInfoTextData[4];
} else if (reactorClip.hitTest(_root._xmouse, _root._ymouse, true)) {
reactorHighlight = true;
trophyHeader.text = trophyHeadingTextData[6];
trophyInfo.text = trophyInfoTextData[6];
} else if (quadComboClip.hitTest(_root._xmouse, _root._ymouse, true)) {
quadComboHighlight = true;
trophyHeader.text = trophyHeadingTextData[5];
trophyInfo.text = trophyInfoTextData[5];
} else if (sevenAtOnceClip.hitTest(_root._xmouse, _root._ymouse, true)) {
sevenAtOnceHighlight = true;
trophyHeader.text = trophyHeadingTextData[1];
trophyInfo.text = trophyInfoTextData[1];
} else {
trophyHeader.text = trophyHeadingTextData[0];
trophyInfo.text = trophyInfoTextData[0];
}
if (quadBoomerVisible) {
quadBoomerFrame = 2;
if (quadBoomerHighlight) {
quadBoomerFrame = 3;
quadBoomerHighlight = false;
}
} else {
quadBoomerFrame = 1;
}
if (tripleBoomerVisible) {
tripleBoomerFrame = 2;
if (tripleBoomerHighlight) {
tripleBoomerFrame = 3;
tripleBoomerHighlight = false;
}
} else {
tripleBoomerFrame = 1;
}
if (tripleComboVisible) {
tripleComboFrame = 2;
if (tripleComboHighlight) {
tripleComboFrame = 3;
tripleComboHighlight = false;
}
} else {
tripleComboFrame = 1;
}
if (reactorVisible) {
reactorFrame = 2;
if (reactorHighlight) {
reactorFrame = 3;
reactorHighlight = false;
}
} else {
reactorFrame = 1;
}
if (quadComboVisible) {
quadComboFrame = 2;
if (quadComboHighlight) {
quadComboFrame = 3;
quadComboHighlight = false;
}
} else {
quadComboFrame = 1;
}
if (sevenAtOnceVisible) {
sevenAtOnceFrame = 2;
if (sevenAtOnceHighlight) {
sevenAtOnceFrame = 3;
sevenAtOnceHighlight = false;
}
} else {
sevenAtOnceFrame = 1;
}
}
function render(tick, alpha) {
_root.LevelUp_mc.spot_mc.level_up_txt.text = com.king.Chuzzle.TextProperties.LEVEL_UP;
_root.LevelUp_mc.Bonus_mc.Bonus2_txt.text = com.king.Chuzzle.TextProperties.BONUS;
_root.LevelUp_mc.Ready_mc.ready_txt.text = com.king.Chuzzle.TextProperties.READY;
_root.LevelUp_mc.Go_mc.go_txt.text = com.king.Chuzzle.TextProperties.GO;
if (levelUpVisible) {
levelUpLightClip._visible = false;
levelUpClip._visible = true;
levelUpClip.gotoAndStop(levelUpTickCounter);
levelUpClip.Bonus_mc.Bonus_txt.text = levelUpBonusCounterString;
levelUpLightClip._visible = true;
levelUpLightClip.gotoAndStop(levelUpTickCounter);
bottleShakeClip.gotoAndStop(Math.floor(bottleTickCounter));
bottleInnerClip.gotoAndStop(Math.floor(bottleTickCounter));
bottleShakeClip._visible = true;
} else {
levelUpClip._visible = false;
levelUpLightClip._visible = false;
bottleShakeClip._visible = false;
}
if (introScreenVisible) {
introScreenClip._visible = true;
} else {
introScreenClip._visible = false;
}
if (howToScreenVisible) {
howToScreenClip._visible = true;
howToMovieClip.gotoAndStop(howToTickCounter);
} else {
howToScreenClip._visible = false;
}
if (gameOverScreenVisible) {
gameOverClip._visible = true;
gameOverClip.GameOver_mc.GameOverScore_txt.text = gameOverScore;
} else {
gameOverClip._visible = false;
}
if (trophiesScreenVisible) {
trophiesClip._visible = true;
trophiesClip.TrophyScore_txt.text = trophiesScore;
} else {
trophiesClip._visible = false;
}
if (starScreenVisible) {
starScreenClip._visible = true;
} else {
starScreenClip._visible = false;
}
quadBoomerClip.gotoAndStop(quadBoomerFrame);
tripleBoomerClip.gotoAndStop(tripleBoomerFrame);
tripleComboClip.gotoAndStop(tripleComboFrame);
reactorClip.gotoAndStop(reactorFrame);
quadComboClip.gotoAndStop(quadComboFrame);
sevenAtOnceClip.gotoAndStop(sevenAtOnceFrame);
levelUpLightHandler.render();
}
function levelUpStart(level) {
this.level = level;
levelUpBonusCounter = 0;
levelUpTickCounter = 1;
bottleTickCounter = 1;
levelUpVisible = true;
}
function levelUpHide() {
levelUpVisible = false;
}
function introScreenShow() {
introScreenVisible = true;
}
function introScreenHide() {
introScreenVisible = false;
}
function howToScreenShow() {
howToScreenVisible = true;
howToTickCounter = 0;
}
function howToScreenHide() {
howToScreenVisible = false;
}
function gameOverScreenShow(score) {
gameOverScore = (com.king.Chuzzle.TextProperties.FINAL_SCORE + " ") + String(score);
gameOverScreenVisible = true;
}
function gameOverScreenHide() {
gameOverScreenVisible = false;
}
function trophiesScreenShow(score) {
trophiesScore = (com.king.Chuzzle.TextProperties.FINAL_SCORE + " ") + String(score);
trophiesScreenVisible = true;
}
function trophiesScreenHide() {
trophiesScreenVisible = false;
}
function starScreenShow() {
starScreenVisible = true;
starScreenFrameCounter = 1;
}
function starScreenHide() {
starScreenVisible = false;
}
function quadBoomerHide() {
quadBoomerVisible = false;
}
function tripleBoomeHide() {
tripleBoomerVisible = false;
}
function tripleComboHide() {
tripleComboVisible = false;
}
function reactorHide() {
reactorVisible = false;
}
function quadComboHide() {
quadComboVisible = false;
}
function sevenAtOnceHide() {
sevenAtOnceVisible = false;
}
function quadBoomerShow() {
quadBoomerVisible = true;
}
function tripleBoomerShow() {
tripleBoomerVisible = true;
}
function tripleComboShow() {
tripleComboVisible = true;
}
function reactorShow() {
reactorVisible = true;
}
function quadComboShow() {
quadComboVisible = true;
}
function sevenAtOnceShow() {
sevenAtOnceVisible = true;
}
function showFreeSign() {
freeSignClip._visible = true;
}
function hideFreeSign() {
freeSignClip._visible = false;
}
var introScreenClip = null;
var howToScreenClip = null;
var howToMovieClip = null;
var gameOverClip = null;
var trophiesClip = null;
var levelUpClip = null;
var levelUpLightClip = null;
var starScreenClip = null;
var bottleShakeClip = null;
var bottleInnerClip = null;
var freeSignClip = null;
static var quadBoomerClip = _root.TrophiesScreen_mc.TrophyQuadBoomer_mc;
static var tripleBoomerClip = _root.TrophiesScreen_mc.TrophyTripleBoomer_mc;
static var tripleComboClip = _root.TrophiesScreen_mc.TrophyTripleCombo_mc;
static var reactorClip = _root.TrophiesScreen_mc.TrophyReactor_mc;
static var quadComboClip = _root.TrophiesScreen_mc.TrophyQuadCombo_mc;
static var sevenAtOnceClip = _root.TrophiesScreen_mc.Trophy7AtOnce_mc;
static var trophyHeader = _root.TrophiesScreen_mc.TrophyHeading_txt;
static var trophyInfo = _root.TrophiesScreen_mc.TrophyInfo_txt;
}
Symbol 722 MovieClip [__Packages.com.king.Chuzzle.LevelUpLightHandler] Frame 0
class com.king.Chuzzle.LevelUpLightHandler
{
var parentClip, effectObjects, newEffectObjects, frameCounter, createFrame;
function LevelUpLightHandler (parentClip) {
this.parentClip = parentClip;
generate = false;
effectObjects = new Array();
newEffectObjects = new Array();
}
function startGenerate() {
frameCounter = 0;
generate = true;
setupNextCreate();
}
function setupNextCreate() {
createFrame = frameCounter + Math.floor((Math.random() * MAX_FRAME_TIME_BEFOREGENERATION) + 1);
}
function update() {
if (generate && (frameCounter <= LAST_GENERATE_FRAME)) {
if (createFrame == frameCounter) {
createLevelUplight();
setupNextCreate();
}
frameCounter++;
}
updating();
removeObjects();
}
function render() {
var _local2 = 0;
while (_local2 < effectObjects.length) {
effectObjects[_local2].updateClip();
_local2++;
}
}
function createLevelUplight() {
var _local3 = randomBetween(300, 500);
var _local2 = randomBetween(100, 300);
var _local5 = Math.floor(Math.random() * 4);
switch (_local5) {
case 0 :
_local3 = randomBetween(186, 206);
_local2 = randomBetween(18, 478);
break;
case 1 :
_local3 = randomBetween(647, 667);
_local2 = randomBetween(18, 478);
break;
case 2 :
_local3 = randomBetween(197, 657);
_local2 = randomBetween(9, 29);
break;
case 3 :
_local3 = randomBetween(197, 657);
_local2 = randomBetween(467, 487);
}
var _local4 = new com.king.Chuzzle.LevelUpLight(_local3, _local2, parentClip);
newEffectObjects.push(_local4);
}
function randomBetween(minValue, maxValue) {
return(Math.floor(Math.random() * ((maxValue - minValue) + 1)) + minValue);
}
function updating() {
var _local2 = 0;
while (_local2 < effectObjects.length) {
effectObjects[_local2].update();
_local2++;
}
_local2 = 0;
while (_local2 < newEffectObjects.length) {
newEffectObjects[_local2].update();
effectObjects.push(newEffectObjects[_local2]);
_local2++;
}
while (newEffectObjects.length > 0) {
newEffectObjects.pop();
}
}
function removeObjects() {
var _local2 = 0;
while (_local2 < effectObjects.length) {
if (effectObjects[_local2].toBeRemoved) {
if (_local2 == (effectObjects.length - 1)) {
var _local3 = effectObjects.pop();
_local3.deleteClip();
} else {
var _local4 = effectObjects.pop();
var _local3 = effectObjects[_local2];
_local3.deleteClip();
effectObjects[_local2] = _local4;
_local2 = 0;
}
}
_local2++;
}
}
function removeAllEffectObjects() {
while (effectObjects.length > 0) {
var _local2 = effectObjects.pop();
_local2.deleteClip();
}
while (newEffectObjects.length > 0) {
var _local2 = newEffectObjects.pop();
_local2.deleteClip();
}
}
static function resetDepthCounter() {
com.king.Chuzzle.EffectObject.resetDepthCounter();
}
static var MAX_FRAME_TIME_BEFOREGENERATION = 10;
static var LAST_GENERATE_FRAME = 240;
var generate = true;
}
Symbol 723 MovieClip [__Packages.com.king.Chuzzle.LevelUpLight] Frame 0
class com.king.Chuzzle.LevelUpLight
{
var parentClip, visible, toBeRemoved, animFrame, clip, posY, posX;
function LevelUpLight (posX, posY, parentClip) {
setPos(posX, posY);
this.parentClip = parentClip;
createClip();
visible = true;
toBeRemoved = false;
animFrame = 1;
}
function createClip() {
var _local2 = "leveluplight" + depth;
clip = parentClip.attachMovie("leveluplight_anim", _local2, depth++, {_x:posX, _y:posY});
}
function setPos(posX, posY) {
this.posX = posX;
this.posY = posY;
}
function update() {
if (animFrame < ANIM_LENGTH) {
animFrame++;
} else {
toBeRemoved = true;
}
}
function updateClip() {
clip._x = posX;
clip._y = posY;
clip.gotoAndStop(animFrame);
if (visible) {
clip._visible = true;
} else {
clip._visible = false;
}
}
function deleteClip() {
removeMovieClip(clip);
}
static function resetDepthCounter() {
depth = LEVELUPLIGHT_START_DEPTH;
}
static var LEVELUPLIGHT_START_DEPTH = 10000;
static var ANIM_LENGTH = 30;
static var depth = LEVELUPLIGHT_START_DEPTH;
}
Symbol 724 MovieClip [__Packages.com.king.Chuzzle.EffectObject] Frame 0
class com.king.Chuzzle.EffectObject
{
var parentClip, visible, toBeRemoved, type, posX, posY, clip, animFrame;
function EffectObject (posX, posY, parentClip) {
setPos(posX, posY);
this.parentClip = parentClip;
createClip();
visible = true;
toBeRemoved = false;
type = 0;
}
function createClip() {
}
function setPos(posX, posY) {
this.posX = posX;
this.posY = posY;
}
function update() {
}
function updateClip() {
clip._x = posX;
clip._y = posY;
clip.gotoAndStop(animFrame);
if (visible) {
clip._visible = true;
} else {
clip._visible = false;
}
}
function setToBeRemoved() {
toBeRemoved = true;
}
function deleteClip() {
removeMovieClip(clip);
}
static function resetDepthCounter() {
depth = EFFECTOBJECT_START_DEPTH;
}
static var EFFECTOBJECT_START_DEPTH = 600000;
static var depth = EFFECTOBJECT_START_DEPTH;
}
Symbol 725 MovieClip [__Packages.com.king.Chuzzle.TextProperties] Frame 0
class com.king.Chuzzle.TextProperties
{
function TextProperties () {
}
static var GAME_STARTS_IN = "GAME_STARTS_IN";
static var HOW_TO_HEADING = "HOW_TO_HEADING";
static var HOW_TO = "HOW_TO";
static var TROPHIES_HEADING = "TROPHIES_HEADING";
static var FINAL_SCORE = "FINAL_SCORE";
static var GAME_ENDS_IN = "GAME_ENDS_IN";
static var SEVEN_AT_ONCE = "SEVEN_AT_ONCE";
static var TRIPLE_COMBO = "TRIPLE_COMBO";
static var QUAD_COMBO = "QUAD_COMBO";
static var TRIPLE_BOOMER = "TRIPLE_BOOMER";
static var QUAD_BOOMER = "QUAD_BOOMER";
static var REACTOR = "SEVEN_AT_ONCE";
static var SEVEN_AT_ONCE_TEXT = "SEVEN_AT_ONCE_TEXT";
static var TRIPLE_COMBO_TEXT = "TRIPLE_COMBO_TEXT";
static var QUAD_COMBO_TEXT = "QUAD_COMBO_TEXT";
static var TRIPLE_BOOMER_TEXT = "TRIPLE_BOOMER_TEXT";
static var QUAD_BOOMER_TEXT = "QUAD_BOOMER_TEXT";
static var REACTOR_TEXT = "REACTOR_TEXT";
static var GAME_OVER = "GAME_OVER";
static var SUPER_POP = "SUPER_POP";
static var COMBO_POP = "COMBO_POP";
static var EXIT_GAME = "EXIT_GAME";
static var LEVEL = "LEVEL";
static var SCRAMBLE = "SCRAMBLE";
static var LEVEL_UP = "LEVEL_UP";
static var BONUS = "BONUS";
static var READY = "READY";
static var GO = "GO";
static var THE_END = "THE END";
static var FREE_PLAY_TEXT = "FREE_PLAY_TEXT";
}
Symbol 726 MovieClip [__Packages.com.king.Chuzzle.Input] Frame 0
class com.king.Chuzzle.Input
{
static var isEnabled, mouseIsPressed, mouseIsReleased, xMouse, yMouse;
function Input () {
}
static function setup() {
isEnabled = true;
reset();
}
static function reset() {
mouseIsPressed = false;
mouseIsReleased = false;
}
static function enable() {
isEnabled = true;
}
static function disable() {
isEnabled = false;
reset();
}
static function setMousePos(mousePosX, mousePosY) {
xMouse = mousePosX;
yMouse = mousePosY;
}
static function mousePressed() {
mouseIsPressed = true;
}
static function mouseReleased() {
mouseIsReleased = true;
}
static function traceInput() {
}
}
Symbol 727 MovieClip [__Packages.com.king.timing.Timer] Frame 0
class com.king.timing.Timer
{
var timeable;
function Timer (timeable, gameTicksPerSecond) {
millisPerGameTick = 1000 / gameTicksPerSecond;
this.timeable = timeable;
maxTickTime = 1000;
}
function getMillisPerTick() {
return(millisPerGameTick);
}
function setMaxTickTime(millis) {
maxTickTime = millis;
}
function advanceTime2() {
var _local2 = getTimer();
if (startTime < 0) {
startTime = _local2;
unprocessedTime = millisPerGameTick;
}
time = _local2 - startTime;
var _local3 = time - lastTime;
lastTime = time;
unprocessedTime = unprocessedTime + _local3;
if (unprocessedTime >= millisPerGameTick) {
var _local4 = maxTickTime + _local2;
do {
timeable.tick(tick);
tick = tick + 1;
unprocessedTime = unprocessedTime - millisPerGameTick;
} while ((unprocessedTime >= millisPerGameTick) && (getTimer() < _local4));
}
var _local5 = unprocessedTime % (millisPerGameTick / millisPerGameTick);
com.king.timing.IFloat.setAlpha(_local5);
timeable.render(tick, _local5);
}
function advanceTime() {
time = getTimer();
var _local2 = time - lastTime;
lastTime = time;
unprocessedTime = unprocessedTime + _local2;
var _local3 = 0;
while (unprocessedTime > millisPerGameTick) {
unprocessedTime = unprocessedTime - millisPerGameTick;
timeable.tick(tick);
tick = tick + 1;
_local3 = _local3 + 1;
if (_local3 >= 10) {
unprocessedTime = 0;
}
}
var _local4 = unprocessedTime / millisPerGameTick;
timeable.render(tick, _local4);
}
var time = 0;
var startTime = -1;
var lastTime = 0;
var unprocessedTime = 0;
var tick = 0;
var millisPerGameTick = 0;
var maxTickTime = -1;
}
Symbol 728 MovieClip [__Packages.com.king.timing.IFloat] Frame 0
class com.king.timing.IFloat
{
static var alpha;
var ivalue, lastValue;
function IFloat (initial) {
ivalue = initial;
lastValue = initial;
alpha = 0;
}
function setTo(initial) {
ivalue = initial;
lastValue = initial;
}
function set(newValue) {
lastValue = ivalue;
ivalue = newValue;
}
function get(lalpha) {
return(lastValue + ((ivalue - lastValue) * lalpha));
}
static function setAlpha(na) {
alpha = na;
}
function get value() {
return(lastValue + ((ivalue - lastValue) * alpha));
}
function set value(v) {
ivalue = v;
lastValue = v;
//return(value);
}
}
Symbol 729 MovieClip [__Packages.com.king.util.Communicator] Frame 0
class com.king.util.Communicator
{
var levelDatas, randomSeed, lang;
function Communicator () {
levelDatas = new Array();
}
function gameStarted() {
if (NORMAL) {
if (!hasSentGameStart) {
hasSentGameStart = true;
fscommand ("gameStart");
}
}
}
function gameQuit() {
if (NORMAL) {
if (!hasSentGameOver) {
hasSentGameOver = true;
fscommand ("gameQuit");
}
}
}
function gameEnd(score) {
if (NORMAL) {
if (!hasSentGameEnd) {
hasSentGameEnd = true;
fscommand ("gameEnd", score);
}
}
}
function startRound(tick, gTime, cVer, ltc) {
if (NORMAL) {
fscommand ("playData", (((((((CMD_START_ROUND + ",") + tick) + " ") + gTime) + " ") + cVer) + " ") + ltc);
}
}
function sendBrickClicked(tick, x, y) {
if (NORMAL) {
fscommand ("playData", (((((CMD_BRICK_CLICKED + ",") + tick) + " ") + x) + " ") + y);
}
}
function sendGameTime(tick, gameTime) {
if (NORMAL) {
fscommand ("playData", (((CMD_GAME_TIME + ",") + tick) + " ") + gameTime);
}
}
function gameLastTick(tick, gTime) {
if (NORMAL) {
if (!hasSentLastTick) {
hasSentLastTick = true;
fscommand ("playData", (((CMD_LAST_TICK + ",") + tick) + " ") + gTime);
}
}
}
function sendUpdateScore(tick, scr) {
if (NORMAL) {
fscommand ("playData", (((CMD_SEND_SCORE + ",") + tick) + " ") + scr);
}
}
function parseGameData(gameData) {
var _local8 = new XML(_root.gameData);
_global.textMappings = new Object();
_global.userType = new Object();
var _local5 = _local8.childNodes[0].childNodes;
randomSeed = new Number(_local8.childNodes[0].attributes.randomseed).valueOf();
lang = _local8.childNodes[0].attributes.lang.valueOf();
var _local9 = _local8.childNodes[0].attributes.relaxMode;
if (_local9 == "true") {
relaxGame = true;
} else {
relaxGame = false;
}
var _local4 = 0;
while (_local4 < _local5.length) {
_root.debugText.text = _root.debugText.text + ("\r" + _local5[_local4].nodeName);
if (_local5[_local4].nodeName == "text") {
if (_local5[_local4].attributes.id == "game_starts_in") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.GAME_STARTS_IN = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "how_to_heading") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.HOW_TO_HEADING = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "how_to") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.HOW_TO = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "trophies_title") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.TROPHIES_HEADING = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "final_score") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.FINAL_SCORE = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "game_ends_in") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.GAME_ENDS_IN = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "7_at_once") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.SEVEN_AT_ONCE = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "triple_combo") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.TRIPLE_COMBO = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "quad_combo") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.QUAD_COMBO = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "triple_boomer") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.TRIPLE_BOOMER = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "quad_boomer") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.QUAD_BOOMER = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "reactor") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.REACTOR = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "7_at_once_text") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.SEVEN_AT_ONCE_TEXT = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "triple_combo_text") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.TRIPLE_COMBO_TEXT = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "quad_combo_text") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.QUAD_COMBO_TEXT = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "triple_boomer_text") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.TRIPLE_BOOMER_TEXT = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "quad_boomer_text") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.QUAD_BOOMER_TEXT = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "reactor_text") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.REACTOR_TEXT = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "game_over") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.GAME_OVER = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "exit_game") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.EXIT_GAME = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "super_pop") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.SUPER_POP = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "combo_pop") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.COMBO_POP = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "level") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.LEVEL = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "scramble") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.SCRAMBLE = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "level_up") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.LEVEL_UP = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "bonus") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.BONUS = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "ready") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.READY = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "go") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.GO = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "the_end") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.THE_END = fixStr(_local7);
} else if (_local5[_local4].attributes.id == "free_game") {
var _local7 = new String(_local5[_local4].firstChild.nodeValue);
com.king.Chuzzle.TextProperties.FREE_PLAY_TEXT = fixStr(_local7);
}
}
if (_local5[_local4].nodeName == "level") {
levelDatas[_local5[_local4].attributes.id] = new String(_local5[_local4].firstChild.nodeValue);
}
if (_local5[_local4].nodeName == "userType") {
var _local6 = new String(_local5[_local4].firstChild.nodeValue);
if (_local6 == "0") {
freeGame = true;
} else {
freeGame = false;
}
}
_local4++;
}
}
function fixStr(inStr) {
var _local1 = inStr.split("\r\n").join(newline);
return(_local1);
}
static var NORMAL = true;
static var CMD_START_ROUND = 266;
static var CMD_BRICK_CLICKED = 389;
static var CMD_GAME_TIME = 111;
static var CMD_LAST_TICK = 912;
static var CMD_SEND_SCORE = 428;
static var CMD_SCORE_UPDATE = 397;
static var CMD_CLIENT_SPAWN = 13;
static var CMD_SEND_RANDOM_NUM = 99;
var hasSentGameStart = false;
var hasSentGameEnd = false;
var hasSentGameOver = false;
var hasSentLastTick = false;
var freeGame = false;
var relaxGame = false;
}
Symbol 730 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 731 MovieClip [__Packages.com.king.util.Map] Frame 0
class com.king.util.Map
{
var map, lastSize;
function Map (init) {
map = new Object();
for (var _local3 in init) {
map["" + _local3] = init[_local3];
}
lastSize = -1;
}
function put(key, value) {
map["" + key] = value;
lastSize = -1;
}
function get(key) {
return(map["" + key]);
}
function remove(key) {
var _local2 = "" + key;
var _local3 = map[_local2];
delete map[_local2];
lastSize = -1;
return(_local3);
}
function contains(key) {
return(map["" + key] != undefined);
}
function count() {
if (lastSize < 0) {
lastSize = 0;
for (var _local2 in map) {
lastSize++;
}
}
return(lastSize);
}
function size() {
return(count());
}
function clear() {
map = {};
lastSize = 0;
}
function dump() {
var _local2 = "";
for (var _local3 in map) {
_local2 = _local2 + (((_local3 + "=>") + map[_local3]) + newline);
}
trace(_local2);
}
function toArray() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = map[_local3];
}
return(_local2);
}
function keySet() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = _local3;
}
return(_local2);
}
function get iterator() {
return(new com.king.util.MapIterator(this));
}
function get valueIterator() {
return(new com.king.util.MapValueIterator(this));
}
function foreach(fn) {
var _local3 = arguments.slice(1);
if (_local3.length > 0) {
do {
if ((in map) == null) {
break;
}
var _local5 = in map;
} while (fn(_local5, map[_local5], _local3[0], _local3[1], _local3[2], _local3[3], _local3[4]) != false);
do {
} while ("foreach" != null);
} else {
do {
if ((in map) == null) {
break;
}
var _local5 = in map;
} while (fn(_local5, map[_local5]) != false);
do {
} while (_local2 != null);
}
lastSize = -1;
}
function get _content() {
return(map);
}
}
Symbol 732 MovieClip [__Packages.com.king.util.Iterator] Frame 0
interface com.king.util.Iterator
{
}
Symbol 733 MovieClip [__Packages.com.king.util.MapIterator] Frame 0
class com.king.util.MapIterator implements com.king.util.Iterator
{
var map, keys, ptr;
function MapIterator (map) {
this.map = map;
keys = map.keySet();
ptr = 0;
}
function next() {
if (ptr < keys.length) {
return(keys[ptr++]);
}
return(undefined);
}
function hasNext() {
return(ptr != keys.length);
}
function remove() {
if (ptr == 0) {
return(undefined);
}
map.remove(keys[ptr - 1]);
}
}
Symbol 734 MovieClip [__Packages.com.king.util.MapValueIterator] Frame 0
class com.king.util.MapValueIterator implements com.king.util.Iterator
{
var map, mapRef, keys, ptr;
function MapValueIterator (map) {
this.map = map;
mapRef = map._content;
keys = map.keySet();
ptr = 0;
}
function next() {
return(mapRef[keys[ptr++]]);
}
function hasNext() {
return(ptr != keys.length);
}
function remove() {
if (ptr == 0) {
return(undefined);
}
map.remove(keys[ptr - 1]);
}
}
Symbol 735 MovieClip [__Packages.com.king.util.SoundManager] Frame 0
class com.king.util.SoundManager
{
static var globalSound;
function SoundManager () {
}
static function isSoundEnabled() {
return(soundEnabled);
}
static function enableSounds(enabled) {
soundEnabled = enabled;
if (!enabled) {
muteAll();
} else {
restoreMuteAll();
}
}
static function toggleSound() {
if (globalSound == undefined) {
globalSound = new Sound(_root);
}
soundOn = !soundOn;
globalSound.setVolume((soundOn ? 100 : 0));
}
static function stopAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.stop();
soundEntry.playStatus = false;
});
}
static function muteAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.setVolume(0);
soundEntry.isMuted = true;
});
}
static function restoreMuteAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.setVolume(soundEntry.realVol);
soundEntry.isMuted = false;
});
}
static function stop(resource) {
var _local1 = sounds.get(resource);
if (_local1 != undefined) {
_local1.sound.stop();
_local1.playStatus = false;
}
}
static function getCalibratedVolume(flashVolume) {
flashVolume = Math.min(100, flashVolume);
flashVolume = Math.max(0, flashVolume);
return(Math.ceil(Math.pow(flashVolume / 100, 1.46) * 100));
}
static function setVolume(resource, percent) {
var _local1 = sounds.get(resource);
if ((_local1 != undefined) && (_local1.playStatus == true)) {
var _local2 = getCalibratedVolume(percent);
if (!_local1.isMuted) {
_local1.sound.setVolume(_local2);
}
_local1.realVol = _local2;
}
}
static function isPlaying(resource) {
var _local1 = sounds.get(resource);
return((_local1 != undefined) && (_local1.playStatus == true));
}
static function initialize(list) {
for (var _local9 in list) {
var resource = list[_local9];
var _local3 = _root.getNextHighestDepth();
var _local2 = new Sound(_root.createEmptyMovieClip("sm_sndhold_" + _local3, _local3));
_local2.attachSound(resource);
_local2.onSoundComplete = function () {
var _local1 = com.king.util.SoundManager.sounds.get(resource);
_local1.playStatus = false;
};
sounds.put(resource, {realVol:100, sound:_local2, playStatus:false});
}
}
static function play(resource, volume, isLoop, fn) {
if (volume == undefined) {
volume = 100;
}
if (isLoop == undefined) {
isLoop = false;
}
volume = getCalibratedVolume(volume);
var _local2 = sounds.get(resource);
if (_local2 != undefined) {
_local2.sound.setVolume((soundEnabled ? (volume) : 0));
_local2.realVol = volume;
_local2.isMuted = !soundEnabled;
_local2.playStatus = true;
_local2.onPlayedFn = fn;
_local2.sound.start(0, (isLoop ? 32767 : 1));
} else {
depth++;
var _local5 = _root.createEmptyMovieClip("sm_sndhold_" + depth, depth);
var _local4 = new Sound(_local5);
_local4.attachSound(resource);
_local4.onSoundComplete = function () {
var _local1 = com.king.util.SoundManager.sounds.get(resource);
_local1.playStatus = false;
com.king.util.SoundManager.onPlayed_(resource);
};
_local4.setVolume((soundEnabled ? (volume) : 0));
_local4.start(0, (isLoop ? 32767 : 1));
sounds.put(resource, {isMuted:!soundEnabled, realVol:volume, onPlayedFn:fn, sound:_local4, playStatus:true, movieClip:_local5});
}
}
static function onPlayed_(name) {
var _local1 = sounds.get(name);
if ((_local1 != undefined) && (_local1.onPlayedFn != undefined)) {
_local1.onPlayedFn();
}
}
static var depth = 1000;
static var sounds = new com.king.util.Map();
static var soundEnabled = true;
static var soundOn = true;
}
Symbol 736 MovieClip [__Packages.com.king.Chuzzle.Game] Frame 0
class com.king.Chuzzle.Game extends MovieClip
{
var gameState, inGameGUI, relaxMode, timeOn, enableInput, seed, random, lockRandom, gameTime, superSet, score, periodAddLockTime, lockTimeMaxOffset, quadBoomer, tripleBoomer, tripleCombo, reactor, quadCombo, sevenAtOnce, finishGameUp, bigsDeleatedInGame, diplomaFourCascade, diplomaBlastASuper, diplomaTripleCombo, newCascade, board, lastScore, cascades, possibleNewHint, level, containerClip, createEmptyMovieClip, containerClip2, containerClip3, bgClip, gameContentClip, bgMaskClip, effectContentClip, effectHandler, chuzzlesDeletedOnLevel, preChuzzlesDeletedOnLevel, waitBeforeEndLevelTicks, addLockTimer, nrChuzzlesDeletedAtOnce, nrChuzzlesSuperAtOnce, comboRemoveFirstMatchScore, currentTick, levelToBeDeleted, lockEnabled, addLockTime, _parent, removeMovieClip, cascadeNow, comboNow, matchNow, createSuperNow, BigBangNow, BreakLockNow;
function Game () {
super();
gameState = STATE_NOT_RUNNING;
inGameGUI = new com.king.Chuzzle.InGameGUI(MAX_GAME_TIME);
}
function initGame(seed, moneyGame, relaxGame) {
MONEY = moneyGame;
relaxMode = relaxGame;
timeOn = false;
enableInput = false;
this.seed = seed;
random = new com.king.util.Random(seed);
lockRandom = new com.king.util.Random(seed);
gameTime = 0;
superSet = new com.king.Chuzzle.SuperSet();
score = 0;
periodAddLockTime = START_ADD_LOCK_AT_TIME;
lockTimeMaxOffset = ADD_LOCK_TIME_MAX_OFFSET;
inGameGUI.setLevel(2);
gameState = STATE_RUNNING;
quadBoomer = false;
tripleBoomer = false;
tripleCombo = false;
reactor = false;
quadCombo = false;
sevenAtOnce = false;
finishGameUp = false;
bigsDeleatedInGame = 0;
diplomaFourCascade = 0;
diplomaBlastASuper = 0;
diplomaTripleCombo = 0;
newCascade = false;
}
function initLevel(level) {
timeOn = false;
enableInput = false;
if (board != null) {
cleanUp();
}
lastScore = 0;
cascades = 1;
possibleNewHint = true;
this.level = level;
var _local4;
if ((level % 2) == 0) {
_local4 = "Bg2Mask";
} else {
_local4 = "Bg1Mask";
}
containerClip = createEmptyMovieClip("container", 5);
containerClip2 = _root.Game2_mc.createEmptyMovieClip("container2", 6);
containerClip3 = _root.Game3_mc.createEmptyMovieClip("container3", 7);
bgClip = containerClip.attachMovie("Background1", "bg1", containerClip.getNextHighestDepth());
gameContentClip = containerClip.createEmptyMovieClip("GameContent", containerClip.getNextHighestDepth());
bgMaskClip = containerClip2.attachMovie(_local4, "bg2", containerClip2.getNextHighestDepth());
effectContentClip = containerClip3.createEmptyMovieClip("EffectContent", containerClip3.getNextHighestDepth());
board = new com.king.Chuzzle.Board(messageReciver, this, random, gameContentClip, superSet, lockRandom, MONEY, relaxMode);
effectHandler = new com.king.Chuzzle.EffectHandler(effectContentClip, bgMaskClip, messageReciver, this);
inGameGUI.init(relaxMode);
chuzzlesDeletedOnLevel = 0;
preChuzzlesDeletedOnLevel = 0;
inGameGUI.setBottle(chuzzlesDeletedOnLevel);
waitBeforeEndLevelTicks = 0;
addLockTimer = 0;
setupLevel(level);
calcNewAddLockTime();
inGameGUI.setLevel(level + 1);
nrChuzzlesDeletedAtOnce = 0;
nrChuzzlesSuperAtOnce = 0;
comboRemoveFirstMatchScore = false;
}
function start() {
enableInput = true;
timeOn = true;
com.king.Chuzzle.Input.enable();
board.theBoardHasChanged = true;
if (MONEY) {
fscommand ("playData", ((("41," + currentTick) + ",") + gameTime) + ",0=0");
}
}
function finishGame() {
finishGameUp = true;
}
function tick(tick) {
currentTick = tick;
switch (gameState) {
case STATE_RUNNING :
if ((preChuzzlesDeletedOnLevel >= levelToBeDeleted) || (gameTime >= MAX_GAME_TIME)) {
enableInput = false;
}
if (!enableInput) {
com.king.Chuzzle.Input.reset();
com.king.Chuzzle.Input.mouseReleased();
}
if (timeOn) {
if (relaxMode == false) {
gameTime++;
}
}
if (lockEnabled && (enableInput)) {
if ((addLockTimer++) == addLockTime) {
addLockTimer = 0;
calcNewAddLockTime();
board.addLock();
}
}
nrChuzzlesDeletedAtOnce = 0;
nrChuzzlesSuperAtOnce = 0;
board.tick(currentTick);
effectHandler.update(currentTick);
inGameGUI.setTimeBar(gameTime);
inGameGUI.tick();
if (chuzzlesDeletedOnLevel >= levelToBeDeleted) {
if (finishPlay()) {
if (MONEY) {
fscommand ("playData", ((((("45," + currentTick) + ",") + gameTime) + ",") + chuzzlesDeletedOnLevel) + ",0=0");
}
board.getSuperSet(superSet);
endLevel();
}
} else {
if (gameTime >= MAX_GAME_TIME) {
finishGameUp = true;
}
if (finishGameUp) {
enableInput = false;
if (finishPlay()) {
if (chuzzlesDeletedOnLevel >= levelToBeDeleted) {
if (MONEY) {
fscommand ("playData", ((((("46," + currentTick) + ",") + gameTime) + ",") + chuzzlesDeletedOnLevel) + ",0=0");
}
board.getSuperSet(superSet);
endLevel();
} else {
if (MONEY) {
fscommand ("playData", ((((("47," + currentTick) + ",") + gameTime) + ",") + chuzzlesDeletedOnLevel) + ",0=0");
}
endGame();
}
}
}
}
break;
case STATE_NOT_RUNNING :
}
}
function render(tick, alpha) {
switch (gameState) {
case STATE_RUNNING :
board.render(tick, alpha);
effectHandler.draw();
inGameGUI.draw();
break;
case STATE_NOT_RUNNING :
}
}
function setupLevel(level) {
switch (level) {
case 1 :
board.disableBig();
lockEnabled = false;
levelToBeDeleted = DELETE_LEVEL1;
break;
case 2 :
board.disableBig();
lockEnabled = false;
board.enableBig();
levelToBeDeleted = DELETE_LEVEL2;
break;
case 3 :
board.disableBig();
lockEnabled = false;
board.enableBig();
lockEnabled = true;
levelToBeDeleted = DELETE_LEVEL3;
break;
case 4 :
board.disableBig();
lockEnabled = false;
board.enableBig();
lockEnabled = true;
levelToBeDeleted = DELETE_LEVEL4;
periodAddLockTime = periodAddLockTime * 0.8;
periodAddLockTime = Math.floor(periodAddLockTime);
break;
case 5 :
board.disableBig();
lockEnabled = false;
board.enableBig();
lockEnabled = true;
levelToBeDeleted = DELETE_LEVEL5;
periodAddLockTime = periodAddLockTime * 0.8;
periodAddLockTime = Math.floor(periodAddLockTime);
break;
default :
board.disableBig();
lockEnabled = false;
board.enableBig();
lockEnabled = true;
levelToBeDeleted = DELETE_ABOVE_LEVEL5;
if (!relaxMode) {
break;
}
periodAddLockTime = periodAddLockTime * LOCK_SPEED_UP_VALUE;
periodAddLockTime = Math.floor(periodAddLockTime);
lockTimeMaxOffset = lockTimeMaxOffset * LOCK_SPEED_UP_VALUE;
lockTimeMaxOffset = Math.floor(lockTimeMaxOffset);
}
}
function getScore() {
return(score);
}
function endLevel() {
board.RemoveHint();
inGameGUI.hideBottle();
if (MONEY) {
fscommand ("playData", ((("42," + currentTick) + ",") + gameTime) + ",0=0");
}
_parent.endLevel();
}
function cleanUp() {
board.cleanUp();
effectHandler.removeAllEffectObjects();
com.king.Chuzzle.EffectHandler.resetDepthCounter();
removeMovieClip();
removeMovieClip();
removeMovieClip();
removeMovieClip();
removeMovieClip();
removeMovieClip();
removeMovieClip();
}
function endGame() {
if (MONEY) {
fscommand ("playData", ((("99," + currentTick) + ",") + gameTime) + ",0=0");
}
_parent.endGame();
}
function finishPlay() {
com.king.Chuzzle.Input.mouseReleased();
if (chuzzlesDeletedOnLevel == preChuzzlesDeletedOnLevel) {
waitBeforeEndLevelTicks++;
if (waitBeforeEndLevelTicks >= WAIT_AT_END_OF_LEVEL_TIME) {
effectHandler.removeAllEffectObjects();
return(true);
}
}
return(false);
}
function messageReciver(reciver, message, data) {
if (message == "test_message") {
reciver.onTestMessage();
} else if (message == "eye_deleted") {
reciver.onEyeDeleted();
} else if (message == "matching_starts") {
reciver.onMatchingStarts();
} else if (message == "cascades_starts") {
reciver.onCascadesStarts();
} else if (message == "matches") {
reciver.onMatches(message, data);
} else if (message == "combos") {
reciver.onCombos(message, data);
} else if (message == "cascades") {
reciver.onCascades(message, data);
} else if (message == "chuzzle_deleted") {
reciver.onChuzzleDeleted(message, data);
} else if (message == "big_chuzzle_deleted") {
reciver.onBigChuzzleDeleted(message, data);
} else if (message == "score_lock_delete") {
reciver.onScoreLockDelete();
} else if (message == "chuzzle_lock_deleted") {
reciver.onChuzzleLockDeleted(message, data);
} else if (message == "super_chuzzle_deleted") {
reciver.onSuperChuzzleDeleted(message, data);
} else if (message == "chuzzle_removed_by_super") {
reciver.onChuzzleRemovedBySuper(message, data);
} else if (message == "big_chuzzle_removed_by_super") {
reciver.onBigChuzzleRemovedBySuper(message, data);
} else if (message == "lock_set") {
reciver.onLockSet(message, data);
} else if (message == "scramble_start") {
reciver.onScrambleStart();
} else if (message == "scramble_end") {
reciver.onScrambleEnd();
} else if (message == "hint_shake") {
reciver.onHintShake();
} else if (message == "chuzzles_moving_back") {
reciver.onChuzzlesMovingBack();
} else if (message == "big_hit_wall_hor") {
reciver.onBigHitWallHor(message, data);
} else if (message == "big_hit_wall_ver") {
reciver.onBigHitWallVer(message, data);
} else if (message == "cannot_move_lock") {
reciver.onCannotMoveLock();
} else if (message == "show_hint") {
reciver.onShowHint(message, data);
} else if (message == "show_hint_wrap") {
reciver.onShowHintWrap(message, data);
} else if (message == "show_hint_big") {
reciver.onShowHintBig(message, data);
} else if (message == "hide_hint") {
reciver.onHideHint();
} else if (message == "score_chuzzle_delete") {
reciver.onScoreChuzzleDelete();
} else if (message == "score_big_chuzzle_delete") {
reciver.onScoreBigChuzzleDelete();
}
}
function onTestMessage(message) {
}
function onEyeDeleted() {
chuzzlesDeletedOnLevel++;
inGameGUI.setBottle(chuzzlesDeletedOnLevel);
if (MONEY) {
}
}
function onMatchingStarts() {
cascadeNow = 0;
comboNow = false;
matchNow = false;
createSuperNow = false;
BigBangNow = false;
BreakLockNow = false;
possibleNewHint = true;
}
function onCascadesStarts() {
lastScore = 0;
newCascade = true;
}
function onMatches(message, data) {
var _local2 = Number(data.nr);
var _local6 = Number(data.posX);
var _local5 = Number(data.posY);
var _local7 = Number(data.color);
var _local8 = Boolean(data.big);
if (_local2 > 6) {
sevenAtOnce = true;
}
if (_local2 >= 5) {
board.addSuper(_local7);
addScore(250, false);
effectHandler.createSuperPop(_local6, _local5);
if (!createSuperNow) {
com.king.util.SoundManager.play("ManyChuzzles");
createSuperNow = true;
}
}
var _local4 = getScoreForMatches(_local2, _local8);
effectHandler.createScorePop(_local6, _local5, _local4);
addScore(_local4, false);
if (matchNow) {
return(undefined);
}
switch (cascadeNow) {
case 0 :
case 1 :
com.king.util.SoundManager.play("Pop");
playRandomShriek();
break;
case 2 :
com.king.util.SoundManager.play("Pop2");
playRandomShriek();
break;
case 3 :
com.king.util.SoundManager.play("Pop3");
playRandomShriek();
break;
case 4 :
com.king.util.SoundManager.play("Pop4");
playRandomShriek();
break;
default :
com.king.util.SoundManager.play("Pop5");
playRandomShriek();
}
matchNow = true;
}
function onCombos(message, data) {
var _local2 = Number(data.nr);
var _local4 = Number(data.posX);
var _local3 = Number(data.posY);
effectHandler.createComboPop(_local4, _local3);
effectHandler.createScorePop(_local4, _local3 - 36, 500);
addScore(_local2 * 500, false);
comboRemoveFirstMatchScore = true;
if (!comboNow) {
com.king.util.SoundManager.play("Multipop");
comboNow = true;
}
if (_local2 > 1) {
tripleCombo = true;
diplomaTripleCombo++;
}
if (_local2 > 2) {
quadCombo = true;
}
}
function onCascades(message, data) {
var _local4 = Number(data.posX);
var _local3 = Number(data.posY);
cascades = Number(data.nr);
cascadeNow = Number(data.nr);
if (cascadeNow > 1) {
effectHandler.createMultiplier(_local4, _local3, cascadeNow);
}
if (cascadeNow > 6) {
reactor = true;
}
if ((cascades > 3) && (newCascade)) {
diplomaFourCascade++;
newCascade = false;
}
}
function onChuzzleDeleted(message, data) {
effectHandler.createSplode(data.posX, data.posY, data.color);
effectHandler.createTwoStars(data.posX, data.posY);
effectHandler.createAnimEyes(data.posX, data.posY, data.row, data.col, data.eyeColor, true);
preChuzzlesDeletedOnLevel++;
}
function onBigChuzzleDeleted(message, data) {
effectHandler.createBigSplode(data.posX, data.posY, data.color);
effectHandler.createTwoStars(data.posX, data.posY);
effectHandler.createAnimEyes(data.posX, data.posY, data.row, data.col, data.eyeColor, false);
preChuzzlesDeletedOnLevel++;
com.king.util.SoundManager.play("BigPop");
if (MONEY) {
fscommand ("playData", ((("32," + currentTick) + ",") + gameTime) + ",0=0");
}
bigsDeleatedInGame++;
}
function onScoreLockDelete() {
addScore(250, false);
if (MONEY) {
fscommand ("playData", ((("30," + currentTick) + ",") + gameTime) + ",0=0");
}
}
function onChuzzleLockDeleted(message, data) {
effectHandler.createLockBreak(data.posX, data.posY);
effectHandler.createAnimEyes(data.posX, data.posY, data.row, data.col, data.eyeColor, true);
preChuzzlesDeletedOnLevel++;
if (!BreakLockNow) {
BreakLockNow = true;
com.king.util.SoundManager.play("BreakLock");
}
}
function onSuperChuzzleDeleted(message, data) {
effectHandler.createSuperExplosion(data.posX, data.posY, data.color);
effectHandler.createSuperExplosionHair(data.posX, data.posY, data.color);
effectHandler.createAnimEyes(data.posX, data.posY, data.row, data.col, data.eyeColor, true);
preChuzzlesDeletedOnLevel++;
if (!BigBangNow) {
com.king.util.SoundManager.play("BigBang", 70);
BigBangNow = false;
}
superAtOnce();
if (MONEY) {
fscommand ("playData", ((("31," + currentTick) + ",") + gameTime) + ",0=0");
}
diplomaBlastASuper++;
}
function onChuzzleRemovedBySuper(message, data) {
effectHandler.createAnimEyes(data.posX, data.posY, data.row, data.col, data.eyeColor, true);
preChuzzlesDeletedOnLevel++;
}
function onBigChuzzleRemovedBySuper(message, data) {
bigsDeleatedInGame++;
}
function onLockSet(message, data) {
addLockTimer = 0;
effectHandler.createLock(data.posX, data.posY);
com.king.util.SoundManager.play("Lockit");
if (MONEY) {
fscommand ("playData", ((((((("19," + currentTick) + ",") + gameTime) + ",") + data.row) + ",") + data.col) + ",0=0");
}
}
function onScrambleStart() {
timeOn = false;
enableInput = false;
addLockTimer = 0;
inGameGUI.showScrambleSign();
com.king.util.SoundManager.play("ChuzzledDoom", 100, true);
if (MONEY) {
fscommand ("playData", ((("18," + currentTick) + ",") + gameTime) + ",0=0");
}
}
function onScrambleEnd() {
if (relaxMode) {
finishGame();
} else {
start();
}
inGameGUI.hideScrambleSign();
com.king.util.SoundManager.stop("ChuzzledDoom");
}
function onHintShake() {
com.king.util.SoundManager.play("Chuzzled");
}
function onChuzzlesMovingBack() {
com.king.util.SoundManager.play("BadMove");
}
function onBigHitWallHor(message, data) {
var _local3 = data.posX;
var _local2 = data.posY;
effectHandler.createFourStars(_local3, _local2, false);
com.king.util.SoundManager.play("ChuzzleBump");
}
function onBigHitWallVer(message, data) {
var _local3 = data.posX;
var _local2 = data.posY;
effectHandler.createFourStars(_local3, _local2, true);
com.king.util.SoundManager.play("ChuzzleBump");
}
function onCannotMoveLock() {
com.king.util.SoundManager.play("LockClank");
}
function onShowHint(message, data) {
var _local4 = Number(data.fromPosX);
var _local3 = Number(data.fromPosY);
var _local6 = Number(data.toPosX);
var _local5 = Number(data.toPosY);
effectHandler.createHintArrow(_local4, _local3, _local6, _local5);
if (possibleNewHint) {
subScore(lastScore);
lastScore = 0;
possibleNewHint = false;
}
}
function onShowHintWrap(message, data) {
var _local6 = Number(data.fromPosX);
var _local5 = Number(data.fromPosY);
var _local10 = Number(data.toPosX);
var _local9 = Number(data.toPosY);
var _local8 = Number(data.fromPosX2);
var _local7 = Number(data.fromPosY2);
var _local4 = Number(data.toPosX2);
var _local3 = Number(data.toPosY2);
effectHandler.createHintArrowWrap(_local6, _local5, _local10, _local9, _local8, _local7, _local4, _local3);
if (possibleNewHint) {
subScore(lastScore);
lastScore = 0;
possibleNewHint = false;
}
}
function onShowHintBig(message, data) {
var _local4 = Number(data.fromPosX);
var _local3 = Number(data.fromPosY);
var _local6 = Number(data.toPosX);
var _local5 = Number(data.toPosY);
effectHandler.createHintArrowBig(_local4, _local3, _local6, _local5);
if (possibleNewHint) {
subScore(lastScore);
lastScore = 0;
possibleNewHint = false;
}
}
function onHideHint() {
effectHandler.removeHintArrow();
}
function onScoreChuzzleDelete() {
}
function onScoreBigChuzzleDelete() {
}
function hintButtonPressed() {
board.showHint();
com.king.util.SoundManager.play("EyesEscape");
}
function getScoreForMatches(matches, big) {
var _local2 = (10 * matches) + (5 * (level - 1));
if (matches > 3) {
_local2 = _local2 + (25 * (matches - 3));
}
if (big) {
_local2 = _local2 + 30;
}
var _local3 = cascades;
if (_local3 > 5) {
_local3 = 5;
}
_local2 = _local2 * _local3;
return(_local2);
}
function addScore(scoreDelta, fromParent) {
score = score + scoreDelta;
inGameGUI.setScore(score);
lastScore = lastScore + scoreDelta;
if (!fromParent) {
if (MONEY) {
fscommand ("playData", ((((((("66," + currentTick) + ",") + gameTime) + ",") + scoreDelta) + ",") + score) + ",0=0");
}
}
}
function subScore(scoreDelta) {
score = score - scoreDelta;
if (score <= 0) {
score = 0;
}
inGameGUI.setScore(score);
inGameGUI.setScoreColorRed();
if (MONEY) {
fscommand ("playData", ((((("15," + currentTick) + ",") + gameTime) + ",") + scoreDelta) + ",0=0");
}
}
function calcNewAddLockTime() {
var _local2;
if (lockTimeMaxOffset <= 0) {
_local2 = 0;
} else {
_local2 = lockRandom.nextInt(2 * lockTimeMaxOffset) - lockTimeMaxOffset;
}
addLockTime = periodAddLockTime + _local2;
if (relaxMode) {
if (addLockTime < 50) {
addLockTime = 50;
}
}
}
function superAtOnce() {
nrChuzzlesSuperAtOnce++;
if (nrChuzzlesSuperAtOnce > 2) {
tripleBoomer = true;
}
if (nrChuzzlesSuperAtOnce > 3) {
quadBoomer = true;
}
}
function playRandomShriek() {
var _local1 = Math.floor((Math.random() * 6) + 1);
switch (_local1) {
case 1 :
com.king.util.SoundManager.play("PopShriek1");
break;
case 2 :
com.king.util.SoundManager.play("PopShriek2");
break;
case 3 :
com.king.util.SoundManager.play("PopShriek3");
break;
case 4 :
com.king.util.SoundManager.play("PopShriek4");
break;
case 5 :
com.king.util.SoundManager.play("PopShriek5");
break;
case 6 :
com.king.util.SoundManager.play("PopShriek6");
}
}
static var MONEY = true;
static var LOCK_SPEED_UP_VALUE = 0.65;
static var START_ADD_LOCK_AT_TIME = 750;
static var ADD_LOCK_TIME_MAX_OFFSET = 250;
static var WAIT_AT_END_OF_LEVEL_TIME = 0;
static var DELETE_LEVEL1 = 100;
static var DELETE_LEVEL2 = 100;
static var DELETE_LEVEL3 = 100;
static var DELETE_LEVEL4 = 100;
static var DELETE_LEVEL5 = 100;
static var DELETE_ABOVE_LEVEL5 = 100;
static var STATE_RUNNING = 0;
static var STATE_NOT_RUNNING = 1;
static var MAX_GAME_TIME = 6000;
}
Symbol 737 MovieClip [__Packages.com.king.Chuzzle.InGameGUI] Frame 0
class com.king.Chuzzle.InGameGUI
{
var maxGameTime, bottleVisible, scoreColorNormal, score, maxInBottle, bottleFrame, star1Visible, star2Visible, star3Visible, star4Visible, star1Frame, nrInBottle, wantedNrInBottle, tickCounter, showScramble, timeBarFrame, scoreRedColorCounter, level, star2Frame, star3Frame, star4Frame;
function InGameGUI (maxGameTime) {
this.maxGameTime = maxGameTime;
bottleVisible = true;
scoreColorNormal = true;
}
function init(relaxMode) {
setTimeBar(1);
score = 0;
maxInBottle = 100;
bottleFrame = 1;
BOTTLE_MC.gotoAndStop(50);
star1Visible = false;
star2Visible = false;
star3Visible = false;
star4Visible = false;
star1Frame = 1;
star1Frame = 2;
star1Frame = 3;
star1Frame = 4;
nrInBottle = 1;
wantedNrInBottle = 1;
hideScrambleSign();
if (relaxMode) {
_root.ScrambleSign_mc.scramble_txt.text = com.king.Chuzzle.TextProperties.THE_END;
var _local4 = com.king.Chuzzle.TextProperties.THE_END.length;
if (_local4 > 7) {
var _local3 = _root.ScrambleSign_mc.scramble_txt.getTextFormat();
_local3.size = 26;
_root.ScrambleSign_mc.scramble_txt.setTextFormat(_local3);
}
}
}
function showScrambleSign() {
tickCounter = 0;
showScramble = true;
}
function hideScrambleSign() {
showScramble = false;
}
function setTimeBar(time) {
timeBarFrame = Math.round((time / maxGameTime) * 100);
timeBarFrame = timeBarFrame + 1;
if (timeBarFrame > 100) {
timeBarFrame = 100;
}
}
function setScore(score) {
this.score = score;
}
function setScoreColorRed() {
scoreColorNormal = true;
scoreRedColorCounter = 0;
GAME_SCORE_TXT.textColor = 16711680 /* 0xFF0000 */;
}
function setScoreColorNormal() {
GAME_SCORE_TXT.textColor = 16776960 /* 0xFFFF00 */;
}
function setLevel(level) {
this.level = level;
}
function tick() {
star1Frame = star1Frame + 1;
if (star1Frame > 100) {
star1Frame = 1;
}
star2Frame = star2Frame + 1;
if (star2Frame > 100) {
star2Frame = 1;
}
star3Frame = star3Frame + 1;
if (star3Frame > 100) {
star3Frame = 1;
}
star4Frame = star4Frame + 1;
if (star4Frame > 100) {
star4Frame = 1;
}
if ((wantedNrInBottle - nrInBottle) < 0.3) {
nrInBottle = wantedNrInBottle;
} else if ((nrInBottle - wantedNrInBottle) < 1) {
nrInBottle = wantedNrInBottle;
} else if (nrInBottle < wantedNrInBottle) {
nrInBottle = nrInBottle + 0.3;
} else if (nrInBottle > wantedNrInBottle) {
nrInBottle = nrInBottle - 1;
}
calculatePercent();
if ((tickCounter++) == SHOW_SCRAMBLE_SIGN_TIME) {
showScramble = false;
}
if (scoreRedColorCounter == SHOW_RED_TEXT_TIME) {
setScoreColorNormal();
scoreRedColorCounter++;
} else {
scoreRedColorCounter++;
}
}
function draw() {
TIME_BAR_MC.gotoAndStop(timeBarFrame);
GAME_SCORE_TXT.text = String(score);
LEVEL_NR.gotoAndStop(level);
BOTTLE_MC._visible = bottleVisible;
BOTTLE_MC.gotoAndStop(bottleFrame);
STAR1_MC._visible = star1Visible;
STAR2_MC._visible = star2Visible;
STAR3_MC._visible = star3Visible;
STAR4_MC._visible = star4Visible;
STAR1_MC.gotoAndStop(star1Frame);
STAR2_MC.gotoAndStop(star2Frame);
STAR3_MC.gotoAndStop(star3Frame);
STAR4_MC.gotoAndStop(star4Frame);
SCRAMBLE_SIGN._visible = showScramble;
}
function setBottle(nr) {
wantedNrInBottle = nr;
}
function showBottle() {
bottleVisible = true;
}
function hideBottle() {
bottleVisible = false;
}
function calculatePercent() {
bottleFrame = Math.round((nrInBottle / maxInBottle) * 100);
if (bottleFrame < 1) {
bottleFrame = 1;
} else if (bottleFrame >= 100) {
bottleFrame = 100;
}
starController(bottleFrame);
}
function setBottleSize(nr) {
maxInBottle = nr;
}
function starController(num) {
if (num < 10) {
star1Visible = false;
star2Visible = false;
star3Visible = false;
star4Visible = false;
}
if ((num > 10) && (!star1Visible)) {
star1Visible = true;
star1Frame = 1;
}
if ((num > 25) && (!star2Visible)) {
star2Visible = true;
star2Frame = 1;
}
if ((num > 40) && (!star3Visible)) {
star3Visible = true;
star3Frame = 1;
}
if ((num > 55) && (!star4Visible)) {
star4Visible = true;
star4Frame = 1;
}
star1Frame = star1Frame + 1;
star2Frame = star2Frame + 1;
star3Frame = star3Frame + 1;
star4Frame = star4Frame + 1;
}
static var SHOW_SCRAMBLE_SIGN_TIME = 25;
static var SHOW_RED_TEXT_TIME = 25;
static var SCRAMBLE_SIGN = _root.ScrambleSign_mc;
static var TIME_BAR_MC = _root.TimeBar_mc;
static var GAME_SCORE_TXT = _root.ScoreSign_mc.Score_txt;
static var LEVEL_NR = _root.Level_mc.LevelNr_mc;
static var BOTTLE_MC = _root.Bottle_mc;
static var STAR1_MC = _root.Bottle_mc.Star1_mc;
static var STAR2_MC = _root.Bottle_mc.Star2_mc;
static var STAR3_MC = _root.Bottle_mc.Star3_mc;
static var STAR4_MC = _root.Bottle_mc.Star4_mc;
}
Symbol 738 MovieClip [__Packages.com.king.Chuzzle.Board] Frame 0
class com.king.Chuzzle.Board
{
var relaxMode, messageCallback, callbackReciver, random, grid, testGrid, localSuperSet, boardMode, addSuperFlag, gotHintInfo, addLockFlag, showHintFlag, showingHint, theBoardHasChanged, bufferStoreMovedRow, bufferStoreMovedCol, bufferStoreShifts, currentTick, mouseDeltaY, mouseDeltaX, mouseActiveCol, mouseActiveRow, tickCounter, bigEnabled, mouseStartPosX, mouseStartPosY;
function Board (messageCallback, callbackReciver, random, bgClip, superSet, lockRandom, moneyGame, relaxMode) {
MONEY = moneyGame;
this.relaxMode = relaxMode;
this.messageCallback = messageCallback;
this.callbackReciver = callbackReciver;
this.random = random;
grid = new com.king.Chuzzle.Grid(GRID_OFFSET_X, GRID_OFFSET_Y, bgClip, messageReciver, this, superSet, random, lockRandom);
testGrid = new com.king.Chuzzle.TestGrid();
localSuperSet = new com.king.Chuzzle.SuperSet();
boardMode = WAIT_MODE;
addSuperFlag = false;
gotHintInfo = false;
addLockFlag = false;
showHintFlag = false;
showingHint = false;
theBoardHasChanged = true;
}
function cleanUp() {
grid.resetDepthCounters();
grid.clearGrid();
}
function tick(tick) {
bufferStoreMovedRow = -1;
bufferStoreMovedCol = -1;
bufferStoreShifts = 0;
currentTick = tick;
if (com.king.Chuzzle.Input.mouseIsPressed) {
mousePressed(com.king.Chuzzle.Input.xMouse, com.king.Chuzzle.Input.yMouse);
}
if (com.king.Chuzzle.Input.mouseIsReleased) {
mouseReleased();
}
switch (boardMode) {
case WAIT_MODE :
if (showHintFlag && (!showingHint)) {
executeShowHint();
}
break;
case ROW_MOVING_MODE :
updateMouseMovement();
var _local2 = false;
if (Math.abs(grid.getHorizontalMove()) < ROW_COL_SHIFT_VALUE) {
if (Math.abs(mouseDeltaX) < Math.abs(mouseDeltaY)) {
_local2 = true;
}
}
if (_local2) {
grid.adjustRow();
grid.moveColSetup(mouseActiveCol);
boardMode = COL_MOVING_MODE;
grid.moveCol(mouseDeltaX);
} else {
grid.moveRow(mouseDeltaX);
}
break;
case COL_MOVING_MODE :
updateMouseMovement();
_local2 = false;
if (Math.abs(grid.getVerticalMove()) < ROW_COL_SHIFT_VALUE) {
if (Math.abs(mouseDeltaY) < Math.abs(mouseDeltaX)) {
_local2 = true;
}
}
if (_local2) {
grid.adjustCol();
grid.moveRowSetup(mouseActiveRow);
boardMode = ROW_MOVING_MODE;
grid.moveRow(mouseDeltaX);
} else {
grid.moveCol(mouseDeltaY);
}
break;
case ROW_ADJUST_MOVING :
break;
case COL_ADJUST_MOVING :
break;
case ROW_MOVING_MODE_RELEASE :
if (grid.executeMatching()) {
var _local5 = grid.colShifts;
var _local3 = grid.getMovedRow();
bufferStoreMovedRow = _local3;
bufferStoreShifts = _local5;
grid.adjustRow();
postMatching();
} else {
grid.moveBackRowSetup();
if (grid.moveBackRow()) {
boardMode = WAIT_MODE;
} else {
boardMode = ROW_MOVING_BACK;
}
messageCallback(callbackReciver, "chuzzles_moving_back", null);
}
break;
case COL_MOVING_MODE_RELEASE :
if (grid.executeMatching()) {
var _local5 = grid.rowShifts;
var _local4 = grid.getMovedCol();
bufferStoreMovedCol = _local4;
bufferStoreShifts = _local5;
grid.adjustCol();
postMatching();
} else {
grid.moveBackColSetup();
if (grid.moveBackCol()) {
boardMode = WAIT_MODE;
} else {
boardMode = COL_MOVING_BACK;
}
messageCallback(callbackReciver, "chuzzles_moving_back", null);
}
break;
case MATCHING_MODE :
break;
case FALLING_MODE :
showHintFlag = false;
if ((tickCounter--) <= 0) {
if (grid.executeMatching()) {
postMatching();
} else {
boardMode = WAIT_MODE;
theBoardHasChanged = true;
}
}
break;
case ROW_MOVING_BACK :
if (grid.moveBackRow()) {
boardMode = WAIT_MODE;
}
break;
case COL_MOVING_BACK :
if (grid.moveBackCol()) {
boardMode = WAIT_MODE;
}
break;
case WAITING_FOR_MOVEMENT :
updateMouseMovement();
if ((mouseDeltaX != 0) || (mouseDeltaY != 0)) {
if (Math.abs(mouseDeltaX) > Math.abs(mouseDeltaY)) {
grid.moveRowSetup(mouseActiveRow);
boardMode = ROW_MOVING_MODE;
grid.moveRow(mouseDeltaX);
} else {
grid.moveColSetup(mouseActiveCol);
boardMode = COL_MOVING_MODE;
grid.moveCol(mouseDeltaY);
}
if (showingHint) {
RemoveHint();
}
}
break;
case SCRAMBLE_MODE :
if (relaxMode == false) {
grid.scrambleAnimate();
}
if ((tickCounter--) != 1) {
break;
}
boardMode = WAIT_MODE;
messageCallback(callbackReciver, "scramble_end");
}
grid.tick(tick);
if (boardMode == SCRAMBLE_MODE) {
return(undefined);
}
if ((addLockFlag && (boardMode != FALLING_MODE)) && (boardMode != SCRAMBLE_MODE)) {
if (grid.addRandomLock()) {
}
theBoardHasChanged = true;
addLockFlag = false;
if ((boardMode == COL_MOVING_MODE) && (grid.newLockIsOnMovedCol())) {
grid.moveBackColSetup();
if (grid.moveBackCol()) {
boardMode = WAIT_MODE;
} else {
boardMode = COL_MOVING_BACK;
}
} else if ((boardMode == ROW_MOVING_MODE) && (grid.newLockIsOnMovedRow())) {
grid.moveBackRowSetup();
if (grid.moveBackRow()) {
boardMode = WAIT_MODE;
} else {
boardMode = ROW_MOVING_BACK;
}
}
if (showingHint) {
messageCallback(callbackReciver, "hide_hint");
showingHint = false;
}
}
if (theBoardHasChanged && (boardMode == WAIT_MODE)) {
theBoardHasChanged = false;
testGrid.copyGrid(grid.gridData);
testGrid.resetTest();
gotHintInfo = false;
}
if (testGrid.test()) {
var _local6 = testGrid.testhasMatch();
if (!_local6) {
if (callbackReciver.enableInput) {
localSuperSet.makeEmpty();
RemoveHint();
if (relaxMode == false) {
grid.setupGrid(localSuperSet);
}
tickCounter = SCRAMBLE_TIME;
boardMode = SCRAMBLE_MODE;
messageCallback(callbackReciver, "scramble_start");
}
} else {
gotHintInfo = true;
}
}
grid.showPossibleMatches();
if (bufferStoreMovedRow != -1) {
if (MONEY) {
fscommand ("playData", ((((((("17," + currentTick) + ",") + bufferStoreMovedRow) + ",-1,") + bufferStoreShifts) + ",") + callbackReciver.gameTime) + ",0=0");
}
} else if (bufferStoreMovedCol != -1) {
if (MONEY) {
fscommand ("playData", ((((((("17," + currentTick) + ",-1,") + bufferStoreMovedCol) + ",") + bufferStoreShifts) + ",") + callbackReciver.gameTime) + ",0=0");
}
}
}
function render(tick, alpha) {
grid.render(tick, alpha);
}
function addSuper(color) {
localSuperSet.push(color);
addSuperFlag = true;
}
function addLock() {
addLockFlag = true;
}
function enableBig() {
bigEnabled = true;
}
function disableBig() {
bigEnabled = false;
}
function getSuperSet(superSet) {
grid.getSuperSet(superSet);
}
function showHint() {
showHintFlag = true;
}
function RemoveHint() {
messageCallback(callbackReciver, "hide_hint");
showingHint = false;
}
function isShowingHint() {
return(showingHint);
}
function messageReciver(reciver, message, data) {
reciver.messageCallback(reciver.callbackReciver, message, data);
}
function mousePressed(mousePosX, mousePosY) {
if (boardMode == WAIT_MODE) {
initMouseMovement(mousePosX, mousePosY);
if (findClickedSquare(mousePosX, mousePosY)) {
boardMode = WAITING_FOR_MOVEMENT;
}
}
}
function mouseReleased() {
switch (boardMode) {
case WAIT_MODE :
break;
case ROW_MOVING_MODE :
boardMode = ROW_MOVING_MODE_RELEASE;
break;
case COL_MOVING_MODE :
boardMode = COL_MOVING_MODE_RELEASE;
break;
case ROW_ADJUST_MOVING :
break;
case COL_ADJUST_MOVING :
break;
case MATCHING_MODE :
break;
case FALLING_MODE :
break;
case ROW_MOVING_BACK :
break;
case COL_MOVING_BACK :
break;
case WAITING_FOR_MOVEMENT :
if (findClickedSquare(com.king.Chuzzle.Input.xMouse, com.king.Chuzzle.Input.yMouse)) {
grid.pick(mouseActiveRow, mouseActiveCol);
}
boardMode = WAIT_MODE;
break;
case SCRAMBLE_MODE :
}
}
function executeShowHint() {
if (gotHintInfo) {
var _local4;
var _local3;
var _local6;
var _local5;
var _local7;
var _local11;
var _local10;
var _local9;
var _local8;
if (testGrid.hintWrap) {
_local4 = GRID_OFFSET_X + (GRID_ELEMENT_SIZE * (testGrid.hintMoveFromCol1 + 1));
_local3 = GRID_OFFSET_Y + (GRID_ELEMENT_SIZE * (testGrid.hintMoveFromRow1 + 0));
_local6 = GRID_OFFSET_X + (GRID_ELEMENT_SIZE * (testGrid.hintMoveToCol1 + 1));
_local5 = GRID_OFFSET_Y + (GRID_ELEMENT_SIZE * (testGrid.hintMoveToRow1 + 0));
_local11 = GRID_OFFSET_X + (GRID_ELEMENT_SIZE * (testGrid.hintMoveFromCol2 + 1));
_local10 = GRID_OFFSET_Y + (GRID_ELEMENT_SIZE * (testGrid.hintMoveFromRow2 + 0));
_local9 = GRID_OFFSET_X + (GRID_ELEMENT_SIZE * (testGrid.hintMoveToCol2 + 1));
_local8 = GRID_OFFSET_Y + (GRID_ELEMENT_SIZE * (testGrid.hintMoveToRow2 + 0));
_local7 = com.king.Chuzzle.GridObj.TYPE_NORMAL;
var _local2 = new Object();
_local2.fromPosX = _local4;
_local2.fromPosY = _local3;
_local2.toPosX = _local6;
_local2.toPosY = _local5;
_local2.fromPosX2 = _local11;
_local2.fromPosY2 = _local10;
_local2.toPosX2 = _local9;
_local2.toPosY2 = _local8;
messageCallback(callbackReciver, "show_hint_wrap", _local2);
} else {
_local4 = GRID_OFFSET_X + (GRID_ELEMENT_SIZE * (testGrid.hintMoveFromCol + 1));
_local3 = GRID_OFFSET_Y + (GRID_ELEMENT_SIZE * (testGrid.hintMoveFromRow + 0));
_local6 = GRID_OFFSET_X + (GRID_ELEMENT_SIZE * (testGrid.hintMoveToCol + 1));
_local5 = GRID_OFFSET_Y + (GRID_ELEMENT_SIZE * (testGrid.hintMoveToRow + 0));
_local7 = testGrid.getType(testGrid.hintMoveFromRow, testGrid.hintMoveFromCol);
var _local2 = new Object();
_local2.fromPosX = _local4;
_local2.fromPosY = _local3;
_local2.toPosX = _local6;
_local2.toPosY = _local5;
if (_local7 == com.king.Chuzzle.GridObj.TYPE_NORMAL) {
messageCallback(callbackReciver, "show_hint", _local2);
} else {
messageCallback(callbackReciver, "show_hint_big", _local2);
}
}
showingHint = true;
}
}
function initMouseMovement(mousePosX, mousePosY) {
mouseStartPosX = mousePosX;
mouseStartPosY = mousePosY;
}
function updateMouseMovement() {
var _local3 = com.king.Chuzzle.Input.yMouse;
mouseDeltaY = _local3 - mouseStartPosY;
mouseStartPosY = _local3;
var _local2 = com.king.Chuzzle.Input.xMouse;
mouseDeltaX = _local2 - mouseStartPosX;
mouseStartPosX = _local2;
}
function findClickedSquare(posX, posY) {
var _local5 = false;
var _local3 = 0;
while (_local3 < GRID_ROWS) {
if ((posY >= ((GRID_OFFSET_Y + (GRID_ELEMENT_SIZE * _local3)) - (GRID_ELEMENT_SIZE / 2))) && (posY < ((GRID_OFFSET_Y + (GRID_ELEMENT_SIZE * (_local3 + 1))) - (GRID_ELEMENT_SIZE / 2)))) {
mouseActiveRow = _local3;
var _local2 = 0;
while (_local2 < GRID_COLUMNS) {
if ((posX >= (((GRID_OFFSET_X + 80) + (GRID_ELEMENT_SIZE * _local2)) - (GRID_ELEMENT_SIZE / 2))) && (posX < (((GRID_OFFSET_X + 80) + (GRID_ELEMENT_SIZE * (_local2 + 1))) - (GRID_ELEMENT_SIZE / 2)))) {
mouseActiveCol = _local2;
_local5 = true;
break;
}
_local2++;
}
if (_local5) {
break;
}
}
_local3++;
}
if (!_local5) {
mouseActiveRow = -1;
mouseActiveCol = -1;
}
return(_local5);
}
function postMatching() {
showHintFlag = false;
grid.preFalling();
grid.addNewObjects();
if (addSuperFlag) {
var _local4 = localSuperSet.getLength();
var _local2 = 0;
while (_local2 < _local4) {
var _local3 = localSuperSet.getObjectAtIndex(_local2);
if (grid.makeRandomSuperAbove(_local3)) {
if (MONEY) {
fscommand ("playData", ((("21," + currentTick) + ",") + callbackReciver.gameTime) + ",0=0");
}
}
_local2++;
}
localSuperSet.makeEmpty();
addSuperFlag = false;
}
if (bigEnabled) {
if (grid.tryToAddBig()) {
if (MONEY) {
fscommand ("playData", ((("22," + currentTick) + ",") + callbackReciver.gameTime) + ",0=0");
}
}
}
grid.adjustForBig();
grid.adjustForSuperExplosion();
grid.setStartAnimPosY();
grid.falling();
tickCounter = grid.setupFallingAnim();
if (MONEY) {
fscommand ("playData", ((("50," + currentTick) + ",") + callbackReciver.gameTime) + ",0=0");
}
boardMode = FALLING_MODE;
}
static var MONEY = true;
static var SCRAMBLE_TIME = 108;
static var ROW_COL_SHIFT_VALUE = 30;
static var HINT_DELAY_TIME = 0;
static var GRID_OFFSET_X = 194;
static var GRID_OFFSET_Y = 86;
static var GRID_ELEMENT_SIZE = 72;
static var GRID_ROWS = 6;
static var GRID_COLUMNS = 6;
static var WAIT_MODE = 0;
static var ROW_MOVING_MODE = 1;
static var COL_MOVING_MODE = 2;
static var ROW_ADJUST_MOVING = 3;
static var COL_ADJUST_MOVING = 4;
static var ROW_MOVING_MODE_RELEASE = 12;
static var COL_MOVING_MODE_RELEASE = 13;
static var MATCHING_MODE = 5;
static var FALLING_MODE = 6;
static var ROW_MOVING_BACK = 7;
static var COL_MOVING_BACK = 8;
static var WAITING_FOR_MOVEMENT = 9;
static var SCRAMBLE_MODE = 10;
}
Symbol 739 MovieClip [__Packages.com.king.util.Random] Frame 0
class com.king.util.Random
{
var mta, mti, lastSeed;
function Random (aSeed) {
mta = new Array(N);
mti = N + 1;
if (aSeed != undefined) {
init_genrand(aSeed);
}
}
function set seed(s) {
init_genrand(s);
//return(seed);
}
function get seed() {
return(lastSeed);
}
function nextInt(n) {
return((genrand_int32() & 2147483647) % n);
}
function nextFloat() {
return(next(24) / 16777216);
}
function next(bits) {
if (bits < 32) {
return(genrand_int32() & ((1 << bits) - 1));
}
return(genrand_int32());
}
function init_genrand(s) {
s = int(s);
var _local5 = getTimer();
lastSeed = s;
mta[0] = s;
var _local2 = s;
var _local3 = new com.king.util.Integer64();
mti = 1;
while (mti < N) {
_local3.init32((_local2 >>> 30) ^ _local2);
_local3.mulu32(1812433253);
_local2 = (mta[mti] = int(_local3.lsb + mti));
mti++;
}
var _local6 = getTimer();
}
function genrand_int32() {
var _local3 = 0;
if (mti >= N) {
if (mti == (N + 1)) {
init_genrand(5489);
}
var _local4 = getTimer();
var _local2 = 0;
_local2 = 0;
while (_local2 < (N - M)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + M] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
while (_local2 < (N - 1)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + (M - N)] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
_local3 = (mta[N - 1] & UPPER_MASK) | (mta[0] & LOWER_MASK);
mta[N - 1] = (mta[M - 1] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
mti = 0;
var _local5 = getTimer();
}
_local3 = mta[mti++];
_local3 = _local3 ^ (_local3 >>> 11);
_local3 = _local3 ^ ((_local3 << 7) & 2636928640);
_local3 = _local3 ^ ((_local3 << 15) & 4022730752);
_local3 = _local3 ^ (_local3 >>> 18);
return(_local3);
}
static var N = 624;
static var M = 397;
static var MATRIX_A = 2567483615;
static var UPPER_MASK = 2147483648;
static var LOWER_MASK = 2147483647;
static var mag01 = [0, 2567483615];
}
Symbol 740 MovieClip [__Packages.com.king.util.Integer64] Frame 0
class com.king.util.Integer64
{
var r, p, s;
function Integer64 (lowInt) {
r = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]];
p = [0, 0, 0, 0, 0];
s = [0, 0, 0];
if (lowInt != undefined) {
merge(lowInt);
}
}
function init(v) {
var _local2 = 0;
while (_local2 < p.length) {
p[_local2] = v.p[_local2];
_local2++;
}
}
function init32(n) {
p[0] = n & 32767;
n = n >>> 15;
p[1] = n & 32767;
n = n >>> 15;
p[2] = n & 3;
p[3] = 0;
p[4] = 0;
}
function get lsb() {
return((p[0] | (p[1] << SH)) | ((p[2] & 3) << 30));
}
function get msb() {
return((((p[2] >> 2) | ((p[3] << SH) >> 2)) | ((p[4] << (SH * 2)) >> 2)) & 2147483647);
}
function binaryShiftLeft(step) {
var _local2 = 0;
while (_local2 < step) {
shl();
_local2++;
}
}
function binaryShiftRight(step) {
var _local4 = (step / SH) >> 0;
var _local5 = step - (_local4 * SH);
var _local2 = p.length - 1;
while (_local2 > 0) {
var _local3 = 0;
while (_local3 < _local4) {
p[_local3] = p[_local3 + 1];
_local3++;
}
p[_local2--] = 0;
}
if (_local5 > 0) {
var _local3 = 0;
while (_local3 < _local5) {
shr();
_local3++;
}
}
}
function binaryNot(o) {
p[0] = p[0] ^ o.p[0];
p[1] = p[1] ^ o.p[1];
p[2] = p[2] ^ o.p[2];
p[3] = p[3] ^ o.p[3];
p[4] = p[4] ^ o.p[4];
}
function add64(o) {
var _local4 = 0;
var _local3 = 1;
var _local2 = 0;
while ((_local3 < p.length) && (o.p[_local2] != 0)) {
_local3++;
}
_local2 = 0;
while (_local2 < _local3) {
_local4 = _local4 + (p[_local2] + o.p[_local2]);
p[_local2] = _local4 & MASK;
_local4 = _local4 >> SH;
_local2++;
}
}
function add32(num) {
var _local2 = 0;
var _local5 = num & MASK;
num = num >> SH;
var _local6 = num & MASK;
num = num >> SH;
var _local4 = num & 3;
_local2 = _local2 + (p[0] + _local5);
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[1] + _local6);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[2] + _local4);
p[2] = _local2 & MASK;
}
function mulu32(num) {
var _local3 = 0;
s[0] = num & MASK;
num = num >>> 15;
s[1] = num & MASK;
num = num >>> 15;
s[2] = num & 3;
var _local2 = 0;
while (_local2 < 3) {
var _local4 = s[_local2];
_local3 = _local4 * p[0];
r[_local2][0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[1]);
r[_local2][1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[2]);
r[_local2][2] = _local3 & 3;
_local2++;
}
_local3 = r[0][0];
p[0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (r[0][1] + r[1][0]);
p[1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local3 & 3;
p[3] = 0;
p[4] = 0;
}
function mul64(o) {
var _local2 = 0;
var _local3 = 0;
while (_local3 < 5) {
var _local4 = o.p[_local3];
_local2 = _local4 * p[0];
r[_local3][0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[1]);
r[_local3][1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[2]);
r[_local3][2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[3]);
r[_local3][3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[4]);
r[_local3][4] = _local2 & MASK;
_local3++;
}
_local2 = r[0][0];
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (r[0][1] + r[1][0]);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (((r[0][3] + r[1][2]) + r[2][1]) + r[3][0]);
p[3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((((r[0][4] + r[1][3]) + r[2][2]) + r[3][1]) + r[4][0]);
p[4] = _local2 & 7;
}
function mul32(value) {
mul64(new com.king.util.Integer64(value));
}
function merge(a) {
var _local2 = 0;
while (_local2 < 3) {
p[_local2] = p[_local2] + (a & 32767);
a = a >>> 15;
_local2++;
}
return(a);
}
function shl() {
var _local5 = 0;
var _local4 = 0;
var _local2 = 0;
var _local3 = p.length;
while (_local2 < _local3) {
_local5 = (p[_local2] & 16384) >> 14;
p[_local2] = p[_local2] << 1;
p[_local2] = (p[_local2] | _local4) & 32767;
_local2++;
_local4 = _local5;
}
}
function shr() {
var _local4 = 0;
var _local3 = 0;
var _local2 = p.length - 1;
while (_local2 >= 0) {
_local4 = (p[_local2] & 1) << 14;
p[_local2] = p[_local2] >> 1;
p[_local2] = (p[_local2] | _local3) & 32767;
_local2--;
_local3 = _local4;
}
}
static var MASK = 32767;
static var SH = 15;
}
Symbol 741 MovieClip [__Packages.com.king.Chuzzle.Grid] Frame 0
class com.king.Chuzzle.Grid
{
var messageCallback, callbackReciver, posX, posY, playGridHeight, playGridWidth, random, lockRandom, gridHeight, gridWidth, playStartRow, playStartCol, playEndRow, playEndCol, playBorderStartRow, playBorderStartCol, playBorderEndRow, playBorderEndCol, gridData, testGrid, currentTick, row, col, movingRow, deltaMoveX, hintShakeCounter, movingCol, deltaMoveY, lockCheckOn, supportRowOn, activeSupportRow, supportColOn, activeSupportCol, moveBack, nrBigs, cascades, sendMessages, moveY, rowShifts, moveBackSpeed, tickCounter, moveX, colShifts, matchMatrix, justRemovedBig, newLockOnRow, newLockOnCol;
function Grid (playPosX, playPosY, bgClip, messageCallback, callbackReciver, superSet, random, lockRandom) {
this.messageCallback = messageCallback;
this.callbackReciver = callbackReciver;
posX = playPosX - (PLAY_GRID_BORDER * OBJECT_SIZE);
posY = playPosY - (PLAY_GRID_HEIGHT * OBJECT_SIZE);
playGridHeight = PLAY_GRID_HEIGHT;
playGridWidth = PLAY_GRID_WIDTH;
this.random = random;
this.lockRandom = lockRandom;
gridHeight = 3 * playGridHeight;
gridWidth = playGridWidth + (2 * PLAY_GRID_BORDER);
playStartRow = playGridHeight;
playStartCol = PLAY_GRID_BORDER;
playEndRow = (playStartRow + playGridHeight) - 1;
playEndCol = (gridWidth - PLAY_GRID_BORDER) - 1;
playBorderStartRow = playStartRow - PLAY_GRID_BORDER;
playBorderStartCol = 0;
playBorderEndRow = playEndRow + PLAY_GRID_BORDER;
playBorderEndCol = playEndCol + PLAY_GRID_BORDER;
gridData = new Array(gridHeight);
var _local3 = 0;
while (_local3 < gridHeight) {
gridData[_local3] = new Array(gridWidth);
var _local2 = 0;
while (_local2 < gridWidth) {
var _local4 = new com.king.Chuzzle.GridObj(bgClip);
gridData[_local3][_local2] = _local4;
_local2++;
}
_local3++;
}
testGrid = new com.king.Chuzzle.TestGrid();
setupGrid(superSet);
messageCallback(callbackReciver, "test_message", null);
}
function tick(tick) {
currentTick = tick;
var _local3 = 0;
while (_local3 < gridHeight) {
var _local2 = 0;
while (_local2 < gridWidth) {
gridData[_local3][_local2].tick(tick);
_local2++;
}
_local3++;
}
}
function render(tick, alpha) {
var _local3 = 0;
while (_local3 < gridHeight) {
var _local2 = 0;
while (_local2 < gridWidth) {
gridData[_local3][_local2].render(tick, alpha);
_local2++;
}
_local3++;
}
}
function showPossibleMatches() {
var _local5 = row - playStartRow;
var _local6 = col - playStartCol;
testGrid.copyGrid(gridData);
var _local4;
var _local2 = new Array();
if (movingRow) {
if ((deltaMoveX < ((-OBJECT_SIZE) / 3)) || (deltaMoveX > (OBJECT_SIZE / 3))) {
hintShakeCounter = HINT_SHAKE_TIME;
}
if (((hintShakeCounter > 0) && (deltaMoveX < HINT_SHAKE_OFFSET)) && (deltaMoveX > (-HINT_SHAKE_OFFSET))) {
_local4 = testGrid.testRow2(_local5, _local2);
if (_local4) {
if (hintShakeCounter == (HINT_SHAKE_TIME - 2)) {
messageCallback(callbackReciver, "hint_shake", null);
}
var _local3 = 0;
while (_local3 < _local2.length) {
gridData[playStartRow + _local2[_local3].row][playStartCol + _local2[_local3].col].shakeChuzzle();
_local3++;
}
hintShakeCounter--;
}
}
} else if (movingCol) {
if ((deltaMoveY < ((-OBJECT_SIZE) / 3)) || (deltaMoveY > (OBJECT_SIZE / 3))) {
hintShakeCounter = HINT_SHAKE_TIME;
}
if (((hintShakeCounter > 0) && (deltaMoveY < HINT_SHAKE_OFFSET)) && (deltaMoveY > (-HINT_SHAKE_OFFSET))) {
_local4 = testGrid.testCol2(_local6, _local2);
if (_local4) {
if (hintShakeCounter == (HINT_SHAKE_TIME - 2)) {
messageCallback(callbackReciver, "hint_shake", null);
}
var _local3 = 0;
while (_local3 < _local2.length) {
gridData[playStartRow + _local2[_local3].row][playStartCol + _local2[_local3].col].shakeChuzzle();
_local3++;
}
hintShakeCounter--;
}
}
}
}
function setupGrid(superSet) {
lockCheckOn = true;
row = -1;
supportRowOn = false;
activeSupportRow = -1;
col = -1;
supportColOn = false;
activeSupportCol = -1;
movingRow = false;
movingCol = false;
moveBack = false;
hintShakeCounter = 0;
nrBigs = 0;
cascades = 0;
clearGrid();
randomGrid();
sendMessages = false;
while (executeMatching()) {
preFalling();
addNewObjects();
falling();
}
sendMessages = true;
makeSuperFromSuperSet(superSet);
setChuzzlePositions();
}
function clearGrid() {
var _local3 = 0;
while (_local3 < gridHeight) {
var _local2 = 0;
while (_local2 < gridWidth) {
gridData[_local3][_local2].setEmpty();
_local2++;
}
_local3++;
}
}
function resetDepthCounters() {
com.king.Chuzzle.GridObj.resetDepthCounters();
}
function randomGrid() {
var _local4 = playStartRow;
while (_local4 <= playEndRow) {
var _local2 = PLAY_GRID_BORDER;
while (_local2 <= playEndCol) {
var _local3 = randomColor();
gridData[_local4][_local2].init(com.king.Chuzzle.GridObj.TYPE_NORMAL, _local3);
_local2++;
}
_local4++;
}
}
function moveColSetup(col) {
movingCol = true;
this.col = playStartCol + col;
supportColOn = false;
var _local2 = bigOnCol(this.col);
if (_local2 != -1) {
this.col = _local2;
activeSupportCol = this.col + 1;
supportColOn = true;
}
moveY = 0;
deltaMoveY = 0;
rowShifts = 0;
}
function moveCol(deltaY) {
if ((lockOnCol(col) && (lockCheckOn)) || ((supportColOn && (lockCheckOn)) && (lockOnCol(activeSupportCol)))) {
if ((deltaY + deltaMoveY) >= 10) {
if (deltaMoveY == 10) {
return(undefined);
}
deltaY = 10 - deltaMoveY;
if (deltaY < 0) {
deltaY = 0;
}
messageCallback(callbackReciver, "cannot_move_lock");
} else if ((deltaY + deltaMoveY) <= -10) {
if (deltaMoveY == -10) {
return(undefined);
}
deltaY = -10 - deltaMoveY;
if (deltaY > 0) {
deltaY = 0;
}
messageCallback(callbackReciver, "cannot_move_lock");
}
}
if (supportColOn) {
var _local13 = findBigRowIndex(col);
if (deltaY < 0) {
var _local11 = ((_local13 - playStartRow) * OBJECT_SIZE) + deltaMoveY;
if (deltaY < (-_local11)) {
deltaY = -_local11;
if ((deltaY != 0) && (!moveBack)) {
var _local10 = new Object();
_local10.posX = (posX + (col * OBJECT_SIZE)) + (1.5 * OBJECT_SIZE);
_local10.posY = (posY + (playStartRow * OBJECT_SIZE)) - (0.5 * OBJECT_SIZE);
messageCallback(callbackReciver, "big_hit_wall_hor", _local10);
}
}
} else if (deltaY > 0) {
var _local12 = (((playEndRow - _local13) * OBJECT_SIZE) - OBJECT_SIZE) - deltaMoveY;
if (deltaY > _local12) {
deltaY = _local12;
if ((deltaY != 0) && (!moveBack)) {
var _local10 = new Object();
_local10.posX = (posX + (col * OBJECT_SIZE)) + (1.5 * OBJECT_SIZE);
_local10.posY = (posY + (playEndRow * OBJECT_SIZE)) + (0.5 * OBJECT_SIZE);
messageCallback(callbackReciver, "big_hit_wall_hor", _local10);
}
}
}
}
moveY = moveY + deltaY;
deltaMoveY = deltaMoveY + deltaY;
if (deltaMoveY > (OBJECT_SIZE / 2)) {
var _local7 = Math.round(deltaMoveY / OBJECT_SIZE);
deltaMoveY = deltaMoveY - (_local7 * OBJECT_SIZE);
var _local4 = 0;
while (_local4 < _local7) {
var _local5 = gridData[playEndRow][col];
var _local2 = playEndRow;
while (_local2 > playStartRow) {
gridData[_local2][col] = gridData[_local2 - 1][col];
_local2--;
}
gridData[playStartRow][col] = _local5;
if (supportColOn) {
_local5 = gridData[playEndRow][activeSupportCol];
_local2 = playEndRow;
while (_local2 > playStartRow) {
gridData[_local2][activeSupportCol] = gridData[_local2 - 1][activeSupportCol];
_local2--;
}
gridData[playStartRow][activeSupportCol] = _local5;
}
rowShifts++;
_local4++;
}
} else if (deltaMoveY < ((-OBJECT_SIZE) / 2)) {
var _local7 = Math.round((-deltaMoveY) / OBJECT_SIZE);
deltaMoveY = deltaMoveY + (_local7 * OBJECT_SIZE);
var _local4 = 0;
while (_local4 < _local7) {
var _local5 = gridData[playStartRow][col];
var _local2 = playStartRow;
while (_local2 < playEndRow) {
gridData[_local2][col] = gridData[_local2 + 1][col];
_local2++;
}
gridData[playEndRow][col] = _local5;
if (supportColOn) {
_local5 = gridData[playStartRow][activeSupportCol];
_local2 = playStartRow;
while (_local2 < playEndRow) {
gridData[_local2][activeSupportCol] = gridData[_local2 + 1][activeSupportCol];
_local2++;
}
gridData[playEndRow][activeSupportCol] = _local5;
}
rowShifts--;
_local4++;
}
}
gridData[playBorderStartRow][col].setEmpty();
var _local8 = gridData[playEndRow][col].color;
var _local9 = gridData[playEndRow][col].type;
gridData[playBorderStartRow][col].init(_local9, _local8);
gridData[playBorderStartRow][col].copyState(gridData[playEndRow][col]);
gridData[playBorderEndRow][col].setEmpty();
_local8 = gridData[playStartRow][col].color;
_local9 = gridData[playStartRow][col].type;
gridData[playBorderEndRow][col].init(_local9, _local8);
gridData[playBorderEndRow][col].copyState(gridData[playStartRow][col]);
if (supportColOn) {
gridData[playBorderStartRow][activeSupportCol].setEmpty();
_local8 = gridData[playEndRow][activeSupportCol].color;
_local9 = gridData[playEndRow][activeSupportCol].type;
gridData[playBorderStartRow][activeSupportCol].init(_local9, _local8);
gridData[playBorderStartRow][activeSupportCol].copyState(gridData[playEndRow][activeSupportCol]);
gridData[playBorderEndRow][activeSupportCol].setEmpty();
_local8 = gridData[playStartRow][activeSupportCol].color;
_local9 = gridData[playStartRow][activeSupportCol].type;
gridData[playBorderEndRow][activeSupportCol].init(_local9, _local8);
gridData[playBorderEndRow][activeSupportCol].copyState(gridData[playStartRow][activeSupportCol]);
}
var _local3 = playBorderStartRow;
while (_local3 <= playBorderEndRow) {
gridData[_local3][col].setChuzzlePos((posX + OBJECT_SIZE) + (col * OBJECT_SIZE), (posY + (_local3 * OBJECT_SIZE)) + deltaMoveY);
_local3++;
}
if (supportColOn) {
_local3 = playBorderStartRow;
while (_local3 <= playBorderEndRow) {
gridData[_local3][activeSupportCol].setChuzzlePos((posX + OBJECT_SIZE) + (activeSupportCol * OBJECT_SIZE), (posY + (_local3 * OBJECT_SIZE)) + deltaMoveY);
_local3++;
}
}
}
function getRowShifts() {
return(rowShifts);
}
function getMovedCol() {
return(col - playStartCol);
}
function adjustCol() {
movingCol = false;
deltaMoveY = 0;
rowShifts = 0;
gridData[playBorderStartRow][col].setEmpty();
gridData[playBorderEndRow][col].setEmpty();
if (supportColOn) {
gridData[playBorderStartRow][activeSupportCol].setEmpty();
gridData[playBorderEndRow][activeSupportCol].setEmpty();
}
var _local2 = playBorderStartRow;
while (_local2 <= playBorderEndRow) {
gridData[_local2][col].setChuzzlePos((posX + OBJECT_SIZE) + (col * OBJECT_SIZE), (posY + (_local2 * OBJECT_SIZE)) + deltaMoveY);
_local2++;
}
if (supportColOn) {
_local2 = playBorderStartRow;
while (_local2 <= playBorderEndRow) {
gridData[_local2][activeSupportCol].setChuzzlePos((posX + OBJECT_SIZE) + (activeSupportCol * OBJECT_SIZE), (posY + (_local2 * OBJECT_SIZE)) + deltaMoveY);
_local2++;
}
}
}
function moveBackColSetup() {
lockCheckOn = false;
moveBackSpeed = -(moveY / MOVE_BACK_TIME);
tickCounter = MOVE_BACK_TIME;
moveBack = true;
}
function moveBackCol() {
moveCol(moveBackSpeed);
if ((tickCounter--) <= 1) {
lockCheckOn = true;
adjustCol();
moveBack = false;
return(true);
}
return(false);
}
function moveRowSetup(row) {
movingRow = true;
this.row = row + playStartRow;
supportRowOn = false;
var _local2 = bigOnRow(this.row);
if (_local2 != -1) {
this.row = _local2;
activeSupportRow = this.row + 1;
supportRowOn = true;
}
moveX = 0;
deltaMoveX = 0;
colShifts = 0;
}
function moveRow(deltaX) {
if ((lockOnRow(row) && (lockCheckOn)) || ((supportRowOn && (lockCheckOn)) && (lockOnRow(activeSupportRow)))) {
if ((deltaX + deltaMoveX) >= 10) {
if (deltaMoveX == 10) {
return(undefined);
}
deltaX = 10 - deltaMoveX;
if (deltaX < 0) {
deltaX = 0;
}
messageCallback(callbackReciver, "cannot_move_lock");
} else if ((deltaX + deltaMoveX) <= -10) {
if (deltaMoveX == -10) {
return(undefined);
}
deltaX = -10 - deltaMoveX;
if (deltaX > 0) {
deltaX = 0;
}
messageCallback(callbackReciver, "cannot_move_lock");
}
}
if (supportRowOn) {
var _local12 = findBigColIndex(row);
if (deltaX < 0) {
var _local11 = ((_local12 - playStartCol) * OBJECT_SIZE) + deltaMoveX;
if (deltaX < (-_local11)) {
deltaX = -_local11;
if ((deltaX != 0) && (!moveBack)) {
var _local9 = new Object();
_local9.posX = posX + (1.5 * OBJECT_SIZE);
_local9.posY = (posY + (row * OBJECT_SIZE)) + (0.5 * OBJECT_SIZE);
messageCallback(callbackReciver, "big_hit_wall_ver", _local9);
}
}
} else if (deltaX > 0) {
var _local10 = (((playEndCol - _local12) * OBJECT_SIZE) - OBJECT_SIZE) - deltaMoveX;
if (deltaX > _local10) {
deltaX = _local10;
if ((deltaX != 0) && (!moveBack)) {
var _local9 = new Object();
_local9.posX = (posX + (playEndCol * OBJECT_SIZE)) + (1.5 * OBJECT_SIZE);
_local9.posY = (posY + (row * OBJECT_SIZE)) + (0.5 * OBJECT_SIZE);
messageCallback(callbackReciver, "big_hit_wall_ver", _local9);
}
}
}
}
moveX = moveX + deltaX;
deltaMoveX = deltaMoveX + deltaX;
if (deltaMoveX > (OBJECT_SIZE / 2)) {
var _local7 = Math.round(deltaMoveX / OBJECT_SIZE);
deltaMoveX = deltaMoveX - (_local7 * OBJECT_SIZE);
var _local3 = 0;
while (_local3 < _local7) {
var _local4 = gridData[row][playEndCol];
var _local2 = playEndCol;
while (_local2 > playStartCol) {
gridData[row][_local2] = gridData[row][_local2 - 1];
_local2--;
}
gridData[row][playStartCol] = _local4;
if (supportRowOn) {
_local4 = gridData[activeSupportRow][playEndCol];
_local2 = playEndCol;
while (_local2 > playStartCol) {
gridData[activeSupportRow][_local2] = gridData[activeSupportRow][_local2 - 1];
_local2--;
}
gridData[activeSupportRow][playStartCol] = _local4;
}
colShifts++;
_local3++;
}
} else if (deltaMoveX < ((-OBJECT_SIZE) / 2)) {
var _local7 = Math.round((-deltaMoveX) / OBJECT_SIZE);
deltaMoveX = deltaMoveX + (_local7 * OBJECT_SIZE);
var _local3 = 0;
while (_local3 < _local7) {
var _local4 = gridData[row][playStartCol];
var _local2 = playStartCol;
while (_local2 < playEndCol) {
gridData[row][_local2] = gridData[row][_local2 + 1];
_local2++;
}
gridData[row][playEndCol] = _local4;
if (supportRowOn) {
_local4 = gridData[activeSupportRow][playStartCol];
_local2 = playStartCol;
while (_local2 < playEndCol) {
gridData[activeSupportRow][_local2] = gridData[activeSupportRow][_local2 + 1];
_local2++;
}
gridData[activeSupportRow][playEndCol] = _local4;
}
colShifts--;
_local3++;
}
}
gridData[row][playBorderStartCol].setEmpty();
var _local6 = gridData[row][playEndCol].color;
var _local8 = gridData[row][playEndCol].type;
gridData[row][playBorderStartCol].init(_local8, _local6);
gridData[row][playBorderStartCol].copyState(gridData[row][playEndCol]);
gridData[row][playBorderEndCol].setEmpty();
_local6 = gridData[row][playStartCol].color;
_local8 = gridData[row][playStartCol].type;
gridData[row][playBorderEndCol].init(_local8, _local6);
gridData[row][playBorderEndCol].copyState(gridData[row][playStartCol]);
if (supportRowOn) {
gridData[activeSupportRow][playBorderStartCol].setEmpty();
_local6 = gridData[activeSupportRow][playEndCol].color;
_local8 = gridData[activeSupportRow][playEndCol].type;
gridData[activeSupportRow][playBorderStartCol].init(_local8, _local6);
gridData[activeSupportRow][playBorderStartCol].copyState(gridData[activeSupportRow][playEndCol]);
gridData[activeSupportRow][playBorderEndCol].setEmpty();
_local6 = gridData[activeSupportRow][playStartCol].color;
_local8 = gridData[activeSupportRow][playStartCol].type;
gridData[activeSupportRow][playBorderEndCol].init(_local8, _local6);
gridData[activeSupportRow][playBorderEndCol].copyState(gridData[activeSupportRow][playStartCol]);
}
var _local2 = playBorderStartCol;
while (_local2 <= playBorderEndCol) {
gridData[row][_local2].setChuzzlePos(((posX + OBJECT_SIZE) + (_local2 * OBJECT_SIZE)) + deltaMoveX, posY + (row * OBJECT_SIZE));
_local2++;
}
if (supportRowOn) {
_local2 = playBorderStartCol;
while (_local2 <= playBorderEndCol) {
gridData[activeSupportRow][_local2].setChuzzlePos(((posX + OBJECT_SIZE) + (_local2 * OBJECT_SIZE)) + deltaMoveX, posY + (activeSupportRow * OBJECT_SIZE));
_local2++;
}
}
}
function getColShifts() {
return(colShifts);
}
function getMovedRow() {
return(row - playStartRow);
}
function adjustRow() {
movingRow = false;
deltaMoveX = 0;
colShifts = 0;
gridData[row][playBorderStartCol].setEmpty();
gridData[row][playBorderEndCol].setEmpty();
if (supportRowOn) {
gridData[activeSupportRow][playBorderStartCol].setEmpty();
gridData[activeSupportRow][playBorderEndCol].setEmpty();
}
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
gridData[row][_local2].setChuzzlePos(((posX + OBJECT_SIZE) + (_local2 * OBJECT_SIZE)) + deltaMoveX, posY + (row * OBJECT_SIZE));
_local2++;
}
if (supportRowOn) {
_local2 = playStartCol;
while (_local2 <= playEndCol) {
gridData[activeSupportRow][_local2].setChuzzlePos(((posX + OBJECT_SIZE) + (_local2 * OBJECT_SIZE)) + deltaMoveX, posY + (activeSupportRow * OBJECT_SIZE));
_local2++;
}
}
}
function moveBackRowSetup() {
moveBackSpeed = -(moveX / MOVE_BACK_TIME);
tickCounter = MOVE_BACK_TIME;
lockCheckOn = false;
moveBack = true;
}
function moveBackRow() {
moveRow(moveBackSpeed);
if ((tickCounter--) <= 1) {
lockCheckOn = true;
adjustRow();
moveBack = false;
return(true);
}
return(false);
}
function getHorizontalMove() {
return(moveX);
}
function getVerticalMove() {
return(moveY);
}
function testMatching() {
return(matching());
}
function executeMatching() {
var _local2 = matching();
if (_local2) {
if (cascades == 0) {
messageCallback(callbackReciver, "cascades_starts", null);
}
setChuzzlePositions();
cascades++;
matchingRemove();
return(true);
}
cascades = 0;
return(false);
}
function matching() {
var _local9 = false;
matchMatrix = new Array();
var _local7 = playStartRow;
while (_local7 <= playEndRow) {
var _local4 = playStartCol;
while (_local4 <= playEndCol) {
gridData[_local7][_local4].setGridPos(_local7, _local4);
gridData[_local7][_local4].matched = false;
gridData[_local7][_local4].superExplode = 0;
_local4++;
}
_local7++;
}
_local7 = playStartRow;
while (_local7 <= playEndRow) {
var _local4 = playStartCol;
while (_local4 <= playEndCol) {
if (gridData[_local7][_local4].matched) {
} else {
var _local2 = new Array();
_local2.push(gridData[_local7][_local4]);
if (match(_local7, _local4, _local2)) {
var _local5 = 1;
while (_local5 < _local2.length) {
var _local6 = _local2[_local5];
match(_local6.row, _local6.col, _local2);
_local5++;
}
}
var _local8 = 0;
var _local3 = 0;
while (_local3 < _local2.length) {
if (_local2[_local3].type != com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT) {
_local8++;
}
_local3++;
}
if (_local8 >= 3) {
_local9 = true;
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3].matched = true;
_local3++;
}
matchMatrix.push(_local2);
}
}
_local4++;
}
_local7++;
}
return(_local9);
}
function matchingRemove() {
if (sendMessages) {
messageCallback(callbackReciver, "matching_starts", null);
}
var _local6 = 0;
while (_local6 < matchMatrix.length) {
if (_local6 == (matchMatrix.length - 1)) {
if (sendMessages) {
cascadeMessage(cascades, matchMatrix[_local6]);
}
}
_local6++;
}
if (sendMessages) {
combosMessage(matchMatrix);
}
var _local5 = 0;
while (_local5 < matchMatrix.length) {
if (sendMessages) {
matchesMessage(matchMatrix[_local5]);
scoreMessages(matchMatrix[_local5]);
}
_local5++;
}
var _local9 = new Array();
var _local8 = 0;
while (_local8 < matchMatrix.length) {
var _local7 = matchMatrix[_local8];
var _local4 = 0;
while (_local4 < _local7.length) {
if (_local7[_local4].superState) {
_local9.push(_local7[_local4]);
}
_local4++;
}
_local8++;
}
_local8 = 0;
while (_local8 < _local9.length) {
superExplode(_local9[_local8]);
_local8++;
}
var _local2;
_local8 = 0;
while (_local8 < matchMatrix.length) {
justRemovedBig = false;
var _local7 = matchMatrix[_local8];
var _local4 = 0;
while (_local4 < _local7.length) {
_local2 = _local7[_local4];
var _local3 = new Object();
_local3.posX = _local2.chuzzleObj.posX;
_local3.posY = _local2.chuzzleObj.posY;
_local3.color = _local2.color;
if (_local2.type == com.king.Chuzzle.GridObj.TYPE_NORMAL) {
if (sendMessages) {
if (_local2.locked == true) {
explodeMessage("chuzzle_lock_deleted", _local2);
} else if (_local2.color != com.king.Chuzzle.GridObj.NONE) {
explodeMessage("chuzzle_deleted", _local2);
}
}
} else if (_local2.type == com.king.Chuzzle.GridObj.TYPE_BIG) {
nrBigs--;
justRemovedBig = true;
if (sendMessages) {
explodeMessage("big_chuzzle_deleted", _local2);
}
}
_local2.setEmpty();
_local4++;
}
_local8++;
}
}
function calcMatchesCenterPosX(matchesArray) {
var _local3 = 0;
var _local4 = 0;
var _local1 = 0;
while (_local1 < matchesArray.length) {
if ((matchesArray[_local1].type == com.king.Chuzzle.GridObj.TYPE_NORMAL) || (matchesArray[_local1].type == com.king.Chuzzle.GridObj.TYPE_BIG)) {
_local4++;
_local3 = _local3 + matchesArray[_local1].chuzzleObj.posX;
}
_local1++;
}
_local3 = _local3 / _local4;
return(_local3);
}
function calcMatchesCenterPosY(matchesArray) {
var _local3 = 0;
var _local4 = 0;
var _local1 = 0;
while (_local1 < matchesArray.length) {
if ((matchesArray[_local1].type == com.king.Chuzzle.GridObj.TYPE_NORMAL) || (matchesArray[_local1].type == com.king.Chuzzle.GridObj.TYPE_BIG)) {
_local4++;
_local3 = _local3 + matchesArray[_local1].chuzzleObj.posY;
}
_local1++;
}
_local3 = _local3 / _local4;
return(_local3);
}
function explodeMessage(mess, gridObj) {
var _local2 = new com.king.Chuzzle.ExplodeData();
_local2.posX = gridObj.chuzzleObj.posX;
_local2.posY = gridObj.chuzzleObj.posY;
_local2.color = gridObj.color;
_local2.row = gridObj.row - playStartRow;
_local2.col = gridObj.col - playStartCol;
_local2.eyeColor = gridObj.chuzzleObj.eyes.color;
messageCallback(callbackReciver, mess, _local2);
}
function combosMessage(matchMatrix) {
var _local7 = matchMatrix.length - 1;
if (_local7 < 1) {
return(undefined);
}
var _local5 = 0;
var _local4 = 0;
var _local2 = 0;
while (_local2 < matchMatrix.length) {
_local5 = _local5 + calcMatchesCenterPosX(matchMatrix[_local2]);
_local4 = _local4 + calcMatchesCenterPosY(matchMatrix[_local2]);
_local2++;
}
_local5 = Math.floor(_local5 / matchMatrix.length);
_local4 = Math.floor(_local4 / matchMatrix.length);
var _local6 = new com.king.Chuzzle.MatchData();
_local6.posX = _local5;
_local6.posY = _local4;
_local6.nr = _local7;
messageCallback(callbackReciver, "combos", _local6);
}
function cascadeMessage(cascades, matches) {
if (cascades < 2) {
}
var _local4 = 0;
var _local2 = 0;
while (_local2 < matches.length) {
if (matches[_local2].type != com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT) {
_local4++;
}
_local2++;
}
var _local5 = new com.king.Chuzzle.MatchData();
_local5.posX = calcMatchesCenterPosX(matches) + OBJECT_SIZE;
_local5.posY = calcMatchesCenterPosY(matches) - OBJECT_SIZE;
_local5.nr = cascades;
messageCallback(callbackReciver, "cascades", _local5);
}
function matchesMessage(matches) {
var _local6;
var _local5 = false;
var _local4 = 0;
var _local2 = 0;
while (_local2 < matches.length) {
if (((matches[_local2].type == com.king.Chuzzle.GridObj.TYPE_NORMAL) || (matches[_local2].type == com.king.Chuzzle.GridObj.TYPE_BIG)) && (matches[_local2].color != com.king.Chuzzle.GridObj.NONE)) {
_local4++;
_local6 = matches[_local2].color;
}
if (matches[_local2].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
_local5 = true;
}
_local2++;
}
if (_local4 < 1) {
return(undefined);
}
var _local7 = new com.king.Chuzzle.MatchData();
_local7.posX = calcMatchesCenterPosX(matches);
_local7.posY = calcMatchesCenterPosY(matches);
_local7.nr = _local4;
_local7.color = _local6;
_local7.big = _local5;
messageCallback(callbackReciver, "matches", _local7);
}
function scoreMessages(matches) {
var _local2 = 0;
while (_local2 < matches.length) {
if (matches[_local2].type == com.king.Chuzzle.GridObj.TYPE_NORMAL) {
if (matches[_local2].locked) {
messageCallback(callbackReciver, "score_lock_delete", null);
}
}
_local2++;
}
}
function adjustForSuperExplosion() {
var _local3 = playEndRow - 1;
while (_local3 >= 0) {
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
if (bigOnCol2(_local2) != -1) {
gridData[_local3 + 1][_local2].superExplode = 0;
}
if (gridData[_local3 + 1][_local2].superExplode != 0) {
if (gridData[_local3][_local2].superExplode < gridData[_local3 + 1][_local2].superExplode) {
gridData[_local3][_local2].superExplode = gridData[_local3 + 1][_local2].superExplode;
}
}
if (gridData[_local3 + 1][_local2].chuzzleObj != null) {
gridData[_local3 + 1][_local2].chuzzleObj.superExplode = gridData[_local3 + 1][_local2].superExplode;
}
_local2++;
}
_local3--;
}
}
function superExplode(superGridObj) {
if (superGridObj.color == com.king.Chuzzle.GridObj.NONE) {
return(undefined);
}
var _local5 = superGridObj.row;
var _local6 = superGridObj.col;
gridData[_local5 - 2][_local6 - 1].superExplode = 1;
gridData[_local5 - 2][_local6].superExplode = 2;
gridData[_local5 - 2][_local6 + 1].superExplode = 1;
if (sendMessages) {
explodeMessage("super_chuzzle_deleted", superGridObj);
}
superExplodeBigHelper(superGridObj);
superGridObj.setEmpty();
var _local3;
var _local4 = -1;
while (_local4 <= 1) {
var _local2 = -1;
for ( ; _local2 <= 1 ; _local2++) {
if (((((_local5 + _local4) < playStartRow) || ((_local5 + _local4) > playEndRow)) || ((_local6 + _local2) < playStartCol)) || ((_local6 + _local2) > playEndCol)) {
} else {
_local3 = gridData[_local5 + _local4][_local6 + _local2];
if (_local3.color == com.king.Chuzzle.GridObj.NONE) {
} else {
if ((_local4 == 0) && (_local2 == 0)) {
} else if (_local3.superState) {
superExplode(_local3);
continue;
}
if (sendMessages) {
explodeMessage("chuzzle_removed_by_super", _local3);
}
superExplodeBigHelper(_local3);
_local3.setEmpty();
}
}
}
_local4++;
}
}
function superExplodeBigHelper(superGridObj) {
var _local4 = superGridObj.row;
var _local5 = superGridObj.col;
if ((superGridObj.type == com.king.Chuzzle.GridObj.TYPE_BIG) || (superGridObj.type == com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT)) {
var _local3 = -1;
while (_local3 <= 1) {
var _local2 = -1;
while (_local2 <= 1) {
if ((gridData[_local4 - _local3][_local5 - _local2].type == com.king.Chuzzle.GridObj.TYPE_BIG) || (gridData[_local4 - _local3][_local5 - _local2].type == com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT)) {
if (gridData[_local4 - _local3][_local5 - _local2].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
messageCallback(callbackReciver, "big_chuzzle_removed_by_super", null);
}
gridData[_local4 - _local3][_local5 - _local2].setEmpty();
}
_local2++;
}
_local3++;
}
}
}
function match(row, col, matchArray) {
var _local4 = false;
var _local2 = checkLeft(row, col);
if ((_local2 != null) && (!allReadyInArray(_local2, matchArray))) {
_local4 = true;
matchArray.push(_local2);
}
_local2 = checkRight(row, col);
if ((_local2 != null) && (!allReadyInArray(_local2, matchArray))) {
_local4 = true;
matchArray.push(_local2);
}
_local2 = checkAbove(row, col);
if ((_local2 != null) && (!allReadyInArray(_local2, matchArray))) {
_local4 = true;
matchArray.push(_local2);
}
_local2 = checkUnder(row, col);
if ((_local2 != null) && (!allReadyInArray(_local2, matchArray))) {
_local4 = true;
matchArray.push(_local2);
}
return(_local4);
}
function allReadyInArray(gridObj, gridObjArray) {
var _local1 = 0;
while (_local1 < gridObjArray.length) {
if ((gridObj.row == gridObjArray[_local1].row) && (gridObj.col == gridObjArray[_local1].col)) {
return(true);
}
_local1++;
}
return(false);
}
function checkLeft(row, col) {
if (col == playStartCol) {
return(null);
}
if (gridData[row][col].color == gridData[row][col - 1].color) {
return(gridData[row][col - 1]);
}
return(null);
}
function checkRight(row, col) {
if (col == playEndCol) {
return(null);
}
if (gridData[row][col].color == gridData[row][col + 1].color) {
return(gridData[row][col + 1]);
}
return(null);
}
function checkAbove(row, col) {
if (row == playStartRow) {
return(null);
}
if (gridData[row][col].color == gridData[row - 1][col].color) {
return(gridData[row - 1][col]);
}
return(null);
}
function checkUnder(row, col) {
if (row == playEndRow) {
return(null);
}
if (gridData[row][col].color == gridData[row + 1][col].color) {
return(gridData[row + 1][col]);
}
return(null);
}
function preFalling() {
var _local5 = playBorderEndRow;
while (_local5 < gridHeight) {
var _local4 = 0;
while (_local4 < gridWidth) {
gridData[_local5][_local4].setEmpty();
_local4++;
}
_local5++;
}
_local5 = 0;
while (_local5 < gridHeight) {
var _local4 = 0;
while (_local4 < gridWidth) {
gridData[_local5][_local4].fallValue = 0;
gridData[_local5][_local4].delayFallValue = 0;
_local4++;
}
_local5++;
}
var _local3 = playStartCol;
while (_local3 <= playEndCol) {
gridData[playEndRow][_local3].fallValue = 0;
var _local2 = playEndRow - 1;
while (_local2 >= (playStartRow - 1)) {
if (gridData[_local2 + 1][_local3].color == com.king.Chuzzle.GridObj.NONE) {
gridData[_local2][_local3].fallValue = 1;
} else {
gridData[_local2][_local3].fallValue = 0;
}
gridData[_local2][_local3].fallValue = gridData[_local2][_local3].fallValue + gridData[_local2 + 1][_local3].fallValue;
_local2--;
}
_local3++;
}
}
function addNewObjects() {
var _local3 = playStartCol;
while (_local3 <= playEndCol) {
var _local5 = gridData[playStartRow - 1][_local3].fallValue;
var _local2 = 1;
while (_local2 <= _local5) {
var _local4 = randomColor();
gridData[playStartRow - _local2][_local3].init(com.king.Chuzzle.GridObj.TYPE_NORMAL, _local4);
gridData[playStartRow - _local2][_local3].fallValue = _local5;
_local2++;
}
_local3++;
}
}
function adjustForBig() {
var _local11 = playEndRow;
while (_local11 >= 0) {
var _local5 = playStartCol;
while (_local5 <= playEndCol) {
if (gridData[_local11][_local5].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
var _local9 = 0;
var _local8 = 0;
var _local6 = _local11 + 2;
while (_local6 <= playEndRow) {
if (gridData[_local6][_local5].color != com.king.Chuzzle.GridObj.NONE) {
_local9++;
}
if (gridData[_local6][_local5 + 1].color != com.king.Chuzzle.GridObj.NONE) {
_local8++;
}
_local6++;
}
var _local7 = Math.abs(_local9 - _local8);
if (_local7 != 0) {
var _local4;
if (_local9 > _local8) {
_local4 = _local5;
} else {
_local4 = _local5 + 1;
}
_local6 = 0;
while (_local6 <= playEndRow) {
gridData[_local6][_local4].fallValue = gridData[_local6][_local4].fallValue + _local7;
_local6++;
}
var _local2 = playBorderStartRow;
do {
if (gridData[_local2][_local4].color == com.king.Chuzzle.GridObj.NONE) {
break;
}
_local2--;
} while (_local2 > -1);
var _local3 = 0;
while (_local3 < _local7) {
var _local10 = randomColor();
gridData[_local2 - _local3][_local4].init(com.king.Chuzzle.GridObj.TYPE_NORMAL, _local10);
gridData[_local2 - _local3][_local4].fallValue = gridData[(_local2 - _local3) + 1][_local4].fallValue;
_local3++;
}
return(undefined);
}
}
_local5++;
}
_local11--;
}
}
function falling() {
var _local3 = playEndRow;
while (_local3 >= 0) {
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
var _local4 = gridData[_local3][_local2].fallValue;
if (_local4 > 0) {
var _local5 = gridData[_local3 + _local4][_local2];
gridData[_local3 + _local4][_local2] = gridData[_local3][_local2];
gridData[_local3 + _local4][_local2].fallValue = 0;
gridData[_local3][_local2] = _local5;
gridData[_local3][_local2].setEmpty();
}
_local2++;
}
_local3--;
}
setChuzzlePositions();
}
function removeUnder() {
var _local3 = playBorderEndRow;
while (_local3 < (playBorderEndRow + 1)) {
var _local2 = 0;
while (_local2 < gridWidth) {
gridData[_local3][_local2].setEmpty();
_local2++;
}
_local3++;
}
}
function setStartAnimPosY() {
var _local3 = 0;
while (_local3 <= playEndRow) {
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
var _local4 = posY + (_local3 * OBJECT_SIZE);
var _local5 = gridData[_local3][_local2].delayFallValue * OBJECT_SIZE;
gridData[_local3][_local2].setStartAnimPosY(_local4, _local5);
_local2++;
}
_local3++;
}
}
function setupFallingAnim() {
var _local6 = 0;
var _local4 = 0;
while (_local4 < gridHeight) {
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
var _local5 = posY + (_local4 * OBJECT_SIZE);
var _local3 = gridData[_local4][_local2].setupFallingAnim(_local5);
if (_local3 > _local6) {
_local6 = _local3;
}
_local2++;
}
_local4++;
}
return(_local6);
}
function setChuzzlePositions() {
var _local4 = 0;
while (_local4 < gridHeight) {
var _local2 = 0;
while (_local2 < gridWidth) {
var _local3 = gridData[_local4][_local2];
if (_local3.chuzzleObj != null) {
_local3.setChuzzlePos((posX + OBJECT_SIZE) + (_local2 * OBJECT_SIZE), posY + (_local4 * OBJECT_SIZE));
}
_local2++;
}
_local4++;
}
}
function randomColor() {
var _local2 = random.nextInt(8) + 1;
return(_local2);
}
function scrambleAnimate() {
var _local3 = playStartCol;
while (_local3 <= playEndCol) {
var _local4 = gridData[playEndRow][_local3];
var _local2;
_local2 = playEndRow;
while (_local2 > playStartRow) {
gridData[_local2][_local3] = gridData[_local2 - 1][_local3];
_local2--;
}
gridData[_local2][_local3] = _local4;
_local3++;
}
setChuzzlePositions();
}
function makeRandomSuperAbove(color) {
var _local4 = 0;
while (_local4 < 10) {
var _local7 = random.nextInt(2);
var _local6 = random.nextInt(6);
if (makeSuper(playBorderStartRow - _local7, playStartCol + _local6, color)) {
return(true);
}
_local4++;
}
var _local3 = playBorderStartRow;
while (_local3 >= 0) {
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
if (makeSuper(_local3, _local2, color)) {
return(true);
}
_local2++;
}
_local3--;
}
return(false);
}
function getSuperSet(superSet) {
superSet.makeEmpty();
var _local3 = playStartRow;
while (_local3 <= playEndRow) {
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
if (gridData[_local3][_local2].superState == true) {
superSet.push(gridData[_local3][_local2].color);
}
_local2++;
}
_local3++;
}
}
function makeSuperFromSuperSet(superSet) {
var _local5 = superSet.getLength();
var _local2 = 0;
while (_local2 < _local5) {
var _local3 = superSet.getObjectAtIndex(_local2);
if (makeRandomTestedSuperOnPlayField(_local3) == false) {
setRandomSuperOnPlayField();
}
_local2++;
}
superSet.makeEmpty();
}
function makeSuper(row, col, color) {
if (gridData[row][col].setAndSimple()) {
var _local4 = gridData[row][col].fallValue;
gridData[row][col].setEmpty();
gridData[row][col].init(com.king.Chuzzle.GridObj.TYPE_NORMAL, color);
gridData[row][col].setSuperState();
gridData[row][col].fallValue = _local4;
return(true);
}
return(false);
}
function makeRandomTestedSuperOnPlayField(color) {
var _local4 = 0;
while (_local4 < 10) {
var _local7 = random.nextInt(6);
var _local6 = random.nextInt(6);
if (makeTestedSuper(playStartRow + _local7, playStartCol + _local6, color)) {
return(true);
}
_local4++;
}
return(false);
while (_local3 >= 0) {
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
if (makeTestedSuper(_local3, _local2, color)) {
return(true);
}
_local2++;
}
_local3--;
}
return(false);
}
function makeTestedSuper(row, col, color) {
if (gridData[row][col].setAndSimple()) {
var _local4 = new com.king.Chuzzle.TestGrid();
_local4.copyGrid(gridData);
_local4.gridData[row - 6][col - 1].setEmpty();
_local4.gridData[row - 6][col - 1].testInit2(com.king.Chuzzle.GridObj.TYPE_NORMAL, color);
_local4.gridData[row - 6][col - 1].setGridPos(row - 6, col - 1);
if (_local4.testRowCol(row - 6, col - 1)) {
return(false);
}
gridData[row][col].setEmpty();
gridData[row][col].init(com.king.Chuzzle.GridObj.TYPE_NORMAL, color);
gridData[row][col].setSuperState();
return(true);
}
return(false);
}
function setRandomSuperOnPlayField() {
var _local4 = 0;
while (_local4 < 10) {
var _local6 = random.nextInt(6);
var _local5 = random.nextInt(6);
if (setSuper(playStartRow + _local6, playStartCol + _local5)) {
return(true);
}
_local4++;
}
var _local3 = playBorderStartRow;
while (_local3 >= 0) {
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
if (setSuper(_local3, _local2)) {
return(true);
}
_local2++;
}
_local3--;
}
return(false);
}
function setSuper(row, col) {
if (gridData[row][col].setAndSimple()) {
gridData[row][col].setSuperState();
return(true);
}
return(false);
}
function addRandomLock() {
var _local6 = 0;
while ((_local6++) < 10) {
var _local5 = playStartRow + lockRandom.nextInt(6);
var _local4 = playStartCol + lockRandom.nextInt(6);
if (gridData[_local5][_local4].setAndSimple()) {
gridData[_local5][_local4].setLock();
newLockOnRow = _local5;
newLockOnCol = _local4;
sendCreateLockMessage(newLockOnRow, newLockOnCol);
return(true);
}
}
var _local3 = playStartRow;
while (_local3 <= playEndRow) {
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
if (gridData[_local3][_local2].setAndSimple()) {
gridData[_local3][_local2].setLock();
newLockOnRow = _local3;
newLockOnCol = _local2;
sendCreateLockMessage(newLockOnRow, newLockOnCol);
return(true);
}
_local2++;
}
_local3++;
}
return(false);
}
function sendCreateLockMessage(onRow, onCol) {
var _local4 = 0;
var _local3 = 0;
var _local2 = new Object();
_local2.posX = newLockPosX();
_local2.posY = newLockPosY();
_local2.row = newLockAtRow();
_local2.col = newLockAtCol();
messageCallback(callbackReciver, "lock_set", _local2);
}
function lockOnCol(col) {
var _local3 = false;
var _local2 = playStartRow;
while (_local2 <= playEndRow) {
if (gridData[_local2][col].locked == true) {
_local3 = true;
break;
}
_local2++;
}
return(_local3);
}
function lockOnRow(row) {
var _local3 = false;
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
if (gridData[row][_local2].locked == true) {
_local3 = true;
break;
}
_local2++;
}
return(_local3);
}
function newLockIsOnMovedCol() {
if (movingCol && ((newLockOnCol == col) || (supportColOn && (newLockOnCol == activeSupportCol)))) {
return(true);
}
return(false);
}
function newLockIsOnMovedRow() {
if (movingRow && ((newLockOnRow == row) || (supportRowOn && (newLockOnRow == activeSupportRow)))) {
return(true);
}
return(false);
}
function newLockPosX() {
var _local3;
if (newLockIsOnMovedRow()) {
var _local2;
_local2 = newLockOnCol - colShifts;
if (_local2 < playStartCol) {
_local2 = _local2 + 6;
} else if (_local2 > playEndCol) {
_local2 = _local2 - 6;
}
if (_local2 < playStartCol) {
_local2 = _local2 + 6;
} else if (_local2 > playEndCol) {
_local2 = _local2 - 6;
}
_local3 = (posX + (_local2 * OBJECT_SIZE)) + OBJECT_SIZE;
} else {
_local3 = (posX + (newLockOnCol * OBJECT_SIZE)) + OBJECT_SIZE;
}
return(_local3);
}
function newLockPosY() {
var _local3;
if (newLockIsOnMovedCol()) {
var _local2;
_local2 = newLockOnRow - rowShifts;
if (_local2 < playStartRow) {
_local2 = _local2 + 6;
} else if (_local2 > playEndRow) {
_local2 = _local2 - 6;
}
_local3 = posY + (_local2 * OBJECT_SIZE);
} else {
_local3 = posY + (newLockOnRow * OBJECT_SIZE);
}
return(_local3);
}
function newLockAtCol() {
var _local2;
if (newLockIsOnMovedRow()) {
_local2 = newLockOnCol - colShifts;
if (_local2 < playStartCol) {
_local2 = _local2 + 6;
} else if (_local2 > playEndCol) {
_local2 = _local2 - 6;
}
if (_local2 < playStartCol) {
_local2 = _local2 + 6;
} else if (_local2 > playEndCol) {
_local2 = _local2 - 6;
}
} else {
_local2 = newLockOnCol;
}
return(_local2 - playStartCol);
}
function newLockAtRow() {
var _local2;
if (newLockIsOnMovedCol()) {
_local2 = newLockOnRow - rowShifts;
if (_local2 < playStartRow) {
_local2 = _local2 + 6;
} else if (_local2 > playEndRow) {
_local2 = _local2 - 6;
}
} else {
_local2 = newLockOnRow;
}
return(_local2 - playStartRow);
}
function tryToAddBig() {
var _local3 = playBorderStartRow - 1;
while (_local3 >= 0) {
var _local2 = playStartCol;
while (_local2 < playEndCol) {
if ((nrBigs < 1) && (!justRemovedBig)) {
if (makeBig(_local3, _local2)) {
nrBigs++;
return(true);
}
}
_local2++;
}
_local3--;
}
return(false);
}
function makeRandomBig(row, col) {
var _local3 = random.nextInt(5);
var _local2 = random.nextInt(5);
return(makeBig(row + _local3, col + _local2));
}
function makeBig(row, col) {
if (((gridData[row][col].setAndSimple() && (gridData[row][col + 1].setAndSimple())) && (gridData[row + 1][col].setAndSimple())) && (gridData[row + 1][col + 1].setAndSimple())) {
var _local4 = randomColor();
gridData[row][col].setEmpty();
gridData[row][col].init(com.king.Chuzzle.GridObj.TYPE_BIG, _local4);
gridData[row][col + 1].setEmpty();
gridData[row][col + 1].init(com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT, _local4);
gridData[row + 1][col].setEmpty();
gridData[row + 1][col].init(com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT, _local4);
gridData[row + 1][col + 1].setEmpty();
gridData[row + 1][col + 1].init(com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT, _local4);
return(true);
}
return(false);
}
function bigOnCol(colIndex) {
var _local4 = -1;
var _local2 = 0;
while (_local2 <= playEndRow) {
if (gridData[_local2][colIndex].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
_local4 = colIndex;
break;
}
if (gridData[_local2][colIndex].type == com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT) {
_local4 = colIndex - 1;
break;
}
_local2++;
}
return(_local4);
}
function bigOnRow(rowIndex) {
var _local4 = -1;
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
if (gridData[rowIndex][_local2].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
_local4 = rowIndex;
break;
}
if (gridData[rowIndex][_local2].type == com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT) {
_local4 = rowIndex - 1;
break;
}
_local2++;
}
return(_local4);
}
function findBigRowIndex(colIndex) {
var _local3 = false;
var _local2 = playStartRow;
while (_local2 <= playEndRow) {
if (gridData[_local2][colIndex].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
_local3 = true;
break;
}
_local2++;
}
if (_local3) {
return(_local2);
}
return(-1);
}
function findBigColIndex(rowIndex) {
var _local3 = false;
var _local2 = playStartCol;
while (_local2 <= playEndCol) {
if (gridData[rowIndex][_local2].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
_local3 = true;
break;
}
_local2++;
}
if (_local3) {
return(_local2);
}
return(-1);
}
function bigOnCol2(colIndex) {
var _local3 = -1;
var _local2 = 0;
while (_local2 <= playEndRow) {
if (gridData[_local2][colIndex].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
_local3 = _local2;
break;
}
if (gridData[_local2][colIndex].type == com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT) {
_local3 = _local2;
break;
}
_local2++;
}
return(_local3);
}
function bigOnColReturnRow(colIndex) {
var _local3 = -1;
var _local2 = playStartRow;
while (_local2 <= playEndRow) {
if (gridData[_local2][colIndex].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
_local3 = _local2;
break;
}
if (gridData[_local2][colIndex].type == com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT) {
_local3 = _local2;
break;
}
_local2++;
}
return(_local3);
}
function pick(rowIndex, colIndex) {
gridData[playStartRow + rowIndex][playStartCol + colIndex].pick();
}
function addRandomBig() {
tryToAddBig();
adjustForBig();
}
static var MOVE_BACK_TIME = 10;
static var HINT_SHAKE_OFFSET = 20;
static var HINT_SHAKE_TIME = 15;
static var OBJECT_SIZE = 72;
static var PLAY_GRID_HEIGHT = 6;
static var PLAY_GRID_WIDTH = 6;
static var PLAY_GRID_BORDER = 1;
}
Symbol 742 MovieClip [__Packages.com.king.Chuzzle.TestGrid] Frame 0
class com.king.Chuzzle.TestGrid
{
static var testCounter, testMatch;
var gridData, hintMoveToCol, hintMoveToRow, hintWrap, hintMoveShiftCol, hintMoveShiftRow, hintMoveFromCol, hintMoveFromRow, hintMoveFromCol1, hintMoveFromRow1, hintMoveFromCol2, hintMoveFromRow2, hintMoveToCol1, hintMoveToRow1, hintMoveToCol2, hintMoveToRow2;
function TestGrid () {
}
function testSetGridObj(rowIndex, colIndex) {
}
function getType(rowIndex, colIndex) {
return(gridData[rowIndex][colIndex].type);
}
function copyGrid(sourceGridData) {
gridData = new Array();
var _local3 = 0;
while (_local3 < HEIGHT) {
gridData[_local3] = new Array(WIDTH);
var _local2 = 0;
while (_local2 < WIDTH) {
gridData[_local3][_local2] = new com.king.Chuzzle.GridObj();
gridData[_local3][_local2].testInit(sourceGridData[6 + _local3][1 + _local2]);
gridData[_local3][_local2].setGridPos(_local3, _local2);
_local2++;
}
_local3++;
}
}
function resetTest() {
testCounter = 0;
testMatch = false;
}
function test() {
if (testCounter < 6) {
if (shiftAndTestCol(testCounter)) {
testMatch = true;
}
} else if (testCounter < 12) {
if (shiftAndTestRow(testCounter - 6)) {
testMatch = true;
}
} else {
if (testCounter == 12) {
testCounter = 99;
return(true);
}
testCounter = 99;
}
testCounter++;
return(false);
}
function testhasMatch() {
return(testMatch);
}
function shiftAndTestRow(rowIndex) {
var _local7 = bigOnRow(rowIndex);
var _local8 = false;
var _local10 = 0;
var _local9 = 0;
_local10 = calcLeftSteps(rowIndex);
if (_local7) {
_local9 = calcRightSteps(rowIndex);
}
if (testRow(rowIndex)) {
_local8 = true;
setHint(0, 0);
}
var _local3 = 0;
while (_local3 < _local10) {
shiftLeft(rowIndex, 1);
if (_local7) {
shiftLeft(rowIndex + 1, 1);
}
if (testRow(rowIndex)) {
_local8 = true;
var _local6 = -(_local3 + 1);
var _local5 = 0;
setHint(_local6, _local5);
}
_local3++;
}
shiftRight(rowIndex, _local10);
if (_local7) {
shiftRight(rowIndex + 1, _local10);
}
_local3 = 0;
while (_local3 < _local9) {
shiftRight(rowIndex, 1);
if (_local7) {
shiftRight(rowIndex + 1, 1);
}
if (testRow(rowIndex)) {
_local8 = true;
var _local6 = _local3 + 1;
var _local4 = 0;
setHint(_local6, _local4);
}
_local3++;
}
shiftLeft(rowIndex, _local9);
if (_local7) {
shiftLeft(rowIndex + 1, _local9);
}
return(_local8);
}
function testRow(rowIndex) {
var _local4 = false;
var _local2 = 0;
while (_local2 < WIDTH) {
var _local3 = testRowCol(rowIndex, _local2);
if (_local3) {
_local4 = true;
}
_local2++;
}
return(_local4);
}
function testRow2(rowIndex, resultArray) {
var _local7 = false;
var _local4 = 0;
while (_local4 < WIDTH) {
var _local3 = new Array();
var _local6 = testRowCol2(rowIndex, _local4, _local3);
if (_local6) {
while (_local3.length > 0) {
var _local2 = _local3.pop();
if (!allReadyInArray(_local2, resultArray)) {
resultArray.push(_local2);
}
}
_local7 = true;
}
_local4++;
}
return(_local7);
}
function shiftAndTestCol(colIndex) {
var _local6 = bigOnCol(colIndex);
var _local7 = false;
var _local9 = 0;
var _local8 = 0;
_local9 = calcUpSteps(colIndex);
if (_local6) {
_local8 = calcDownSteps(colIndex);
}
if (testCol(colIndex)) {
_local7 = true;
setHint(0, 0);
}
var _local3 = 0;
while (_local3 < _local9) {
shiftUp(colIndex, 1);
if (_local6) {
shiftUp(colIndex + 1, 1);
}
if (testCol(colIndex)) {
_local7 = true;
var _local5 = 0;
var _local4 = -(_local3 + 1);
setHint(_local5, _local4);
}
_local3++;
}
shiftDown(colIndex, _local9);
if (_local6) {
shiftDown(colIndex + 1, _local9);
}
_local3 = 0;
while (_local3 < _local8) {
shiftDown(colIndex, 1);
if (_local6) {
shiftDown(colIndex + 1, 1);
}
if (testCol(colIndex)) {
_local7 = true;
var _local5 = 0;
var _local4 = _local3 + 1;
setHint(_local5, _local4);
}
_local3++;
}
shiftUp(colIndex, _local8);
if (_local6) {
shiftUp(colIndex + 1, _local8);
}
return(_local7);
}
function testCol(colIndex) {
var _local4 = false;
var _local2 = 0;
while (_local2 < HEIGHT) {
var _local3 = testRowCol(_local2, colIndex);
if (_local3) {
_local4 = true;
}
_local2++;
}
return(_local4);
}
function testCol2(colIndex, resultArray) {
var _local7 = false;
var _local4 = 0;
while (_local4 < HEIGHT) {
var _local3 = new Array();
var _local6 = testRowCol2(_local4, colIndex, _local3);
if (_local6) {
while (_local3.length > 0) {
var _local2 = _local3.pop();
if (!allReadyInArray(_local2, resultArray)) {
resultArray.push(_local2);
}
}
_local7 = true;
}
_local4++;
}
return(_local7);
}
function testRowCol(row, col) {
var _local2 = new Array();
_local2.push(gridData[row][col]);
if (match(row, col, _local2)) {
var _local5 = 1;
while (_local5 <= _local2.length) {
var _local4 = _local2[_local5];
match(_local4.row, _local4.col, _local2);
_local5++;
}
}
var _local6 = 0;
var _local3 = 0;
while (_local3 < _local2.length) {
if (_local2[_local3].type != com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT) {
_local6++;
}
_local3++;
}
if (_local6 >= 3) {
if (_local2[0].type == com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT) {
return(false);
}
hintMoveToCol = col;
hintMoveToRow = row;
return(true);
}
return(false);
}
function setHint(shiftCol, shiftRow) {
hintWrap = false;
hintMoveShiftCol = shiftCol;
hintMoveShiftRow = shiftRow;
hintMoveFromCol = hintMoveToCol - hintMoveShiftCol;
hintMoveFromRow = hintMoveToRow - hintMoveShiftRow;
hintMoveFromCol1 = hintMoveFromCol;
hintMoveFromRow1 = hintMoveFromRow;
hintMoveFromCol2 = hintMoveFromCol;
hintMoveFromRow2 = hintMoveFromRow;
hintMoveToCol1 = hintMoveToCol;
hintMoveToRow1 = hintMoveToRow;
hintMoveToCol2 = hintMoveToCol;
hintMoveToRow2 = hintMoveToRow;
if (hintMoveFromCol < 0) {
hintMoveFromCol = hintMoveFromCol + 6;
hintMoveFromCol1 = hintMoveFromCol;
hintMoveToCol1 = 5;
hintMoveFromCol2 = 0;
hintMoveToCol2 = hintMoveToCol;
if (bigOnRow(hintMoveToRow) || (bigSupportOnRow(hintMoveToRow))) {
hintWrap = true;
}
} else if (hintMoveFromCol > 5) {
hintMoveFromCol = hintMoveFromCol - 6;
hintMoveFromCol1 = hintMoveFromCol;
hintMoveToCol1 = 0;
hintMoveFromCol2 = 5;
hintMoveToCol2 = hintMoveToCol;
if (bigOnRow(hintMoveToRow) || (bigSupportOnRow(hintMoveToRow))) {
hintWrap = true;
}
} else if (hintMoveFromRow < 0) {
hintMoveFromRow = hintMoveFromRow + 6;
hintMoveFromRow1 = hintMoveFromRow;
hintMoveToRow1 = 5;
hintMoveFromRow2 = 0;
hintMoveToRow2 = hintMoveToRow;
if (bigOnCol(hintMoveToCol) || (bigSupportOnCol(hintMoveToCol))) {
hintWrap = true;
}
} else if (hintMoveFromRow > 5) {
hintMoveFromRow = hintMoveFromRow - 6;
hintMoveFromRow1 = hintMoveFromRow;
hintMoveToRow1 = 0;
hintMoveFromRow2 = 5;
hintMoveToRow2 = hintMoveToRow;
if (bigOnCol(hintMoveToCol) || (bigSupportOnCol(hintMoveToCol))) {
hintWrap = true;
}
}
}
function testRowCol2(row, col, resultArray) {
var _local2 = new Array();
_local2.push(gridData[row][col]);
if (match(row, col, _local2)) {
var _local5 = 1;
while (_local5 <= _local2.length) {
var _local4 = _local2[_local5];
match(_local4.row, _local4.col, _local2);
_local5++;
}
}
var _local6 = 0;
var _local3 = 0;
while (_local3 < _local2.length) {
if (_local2[_local3].type != com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT) {
_local6++;
}
_local3++;
}
if (_local6 >= 3) {
while (_local2.length > 0) {
resultArray.push(_local2.pop());
}
return(true);
}
return(false);
}
function match(row, col, matchArray) {
var _local4 = false;
var _local2 = checkLeft(row, col);
if ((_local2 != null) && (!allReadyInArray(_local2, matchArray))) {
_local4 = true;
matchArray.push(_local2);
}
_local2 = checkRight(row, col);
if ((_local2 != null) && (!allReadyInArray(_local2, matchArray))) {
_local4 = true;
matchArray.push(_local2);
}
_local2 = checkAbove(row, col);
if ((_local2 != null) && (!allReadyInArray(_local2, matchArray))) {
_local4 = true;
matchArray.push(_local2);
}
_local2 = checkUnder(row, col);
if ((_local2 != null) && (!allReadyInArray(_local2, matchArray))) {
_local4 = true;
matchArray.push(_local2);
}
return(_local4);
}
function allReadyInArray(gridObj, matchArray) {
var _local1 = 0;
while (_local1 < matchArray.length) {
if ((gridObj.row == matchArray[_local1].row) && (gridObj.col == matchArray[_local1].col)) {
return(true);
}
_local1++;
}
return(false);
}
function checkLeft(row, col) {
if (col == 0) {
return(null);
}
if (gridData[row][col].color == gridData[row][col - 1].color) {
return(gridData[row][col - 1]);
}
return(null);
}
function checkRight(row, col) {
if (col == 5) {
return(null);
}
if (gridData[row][col].color == gridData[row][col + 1].color) {
return(gridData[row][col + 1]);
}
return(null);
}
function checkAbove(row, col) {
if (row == 0) {
return(null);
}
if (gridData[row][col].color == gridData[row - 1][col].color) {
return(gridData[row - 1][col]);
}
return(null);
}
function checkUnder(row, col) {
if (row == 5) {
return(null);
}
if (gridData[row][col].color == gridData[row + 1][col].color) {
return(gridData[row + 1][col]);
}
return(null);
}
function shiftLeft(rowIndex, steps) {
var _local4 = 0;
while (_local4 < steps) {
var _local5 = gridData[rowIndex][0];
var _local2 = 0;
while (_local2 < 5) {
gridData[rowIndex][_local2] = gridData[rowIndex][_local2 + 1];
_local2++;
}
gridData[rowIndex][5] = _local5;
_local4++;
}
_local4 = 0;
while (_local4 < 6) {
gridData[rowIndex][_local4].setGridPos(rowIndex, _local4);
_local4++;
}
}
function shiftRight(rowIndex, steps) {
var _local4 = 0;
while (_local4 < steps) {
var _local5 = gridData[rowIndex][5];
var _local2 = 5;
while (_local2 > 0) {
gridData[rowIndex][_local2] = gridData[rowIndex][_local2 - 1];
_local2--;
}
gridData[rowIndex][0] = _local5;
_local4++;
}
_local4 = 0;
while (_local4 < 6) {
gridData[rowIndex][_local4].setGridPos(rowIndex, _local4);
_local4++;
}
}
function lockOnCol(colIndex) {
var _local2 = 0;
while (_local2 < 6) {
if (gridData[_local2][colIndex].locked) {
return(true);
}
_local2++;
}
return(false);
}
function shiftUp(colIndex, steps) {
var _local4 = 0;
while (_local4 < steps) {
var _local5 = gridData[0][colIndex];
var _local2 = 0;
while (_local2 < 5) {
gridData[_local2][colIndex] = gridData[_local2 + 1][colIndex];
_local2++;
}
gridData[5][colIndex] = _local5;
_local4++;
}
_local4 = 0;
while (_local4 < 6) {
gridData[_local4][colIndex].setGridPos(_local4, colIndex);
_local4++;
}
}
function shiftDown(colIndex, steps) {
var _local4 = 0;
while (_local4 < steps) {
var _local5 = gridData[5][colIndex];
var _local2 = 5;
while (_local2 > 0) {
gridData[_local2][colIndex] = gridData[_local2 - 1][colIndex];
_local2--;
}
gridData[0][colIndex] = _local5;
_local4++;
}
_local4 = 0;
while (_local4 < 6) {
gridData[_local4][colIndex].setGridPos(_local4, colIndex);
_local4++;
}
}
function calcLeftSteps(rowIndex) {
var _local2;
if (lockOnRow(rowIndex)) {
_local2 = 0;
} else if (bigOnRow(rowIndex)) {
if (lockOnRow(rowIndex + 1)) {
_local2 = 0;
} else {
var _local4 = bigOnRowPos(rowIndex);
switch (_local4) {
case 0 :
_local2 = 0;
break;
case 1 :
_local2 = 1;
break;
case 2 :
_local2 = 2;
break;
case 3 :
_local2 = 3;
break;
case 4 :
_local2 = 4;
break;
case 5 :
_local2 = 0;
}
}
} else if (bigSupportOnRow(rowIndex)) {
_local2 = 0;
} else {
_local2 = 5;
}
return(_local2);
}
function calcUpSteps(colIndex) {
var _local2;
if (lockOnCol(colIndex)) {
_local2 = 0;
} else if (bigOnCol(colIndex)) {
if (lockOnCol(colIndex + 1)) {
_local2 = 0;
} else {
var _local4 = bigOnColPos(colIndex);
switch (_local4) {
case 0 :
_local2 = 0;
break;
case 1 :
_local2 = 1;
break;
case 2 :
_local2 = 2;
break;
case 3 :
_local2 = 3;
break;
case 4 :
_local2 = 4;
break;
case 5 :
_local2 = 0;
}
}
} else if (bigSupportOnCol(colIndex)) {
_local2 = 0;
} else {
_local2 = 5;
}
return(_local2);
}
function calcDownSteps(colIndex) {
var _local2;
if (lockOnCol(colIndex)) {
_local2 = 0;
} else if (bigOnCol(colIndex)) {
if (lockOnCol(colIndex + 1)) {
_local2 = 0;
} else {
var _local4 = bigOnColPos(colIndex);
switch (_local4) {
case 0 :
_local2 = 4;
break;
case 1 :
_local2 = 3;
break;
case 2 :
_local2 = 2;
break;
case 3 :
_local2 = 1;
break;
case 4 :
_local2 = 0;
break;
case 5 :
_local2 = 0;
}
}
} else if (bigSupportOnCol(colIndex)) {
_local2 = 0;
} else {
_local2 = 5;
}
return(_local2);
}
function calcRightSteps(rowIndex) {
var _local2;
if (lockOnRow(rowIndex)) {
_local2 = 0;
} else if (bigOnRow(rowIndex)) {
if (lockOnRow(rowIndex + 1)) {
_local2 = 0;
} else {
var _local4 = bigOnRowPos(rowIndex);
switch (_local4) {
case 0 :
_local2 = 4;
break;
case 1 :
_local2 = 3;
break;
case 2 :
_local2 = 2;
break;
case 3 :
_local2 = 1;
break;
case 4 :
_local2 = 0;
break;
case 5 :
_local2 = 0;
}
}
} else if (bigSupportOnRow(rowIndex)) {
_local2 = 0;
} else {
_local2 = 5;
}
return(_local2);
}
function lockOnRow(rowIndex) {
var _local2 = 0;
while (_local2 < 6) {
if (gridData[rowIndex][_local2].locked) {
return(true);
}
_local2++;
}
return(false);
}
function bigOnRow(rowIndex) {
var _local2 = 0;
while (_local2 < 6) {
if (gridData[rowIndex][_local2].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
return(true);
}
_local2++;
}
return(false);
}
function bigOnRowPos(rowIndex) {
var _local2 = 0;
while (_local2 < 6) {
if (gridData[rowIndex][_local2].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
return(_local2);
}
_local2++;
}
return(-1);
}
function bigSupportOnRow(rowIndex) {
var _local2 = 0;
while (_local2 < 6) {
if (gridData[rowIndex][_local2].type == com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT) {
return(true);
}
_local2++;
}
return(false);
}
function bigOnCol(colIndex) {
var _local2 = 0;
while (_local2 < 6) {
if (gridData[_local2][colIndex].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
return(true);
}
_local2++;
}
return(false);
}
function bigOnColPos(colIndex) {
var _local2 = 0;
while (_local2 < 6) {
if (gridData[_local2][colIndex].type == com.king.Chuzzle.GridObj.TYPE_BIG) {
return(_local2);
}
_local2++;
}
return(-1);
}
function bigSupportOnCol(colIndex) {
var _local2 = 0;
while (_local2 < 6) {
if (gridData[_local2][colIndex].type == com.king.Chuzzle.GridObj.TYPE_BIG_SUPPORT) {
return(true);
}
_local2++;
}
return(false);
}
function traceCol(colIndex) {
}
function traceRow(rowIndex) {
}
function debugTest() {
}
static var HEIGHT = 6;
static var WIDTH = 6;
}
Symbol 743 MovieClip [__Packages.com.king.Chuzzle.GridObj] Frame 0
class com.king.Chuzzle.GridObj
{
var CHUZZLE_HOLDER, type, color, chuzzleObj, locked, superState, matched, superExplode, col, row, fallValue;
function GridObj (bgClip) {
CHUZZLE_HOLDER = bgClip;
}
function init(type, color) {
this.type = type;
this.color = color;
if (type == TYPE_NORMAL) {
chuzzleObj = new com.king.Chuzzle.ChuzzleSmallObj(this.type, this.color, CHUZZLE_HOLDER);
} else if (type == TYPE_BIG) {
chuzzleObj = new com.king.Chuzzle.ChuzzleBigObj(this.type, this.color, CHUZZLE_HOLDER);
} else if (type == TYPE_BIG_SUPPORT) {
}
locked = false;
superState = false;
matched = false;
superExplode = 0;
}
function testInit(sourceGridObj) {
type = sourceGridObj.type;
color = sourceGridObj.color;
locked = sourceGridObj.locked;
matched = false;
}
function testInit2(type, color) {
this.type = type;
this.color = color;
}
function tick(tick) {
if (chuzzleObj != null) {
chuzzleObj.tick();
}
}
function render(tick, alpha) {
if (chuzzleObj != null) {
chuzzleObj.render(tick, alpha);
}
}
function setEmpty() {
type = TYPE_NORMAL;
color = NONE;
locked = false;
superState = false;
matched = false;
chuzzleObj.deleteClips();
chuzzleObj = null;
superExplode = 0;
}
static function resetDepthCounters() {
com.king.Chuzzle.ChuzzleObj.resetDepthCounters();
}
function setAndSimple() {
if ((((type == TYPE_NORMAL) && (color != NONE)) && (!locked)) && (!superState)) {
return(true);
}
return(false);
}
function shakeChuzzle() {
chuzzleObj.shake();
}
function setLock() {
locked = true;
chuzzleObj.setLock();
}
function setSuperState() {
superState = true;
chuzzleObj.setSuperState();
}
function clone(sourceGridObj) {
type = sourceGridObj.type;
color = sourceGridObj.color;
col = sourceGridObj.col;
row = sourceGridObj.row;
fallValue = sourceGridObj.fallValue;
}
function copyState(sourceGridObj) {
chuzzleObj.copyState(sourceGridObj.chuzzleObj);
}
function pick() {
chuzzleObj.pick();
}
function setGridPos(row, col) {
this.row = row;
this.col = col;
}
function setChuzzlePos(posX, posY) {
chuzzleObj.setPos(posX, posY);
}
function oldsetStartAnimPosY(startAnimPosY) {
chuzzleObj.setStartAnimPosY(startAnimPosY);
}
function setStartAnimPosY(startAnimPosY, delayPosY) {
chuzzleObj.setStartAnimPosY(startAnimPosY, delayPosY);
}
function setupFallingAnim(endAnimPosY) {
return(chuzzleObj.setupFallingAnim(endAnimPosY));
}
function setType(type) {
this.type = type;
chuzzleObj.setType(type);
}
function setColor(color) {
this.color = color;
chuzzleObj.setColor(color);
}
static var NONE = 0;
static var RED = 1;
static var GREEN = 2;
static var BLUE = 3;
static var ORANGE = 4;
static var YELLOW = 5;
static var PURPLE = 6;
static var WHITE = 7;
static var LIGHTBLUE = 8;
static var TYPE_NORMAL = 0;
static var TYPE_BIG = 1;
static var TYPE_BIG_SUPPORT = 2;
}
Symbol 744 MovieClip [__Packages.com.king.Chuzzle.ChuzzleObj] Frame 0
class com.king.Chuzzle.ChuzzleObj
{
var type, parentClip, showLock, delayShowLockCounter, state, locked, superState, eyesOffsetX, eyesOffsetY, eyes, shakeOn, initShake, shakeValueX, shakeValueY, shakeStepCounter, lockFrame, superExplode, deltaShakeX, deltaShakeY, hair, posX, posY, fallingSpeed, endAnimPosY, nrPicks, baldVisible, hideBaldCounter, baldClip, superStateClip, superStateClip2, lockClip, direction, startAnimPosY, delayPosY;
function ChuzzleObj (type, color, parentClip) {
this.type = type;
this.parentClip = parentClip;
showLock = false;
delayShowLockCounter = DELAY_LOCK_TIME;
state = STATE_NORMAL;
locked = false;
superState = false;
eyesOffsetX = 0;
eyesOffsetY = 0;
eyes = new com.king.Chuzzle.Eyes(0, 0, color, this.parentClip);
createBaldClip();
createSuperStateClip();
createLockClip(color);
shakeOn = false;
initShake = true;
shakeValueX = 0;
shakeValueY = 0;
shakeStepCounter = 0;
lockFrame = 1;
superExplode = 0;
}
function tick(tick) {
switch (state) {
case STATE_NORMAL :
if (shakeOn) {
getShakeValues();
shakeValueX = shakeValueX + deltaShakeX;
shakeValueY = shakeValueY + deltaShakeY;
shakeStepCounter = 0;
} else {
initShake = true;
}
hair.update(posX + shakeValueX, posY + shakeValueY, shakeOn);
eyes.update((posX + eyesOffsetX) + shakeValueX, (posY + eyesOffsetY) + shakeValueY, _root._xmouse, _root._ymouse);
shakeValueX = 0;
shakeValueY = 0;
shakeOn = false;
break;
case STATE_ANIMATE_FALLING :
fallingSpeed = fallingSpeed + DOWN_ACCEL;
if (fallingSpeed > MAX_DOWN_SPEED) {
fallingSpeed = MAX_DOWN_SPEED;
}
posY = posY + fallingSpeed;
if (posY >= endAnimPosY) {
posY = endAnimPosY;
state = STATE_NORMAL;
}
hair.update(posX, posY);
eyes.update(posX + eyesOffsetX, posY + eyesOffsetY, _root._xmouse, _root._ymouse);
break;
case STATE_PICKED :
hair.update(posX, posY);
eyes.update(posX + eyesOffsetX, posY + eyesOffsetY, _root._xmouse, _root._ymouse);
if (nrPicks != 3) {
break;
}
baldVisible = true;
hair.hide();
state = STATE_NORMAL;
hideBaldCounter = 0;
}
if (hideBaldCounter < (com.king.Chuzzle.Hair.BALD_FRAMES + 1)) {
hideBaldCounter++;
if (hideBaldCounter == (com.king.Chuzzle.Hair.BALD_FRAMES + 1)) {
baldVisible = false;
}
}
if (locked && (delayShowLockCounter == 0)) {
showLock = true;
} else if (locked) {
delayShowLockCounter--;
}
}
function createBaldClip() {
var _local2 = "bald" + baldDepth;
baldClip = parentClip.attachMovie("Naked", _local2, baldDepth++, {_x:posX, _y:posY});
baldVisible = false;
if (baldDepth >= (BALD_START_DEPTH + 90)) {
}
}
function render(tick, alpha) {
superStateClip._visible = superState;
superStateClip2._visible = superState;
lockClip._visible = showLock;
if (showLock) {
lockFrame++;
if (lockFrame > 282) {
lockFrame = 1;
}
lockClip.gotoAndStop(lockFrame);
}
baldClip._visible = baldVisible;
var _local3 = new com.king.timing.IFloat();
var _local4 = new com.king.timing.IFloat();
_local3.setTo(posX);
_local4.setTo(posY);
if (posX != lockClip._x) {
lockClip._x = _local3.get(alpha);
superStateClip._x = _local3.get(alpha);
superStateClip2._x = _local3.get(alpha);
baldClip._x = _local3.get(alpha);
}
if (posY != lockClip._y) {
lockClip._y = _local4.get(alpha);
superStateClip._y = _local4.get(alpha);
superStateClip2._y = _local4.get(alpha);
baldClip._y = _local4.get(alpha);
}
hair.render();
eyes.render();
}
function pick() {
return(undefined);
}
function shake() {
if (initShake == true) {
shakeValueX = 0;
shakeValueY = 0;
direction = 0;
initShake = false;
}
shakeOn = true;
}
function getShakeValues() {
direction = Math.floor(Math.random() * 8);
switch (direction) {
case 0 :
deltaShakeX = SHAKE_DELTA;
deltaShakeY = -SHAKE_DELTA;
break;
case 1 :
deltaShakeX = 0;
deltaShakeY = SHAKE_DELTA;
break;
case 2 :
deltaShakeX = -SHAKE_DELTA;
deltaShakeY = -SHAKE_DELTA;
break;
case 3 :
deltaShakeX = 0;
deltaShakeY = -SHAKE_DELTA;
break;
case 4 :
deltaShakeX = -SHAKE_DELTA;
deltaShakeY = SHAKE_DELTA;
break;
case 5 :
deltaShakeX = SHAKE_DELTA;
deltaShakeY = 0;
break;
case 6 :
deltaShakeX = -SHAKE_DELTA;
deltaShakeY = 0;
break;
case 7 :
deltaShakeX = SHAKE_DELTA;
deltaShakeY = SHAKE_DELTA;
}
}
function setPos(posX, posY) {
this.posX = posX;
this.posY = posY;
state = STATE_NORMAL;
}
function setType(type) {
this.type = type;
}
function setColor(color) {
}
function copyState(sourceChuzzleObj) {
state = sourceChuzzleObj.state;
locked = sourceChuzzleObj.locked;
deleteLock = sourceChuzzleObj.deleteLock;
nrPicks = sourceChuzzleObj.nrPicks;
baldVisible = sourceChuzzleObj.baldVisible;
hideBaldCounter = sourceChuzzleObj.hideBaldCounter;
hair.copyState(sourceChuzzleObj.hair);
eyes.copyState(sourceChuzzleObj.eyes);
}
function deleteClips() {
hair.delClip();
hair = null;
eyes.deleteClips();
eyes = null;
removeMovieClip(lockClip);
removeMovieClip(baldClip);
removeMovieClip(superStateClip);
removeMovieClip(superStateClip2);
}
static function resetDepthCounters() {
lockDepth = LOCK_START_DEPTH;
baldDepth = BALD_START_DEPTH;
superStateDepth = SUPER_STATE_START_DEPTH;
com.king.Chuzzle.Eyes.resetDepthCounter();
com.king.Chuzzle.Hair.resetDepthCounter();
}
function createLockClip(color) {
var _local2 = "lock" + lockDepth;
lockClip = parentClip.attachMovie("lock", _local2, lockDepth++);
if (lockDepth >= (LOCK_START_DEPTH + 90)) {
}
tint(color);
}
function createSuperStateClip() {
var _local2 = "super" + superStateDepth;
superStateClip = parentClip.attachMovie("chuzzle_shock_anim", _local2, superStateDepth++);
superStateClip.gotoAndPlay(1);
_local2 = "super" + superStateDepth;
superStateClip2 = parentClip.attachMovie("chuzzle_shock_anim", _local2, superStateDepth++);
superStateClip2.gotoAndPlay(10);
}
function setLock() {
locked = true;
delayShowLockCounter = DELAY_LOCK_TIME;
}
function setSuperState() {
superState = true;
eyes.setSuperEyes();
}
function deleteLock() {
locked = false;
removeMovieClip(lockClip);
}
function oldsetStartAnimPosY(startAnimPosY) {
this.startAnimPosY = startAnimPosY;
}
function setStartAnimPosY(startAnimPosY, delayPosY) {
this.startAnimPosY = startAnimPosY;
this.delayPosY = delayPosY;
}
function setupFallingAnim(endAnimPosY) {
if (delayPosY != 0) {
}
this.endAnimPosY = endAnimPosY;
posY = startAnimPosY;
if (superExplode == 1) {
fallingSpeed = START_SUPER_EXP_DOWN_SPEED1;
} else if (superExplode == 2) {
fallingSpeed = START_SUPER_EXP_DOWN_SPEED2;
} else {
fallingSpeed = START_DOWN_SPEED;
}
state = STATE_ANIMATE_FALLING;
return(fallTime());
}
function fallTime() {
var _local5 = endAnimPosY;
var _local3 = startAnimPosY;
var _local2 = fallingSpeed;
var _local4 = 0;
do {
_local4++;
_local2 = _local2 + DOWN_ACCEL;
if (_local2 > MAX_DOWN_SPEED) {
_local2 = MAX_DOWN_SPEED;
}
_local3 = _local3 + _local2;
} while (_local3 < _local5);
return(_local4);
}
function tint(color) {
var _local2;
switch (color) {
case RED :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 255, 64, 64, 0);
break;
case GREEN :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 64, 230, 64, 0);
break;
case BLUE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 89, 89, 255, 0);
break;
case ORANGE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 255, 191, 26, 0);
break;
case YELLOW :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 255, 255, 0, 0);
break;
case PURPLE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 204, 0, 204, 0);
break;
case WHITE :
break;
case LIGHTBLUE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 128, 255, 255, 0);
}
var _local4 = new flash.geom.Transform(superStateClip);
_local4.colorTransform = _local2;
var _local3 = new flash.geom.Transform(superStateClip2);
_local3.colorTransform = _local2;
}
static var DELAY_LOCK_TIME = 10;
static var SHAKE_DELTA = 1;
static var START_DOWN_SPEED = 0;
static var START_SUPER_EXP_DOWN_SPEED1 = -2;
static var START_SUPER_EXP_DOWN_SPEED2 = -6;
static var MAX_DOWN_SPEED = 20;
static var DOWN_ACCEL = 1.9;
static var OBJECT_SIZE = 80;
static var LOCK_START_DEPTH = 500000;
static var lockDepth = LOCK_START_DEPTH;
static var BALD_START_DEPTH = 200000;
static var baldDepth = BALD_START_DEPTH;
static var SUPER_STATE_START_DEPTH = 100000;
static var superStateDepth = SUPER_STATE_START_DEPTH;
static var TYPE_NORMAL = 0;
static var TYPE_BIG = 1;
static var TYPE_BIG_SUPPORT = 2;
static var NONE = 0;
static var RED = 1;
static var GREEN = 2;
static var BLUE = 3;
static var ORANGE = 4;
static var YELLOW = 5;
static var PURPLE = 6;
static var WHITE = 7;
static var LIGHTBLUE = 8;
static var STATE_NORMAL = 0;
static var STATE_ANIMATE_FALLING = 1;
static var STATE_PICKED = 2;
}
Symbol 745 MovieClip [__Packages.com.king.Chuzzle.Hair] Frame 0
class com.king.Chuzzle.Hair
{
var color, parentClip, type, visible, alphaValue, frame, animFrequenceCounter, animFrequenceCounterIdle, oldState, animate, animateIdle, posX, posY, oldPosX, oldPosY, state, stateChanged, moveDirection, baldCounter, oldOldPosX, oldOldPosY, clip;
function Hair (color, parentClip, type) {
this.color = color;
this.parentClip = parentClip;
this.type = type;
visible = true;
alphaValue = 100;
createClip();
frame = 1;
animFrequenceCounter = 0;
animFrequenceCounterIdle = Math.floor(Math.random() * ANIM_FREQUENCE_IDLE);
toStateIdle();
oldState = STATE_LEFT;
}
function copyState(sourceHair) {
animFrequenceCounter = sourceHair.animFrequenceCounter;
animate = sourceHair.animate;
animFrequenceCounterIdle = sourceHair.animFrequenceCounterIdle;
animateIdle = sourceHair.animateIdle;
frame = sourceHair.frame;
posX = sourceHair.posX;
posY = sourceHair.posY;
oldPosX = sourceHair.oldPosX;
oldPosY = sourceHair.oldPosY;
state = sourceHair.state;
oldState = sourceHair.oldState;
stateChanged = sourceHair.stateChanged;
moveDirection = sourceHair.moveDirection;
baldCounter = sourceHair.baldCounter;
alphaValue = sourceHair.alphaValue;
visible = sourceHair.visible;
}
function update(posX, posY, still) {
this.posX = posX;
this.posY = posY;
if (baldCounter < BALD_FRAMES) {
baldCounter++;
if (baldCounter >= BALD_TONE_IN_FRAME) {
var _local2 = 100 / (BALD_FRAMES - BALD_TONE_IN_FRAME);
visible = true;
alphaValue = alphaValue + _local2;
}
if (baldCounter == BALD_FRAMES) {
alphaValue = 100;
}
}
animFrequenceCounter++;
if (animFrequenceCounter >= ANIM_FREQUENCE) {
animFrequenceCounter = 0;
animate = true;
} else {
animate = false;
}
animFrequenceCounterIdle++;
if (animFrequenceCounterIdle >= ANIM_FREQUENCE_IDLE) {
animFrequenceCounterIdle = 0;
animateIdle = true;
} else {
animateIdle = false;
}
moveDirection = MOVE_INPUT_NONE;
if (still) {
moveDirection = MOVE_INPUT_NONE;
} else if (this.posX < oldOldPosX) {
moveDirection = MOVE_INPUT_LEFT;
} else if (this.posX > oldOldPosX) {
moveDirection = MOVE_INPUT_RIGHT;
} else if (this.posY < oldOldPosY) {
moveDirection = MOVE_INPUT_UP;
} else if (this.posY > oldOldPosY) {
moveDirection = MOVE_INPUT_DOWN;
} else {
moveDirection = MOVE_INPUT_NONE;
}
switch (state) {
case STATE_IDLE :
if (moveDirection == MOVE_INPUT_LEFT) {
toStateLeft();
} else if (moveDirection == MOVE_INPUT_RIGHT) {
toStateRight();
} else if (moveDirection == MOVE_INPUT_DOWN) {
toStateDown();
} else if (moveDirection == MOVE_INPUT_UP) {
toStateUp();
} else {
idleAnim();
}
break;
case STATE_LEFT :
if (leftAnim()) {
toStateIdle();
}
break;
case STATE_RIGHT :
if (rightAnim()) {
toStateIdle();
}
break;
case STATE_DOWN :
if (downAnim()) {
toStateIdle();
}
break;
case STATE_UP :
if (!upAnim()) {
break;
}
toStateIdle();
}
if (state != oldState) {
stateChanged = true;
} else {
stateChanged = false;
}
oldState = state;
oldOldPosX = oldPosX;
oldOldPosY = oldPosY;
oldPosX = this.posX;
oldPosY = this.posY;
}
function render() {
clip.gotoAndStop(frame);
clip._x = posX;
clip._y = posY;
clip._alpha = alphaValue;
clip.visible = visible;
if (stateChanged) {
switch (state) {
case STATE_IDLE :
break;
case STATE_LEFT :
break;
case STATE_RIGHT :
break;
case STATE_DOWN :
break;
case STATE_UP :
}
}
}
function delClip() {
removeMovieClip(clip);
clip = null;
}
static function resetDepthCounter() {
depth = HAIR_START_DEPTH;
}
function hide() {
visible = false;
alphaValue = 0;
baldCounter = 0;
}
function createClip() {
var _local2 = "hair" + depth;
switch (color) {
case RED :
clip = parentClip.attachMovie("RedHair", _local2, depth++);
break;
case GREEN :
clip = parentClip.attachMovie("GreenHair", _local2, depth++);
break;
case BLUE :
clip = parentClip.attachMovie("BlueHair", _local2, depth++);
break;
case ORANGE :
clip = parentClip.attachMovie("OrangeHair", _local2, depth++);
break;
case YELLOW :
clip = parentClip.attachMovie("YellowHair", _local2, depth++);
break;
case PURPLE :
clip = parentClip.attachMovie("PurpleHair", _local2, depth++);
break;
case WHITE :
clip = parentClip.attachMovie("WhiteHair", _local2, depth++);
break;
case LIGHTBLUE :
clip = parentClip.attachMovie("CyanHair", _local2, depth++);
}
if (depth >= (HAIR_START_DEPTH + 90)) {
}
}
function toStateIdle() {
state = STATE_IDLE;
frame = Math.floor(Math.random() * MAX_IDLE_FRAME) + 1;
}
function toStateLeft() {
state = STATE_LEFT;
frame = MIN_LEFT_FRAME;
leftAnim();
}
function toStateRight() {
state = STATE_RIGHT;
frame = MIN_RIGHT_FRAME;
rightAnim();
}
function toStateDown() {
state = STATE_DOWN;
frame = MIN_DOWN_FRAME;
downAnim();
}
function toStateUp() {
state = STATE_UP;
frame = MIN_UP_FRAME;
upAnim();
}
function idleAnim() {
if (!animateIdle) {
return(undefined);
}
if (frame < MAX_IDLE_FRAME) {
frame = frame + ANIM_STEP_IDLE;
} else {
frame = MIN_IDLE_FRAME;
}
}
function leftAnim() {
var _local2 = false;
switch (moveDirection) {
case MOVE_INPUT_LEFT :
if (!animate) {
break;
}
if (frame < MAX_LEFT_FRAME) {
frame = frame + ANIM_STEP;
}
if (frame > MAX_LEFT_FRAME) {
frame = MAX_LEFT_FRAME;
}
break;
case MOVE_INPUT_NONE :
default :
case MOVE_INPUT_RIGHT :
if (!animate) {
} else {
if (frame > MIN_LEFT_FRAME) {
frame = frame - ANIM_STEP;
}
if (frame <= MIN_LEFT_FRAME) {
_local2 = true;
}
break;
toStateDown();
break;
toStateUp();
}
case MOVE_INPUT_DOWN :
toStateDown();
break;
case MOVE_INPUT_UP :
toStateUp();
}
return(_local2);
}
function rightAnim() {
var _local2 = false;
switch (moveDirection) {
case MOVE_INPUT_RIGHT :
if (!animate) {
break;
}
if (frame < MAX_RIGHT_FRAME) {
frame = frame + ANIM_STEP;
}
if (frame > MAX_RIGHT_FRAME) {
frame = MAX_RIGHT_FRAME;
}
break;
case MOVE_INPUT_NONE :
case MOVE_INPUT_LEFT :
if (!animate) {
} else {
if (frame > MIN_RIGHT_FRAME) {
frame = frame - ANIM_STEP;
}
if (frame <= MIN_RIGHT_FRAME) {
_local2 = true;
}
break;
toStateDown();
break;
toStateUp();
}
case MOVE_INPUT_DOWN :
toStateDown();
break;
case MOVE_INPUT_UP :
toStateUp();
}
return(_local2);
}
function downAnim() {
var _local2 = false;
switch (moveDirection) {
case MOVE_INPUT_DOWN :
if (!animate) {
break;
}
if (frame < MAX_DOWN_FRAME) {
frame = frame + ANIM_STEP;
}
if (frame > MAX_DOWN_FRAME) {
frame = MAX_DOWN_FRAME;
}
break;
case MOVE_INPUT_NONE :
case MOVE_INPUT_UP :
if (!animate) {
} else {
if (frame > MIN_DOWN_FRAME) {
frame = frame - ANIM_STEP;
}
if (frame <= MIN_DOWN_FRAME) {
_local2 = true;
}
break;
toStateLeft();
break;
toStateRight();
}
case MOVE_INPUT_LEFT :
toStateLeft();
break;
case MOVE_INPUT_RIGHT :
toStateRight();
}
return(_local2);
}
function upAnim() {
var _local2 = false;
switch (moveDirection) {
case MOVE_INPUT_UP :
if (!animate) {
break;
}
if (frame < MAX_UP_FRAME) {
frame = frame + ANIM_STEP;
}
if (frame > MAX_UP_FRAME) {
frame = MAX_UP_FRAME;
}
break;
case MOVE_INPUT_NONE :
case MOVE_INPUT_DOWN :
if (!animate) {
} else {
if (frame > MIN_UP_FRAME) {
frame = frame - ANIM_STEP;
}
if (frame <= MIN_UP_FRAME) {
_local2 = true;
}
break;
toStateLeft();
break;
toStateRight();
}
case MOVE_INPUT_LEFT :
toStateLeft();
break;
case MOVE_INPUT_RIGHT :
toStateRight();
}
return(_local2);
}
static var BALD_FRAMES = 60;
static var BALD_TONE_IN_FRAME = 30;
static var NONE = 0;
static var RED = 1;
static var GREEN = 2;
static var BLUE = 3;
static var ORANGE = 4;
static var YELLOW = 5;
static var PURPLE = 6;
static var WHITE = 7;
static var LIGHTBLUE = 8;
static var TYPE_NORMAL = 0;
static var TYPE_BIG = 1;
static var TYPE_BIG_SUPPORT = 2;
static var TYPE_LOCKED = 3;
static var TYPE_SUPER = 4;
var OBJECT_SIZE = 72;
static var HAIR_START_DEPTH = 300000;
static var depth = HAIR_START_DEPTH;
var MIN_IDLE_FRAME = 1;
var MAX_IDLE_FRAME = 5;
var ANIM_STEP_IDLE = 1;
var ANIM_FREQUENCE_IDLE = 6;
var MIN_DOWN_FRAME = 6;
var MAX_DOWN_FRAME = 8;
var MIN_LEFT_FRAME = 9;
var MAX_LEFT_FRAME = 11;
var MIN_RIGHT_FRAME = 9;
var MAX_RIGHT_FRAME = 11;
var MIN_UP_FRAME = 12;
var MAX_UP_FRAME = 14;
var ANIM_STEP = 1;
var ANIM_FREQUENCE = 1;
static var MOVE_INPUT_NONE = 0;
static var MOVE_INPUT_LEFT = 1;
static var MOVE_INPUT_RIGHT = 2;
static var MOVE_INPUT_DOWN = 3;
static var MOVE_INPUT_UP = 4;
static var STATE_IDLE = 0;
static var STATE_LEFT = 1;
static var STATE_RIGHT = 2;
static var STATE_DOWN = 3;
static var STATE_UP = 4;
}
Symbol 746 MovieClip [__Packages.com.king.Chuzzle.Eyes] Frame 0
class com.king.Chuzzle.Eyes
{
var posX, posY, leftEyeCenterPosX, leftEyeCenterPosY, leftEyePosX, leftEyePosY, rightEyeCenterPosX, rightEyeCenterPosY, rightEyePosX, rightEyePosY, color, backGround, superEyes, blinkCounter, showColorClip, clip, leftEyeClip, rightEyeClip, colorClip, eyeOffsetX, eyeOffsetY;
function Eyes (posX, posY, bgColor, parentClip) {
this.posX = posX;
this.posY = posY;
leftEyeCenterPosX = this.posX - 10;
leftEyeCenterPosY = this.posY;
leftEyePosX = leftEyeCenterPosX;
leftEyePosY = leftEyeCenterPosY;
rightEyeCenterPosX = this.posX + 10;
rightEyeCenterPosY = this.posY;
rightEyePosX = rightEyeCenterPosX;
rightEyePosY = rightEyeCenterPosY;
color = Math.floor((Math.random() * 6) + 1);
backGround = 1;
superEyes = false;
blinkCounter = BLINK_FRAMES;
showColorClip = false;
var _local2 = "eyes" + depth;
clip = parentClip.attachMovie("Eyes", _local2, depth++, {_x:posX, _y:posY});
_local2 = "eye" + depth;
leftEyeClip = parentClip.attachMovie("Eye", _local2, depth++, {_x:leftEyePosX, _y:leftEyePosY});
_local2 = "eye" + depth;
rightEyeClip = parentClip.attachMovie("Eye", _local2, depth++, {_x:rightEyePosX, _y:rightEyePosY});
var _local6 = "ceyes" + depth;
colorClip = parentClip.attachMovie("Eyes", _local2, depth++, {_x:posX, _y:posY});
tint(bgColor);
update(posX, posY, posX, posY);
if (depth >= (EYES_START_DEPTH + 90)) {
}
}
function copyState(sourceEyes) {
posX = sourceEyes.posX;
posY = sourceEyes.posY;
leftEyeCenterPosX = sourceEyes.leftEyeCenterPosX;
leftEyeCenterPosY = sourceEyes.leftEyeCenterPosY;
leftEyePosX = sourceEyes.leftEyePosX;
leftEyePosY = sourceEyes.leftEyePosY;
rightEyeCenterPosX = sourceEyes.rightEyeCenterPosX;
rightEyeCenterPosY = sourceEyes.rightEyeCenterPosY;
rightEyePosX = sourceEyes.rightEyePosX;
rightEyePosY = sourceEyes.rightEyePosY;
eyeOffsetX = sourceEyes.eyeOffsetX;
eyeOffsetY = sourceEyes.eyeOffsetY;
superEyes = sourceEyes.superEyes;
blinkCounter = sourceEyes.blinkCounter;
showColorClip = sourceEyes.showColorClip;
color = sourceEyes.color;
backGround = sourceEyes.backGround;
}
function update(posX, posY, mousePosX, mousePosY) {
if (Math.floor(Math.random() * BLINK_CHANCE) == 0) {
blink();
}
this.posX = posX;
this.posY = posY;
leftEyeCenterPosX = this.posX - 10;
leftEyeCenterPosY = this.posY;
leftEyePosX = leftEyeCenterPosX;
leftEyePosY = leftEyeCenterPosY;
rightEyeCenterPosX = this.posX + 10;
rightEyeCenterPosY = this.posY;
var _local2 = mousePosX - posX;
var _local3 = mousePosY - (posY - 16);
var _local5 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
if (_local5 < 36) {
var _local4 = Math.atan2(_local3, _local2);
eyeOffsetX = EYE_RADIE * Math.cos(_local4);
eyeOffsetY = EYE_RADIE * Math.sin(_local4);
}
if (superEyes) {
leftEyePosX = leftEyeCenterPosX + EYE_RADIE_SUPER;
leftEyePosY = leftEyeCenterPosY;
rightEyePosX = rightEyeCenterPosX - EYE_RADIE_SUPER;
rightEyePosY = rightEyeCenterPosY;
showColorClip = false;
} else {
leftEyePosX = leftEyeCenterPosX + eyeOffsetX;
leftEyePosY = leftEyeCenterPosY + eyeOffsetY;
rightEyePosX = rightEyeCenterPosX + eyeOffsetX;
rightEyePosY = rightEyeCenterPosY + eyeOffsetY;
if (blinkCounter < BLINK_FRAMES) {
showColorClip = true;
blinkCounter++;
} else {
showColorClip = false;
}
}
}
function render() {
clip._x = posX;
clip._y = posY;
clip.gotoAndStop(backGround);
leftEyeClip._x = leftEyePosX;
leftEyeClip._y = leftEyePosY;
rightEyeClip._x = rightEyePosX;
rightEyeClip._y = rightEyePosY;
leftEyeClip.gotoAndStop(color);
rightEyeClip.gotoAndStop(color);
colorClip._x = posX;
colorClip._y = posY;
colorClip.gotoAndStop(backGround);
colorClip._visible = showColorClip;
}
function deleteClips() {
removeMovieClip(clip);
removeMovieClip(leftEyeClip);
removeMovieClip(rightEyeClip);
removeMovieClip(colorClip);
}
static function resetDepthCounter() {
depth = EYES_START_DEPTH;
}
function setSuperEyes() {
superEyes = true;
}
function blink() {
blinkCounter = 0;
}
function tint(color) {
var _local2;
switch (color) {
case RED :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 255, 64, 64, 0);
break;
case GREEN :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 64, 230, 64, 0);
break;
case BLUE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 89, 89, 255, 0);
break;
case ORANGE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 255, 191, 26, 0);
break;
case YELLOW :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 255, 255, 0, 0);
break;
case PURPLE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 204, 0, 204, 0);
break;
case WHITE :
break;
case LIGHTBLUE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 128, 255, 255, 0);
}
var _local3 = new flash.geom.Transform(colorClip);
_local3.colorTransform = _local2;
}
static var EYE_RADIE = 4;
static var EYE_RADIE_SUPER = 5.5;
static var EYES_START_DEPTH = 400000;
static var depth = EYES_START_DEPTH;
static var BLINK_FRAMES = 3;
static var BLINK_CHANCE = 1000;
static var NONE = 0;
static var RED = 1;
static var GREEN = 2;
static var BLUE = 3;
static var ORANGE = 4;
static var YELLOW = 5;
static var PURPLE = 6;
static var WHITE = 7;
static var LIGHTBLUE = 8;
}
Symbol 747 MovieClip [__Packages.com.king.Chuzzle.ChuzzleSmallObj] Frame 0
class com.king.Chuzzle.ChuzzleSmallObj extends com.king.Chuzzle.ChuzzleObj
{
var hair, eyesOffsetX, eyesOffsetY;
function ChuzzleSmallObj (type, color, parentClip) {
super(type, color, parentClip);
hair = new com.king.Chuzzle.Hair(color, parentClip, type);
eyesOffsetX = 0;
eyesOffsetY = 16;
}
}
Symbol 748 MovieClip [__Packages.com.king.Chuzzle.ChuzzleBigObj] Frame 0
class com.king.Chuzzle.ChuzzleBigObj extends com.king.Chuzzle.ChuzzleObj
{
var hair, eyesOffsetX, eyesOffsetY;
function ChuzzleBigObj (type, color, parentClip) {
super(type, color, parentClip);
hair = new com.king.Chuzzle.HairBig(color, parentClip, type);
eyesOffsetX = 36;
eyesOffsetY = 78;
}
}
Symbol 749 MovieClip [__Packages.com.king.Chuzzle.HairBig] Frame 0
class com.king.Chuzzle.HairBig extends com.king.Chuzzle.Hair
{
var color, clip, parentClip, frame, posX, posY, stateChanged, state;
function HairBig (color, parentClip, type) {
super(color, parentClip, type);
}
function createClip() {
var _local2 = "hair" + com.king.Chuzzle.Hair.depth;
switch (color) {
case com.king.Chuzzle.Hair.RED :
clip = parentClip.attachMovie("BigRedHair", _local2, com.king.Chuzzle.Hair.depth++);
break;
case com.king.Chuzzle.Hair.GREEN :
clip = parentClip.attachMovie("BigGreenHair", _local2, com.king.Chuzzle.Hair.depth++);
break;
case com.king.Chuzzle.Hair.BLUE :
clip = parentClip.attachMovie("BigBlueHair", _local2, com.king.Chuzzle.Hair.depth++);
break;
case com.king.Chuzzle.Hair.ORANGE :
clip = parentClip.attachMovie("BigOrangeHair", _local2, com.king.Chuzzle.Hair.depth++);
break;
case com.king.Chuzzle.Hair.YELLOW :
clip = parentClip.attachMovie("BigYellowHair", _local2, com.king.Chuzzle.Hair.depth++);
break;
case com.king.Chuzzle.Hair.PURPLE :
clip = parentClip.attachMovie("BigPurpleHair", _local2, com.king.Chuzzle.Hair.depth++);
break;
case com.king.Chuzzle.Hair.WHITE :
clip = parentClip.attachMovie("BigWhiteHair", _local2, com.king.Chuzzle.Hair.depth++);
break;
case com.king.Chuzzle.Hair.LIGHTBLUE :
clip = parentClip.attachMovie("BigCyanHair", _local2, com.king.Chuzzle.Hair.depth++);
}
if (com.king.Chuzzle.Hair.depth >= (com.king.Chuzzle.Hair.HAIR_START_DEPTH + 90)) {
}
}
function render() {
clip.gotoAndStop(frame);
clip._x = posX + (OBJECT_SIZE / 2);
clip._y = posY + (OBJECT_SIZE / 2);
if (stateChanged) {
switch (state) {
case com.king.Chuzzle.Hair.STATE_IDLE :
clip._xscale = 100;
clip._yscale = 100;
break;
case com.king.Chuzzle.Hair.STATE_LEFT :
clip._xscale = 100;
clip._yscale = 100;
break;
case com.king.Chuzzle.Hair.STATE_RIGHT :
clip._xscale = 100;
clip._yscale = 100;
break;
case com.king.Chuzzle.Hair.STATE_DOWN :
clip._xscale = 100;
clip._yscale = 100;
break;
case com.king.Chuzzle.Hair.STATE_UP :
clip._xscale = 100;
clip._yscale = 100;
}
}
}
var MIN_IDLE_FRAME = 1;
var MAX_IDLE_FRAME = 5;
var ANIM_STEP_IDLE = 1;
var ANIM_FREQUENCE_IDLE = 10;
var MIN_DOWN_FRAME = 1;
var MAX_DOWN_FRAME = 1;
var MIN_LEFT_FRAME = 1;
var MAX_LEFT_FRAME = 1;
var MIN_RIGHT_FRAME = 1;
var MAX_RIGHT_FRAME = 1;
var MIN_UP_FRAME = 1;
var MAX_UP_FRAME = 1;
var ANIM_STEP = 1;
var ANIM_FREQUENCE = 1;
var OBJECT_SIZE = 72;
}
Symbol 750 MovieClip [__Packages.com.king.Chuzzle.SuperSet] Frame 0
class com.king.Chuzzle.SuperSet
{
var colorArray;
function SuperSet () {
colorArray = new Array();
}
function push(color) {
colorArray.push(color);
}
function pop() {
if (colorArray.length == 0) {
return(-1);
}
return(Number(colorArray.pop()));
}
function isNotEmpty() {
if (colorArray.length == 0) {
return(false);
}
return(true);
}
function makeEmpty() {
while (colorArray.length != 0) {
colorArray.pop();
}
}
function getLength() {
return(colorArray.length);
}
function getObjectAtIndex(index) {
return(colorArray[index]);
}
function traceSuperSet() {
var _local2 = 0;
while (_local2 < colorArray.length) {
trace((_local2 + " color: ") + colorArray[_local2]);
_local2++;
}
}
}
Symbol 751 MovieClip [__Packages.com.king.Chuzzle.ExplodeData] Frame 0
class com.king.Chuzzle.ExplodeData
{
function ExplodeData () {
}
}
Symbol 752 MovieClip [__Packages.com.king.Chuzzle.MatchData] Frame 0
class com.king.Chuzzle.MatchData
{
function MatchData () {
}
}
Symbol 753 MovieClip [__Packages.com.king.Chuzzle.EffectHandler] Frame 0
class com.king.Chuzzle.EffectHandler
{
var parentClip, parentClipTop, messageCallback, callbackReciver, effectObjects, newEffectObjects, currentTick, hintArrow;
function EffectHandler (parentClip, parentClipTop, messageCallback, callbackReciver) {
this.parentClip = parentClip;
this.parentClipTop = parentClipTop;
this.messageCallback = messageCallback;
this.callbackReciver = callbackReciver;
effectObjects = new Array();
newEffectObjects = new Array();
}
function update(tick) {
currentTick = tick;
updating();
removeObjects();
}
function draw() {
var _local2 = 0;
while (_local2 < effectObjects.length) {
effectObjects[_local2].updateClip();
_local2++;
}
}
function createSplode(posX, posY, color) {
var _local2 = new com.king.Chuzzle.Splode(posX, posY, parentClip, color);
newEffectObjects.push(_local2);
}
function createBigSplode(posX, posY, color) {
var _local2 = new com.king.Chuzzle.BigSplode(posX, posY, parentClip, color);
newEffectObjects.push(_local2);
}
function createLockBreak(posX, posY) {
var _local2 = new com.king.Chuzzle.LockBreak(posX, posY, parentClip);
newEffectObjects.push(_local2);
}
function createSuperExplosion(posX, posY, color) {
var _local2 = new com.king.Chuzzle.SuperSplode(posX, posY, parentClip, color);
newEffectObjects.push(_local2);
}
function createSuperExplosionHair(posX, posY, color) {
var _local2 = new com.king.Chuzzle.SuperExplodeHair(posX, posY, parentClip, color);
newEffectObjects.push(_local2);
}
function createTwoStars(posX, posY) {
var _local2 = new com.king.Chuzzle.TwoStars(posX, posY, parentClip);
newEffectObjects.push(_local2);
}
function createLock(posX, posY) {
var _local2 = new com.king.Chuzzle.Lock(posX, posY, parentClipTop);
newEffectObjects.push(_local2);
}
function createScorePop(posX, posY, score) {
var _local2 = new com.king.Chuzzle.ScorePop(posX, posY, score, parentClip);
newEffectObjects.push(_local2);
}
function createFourStars(posX, posY, vertical) {
var _local2 = new com.king.Chuzzle.FourStars(posX, posY, parentClip, vertical);
newEffectObjects.push(_local2);
}
function createComboPop(posX, posY) {
var _local2 = new com.king.Chuzzle.ComboPop(posX, posY, parentClip);
newEffectObjects.push(_local2);
}
function createSuperPop(posX, posY) {
var _local2 = new com.king.Chuzzle.SuperPop(posX, posY, parentClip);
newEffectObjects.push(_local2);
}
function createMultiplier(posX, posY, multi) {
var _local2 = new com.king.Chuzzle.Multiplier(posX, posY, multi, parentClip);
newEffectObjects.push(_local2);
}
function createHintArrow(posX, posY, toPosX, toPosY) {
hintArrow = new com.king.Chuzzle.HintArrow(posX, posY, toPosX, toPosY, parentClip);
newEffectObjects.push(hintArrow);
}
function createHintArrowBig(posX, posY, toPosX, toPosY) {
hintArrow = new com.king.Chuzzle.HintArrowBig(posX, posY, toPosX, toPosY, parentClip);
newEffectObjects.push(hintArrow);
}
function createHintArrowWrap(posX, posY, toPosX, toPosY, posX2, posY2, toPosX2, toPosY2) {
hintArrow = new com.king.Chuzzle.HintArrowWrap(posX, posY, toPosX, toPosY, posX2, posY2, toPosX2, toPosY2, parentClip);
newEffectObjects.push(hintArrow);
}
function removeHintArrow() {
hintArrow.setToBeRemoved();
}
function createAnimEyes(posX, posY, rowIndex, colIndex, eyeColor, normal) {
var _local2 = new com.king.Chuzzle.AnimEyes(posX, posY, rowIndex, colIndex, eyeColor, normal, parentClip);
newEffectObjects.push(_local2);
}
function updating() {
var _local2 = 0;
while (_local2 < effectObjects.length) {
effectObjects[_local2].update();
_local2++;
}
_local2 = 0;
while (_local2 < newEffectObjects.length) {
newEffectObjects[_local2].update();
effectObjects.push(newEffectObjects[_local2]);
if (newEffectObjects[_local2].type == 1) {
}
_local2++;
}
while (newEffectObjects.length > 0) {
newEffectObjects.pop();
}
}
function removeObjects() {
var _local2 = 0;
while (_local2 < effectObjects.length) {
if (effectObjects[_local2].toBeRemoved) {
if (effectObjects[_local2].type == 1) {
messageCallback(callbackReciver, "eye_deleted", null);
}
if (_local2 == (effectObjects.length - 1)) {
var _local3 = effectObjects.pop();
_local3.deleteClip();
} else {
var _local4 = effectObjects.pop();
var _local3 = effectObjects[_local2];
_local3.deleteClip();
effectObjects[_local2] = _local4;
_local2--;
}
}
_local2++;
}
}
function removeAllEffectObjects() {
while (effectObjects.length > 0) {
var _local2 = effectObjects.pop();
_local2.deleteClip();
}
while (newEffectObjects.length > 0) {
var _local2 = newEffectObjects.pop();
_local2.deleteClip();
}
}
static function resetDepthCounter() {
com.king.Chuzzle.EffectObject.resetDepthCounter();
}
}
Symbol 754 MovieClip [__Packages.com.king.Chuzzle.Splode] Frame 0
class com.king.Chuzzle.Splode extends com.king.Chuzzle.EffectObject
{
var color, frameCounter, clip, parentClip, posY, posX, animFrame, toBeRemoved;
function Splode (posX, posY, parentClip, color) {
super(posX, posY, parentClip);
this.color = color;
tint();
frameCounter = 0;
}
function createClip() {
var _local2 = "splode" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie("Splode", _local2, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
}
function tint() {
var _local2;
switch (color) {
case RED :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 255, 64, 64, 0);
break;
case GREEN :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 64, 230, 64, 0);
break;
case BLUE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 89, 89, 255, 0);
break;
case ORANGE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 255, 191, 26, 0);
break;
case YELLOW :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 255, 255, 0, 0);
break;
case PURPLE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 204, 0, 204, 0);
break;
case WHITE :
break;
case LIGHTBLUE :
_local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 128, 255, 255, 0);
}
var _local3 = new flash.geom.Transform(clip);
_local3.colorTransform = _local2;
}
function update() {
frameCounter++;
animFrame = frameCounter;
if (animFrame > NR_FRAMES) {
animFrame = NR_FRAMES;
}
if (frameCounter > NR_FRAMES) {
toBeRemoved = true;
}
}
var NR_FRAMES = 16;
static var RED = 1;
static var GREEN = 2;
static var BLUE = 3;
static var ORANGE = 4;
static var YELLOW = 5;
static var PURPLE = 6;
static var WHITE = 7;
static var LIGHTBLUE = 8;
}
Symbol 755 MovieClip [__Packages.com.king.Chuzzle.BigSplode] Frame 0
class com.king.Chuzzle.BigSplode extends com.king.Chuzzle.Splode
{
var clip, posX, posY, animFrame, visible;
function BigSplode (posX, posY, parentClip, color) {
super(posX, posY, parentClip, color);
}
function createClip() {
super.createClip();
clip._xscale = 200;
clip._yscale = 200;
}
function updateClip() {
clip._x = posX + 36;
clip._y = posY + 36;
clip.gotoAndStop(animFrame);
if (visible) {
clip._visible = true;
} else {
clip._visible = false;
}
}
}
Symbol 756 MovieClip [__Packages.com.king.Chuzzle.LockBreak] Frame 0
class com.king.Chuzzle.LockBreak extends com.king.Chuzzle.EffectObject
{
var frameCounter, animFrame, alphaValue, alphaDelta, clip, parentClip, posY, posX, toBeRemoved;
function LockBreak (posX, posY, parentClip) {
super(posX, posY, parentClip);
frameCounter = 0;
animFrame = 1;
alphaValue = 0;
alphaDelta = (1 / (NR_FRAMES / 2)) * 75;
}
function createClip() {
var _local2 = "lb" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie("rainbow_lock_effect", _local2, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
}
function update() {
frameCounter++;
if (frameCounter > NR_FRAMES) {
toBeRemoved = true;
}
if (frameCounter <= (NR_FRAMES / 2)) {
alphaValue = alphaValue + alphaDelta;
} else {
alphaValue = alphaValue - alphaDelta;
}
}
function updateClip() {
super.updateClip();
clip._alpha = alphaValue;
}
var NR_FRAMES = 25;
}
Symbol 757 MovieClip [__Packages.com.king.Chuzzle.SuperSplode] Frame 0
class com.king.Chuzzle.SuperSplode extends com.king.Chuzzle.Splode
{
var clip;
function SuperSplode (posX, posY, parentClip, color) {
super(posX, posY, parentClip, color);
}
function createClip() {
super.createClip();
clip._xscale = 245;
clip._yscale = 245;
}
}
Symbol 758 MovieClip [__Packages.com.king.Chuzzle.SuperExplodeHair] Frame 0
class com.king.Chuzzle.SuperExplodeHair extends com.king.Chuzzle.Splode
{
var alphaValue, clip, parentClip, posY, posX, frameCounter;
function SuperExplodeHair (posX, posY, parentClip, color) {
super(posX, posY, parentClip, color);
alphaValue = 100;
}
function createClip() {
var _local2 = "seh" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie("fuzz_hair_ring_anim", _local2, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
}
function update() {
super.update();
if (frameCounter > (NR_FRAMES * 0.67)) {
alphaValue = alphaValue - 10;
}
}
function render() {
super.updateClip();
clip._alpha = alphaValue;
}
var NR_FRAMES = 32;
}
Symbol 759 MovieClip [__Packages.com.king.Chuzzle.TwoStars] Frame 0
class com.king.Chuzzle.TwoStars extends com.king.Chuzzle.EffectObject
{
var setPos, parentClip, visible, toBeRemoved, frameCounter, posX, posY, pos2X, pos2Y, clip, clip2, animFrame;
function TwoStars (posX, posY, parentClip) {
super();
setPos(posX, posY);
this.parentClip = parentClip;
visible = true;
toBeRemoved = false;
frameCounter = 0;
var _local6 = Math.floor((Math.random() * 100) + 1) - 50;
var _local8 = Math.floor((Math.random() * 100) + 1) - 50;
var _local5 = Math.floor((Math.random() * 100) + 1) - 50;
var _local7 = Math.floor((Math.random() * 100) + 1) - 50;
this.posX = posX + _local6;
this.posY = posY + _local8;
pos2X = posX + _local5;
pos2Y = posY + _local7;
createClips();
}
function createClips() {
var _local3 = "TwoStars" + com.king.Chuzzle.EffectObject.depth;
clip = _root.attachMovie("star_anim", _local3, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
clip._xscale = 75;
clip._yscale = 75;
_local3 = "TwoStars" + com.king.Chuzzle.EffectObject.depth;
clip2 = _root.attachMovie("star_anim", _local3, com.king.Chuzzle.EffectObject.depth++, {_x:pos2X, _y:pos2Y});
clip2._xscale = 75;
clip2._yscale = 75;
}
function update() {
frameCounter = frameCounter + 4;
animFrame = frameCounter;
if (animFrame > NR_FRAMES) {
animFrame = NR_FRAMES;
toBeRemoved = true;
}
}
function updateClip() {
clip._x = posX;
clip._y = posY;
clip.gotoAndStop(animFrame);
if (visible) {
clip._visible = true;
} else {
clip._visible = false;
}
clip2._x = pos2X;
clip2._y = pos2Y;
clip2.gotoAndStop(animFrame);
if (visible) {
clip2._visible = true;
} else {
clip2._visible = false;
}
}
function deleteClip() {
removeMovieClip(clip);
removeMovieClip(clip2);
}
static var NR_FRAMES = 50;
}
Symbol 760 MovieClip [__Packages.com.king.Chuzzle.Lock] Frame 0
class com.king.Chuzzle.Lock extends com.king.Chuzzle.EffectObject
{
var wantedPosX, wantedPosY, frameCounter, clip, parentClip, posY, posX, scaleFactor, toBeRemoved;
function Lock (posX, posY, parentClip) {
super(START_POS_X, START_POS_Y, parentClip);
wantedPosX = posX;
wantedPosY = posY;
frameCounter = 0;
}
function createClip() {
var _local2 = "lock" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie("lock", _local2, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
}
function update() {
posX = START_POS_X + ((frameCounter / NR_FRAMES) * (wantedPosX - START_POS_X));
posY = START_POS_Y + ((frameCounter / NR_FRAMES) * (wantedPosY - START_POS_Y));
scaleFactor = START_SCALE + ((frameCounter / NR_FRAMES) * (WANTED_SCALE - START_SCALE));
if (frameCounter >= NR_FRAMES) {
toBeRemoved = true;
}
frameCounter++;
}
function updateClip() {
super.updateClip();
clip._xscale = scaleFactor;
clip._yscale = scaleFactor;
}
static var NR_FRAMES = 11;
static var START_POS_X = 410;
static var START_POS_Y = 302;
static var START_SCALE = 500;
static var WANTED_SCALE = 100;
}
Symbol 761 MovieClip [__Packages.com.king.Chuzzle.ScorePop] Frame 0
class com.king.Chuzzle.ScorePop extends com.king.Chuzzle.EffectObject
{
var score, frameCounter, clip, parentClip, posY, posX, animFrame, toBeRemoved;
function ScorePop (posX, posY, score, parentClip) {
super(posX, posY, parentClip);
this.score = score;
frameCounter = 0;
clip.TextHolder_mc.Score_txt.text = score;
}
function createClip() {
var _local2 = "score" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie("scorepop_anim", _local2, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
}
function update() {
frameCounter = frameCounter + 2;
animFrame = frameCounter;
if (animFrame > NR_FRAMES) {
animFrame = NR_FRAMES;
}
if (frameCounter > NR_FRAMES) {
toBeRemoved = true;
}
}
static var NR_FRAMES = 50;
}
Symbol 762 MovieClip [__Packages.com.king.Chuzzle.FourStars] Frame 0
class com.king.Chuzzle.FourStars extends com.king.Chuzzle.EffectObject
{
var parentClip, vertical, visible, toBeRemoved, frameCounter, scale1, scale2, scale3, scale4, posX, posY, pos2X, pos2Y, pos3X, pos3Y, pos4X, pos4Y, clip, clip2, clip3, clip4, animFrame;
function FourStars (posX, posY, parentClip, vertical) {
super();
this.parentClip = parentClip;
this.vertical = vertical;
visible = true;
toBeRemoved = false;
frameCounter = 0;
setPos(posX, posY);
createClips();
}
function setPos(posX, posY) {
var _local8 = Math.floor(Math.random() * 40) - 20;
var _local7 = Math.floor(Math.random() * 24) - 12;
var _local6 = Math.floor(Math.random() * 40) - 20;
var _local5 = Math.floor(Math.random() * 24) - 12;
var _local4 = Math.floor(Math.random() * 40) - 20;
var _local11 = Math.floor(Math.random() * 24) - 12;
var _local10 = Math.floor(Math.random() * 40) - 20;
var _local9 = Math.floor(Math.random() * 24) - 12;
scale1 = 50 + Math.floor(Math.random() * 51);
scale2 = 50 + Math.floor(Math.random() * 51);
scale3 = 50 + Math.floor(Math.random() * 51);
scale4 = 50 + Math.floor(Math.random() * 51);
if (vertical) {
this.posX = posX + _local8;
this.posY = (posY - 15) + _local7;
pos2X = posX + _local6;
pos2Y = (posY - 50) + _local5;
(pos3X = posX + _local4);
(pos3Y = (posY + 15) + _local11);
pos4X = posX + _local10;
pos4Y = (posY + 50) + _local9;
} else {
this.posX = (posX - 15) + _local7;
this.posY = posY + _local8;
pos2X = (posX - 50) + _local5;
pos2Y = posY + _local6;
pos3X = (posX + 15) + _local11;
pos3Y = posY + _local4;
pos4X = (posX + 50) + _local9;
pos4Y = posY + _local10;
}
}
function createClips() {
var _local5 = "fs" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie("star_anim", _local5, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY, _xscale:scale1, _yscale:scale1});
var _local4 = "fs2" + com.king.Chuzzle.EffectObject.depth;
clip2 = parentClip.attachMovie("star_anim", _local4, com.king.Chuzzle.EffectObject.depth++, {_x:pos2X, _y:pos2Y, _xscale:scale2, _yscale:scale2});
var _local3 = "fs3" + com.king.Chuzzle.EffectObject.depth;
clip3 = parentClip.attachMovie("star_anim", _local3, com.king.Chuzzle.EffectObject.depth++, {_x:pos3X, _y:pos3Y, _xscale:scale3, _yscale:scale3});
var _local2 = "fs4" + com.king.Chuzzle.EffectObject.depth;
clip4 = parentClip.attachMovie("star_anim", _local2, com.king.Chuzzle.EffectObject.depth++, {_x:pos4X, _y:pos4Y, _xscale:scale4, _yscale:scale4});
}
function update() {
frameCounter = frameCounter + 3;
animFrame = frameCounter;
if (animFrame > NR_FRAMES) {
animFrame = NR_FRAMES;
}
if (frameCounter > NR_FRAMES) {
toBeRemoved = true;
}
}
function updateClip() {
clip._x = posX;
clip._y = posY;
clip.gotoAndStop(animFrame);
clip2._x = pos2X;
clip2._y = pos2Y;
clip2.gotoAndStop(animFrame);
clip3._x = pos3X;
clip3._y = pos3Y;
clip3.gotoAndStop(animFrame);
clip4._x = pos4X;
clip4._y = pos4Y;
clip4.gotoAndStop(animFrame);
}
function deleteClip() {
removeMovieClip(clip);
removeMovieClip(clip2);
removeMovieClip(clip3);
removeMovieClip(clip4);
}
var NR_FRAMES = 50;
}
Symbol 763 MovieClip [__Packages.com.king.Chuzzle.ComboPop] Frame 0
class com.king.Chuzzle.ComboPop extends com.king.Chuzzle.EffectObject
{
var frameCounter, clip, parentClip, posY, posX, animFrame, toBeRemoved;
function ComboPop (posX, posY, parentClip) {
super(posX, posY, parentClip);
frameCounter = 0;
}
function createClip() {
var _local2 = "comboPop" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie("combo_anim", _local2, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
clip.Combo_mc.Text_txt.text = com.king.Chuzzle.TextProperties.COMBO_POP;
}
function update() {
frameCounter = frameCounter + 1;
animFrame = frameCounter;
if (animFrame > NR_FRAMES) {
animFrame = NR_FRAMES;
}
if (frameCounter > NR_FRAMES) {
toBeRemoved = true;
}
}
static var NR_FRAMES = 50;
}
Symbol 764 MovieClip [__Packages.com.king.Chuzzle.SuperPop] Frame 0
class com.king.Chuzzle.SuperPop extends com.king.Chuzzle.ComboPop
{
var clip, parentClip, posY, posX;
function SuperPop (posX, posY, parentClip) {
super(posX, posY, parentClip);
}
function createClip() {
var _local2 = "comboPop" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie("combo_anim", _local2, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
clip.Combo_mc.Text_txt.text = com.king.Chuzzle.TextProperties.SUPER_POP;
}
}
Symbol 765 MovieClip [__Packages.com.king.Chuzzle.Multiplier] Frame 0
class com.king.Chuzzle.Multiplier extends com.king.Chuzzle.EffectObject
{
var setPos, multi, parentClip, visible, toBeRemoved, frameCounter, clip, posY, posX, animFrame;
function Multiplier (posX, posY, multi, parentClip) {
super();
setPos(posX, posY);
this.multi = multi;
this.parentClip = parentClip;
visible = true;
toBeRemoved = false;
frameCounter = 0;
createClip();
}
function createClip() {
var _local2;
switch (multi) {
case 2 :
_local2 = "multiplier_scorepop2x";
break;
case 3 :
_local2 = "multiplier_scorepop3x";
break;
case 4 :
_local2 = "multiplier_scorepop4x";
break;
case 5 :
_local2 = "multiplier_scorepop5x";
break;
case 6 :
_local2 = "multiplier_scorepop6x";
break;
case 7 :
_local2 = "multiplier_scorepop7x";
break;
case 8 :
_local2 = "multiplier_scorepop8x";
break;
case 9 :
_local2 = "multiplier_scorepop9x";
break;
case 10 :
_local2 = "multiplier_scorepop10x";
break;
case 10 :
_local2 = "multiplier_scorepopWOW";
}
var _local3 = "multiplier" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie(_local2, _local3, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
}
function update() {
frameCounter = frameCounter + 1;
animFrame = frameCounter;
if (animFrame > NR_FRAMES) {
animFrame = NR_FRAMES;
}
if (frameCounter > NR_FRAMES) {
toBeRemoved = true;
}
}
static var NR_FRAMES = 75;
}
Symbol 766 MovieClip [__Packages.com.king.Chuzzle.HintArrow] Frame 0
class com.king.Chuzzle.HintArrow extends com.king.Chuzzle.EffectObject
{
var parentClip, visible, toBeRemoved, tickCounter, animFrame, posX, posY, toPosX, toPosY, times, scale, pos2X, pos2Y, clipRotation, pos3X, pos3Y, clip, clip3, clip2;
function HintArrow (posX, posY, toPosX, toPosY, parentClip) {
super();
this.parentClip = parentClip;
visible = true;
toBeRemoved = false;
tickCounter = 0;
animFrame = 1;
setPos(posX, posY, toPosX, toPosY);
createClips();
}
function setPos(inPosX, inPosY, inToPosX, inToPosY) {
posX = inPosX;
posY = inPosY;
toPosX = inToPosX;
toPosY = inToPosY;
times = 0;
if (posX != toPosX) {
times = Math.abs(posX - toPosX) / 72;
} else if (posY != toPosY) {
times = Math.abs(posY - toPosY) / 72;
}
scale = 100 * (times - 1);
if (scale <= 0) {
scale = 0;
}
pos2X = toPosX;
pos2Y = toPosY;
if (posX > toPosX) {
clipRotation = 180;
pos2X = toPosX + 5;
pos2Y = toPosY - 0;
pos3X = (posX - (92 + (36 * (times - 2)))) - 1;
pos3Y = posY;
} else if (posX < toPosX) {
clipRotation = 0;
pos2X = toPosX - 5;
pos2Y = toPosY - 0;
pos3X = (posX + (92 + (36 * (times - 2)))) - 1;
pos3Y = posY;
} else if (posY > toPosY) {
clipRotation = -90;
pos2X = toPosX - 0;
pos2Y = toPosY + 5;
pos3X = posX;
pos3Y = (posY - (92 + (36 * (times - 2)))) - 1;
} else if (posY < toPosY) {
clipRotation = 90;
pos2X = toPosX - 0;
pos2Y = toPosY - 5;
pos3X = posX;
pos3Y = (posY + (92 + (36 * (times - 2)))) - 1;
}
}
function createClips() {
var _local2 = "HintArrowC" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie("HintArrowCircle", _local2, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
if (times > 1) {
var _local5 = "HintMiddle" + com.king.Chuzzle.EffectObject.depth;
clip3 = parentClip.attachMovie("HintMiddle", arrowName, com.king.Chuzzle.EffectObject.depth++, {_x:pos3X, _y:pos3Y});
}
var arrowName = ("HintArrow" + com.king.Chuzzle.EffectObject.depth);
clip2 = parentClip.attachMovie("HintArrow", arrowName, com.king.Chuzzle.EffectObject.depth++, {_x:pos2X, _y:pos2Y});
}
function update() {
tickCounter = tickCounter + 1;
if (tickCounter >= (2 * COLOR_SWITCH_TIME)) {
animFrame = 2;
tickCounter = 0;
} else if (tickCounter >= COLOR_SWITCH_TIME) {
animFrame = 1;
}
}
function updateClip() {
clip._x = posX;
clip._y = posY;
clip3._xscale = scale;
clip3._yscale = 100;
if (visible) {
clip._visible = true;
} else {
clip._visible = false;
}
clip2._x = pos2X;
clip2._y = pos2Y;
clip2._rotation = clipRotation;
if (visible) {
clip2._visible = true;
} else {
clip2._visible = false;
}
clip3._x = pos3X;
clip3._y = pos3Y;
clip3._rotation = clipRotation;
if (visible) {
clip3._visible = true;
} else {
clip3._visible = false;
}
clip.gotoAndStop(animFrame);
clip2.gotoAndStop(animFrame);
clip3.gotoAndStop(animFrame);
clip._xscale = 101;
clip._yscale = 101;
}
function deleteClip() {
removeMovieClip(clip);
removeMovieClip(clip2);
removeMovieClip(clip3);
}
static var COLOR_SWITCH_TIME = 10;
}
Symbol 767 MovieClip [__Packages.com.king.Chuzzle.HintArrowBig] Frame 0
class com.king.Chuzzle.HintArrowBig extends com.king.Chuzzle.EffectObject
{
var parentClip, visible, toBeRemoved, tickCounter, animFrame, posX, posY, toPosX, toPosY, times, scale, clipRotation, pos2X, pos2Y, pos3X, pos3Y, clip3, clip, clip2;
function HintArrowBig (posX, posY, toPosX, toPosY, parentClip) {
super();
this.parentClip = parentClip;
visible = true;
toBeRemoved = false;
tickCounter = 0;
animFrame = 1;
setPos(posX, posY, toPosX, toPosY);
createClips();
}
function setPos(inPosX, inPosY, inToPosX, inToPosY) {
trace("big class");
posX = inPosX;
posY = inPosY;
toPosX = inToPosX;
toPosY = inToPosY;
if (posX > toPosX) {
toPosY = toPosY + 36;
} else if (posX < toPosX) {
toPosY = toPosY + 36;
toPosX = toPosX + 72;
} else if (posY > toPosY) {
toPosX = toPosX + 36;
} else if (posY < toPosY) {
toPosX = toPosX + 36;
toPosY = toPosY + 72;
}
posX = posX + 36;
posY = posY + 36;
times = 0;
if (inPosX != inToPosX) {
times = Math.abs(inPosX - inToPosX) / 72;
} else if (inPosY != inToPosY) {
times = Math.abs(inPosY - inToPosY) / 72;
}
scale = 100 * (times - 1);
if (scale <= 0) {
scale = 0;
}
if (posX > toPosX) {
clipRotation = 180;
pos2X = toPosX + 5;
pos2Y = toPosY - 0;
pos3X = posX - (128 + (36 * (times - 2)));
pos3Y = posY;
} else if (posX < toPosX) {
clipRotation = 0;
pos2X = toPosX - 5;
pos2Y = toPosY - 0;
pos3X = posX + (128 + (36 * (times - 2)));
pos3Y = posY;
} else if (posY > toPosY) {
clipRotation = -90;
pos2X = toPosX - 0;
pos2Y = toPosY + 5;
pos3X = posX;
pos3Y = posY - (128 + (36 * (times - 2)));
} else if (posY < toPosY) {
clipRotation = 90;
pos2X = toPosX - 0;
pos2Y = toPosY - 5;
pos3X = posX;
pos3Y = posY + (128 + (36 * (times - 2)));
}
}
function createClips() {
if (times > 1) {
var _local5 = "HintMiddleS" + com.king.Chuzzle.EffectObject.depth;
clip3 = parentClip.attachMovie("HintMiddle", arrowName, com.king.Chuzzle.EffectObject.depth++, {_x:pos3X, _y:pos3Y});
}
var _local2 = "HintArrowCS" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie("hint_stor", _local2, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
var arrowName = ("HintArrowS" + com.king.Chuzzle.EffectObject.depth);
clip2 = parentClip.attachMovie("HintArrow", arrowName, com.king.Chuzzle.EffectObject.depth++, {_x:pos2X, _y:pos2Y});
}
function update() {
tickCounter = tickCounter + 1;
if (tickCounter >= (2 * COLOR_SWITCH_TIME)) {
animFrame = 2;
tickCounter = 0;
} else if (tickCounter >= COLOR_SWITCH_TIME) {
animFrame = 1;
}
}
function updateClip() {
clip._x = posX;
clip._y = posY;
clip._xscale = 100;
clip._yscale = 100;
clip3._xscale = scale;
clip3._yscale = 100;
if (visible) {
clip._visible = true;
} else {
clip._visible = false;
}
clip2._x = pos2X;
clip2._y = pos2Y;
clip2._rotation = clipRotation;
if (visible) {
clip2._visible = true;
} else {
clip2._visible = false;
}
clip3._x = pos3X;
clip3._y = pos3Y;
clip3._rotation = clipRotation;
if (visible) {
clip3._visible = true;
} else {
clip3._visible = false;
}
clip.gotoAndStop(animFrame);
clip2.gotoAndStop(animFrame);
clip3.gotoAndStop(animFrame);
}
function deleteClip() {
removeMovieClip(clip);
removeMovieClip(clip2);
removeMovieClip(clip3);
}
static var COLOR_SWITCH_TIME = 10;
}
Symbol 768 MovieClip [__Packages.com.king.Chuzzle.HintArrowWrap] Frame 0
class com.king.Chuzzle.HintArrowWrap extends com.king.Chuzzle.EffectObject
{
var parentClip, visible, toBeRemoved, tickCounter, animFrame, posX, posY, toPosX, toPosY, times, times2, scale, scale2, clipRotation, pos2X, pos2Y, pos3X, pos3Y, clipRotation2, pos4X, pos4Y, clip, clip3, clip4, clip2;
function HintArrowWrap (posX, posY, toPosX, toPosY, posX2, posY2, toPosX2, toPosY2, parentClip) {
super();
this.parentClip = parentClip;
visible = true;
toBeRemoved = false;
tickCounter = 0;
animFrame = 1;
setPos(posX, posY, toPosX, toPosY, posX2, posY2, toPosX2, toPosY2);
createClips();
}
function setPos(inPosX, inPosY, inToPosX, inToPosY, inPosX2, inPosY2, inToPosX2, inToPosY2) {
posX = inPosX;
posY = inPosY;
toPosX = inToPosX;
toPosY = inToPosY;
times = 0;
if (posX != toPosX) {
times = Math.abs(posX - toPosX) / 72;
} else if (posY != toPosY) {
times = Math.abs(posY - toPosY) / 72;
}
times2 = 0;
if (inPosX2 != inToPosX2) {
times2 = Math.abs(inPosX2 - inToPosX2) / 72;
} else if (inPosY2 != inToPosY2) {
times2 = Math.abs(inPosY2 - inToPosY2) / 72;
}
times2++;
scale = 100 * times;
if (scale <= 0) {
scale = 0;
}
scale2 = 100 * times2;
if (scale2 <= 0) {
scale2 = 0;
}
if (posX > toPosX) {
clipRotation = 180;
pos2X = toPosX + 5;
pos2Y = toPosY - 0;
pos3X = posX - (128 + (36 * (times - 2)));
pos3Y = posY;
} else if (posX < toPosX) {
clipRotation = 0;
pos2X = toPosX - 5;
pos2Y = toPosY - 0;
pos3X = posX + (128 + (36 * (times - 2)));
pos3Y = posY;
} else if (posY > toPosY) {
clipRotation = -90;
pos2X = toPosX - 0;
pos2Y = toPosY + 5;
pos3X = posX;
pos3Y = posY - (128 + (36 * (times - 2)));
} else if (posY < toPosY) {
clipRotation = 90;
pos2X = toPosX - 0;
pos2Y = toPosY - 5;
pos3X = posX;
pos3Y = posY + (128 + (36 * (times - 2)));
} else if (posY == toPosY) {
}
if (inPosX2 > inToPosX2) {
clipRotation2 = 180;
pos2X = inToPosX2;
pos2Y = inToPosY2;
pos4X = inToPosX2 + (36 * times2);
pos4Y = posY;
} else if (inPosX2 < inToPosX2) {
clipRotation2 = 0;
pos2X = inToPosX2;
pos2Y = inToPosY2;
pos4X = inToPosX2 - (36 * times2);
pos4Y = posY;
} else if (inPosY2 > inToPosY2) {
clipRotation2 = -90;
pos2X = inToPosX2;
pos2Y = inToPosY2;
pos4X = posX;
pos4Y = inToPosY2 + (36 * times2);
} else if (inPosY2 < inToPosY2) {
clipRotation2 = 90;
pos2X = inToPosX2;
pos2Y = inToPosY2;
pos4X = posX;
pos4Y = inToPosY2 - (36 * times2);
} else {
pos2X = inToPosX2;
pos2Y = inToPosY2;
if (posX < inPosX2) {
clipRotation2 = 180;
pos4X = inToPosX2 + 36;
pos4Y = posY;
} else if (posX > inPosX2) {
clipRotation2 = 0;
pos4X = inToPosX2 - 36;
pos4Y = posY;
}
if (posY < inPosY2) {
clipRotation2 = -90;
pos4X = posX;
pos4Y = inToPosY2 + 36;
} else if (posY > inPosY2) {
clipRotation2 = 90;
pos4X = posX;
pos4Y = inToPosY2 - 36;
}
}
}
function createClips() {
var _local2 = "HintArrowC" + com.king.Chuzzle.EffectObject.depth;
clip = parentClip.attachMovie("HintArrowCircle", _local2, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
if (times > 0) {
var _local5 = "HintMiddle" + com.king.Chuzzle.EffectObject.depth;
clip3 = parentClip.attachMovie("HintMiddle", arrowName, com.king.Chuzzle.EffectObject.depth++, {_x:pos3X, _y:pos3Y});
}
if (times2 > 0) {
var _local6 = "HintMiddle2" + com.king.Chuzzle.EffectObject.depth;
clip4 = parentClip.attachMovie("HintMiddle", arrowName, com.king.Chuzzle.EffectObject.depth++, {_x:pos4X, _y:pos4Y});
}
var arrowName = ("HintArrow" + com.king.Chuzzle.EffectObject.depth);
clip2 = parentClip.attachMovie("HintArrow", arrowName, com.king.Chuzzle.EffectObject.depth++, {_x:pos2X, _y:pos2Y});
}
function update() {
tickCounter = tickCounter + 1;
if (tickCounter >= (2 * COLOR_SWITCH_TIME)) {
animFrame = 2;
tickCounter = 0;
} else if (tickCounter >= COLOR_SWITCH_TIME) {
animFrame = 1;
}
}
function updateClip() {
clip._x = posX;
clip._y = posY;
clip3._xscale = scale;
clip3._yscale = 100;
clip4._xscale = scale2;
clip4._yscale = 100;
if (visible) {
clip._visible = true;
} else {
clip._visible = false;
}
clip2._x = pos2X;
clip2._y = pos2Y;
clip2._rotation = clipRotation2;
if (visible) {
clip2._visible = true;
} else {
clip2._visible = false;
}
clip3._x = pos3X;
clip3._y = pos3Y;
clip3._rotation = clipRotation;
if (visible) {
clip3._visible = true;
} else {
clip3._visible = false;
}
clip4._x = pos4X;
clip4._y = pos4Y;
clip4._rotation = clipRotation2;
clip.gotoAndStop(animFrame);
clip2.gotoAndStop(animFrame);
clip3.gotoAndStop(animFrame);
clip4.gotoAndStop(animFrame);
clip._xscale = 101;
clip._yscale = 101;
}
function deleteClip() {
removeMovieClip(clip);
removeMovieClip(clip2);
removeMovieClip(clip3);
removeMovieClip(clip4);
}
static var COLOR_SWITCH_TIME = 10;
}
Symbol 769 MovieClip [__Packages.com.king.Chuzzle.AnimEyes] Frame 0
class com.king.Chuzzle.AnimEyes extends com.king.Chuzzle.EffectObject
{
var rowIndex, colIndex, parentClip, visible, toBeRemoved, type, eyeColor, normal, posX, posY, endFrame, animFrame, clip;
function AnimEyes (posX, posY, rowIndex, colIndex, eyeColor, normal, parentClip) {
super();
this.rowIndex = rowIndex;
this.colIndex = colIndex;
this.parentClip = parentClip;
visible = true;
toBeRemoved = false;
type = 1;
this.eyeColor = eyeColor;
this.normal = normal;
if (normal) {
this.posX = posX;
this.posY = posY;
endFrame = framesData[(rowIndex * 6) + colIndex];
} else {
this.rowIndex = this.rowIndex + 1;
this.colIndex = this.colIndex + 1;
this.posX = posX + 72;
this.posY = posY + 72;
endFrame = bigFramesData[(((rowIndex * 6) + 0) + colIndex) + 0];
}
animFrame = 1;
createClip();
}
function createClip() {
var _local2 = "ae" + com.king.Chuzzle.EffectObject.depth;
var _local3 = ("EyeAnim" + rowIndex) + colIndex;
clip = parentClip.attachMovie(_local3, _local2, com.king.Chuzzle.EffectObject.depth++, {_x:posX, _y:posY});
clip.Eyes_mc.RightEye_mc.gotoAndStop(eyeColor);
clip.Eyes_mc.LeftEye_mc.gotoAndStop(eyeColor);
}
function update() {
if (animFrame >= endFrame) {
toBeRemoved = true;
com.king.util.SoundManager.play("Bottled");
} else {
animFrame++;
}
}
var NR_FRAMES = 50;
static var framesData = Array(14, 15, 18, 23, 30, 39, 16, 17, 20, 25, 32, 41, 19, 21, 22, 27, 34, 43, 24, 26, 28, 29, 36, 45, 31, 33, 35, 37, 38, 47, 40, 42, 44, 46, 48, 49);
static var bigFramesData = Array(25, 26, 29, 34, 41, 25, 27, 28, 31, 36, 43, 25, 30, 32, 33, 38, 45, 25, 35, 37, 39, 40, 47, 25, 42, 44, 46, 48, 49, 25, 25, 25, 25, 25, 25, 25);
}