Symbol 32 MovieClip [Score] Frame 1
#initclip 30
Object.registerClass("Score", com.king.ConnectorGame.Score);
#endinitclip
Symbol 54 MovieClip Frame 1
stop();
Symbol 54 MovieClip Frame 2
stop();
Symbol 54 MovieClip Frame 3
stop();
Symbol 54 MovieClip Frame 4
stop();
Symbol 54 MovieClip Frame 5
stop();
Symbol 54 MovieClip Frame 6
stop();
Symbol 81 MovieClip [pMiddle] Frame 1
stop();
Symbol 81 MovieClip [pMiddle] Frame 2
stop();
Symbol 81 MovieClip [pMiddle] Frame 3
stop();
Symbol 81 MovieClip [pMiddle] Frame 4
stop();
Symbol 81 MovieClip [pMiddle] Frame 5
stop();
Symbol 81 MovieClip [pMiddle] Frame 6
stop();
Symbol 81 MovieClip [pMiddle] Frame 7
stop();
Symbol 81 MovieClip [pMiddle] Frame 8
stop();
Symbol 81 MovieClip [pMiddle] Frame 9
stop();
Symbol 88 MovieClip [pPetal] Frame 1
stop();
Symbol 88 MovieClip [pPetal] Frame 2
stop();
Symbol 88 MovieClip [pPetal] Frame 3
stop();
Symbol 88 MovieClip [pPetal] Frame 4
stop();
Symbol 88 MovieClip [pPetal] Frame 5
stop();
Symbol 88 MovieClip [pPetal] Frame 6
stop();
Symbol 88 MovieClip [pPetal] Frame 7
stop();
Symbol 88 MovieClip [pPetal] Frame 8
stop();
Symbol 100 MovieClip [Pieces_BG] Frame 1
#initclip 23
Object.registerClass("Pieces_BG", com.king.ConnectorGame.Pieces_BG);
#endinitclip
stop();
Symbol 100 MovieClip [Pieces_BG] Frame 2
stop();
Symbol 100 MovieClip [Pieces_BG] Frame 3
stop();
Symbol 102 MovieClip [Pieces] Frame 1
#initclip 24
Object.registerClass("Pieces", com.king.ConnectorGame.Pieces);
#endinitclip
Symbol 103 MovieClip [cStone] Frame 1
#initclip 25
Object.registerClass("cStone", com.king.ConnectorGame.CStone);
#endinitclip
Symbol 128 MovieClip [InfoSign] Frame 1
#initclip 26
Object.registerClass("InfoSign", com.king.ConnectorGame.InfoSign);
#endinitclip
stop();
Symbol 152 MovieClip [Game] Frame 1
#initclip 27
Object.registerClass("Game", com.king.ConnectorGame.Game);
#endinitclip
Symbol 225 MovieClip [OceanPaint] Frame 1
#initclip 28
Object.registerClass("OceanPaint", com.king.ConnectorGame.OceanPaint);
#endinitclip
Symbol 247 MovieClip Frame 20
stop();
Symbol 248 MovieClip Frame 20
stop();
Symbol 249 MovieClip Frame 20
stop();
Symbol 250 MovieClip Frame 20
stop();
Symbol 260 MovieClip Frame 1
stop();
Symbol 260 MovieClip Frame 73
stop();
Symbol 260 MovieClip Frame 81
stop();
Symbol 260 MovieClip Frame 176
stop();
Symbol 260 MovieClip Frame 207
stop();
Symbol 260 MovieClip Frame 311
stop();
Symbol 291 MovieClip [ConnectorGame] Frame 1
#initclip 29
Object.registerClass("ConnectorGame", com.king.ConnectorGame.ConnectorGame);
#endinitclip
Symbol 295 MovieClip [__Packages.com.king.ConnectorGame.Pieces_BG] Frame 0
class com.king.ConnectorGame.Pieces_BG extends MovieClip
{
var type, _visible, gotoAndStop, x, y, _y, _x, _parent, removeMovieClip;
function Pieces_BG () {
super();
}
function Pieces() {
}
function tick(tick, tps) {
}
function render(tick, alpha) {
}
function init(yF, xF, fType) {
type = fType;
switch (Number(type)) {
case 0 :
_visible = false;
marked = true;
break;
case 1 :
gotoAndStop(3);
_visible = false;
marked = true;
break;
case 2 :
gotoAndStop(3);
_visible = false;
marked = true;
break;
case 3 :
gotoAndStop(3);
_visible = false;
marked = true;
break;
case 4 :
gotoAndStop(3);
_visible = false;
marked = true;
break;
case 5 :
gotoAndStop(3);
_visible = false;
marked = true;
break;
case 6 :
gotoAndStop(3);
_visible = false;
marked = true;
break;
case 7 :
gotoAndStop(3);
_visible = false;
marked = true;
break;
case 8 :
gotoAndStop(3);
_visible = false;
marked = true;
break;
case 9 :
gotoAndStop(1);
}
x = xF;
y = yF;
_y = (y * 40) + 120;
_x = (x * 40) + 350;
}
function onPress() {
_parent.gridPressed(y, x);
}
function animate() {
}
function mark(num) {
gotoAndStop(num);
marked = true;
}
function remove() {
removeMovieClip();
}
function onRollOver() {
if (_parent.switchActivated) {
_parent.gameGridObj[y][x].tagSwitch(true, false);
}
}
function onRollOut() {
if (_parent.switchActivated) {
_parent.gameGridObj[y][x].tagSwitch(false, true);
}
}
var marked = false;
}
Symbol 296 MovieClip [__Packages.com.king.ConnectorGame.Pieces] Frame 0
class com.king.ConnectorGame.Pieces extends MovieClip
{
var delay, ifloat, rotFloat, posArr, posRenderArr, petalArr, petalFrameArr, petalLastFrameArr, mcSwitchSymbol, currentTick, runDelay, delayTime, runGoto, yPos, accCounter, speed, gotoY, _parent, middle, turnCounter, CCW, explodeMeCounter, explodeMeScore, explodeMeNSB, _y, x, y, type, delayer, _visible, _x, explode, cfe, attachMovie, getNextHighestDepth, rot, removeMovieClip;
function Pieces () {
super();
delay = new com.king.util.Delay();
ifloat = new com.king.timing.IFloat();
rotFloat = new Array();
posArr = new Array();
posRenderArr = new Array();
petalArr = new Array();
petalFrameArr = new Array();
petalLastFrameArr = new Array();
mcSwitchSymbol._visible = false;
}
function tick(tick, tps) {
currentTick = tick;
if (runDelay) {
delayTime--;
if (delayTime == 0) {
runDelay = false;
runGoto = true;
}
}
if (runGoto) {
yPos = yPos + (speed + accCounter);
accCounter = accCounter + 2;
if (yPos > gotoY) {
yPos = gotoY;
accCounter = 0;
runGoto = false;
ifloat.set(yPos);
_parent.noOfMoving--;
_parent.checkForPairs();
if (stone) {
middle.mcCorner.txtArea._visible = true;
}
}
ifloat.set(yPos);
}
if (turnP) {
renderP = true;
turnCounter++;
if (turnCounter < TURN_SPEED) {
var _local2 = 0;
while (_local2 < petalArr.length) {
if (CCW) {
posRenderArr[_local2] = posRenderArr[_local2] + (90 / TURN_SPEED);
} else {
posRenderArr[_local2] = posRenderArr[_local2] - (90 / TURN_SPEED);
}
rotFloat[_local2].set(posRenderArr[_local2]);
_local2++;
}
} else if (turnCounter == TURN_SPEED) {
var _local2 = 0;
while (_local2 < petalArr.length) {
if (CCW) {
posRenderArr[_local2] = posRenderArr[_local2] + (90 / TURN_SPEED);
} else {
posRenderArr[_local2] = posRenderArr[_local2] - (90 / TURN_SPEED);
}
rotFloat[_local2].set(posRenderArr[_local2]);
rotFloat[_local2].set(posRenderArr[_local2]);
_local2++;
}
} else {
_parent.noOfMoving--;
_parent.checkForPairs();
turnP = false;
}
}
if (explodeMeBool) {
explodeMeCounter--;
if (explodeMeCounter == 0) {
explodeMeBool = false;
_parent.explodePiece(this, explodeMeScore, explodeMeNSB);
}
}
}
function render(tick, alpha) {
if (yPos != _y) {
_y = ifloat.get(alpha);
}
if (renderP) {
var _local2 = 0;
while (_local2 < petalArr.length) {
petalArr[_local2]._rotation = rotFloat[_local2].get(alpha);
_local2++;
}
middle._rotation = rotFloat[0].get(alpha);
if (Number((petalArr[0]._rotation + 360) % 360) == Number((posRenderArr[0] + 360) % 360)) {
renderP = false;
}
}
var _local2 = 0;
while (_local2 < petalArr.length) {
if ((petalFrameArr[_local2] != petalLastFrameArr[_local2]) && (stone == false)) {
tintPetal(petalFrameArr[_local2], petalArr[_local2]);
petalLastFrameArr[_local2] = petalFrameArr[_local2];
}
_local2++;
}
if (cornerBlobCounter != cornerBlobCounterAt) {
cornerBlobCounterAt++;
cornerBlobCounterAt = Math.min(cornerBlobCounterAt + 2, cornerBlobCounter);
middle.mcCorner.mcBlobAnim.gotoAndStop(cornerBlobCounterAt);
}
}
function init(yF, xF, del, pArr, fType, diff) {
x = xF;
y = yF;
type = fType;
delayer = del;
switch (Number(type)) {
case 0 :
posArr = [];
_visible = false;
break;
case 9 :
posArr = pArr;
break;
default :
stone = true;
stoneType = type;
posArr = pArr;
}
yPos = ((y * 40) + 120) - diff;
_x = (x * 40) + 350;
_y = yPos;
accCounter = 0;
speed = 1;
runGoto = false;
runDelay = false;
explode = false;
cfe = false;
ifloat.setTo(yPos);
}
function createPetals() {
var _local2 = 0;
while (_local2 < posArr.length) {
var _local3 = attachMovie("pPetal", "pPetal" + petalCounter, getNextHighestDepth());
petalCounter++;
petalFrameArr[_local2] = 9;
petalLastFrameArr[_local2] = 9;
if (stone) {
petalFrameArr[_local2] = stoneType;
petalLastFrameArr[_local2] = stoneType;
}
petalArr[_local2] = _local3;
posRenderArr[_local2] = posArr[_local2] * 90;
rot = posArr[_local2] * 90;
_local3._rotation = rot;
rotFloat[_local2] = new com.king.timing.IFloat();
rotFloat[_local2].setTo(posRenderArr[_local2]);
tintPetal(petalFrameArr[_local2], petalArr[_local2]);
_local2++;
}
middle = attachMovie("pMiddle", "pMiddle", getNextHighestDepth());
if (stone) {
middle.gotoAndStop(Number(type) + 9);
middle.mcCorner.mcBlobAnim.gotoAndStop(1);
} else {
middle.gotoAndStop(9);
}
}
function goTo(delayer, val) {
tagSwitch(false, true);
accCounter = 0;
gotoY = val;
runDelay = true;
delayTime = delayer;
_parent.noOfMoving++;
}
function turnPiece(gCCW) {
_parent.noOfMoving++;
CCW = gCCW;
if (!turnP) {
if (CCW) {
var _local2 = 0;
while (_local2 < posArr.length) {
posArr[_local2]++;
if (posArr[_local2] > 3) {
posArr[_local2] = 0;
}
_local2++;
}
rot = 0;
turnCounter = 0;
turnP = true;
} else {
var _local2 = 0;
while (_local2 < posArr.length) {
posArr[_local2]--;
if (posArr[_local2] < 0) {
posArr[_local2] = 3;
}
_local2++;
}
rot = 0;
turnCounter = 0;
turnP = true;
}
}
}
function tintPetal(num, obj) {
obj.gotoAndStop(Number(num));
var _local3 = 0;
var _local2 = 0;
while (_local2 < petalFrameArr.length) {
if (petalFrameArr[_local2] != 9) {
_local3++;
}
_local2++;
}
if ((num == 9) && (Number(_local3) == 0)) {
middle.gotoAndStop(Number(num));
} else if (num != 9) {
middle.gotoAndStop(Number(num));
}
}
function explodePiece() {
removePiece();
}
function removePiece() {
removeMovieClip();
}
function tagSwitch(tag, pets) {
if (!stone) {
mcSwitchSymbol._visible = tag;
var _local2 = 0;
while (_local2 < petalArr.length) {
petalArr[_local2]._visible = pets;
_local2++;
}
middle._visible = pets;
}
}
function switchPiece() {
mcSwitchSymbol._visible = false;
var _local2 = 0;
while (_local2 < petalArr.length) {
petalArr[_local2].removeMovieClip();
_local2++;
}
middle.removeMovieClip();
posArr = [0, 1, 2, 3];
createPetals();
}
function explodeMe(del, scr, nSB) {
explodeMeCounter = del;
explodeMeScore = scr;
explodeMeNSB = nSB;
explodeMeBool = true;
}
static var TURN_SPEED = 5;
var petalCounter = 0;
var turnP = false;
var renderP = false;
var stone = false;
var stoneType = 123;
var stoneConnect = false;
var cornerBlobCounter = 1;
var cornerBlobCounterAt = 1;
var blingRunning = false;
var explodeMeBool = false;
}
Symbol 297 MovieClip [__Packages.com.king.util.Delay] Frame 0
class com.king.util.Delay
{
var m_fn, m_param, m_context, m_delay, m_started, m_timerId;
function Delay (context, fn, delay) {
m_fn = fn;
m_param = new Array();
var _local3 = 3;
while (_local3 < arguments.length) {
m_param.push(arguments[_local3]);
_local3++;
}
m_context = context;
m_delay = delay;
m_started = getTimer();
m_timerId = setInterval(mx.utils.Delegate.create(this, onEvent), delay);
}
function onEvent() {
if (getTimer() >= (m_delay + m_started)) {
clearInterval(m_timerId);
m_fn.apply(m_context, m_param);
m_fn = undefined;
m_param = undefined;
}
}
static function oneShot(context, fn, delay) {
var _local3 = new com.king.util.Delay(context, fn, delay);
_local3.m_param = new Array();
var _local2 = 3;
while (_local2 < arguments.length) {
_local3.m_param.push(arguments[_local2]);
_local2++;
}
}
}
Symbol 298 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 299 MovieClip [__Packages.com.king.timing.IFloat] Frame 0
class com.king.timing.IFloat
{
static var alpha;
var ivalue, lastValue;
function IFloat (initial) {
ivalue = initial;
lastValue = initial;
alpha = 0;
}
function setTo(initial) {
ivalue = initial;
lastValue = initial;
}
function set(newValue) {
lastValue = ivalue;
ivalue = newValue;
}
function get(lalpha) {
return(lastValue + ((ivalue - lastValue) * lalpha));
}
static function setAlpha(na) {
alpha = na;
}
function get value() {
return(lastValue + ((ivalue - lastValue) * alpha));
}
function set value(v) {
ivalue = v;
lastValue = v;
//return(value);
}
}
Symbol 300 MovieClip [__Packages.com.king.ConnectorGame.CStone] Frame 0
class com.king.ConnectorGame.CStone extends MovieClip
{
var connDirArr, connArr, id, y, x, _parent, type, _y, _x, gotoAndStop, mcStone, removeMovieClip;
function CStone () {
super();
connDirArr = new Array();
connArr = new Array();
}
function tick(tick, tps) {
}
function render(tick, alpha) {
}
function init(yF, xF, num, fType, rot) {
id = num;
switch (id) {
case 0 :
y = 0;
x = 0;
connDirArr = [1, 2];
connArr = [_parent.gameGridObj[y][x], _parent.gameGridObj[y][x]];
break;
case 1 :
y = 0;
x = xF - 1;
connDirArr = [2, 3];
connArr = [_parent.gameGridObj[y][x], _parent.gameGridObj[y][x]];
break;
case 2 :
y = yF - 1;
x = xF - 1;
connDirArr = [0, 3];
connArr = [_parent.gameGridObj[y][x], _parent.gameGridObj[y][x]];
break;
case 3 :
y = yF - 1;
x = 0;
connDirArr = [0, 1];
connArr = [_parent.gameGridObj[y][x], _parent.gameGridObj[y][x]];
}
type = fType;
_y = (y * 40) + 100;
_x = (x * 40) + 100;
gotoAndStop(type);
mcStone._rotation = rot;
}
function updateConns() {
switch (id) {
case 0 :
connArr = [_parent.gameGridObj[y][x], _parent.gameGridObj[y][x]];
break;
case 1 :
connArr = [_parent.gameGridObj[y][x], _parent.gameGridObj[y][x]];
break;
case 2 :
connArr = [_parent.gameGridObj[y][x], _parent.gameGridObj[y][x]];
break;
case 3 :
connArr = [_parent.gameGridObj[y][x], _parent.gameGridObj[y][x]];
}
}
function remove() {
removeMovieClip();
}
}
Symbol 301 MovieClip [__Packages.com.king.ConnectorGame.InfoSign] Frame 0
class com.king.ConnectorGame.InfoSign extends MovieClip
{
var _visible, _parent;
function InfoSign () {
super();
}
function tick(tick, tps) {
}
function render(tick, alpha) {
}
function show() {
_visible = true;
vis = true;
}
function hide() {
_visible = false;
vis = false;
}
function onPress() {
_parent.ticksLeft = 1;
}
var vis = false;
}
Symbol 302 MovieClip [__Packages.com.king.ConnectorGame.Game] Frame 0
class com.king.ConnectorGame.Game extends MovieClip
{
var communicator, gameState, delay, mcSwitch, currentTick, _parent, explodeGrace, noOfMoving, explodeTimer, blingTimer, noOfExpl, level, random, bonusRandom, levelReq, moveBonus, txtLevel, attachMovie, numStonesBonus, numStonesInChain, rStoneHit;
function Game () {
super();
communicator = new com.king.util.Communicator();
gameState = STATE_NOT_RUNNING;
delay = new com.king.util.Delay();
mcSwitch.onPress = function () {
this._parent.switchPressed();
};
}
function tick(tick, tps) {
currentTick = tick;
if (gameState == STATE_RUNNING) {
if (!pressOK) {
pressOK = true;
}
_parent.gameTime = _parent.gameTime - 1;
if ((_parent.gameTime == 0) && (explodeGrace == false)) {
killAnims();
} else if ((_parent.gameTime == 1) && (explodeGrace == true)) {
var _local3 = 0;
while (_local3 < explArr.length) {
var _local2 = 0;
while (_local2 < explArr[_local3].length) {
if (!explArr[_local3][_local2].stone) {
explArr[_local3][_local2].explode = true;
}
_local2++;
}
_local3++;
}
explodeGrace = false;
createScore();
explodeBoard();
if (lvlCleared()) {
killAnims();
}
} else {
var _local3 = 0;
while (_local3 < gameGridObj.length) {
var _local2 = 0;
while (_local2 < gameGridObj[_local3].length) {
gameGridObj[_local3][_local2].tick(tick, tps);
_local2++;
}
_local3++;
}
if (runCheck && (noOfMoving == 0)) {
checkForPairs();
runCheck = false;
}
if (explodeGrace) {
explodeTimer--;
blingTimer--;
if (blingTimer == 0) {
var _local6 = Math.round(Math.random() * explArr.length);
var _local7 = Math.round(Math.random() * explArr[_local6].length);
if ((!explArr[_local6][_local7].blingRunning) && (gameGridBG[explArr[_local6][_local7].y][explArr[_local6][_local7].x].marked == false)) {
explArr[_local6][_local7].middle.mcBling.gotoAndPlay(2);
}
blingTimer = 5;
}
if ((explodeTimer <= 0) && (noOfMoving == 0)) {
_local3 = 0;
while (_local3 < explArr.length) {
var _local2 = 0;
while (_local2 < explArr[_local3].length) {
if (!explArr[_local3][_local2].stone) {
explArr[_local3][_local2].explode = true;
}
_local2++;
}
_local3++;
}
explodeGrace = false;
refill = true;
createScore();
explodeBoard();
}
}
if ((refill == true) && (noOfExpl == 0)) {
refill = false;
if (lvlCleared()) {
killAnims();
endRoundBool = true;
} else {
refillBoard();
}
}
}
} else if (gameState == STATE_ANIM) {
var _local3 = 0;
while (_local3 < gameGridObj.length) {
var _local2 = 0;
while (_local2 < gameGridObj[_local3].length) {
gameGridObj[_local3][_local2].tick(tick, tps);
_local2++;
}
_local3++;
}
if ((scoreArr.length == 0) && (noOfExpl == 0)) {
endRound();
}
}
if (scoreArr.length > 0) {
var _local3 = 0;
while (_local3 < scoreArr.length) {
if (scoreArr[_local3].tick(tick, tps)) {
scoreArr[_local3].removeMovieClip();
scoreArr.splice(_local3, 1);
_local3--;
}
_local3++;
}
}
if (!playingSound) {
if (!com.king.util.SoundManager.isPlaying("level_start")) {
com.king.util.SoundManager.play("loop", 50, true);
playingSound = true;
}
}
}
function render(tick, alpha) {
if (gameState == STATE_RUNNING) {
var _local4 = 0;
while (_local4 < gameGridObj.length) {
var _local2 = 0;
while (_local2 < gameGridObj[_local4].length) {
gameGridObj[_local4][_local2].render(tick, alpha);
_local2++;
}
_local4++;
}
} else if (gameState == STATE_ANIM) {
var _local4 = 0;
while (_local4 < gameGridObj.length) {
var _local2 = 0;
while (_local2 < gameGridObj[_local4].length) {
gameGridObj[_local4][_local2].render(tick, alpha);
_local2++;
}
_local4++;
}
}
if (scoreArr.length > 0) {
var _local4 = 0;
while (_local4 < scoreArr.length) {
scoreArr[_local4].render(tick, alpha);
_local4++;
}
}
if (switchActivated) {
_parent.mcPointer._x = _parent._xmouse;
_parent.mcPointer._y = _parent._ymouse;
}
}
function startRound(lvl, rnd, lvlDataArr, sdArr, bRnd, userType) {
level = lvl;
random = rnd;
bonusRandom = bRnd;
if ((level == 2) && (userType == 0)) {
openGameGO = true;
com.king.util.Delay.oneShot(this, openGameEnd, 2000);
}
playingSound = false;
noOfExpl = 0;
levelReq = 0;
switchActivated = false;
moveBonus = 2000;
stoneCounter = 0;
explodeTimer = 0;
noOfMoving = 0;
runCheck = false;
explodeGrace = false;
var _local2 = 0;
while (_local2 < 4) {
colorBonusArr[_local2] = 0;
colorSingleBonus[_local2] = false;
_local2++;
}
txtLevel.text = level;
_parent.txtMoveBonus.text = moveBonus;
setKeyListener();
parseLvlData(lvlDataArr);
stoneDirArr = sdArr;
createBonus();
createBackGround();
createBoard();
writeStats();
visualBonusUpdate();
arrangeSwitch();
gameState = STATE_RUNNING;
}
function writeStats() {
_parent.txtStraight.text = NUM_STRAIGHT + "%";
_parent.txtBent.text = NUM_BENT + "%";
_parent.txtThree.text = NUM_THREE + "%";
_parent.txtFour.text = NUM_FOUR + "%";
}
function parseLvlData(lvlDataArr) {
lvlArr = [];
var _local3 = new Array();
var _local2 = 0;
while (_local2 < lvlDataArr.length) {
_local3 = lvlDataArr[_local2].split("");
lvlArr[_local2] = _local3;
_local2++;
}
}
function lvlCleared() {
var _local3 = 0;
while (_local3 < lvlArr.length) {
var _local2 = 0;
while (_local2 < lvlArr[_local3].length) {
if (gameGridBG[_local3][_local2].marked == false) {
return(false);
}
_local2++;
}
_local3++;
}
return(true);
}
function createBonus() {
switch (level) {
case 1 :
var _local5 = 0.3;
var _local4 = 0.5;
break;
case 2 :
_local5 = 0.3;
_local4 = 0.7;
break;
case 3 :
_local5 = 0.5;
_local4 = 0.8;
}
var _local3 = Math.round((lvlArr.length * lvlArr[0].length) * _local4);
var _local2 = Math.round((lvlArr.length * lvlArr[0].length) * _local5);
colorBonusValsArr[0] = Math.max(_local2, bonusRandom.nextInt(_local3));
colorBonusValsArr[1] = Math.max(_local2, bonusRandom.nextInt(_local3));
colorBonusValsArr[2] = Math.max(_local2, bonusRandom.nextInt(_local3));
if (level > 2) {
colorBonusValsArr[3] = Math.max(Math.round(_local2 / 2), bonusRandom.nextInt(Math.round(_local2 / 2)));
} else {
colorBonusValsArr[3] = Math.max(_local2, bonusRandom.nextInt(_local3));
}
}
function createBackGround() {
var _local3 = 0;
while (_local3 < lvlArr.length) {
var _local5 = new Array();
var _local2 = 0;
while (_local2 < lvlArr[_local3].length) {
var _local4 = attachMovie("Pieces_BG", "pieces_bg_" + piecesBGCounter, pBGDepthCounter);
_local5[_local2] = _local4;
_local4.init(_local3, _local2, lvlArr[_local3][_local2]);
piecesBGCounter++;
pBGDepthCounter++;
_local2++;
}
gameGridBG[_local3] = _local5;
_local3++;
}
}
function createBoard() {
levelReq = 0;
var _local7 = 0;
while (_local7 < lvlArr.length) {
var _local8 = new Array();
var _local9 = new Array();
var _local4 = 0;
while (_local4 < lvlArr[_local7].length) {
var _local3 = new Array();
_local3 = getSymbolArr();
if ((lvlArr[_local7][_local4] != 0) && (lvlArr[_local7][_local4] != 9)) {
_local3 = [];
var _local5 = stoneDirArr[stoneCounter].split(",");
var _local2 = 0;
while (_local2 < _local5.length) {
_local3[_local2] = Number(_local5[_local2]);
_local2++;
}
stoneCounter++;
}
var _local6 = attachMovie("Pieces", "pieces_" + piecesCounter, pDepthCounter);
_local6.init(_local7, _local4, _local7 + 1, _local3, lvlArr[_local7][_local4], 0);
piecesCounter++;
pDepthCounter++;
_local8[_local4] = 1;
_local9[_local4] = _local6;
if ((lvlArr[_local7][_local4] != 0) && (lvlArr[_local7][_local4] != 9)) {
cStoneArr.push(_local6);
} else {
levelReq++;
}
_local4++;
}
gameGrid[_local7] = _local8;
gameGridObj[_local7] = _local9;
_local7++;
}
checkForPairs();
if (explodeGrace) {
communicator.sendBoardRemake(level);
explodeGrace = false;
explodeTimer = 0;
clearPieces();
createBoard();
} else {
_local7 = 0;
while (_local7 < gameGridObj.length) {
var _local4 = 0;
while (_local4 < gameGridObj[_local7].length) {
gameGridObj[_local7][_local4].createPetals();
_local4++;
}
_local7++;
}
checkForPairs();
}
}
function getSymbolArr() {
var _local3 = random.nextInt(100);
var _local2 = new Array();
if (_local3 < NUM_STRAIGHT) {
_local2 = [0, 2];
} else if (_local3 < (NUM_STRAIGHT + NUM_BENT)) {
_local2 = [1, 2];
} else if (_local3 < ((NUM_STRAIGHT + NUM_BENT) + NUM_THREE)) {
_local2 = [0, 1, 2];
} else if (_local3 < (((NUM_STRAIGHT + NUM_BENT) + NUM_THREE) + NUM_FOUR)) {
_local2 = [0, 1, 2, 3];
}
return(_local2);
}
function explodeBoard() {
noOfExpl = 0;
var _local6 = 0;
var _local3 = 0;
while (_local3 < explArr.length) {
var _local5 = 0;
var _local2 = 0;
while (_local2 < explArr[_local3].length) {
if (explArr[_local3][_local2].explode) {
explArr[_local3][_local2].explode = false;
if (gameGridBG[explArr[_local3][_local2].y][explArr[_local3][_local2].x].marked == false) {
_local5++;
levelReq--;
}
_local6++;
noOfExpl++;
gameGrid[explArr[_local3][_local2].y][explArr[_local3][_local2].x] = 0;
var _local4 = Number((BASE_SCORE * numStonesBonus) + (_local5 * 10));
if (gameGridBG[explArr[_local3][_local2].y][explArr[_local3][_local2].x].marked) {
_local4 = 0;
}
explArr[_local3][_local2].explodeMe(2 * _local6, _local4, numStonesBonus);
}
_local2++;
}
_local3++;
}
}
function explodePiece(piece, scr, nSB) {
if (scr > 0) {
com.king.util.SoundManager.play("plop", 70, false);
} else {
com.king.util.SoundManager.play("noplop", 70, false);
}
_parent.updateScoreSign(scr);
noOfExpl--;
gameGridBG[piece.y][piece.x].mark(3);
createScoreSign(scr, piece, nSB);
piece.explodePiece();
if ((noOfExpl == 0) && (partialScoreArr1.length > 0)) {
var _local2 = 0;
while (_local2 < partialScoreArr1.length) {
createScoreSign(partialScoreArr1[_local2], partialScoreArr2[_local2], partialScoreArr3[_local2]);
_local2++;
}
partialScoreArr1 = [];
partialScoreArr2 = [];
partialScoreArr3 = [];
if (playBonusSound == 1) {
com.king.util.SoundManager.play("colour_2", 100, false);
} else if (playBonusSound == 2) {
com.king.util.SoundManager.play("last_colour", 100, false);
}
playBonusSound = 0;
}
}
function createScore() {
numStonesInChain = 0;
numStonesBonus = 1;
var _local5 = 0;
var _local6 = 0;
var _local4 = new Array();
var _local2 = 0;
while (_local2 < explArr.length) {
numStonesInChain = 0;
_local4 = [];
var _local3 = 0;
while (_local3 < explArr[_local2].length) {
if (gameGridBG[explArr[_local2][_local3].y][explArr[_local2][_local3].x].marked == false) {
numStonesInChain++;
}
if (explArr[_local2][_local3].stone) {
_local4.push(explArr[_local2][_local3].stoneType - 1);
}
_local3++;
}
if (numStonesInChain > 0) {
if (_local2 < (explArr.length - 1)) {
if (explArr[_local2] == explArr[_local2 + 1]) {
numStonesBonus = numStonesBonus + 0.5;
} else {
_local5 = numStonesInChain * 100;
_parent.updateScore(Math.round((_local5 * numStonesBonus) + _local6));
updateColorBonus(_local4, numStonesInChain);
numStonesBonus = 1;
}
} else {
_local5 = numStonesInChain * 100;
_local6 = (((numStonesInChain / 2) * numStonesInChain) + (numStonesInChain / 2)) * 10;
_parent.updateScore(Math.round((_local5 * numStonesBonus) + _local6));
updateColorBonus(_local4, numStonesInChain);
}
}
_local2++;
}
}
function createScoreSign(num, Obj, nSB) {
var _local2 = attachMovie("Score", "score_" + scoreCounter, scoreDepth);
_local2.init(Obj._y, Obj._x, num, nSB);
scoreArr.push(_local2);
scoreCounter++;
scoreDepth++;
}
function updateColorBonus(cArr, num) {
var _local3 = 0;
while (_local3 < cArr.length) {
colorBonusArr[cArr[_local3]] = colorBonusArr[cArr[_local3]] + num;
_local3++;
}
var _local5 = false;
_local3 = 0;
while (_local3 < colorBonusArr.length) {
if ((colorBonusArr[_local3] >= colorBonusValsArr[_local3]) && (colorSingleBonus[_local3] == false)) {
var _local2 = Math.round(((level * 500) + 500) / 4);
colorSingleBonus[_local3] = true;
_parent.updateScore(_local2);
_parent.updateScoreSign(_local2);
partialScoreArr1.push(_local2);
partialScoreArr2.push(cStoneArr[_local3]);
partialScoreArr3.push(_local3 + 3);
_local5 = true;
}
_local3++;
}
if (_local5) {
var _local6 = true;
_local3 = 0;
while (_local3 < colorSingleBonus.length) {
if (colorSingleBonus[_local3] == false) {
_local6 = false;
}
_local3++;
}
if (_local6) {
playBonusSound = 2;
} else {
playBonusSound = 1;
}
}
visualBonusUpdate();
}
function visualBonusUpdate() {
var _local2 = 0;
while (_local2 < cStoneArr.length) {
cStoneArr[_local2].middle.mcCorner.txtArea.text = (colorBonusArr[_local2] + "/") + colorBonusValsArr[_local2];
cStoneArr[_local2].cornerBlobCounter = Math.round(((colorBonusArr[_local2] / colorBonusValsArr[_local2]) * 100) + 1);
_local2++;
}
}
function refillBoard() {
communicator.rendRefillBoard(currentTick);
var _local7 = lvlArr.length - 1;
while (_local7 >= 0) {
var _local2 = lvlArr[0].length - 1;
while (_local2 >= 0) {
if (gameGrid[_local7][_local2] == 0) {
var _local5 = _local7;
while (_local5 >= 0) {
if (((gameGrid[_local5][_local2] == 1) && (gameGridObj[_local5][_local2].stone == false)) && (gameGridObj[_local5][_local2].type == 9)) {
gameGridObj[_local7][_local2] = gameGridObj[_local5][_local2];
gameGrid[_local5][_local2] = 0;
gameGrid[_local7][_local2] = 1;
gameGridObj[_local7][_local2].y = _local7;
gameGridObj[_local7][_local2].goTo(1, Number((_local7 * 40) + 120));
break;
}
if (_local5 == 0) {
var _local3 = _local7;
while (_local3 >= 0) {
if (!gameGridObj[_local3][_local2].stone) {
var _local6 = new Array();
_local6 = getSymbolArr();
var _local4 = attachMovie("Pieces", "pieces_" + piecesCounter, pDepthCounter);
_local4.init(_local3, _local2, 1, _local6, lvlArr[_local3][_local2], 750);
_local4.createPetals();
_local4.goTo(_local4.delayer, (_local4.y * 40) + 120);
gameGridObj[_local3][_local2] = _local4;
piecesCounter++;
pDepthCounter++;
gameGrid[_local3][_local2] = 1;
}
_local3--;
}
}
_local5--;
}
}
_local2--;
}
_local7--;
}
_local7 = 0;
while (_local7 < cStoneArr.length) {
cStoneArr[_local7].updateConns();
_local7++;
}
}
function gridPressed(y, x) {
if (!openGameGO) {
if (switchActivated) {
if ((((noOfMoving == 0) && (gameGridObj[y][x].stone == false)) && (refill == false)) && (pressOK == true)) {
communicator.sendBrickSwitch(currentTick + 1, x, y);
gameGridObj[y][x].switchPiece();
switchActivated = false;
showMouse();
runCheck = true;
}
} else if (((((noOfMoving == 0) && (gameGridObj[y][x].stone == false)) && (refill == false)) && (pressOK == true)) && (_parent.gameTime > 6)) {
com.king.util.SoundManager.play("turn", 100, false);
communicator.sendBrickClicked(currentTick + 1, x, y, CCW);
moveBonus = Math.max((moveBonus = moveBonus - MOVE_COST), 0);
_parent.txtMoveBonus.text = moveBonus;
clickCounter++;
gameGridObj[y][x].turnPiece(CCW);
}
}
}
function switchPressed() {
if (!openGameGO) {
if (switchActivated) {
switchActivated = false;
showMouse();
_parent.noOfSwitch++;
arrangeSwitch();
} else if ((_parent.noOfSwitch > 0) && (pressOK == true)) {
switchActivated = true;
hideMouse();
_parent.noOfSwitch--;
arrangeSwitch();
}
}
}
function hideMouse() {
Mouse.hide();
_parent.mcPointer._visible = true;
_parent.mcPointer._x = _parent._xmouse;
_parent.mcPointer._y = _parent._ymouse;
}
function showMouse() {
Mouse.show();
_parent.mcPointer._visible = false;
}
function arrangeSwitch() {
switch (_parent.noOfSwitch) {
case 0 :
_parent.switchArr[0].gotoAndStop(2);
_parent.switchArr[1].gotoAndStop(2);
_parent.switchArr[2].gotoAndStop(2);
break;
case 1 :
_parent.switchArr[0].gotoAndStop(2);
_parent.switchArr[1].gotoAndStop(2);
_parent.switchArr[2].gotoAndStop(1);
break;
case 2 :
_parent.switchArr[0].gotoAndStop(2);
_parent.switchArr[1].gotoAndStop(1);
_parent.switchArr[2].gotoAndStop(1);
break;
case 3 :
_parent.switchArr[0].gotoAndStop(1);
_parent.switchArr[1].gotoAndStop(1);
_parent.switchArr[2].gotoAndStop(1);
}
}
function checkForPairs() {
if (noOfMoving == 0) {
explArr = [];
var _local19 = 0;
while (_local19 < lvlArr.length) {
var _local13 = 0;
while (_local13 < lvlArr[0].length) {
var _local9 = 0;
while (_local9 < gameGridObj[_local19][_local13].petalFrameArr.length) {
if (!gameGridObj[_local19][_local13].stone) {
gameGridObj[_local19][_local13].petalFrameArr[_local9] = 9;
}
_local9++;
}
_local13++;
}
_local19++;
}
_local19 = 0;
while (_local19 < cStoneArr.length) {
var _local21 = new Array();
checkChain(cStoneArr[_local19], cStoneArr[_local19].stoneType, cStoneArr[_local19], _local21);
_local19++;
}
_local19 = 0;
while (_local19 < lvlArr.length) {
var _local13 = 0;
while (_local13 < lvlArr[0].length) {
gameGridObj[_local19][_local13].cfe = false;
_local13++;
}
_local19++;
}
_local19 = 0;
while (_local19 < explArr.length) {
if ((_local19 + 2) < explArr.length) {
if ((explArr[_local19] == explArr[_local19 + 1]) && (explArr[_local19] == explArr[_local19 + 2])) {
var _local13 = 0;
var _local18 = explArr[_local19].length;
while (_local13 < _local18) {
var _local9 = 0;
var _local10 = explArr[_local19][_local13];
var _local16 = _local10.petalFrameArr.length;
while (_local9 < _local16) {
if (_local10.petalFrameArr[_local9] != 9) {
_local10.petalFrameArr[_local9] = 7;
}
_local9++;
}
_local13++;
}
_local19 = _local19 + 2;
} else if (explArr[_local19] == explArr[_local19 + 1]) {
var _local13 = 0;
var _local18 = explArr[_local19].length;
while (_local13 < _local18) {
var _local9 = 0;
var _local10 = explArr[_local19][_local13];
var _local16 = _local10.petalFrameArr.length;
while (_local9 < _local16) {
if (_local10.petalFrameArr[_local9] != 9) {
_local10.petalFrameArr[_local9] = 6;
}
_local9++;
}
_local13++;
}
_local19 = _local19 + 1;
} else {
var _local13 = 0;
var _local18 = explArr[_local19].length;
while (_local13 < _local18) {
var _local9 = 0;
var _local10 = explArr[_local19][_local13];
var _local16 = _local10.petalFrameArr.length;
while (_local9 < _local16) {
if (_local10.petalFrameArr[_local9] != 9) {
_local10.petalFrameArr[_local9] = 5;
}
_local9++;
}
_local13++;
}
}
} else if ((_local19 + 1) < explArr.length) {
if (explArr[_local19] == explArr[_local19 + 1]) {
var _local13 = 0;
var _local18 = explArr[_local19].length;
while (_local13 < _local18) {
var _local9 = 0;
var _local10 = explArr[_local19][_local13];
var _local16 = _local10.petalFrameArr.length;
while (_local9 < _local16) {
if (_local10.petalFrameArr[_local9] != 9) {
_local10.petalFrameArr[_local9] = 6;
}
_local9++;
}
_local13++;
}
_local19 = _local19 + 1;
} else {
var _local13 = 0;
var _local18 = explArr[_local19].length;
while (_local13 < _local18) {
var _local9 = 0;
var _local10 = explArr[_local19][_local13];
var _local16 = _local10.petalFrameArr.length;
while (_local9 < _local16) {
if (_local10.petalFrameArr[_local9] != 9) {
_local10.petalFrameArr[_local9] = 5;
}
_local9++;
}
_local13++;
}
}
} else {
var _local13 = 0;
var _local18 = explArr[_local19].length;
while (_local13 < _local18) {
var _local9 = 0;
var _local10 = explArr[_local19][_local13];
var _local16 = _local10.petalFrameArr.length;
while (_local9 < _local16) {
if (_local10.petalFrameArr[_local9] != 9) {
_local10.petalFrameArr[_local9] = 5;
}
_local9++;
}
_local13++;
}
}
_local19++;
}
if (explArr.length > 0) {
_local19 = 0;
while (_local19 < explArr.length) {
var _local13 = 0;
while (_local13 < explArr[_local19].length) {
if (explArr[_local19][_local13].stone) {
var _local11 = 0;
var _local14 = explArr[_local19][_local13].posArr.length;
while (_local11 < _local14) {
rStoneHit = true;
explClrArr = [];
var _local4 = explArr[_local19][_local13].posArr[_local11];
switch (_local4) {
case 0 :
var _local5 = gameGridObj[explArr[_local19][_local13].y - 1][explArr[_local19][_local13].x];
var _local8 = 0;
while (_local8 < _local5.posArr.length) {
if ((_local5.posArr[_local8] == ((_local4 + 2) % 4)) && (_local5.type != 0)) {
rStoneHit = false;
explArr[_local19][_local13].cfe = true;
clearExplArr(_local5, explArr[_local19][_local13]);
}
_local8++;
}
break;
case 1 :
_local5 = gameGridObj[explArr[_local19][_local13].y][explArr[_local19][_local13].x + 1];
_local8 = 0;
while (_local8 < _local5.posArr.length) {
if ((_local5.posArr[_local8] == ((_local4 + 2) % 4)) && (_local5.type != 0)) {
rStoneHit = false;
explArr[_local19][_local13].cfe = true;
clearExplArr(_local5, explArr[_local19][_local13]);
}
_local8++;
}
break;
case 2 :
_local5 = gameGridObj[explArr[_local19][_local13].y + 1][explArr[_local19][_local13].x];
_local8 = 0;
while (_local8 < _local5.posArr.length) {
if ((_local5.posArr[_local8] == ((_local4 + 2) % 4)) && (_local5.type != 0)) {
rStoneHit = false;
explArr[_local19][_local13].cfe = true;
clearExplArr(_local5, explArr[_local19][_local13]);
}
_local8++;
}
break;
case 3 :
_local5 = gameGridObj[explArr[_local19][_local13].y][explArr[_local19][_local13].x - 1];
_local8 = 0;
for(;;){
if (_local8 >= _local5.posArr.length) {
break;
}
if ((_local5.posArr[_local8] == ((_local4 + 2) % 4)) && (_local5.type != 0)) {
rStoneHit = false;
explArr[_local19][_local13].cfe = true;
clearExplArr(_local5, explArr[_local19][_local13]);
}
_local8++;
};
}
if (!rStoneHit) {
var _local6 = 0;
while (_local6 < explClrArr.length) {
var _local2 = 0;
while (_local2 < explArr[_local19].length) {
if (explArr[_local19][_local2] == explClrArr[_local6]) {
removePieceFromChain(_local19, _local2, 0);
_local2--;
_local13 = 0;
}
_local2++;
}
_local6++;
}
}
var _local7 = 0;
while (_local7 < lvlArr.length) {
var _local3 = 0;
while (_local3 < lvlArr[0].length) {
gameGridObj[_local7][_local3].cfe = false;
_local3++;
}
_local7++;
}
_local11++;
}
}
_local13++;
}
_local19++;
}
if (explodeGrace == false) {
explodeGrace = true;
explodeTimer = 70;
blingTimer = 10;
}
} else {
explodeGrace = false;
explodeTimer = 0;
}
if (explArr.length > 0) {
_local19 = 0;
var _local22 = explArr.length;
while (_local19 < _local22) {
var _local13 = 0;
var _local20 = explArr[_local19].length;
while (_local13 < _local20) {
var _local12 = explArr[_local19][_local13];
if (!_local12.stone) {
var _local17 = 0;
var _local11 = 0;
var _local15 = _local12.petalFrameArr.length;
while (_local11 < _local15) {
if (_local12.petalFrameArr[_local11] == 9) {
_local17++;
}
_local11++;
}
if (_local17 == (_local12.petalFrameArr.length - 1)) {
removePieceFromChain(_local19, _local13, 0);
_local13 = 0;
_local19 = 0;
}
}
_local13++;
}
_local19++;
}
}
_local19 = 0;
while (_local19 < lvlArr.length) {
var _local13 = 0;
while (_local13 < lvlArr[0].length) {
gameGridObj[_local19][_local13].cfe = false;
_local13++;
}
_local19++;
}
}
}
function removePieceFromChain(w, r, wC) {
var _local2 = explArr[w][r - wC];
var _local3 = 0;
while (_local3 < _local2.posArr.length) {
_local2.petalFrameArr[_local3] = 9;
switch (_local2.posArr[_local3]) {
case 0 :
if (_local2.y > 0) {
var _local5 = gameGridObj[_local2.y - 1][_local2.x];
if (!_local5.stone) {
var _local4 = 0;
while (_local4 < _local5.posArr.length) {
if (_local5.posArr[_local4] == ((_local2.posArr[_local3] + 2) % 4)) {
_local5.petalFrameArr[_local4] = 9;
}
_local4++;
}
}
}
break;
case 1 :
if (_local2.x < lvlArr[0].length) {
var _local5 = gameGridObj[_local2.y][_local2.x + 1];
if (!_local5.stone) {
var _local4 = 0;
while (_local4 < _local5.posArr.length) {
if (_local5.posArr[_local4] == ((_local2.posArr[_local3] + 2) % 4)) {
_local5.petalFrameArr[_local4] = 9;
}
_local4++;
}
}
}
break;
case 2 :
if (_local2.y < lvlArr.length) {
var _local5 = gameGridObj[_local2.y + 1][_local2.x];
if (!_local5.stone) {
var _local4 = 0;
while (_local4 < _local5.posArr.length) {
if (_local5.posArr[_local4] == ((_local2.posArr[_local3] + 2) % 4)) {
_local5.petalFrameArr[_local4] = 9;
}
_local4++;
}
}
}
break;
case 3 :
if (_local2.x <= 0) {
break;
}
var _local5 = gameGridObj[_local2.y][_local2.x - 1];
if (_local5.stone) {
break;
}
var _local4 = 0;
for(;;){
if (_local4 >= _local5.posArr.length) {
break;
}
if (_local5.posArr[_local4] == ((_local2.posArr[_local3] + 2) % 4)) {
_local5.petalFrameArr[_local4] = 9;
}
_local4++;
};
}
_local3++;
}
explArr[w].splice(r - wC, 1);
}
function clearExplArr(piece, startPoint) {
if (piece.stone) {
rStoneHit = true;
}
piece.cfe = true;
explClrArr.push(piece);
var _local3 = 0;
while (_local3 < piece.posArr.length) {
switch (piece.posArr[_local3]) {
case 0 :
if (piece.y > 0) {
var _local4 = gameGridObj[piece.y - 1][piece.x];
var _local5 = 0;
while (_local5 < _local4.posArr.length) {
if (((_local4.posArr[_local5] == ((piece.posArr[_local3] + 2) % 4)) && (_local4.type != 0)) && (_local4.cfe == false)) {
clearExplArr(_local4, startPoint);
break;
}
_local5++;
}
}
break;
case 1 :
if (piece.x < lvlArr[0].length) {
var _local4 = gameGridObj[piece.y][piece.x + 1];
var _local5 = 0;
while (_local5 < _local4.posArr.length) {
if (((_local4.posArr[_local5] == ((piece.posArr[_local3] + 2) % 4)) && (_local4.type != 0)) && (_local4.cfe == false)) {
clearExplArr(_local4, startPoint);
break;
}
_local5++;
}
}
break;
case 2 :
if (piece.y < lvlArr.length) {
var _local4 = gameGridObj[piece.y + 1][piece.x];
var _local5 = 0;
while (_local5 < _local4.posArr.length) {
if (((_local4.posArr[_local5] == ((piece.posArr[_local3] + 2) % 4)) && (_local4.type != 0)) && (_local4.cfe == false)) {
clearExplArr(_local4, startPoint);
break;
}
_local5++;
}
}
break;
case 3 :
if (piece.x <= 0) {
break;
}
var _local4 = gameGridObj[piece.y][piece.x - 1];
var _local5 = 0;
for(;;){
if (_local5 >= _local4.posArr.length) {
break;
}
if (((_local4.posArr[_local5] == ((piece.posArr[_local3] + 2) % 4)) && (_local4.type != 0)) && (_local4.cfe == false)) {
clearExplArr(_local4, startPoint);
break;
}
_local5++;
};
}
_local3++;
}
}
function checkChain(piece, stone, lastPiece, explStrArr) {
if (!piece.cfe) {
piece.cfe = true;
explStrArr.push(piece);
if ((piece.stone == true) && (piece.stoneType != stone)) {
explArr.push(explStrArr);
lastPiece.stoneConnect = true;
}
var _local7 = false;
var _local3 = 0;
while (_local3 < piece.posArr.length) {
switch (piece.posArr[_local3]) {
case 0 :
if (piece.y > 0) {
var _local5 = gameGridObj[piece.y - 1][piece.x];
var _local6 = 0;
while (_local6 < _local5.posArr.length) {
if ((_local5.posArr[_local6] == ((piece.posArr[_local3] + 2) % 4)) && (_local5.type != 0)) {
if (_local5 != lastPiece) {
_local7 = true;
}
piece.petalFrameArr[_local3] = stone;
checkChain(_local5, stone, piece, explStrArr);
break;
}
_local6++;
}
}
break;
case 1 :
if (piece.x < lvlArr[0].length) {
var _local5 = gameGridObj[piece.y][piece.x + 1];
var _local6 = 0;
while (_local6 < _local5.posArr.length) {
if ((_local5.posArr[_local6] == ((piece.posArr[_local3] + 2) % 4)) && (_local5.type != 0)) {
if (_local5 != lastPiece) {
_local7 = true;
}
piece.petalFrameArr[_local3] = stone;
checkChain(_local5, stone, piece, explStrArr);
break;
}
_local6++;
}
}
break;
case 2 :
if (piece.y < lvlArr.length) {
var _local5 = gameGridObj[piece.y + 1][piece.x];
var _local6 = 0;
while (_local6 < _local5.posArr.length) {
if ((_local5.posArr[_local6] == ((piece.posArr[_local3] + 2) % 4)) && (_local5.type != 0)) {
if (_local5 != lastPiece) {
_local7 = true;
}
piece.petalFrameArr[_local3] = stone;
checkChain(_local5, stone, piece, explStrArr);
break;
}
_local6++;
}
}
break;
case 3 :
if (piece.x <= 0) {
break;
}
var _local5 = gameGridObj[piece.y][piece.x - 1];
var _local6 = 0;
for(;;){
if (_local6 >= _local5.posArr.length) {
break;
}
if ((_local5.posArr[_local6] == ((piece.posArr[_local3] + 2) % 4)) && (_local5.type != 0)) {
if (_local5 != lastPiece) {
_local7 = true;
}
piece.petalFrameArr[_local3] = stone;
checkChain(_local5, stone, piece, explStrArr);
break;
}
_local6++;
};
}
_local3++;
}
}
}
function killAnims() {
if (switchActivated) {
switchActivated = false;
_parent.noOfSwitch++;
arrangeSwitch();
showMouse();
}
pressOK = false;
gameState = STATE_ANIM;
}
function endRound() {
com.king.util.SoundManager.stop("loop");
var _local3 = true;
var _local2 = 0;
while (_local2 < colorBonusArr.length) {
if (colorBonusArr[_local2] < colorBonusValsArr[_local2]) {
_local3 = false;
}
_local2++;
}
Key.removeListener(keyListener);
clearLevel();
var _local6 = colorBonusArr[0] / colorBonusValsArr[0];
var _local7 = colorBonusArr[1] / colorBonusValsArr[1];
var _local5 = colorBonusArr[2] / colorBonusValsArr[2];
var _local4 = colorBonusArr[3] / colorBonusValsArr[3];
_parent.endRound(_local3, levelReq, _local6, _local7, _local5, _local4);
gameState = STATE_NOT_RUNNING;
}
function clearLevel() {
var _local3 = 0;
while (_local3 < lvlArr.length) {
var _local2 = 0;
while (_local2 < lvlArr[_local3].length) {
gameGridBG[_local3][_local2].removeMovieClip();
gameGridObj[_local3][_local2].removeMovieClip();
_local2++;
}
_local3++;
}
cStoneArr = [];
stoneCounter = 0;
}
function clearPieces() {
var _local3 = 0;
while (_local3 < lvlArr.length) {
var _local2 = 0;
while (_local2 < lvlArr[_local3].length) {
gameGridObj[_local3][_local2].removeMovieClip();
_local2++;
}
_local3++;
}
cStoneArr = [];
stoneCounter = 0;
}
function showCredit() {
_parent.mcCredit._visible = true;
}
function openGameEnd() {
clearLevel();
_parent.openGameEnd();
}
function setKeyListener() {
keyListener.onKeyDown = function () {
if (Key.getCode() == 32) {
_root.mcConnectorGame.mcGame.CCW = false;
} else if (chr(Key.getAscii()).toUpperCase() == "Q") {
_root.mcConnectorGame.mcGame.inputString = "";
} else {
_root.mcConnectorGame.mcGame.inputString = _root.mcConnectorGame.mcGame.inputString + chr(Key.getAscii()).toUpperCase();
if (_root.mcConnectorGame.mcGame.inputString == "CREDIT") {
_root.mcConnectorGame.mcGame.showCredit();
}
}
};
keyListener.onKeyUp = function () {
if (Key.getCode() == 32) {
_root.mcConnectorGame.mcGame.CCW = true;
}
};
Key.addListener(keyListener);
}
static var STATE_RUNNING = 0;
static var STATE_NOT_RUNNING = 1;
static var STATE_ANIM = 2;
static var TICKS_PER_SEC = 25;
static var BOARD_WIDTH = 8;
static var BOARD_HEIGHT = 5;
static var NUM_STRAIGHT = 30;
static var NUM_BENT = 25;
static var NUM_THREE = 35;
static var NUM_FOUR = 10;
static var BASE_SCORE = 100;
static var MOVE_COST = 50;
var runCheck = false;
var piecesCounter = 0;
var pDepthCounter = 10000;
var scoreDepth = 20000;
var piecesBGCounter = 0;
var pBGDepthCounter = 5000;
var gameGrid = new Array();
var gameGridObj = new Array();
var gameGridBG = new Array();
var explArr = new Array();
var explClrArr = new Array();
var cStoneArr = new Array();
var stoneDirArr = new Array();
var scoreArr = new Array();
var partialScoreArr1 = new Array();
var partialScoreArr2 = new Array();
var partialScoreArr3 = new Array();
var startPoint = null;
var CCW = true;
var keyListener = new Object();
var clickCounter = 0;
var stoneCounter = 0;
var scoreCounter = 0;
var lvlArr = new Array();
var playBonusSound = 0;
var gSA = 0;
var refill = false;
var endRoundBool = false;
var switchActivated = false;
var openGameGO = false;
var colorBonusArr = new Array();
var colorBonusValsArr = new Array();
var colorSingleBonus = new Array();
var playingSound = false;
var pressOK = false;
var inputString = "";
var bonusLimitArr = new Array(38, 60, 70, 95);
}
Symbol 303 MovieClip [__Packages.com.king.util.Communicator] Frame 0
class com.king.util.Communicator
{
var levelDatas, stoneDatas, randomSeed, lang;
function Communicator () {
levelDatas = new Array();
stoneDatas = new Array();
}
function gameStarted() {
trace("GAME START");
if (!hasSentGameStart) {
hasSentGameStart = true;
fscommand ("gameStart");
}
}
function gameQuit() {
trace("GAME QUIT");
if (!hasSentGameOver) {
hasSentGameOver = true;
fscommand ("gameQuit");
}
}
function gameEnd(score) {
trace("GAME ENDS");
if (!hasSentGameEnd) {
hasSentGameEnd = true;
fscommand ("gameEnd", score);
}
}
function startRound(tick, cVer, ltc, rnd) {
fscommand ("playData", (((((((CMD_START_ROUND + ",") + tick) + " ") + cVer) + " ") + ltc) + " ") + rnd);
}
function sendBrickClicked(tick, x, y, CCW) {
fscommand ("playData", (((((((CMD_BRICK_CLICKED + ",") + tick) + " ") + x) + " ") + y) + " ") + CCW);
}
function sendBrickSwitch(tick, x, y) {
fscommand ("playData", (((((CMD_BRICK_SWITCH + ",") + tick) + " ") + x) + " ") + y);
}
function sendGameTime(tick, gameTime) {
fscommand ("playData", (((CMD_GAME_TIME + ",") + tick) + " ") + gameTime);
}
function gameLastTick(tick) {
if (!hasSentLastTick) {
hasSentLastTick = true;
fscommand ("playData", (CMD_LAST_TICK + ",") + tick);
}
}
function sendUpdateScore(tick, scr) {
fscommand ("playData", (((CMD_SEND_SCORE + ",") + tick) + " ") + scr);
}
function sendRandom(tick, rnd) {
if (!hasSentLastTick) {
fscommand ("playData", (((CMD_SEND_RANDOM + ",") + tick) + " ") + rnd);
}
}
function sendBoardRemake(level) {
fscommand ("playData", (CMD_SEND_BOARD_REMAKE + ",") + level);
}
function rendRefillBoard(tick) {
fscommand ("playData", (CMD_SEND_REFILL_BOARD + ",") + tick);
}
function parseGameData(gameData) {
var _local6 = new XML(_root.gameData);
_global.textMappings = new Object();
_global.userType = new Object();
var _local5 = _local6.childNodes[0].childNodes;
randomSeed = new Number(_local6.childNodes[0].attributes.randomseed).valueOf();
lang = _local6.childNodes[0].attributes.lang.valueOf();
var _local4 = 0;
while (_local4 < _local5.length) {
_root.debugText.text = _root.debugText.text + ("\r" + _local5[_local4].nodeName);
if (_local5[_local4].nodeName == "text") {
_global.textMappings[_local5[_local4].attributes.id] = new String(_local5[_local4].firstChild.nodeValue);
}
if (_local5[_local4].nodeName == "lvlData") {
levelDatas[_local5[_local4].attributes.id] = new String(_local5[_local4].firstChild.nodeValue);
}
if (_local5[_local4].nodeName == "cStoneData") {
stoneDatas[_local5[_local4].attributes.id] = new String(_local5[_local4].firstChild.nodeValue);
}
if (_local5[_local4].nodeName == "userType") {
_global.userType[_local5[_local4].attributes.id] = new String(_local5[_local4].firstChild.nodeValue);
}
_local4++;
}
}
static var CMD_START_ROUND = 126;
static var CMD_BRICK_CLICKED = 238;
static var CMD_BRICK_SWITCH = 871;
static var CMD_GAME_TIME = 311;
static var CMD_LAST_TICK = 491;
static var CMD_SEND_SCORE = 542;
static var CMD_SEND_RANDOM = 111;
static var CMD_SEND_BOARD_REMAKE = 789;
static var CMD_SEND_REFILL_BOARD = 555;
var hasSentGameStart = false;
var hasSentGameEnd = false;
var hasSentGameOver = false;
var hasSentLastTick = false;
}
Symbol 304 MovieClip [__Packages.com.king.util.Map] Frame 0
class com.king.util.Map
{
var map, lastSize;
function Map (init) {
map = new Object();
for (var _local3 in init) {
map["" + _local3] = init[_local3];
}
lastSize = -1;
}
function put(key, value) {
map["" + key] = value;
lastSize = -1;
}
function get(key) {
return(map["" + key]);
}
function remove(key) {
var _local2 = "" + key;
var _local3 = map[_local2];
delete map[_local2];
lastSize = -1;
return(_local3);
}
function contains(key) {
return(map["" + key] != undefined);
}
function count() {
if (lastSize < 0) {
lastSize = 0;
for (var _local2 in map) {
lastSize++;
}
}
return(lastSize);
}
function size() {
return(count());
}
function clear() {
map = {};
lastSize = 0;
}
function dump() {
var _local2 = "";
for (var _local3 in map) {
_local2 = _local2 + (((_local3 + "=>") + map[_local3]) + newline);
}
trace(_local2);
}
function toArray() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = map[_local3];
}
return(_local2);
}
function keySet() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = _local3;
}
return(_local2);
}
function get iterator() {
return(new com.king.util.MapIterator(this));
}
function get valueIterator() {
return(new com.king.util.MapValueIterator(this));
}
function foreach(fn) {
var _local3 = arguments.slice(1);
if (_local3.length > 0) {
do {
if ((in map) == null) {
break;
}
var _local5 = in map;
} while (fn(_local5, map[_local5], _local3[0], _local3[1], _local3[2], _local3[3], _local3[4]) != false);
do {
} while ("foreach" != null);
} else {
do {
if ((in map) == null) {
break;
}
var _local5 = in map;
} while (fn(_local5, map[_local5]) != false);
do {
} while (_local2 != null);
}
lastSize = -1;
}
function get _content() {
return(map);
}
}
Symbol 305 MovieClip [__Packages.com.king.util.Iterator] Frame 0
interface com.king.util.Iterator
{
}
Symbol 306 MovieClip [__Packages.com.king.util.MapIterator] Frame 0
class com.king.util.MapIterator implements com.king.util.Iterator
{
var map, keys, ptr;
function MapIterator (map) {
this.map = map;
keys = map.keySet();
ptr = 0;
}
function next() {
if (ptr < keys.length) {
return(keys[ptr++]);
}
return(undefined);
}
function hasNext() {
return(ptr != keys.length);
}
function remove() {
if (ptr == 0) {
return(undefined);
}
map.remove(keys[ptr - 1]);
}
}
Symbol 307 MovieClip [__Packages.com.king.util.MapValueIterator] Frame 0
class com.king.util.MapValueIterator implements com.king.util.Iterator
{
var map, mapRef, keys, ptr;
function MapValueIterator (map) {
this.map = map;
mapRef = map._content;
keys = map.keySet();
ptr = 0;
}
function next() {
return(mapRef[keys[ptr++]]);
}
function hasNext() {
return(ptr != keys.length);
}
function remove() {
if (ptr == 0) {
return(undefined);
}
map.remove(keys[ptr - 1]);
}
}
Symbol 308 MovieClip [__Packages.com.king.util.SoundManager] Frame 0
class com.king.util.SoundManager
{
static var globalSound;
function SoundManager () {
}
static function isSoundEnabled() {
return(soundEnabled);
}
static function enableSounds(enabled) {
soundEnabled = enabled;
if (!enabled) {
muteAll();
} else {
restoreMuteAll();
}
}
static function toggleSound() {
if (globalSound == undefined) {
globalSound = new Sound(_root);
}
soundOn = !soundOn;
globalSound.setVolume((soundOn ? 100 : 0));
}
static function stopAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.stop();
soundEntry.playStatus = false;
});
}
static function muteAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.setVolume(0);
soundEntry.isMuted = true;
});
}
static function restoreMuteAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.setVolume(soundEntry.realVol);
soundEntry.isMuted = false;
});
}
static function stop(resource) {
var _local1 = sounds.get(resource);
if (_local1 != undefined) {
_local1.sound.stop();
_local1.playStatus = false;
}
}
static function getCalibratedVolume(flashVolume) {
flashVolume = Math.min(100, flashVolume);
flashVolume = Math.max(0, flashVolume);
return(Math.ceil(Math.pow(flashVolume / 100, 1.46) * 100));
}
static function setVolume(resource, percent) {
var _local1 = sounds.get(resource);
if ((_local1 != undefined) && (_local1.playStatus == true)) {
var _local2 = getCalibratedVolume(percent);
if (!_local1.isMuted) {
_local1.sound.setVolume(_local2);
}
_local1.realVol = _local2;
}
}
static function isPlaying(resource) {
var _local1 = sounds.get(resource);
return((_local1 != undefined) && (_local1.playStatus == true));
}
static function initialize(list) {
for (var _local9 in list) {
var resource = list[_local9];
var _local3 = _root.getNextHighestDepth();
var _local2 = new Sound(_root.createEmptyMovieClip("sm_sndhold_" + _local3, _local3));
_local2.attachSound(resource);
_local2.onSoundComplete = function () {
var _local1 = com.king.util.SoundManager.sounds.get(resource);
_local1.playStatus = false;
};
sounds.put(resource, {realVol:100, sound:_local2, playStatus:false});
}
}
static function play(resource, volume, isLoop, fn) {
if (volume == undefined) {
volume = 100;
}
if (isLoop == undefined) {
isLoop = false;
}
volume = getCalibratedVolume(volume);
var _local2 = sounds.get(resource);
if (_local2 != undefined) {
_local2.sound.setVolume((soundEnabled ? (volume) : 0));
_local2.realVol = volume;
_local2.isMuted = !soundEnabled;
_local2.playStatus = true;
_local2.onPlayedFn = fn;
_local2.sound.start(0, (isLoop ? 32767 : 1));
} else {
var _local6 = _root.getNextHighestDepth();
var _local4 = new Sound(_root.createEmptyMovieClip("sm_sndhold_" + _local6, _local6));
_local4.attachSound(resource);
_local4.onSoundComplete = function () {
var _local1 = com.king.util.SoundManager.sounds.get(resource);
_local1.playStatus = false;
com.king.util.SoundManager.onPlayed_(resource);
};
_local4.setVolume((soundEnabled ? (volume) : 0));
_local4.start(0, (isLoop ? 32767 : 1));
sounds.put(resource, {isMuted:!soundEnabled, realVol:volume, onPlayedFn:fn, sound:_local4, playStatus:true});
}
}
static function onPlayed_(name) {
var _local1 = sounds.get(name);
if ((_local1 != undefined) && (_local1.onPlayedFn != undefined)) {
_local1.onPlayedFn();
}
}
static var sounds = new com.king.util.Map();
static var soundEnabled = true;
static var soundOn = true;
}
Symbol 309 MovieClip [__Packages.com.king.ConnectorGame.OceanPaint] Frame 0
class com.king.ConnectorGame.OceanPaint extends MovieClip
{
var mcAnimYellowPaint1, mcAnimYellowPaint2, mcAnimYellowPaint3, mcAnimPinkPaint1, mcAnimPinkPaint2, mcAnimPinkPaint3, mcAnimBluePaint1, mcAnimBluePaint2, mcAnimBluePaint3, mcAnimGreenPaint1, mcAnimGreenPaint2, mcAnimGreenPaint3, runNum, aY, tY, aG, tG, aP, tP, aB, tB, targetY, targetG, targetP, targetB, _parent;
function OceanPaint () {
super();
mcAnimYellowPaint1.gotoAndStop(1);
mcAnimYellowPaint2.gotoAndStop(1);
mcAnimYellowPaint3.gotoAndStop(1);
mcAnimPinkPaint1.gotoAndStop(1);
mcAnimPinkPaint2.gotoAndStop(1);
mcAnimPinkPaint3.gotoAndStop(1);
mcAnimBluePaint1.gotoAndStop(1);
mcAnimBluePaint2.gotoAndStop(1);
mcAnimBluePaint3.gotoAndStop(1);
mcAnimGreenPaint1.gotoAndStop(1);
mcAnimGreenPaint2.gotoAndStop(1);
mcAnimGreenPaint3.gotoAndStop(1);
}
function tick(tick, tps) {
if (delay) {
delayCounter++;
if (delayCounter == 50) {
com.king.util.SoundManager.play("paint1", 30, false);
delay = false;
runPaint = true;
}
}
if (runPaint) {
paintShowCounter++;
switch (runNum) {
case 1 :
aY = Math.min(aY + 4, tY);
break;
case 2 :
aG = Math.min(aG + 4, tG);
break;
case 3 :
aP = Math.min(aP + 4, tP);
break;
case 4 :
aB = Math.min(aB + 4, tB);
}
if ((paintShowCounter % 25) == 0) {
runNum++;
switch (runNum) {
case 2 :
com.king.util.SoundManager.play("paint2", 30, false);
break;
case 3 :
com.king.util.SoundManager.play("paint3", 30, false);
break;
case 4 :
com.king.util.SoundManager.play("paint4", 30, false);
}
}
}
}
function render(tick, alpha) {
if (runPaint) {
if (aY <= tY) {
targetY.gotoAndStop(aY);
}
if (aG <= tG) {
targetG.gotoAndStop(aG);
}
if (aP <= tP) {
targetP.gotoAndStop(aP);
}
if (aB <= tB) {
targetB.gotoAndStop(aB);
}
if (paintShowCounter >= 100) {
endPaint();
}
}
}
function paint(lvl, y, g, p, b) {
switch (lvl) {
case 1 :
targetY = mcAnimYellowPaint1;
targetG = mcAnimGreenPaint1;
targetP = mcAnimPinkPaint1;
targetB = mcAnimBluePaint1;
break;
case 2 :
targetY = mcAnimYellowPaint2;
targetG = mcAnimGreenPaint2;
targetP = mcAnimPinkPaint2;
targetB = mcAnimBluePaint2;
break;
case 3 :
targetY = mcAnimYellowPaint3;
targetG = mcAnimGreenPaint3;
targetP = mcAnimPinkPaint3;
targetB = mcAnimBluePaint3;
}
tY = Math.min(Math.round(y * 100), 100);
tG = Math.min(Math.round(g * 100), 100);
tP = Math.min(Math.round(p * 100), 100);
tB = Math.min(Math.round(b * 100), 100);
if (tY != 100) {
tY = 0;
}
if (tG != 100) {
tG = 0;
}
if (tP != 100) {
tP = 0;
}
if (tB != 100) {
tB = 0;
}
aY = 1;
aG = 1;
aP = 1;
aB = 1;
runNum = 1;
paintShowCounter = 0;
delay = true;
delayCounter = 0;
}
function endPaint() {
trace("donePainting");
runPaint = false;
_parent.donePainting();
}
var runPaint = false;
var delay = false;
var delayCounter = 0;
var paintShowCounter = 0;
}
Symbol 310 MovieClip [__Packages.com.king.timing.Timeable] Frame 0
interface com.king.timing.Timeable
{
}
Symbol 311 MovieClip [__Packages.com.king.ConnectorGame.ConnectorGame] Frame 0
class com.king.ConnectorGame.ConnectorGame extends MovieClip implements com.king.timing.Timeable
{
var m_mainTimer, onEnterFrame, communicator, delay, m_performance, gameState, gameTime, mcGame, mcExitGame, mcToggleSound, mcCredit, mcPointer, secTimer, currentTick, random, bonusRandom, txtScoreSign, txtTimeBonusSign, txtColourBonus, txtTotalScoreSign, txtClickCont, txtToggleSound, txtEndGame, txtIntro1, txtIntro2, txtIntro3, txtIntro4, txtIntro5, txtIntro6, mcInfoSign, txtOpenGameEnd, txtClickEnd, txtTime, userType, ticksLeft, txtTimeCounter, mcIntro, animWaitingGoTo, mcPaint, startTime, txtFPS, mcInfoScreens, scorePreBonus, txtTimeBonus, brScore, nextGoto, endGameTrue, txtHeader;
function ConnectorGame () {
super();
m_mainTimer = new com.king.timing.Timer(this, TICKS_PER_SEC);
onEnterFrame = mx.utils.Delegate.create(this, drive);
communicator = new com.king.util.Communicator();
delay = new com.king.util.Delay();
m_performance = new com.king.timing.Performance(60);
gameState = STATE_WAIT_FOR_GAMEDATA;
gameTime = TICKS_PER_SEC * 120;
gameTimeArr = [120, 140, 160];
switchArr = [mcGame.mcSwitch.mcSwitch1, mcGame.mcSwitch.mcSwitch2, mcGame.mcSwitch.mcSwitch3];
mcExitGame.onPress = function () {
this._parent.endGamePressed();
};
mcToggleSound.onPress = function () {
com.king.util.SoundManager.toggleSound();
if (this._parent.soundOn) {
this._parent.txtToggleSound = _global.textMappings.sound_on;
this._parent.soundOn = false;
} else {
this._parent.txtToggleSound = _global.textMappings.sound_off;
this._parent.soundOn = true;
}
};
mcCredit._visible = false;
mcPointer._visible = false;
mcGame._visible = false;
}
function drive() {
m_mainTimer.advanceTime2();
}
function tick(tick) {
secTimer = Math.round(gameTime / TICKS_PER_SEC);
currentTick = tick;
switch (gameState) {
case STATE_WAIT_FOR_GAMEDATA :
if (DEBUG_MODE) {
_root.gameData = DEBUG_GAME_DATA;
}
if (_root.gameData != undefined) {
communicator.gameStarted();
communicator.parseGameData(_root.gameData);
random = new com.king.util.Random(communicator.randomSeed);
bonusRandom = new com.king.util.Random(random.nextInt(10000));
txtScoreSign = _global.textMappings.score;
txtTimeBonusSign = _global.textMappings.time_bonus;
txtColourBonus = _global.textMappings.colour_bonus;
txtTotalScoreSign = _global.textMappings.total_score;
txtClickCont = _global.textMappings.click_cont;
txtToggleSound = _global.textMappings.sound_off;
txtEndGame = _global.textMappings.end_game;
txtIntro1 = _global.textMappings.intro1;
txtIntro2 = _global.textMappings.intro2;
txtIntro3 = _global.textMappings.intro4;
txtIntro4 = _global.textMappings.intro3;
txtIntro5 = _global.textMappings.intro5;
txtIntro6 = _global.textMappings.intro6;
mcInfoSign.txtIntro.text = txtIntro1;
txtOpenGameEnd = _global.textMappings.open_game_end;
txtClickEnd = _global.textMappings.click_end_game;
txtTime = _global.textMappings.time;
introTextArr[0] = txtIntro1;
introTextArr[1] = txtIntro2;
introTextArr[2] = txtIntro3;
introTextArr[3] = txtIntro4;
introTextArr[4] = txtIntro5;
userType = _global.userType["0"];
trace("UT " + userType);
showInfoScreen();
}
break;
case STATE_SHOW_INFO_SCREEN :
ticksLeft = ticksLeft - 1;
if (runIntro && (introPauseCounter == 0)) {
introGoto++;
if ((((introGoto == 80) || (introGoto == 90)) || (introGoto == 176)) || (introGoto == 207)) {
introPauseCounter = 125;
}
} else if (runIntro && (introPauseCounter > 0)) {
introPauseCounter--;
if (introPauseCounter == 0) {
introTextCounter++;
mcInfoSign.txtIntro.text = introTextArr[introTextCounter];
}
}
txtTimeCounter = _global.textMappings.game_starts_in.split("[0]").join("" + Math.round(ticksLeft / 25));
if (ticksLeft <= 0) {
runIntro = false;
mcIntro._visible = false;
communicator.startRound(tick + 1, clientVersion, 0, random.nextInt(50000));
startRound();
}
break;
case STATE_PLAY_GAME :
if (runFPSCheck) {
m_performance = new com.king.timing.Performance(2);
m_performance.setFpsThreshold(10, 10);
m_performance.addQualityFeedbackListener(mx.utils.Delegate.create(this, onLowQualityWarning));
runFPSCheck = true;
}
mcGame.tick(tick, TICKS_PER_SEC);
break;
case STATE_WAITING_FOR_ANIM_TO_END :
mcGame.tick(tick, TICKS_PER_SEC);
if (mcGame.endRoundBool == false) {
if (animWaitingGoTo) {
betweenRounds();
} else {
endGame();
}
}
break;
case STATE_BETWEEN_ROUNDS :
ticksLeft = ticksLeft - 1;
txtTimeCounter = _global.textMappings.game_next_screen.split("[0]").join("" + Math.round(ticksLeft / 25));
if (ticksLeft == 0) {
communicator.startRound(tick + 1, clientVersion, 0, random.nextInt(50000));
startRound();
}
break;
case STATE_END_GAME :
ticksLeft = ticksLeft - 1;
txtTimeCounter = _global.textMappings.game_ends.split("[0]").join("" + Math.round(ticksLeft / 25));
if (ticksLeft != 0) {
break;
}
gamePreQuit();
break;
case STATE_NOT_RUNNING :
}
if ((gameState != STATE_END_GAME) && (gameState != STATE_NOT_RUNNING)) {
mcPaint.tick(tick, TICKS_PER_SEC);
}
}
function render(tick, alpha) {
m_performance.frameUpdated();
if (secTimer != Number(txtTime.text)) {
mcGame.txtTime.text = secTimer;
}
if (noOfRend == 0) {
startTime = getTimer();
}
noOfRend++;
var _local4 = getTimer() - startTime;
if (_local4 > 2000) {
txtFPS.text = Math.round((noOfRend * 1000) / _local4);
noOfRend = 0;
}
switch (gameState) {
case STATE_SHOW_INFO_SCREEN :
if (runIntro) {
mcIntro.gotoAndStop(introGoto);
}
break;
case STATE_PLAY_GAME :
mcGame.render(tick, alpha);
break;
case STATE_WAITING_FOR_ANIM_TO_END :
mcGame.render(tick, alpha);
}
mcPaint.render(tick, alpha);
}
function onLowQualityWarning() {
if (m_forcedLow) {
trace("LOW QUAL!");
m_forcedLow = true;
_root._quality = "low";
}
}
function createLevelData() {
levelArr = communicator.levelDatas[level].split(",");
stoneDirArr = communicator.stoneDatas[level].split("-");
}
function showInfoScreen() {
com.king.util.SoundManager.play("intro", 100, false);
ticksLeft = TICKS_PER_SEC * 40;
mcInfoSign.gotoAndStop(1);
mcInfoSign.show();
runIntro = true;
introGoto = 0;
introPauseCounter = 0;
gameState = STATE_SHOW_INFO_SCREEN;
}
function startRound() {
com.king.util.SoundManager.stop("intro");
com.king.util.SoundManager.stop("level_end");
com.king.util.SoundManager.stop("between_level");
com.king.util.SoundManager.play("level_start", 100, false);
mcGame._visible = true;
mcInfoSign.hide();
gameTime = gameTimeArr[level] * TICKS_PER_SEC;
createLevelData();
mcInfoScreens._visible = false;
level++;
gameState = STATE_PLAY_GAME;
mcGame.startRound(level, random, levelArr, stoneDirArr, bonusRandom, userType);
}
function endRound(bonusRecieved, levelReq, y, g, p, b) {
if ((levelReq == 0) && (level < 3)) {
com.king.util.SoundManager.play("level_end", 100, false);
trace("MADE NEXT LEVEL");
scorePreBonus = score;
updateScore(Math.round(((gameTime / (gameTimeArr[level - 1] * TICKS_PER_SEC)) * 100) * 20));
updateScoreSign(Math.round(((gameTime / (gameTimeArr[level - 1] * TICKS_PER_SEC)) * 100) * 20));
txtTimeBonus.text = Math.round(((gameTime / (gameTimeArr[level - 1] * TICKS_PER_SEC)) * 100) * 20);
brScore = 0;
if (bonusRecieved) {
updateScore((level * 500) + 500);
updateScoreSign((level * 500) + 500);
brScore = (level * 500) + 500;
}
nextGoto = betweenRounds;
startPainting(level, y, g, p, b);
} else if ((levelReq == 0) && (level == 3)) {
com.king.util.SoundManager.play("game_complete", 100, false);
trace("MADE GAME");
scorePreBonus = score;
updateScore(Math.round(((gameTime / (gameTimeArr[level - 1] * TICKS_PER_SEC)) * 100) * 20));
updateScoreSign(Math.round(((gameTime / (gameTimeArr[level - 1] * TICKS_PER_SEC)) * 100) * 20));
txtTimeBonus.text = Math.round(((gameTime / (gameTimeArr[level - 1] * TICKS_PER_SEC)) * 100) * 20);
brScore = 0;
if (bonusRecieved) {
updateScore((level * 500) + 500);
updateScoreSign((level * 500) + 500);
brScore = (level * 500) + 500;
}
nextGoto = endGameTrue;
startPainting(level, y, g, p, b);
} else {
com.king.util.SoundManager.play("game_over", 100, false);
trace("TIME UP! YOU LOOSE MONGO!");
mcGame._visible = false;
scorePreBonus = score;
txtHeader = _global.textMappings.game_over;
brScore = 0;
mcInfoSign.txtColorBonus.text = 0;
mcInfoSign.txtTimeBonus.text = 0;
mcInfoSign.txtRoundScore.text = scorePreBonus - lastRoundScore;
mcInfoSign.txtTotalScore.text = score;
mcInfoSign.txtClickCont.text = txtClickEnd;
endGame(false);
}
}
function startPainting(level, y, g, p, b) {
mcGame._visible = false;
mcPaint.paint(level, y, g, p, b);
}
function donePainting() {
if (level < 3) {
com.king.util.SoundManager.play("between_level", 100, true);
}
if (nextGoto == betweenRounds) {
betweenRounds();
} else if (nextGoto == endGameTrue) {
endGame(true);
}
}
function betweenRounds() {
ticksLeft = TICKS_PER_SEC * 14;
gameState = STATE_BETWEEN_ROUNDS;
mcInfoSign.gotoAndStop(2);
mcInfoSign.show();
txtHeader = _global.textMappings.next_level;
mcInfoSign.txtColorBonus.text = brScore;
mcInfoSign.txtTimeBonus.text = Math.round(((gameTime / (gameTimeArr[level - 1] * TICKS_PER_SEC)) * 100) * 20);
mcInfoSign.txtRoundScore.text = scorePreBonus - lastRoundScore;
mcInfoSign.txtTotalScore.text = score;
mcInfoSign.txtClickCont.text = txtClickCont;
lastRoundScore = score;
}
function endGamePressed() {
communicator.sendRandom(currentTick, random.nextInt(10000));
communicator.gameLastTick(currentTick);
ticksLeft = TICKS_PER_SEC * 10;
mcInfoSign.gotoAndStop(2);
mcInfoSign.show();
txtHeader = _global.textMappings.game_over;
mcInfoSign.txtColorBonus.text = 0;
mcInfoSign.txtTimeBonus.text = 0;
mcInfoSign.txtRoundScore.text = score - lastRoundScore;
mcInfoSign.txtTotalScore.text = score;
mcInfoSign.txtClickCont.text = txtClickEnd;
gameState = STATE_END_GAME;
}
function endGame(gameCleared) {
ticksLeft = TICKS_PER_SEC * 10;
mcInfoSign.gotoAndStop(2);
mcInfoSign.show();
if (gameCleared) {
txtHeader = _global.textMappings.game_complete;
} else {
txtHeader = _global.textMappings.game_over;
}
mcInfoSign.txtColorBonus.text = brScore;
mcInfoSign.txtTimeBonus.text = Math.round(((gameTime / (gameTimeArr[level - 1] * TICKS_PER_SEC)) * 100) * 20);
mcInfoSign.txtRoundScore.text = scorePreBonus - lastRoundScore;
mcInfoSign.txtTotalScore.text = score;
mcInfoSign.txtClickCont.text = txtClickEnd;
gameState = STATE_END_GAME;
}
function openGameEnd() {
mcInfoSign.gotoAndStop(3);
mcInfoSign.show();
ticksLeft = 10 * TICKS_PER_SEC;
gameState = STATE_END_GAME;
}
function gamePreQuit() {
trace("gamePreQuit");
gameState = STATE_NOT_RUNNING;
communicator.sendRandom(currentTick, random.nextInt(10000));
communicator.gameLastTick(currentTick);
communicator.gameEnd(score);
com.king.util.Delay.oneShot(this, gameQuit, 1500);
}
function gameQuit() {
communicator.gameQuit();
}
function updateScore(scr) {
score = score + scr;
communicator.sendUpdateScore(currentTick, scr);
}
function updateScoreSign(scr) {
mcGame.txtScore.text = Number(mcGame.txtScore.text) + scr;
}
static var STATE_WAIT_FOR_GAMEDATA = 0;
static var STATE_SHOW_INFO_SCREEN = 1;
static var STATE_PLAY_GAME = 2;
static var STATE_BETWEEN_ROUNDS = 3;
static var STATE_END_GAME = 4;
static var STATE_NOT_RUNNING = 5;
static var STATE_WAITING_FOR_ANIM_TO_END = 6;
static var TICKS_PER_SEC = 25;
var noOfRend = 0;
var soundOn = true;
var score = 0;
var lastRoundScore = 0;
var level = 0;
var levelArr = new Array();
var stoneDirArr = new Array();
var gameTimeArr = new Array();
var switchArr = new Array();
var noOfSwitch = 3;
var m_forcedLow = false;
var runFPSCheck = false;
var runIntro = false;
var introPauseCounter = 0;
var introGoto = 0;
var introTextCounter = 0;
var introTextArr = new Array();
var clientVersion = "1.25";
static var DEBUG_MODE = true;
static var DEBUG_GAME_DATA = "<gamedata randomseed=\"1\" timelimit=\"660\" lang=\"de\"><text id=\"game_starts_in\">The game starts in [0] seconds!</text><text id=\"game_next_screen\">Next level in [0] seconds!</text><text id=\"game_ends\">Game ends in [0] seconds!</text><text id=\"click_cont\">Click to continue</text><text id=\"click_end_game\">Click to end game</text><text id=\"score\">SCORE</text><text id=\"total_score\">TOTAL SCORE</text><text id=\"time_bonus\">TIME BONUS</text><text id=\"colour_bonus\">COLOUR BONUS</text><text id=\"end_game\">End Game</text><text id=\"sound_on\">Sound On</text><text id=\"sound_off\">Sound Off</text><text id=\"next_level\">Congrats! You made it to the next level!</text><text id=\"game_over\">Booo! You suck! Time is up!</text><text id=\"game_complete\">You beat the game! Now its time for MACARENA!</text><text id=\"intro1\">intro 1</text><text id=\"intro2\">intro 2</text><text id=\"intro3\">intro 3</text><text id=\"intro4\">intro 4</text><text id=\"intro5\">intro 5</text><text id=\"open_game_end\">Register to play the whole game</text><lvlData id=\"0\">19992,99999,99999,99999,39994</lvlData><lvlData id=\"1\">1999992,9999999,9999999,9999999,9999999,3999994</lvlData><lvlData id=\"2\">19999992,99999999,99999999,99999999,99999999,99999999,39999994</lvlData><cStoneData id=\"0\">1,2-2,3-0,1-0,3</cStoneData><cStoneData id=\"1\">1,2-2,3-0,1-0,3</cStoneData><cStoneData id=\"2\">1,2-2,3-0,1-0,3</cStoneData><userType id=\"0\">1</userType></gamedata>";
}
Symbol 312 MovieClip [__Packages.com.king.timing.Timer] Frame 0
class com.king.timing.Timer
{
var timeable;
function Timer (timeable, gameTicksPerSecond) {
millisPerGameTick = 1000 / gameTicksPerSecond;
this.timeable = timeable;
maxTickTime = 500;
}
function getMillisPerTick() {
return(millisPerGameTick);
}
function setMaxTickTime(millis) {
maxTickTime = millis;
}
function advanceTime2() {
var _local3 = getTimer();
if (startTime < 0) {
startTime = _local3;
unprocessedTime = millisPerGameTick;
}
time = _local3 - startTime;
var _local5 = time - lastTime;
lastTime = time;
unprocessedTime = unprocessedTime + _local5;
if (unprocessedTime >= millisPerGameTick) {
var _local2 = maxTickTime + _local3;
do {
timeable.tick(tick);
tick++;
unprocessedTime = unprocessedTime - millisPerGameTick;
} while ((unprocessedTime >= millisPerGameTick) && (getTimer() < _local2));
}
var _local4 = (unprocessedTime % millisPerGameTick) / millisPerGameTick;
com.king.timing.IFloat.setAlpha(_local4);
timeable.render(tick, _local4);
}
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++;
_local2++;
if (_local2 >= 10) {
unprocessedTime = 0;
}
}
var _local4 = unprocessedTime / millisPerGameTick;
timeable.render(tick, _local4);
}
var time = 0;
var startTime = -1;
var lastTime = 0;
var unprocessedTime = 0;
var tick = 0;
var millisPerGameTick = 0;
var maxTickTime = -1;
}
Symbol 313 MovieClip [__Packages.com.king.timing.Performance] Frame 0
class com.king.timing.Performance
{
var idealFps, measurePeriod, minPeriodFps, listeners, startAt, period, nextFpsUpdate, totalFps, fpsCount, lastFpsCount, periodFps, updates;
function Performance (idealFps) {
this.idealFps = idealFps;
measurePeriod = 5;
minPeriodFps = (idealFps / 2) * measurePeriod;
listeners = [];
begin();
}
function begin() {
startAt = -1;
period = -1;
nextFpsUpdate = getTimer();
totalFps = 0;
fpsCount = 0;
lastFpsCount = -1;
periodFps = 0;
updates = 0;
}
function frameUpdated() {
fpsCount++;
var _local3 = getTimer();
if (startAt < 0) {
startAt = _local3;
}
if (_local3 > nextFpsUpdate) {
if (updates > 0) {
lastFpsCount = fpsCount;
totalFps = totalFps + fpsCount;
}
periodFps = periodFps + fpsCount;
if ((++period) == measurePeriod) {
if (periodFps < minPeriodFps) {
for (var _local2 in listeners) {
listeners[_local2](periodFps / measurePeriod);
}
}
period = 0;
periodFps = 0;
}
nextFpsUpdate = _local3 + 1000;
fpsCount = 0;
updates++;
}
}
function addQualityFeedbackListener(fn) {
listeners.push(fn);
}
function setFpsThreshold(minPeriodFps, measurePeriod) {
this.minPeriodFps = minPeriodFps * measurePeriod;
this.measurePeriod = measurePeriod;
}
function get fps() {
return(lastFpsCount);
}
function get averageFps() {
return(totalFps / ((getTimer() - startAt) / 1000));
}
}
Symbol 314 MovieClip [__Packages.com.king.util.Random] Frame 0
class com.king.util.Random
{
var mta, mti, lastSeed;
function Random (aSeed) {
mta = new Array(N);
mti = N + 1;
if (aSeed != undefined) {
init_genrand(aSeed);
}
}
function set seed(s) {
init_genrand(s);
//return(seed);
}
function get seed() {
return(lastSeed);
}
function nextInt(n) {
return((genrand_int32() & 2147483647) % n);
}
function nextFloat() {
return(next(24) / 16777216);
}
function next(bits) {
if (bits < 32) {
return(genrand_int32() & ((1 << bits) - 1));
}
return(genrand_int32());
}
function init_genrand(s) {
s = int(s);
var _local5 = getTimer();
lastSeed = s;
mta[0] = s;
var _local2 = s;
var _local3 = new com.king.util.Integer64();
mti = 1;
while (mti < N) {
_local3.init32((_local2 >>> 30) ^ _local2);
_local3.mulu32(1812433253);
_local2 = (mta[mti] = int(_local3.lsb + mti));
mti++;
}
var _local6 = getTimer();
}
function genrand_int32() {
var _local3 = 0;
if (mti >= N) {
if (mti == (N + 1)) {
init_genrand(5489);
}
var _local4 = getTimer();
var _local2 = 0;
_local2 = 0;
while (_local2 < (N - M)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + M] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
while (_local2 < (N - 1)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + (M - N)] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
_local3 = (mta[N - 1] & UPPER_MASK) | (mta[0] & LOWER_MASK);
mta[N - 1] = (mta[M - 1] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
mti = 0;
var _local5 = getTimer();
}
_local3 = mta[mti++];
_local3 = _local3 ^ (_local3 >>> 11);
_local3 = _local3 ^ ((_local3 << 7) & 2636928640);
_local3 = _local3 ^ ((_local3 << 15) & 4022730752);
_local3 = _local3 ^ (_local3 >>> 18);
return(_local3);
}
static var N = 624;
static var M = 397;
static var MATRIX_A = 2567483615;
static var UPPER_MASK = 2147483648;
static var LOWER_MASK = 2147483647;
static var mag01 = [0, 2567483615];
}
Symbol 315 MovieClip [__Packages.com.king.util.Integer64] Frame 0
class com.king.util.Integer64
{
var r, p, s;
function Integer64 (lowInt) {
r = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]];
p = [0, 0, 0, 0, 0];
s = [0, 0, 0];
if (lowInt != undefined) {
merge(lowInt);
}
}
function init(v) {
var _local2 = 0;
while (_local2 < p.length) {
p[_local2] = v.p[_local2];
_local2++;
}
}
function init32(n) {
p[0] = n & 32767;
n = n >>> 15;
p[1] = n & 32767;
n = n >>> 15;
p[2] = n & 3;
p[3] = 0;
p[4] = 0;
}
function get lsb() {
return((p[0] | (p[1] << SH)) | ((p[2] & 3) << 30));
}
function get msb() {
return((((p[2] >> 2) | ((p[3] << SH) >> 2)) | ((p[4] << (SH * 2)) >> 2)) & 2147483647);
}
function binaryShiftLeft(step) {
var _local2 = 0;
while (_local2 < step) {
shl();
_local2++;
}
}
function binaryShiftRight(step) {
var _local4 = (step / SH) >> 0;
var _local5 = step - (_local4 * SH);
var _local2 = p.length - 1;
while (_local2 > 0) {
var _local3 = 0;
while (_local3 < _local4) {
p[_local3] = p[_local3 + 1];
_local3++;
}
p[_local2--] = 0;
}
if (_local5 > 0) {
var _local3 = 0;
while (_local3 < _local5) {
shr();
_local3++;
}
}
}
function binaryNot(o) {
p[0] = p[0] ^ o.p[0];
p[1] = p[1] ^ o.p[1];
p[2] = p[2] ^ o.p[2];
p[3] = p[3] ^ o.p[3];
p[4] = p[4] ^ o.p[4];
}
function add64(o) {
var _local4 = 0;
var _local3 = 1;
var _local2 = 0;
while ((_local3 < p.length) && (o.p[_local2] != 0)) {
_local3++;
}
_local2 = 0;
while (_local2 < _local3) {
_local4 = _local4 + (p[_local2] + o.p[_local2]);
p[_local2] = _local4 & MASK;
_local4 = _local4 >> SH;
_local2++;
}
}
function add32(num) {
var _local2 = 0;
var _local5 = num & MASK;
num = num >> SH;
var _local6 = num & MASK;
num = num >> SH;
var _local4 = num & 3;
_local2 = _local2 + (p[0] + _local5);
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[1] + _local6);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[2] + _local4);
p[2] = _local2 & MASK;
}
function mulu32(num) {
var _local3 = 0;
s[0] = num & MASK;
num = num >>> 15;
s[1] = num & MASK;
num = num >>> 15;
s[2] = num & 3;
var _local2 = 0;
while (_local2 < 3) {
var _local4 = s[_local2];
_local3 = _local4 * p[0];
r[_local2][0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[1]);
r[_local2][1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[2]);
r[_local2][2] = _local3 & 3;
_local2++;
}
_local3 = r[0][0];
p[0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (r[0][1] + r[1][0]);
p[1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local3 & 3;
p[3] = 0;
p[4] = 0;
}
function mul64(o) {
var _local2 = 0;
var _local3 = 0;
while (_local3 < 5) {
var _local4 = o.p[_local3];
_local2 = _local4 * p[0];
r[_local3][0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[1]);
r[_local3][1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[2]);
r[_local3][2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[3]);
r[_local3][3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[4]);
r[_local3][4] = _local2 & MASK;
_local3++;
}
_local2 = r[0][0];
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (r[0][1] + r[1][0]);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (((r[0][3] + r[1][2]) + r[2][1]) + r[3][0]);
p[3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((((r[0][4] + r[1][3]) + r[2][2]) + r[3][1]) + r[4][0]);
p[4] = _local2 & 7;
}
function mul32(value) {
mul64(new com.king.util.Integer64(value));
}
function merge(a) {
var _local2 = 0;
while (_local2 < 3) {
p[_local2] = p[_local2] + (a & 32767);
a = a >>> 15;
_local2++;
}
return(a);
}
function shl() {
var _local5 = 0;
var _local4 = 0;
var _local2 = 0;
var _local3 = p.length;
while (_local2 < _local3) {
_local5 = (p[_local2] & 16384) >> 14;
p[_local2] = p[_local2] << 1;
p[_local2] = (p[_local2] | _local4) & 32767;
_local2++;
_local4 = _local5;
}
}
function shr() {
var _local4 = 0;
var _local3 = 0;
var _local2 = p.length - 1;
while (_local2 >= 0) {
_local4 = (p[_local2] & 1) << 14;
p[_local2] = p[_local2] >> 1;
p[_local2] = (p[_local2] | _local3) & 32767;
_local2--;
_local3 = _local4;
}
}
static var MASK = 32767;
static var SH = 15;
}
Symbol 316 MovieClip [__Packages.com.king.ConnectorGame.Score] Frame 0
class com.king.ConnectorGame.Score extends MovieClip
{
var yFloat, aFloat, currentTick, yPos, aPos, _y, _alpha, gotoAndStop, txtScore, txtNum, _x;
function Score () {
super();
yFloat = new com.king.timing.IFloat();
aFloat = new com.king.timing.IFloat();
}
function tick(tick, tps) {
currentTick = tick;
yPos = yPos - acc;
aPos = aPos - acc;
yFloat.set(yPos);
aFloat.set(aPos);
acc = acc + 0.3;
if (aPos <= 0) {
return(true);
}
return(false);
}
function render(tick, alpha) {
_y = yFloat.get(alpha);
_alpha = aFloat.get(alpha);
}
function init(y, x, theScore, nSB) {
switch (nSB) {
case 1 :
gotoAndStop(1);
txtScore.text = theScore;
break;
case 1.5 :
gotoAndStop(2);
txtScore.text = theScore;
break;
case 2 :
gotoAndStop(3);
txtScore.text = theScore;
break;
case 3 :
gotoAndStop(4);
txtNum.text = theScore;
break;
case 4 :
gotoAndStop(5);
txtNum.text = theScore;
break;
case 5 :
gotoAndStop(6);
txtNum.text = theScore;
break;
case 6 :
gotoAndStop(7);
txtNum.text = theScore;
}
_y = y;
_x = x;
yPos = y;
aPos = 100;
yFloat.setTo(yPos);
aFloat.setTo(aPos);
}
function removeScores() {
}
var acc = 0;
}