Section 1
//Linear (fl.motion.easing.Linear)
package fl.motion.easing {
public class Linear {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package fl.motion.easing
Section 2
//TweenEvent (gs.events.TweenEvent)
package gs.events {
import flash.events.*;
public class TweenEvent extends Event {
public var info:Object;
public static const UPDATE:String = "update";
public static const START:String = "start";
public static const version:Number = 0.9;
public static const COMPLETE:String = "complete";
public function TweenEvent(_arg1:String, _arg2:Object=null, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
this.info = _arg2;
}
override public function clone():Event{
return (new TweenEvent(this.type, this.info, this.bubbles, this.cancelable));
}
}
}//package gs.events
Section 3
//AutoAlphaPlugin (gs.plugins.AutoAlphaPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class AutoAlphaPlugin extends TweenPlugin {
protected var _tweenVisible:Boolean;
protected var _tween:TweenLite;
protected var _visible:Boolean;
protected var _target:Object;
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function AutoAlphaPlugin(){
this.propName = "autoAlpha";
this.overwriteProps = ["alpha", "visible"];
this.onComplete = onCompleteTween;
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
if (((!((_target.visible == true))) && (_tweenVisible))){
_target.visible = true;
};
}
public function onCompleteTween():void{
if (((((_tweenVisible) && (!((_tween.vars.runBackwards == true))))) && ((_tween.ease == _tween.vars.ease)))){
_target.visible = _visible;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_tween = _arg3;
_visible = Boolean(!((_arg2 == 0)));
_tweenVisible = true;
addTween(_arg1, "alpha", _arg1.alpha, _arg2, "alpha");
return (true);
}
override public function killProps(_arg1:Object):void{
super.killProps(_arg1);
_tweenVisible = !(Boolean(("visible" in _arg1)));
}
}
}//package gs.plugins
Section 4
//BevelFilterPlugin (gs.plugins.BevelFilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class BevelFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function BevelFilterPlugin(){
this.propName = "bevelFilter";
this.overwriteProps = ["bevelFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = BevelFilter;
initFilter(_arg2, new BevelFilter(0, 0, 0xFFFFFF, 0.5, 0, 0.5, 2, 2, 0, ((_arg2.quality) || (2))));
return (true);
}
}
}//package gs.plugins
Section 5
//BezierPlugin (gs.plugins.BezierPlugin)
package gs.plugins {
import gs.*;
import gs.utils.tween.*;
public class BezierPlugin extends TweenPlugin {
protected var _future:Object;
protected var _orient:Boolean;
protected var _orientData:Array;
protected var _beziers:Object;
protected var _target:Object;
protected static const _RAD2DEG:Number = 57.2957795130823;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function BezierPlugin(){
_future = {};
super();
this.propName = "bezier";
this.overwriteProps = [];
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:String;
var _local4:Object;
var _local5:Number;
var _local6:uint;
var _local7:Number;
var _local8:int;
var _local9:Object;
var _local10:Boolean;
var _local11:Number;
var _local12:Number;
var _local13:Array;
var _local14:Number;
if (_arg1 == 1){
for (_local3 in _beziers) {
_local2 = (_beziers[_local3].length - 1);
_target[_local3] = _beziers[_local3][_local2][2];
};
} else {
for (_local3 in _beziers) {
_local6 = _beziers[_local3].length;
if (_arg1 < 0){
_local2 = 0;
} else {
if (_arg1 >= 1){
_local2 = (_local6 - 1);
} else {
_local2 = int((_local6 * _arg1));
};
};
_local5 = ((_arg1 - (_local2 * (1 / _local6))) * _local6);
_local4 = _beziers[_local3][_local2];
if (this.round){
_local7 = (_local4[0] + (_local5 * (((2 * (1 - _local5)) * (_local4[1] - _local4[0])) + (_local5 * (_local4[2] - _local4[0])))));
_local8 = ((_local7)<0) ? -1 : 1;
_target[_local3] = ((((_local7 % 1) * _local8))>0.5) ? (int(_local7) + _local8) : int(_local7);
} else {
_target[_local3] = (_local4[0] + (_local5 * (((2 * (1 - _local5)) * (_local4[1] - _local4[0])) + (_local5 * (_local4[2] - _local4[0])))));
};
};
};
if (_orient){
_local9 = _target;
_local10 = this.round;
_target = _future;
this.round = false;
_orient = false;
this.changeFactor = (_arg1 + 0.01);
_target = _local9;
this.round = _local10;
_orient = true;
_local2 = 0;
while (_local2 < _orientData.length) {
_local13 = _orientData[_local2];
_local14 = ((_local13[3]) || (0));
_local11 = (_future[_local13[0]] - _target[_local13[0]]);
_local12 = (_future[_local13[1]] - _target[_local13[1]]);
_target[_local13[2]] = ((Math.atan2(_local12, _local11) * _RAD2DEG) + _local14);
_local2++;
};
};
}
protected function init(_arg1:TweenLite, _arg2:Array, _arg3:Boolean):void{
var _local4:Object;
var _local5:int;
var _local6:String;
_target = _arg1.target;
if (_arg1.exposedVars.orientToBezier == true){
_orientData = [["x", "y", "rotation", 0]];
_orient = true;
} else {
if ((_arg1.exposedVars.orientToBezier is Array)){
_orientData = _arg1.exposedVars.orientToBezier;
_orient = true;
};
};
_local4 = {};
_local5 = 0;
while (_local5 < _arg2.length) {
for (_local6 in _arg2[_local5]) {
if (_local4[_local6] == undefined){
_local4[_local6] = [_arg1.target[_local6]];
};
if (typeof(_arg2[_local5][_local6]) == "number"){
_local4[_local6].push(_arg2[_local5][_local6]);
} else {
_local4[_local6].push((_arg1.target[_local6] + Number(_arg2[_local5][_local6])));
};
};
_local5++;
};
for (_local6 in _local4) {
this.overwriteProps[this.overwriteProps.length] = _local6;
if (_arg1.exposedVars[_local6] != undefined){
if (typeof(_arg1.exposedVars[_local6]) == "number"){
_local4[_local6].push(_arg1.exposedVars[_local6]);
} else {
_local4[_local6].push((_arg1.target[_local6] + Number(_arg1.exposedVars[_local6])));
};
delete _arg1.exposedVars[_local6];
_local5 = (_arg1.tweens.length - 1);
while (_local5 > -1) {
if (_arg1.tweens[_local5].name == _local6){
_arg1.tweens.splice(_local5, 1);
};
_local5--;
};
};
};
_beziers = parseBeziers(_local4, _arg3);
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (!(_arg2 is Array)){
return (false);
};
init(_arg3, (_arg2 as Array), false);
return (true);
}
override public function killProps(_arg1:Object):void{
var _local2:String;
for (_local2 in _beziers) {
if ((_local2 in _arg1)){
delete _beziers[_local2];
};
};
super.killProps(_arg1);
}
public static function parseBeziers(_arg1:Object, _arg2:Boolean=false):Object{
var _local3:int;
var _local4:Array;
var _local5:Object;
var _local6:String;
var _local7:Object;
_local7 = {};
if (_arg2){
for (_local6 in _arg1) {
_local4 = _arg1[_local6];
_local5 = [];
_local7[_local6] = _local5;
if (_local4.length > 2){
_local5[_local5.length] = [_local4[0], (_local4[1] - ((_local4[2] - _local4[0]) / 4)), _local4[1]];
_local3 = 1;
while (_local3 < (_local4.length - 1)) {
_local5[_local5.length] = [_local4[_local3], (_local4[_local3] + (_local4[_local3] - _local5[(_local3 - 1)][1])), _local4[(_local3 + 1)]];
_local3++;
};
} else {
_local5[_local5.length] = [_local4[0], ((_local4[0] + _local4[1]) / 2), _local4[1]];
};
};
} else {
for (_local6 in _arg1) {
_local4 = _arg1[_local6];
_local5 = [];
_local7[_local6] = _local5;
if (_local4.length > 3){
_local5[_local5.length] = [_local4[0], _local4[1], ((_local4[1] + _local4[2]) / 2)];
_local3 = 2;
while (_local3 < (_local4.length - 2)) {
_local5[_local5.length] = [_local5[(_local3 - 2)][2], _local4[_local3], ((_local4[_local3] + _local4[(_local3 + 1)]) / 2)];
_local3++;
};
_local5[_local5.length] = [_local5[(_local5.length - 1)][2], _local4[(_local4.length - 2)], _local4[(_local4.length - 1)]];
} else {
if (_local4.length == 3){
_local5[_local5.length] = [_local4[0], _local4[1], _local4[2]];
} else {
if (_local4.length == 2){
_local5[_local5.length] = [_local4[0], ((_local4[0] + _local4[1]) / 2), _local4[1]];
};
};
};
};
};
return (_local7);
}
}
}//package gs.plugins
Section 6
//BezierThroughPlugin (gs.plugins.BezierThroughPlugin)
package gs.plugins {
import gs.*;
public class BezierThroughPlugin extends BezierPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function BezierThroughPlugin(){
this.propName = "bezierThrough";
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (!(_arg2 is Array)){
return (false);
};
init(_arg3, (_arg2 as Array), true);
return (true);
}
}
}//package gs.plugins
Section 7
//BlurFilterPlugin (gs.plugins.BlurFilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class BlurFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function BlurFilterPlugin(){
this.propName = "blurFilter";
this.overwriteProps = ["blurFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = BlurFilter;
initFilter(_arg2, new BlurFilter(0, 0, ((_arg2.quality) || (2))));
return (true);
}
}
}//package gs.plugins
Section 8
//ColorMatrixFilterPlugin (gs.plugins.ColorMatrixFilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class ColorMatrixFilterPlugin extends FilterPlugin {
protected var _matrix:Array;
protected var _matrixTween:EndArrayPlugin;
public static const API:Number = 1;
public static const VERSION:Number = 1.01;
protected static var _lumG:Number = 0.71516;
protected static var _lumR:Number = 0.212671;
protected static var _idMatrix:Array = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
protected static var _lumB:Number = 0.072169;
public function ColorMatrixFilterPlugin(){
this.propName = "colorMatrixFilter";
this.overwriteProps = ["colorMatrixFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local4:Object;
var _local5:Array;
_target = _arg1;
_type = ColorMatrixFilter;
_local4 = _arg2;
initFilter({}, new ColorMatrixFilter(_idMatrix.slice()));
_matrix = ColorMatrixFilter(_filter).matrix;
_local5 = [];
if (((!((_local4.matrix == null))) && ((_local4.matrix is Array)))){
_local5 = _local4.matrix;
} else {
if (_local4.relative == true){
_local5 = _matrix.slice();
} else {
_local5 = _idMatrix.slice();
};
_local5 = setBrightness(_local5, _local4.brightness);
_local5 = setContrast(_local5, _local4.contrast);
_local5 = setHue(_local5, _local4.hue);
_local5 = setSaturation(_local5, _local4.saturation);
_local5 = setThreshold(_local5, _local4.threshold);
if (!isNaN(_local4.colorize)){
_local5 = colorize(_local5, _local4.colorize, _local4.amount);
};
};
_matrixTween = new EndArrayPlugin();
_matrixTween.init(_matrix, _local5);
return (true);
}
override public function set changeFactor(_arg1:Number):void{
_matrixTween.changeFactor = _arg1;
ColorMatrixFilter(_filter).matrix = _matrix;
super.changeFactor = _arg1;
}
public static function setSaturation(_arg1:Array, _arg2:Number):Array{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Array;
if (isNaN(_arg2)){
return (_arg1);
};
_local3 = (1 - _arg2);
_local4 = (_local3 * _lumR);
_local5 = (_local3 * _lumG);
_local6 = (_local3 * _lumB);
_local7 = [(_local4 + _arg2), _local5, _local6, 0, 0, _local4, (_local5 + _arg2), _local6, 0, 0, _local4, _local5, (_local6 + _arg2), 0, 0, 0, 0, 0, 1, 0];
return (applyMatrix(_local7, _arg1));
}
public static function setHue(_arg1:Array, _arg2:Number):Array{
var _local3:Number;
var _local4:Number;
var _local5:Array;
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = (_arg2 * (Math.PI / 180));
_local3 = Math.cos(_arg2);
_local4 = Math.sin(_arg2);
_local5 = [((_lumR + (_local3 * (1 - _lumR))) + (_local4 * -(_lumR))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * -(_lumG))), ((_lumB + (_local3 * -(_lumB))) + (_local4 * (1 - _lumB))), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * 0.143)), ((_lumG + (_local3 * (1 - _lumG))) + (_local4 * 0.14)), ((_lumB + (_local3 * -(_lumB))) + (_local4 * -0.283)), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * -((1 - _lumR)))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * _lumG)), ((_lumB + (_local3 * (1 - _lumB))) + (_local4 * _lumB)), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
return (applyMatrix(_local5, _arg1));
}
public static function setThreshold(_arg1:Array, _arg2:Number):Array{
var _local3:Array;
if (isNaN(_arg2)){
return (_arg1);
};
_local3 = [(_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), 0, 0, 0, 1, 0];
return (applyMatrix(_local3, _arg1));
}
public static function applyMatrix(_arg1:Array, _arg2:Array):Array{
var _local3:Array;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
if (((!((_arg1 is Array))) || (!((_arg2 is Array))))){
return (_arg2);
};
_local3 = [];
_local4 = 0;
_local5 = 0;
_local6 = 0;
while (_local6 < 4) {
_local7 = 0;
while (_local7 < 5) {
if (_local7 == 4){
_local5 = _arg1[(_local4 + 4)];
} else {
_local5 = 0;
};
_local3[(_local4 + _local7)] = (((((_arg1[_local4] * _arg2[_local7]) + (_arg1[(_local4 + 1)] * _arg2[(_local7 + 5)])) + (_arg1[(_local4 + 2)] * _arg2[(_local7 + 10)])) + (_arg1[(_local4 + 3)] * _arg2[(_local7 + 15)])) + _local5);
_local7++;
};
_local4 = (_local4 + 5);
_local6++;
};
return (_local3);
}
public static function colorize(_arg1:Array, _arg2:Number, _arg3:Number=1):Array{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Array;
if (isNaN(_arg2)){
return (_arg1);
};
if (isNaN(_arg3)){
_arg3 = 1;
};
_local4 = (((_arg2 >> 16) & 0xFF) / 0xFF);
_local5 = (((_arg2 >> 8) & 0xFF) / 0xFF);
_local6 = ((_arg2 & 0xFF) / 0xFF);
_local7 = (1 - _arg3);
_local8 = [(_local7 + ((_arg3 * _local4) * _lumR)), ((_arg3 * _local4) * _lumG), ((_arg3 * _local4) * _lumB), 0, 0, ((_arg3 * _local5) * _lumR), (_local7 + ((_arg3 * _local5) * _lumG)), ((_arg3 * _local5) * _lumB), 0, 0, ((_arg3 * _local6) * _lumR), ((_arg3 * _local6) * _lumG), (_local7 + ((_arg3 * _local6) * _lumB)), 0, 0, 0, 0, 0, 1, 0];
return (applyMatrix(_local8, _arg1));
}
public static function setBrightness(_arg1:Array, _arg2:Number):Array{
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = ((_arg2 * 100) - 100);
return (applyMatrix([1, 0, 0, 0, _arg2, 0, 1, 0, 0, _arg2, 0, 0, 1, 0, _arg2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], _arg1));
}
public static function setContrast(_arg1:Array, _arg2:Number):Array{
var _local3:Array;
if (isNaN(_arg2)){
return (_arg1);
};
_arg2 = (_arg2 + 0.01);
_local3 = [_arg2, 0, 0, 0, (128 * (1 - _arg2)), 0, _arg2, 0, 0, (128 * (1 - _arg2)), 0, 0, _arg2, 0, (128 * (1 - _arg2)), 0, 0, 0, 1, 0];
return (applyMatrix(_local3, _arg1));
}
}
}//package gs.plugins
Section 9
//DropShadowFilterPlugin (gs.plugins.DropShadowFilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class DropShadowFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function DropShadowFilterPlugin(){
this.propName = "dropShadowFilter";
this.overwriteProps = ["dropShadowFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = DropShadowFilter;
initFilter(_arg2, new DropShadowFilter(0, 45, 0, 0, 0, 0, 1, ((_arg2.quality) || (2)), _arg2.inner, _arg2.knockout, _arg2.hideObject));
return (true);
}
}
}//package gs.plugins
Section 10
//EndArrayPlugin (gs.plugins.EndArrayPlugin)
package gs.plugins {
import gs.*;
import gs.utils.tween.*;
public class EndArrayPlugin extends TweenPlugin {
protected var _info:Array;
protected var _a:Array;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function EndArrayPlugin(){
_info = [];
super();
this.propName = "endArray";
this.overwriteProps = ["endArray"];
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:ArrayTweenInfo;
var _local4:Number;
var _local5:int;
if (this.round){
_local2 = (_info.length - 1);
while (_local2 > -1) {
_local3 = _info[_local2];
_local4 = (_local3.start + (_local3.change * _arg1));
_local5 = ((_local4)<0) ? -1 : 1;
_a[_local3.index] = ((((_local4 % 1) * _local5))>0.5) ? (int(_local4) + _local5) : int(_local4);
_local2--;
};
} else {
_local2 = (_info.length - 1);
while (_local2 > -1) {
_local3 = _info[_local2];
_a[_local3.index] = (_local3.start + (_local3.change * _arg1));
_local2--;
};
};
}
public function init(_arg1:Array, _arg2:Array):void{
var _local3:int;
_a = _arg1;
_local3 = (_arg2.length - 1);
while (_local3 > -1) {
if (((!((_arg1[_local3] == _arg2[_local3]))) && (!((_arg1[_local3] == null))))){
_info[_info.length] = new ArrayTweenInfo(_local3, _a[_local3], (_arg2[_local3] - _a[_local3]));
};
_local3--;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((!((_arg1 is Array))) || (!((_arg2 is Array))))){
return (false);
};
init((_arg1 as Array), _arg2);
return (true);
}
}
}//package gs.plugins
Section 11
//FilterPlugin (gs.plugins.FilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
import gs.utils.tween.*;
public class FilterPlugin extends TweenPlugin {
protected var _index:int;
protected var _filter:BitmapFilter;
protected var _type:Class;
protected var _remove:Boolean;
protected var _target:Object;
public static const VERSION:Number = 1.03;
public static const API:Number = 1;
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:TweenInfo;
var _local4:Array;
_local4 = _target.filters;
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
_local3 = _tweens[_local2];
_local3.target[_local3.property] = (_local3.start + (_local3.change * _arg1));
_local2--;
};
if (!(_local4[_index] is _type)){
_index = (_local4.length - 1);
_local2 = (_local4.length - 1);
while (_local2 > -1) {
if ((_local4[_local2] is _type)){
_index = _local2;
break;
};
_local2--;
};
};
_local4[_index] = _filter;
_target.filters = _local4;
}
public function onCompleteTween():void{
var _local1:int;
var _local2:Array;
if (_remove){
_local2 = _target.filters;
if (!(_local2[_index] is _type)){
_local1 = (_local2.length - 1);
while (_local1 > -1) {
if ((_local2[_local1] is _type)){
_local2.splice(_local1, 1);
break;
};
_local1--;
};
} else {
_local2.splice(_index, 1);
};
_target.filters = _local2;
};
}
protected function initFilter(_arg1:Object, _arg2:BitmapFilter):void{
var _local3:Array;
var _local4:String;
var _local5:int;
var _local6:HexColorsPlugin;
var _local7:Object;
_local3 = _target.filters;
_index = -1;
if (_arg1.index != null){
_index = _arg1.index;
} else {
_local5 = (_local3.length - 1);
while (_local5 > -1) {
if ((_local3[_local5] is _type)){
_index = _local5;
break;
};
_local5--;
};
};
if ((((((_index == -1)) || ((_local3[_index] == null)))) || ((_arg1.addFilter == true)))){
_index = ((_arg1.index)!=null) ? _arg1.index : _local3.length;
_local3[_index] = _arg2;
_target.filters = _local3;
};
_filter = _local3[_index];
_remove = Boolean((_arg1.remove == true));
if (_remove){
this.onComplete = onCompleteTween;
};
_local7 = ((_arg1.isTV)==true) ? _arg1.exposedVars : _arg1;
for (_local4 in _local7) {
if (((((((((!((_local4 in _filter))) || ((_filter[_local4] == _local7[_local4])))) || ((_local4 == "remove")))) || ((_local4 == "index")))) || ((_local4 == "addFilter")))){
} else {
if ((((((_local4 == "color")) || ((_local4 == "highlightColor")))) || ((_local4 == "shadowColor")))){
_local6 = new HexColorsPlugin();
_local6.initColor(_filter, _local4, _filter[_local4], _local7[_local4]);
_tweens[_tweens.length] = new TweenInfo(_local6, "changeFactor", 0, 1, _local4, false);
} else {
if ((((((((_local4 == "quality")) || ((_local4 == "inner")))) || ((_local4 == "knockout")))) || ((_local4 == "hideObject")))){
_filter[_local4] = _local7[_local4];
} else {
addTween(_filter, _local4, _filter[_local4], _local7[_local4], _local4);
};
};
};
};
}
}
}//package gs.plugins
Section 12
//FramePlugin (gs.plugins.FramePlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class FramePlugin extends TweenPlugin {
public var frame:int;
protected var _target:MovieClip;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function FramePlugin(){
this.propName = "frame";
this.overwriteProps = ["frame"];
this.round = true;
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_target.gotoAndStop(this.frame);
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((!((_arg1 is MovieClip))) || (isNaN(_arg2)))){
return (false);
};
_target = (_arg1 as MovieClip);
this.frame = _target.currentFrame;
addTween(this, "frame", this.frame, _arg2, "frame");
return (true);
}
}
}//package gs.plugins
Section 13
//GlowFilterPlugin (gs.plugins.GlowFilterPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class GlowFilterPlugin extends FilterPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function GlowFilterPlugin(){
this.propName = "glowFilter";
this.overwriteProps = ["glowFilter"];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_type = GlowFilter;
initFilter(_arg2, new GlowFilter(0xFFFFFF, 0, 0, 0, ((_arg2.strength) || (1)), ((_arg2.quality) || (2)), _arg2.inner, _arg2.knockout));
return (true);
}
}
}//package gs.plugins
Section 14
//HexColorsPlugin (gs.plugins.HexColorsPlugin)
package gs.plugins {
import gs.*;
public class HexColorsPlugin extends TweenPlugin {
protected var _colors:Array;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function HexColorsPlugin(){
this.propName = "hexColors";
this.overwriteProps = [];
_colors = [];
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:Array;
_local2 = (_colors.length - 1);
while (_local2 > -1) {
_local3 = _colors[_local2];
_local3[0][_local3[1]] = ((((_local3[2] + (_arg1 * _local3[3])) << 16) | ((_local3[4] + (_arg1 * _local3[5])) << 8)) | (_local3[6] + (_arg1 * _local3[7])));
_local2--;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local4:String;
for (_local4 in _arg2) {
initColor(_arg1, _local4, uint(_arg1[_local4]), uint(_arg2[_local4]));
};
return (true);
}
override public function killProps(_arg1:Object):void{
var _local2:int;
_local2 = (_colors.length - 1);
while (_local2 > -1) {
if (_arg1[_colors[_local2][1]] != undefined){
_colors.splice(_local2, 1);
};
_local2--;
};
super.killProps(_arg1);
}
public function initColor(_arg1:Object, _arg2:String, _arg3:uint, _arg4:uint):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (_arg3 != _arg4){
_local5 = (_arg3 >> 16);
_local6 = ((_arg3 >> 8) & 0xFF);
_local7 = (_arg3 & 0xFF);
_colors[_colors.length] = [_arg1, _arg2, _local5, ((_arg4 >> 16) - _local5), _local6, (((_arg4 >> 8) & 0xFF) - _local6), _local7, ((_arg4 & 0xFF) - _local7)];
this.overwriteProps[this.overwriteProps.length] = _arg2;
};
}
}
}//package gs.plugins
Section 15
//RemoveTintPlugin (gs.plugins.RemoveTintPlugin)
package gs.plugins {
public class RemoveTintPlugin extends TintPlugin {
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function RemoveTintPlugin(){
this.propName = "removeTint";
}
}
}//package gs.plugins
Section 16
//RoundPropsPlugin (gs.plugins.RoundPropsPlugin)
package gs.plugins {
public class RoundPropsPlugin extends TweenPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function RoundPropsPlugin(){
this.propName = "roundProps";
this.overwriteProps = [];
this.round = true;
}
public function add(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number):void{
addTween(_arg1, _arg2, _arg3, (_arg3 + _arg4), _arg2);
this.overwriteProps[this.overwriteProps.length] = _arg2;
}
}
}//package gs.plugins
Section 17
//ShortRotationPlugin (gs.plugins.ShortRotationPlugin)
package gs.plugins {
import gs.*;
public class ShortRotationPlugin extends TweenPlugin {
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function ShortRotationPlugin(){
this.propName = "shortRotation";
this.overwriteProps = [];
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local4:String;
if (typeof(_arg2) == "number"){
trace("WARNING: You appear to be using the old shortRotation syntax. Instead of passing a number, please pass an object with properties that correspond to the rotations values For example, TweenMax.to(mc, 2, {shortRotation:{rotationX:-170, rotationY:25}})");
return (false);
};
for (_local4 in _arg2) {
initRotation(_arg1, _local4, _arg1[_local4], _arg2[_local4]);
};
return (true);
}
public function initRotation(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number):void{
var _local5:Number;
_local5 = ((_arg4 - _arg3) % 360);
if (((_arg4 - _arg3) % 360) != (_local5 % 180)){
_local5 = ((_local5)<0) ? (_local5 + 360) : (_local5 - 360);
};
addTween(_arg1, _arg2, _arg3, (_arg3 + _local5), _arg2);
this.overwriteProps[this.overwriteProps.length] = _arg2;
}
}
}//package gs.plugins
Section 18
//TintPlugin (gs.plugins.TintPlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.geom.*;
import gs.utils.tween.*;
public class TintPlugin extends TweenPlugin {
protected var _ct:ColorTransform;
protected var _ignoreAlpha:Boolean;
protected var _target:DisplayObject;
public static const VERSION:Number = 1.1;
public static const API:Number = 1;
protected static var _props:Array = ["redMultiplier", "greenMultiplier", "blueMultiplier", "alphaMultiplier", "redOffset", "greenOffset", "blueOffset", "alphaOffset"];
public function TintPlugin(){
this.propName = "tint";
this.overwriteProps = ["tint"];
}
override public function set changeFactor(_arg1:Number):void{
var _local2:ColorTransform;
updateTweens(_arg1);
if (_ignoreAlpha){
_local2 = _target.transform.colorTransform;
_ct.alphaMultiplier = _local2.alphaMultiplier;
_ct.alphaOffset = _local2.alphaOffset;
};
_target.transform.colorTransform = _ct;
}
public function init(_arg1:DisplayObject, _arg2:ColorTransform):void{
var _local3:int;
var _local4:String;
_target = _arg1;
_ct = _target.transform.colorTransform;
_local3 = (_props.length - 1);
while (_local3 > -1) {
_local4 = _props[_local3];
if (_ct[_local4] != _arg2[_local4]){
_tweens[_tweens.length] = new TweenInfo(_ct, _local4, _ct[_local4], (_arg2[_local4] - _ct[_local4]), "tint", false);
};
_local3--;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local4:ColorTransform;
if (!(_arg1 is DisplayObject)){
return (false);
};
_local4 = new ColorTransform();
if (((!((_arg2 == null))) && (!((_arg3.exposedVars.removeTint == true))))){
_local4.color = uint(_arg2);
};
_ignoreAlpha = true;
init((_arg1 as DisplayObject), _local4);
return (true);
}
}
}//package gs.plugins
Section 19
//TweenPlugin (gs.plugins.TweenPlugin)
package gs.plugins {
import gs.*;
import gs.utils.tween.*;
public class TweenPlugin {
public var overwriteProps:Array;
protected var _tweens:Array;
public var round:Boolean;
public var onComplete:Function;
public var propName:String;
protected var _changeFactor:Number;// = 0
public static const VERSION:Number = 1.03;
public static const API:Number = 1;
public function TweenPlugin(){
_tweens = [];
_changeFactor = 0;
super();
}
protected function updateTweens(_arg1:Number):void{
var _local2:int;
var _local3:TweenInfo;
var _local4:Number;
var _local5:int;
if (this.round){
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
_local3 = _tweens[_local2];
_local4 = (_local3.start + (_local3.change * _arg1));
_local5 = ((_local4)<0) ? -1 : 1;
_local3.target[_local3.property] = ((((_local4 % 1) * _local5))>0.5) ? (int(_local4) + _local5) : int(_local4);
_local2--;
};
} else {
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
_local3 = _tweens[_local2];
_local3.target[_local3.property] = (_local3.start + (_local3.change * _arg1));
_local2--;
};
};
}
public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_changeFactor = _arg1;
}
protected function addTween(_arg1:Object, _arg2:String, _arg3:Number, _arg4, _arg5:String=null):void{
var _local6:Number;
if (_arg4 != null){
_local6 = ((typeof(_arg4))=="number") ? (_arg4 - _arg3) : Number(_arg4);
if (_local6 != 0){
_tweens[_tweens.length] = new TweenInfo(_arg1, _arg2, _arg3, _local6, ((_arg5) || (_arg2)), false);
};
};
}
public function killProps(_arg1:Object):void{
var _local2:int;
_local2 = (this.overwriteProps.length - 1);
while (_local2 > -1) {
if ((this.overwriteProps[_local2] in _arg1)){
this.overwriteProps.splice(_local2, 1);
};
_local2--;
};
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
if ((_tweens[_local2].name in _arg1)){
_tweens.splice(_local2, 1);
};
_local2--;
};
}
public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
addTween(_arg1, this.propName, _arg1[this.propName], _arg2, this.propName);
return (true);
}
public function get changeFactor():Number{
return (_changeFactor);
}
public static function activate(_arg1:Array):Boolean{
var _local2:int;
var _local3:Object;
_local2 = (_arg1.length - 1);
while (_local2 > -1) {
_local3 = new (_arg1[_local2]);
TweenLite.plugins[_local3.propName] = _arg1[_local2];
_local2--;
};
return (true);
}
}
}//package gs.plugins
Section 20
//VisiblePlugin (gs.plugins.VisiblePlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
public class VisiblePlugin extends TweenPlugin {
protected var _tween:TweenLite;
protected var _visible:Boolean;
protected var _target:Object;
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function VisiblePlugin(){
this.propName = "visible";
this.overwriteProps = ["visible"];
this.onComplete = onCompleteTween;
}
override public function set changeFactor(_arg1:Number):void{
if (_target.visible != true){
_target.visible = true;
};
}
public function onCompleteTween():void{
if (((!((_tween.vars.runBackwards == true))) && ((_tween.ease == _tween.vars.ease)))){
_target.visible = _visible;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_tween = _arg3;
_visible = Boolean(_arg2);
return (true);
}
}
}//package gs.plugins
Section 21
//VolumePlugin (gs.plugins.VolumePlugin)
package gs.plugins {
import flash.display.*;
import gs.*;
import flash.media.*;
public class VolumePlugin extends TweenPlugin {
protected var _st:SoundTransform;
protected var _target:Object;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function VolumePlugin(){
this.propName = "volume";
this.overwriteProps = ["volume"];
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_target.soundTransform = _st;
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((isNaN(_arg2)) || (!(_arg1.hasOwnProperty("soundTransform"))))){
return (false);
};
_target = _arg1;
_st = _target.soundTransform;
addTween(_st, "volume", _st.volume, _arg2, "volume");
return (true);
}
}
}//package gs.plugins
Section 22
//ArrayTweenInfo (gs.utils.tween.ArrayTweenInfo)
package gs.utils.tween {
public class ArrayTweenInfo {
public var change:Number;
public var index:uint;
public var start:Number;
public function ArrayTweenInfo(_arg1:uint, _arg2:Number, _arg3:Number){
this.index = _arg1;
this.start = _arg2;
this.change = _arg3;
}
}
}//package gs.utils.tween
Section 23
//TweenInfo (gs.utils.tween.TweenInfo)
package gs.utils.tween {
public class TweenInfo {
public var start:Number;
public var name:String;
public var change:Number;
public var target:Object;
public var property:String;
public var isPlugin:Boolean;
public function TweenInfo(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Boolean){
this.target = _arg1;
this.property = _arg2;
this.start = _arg3;
this.change = _arg4;
this.name = _arg5;
this.isPlugin = _arg6;
}
}
}//package gs.utils.tween
Section 24
//OverwriteManager (gs.OverwriteManager)
package gs {
import gs.utils.tween.*;
import flash.utils.*;
import flash.errors.*;
public class OverwriteManager {
public static const ALL:int = 1;
public static const NONE:int = 0;
public static const AUTO:int = 2;
public static const CONCURRENT:int = 3;
public static const version:Number = 3.12;
public static var mode:int;
public static var enabled:Boolean;
public static function killVars(_arg1:Object, _arg2:Object, _arg3:Array):void{
var _local4:int;
var _local5:String;
var _local6:TweenInfo;
_local4 = (_arg3.length - 1);
while (_local4 > -1) {
_local6 = _arg3[_local4];
if ((_local6.name in _arg1)){
_arg3.splice(_local4, 1);
} else {
if (((_local6.isPlugin) && ((_local6.name == "_MULTIPLE_")))){
_local6.target.killProps(_arg1);
if (_local6.target.overwriteProps.length == 0){
_arg3.splice(_local4, 1);
};
};
};
_local4--;
};
for (_local5 in _arg1) {
delete _arg2[_local5];
};
}
public static function manageOverwrites(_arg1:TweenLite, _arg2:Array):void{
var _local3:Object;
var _local4:int;
var _local5:Number;
var _local6:Array;
var _local7:int;
var _local8:TweenLite;
var _local9:int;
var _local10:Array;
var _local11:Object;
var _local12:int;
var _local13:TweenInfo;
var _local14:Array;
_local3 = _arg1.vars;
_local4 = ((_local3.overwrite)==undefined) ? mode : int(_local3.overwrite);
if ((((_local4 < 2)) || ((_arg2 == null)))){
return;
};
_local5 = _arg1.startTime;
_local6 = [];
_local9 = -1;
_local7 = (_arg2.length - 1);
while (_local7 > -1) {
_local8 = _arg2[_local7];
if (_local8 == _arg1){
_local9 = _local7;
} else {
if ((((((_local7 < _local9)) && ((_local8.startTime <= _local5)))) && (((_local8.startTime + ((_local8.duration * 1000) / _local8.combinedTimeScale)) > _local5)))){
_local6[_local6.length] = _local8;
};
};
_local7--;
};
if ((((_local6.length == 0)) || ((_arg1.tweens.length == 0)))){
return;
};
if (_local4 == AUTO){
_local10 = _arg1.tweens;
_local11 = {};
_local7 = (_local10.length - 1);
while (_local7 > -1) {
_local13 = _local10[_local7];
if (_local13.isPlugin){
if (_local13.name == "_MULTIPLE_"){
_local14 = _local13.target.overwriteProps;
_local12 = (_local14.length - 1);
while (_local12 > -1) {
_local11[_local14[_local12]] = true;
_local12--;
};
} else {
_local11[_local13.name] = true;
};
_local11[_local13.target.propName] = true;
} else {
_local11[_local13.name] = true;
};
_local7--;
};
_local7 = (_local6.length - 1);
while (_local7 > -1) {
killVars(_local11, _local6[_local7].exposedVars, _local6[_local7].tweens);
_local7--;
};
} else {
_local7 = (_local6.length - 1);
while (_local7 > -1) {
_local6[_local7].enabled = false;
_local7--;
};
};
}
public static function init(_arg1:int=2):int{
if (TweenLite.version < 10.09){
trace("TweenLite warning: Your TweenLite class needs to be updated to work with OverwriteManager (or you may need to clear your ASO files). Please download and install the latest version from http://www.tweenlite.com.");
};
TweenLite.overwriteManager = OverwriteManager;
mode = _arg1;
enabled = true;
return (mode);
}
}
}//package gs
Section 25
//TweenLite (gs.TweenLite)
package gs {
import flash.display.*;
import flash.events.*;
import gs.utils.tween.*;
import gs.plugins.*;
import flash.utils.*;
public class TweenLite {
public var delay:Number;
protected var _hasUpdate:Boolean;
protected var _hasPlugins:Boolean;
public var started:Boolean;
public var initted:Boolean;
public var active:Boolean;
public var startTime:Number;
public var target:Object;
public var duration:Number;
public var gc:Boolean;
public var vars:Object;
public var ease:Function;
public var tweens:Array;
public var exposedVars:Object;
public var combinedTimeScale:Number;
public var initTime:Number;
public static const version:Number = 10.09;
private static var _timer:Timer = new Timer(2000);
public static var defaultEase:Function = TweenLite.easeOut;
public static var plugins:Object = {};
public static var currentTime:uint;
public static var masterList:Dictionary = new Dictionary(false);
protected static var _reservedProps:Object = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, roundProps:1, onStart:1, onStartParams:1, persist:1, renderOnStart:1, proxiedEase:1, easeParams:1, yoyo:1, loop:1, onCompleteListener:1, onUpdateListener:1, onStartListener:1, orientToBezier:1, timeScale:1};
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
public static var timingSprite:Sprite = new Sprite();
public static var overwriteManager:Object;
private static var _tlInitted:Boolean;
public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){
var _local4:int;
super();
if (_arg1 == null){
return;
};
if (!_tlInitted){
TweenPlugin.activate([TintPlugin, RemoveTintPlugin, FramePlugin, AutoAlphaPlugin, VisiblePlugin, VolumePlugin, EndArrayPlugin]);
currentTime = getTimer();
timingSprite.addEventListener(Event.ENTER_FRAME, updateAll, false, 0, true);
if (overwriteManager == null){
overwriteManager = {mode:1, enabled:false};
};
_timer.addEventListener("timer", killGarbage, false, 0, true);
_timer.start();
_tlInitted = true;
};
this.vars = _arg3;
this.duration = ((_arg2) || (0.001));
this.delay = ((_arg3.delay) || (0));
this.combinedTimeScale = ((_arg3.timeScale) || (1));
this.active = Boolean((((_arg2 == 0)) && ((this.delay == 0))));
this.target = _arg1;
if (typeof(this.vars.ease) != "function"){
this.vars.ease = defaultEase;
};
if (this.vars.easeParams != null){
this.vars.proxiedEase = this.vars.ease;
this.vars.ease = easeProxy;
};
this.ease = this.vars.ease;
this.exposedVars = ((this.vars.isTV)==true) ? this.vars.exposedVars : this.vars;
this.tweens = [];
this.initTime = currentTime;
this.startTime = (this.initTime + (this.delay * 1000));
_local4 = ((((_arg3.overwrite == undefined)) || (((!(overwriteManager.enabled)) && ((_arg3.overwrite > 1)))))) ? overwriteManager.mode : int(_arg3.overwrite);
if (((!((_arg1 in masterList))) || ((_local4 == 1)))){
masterList[_arg1] = [this];
} else {
masterList[_arg1].push(this);
};
if ((((((this.vars.runBackwards == true)) && (!((this.vars.renderOnStart == true))))) || (this.active))){
initTweenVals();
if (this.active){
render((this.startTime + 1));
} else {
render(this.startTime);
};
if (((((!((this.exposedVars.visible == null))) && ((this.vars.runBackwards == true)))) && ((this.target is DisplayObject)))){
this.target.visible = this.exposedVars.visible;
};
};
}
public function set enabled(_arg1:Boolean):void{
var _local2:Array;
var _local3:Boolean;
var _local4:int;
if (_arg1){
if (!(this.target in masterList)){
masterList[this.target] = [this];
} else {
_local2 = masterList[this.target];
_local4 = (_local2.length - 1);
while (_local4 > -1) {
if (_local2[_local4] == this){
_local3 = true;
break;
};
_local4--;
};
if (!_local3){
_local2[_local2.length] = this;
};
};
};
this.gc = (_arg1) ? false : true;
if (this.gc){
this.active = false;
} else {
this.active = this.started;
};
}
public function clear():void{
this.tweens = [];
this.vars = (this.exposedVars = {ease:this.vars.ease});
_hasUpdate = false;
}
public function render(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
var _local4:TweenInfo;
var _local5:int;
_local2 = ((_arg1 - this.startTime) * 0.001);
if (_local2 >= this.duration){
_local2 = this.duration;
_local3 = ((((this.ease == this.vars.ease)) || ((this.duration == 0.001)))) ? 1 : 0;
} else {
_local3 = this.ease(_local2, 0, 1, this.duration);
};
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local4 = this.tweens[_local5];
_local4.target[_local4.property] = (_local4.start + (_local3 * _local4.change));
_local5--;
};
if (_hasUpdate){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
complete(true);
};
}
public function activate():void{
this.started = (this.active = true);
if (!this.initted){
initTweenVals();
};
if (this.vars.onStart != null){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
if (this.duration == 0.001){
this.startTime = (this.startTime - 1);
};
}
public function get enabled():Boolean{
return ((this.gc) ? false : true);
}
public function initTweenVals():void{
var _local1:String;
var _local2:int;
var _local3:*;
var _local4:TweenInfo;
if (((!((this.exposedVars.timeScale == undefined))) && ((this.target is TweenLite)))){
this.tweens[this.tweens.length] = new TweenInfo(this.target, "timeScale", this.target.timeScale, (this.exposedVars.timeScale - this.target.timeScale), "timeScale", false);
};
for (_local1 in this.exposedVars) {
if ((_local1 in _reservedProps)){
} else {
if ((_local1 in plugins)){
_local3 = new (plugins[_local1]);
if (_local3.onInitTween(this.target, this.exposedVars[_local1], this) == false){
this.tweens[this.tweens.length] = new TweenInfo(this.target, _local1, this.target[_local1], ((typeof(this.exposedVars[_local1]))=="number") ? (this.exposedVars[_local1] - this.target[_local1]) : Number(this.exposedVars[_local1]), _local1, false);
} else {
this.tweens[this.tweens.length] = new TweenInfo(_local3, "changeFactor", 0, 1, ((_local3.overwriteProps.length)==1) ? _local3.overwriteProps[0] : "_MULTIPLE_", true);
_hasPlugins = true;
};
} else {
this.tweens[this.tweens.length] = new TweenInfo(this.target, _local1, this.target[_local1], ((typeof(this.exposedVars[_local1]))=="number") ? (this.exposedVars[_local1] - this.target[_local1]) : Number(this.exposedVars[_local1]), _local1, false);
};
};
};
if (this.vars.runBackwards == true){
_local2 = (this.tweens.length - 1);
while (_local2 > -1) {
_local4 = this.tweens[_local2];
this.tweens[_local2].start = (_local4.start + _local4.change);
_local4.change = -(_local4.change);
_local2--;
};
};
if (this.vars.onUpdate != null){
_hasUpdate = true;
};
if (((TweenLite.overwriteManager.enabled) && ((this.target in masterList)))){
overwriteManager.manageOverwrites(this, masterList[this.target]);
};
this.initted = true;
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
public function killVars(_arg1:Object):void{
if (overwriteManager.enabled){
overwriteManager.killVars(_arg1, this.exposedVars, this.tweens);
};
}
public function complete(_arg1:Boolean=false):void{
var _local2:int;
if (!_arg1){
if (!this.initted){
initTweenVals();
};
this.startTime = (currentTime - ((this.duration * 1000) / this.combinedTimeScale));
render(currentTime);
return;
};
if (_hasPlugins){
_local2 = (this.tweens.length - 1);
while (_local2 > -1) {
if (((this.tweens[_local2].isPlugin) && (!((this.tweens[_local2].target.onComplete == null))))){
this.tweens[_local2].target.onComplete();
};
_local2--;
};
};
if (this.vars.persist != true){
this.enabled = false;
};
if (this.vars.onComplete != null){
this.vars.onComplete.apply(null, this.vars.onCompleteParams);
};
}
public static function updateAll(_arg1:Event=null):void{
var _local2:uint;
var _local3:Dictionary;
var _local4:Array;
var _local5:int;
var _local6:TweenLite;
_local2 = (currentTime = getTimer());
_local3 = masterList;
for each (_local4 in _local3) {
_local5 = (_local4.length - 1);
while (_local5 > -1) {
_local6 = _local4[_local5];
if (_local6.active){
_local6.render(_local2);
} else {
if (_local6.gc){
_local4.splice(_local5, 1);
} else {
if (_local2 >= _local6.startTime){
_local6.activate();
_local6.render(_local2);
};
};
};
_local5--;
};
};
}
public static function removeTween(_arg1:TweenLite, _arg2:Boolean=true):void{
if (_arg1 != null){
if (_arg2){
_arg1.clear();
};
_arg1.enabled = false;
};
}
public static function killTweensOf(_arg1:Object=null, _arg2:Boolean=false):void{
var _local3:Array;
var _local4:int;
var _local5:TweenLite;
if (((!((_arg1 == null))) && ((_arg1 in masterList)))){
_local3 = masterList[_arg1];
_local4 = (_local3.length - 1);
while (_local4 > -1) {
_local5 = _local3[_local4];
if (((_arg2) && (!(_local5.gc)))){
_local5.complete(false);
};
_local5.clear();
_local4--;
};
delete masterList[_arg1];
};
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
_arg3.runBackwards = true;
return (new TweenLite(_arg1, _arg2, _arg3));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
protected static function killGarbage(_arg1:TimerEvent):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = masterList;
for (_local3 in _local2) {
if (_local2[_local3].length == 0){
delete _local2[_local3];
};
};
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, overwrite:0}));
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
}
}//package gs
Section 26
//TweenMax (gs.TweenMax)
package gs {
import flash.events.*;
import gs.utils.tween.*;
import gs.plugins.*;
import gs.events.*;
import flash.utils.*;
public class TweenMax extends TweenLite implements IEventDispatcher {
protected var _dispatcher:EventDispatcher;
protected var _callbacks:Object;
public var pauseTime:Number;
protected var _repeatCount:Number;
protected var _timeScale:Number;
public static const version:Number = 10.1;
public static var removeTween:Function = TweenLite.removeTween;
private static var _overwriteMode:int = (OverwriteManager.enabled) ? OverwriteManager.mode : OverwriteManager.init();
;
protected static var _pausedTweens:Dictionary = new Dictionary(false);
protected static var _globalTimeScale:Number = 1;
public static var killTweensOf:Function = TweenLite.killTweensOf;
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
private static var _activatedPlugins:Boolean = TweenPlugin.activate([TintPlugin, RemoveTintPlugin, FramePlugin, AutoAlphaPlugin, VisiblePlugin, VolumePlugin, EndArrayPlugin, HexColorsPlugin, BlurFilterPlugin, ColorMatrixFilterPlugin, BevelFilterPlugin, DropShadowFilterPlugin, GlowFilterPlugin, RoundPropsPlugin, BezierPlugin, BezierThroughPlugin, ShortRotationPlugin]);
public function TweenMax(_arg1:Object, _arg2:Number, _arg3:Object){
super(_arg1, _arg2, _arg3);
if (TweenLite.version < 10.09){
trace("TweenMax error! Please update your TweenLite class or try deleting your ASO files. TweenMax requires a more recent version. Download updates at http://www.TweenMax.com.");
};
if (((!((this.combinedTimeScale == 1))) && ((this.target is TweenMax)))){
_timeScale = 1;
this.combinedTimeScale = _globalTimeScale;
} else {
_timeScale = this.combinedTimeScale;
this.combinedTimeScale = (this.combinedTimeScale * _globalTimeScale);
};
if (((!((this.combinedTimeScale == 1))) && (!((this.delay == 0))))){
this.startTime = (this.initTime + (this.delay * (1000 / this.combinedTimeScale)));
};
if (((((!((this.vars.onCompleteListener == null))) || (!((this.vars.onUpdateListener == null))))) || (!((this.vars.onStartListener == null))))){
initDispatcher();
if ((((_arg2 == 0)) && ((this.delay == 0)))){
onUpdateDispatcher();
onCompleteDispatcher();
};
};
_repeatCount = 0;
if (((!(isNaN(this.vars.yoyo))) || (!(isNaN(this.vars.loop))))){
this.vars.persist = true;
};
if ((((this.delay == 0)) && (!((this.exposedVars.startAt == null))))){
this.exposedVars.startAt.overwrite = 0;
new TweenMax(this.target, 0, this.exposedVars.startAt);
};
}
override public function set enabled(_arg1:Boolean):void{
if (!_arg1){
_pausedTweens[this] = null;
delete _pausedTweens[this];
};
super.enabled = _arg1;
if (_arg1){
this.combinedTimeScale = (_timeScale * _globalTimeScale);
};
}
public function set reversed(_arg1:Boolean):void{
if (this.reversed != _arg1){
reverse();
};
}
override public function render(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
var _local4:TweenInfo;
var _local5:int;
_local2 = (((_arg1 - this.startTime) * 0.001) * this.combinedTimeScale);
if (_local2 >= this.duration){
_local2 = this.duration;
_local3 = ((((this.ease == this.vars.ease)) || ((this.duration == 0.001)))) ? 1 : 0;
} else {
_local3 = this.ease(_local2, 0, 1, this.duration);
};
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local4 = this.tweens[_local5];
_local4.target[_local4.property] = (_local4.start + (_local3 * _local4.change));
_local5--;
};
if (_hasUpdate){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
complete(true);
};
}
protected function adjustStartValues():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:TweenInfo;
var _local6:int;
_local1 = this.progress;
if (_local1 != 0){
_local2 = this.ease(_local1, 0, 1, 1);
_local3 = (1 / (1 - _local2));
_local6 = (this.tweens.length - 1);
while (_local6 > -1) {
_local5 = this.tweens[_local6];
_local4 = (_local5.start + _local5.change);
if (_local5.isPlugin){
_local5.change = ((_local4 - _local2) * _local3);
} else {
_local5.change = ((_local4 - _local5.target[_local5.property]) * _local3);
};
_local5.start = (_local4 - _local5.change);
_local6--;
};
};
}
public function get timeScale():Number{
return (_timeScale);
}
public function restart(_arg1:Boolean=false):void{
if (_arg1){
this.initTime = currentTime;
this.startTime = (currentTime + (this.delay * (1000 / this.combinedTimeScale)));
} else {
this.startTime = currentTime;
this.initTime = (currentTime - (this.delay * (1000 / this.combinedTimeScale)));
};
_repeatCount = 0;
if (this.target != this.vars.onComplete){
render(this.startTime);
};
this.pauseTime = NaN;
_pausedTweens[this] = null;
delete _pausedTweens[this];
this.enabled = true;
}
public function get paused():Boolean{
return (!(isNaN(this.pauseTime)));
}
public function killProperties(_arg1:Array):void{
var _local2:Object;
var _local3:int;
_local2 = {};
_local3 = (_arg1.length - 1);
while (_local3 > -1) {
_local2[_arg1[_local3]] = true;
_local3--;
};
killVars(_local2);
}
public function resume():void{
this.enabled = true;
if (!isNaN(this.pauseTime)){
this.initTime = (this.initTime + (currentTime - this.pauseTime));
this.startTime = (this.initTime + (this.delay * (1000 / this.combinedTimeScale)));
this.pauseTime = NaN;
if (((!(this.started)) && ((currentTime >= this.startTime)))){
activate();
} else {
this.active = this.started;
};
_pausedTweens[this] = null;
delete _pausedTweens[this];
};
}
override public function complete(_arg1:Boolean=false):void{
if (((((!(isNaN(this.vars.yoyo))) && ((((_repeatCount < this.vars.yoyo)) || ((this.vars.yoyo == 0)))))) || (((!(isNaN(this.vars.loop))) && ((((_repeatCount < this.vars.loop)) || ((this.vars.loop == 0)))))))){
_repeatCount++;
if (!isNaN(this.vars.yoyo)){
this.ease = ((this.vars.ease)==this.ease) ? reverseEase : this.vars.ease;
};
this.startTime = (_arg1) ? (this.startTime + (this.duration * (1000 / this.combinedTimeScale))) : currentTime;
this.initTime = (this.startTime - (this.delay * (1000 / this.combinedTimeScale)));
} else {
if (this.vars.persist == true){
pause();
};
};
super.complete(_arg1);
}
public function invalidate(_arg1:Boolean=true):void{
var _local2:Number;
if (this.initted){
_local2 = this.progress;
if (((!(_arg1)) && (!((_local2 == 0))))){
this.progress = 0;
};
this.tweens = [];
_hasPlugins = false;
this.exposedVars = ((this.vars.isTV)==true) ? this.vars.exposedProps : this.vars;
initTweenVals();
_timeScale = ((this.vars.timeScale) || (1));
this.combinedTimeScale = (_timeScale * _globalTimeScale);
this.delay = ((this.vars.delay) || (0));
if (isNaN(this.pauseTime)){
this.startTime = (this.initTime + ((this.delay * 1000) / this.combinedTimeScale));
};
if (((((!((this.vars.onCompleteListener == null))) || (!((this.vars.onUpdateListener == null))))) || (!((this.vars.onStartListener == null))))){
if (_dispatcher != null){
this.vars.onStart = _callbacks.onStart;
this.vars.onUpdate = _callbacks.onUpdate;
this.vars.onComplete = _callbacks.onComplete;
_dispatcher = null;
};
initDispatcher();
};
if (_local2 != 0){
if (_arg1){
adjustStartValues();
} else {
this.progress = _local2;
};
};
};
}
public function get progress():Number{
var _local1:Number;
var _local2:Number;
_local1 = (isNaN(this.pauseTime)) ? currentTime : this.pauseTime;
_local2 = (((((_local1 - this.initTime) * 0.001) - (this.delay / this.combinedTimeScale)) / this.duration) * this.combinedTimeScale);
if (_local2 > 1){
return (1);
};
if (_local2 < 0){
return (0);
};
return (_local2);
}
public function willTrigger(_arg1:String):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.willTrigger(_arg1));
}
public function dispatchEvent(_arg1:Event):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.dispatchEvent(_arg1));
}
public function get reversed():Boolean{
return ((this.ease == reverseEase));
}
protected function onStartDispatcher(... _args):void{
if (_callbacks.onStart != null){
_callbacks.onStart.apply(null, this.vars.onStartParams);
};
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.START));
}
public function setDestination(_arg1:String, _arg2, _arg3:Boolean=true):void{
var _local4:Number;
var _local5:int;
var _local6:TweenInfo;
var _local7:Object;
var _local8:Object;
var _local9:Array;
var _local10:Boolean;
var _local11:Array;
var _local12:Object;
_local4 = this.progress;
if (this.initted){
if (!_arg3){
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local6 = this.tweens[_local5];
if (_local6.name == _arg1){
_local6.target[_local6.property] = _local6.start;
};
_local5--;
};
};
_local7 = this.vars;
_local8 = this.exposedVars;
_local9 = this.tweens;
_local10 = _hasPlugins;
this.tweens = [];
this.vars = (this.exposedVars = {});
this.vars[_arg1] = _arg2;
initTweenVals();
if (((!((this.ease == reverseEase))) && ((_local7.ease is Function)))){
this.ease = _local7.ease;
};
if (((_arg3) && (!((_local4 == 0))))){
adjustStartValues();
};
_local11 = this.tweens;
this.vars = _local7;
this.exposedVars = _local8;
this.tweens = _local9;
_local12 = {};
_local12[_arg1] = true;
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local6 = this.tweens[_local5];
if (_local6.name == _arg1){
this.tweens.splice(_local5, 1);
} else {
if (((_local6.isPlugin) && ((_local6.name == "_MULTIPLE_")))){
_local6.target.killProps(_local12);
if (_local6.target.overwriteProps.length == 0){
this.tweens.splice(_local5, 1);
};
};
};
_local5--;
};
this.tweens = this.tweens.concat(_local11);
_hasPlugins = Boolean(((_local10) || (_hasPlugins)));
};
this.vars[_arg1] = (this.exposedVars[_arg1] = _arg2);
}
public function set timeScale(_arg1:Number):void{
if (_arg1 < 1E-5){
_arg1 = (_timeScale = 1E-5);
} else {
_timeScale = _arg1;
_arg1 = (_arg1 * _globalTimeScale);
};
this.initTime = ((currentTime - ((((currentTime - this.initTime) - (this.delay * (1000 / this.combinedTimeScale))) * this.combinedTimeScale) * (1 / _arg1))) - (this.delay * (1000 / _arg1)));
if (this.startTime != 999999999999999){
this.startTime = (this.initTime + (this.delay * (1000 / _arg1)));
};
this.combinedTimeScale = _arg1;
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
if (_dispatcher != null){
_dispatcher.removeEventListener(_arg1, _arg2, _arg3);
};
}
override public function initTweenVals():void{
var _local1:int;
var _local2:int;
var _local3:String;
var _local4:String;
var _local5:Array;
var _local6:Object;
var _local7:TweenInfo;
if (((!((this.exposedVars.startAt == null))) && (!((this.delay == 0))))){
this.exposedVars.startAt.overwrite = 0;
new TweenMax(this.target, 0, this.exposedVars.startAt);
};
super.initTweenVals();
if ((((this.exposedVars.roundProps is Array)) && (!((TweenLite.plugins.roundProps == null))))){
_local5 = this.exposedVars.roundProps;
_local1 = (_local5.length - 1);
while (_local1 > -1) {
_local3 = _local5[_local1];
_local2 = (this.tweens.length - 1);
while (_local2 > -1) {
_local7 = this.tweens[_local2];
if (_local7.name == _local3){
if (_local7.isPlugin){
_local7.target.round = true;
} else {
if (_local6 == null){
_local6 = new TweenLite.plugins.roundProps();
_local6.add(_local7.target, _local3, _local7.start, _local7.change);
_hasPlugins = true;
this.tweens[_local2] = new TweenInfo(_local6, "changeFactor", 0, 1, _local3, true);
} else {
_local6.add(_local7.target, _local3, _local7.start, _local7.change);
this.tweens.splice(_local2, 1);
};
};
} else {
if (((((_local7.isPlugin) && ((_local7.name == "_MULTIPLE_")))) && (!(_local7.target.round)))){
_local4 = ((" " + _local7.target.overwriteProps.join(" ")) + " ");
if (_local4.indexOf(((" " + _local3) + " ")) != -1){
_local7.target.round = true;
};
};
};
_local2--;
};
_local1--;
};
};
}
protected function initDispatcher():void{
var _local1:Object;
var _local2:String;
if (_dispatcher == null){
_dispatcher = new EventDispatcher(this);
_callbacks = {onStart:this.vars.onStart, onUpdate:this.vars.onUpdate, onComplete:this.vars.onComplete};
if (this.vars.isTV == true){
this.vars = this.vars.clone();
} else {
_local1 = {};
for (_local2 in this.vars) {
_local1[_local2] = this.vars[_local2];
};
this.vars = _local1;
};
this.vars.onStart = onStartDispatcher;
this.vars.onComplete = onCompleteDispatcher;
if ((this.vars.onStartListener is Function)){
_dispatcher.addEventListener(TweenEvent.START, this.vars.onStartListener, false, 0, true);
};
if ((this.vars.onUpdateListener is Function)){
_dispatcher.addEventListener(TweenEvent.UPDATE, this.vars.onUpdateListener, false, 0, true);
this.vars.onUpdate = onUpdateDispatcher;
_hasUpdate = true;
};
if ((this.vars.onCompleteListener is Function)){
_dispatcher.addEventListener(TweenEvent.COMPLETE, this.vars.onCompleteListener, false, 0, true);
};
};
}
protected function onUpdateDispatcher(... _args):void{
if (_callbacks.onUpdate != null){
_callbacks.onUpdate.apply(null, this.vars.onUpdateParams);
};
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.UPDATE));
}
public function set progress(_arg1:Number):void{
this.startTime = (currentTime - ((this.duration * _arg1) * 1000));
this.initTime = (this.startTime - (this.delay * (1000 / this.combinedTimeScale)));
if (!this.started){
activate();
};
render(currentTime);
if (!isNaN(this.pauseTime)){
this.pauseTime = currentTime;
this.startTime = 999999999999999;
this.active = false;
};
}
public function reverse(_arg1:Boolean=true, _arg2:Boolean=true):void{
var _local3:Number;
this.ease = ((this.vars.ease)==this.ease) ? reverseEase : this.vars.ease;
_local3 = this.progress;
if (((_arg1) && ((_local3 > 0)))){
this.startTime = (currentTime - ((((1 - _local3) * this.duration) * 1000) / this.combinedTimeScale));
this.initTime = (this.startTime - (this.delay * (1000 / this.combinedTimeScale)));
};
if (_arg2 != false){
if (_local3 < 1){
resume();
} else {
restart();
};
};
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
if (_dispatcher == null){
initDispatcher();
};
if ((((_arg1 == TweenEvent.UPDATE)) && (!((this.vars.onUpdate == onUpdateDispatcher))))){
this.vars.onUpdate = onUpdateDispatcher;
_hasUpdate = true;
};
_dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function set paused(_arg1:Boolean):void{
if (_arg1){
pause();
} else {
resume();
};
}
public function hasEventListener(_arg1:String):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.hasEventListener(_arg1));
}
public function pause():void{
if (isNaN(this.pauseTime)){
this.pauseTime = currentTime;
this.startTime = 999999999999999;
this.enabled = false;
_pausedTweens[this] = this;
};
}
public function reverseEase(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.ease((_arg4 - _arg1), _arg2, _arg3, _arg4));
}
protected function onCompleteDispatcher(... _args):void{
if (_callbacks.onComplete != null){
_callbacks.onComplete.apply(null, this.vars.onCompleteParams);
};
_dispatcher.dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
}
public static function set globalTimeScale(_arg1:Number):void{
setGlobalTimeScale(_arg1);
}
public static function pauseAll(_arg1:Boolean=true, _arg2:Boolean=false):void{
changePause(true, _arg1, _arg2);
}
public static function killAllDelayedCalls(_arg1:Boolean=false):void{
killAll(_arg1, false, true);
}
public static function setGlobalTimeScale(_arg1:Number):void{
var _local2:Dictionary;
var _local3:int;
var _local4:Array;
if (_arg1 < 1E-5){
_arg1 = 1E-5;
};
_local2 = masterList;
_globalTimeScale = _arg1;
for each (_local4 in _local2) {
_local3 = (_local4.length - 1);
while (_local3 > -1) {
if ((_local4[_local3] is TweenMax)){
_local4[_local3].timeScale = (_local4[_local3].timeScale * 1);
};
_local3--;
};
};
}
public static function get globalTimeScale():Number{
return (_globalTimeScale);
}
public static function getTweensOf(_arg1:Object):Array{
var _local2:Array;
var _local3:Array;
var _local4:TweenLite;
var _local5:int;
_local2 = masterList[_arg1];
_local3 = [];
if (_local2 != null){
_local5 = (_local2.length - 1);
while (_local5 > -1) {
if (!_local2[_local5].gc){
_local3[_local3.length] = _local2[_local5];
};
_local5--;
};
};
for each (_local4 in _pausedTweens) {
if (_local4.target == _arg1){
_local3[_local3.length] = _local4;
};
};
return (_local3);
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null, _arg4:Boolean=false):TweenMax{
return (new TweenMax(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, persist:_arg4, overwrite:0}));
}
public static function isTweening(_arg1:Object):Boolean{
var _local2:Array;
var _local3:int;
_local2 = getTweensOf(_arg1);
_local3 = (_local2.length - 1);
while (_local3 > -1) {
if (((((_local2[_local3].active) || ((_local2[_local3].startTime == currentTime)))) && (!(_local2[_local3].gc)))){
return (true);
};
_local3--;
};
return (false);
}
public static function changePause(_arg1:Boolean, _arg2:Boolean=true, _arg3:Boolean=false):void{
var _local4:Array;
var _local5:Boolean;
var _local6:int;
_local4 = getAllTweens();
_local6 = (_local4.length - 1);
while (_local6 > -1) {
_local5 = (_local4[_local6].target == _local4[_local6].vars.onComplete);
if ((((_local4[_local6] is TweenMax)) && ((((_local5 == _arg3)) || (!((_local5 == _arg2))))))){
_local4[_local6].paused = _arg1;
};
_local6--;
};
}
public static function killAllTweens(_arg1:Boolean=false):void{
killAll(_arg1, true, false);
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenMax{
_arg3.runBackwards = true;
return (new TweenMax(_arg1, _arg2, _arg3));
}
public static function killAll(_arg1:Boolean=false, _arg2:Boolean=true, _arg3:Boolean=true):void{
var _local4:Array;
var _local5:Boolean;
var _local6:int;
_local4 = getAllTweens();
_local6 = (_local4.length - 1);
while (_local6 > -1) {
_local5 = (_local4[_local6].target == _local4[_local6].vars.onComplete);
if ((((_local5 == _arg3)) || (!((_local5 == _arg2))))){
if (_arg1){
_local4[_local6].complete(false);
_local4[_local6].clear();
} else {
TweenLite.removeTween(_local4[_local6], true);
};
};
_local6--;
};
}
public static function getAllTweens():Array{
var _local1:Dictionary;
var _local2:Array;
var _local3:Array;
var _local4:int;
var _local5:TweenLite;
_local1 = masterList;
_local2 = [];
for each (_local3 in _local1) {
_local4 = (_local3.length - 1);
while (_local4 > -1) {
if (!_local3[_local4].gc){
_local2[_local2.length] = _local3[_local4];
};
_local4--;
};
};
for each (_local5 in _pausedTweens) {
_local2[_local2.length] = _local5;
};
return (_local2);
}
public static function resumeAll(_arg1:Boolean=true, _arg2:Boolean=false):void{
changePause(false, _arg1, _arg2);
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenMax{
return (new TweenMax(_arg1, _arg2, _arg3));
}
}
}//package gs
Section 27
//Bg_1 (main_fla.Bg_1)
package main_fla {
import flash.display.*;
public dynamic class Bg_1 extends MovieClip {
public function Bg_1(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package main_fla
Section 28
//GameMc_4 (main_fla.GameMc_4)
package main_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
import mochi.as3.*;
import flash.media.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class GameMc_4 extends MovieClip {
public var bgChannel:SoundChannel;
public var bar:Bar;
public var menuMC:MovieClip;
public var sp:SimpleButton;
public var finScore:int;
public var level:Number;
public var shared:SharedObject;
public var boardID:String;
public var o:Object;
public var mBtn:SimpleButton;
public var emc:EmptyMc;
public var emc2:EmptyMc;
public var game:Level;
public function GameMc_4(){
addFrameScript(0, frame1, 1, frame2, 3, frame4, 5, frame6, 6, frame7);
}
public function replayBgMusic(_arg1:Event){
bgChannel = new SoundBg().play();
bgChannel.addEventListener(Event.SOUND_COMPLETE, replayBgMusic);
}
public function OnDisplayHandler(){
}
public function startMusic(){
bgChannel = new SoundBg().play();
bgChannel.addEventListener(Event.SOUND_COMPLETE, replayBgMusic);
}
public function OnDisplayHandler1(){
}
public function gotoSponsor(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.payku.com");
navigateToURL(_local2, "_blank");
}
public function stopMusic(){
bgChannel.removeEventListener(Event.SOUND_COMPLETE, replayBgMusic);
bgChannel.stop();
}
public function Highscores(_arg1:Event){
MochiScores.showLeaderboard({boardID:"5bb8c7e3ef5a2f6f", res:"750x600", onClose:onCloseHandler, onDisplay:OnDisplayHandler});
}
public function gotoMenu(_arg1:Event){
gotoAndPlay(1);
}
function frame1(){
sp.addEventListener(MouseEvent.CLICK, gotoSponsor);
level = 0;
if (game != null){
game.Destroy();
emc2.removeChild(game);
game = null;
};
if (bgChannel == null){
bgChannel = new SoundBg().play();
};
bgChannel.addEventListener(Event.SOUND_COMPLETE, replayBgMusic);
if (root["mochiStat"].text == "false"){
MochiServices.connect("881d7fc2cc71eb57", this, onConnectError);
(root["mochiStat"].text == "true");
};
menuMC.mc.btn4.addEventListener(MouseEvent.CLICK, Highscores);
stop();
}
function frame6(){
trace(level);
game = new Level(level);
game.x = -350;
game.y = -300;
emc2.addChild(game);
game.Init();
stop();
}
function frame7(){
finScore = int(root["score"].text);
mBtn.addEventListener(MouseEvent.CLICK, gotoMenu);
stop();
o = {n:[5, 11, 11, 8, 12, 7, 14, 3, 14, 15, 5, 10, 2, 15, 6, 15], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
boardID = o.f(0, "");
MochiScores.showLeaderboard({boardID:boardID, res:"750x600", score:finScore, onClose:onCloseHandler1});
}
function frame4(){
level++;
if (level == 16){
gotoAndPlay(7);
} else {
shared = SharedObject.getLocal("hcshared");
shared.data.lvl = level;
shared.data.score = root["score"].text;
shared.close();
};
}
public function onCloseHandler1(){
gotoAndPlay(1);
}
public function onCloseHandler(){
}
function frame2(){
shared = SharedObject.getLocal("hcshared");
if (shared.data.lvl == undefined){
shared.data.lvl = 1;
root["score"].text = "0";
shared.data.score = 0;
shared.close();
gotoAndPlay(4);
} else {
level = shared.data.lvl;
root["score"].text = shared.data.score;
shared.close();
gotoAndPlay(5);
};
}
public function onConnectError(_arg1:String){
}
}
}//package main_fla
Section 29
//lvltb_23 (main_fla.lvltb_23)
package main_fla {
import flash.display.*;
import flash.text.*;
public dynamic class lvltb_23 extends MovieClip {
public var level:TextField;
}
}//package main_fla
Section 30
//MainTimeline (main_fla.MainTimeline)
package main_fla {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
public dynamic class MainTimeline extends MovieClip {
public var mochiStat:TextField;
public var sp:SimpleButton;
public var lpc:TextField;
public var muted:TextField;
public var GameMC:MovieClip;
public var score:TextField;
public function MainTimeline(){
addFrameScript(0, frame1);
}
public function gotoSponsor(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.payku.com");
navigateToURL(_local2, "_blank");
}
function frame1(){
stop();
this.stop();
this.addEventListener("enterFrame", PL_LOADING);
sp.addEventListener(MouseEvent.CLICK, gotoSponsor);
}
public function PL_LOADING(_arg1:Event):void{
var _local2:Number;
_local2 = ((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100);
lpc.text = (int(_local2) + "%");
if (_local2 == 100){
this.gotoAndStop(3);
this.removeEventListener("enterFrame", PL_LOADING);
};
}
}
}//package main_fla
Section 31
//MenuMc_5 (main_fla.MenuMc_5)
package main_fla {
import flash.display.*;
public dynamic class MenuMc_5 extends MovieClip {
public var mc:MovieClip;
public function MenuMc_5(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package main_fla
Section 32
//MenuScreen_6 (main_fla.MenuScreen_6)
package main_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
import flash.media.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MenuScreen_6 extends MovieClip {
public var t1:Timer;
public var btn3:SimpleButton;
public var btn2:SimpleButton;
public var btn4:SimpleButton;
public var btn1:SimpleButton;
public var btn5:SimpleButton;
public var h:HelpMC;
public function MenuScreen_6(){
addFrameScript(0, frame1);
}
public function btn3Handler(_arg1:Event){
if (h == null){
h = new HelpMC();
h.x = 350;
h.y = -180;
root["GameMC"]["emc"].addChild(h);
} else {
h.gotoAndPlay(31);
t1 = new Timer(1000);
t1.start();
t1.addEventListener(TimerEvent.TIMER, tim);
};
}
public function btn2Handler(_arg1:Event){
root["GameMC"].gotoAndPlay(2);
}
public function btn1Handler(_arg1:Event){
root["GameMC"].gotoAndPlay(4);
root["score"].text = "0";
}
function frame1(){
btn1.addEventListener(MouseEvent.CLICK, btn1Handler);
btn2.addEventListener(MouseEvent.CLICK, btn2Handler);
btn3.addEventListener(MouseEvent.CLICK, btn3Handler);
btn5.addEventListener(MouseEvent.CLICK, btn5Handler);
}
public function tim(_arg1:TimerEvent){
t1.removeEventListener(TimerEvent.TIMER, tim);
t1.stop();
root["GameMC"]["emc"].removeChild(h);
h = null;
}
public function btn5Handler(_arg1:Event){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.payku.com");
navigateToURL(_local2, "_blank");
}
}
}//package main_fla
Section 33
//Sprite131_25 (main_fla.Sprite131_25)
package main_fla {
import flash.display.*;
public dynamic class Sprite131_25 extends MovieClip {
public function Sprite131_25(){
addFrameScript(13, frame14);
}
function frame14(){
stop();
}
}
}//package main_fla
Section 34
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_HIDE:String = "StoreHide";
public static const LOGGED_IN:String = "LoggedIn";
public static const STORE_ITEMS:String = "StoreItems";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
public static const ITEM_NEW:String = "ItemNew";
public static const USER_INFO:String = "UserInfo";
public static const IO_ERROR:String = "IOError";
public static const ITEM_OWNED:String = "ItemOwned";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const ERROR:String = "Error";
public static const LOGGED_OUT:String = "LoggedOut";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOW:String = "LoginShow";
public static const STORE_SHOW:String = "StoreShow";
public static const PROFILE_HIDE:String = "ProfileHide";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function showItem(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("coins_saveUserProperties", _arg1);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showLoginWidget", {options:_arg1});
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showStore(_arg1:Object=null):void{
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function getUserInfo():void{
MochiServices.send("coins_getUserInfo");
}
public static function hideLoginWidget():void{
MochiServices.send("coins_hideLoginWidget");
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
}
}//package mochi.as3
Section 35
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function reencode():void{
var _local1:uint;
_local1 = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String;
_local1 = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function get value():Number{
return (Number(this.toString()));
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String;
_local3 = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 36
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
return;
};
for (_local3 in eventTable[_arg1]) {
var _local6 = eventTable[_arg1];
_local6[_local3](_arg2);
};
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
eventTable[_arg1] = [];
return;
};
for (_local3 in eventTable[_arg1]) {
if (eventTable[_arg1][_local3] != _arg2){
} else {
eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_arg2);
}
}
}//package mochi.as3
Section 37
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const FORMAT_LONG:String = "LongForm";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const FORMAT_SHORT:String = "ShortForm";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_CENTER:String = "ALIGN_C";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var gameStart:Number;
private static var levelStart:Number;
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
var _local3:Object;
var _local4:Object;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_local3.clip = _arg1;
MochiServices.send("events_setNotifications", _local3, null, null);
}
public static function endGame():void{
var _local1:Number;
_local1 = (new Date().time - gameStart);
trigger("end_game", {time:_local1});
}
public static function startGame():void{
gameStart = new Date().time;
trigger("start_game");
}
public static function trigger(_arg1:String, _arg2:Object=null):void{
if (_arg2 == null){
_arg2 = {};
} else {
if (_arg2["kind"] != undefined){
trace("WARNING: optional arguements package contains key 'id', it will be overwritten");
_arg2["kind"] = _arg1;
};
};
MochiServices.send("events_triggerEvent", {eventObject:_arg2}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startLevel():void{
levelStart = new Date().time;
trigger("start_level");
}
public static function endLevel():void{
var _local1:Number;
_local1 = (new Date().time - levelStart);
trigger("end_level", {time:_local1});
}
}
}//package mochi.as3
Section 38
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
delete options.clip;
MochiServices.setContainer();
MochiServices.bringToTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (((((_arg1) && ((_arg1.error == true)))) && (onErrorHandler))){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiServices.warnID(_arg1, true);
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi.as3
Section 39
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _preserved:Object;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
public static var servicesSync:MochiSync = new MochiSync();
private static var _clip:MovieClip;
private static var _id:String;
private static var _services:String = "services.swf";
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _loader:Loader;
private static var _connecting:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _listenChannelName:String = "__ms_";
public static var onError:Object;
public static var netup:Boolean = true;
private static var _mochiLC:String = "MochiLC.swf";
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function onReceive(_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = _clip._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete _clip._callbacks[cb];
}
public static function get childClip():Object{
return (_clip);
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local3:Array;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:MovieClip;
var _local8:LocalConnection;
var _local9:String;
var _local10:ByteArray;
var _local11:ByteArray;
var _local12:uint;
var _local13:uint;
var _local14:Loader;
_local3 = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
_local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
_local6 = [0, 64, 0, 0, 0];
_local7 = new MovieClip();
_local8 = new LocalConnection();
_local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
_local10 = new ByteArray();
_local11 = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
_local12 = ((_local3.length + _local11.length) + 4);
_local13 = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
vars = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
var _local2:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
_local2 = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
var _local3:Number;
_arg1 = _arg1.toLowerCase();
if (_arg1.length != 16){
trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (_arg1 == "1e113c7239048b3f"){
if (_arg2){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (_arg1 == "84993a1de4031cd8"){
if (_arg2){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
_local3 = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_mochiLocalConnection.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.3 as3");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_clip._queue))){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
public static function get id():String{
return (_id);
}
private static function onEvent(_arg1:Object):void{
var _local2:String;
var _local3:String;
_local2 = _arg1.target;
_local3 = _arg1.event;
switch (_local2){
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "sync":
servicesSync.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
private static function urlOptions(_arg1:Object):Object{
var _local2:Object;
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
_local2 = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
};
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_clip._queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function loadLCBridge(_arg1:Object):void{
var loader:Loader;
var mochiLCURL:String;
var req:URLRequest;
var complete:Function;
var clip = _arg1;
loader = new Loader();
mochiLCURL = (_servURL + _mochiLC);
req = new URLRequest(mochiLCURL);
complete = function (_arg1:Object):void{
_mochiLocalConnection = MovieClip(loader.content);
listen();
};
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
loader.load(req);
clip.addChild(loader);
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var _local3:String;
var _local4:String;
var _local5:URLRequest;
var _local6:URLVariables;
_local3 = ("_mochiservices_com_" + _arg1);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
_local4 = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local4 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local4);
_clip = createEmptyMovieClip(_arg2, _local3, 10336, false);
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
_local5 = new URLRequest(_local4);
_local6 = new URLVariables();
_local6.listenLC = _listenChannelName;
_local6.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local6.api_version = getVersion();
if (widget){
_local6.widget = true;
};
_local5.data = _local6;
_loader.load(_local5);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
mc.x = -375;
mc.y = -310;
return (mc);
}
public static function bringToTop(_arg1:Event=null):void{
var e = _arg1;
if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 40
//MochiSync (mochi.as3.MochiSync)
package mochi.as3 {
import flash.utils.*;
public dynamic class MochiSync extends Proxy {
private var _syncContainer:Object;
public static var SYNC_PROPERTY:String = "UpdateProperty";
public static var SYNC_REQUEST:String = "SyncRequest";
public function MochiSync():void{
_syncContainer = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
switch (_arg1){
case SYNC_REQUEST:
MochiServices.send("sync_syncronize", _syncContainer);
break;
case SYNC_PROPERTY:
_syncContainer[_arg2.name] = _arg2.value;
break;
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (_syncContainer[_arg1]);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:String;
if (_syncContainer[_arg1] == _arg2){
return;
};
_local3 = _arg1.toString();
_syncContainer[_local3] = _arg2;
MochiServices.send("sync_propUpdate", {name:_local3, value:_arg2});
}
}
}//package mochi.as3
Section 41
//Bar (Bar)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
import flash.media.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class Bar extends MovieClip {
public var sp:SimpleButton;
public var sw:TextField;
public var btn1:SimpleButton;
public var btn2:SimpleButton;
public var level:TextField;
public var hint:SimpleButton;
public var score:TextField;
public function Bar(){
addFrameScript(0, frame1, 29, frame30);
}
public function btn2Handler(_arg1:Event){
if (root["muted"].text == "0"){
root["muted"].text = "1";
root["GameMC"].stopMusic();
} else {
root["muted"].text = "0";
root["GameMC"].startMusic();
};
}
public function btn1Handler(_arg1:Event){
root["GameMC"].gotoAndPlay(1);
}
function frame1(){
btn1.addEventListener(MouseEvent.CLICK, btn1Handler);
btn2.addEventListener(MouseEvent.CLICK, btn2Handler);
sp.addEventListener(MouseEvent.CLICK, btn5Handler);
}
function frame30(){
stop();
}
public function btn5Handler(_arg1:Event){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.payku.com");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 42
//Batman (Batman)
package {
import flash.display.*;
public dynamic class Batman extends MovieClip {
public function Batman(){
addFrameScript(32, frame33);
}
function frame33(){
stop();
}
}
}//package
Section 43
//Brick (Brick)
package {
import flash.display.*;
public dynamic class Brick extends MovieClip {
public function Brick(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 9, frame10, 10, frame11, 14, frame15);
}
function frame10(){
stop();
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame8(){
stop();
}
function frame2(){
stop();
}
function frame15(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 44
//EmptyMc (EmptyMc)
package {
import flash.display.*;
public dynamic class EmptyMc extends MovieClip {
}
}//package
Section 45
//FieldBG (FieldBG)
package {
import flash.display.*;
public dynamic class FieldBG extends MovieClip {
public function FieldBG(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 46
//Fly (Fly)
package {
import flash.media.*;
public dynamic class Fly extends Sound {
}
}//package
Section 47
//HelpMC (HelpMC)
package {
import flash.display.*;
public dynamic class HelpMC extends MovieClip {
public var lnk:SimpleButton;
public function HelpMC(){
addFrameScript(29, frame30, 44, frame45);
}
function frame30(){
stop();
}
function frame45(){
stop();
}
}
}//package
Section 48
//Level (Level)
package {
import flash.display.*;
import flash.events.*;
import gs.*;
import fl.motion.easing.*;
import flash.media.*;
import flash.utils.*;
import flash.text.*;
import fl.transitions.easing.*;
public class Level extends MovieClip {
public var bar:Bar;
public var fieldSize:int;// = 15
public var lvl:int;
public var offsetX:int;// = 175
public var offsetY:int;// = 20
public var achiv:Array;
public var sl:StartLevel;
public var prevCol:int;// = -1
public var sw:Timer;
public var animationTime:Number;// = 0.3
public var swc:int;// = 0
public var fieldBgInit:Array;
public var bricksLimit:int;
public var lowLevel:int;
public var bonusAllowed:Boolean;// = false
public var score:int;// = 0
public var combos:int;// = 0
public var candiesCnt:int;// = 0
public var res:Boolean;// = false
public var prevRow:int;// = -1
public var movement:Boolean;// = true
public var isMouseDown:Boolean;// = false
public var fieldBg:Array;
public var timeLimit;
public var pauseTimer:Timer;
public var field:Array;
public var numOfCandies:int;
public var pauseTimer2:Timer;
public var pauseTimer4:Timer;
public var fieldInit:Array;
public var pauseTimer3:Timer;
public var globalWin:Boolean;// = false
public var swaps:int;
public var tutorial;
public var col:int;
var tempField:Array;
public var lastPopulate:int;// = 0
public var candies:Array;
public var row:int;
public function Level(_arg1){
fieldSize = 15;
offsetX = 175;
offsetY = 20;
prevRow = -1;
prevCol = -1;
movement = true;
res = false;
animationTime = 0.3;
isMouseDown = false;
combos = 0;
bonusAllowed = false;
score = 0;
lastPopulate = 0;
globalWin = false;
swc = 0;
candiesCnt = 0;
super();
bricksLimit = 6;
lvl = _arg1;
switch (lvl){
case 1:
bricksLimit = 4;
break;
case 2:
bricksLimit = 5;
break;
case 4:
bricksLimit = 5;
break;
case 9:
bricksLimit = 5;
break;
case 13:
bricksLimit = 4;
break;
};
}
public function WinHandler2(){
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < fieldSize) {
_local2 = 0;
while (_local2 < fieldSize) {
if (((!((fieldBg[_local1][_local2] == null))) && (!((fieldBg[_local1][_local2].color == 0))))){
TweenMax.to(fieldBg[_local1][_local2], ((animationTime * Math.random()) * 3), {alpha:0, ease:Linear.easeNone});
};
_local2++;
};
_local1++;
};
pauseTimer3 = new Timer(1500, 0);
pauseTimer3.addEventListener(TimerEvent.TIMER, PauseTimer3Handler);
pauseTimer3.start();
}
public function PopulateField(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:*;
var _local5:int;
var _local6:int;
var _local7:SoundChannel;
_local4 = 0;
_local1 = 0;
while (_local1 < fieldSize) {
_local2 = 0;
while (_local2 < fieldSize) {
if (field[_local1][_local2] == null){
_local3 = int(((Math.random() * bricksLimit) + 1));
if ((((swaps >= candies[candiesCnt])) && ((candiesCnt < numOfCandies)))){
_local3 = 7;
candiesCnt++;
if (root["muted"].text == "0"){
_local7 = new SoundBonus().play();
};
if ((((lvl == 1)) && ((candiesCnt == 1)))){
tutorial = new Note();
tutorial.x = ((offsetX + (37 * _local1)) + 100);
tutorial.y = ((offsetY - (37 * (fieldSize - _local2))) + 300);
root["GameMC"]["emc"].addChild(tutorial);
trace("Tutorial");
};
};
field[_local1][_local2] = new Brick();
field[_local1][_local2].gotoAndStop((1 + _local3));
field[_local1][_local2].color = _local3;
field[_local1][_local2].locked = new Boolean(false);
field[_local1][_local2].act = new String("neutral");
field[_local1][_local2].x = (offsetX + (37 * _local1));
field[_local1][_local2].y = (offsetY - (37 * (fieldSize - _local2)));
addChild(field[_local1][_local2]);
_local4++;
_local6 = (offsetY + (37 * _local2));
TweenMax.to(field[_local1][_local2], animationTime, {y:_local6, ease:Linear.easeIn});
};
_local2++;
};
_local1++;
};
return (_local4);
}
public function SimpleCheck(){
var _local1:*;
var _local2:int;
var _local3:*;
_local1 = 0;
while (_local1 < fieldSize) {
_local3 = 1;
_local2 = 0;
while (_local2 < (fieldSize - 1)) {
if (((((!((tempField[_local1][_local2] == null))) && (!((tempField[_local1][(_local2 + 1)] == null))))) && (!((tempField[_local1][_local2].color == 0))))){
if (tempField[_local1][_local2].color == tempField[_local1][(_local2 + 1)].color){
_local3++;
if (_local3 >= 3){
return (true);
};
} else {
_local3 = 1;
};
};
_local2++;
};
_local1++;
};
_local1 = 0;
while (_local1 < fieldSize) {
_local3 = 1;
_local2 = 0;
while (_local2 < (fieldSize - 1)) {
if (((((!((tempField[_local2][_local1] == null))) && (!((tempField[(_local2 + 1)][_local1] == null))))) && (!((tempField[_local2][_local1].color == 0))))){
if (tempField[_local2][_local1].color == tempField[(_local2 + 1)][_local1].color){
_local3++;
if (_local3 >= 3){
return (true);
};
} else {
_local3 = 1;
};
};
_local2++;
};
_local1++;
};
return (false);
}
public function DisposeEnd(_arg1, _arg2){
var _local3:*;
if (!globalWin){
RefreshField();
};
_local3 = 0;
if ((((numOfCandies == 0)) && (!(globalWin)))){
globalWin = true;
WinHandler();
};
}
public function SWHandler(_arg1:Event){
var _local2:int;
var _local3:int;
var _local4:SoundChannel;
var _local5:int;
var _local6:int;
var _local7:Boolean;
swc++;
if ((timeLimit - swc) >= 0){
_local2 = ((timeLimit - swc) / 60);
_local3 = ((timeLimit - swc) % 60);
if (_local3 <= 9){
root["GameMC"]["bar"].sw.text = ((_local2.toString() + ":0") + _local3.toString());
} else {
root["GameMC"]["bar"].sw.text = ((_local2.toString() + ":") + _local3.toString());
};
if ((timeLimit - swc) <= 10){
if (root["muted"].text == "0"){
_local4 = new SoundTick().play();
};
};
} else {
sw.removeEventListener(TimerEvent.TIMER, SWHandler);
sw.stop();
_local7 = false;
sw.stop();
_local5 = 0;
while (_local5 < fieldSize) {
_local6 = 0;
while (_local6 < fieldSize) {
if (((!((field[_local5][_local6] == null))) && (!((field[_local5][_local6].color == 0))))){
if (!_local7){
TweenMax.to(field[_local5][_local6], (animationTime * 2), {y:600, onComplete:LoseHandler2, ease:Linear.easeIn});
_local7 = true;
} else {
TweenMax.to(field[_local5][_local6], (animationTime * 2), {y:600, ease:Linear.easeIn});
};
};
_local6++;
};
_local5++;
};
if (root["muted"].text == "0"){
_local4 = new SoundLose().play();
};
sl = new StartLevel();
sl.x = 375;
sl.y = 275;
sl.lvlmc.level.text = "Time is over";
addChild(sl);
};
}
public function LoseHandler2(){
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < fieldSize) {
_local2 = 0;
while (_local2 < fieldSize) {
if (((!((fieldBg[_local1][_local2] == null))) && (!((fieldBg[_local1][_local2].color == 0))))){
TweenMax.to(fieldBg[_local1][_local2], ((animationTime * Math.random()) * 3), {alpha:0, ease:Linear.easeNone});
};
_local2++;
};
_local1++;
};
pauseTimer4 = new Timer(1500, 0);
pauseTimer4.addEventListener(TimerEvent.TIMER, PauseTimer4Handler);
pauseTimer4.start();
}
public function PauseTimer4Handler(_arg1:Event){
pauseTimer4.stop();
pauseTimer4.removeEventListener(TimerEvent.TIMER, PauseTimer4Handler);
root["GameMC"].gotoAndPlay(7);
}
public function HintAnimation(_arg1, _arg2, _arg3, _arg4){
TweenMax.to(field[_arg1][_arg2], animationTime, {width:35, ease:Linear.easeIn});
TweenMax.to(field[_arg3][_arg4], animationTime, {width:35, ease:Linear.easeIn});
TweenMax.to(field[_arg1][_arg2], animationTime, {height:35, ease:Linear.easeIn});
TweenMax.to(field[_arg3][_arg4], animationTime, {height:35, ease:Linear.easeIn});
}
public function swHandler2(_arg1:Event){
var _local2:*;
var _local3:int;
var _local4:int;
_local2 = (timeLimit - swc);
swc = (swc + 5);
if (_local2 <= 5){
sw.stop();
} else {
score = (score + 10);
root["GameMC"]["bar"].score.text = score.toString();
_local3 = ((timeLimit - swc) / 60);
_local4 = ((timeLimit - swc) % 60);
if (_local4 <= 9){
root["GameMC"]["bar"].sw.text = ((_local3.toString() + ":0") + _local4.toString());
} else {
root["GameMC"]["bar"].sw.text = ((_local3.toString() + ":") + _local4.toString());
};
};
}
public function PauseTimer2Handler(_arg1:Event){
pauseTimer2.stop();
pauseTimer2.removeEventListener(TimerEvent.TIMER, PauseTimer2Handler);
DrawField();
CheckField();
DeleteChecked();
}
public function DrawBg(){
var _local1:int;
var _local2:int;
var _local3:FieldBG;
_local1 = 0;
while (_local1 < fieldSize) {
_local2 = 0;
while (_local2 < fieldSize) {
if (fieldInit[_local2][_local1] != 0){
_local3 = new FieldBG();
_local3.x = (offsetX + (37 * _local1));
_local3.y = (offsetY + (37 * _local2));
_local3.alpha = 0;
TweenMax.to(_local3, (animationTime * Math.random()), {alpha:1, ease:Linear.easeIn});
addChild(_local3);
};
_local2++;
};
_local1++;
};
}
public function TraceField(){
var _local1:*;
var _local2:*;
var _local3:*;
_local1 = "";
_local2 = 0;
while (_local2 < fieldSize) {
_local1 = "";
_local3 = 0;
while (_local3 < fieldSize) {
if (field[_local3][_local2] != null){
_local1 = (_local1 + (field[_local3][_local2].color + "|"));
} else {
_local1 = (_local1 + "n|");
};
_local3++;
};
trace(_local1);
_local2++;
};
}
public function OnMouseMove(_arg1:Event){
var _local2:*;
var _local3:*;
if (((isMouseDown) && (movement))){
_local2 = (mouseX - 158);
_local3 = (mouseY - 3);
prevCol = col;
prevRow = row;
col = int((_local2 / 37));
row = int((_local3 / 37));
if (((!((prevCol == col))) && ((prevCol >= 0)))){
if (Math.abs((col - prevCol)) == 1){
if (((((((!(field[col][row].locked)) && (!(field[prevCol][prevRow].locked)))) && (!((field[col][row].color == 0))))) && (!((field[prevCol][prevRow].color == 0))))){
SwapPair(col, row, prevCol, prevRow);
isMouseDown = false;
prevCol = -1;
prevRow = -1;
};
};
} else {
if (((!((prevRow == row))) && ((prevRow >= 0)))){
if (Math.abs((row - prevRow)) == 1){
if (((((((!(field[col][row].locked)) && (!(field[prevCol][prevRow].locked)))) && (!((field[col][row].color == 0))))) && (!((field[prevCol][prevRow].color == 0))))){
SwapPair(col, row, prevCol, prevRow);
isMouseDown = false;
};
};
};
};
};
}
public function GetHint(_arg1:Event){
FindMove(true);
}
public function CheckField(){
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Boolean;
var _local11:int;
_local8 = 1;
_local9 = 0;
_local10 = false;
_local11 = 0;
_local1 = 0;
while (_local1 < fieldSize) {
_local5 = 0;
_local8 = 0;
_local10 = false;
_local2 = 0;
while (_local2 < fieldSize) {
if (((((!((field[_local1][_local2] == null))) && (!((field[_local1][(_local2 + 1)] == null))))) && (!((field[_local1][_local2].color == 0))))){
if (field[_local1][_local2].color != 7){
if ((field[_local1][_local2].color == field[_local1][(_local2 + 1)].color)){
if (((!(((_local2 + 1) == fieldSize))) || (!((field[_local1][_local2].color == 0))))){
if (!_local10){
_local6 = _local2;
_local10 = true;
_local8 = 2;
_local7 = (_local2 + 1);
} else {
_local7 = (_local2 + 1);
_local8++;
};
} else {
_local7 = (_local2 + 1);
_local8++;
if (_local8 >= 3){
_local4 = _local6;
_local9 = 0;
while (_local4 <= _local7) {
field[_local1][_local4].act = "del";
_local11++;
_local4++;
_local9++;
};
res = true;
};
_local8 = 0;
_local10 = false;
};
} else {
if (_local8 >= 3){
_local4 = _local6;
_local9 = 0;
while (_local4 <= _local7) {
field[_local1][_local4].act = "del";
_local11++;
_local4++;
_local9++;
};
res = true;
};
_local8 = 0;
_local10 = false;
};
};
} else {
if (_local8 >= 3){
_local4 = _local6;
_local9 = 0;
while (_local4 <= _local7) {
field[_local1][_local4].act = "del";
_local11++;
_local4++;
_local9++;
};
res = true;
};
_local8 = 0;
_local10 = false;
};
_local2++;
};
_local1++;
};
_local1 = 0;
while (_local1 < fieldSize) {
_local5 = 0;
_local8 = 0;
_local10 = false;
_local2 = 0;
while (_local2 < fieldSize) {
if (((!((field[_local2][_local1] == null))) && (((_local2 + 1) < fieldSize)))){
if (field[_local2][_local1].color != 7){
if ((((field[_local2][_local1].color == field[(_local2 + 1)][_local1].color)) && (!((field[_local2][_local1].color == 0))))){
if (((!(((_local2 + 1) == fieldSize))) || (!((field[_local2][_local1].color == 0))))){
if (!_local10){
_local6 = _local2;
_local10 = true;
_local8 = 2;
_local7 = (_local2 + 1);
} else {
_local7 = (_local2 + 1);
_local8++;
};
} else {
_local7 = (_local2 + 1);
_local8++;
if (_local8 >= 3){
_local4 = _local6;
_local9 = 0;
while (_local4 <= _local7) {
field[_local4][_local1].act = "del";
_local11++;
_local4++;
_local9++;
};
res = true;
};
_local8 = 0;
_local10 = false;
};
} else {
if (_local8 >= 3){
_local4 = _local6;
_local9 = 0;
while (_local4 <= _local7) {
field[_local4][_local1].act = "del";
_local11++;
_local4++;
_local9++;
};
res = true;
};
_local8 = 0;
_local10 = false;
};
};
} else {
if (_local8 >= 3){
_local4 = _local6;
_local9 = 0;
while (_local4 <= _local7) {
field[_local4][_local1].act = "del";
_local11++;
_local4++;
_local9++;
};
res = true;
};
_local8 = 0;
_local10 = false;
};
_local2++;
};
_local1++;
};
_local2 = 0;
while (_local2 < fieldSize) {
if (field[_local2][lowLevel].color == 7){
field[_local2][lowLevel].act = "delCandie";
_local11++;
};
_local2++;
};
return (_local11);
}
public function RefreshField(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Boolean;
var _local8:Boolean;
_local6 = 1;
_local7 = true;
_local8 = false;
_local1 = 0;
while (_local1 < fieldSize) {
_local8 = false;
_local2 = (fieldSize - 2);
while (_local2 >= 0) {
if (((!((field[_local1][_local2] == null))) && (!((field[_local1][_local2].color == 0))))){
_local6 = GetOffset(_local1, _local2);
if (field[_local1][(_local2 + _local6)] == null){
_local4 = (offsetY + ((_local2 + _local6) * 37));
TweenMax.to(field[_local1][_local2], animationTime, {y:_local4, ease:Linear.easeIn});
field[_local1][(_local2 + _local6)] = field[_local1][_local2];
field[_local1][_local2] = null;
_local8 = true;
};
};
_local2--;
};
if (_local8){
_local1 = (_local1 - _local6);
};
_local1++;
};
if (PopulateField() > 0){
pauseTimer.start();
lastPopulate = 10;
} else {
lastPopulate = 0;
};
}
public function SwapPair(_arg1, _arg2, _arg3, _arg4){
var _local5:int;
var _local6:int;
var _local7:*;
var _local8:SoundChannel;
if (_arg2 == _arg4){
movement = false;
_local5 = (offsetX + (_arg1 * 37));
_local6 = (offsetX + (_arg3 * 37));
field[_arg1][_arg2].locked = true;
field[_arg3][_arg4].locked = true;
TweenMax.to(field[_arg1][_arg2], 0.2, {x:_local6, onComplete:BrickMoveEnd, onCompleteParams:[_arg1, _arg2, _arg3, _arg4], ease:Linear.easeIn});
TweenMax.to(field[_arg3][_arg4], 0.2, {x:_local5, ease:Linear.easeIn});
_local7 = field[_arg1][_arg2];
field[_arg1][_arg2] = field[_arg3][_arg4];
field[_arg3][_arg4] = _local7;
} else {
if (_arg1 == _arg3){
movement = false;
_local5 = (offsetY + (_arg2 * 37));
_local6 = (offsetY + (_arg4 * 37));
field[_arg1][_arg2].locked = true;
field[_arg3][_arg4].locked = true;
TweenMax.to(field[_arg1][_arg2], 0.2, {y:_local6, onComplete:BrickMoveEnd, onCompleteParams:[_arg1, _arg2, _arg3, _arg4], ease:Linear.easeIn});
TweenMax.to(field[_arg3][_arg4], 0.2, {y:_local5, ease:Linear.easeIn});
_local7 = field[_arg1][_arg2];
field[_arg1][_arg2] = field[_arg3][_arg4];
field[_arg3][_arg4] = _local7;
};
};
if (root["muted"].text == "0"){
_local8 = new SoundMove1().play();
};
}
public function Init(){
var _local1:int;
var _local2:int;
root["GameMC"]["bar"].level.text = lvl.toString();
root["GameMC"]["bar"].score.text = root["score"].text;
score = root["score"].text;
fieldBg = new Array();
fieldBgInit = new Array();
pauseTimer2 = new Timer(((animationTime * 4) * 1000), 0);
pauseTimer2.addEventListener(TimerEvent.TIMER, PauseTimer2Handler);
sw = new Timer(1000, 0);
sw.addEventListener(TimerEvent.TIMER, SWHandler);
sw.start();
_local1 = 0;
while (_local1 < fieldSize) {
fieldBg[_local1] = new Array();
fieldBgInit[_local1] = new Array();
_local2 = 0;
while (_local2 < fieldSize) {
fieldBgInit[_local1][_local2] = 1;
_local2++;
};
_local1++;
};
field = new Array();
fieldInit = new Array();
_local1 = 0;
while (_local1 < fieldSize) {
field[_local1] = new Array();
fieldInit[_local1] = new Array();
_local2 = 0;
while (_local2 < fieldSize) {
fieldInit[_local1][_local2] = int(((Math.random() * bricksLimit) + 1));
_local2++;
};
_local1++;
};
candies = new Array();
swaps = 0;
switch (lvl){
case 1:
timeLimit = 180;
candies = [5, 10, 15];
numOfCandies = 3;
lowLevel = 11;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][3] = 0;
fieldInit[1][3] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][11] = 0;
fieldInit[1][11] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][1] = 0;
fieldInit[2][1] = 0;
fieldBgInit[2][2] = 0;
fieldInit[2][2] = 0;
fieldBgInit[2][3] = 0;
fieldInit[2][3] = 0;
fieldBgInit[2][4] = 0;
fieldInit[2][4] = 0;
fieldBgInit[2][5] = 0;
fieldInit[2][5] = 0;
fieldBgInit[2][6] = 0;
fieldInit[2][6] = 0;
fieldBgInit[2][7] = 0;
fieldInit[2][7] = 0;
fieldBgInit[2][8] = 0;
fieldInit[2][8] = 0;
fieldBgInit[2][9] = 0;
fieldInit[2][9] = 0;
fieldBgInit[2][10] = 0;
fieldInit[2][10] = 0;
fieldBgInit[2][11] = 0;
fieldInit[2][11] = 0;
fieldBgInit[2][12] = 0;
fieldInit[2][12] = 0;
fieldBgInit[2][13] = 0;
fieldInit[2][13] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][1] = 0;
fieldInit[3][1] = 0;
fieldBgInit[3][2] = 0;
fieldInit[3][2] = 0;
fieldBgInit[3][12] = 0;
fieldInit[3][12] = 0;
fieldBgInit[3][13] = 0;
fieldInit[3][13] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][1] = 0;
fieldInit[4][1] = 0;
fieldBgInit[4][2] = 0;
fieldInit[4][2] = 0;
fieldBgInit[4][12] = 0;
fieldInit[4][12] = 0;
fieldBgInit[4][13] = 0;
fieldInit[4][13] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][1] = 0;
fieldInit[5][1] = 0;
fieldBgInit[5][2] = 0;
fieldInit[5][2] = 0;
fieldBgInit[5][12] = 0;
fieldInit[5][12] = 0;
fieldBgInit[5][13] = 0;
fieldInit[5][13] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][1] = 0;
fieldInit[6][1] = 0;
fieldBgInit[6][2] = 0;
fieldInit[6][2] = 0;
fieldBgInit[6][12] = 0;
fieldInit[6][12] = 0;
fieldBgInit[6][13] = 0;
fieldInit[6][13] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][1] = 0;
fieldInit[7][1] = 0;
fieldBgInit[7][2] = 0;
fieldInit[7][2] = 0;
fieldBgInit[7][12] = 0;
fieldInit[7][12] = 0;
fieldBgInit[7][13] = 0;
fieldInit[7][13] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][1] = 0;
fieldInit[8][1] = 0;
fieldBgInit[8][2] = 0;
fieldInit[8][2] = 0;
fieldBgInit[8][12] = 0;
fieldInit[8][12] = 0;
fieldBgInit[8][13] = 0;
fieldInit[8][13] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][1] = 0;
fieldInit[9][1] = 0;
fieldBgInit[9][2] = 0;
fieldInit[9][2] = 0;
fieldBgInit[9][12] = 0;
fieldInit[9][12] = 0;
fieldBgInit[9][13] = 0;
fieldInit[9][13] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][1] = 0;
fieldInit[10][1] = 0;
fieldBgInit[10][2] = 0;
fieldInit[10][2] = 0;
fieldBgInit[10][12] = 0;
fieldInit[10][12] = 0;
fieldBgInit[10][13] = 0;
fieldInit[10][13] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][1] = 0;
fieldInit[11][1] = 0;
fieldBgInit[11][2] = 0;
fieldInit[11][2] = 0;
fieldBgInit[11][12] = 0;
fieldInit[11][12] = 0;
fieldBgInit[11][13] = 0;
fieldInit[11][13] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][1] = 0;
fieldInit[12][1] = 0;
fieldBgInit[12][2] = 0;
fieldInit[12][2] = 0;
fieldBgInit[12][3] = 0;
fieldInit[12][3] = 0;
fieldBgInit[12][4] = 0;
fieldInit[12][4] = 0;
fieldBgInit[12][5] = 0;
fieldInit[12][5] = 0;
fieldBgInit[12][6] = 0;
fieldInit[12][6] = 0;
fieldBgInit[12][7] = 0;
fieldInit[12][7] = 0;
fieldBgInit[12][8] = 0;
fieldInit[12][8] = 0;
fieldBgInit[12][9] = 0;
fieldInit[12][9] = 0;
fieldBgInit[12][10] = 0;
fieldInit[12][10] = 0;
fieldBgInit[12][11] = 0;
fieldInit[12][11] = 0;
fieldBgInit[12][12] = 0;
fieldInit[12][12] = 0;
fieldBgInit[12][13] = 0;
fieldInit[12][13] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][1] = 0;
fieldInit[13][1] = 0;
fieldBgInit[13][2] = 0;
fieldInit[13][2] = 0;
fieldBgInit[13][3] = 0;
fieldInit[13][3] = 0;
fieldBgInit[13][4] = 0;
fieldInit[13][4] = 0;
fieldBgInit[13][5] = 0;
fieldInit[13][5] = 0;
fieldBgInit[13][6] = 0;
fieldInit[13][6] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][8] = 0;
fieldInit[13][8] = 0;
fieldBgInit[13][9] = 0;
fieldInit[13][9] = 0;
fieldBgInit[13][10] = 0;
fieldInit[13][10] = 0;
fieldBgInit[13][11] = 0;
fieldInit[13][11] = 0;
fieldBgInit[13][12] = 0;
fieldInit[13][12] = 0;
fieldBgInit[13][13] = 0;
fieldInit[13][13] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
fieldBgInit[5][5] = 2;
fieldBgInit[5][6] = 2;
fieldBgInit[5][7] = 2;
fieldBgInit[5][8] = 2;
fieldBgInit[5][9] = 2;
fieldBgInit[6][5] = 2;
fieldBgInit[6][6] = 2;
fieldBgInit[6][7] = 2;
fieldBgInit[6][8] = 2;
fieldBgInit[6][9] = 2;
fieldBgInit[7][5] = 2;
fieldBgInit[7][6] = 2;
fieldBgInit[7][8] = 2;
fieldBgInit[7][9] = 2;
fieldBgInit[8][5] = 2;
fieldBgInit[8][6] = 2;
fieldBgInit[8][7] = 2;
fieldBgInit[8][8] = 2;
fieldBgInit[8][9] = 2;
fieldBgInit[9][5] = 2;
fieldBgInit[9][6] = 2;
fieldBgInit[9][7] = 2;
fieldBgInit[9][8] = 2;
fieldBgInit[9][9] = 2;
break;
case 2:
timeLimit = 90;
candies = [5, 10, 15];
numOfCandies = 3;
lowLevel = 11;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][3] = 0;
fieldInit[1][3] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][11] = 0;
fieldInit[1][11] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][1] = 0;
fieldInit[2][1] = 0;
fieldBgInit[2][2] = 0;
fieldInit[2][2] = 0;
fieldBgInit[2][3] = 0;
fieldInit[2][3] = 0;
fieldBgInit[2][4] = 0;
fieldInit[2][4] = 0;
fieldBgInit[2][5] = 0;
fieldInit[2][5] = 0;
fieldBgInit[2][6] = 0;
fieldInit[2][6] = 0;
fieldBgInit[2][7] = 0;
fieldInit[2][7] = 0;
fieldBgInit[2][8] = 0;
fieldInit[2][8] = 0;
fieldBgInit[2][9] = 0;
fieldInit[2][9] = 0;
fieldBgInit[2][10] = 0;
fieldInit[2][10] = 0;
fieldBgInit[2][11] = 0;
fieldInit[2][11] = 0;
fieldBgInit[2][12] = 0;
fieldInit[2][12] = 0;
fieldBgInit[2][13] = 0;
fieldInit[2][13] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][1] = 0;
fieldInit[3][1] = 0;
fieldBgInit[3][2] = 0;
fieldInit[3][2] = 0;
fieldBgInit[3][3] = 0;
fieldInit[3][3] = 0;
fieldBgInit[3][4] = 0;
fieldInit[3][4] = 0;
fieldBgInit[3][5] = 0;
fieldInit[3][5] = 0;
fieldBgInit[3][6] = 0;
fieldInit[3][6] = 0;
fieldBgInit[3][7] = 0;
fieldInit[3][7] = 0;
fieldBgInit[3][8] = 0;
fieldInit[3][8] = 0;
fieldBgInit[3][9] = 0;
fieldInit[3][9] = 0;
fieldBgInit[3][10] = 0;
fieldInit[3][10] = 0;
fieldBgInit[3][11] = 0;
fieldInit[3][11] = 0;
fieldBgInit[3][12] = 0;
fieldInit[3][12] = 0;
fieldBgInit[3][13] = 0;
fieldInit[3][13] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][1] = 0;
fieldInit[4][1] = 0;
fieldBgInit[4][2] = 0;
fieldInit[4][2] = 0;
fieldBgInit[4][3] = 0;
fieldInit[4][3] = 0;
fieldBgInit[4][4] = 0;
fieldInit[4][4] = 0;
fieldBgInit[4][5] = 0;
fieldInit[4][5] = 0;
fieldBgInit[4][6] = 0;
fieldInit[4][6] = 0;
fieldBgInit[4][8] = 0;
fieldInit[4][8] = 0;
fieldBgInit[4][9] = 0;
fieldInit[4][9] = 0;
fieldBgInit[4][10] = 0;
fieldInit[4][10] = 0;
fieldBgInit[4][11] = 0;
fieldInit[4][11] = 0;
fieldBgInit[4][12] = 0;
fieldInit[4][12] = 0;
fieldBgInit[4][13] = 0;
fieldInit[4][13] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][1] = 0;
fieldInit[5][1] = 0;
fieldBgInit[5][2] = 0;
fieldInit[5][2] = 0;
fieldBgInit[5][3] = 0;
fieldInit[5][3] = 0;
fieldBgInit[5][4] = 0;
fieldInit[5][4] = 0;
fieldBgInit[5][5] = 0;
fieldInit[5][5] = 0;
fieldBgInit[5][9] = 0;
fieldInit[5][9] = 0;
fieldBgInit[5][10] = 0;
fieldInit[5][10] = 0;
fieldBgInit[5][11] = 0;
fieldInit[5][11] = 0;
fieldBgInit[5][12] = 0;
fieldInit[5][12] = 0;
fieldBgInit[5][13] = 0;
fieldInit[5][13] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][1] = 0;
fieldInit[6][1] = 0;
fieldBgInit[6][2] = 0;
fieldInit[6][2] = 0;
fieldBgInit[6][3] = 0;
fieldInit[6][3] = 0;
fieldBgInit[6][4] = 0;
fieldInit[6][4] = 0;
fieldBgInit[6][10] = 0;
fieldInit[6][10] = 0;
fieldBgInit[6][11] = 0;
fieldInit[6][11] = 0;
fieldBgInit[6][12] = 0;
fieldInit[6][12] = 0;
fieldBgInit[6][13] = 0;
fieldInit[6][13] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][1] = 0;
fieldInit[7][1] = 0;
fieldBgInit[7][2] = 0;
fieldInit[7][2] = 0;
fieldBgInit[7][3] = 0;
fieldInit[7][3] = 0;
fieldBgInit[7][11] = 0;
fieldInit[7][11] = 0;
fieldBgInit[7][12] = 0;
fieldInit[7][12] = 0;
fieldBgInit[7][13] = 0;
fieldInit[7][13] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][1] = 0;
fieldInit[8][1] = 0;
fieldBgInit[8][2] = 0;
fieldInit[8][2] = 0;
fieldBgInit[8][12] = 0;
fieldInit[8][12] = 0;
fieldBgInit[8][13] = 0;
fieldInit[8][13] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][1] = 0;
fieldInit[9][1] = 0;
fieldBgInit[9][13] = 0;
fieldInit[9][13] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][1] = 0;
fieldInit[10][1] = 0;
fieldBgInit[10][13] = 0;
fieldInit[10][13] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][1] = 0;
fieldInit[11][1] = 0;
fieldBgInit[11][13] = 0;
fieldInit[11][13] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][1] = 0;
fieldInit[12][1] = 0;
fieldBgInit[12][2] = 0;
fieldInit[12][2] = 0;
fieldBgInit[12][3] = 0;
fieldInit[12][3] = 0;
fieldBgInit[12][4] = 0;
fieldInit[12][4] = 0;
fieldBgInit[12][5] = 0;
fieldInit[12][5] = 0;
fieldBgInit[12][6] = 0;
fieldInit[12][6] = 0;
fieldBgInit[12][7] = 0;
fieldInit[12][7] = 0;
fieldBgInit[12][8] = 0;
fieldInit[12][8] = 0;
fieldBgInit[12][9] = 0;
fieldInit[12][9] = 0;
fieldBgInit[12][10] = 0;
fieldInit[12][10] = 0;
fieldBgInit[12][11] = 0;
fieldInit[12][11] = 0;
fieldBgInit[12][12] = 0;
fieldInit[12][12] = 0;
fieldBgInit[12][13] = 0;
fieldInit[12][13] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][1] = 0;
fieldInit[13][1] = 0;
fieldBgInit[13][2] = 0;
fieldInit[13][2] = 0;
fieldBgInit[13][3] = 0;
fieldInit[13][3] = 0;
fieldBgInit[13][4] = 0;
fieldInit[13][4] = 0;
fieldBgInit[13][5] = 0;
fieldInit[13][5] = 0;
fieldBgInit[13][6] = 0;
fieldInit[13][6] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][8] = 0;
fieldInit[13][8] = 0;
fieldBgInit[13][9] = 0;
fieldInit[13][9] = 0;
fieldBgInit[13][10] = 0;
fieldInit[13][10] = 0;
fieldBgInit[13][11] = 0;
fieldInit[13][11] = 0;
fieldBgInit[13][12] = 0;
fieldInit[13][12] = 0;
fieldBgInit[13][13] = 0;
fieldInit[13][13] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 3:
timeLimit = 90;
candies = [5, 10, 15];
numOfCandies = 3;
lowLevel = 12;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][3] = 0;
fieldInit[1][3] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][11] = 0;
fieldInit[1][11] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][1] = 0;
fieldInit[2][1] = 0;
fieldBgInit[2][3] = 0;
fieldInit[2][3] = 0;
fieldBgInit[2][4] = 0;
fieldInit[2][4] = 0;
fieldBgInit[2][5] = 0;
fieldInit[2][5] = 0;
fieldBgInit[2][6] = 0;
fieldInit[2][6] = 0;
fieldBgInit[2][7] = 0;
fieldInit[2][7] = 0;
fieldBgInit[2][8] = 0;
fieldInit[2][8] = 0;
fieldBgInit[2][9] = 0;
fieldInit[2][9] = 0;
fieldBgInit[2][10] = 0;
fieldInit[2][10] = 0;
fieldBgInit[2][11] = 0;
fieldInit[2][11] = 0;
fieldBgInit[2][13] = 0;
fieldInit[2][13] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][1] = 0;
fieldInit[3][1] = 0;
fieldBgInit[3][4] = 0;
fieldInit[3][4] = 0;
fieldBgInit[3][5] = 0;
fieldInit[3][5] = 0;
fieldBgInit[3][6] = 0;
fieldInit[3][6] = 0;
fieldBgInit[3][7] = 0;
fieldInit[3][7] = 0;
fieldBgInit[3][8] = 0;
fieldInit[3][8] = 0;
fieldBgInit[3][9] = 0;
fieldInit[3][9] = 0;
fieldBgInit[3][10] = 0;
fieldInit[3][10] = 0;
fieldBgInit[3][13] = 0;
fieldInit[3][13] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][1] = 0;
fieldInit[4][1] = 0;
fieldBgInit[4][5] = 0;
fieldInit[4][5] = 0;
fieldBgInit[4][6] = 0;
fieldInit[4][6] = 0;
fieldBgInit[4][7] = 0;
fieldInit[4][7] = 0;
fieldBgInit[4][8] = 0;
fieldInit[4][8] = 0;
fieldBgInit[4][9] = 0;
fieldInit[4][9] = 0;
fieldBgInit[4][13] = 0;
fieldInit[4][13] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][1] = 0;
fieldInit[5][1] = 0;
fieldBgInit[5][6] = 0;
fieldInit[5][6] = 0;
fieldBgInit[5][7] = 0;
fieldInit[5][7] = 0;
fieldBgInit[5][8] = 0;
fieldInit[5][8] = 0;
fieldBgInit[5][13] = 0;
fieldInit[5][13] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][1] = 0;
fieldInit[6][1] = 0;
fieldBgInit[6][7] = 0;
fieldInit[6][7] = 0;
fieldBgInit[6][13] = 0;
fieldInit[6][13] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][1] = 0;
fieldInit[7][1] = 0;
fieldBgInit[7][13] = 0;
fieldInit[7][13] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][1] = 0;
fieldInit[8][1] = 0;
fieldBgInit[8][13] = 0;
fieldInit[8][13] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][1] = 0;
fieldInit[9][1] = 0;
fieldBgInit[9][13] = 0;
fieldInit[9][13] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][1] = 0;
fieldInit[10][1] = 0;
fieldBgInit[10][13] = 0;
fieldInit[10][13] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][1] = 0;
fieldInit[11][1] = 0;
fieldBgInit[11][13] = 0;
fieldInit[11][13] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][1] = 0;
fieldInit[12][1] = 0;
fieldBgInit[12][13] = 0;
fieldInit[12][13] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][1] = 0;
fieldInit[13][1] = 0;
fieldBgInit[13][2] = 0;
fieldInit[13][2] = 0;
fieldBgInit[13][3] = 0;
fieldInit[13][3] = 0;
fieldBgInit[13][4] = 0;
fieldInit[13][4] = 0;
fieldBgInit[13][5] = 0;
fieldInit[13][5] = 0;
fieldBgInit[13][6] = 0;
fieldInit[13][6] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][8] = 0;
fieldInit[13][8] = 0;
fieldBgInit[13][9] = 0;
fieldInit[13][9] = 0;
fieldBgInit[13][10] = 0;
fieldInit[13][10] = 0;
fieldBgInit[13][11] = 0;
fieldInit[13][11] = 0;
fieldBgInit[13][12] = 0;
fieldInit[13][12] = 0;
fieldBgInit[13][13] = 0;
fieldInit[13][13] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 4:
timeLimit = 60;
candies = [5, 10, 15];
numOfCandies = 3;
lowLevel = 12;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][3] = 0;
fieldInit[1][3] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][11] = 0;
fieldInit[1][11] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][1] = 0;
fieldInit[2][1] = 0;
fieldBgInit[2][2] = 0;
fieldInit[2][2] = 0;
fieldBgInit[2][3] = 0;
fieldInit[2][3] = 0;
fieldBgInit[2][4] = 0;
fieldInit[2][4] = 0;
fieldBgInit[2][5] = 0;
fieldInit[2][5] = 0;
fieldBgInit[2][6] = 0;
fieldInit[2][6] = 0;
fieldBgInit[2][7] = 0;
fieldInit[2][7] = 0;
fieldBgInit[2][8] = 0;
fieldInit[2][8] = 0;
fieldBgInit[2][9] = 0;
fieldInit[2][9] = 0;
fieldBgInit[2][10] = 0;
fieldInit[2][10] = 0;
fieldBgInit[2][11] = 0;
fieldInit[2][11] = 0;
fieldBgInit[2][12] = 0;
fieldInit[2][12] = 0;
fieldBgInit[2][13] = 0;
fieldInit[2][13] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][1] = 0;
fieldInit[3][1] = 0;
fieldBgInit[3][2] = 0;
fieldInit[3][2] = 0;
fieldBgInit[3][3] = 0;
fieldInit[3][3] = 0;
fieldBgInit[3][4] = 0;
fieldInit[3][4] = 0;
fieldBgInit[3][5] = 0;
fieldInit[3][5] = 0;
fieldBgInit[3][6] = 0;
fieldInit[3][6] = 0;
fieldBgInit[3][7] = 0;
fieldInit[3][7] = 0;
fieldBgInit[3][8] = 0;
fieldInit[3][8] = 0;
fieldBgInit[3][9] = 0;
fieldInit[3][9] = 0;
fieldBgInit[3][10] = 0;
fieldInit[3][10] = 0;
fieldBgInit[3][11] = 0;
fieldInit[3][11] = 0;
fieldBgInit[3][12] = 0;
fieldInit[3][12] = 0;
fieldBgInit[3][13] = 0;
fieldInit[3][13] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][1] = 0;
fieldInit[4][1] = 0;
fieldBgInit[4][13] = 0;
fieldInit[4][13] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][1] = 0;
fieldInit[5][1] = 0;
fieldBgInit[5][13] = 0;
fieldInit[5][13] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][1] = 0;
fieldInit[6][1] = 0;
fieldBgInit[6][7] = 0;
fieldInit[6][7] = 0;
fieldBgInit[6][13] = 0;
fieldInit[6][13] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][1] = 0;
fieldInit[7][1] = 0;
fieldBgInit[7][3] = 0;
fieldInit[7][3] = 0;
fieldBgInit[7][4] = 0;
fieldInit[7][4] = 0;
fieldBgInit[7][5] = 0;
fieldInit[7][5] = 0;
fieldBgInit[7][7] = 0;
fieldInit[7][7] = 0;
fieldBgInit[7][9] = 0;
fieldInit[7][9] = 0;
fieldBgInit[7][10] = 0;
fieldInit[7][10] = 0;
fieldBgInit[7][11] = 0;
fieldInit[7][11] = 0;
fieldBgInit[7][13] = 0;
fieldInit[7][13] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][1] = 0;
fieldInit[8][1] = 0;
fieldBgInit[8][7] = 0;
fieldInit[8][7] = 0;
fieldBgInit[8][13] = 0;
fieldInit[8][13] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][1] = 0;
fieldInit[9][1] = 0;
fieldBgInit[9][7] = 0;
fieldInit[9][7] = 0;
fieldBgInit[9][13] = 0;
fieldInit[9][13] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][1] = 0;
fieldInit[10][1] = 0;
fieldBgInit[10][7] = 0;
fieldInit[10][7] = 0;
fieldBgInit[10][13] = 0;
fieldInit[10][13] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][1] = 0;
fieldInit[11][1] = 0;
fieldBgInit[11][7] = 0;
fieldInit[11][7] = 0;
fieldBgInit[11][13] = 0;
fieldInit[11][13] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][1] = 0;
fieldInit[12][1] = 0;
fieldBgInit[12][7] = 0;
fieldInit[12][7] = 0;
fieldBgInit[12][13] = 0;
fieldInit[12][13] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][1] = 0;
fieldInit[13][1] = 0;
fieldBgInit[13][2] = 0;
fieldInit[13][2] = 0;
fieldBgInit[13][3] = 0;
fieldInit[13][3] = 0;
fieldBgInit[13][4] = 0;
fieldInit[13][4] = 0;
fieldBgInit[13][5] = 0;
fieldInit[13][5] = 0;
fieldBgInit[13][6] = 0;
fieldInit[13][6] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][8] = 0;
fieldInit[13][8] = 0;
fieldBgInit[13][9] = 0;
fieldInit[13][9] = 0;
fieldBgInit[13][10] = 0;
fieldInit[13][10] = 0;
fieldBgInit[13][11] = 0;
fieldInit[13][11] = 0;
fieldBgInit[13][12] = 0;
fieldInit[13][12] = 0;
fieldBgInit[13][13] = 0;
fieldInit[13][13] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 5:
timeLimit = 90;
candies = [5, 10, 15];
numOfCandies = 3;
lowLevel = 9;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][3] = 0;
fieldInit[1][3] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][11] = 0;
fieldInit[1][11] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][1] = 0;
fieldInit[2][1] = 0;
fieldBgInit[2][2] = 0;
fieldInit[2][2] = 0;
fieldBgInit[2][3] = 0;
fieldInit[2][3] = 0;
fieldBgInit[2][4] = 0;
fieldInit[2][4] = 0;
fieldBgInit[2][5] = 0;
fieldInit[2][5] = 0;
fieldBgInit[2][6] = 0;
fieldInit[2][6] = 0;
fieldBgInit[2][7] = 0;
fieldInit[2][7] = 0;
fieldBgInit[2][8] = 0;
fieldInit[2][8] = 0;
fieldBgInit[2][9] = 0;
fieldInit[2][9] = 0;
fieldBgInit[2][10] = 0;
fieldInit[2][10] = 0;
fieldBgInit[2][11] = 0;
fieldInit[2][11] = 0;
fieldBgInit[2][12] = 0;
fieldInit[2][12] = 0;
fieldBgInit[2][13] = 0;
fieldInit[2][13] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][1] = 0;
fieldInit[3][1] = 0;
fieldBgInit[3][2] = 0;
fieldInit[3][2] = 0;
fieldBgInit[3][3] = 0;
fieldInit[3][3] = 0;
fieldBgInit[3][4] = 0;
fieldInit[3][4] = 0;
fieldBgInit[3][11] = 0;
fieldInit[3][11] = 0;
fieldBgInit[3][12] = 0;
fieldInit[3][12] = 0;
fieldBgInit[3][13] = 0;
fieldInit[3][13] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][1] = 0;
fieldInit[4][1] = 0;
fieldBgInit[4][2] = 0;
fieldInit[4][2] = 0;
fieldBgInit[4][3] = 0;
fieldInit[4][3] = 0;
fieldBgInit[4][12] = 0;
fieldInit[4][12] = 0;
fieldBgInit[4][13] = 0;
fieldInit[4][13] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][1] = 0;
fieldInit[5][1] = 0;
fieldBgInit[5][2] = 0;
fieldInit[5][2] = 0;
fieldBgInit[5][13] = 0;
fieldInit[5][13] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][1] = 0;
fieldInit[6][1] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][1] = 0;
fieldInit[7][1] = 0;
fieldBgInit[7][2] = 0;
fieldInit[7][2] = 0;
fieldBgInit[7][13] = 0;
fieldInit[7][13] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][1] = 0;
fieldInit[8][1] = 0;
fieldBgInit[8][2] = 0;
fieldInit[8][2] = 0;
fieldBgInit[8][3] = 0;
fieldInit[8][3] = 0;
fieldBgInit[8][12] = 0;
fieldInit[8][12] = 0;
fieldBgInit[8][13] = 0;
fieldInit[8][13] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][1] = 0;
fieldInit[9][1] = 0;
fieldBgInit[9][2] = 0;
fieldInit[9][2] = 0;
fieldBgInit[9][3] = 0;
fieldInit[9][3] = 0;
fieldBgInit[9][4] = 0;
fieldInit[9][4] = 0;
fieldBgInit[9][11] = 0;
fieldInit[9][11] = 0;
fieldBgInit[9][12] = 0;
fieldInit[9][12] = 0;
fieldBgInit[9][13] = 0;
fieldInit[9][13] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][1] = 0;
fieldInit[10][1] = 0;
fieldBgInit[10][2] = 0;
fieldInit[10][2] = 0;
fieldBgInit[10][3] = 0;
fieldInit[10][3] = 0;
fieldBgInit[10][4] = 0;
fieldInit[10][4] = 0;
fieldBgInit[10][5] = 0;
fieldInit[10][5] = 0;
fieldBgInit[10][6] = 0;
fieldInit[10][6] = 0;
fieldBgInit[10][7] = 0;
fieldInit[10][7] = 0;
fieldBgInit[10][8] = 0;
fieldInit[10][8] = 0;
fieldBgInit[10][9] = 0;
fieldInit[10][9] = 0;
fieldBgInit[10][10] = 0;
fieldInit[10][10] = 0;
fieldBgInit[10][11] = 0;
fieldInit[10][11] = 0;
fieldBgInit[10][12] = 0;
fieldInit[10][12] = 0;
fieldBgInit[10][13] = 0;
fieldInit[10][13] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][1] = 0;
fieldInit[11][1] = 0;
fieldBgInit[11][2] = 0;
fieldInit[11][2] = 0;
fieldBgInit[11][3] = 0;
fieldInit[11][3] = 0;
fieldBgInit[11][4] = 0;
fieldInit[11][4] = 0;
fieldBgInit[11][5] = 0;
fieldInit[11][5] = 0;
fieldBgInit[11][6] = 0;
fieldInit[11][6] = 0;
fieldBgInit[11][7] = 0;
fieldInit[11][7] = 0;
fieldBgInit[11][8] = 0;
fieldInit[11][8] = 0;
fieldBgInit[11][9] = 0;
fieldInit[11][9] = 0;
fieldBgInit[11][10] = 0;
fieldInit[11][10] = 0;
fieldBgInit[11][11] = 0;
fieldInit[11][11] = 0;
fieldBgInit[11][12] = 0;
fieldInit[11][12] = 0;
fieldBgInit[11][13] = 0;
fieldInit[11][13] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][1] = 0;
fieldInit[12][1] = 0;
fieldBgInit[12][2] = 0;
fieldInit[12][2] = 0;
fieldBgInit[12][3] = 0;
fieldInit[12][3] = 0;
fieldBgInit[12][4] = 0;
fieldInit[12][4] = 0;
fieldBgInit[12][5] = 0;
fieldInit[12][5] = 0;
fieldBgInit[12][6] = 0;
fieldInit[12][6] = 0;
fieldBgInit[12][7] = 0;
fieldInit[12][7] = 0;
fieldBgInit[12][8] = 0;
fieldInit[12][8] = 0;
fieldBgInit[12][9] = 0;
fieldInit[12][9] = 0;
fieldBgInit[12][10] = 0;
fieldInit[12][10] = 0;
fieldBgInit[12][11] = 0;
fieldInit[12][11] = 0;
fieldBgInit[12][12] = 0;
fieldInit[12][12] = 0;
fieldBgInit[12][13] = 0;
fieldInit[12][13] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][1] = 0;
fieldInit[13][1] = 0;
fieldBgInit[13][2] = 0;
fieldInit[13][2] = 0;
fieldBgInit[13][3] = 0;
fieldInit[13][3] = 0;
fieldBgInit[13][4] = 0;
fieldInit[13][4] = 0;
fieldBgInit[13][5] = 0;
fieldInit[13][5] = 0;
fieldBgInit[13][6] = 0;
fieldInit[13][6] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][8] = 0;
fieldInit[13][8] = 0;
fieldBgInit[13][9] = 0;
fieldInit[13][9] = 0;
fieldBgInit[13][10] = 0;
fieldInit[13][10] = 0;
fieldBgInit[13][11] = 0;
fieldInit[13][11] = 0;
fieldBgInit[13][12] = 0;
fieldInit[13][12] = 0;
fieldBgInit[13][13] = 0;
fieldInit[13][13] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 6:
timeLimit = 150;
candies = [10, 20, 30];
numOfCandies = 3;
lowLevel = 12;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][3] = 0;
fieldInit[1][3] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][11] = 0;
fieldInit[1][11] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][1] = 0;
fieldInit[3][1] = 0;
fieldBgInit[3][13] = 0;
fieldInit[3][13] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][1] = 0;
fieldInit[4][1] = 0;
fieldBgInit[4][2] = 0;
fieldInit[4][2] = 0;
fieldBgInit[4][12] = 0;
fieldInit[4][12] = 0;
fieldBgInit[4][13] = 0;
fieldInit[4][13] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][1] = 0;
fieldInit[5][1] = 0;
fieldBgInit[5][2] = 0;
fieldInit[5][2] = 0;
fieldBgInit[5][3] = 0;
fieldInit[5][3] = 0;
fieldBgInit[5][11] = 0;
fieldInit[5][11] = 0;
fieldBgInit[5][12] = 0;
fieldInit[5][12] = 0;
fieldBgInit[5][13] = 0;
fieldInit[5][13] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][1] = 0;
fieldInit[6][1] = 0;
fieldBgInit[6][2] = 0;
fieldInit[6][2] = 0;
fieldBgInit[6][3] = 0;
fieldInit[6][3] = 0;
fieldBgInit[6][4] = 0;
fieldInit[6][4] = 0;
fieldBgInit[6][10] = 0;
fieldInit[6][10] = 0;
fieldBgInit[6][11] = 0;
fieldInit[6][11] = 0;
fieldBgInit[6][12] = 0;
fieldInit[6][12] = 0;
fieldBgInit[6][13] = 0;
fieldInit[6][13] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][1] = 0;
fieldInit[7][1] = 0;
fieldBgInit[7][2] = 0;
fieldInit[7][2] = 0;
fieldBgInit[7][3] = 0;
fieldInit[7][3] = 0;
fieldBgInit[7][4] = 0;
fieldInit[7][4] = 0;
fieldBgInit[7][5] = 0;
fieldInit[7][5] = 0;
fieldBgInit[7][9] = 0;
fieldInit[7][9] = 0;
fieldBgInit[7][10] = 0;
fieldInit[7][10] = 0;
fieldBgInit[7][11] = 0;
fieldInit[7][11] = 0;
fieldBgInit[7][12] = 0;
fieldInit[7][12] = 0;
fieldBgInit[7][13] = 0;
fieldInit[7][13] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][1] = 0;
fieldInit[8][1] = 0;
fieldBgInit[8][2] = 0;
fieldInit[8][2] = 0;
fieldBgInit[8][3] = 0;
fieldInit[8][3] = 0;
fieldBgInit[8][4] = 0;
fieldInit[8][4] = 0;
fieldBgInit[8][10] = 0;
fieldInit[8][10] = 0;
fieldBgInit[8][11] = 0;
fieldInit[8][11] = 0;
fieldBgInit[8][12] = 0;
fieldInit[8][12] = 0;
fieldBgInit[8][13] = 0;
fieldInit[8][13] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][1] = 0;
fieldInit[9][1] = 0;
fieldBgInit[9][2] = 0;
fieldInit[9][2] = 0;
fieldBgInit[9][3] = 0;
fieldInit[9][3] = 0;
fieldBgInit[9][11] = 0;
fieldInit[9][11] = 0;
fieldBgInit[9][12] = 0;
fieldInit[9][12] = 0;
fieldBgInit[9][13] = 0;
fieldInit[9][13] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][1] = 0;
fieldInit[10][1] = 0;
fieldBgInit[10][2] = 0;
fieldInit[10][2] = 0;
fieldBgInit[10][12] = 0;
fieldInit[10][12] = 0;
fieldBgInit[10][13] = 0;
fieldInit[10][13] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][1] = 0;
fieldInit[11][1] = 0;
fieldBgInit[11][13] = 0;
fieldInit[11][13] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][1] = 0;
fieldInit[13][1] = 0;
fieldBgInit[13][2] = 0;
fieldInit[13][2] = 0;
fieldBgInit[13][3] = 0;
fieldInit[13][3] = 0;
fieldBgInit[13][4] = 0;
fieldInit[13][4] = 0;
fieldBgInit[13][5] = 0;
fieldInit[13][5] = 0;
fieldBgInit[13][6] = 0;
fieldInit[13][6] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][8] = 0;
fieldInit[13][8] = 0;
fieldBgInit[13][9] = 0;
fieldInit[13][9] = 0;
fieldBgInit[13][10] = 0;
fieldInit[13][10] = 0;
fieldBgInit[13][11] = 0;
fieldInit[13][11] = 0;
fieldBgInit[13][12] = 0;
fieldInit[13][12] = 0;
fieldBgInit[13][13] = 0;
fieldInit[13][13] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 7:
timeLimit = 150;
candies = [5, 10, 15];
numOfCandies = 3;
lowLevel = 12;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][3] = 0;
fieldInit[1][3] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][11] = 0;
fieldInit[1][11] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][1] = 0;
fieldInit[2][1] = 0;
fieldBgInit[2][2] = 0;
fieldInit[2][2] = 0;
fieldBgInit[2][3] = 0;
fieldInit[2][3] = 0;
fieldBgInit[2][4] = 0;
fieldInit[2][4] = 0;
fieldBgInit[2][6] = 0;
fieldInit[2][6] = 0;
fieldBgInit[2][7] = 0;
fieldInit[2][7] = 0;
fieldBgInit[2][8] = 0;
fieldInit[2][8] = 0;
fieldBgInit[2][10] = 0;
fieldInit[2][10] = 0;
fieldBgInit[2][11] = 0;
fieldInit[2][11] = 0;
fieldBgInit[2][12] = 0;
fieldInit[2][12] = 0;
fieldBgInit[2][13] = 0;
fieldInit[2][13] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][1] = 0;
fieldInit[3][1] = 0;
fieldBgInit[3][2] = 0;
fieldInit[3][2] = 0;
fieldBgInit[3][3] = 0;
fieldInit[3][3] = 0;
fieldBgInit[3][7] = 0;
fieldInit[3][7] = 0;
fieldBgInit[3][11] = 0;
fieldInit[3][11] = 0;
fieldBgInit[3][12] = 0;
fieldInit[3][12] = 0;
fieldBgInit[3][13] = 0;
fieldInit[3][13] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][1] = 0;
fieldInit[4][1] = 0;
fieldBgInit[4][13] = 0;
fieldInit[4][13] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][1] = 0;
fieldInit[5][1] = 0;
fieldBgInit[5][13] = 0;
fieldInit[5][13] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][1] = 0;
fieldInit[6][1] = 0;
fieldBgInit[6][13] = 0;
fieldInit[6][13] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][1] = 0;
fieldInit[7][1] = 0;
fieldBgInit[7][13] = 0;
fieldInit[7][13] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][1] = 0;
fieldInit[8][1] = 0;
fieldBgInit[8][2] = 0;
fieldInit[8][2] = 0;
fieldBgInit[8][3] = 0;
fieldInit[8][3] = 0;
fieldBgInit[8][11] = 0;
fieldInit[8][11] = 0;
fieldBgInit[8][12] = 0;
fieldInit[8][12] = 0;
fieldBgInit[8][13] = 0;
fieldInit[8][13] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][1] = 0;
fieldInit[9][1] = 0;
fieldBgInit[9][2] = 0;
fieldInit[9][2] = 0;
fieldBgInit[9][3] = 0;
fieldInit[9][3] = 0;
fieldBgInit[9][11] = 0;
fieldInit[9][11] = 0;
fieldBgInit[9][12] = 0;
fieldInit[9][12] = 0;
fieldBgInit[9][13] = 0;
fieldInit[9][13] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][1] = 0;
fieldInit[10][1] = 0;
fieldBgInit[10][2] = 0;
fieldInit[10][2] = 0;
fieldBgInit[10][3] = 0;
fieldInit[10][3] = 0;
fieldBgInit[10][11] = 0;
fieldInit[10][11] = 0;
fieldBgInit[10][12] = 0;
fieldInit[10][12] = 0;
fieldBgInit[10][13] = 0;
fieldInit[10][13] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][1] = 0;
fieldInit[11][1] = 0;
fieldBgInit[11][2] = 0;
fieldInit[11][2] = 0;
fieldBgInit[11][3] = 0;
fieldInit[11][3] = 0;
fieldBgInit[11][11] = 0;
fieldInit[11][11] = 0;
fieldBgInit[11][12] = 0;
fieldInit[11][12] = 0;
fieldBgInit[11][13] = 0;
fieldInit[11][13] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][1] = 0;
fieldInit[12][1] = 0;
fieldBgInit[12][2] = 0;
fieldInit[12][2] = 0;
fieldBgInit[12][3] = 0;
fieldInit[12][3] = 0;
fieldBgInit[12][4] = 0;
fieldInit[12][4] = 0;
fieldBgInit[12][10] = 0;
fieldInit[12][10] = 0;
fieldBgInit[12][11] = 0;
fieldInit[12][11] = 0;
fieldBgInit[12][12] = 0;
fieldInit[12][12] = 0;
fieldBgInit[12][13] = 0;
fieldInit[12][13] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][1] = 0;
fieldInit[13][1] = 0;
fieldBgInit[13][2] = 0;
fieldInit[13][2] = 0;
fieldBgInit[13][3] = 0;
fieldInit[13][3] = 0;
fieldBgInit[13][4] = 0;
fieldInit[13][4] = 0;
fieldBgInit[13][5] = 0;
fieldInit[13][5] = 0;
fieldBgInit[13][6] = 0;
fieldInit[13][6] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][8] = 0;
fieldInit[13][8] = 0;
fieldBgInit[13][9] = 0;
fieldInit[13][9] = 0;
fieldBgInit[13][10] = 0;
fieldInit[13][10] = 0;
fieldBgInit[13][11] = 0;
fieldInit[13][11] = 0;
fieldBgInit[13][12] = 0;
fieldInit[13][12] = 0;
fieldBgInit[13][13] = 0;
fieldInit[13][13] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 8:
timeLimit = 150;
candies = [5, 10, 15];
numOfCandies = 3;
lowLevel = 13;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][6] = 0;
fieldInit[2][6] = 0;
fieldBgInit[2][7] = 0;
fieldInit[2][7] = 0;
fieldBgInit[2][8] = 0;
fieldInit[2][8] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][6] = 0;
fieldInit[3][6] = 0;
fieldBgInit[3][7] = 0;
fieldInit[3][7] = 0;
fieldBgInit[3][8] = 0;
fieldInit[3][8] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][6] = 0;
fieldInit[4][6] = 0;
fieldBgInit[4][7] = 0;
fieldInit[4][7] = 0;
fieldBgInit[4][8] = 0;
fieldInit[4][8] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][6] = 0;
fieldInit[5][6] = 0;
fieldBgInit[5][7] = 0;
fieldInit[5][7] = 0;
fieldBgInit[5][8] = 0;
fieldInit[5][8] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][6] = 0;
fieldInit[6][6] = 0;
fieldBgInit[6][7] = 0;
fieldInit[6][7] = 0;
fieldBgInit[6][8] = 0;
fieldInit[6][8] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][6] = 0;
fieldInit[7][6] = 0;
fieldBgInit[7][7] = 0;
fieldInit[7][7] = 0;
fieldBgInit[7][8] = 0;
fieldInit[7][8] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][1] = 0;
fieldInit[8][1] = 0;
fieldBgInit[8][2] = 0;
fieldInit[8][2] = 0;
fieldBgInit[8][3] = 0;
fieldInit[8][3] = 0;
fieldBgInit[8][4] = 0;
fieldInit[8][4] = 0;
fieldBgInit[8][5] = 0;
fieldInit[8][5] = 0;
fieldBgInit[8][6] = 0;
fieldInit[8][6] = 0;
fieldBgInit[8][7] = 0;
fieldInit[8][7] = 0;
fieldBgInit[8][8] = 0;
fieldInit[8][8] = 0;
fieldBgInit[8][9] = 0;
fieldInit[8][9] = 0;
fieldBgInit[8][10] = 0;
fieldInit[8][10] = 0;
fieldBgInit[8][11] = 0;
fieldInit[8][11] = 0;
fieldBgInit[8][12] = 0;
fieldInit[8][12] = 0;
fieldBgInit[8][13] = 0;
fieldInit[8][13] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][6] = 0;
fieldInit[9][6] = 0;
fieldBgInit[9][7] = 0;
fieldInit[9][7] = 0;
fieldBgInit[9][8] = 0;
fieldInit[9][8] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][6] = 0;
fieldInit[10][6] = 0;
fieldBgInit[10][7] = 0;
fieldInit[10][7] = 0;
fieldBgInit[10][8] = 0;
fieldInit[10][8] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][6] = 0;
fieldInit[11][6] = 0;
fieldBgInit[11][7] = 0;
fieldInit[11][7] = 0;
fieldBgInit[11][8] = 0;
fieldInit[11][8] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][6] = 0;
fieldInit[12][6] = 0;
fieldBgInit[12][7] = 0;
fieldInit[12][7] = 0;
fieldBgInit[12][8] = 0;
fieldInit[12][8] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][6] = 0;
fieldInit[13][6] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][8] = 0;
fieldInit[13][8] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 9:
timeLimit = 150;
candies = [5, 10, 15];
numOfCandies = 3;
lowLevel = 13;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][3] = 0;
fieldInit[1][3] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][11] = 0;
fieldInit[1][11] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][1] = 0;
fieldInit[2][1] = 0;
fieldBgInit[2][2] = 0;
fieldInit[2][2] = 0;
fieldBgInit[2][3] = 0;
fieldInit[2][3] = 0;
fieldBgInit[2][4] = 0;
fieldInit[2][4] = 0;
fieldBgInit[2][5] = 0;
fieldInit[2][5] = 0;
fieldBgInit[2][6] = 0;
fieldInit[2][6] = 0;
fieldBgInit[2][7] = 0;
fieldInit[2][7] = 0;
fieldBgInit[2][8] = 0;
fieldInit[2][8] = 0;
fieldBgInit[2][9] = 0;
fieldInit[2][9] = 0;
fieldBgInit[2][10] = 0;
fieldInit[2][10] = 0;
fieldBgInit[2][11] = 0;
fieldInit[2][11] = 0;
fieldBgInit[2][12] = 0;
fieldInit[2][12] = 0;
fieldBgInit[2][13] = 0;
fieldInit[2][13] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][1] = 0;
fieldInit[3][1] = 0;
fieldBgInit[3][2] = 0;
fieldInit[3][2] = 0;
fieldBgInit[3][3] = 0;
fieldInit[3][3] = 0;
fieldBgInit[3][5] = 0;
fieldInit[3][5] = 0;
fieldBgInit[3][7] = 0;
fieldInit[3][7] = 0;
fieldBgInit[3][9] = 0;
fieldInit[3][9] = 0;
fieldBgInit[3][11] = 0;
fieldInit[3][11] = 0;
fieldBgInit[3][12] = 0;
fieldInit[3][12] = 0;
fieldBgInit[3][13] = 0;
fieldInit[3][13] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][1] = 0;
fieldInit[4][1] = 0;
fieldBgInit[4][2] = 0;
fieldInit[4][2] = 0;
fieldBgInit[4][12] = 0;
fieldInit[4][12] = 0;
fieldBgInit[4][13] = 0;
fieldInit[4][13] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][1] = 0;
fieldInit[5][1] = 0;
fieldBgInit[5][2] = 0;
fieldInit[5][2] = 0;
fieldBgInit[5][12] = 0;
fieldInit[5][12] = 0;
fieldBgInit[5][13] = 0;
fieldInit[5][13] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][1] = 0;
fieldInit[6][1] = 0;
fieldBgInit[6][2] = 0;
fieldInit[6][2] = 0;
fieldBgInit[6][12] = 0;
fieldInit[6][12] = 0;
fieldBgInit[6][13] = 0;
fieldInit[6][13] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][1] = 0;
fieldInit[7][1] = 0;
fieldBgInit[7][2] = 0;
fieldInit[7][2] = 0;
fieldBgInit[7][12] = 0;
fieldInit[7][12] = 0;
fieldBgInit[7][13] = 0;
fieldInit[7][13] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][1] = 0;
fieldInit[8][1] = 0;
fieldBgInit[8][2] = 0;
fieldInit[8][2] = 0;
fieldBgInit[8][12] = 0;
fieldInit[8][12] = 0;
fieldBgInit[8][13] = 0;
fieldInit[8][13] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][1] = 0;
fieldInit[9][1] = 0;
fieldBgInit[9][2] = 0;
fieldInit[9][2] = 0;
fieldBgInit[9][12] = 0;
fieldInit[9][12] = 0;
fieldBgInit[9][13] = 0;
fieldInit[9][13] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][1] = 0;
fieldInit[10][1] = 0;
fieldBgInit[10][2] = 0;
fieldInit[10][2] = 0;
fieldBgInit[10][12] = 0;
fieldInit[10][12] = 0;
fieldBgInit[10][13] = 0;
fieldInit[10][13] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][1] = 0;
fieldInit[11][1] = 0;
fieldBgInit[11][2] = 0;
fieldInit[11][2] = 0;
fieldBgInit[11][12] = 0;
fieldInit[11][12] = 0;
fieldBgInit[11][13] = 0;
fieldInit[11][13] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][1] = 0;
fieldInit[12][1] = 0;
fieldBgInit[12][2] = 0;
fieldInit[12][2] = 0;
fieldBgInit[12][12] = 0;
fieldInit[12][12] = 0;
fieldBgInit[12][13] = 0;
fieldInit[12][13] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][1] = 0;
fieldInit[13][1] = 0;
fieldBgInit[13][2] = 0;
fieldInit[13][2] = 0;
fieldBgInit[13][3] = 0;
fieldInit[13][3] = 0;
fieldBgInit[13][5] = 0;
fieldInit[13][5] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][9] = 0;
fieldInit[13][9] = 0;
fieldBgInit[13][11] = 0;
fieldInit[13][11] = 0;
fieldBgInit[13][12] = 0;
fieldInit[13][12] = 0;
fieldBgInit[13][13] = 0;
fieldInit[13][13] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 10:
timeLimit = 150;
candies = [3, 6, 9];
numOfCandies = 3;
lowLevel = 11;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][3] = 0;
fieldInit[1][3] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][11] = 0;
fieldInit[1][11] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][1] = 0;
fieldInit[2][1] = 0;
fieldBgInit[2][2] = 0;
fieldInit[2][2] = 0;
fieldBgInit[2][12] = 0;
fieldInit[2][12] = 0;
fieldBgInit[2][13] = 0;
fieldInit[2][13] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][1] = 0;
fieldInit[3][1] = 0;
fieldBgInit[3][13] = 0;
fieldInit[3][13] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][4] = 0;
fieldInit[4][4] = 0;
fieldBgInit[4][5] = 0;
fieldInit[4][5] = 0;
fieldBgInit[4][9] = 0;
fieldInit[4][9] = 0;
fieldBgInit[4][10] = 0;
fieldInit[4][10] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][4] = 0;
fieldInit[5][4] = 0;
fieldBgInit[5][5] = 0;
fieldInit[5][5] = 0;
fieldBgInit[5][9] = 0;
fieldInit[5][9] = 0;
fieldBgInit[5][10] = 0;
fieldInit[5][10] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][7] = 0;
fieldInit[6][7] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][4] = 0;
fieldInit[8][4] = 0;
fieldBgInit[8][6] = 0;
fieldInit[8][6] = 0;
fieldBgInit[8][7] = 0;
fieldInit[8][7] = 0;
fieldBgInit[8][8] = 0;
fieldInit[8][8] = 0;
fieldBgInit[8][10] = 0;
fieldInit[8][10] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][5] = 0;
fieldInit[9][5] = 0;
fieldBgInit[9][7] = 0;
fieldInit[9][7] = 0;
fieldBgInit[9][9] = 0;
fieldInit[9][9] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][1] = 0;
fieldInit[10][1] = 0;
fieldBgInit[10][13] = 0;
fieldInit[10][13] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][1] = 0;
fieldInit[11][1] = 0;
fieldBgInit[11][2] = 0;
fieldInit[11][2] = 0;
fieldBgInit[11][12] = 0;
fieldInit[11][12] = 0;
fieldBgInit[11][13] = 0;
fieldInit[11][13] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][1] = 0;
fieldInit[12][1] = 0;
fieldBgInit[12][2] = 0;
fieldInit[12][2] = 0;
fieldBgInit[12][3] = 0;
fieldInit[12][3] = 0;
fieldBgInit[12][4] = 0;
fieldInit[12][4] = 0;
fieldBgInit[12][5] = 0;
fieldInit[12][5] = 0;
fieldBgInit[12][6] = 0;
fieldInit[12][6] = 0;
fieldBgInit[12][7] = 0;
fieldInit[12][7] = 0;
fieldBgInit[12][8] = 0;
fieldInit[12][8] = 0;
fieldBgInit[12][9] = 0;
fieldInit[12][9] = 0;
fieldBgInit[12][10] = 0;
fieldInit[12][10] = 0;
fieldBgInit[12][11] = 0;
fieldInit[12][11] = 0;
fieldBgInit[12][12] = 0;
fieldInit[12][12] = 0;
fieldBgInit[12][13] = 0;
fieldInit[12][13] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][1] = 0;
fieldInit[13][1] = 0;
fieldBgInit[13][2] = 0;
fieldInit[13][2] = 0;
fieldBgInit[13][3] = 0;
fieldInit[13][3] = 0;
fieldBgInit[13][4] = 0;
fieldInit[13][4] = 0;
fieldBgInit[13][5] = 0;
fieldInit[13][5] = 0;
fieldBgInit[13][6] = 0;
fieldInit[13][6] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][8] = 0;
fieldInit[13][8] = 0;
fieldBgInit[13][9] = 0;
fieldInit[13][9] = 0;
fieldBgInit[13][10] = 0;
fieldInit[13][10] = 0;
fieldBgInit[13][11] = 0;
fieldInit[13][11] = 0;
fieldBgInit[13][12] = 0;
fieldInit[13][12] = 0;
fieldBgInit[13][13] = 0;
fieldInit[13][13] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 11:
timeLimit = 90;
candies = [5, 10, 15];
numOfCandies = 3;
lowLevel = 14;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[2][4] = 0;
fieldInit[2][4] = 0;
fieldBgInit[2][5] = 0;
fieldInit[2][5] = 0;
fieldBgInit[2][6] = 0;
fieldInit[2][6] = 0;
fieldBgInit[2][7] = 0;
fieldInit[2][7] = 0;
fieldBgInit[2][8] = 0;
fieldInit[2][8] = 0;
fieldBgInit[2][9] = 0;
fieldInit[2][9] = 0;
fieldBgInit[2][10] = 0;
fieldInit[2][10] = 0;
fieldBgInit[3][4] = 0;
fieldInit[3][4] = 0;
fieldBgInit[3][5] = 0;
fieldInit[3][5] = 0;
fieldBgInit[3][6] = 0;
fieldInit[3][6] = 0;
fieldBgInit[3][7] = 0;
fieldInit[3][7] = 0;
fieldBgInit[3][8] = 0;
fieldInit[3][8] = 0;
fieldBgInit[3][9] = 0;
fieldInit[3][9] = 0;
fieldBgInit[3][10] = 0;
fieldInit[3][10] = 0;
fieldBgInit[4][4] = 0;
fieldInit[4][4] = 0;
fieldBgInit[4][5] = 0;
fieldInit[4][5] = 0;
fieldBgInit[4][6] = 0;
fieldInit[4][6] = 0;
fieldBgInit[4][7] = 0;
fieldInit[4][7] = 0;
fieldBgInit[4][8] = 0;
fieldInit[4][8] = 0;
fieldBgInit[4][9] = 0;
fieldInit[4][9] = 0;
fieldBgInit[4][10] = 0;
fieldInit[4][10] = 0;
fieldBgInit[5][4] = 0;
fieldInit[5][4] = 0;
fieldBgInit[5][5] = 0;
fieldInit[5][5] = 0;
fieldBgInit[5][6] = 0;
fieldInit[5][6] = 0;
fieldBgInit[5][7] = 0;
fieldInit[5][7] = 0;
fieldBgInit[5][8] = 0;
fieldInit[5][8] = 0;
fieldBgInit[5][9] = 0;
fieldInit[5][9] = 0;
fieldBgInit[5][10] = 0;
fieldInit[5][10] = 0;
fieldBgInit[6][4] = 0;
fieldInit[6][4] = 0;
fieldBgInit[6][5] = 0;
fieldInit[6][5] = 0;
fieldBgInit[6][6] = 0;
fieldInit[6][6] = 0;
fieldBgInit[6][7] = 0;
fieldInit[6][7] = 0;
fieldBgInit[6][8] = 0;
fieldInit[6][8] = 0;
fieldBgInit[6][9] = 0;
fieldInit[6][9] = 0;
fieldBgInit[6][10] = 0;
fieldInit[6][10] = 0;
fieldBgInit[7][4] = 0;
fieldInit[7][4] = 0;
fieldBgInit[7][5] = 0;
fieldInit[7][5] = 0;
fieldBgInit[7][6] = 0;
fieldInit[7][6] = 0;
fieldBgInit[7][7] = 0;
fieldInit[7][7] = 0;
fieldBgInit[7][8] = 0;
fieldInit[7][8] = 0;
fieldBgInit[7][9] = 0;
fieldInit[7][9] = 0;
fieldBgInit[7][10] = 0;
fieldInit[7][10] = 0;
fieldBgInit[8][4] = 0;
fieldInit[8][4] = 0;
fieldBgInit[8][5] = 0;
fieldInit[8][5] = 0;
fieldBgInit[8][6] = 0;
fieldInit[8][6] = 0;
fieldBgInit[8][7] = 0;
fieldInit[8][7] = 0;
fieldBgInit[8][8] = 0;
fieldInit[8][8] = 0;
fieldBgInit[8][9] = 0;
fieldInit[8][9] = 0;
fieldBgInit[8][10] = 0;
fieldInit[8][10] = 0;
fieldBgInit[9][4] = 0;
fieldInit[9][4] = 0;
fieldBgInit[9][10] = 0;
fieldInit[9][10] = 0;
fieldBgInit[10][4] = 0;
fieldInit[10][4] = 0;
fieldBgInit[10][10] = 0;
fieldInit[10][10] = 0;
fieldBgInit[11][4] = 0;
fieldInit[11][4] = 0;
fieldBgInit[11][10] = 0;
fieldInit[11][10] = 0;
fieldBgInit[12][4] = 0;
fieldInit[12][4] = 0;
fieldBgInit[12][10] = 0;
fieldInit[12][10] = 0;
fieldBgInit[13][4] = 0;
fieldInit[13][4] = 0;
fieldBgInit[13][10] = 0;
fieldInit[13][10] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
break;
case 12:
timeLimit = 150;
candies = [10, 20, 30];
numOfCandies = 3;
lowLevel = 13;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][3] = 0;
fieldInit[1][3] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][11] = 0;
fieldInit[1][11] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][1] = 0;
fieldInit[2][1] = 0;
fieldBgInit[2][2] = 0;
fieldInit[2][2] = 0;
fieldBgInit[2][3] = 0;
fieldInit[2][3] = 0;
fieldBgInit[2][4] = 0;
fieldInit[2][4] = 0;
fieldBgInit[2][5] = 0;
fieldInit[2][5] = 0;
fieldBgInit[2][6] = 0;
fieldInit[2][6] = 0;
fieldBgInit[2][7] = 0;
fieldInit[2][7] = 0;
fieldBgInit[2][8] = 0;
fieldInit[2][8] = 0;
fieldBgInit[2][9] = 0;
fieldInit[2][9] = 0;
fieldBgInit[2][10] = 0;
fieldInit[2][10] = 0;
fieldBgInit[2][11] = 0;
fieldInit[2][11] = 0;
fieldBgInit[2][12] = 0;
fieldInit[2][12] = 0;
fieldBgInit[2][13] = 0;
fieldInit[2][13] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][1] = 0;
fieldInit[3][1] = 0;
fieldBgInit[3][2] = 0;
fieldInit[3][2] = 0;
fieldBgInit[3][3] = 0;
fieldInit[3][3] = 0;
fieldBgInit[3][5] = 0;
fieldInit[3][5] = 0;
fieldBgInit[3][6] = 0;
fieldInit[3][6] = 0;
fieldBgInit[3][7] = 0;
fieldInit[3][7] = 0;
fieldBgInit[3][8] = 0;
fieldInit[3][8] = 0;
fieldBgInit[3][9] = 0;
fieldInit[3][9] = 0;
fieldBgInit[3][11] = 0;
fieldInit[3][11] = 0;
fieldBgInit[3][12] = 0;
fieldInit[3][12] = 0;
fieldBgInit[3][13] = 0;
fieldInit[3][13] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][1] = 0;
fieldInit[4][1] = 0;
fieldBgInit[4][2] = 0;
fieldInit[4][2] = 0;
fieldBgInit[4][6] = 0;
fieldInit[4][6] = 0;
fieldBgInit[4][7] = 0;
fieldInit[4][7] = 0;
fieldBgInit[4][8] = 0;
fieldInit[4][8] = 0;
fieldBgInit[4][12] = 0;
fieldInit[4][12] = 0;
fieldBgInit[4][13] = 0;
fieldInit[4][13] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][1] = 0;
fieldInit[5][1] = 0;
fieldBgInit[5][7] = 0;
fieldInit[5][7] = 0;
fieldBgInit[5][13] = 0;
fieldInit[5][13] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 13:
timeLimit = 150;
candies = [5, 10, 15];
numOfCandies = 3;
lowLevel = 13;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][6] = 0;
fieldInit[0][6] = 0;
fieldBgInit[0][7] = 0;
fieldInit[0][7] = 0;
fieldBgInit[0][8] = 0;
fieldInit[0][8] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][5] = 0;
fieldInit[1][5] = 0;
fieldBgInit[1][6] = 0;
fieldInit[1][6] = 0;
fieldBgInit[1][7] = 0;
fieldInit[1][7] = 0;
fieldBgInit[1][8] = 0;
fieldInit[1][8] = 0;
fieldBgInit[1][9] = 0;
fieldInit[1][9] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][1] = 0;
fieldInit[2][1] = 0;
fieldBgInit[2][5] = 0;
fieldInit[2][5] = 0;
fieldBgInit[2][6] = 0;
fieldInit[2][6] = 0;
fieldBgInit[2][7] = 0;
fieldInit[2][7] = 0;
fieldBgInit[2][8] = 0;
fieldInit[2][8] = 0;
fieldBgInit[2][9] = 0;
fieldInit[2][9] = 0;
fieldBgInit[2][13] = 0;
fieldInit[2][13] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][6] = 0;
fieldInit[3][6] = 0;
fieldBgInit[3][7] = 0;
fieldInit[3][7] = 0;
fieldBgInit[3][8] = 0;
fieldInit[3][8] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][1] = 0;
fieldInit[4][1] = 0;
fieldBgInit[4][5] = 0;
fieldInit[4][5] = 0;
fieldBgInit[4][6] = 0;
fieldInit[4][6] = 0;
fieldBgInit[4][7] = 0;
fieldInit[4][7] = 0;
fieldBgInit[4][8] = 0;
fieldInit[4][8] = 0;
fieldBgInit[4][9] = 0;
fieldInit[4][9] = 0;
fieldBgInit[4][13] = 0;
fieldInit[4][13] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][1] = 0;
fieldInit[5][1] = 0;
fieldBgInit[5][2] = 0;
fieldInit[5][2] = 0;
fieldBgInit[5][4] = 0;
fieldInit[5][4] = 0;
fieldBgInit[5][5] = 0;
fieldInit[5][5] = 0;
fieldBgInit[5][6] = 0;
fieldInit[5][6] = 0;
fieldBgInit[5][7] = 0;
fieldInit[5][7] = 0;
fieldBgInit[5][8] = 0;
fieldInit[5][8] = 0;
fieldBgInit[5][9] = 0;
fieldInit[5][9] = 0;
fieldBgInit[5][10] = 0;
fieldInit[5][10] = 0;
fieldBgInit[5][12] = 0;
fieldInit[5][12] = 0;
fieldBgInit[5][13] = 0;
fieldInit[5][13] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][1] = 0;
fieldInit[6][1] = 0;
fieldBgInit[6][2] = 0;
fieldInit[6][2] = 0;
fieldBgInit[6][3] = 0;
fieldInit[6][3] = 0;
fieldBgInit[6][4] = 0;
fieldInit[6][4] = 0;
fieldBgInit[6][5] = 0;
fieldInit[6][5] = 0;
fieldBgInit[6][6] = 0;
fieldInit[6][6] = 0;
fieldBgInit[6][7] = 0;
fieldInit[6][7] = 0;
fieldBgInit[6][8] = 0;
fieldInit[6][8] = 0;
fieldBgInit[6][9] = 0;
fieldInit[6][9] = 0;
fieldBgInit[6][10] = 0;
fieldInit[6][10] = 0;
fieldBgInit[6][11] = 0;
fieldInit[6][11] = 0;
fieldBgInit[6][12] = 0;
fieldInit[6][12] = 0;
fieldBgInit[6][13] = 0;
fieldInit[6][13] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][1] = 0;
fieldInit[7][1] = 0;
fieldBgInit[7][2] = 0;
fieldInit[7][2] = 0;
fieldBgInit[7][4] = 0;
fieldInit[7][4] = 0;
fieldBgInit[7][5] = 0;
fieldInit[7][5] = 0;
fieldBgInit[7][6] = 0;
fieldInit[7][6] = 0;
fieldBgInit[7][7] = 0;
fieldInit[7][7] = 0;
fieldBgInit[7][8] = 0;
fieldInit[7][8] = 0;
fieldBgInit[7][9] = 0;
fieldInit[7][9] = 0;
fieldBgInit[7][10] = 0;
fieldInit[7][10] = 0;
fieldBgInit[7][12] = 0;
fieldInit[7][12] = 0;
fieldBgInit[7][13] = 0;
fieldInit[7][13] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][1] = 0;
fieldInit[8][1] = 0;
fieldBgInit[8][5] = 0;
fieldInit[8][5] = 0;
fieldBgInit[8][6] = 0;
fieldInit[8][6] = 0;
fieldBgInit[8][7] = 0;
fieldInit[8][7] = 0;
fieldBgInit[8][8] = 0;
fieldInit[8][8] = 0;
fieldBgInit[8][9] = 0;
fieldInit[8][9] = 0;
fieldBgInit[8][13] = 0;
fieldInit[8][13] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][6] = 0;
fieldInit[9][6] = 0;
fieldBgInit[9][7] = 0;
fieldInit[9][7] = 0;
fieldBgInit[9][8] = 0;
fieldInit[9][8] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][1] = 0;
fieldInit[10][1] = 0;
fieldBgInit[10][5] = 0;
fieldInit[10][5] = 0;
fieldBgInit[10][6] = 0;
fieldInit[10][6] = 0;
fieldBgInit[10][7] = 0;
fieldInit[10][7] = 0;
fieldBgInit[10][8] = 0;
fieldInit[10][8] = 0;
fieldBgInit[10][9] = 0;
fieldInit[10][9] = 0;
fieldBgInit[10][13] = 0;
fieldInit[10][13] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][1] = 0;
fieldInit[11][1] = 0;
fieldBgInit[11][2] = 0;
fieldInit[11][2] = 0;
fieldBgInit[11][4] = 0;
fieldInit[11][4] = 0;
fieldBgInit[11][5] = 0;
fieldInit[11][5] = 0;
fieldBgInit[11][6] = 0;
fieldInit[11][6] = 0;
fieldBgInit[11][7] = 0;
fieldInit[11][7] = 0;
fieldBgInit[11][8] = 0;
fieldInit[11][8] = 0;
fieldBgInit[11][9] = 0;
fieldInit[11][9] = 0;
fieldBgInit[11][10] = 0;
fieldInit[11][10] = 0;
fieldBgInit[11][12] = 0;
fieldInit[11][12] = 0;
fieldBgInit[11][13] = 0;
fieldInit[11][13] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][1] = 0;
fieldInit[12][1] = 0;
fieldBgInit[12][2] = 0;
fieldInit[12][2] = 0;
fieldBgInit[12][3] = 0;
fieldInit[12][3] = 0;
fieldBgInit[12][4] = 0;
fieldInit[12][4] = 0;
fieldBgInit[12][5] = 0;
fieldInit[12][5] = 0;
fieldBgInit[12][6] = 0;
fieldInit[12][6] = 0;
fieldBgInit[12][7] = 0;
fieldInit[12][7] = 0;
fieldBgInit[12][8] = 0;
fieldInit[12][8] = 0;
fieldBgInit[12][9] = 0;
fieldInit[12][9] = 0;
fieldBgInit[12][10] = 0;
fieldInit[12][10] = 0;
fieldBgInit[12][11] = 0;
fieldInit[12][11] = 0;
fieldBgInit[12][12] = 0;
fieldInit[12][12] = 0;
fieldBgInit[12][13] = 0;
fieldInit[12][13] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][6] = 0;
fieldInit[13][6] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][8] = 0;
fieldInit[13][8] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 14:
timeLimit = 150;
candies = [5, 15, 25];
numOfCandies = 3;
lowLevel = 10;
fieldBgInit[0][0] = 0;
fieldInit[0][0] = 0;
fieldBgInit[0][1] = 0;
fieldInit[0][1] = 0;
fieldBgInit[0][2] = 0;
fieldInit[0][2] = 0;
fieldBgInit[0][3] = 0;
fieldInit[0][3] = 0;
fieldBgInit[0][4] = 0;
fieldInit[0][4] = 0;
fieldBgInit[0][5] = 0;
fieldInit[0][5] = 0;
fieldBgInit[0][9] = 0;
fieldInit[0][9] = 0;
fieldBgInit[0][10] = 0;
fieldInit[0][10] = 0;
fieldBgInit[0][11] = 0;
fieldInit[0][11] = 0;
fieldBgInit[0][12] = 0;
fieldInit[0][12] = 0;
fieldBgInit[0][13] = 0;
fieldInit[0][13] = 0;
fieldBgInit[0][14] = 0;
fieldInit[0][14] = 0;
fieldBgInit[1][0] = 0;
fieldInit[1][0] = 0;
fieldBgInit[1][1] = 0;
fieldInit[1][1] = 0;
fieldBgInit[1][2] = 0;
fieldInit[1][2] = 0;
fieldBgInit[1][3] = 0;
fieldInit[1][3] = 0;
fieldBgInit[1][4] = 0;
fieldInit[1][4] = 0;
fieldBgInit[1][10] = 0;
fieldInit[1][10] = 0;
fieldBgInit[1][11] = 0;
fieldInit[1][11] = 0;
fieldBgInit[1][12] = 0;
fieldInit[1][12] = 0;
fieldBgInit[1][13] = 0;
fieldInit[1][13] = 0;
fieldBgInit[1][14] = 0;
fieldInit[1][14] = 0;
fieldBgInit[2][0] = 0;
fieldInit[2][0] = 0;
fieldBgInit[2][1] = 0;
fieldInit[2][1] = 0;
fieldBgInit[2][2] = 0;
fieldInit[2][2] = 0;
fieldBgInit[2][3] = 0;
fieldInit[2][3] = 0;
fieldBgInit[2][11] = 0;
fieldInit[2][11] = 0;
fieldBgInit[2][12] = 0;
fieldInit[2][12] = 0;
fieldBgInit[2][13] = 0;
fieldInit[2][13] = 0;
fieldBgInit[2][14] = 0;
fieldInit[2][14] = 0;
fieldBgInit[3][0] = 0;
fieldInit[3][0] = 0;
fieldBgInit[3][1] = 0;
fieldInit[3][1] = 0;
fieldBgInit[3][2] = 0;
fieldInit[3][2] = 0;
fieldBgInit[3][12] = 0;
fieldInit[3][12] = 0;
fieldBgInit[3][13] = 0;
fieldInit[3][13] = 0;
fieldBgInit[3][14] = 0;
fieldInit[3][14] = 0;
fieldBgInit[4][0] = 0;
fieldInit[4][0] = 0;
fieldBgInit[4][1] = 0;
fieldInit[4][1] = 0;
fieldBgInit[4][13] = 0;
fieldInit[4][13] = 0;
fieldBgInit[4][14] = 0;
fieldInit[4][14] = 0;
fieldBgInit[5][0] = 0;
fieldInit[5][0] = 0;
fieldBgInit[5][14] = 0;
fieldInit[5][14] = 0;
fieldBgInit[6][0] = 0;
fieldInit[6][0] = 0;
fieldBgInit[6][14] = 0;
fieldInit[6][14] = 0;
fieldBgInit[7][0] = 0;
fieldInit[7][0] = 0;
fieldBgInit[7][14] = 0;
fieldInit[7][14] = 0;
fieldBgInit[8][0] = 0;
fieldInit[8][0] = 0;
fieldBgInit[8][14] = 0;
fieldInit[8][14] = 0;
fieldBgInit[9][0] = 0;
fieldInit[9][0] = 0;
fieldBgInit[9][1] = 0;
fieldInit[9][1] = 0;
fieldBgInit[9][13] = 0;
fieldInit[9][13] = 0;
fieldBgInit[9][14] = 0;
fieldInit[9][14] = 0;
fieldBgInit[10][0] = 0;
fieldInit[10][0] = 0;
fieldBgInit[10][1] = 0;
fieldInit[10][1] = 0;
fieldBgInit[10][2] = 0;
fieldInit[10][2] = 0;
fieldBgInit[10][12] = 0;
fieldInit[10][12] = 0;
fieldBgInit[10][13] = 0;
fieldInit[10][13] = 0;
fieldBgInit[10][14] = 0;
fieldInit[10][14] = 0;
fieldBgInit[11][0] = 0;
fieldInit[11][0] = 0;
fieldBgInit[11][1] = 0;
fieldInit[11][1] = 0;
fieldBgInit[11][2] = 0;
fieldInit[11][2] = 0;
fieldBgInit[11][3] = 0;
fieldInit[11][3] = 0;
fieldBgInit[11][4] = 0;
fieldInit[11][4] = 0;
fieldBgInit[11][5] = 0;
fieldInit[11][5] = 0;
fieldBgInit[11][6] = 0;
fieldInit[11][6] = 0;
fieldBgInit[11][7] = 0;
fieldInit[11][7] = 0;
fieldBgInit[11][8] = 0;
fieldInit[11][8] = 0;
fieldBgInit[11][9] = 0;
fieldInit[11][9] = 0;
fieldBgInit[11][10] = 0;
fieldInit[11][10] = 0;
fieldBgInit[11][11] = 0;
fieldInit[11][11] = 0;
fieldBgInit[11][12] = 0;
fieldInit[11][12] = 0;
fieldBgInit[11][13] = 0;
fieldInit[11][13] = 0;
fieldBgInit[11][14] = 0;
fieldInit[11][14] = 0;
fieldBgInit[12][0] = 0;
fieldInit[12][0] = 0;
fieldBgInit[12][1] = 0;
fieldInit[12][1] = 0;
fieldBgInit[12][2] = 0;
fieldInit[12][2] = 0;
fieldBgInit[12][3] = 0;
fieldInit[12][3] = 0;
fieldBgInit[12][4] = 0;
fieldInit[12][4] = 0;
fieldBgInit[12][5] = 0;
fieldInit[12][5] = 0;
fieldBgInit[12][6] = 0;
fieldInit[12][6] = 0;
fieldBgInit[12][7] = 0;
fieldInit[12][7] = 0;
fieldBgInit[12][8] = 0;
fieldInit[12][8] = 0;
fieldBgInit[12][9] = 0;
fieldInit[12][9] = 0;
fieldBgInit[12][10] = 0;
fieldInit[12][10] = 0;
fieldBgInit[12][11] = 0;
fieldInit[12][11] = 0;
fieldBgInit[12][12] = 0;
fieldInit[12][12] = 0;
fieldBgInit[12][13] = 0;
fieldInit[12][13] = 0;
fieldBgInit[12][14] = 0;
fieldInit[12][14] = 0;
fieldBgInit[13][0] = 0;
fieldInit[13][0] = 0;
fieldBgInit[13][1] = 0;
fieldInit[13][1] = 0;
fieldBgInit[13][2] = 0;
fieldInit[13][2] = 0;
fieldBgInit[13][3] = 0;
fieldInit[13][3] = 0;
fieldBgInit[13][4] = 0;
fieldInit[13][4] = 0;
fieldBgInit[13][5] = 0;
fieldInit[13][5] = 0;
fieldBgInit[13][6] = 0;
fieldInit[13][6] = 0;
fieldBgInit[13][7] = 0;
fieldInit[13][7] = 0;
fieldBgInit[13][8] = 0;
fieldInit[13][8] = 0;
fieldBgInit[13][9] = 0;
fieldInit[13][9] = 0;
fieldBgInit[13][10] = 0;
fieldInit[13][10] = 0;
fieldBgInit[13][11] = 0;
fieldInit[13][11] = 0;
fieldBgInit[13][12] = 0;
fieldInit[13][12] = 0;
fieldBgInit[13][13] = 0;
fieldInit[13][13] = 0;
fieldBgInit[13][14] = 0;
fieldInit[13][14] = 0;
fieldBgInit[14][0] = 0;
fieldInit[14][0] = 0;
fieldBgInit[14][1] = 0;
fieldInit[14][1] = 0;
fieldBgInit[14][2] = 0;
fieldInit[14][2] = 0;
fieldBgInit[14][3] = 0;
fieldInit[14][3] = 0;
fieldBgInit[14][4] = 0;
fieldInit[14][4] = 0;
fieldBgInit[14][5] = 0;
fieldInit[14][5] = 0;
fieldBgInit[14][6] = 0;
fieldInit[14][6] = 0;
fieldBgInit[14][7] = 0;
fieldInit[14][7] = 0;
fieldBgInit[14][8] = 0;
fieldInit[14][8] = 0;
fieldBgInit[14][9] = 0;
fieldInit[14][9] = 0;
fieldBgInit[14][10] = 0;
fieldInit[14][10] = 0;
fieldBgInit[14][11] = 0;
fieldInit[14][11] = 0;
fieldBgInit[14][12] = 0;
fieldInit[14][12] = 0;
fieldBgInit[14][13] = 0;
fieldInit[14][13] = 0;
fieldBgInit[14][14] = 0;
fieldInit[14][14] = 0;
break;
case 15:
timeLimit = 120;
candies = [10, 20, 30];
numOfCandies = 3;
lowLevel = 14;
break;
};
DrawBatmans();
pauseTimer2.start();
pauseTimer = new Timer((animationTime * 1300), 0);
pauseTimer.addEventListener(TimerEvent.TIMER, PauseTimerHandler);
addEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown);
addEventListener(MouseEvent.MOUSE_UP, OnMouseUp);
addEventListener(MouseEvent.MOUSE_MOVE, OnMouseMove);
root["GameMC"]["bar"].hint.addEventListener(MouseEvent.CLICK, GetHint);
}
public function SwapBack(_arg1, _arg2, _arg3, _arg4){
var _local5:int;
var _local6:int;
var _local7:*;
var _local8:SoundChannel;
if (_arg2 == _arg4){
_local5 = (offsetX + (_arg1 * 37));
_local6 = (offsetX + (_arg3 * 37));
TweenMax.to(field[_arg1][_arg2], 0.2, {x:_local6, onComplete:BrickMoveEnd2, ease:Linear.easeIn});
TweenMax.to(field[_arg3][_arg4], 0.2, {x:_local5, ease:Linear.easeIn});
_local7 = field[_arg1][_arg2];
field[_arg1][_arg2] = field[_arg3][_arg4];
field[_arg3][_arg4] = _local7;
} else {
if (_arg1 == _arg3){
_local5 = (offsetY + (_arg2 * 37));
_local6 = (offsetY + (_arg4 * 37));
TweenMax.to(field[_arg1][_arg2], 0.2, {y:_local6, onComplete:BrickMoveEnd2, ease:Linear.easeIn});
TweenMax.to(field[_arg3][_arg4], 0.2, {y:_local5, ease:Linear.easeIn});
_local7 = field[_arg1][_arg2];
field[_arg1][_arg2] = field[_arg3][_arg4];
field[_arg3][_arg4] = _local7;
};
};
if (root["muted"].text == "0"){
_local8 = new SoundMove2().play();
};
}
public function PauseTimerHandler(_arg1:Event){
var _local2:int;
var _local3:int;
var _local4:Boolean;
var _local5:SoundChannel;
pauseTimer.stop();
if (CheckField() > 0){
DeleteChecked();
} else {
movement = true;
if (FindMove() == false){
sw.removeEventListener(TimerEvent.TIMER, SWHandler);
sw.stop();
_local4 = false;
sw.stop();
_local2 = 0;
while (_local2 < fieldSize) {
_local3 = 0;
while (_local3 < fieldSize) {
if (((!((field[_local2][_local3] == null))) && (!((field[_local2][_local3].color == 0))))){
if (!_local4){
TweenMax.to(field[_local2][_local3], (animationTime * 2), {y:600, onComplete:LoseHandler2, ease:Linear.easeIn});
_local4 = true;
} else {
TweenMax.to(field[_local2][_local3], (animationTime * 2), {y:600, ease:Linear.easeIn});
};
};
_local3++;
};
_local2++;
};
if (root["muted"].text == "0"){
_local5 = new SoundLose().play();
};
trace("lose");
sl = new StartLevel();
sl.x = 375;
sl.y = 275;
sl.lvlmc.level.text = "No moves";
addChild(sl);
};
combos = 0;
};
}
public function OnMouseUp(_arg1:Event){
isMouseDown = false;
prevCol = -1;
prevRow = -1;
}
public function Kakaha(){
}
public function CreateBar(){
bar = new Bar();
bar.x = -30;
bar.y = -17;
addChild(bar);
root["GameMC"]["bar"].level.text = lvl.toString();
}
public function DeleteChecked(){
var _local1:Boolean;
var _local2:*;
var _local3:*;
var _local4:SoundChannel;
_local1 = false;
_local2 = 0;
while (_local2 < fieldSize) {
_local3 = 0;
while (_local3 < fieldSize) {
if (field[_local2][_local3].act == "del"){
TweenMax.to(field[_local2][_local3], 0.2, {alpha:0.5, onComplete:DisposeEnd, onCompleteParams:[_local2, _local3], ease:Linear.easeIn});
field[_local2][_local3].gotoAndStop(15);
_local1 = true;
field[_local2][_local3] = null;
score = (score + 10);
} else {
if (field[_local2][_local3].act == "delCandie"){
TweenMax.to(field[_local2][_local3], 0.9, {x:((candies.length - numOfCandies) * 40), y:0, bezier:[{x:(field[_local2][_local3].x / 2), y:(field[_local2][_local3].y + 100)}], onComplete:DisposeEnd, onCompleteParams:[_local2, _local3], ease:Linear.easeIn});
field[_local2][_local3] = null;
numOfCandies--;
if (root["muted"].text == "0"){
_local4 = new SoundCandy().play();
};
} else {
field[_local2][_local3].act = "neutral";
};
};
_local3++;
};
_local2++;
};
if (!_local1){
combos = 0;
} else {
combos++;
swaps++;
if (root["muted"].text == "0"){
if (combos <= 5){
switch (combos){
case 1:
_local4 = new SoundDispose1().play();
break;
case 2:
_local4 = new SoundDispose2().play();
break;
case 3:
_local4 = new SoundDispose3().play();
break;
case 4:
_local4 = new SoundDispose4().play();
break;
case 5:
_local4 = new SoundDispose5().play();
break;
};
} else {
_local4 = new SoundDispose5().play();
};
};
if (combos == 3){
bonusAllowed = true;
};
};
root["GameMC"]["bar"].score.text = score;
}
public function GetOffset(_arg1, _arg2){
var _local3:int;
var _local4:int;
var _local5:Boolean;
_local4 = 0;
_local5 = false;
_local3 = _arg2;
for (;_local3 < fieldSize;_local3++) {
if ((((field[_arg1][_local3] == null)) && (!(_local5)))){
return (1);
};
if ((((field[_arg1][_local3] == null)) && (_local5))){
_local4++;
return (_local4);
};
if (field[_arg1][_local3].color == 0){
_local4++;
_local5 = true;
continue;
};
};
return (_local4);
}
public function BrickMoveEnd2(){
movement = true;
}
public function FindMove(_arg1:Boolean=false){
var _local2:*;
var _local3:int;
var _local4:*;
tempField = new Array();
_local2 = 0;
while (_local2 < fieldSize) {
tempField[_local2] = new Array();
_local3 = 0;
while (_local3 < fieldSize) {
tempField[_local2][_local3] = field[_local2][_local3];
_local3++;
};
_local2++;
};
_local2 = 0;
while (_local2 < fieldSize) {
_local3 = 0;
while (_local3 < (fieldSize - 1)) {
if (((((((!((tempField[_local3][_local2] == null))) && (!((tempField[(_local3 + 1)][_local2] == null))))) && (!((tempField[_local3][_local2].color == 0))))) && (!((tempField[(_local3 + 1)][_local2].color == 0))))){
_local4 = tempField[_local3][_local2];
tempField[_local3][_local2] = tempField[(_local3 + 1)][_local2];
tempField[(_local3 + 1)][_local2] = _local4;
if (SimpleCheck() == true){
if (_arg1){
TweenMax.to(field[_local3][_local2], animationTime, {width:50, onComplete:HintAnimation, onCompleteParams:[_local3, _local2, (_local3 + 1), _local2], ease:Linear.easeNone});
TweenMax.to(field[(_local3 + 1)][_local2], animationTime, {width:50, ease:Linear.easeIn});
TweenMax.to(field[_local3][_local2], animationTime, {height:50, ease:Linear.easeIn});
TweenMax.to(field[(_local3 + 1)][_local2], animationTime, {height:50, ease:Linear.easeIn});
};
return (true);
} else {
_local4 = tempField[_local3][_local2];
tempField[_local3][_local2] = tempField[(_local3 + 1)][_local2];
tempField[(_local3 + 1)][_local2] = _local4;
};
};
_local3++;
};
_local2++;
};
_local2 = 0;
while (_local2 < fieldSize) {
_local3 = 0;
while (_local3 < fieldSize) {
if (((((((!((tempField[_local2][_local3] == null))) && (!((tempField[_local2][(_local3 + 1)] == null))))) && (!((tempField[_local2][_local3].color == 0))))) && (!((tempField[_local2][(_local3 + 1)].color == 0))))){
_local4 = tempField[_local2][_local3];
tempField[_local2][_local3] = tempField[_local2][(_local3 + 1)];
tempField[_local2][(_local3 + 1)] = _local4;
if (SimpleCheck() == true){
if (_arg1){
TweenMax.to(field[_local2][_local3], animationTime, {width:50, onComplete:HintAnimation, onCompleteParams:[_local2, _local3, _local2, (_local3 + 1)], ease:Linear.easeNone});
TweenMax.to(field[_local2][(_local3 + 1)], animationTime, {width:50, ease:Linear.easeIn});
TweenMax.to(field[_local2][_local3], animationTime, {height:50, ease:Linear.easeIn});
TweenMax.to(field[_local2][(_local3 + 1)], animationTime, {height:50, ease:Linear.easeIn});
};
return (true);
} else {
_local4 = tempField[_local2][_local3];
tempField[_local2][_local3] = tempField[_local2][(_local3 + 1)];
tempField[_local2][(_local3 + 1)] = _local4;
};
};
_local3++;
};
_local2++;
};
return (false);
}
public function PauseTimer3Handler(_arg1:Event){
pauseTimer3.stop();
pauseTimer3.removeEventListener(TimerEvent.TIMER, PauseTimer3Handler);
root["GameMC"].gotoAndPlay(4);
}
public function OnMouseDown(_arg1:Event){
var _local2:*;
var _local3:*;
var _local4:int;
if (mouseX > offsetX){
_local2 = (mouseX - 158);
_local3 = (mouseY - 3);
isMouseDown = true;
col = int((_local2 / 37));
row = int((_local3 / 37));
if (((!((field[col][row] == null))) && (movement))){
if (field[col][row].color == 9){
_local4 = 0;
while (_local4 < fieldSize) {
if (field[_local4][row].color != 0){
field[_local4][row].act = "del";
};
_local4++;
};
DeleteChecked();
RefreshField();
} else {
if (field[col][row].color == 10){
field[col][row].act = "del";
if ((col - 1) >= 0){
if (((!((field[(col - 1)][row] == null))) && (!((field[(col - 1)][row].color == 0))))){
field[(col - 1)][row].act = "del";
};
};
if ((col + 1) < fieldSize){
if (((!((field[(col + 1)][row] == null))) && (!((field[(col + 1)][row].color == 0))))){
field[(col + 1)][row].act = "del";
};
};
if ((row - 1) >= 0){
if (((!((field[col][(row - 1)] == null))) && (!((field[col][(row - 1)].color == 0))))){
field[col][(row - 1)].act = "del";
};
};
if ((row + 1) < fieldSize){
if (((!((field[col][(row + 1)] == null))) && (!((field[col][(row + 1)].color == 0))))){
field[col][(row + 1)].act = "del";
};
};
if (((((col - 1) >= 0)) && (((row + 1) < fieldSize)))){
if (((!((field[(col - 1)][(row + 1)] == null))) && (!((field[(col - 1)][(row + 1)].color == 0))))){
field[(col - 1)][(row + 1)].act = "del";
};
};
if (((((col - 1) >= 0)) && (((row - 1) >= 0)))){
if (((!((field[(col - 1)][(row - 1)] == null))) && (!((field[(col - 1)][(row - 1)].color == 0))))){
field[(col - 1)][(row - 1)].act = "del";
};
};
if (((((col + 1) < fieldSize)) && (((row + 1) < fieldSize)))){
if (((!((field[(col + 1)][(row + 1)] == null))) && (!((field[(col + 1)][(row + 1)].color == 0))))){
field[(col + 1)][(row + 1)].act = "del";
};
};
if (((((col + 1) < fieldSize)) && (((row - 1) >= 0)))){
if (((!((field[(col + 1)][(row - 1)] == null))) && (!((field[(col + 1)][(row - 1)].color == 0))))){
field[(col + 1)][(row - 1)].act = "del";
};
};
DeleteChecked();
RefreshField();
};
};
};
if ((((lvl == 1)) && (!((tutorial == null))))){
root["GameMC"]["emc"].removeChild(tutorial);
tutorial = null;
};
};
}
public function BonusRocket(_arg1, _arg2){
}
public function Destroy(){
pauseTimer.removeEventListener(TimerEvent.TIMER, PauseTimerHandler);
removeEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown);
removeEventListener(MouseEvent.MOUSE_UP, OnMouseUp);
removeEventListener(MouseEvent.MOUSE_MOVE, OnMouseMove);
sw.removeEventListener(TimerEvent.TIMER, SWHandler);
}
public function BrickMoveEnd(_arg1, _arg2, _arg3, _arg4){
var _local5:Brick;
prevCol = -1;
field[_arg1][_arg2].locked = false;
field[_arg3][_arg4].locked = false;
CheckField();
if (((!((field[_arg1][_arg2].act == "del"))) && (!((field[_arg3][_arg4].act == "del"))))){
SwapBack(_arg1, _arg2, _arg3, _arg4);
};
DeleteChecked();
}
public function WinHandler(){
var _local1:int;
var _local2:int;
var _local3:Boolean;
var _local4:SoundChannel;
_local3 = false;
sw.stop();
_local1 = 0;
while (_local1 < fieldSize) {
_local2 = 0;
while (_local2 < fieldSize) {
if (((!((field[_local1][_local2] == null))) && (!((field[_local1][_local2].color == 0))))){
if (!_local3){
TweenMax.to(field[_local1][_local2], animationTime, {width:0, onComplete:WinHandler2, ease:Linear.easeIn});
_local3 = true;
} else {
TweenMax.to(field[_local1][_local2], animationTime, {width:0, ease:Linear.easeIn});
};
TweenMax.to(field[_local1][_local2], animationTime, {height:0, ease:Linear.easeIn});
};
_local2++;
};
_local1++;
};
score = (score + ((timeLimit - swc) * 5));
root["score"].text = score.toString();
sw = new Timer(1, 0);
sw.addEventListener(TimerEvent.TIMER, swHandler2);
sw.start();
if (root["muted"].text == "0"){
_local4 = new SoundWin().play();
};
sl = new StartLevel();
sl.x = 375;
sl.y = 275;
sl.lvlmc.level.text = "Win";
addChild(sl);
}
public function DrawBatmans(){
var _local1:int;
var _local2:Array;
var _local3:Number;
var _local4:SoundChannel;
_local2 = new Array();
if (root["muted"].text == "0"){
_local4 = new Fly().play();
};
_local1 = 0;
while (_local1 < 1) {
_local2[_local1] = new Batman();
_local2[_local1].x = 270;
_local2[_local1].scaleX = (_local2[_local1].scaleY = 2);
root["GameMC"]["emc"].addChild(_local2[_local1]);
_local1++;
};
setTimeout(DrawBg, 800);
}
public function DrawField(){
var _local1:int;
var _local2:int;
var _local3:SoundChannel;
if (root["muted"].text == "0"){
_local3 = new SoundNewBricks().play();
};
_local1 = 0;
while (_local1 < fieldSize) {
_local2 = 0;
while (_local2 < fieldSize) {
if (fieldInit[_local2][_local1] != 0){
field[_local1][_local2] = new Brick();
field[_local1][_local2].gotoAndStop((1 + fieldInit[_local2][_local1]));
field[_local1][_local2].color = fieldInit[_local2][_local1];
} else {
field[_local1][_local2] = new Brick();
field[_local1][_local2].gotoAndStop((1 + fieldInit[_local2][_local1]));
field[_local1][_local2].color = fieldInit[_local2][_local1];
};
field[_local1][_local2].locked = new Boolean(false);
field[_local1][_local2].act = new String("neutral");
field[_local1][_local2].x = (offsetX + (37 * _local1));
field[_local1][_local2].y = (offsetY + (37 * _local2));
field[_local1][_local2].width = 1;
field[_local1][_local2].height = 1;
TweenMax.to(field[_local1][_local2], animationTime, {width:35, ease:Linear.easeIn});
TweenMax.to(field[_local1][_local2], animationTime, {height:35, ease:Linear.easeIn});
addChild(field[_local1][_local2]);
_local2++;
};
_local1++;
};
sl = new StartLevel();
sl.x = 375;
sl.lvlmc.level.text = ("Level " + lvl.toString());
root["GameMC"]["emc"].addChild(sl);
}
}
}//package
Section 49
//Note (Note)
package {
import flash.display.*;
public dynamic class Note extends MovieClip {
public function Note(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package
Section 50
//SoundBg (SoundBg)
package {
import flash.media.*;
public dynamic class SoundBg extends Sound {
}
}//package
Section 51
//SoundBonus (SoundBonus)
package {
import flash.media.*;
public dynamic class SoundBonus extends Sound {
}
}//package
Section 52
//SoundCandy (SoundCandy)
package {
import flash.media.*;
public dynamic class SoundCandy extends Sound {
}
}//package
Section 53
//SoundDispose1 (SoundDispose1)
package {
import flash.media.*;
public dynamic class SoundDispose1 extends Sound {
}
}//package
Section 54
//SoundDispose2 (SoundDispose2)
package {
import flash.media.*;
public dynamic class SoundDispose2 extends Sound {
}
}//package
Section 55
//SoundDispose3 (SoundDispose3)
package {
import flash.media.*;
public dynamic class SoundDispose3 extends Sound {
}
}//package
Section 56
//SoundDispose4 (SoundDispose4)
package {
import flash.media.*;
public dynamic class SoundDispose4 extends Sound {
}
}//package
Section 57
//SoundDispose5 (SoundDispose5)
package {
import flash.media.*;
public dynamic class SoundDispose5 extends Sound {
}
}//package
Section 58
//SoundDisposeBg (SoundDisposeBg)
package {
import flash.media.*;
public dynamic class SoundDisposeBg extends Sound {
}
}//package
Section 59
//SoundLose (SoundLose)
package {
import flash.media.*;
public dynamic class SoundLose extends Sound {
}
}//package
Section 60
//SoundMove1 (SoundMove1)
package {
import flash.media.*;
public dynamic class SoundMove1 extends Sound {
}
}//package
Section 61
//SoundMove2 (SoundMove2)
package {
import flash.media.*;
public dynamic class SoundMove2 extends Sound {
}
}//package
Section 62
//SoundNewBricks (SoundNewBricks)
package {
import flash.media.*;
public dynamic class SoundNewBricks extends Sound {
}
}//package
Section 63
//SoundTick (SoundTick)
package {
import flash.media.*;
public dynamic class SoundTick extends Sound {
}
}//package
Section 64
//SoundWin (SoundWin)
package {
import flash.media.*;
public dynamic class SoundWin extends Sound {
}
}//package
Section 65
//StartLevel (StartLevel)
package {
import flash.display.*;
public dynamic class StartLevel extends MovieClip {
public var lvlmc:MovieClip;
public function StartLevel(){
addFrameScript(35, frame36);
}
function frame36(){
stop();
}
}
}//package