Frame 1
_root.gamemode = 2;
var game = (new com.midasplayer.game.klickklackroll.Game());
Symbol 55 MovieClip Frame 1
stop();
Symbol 55 MovieClip Frame 31
stop();
Symbol 95 MovieClip Frame 1
stop();
Symbol 123 MovieClip Frame 1
stop();
Symbol 123 MovieClip Frame 9
play();
Symbol 123 MovieClip Frame 14
gotoAndPlay (9);
Symbol 130 MovieClip Frame 1
stop();
Symbol 149 MovieClip Frame 1
stop();
Symbol 149 MovieClip Frame 2
play();
Symbol 149 MovieClip Frame 7
gotoAndPlay (2);
Symbol 154 MovieClip Frame 1
stop();
Symbol 158 MovieClip Frame 1
stop();
Symbol 158 MovieClip Frame 2
stop();
Symbol 288 MovieClip [__Packages.com.midasplayer.util.GameBase] Frame 0
class com.midasplayer.util.GameBase
{
static var gameData_, game_, checkGameDataIntervalId_;
function GameBase () {
gameMode_ = GAME_MODE_MONEY;
}
function startGame() {
}
static function setGameMode(gameMode) {
gameMode_ = gameMode;
}
static function getGameMode() {
return(gameMode_);
}
static function setGameType(gameType) {
gameType_ = gameType;
}
static function getGameType() {
return(gameType_);
}
static function getGameData() {
return(gameData_);
}
function reportGameStart() {
com.midasplayer.util.Log.debug("gameStart");
fscommand ("gameStart");
}
function reportGameEnd(score) {
com.midasplayer.util.Log.debug("gameEnd " + String(score));
fscommand ("gameEnd", String(score));
}
function reportGameQuit() {
com.midasplayer.util.Log.debug("gameQuit");
fscommand ("gameQuit");
}
function reportGameOver(score) {
com.midasplayer.util.Log.debug("gameOver " + String(score));
fscommand ("gameOver", String(score));
}
function reportPlayData(pCode, pData, pScore) {
if (gameMode_ != GAME_MODE_MONEY) {
return(undefined);
}
var _local1;
_local1 = String(pCode);
if ((pData != null) && (pData.length > 0)) {
_local1 = _local1 + ("," + pData);
}
if (((pScore != undefined) && (pScore != null)) && (pScore.length > 0)) {
_local1 = _local1 + ("=" + pScore);
}
trace(_local1);
com.midasplayer.util.Log.debug("playData " + _local1);
fscommand ("playData", "" + _local1);
}
static function runsLocal() {
return(_root._URL.substr(0, 5).toLowerCase() == "file:");
}
function init(game) {
game_ = game;
checkGameDataIntervalId_ = setInterval(this, "checkGameData", 200);
}
function checkGameData() {
if (!hasGameData_) {
if (((_root.gameData != null) && (_root.gameData != undefined)) && (_root.gameData != "")) {
hasGameData_ = true;
parseGameData(_root.gameData);
clearInterval(checkGameDataIntervalId_);
game_.startGame();
}
}
}
function parseGameData(myData) {
gameData_ = new com.midasplayer.util.Map();
var _local7 = new XML();
_local7.ignoreWhite = true;
_local7.parseXML(myData);
var _local4 = _local7.firstChild;
if (_local4.nodeName == "gamedata") {
for (var _local6 in _local4.attributes) {
var _local5;
var _local2 = _local4.attributes[_local6];
gameData_.put(_local6, _local2);
}
var _local1 = _local4.firstChild;
while (_local1 != null) {
if (_local1.nodeName == "text") {
com.midasplayer.util.I18n.addTranslation(String(_local1.attributes.id), String(_local1.firstChild));
} else {
var _local3 = "0";
for (var _local6 in _local1.attributes) {
var _local2 = _local1.attributes[_local6];
if (_local6 == "id") {
_local3 = _local2;
} else {
gameData_.put((((_local1.nodeName + ".") + _local3) + ".") + _local6, _local2);
}
}
}
_local1 = _local1.nextSibling;
}
}
}
static var GAME_MODE_DEBUG = 0;
static var GAME_MODE_PRACTICE = 1;
static var GAME_MODE_MONEY = 2;
static var GAME_TYPE_SINGLE = 0;
static var GAME_TYPE_MULTI = 1;
static var gameMode_ = GAME_MODE_DEBUG;
static var gameType_ = GAME_TYPE_SINGLE;
static var hasGameData_ = false;
}
Symbol 289 MovieClip [__Packages.com.midasplayer.util.Map] Frame 0
class com.midasplayer.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 = map["@" + key];
delete map["@" + key];
lastSize = -1;
return(_local2);
}
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.substring(1);
}
return(_local2);
}
function foreach(fn) {
do {
if ((in map) == null) {
break;
}
var _local3 = in map;
} while (fn(_local3.substring(1), map[_local3]) != false);
do {
} while ("foreach" != null);
lastSize = -1;
}
}
Symbol 290 MovieClip [__Packages.com.midasplayer.util.ArrayList] Frame 0
class com.midasplayer.util.ArrayList
{
var value;
function ArrayList () {
value = new Array();
}
function insert(obj, pos) {
var _local3 = value.length;
if (pos == undefined) {
value.push(obj);
return(_local3);
}
if (pos > _local3) {
pos = _local3;
}
var _local2 = _local3 - 1;
while (_local2 > (pos - 1)) {
value[_local2 + 1] = value[_local2];
_local2--;
}
value[pos] = obj;
return(pos);
}
function get(pos) {
return(value[pos]);
}
function indexOf(obj) {
var _local2 = 0;
while (_local2 < value.length) {
if (obj == value[_local2]) {
return(_local2);
}
_local2++;
}
return(-1);
}
function remove(obj) {
return(removeByIndex(indexOf(obj)));
}
function removeByIndex(pos) {
var _local5;
var _local3 = value.length;
if ((pos < _local3) && (pos >= 0)) {
_local5 = value[pos];
delete value[pos];
var _local2 = pos;
while (_local2 < (_local3 - 1)) {
value[_local2] = value[_local2 + 1];
_local2++;
}
value.length = _local3 - 1;
}
return(_local5);
}
function size() {
return(value.length);
}
function clear() {
value = new Array();
}
function toArray() {
return(value);
}
function foreach(fn) {
var _local2 = 0;
var _local3 = value.length;
while (_local2 < _local3) {
if (fn(_local2, value[_local2]) == false) {
break;
}
_local2++;
}
}
function sortOn(field) {
value.sortOn(field);
}
function sort() {
value.sort();
}
function subList(from, to) {
if (!to) {
to = value.length;
}
var a = (new com.midasplayer.util.ArrayList());
var i = from;
while (i < to) {
a.insert(eval (i));
i++;
}
return(a);
}
}
Symbol 291 MovieClip [__Packages.com.midasplayer.util.Log] Frame 0
class com.midasplayer.util.Log
{
function Log () {
}
static function setLevel(level) {
level_ = level;
}
static function debug(msg) {
if (level_ <= LEVEL_DEBUG) {
log_.insert(new com.midasplayer.util.LogEntry(LEVEL_DEBUG, msg));
}
}
static function warning(msg) {
if (level_ <= LEVEL_WARNING) {
log_.insert(new com.midasplayer.util.LogEntry(LEVEL_WARNING, msg));
}
}
static function error(msg) {
if (level_ <= LEVEL_ERROR) {
log_.insert(new com.midasplayer.util.LogEntry(LEVEL_ERROR, msg));
}
}
static function getLog() {
if (log_.size() != logStringLastUpdatedSize_) {
logString_ = "";
var _local1 = 0;
while (_local1 < log_.size()) {
var _local2 = com.midasplayer.util.LogEntry(log_.get(_local1));
if (_local1 > 0) {
logString_ = logString_ + newline;
}
logString_ = logString_ + LEVEL_STRINGS[_local2.getLevel()];
logString_ = logString_ + ": ";
logString_ = logString_ + _local2.getMessage();
logStringLastUpdatedSize_ = log_.size();
_local1++;
}
}
return(logString_);
}
static var LEVEL_ALL = -1;
static var LEVEL_NONE = 1000;
static var LEVEL_DEBUG = 0;
static var LEVEL_WARNING = 1;
static var LEVEL_ERROR = 2;
static var LEVEL_STRINGS = ["DEBUG", "WARNING", "ERROR"];
static var level_ = LEVEL_ALL;
static var log_ = new com.midasplayer.util.ArrayList();
static var logString_ = "";
static var logStringLastUpdatedSize_ = 0;
}
Symbol 292 MovieClip [__Packages.com.midasplayer.util.LogEntry] Frame 0
class com.midasplayer.util.LogEntry
{
var level_, message_;
function LogEntry (level, msg) {
level_ = level;
message_ = msg;
}
function getLevel() {
return(level_);
}
function getMessage() {
return(message_);
}
}
Symbol 293 MovieClip [__Packages.com.midasplayer.util.I18n] Frame 0
class com.midasplayer.util.I18n
{
function I18n () {
}
static function addTranslation(name, val) {
val = val.split("'").join("'");
val = val.split("\r\n").join(newline);
translations_.put(name, val);
}
static function format(name, replace0, replace1, replace2) {
var _local2 = translations_.get(name);
if (_local2 == undefined) {
return(("{" + name) + "}");
}
var _local1 = _local2.toString();
if (replace1 != undefined) {
var _local4 = _local1.split("{0}");
_local1 = _local4.join(replace0);
if (replace2 != undefined) {
_local4 = _local1.split("{1}");
_local1 = _local4.join(replace1);
if (replace2 != undefined) {
_local4 = _local1.split("{2}");
_local1 = _local4.join(replace2);
}
}
}
return(_local1);
}
static var translations_ = new com.midasplayer.util.Map();
}
Symbol 294 MovieClip [__Packages.com.midasplayer.game.klickklackroll.Game] Frame 0
class com.midasplayer.game.klickklackroll.Game extends com.midasplayer.util.GameBase
{
static var board_, activationLimit_, clearLimit_, percentCleared_, bonus_, score_, quitIntervalId_, clockIntervalId_;
var init, reportGameStart, level_, quitFlag_, timesUp_, soundOn_, reportPlayData, counters_, reportGameEnd, timeLeft_, reportGameQuit;
function Game () {
super();
com.midasplayer.util.GameBase.setGameMode(_root.gamemode);
com.midasplayer.util.Log.setLevel(com.midasplayer.util.Log.LEVEL_NONE);
init(this);
}
function startGame() {
reportGameStart();
_root.attachMovie("board", "board", _root.getNextHighestDepth());
_root.board._x = 0;
_root.board._y = 0;
_root.board.cacheAsBitmap = true;
setScore(0);
board_ = new com.midasplayer.game.klickklackroll.Board();
var _local3 = Number(com.midasplayer.util.GameBase.gameData_.get("randomseed"));
board_.setSeed(_local3);
_root.board.txtTimeLeft.text = com.midasplayer.util.I18n.format("time_left");
_root.board.txtScore.text = com.midasplayer.util.I18n.format("score");
_root.board.txtBlastoMeter.text = com.midasplayer.util.I18n.format("column_blast");
_root.board.txtEndGame.text = com.midasplayer.util.I18n.format("end_game");
_root.board.txtSound.text = com.midasplayer.util.I18n.format("sound_off");
_root.board.endGameBtn.onRollOver = function () {
if ((_root.levelsign == undefined) && (_root.introsign == undefined)) {
this.gotoAndStop(2);
}
};
_root.board.endGameBtn.onRollOut = function () {
this.gotoAndStop(1);
};
_root.board.endGameBtn.onPress = function () {
if ((_root.levelsign == undefined) && (_root.introsign == undefined)) {
_root.game.endGame();
}
};
soundOnOff();
level_ = 1;
startLevel(level_);
}
function startLevel(level) {
if (quitFlag_) {
return(undefined);
}
timesUp_ = false;
var _local8 = Number(com.midasplayer.util.GameBase.gameData_.get(("level." + level) + ".width"));
var _local4 = Number(com.midasplayer.util.GameBase.gameData_.get(("level." + level) + ".height"));
var _local7 = Number(com.midasplayer.util.GameBase.gameData_.get(("level." + level) + ".colors"));
var _local6 = Number(com.midasplayer.util.GameBase.gameData_.get(("level." + level) + ".bomb_percent"));
var _local9 = Number(com.midasplayer.util.GameBase.gameData_.get(("level." + level) + ".multiplier_percent"));
var _local5 = Number(com.midasplayer.util.GameBase.gameData_.get(("level." + level) + ".timelimit"));
activationLimit_ = Number(com.midasplayer.util.GameBase.gameData_.get(("level." + level) + ".activation_limit"));
clearLimit_ = Number(com.midasplayer.util.GameBase.gameData_.get(("level." + level) + ".clear"));
_root.board.gotoAndStop(level);
displayTimeLeft(_local5);
displayLevel(level);
board_.setSize(_local8, _local4);
board_.setNumColors(_local7);
board_.setBombPercent(_local6);
board_.setMultiplierPercent(_local9);
board_.setMultiplier(1 + ((level_ - 1) * 0.1));
board_.generateFromGameData(String(com.midasplayer.util.GameBase.gameData_.get(("level." + level) + ".symbols")));
if (level == 1) {
startPlayIntro();
} else {
startBoard();
}
}
function endGame() {
if (quitFlag_) {
return(undefined);
}
quitFlag_ = true;
_root.introsign.removeMovieClip();
_root.levelsign.removeMovieClip();
_root.counter.removeMovieClip();
_root.timermc.removeMovieClip();
endLevel();
}
function soundOnOff() {
if ((soundOn_ == undefined) || (soundOn_ == false)) {
soundOn_ = true;
_root.board.soundBtn.onRollOver = function () {
this.gotoAndStop(2);
};
_root.board.soundBtn.onRollOut = function () {
this.gotoAndStop(1);
};
_root.board.soundBtn.onPress = function () {
_root.game.soundOnOff();
};
com.midasplayer.fx.SoundManager.enableSounds(soundOn_);
_root.board.txtSound.text = com.midasplayer.util.I18n.format("sound_off");
} else {
soundOn_ = false;
_root.board.soundBtn.gotoAndStop(3);
_root.board.soundBtn.onRollOver = function () {
this.gotoAndStop(4);
};
_root.board.soundBtn.onRollOut = function () {
this.gotoAndStop(3);
};
_root.board.soundBtn.onPress = function () {
_root.game.soundOnOff();
};
com.midasplayer.fx.SoundManager.enableSounds(soundOn_);
_root.board.txtSound.text = com.midasplayer.util.I18n.format("sound_on");
}
}
function startBoard() {
if (quitFlag_) {
return(undefined);
}
reportPlayData(13, "", "0");
board_.start();
_root.board.level.gotoAndStop(level_ + 1);
var _local3 = Number(com.midasplayer.util.GameBase.gameData_.get(("level." + level_) + ".timelimit"));
startClock(_local3);
createOpener();
com.midasplayer.fx.SoundManager.stop("game intro");
com.midasplayer.fx.SoundManager.play("level start");
}
function startPlayIntro() {
_root.attachMovie("introSign", "introsign", _root.getNextHighestDepth());
_root.introsign._x = 160;
_root.introsign._y = 50;
_root.introsign.txtGameInstructions.text = com.midasplayer.util.I18n.format("instruction_headline");
_root.introsign.txt1.text = com.midasplayer.util.I18n.format("instruction_text_1");
_root.introsign.txt2.text = com.midasplayer.util.I18n.format("instruction_text_2");
_root.introsign.txt3.text = com.midasplayer.util.I18n.format("instruction_text_3");
_root.introsign.txt5.text = com.midasplayer.util.I18n.format("instruction_text_5");
_root.introsign.txtStartIn.text = com.midasplayer.util.I18n.format("start_in");
_root.introsign.txtStartGame.text = com.midasplayer.util.I18n.format("start_game");
_root.attachMovie("timer", "timermc", _root.getNextHighestDepth());
_root.timermc.txt.text = com.midasplayer.util.I18n.format("start_in");
_root.timermc._x = 630;
_root.timermc._y = 340;
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:playIntro}], callback:endPlayIntro, callback_scope:this, tps:25});
com.midasplayer.fx.SoundManager.play("game intro");
}
function playIntro(tick, alpha) {
var _local3 = false;
if (tick > 25) {
_root.introsign.onPress = function () {
this.clicked = true;
};
_root.timermc.onPress = function () {
this.clicked = true;
};
}
var _local4 = 10 - Math.round(tick / 25);
if (_local4 <= 0) {
_local3 = true;
} else {
_root.introsign.txtNumSecs.text = _local4;
}
_root.timermc.plate._rotation = Math.min(310, (310 * tick) / 250);
if (_root.introsign.clicked) {
_local3 = true;
}
if (_root.timermc.clicked) {
_local3 = true;
}
return(_local3);
}
function endPlayIntro() {
_root.introsign.removeMovieClip();
_root.timermc.removeMovieClip();
startBoard();
}
function createLevelSign() {
_root.attachMovie("counter", "counter", _root.getNextHighestDepth());
_root.counter._x = 478;
_root.counter._y = 45;
_root.counter._rotation = 20;
_root.attachMovie("levelSign", "levelsign", _root.getNextHighestDepth());
_root.levelsign._x = 46;
_root.levelsign._y = 56;
_root.counter.cleared.text = com.midasplayer.util.I18n.format("cleared_cubes");
_root.attachMovie("timer", "timermc", _root.getNextHighestDepth());
if (level_ == 2) {
_root.timermc.txt.text = com.midasplayer.util.I18n.format("level_2_start_in");
}
if (level_ == 3) {
_root.timermc.txt.text = com.midasplayer.util.I18n.format("level_3_start_in");
}
if (((percentCleared_ < clearLimit_) || (level_ == 4)) || (quitFlag_)) {
_root.timermc.txt.text = com.midasplayer.util.I18n.format("end_in");
}
_root.timermc._x = 580;
_root.timermc._y = 360;
counters_ = new Array();
var _local5 = 0;
while (_local5 < 10) {
counters_[_local5] = new Array();
_local5++;
}
var _local6 = 75;
var _local9 = 42;
var _local8 = 10;
var _local7 = 10;
_local5 = 0;
while (_local5 < 10) {
var _local3 = 0;
while (_local3 < 10) {
var _local4 = _root.counter.attachMovie("countpercent", ("c" + String((_local5 * 30) + 1)) + String(_local3 + 1), (_local5 * 20) + _local3);
_local4._x = _local6 + (_local3 * _local8);
_local4._y = _local9 + (_local5 * _local7);
_local4.gotoAndStop(1);
counters_[_local5][_local3] = _local4;
_local3++;
}
_local5++;
}
_local6 = _local6 + 1;
_local5 = 0;
while (_local5 < 10) {
var _local3 = 10;
while (_local3 < 15) {
var _local4 = _root.counter.attachMovie("countpercent", ("c" + String((_local5 * 30) + 1)) + String(_local3 + 1), (_local5 * 20) + _local3);
_local4._x = _local6 + (_local3 * _local8);
_local4._y = _local9 + (_local5 * _local7);
_local4.gotoAndStop(1);
counters_[_local5][_local3] = _local4;
_local3++;
}
_local5++;
}
_local6 = _local6 + 1;
_local5 = 0;
while (_local5 < 10) {
var _local3 = 15;
while (_local3 < 20) {
var _local4 = _root.counter.attachMovie("countpercent", ("c" + String((_local5 * 30) + 1)) + String(_local3 + 1), (_local5 * 20) + _local3);
_local4._x = _local6 + (_local3 * _local8);
_local4._y = _local9 + (_local5 * _local7);
_local4.gotoAndStop(1);
counters_[_local5][_local3] = _local4;
_local3++;
}
_local5++;
}
_root.counter.levelNumber.gotoAndStop(level_ - 1);
}
function startPlayLevelSign() {
createLevelSign();
if ((!areMoreLevels()) || (quitFlag_)) {
_root.levelsign.txtGameOver.text = com.midasplayer.util.I18n.format("game_over");
} else {
_root.levelsign.txtGameOver.text = com.midasplayer.util.I18n.format("level_over");
if (timesUp_) {
_root.levelsign.txtStatus.text = com.midasplayer.util.I18n.format("time_is_out");
} else {
_root.levelsign.txtStatus.text = com.midasplayer.util.I18n.format("no_more_moves");
}
}
_root.levelsign.txtClearedPercentage.text = "";
_root.levelsign.txtQualified.text = "";
_root.levelsign.txtScore.text = com.midasplayer.util.I18n.format("game_score");
_root.levelsign.txtClearBonus.text = com.midasplayer.util.I18n.format("clearance_bonus");
_root.levelsign.txtTotal.autoSize = true;
_root.levelsign.txtTotal.text = com.midasplayer.util.I18n.format("total_score");
if (_root.levelsign.txtTotal._height > 50) {
_root.levelsign.txtTotal._y = 242;
}
_root.levelsign.txtCounter.text = "";
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:playLevelSign}], callback:endPlayLevelSign, callback_scope:this, tps:25});
if (percentCleared_ == 100) {
_root.attachMovie("ufo", "ufo", _root.getNextHighestDepth());
_root.ufo._x = -300;
_root.ufo._y = 200;
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:playLevelUfo}], callback:endPlayUfo, callback_scope:this, tps:50});
}
}
function playLevelUfo(tick, alpha) {
var _local6 = false;
if (((tick > 110) && (tick < 130)) && (!com.midasplayer.fx.SoundManager.isPlaying("end_100_percent"))) {
com.midasplayer.fx.SoundManager.play("end_100_percent", 75);
}
var _local8 = 80;
var _local4 = 150;
var _local2 = tick - _local8;
_local2 = ((_local2 < 0) ? 0 : (_local2));
_local2 = ((_local2 > _local4) ? (_local4) : (_local2));
var _local5 = (_local2 / _local4) * Math.PI;
var _local3 = Math.sin(_local5);
if (_local5 > (Math.PI/2)) {
_local3 = 2 - _local3;
}
_local3 = _local3 / 2;
var _local9 = 400 - ((_local3 * _local3) * 800);
_root.ufo._x = (-_root.ufo._width) + ((755 + _root.ufo._width) * _local3);
_root.ufo._y = _local9;
if (tick > 250) {
_local6 = true;
}
return(_local6);
}
function endPlayUfo() {
_root.ufo.removeMovieClip();
}
function playLevelSign(tick, alpha) {
var done = false;
if (tick > 25) {
if (((percentCleared_ >= clearLimit_) && (level_ != 4)) && (!quitFlag_)) {
_root.counter.onPress = function () {
this.clicked = true;
};
_root.levelsign.onPress = function () {
this.clicked = true;
};
_root.timermc.onPress = function () {
this.clicked = true;
};
}
}
var lastPos = 0;
var p = ((tick > 100) ? 100 : (tick));
var numCols = board_.getNumCols();
var toPos = (((p / 100) * numCols) * 10);
var allCleared = true;
var i = lastPos;
while (i < toPos) {
var x = (i % numCols);
var y = (9 - Math.floor(i / numCols));
if (x == (numCols - 1)) {
var mc = eval ("_root.counter.cp" + y);
if (allCleared) {
mc.gotoAndStop(2);
} else {
mc.gotoAndStop(1);
}
allCleared = true;
}
var frame = 1;
var block = board_.getBlock(y, x);
if ((block == null) || (block == undefined)) {
frame = 3;
} else if (block.isDragging()) {
frame = 2;
} else {
allCleared = false;
frame = 4;
}
counters_[y][x].gotoAndStop(frame);
i++;
}
if (tick < 50) {
displayDigital("_root.counter.score", Math.floor((percentCleared_ * tick) / 50));
} else {
displayDigital("_root.counter.score", percentCleared_);
if (areMoreLevels() && (!quitFlag_)) {
if (percentCleared_ >= clearLimit_) {
_root.levelsign.txtQualified.text = com.midasplayer.util.I18n.format("qualified");
} else {
_root.levelsign.txtQualified.text = com.midasplayer.util.I18n.format("not_qualified");
}
}
if (tick > 60) {
_root.levelsign.txtNumScore.text = score_ - bonus_;
}
if (tick > 70) {
_root.levelsign.txtNumClearBonus.text = bonus_;
}
if (tick > 75) {
if ((percentCleared_ >= 85) && (_root.levelsign.star._currentframe == 1)) {
_root.levelsign.star.play();
}
}
if (tick > 80) {
_root.levelsign.txtNumTotal.text = score_;
}
}
var secsLeft = (5 - Math.round(tick / 25));
if (secsLeft <= 0) {
done = true;
} else {
_root.levelsign.txtCounter.text = secsLeft;
}
_root.timermc.plate._rotation = 150 + Math.min(310, (310 * tick) / 250);
if (_root.counter.clicked) {
done = true;
}
if (_root.levelsign.clicked) {
done = true;
}
if (_root.timermc.clicked) {
done = true;
}
return(done);
}
function areMoreLevels() {
var _local2 = com.midasplayer.util.GameBase.gameData_.get(("level." + level_) + ".width");
return(_local2 != undefined);
}
function endPlayLevelSign() {
if (((percentCleared_ >= clearLimit_) && (areMoreLevels())) && (!quitFlag_)) {
_root.counter.removeMovieClip();
_root.levelsign.removeMovieClip();
_root.timermc.removeMovieClip();
startLevel(level_);
} else {
reportGameEnd(score_);
quitIntervalId_ = setInterval(this, "quitGame", 1500);
}
}
function playOutro(tick, alpha) {
var _local1 = false;
_local1 = true;
return(_local1);
}
function endPlayOutro() {
level_++;
startPlayLevelSign();
}
function endLevel() {
board_.deactivate();
stopClock();
openerUsed();
colBlasterUsed();
percentCleared_ = Math.round(board_.getPercentCleared());
var _local2 = 1000 + ((level_ - 1) * 500);
bonus_ = ((percentCleared_ * percentCleared_) * _local2) / 10000;
bonus_ = Math.round(bonus_);
if (percentCleared_ == 100) {
bonus_ = bonus_ + 2000;
}
addScore(bonus_);
if (timesUp_) {
reportPlayData(671, "", "0");
} else if (quitFlag_) {
reportPlayData(5788, "", "0");
} else {
reportPlayData(4824, "", "0");
}
reportPlayData(14, "", "" + bonus_);
if (timeLeft_ > 0) {
}
if (level_ == 3) {
com.midasplayer.fx.SoundManager.play("game over");
} else {
com.midasplayer.fx.SoundManager.play("level end");
}
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:playOutro}], callback:endPlayOutro, callback_scope:this, tps:25});
}
function quitGame() {
com.midasplayer.fx.SoundManager.stopAll();
clearInterval(quitIntervalId_);
reportGameQuit();
}
function restart(numColors, numCols, numRows) {
setScore(0);
var _local3 = 1;
var _local2 = Number(com.midasplayer.util.GameBase.gameData_.get(("level." + _local3) + ".timelimit"));
board_.setSize(numCols, numRows);
board_.setNumColors(numColors);
board_.generate();
board_.start();
startClock(_local2);
}
function getBoard() {
return(board_);
}
static function reportRemovedBlocks(num) {
blastPoints_ = blastPoints_ + (num * num);
updateBlastometer();
}
static function colBlasterUsed() {
_root.mcHitArea.removeMovieClip();
_root.mcBlastColumn.removeMovieClip();
_root.board.mcBlastometer.onPress = null;
_root.board.mcBlastometer.useHandCursor = false;
blastPoints_ = 0;
updateBlastometer();
}
static function updateBlastometer() {
var _local2 = Math.min(1, blastPoints_ / activationLimit_);
_root.board.mcBlastometer.gotoAndStop(Math.max(1, Math.floor(_local2 * 9)));
if (blastPoints_ >= activationLimit_) {
_root.board.mcBlastometer.gotoAndPlay(9);
createColumnBlaster();
}
}
static function createColumnBlaster() {
if (_root.board.mcBlastometer.onPress) {
return(undefined);
}
_root.board.mcBlastometer.useHandCursor = true;
_root.board.mcBlastometer.onPress = function () {
if (_root.mcOpener != undefined) {
return(undefined);
}
this.onPress = null;
var _local4 = _root.attachMovie("blastcolumn", "mcBlastColumn", _root.getNextHighestDepth());
_local4._x = _root.game.getBoard().columnBlasterX(_root._xmouse);
_local4._y = _root.game.getBoard().Y_OFFSET;
_local4.onMouseMove = function () {
this._x = _root.game.getBoard().columnBlasterX(_root._xmouse);
};
var _local3 = _root.attachMovie("hitArea", "mcHitArea", _root.getNextHighestDepth());
_local3._alpha = 0;
_local3._x = _root.game.getBoard().X_OFFSET;
_local3._y = _root.game.getBoard().Y_OFFSET;
_local3._width = _root.game.getBoard().getWidth();
_local3._height = _root.game.getBoard().getHeight();
_local3.onPress = function () {
_root.game.getBoard().blastCol(_root._xmouse);
};
};
}
static function openerUsed() {
_root.board.mcCogBlastometer.gotoAndStop(1);
_root.board.mcCogBlastometer.onPress = null;
_root.board.mcCogBlastometer.useHandCursor = false;
_root.mcOpenerHitArea.removeMovieClip();
_root.mcOpener.removeMovieClip();
}
static function createOpener() {
if (_root.board.mcCogBlastometer.onPress) {
return(undefined);
}
_root.board.mcCogBlastometer.gotoAndPlay(2);
_root.board.mcCogBlastometer.useHandCursor = true;
_root.board.mcCogBlastometer.onPress = function () {
if (_root.mcBlastColumn != undefined) {
return(undefined);
}
this.onPress = null;
var mcBc = _root.createEmptyMovieClip("mcOpener", _root.getNextHighestDepth());
mcBc.attachMovie("beamcog", "c1", 1);
mcBc.attachMovie("beamcog", "c2", 2);
mcBc.attachMovie("beamcog", "c3", 3);
_root.game.getBoard().positionOpener(mcBc);
mcBc.onMouseMove = function () {
if (_root.game.getBoard().usingCogBlaster_) {
return(undefined);
}
_root.game.getBoard().positionOpener(mcBc);
};
var _local3 = _root.attachMovie("hitArea", "mcOpenerHitArea", _root.getNextHighestDepth());
_local3._alpha = 0;
_local3._x = _root.game.getBoard().X_OFFSET;
_local3._y = _root.game.getBoard().Y_OFFSET;
_local3._width = _root.game.getBoard().getWidth();
_local3._height = _root.game.getBoard().getHeight();
_local3.onPress = function () {
_root.game.getBoard().opener(_root._xmouse, _root._ymouse);
};
};
}
function startClock(timeLimit) {
timeLeft_ = timeLimit;
setClockTime(timeLeft_);
stopClock();
clockIntervalId_ = setInterval(this, "updateClock", 1000);
}
static function stopClock() {
clearInterval(clockIntervalId_);
com.midasplayer.fx.SoundManager.stop("clock");
clockPlaying_ = false;
}
function updateClock(ref) {
timeLeft_--;
if (timeLeft_ <= 0) {
timeLeft_ = 0;
}
if ((timeLeft_ <= 5) && (!clockPlaying_)) {
clockPlaying_ = true;
com.midasplayer.fx.SoundManager.play("clock", 100, true);
}
setClockTime(timeLeft_);
}
function setClockTime(timeLeft) {
if (timeLeft == 0) {
timesUp_ = true;
board_.stop();
}
displayTimeLeft(timeLeft);
}
static function setScore(score) {
score_ = score;
displayScore(score_);
}
static function addScore(score) {
score_ = score_ + score;
if (score_ < 0) {
score_ = 0;
}
displayScore(score_);
}
static function getScore() {
return(score_);
}
static function displayScore(score) {
displayDigital("_root.board.mcScoreNum", score_);
}
static function displayTimeLeft(timeLeft) {
displayDigital("_root.board.mcTimeNum", timeLeft);
}
static function displayLevel(level) {
}
static function displayDigital(mcName, val) {
var stringVal = String(val);
var len = stringVal.length;
var i = 10;
while (i >= 1) {
var mc = eval (mcName + i);
var n = 1;
if (len >= i) {
n = Number(stringVal.charAt(len - i)) + 2;
}
mc.gotoAndStop(n);
i--;
}
}
static var clockPlaying_ = false;
static var blastPoints_ = 0;
}
Symbol 295 MovieClip [__Packages.com.midasplayer.game.klickklackroll.Board] Frame 0
class com.midasplayer.game.klickklackroll.Board
{
var boardClip, setBlockColor_, random_, numColors_, bombPercent_, multiplierPercent_, multiplier_, blocks_, dragList_, topLayer, scoreLayer, removeList_, usingCogBlaster_, fallBlockFlag_, checkList_;
function Board () {
boardClip = _root.createEmptyMovieClip("boardclip", _root.getNextHighestDepth());
boardClip._x = _root.board._x + X_OFFSET;
boardClip._y = _root.board._y + Y_OFFSET;
}
function onKeyUp() {
setBlockColor_ = undefined;
}
function onKeyDown() {
switch (Key.getCode()) {
case 87 :
setBlockColor_ = "w";
break;
case 82 :
setBlockColor_ = "r";
break;
case 71 :
setBlockColor_ = "g";
break;
case 66 :
setBlockColor_ = "b";
break;
case 88 :
setBlockColor_ = "x";
break;
case 89 :
setBlockColor_ = "y";
break;
case 80 :
setBlockColor_ = "p";
}
}
function setSeed(seed) {
random_ = new com.midasplayer.util.Random(seed);
}
function setSize(cols, rows) {
if ((cols_ > 0) || (rows_ > 0)) {
clear();
}
cols_ = cols;
rows_ = rows;
}
function getNumCols() {
return(cols_);
}
function getWidth() {
return(cols_ * com.midasplayer.game.klickklackroll.Block.BLOCK_WIDTH);
}
function getHeight() {
return(rows_ * com.midasplayer.game.klickklackroll.Block.BLOCK_HEIGHT);
}
function setNumColors(numColors) {
numColors_ = numColors;
}
function setBombPercent(bombPercent) {
bombPercent_ = bombPercent;
}
function setMultiplierPercent(multiplierPercent) {
multiplierPercent_ = multiplierPercent;
}
function setMultiplier(multiplier) {
multiplier_ = multiplier;
}
function generateRandomBlock(col, row) {
var _local4 = ["r", "g", "b", "y", "p", "o", "n", "d", "i", "t"];
var _local2;
var _local3 = false;
var _local5 = random_.nextInt(100);
if (_local5 < bombPercent_) {
_local2 = "x";
} else if (_local5 < (bombPercent_ + multiplierPercent_)) {
_local2 = _local4[random_.nextInt(numColors_)];
_local3 = true;
} else {
_local2 = _local4[random_.nextInt(numColors_)];
}
return(generateBlock(col, row, _local2, _local3));
}
function generateBlock(col, row, color, isMultiplier) {
var _local3 = boardClip.getNextHighestDepth();
var _local2 = com.midasplayer.game.klickklackroll.Block(boardClip.attachMovie(com.midasplayer.game.klickklackroll.Block.ID, "b" + _local3, _local3, {color:color, board:this}));
_local2.setMultiplier(isMultiplier);
_local2.setPos(col, row);
return(_local2);
}
function generateBottomBlock(col, row) {
var _local5 = "";
var _local3 = boardClip.getNextHighestDepth();
var _local2 = com.midasplayer.game.klickklackroll.Block(boardClip.attachMovie(com.midasplayer.game.klickklackroll.Block.ID, "b" + _local3, _local3, {color:_local5, board:this}));
_local2.setPos(col, row);
return(_local2);
}
function generateFromGameData(data) {
blocks_ = new Array();
dragList_ = new Array();
var _local9 = new com.midasplayer.util.StringTokenizer(data);
var _local2;
var _local8 = 0;
while (_local8 < rows_) {
blocks_[_local8] = new Array();
var _local5 = 0;
while (_local5 < cols_) {
var _local3 = _local9.nextToken();
var _local4 = false;
var _local6 = _local3.charAt(0).toLowerCase();
if (_local3.charAt(1) == "S") {
_local4 = true;
}
var _local7 = generateBlock(_local5, _local8, _local6, _local4);
if (_local7.isDragging()) {
dragList_.push(_local7);
if (_local7.col == 0) {
_local7.setFrame(1);
} else if (!_local2.isDragging()) {
_local7.setFrame(1);
} else if (_local7.col == (cols_ - 1)) {
_local7.setFrame(3);
}
} else if (_local2.isDragging()) {
_local2.setFrame(3);
}
setBlock(_local8, _local5, _local7);
_local2 = _local7;
_local5++;
}
_local8++;
}
_local8 = rows_;
blocks_[_local8] = new Array();
var _local5 = 0;
while (_local5 < cols_) {
var _local7 = generateBottomBlock(_local5, _local8);
dragList_.push(_local7);
setBlock(_local8, _local5, _local7);
_local5++;
}
topLayer.removeMovieClip();
topLayer = boardClip.createEmptyMovieClip("toplayer", boardClip.getNextHighestDepth());
scoreLayer.removeMovieClip();
scoreLayer = boardClip.createEmptyMovieClip("scorelayer", boardClip.getNextHighestDepth());
}
function generate() {
blocks_ = new Array();
dragList_ = new Array();
var _local4 = 0;
while (_local4 < rows_) {
blocks_[_local4] = new Array();
var _local2 = 0;
while (_local2 < cols_) {
var _local3 = generateRandomBlock(_local2, _local4);
if (_local3.isDragging()) {
dragList_.push(_local3);
}
setBlock(_local4, _local2, _local3);
_local2++;
}
_local4++;
}
_local4 = rows_;
blocks_[_local4] = new Array();
var _local2 = 0;
while (_local2 < cols_) {
var _local3 = generateBottomBlock(_local2, _local4);
dragList_.push(_local3);
setBlock(_local4, _local2, _local3);
_local2++;
}
topLayer.removeMovieClip();
topLayer = boardClip.createEmptyMovieClip("toplayer", boardClip.getNextHighestDepth());
scoreLayer.removeMovieClip();
scoreLayer = boardClip.createEmptyMovieClip("scorelayer", boardClip.getNextHighestDepth());
}
function start() {
acceptInput_ = true;
activate();
}
function stop() {
acceptInput_ = false;
com.midasplayer.game.klickklackroll.Game.colBlasterUsed();
deactivate();
if (!processing_) {
_root.game.endLevel();
}
}
function activate() {
var _local3 = 0;
while (_local3 <= rows_) {
var _local2 = 0;
while (_local2 < cols_) {
blocks_[_local3][_local2].activate();
_local2++;
}
_local3++;
}
}
function deactivate() {
var _local3 = 0;
while (_local3 <= rows_) {
var _local2 = 0;
while (_local2 < cols_) {
blocks_[_local3][_local2].deactivate();
_local2++;
}
_local3++;
}
}
function columnBlasterCol(mouseX) {
var _local2 = 0;
if (mouseX < X_OFFSET) {
_local2 = 0;
} else if (mouseX >= (X_OFFSET + getWidth())) {
_local2 = cols_ - 1;
} else {
_local2 = Math.floor((cols_ * (mouseX - X_OFFSET)) / getWidth());
}
return(_local2);
}
function columnBlasterX(mouseX) {
return((X_OFFSET + (columnBlasterCol(mouseX) * 30)) + 5);
}
function blastCol(mouseX) {
if (!acceptInput_) {
return(undefined);
}
if (!processing_) {
processing_ = true;
var _local2 = columnBlasterCol(mouseX);
colBlasterUsed(_local2);
com.midasplayer.game.klickklackroll.Game.colBlasterUsed();
}
}
function openerCol(mouseX) {
var _local2 = 0;
if (mouseX < X_OFFSET) {
_local2 = 0;
} else if (mouseX >= ((X_OFFSET + getWidth()) - (3 * com.midasplayer.game.klickklackroll.Block.BLOCK_WIDTH))) {
_local2 = cols_ - 3;
} else {
_local2 = Math.floor((cols_ * (mouseX - X_OFFSET)) / getWidth());
}
return(_local2);
}
function openerRow(col) {
var _local6 = 0;
var _local4 = dragList_.length;
var _local2 = 0;
while (_local2 < _local4) {
var _local3 = com.midasplayer.game.klickklackroll.Block(dragList_[_local2]);
if (_local3.col == col) {
return(_local3.row);
}
_local2++;
}
return(0);
}
function positionOpener(mc) {
var _local5 = _root._xmouse;
var _local4 = openerCol(_local5);
mc.c1._x = openerX(_local5);
mc.c1._y = openerY(_local4);
mc.c1.myCol = _local4;
mc.c1.myRow = openerRow(_local4);
mc.c2._x = openerX(_local5) + (com.midasplayer.game.klickklackroll.Block.BLOCK_WIDTH * 1);
mc.c2._y = openerY(_local4 + 1);
mc.c2.myCol = _local4 + 1;
mc.c2.myRow = openerRow(_local4 + 1);
mc.c3._x = openerX(_local5) + (com.midasplayer.game.klickklackroll.Block.BLOCK_WIDTH * 2);
mc.c3._y = openerY(_local4 + 2);
mc.c3.myCol = _local4 + 2;
mc.c3.myRow = openerRow(_local4 + 2);
}
function openerX(mouseX) {
return(X_OFFSET + (openerCol(mouseX) * com.midasplayer.game.klickklackroll.Block.BLOCK_WIDTH));
}
function openerY(col) {
return(Y_OFFSET + (openerRow(col) * com.midasplayer.game.klickklackroll.Block.BLOCK_HEIGHT));
}
function opener(mouseX, mouseY) {
if (!acceptInput_) {
return(undefined);
}
if (!processing_) {
processing_ = true;
var _local3 = _root.mcOpener;
positionOpener(_local3);
useOpener(_local3.c1.myCol, _local3.c1.myRow, _local3.c2.myCol, _local3.c2.myRow, _local3.c3.myCol, _local3.c3.myRow);
}
}
function getBlock(row, col) {
return(blocks_[row][col]);
}
function setBlock(row, col, block) {
blocks_[row][col] = block;
blocks_[row - 1][col].setBlockUnder(block);
block.setBlockUnder(blocks_[row + 1][col]);
}
function clearBlock(row, col) {
blocks_[row][col].remove();
delete blocks_[row][col];
setBlock(row, col, undefined);
affectedColsList_[col] = true;
}
function clear() {
var _local3 = 0;
while (_local3 <= rows_) {
var _local2 = 0;
while (_local2 < cols_) {
clearBlock(_local3, _local2);
_local2++;
}
_local3++;
}
}
function highlightActiveBlock() {
var _local4 = Math.floor(boardClip._xmouse / com.midasplayer.game.klickklackroll.Block.BLOCK_WIDTH);
var _local3 = Math.floor(boardClip._ymouse / com.midasplayer.game.klickklackroll.Block.BLOCK_HEIGHT);
var _local2 = com.midasplayer.game.klickklackroll.Block(blocks_[_local3][_local4]);
blockRollOver(_local2);
}
function blockRollOver(block) {
if (!processing_) {
markRollOver(block, new Array(), true);
}
}
function blockRollOut(block) {
if (!processing_) {
markRollOver(block, new Array(), false);
}
}
function blockClicked(block) {
if (!acceptInput_) {
return(undefined);
}
if (setBlockColor_ != undefined) {
var _local6 = block.row;
var _local7 = block.col;
var _local9 = boardClip.getNextHighestDepth();
var _local4 = com.midasplayer.game.klickklackroll.Block(boardClip.attachMovie(com.midasplayer.game.klickklackroll.Block.ID, "b" + _local9, _local9, {color:setBlockColor_, board:this}));
_local4.setPos(_local7, _local6);
var _local8 = com.midasplayer.game.klickklackroll.Block(blocks_[_local6][_local7]);
_local8.remove();
setBlock(_local6, _local7, _local4);
if (_local4.isDragging()) {
dragList_.push(_local4);
}
return(undefined);
}
if (!processing_) {
processing_ = true;
var _local11 = block.getX();
var _local10 = block.getY();
var _local5 = 0;
if (block.isBomb()) {
_local5 = bombClicked(block);
} else {
_local5 = markRemove(block, true);
}
_root.game.reportPlayData(651, (block.col + " ") + block.row, "" + _local5);
new com.midasplayer.game.klickklackroll.ScorePopup(this, _local5, _local11, _local10);
}
}
function bombClicked(block) {
var _local7 = 0;
var _local5 = block.col;
var _local6 = block.row;
removeList_ = new Array();
if (!blocks_[_local6 + 1][_local5].isRemovable()) {
var _local4 = _local6 - 1;
while (_local4 <= _local6) {
var _local2 = _local5 - 1;
while (_local2 <= (_local5 + 1)) {
block = com.midasplayer.game.klickklackroll.Block(blocks_[_local4][_local2]);
if (block.isRemovable()) {
removeList_.push(block);
}
_local2++;
}
_local4++;
}
com.midasplayer.fx.SoundManager.play("bomb explosion");
_local7 = 300;
_local7 = Math.round(_local7 * multiplier_);
} else {
com.midasplayer.fx.SoundManager.play("negative");
_local7 = -10;
}
com.midasplayer.game.klickklackroll.Game.addScore(_local7);
com.midasplayer.game.klickklackroll.Game.reportRemovedBlocks(removeList_.length);
remove();
return(_local7);
}
function colBlasterUsed(col) {
var _local5 = 0;
removeList_ = new Array();
var _local3 = 0;
while (_local3 < rows_) {
var _local4 = com.midasplayer.game.klickklackroll.Block(blocks_[_local3][col]);
if (_local4.isRemovable()) {
removeList_.push(_local4);
}
_local3++;
}
com.midasplayer.fx.SoundManager.play("electricity");
_local5 = 20 * removeList_.length;
_local5 = Math.round(_local5 * multiplier_);
com.midasplayer.game.klickklackroll.Game.addScore(_local5);
com.midasplayer.game.klickklackroll.Game.reportRemovedBlocks(removeList_.length);
_root.game.reportPlayData(198, col + "", "" + _local5);
remove();
return(_local5);
}
function useOpener(c1, r1, c2, r2, c3, r3) {
removeList_ = new Array();
usingCogBlaster_ = true;
com.midasplayer.fx.SoundManager.play("cogblaster");
var _local3;
_local3 = com.midasplayer.game.klickklackroll.Block(blocks_[r1][c1]);
if (_local3 != undefined) {
removeList_.push(_local3);
}
_local3 = com.midasplayer.game.klickklackroll.Block(blocks_[r2][c2]);
if (_local3 != undefined) {
removeList_.push(_local3);
}
_local3 = com.midasplayer.game.klickklackroll.Block(blocks_[r3][c3]);
if (_local3 != undefined) {
removeList_.push(_local3);
}
var _local5 = com.midasplayer.game.klickklackroll.Block(blocks_[r1][c1 - 1]);
var _local4 = com.midasplayer.game.klickklackroll.Block(blocks_[r3][c3 + 1]);
if (_local5.isDragging()) {
_local5.setFrame(3);
}
if (_local4.isDragging()) {
_local4.setFrame(1);
}
_root.game.reportPlayData(199, (((((((((c1 + " ") + r1) + " ") + c2) + " ") + r2) + " ") + c3) + " ") + r3, "0");
remove();
}
function anyMoreMoves() {
var _local4 = 0;
while (_local4 < rows_) {
var _local2 = 0;
while (_local2 < cols_) {
var _local3 = com.midasplayer.game.klickklackroll.Block(blocks_[_local4][_local2]);
var _local5 = com.midasplayer.game.klickklackroll.Block(blocks_[_local4 + 1][_local2]);
var _local6 = com.midasplayer.game.klickklackroll.Block(blocks_[_local4][_local2 + 1]);
if (_local3.isBomb()) {
if (!_local5.isRemovable()) {
return(true);
}
} else if (_local3.isRemovable()) {
if (_local3.isSameType(_local6) || (_local3.isSameType(_local5))) {
return(true);
}
}
_local2++;
}
_local4++;
}
return(false);
}
function getPercentCleared() {
var _local5 = 0;
var _local6 = rows_ * cols_;
var _local4 = 0;
while (_local4 < rows_) {
var _local2 = 0;
while (_local2 < cols_) {
var _local3 = com.midasplayer.game.klickklackroll.Block(blocks_[_local4][_local2]);
if (_local3.isRemovable()) {
_local5++;
} else if (_local3.isDragging()) {
_local6--;
}
_local2++;
}
_local4++;
}
return(100 - (100 * (_local5 / _local6)));
}
function remove() {
var _local2 = new Array();
getRemoveAnims(_local2);
playRemove(_local2);
}
function playRemove(animList) {
com.midasplayer.util.AnimPlayer.play({playlist:animList, callback:endRemove, callback_scope:this, tps:500});
}
function endRemove() {
if (usingCogBlaster_) {
usingCogBlaster_ = false;
com.midasplayer.game.klickklackroll.Game.openerUsed();
}
fallDown();
}
function getRemoveAnims(animList) {
var _local6 = removeList_.length;
if (_local6 >= 1) {
var _local2 = 0;
while (_local2 < _local6) {
var _local3 = com.midasplayer.game.klickklackroll.Block(removeList_.pop());
animList.push({obj:_local3, func:_local3.removeAnim});
_local2++;
}
}
}
function fallDown() {
var _local2 = new Array();
getFallDownAnims(_local2);
playFallDown(_local2);
}
function playFallDown(animList) {
com.midasplayer.util.AnimPlayer.play({playlist:animList, callback:endFallDown, callback_scope:this, tps:150});
}
function endFallDown() {
dragLeft();
}
function getFallDownAnims(animList) {
var _local7 = new Array();
var _local6 = 0;
while (_local6 < cols_) {
var _local2 = 0;
if (affectedColsList_[_local6]) {
var _local4 = rows_ - 1;
while (_local4 >= 0) {
var _local3 = com.midasplayer.game.klickklackroll.Block(blocks_[_local4][_local6]);
if (_local3 == undefined) {
_local2++;
} else if (!_local3.isRemovable()) {
_local2 = 0;
} else if (_local2 > 0) {
if (_local3.getFallHeight() == 0) {
_local7.push(_local3);
}
_local3.setFallHeight(_local2);
}
_local4--;
}
affectedColsList_[_local6] = false;
}
_local6++;
}
var _local10 = _local7.length;
var _local5 = 0;
while (_local5 < _local10) {
var _local3 = com.midasplayer.game.klickklackroll.Block(_local7[_local5]);
_local6 = _local3.col;
var _local4 = _local3.row;
setBlock(_local4 + _local3.getFallHeight(), _local6, blocks_[_local4][_local6]);
setBlock(_local4, _local6, undefined);
animList.push({obj:_local3, func:_local3.fallAnim});
_local5++;
}
}
function testFallBlocks() {
var _local5 = 0;
while (_local5 < cols_) {
var _local4 = 0;
if (affectedColsList_[_local5]) {
var _local2 = rows_ - 1;
while (_local2 >= 0) {
var _local3 = com.midasplayer.game.klickklackroll.Block(blocks_[_local2][_local5]);
if (_local3 == undefined) {
_local4++;
} else if (!_local3.isRemovable()) {
_local4 = 0;
} else if (_local4 > 0) {
return(true);
}
_local2--;
}
}
_local5++;
}
return(false);
}
function dragLeft() {
var _local2 = new Array();
fallBlockFlag_ = false;
while (getDragLeftAnims(_local2)) {
if (testFallBlocks()) {
fallBlockFlag_ = true;
break;
}
}
playDragLeft(_local2);
}
function playDragLeft(animList) {
com.midasplayer.util.AnimPlayer.play({playlist:animList, callback:endDragLeft, callback_scope:this, tps:260});
}
function endDragLeft() {
if (fallBlockFlag_) {
fallDown();
} else {
if ((!anyMoreMoves()) || (!acceptInput_)) {
processing_ = false;
stop();
}
processing_ = false;
highlightActiveBlock();
}
}
function getDragLeftAnims(animList) {
markId_++;
var _local11 = new Array();
var _local17 = false;
var _local18 = dragList_.length;
var _local13 = 0;
while (_local13 < _local18) {
var _local14 = com.midasplayer.game.klickklackroll.Block(dragList_[_local13]);
var _local9 = _local14.col;
var _local7 = _local14.row;
var _local3 = com.midasplayer.game.klickklackroll.Block(blocks_[_local7 - 1][_local9]);
var _local10 = com.midasplayer.game.klickklackroll.Block(blocks_[_local7 - 1][_local9 - 1]);
if (((_local9 >= 0) && (_local7 > 0)) && (_local3 == undefined)) {
var _local6 = _local9;
while (_local6 < (cols_ - 1)) {
var _local12 = com.midasplayer.game.klickklackroll.Block(blocks_[_local7][_local6]);
if (_local12 == undefined) {
break;
}
var _local5 = _local7 - 1;
while (_local5 >= 0) {
_local3 = com.midasplayer.game.klickklackroll.Block(blocks_[_local5][_local6]);
var _local2 = com.midasplayer.game.klickklackroll.Block(blocks_[_local5][_local6 + 1]);
if (_local3 == undefined) {
if (_local2.isRemovable()) {
_local2.setDragLength(_local2.getDragLength() + 1);
_local2.mark(markId_);
_local11.push(_local2);
var _local4 = _local2.col - (_local2.getDragLength() - 1);
var _local8 = _local2.row;
setBlock(_local8, _local4 - 1, blocks_[_local8][_local4]);
setBlock(_local8, _local4, undefined);
affectedColsList_[_local4 - 1] = true;
affectedColsList_[_local4] = true;
} else {
break;
}
} else {
break;
}
_local5--;
}
_local6++;
}
} else if (((_local9 > 0) && (_local7 > 0)) && (_local10 == undefined)) {
var _local6 = _local9;
while (_local6 < cols_) {
var _local12 = com.midasplayer.game.klickklackroll.Block(blocks_[_local7][_local6]);
if (_local12 == undefined) {
break;
}
var _local5 = _local7 - 1;
while (_local5 >= 0) {
_local10 = com.midasplayer.game.klickklackroll.Block(blocks_[_local5][_local6 - 1]);
_local3 = com.midasplayer.game.klickklackroll.Block(blocks_[_local5][_local6]);
if (_local10 == undefined) {
if (_local3.isRemovable()) {
_local3.setDragLength(_local3.getDragLength() + 1);
_local3.mark(markId_);
_local11.push(_local3);
var _local4 = _local3.col - (_local3.getDragLength() - 1);
var _local8 = _local3.row;
setBlock(_local8, _local4 - 1, blocks_[_local8][_local4]);
setBlock(_local8, _local4, undefined);
affectedColsList_[_local4 - 1] = true;
affectedColsList_[_local4] = true;
} else {
break;
}
} else {
break;
}
_local5--;
}
_local6++;
}
}
_local13++;
}
_local18 = _local11.length;
_local13 = 0;
while (_local13 < _local18) {
var _local14 = com.midasplayer.game.klickklackroll.Block(_local11[_local13]);
animList.push({obj:_local14, func:_local14.dragLeftAnim});
_local17 = true;
_local13++;
}
return(_local17);
}
function markRemove(block) {
var _local9 = 0;
var _local8 = new Array();
getMarkRemoveAnims(block, _local8);
var _local11 = removeList_.length;
if (_local11 == 1) {
_local9 = -10;
com.midasplayer.fx.SoundManager.play("negative");
removeList_ = new Array();
} else {
var _local10 = 0;
var _local3 = 0;
while (_local3 < _local11) {
block = com.midasplayer.game.klickklackroll.Block(removeList_[_local3]);
if (block.isMultiplier()) {
_local10++;
}
_local3++;
}
_local9 = (_local11 * _local11) * 10;
_local9 = _local9 * Math.pow(2, _local10);
com.midasplayer.fx.SoundManager.play("clearblocks");
com.midasplayer.game.klickklackroll.Game.reportRemovedBlocks(_local11);
}
_local11 = _local8.length;
var _local3 = 0;
while (_local3 < _local11) {
var _local4 = _local8[_local3];
var _local5 = _local4.length;
var _local2 = 0;
while (_local2 < _local5) {
var _local6 = _local4[_local2];
_local2++;
}
_local3++;
}
playMarkRemove(_local8);
if (_local9 > 0) {
_local9 = Math.round(_local9 * multiplier_);
}
com.midasplayer.game.klickklackroll.Game.addScore(_local9);
return(_local9);
}
function playMarkRemove(animList) {
com.midasplayer.util.AnimPlayer.play({playlist:animList, callback:endMarkRemove, callback_scope:this, tps:1000});
}
function endMarkRemove() {
topLayer.clear();
remove();
}
function getMarkRemoveAnims(initialBlock, animList) {
if (animList.length == 0) {
markId_++;
removeList_ = new Array();
checkList_ = new Array();
initialBlock.mark(markId_);
checkList_.push(initialBlock);
removeList_.push(initialBlock);
}
var _local11 = checkList_.length;
var _local7 = new Array();
var _local8 = 0;
while (_local8 < _local11) {
var _local3 = com.midasplayer.game.klickklackroll.Block(checkList_.shift());
var _local5 = _local3.col;
var _local4 = _local3.row;
var _local2;
if (!_local3.isRemovable()) {
} else {
_local2 = blocks_[_local4 - 1][_local5];
if (((_local2 != undefined) && (!_local2.isMarked(markId_))) && (initialBlock.isSameType(_local2))) {
_local7.push({obj:_local3, func:_local3.removeUpAnim});
_local2.mark(markId_);
checkList_.push(_local2);
removeList_.push(_local2);
}
_local2 = blocks_[_local4][_local5 + 1];
if (((_local2 != undefined) && (!_local2.isMarked(markId_))) && (initialBlock.isSameType(_local2))) {
_local7.push({obj:_local3, func:_local3.removeRightAnim});
_local2.mark(markId_);
checkList_.push(_local2);
removeList_.push(_local2);
}
_local2 = blocks_[_local4 + 1][_local5];
if (((_local2 != undefined) && (!_local2.isMarked(markId_))) && (initialBlock.isSameType(_local2))) {
_local7.push({obj:_local3, func:_local3.removeDownAnim});
_local2.mark(markId_);
checkList_.push(_local2);
removeList_.push(_local2);
}
_local2 = blocks_[_local4][_local5 - 1];
if (((_local2 != undefined) && (!_local2.isMarked(markId_))) && (initialBlock.isSameType(_local2))) {
_local7.push({obj:_local3, func:_local3.removeLeftAnim});
_local2.mark(markId_);
checkList_.push(_local2);
removeList_.push(_local2);
}
}
_local8++;
}
if (_local7.length > 0) {
animList.push(_local7);
}
if (checkList_.length > 0) {
getMarkRemoveAnims(initialBlock, animList);
}
}
function markRollOver(initialBlock, checkList, switchOn) {
if (checkList.length == 0) {
markId_++;
initialBlock.mark(markId_);
initialBlock.rollOverAction(switchOn);
checkList.push(initialBlock);
}
var _local10 = checkList.length;
var _local9 = 0;
while (_local9 < _local10) {
var _local6 = com.midasplayer.game.klickklackroll.Block(checkList.shift());
var _local4 = _local6.col;
var _local3 = _local6.row;
var _local2;
if (!_local6.isRemovable()) {
} else {
_local2 = blocks_[_local3 - 1][_local4];
if (((_local2 != undefined) && (!_local2.isMarked(markId_))) && (initialBlock.isSameType(_local2))) {
_local2.mark(markId_);
_local2.rollOverAction(switchOn);
checkList.push(_local2);
}
_local2 = blocks_[_local3][_local4 + 1];
if (((_local2 != undefined) && (!_local2.isMarked(markId_))) && (initialBlock.isSameType(_local2))) {
_local2.mark(markId_);
_local2.rollOverAction(switchOn);
checkList.push(_local2);
}
_local2 = blocks_[_local3 + 1][_local4];
if (((_local2 != undefined) && (!_local2.isMarked(markId_))) && (initialBlock.isSameType(_local2))) {
_local2.mark(markId_);
_local2.rollOverAction(switchOn);
checkList.push(_local2);
}
_local2 = blocks_[_local3][_local4 - 1];
if (((_local2 != undefined) && (!_local2.isMarked(markId_))) && (initialBlock.isSameType(_local2))) {
_local2.mark(markId_);
_local2.rollOverAction(switchOn);
checkList.push(_local2);
}
}
_local9++;
}
if (checkList.length > 0) {
markRollOver(initialBlock, checkList, switchOn);
}
}
var cols_ = 0;
var rows_ = 0;
var markId_ = 0;
var affectedColsList_ = new Array();
var processing_ = false;
var acceptInput_ = false;
var X_OFFSET = 77;
var Y_OFFSET = 76;
}
Symbol 296 MovieClip [__Packages.com.midasplayer.util.Random] Frame 0
class com.midasplayer.util.Random
{
var mta, mti, lastSeed;
function Random (aSeed) {
mta = new Array(N);
mti = N + 1;
if (aSeed != undefined) {
init_genrand(aSeed);
}
}
function set seed(s) {
init_genrand(s);
//return(seed);
}
function get seed() {
return(lastSeed);
}
function nextInt(n) {
return((genrand_int32() & 2147483647) % n);
}
function nextFloat() {
return(next(24) / 16777216);
}
function next(bits) {
if (bits < 32) {
return(genrand_int32() & ((1 << bits) - 1));
}
return(genrand_int32());
}
function init_genrand(s) {
var _local5 = getTimer();
lastSeed = s;
mta[0] = s;
var _local2 = s;
var _local3 = new com.midasplayer.util.Integer64();
mti = 1;
while (mti < N) {
_local3.init32((_local2 >>> 30) ^ _local2);
_local3.mulu32(1812433253);
_local2 = (mta[mti] = _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 297 MovieClip [__Packages.com.midasplayer.util.Integer64] Frame 0
class com.midasplayer.util.Integer64
{
var r, p, s;
function Integer64 (lowInt) {
r = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]];
p = [0, 0, 0, 0, 0];
s = [0, 0, 0];
if (lowInt != undefined) {
merge(lowInt);
}
}
function init(v) {
var _local2 = 0;
while (_local2 < p.length) {
p[_local2] = v.p[_local2];
_local2++;
}
}
function init32(n) {
p[0] = n & 32767;
n = n >>> 15;
p[1] = n & 32767;
n = n >>> 15;
p[2] = n & 3;
p[3] = 0;
p[4] = 0;
}
function get lsb() {
return((p[0] | (p[1] << SH)) | ((p[2] & 3) << 30));
}
function get msb() {
return((((p[2] >> 2) | ((p[3] << SH) >> 2)) | ((p[4] << (SH * 2)) >> 2)) & 2147483647);
}
function binaryShiftLeft(step) {
var _local2 = 0;
while (_local2 < step) {
shl();
_local2++;
}
}
function binaryShiftRight(step) {
var _local4 = (step / SH) >> 0;
var _local5 = step - (_local4 * SH);
var _local2 = p.length - 1;
while (_local2 > 0) {
var _local3 = 0;
while (_local3 < _local4) {
p[_local3] = p[_local3 + 1];
_local3++;
}
p[_local2--] = 0;
}
if (_local5 > 0) {
var _local3 = 0;
while (_local3 < _local5) {
shr();
_local3++;
}
}
}
function binaryNot(o) {
p[0] = p[0] ^ o.p[0];
p[1] = p[1] ^ o.p[1];
p[2] = p[2] ^ o.p[2];
p[3] = p[3] ^ o.p[3];
p[4] = p[4] ^ o.p[4];
}
function add64(o) {
var _local4 = 0;
var _local3 = 1;
var _local2 = 0;
while ((_local3 < p.length) && (o.p[_local2] != 0)) {
_local3++;
}
_local2 = 0;
while (_local2 < _local3) {
_local4 = _local4 + (p[_local2] + o.p[_local2]);
p[_local2] = _local4 & MASK;
_local4 = _local4 >> SH;
_local2++;
}
}
function add32(num) {
var _local2 = 0;
var _local5 = num & MASK;
num = num >> SH;
var _local6 = num & MASK;
num = num >> SH;
var _local4 = num & 3;
_local2 = _local2 + (p[0] + _local5);
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[1] + _local6);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[2] + _local4);
p[2] = _local2 & MASK;
}
function mulu32(num) {
var _local3 = 0;
s[0] = num & MASK;
num = num >>> 15;
s[1] = num & MASK;
num = num >>> 15;
s[2] = num & 3;
var _local2 = 0;
while (_local2 < 3) {
var _local4 = s[_local2];
_local3 = _local4 * p[0];
r[_local2][0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[1]);
r[_local2][1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[2]);
r[_local2][2] = _local3 & 3;
_local2++;
}
_local3 = r[0][0];
p[0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (r[0][1] + r[1][0]);
p[1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local3 & 3;
p[3] = 0;
p[4] = 0;
}
function mul64(o) {
var _local2 = 0;
var _local3 = 0;
while (_local3 < 5) {
var _local4 = o.p[_local3];
_local2 = _local4 * p[0];
r[_local3][0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[1]);
r[_local3][1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[2]);
r[_local3][2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[3]);
r[_local3][3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[4]);
r[_local3][4] = _local2 & MASK;
_local3++;
}
_local2 = r[0][0];
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (r[0][1] + r[1][0]);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (((r[0][3] + r[1][2]) + r[2][1]) + r[3][0]);
p[3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((((r[0][4] + r[1][3]) + r[2][2]) + r[3][1]) + r[4][0]);
p[4] = _local2 & 7;
}
function mul32(value) {
mul64(new com.midasplayer.util.Integer64(value));
}
function toString() {
return(((((("Integer64[value=0x" + com.midasplayer.util.Numbers.dec2hex(msb)) + ":") + com.midasplayer.util.Numbers.dec2hex(lsb)) + ":(") + p) + ")]");
}
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 298 MovieClip [__Packages.com.midasplayer.util.Numbers] Frame 0
class com.midasplayer.util.Numbers
{
function Numbers () {
}
static function dec2hex(iValue, padding) {
var _local1 = "";
while (iValue != 0) {
_local1 = "0123456789abcdef".charAt(iValue & 15) + _local1;
iValue = iValue >>> 4;
}
if (padding) {
if (_local1.length == 0) {
_local1 = "00";
}
if (_local1.length < 2) {
_local1 = "0" + _local1;
}
} else if (_local1.length == 0) {
_local1 = "0";
}
return(_local1);
}
static function itoa(value, numZeroPadding) {
var _local2 = "" + value;
if (numZeroPadding) {
var _local1 = numZeroPadding - 1;
while (_local1 > 0) {
if (value < Math.pow(10, _local1)) {
_local2 = "0" + _local2;
}
_local1--;
}
}
return(_local2);
}
static function asTime(millis, alwaysHours, alwaysMinutes) {
if (alwaysHours) {
alwaysMinutes = true;
}
if (millis < 0) {
millis = 0;
}
millis = millis / 1000;
millis = Math.floor(millis);
var _local3 = Math.floor(millis / 3600);
var _local4 = Math.floor(millis / 60) % 60;
var _local5 = millis % 60;
var _local1 = "";
if (alwaysHours || (_local3 > 0)) {
_local1 = _local1 + itoa(_local3, 2);
}
if (alwaysHours || (_local1.length > 0)) {
_local1 = _local1 + ":";
}
var _local6 = _local1.length;
if ((alwaysMinutes || (_local4 > 0)) || (_local3 > 0)) {
_local1 = _local1 + itoa(_local4, 2);
}
if (alwaysMinutes || (_local1.length != _local6)) {
_local1 = _local1 + ":";
}
return(_local1 + itoa(_local5, 2));
}
}
Symbol 299 MovieClip [__Packages.com.midasplayer.game.klickklackroll.Block] Frame 0
class com.midasplayer.game.klickklackroll.Block extends MovieClip
{
static var blockClipNames;
var color, clip_, useHandCursor, attachMovie, col, row, markId_, removeMovieClip, board;
function Block () {
super();
init(color);
deactivate();
clip_.cacheAsBitmap = true;
}
static function staticInitializer(Void) {
blockClipNames = new Array();
blockClipNames.r = "block_red";
blockClipNames.g = "block_green";
blockClipNames.b = "block_blue";
blockClipNames.n = "block_brown";
blockClipNames.d = "block_darkgreen";
blockClipNames.i = "block_pink";
blockClipNames.t = "block_turquoise";
blockClipNames.o = "block_orange";
blockClipNames.p = "block_purple";
blockClipNames.y = "block_yellow";
blockClipNames.w = "block_wall";
blockClipNames.x = "block_bomb";
return(true);
}
function activate() {
useHandCursor = true;
clip_.gotoAndStop(currentFrame_);
}
function deactivate() {
useHandCursor = false;
}
function init(type) {
if (type.length > 0) {
clip_ = attachMovie(getBlockClipName(type), "clip", 1);
if (isWall()) {
currentFrame_ = 2;
} else if (isMultiplier()) {
currentFrame_ = 3;
} else {
currentFrame_ = 1;
}
}
clip_.gotoAndStop(currentFrame_);
}
function setFrame(frame) {
currentFrame_ = frame;
clip_.gotoAndStop(currentFrame_);
}
function setPos(col, row) {
this.col = col;
this.row = row;
clip_._x = col * BLOCK_WIDTH;
clip_._y = row * BLOCK_HEIGHT;
}
function setMultiplier(isMultiplier) {
isMultiplier_ = isMultiplier;
if (isMultiplier_) {
currentFrame_ = 3;
clip_.gotoAndStop(currentFrame_);
}
}
function isMultiplier() {
return(isMultiplier_);
}
function getBlockClipName(name) {
return(blockClipNames[name]);
}
function getType() {
return(color);
}
function getCol() {
return(col);
}
function getRow() {
return(row);
}
function getX() {
return(clip_._x);
}
function getY() {
return(clip_._y);
}
function mark(id) {
markId_ = id;
}
function setBlockUnder(block) {
if (isBomb() && (!block.isRemovable())) {
currentFrame_ = 3;
bombActive_ = true;
} else {
bombActive_ = false;
if (isWall()) {
} else if (isMultiplier()) {
currentFrame_ = 3;
} else {
currentFrame_ = 1;
}
}
clip_.gotoAndStop(currentFrame_);
}
function isMarked(id) {
return(markId_ == id);
}
function isWall() {
return(color == "w");
}
function isRemovable() {
if ((color == "w") || (color == "")) {
return(false);
}
return(true);
}
function isDragging() {
if (color == "w") {
return(true);
}
return(false);
}
function isBomb() {
if (color == "x") {
return(true);
}
return(false);
}
function isSameType(block) {
if (block == undefined) {
return(false);
}
if (block.getType() == getType()) {
return(true);
}
return(false);
}
function setFallHeight(height) {
fallHeight_ = height;
}
function getFallHeight() {
return(fallHeight_);
}
function setDragLength(length) {
dragLength_ = length;
}
function getDragLength() {
return(dragLength_);
}
function fallAnim(tick, alpha) {
var _local3 = false;
var _local5 = row * BLOCK_HEIGHT;
var _local2 = fallHeight_ * BLOCK_HEIGHT;
var _local4 = (_local2 * tick) / 12;
if (_local4 > _local2) {
_local4 = _local2;
_local3 = true;
}
clip_._y = (row * BLOCK_HEIGHT) + _local4;
if (_local3) {
setPos(col, row + fallHeight_);
fallHeight_ = 0;
}
return(_local3);
}
function dragLeftAnim(tick, alpha) {
var _local2 = false;
var _local3 = col * BLOCK_WIDTH;
var _local4 = dragLength_ * BLOCK_WIDTH;
clip_._x = _local3 - tick;
if (tick > _local4) {
_local2 = true;
}
if (_local2) {
setPos(col - dragLength_, row);
dragLength_ = 0;
}
return(_local2);
}
function dragRightAnim(tick, alpha) {
var _local2 = false;
var _local3 = col * BLOCK_WIDTH;
var _local4 = dragLength_ * BLOCK_WIDTH;
clip_._x = _local3 + tick;
if (tick > _local4) {
_local2 = true;
}
if (_local2) {
setPos(col + dragLength_, row);
dragLength_ = 0;
}
return(_local2);
}
function remove() {
clip_.removeMovieClip();
removeMovieClip();
}
function removeUpAnim(tick, alpha) {
var _local3 = false;
var _local5 = clip_._x + (clip_._width / 2);
var _local4 = clip_._y + (clip_._height / 2);
var _local2 = tick * 2.2;
if (_local2 > clip_._width) {
_local2 = clip_._width;
_local3 = true;
}
board.topLayer.lineStyle(5, 16777215, 30);
board.topLayer.moveTo(_local5, _local4);
board.topLayer.lineTo(_local5, _local4 - _local2);
return(_local3);
}
function removeRightAnim(tick, alpha) {
var _local3 = false;
var _local5 = clip_._x + (clip_._width / 2);
var _local4 = clip_._y + (clip_._height / 2);
var _local2 = tick * 2.2;
if (_local2 > clip_._width) {
_local2 = clip_._width;
_local3 = true;
}
board.topLayer.lineStyle(5, 16777215, 30);
board.topLayer.moveTo(_local5, _local4);
board.topLayer.lineTo(_local5 + _local2, _local4);
return(_local3);
}
function removeDownAnim(tick, alpha) {
var _local3 = false;
var _local5 = clip_._x + (clip_._width / 2);
var _local4 = clip_._y + (clip_._height / 2);
var _local2 = tick * 2.2;
if (_local2 > clip_._width) {
_local2 = clip_._width;
_local3 = true;
}
board.topLayer.lineStyle(5, 16777215, 30);
board.topLayer.moveTo(_local5, _local4);
board.topLayer.lineTo(_local5, _local4 + _local2);
return(_local3);
}
function removeLeftAnim(tick, alpha) {
var _local3 = false;
var _local5 = clip_._x + (clip_._width / 2);
var _local4 = clip_._y + (clip_._height / 2);
var _local2 = tick * 2.2;
if (_local2 > clip_._width) {
_local2 = clip_._width;
_local3 = true;
}
board.topLayer.lineStyle(5, 16777215, 30);
board.topLayer.moveTo(_local5, _local4);
board.topLayer.lineTo(_local5 - _local2, _local4);
return(_local3);
}
function removeAnim(tick, alpha) {
var _local3 = false;
if (isDragging()) {
if (tick > 300) {
board.clearBlock(row, col);
com.midasplayer.fx.SoundManager.stop("cogblaster");
return(true);
}
return(false);
}
var _local2 = tick * 5;
if (_local2 > 100) {
_local2 = 100;
board.clearBlock(row, col);
_local3 = true;
}
clip_._alpha = 100 - _local2;
return(_local3);
}
function onRollOver() {
board.blockRollOver(this);
}
function rollOverAction(switchOn) {
if (switchOn) {
if (isRemovable()) {
if (isMultiplier() || (bombActive_)) {
currentFrame_ = 4;
if (!useHandCursor) {
return(undefined);
}
clip_.gotoAndStop(currentFrame_);
} else {
currentFrame_ = 2;
if (!useHandCursor) {
return(undefined);
}
clip_.gotoAndStop(currentFrame_);
}
}
} else if (isRemovable()) {
if (isMultiplier() || (bombActive_)) {
currentFrame_ = 3;
if (!useHandCursor) {
return(undefined);
}
clip_.gotoAndStop(currentFrame_);
} else {
currentFrame_ = 1;
if (!useHandCursor) {
return(undefined);
}
clip_.gotoAndStop(currentFrame_);
}
}
}
function onDragOut() {
board.blockRollOut(this);
}
function onRollOut() {
board.blockRollOut(this);
}
function onPress() {
if (useHandCursor == false) {
return(undefined);
}
board.blockRollOut(this);
board.blockClicked(this);
}
static var ID = "__Packages.com.midasplayer.game.klickklackroll.Block";
static var CLASS = Object.registerClass(ID, com.midasplayer.game.klickklackroll.Block);
static var BLOCK_HEIGHT = 30;
static var BLOCK_WIDTH = 30;
var fallHeight_ = 0;
var dragLength_ = 0;
var isMultiplier_ = false;
var currentFrame_ = 1;
var bombActive_ = false;
static var staticInitialized = staticInitializer();
}
Symbol 300 MovieClip [__Packages.com.midasplayer.fx.SoundManager] Frame 0
class com.midasplayer.fx.SoundManager
{
function SoundManager () {
}
static function isSoundEnabled() {
return(soundEnabled);
}
static function enableSounds(enabled) {
soundEnabled = enabled;
if (!enabled) {
muteAll();
} else {
restoreMuteAll();
}
}
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);
});
}
static function restoreMuteAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.setVolume(soundEntry.realVol);
});
}
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);
_local1.sound.setVolume(_local2);
_local1.sound.volume = _local2;
}
}
static function getVolume(resource) {
var _local1 = sounds.get(resource);
if ((_local1 != undefined) && (_local1.playStatus == true)) {
return(_local1.sound.getVolume());
}
return(0);
}
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.midasplayer.fx.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.playStatus = true;
_local2.onPlayedFn = fn;
_local2.sound.start(0, (isLoop ? 32767 : 1));
} else {
var _local6 = _root.getNextHighestDepth();
var _local4 = new Sound(_root.createEmptyMovieClip("sm_sndhold_" + _local6, _local6));
_local4.attachSound(resource);
_local4.onSoundComplete = function () {
var _local1 = com.midasplayer.fx.SoundManager.sounds.get(resource);
_local1.playStatus = false;
com.midasplayer.fx.SoundManager.onPlayed_(resource);
};
_local4.setVolume((soundEnabled ? (volume) : 0));
_local4.start(0, (isLoop ? 32767 : 1));
sounds.put(resource, {realVol:volume, onPlayedFn:fn, sound:_local4, playStatus:true});
}
}
static function onPlayed_(name) {
var _local1 = sounds.get(name);
if ((_local1 != undefined) && (_local1.onPlayedFn != undefined)) {
_local1.onPlayedFn();
}
}
static var sounds = new com.midasplayer.util.Map();
static var soundEnabled = true;
}
Symbol 301 MovieClip [__Packages.com.midasplayer.util.StringTokenizer] Frame 0
class com.midasplayer.util.StringTokenizer
{
var str_, index_, delim;
function StringTokenizer (str) {
str_ = str;
index_ = 0;
delim = " ";
}
function hasMoreTokens() {
var _local2 = str_.indexOf(delim, index_);
return(_local2 != -1);
}
function nextToken() {
var _local2 = str_.indexOf(delim, index_);
if (_local2 == -1) {
_local2 = str_.length;
}
var _local3 = str_.substring(index_, _local2);
index_ = _local2 + 1;
return(_local3);
}
}
Symbol 302 MovieClip [__Packages.com.midasplayer.game.klickklackroll.ScorePopup] Frame 0
class com.midasplayer.game.klickklackroll.ScorePopup
{
var clip_, y_;
function ScorePopup (board, score, x, y) {
var _local2 = board.scoreLayer.getNextHighestDepth();
if (score < 0) {
clip_ = board.scoreLayer.attachMovie("minuspoints", "s" + _local2, _local2);
clip_._x = x + (com.midasplayer.game.klickklackroll.Block.BLOCK_WIDTH / 2);
clip_._y = y + (com.midasplayer.game.klickklackroll.Block.BLOCK_HEIGHT / 2);
y_ = clip_._y;
clip_._alpha = 0;
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showScore}], callback:endShowScore, callback_scope:this, tps:90});
} else {
clip_ = board.scoreLayer.attachMovie("scorePopup", "s" + _local2, _local2);
clip_._x = x;
clip_._y = y + (com.midasplayer.game.klickklackroll.Block.BLOCK_HEIGHT / 2);
y_ = clip_._y;
clip_._alpha = 0;
displayDigital(("_root.boardclip.scorelayer.s" + _local2) + ".score", score);
var _local4 = Math.floor(Math.log(score) / Math.LN10) + 1;
var _local6 = _local4 * 7.5;
clip_._x = clip_._x - (_local6 / 2);
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showScore}], callback:endShowScore, callback_scope:this, tps:90});
}
}
function displayDigital(mcName, val) {
var stringVal = String(val);
var len = stringVal.length;
var i = 10;
while (i >= 1) {
var mc = eval (mcName + i);
var n = 1;
if (len >= i) {
n = Number(stringVal.charAt(len - i)) + 2;
}
mc.gotoAndStop(n);
i--;
}
}
function showScore(tick, alpha) {
var _local5 = false;
alpha = 0;
var _local3 = 0;
if (tick < 20) {
alpha = (tick * tick) / 4;
_local3 = 20 * (alpha / 100);
} else if (tick < 50) {
alpha = 100;
_local3 = 20;
} else if (tick < 70) {
alpha = ((70 - tick) * (70 - tick)) / 4;
_local3 = 20 + (20 * ((100 - alpha) / 100));
} else {
alpha = 0;
_local3 = 40;
_local5 = true;
}
clip_._alpha = alpha;
clip_._y = y_ - _local3;
return(_local5);
}
function endShowScore() {
clip_.removeMovieClip();
}
}
Symbol 303 MovieClip [__Packages.com.midasplayer.util.AnimPlayer] Frame 0
class com.midasplayer.util.AnimPlayer
{
static var clip_;
function AnimPlayer () {
}
static function staticInitializer(Void) {
clip_ = _root.createEmptyMovieClip("timer", _root.getNextHighestDepth());
clip_.onEnterFrame = function () {
com.midasplayer.util.AnimPlayer.onEnterFrame();
};
return(true);
}
static function play(props) {
animId_++;
var _local3 = props.playlist;
var _local4 = props.callback;
var _local5 = props.callback_scope;
var _local1 = props.tps;
if (_local1 == undefined) {
_local1 = 100;
}
callbacks_.put(animId_, _local4);
callbackScopes_.put(animId_, _local5);
animEntries_.put(animId_, new com.midasplayer.util.AnimEntry(_local3, animId_));
timers_.put(animId_, new com.midasplayer.timing.Timer(com.midasplayer.util.AnimEntry(animEntries_.get(animId_)), _local1));
}
static function end(animId) {
delete eval (timers_.get(animId));
timers_.remove(animId);
delete eval (animEntries_.get(animId));
animEntries_.remove(animId);
var _local2 = callbacks_.get(animId);
callbacks_.remove(animId);
var _local3 = callbackScopes_.get(animId);
callbackScopes_.remove(animId);
_local2.call(_local3);
}
static function onEnterFrame() {
timers_.foreach(function (key, obj) {
com.midasplayer.timing.Timer(obj).advanceTime();
});
}
static var animId_ = 0;
static var animEntries_ = new com.midasplayer.util.Map();
static var timers_ = new com.midasplayer.util.Map();
static var callbacks_ = new com.midasplayer.util.Map();
static var callbackScopes_ = new com.midasplayer.util.Map();
static var staticInitialized = staticInitializer();
}
Symbol 304 MovieClip [__Packages.com.midasplayer.timing.Timeable] Frame 0
interface com.midasplayer.timing.Timeable
{
}
Symbol 305 MovieClip [__Packages.com.midasplayer.util.AnimEntry] Frame 0
class com.midasplayer.util.AnimEntry implements com.midasplayer.timing.Timeable
{
var playList_, animId_;
function AnimEntry (playList, animId) {
playList_ = playList;
animId_ = animId;
}
function tick(tick) {
}
function render(tick, alpha) {
if (baseTick_ == -1) {
baseTick_ = tick;
}
var _local2 = play(playList_, tick - baseTick_, alpha);
if (_local2) {
com.midasplayer.util.AnimPlayer.end(animId_);
}
}
function play(playList, tick, alpha) {
var _local11 = playList.length;
var _local4 = true;
var _local3 = 0;
while (_local3 < _local11) {
var _local2 = playList[_local3];
if (_local2 == undefined) {
} else if (_local2.length == undefined) {
var _local9 = _local2.func;
var _local8 = _local2.obj;
var _local6 = _local9.call(_local8, tick, alpha);
if (_local6) {
playList[_local3] = undefined;
} else {
_local4 = false;
}
} else {
var _local6 = play(_local2, tick, alpha);
if (_local6) {
playList[_local3] = undefined;
baseTick_ = baseTick_ + tick;
_local4 = false;
break;
}
_local4 = false;
break;
}
_local3++;
}
return(_local4);
}
var baseTick_ = -1;
}
Symbol 306 MovieClip [__Packages.com.midasplayer.timing.Timer] Frame 0
class com.midasplayer.timing.Timer
{
var gameTicksPerSecond, timeable;
function Timer (timeable, gameTicksPerSecond) {
this.gameTicksPerSecond = gameTicksPerSecond;
millisPerGameTick = 1000 / gameTicksPerSecond;
this.timeable = timeable;
}
function advanceTime() {
time = getTimer();
var _local3 = time - lastTime;
lastTime = time;
unprocessedTime = unprocessedTime + _local3;
var _local2 = 0;
while (unprocessedTime > millisPerGameTick) {
unprocessedTime = unprocessedTime - millisPerGameTick;
timeable.tick(tick);
tick++;
if ((tick % gameTicksPerSecond) == 0) {
fps = frames;
frames = 0;
}
_local2++;
if (_local2 >= 10) {
unprocessedTime = 0;
}
}
var _local4 = unprocessedTime / millisPerGameTick;
timeable.render(tick, _local4);
frames++;
}
var time = 0;
var lastTime = 0;
var unprocessedTime = 0;
var tick = 0;
var millisPerGameTick = 0;
var fps = 0;
var frames = 0;
}