Frame 1
_root.gamemode = 2;
var game = (new com.midasplayer.game.klickklackturn.Game());
stop();
Symbol 35 MovieClip [finger] Frame 1
_root.game.instructionsAnim(0);
stop();
Symbol 35 MovieClip [finger] Frame 20
_root.game.instructionsAnim(1);
stop();
Symbol 35 MovieClip [finger] Frame 40
_root.game.instructionsAnim(2);
stop();
Symbol 35 MovieClip [finger] Frame 60
_root.game.instructionsAnim(3);
stop();
Symbol 35 MovieClip [finger] Frame 80
_root.game.instructionsAnim(4);
stop();
Symbol 35 MovieClip [finger] Frame 100
_root.game.instructionsAnim(5);
stop();
Symbol 70 MovieClip Frame 1
stop();
Symbol 70 MovieClip Frame 2
stop();
Symbol 99 MovieClip Frame 18
stop();
Symbol 99 MovieClip Frame 28
stop();
Symbol 99 MovieClip Frame 38
stop();
Symbol 100 MovieClip Frame 1
nut.gotoAndPlay("start");
Symbol 100 MovieClip Frame 138
nut.gotoAndStop("snurr");
Symbol 100 MovieClip Frame 184
nut.gotoAndStop("flax");
Symbol 100 MovieClip Frame 213
nut.gotoAndStop("stop");
stop();
Symbol 127 MovieClip Frame 1
function randomize(min, max) {
var _local1 = Math.floor(Math.random() * ((max - min) + 1)) + min;
return(_local1);
}
_rotation = randomize(10, 150);
_xscale = randomize(50, 100);
_yscale = _xscale;
Symbol 127 MovieClip Frame 30
if (_parent.halt) {
stop();
}
Symbol 128 MovieClip Frame 28
stop();
Symbol 130 MovieClip [mc_wrench] Frame 129
_root.wrench.gotoAndPlay(2);
Symbol 130 MovieClip [mc_wrench] Frame 131
stop();
Symbol 131 MovieClip [wrench2] Frame 235
stop();
Symbol 217 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);
}
static function reportGameStart() {
com.midasplayer.util.Log.debug("gameStart");
fscommand ("gameStart");
}
static function reportGameEnd(score) {
com.midasplayer.util.Log.debug("gameEnd " + String(score));
fscommand ("gameEnd", String(score));
}
static 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));
}
static 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);
}
com.midasplayer.util.Log.debug("playData " + _local1);
trace(_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);
}
}
gameData.put(((_local1.nodeName + ".") + _local3) + ".nodeData", _local1.firstChild);
}
_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 218 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 + "x";
_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 219 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 _local3 = new com.midasplayer.util.ArrayList();
var _local2 = from;
while (_local2 < to) {
_local3.insert(get(_local2));
_local2++;
}
return(_local3);
}
}
Symbol 220 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 221 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 222 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 _local3 = translations_.get(name);
if (_local3 == undefined) {
return(("{" + name) + "}");
}
var _local1 = _local3.toString();
if (replace0 != undefined) {
var _local2 = _local1.split("{0}");
_local1 = _local2.join(replace0);
if (replace1 != undefined) {
_local2 = _local1.split("{1}");
_local1 = _local2.join(replace1);
if (replace2 != undefined) {
_local2 = _local1.split("{2}");
_local1 = _local2.join(replace2);
}
}
}
return(_local1);
}
static var translations_ = new com.midasplayer.util.Map();
}
Symbol 223 MovieClip [__Packages.com.midasplayer.game.klickklackturn.Game] Frame 0
class com.midasplayer.game.klickklackturn.Game extends com.midasplayer.util.GameBase
{
static var seed_, random_, clearLimit_, board_, introBoard_, percentCleared_, bonus_, score_, quitIntervalId_, timeLimit_, clockIntervalId_;
var init, level_, quitFlag_, timesUp_, soundOn_, continuePlay_, timeLeft_;
function Game () {
super();
Stage.showMenu = false;
Stage.scaleMode = "noScale";
_root._quality = "high";
_root._focusrect = false;
com.midasplayer.util.GameBase.setGameMode(_root.gamemode);
com.midasplayer.util.Log.setLevel(com.midasplayer.util.Log.LEVEL_NONE);
init(this);
}
function startGame() {
seed_ = Number(com.midasplayer.util.GameBase.gameData.get("seed"));
random_ = new com.midasplayer.util.Random(seed_);
com.midasplayer.util.GameBase.reportGameStart();
com.midasplayer.util.GameBase.reportPlayData(19, (VERSION + " ") + seed_, "0");
_root.gotoAndStop(2);
_root.board.gotoAndStop(1);
_root.time.gotoAndStop(1);
setScore(0);
_root.txt_level.text = com.midasplayer.util.I18n.format("level");
_root.txt_score.text = com.midasplayer.util.I18n.format("score");
_root.sound.text = com.midasplayer.util.I18n.format("sound_off");
_root.endgame.text = com.midasplayer.util.I18n.format("exit_game");
_root.endgamebox.onPress = function () {
if ((_root.levelsign == undefined) && (_root.introsign == undefined)) {
_root.game.endGame();
}
};
_root.endgame._visible = false;
_root.endgamebox.useHandCursor = false;
soundOnOff();
level_ = 1;
startLevel(level_);
}
function activateArrows() {
_root.arrowLeft.onRollOver = (_root.arrowLeft.onDragOver = function () {
this.gotoAndStop(2);
});
_root.arrowLeft.onRollOut = (_root.arrowLeft.onDragOut = function () {
this.gotoAndStop(1);
});
_root.arrowRight.onRollOver = (_root.arrowRight.onDragOver = function () {
this.gotoAndStop(2);
});
_root.arrowRight.onRollOut = (_root.arrowRight.onDragOut = function () {
this.gotoAndStop(1);
});
_root.arrowLeft.onPress = function () {
_root.game.getBoard().rotateLeft();
};
_root.arrowRight.onPress = function () {
_root.game.getBoard().rotateRight();
};
_root.arrowLeft.useHandCursor = true;
_root.arrowRight.useHandCursor = true;
Key.addListener(this);
}
function deactivateArrows() {
_root.arrowLeft.onRollOver = (_root.arrowLeft.onDragOver = undefined);
_root.arrowLeft.onRollOut = (_root.arrowLeft.onDragOut = undefined);
_root.arrowRight.onRollOver = (_root.arrowRight.onDragOver = undefined);
_root.arrowRight.onRollOut = (_root.arrowRight.onDragOut = undefined);
_root.arrowLeft.gotoAndStop(1);
_root.arrowRight.gotoAndStop(1);
_root.arrowLeft.onPress = undefined;
_root.arrowRight.onPress = undefined;
_root.arrowLeft.useHandCursor = false;
_root.arrowRight.useHandCursor = false;
Key.removeListener(this);
}
function onKeyDown() {
if (Key.isDown(39)) {
_root.game.getBoard().rotateRight();
}
if (Key.isDown(37)) {
_root.game.getBoard().rotateLeft();
}
}
function startLevel(level) {
if (quitFlag_) {
return(undefined);
}
timesUp_ = false;
var _local9 = Number(com.midasplayer.util.GameBase.gameData.get(("level." + level) + ".width"));
var _local5 = Number(com.midasplayer.util.GameBase.gameData.get(("level." + level) + ".height"));
var _local8 = Number(com.midasplayer.util.GameBase.gameData.get(("level." + level) + ".colors"));
var _local7 = Number(com.midasplayer.util.GameBase.gameData.get(("level." + level) + ".bomb_percent"));
var _local10 = Number(com.midasplayer.util.GameBase.gameData.get(("level." + level) + ".multiplier_percent"));
var _local6 = Number(com.midasplayer.util.GameBase.gameData.get(("level." + level) + ".timelimit"));
clearLimit_ = Number(com.midasplayer.util.GameBase.gameData.get(("level." + level) + ".clear"));
_root.board.gotoAndStop(level);
displayTimeLeft(_local6);
displayLevel(level);
if (board_ == null) {
board_ = new com.midasplayer.game.klickklackturn.Board(_root, _root.board, false);
}
var _local4 = random_.nextInt(10000000);
board_.setSeed(_local4);
board_.setSize(_local9, _local5);
board_.setNumColors(_local8);
board_.setBombPercent(_local7);
board_.setMultiplierPercent(_local10);
board_.setMultiplier(1 + ((level_ - 1) * 0.1));
board_.generate();
com.midasplayer.util.GameBase.reportPlayData(132, "" + _local4, "0");
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();
if (board_) {
board_.stop();
} else {
endLevel();
}
}
function soundOnOff() {
if ((soundOn_ == undefined) || (soundOn_ == false)) {
soundOn_ = true;
_root.soundbox.onPress = function () {
_root.game.soundOnOff();
};
com.midasplayer.fx.SoundManager.enableSounds(soundOn_);
_root.sound.text = com.midasplayer.util.I18n.format("sound_off");
} else {
soundOn_ = false;
_root.soundbox.onPress = function () {
_root.game.soundOnOff();
};
com.midasplayer.fx.SoundManager.enableSounds(soundOn_);
_root.sound.text = com.midasplayer.util.I18n.format("sound_on");
}
}
function playLoop() {
com.midasplayer.fx.SoundManager.play("game_loop#1", 75, true);
}
function startBoard() {
if (quitFlag_) {
return(undefined);
}
activateArrows();
_root.endgame._visible = true;
_root.endgamebox.useHandCursor = true;
board_.start();
_root.board.level.gotoAndStop(level_ + 1);
var _local3 = Number(com.midasplayer.util.GameBase.gameData.get(("level." + level_) + ".timelimit"));
startClock(_local3);
com.midasplayer.fx.SoundManager.stop("intro#1");
com.midasplayer.fx.SoundManager.play("level_starts#1", 100, false, playLoop);
}
function startPlayIntro() {
com.midasplayer.fx.SoundManager.play("intro#1");
_root.attachMovie("mc_instructions", "introsign", _root.getNextHighestDepth());
_root.introsign._x = 343;
_root.introsign._y = 245;
_root.introsign.info.header.text = com.midasplayer.util.I18n.format("instructions_header");
_root.introsign.info.txt1.text = com.midasplayer.util.I18n.format("instructions_txt1");
_root.introsign.info.txt2.text = com.midasplayer.util.I18n.format("instructions_txt2");
_root.introsign.info.starts.text = com.midasplayer.util.I18n.format("game_starts_in");
_root.introsign.info.start.text = com.midasplayer.util.I18n.format("start");
introBoard_ = new com.midasplayer.game.klickklackturn.Board(_root, _root.introsign.introboard, true);
introBoard_.setSeed(2);
introBoard_.setSize(4, 4);
introBoard_.setNumColors(3);
introBoard_.setBombPercent(0);
introBoard_.setMultiplierPercent(10);
introBoard_.setMultiplier(1);
introBoard_.generate();
introBoard_.start();
_root.attachMovie("finger", "finger", _root.getNextHighestDepth());
_root.finger._x = 235;
_root.finger._y = 309;
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 instructionsAnim(pos) {
if (pos == 0) {
com.midasplayer.util.AnimPlayer.delay({millis:1500, callback:playFinger, callback_scope:this});
} else if (pos == 1) {
com.midasplayer.util.AnimPlayer.delay({millis:500, callback:click1, callback_scope:this});
com.midasplayer.util.AnimPlayer.delay({millis:1500, callback:playFinger, callback_scope:this});
} else if (pos == 2) {
com.midasplayer.util.AnimPlayer.delay({millis:500, callback:click2, callback_scope:this});
com.midasplayer.util.AnimPlayer.delay({millis:2000, callback:playFinger, callback_scope:this});
} else if (pos == 3) {
com.midasplayer.util.AnimPlayer.delay({millis:500, callback:click3, callback_scope:this});
com.midasplayer.util.AnimPlayer.delay({millis:1500, callback:playFinger, callback_scope:this});
} else if (pos == 4) {
com.midasplayer.util.AnimPlayer.delay({millis:500, callback:click4, callback_scope:this});
com.midasplayer.util.AnimPlayer.delay({millis:1500, callback:playFinger, callback_scope:this});
} else if (pos == 5) {
com.midasplayer.util.AnimPlayer.delay({millis:1000, callback:click5, callback_scope:this});
}
}
function click1() {
_root.finger._yscale = 80;
introBoard_.blockClicked(introBoard_.getBlock(3, 2));
com.midasplayer.util.AnimPlayer.delay({millis:500, callback:unclick, callback_scope:this});
}
function click2() {
_root.finger._yscale = 80;
introBoard_.rotateRight();
com.midasplayer.util.AnimPlayer.delay({millis:500, callback:unclick, callback_scope:this});
}
function click3() {
_root.finger._yscale = 80;
introBoard_.blockClicked(introBoard_.getBlock(2, 2));
com.midasplayer.util.AnimPlayer.delay({millis:500, callback:unclick, callback_scope:this});
}
function click4() {
_root.finger._yscale = 80;
introBoard_.blockClicked(introBoard_.getBlock(2, 1));
com.midasplayer.util.AnimPlayer.delay({millis:500, callback:unclick, callback_scope:this});
}
function click5() {
_root.finger._yscale = 80;
introBoard_.blockClicked(introBoard_.getBlock(3, 0));
com.midasplayer.util.AnimPlayer.delay({millis:500, callback:unclick, callback_scope:this});
}
function unclick() {
_root.finger._yscale = 100;
}
function playFinger() {
_root.finger.play();
}
function playIntro(tick, alpha) {
var _local3 = false;
if (tick > 25) {
_root.introsign.onPress = function () {
this.clicked = true;
};
}
var _local4 = 15 - Math.round(tick / 25);
if (_local4 <= 0) {
_local3 = true;
} else {
_root.introsign.info.secs.text = _local4;
}
if (_root.introsign.clicked) {
_local3 = true;
}
return(_local3);
}
function endPlayIntro() {
_root.finger.removeMovieClip();
_root.introsign.removeMovieClip();
introBoard_.stop();
introBoard_.clear();
_root.boardlayer.removeMovieClip();
startBoard();
}
function startPlayLevelSign() {
com.midasplayer.fx.SoundManager.stop("game_loop#1");
continuePlay_ = ((percentCleared_ >= clearLimit_) && (areMoreLevels())) && (!quitFlag_);
_root.attachMovie("mc_nextlevel", "levelsign", _root.getNextHighestDepth());
_root.levelsign._x = 343;
_root.levelsign._y = 245;
_root.levelsign.fig.gotoAndStop(level_ - 1);
_root.levelsign.info.header.text = com.midasplayer.util.I18n.format("level_finished", "" + (level_ - 1));
if (timeLeft_ == 0) {
_root.levelsign.info.txt1.text = com.midasplayer.util.I18n.format("time_is_out");
} else {
_root.levelsign.info.txt1.text = com.midasplayer.util.I18n.format("no_more_moves");
}
_root.levelsign.info.txt_score.text = com.midasplayer.util.I18n.format("score");
_root.levelsign.info.txt_bonus.text = com.midasplayer.util.I18n.format("bonus");
_root.levelsign.info.txt_total.text = com.midasplayer.util.I18n.format("total");
if (percentCleared_ >= clearLimit_) {
if (!areMoreLevels()) {
_root.levelsign.info.thumb.gotoAndStop(3);
} else {
if (!quitFlag_) {
_root.levelsign.info.txt1.text = _root.levelsign.info.txt1.text + ((((newline + com.midasplayer.util.I18n.format("qualified")) + " (") + clearLimit_) + "%)");
}
_root.levelsign.info.thumb.gotoAndStop(1);
}
} else if (!areMoreLevels()) {
_root.levelsign.info.thumb.gotoAndStop(2);
} else {
_root.levelsign.info.txt1.text = _root.levelsign.info.txt1.text + ((((newline + com.midasplayer.util.I18n.format("not_qualified")) + " (") + clearLimit_) + "%)");
_root.levelsign.info.thumb.gotoAndStop(2);
}
_root.levelsign.info.score.text = score_ - bonus_;
_root.levelsign.info.bonus.text = bonus_;
_root.levelsign.info.total.text = score_;
_root.attachMovie("wrench2", "wrench", _root.getNextHighestDepth());
_root.wrench._x = 296.4;
_root.wrench._y = 227.7;
_root.wrench.gotoAndStop(1);
_root.wrench.anim.gotoAndStop(1);
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");
}
}
if (continuePlay_) {
com.midasplayer.fx.SoundManager.play("level_cleared#1");
_root.levelsign.info.starts.text = com.midasplayer.util.I18n.format("level_starts_in");
_root.levelsign.info.start.text = com.midasplayer.util.I18n.format("start");
} else {
com.midasplayer.fx.SoundManager.play("game_over#1");
_root.levelsign.info.starts.text = com.midasplayer.util.I18n.format("game_ends_in");
_root.levelsign.info.start.text = com.midasplayer.util.I18n.format("end");
com.midasplayer.util.GameBase.reportGameEnd(score_);
}
if (percentCleared_ == 100) {
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:playLevelSign}], callback:endPlayLevelSign, callback_scope:this, tps:50});
} else {
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:playLevelSign}], callback:endPlayLevelSign, callback_scope:this, tps:50});
}
}
function playLevelSign(tick, alpha) {
var _local4 = false;
if (tick > 25) {
_root.levelsign.onPress = function () {
this.clicked = true;
};
}
var _local6 = com.midasplayer.util.AnimPlayer.tickToPercent(tick + alpha, 0, 50);
var _local3 = Math.floor(_local6 * percentCleared_);
if (_local3 == 100) {
if (!_root.wrench.playing) {
_root.wrench.playing = true;
_root.wrench.anim.percent.text = _local3 + "%";
_root.wrench.anim.gotoAndPlay(100);
com.midasplayer.fx.SoundManager.play("100%_fly-by");
}
} else {
_root.wrench.anim.gotoAndStop(_local3);
_root.wrench.anim.percent.text = _local3 + "%";
}
var _local5 = 10 - Math.round(tick / 50);
if (_local5 <= 0) {
_local4 = true;
} else {
_root.levelsign.info.secs.text = _local5;
}
if (_root.levelsign.clicked) {
_root.levelsign.info.secs.text = 0;
_local4 = true;
}
return(_local4);
}
function endPlayLevelSign() {
if (continuePlay_) {
_root.wrench.removeMovieClip();
_root.levelsign.removeMovieClip();
startLevel(level_);
} else {
quitIntervalId_ = setInterval(this, "quitGame", 1000);
}
}
function areMoreLevels() {
var _local2 = com.midasplayer.util.GameBase.gameData.get(("level." + level_) + ".width");
return(_local2 != undefined);
}
function endLevel() {
deactivateArrows();
_root.endgame._visible = false;
_root.endgamebox.useHandCursor = false;
board_.deactivate();
stopClock();
percentCleared_ = Math.round(board_.getPercentCleared());
var _local4 = 1000 + ((level_ - 1) * 500);
bonus_ = ((percentCleared_ * percentCleared_) * _local4) / 10000;
bonus_ = Math.round(bonus_);
if (percentCleared_ == 100) {
bonus_ = bonus_ + 2000;
}
var _local3 = Math.round(100 * (timeLeft_ / timeLimit_));
bonus_ = bonus_ + _local3;
if (percentCleared_ >= clearLimit_) {
addScore(bonus_);
} else {
bonus_ = 0;
}
if (timesUp_) {
com.midasplayer.util.GameBase.reportPlayData(671, "", "0");
} else if (quitFlag_) {
com.midasplayer.util.GameBase.reportPlayData(5788, "", "0");
} else {
com.midasplayer.util.GameBase.reportPlayData(4824, "", "0");
}
com.midasplayer.util.GameBase.reportPlayData(14, "" + timeLeft_, "" + bonus_);
if (timeLeft_ > 0) {
}
if (level_ == 4) {
com.midasplayer.fx.SoundManager.play("game over");
} else {
com.midasplayer.fx.SoundManager.play("level end");
}
level_++;
com.midasplayer.util.AnimPlayer.delay({millis:800, callback:startPlayLevelSign, callback_scope:this});
}
function quitGame() {
com.midasplayer.fx.SoundManager.stopAll();
clearInterval(quitIntervalId_);
com.midasplayer.util.GameBase.reportGameQuit();
}
function getIntroBoard() {
return(introBoard_);
}
function getBoard() {
return(board_);
}
static function reportRemovedBlocks(num) {
}
function startClock(timeLimit) {
timeLimit_ = 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 playTimeWarning() {
_root.timewarning = _root.timewarning + 1;
if (_root.timewarning <= 3) {
com.midasplayer.fx.SoundManager.play("warning#1", 100, false, _root.game.playTimeWarning);
}
}
function updateClock(ref) {
timeLeft_--;
if (timeLeft_ <= 0) {
timeLeft_ = 0;
}
if ((timeLeft_ <= 5) && (!clockPlaying_)) {
clockPlaying_ = true;
_root.timewarning = 1;
com.midasplayer.fx.SoundManager.play("warning#1", 100, false, _root.game.playTimeWarning);
}
setClockTime(timeLeft_);
}
function setClockTime(timeLeft) {
if (timeLeft == 0) {
timesUp_ = true;
trace("stopping...");
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) {
_root.score.text = score_;
}
static function displayTimeLeft(timeLeft) {
var _local2 = Math.floor(360 - ((359 * timeLeft) / timeLimit_));
_root.time.gotoAndStop(_local2);
}
static function displayLevel(level) {
_root.level.text = level;
}
static var VERSION = "1.0";
static var clockPlaying_ = false;
static var blastPoints_ = 0;
}
Symbol 224 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 _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;
}
_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 225 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 226 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 227 MovieClip [__Packages.com.midasplayer.game.klickklackturn.Board] Frame 0
class com.midasplayer.game.klickklackturn.Board
{
var isIntro_, displayBoardClip, colors_, boardClip, random_, numColors_, mycolors_, bombPercent_, multiplierPercent_, multiplier_, blocks_, tmpBlocks_, dragList_, topLayer, scoreLayer, stopped_, removeList_, fallBlockFlag_, checkList_;
function Board (layer, clip, isIntro) {
isIntro_ = isIntro;
displayBoardClip = clip;
affectedColsList_ = new Array();
colors_ = ["g", "p", "t", "v", "y"];
if (isIntro) {
boardClip = layer.createEmptyMovieClip("boardclipintro", _root.getNextHighestDepth());
boardClip._x = _root.introsign._x + displayBoardClip._x;
boardClip._y = _root.introsign._y + displayBoardClip._y;
} else {
boardClip = layer.createEmptyMovieClip("boardclip", _root.getNextHighestDepth());
boardClip._x = displayBoardClip._x;
boardClip._y = displayBoardClip._y;
}
}
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.klickklackturn.Block.BLOCK_WIDTH);
}
function getHeight() {
return(rows_ * com.midasplayer.game.klickklackturn.Block.BLOCK_HEIGHT);
}
function setNumColors(numColors) {
numColors_ = numColors;
mycolors_ = new Array();
var _local2 = 0;
while (_local2 < numColors) {
mycolors_.push(colors_[_local2]);
_local2++;
}
}
function setBombPercent(bombPercent) {
bombPercent_ = bombPercent;
}
function setMultiplierPercent(multiplierPercent) {
multiplierPercent_ = multiplierPercent;
}
function setMultiplier(multiplier) {
multiplier_ = multiplier;
}
function generateRandomBlock(col, row) {
var _local2;
var _local3 = false;
var _local4 = random_.nextInt(100);
if (_local4 < bombPercent_) {
_local2 = "x";
} else if (_local4 < (bombPercent_ + multiplierPercent_)) {
_local2 = mycolors_[random_.nextInt(numColors_)];
_local3 = true;
} else {
_local2 = mycolors_[random_.nextInt(numColors_)];
}
return(generateBlock(col, row, _local2, _local3));
}
function generateBlock(col, row, color, isMultiplier) {
var _local3 = boardClip.getNextHighestDepth();
var _local2 = com.midasplayer.game.klickklackturn.Block(boardClip.attachMovie(com.midasplayer.game.klickklackturn.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.klickklackturn.Block(boardClip.attachMovie(com.midasplayer.game.klickklackturn.Block.ID, "b" + _local3, _local3, {color:_local5, board:this}));
_local2.setPos(col, row);
return(_local2);
}
function generate() {
blocks_ = new Array();
tmpBlocks_ = new Array();
dragList_ = new Array();
var _local3 = 0;
while (_local3 < rows_) {
blocks_[_local3] = new Array();
tmpBlocks_[_local3] = new Array();
var _local2 = 0;
while (_local2 < cols_) {
var _local4 = generateRandomBlock(_local2, _local3);
if (_local4.isDragging()) {
dragList_.push(_local4);
}
setBlock(_local3, _local2, _local4);
_local2++;
}
_local3++;
}
_local3 = rows_;
blocks_[_local3] = new Array();
var _local2 = 0;
while (_local2 < cols_) {
var _local4 = generateBottomBlock(_local2, _local3);
dragList_.push(_local4);
setBlock(_local3, _local2, _local4);
_local2++;
}
var _local5 = false;
var _local6;
while (!_local5) {
_local2 = random_.nextInt(cols_);
_local3 = random_.nextInt(rows_);
_local6 = blocks_[_local3][_local2];
if (!_local6.isBomb()) {
blocks_[_local3][_local2].setMultiplier(true);
_local5 = true;
}
}
topLayer.removeMovieClip();
topLayer = boardClip.createEmptyMovieClip("toplayer", boardClip.getNextHighestDepth());
scoreLayer.removeMovieClip();
scoreLayer = boardClip.createEmptyMovieClip("scorelayer", boardClip.getNextHighestDepth());
}
function start() {
stopped_ = false;
acceptInput_ = true;
if (!isIntro_) {
activate();
}
}
function stop() {
stopped_ = true;
acceptInput_ = false;
deactivate();
if (!isIntro_) {
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 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 _local6 = Math.floor(boardClip._xmouse / com.midasplayer.game.klickklackturn.Block.BLOCK_WIDTH);
var _local5 = Math.floor(boardClip._ymouse / com.midasplayer.game.klickklackturn.Block.BLOCK_HEIGHT);
var _local7 = com.midasplayer.game.klickklackturn.Block(blocks_[_local5][_local6]);
var _local4 = 0;
while (_local4 < rows_) {
var _local3 = 0;
while (_local3 < cols_) {
if (blocks_[_local4][_local3].hitTest(_root._xmouse, _root._ymouse)) {
blockRollOver(blocks_[_local4][_local3]);
}
_local3++;
}
_local4++;
}
}
function blockRollOver(block) {
if (!processing_) {
markRollOver(block, new Array(), true);
}
}
function blockRollOut(block) {
if (!processing_) {
markRollOver(block, new Array(), false);
}
}
function copyBoard() {
var _local3 = 0;
while (_local3 < rows_) {
var _local2 = 0;
while (_local2 < cols_) {
tmpBlocks_[_local3][_local2] = blocks_[_local3][_local2];
_local2++;
}
_local3++;
}
}
function rotateRight() {
if (!acceptInput_) {
return(undefined);
}
if (!processing_) {
processing_ = true;
com.midasplayer.fx.SoundManager.play("stage_turns_over#1", 100);
copyBoard();
var _local2 = 0;
while (_local2 < rows_) {
var _local3 = 0;
while (_local3 < cols_) {
blocks_[_local2][_local3] = tmpBlocks_[(cols_ - _local3) - 1][_local2];
blocks_[_local2][_local3].row = _local2;
blocks_[_local2][_local3].col = _local3;
_local3++;
}
_local2++;
}
var _local3 = 0;
while (_local3 < cols_) {
affectedColsList_[_local3] = true;
_local3++;
}
if (!isIntro_) {
com.midasplayer.util.GameBase.reportPlayData(21, "", "0");
}
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:rotateAnim, params:{start:boardClip._rotation, delta:90}}], callback:rotateEnd, callback_scope:this, tps:50});
}
}
function rotateLeft() {
if (!acceptInput_) {
return(undefined);
}
if (!processing_) {
processing_ = true;
com.midasplayer.fx.SoundManager.play("stage_turns_over#1", 100);
copyBoard();
var _local2 = 0;
while (_local2 < rows_) {
var _local3 = 0;
while (_local3 < cols_) {
blocks_[_local2][_local3] = tmpBlocks_[_local3][(rows_ - _local2) - 1];
blocks_[_local2][_local3].row = _local2;
blocks_[_local2][_local3].col = _local3;
_local3++;
}
_local2++;
}
var _local3 = 0;
while (_local3 < cols_) {
affectedColsList_[_local3] = true;
_local3++;
}
if (!isIntro_) {
com.midasplayer.util.GameBase.reportPlayData(22, "", "0");
}
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:rotateAnim, params:{start:boardClip._rotation, delta:-90}}], callback:rotateEnd, callback_scope:this, tps:50});
}
}
function rotateAnim(tick, alpha, params) {
var _local13 = params.start;
var _local9 = params.delta;
var _local10 = com.midasplayer.util.AnimPlayer.tickToPercent(tick + alpha, 0, 30);
var _local11 = _local10;
if (tick < 10) {
_root.falldown = false;
}
if ((tick > 30) && (_root.falldown == false)) {
_root.falldown = true;
}
displayBoardClip._rotation = _local13 + (_local9 * _local10);
if (_local9 < 0) {
var _local12 = (_local9 * _local10) + 90;
var _local15 = Math.round(_local11 * 37);
if (!isIntro_) {
_root.cogs.gotoAndStop(50 + _local15);
}
} else {
var _local12 = (_local9 * _local10) - 90;
var _local15 = Math.round(_local11 * 37);
if (!isIntro_) {
_root.cogs.gotoAndStop(10 + _local15);
}
}
var _local7 = Math.sin((_local12 * Math.PI) / 180);
var _local8 = Math.cos((_local12 * Math.PI) / 180);
var _local4 = 0;
while (_local4 < rows_) {
var _local3 = 0;
while (_local3 < cols_) {
var _local6 = ((_local3 * com.midasplayer.game.klickklackturn.Block.BLOCK_WIDTH) - (getWidth() / 2)) + 15;
var _local5 = ((_local4 * com.midasplayer.game.klickklackturn.Block.BLOCK_HEIGHT) - (getHeight() / 2)) + 15;
blocks_[_local4][_local3].clip_._x = (_local6 * _local8) - (_local5 * _local7);
blocks_[_local4][_local3].clip_._y = (_local6 * _local7) + (_local5 * _local8);
_local3++;
}
_local4++;
}
return(_local11 == 1);
}
function rotateEnd(tick, alpha) {
var _local3 = 0;
while (_local3 < rows_) {
var _local2 = 0;
while (_local2 < cols_) {
blocks_[_local3][_local2].setPos(_local2, _local3);
blocks_[_local3][_local2].rollOverAction(false);
blocks_[_local3][_local2].setBlockUnder(blocks_[_local3 + 1][_local2]);
_local2++;
}
_local3++;
}
boardClip._rotation = 0;
fallDown();
}
function blockClicked(block) {
if (!acceptInput_) {
return(undefined);
}
if (!processing_) {
processing_ = true;
var _local6 = block.getX();
var _local5 = block.getY();
var _local3 = 0;
if (block.isBomb()) {
_local3 = bombClicked(block);
} else {
_local3 = markRemove(block, true);
}
if (!isIntro_) {
var _local4 = _local3;
com.midasplayer.util.GameBase.reportPlayData(651, (block.col + " ") + block.row, "" + _local4);
}
new com.midasplayer.game.klickklackturn.ScorePopup(this, _local3, _local6, _local5 - 35);
}
}
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.klickklackturn.Block(blocks_[_local4][_local2]);
if (block.isRemovable()) {
removeList_.push(block);
}
_local2++;
}
_local4++;
}
com.midasplayer.fx.SoundManager.play("bomb_combo#2", 100);
_local7 = 300;
_local7 = Math.round(_local7 * multiplier_);
} else {
com.midasplayer.fx.SoundManager.play("no_combo#2", 100);
_local7 = -10;
}
if (!isIntro_) {
com.midasplayer.game.klickklackturn.Game.addScore(_local7);
com.midasplayer.game.klickklackturn.Game.reportRemovedBlocks(removeList_.length);
}
remove();
return(_local7);
}
function anyMoreMoves() {
var _local4 = 0;
while (_local4 < rows_) {
var _local2 = 0;
while (_local2 < cols_) {
var _local3 = com.midasplayer.game.klickklackturn.Block(blocks_[_local4][_local2]);
var _local5 = com.midasplayer.game.klickklackturn.Block(blocks_[_local4 + 1][_local2]);
var _local6 = com.midasplayer.game.klickklackturn.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.klickklackturn.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() {
fallDown();
}
function getRemoveAnims(animList) {
var _local6 = removeList_.length;
if (_local6 >= 1) {
var _local2 = 0;
while (_local2 < _local6) {
var _local3 = com.midasplayer.game.klickklackturn.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:50});
}
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.klickklackturn.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.klickklackturn.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.klickklackturn.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:50});
}
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.klickklackturn.Block(dragList_[_local13]);
var _local9 = _local14.col;
var _local7 = _local14.row;
var _local3 = com.midasplayer.game.klickklackturn.Block(blocks_[_local7 - 1][_local9]);
var _local10 = com.midasplayer.game.klickklackturn.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.klickklackturn.Block(blocks_[_local7][_local6]);
if (_local12 == undefined) {
break;
}
var _local5 = _local7 - 1;
while (_local5 >= 0) {
_local3 = com.midasplayer.game.klickklackturn.Block(blocks_[_local5][_local6]);
var _local2 = com.midasplayer.game.klickklackturn.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.klickklackturn.Block(blocks_[_local7][_local6]);
if (_local12 == undefined) {
break;
}
var _local5 = _local7 - 1;
while (_local5 >= 0) {
_local10 = com.midasplayer.game.klickklackturn.Block(blocks_[_local5][_local6 - 1]);
_local3 = com.midasplayer.game.klickklackturn.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.klickklackturn.Block(_local11[_local13]);
animList.push({obj:_local14, func:_local14.dragLeftAnim});
_local17 = true;
_local13++;
}
return(_local17);
}
function markRemove(block) {
var _local8 = 0;
var _local9 = new Array();
getMarkRemoveAnims(block, _local9);
var _local11 = removeList_.length;
if (_local11 == 1) {
_local8 = -10;
com.midasplayer.fx.SoundManager.play("no_combo#2", 50);
removeList_ = new Array();
} else {
var _local10 = 0;
var _local3 = 0;
while (_local3 < _local11) {
block = com.midasplayer.game.klickklackturn.Block(removeList_[_local3]);
if (block.isMultiplier()) {
_local10++;
}
_local3++;
}
_local8 = (_local11 * _local11) * 10;
_local8 = _local8 * Math.pow(2, _local10);
if (_local10 > 0) {
com.midasplayer.fx.SoundManager.play("radioactive_combo#2", 60);
} else {
com.midasplayer.fx.SoundManager.play("combo#1", 40);
}
if (!isIntro_) {
com.midasplayer.game.klickklackturn.Game.reportRemovedBlocks(_local11);
}
}
_local11 = _local9.length;
var _local3 = 0;
while (_local3 < _local11) {
var _local4 = _local9[_local3];
var _local5 = _local4.length;
var _local2 = 0;
while (_local2 < _local5) {
var _local6 = _local4[_local2];
_local2++;
}
_local3++;
}
playMarkRemove(_local9);
if (_local8 > 0) {
_local8 = Math.round(_local8 * multiplier_);
}
if (!isIntro_) {
var _local13 = com.midasplayer.game.klickklackturn.Game.getScore();
com.midasplayer.game.klickklackturn.Game.addScore(_local8);
var _local12 = com.midasplayer.game.klickklackturn.Game.getScore();
_local8 = _local12 - _local13;
trace(_local13);
trace(_local12);
trace(_local8);
}
return(_local8);
}
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.klickklackturn.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.klickklackturn.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;
}
Symbol 228 MovieClip [__Packages.com.midasplayer.game.klickklackturn.Block] Frame 0
class com.midasplayer.game.klickklackturn.Block extends MovieClip
{
static var blockClipNames;
var color, clip_, useHandCursor, attachMovie, col, row, board, markId_, removeMovieClip;
function Block () {
super();
init(color);
deactivate();
clip_.cacheAsBitmap = true;
}
static function staticInitializer(Void) {
blockClipNames = new Array();
blockClipNames.g = "plupp_green";
blockClipNames.p = "plupp_pink";
blockClipNames.t = "plupp_turquois";
blockClipNames.v = "plupp_violet";
blockClipNames.y = "plupp_yellow";
blockClipNames.x = "pluppbomb";
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 (isMultiplier()) {
currentFrame_ = 2;
} 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) - (board.getWidth() / 2)) + 15;
clip_._y = ((row * BLOCK_HEIGHT) - (board.getHeight() / 2)) + 15;
}
function setMultiplier(isMultiplier) {
isMultiplier_ = isMultiplier;
if (isMultiplier_) {
currentFrame_ = 2;
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_ = 2;
bombActive_ = true;
} else {
bombActive_ = false;
if (isWall()) {
} else if (isMultiplier()) {
currentFrame_ = 2;
} 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 = ((row * BLOCK_HEIGHT) - (board.getHeight() / 2)) + 15;
var _local4 = fallHeight_ * BLOCK_HEIGHT;
var _local2 = com.midasplayer.util.AnimPlayer.tickToPercent(tick + alpha, 0, 9);
clip_._y = com.midasplayer.util.AnimPlayer.easeInOutQuad(_local2, _local3, _local4, 1);
if (_local2 == 1) {
setPos(col, row + fallHeight_);
fallHeight_ = 0;
}
return(_local2 == 1);
}
function dragLeftAnim(tick, alpha) {
var _local2 = com.midasplayer.util.AnimPlayer.tickToPercent(tick + alpha, 0, 10);
var _local3 = ((col * BLOCK_WIDTH) - (board.getWidth() / 2)) + 15;
var _local4 = (-dragLength_) * BLOCK_WIDTH;
clip_._x = com.midasplayer.util.AnimPlayer.easeInOutQuad(_local2, _local3, _local4, 1);
if (_local2 == 1) {
setPos(col - dragLength_, row);
dragLength_ = 0;
}
return(_local2 == 1);
}
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;
var _local4 = clip_._y;
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;
var _local4 = clip_._y;
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;
var _local4 = clip_._y;
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;
var _local4 = clip_._y;
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_ = 3;
if (!useHandCursor) {
return(undefined);
}
clip_.gotoAndStop(currentFrame_);
}
}
} else if (isRemovable()) {
if (isMultiplier() || (bombActive_)) {
currentFrame_ = 2;
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.klickklackturn.Block";
static var CLASS = Object.registerClass(ID, com.midasplayer.game.klickklackturn.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 229 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));
return(animId_);
}
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 stop(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);
}
static function setTps(animId, tps) {
timers_.get(animId).setTps(tps);
}
static function tickToPercent(tick, startTick, numTicks) {
var _local1 = (tick - startTick) / numTicks;
_local1 = ((_local1 < 0) ? 0 : (_local1));
_local1 = ((_local1 > 1) ? 1 : (_local1));
return(_local1);
}
static function delay(props) {
return(play({playlist:[{obj:com.midasplayer.util.AnimPlayer, func:delayAnim, params:{millis:props.millis}}], callback:props.callback, callback_scope:props.callback_scope, tps:50}));
}
static function delayAnim(tick, alpha, params) {
if ((tick / 50) >= (params.millis / 1000)) {
return(true);
}
return(false);
}
static function easeInOutQuad(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((c / 2) * t) * t) + b);
}
t--;
return((((-c) / 2) * ((t * (t - 2)) - 1)) + b);
}
static function easeInOutBack(t, b, c, d, s) {
if (s == undefined) {
s = 1.70158;
}
t = t / (d / 2);
if (t < 1) {
s = s * 1.525;
return(((c / 2) * ((t * t) * (((s + 1) * t) - s))) + b);
}
t = t - 2;
s = s * 1.525;
return(((c / 2) * (((t * t) * (((s + 1) * t) + s)) + 2)) + b);
}
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 230 MovieClip [__Packages.com.midasplayer.timing.Timeable] Frame 0
interface com.midasplayer.timing.Timeable
{
}
Symbol 231 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 _local12 = playList.length;
var _local4 = true;
var _local3 = 0;
while (_local3 < _local12) {
var _local2 = playList[_local3];
if (_local2 == undefined) {
} else if (_local2.length == undefined) {
var _local9 = _local2.func;
var _local8 = _local2.obj;
var _local10 = _local2.params;
var _local6 = _local9.call(_local8, tick, alpha, _local10);
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 232 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;
}
Symbol 233 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 234 MovieClip [__Packages.com.midasplayer.game.klickklackturn.ScorePopup] Frame 0
class com.midasplayer.game.klickklackturn.ScorePopup
{
var clip_, y_;
function ScorePopup (board, score, x, y) {
var _local2 = board.scoreLayer.getNextHighestDepth();
clip_ = board.scoreLayer.attachMovie("scorepopup", "s" + _local2, _local2);
clip_._x = x;
clip_._y = y + (com.midasplayer.game.klickklackturn.Block.BLOCK_HEIGHT / 2);
if (score > 0) {
clip_.popup.text.txt.score.text = "+" + score;
} else {
clip_.popup.text.txt.score.text = "" + score;
}
y_ = clip_._y;
clip_._alpha = 0;
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showScore}], callback:endShowScore, callback_scope:this, tps:80});
}
function showScore(tick, alpha) {
var _local2 = com.midasplayer.util.AnimPlayer.tickToPercent(tick + alpha, 0, 40);
clip_._y = y_ - (_local2 * 30);
clip_._alpha = (1 - (((_local2 * _local2) * _local2) * _local2)) * 100;
clip_._xscale = (_local2 * 100) + 100;
clip_._yscale = (_local2 * 100) + 100;
return(_local2 == 1);
}
function endShowScore() {
clip_.removeMovieClip();
}
}
Symbol 171 MovieClip Frame 1
stop();
Symbol 171 MovieClip Frame 10
play();
Symbol 171 MovieClip Frame 46
stop();
Symbol 171 MovieClip Frame 51
play();
Symbol 171 MovieClip Frame 87
stop();
Symbol 187 MovieClip Frame 360
stop();
Symbol 194 MovieClip Frame 1
stop();
Symbol 194 MovieClip Frame 2
stop();