Section 1
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
col1.SetV(_arg2);
col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
col1.x = _local4;
col2.x = -(_local5);
col1.y = _local5;
col2.y = _local4;
};
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function Set(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = col1.x;
_local3 = col2.x;
_local4 = col1.y;
_local5 = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_local6 = (1 / _local6);
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = col1.x;
_local5 = col2.x;
_local6 = col1.y;
_local7 = col2.y;
_local8 = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 2
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1));
public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity);
public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0);
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = b2MulMV(_arg1.R, _arg2);
_local3.x = (_local3.x + _arg1.position.x);
_local3.y = (_local3.y + _arg1.position.y);
return (_local3);
}
public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:*;
_local3 = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22;
_local2 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
_local3 = SubtractVV(_arg2, _arg1.position);
_local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y));
_local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y));
_local3.x = _local4;
return (_local3);
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2;
_local2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Mat22;
_local3 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
_local4 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
_local5 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean;
_local2 = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Box2D.Common.Math
Section 3
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
public class b2Vec2 {
public var x:Number;
public var y:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function LengthSquared():Number{
return (((x * x) + (y * y)));
}
public function SetZero():void{
x = 0;
y = 0;
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function CrossVF(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function Normalize():Number{
var _local1:Number;
var _local2:Number;
_local1 = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
_local2 = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 4
//b2XForm (Box2D.Common.Math.b2XForm)
package Box2D.Common.Math {
public class b2XForm {
public var R:b2Mat22;
public var position:b2Vec2;
public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{
position = new b2Vec2();
R = new b2Mat22();
super();
if (_arg1){
position.SetV(_arg1);
R.SetM(_arg2);
};
}
public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{
position.SetV(_arg1);
R.SetM(_arg2);
}
public function Set(_arg1:b2XForm):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
public function SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
}
}//package Box2D.Common.Math
Section 5
//Game (elm.core.Game)
package elm.core {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class Game {
private static var m_debug:Boolean = true;
private static var states:Object;
public static var clip:Layer;
private static var state:String;
public static var mouseX:Number;
public static var mouseY:Number;
private static var last_time:Number;
public static var fps:uint;
private static var vars:Object;
public static var SYS:Layer;
private static var fps_num:uint;
public static var delta:Number;
private static var last_fps_time:Number;
public static function getVar(_arg1:String){
return (vars[_arg1]);
}
public static function getStateName():String{
return (state);
}
public static function get Height():Number{
return (Gfx.Height);
}
public static function setState(_arg1:String):State{
if (states[_arg1] == undefined){
Log.Error((("State '" + _arg1) + "' not found."));
return (null);
};
if (state == _arg1){
return (states[state]);
};
if (state != ""){
clip.stage.removeEventListener(MouseEvent.CLICK, states[state].onMouseClick);
clip.stage.removeEventListener(MouseEvent.DOUBLE_CLICK, states[state].onMouseDoubleClick);
clip.stage.removeEventListener(MouseEvent.MOUSE_DOWN, states[state].onMouseDown);
clip.stage.removeEventListener(MouseEvent.MOUSE_UP, states[state].onMouseUp);
clip.stage.removeEventListener(MouseEvent.MOUSE_MOVE, states[state].onMouseMove);
clip.stage.removeEventListener(KeyboardEvent.KEY_DOWN, states[state].onKeyDown);
clip.stage.removeEventListener(KeyboardEvent.KEY_UP, states[state].onKeyUp);
states[state].free();
};
Gfx.freeLayers();
if (states[_arg1].init()){
clip.stage.doubleClickEnabled = true;
clip.stage.addEventListener(MouseEvent.CLICK, states[_arg1].onMouseClick);
clip.stage.addEventListener(MouseEvent.MOUSE_DOWN, states[_arg1].onMouseDown);
clip.stage.addEventListener(MouseEvent.MOUSE_UP, states[_arg1].onMouseUp);
clip.stage.addEventListener(MouseEvent.MOUSE_MOVE, states[_arg1].onMouseMove);
clip.stage.addEventListener(KeyboardEvent.KEY_DOWN, states[_arg1].onKeyDown);
clip.stage.addEventListener(KeyboardEvent.KEY_UP, states[_arg1].onKeyUp);
last_time = (last_fps_time = getTimer());
state = _arg1;
} else {
Log.Error((("State '" + _arg1) + "' not inited."));
return (null);
};
clip.stage.focus = null;
return (states[state]);
}
public static function clearSavesVars(_arg1:String):void{
var _local2:SharedObject;
_local2 = SharedObject.getLocal(_arg1);
_local2.clear();
}
public static function init(_arg1:Layer){
_slot1.clip = _arg1;
states = [];
state = "";
vars = [];
_arg1.addEventListener(Event.ENTER_FRAME, _slot1.frame);
last_time = (last_fps_time = getTimer());
SYS = Gfx.createLayer(null, "sys", 999, false);
Gfx.createText(SYS, "fps", 0, 0, Gfx.Width, 20, {font:"_sans", embed:false, size:12, align:"center", color:0xCCCCCC, bold:false}, []);
}
public static function getState(_arg1:String):State{
return (states[_arg1]);
}
public static function saveVars(_arg1:String):void{
var _local2:SharedObject;
_local2 = SharedObject.getLocal(_arg1);
_local2.data.vars = vars;
_local2.flush();
}
public static function setVar(_arg1:String, _arg2):void{
vars[_arg1] = _arg2;
}
public static function isSavedVars(_arg1:String):Boolean{
var _local2:SharedObject;
_local2 = SharedObject.getLocal(_arg1);
return (!((_local2.data.vars == undefined)));
}
public static function loadVars(_arg1:String):void{
var _local2:SharedObject;
_local2 = SharedObject.getLocal(_arg1);
vars = _local2.data.vars;
}
public static function frame(_arg1:Event){
delta = ((getTimer() - last_time) / 1000);
last_time = getTimer();
fps_num++;
if ((getTimer() - last_fps_time) >= 1000){
fps = fps_num;
fps_num = 0;
last_fps_time = getTimer();
};
mouseX = clip.mouseX;
mouseY = clip.mouseY;
if (state != ""){
states[state].frame();
};
Gfx.setText(SYS, "fps", ((((((fps + " fps, ") + delta) + " delta, x:") + mouseX) + ", y:") + mouseY));
}
public static function get Width():Number{
return (Gfx.Width);
}
public static function get Debug():Boolean{
return (m_debug);
}
public static function set Debug(_arg1:Boolean):void{
var _local2:DisplayObject;
m_debug = _arg1;
_local2 = Gfx.getMovie(SYS, "fps");
if (_local2){
if (!m_debug){
_local2.y = -10;
} else {
_local2.y = 10;
};
};
}
public static function addState(_arg1:String, _arg2:State):void{
states[_arg1] = _arg2;
}
}
}//package elm.core
Section 6
//Gfx (elm.core.Gfx)
package elm.core {
import flash.display.*;
import flash.utils.*;
public class Gfx {
public static var Width:Number;
public static var Height:Number;
private static var autoLayer:Array;
public static var clip:Layer;
public static function removeMovieByName(_arg1:Layer, _arg2:String):void{
if (!_arg1){
_arg1 = clip;
};
removeMovie(_arg1, _arg1.getChildByName(_arg2));
}
public static function getText(_arg1:Layer, _arg2:String):String{
var _local3:Text;
if (!_arg1){
_arg1 = clip;
};
_local3 = (_arg1.getChildByName(_arg2) as Text);
if (_local3){
return (_local3.text);
};
return ("");
}
public static function removeLayer(_arg1:Layer, _arg2:Layer){
var _local3:int;
if (!_arg1){
_arg1 = clip;
};
_local3 = _arg1.getChildIndex(_arg2);
if (_local3 >= 0){
_arg1.depthLayer.splice(_local3, 1);
_arg1.removeChildAt(_local3);
};
}
public static function addMovie(_arg1:Layer, _arg2:DisplayObject, _arg3:String=null, _arg4:Object=null):DisplayObject{
var _local5:*;
if (!_arg2){
return (null);
};
if (!_arg1){
_arg1 = clip;
};
for (_local5 in _arg4) {
_arg2[_local5] = _arg4[_local5];
};
_arg1.addChild(_arg2);
if (_arg3){
_arg2.name = _arg3;
};
return (_arg2);
}
public static function makeMovie(_arg1:String, _arg2:String, _arg3:Object=null):DisplayObject{
var _local4:Class;
var _local5:*;
var _local6:*;
_local4 = (getDefinitionByName(_arg1) as Class);
_local5 = new (_local4);
for (_local6 in _arg3) {
_local5[_local6] = _arg3[_local6];
};
_local5.name = _arg2;
return ((_local5 as DisplayObject));
}
public static function removeMovie(_arg1:Layer, _arg2:DisplayObject):void{
if (!_arg1){
_arg1 = clip;
};
_arg1.removeChild(_arg2);
}
public static function createMovie(_arg1:Layer, _arg2:String, _arg3:String, _arg4:Object=null):DisplayObject{
var _local5:Class;
var _local6:*;
var _local7:*;
if (!_arg1){
_arg1 = clip;
};
_local5 = (getDefinitionByName(_arg2) as Class);
_local6 = new (_local5);
for (_local7 in _arg4) {
_local6[_local7] = _arg4[_local7];
};
_arg1.addChild(_local6);
_local6.name = _arg3;
return ((_local6 as DisplayObject));
}
public static function createLayer(_arg1:Layer, _arg2:String, _arg3:uint, _arg4:Boolean=true):Layer{
var _local5:Layer;
var _local6:uint;
var _local7:uint;
if (!_arg1){
if (_arg4){
autoLayer.push(_arg2);
};
_arg1 = clip;
};
_local5 = new Layer();
_local5.name = _arg2;
_local6 = 0;
_local7 = 0;
while (_local7 < _arg1.depthLayer.length) {
if (_arg1.depthLayer[_local7] >= _arg3){
_local6 = _local7;
break;
};
_local7++;
};
_arg1.depthLayer.splice(_local6, 0, _arg3);
return (Layer(_arg1.addChildAt(_local5, _local6)));
}
public static function setText(_arg1:Layer, _arg2:String, _arg3:String):void{
var _local4:Text;
if (!_arg1){
_arg1 = clip;
};
_local4 = (_arg1.getChildByName(_arg2) as Text);
if (_local4){
_local4.text = _arg3;
};
}
public static function init(_arg1:Layer):void{
_slot1.clip = _arg1;
Width = _arg1.stage.stageWidth;
Height = _arg1.stage.stageHeight;
autoLayer = [];
Log.Message((((("elm.core.Gfx inited. (" + Width) + "x") + Height) + ")"));
}
public static function createText(_arg1:Layer, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Object, _arg8:Array):Text{
var _local9:Text;
if (!_arg1){
_arg1 = clip;
};
_local9 = new Text(_arg3, _arg4, _arg5, _arg6, _arg7);
_local9.name = _arg2;
if (_arg8){
_local9.filters = _arg8;
};
_arg1.addChild(_local9);
return (_local9);
}
public static function getMovie(_arg1:Layer, _arg2:String):DisplayObject{
return ((_arg1.getChildByName(_arg2) as DisplayObject));
}
public static function freeLayers(){
var _local1:Layer;
var _local2:int;
var _local3:Number;
_local3 = 0;
while (_local3 < autoLayer.length) {
_local1 = (clip.getChildByName(autoLayer[_local3]) as Layer);
_local2 = clip.getChildIndex(_local1);
if (_local2 >= 0){
clip.depthLayer.splice(_local2, 1);
clip.removeChildAt(_local2);
};
_local3++;
};
autoLayer = [];
}
public static function getLayerByName(_arg1:Layer, _arg2:String):Layer{
if (!_arg1){
_arg1 = clip;
};
return (Layer(_arg1.getChildByName(_arg2)));
}
}
}//package elm.core
Section 7
//Layer (elm.core.Layer)
package elm.core {
import flash.display.*;
public class Layer extends Sprite {
public var depthLayer:Array;
public function Layer(){
depthLayer = [];
super();
}
public function createLayer(_arg1:String, _arg2:uint, _arg3:Boolean=true):Layer{
return (Gfx.createLayer(this, _arg1, _arg2, _arg3));
}
}
}//package elm.core
Section 8
//Log (elm.core.Log)
package elm.core {
public class Log {
public static function Error(_arg1:String=""){
Message(("Error: " + _arg1));
}
public static function Message(_arg1:String=""){
}
}
}//package elm.core
Section 9
//PreloaderMochi (elm.core.PreloaderMochi)
package elm.core {
import flash.display.*;
import flash.events.*;
import mochi.*;
public dynamic class PreloaderMochi extends MovieClip {
public function PreloaderMochi(){
stop();
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
public function onProgress(_arg1:Number):void{
}
public function onCompleteMochiAd():void{
addEventListener(Event.ENTER_FRAME, onEnterFrame);
play();
}
public function ShowLeaderboard(_arg1:uint=undefined, _arg2:Function=null):void{
var bid:String;
var o:Object;
var score = _arg1;
var on_close = _arg2;
bid = GetMochiLeaderBoardId();
if (!bid){
return;
};
o = {boardID:bid};
if (score){
o.score = score;
};
if (on_close){
o.onClose = on_close;
} else {
if (!score){
o.onClose = function ():void{
};
} else {
o.onClose = function ():void{
Game.setState("mainmenu");
};
};
};
MochiScores.showLeaderboard(o);
}
public function GetDocumentClass():String{
return ("Main");
}
public function GetMochiObject():Object{
return ({});
}
public function GetNoProgressBar():Boolean{
return (true);
}
public function onAddedToStage(_arg1:Event):void{
var _local2:Object;
_local2 = GetMochiObject();
_local2.clip = this;
_local2.ad_finished = onCompleteMochiAd;
_local2.ad_progress = onProgress;
_local2.no_progress_bar = GetNoProgressBar();
MochiServices.connect(_local2.id, this);
MochiAd.showPreGameAd(_local2);
}
final private function main():void{
var _local1:Class;
Log.Message(("DocumentClass: " + GetDocumentClass()));
_local1 = (loaderInfo.applicationDomain.getDefinition(GetDocumentClass()) as Class);
addChild(new (_local1));
}
private function onEnterFrame(_arg1:Event):void{
if (currentFrame >= GetEntryFrame()){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
stop();
main();
};
}
public function GetMochiLeaderBoardId():String{
return (null);
}
public function GetEntryFrame():uint{
return (3);
}
public function GetMochiGameId():String{
var _local1:Object;
_local1 = GetMochiObject();
if (_local1.id){
return (_local1.id);
};
return (null);
}
}
}//package elm.core
Section 10
//RootLayer (elm.core.RootLayer)
package elm.core {
import flash.events.*;
import flash.display.*;
public class RootLayer extends Layer {
public var layers:Layer;
public function RootLayer(){
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
public function init():void{
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
Gfx.init(this);
Sfx.init(this);
Game.init(this);
}
public function onAddedToStage(_arg1:Event):void{
init();
}
}
}//package elm.core
Section 11
//Sfx (elm.core.Sfx)
package elm.core {
import flash.media.*;
import flash.events.*;
import flash.utils.*;
public class Sfx {
public static var clip:Layer = null;
private static var sound:Object = null;
public static function play(_arg1:String, _arg2:Number=1, _arg3:Number=0, _arg4:Function=null):SoundChannel{
var _local5:SoundChannel;
var _local6:Class;
if (((!(sound[_arg1])) || ((sound[_arg1] == undefined)))){
_local6 = (getDefinitionByName(_arg1) as Class);
sound[_arg1] = new (_local6);
};
_local5 = sound[_arg1].play(0, 0, new SoundTransform(_arg2, _arg3));
if (_arg4 != null){
_local5.addEventListener(Event.SOUND_COMPLETE, _arg4);
};
return (_local5);
}
public static function init(_arg1:Layer){
_slot1.clip = _arg1;
sound = {};
}
}
}//package elm.core
Section 12
//State (elm.core.State)
package elm.core {
import flash.events.*;
public class State {
public function onMouseClick(_arg1:MouseEvent):void{
}
public function onMouseUp(_arg1:MouseEvent):void{
}
public function onKeyDown(_arg1:KeyboardEvent):void{
}
public function free():void{
}
public function frame():void{
}
public function onMouseDown(_arg1:MouseEvent):void{
}
public function init():Boolean{
return (false);
}
public function onMouseDoubleClick(_arg1:MouseEvent):void{
}
public function onMouseMove(_arg1:MouseEvent):void{
}
public function onKeyUp(_arg1:KeyboardEvent):void{
}
}
}//package elm.core
Section 13
//Text (elm.core.Text)
package elm.core {
import flash.display.*;
import flash.text.*;
public class Text extends Sprite {
private var _text:TextField;
public function Text(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object){
var _local6:TextFormat;
super();
this.x = (_arg1 + (_arg3 * 0.5));
this.y = (_arg2 + (_arg4 * 0.5));
_text = new TextField();
_text.x = (-(_arg3) * 0.5);
_text.y = (-(_arg4) * 0.5);
_text.width = _arg3;
_text.height = _arg4;
_text.selectable = false;
_text.embedFonts = _arg5.embed;
_text.multiline = true;
_text.wordWrap = true;
_text.antiAliasType = AntiAliasType.ADVANCED;
_text.mouseEnabled = false;
_local6 = new TextFormat(_arg5.font, _arg5.size, _arg5.color, _arg5.bold, _arg5.italic, _arg5.underline, _arg5.url, _arg5.target, _arg5.align, _arg5.leftMargin, _arg5.rightMargin, _arg5.indent, _arg5.leading);
_text.defaultTextFormat = _local6;
addChild(_text);
this.mouseEnabled = false;
}
public function get text():String{
return (_text.text);
}
public function set text(_arg1:String):void{
_text.text = _arg1;
}
public function set a(_arg1:Number):void{
alpha = _arg1;
_text.alpha = _arg1;
}
}
}//package elm.core
Section 14
//Animation (elm.gfx.Animation)
package elm.gfx {
import elm.core.*;
import flash.display.*;
import gfx.*;
public class Animation extends MovieClip {
private var ani:Object;// = null
public var aaa:MovieClip;
public var hit:EatFirst;
public static var FORVARD:uint = 0;
public static var BACK:uint = 1;
public static var PINPONG:uint = 2;
public function Animation(){
ani = null;
super();
ani = new Object();
}
public function GetPercent(_arg1:String):uint{
var _local2:Number;
var _local3:uint;
_local2 = (((ani[_arg1].end - ani[_arg1].begin) + 1) * 0.01);
_local3 = int((((ani[_arg1].curr - ani[_arg1].begin) + 1) / _local2));
if (_local3 > 100){
_local3 = 100;
};
return (_local3);
}
public function Set(_arg1:String, _arg2:Number, _arg3:uint, _arg4:uint, _arg5:uint=0, _arg6:Boolean=true):void{
ani[_arg1] = new Object();
ani[_arg1].timer = 0;
ani[_arg1].fps = (1 / _arg2);
ani[_arg1].begin = (ani[_arg1].curr = _arg3);
ani[_arg1].end = _arg4;
ani[_arg1].type = _arg5;
ani[_arg1].is_loop = _arg6;
ani[_arg1].percent = -1;
if (int(_arg5) == 1){
ani[_arg1].step = -1;
} else {
ani[_arg1].step = 1;
if (int(_arg5) == 2){
ani[_arg1].is_loop = true;
};
};
}
public function SetPercent(_arg1:String, _arg2:uint):void{
var _local3:Number;
if (_arg2 < 0){
_arg2 = 0;
};
if (_arg2 > 100){
_arg2 = 100;
};
if (ani[_arg1].percent == _arg2){
return;
};
_local3 = ((ani[_arg1].end - ani[_arg1].begin) + 1);
ani[_arg1].curr = (int((ani[_arg1].begin + ((_local3 * 0.01) * _arg2))) - 1);
gotoAndStop(ani[_arg1].curr);
ani[_arg1].percent = _arg2;
}
public function Update(_arg1:String, _arg2:Number):void{
var _local3:Number;
if (ani[_arg1] == undefined){
Log.Error((((this.name + " error: Animation '") + _arg1) + "' not found."));
return;
};
ani[_arg1].timer = (ani[_arg1].timer + _arg2);
_local3 = 0;
while (ani[_arg1].timer >= ani[_arg1].fps) {
ani[_arg1].timer = (ani[_arg1].timer - ani[_arg1].fps);
ani[_arg1].curr = (ani[_arg1].curr + ani[_arg1].step);
ani[_arg1].percent = -1;
if (ani[_arg1].type == 0){
if (ani[_arg1].curr > ani[_arg1].end){
if (ani[_arg1].is_loop){
ani[_arg1].curr = ani[_arg1].begin;
} else {
ani[_arg1].curr = ani[_arg1].end;
};
};
} else {
if (ani[_arg1].atype == 1){
if (ani[_arg1].curr < ani[_arg1].begin){
if (ani[_arg1].is_loop){
ani[_arg1].curr = ani[_arg1].end;
} else {
ani[_arg1].curr = ani[_arg1].begin;
};
};
} else {
if ((((ani[_arg1].curr == ani[_arg1].begin)) || ((ani[_arg1].curr == ani[_arg1].end)))){
ani[_arg1].step = -(ani[_arg1].step);
};
};
};
_local3++;
if (_local3 > 10){
ani[_arg1].timer = 0;
return;
};
};
gotoAndStop(ani[_arg1].curr);
}
}
}//package elm.gfx
Section 15
//Float (elm.utils.Float)
package elm.utils {
public class Float {
public static function approach(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
_local4 = (_arg2 - _arg3);
if (_local4 > 0){
if (_local4 < _arg1){
return (_arg3);
};
return ((_arg2 - _arg1));
//unresolved jump
};
if (_local4 < 0){
_local4 = -(_local4);
if (_local4 < _arg1){
return (_arg3);
};
return ((_arg2 + _arg1));
//unresolved jump
};
return (_arg3);
}
}
}//package elm.utils
Section 16
//Vec2 (elm.utils.Vec2)
package elm.utils {
import Box2D.Common.Math.*;
public class Vec2 extends b2Vec2 {
public function Vec2(_arg1:Number=0, _arg2:Number=0){
super(_arg1, _arg2);
}
public function AngleTo(_arg1:b2Vec2):Number{
var _local2:Number;
if ((((x == _arg1.x)) && ((y == _arg1.y)))){
return (NaN);
};
_local2 = ((Math.atan(((_arg1.y - y) / (_arg1.x - x))) * 180) / Math.PI);
if (_arg1.x >= x){
return ((_local2 + 90));
};
return ((_local2 - 90));
}
public function Move(_arg1:Number, _arg2:Number){
var _local3:Number;
_local3 = ((Math.PI / 180) * _arg2);
x = (x + (Math.sin(_local3) * _arg1));
y = (y - (Math.cos(_local3) * _arg1));
}
public function Angle():Number{
var _local1:Vec2;
_local1 = new Vec2();
return (_local1.AngleTo(this));
}
public function DistanceTo(_arg1:b2Vec2):Number{
return (Math.sqrt((((_arg1.x - x) * (_arg1.x - x)) + ((_arg1.y - y) * (_arg1.y - y)))));
}
}
}//package elm.utils
Section 17
//Background (gfx.Background)
package gfx {
import flash.display.*;
public dynamic class Background extends MovieClip {
}
}//package gfx
Section 18
//Character (gfx.Character)
package gfx {
import elm.gfx.*;
public dynamic class Character extends Animation {
}
}//package gfx
Section 19
//Eat0 (gfx.Eat0)
package gfx {
import flash.display.*;
public dynamic class Eat0 extends MovieClip {
public var second:EatSecond;
public var first:EatFirst;
}
}//package gfx
Section 20
//Eat1 (gfx.Eat1)
package gfx {
import flash.display.*;
public dynamic class Eat1 extends MovieClip {
public var arrow:MovieClip;
public var body:EatFirst;
}
}//package gfx
Section 21
//Eat2 (gfx.Eat2)
package gfx {
import flash.display.*;
public dynamic class Eat2 extends MovieClip {
public var center:EatSecond;
public var body:EatFirst;
}
}//package gfx
Section 22
//EatFirst (gfx.EatFirst)
package gfx {
import elm.gfx.*;
public dynamic class EatFirst extends Animation {
}
}//package gfx
Section 23
//EatSecond (gfx.EatSecond)
package gfx {
import elm.gfx.*;
public dynamic class EatSecond extends Animation {
}
}//package gfx
Section 24
//GameLogo (gfx.GameLogo)
package gfx {
import flash.display.*;
public dynamic class GameLogo extends MovieClip {
}
}//package gfx
Section 25
//Hole (gfx.Hole)
package gfx {
import elm.gfx.*;
public dynamic class Hole extends Animation {
}
}//package gfx
Section 26
//Pause (gfx.Pause)
package gfx {
import flash.display.*;
public dynamic class Pause extends MovieClip {
}
}//package gfx
Section 27
//Progress (gfx.Progress)
package gfx {
import flash.display.*;
import flash.text.*;
public dynamic class Progress extends MovieClip {
public var bar:MovieClip;
public var t01:TextField;
public var t02:TextField;
public var t00:TextField;
public var t12:TextField;
public var t10:TextField;
public var t11:TextField;
}
}//package gfx
Section 28
//BtnAbout (gui.BtnAbout)
package gui {
public dynamic class BtnAbout extends SoundButton {
}
}//package gui
Section 29
//BtnControl (gui.BtnControl)
package gui {
public dynamic class BtnControl extends SoundButton {
}
}//package gui
Section 30
//BtnHelp (gui.BtnHelp)
package gui {
public dynamic class BtnHelp extends SoundButton {
}
}//package gui
Section 31
//BtnMenu (gui.BtnMenu)
package gui {
public dynamic class BtnMenu extends SoundButton {
}
}//package gui
Section 32
//BtnPause (gui.BtnPause)
package gui {
public dynamic class BtnPause extends SoundButton {
}
}//package gui
Section 33
//BtnPlay (gui.BtnPlay)
package gui {
public dynamic class BtnPlay extends SoundButton {
}
}//package gui
Section 34
//BtnScore (gui.BtnScore)
package gui {
public dynamic class BtnScore extends SoundButton {
}
}//package gui
Section 35
//BtnSubmit (gui.BtnSubmit)
package gui {
public dynamic class BtnSubmit extends SoundButton {
}
}//package gui
Section 36
//Help (gui.Help)
package gui {
import flash.display.*;
import gfx.*;
public dynamic class Help extends MovieClip {
public var hole:Hole;
}
}//package gui
Section 37
//SoundControl (gui.SoundControl)
package gui {
import flash.display.*;
public dynamic class SoundControl extends MovieClip {
public var btn:BtnControl;
}
}//package gui
Section 38
//aaa_6 (i_want_eat_fla.aaa_6)
package i_want_eat_fla {
import flash.media.*;
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.filters.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
public dynamic class aaa_6 extends MovieClip {
public function aaa_6(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package i_want_eat_fla
Section 39
//export_4 (i_want_eat_fla.export_4)
package i_want_eat_fla {
import flash.media.*;
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.filters.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
public dynamic class export_4 extends MovieClip {
public function export_4(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package i_want_eat_fla
Section 40
//karmateam_prialka_21 (i_want_eat_fla.karmateam_prialka_21)
package i_want_eat_fla {
import flash.display.*;
public dynamic class karmateam_prialka_21 extends MovieClip {
public var roll:MovieClip;
}
}//package i_want_eat_fla
Section 41
//karmateam_print_19 (i_want_eat_fla.karmateam_print_19)
package i_want_eat_fla {
import flash.display.*;
public dynamic class karmateam_print_19 extends MovieClip {
public var prialka:MovieClip;
}
}//package i_want_eat_fla
Section 42
//sfx_25 (i_want_eat_fla.sfx_25)
package i_want_eat_fla {
import flash.media.*;
import flash.geom.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.filters.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
public dynamic class sfx_25 extends MovieClip {
public function sfx_25(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package i_want_eat_fla
Section 43
//MochiScores (mochi.MochiScores)
package mochi {
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 options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
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;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
//unresolved jump
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
//unresolved jump
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
//unresolved jump
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (_slot1.boardID != null){
options.boardID = _slot1.boardID;
};
};
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{
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
_slot1.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi
Section 44
//MochiServices (mochi.MochiServices)
package mochi {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
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 _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
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++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
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);
};
};
};
};
};
}
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_" + getTimer()) + "_") + Math.floor(new Date().getTime()));
_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);
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, _slot1.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 netup:Boolean;
var vars:Object;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var err:Function;
var complete:Function;
var setURL: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();
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
complete = function (_arg1:Object):void{
netup = true;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
setURL = function ():void{
var _local1:String;
var _local2:DisplayObject;
if (netup){
_local1 = (url + s);
} else {
_local1 = burl;
};
_local2 = clickMovie(_local1, onClick);
btn.addChild(_local2);
_local2.scaleX = (0.01 * btn.width);
_local2.scaleY = (0.01 * btn.height);
};
setTimeout(setURL, 1500);
}
public static function getVersion():String{
return ("1.35");
}
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 {
_listenChannel.close();
_rcvChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
return (_local2);
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, _slot1.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
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 onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, _slot1.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_rcvChannel.addEventListener(StatusEvent.STATUS, _slot1.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._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];
//unresolved jump
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
_slot1.onError("IOError");
};
_rcvChannel.connect(_rcvChannelName);
_connecting = false;
_connected = true;
_listenChannel.close();
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
_slot1.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
}
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) {
};
};
};
};
}
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");
_rcvChannelName = _arg1;
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!_slot1.isNetworkAvailable()){
return (null);
};
_slot1.allowDomains(_gatewayURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
_slot1.disconnect();
_slot1.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_gatewayURL);
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain("*", "localhost");
_rcvChannel.allowInsecureDomain("*", "localhost");
_rcvChannel.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (_slot1.clip != null){
if (_slot1.childClip != null){
try {
if (_slot1.clip.numChildren > 1){
_slot1.clip.setChildIndex(_slot1.childClip, (_slot1.clip.numChildren - 1));
};
} catch(errorObject:Error) {
_container.removeEventListener(Event.ENTER_FRAME, _slot1.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
_connecting = true;
init(id, clip);
};
//unresolved jump
};
if (onError != null){
_slot1.onError = onError;
} else {
if (_slot1.onError == null){
_slot1.onError = function (_arg1:String):void{
};
};
};
}
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;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
_slot1.disconnect();
_slot1.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 45
//Character (objects.Character)
package objects {
import elm.core.*;
import elm.utils.*;
import elm.gfx.*;
public class Character {
private var m_move:int;// = -1
private var is_deading:Boolean;// = false
public var pos:Vec2;// = null
public var obj:Animation;// = null
private var is_dead:Boolean;// = false
public var id:int;// = -1
public static const SPEED:Number = 60;
public static const MOVE_UP:int = 2;
public static const MOVE_RIGHT:int = 1;
public static const MOVE_NO:int = -1;
public static const MOVE_DOWN:int = 3;
public static const MOVE:Array = [{sx:-1, a:"right"}, {sx:1, a:"right"}, {sx:1, a:"up"}, {sx:1, a:"down"}];
public static const MOVE_LEFT:int = 0;
private static var number:int = -1;
public function Character(_arg1:Number, _arg2:Number){
id = -1;
is_dead = false;
is_deading = false;
pos = null;
obj = null;
m_move = MOVE_NO;
super();
id = ++number;
pos = new Vec2(_arg1, _arg2);
obj = (Gfx.makeMovie("gfx.Character", ("char" + id), {x:_arg1, y:_arg2}) as Animation);
obj.stop();
obj["aaa"].stop();
obj.Set("right", 10, 1, 3, Animation.FORVARD, true);
obj.Set("down", 10, 4, 6, Animation.FORVARD, true);
obj.Set("up", 10, 7, 9, Animation.FORVARD, true);
SetMove(MOVE_RIGHT);
}
public function IsMove():Boolean{
return (!((m_move == MOVE_NO)));
}
public function Dead(_arg1:Boolean=false):void{
if (_arg1){
is_deading = true;
SetMove(MOVE_DOWN);
obj.scaleY = 1;
obj.SetPercent(MOVE[m_move].a, 100);
obj["aaa"].gotoAndStop(2);
if (!Main.music_mute){
Sfx.play("sfx.Aaa", Main.music_volume);
};
} else {
is_dead = true;
};
}
public function Update(_arg1:Number):void{
if (is_deading){
obj.scaleX = Float.approach((_arg1 * 0.5), obj.scaleX, 0);
obj.scaleY = obj.scaleX;
obj["aaa"].scaleX = (4 - (obj.scaleX * 3));
obj["aaa"].scaleY = obj["aaa"].scaleX;
if (obj.scaleX == 0){
is_dead = true;
};
obj.x = pos.x;
obj.y = pos.y;
return;
};
if (m_move != MOVE_NO){
obj.Update(MOVE[m_move].a, _arg1);
switch (m_move){
case MOVE_LEFT:
pos.x = (pos.x - (GetSpeed() * _arg1));
break;
case MOVE_RIGHT:
pos.x = (pos.x + (GetSpeed() * _arg1));
break;
case MOVE_UP:
pos.y = (pos.y - (GetSpeed() * _arg1));
break;
case MOVE_DOWN:
pos.y = (pos.y + (GetSpeed() * _arg1));
break;
};
if (pos.x < (16 + 36)){
Dead(true);
};
if (pos.x > (Game.Width - (16 + 36))){
Dead(true);
};
if (pos.y < (16 + 36)){
Dead(true);
};
if (pos.y > (Game.Height - (16 + 36))){
Dead(true);
};
obj.x = pos.x;
obj.y = pos.y;
};
}
public function GetSpeed():Number{
return (SPEED);
}
public function IsDead(_arg1:Boolean=false):Boolean{
return (((is_dead) || (((_arg1) && (is_deading)))));
}
public function SetMove(_arg1:int):void{
if (m_move == _arg1){
return;
};
if (_arg1 != MOVE_NO){
obj.scaleX = MOVE[_arg1].sx;
} else {
if (m_move != MOVE_NO){
obj.SetPercent(MOVE[m_move].a, 0);
};
};
m_move = _arg1;
}
}
}//package objects
Section 46
//Eat (objects.Eat)
package objects {
import elm.core.*;
import flash.geom.*;
import flash.display.*;
import elm.gfx.*;
public class Eat {
public var grid_y:int;// = -1
public var obj:MovieClip;// = null
public var is_dead:Boolean;// = false
public var id:int;// = -1
public var grid_x:int;// = -1
private static const COLOR:Array = [[0xFFFF00, 16777011], [65331, 3407718], [13311, 3368703], [0xFF0033, 16724838]];
private static var number:int = -1;
public function Eat(_arg1:Number, _arg2:Number, _arg3:int){
id = -1;
is_dead = false;
grid_x = -1;
grid_y = -1;
obj = null;
super();
id = ++number;
obj = Gfx.makeMovie("gfx.Eat2", ("eat" + id), {x:_arg1, y:_arg2});
obj.stop();
obj["body"].stop();
obj["body"].Set("a", 30, 1, 60, Animation.FORVARD, true);
obj["body"].transform.colorTransform = GetColorTransform(COLOR[_arg3][0]);
obj["center"].stop();
obj["center"].Set("a", 30, 1, 60, Animation.FORVARD, true);
obj["center"].transform.colorTransform = GetColorTransform(COLOR[_arg3][1]);
}
public function Dead(_arg1:Boolean):void{
}
public function Update(_arg1:Number):void{
obj["body"].Update("a", _arg1);
obj["center"].Update("a", _arg1);
}
public static function GetColorTransform(_arg1:int):ColorTransform{
var _local2:ColorTransform;
var _local3:int;
_local2 = new ColorTransform();
_local3 = (0xFFFFFF - _arg1);
_local2.redOffset = -(((_local3 >> 16) & 0xFF));
_local2.greenOffset = -(((_local3 >> 8) & 0xFF));
_local2.blueOffset = -((_local3 & 0xFF));
return (_local2);
}
}
}//package objects
Section 47
//Aaa (sfx.Aaa)
package sfx {
import flash.media.*;
public dynamic class Aaa extends Sound {
}
}//package sfx
Section 48
//Eat0 (sfx.Eat0)
package sfx {
import flash.media.*;
public dynamic class Eat0 extends Sound {
}
}//package sfx
Section 49
//Track0 (sfx.Track0)
package sfx {
import flash.media.*;
public dynamic class Track0 extends Sound {
}
}//package sfx
Section 50
//About (states.About)
package states {
import elm.core.*;
import flash.media.*;
import flash.events.*;
import flash.display.*;
import gfx.*;
import flash.filters.*;
public class About extends State {
private var GUI:Layer;
private var logo_mov:MovieClip;
override public function onMouseClick(_arg1:MouseEvent):void{
}
override public function onKeyDown(_arg1:KeyboardEvent):void{
}
override public function free():void{
Log.Message("About free.");
}
override public function frame():void{
logo_mov["logo"]["prialka"]["roll"].rotation = (logo_mov["logo"]["prialka"]["roll"].rotation + (10 * Game.delta));
}
override public function init():Boolean{
var m:DisplayObject;
GUI = Gfx.createLayer(null, "gui", 100, true);
Gfx.createMovie(GUI, "gfx.Background", "background");
logo_mov = (Gfx.createMovie(GUI, "karmateam_logo", "karmateam_logo", {x:250, y:250}) as MovieClip);
m = Gfx.createMovie(GUI, "gui.BtnMenu", "btn_menu", {x:50, y:460});
m.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
Game.setState("mainmenu");
});
Log.Message("About init.");
return (true);
}
}
}//package states
Section 51
//Gameplay (states.Gameplay)
package states {
import elm.core.*;
import flash.media.*;
import flash.events.*;
import objects.*;
import flash.display.*;
import elm.utils.*;
import elm.gfx.*;
import flash.filters.*;
import flash.ui.*;
public class Gameplay extends State {
private var combo:int;
private var score:int;
private var progress_mov:MovieClip;
private var eat_power:Array;
private var player:Player;
private var eat_count;// = 0
private var rnd_timer:Number;
private var key_stack:Array;
private var MSG:Text;
private var combo_scores:Number;
public static const EAT_POWER_STEP:Number = 1;
private static const EAT_POWER_TIME:Number = 4;
private static const RND_TIME:Number = 0.5;
private static const EAT_MAX:int = 484;
public static var HOLE:Layer;
public static var GUI:Layer;
public static var CHAR:Layer;
public static var BACK:Layer;
private static var m_pause:Boolean = false;
public static var OTHER:Layer;
public static var EAT:Layer;
public function Gameplay(){
eat_count = 0;
super();
}
override public function onMouseUp(_arg1:MouseEvent):void{
}
override public function onKeyDown(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = 0;
while (_local2 < key_stack.length) {
if (key_stack[_local2] == _arg1.keyCode){
key_stack.splice(_local2, 1);
_local2--;
};
_local2++;
};
key_stack.push(_arg1.keyCode);
}
override public function onMouseDown(_arg1:MouseEvent):void{
}
override public function init():Boolean{
var m:DisplayObject;
BACK = Gfx.createLayer(null, "back", 10, true);
HOLE = Gfx.createLayer(null, "hole", 20, true);
EAT = Gfx.createLayer(null, "eat", 30, true);
CHAR = Gfx.createLayer(null, "char", 40, true);
OTHER = Gfx.createLayer(null, "other", 90, true);
GUI = Gfx.createLayer(null, "gui", 100, true);
Gfx.createMovie(BACK, "gfx.Background", "background");
progress_mov = (Gfx.createMovie(GUI, "gfx.Progress", "progress", {x:150, y:((500 - 8) - 36)}) as MovieClip);
progress_mov["t00"].text = "x2";
progress_mov["t10"].text = "x2";
progress_mov["t01"].text = "x3";
progress_mov["t11"].text = "x3";
progress_mov["t02"].text = "x4";
progress_mov["t12"].text = "x4";
Gfx.createText(GUI, "inf", 0, 20, Gfx.Width, 20, {font:"_sans", embed:false, size:14, align:"center", color:0, bold:false}, []);
Gfx.createText(GUI, "score", 0, 8, Gfx.Width, 100, {font:"Courier New", embed:true, size:30, align:"center", color:0xFF9900, bold:false}, [new GlowFilter(0, 1, 5, 5, 4, BitmapFilterQuality.LOW)]);
MSG = Gfx.createText(GUI, "msg", 0, ((Gfx.Height - 40) * 0.5), Gfx.Width, 100, {font:"Courier New", embed:true, size:50, align:"center", color:0xFFFFFF, bold:false}, [new GlowFilter(0xFF9900, 1, 5, 5, 3, BitmapFilterQuality.HIGH)]);
MSG.addEventListener(Event.ENTER_FRAME, function (_arg1:Event){
if (_arg1.currentTarget.alpha > 0){
(_arg1.currentTarget as Text).alpha = ((_arg1.currentTarget as Text).alpha - (Game.delta * 0.5));
};
});
m = Gfx.createMovie(GUI, "gui.BtnMenu", "btn_menu", {x:50, y:460});
m.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
Game.setState("mainmenu");
});
m = Gfx.createMovie(GUI, "gui.BtnPause", "btn_pause", {x:450, y:460});
m.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
_slot1.Pause = !(_slot1.Pause);
});
Gen();
key_stack = [];
Log.Message("Gameplay init.");
return (true);
}
override public function onMouseClick(_arg1:MouseEvent):void{
}
public function ShowMessage(_arg1:String, _arg2:Number=2):void{
MSG.text = _arg1;
MSG.alpha = _arg2;
Log.Message(_arg1);
}
override public function free():void{
Log.Message("Gameplay free.");
}
override public function frame():void{
var _local1:Number;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Number;
if (m_pause){
return;
};
_local1 = Game.delta;
_local2 = -1;
if (key_stack.length > 0){
_local2 = key_stack[(key_stack.length - 1)];
};
if (_local2 == Keyboard.LEFT){
player.SetMove(Character.MOVE_LEFT);
} else {
if (_local2 == Keyboard.RIGHT){
player.SetMove(Character.MOVE_RIGHT);
} else {
if (_local2 == Keyboard.UP){
player.SetMove(Character.MOVE_UP);
} else {
if (_local2 == Keyboard.DOWN){
player.SetMove(Character.MOVE_DOWN);
};
};
};
};
player.Update(_local1);
if (player.IsDead()){
Game.setVar("score", score);
Game.setState("scores");
};
Gfx.setText(GUI, "score", ("" + score));
progress_mov.gotoAndStop(Math.floor(((combo_scores - 1) * 100)));
combo_scores = (combo_scores - (_local1 * 0.05));
if (combo_scores < 1){
combo_scores = 1;
};
_local3 = -1;
_local4 = -1;
if (rnd_timer > 0){
rnd_timer = (rnd_timer - _local1);
if (rnd_timer <= 0){
rnd_timer = RND_TIME;
_local3 = Math.floor((Math.random() * 11));
_local4 = Math.floor((Math.random() * 11));
};
};
_local5 = 0;
while (_local5 < 11) {
_local6 = 0;
while (_local6 < 11) {
if (eat_power[_local5][_local6].eat != null){
eat_power[_local5][_local6].eat.Update(_local1);
if (player.obj["hit"].hitTestObject(eat_power[_local5][_local6].eat.obj)){
if (!Main.music_mute){
Sfx.play("sfx.Eat0", Main.music_volume);
};
eat_count++;
player.power = (player.power + eat_power[_local5][_local6].power);
_local7 = (eat_power[_local5][_local6].power + 1);
if (Math.floor(eat_power[_local5][_local6].power) == (combo + 1)){
combo++;
if (combo == 1){
_local7 = (_local7 + 1);
combo_scores = (combo_scores + 0.2);
ShowMessage("double", 1);
} else {
if (combo == 2){
_local7 = (_local7 + 2);
combo_scores = (combo_scores + 0.4);
ShowMessage("trident", 1);
} else {
if (combo == 3){
combo = -1;
_local7 = (_local7 + 3);
combo_scores = (combo_scores + 0.6);
ShowMessage("pallet!", 1);
};
};
};
} else {
if (combo != 0){
if (Math.floor(eat_power[_local5][_local6].power) == 0){
combo = 0;
} else {
combo = -1;
};
};
};
if (combo_scores > 5){
combo_scores = 5;
};
score = (score + (_local7 * combo_scores));
Gfx.removeMovieByName(EAT, eat_power[_local5][_local6].eat.obj.name);
eat_power[_local5][_local6].eat.Dead(true);
eat_power[_local5][_local6].eat = null;
eat_power[_local5][_local6].power = (eat_power[_local5][_local6].power + EAT_POWER_STEP);
if (eat_power[_local5][_local6].power > 3){
Log.Message(((((("[" + _local5) + ":") + _local6) + "].p=") + eat_power[_local5][_local6].power));
};
eat_power[_local5][_local6].timer = (EAT_POWER_TIME + (eat_power[_local5][_local6].power * EAT_POWER_TIME));
};
} else {
if (eat_power[_local5][_local6].hole != null){
eat_power[_local5][_local6].hole.Update("a", _local1);
if (!player.IsDead(true)){
if (eat_power[_local5][_local6].hole.hitTestPoint(player.pos.x, player.pos.y, true)){
player.pos.x = eat_power[_local5][_local6].hole.x;
player.pos.y = eat_power[_local5][_local6].hole.y;
player.Dead(true);
};
};
} else {
if (eat_power[_local5][_local6].timer > 0){
if (eat_power[_local5][_local6].power <= 4){
eat_power[_local5][_local6].timer = (eat_power[_local5][_local6].timer - _local1);
if (eat_power[_local5][_local6].timer <= 0){
if (eat_power[_local5][_local6].power <= 3){
eat_power[_local5][_local6].eat = new Eat((((16 + 18) + 36) + (36 * _local5)), (((16 + 18) + 36) + (36 * _local6)), eat_power[_local5][_local6].power);
Gfx.addMovie(EAT, eat_power[_local5][_local6].eat.obj);
} else {
eat_power[_local5][_local6].hole = (Gfx.makeMovie("gfx.Hole", ((("hole_" + _local5) + "x") + _local6), {x:(((16 + 18) + 36) + (36 * _local5)), y:(((16 + 18) + 36) + (36 * _local6))}) as Animation);
eat_power[_local5][_local6].hole.stop();
eat_power[_local5][_local6].hole.Set("a", 5, 1, 60, Animation.PINPONG, true);
Gfx.addMovie(HOLE, eat_power[_local5][_local6].hole);
};
};
};
} else {
if ((((_local3 == _local5)) && ((_local4 == _local6)))){
eat_power[_local5][_local6].timer = EAT_POWER_TIME;
};
};
};
};
_local6++;
};
_local5++;
};
if (eat_count >= EAT_MAX){
Game.setState("scores");
};
}
override public function onKeyUp(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = 0;
while (_local2 < key_stack.length) {
if (key_stack[_local2] == _arg1.keyCode){
key_stack.splice(_local2, 1);
_local2--;
};
_local2++;
};
}
public function Gen():void{
var _local1:int;
var _local2:int;
score = 0;
combo = -1;
combo_scores = 1;
player = new Player(250, 250);
Gfx.addMovie(CHAR, player.obj, null);
eat_power = [];
_local1 = 0;
while (_local1 < 11) {
eat_power[_local1] = [];
_local2 = 0;
while (_local2 < 11) {
eat_power[_local1][_local2] = {power:0, timer:0, eat:new Eat((((16 + 18) + 36) + (36 * _local1)), (((16 + 18) + 36) + (36 * _local2)), 0), hole:null};
Gfx.addMovie(EAT, eat_power[_local1][_local2].eat.obj);
_local2++;
};
_local1++;
};
rnd_timer = RND_TIME;
ShowMessage("go!");
}
public static function get Pause():Boolean{
return (m_pause);
}
public static function set Pause(_arg1:Boolean):void{
m_pause = _arg1;
if (m_pause){
Gfx.createMovie(OTHER, "gfx.Pause", "pause");
} else {
Gfx.removeMovieByName(OTHER, "pause");
};
}
}
}//package states
Section 52
//Help (states.Help)
package states {
import elm.core.*;
import flash.media.*;
import flash.events.*;
import flash.display.*;
import elm.gfx.*;
import gfx.*;
import flash.filters.*;
public class Help extends State {
private var GUI:Layer;
private var char_mov:Animation;
override public function onMouseClick(_arg1:MouseEvent):void{
}
override public function onKeyDown(_arg1:KeyboardEvent):void{
}
override public function free():void{
Log.Message("Help free.");
}
override public function frame():void{
char_mov.Update("a", Game.delta);
}
override public function init():Boolean{
var m:DisplayObject;
GUI = Gfx.createLayer(null, "gui", 100, true);
Gfx.createMovie(GUI, "gfx.Background", "background");
m = Gfx.createMovie(GUI, "gui.Help", "help");
m["hole"].stop();
char_mov = (Gfx.createMovie(GUI, "gfx.Character", "char", {x:250, y:400}) as Animation);
char_mov.stop();
char_mov["aaa"].stop();
char_mov.Set("a", 10, 1, 3, 0, true);
m = Gfx.createMovie(GUI, "gui.BtnMenu", "btn_menu", {x:50, y:460});
m.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
Game.setState("mainmenu");
});
Log.Message("Help init.");
return (true);
}
}
}//package states
Section 53
//Mainmenu (states.Mainmenu)
package states {
import elm.core.*;
import flash.media.*;
import flash.events.*;
import flash.display.*;
import elm.gfx.*;
import gfx.*;
import flash.filters.*;
public class Mainmenu extends State {
private var GUI:Layer;
private var char_mov:Animation;
public function Mainmenu(){
var m:MovieClip;
super();
m = (Gfx.createMovie(Game.SYS, "gui.SoundControl", "sound_control", {x:474, y:2}) as MovieClip);
m.stop();
(m["btn"] as SimpleButton).addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
var _local2:SoundTransform;
Main.music_mute = !(Main.music_mute);
_local2 = Main.music_channel.soundTransform;
if (Main.music_mute){
_arg1.currentTarget.parent.gotoAndStop(2);
Main.music_volume = 0;
if (Main.music_channel){
_local2.volume = Main.music_volume;
};
} else {
_arg1.currentTarget.parent.gotoAndStop(1);
Main.music_volume = Main.MUSIC_VOLUME;
if (Main.music_channel){
_local2.volume = Main.music_volume;
};
};
Main.music_channel.soundTransform = _local2;
});
}
override public function onMouseClick(_arg1:MouseEvent):void{
}
override public function onKeyDown(_arg1:KeyboardEvent):void{
}
override public function free():void{
Log.Message("Mainmenu free.");
}
override public function frame():void{
char_mov.Update("a", Game.delta);
}
override public function init():Boolean{
var m:DisplayObject;
GUI = Gfx.createLayer(null, "gui", 100, true);
Gfx.createMovie(GUI, "gfx.Background", "background");
m = Gfx.createMovie(GUI, "gfx.GameLogo", "game_logo", {x:52, y:70, scaleX:1, scaleY:1});
char_mov = (Gfx.createMovie(GUI, "gfx.Character", "char", {x:((500 - 16) - 36), y:((500 - 16) - 36), scaleX:-1}) as Animation);
char_mov.stop();
char_mov["aaa"].stop();
char_mov.Set("a", 5, 1, 3, 0, true);
m = Gfx.createMovie(GUI, "gui.BtnPlay", "btn_play", {x:250, y:200});
m.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
Game.setState("gameplay");
});
m = Gfx.createMovie(GUI, "gui.BtnHelp", "btn_help", {x:250, y:250});
m.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
Game.setState("help");
});
m = Gfx.createMovie(GUI, "gui.BtnScore", "btn_score", {x:250, y:300});
m.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
(Game.clip.parent as PreloaderClass).ShowLeaderboard();
});
m = Gfx.createMovie(GUI, "gui.BtnAbout", "btn_about", {x:250, y:350});
m.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
Game.setState("about");
});
Log.Message("Mainmenu init.");
return (true);
}
}
}//package states
Section 54
//Scores (states.Scores)
package states {
import elm.core.*;
import flash.media.*;
import flash.events.*;
import flash.display.*;
import gfx.*;
import flash.filters.*;
public class Scores extends State {
private var GUI:Layer;
override public function onMouseClick(_arg1:MouseEvent):void{
}
override public function onKeyDown(_arg1:KeyboardEvent):void{
}
override public function free():void{
Log.Message("Scores free.");
}
override public function frame():void{
}
override public function init():Boolean{
var m:DisplayObject;
GUI = Gfx.createLayer(null, "gui", 100, true);
Gfx.createMovie(GUI, "gfx.Background", "background");
Gfx.createText(GUI, "msg", 0, ((Gfx.Height - 40) * 0.5), Gfx.Width, 100, {font:"Courier New", embed:true, size:50, align:"center", color:0xFFFFFF, bold:false}, [new GlowFilter(0xFF9900, 1, 5, 5, 3, BitmapFilterQuality.HIGH)]);
Gfx.setText(GUI, "msg", ("" + Game.getVar("score")));
m = Gfx.createMovie(GUI, "gui.BtnMenu", "btn_menu", {x:50, y:460});
m.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
Game.setState("mainmenu");
});
m = Gfx.createMovie(GUI, "gui.BtnSubmit", "btn_submit", {x:420, y:460});
m.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
(Game.clip.parent as PreloaderMochi).ShowLeaderboard(Game.getVar("score"));
});
Log.Message("Scores init.");
return (true);
}
}
}//package states
Section 55
//karmateam_logo (karmateam_logo)
package {
import flash.display.*;
public dynamic class karmateam_logo extends MovieClip {
public var logo:MovieClip;
}
}//package
Section 56
//Main (Main)
package {
import elm.core.*;
import flash.media.*;
import flash.events.*;
import flash.display.*;
import states.*;
public class Main extends RootLayer {
public static const MUSIC_MAX:int = 1;
public static const MUSIC_VOLUME:Number = 1;
public static var music_channel:SoundChannel = null;
public static var music_mute:Boolean = false;
public static var music_volume:Number = 1;
public static var emitterDefs:Object;
override public function init():void{
var _local1:*;
super.init();
Game.Debug = false;
Game.addState("mainmenu", new Mainmenu());
Game.addState("gameplay", new Gameplay());
Game.addState("help", new Help());
Game.addState("about", new About());
Game.addState("scores", new Scores());
Game.setState("mainmenu");
emitterDefs = {};
_local1 = 0;
Game.setVar("track", _local1);
music_channel = Sfx.play(("sfx.Track" + _local1), (music_volume * 0.5), 0, onSoundComplete);
Log.Message((("Play 'track" + _local1) + "'."));
}
public function onSoundComplete(_arg1:Event){
var _local2:int;
var _local3:int;
music_channel.removeEventListener(Event.SOUND_COMPLETE, onSoundComplete);
_local2 = Math.floor((Math.random() * MUSIC_MAX));
_local3 = Game.getVar("track");
while ((((MUSIC_MAX > 1)) && (!((_local2 == _local3))))) {
_local2 = Math.floor((Math.random() * MUSIC_MAX));
};
Game.setVar("track", _local2);
music_channel = Sfx.play(("sfx.Track" + _local2), (music_volume * 0.5), 0, onSoundComplete);
Log.Message((("Play 'track" + _local2) + "'."));
}
}
}//package
Section 57
//MainExport (MainExport)
package {
public dynamic class MainExport extends Main {
}
}//package
Section 58
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.5");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}};
options = _slot1._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!_slot1.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
_slot1._cleanup(mc);
options.ad_finished();
};
wh = _slot1._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
_slot1.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
_slot1.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}};
options = _slot1._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!_slot1.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
_slot1._cleanup(mc);
options.ad_finished();
};
wh = _slot1._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
_slot1.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
_slot1.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
_slot1.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
_slot1.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _slot1._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = _slot1.getVersion();
clip = options.clip;
if (!_slot1._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = _slot1._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
_slot1.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = _local3.width;
_local5 = _local3.height;
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
_slot1.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = _slot1.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = _slot1.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = _slot1._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
setTimeout(options.ad_finished, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!_slot1.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
_slot1._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = _slot1._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
_slot1.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
_slot1.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
_slot1.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
_slot1.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
_slot1.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
_slot1.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
_slot1.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 59
//Player (Player)
package {
import objects.*;
public class Player extends Character {
public var power:Number;// = 0
private var m_bonuses:Array;
public static const BONUS:Array = [5];
public static const BONUS_SPEED:int = 0;
public function Player(_arg1:Number, _arg2:Number){
power = 0;
super(_arg1, _arg2);
m_bonuses = [];
}
override public function Dead(_arg1:Boolean=false):void{
m_bonuses = null;
super.Dead(_arg1);
}
override public function Update(_arg1:Number):void{
var _local2:int;
super.Update(_arg1);
if (IsDead(true)){
return;
};
_local2 = 0;
while (_local2 < m_bonuses.length) {
m_bonuses[_local2].timer = (m_bonuses[_local2].timer - _arg1);
if (m_bonuses[_local2].timer <= 0){
m_bonuses.splice(_local2, 1);
};
_local2++;
};
}
private function GetBonusIndex(_arg1:int):int{
var _local2:int;
_local2 = 0;
while (_local2 < m_bonuses.length) {
if (m_bonuses[_local2].type == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
override public function GetSpeed():Number{
var _local1:Number;
_local1 = (Character.SPEED + ((Character.SPEED * power) * 0.004));
if (IsBonus(BONUS_SPEED)){
_local1 = (_local1 * 2);
};
return (_local1);
}
public function IsBonus(_arg1:int):Boolean{
return ((GetBonusIndex(_arg1) >= 0));
}
public function AddBonus(_arg1:int):void{
var _local2:int;
_local2 = GetBonusIndex(_arg1);
if (_local2 < 0){
m_bonuses.push({type:_arg1, timer:BONUS[_arg1]});
} else {
m_bonuses[_local2].timer = BONUS[_arg1];
};
}
}
}//package
Section 60
//PreloaderClass (PreloaderClass)
package {
import elm.core.*;
import flash.display.*;
import flash.events.*;
import flash.text.*;
import gfx.*;
public dynamic class PreloaderClass extends PreloaderMochi {
public var persent_text:TextField;
public var bar:Progress;
public function PreloaderClass(){
addFrameScript(2, frame3);
(this["bar"] as MovieClip).gotoAndStop(0);
(this["persent_text"] as TextField).text = "";
}
override public function onProgress(_arg1:Number):void{
(this["persent_text"] as TextField).text = (Math.round(_arg1) + "%");
(this["bar"] as MovieClip).gotoAndStop(Math.round((_arg1 * 4)));
}
function frame3(){
stop();
}
override public function GetDocumentClass():String{
return ("Main");
}
override public function GetMochiObject():Object{
return ({id:"34cfe6c739d80e6f", res:"500x500", background:0xFFFFFF, color:65331, outline:0, no_bg:true});
}
override public function GetMochiLeaderBoardId():String{
return ("8483c0f10bafe925");
}
}
}//package
Section 61
//SoundButton (SoundButton)
package {
import elm.core.*;
import flash.events.*;
import flash.display.*;
public class SoundButton extends SimpleButton {
public function SoundButton(){
this.addEventListener(MouseEvent.ROLL_OVER, this.onSoundRollOver);
}
public function onSoundRollOver(_arg1:MouseEvent):void{
if (!Main.music_mute){
Sfx.play("sfx.Eat0", Main.music_volume, 0);
};
}
}
}//package