Section 1
//AuxFunctions (caurina.transitions.AuxFunctions)
package caurina.transitions {
public class AuxFunctions {
public static function getObjectLength(_arg1:Object):uint{
var _local3:String;
var _local2:uint;
for (_local3 in _arg1) {
_local2++;
};
return (_local2);
}
public static function numberToG(_arg1:Number):Number{
return (((_arg1 & 0xFF00) >> 8));
}
public static function numberToB(_arg1:Number):Number{
return ((_arg1 & 0xFF));
}
public static function numberToR(_arg1:Number):Number{
return (((_arg1 & 0xFF0000) >> 16));
}
public static function concatObjects(... _args):Object{
var _local3:Object;
var _local5:String;
var _local2:Object = {};
var _local4:int;
while (_local4 < _args.length) {
_local3 = _args[_local4];
for (_local5 in _local3) {
if (_local3[_local5] == null){
delete _local2[_local5];
} else {
_local2[_local5] = _local3[_local5];
};
};
_local4++;
};
return (_local2);
}
}
}//package caurina.transitions
Section 2
//Equations (caurina.transitions.Equations)
package caurina.transitions {
public class Equations {
public function Equations(){
trace("Equations is a static class and should not be instantiated.");
}
public static function easeOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
if (_arg1 < (1 / 2.75)){
return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2));
};
if (_arg1 < (2 / 2.75)){
_arg1 = (_arg1 - (1.5 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2));
};
if (_arg1 < (2.5 / 2.75)){
_arg1 = (_arg1 - (2.25 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2));
};
_arg1 = (_arg1 - (2.625 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2));
}
public static function easeInOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * (0.3 * 1.5)) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
};
--_arg1;
return ((((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) * 0.5) + _arg3) + _arg2));
}
public static function easeInOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
public static function easeInOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (((easeInBounce((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOutBounce(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
public static function easeInOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_local6 + 1) * _arg1) - _local6))) + _arg2));
};
_arg1 = (_arg1 - 2);
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 2)) + _arg2));
}
public static function easeOutInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCubic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCubic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 1)) + _arg2));
}
public static function easeInOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2));
}
public static function easeInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * (((_local6 + 1) * _arg1) - _local6)) + _arg2));
}
public static function easeInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeOutInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuint((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuint(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBounce((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBounce(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function init():void{
Tweener.registerTransition("easenone", easeNone);
Tweener.registerTransition("linear", easeNone);
Tweener.registerTransition("easeinquad", easeInQuad);
Tweener.registerTransition("easeoutquad", easeOutQuad);
Tweener.registerTransition("easeinoutquad", easeInOutQuad);
Tweener.registerTransition("easeoutinquad", easeOutInQuad);
Tweener.registerTransition("easeincubic", easeInCubic);
Tweener.registerTransition("easeoutcubic", easeOutCubic);
Tweener.registerTransition("easeinoutcubic", easeInOutCubic);
Tweener.registerTransition("easeoutincubic", easeOutInCubic);
Tweener.registerTransition("easeinquart", easeInQuart);
Tweener.registerTransition("easeoutquart", easeOutQuart);
Tweener.registerTransition("easeinoutquart", easeInOutQuart);
Tweener.registerTransition("easeoutinquart", easeOutInQuart);
Tweener.registerTransition("easeinquint", easeInQuint);
Tweener.registerTransition("easeoutquint", easeOutQuint);
Tweener.registerTransition("easeinoutquint", easeInOutQuint);
Tweener.registerTransition("easeoutinquint", easeOutInQuint);
Tweener.registerTransition("easeinsine", easeInSine);
Tweener.registerTransition("easeoutsine", easeOutSine);
Tweener.registerTransition("easeinoutsine", easeInOutSine);
Tweener.registerTransition("easeoutinsine", easeOutInSine);
Tweener.registerTransition("easeincirc", easeInCirc);
Tweener.registerTransition("easeoutcirc", easeOutCirc);
Tweener.registerTransition("easeinoutcirc", easeInOutCirc);
Tweener.registerTransition("easeoutincirc", easeOutInCirc);
Tweener.registerTransition("easeinexpo", easeInExpo);
Tweener.registerTransition("easeoutexpo", easeOutExpo);
Tweener.registerTransition("easeinoutexpo", easeInOutExpo);
Tweener.registerTransition("easeoutinexpo", easeOutInExpo);
Tweener.registerTransition("easeinelastic", easeInElastic);
Tweener.registerTransition("easeoutelastic", easeOutElastic);
Tweener.registerTransition("easeinoutelastic", easeInOutElastic);
Tweener.registerTransition("easeoutinelastic", easeOutInElastic);
Tweener.registerTransition("easeinback", easeInBack);
Tweener.registerTransition("easeoutback", easeOutBack);
Tweener.registerTransition("easeinoutback", easeInOutBack);
Tweener.registerTransition("easeoutinback", easeOutInBack);
Tweener.registerTransition("easeinbounce", easeInBounce);
Tweener.registerTransition("easeoutbounce", easeOutBounce);
Tweener.registerTransition("easeinoutbounce", easeInOutBounce);
Tweener.registerTransition("easeoutinbounce", easeOutInBounce);
}
public static function easeOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==_arg4) ? (_arg2 + _arg3) : (((_arg3 * 1.001) * (-(Math.pow(2, ((-10 * _arg1) / _arg4))) + 1)) + _arg2));
}
public static function easeOutInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBack((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBack(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==0) ? _arg2 : (((_arg3 * Math.pow(2, (10 * ((_arg1 / _arg4) - 1)))) + _arg2) - (_arg3 * 0.001)));
}
public static function easeInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2));
}
public static function easeInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 - easeOutBounce((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeOutInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutExpo((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInExpo(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((-(_arg3) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2));
}
public static function easeInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeInOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 2)) + _arg2));
}
public static function easeOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeOutInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutElastic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInElastic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
--_arg1;
return ((-(((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
}
public static function easeOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuad((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuad(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeInOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
}
public static function easeOutInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutSine((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInSine(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 == 0){
return (_arg2);
};
if (_arg1 == _arg4){
return ((_arg2 + _arg3));
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * Math.pow(2, (10 * (_arg1 - 1)))) + _arg2) - (_arg3 * 0.0005)));
};
--_arg1;
return (((((_arg3 / 2) * 1.0005) * (-(Math.pow(2, (-10 * _arg1))) + 2)) + _arg2));
}
public static function easeOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
return (((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) + _arg3) + _arg2));
}
public static function easeOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
}
public static function easeOutInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuart((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuart(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCirc((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCirc(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
}
}//package caurina.transitions
Section 3
//PropertyInfoObj (caurina.transitions.PropertyInfoObj)
package caurina.transitions {
public class PropertyInfoObj {
public var modifierParameters:Array;
public var isSpecialProperty:Boolean;
public var valueComplete:Number;
public var modifierFunction:Function;
public var extra:Object;
public var valueStart:Number;
public var hasModifier:Boolean;
public var arrayIndex:Number;
public var originalValueComplete:Object;
public function PropertyInfoObj(_arg1:Number, _arg2:Number, _arg3:Object, _arg4:Number, _arg5:Object, _arg6:Boolean, _arg7:Function, _arg8:Array){
valueStart = _arg1;
valueComplete = _arg2;
originalValueComplete = _arg3;
arrayIndex = _arg4;
extra = _arg5;
isSpecialProperty = _arg6;
hasModifier = Boolean(_arg7);
modifierFunction = _arg7;
modifierParameters = _arg8;
}
public function toString():String{
var _local1 = "\n[PropertyInfoObj ";
_local1 = (_local1 + ("valueStart:" + String(valueStart)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("valueComplete:" + String(valueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("originalValueComplete:" + String(originalValueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("arrayIndex:" + String(arrayIndex)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("extra:" + String(extra)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("isSpecialProperty:" + String(isSpecialProperty)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("hasModifier:" + String(hasModifier)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierFunction:" + String(modifierFunction)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierParameters:" + String(modifierParameters)));
_local1 = (_local1 + "]\n");
return (_local1);
}
public function clone():PropertyInfoObj{
var _local1:PropertyInfoObj = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters);
return (_local1);
}
}
}//package caurina.transitions
Section 4
//SpecialProperty (caurina.transitions.SpecialProperty)
package caurina.transitions {
public class SpecialProperty {
public var parameters:Array;
public var getValue:Function;
public var preProcess:Function;
public var setValue:Function;
public function SpecialProperty(_arg1:Function, _arg2:Function, _arg3:Array=null, _arg4:Function=null){
getValue = _arg1;
setValue = _arg2;
parameters = _arg3;
preProcess = _arg4;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialProperty ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("setValue:" + String(setValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("preProcess:" + String(preProcess)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 5
//SpecialPropertyModifier (caurina.transitions.SpecialPropertyModifier)
package caurina.transitions {
public class SpecialPropertyModifier {
public var getValue:Function;
public var modifyValues:Function;
public function SpecialPropertyModifier(_arg1:Function, _arg2:Function){
modifyValues = _arg1;
getValue = _arg2;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialPropertyModifier ");
_local1 = (_local1 + ("modifyValues:" + String(modifyValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 6
//SpecialPropertySplitter (caurina.transitions.SpecialPropertySplitter)
package caurina.transitions {
public class SpecialPropertySplitter {
public var parameters:Array;
public var splitValues:Function;
public function SpecialPropertySplitter(_arg1:Function, _arg2:Array){
splitValues = _arg1;
parameters = _arg2;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialPropertySplitter ");
_local1 = (_local1 + ("splitValues:" + String(splitValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 7
//Tweener (caurina.transitions.Tweener)
package caurina.transitions {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Tweener {
private static var _timeScale:Number = 1;
private static var _currentTimeFrame:Number;
private static var _specialPropertySplitterList:Object;
private static var _engineExists:Boolean = false;
private static var _specialPropertyModifierList:Object;
private static var _currentTime:Number;
private static var _tweenList:Array;
private static var _specialPropertyList:Object;
private static var _transitionList:Object;
private static var _inited:Boolean = false;
private static var __tweener_controller__:MovieClip;
public function Tweener(){
trace("Tweener is a static class and should not be instantiated.");
}
public static function registerSpecialPropertyModifier(_arg1:String, _arg2:Function, _arg3:Function):void{
if (!_inited){
init();
};
var _local4:SpecialPropertyModifier = new SpecialPropertyModifier(_arg2, _arg3);
_specialPropertyModifierList[_arg1] = _local4;
}
public static function registerSpecialProperty(_arg1:String, _arg2:Function, _arg3:Function, _arg4:Array=null, _arg5:Function=null):void{
if (!_inited){
init();
};
var _local6:SpecialProperty = new SpecialProperty(_arg2, _arg3, _arg4, _arg5);
_specialPropertyList[_arg1] = _local6;
}
public static function init(... _args):void{
_inited = true;
_transitionList = new Object();
Equations.init();
_specialPropertyList = new Object();
_specialPropertyModifierList = new Object();
_specialPropertySplitterList = new Object();
}
private static function updateTweens():Boolean{
var _local1:int;
if (_tweenList.length == 0){
return (false);
};
_local1 = 0;
while (_local1 < _tweenList.length) {
if ((((_tweenList[_local1] == undefined)) || (!(_tweenList[_local1].isPaused)))){
if (!updateTweenByIndex(_local1)){
removeTweenByIndex(_local1);
};
if (_tweenList[_local1] == null){
removeTweenByIndex(_local1, true);
_local1--;
};
};
_local1++;
};
return (true);
}
public static function addCaller(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Array;
var _local8:Function;
var _local9:TweenListObj;
var _local10:Number;
var _local11:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local4 = _arg1.concat();
} else {
_local4 = [_arg1];
};
var _local5:Object = _arg2;
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var _local6:Number = (isNaN(_local5.time)) ? 0 : _local5.time;
var _local7:Number = (isNaN(_local5.delay)) ? 0 : _local5.delay;
if (typeof(_local5.transition) == "string"){
_local11 = _local5.transition.toLowerCase();
_local8 = _transitionList[_local11];
} else {
_local8 = _local5.transition;
};
if (!Boolean(_local8)){
_local8 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local4.length) {
if (_local5.useFrames == true){
_local9 = new TweenListObj(_local4[_local3], (_currentTimeFrame + (_local7 / _timeScale)), (_currentTimeFrame + ((_local7 + _local6) / _timeScale)), true, _local8, _local5.transitionParams);
} else {
_local9 = new TweenListObj(_local4[_local3], (_currentTime + ((_local7 * 1000) / _timeScale)), (_currentTime + (((_local7 * 1000) + (_local6 * 1000)) / _timeScale)), false, _local8, _local5.transitionParams);
};
_local9.properties = null;
_local9.onStart = _local5.onStart;
_local9.onUpdate = _local5.onUpdate;
_local9.onComplete = _local5.onComplete;
_local9.onOverwrite = _local5.onOverwrite;
_local9.onStartParams = _local5.onStartParams;
_local9.onUpdateParams = _local5.onUpdateParams;
_local9.onCompleteParams = _local5.onCompleteParams;
_local9.onOverwriteParams = _local5.onOverwriteParams;
_local9.onStartScope = _local5.onStartScope;
_local9.onUpdateScope = _local5.onUpdateScope;
_local9.onCompleteScope = _local5.onCompleteScope;
_local9.onOverwriteScope = _local5.onOverwriteScope;
_local9.onErrorScope = _local5.onErrorScope;
_local9.isCaller = true;
_local9.count = _local5.count;
_local9.waitFrames = _local5.waitFrames;
_tweenList.push(_local9);
if ((((_local6 == 0)) && ((_local7 == 0)))){
_local10 = (_tweenList.length - 1);
updateTweenByIndex(_local10);
removeTweenByIndex(_local10);
};
_local3++;
};
return (true);
}
public static function pauseAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
pauseTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function removeTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local5:SpecialPropertySplitter;
var _local6:Array;
var _local7:uint;
var _local3:Array = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && ((_local3.indexOf(_args[_local4]) == -1)))){
if (_specialPropertySplitterList[_args[_local4]]){
_local5 = _specialPropertySplitterList[_args[_local4]];
_local6 = _local5.splitValues(_arg1, null);
_local7 = 0;
while (_local7 < _local6.length) {
_local3.push(_local6[_local7].name);
_local7++;
};
} else {
_local3.push(_args[_local4]);
};
};
_local4++;
};
return (affectTweens(removeTweenByIndex, _arg1, _local3));
}
public static function splitTweens(_arg1:Number, _arg2:Array):uint{
var _local5:uint;
var _local6:String;
var _local7:Boolean;
var _local3:TweenListObj = _tweenList[_arg1];
var _local4:TweenListObj = _local3.clone(false);
_local5 = 0;
while (_local5 < _arg2.length) {
_local6 = _arg2[_local5];
if (Boolean(_local3.properties[_local6])){
_local3.properties[_local6] = undefined;
delete _local3.properties[_local6];
};
_local5++;
};
for (_local6 in _local4.properties) {
_local7 = false;
_local5 = 0;
while (_local5 < _arg2.length) {
if (_arg2[_local5] == _local6){
_local7 = true;
break;
};
_local5++;
};
if (!_local7){
_local4.properties[_local6] = undefined;
delete _local4.properties[_local6];
};
};
_tweenList.push(_local4);
return ((_tweenList.length - 1));
}
public static function updateFrame():void{
_currentTimeFrame++;
}
public static function resumeTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj = _tweenList[_arg1];
if ((((_local2 == null)) || (!(_local2.isPaused)))){
return (false);
};
var _local3:Number = getCurrentTweeningTime(_local2);
_local2.timeStart = (_local2.timeStart + (_local3 - _local2.timePaused));
_local2.timeComplete = (_local2.timeComplete + (_local3 - _local2.timePaused));
_local2.timePaused = undefined;
_local2.isPaused = false;
return (true);
}
public static function getVersion():String{
return ("AS3 1.31.74");
}
public static function onEnterFrame(_arg1:Event):void{
updateTime();
updateFrame();
var _local2:Boolean;
_local2 = updateTweens();
if (!_local2){
stopEngine();
};
}
public static function updateTime():void{
_currentTime = getTimer();
}
private static function updateTweenByIndex(_arg1:Number):Boolean{
var tTweening:TweenListObj;
var mustUpdate:Boolean;
var nv:Number;
var t:Number;
var b:Number;
var c:Number;
var d:Number;
var pName:String;
var eventScope:Object;
var tScope:Object;
var tProperty:Object;
var pv:Number;
var i = _arg1;
tTweening = _tweenList[i];
if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){
return (false);
};
var isOver:Boolean;
var cTime:Number = getCurrentTweeningTime(tTweening);
if (cTime >= tTweening.timeStart){
tScope = tTweening.scope;
if (tTweening.isCaller){
do {
t = (((tTweening.timeComplete - tTweening.timeStart) / tTweening.count) * (tTweening.timesCalled + 1));
b = tTweening.timeStart;
c = (tTweening.timeComplete - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d);
} while (!(cTime >= nv));
} else {
mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates)));
if (cTime >= tTweening.timeComplete){
isOver = true;
mustUpdate = true;
};
if (!tTweening.hasStarted){
if (Boolean(tTweening.onStart)){
eventScope = (Boolean(tTweening.onStartScope)) ? tTweening.onStartScope : tScope;
try {
tTweening.onStart.apply(eventScope, tTweening.onStartParams);
} catch(e2:Error) {
handleError(tTweening, e2, "onStart");
};
};
for (pName in tTweening.properties) {
if (tTweening.properties[pName].isSpecialProperty){
if (Boolean(_specialPropertyList[pName].preProcess)){
tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra);
};
pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
pv = tScope[pName];
};
tTweening.properties[pName].valueStart = (isNaN(pv)) ? tTweening.properties[pName].valueComplete : pv;
};
mustUpdate = true;
tTweening.hasStarted = true;
};
if (mustUpdate){
for (pName in tTweening.properties) {
tProperty = tTweening.properties[pName];
if (isOver){
nv = tProperty.valueComplete;
} else {
if (tProperty.hasModifier){
t = (cTime - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, 0, 1, d, tTweening.transitionParams);
nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters);
} else {
t = (cTime - tTweening.timeStart);
b = tProperty.valueStart;
c = (tProperty.valueComplete - tProperty.valueStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d, tTweening.transitionParams);
};
};
if (tTweening.rounded){
nv = Math.round(nv);
};
if (tProperty.isSpecialProperty){
_specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
tScope[pName] = nv;
};
};
tTweening.updatesSkipped = 0;
if (Boolean(tTweening.onUpdate)){
eventScope = (Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope;
try {
tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams);
} catch(e3:Error) {
handleError(tTweening, e3, "onUpdate");
};
};
} else {
tTweening.updatesSkipped++;
};
};
if (((isOver) && (Boolean(tTweening.onComplete)))){
eventScope = (Boolean(tTweening.onCompleteScope)) ? tTweening.onCompleteScope : tScope;
try {
tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams);
} catch(e4:Error) {
handleError(tTweening, e4, "onComplete");
};
};
return (!(isOver));
};
return (true);
}
public static function setTimeScale(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (isNaN(_arg1)){
_arg1 = 1;
};
if (_arg1 < 1E-5){
_arg1 = 1E-5;
};
if (_arg1 != _timeScale){
if (_tweenList != null){
_local2 = 0;
while (_local2 < _tweenList.length) {
_local3 = getCurrentTweeningTime(_tweenList[_local2]);
_tweenList[_local2].timeStart = (_local3 - (((_local3 - _tweenList[_local2].timeStart) * _timeScale) / _arg1));
_tweenList[_local2].timeComplete = (_local3 - (((_local3 - _tweenList[_local2].timeComplete) * _timeScale) / _arg1));
if (_tweenList[_local2].timePaused != undefined){
_tweenList[_local2].timePaused = (_local3 - (((_local3 - _tweenList[_local2].timePaused) * _timeScale) / _arg1));
};
_local2++;
};
};
_timeScale = _arg1;
};
}
public static function resumeAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
resumeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
private static function handleError(_arg1:TweenListObj, _arg2:Error, _arg3:String):void{
var eventScope:Object;
var pTweening = _arg1;
var pError = _arg2;
var pCallBackName = _arg3;
if (((Boolean(pTweening.onError)) && ((pTweening.onError is Function)))){
eventScope = (Boolean(pTweening.onErrorScope)) ? pTweening.onErrorScope : pTweening.scope;
try {
pTweening.onError.apply(eventScope, [pTweening.scope, pError]);
} catch(metaError:Error) {
printError(((((String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n ") + pError.getStackTrace()) + "\nonError error: ") + metaError.getStackTrace()));
};
} else {
if (!Boolean(pTweening.onError)){
printError(((((String(pTweening.scope) + " raised an error while executing the '") + pCallBackName) + "'handler. \n") + pError.getStackTrace()));
};
};
}
private static function startEngine():void{
_engineExists = true;
_tweenList = new Array();
__tweener_controller__ = new MovieClip();
__tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
_currentTimeFrame = 0;
updateTime();
}
public static function removeAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
removeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function addTween(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:String;
var _local6:Array;
var _local13:Function;
var _local14:Object;
var _local15:TweenListObj;
var _local16:Number;
var _local17:Array;
var _local18:Array;
var _local19:Array;
var _local20:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local6 = _arg1.concat();
} else {
_local6 = [_arg1];
};
var _local7:Object = TweenListObj.makePropertiesChain(_arg2);
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var _local8:Number = (isNaN(_local7.time)) ? 0 : _local7.time;
var _local9:Number = (isNaN(_local7.delay)) ? 0 : _local7.delay;
var _local10:Array = new Array();
var _local11:Object = {time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, transitionParams:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, onError:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true, onStartScope:true, onUpdateScope:true, onCompleteScope:true, onOverwriteScope:true, onErrorScope:true};
var _local12:Object = new Object();
for (_local5 in _local7) {
if (!_local11[_local5]){
if (_specialPropertySplitterList[_local5]){
_local17 = _specialPropertySplitterList[_local5].splitValues(_local7[_local5], _specialPropertySplitterList[_local5].parameters);
_local3 = 0;
while (_local3 < _local17.length) {
if (_specialPropertySplitterList[_local17[_local3].name]){
_local18 = _specialPropertySplitterList[_local17[_local3].name].splitValues(_local17[_local3].value, _specialPropertySplitterList[_local17[_local3].name].parameters);
_local4 = 0;
while (_local4 < _local18.length) {
_local10[_local18[_local4].name] = {valueStart:undefined, valueComplete:_local18[_local4].value, arrayIndex:_local18[_local4].arrayIndex, isSpecialProperty:false};
_local4++;
};
} else {
_local10[_local17[_local3].name] = {valueStart:undefined, valueComplete:_local17[_local3].value, arrayIndex:_local17[_local3].arrayIndex, isSpecialProperty:false};
};
_local3++;
};
} else {
if (_specialPropertyModifierList[_local5] != undefined){
_local19 = _specialPropertyModifierList[_local5].modifyValues(_local7[_local5]);
_local3 = 0;
while (_local3 < _local19.length) {
_local12[_local19[_local3].name] = {modifierParameters:_local19[_local3].parameters, modifierFunction:_specialPropertyModifierList[_local5].getValue};
_local3++;
};
} else {
_local10[_local5] = {valueStart:undefined, valueComplete:_local7[_local5]};
};
};
};
};
for (_local5 in _local10) {
if (_specialPropertyList[_local5] != undefined){
_local10[_local5].isSpecialProperty = true;
} else {
if (_local6[0][_local5] == undefined){
printError((((("The property '" + _local5) + "' doesn't seem to be a normal object property of ") + String(_local6[0])) + " or a registered special property."));
};
};
};
for (_local5 in _local12) {
if (_local10[_local5] != undefined){
_local10[_local5].modifierParameters = _local12[_local5].modifierParameters;
_local10[_local5].modifierFunction = _local12[_local5].modifierFunction;
};
};
if (typeof(_local7.transition) == "string"){
_local20 = _local7.transition.toLowerCase();
_local13 = _transitionList[_local20];
} else {
_local13 = _local7.transition;
};
if (!Boolean(_local13)){
_local13 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local6.length) {
_local14 = new Object();
for (_local5 in _local10) {
_local14[_local5] = new PropertyInfoObj(_local10[_local5].valueStart, _local10[_local5].valueComplete, _local10[_local5].valueComplete, _local10[_local5].arrayIndex, {}, _local10[_local5].isSpecialProperty, _local10[_local5].modifierFunction, _local10[_local5].modifierParameters);
};
if (_local7.useFrames == true){
_local15 = new TweenListObj(_local6[_local3], (_currentTimeFrame + (_local9 / _timeScale)), (_currentTimeFrame + ((_local9 + _local8) / _timeScale)), true, _local13, _local7.transitionParams);
} else {
_local15 = new TweenListObj(_local6[_local3], (_currentTime + ((_local9 * 1000) / _timeScale)), (_currentTime + (((_local9 * 1000) + (_local8 * 1000)) / _timeScale)), false, _local13, _local7.transitionParams);
};
_local15.properties = _local14;
_local15.onStart = _local7.onStart;
_local15.onUpdate = _local7.onUpdate;
_local15.onComplete = _local7.onComplete;
_local15.onOverwrite = _local7.onOverwrite;
_local15.onError = _local7.onError;
_local15.onStartParams = _local7.onStartParams;
_local15.onUpdateParams = _local7.onUpdateParams;
_local15.onCompleteParams = _local7.onCompleteParams;
_local15.onOverwriteParams = _local7.onOverwriteParams;
_local15.onStartScope = _local7.onStartScope;
_local15.onUpdateScope = _local7.onUpdateScope;
_local15.onCompleteScope = _local7.onCompleteScope;
_local15.onOverwriteScope = _local7.onOverwriteScope;
_local15.onErrorScope = _local7.onErrorScope;
_local15.rounded = _local7.rounded;
_local15.skipUpdates = _local7.skipUpdates;
removeTweensByTime(_local15.scope, _local15.properties, _local15.timeStart, _local15.timeComplete);
_tweenList.push(_local15);
if ((((_local8 == 0)) && ((_local9 == 0)))){
_local16 = (_tweenList.length - 1);
updateTweenByIndex(_local16);
removeTweenByIndex(_local16);
};
_local3++;
};
return (true);
}
public static function registerTransition(_arg1:String, _arg2:Function):void{
if (!_inited){
init();
};
_transitionList[_arg1] = _arg2;
}
public static function printError(_arg1:String):void{
trace(("## [Tweener] Error: " + _arg1));
}
private static function affectTweens(_arg1:Function, _arg2:Object, _arg3:Array):Boolean{
var _local5:uint;
var _local6:Array;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local4:Boolean;
if (!Boolean(_tweenList)){
return (false);
};
_local5 = 0;
while (_local5 < _tweenList.length) {
if (((_tweenList[_local5]) && ((_tweenList[_local5].scope == _arg2)))){
if (_arg3.length == 0){
_arg1(_local5);
_local4 = true;
} else {
_local6 = new Array();
_local7 = 0;
while (_local7 < _arg3.length) {
if (Boolean(_tweenList[_local5].properties[_arg3[_local7]])){
_local6.push(_arg3[_local7]);
};
_local7++;
};
if (_local6.length > 0){
_local8 = AuxFunctions.getObjectLength(_tweenList[_local5].properties);
if (_local8 == _local6.length){
_arg1(_local5);
_local4 = true;
} else {
_local9 = splitTweens(_local5, _local6);
_arg1(_local9);
_local4 = true;
};
};
};
};
_local5++;
};
return (_local4);
}
public static function getTweens(_arg1:Object):Array{
var _local2:uint;
var _local3:String;
if (!Boolean(_tweenList)){
return ([]);
};
var _local4:Array = new Array();
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
for (_local3 in _tweenList[_local2].properties) {
_local4.push(_local3);
};
};
_local2++;
};
return (_local4);
}
public static function isTweening(_arg1:Object):Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
return (true);
};
_local2++;
};
return (false);
}
public static function pauseTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj = _tweenList[_arg1];
if ((((_local2 == null)) || (_local2.isPaused))){
return (false);
};
_local2.timePaused = getCurrentTweeningTime(_local2);
_local2.isPaused = true;
return (true);
}
public static function getCurrentTweeningTime(_arg1:Object):Number{
return ((_arg1.useFrames) ? _currentTimeFrame : _currentTime);
}
public static function getTweenCount(_arg1:Object):Number{
var _local2:uint;
if (!Boolean(_tweenList)){
return (0);
};
var _local3:Number = 0;
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
_local3 = (_local3 + AuxFunctions.getObjectLength(_tweenList[_local2].properties));
};
_local2++;
};
return (_local3);
}
private static function stopEngine():void{
_engineExists = false;
_tweenList = null;
_currentTime = 0;
_currentTimeFrame = 0;
__tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
__tweener_controller__ = null;
}
public static function removeTweensByTime(_arg1:Object, _arg2:Object, _arg3:Number, _arg4:Number):Boolean{
var removedLocally:Boolean;
var i:uint;
var pName:String;
var eventScope:Object;
var p_scope = _arg1;
var p_properties = _arg2;
var p_timeStart = _arg3;
var p_timeComplete = _arg4;
var removed:Boolean;
var tl:uint = _tweenList.length;
i = 0;
while (i < tl) {
if (((Boolean(_tweenList[i])) && ((p_scope == _tweenList[i].scope)))){
if ((((p_timeComplete > _tweenList[i].timeStart)) && ((p_timeStart < _tweenList[i].timeComplete)))){
removedLocally = false;
for (pName in _tweenList[i].properties) {
if (Boolean(p_properties[pName])){
if (Boolean(_tweenList[i].onOverwrite)){
eventScope = (Boolean(_tweenList[i].onOverwriteScope)) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope;
try {
_tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams);
} catch(e:Error) {
handleError(_tweenList[i], e, "onOverwrite");
};
};
_tweenList[i].properties[pName] = undefined;
delete _tweenList[i].properties[pName];
removedLocally = true;
removed = true;
};
};
if (removedLocally){
if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0){
removeTweenByIndex(i);
};
};
};
};
i = (i + 1);
};
return (removed);
}
public static function registerSpecialPropertySplitter(_arg1:String, _arg2:Function, _arg3:Array=null):void{
if (!_inited){
init();
};
var _local4:SpecialPropertySplitter = new SpecialPropertySplitter(_arg2, _arg3);
_specialPropertySplitterList[_arg1] = _local4;
}
public static function removeTweenByIndex(_arg1:Number, _arg2:Boolean=false):Boolean{
_tweenList[_arg1] = null;
if (_arg2){
_tweenList.splice(_arg1, 1);
};
return (true);
}
public static function resumeTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local3:Array = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && ((_local3.indexOf(_args[_local4]) == -1)))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(resumeTweenByIndex, _arg1, _local3));
}
public static function pauseTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local3:Array = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && ((_local3.indexOf(_args[_local4]) == -1)))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(pauseTweenByIndex, _arg1, _local3));
}
}
}//package caurina.transitions
Section 8
//TweenListObj (caurina.transitions.TweenListObj)
package caurina.transitions {
public class TweenListObj {
public var hasStarted:Boolean;
public var onUpdate:Function;
public var useFrames:Boolean;
public var count:Number;
public var onOverwriteParams:Array;
public var timeStart:Number;
public var timeComplete:Number;
public var onStartParams:Array;
public var onUpdateScope:Object;
public var rounded:Boolean;
public var onUpdateParams:Array;
public var properties:Object;
public var onComplete:Function;
public var transitionParams:Object;
public var updatesSkipped:Number;
public var onStart:Function;
public var onOverwriteScope:Object;
public var skipUpdates:Number;
public var onStartScope:Object;
public var scope:Object;
public var isCaller:Boolean;
public var timePaused:Number;
public var transition:Function;
public var onCompleteParams:Array;
public var onError:Function;
public var timesCalled:Number;
public var onErrorScope:Object;
public var onOverwrite:Function;
public var isPaused:Boolean;
public var waitFrames:Boolean;
public var onCompleteScope:Object;
public function TweenListObj(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Function, _arg6:Object){
scope = _arg1;
timeStart = _arg2;
timeComplete = _arg3;
useFrames = _arg4;
transition = _arg5;
transitionParams = _arg6;
properties = new Object();
isPaused = false;
timePaused = undefined;
isCaller = false;
updatesSkipped = 0;
timesCalled = 0;
skipUpdates = 0;
hasStarted = false;
}
public function clone(_arg1:Boolean):TweenListObj{
var _local3:String;
var _local2:TweenListObj = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams);
_local2.properties = new Array();
for (_local3 in properties) {
_local2.properties[_local3] = properties[_local3].clone();
};
_local2.skipUpdates = skipUpdates;
_local2.updatesSkipped = updatesSkipped;
if (!_arg1){
_local2.onStart = onStart;
_local2.onUpdate = onUpdate;
_local2.onComplete = onComplete;
_local2.onOverwrite = onOverwrite;
_local2.onError = onError;
_local2.onStartParams = onStartParams;
_local2.onUpdateParams = onUpdateParams;
_local2.onCompleteParams = onCompleteParams;
_local2.onOverwriteParams = onOverwriteParams;
_local2.onStartScope = onStartScope;
_local2.onUpdateScope = onUpdateScope;
_local2.onCompleteScope = onCompleteScope;
_local2.onOverwriteScope = onOverwriteScope;
_local2.onErrorScope = onErrorScope;
};
_local2.rounded = rounded;
_local2.isPaused = isPaused;
_local2.timePaused = timePaused;
_local2.isCaller = isCaller;
_local2.count = count;
_local2.timesCalled = timesCalled;
_local2.waitFrames = waitFrames;
_local2.hasStarted = hasStarted;
return (_local2);
}
public function toString():String{
var _local3:String;
var _local1 = "\n[TweenListObj ";
_local1 = (_local1 + ("scope:" + String(scope)));
_local1 = (_local1 + ", properties:");
var _local2:Boolean;
for (_local3 in properties) {
if (!_local2){
_local1 = (_local1 + ",");
};
_local1 = (_local1 + ("[name:" + properties[_local3].name));
_local1 = (_local1 + (",valueStart:" + properties[_local3].valueStart));
_local1 = (_local1 + (",valueComplete:" + properties[_local3].valueComplete));
_local1 = (_local1 + "]");
_local2 = false;
};
_local1 = (_local1 + (", timeStart:" + String(timeStart)));
_local1 = (_local1 + (", timeComplete:" + String(timeComplete)));
_local1 = (_local1 + (", useFrames:" + String(useFrames)));
_local1 = (_local1 + (", transition:" + String(transition)));
_local1 = (_local1 + (", transitionParams:" + String(transitionParams)));
if (skipUpdates){
_local1 = (_local1 + (", skipUpdates:" + String(skipUpdates)));
};
if (updatesSkipped){
_local1 = (_local1 + (", updatesSkipped:" + String(updatesSkipped)));
};
if (Boolean(onStart)){
_local1 = (_local1 + (", onStart:" + String(onStart)));
};
if (Boolean(onUpdate)){
_local1 = (_local1 + (", onUpdate:" + String(onUpdate)));
};
if (Boolean(onComplete)){
_local1 = (_local1 + (", onComplete:" + String(onComplete)));
};
if (Boolean(onOverwrite)){
_local1 = (_local1 + (", onOverwrite:" + String(onOverwrite)));
};
if (Boolean(onError)){
_local1 = (_local1 + (", onError:" + String(onError)));
};
if (onStartParams){
_local1 = (_local1 + (", onStartParams:" + String(onStartParams)));
};
if (onUpdateParams){
_local1 = (_local1 + (", onUpdateParams:" + String(onUpdateParams)));
};
if (onCompleteParams){
_local1 = (_local1 + (", onCompleteParams:" + String(onCompleteParams)));
};
if (onOverwriteParams){
_local1 = (_local1 + (", onOverwriteParams:" + String(onOverwriteParams)));
};
if (onStartScope){
_local1 = (_local1 + (", onStartScope:" + String(onStartScope)));
};
if (onUpdateScope){
_local1 = (_local1 + (", onUpdateScope:" + String(onUpdateScope)));
};
if (onCompleteScope){
_local1 = (_local1 + (", onCompleteScope:" + String(onCompleteScope)));
};
if (onOverwriteScope){
_local1 = (_local1 + (", onOverwriteScope:" + String(onOverwriteScope)));
};
if (onErrorScope){
_local1 = (_local1 + (", onErrorScope:" + String(onErrorScope)));
};
if (rounded){
_local1 = (_local1 + (", rounded:" + String(rounded)));
};
if (isPaused){
_local1 = (_local1 + (", isPaused:" + String(isPaused)));
};
if (timePaused){
_local1 = (_local1 + (", timePaused:" + String(timePaused)));
};
if (isCaller){
_local1 = (_local1 + (", isCaller:" + String(isCaller)));
};
if (count){
_local1 = (_local1 + (", count:" + String(count)));
};
if (timesCalled){
_local1 = (_local1 + (", timesCalled:" + String(timesCalled)));
};
if (waitFrames){
_local1 = (_local1 + (", waitFrames:" + String(waitFrames)));
};
if (hasStarted){
_local1 = (_local1 + (", hasStarted:" + String(hasStarted)));
};
_local1 = (_local1 + "]\n");
return (_local1);
}
public static function makePropertiesChain(_arg1:Object):Object{
var _local3:Object;
var _local4:Object;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local2:Object = _arg1.base;
if (_local2){
_local3 = {};
if ((_local2 is Array)){
_local4 = [];
_local8 = 0;
while (_local8 < _local2.length) {
_local4.push(_local2[_local8]);
_local8++;
};
} else {
_local4 = [_local2];
};
_local4.push(_arg1);
_local6 = _local4.length;
_local7 = 0;
while (_local7 < _local6) {
if (_local4[_local7]["base"]){
_local5 = AuxFunctions.concatObjects(makePropertiesChain(_local4[_local7]["base"]), _local4[_local7]);
} else {
_local5 = _local4[_local7];
};
_local3 = AuxFunctions.concatObjects(_local3, _local5);
_local7++;
};
if (_local3["base"]){
delete _local3["base"];
};
return (_local3);
//unresolved jump
};
return (_arg1);
}
}
}//package caurina.transitions
Section 9
//ag_intro_mc_343 (KingdomCrusher_fla.ag_intro_mc_343)
package KingdomCrusher_fla {
import flash.display.*;
public dynamic class ag_intro_mc_343 extends MovieClip {
public var timeToMoveOn:Boolean;
public function ag_intro_mc_343(){
addFrameScript(0, frame1, 217, frame218);
}
function frame218(){
stop();
timeToMoveOn = true;
}
function frame1(){
timeToMoveOn = false;
}
}
}//package KingdomCrusher_fla
Section 10
//catapult15_175 (KingdomCrusher_fla.catapult15_175)
package KingdomCrusher_fla {
import flash.display.*;
public dynamic class catapult15_175 extends MovieClip {
public var thrower:MovieClip;
public function catapult15_175(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package KingdomCrusher_fla
Section 11
//catapult19_171 (KingdomCrusher_fla.catapult19_171)
package KingdomCrusher_fla {
import flash.display.*;
public dynamic class catapult19_171 extends MovieClip {
public var barrel:MovieClip;
public var throwerArm:MovieClip;
public function catapult19_171(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package KingdomCrusher_fla
Section 12
//MainTimeline (KingdomCrusher_fla.MainTimeline)
package KingdomCrusher_fla {
import flash.events.*;
import caurina.transitions.*;
import flash.geom.*;
import flash.display.*;
import flash.utils.*;
import flash.filters.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var bytestotal;
public var sfbButton:SimpleButton;
public var agTeaserClip:MovieClip;
public var startGameButton:Symbol1;
public var playMoreGamesButton:SimpleButton;
public var ssIntro:LogoIntroClip;
public var ssButton:SSTitleButton;
public var loadCounter:TextField;
public var bytesloaded;
public var agButton:SimpleButton;
public var sclbar;
public function MainTimeline(){
addFrameScript(0, frame1, 2, frame3, 3, frame4, 14, frame15, 15, frame16, 25, frame26, 42, frame43, 54, frame55);
}
public function playMoreClicked(_arg1:MouseEvent){
var _local2:URLRequest = new URLRequest("http://www.armorgames.com/");
navigateToURL(_local2, "_blank");
}
public function stepFrame(_arg1:Event){
bytestotal = stage.loaderInfo.bytesTotal;
bytesloaded = stage.loaderInfo.bytesLoaded;
sclbar = Math.round(((bytesloaded * 100) / bytestotal));
loadCounter.text = (("Loading..." + String(sclbar)) + "%");
if (bytesloaded >= bytestotal){
removeEventListener(Event.ENTER_FRAME, stepFrame);
play();
};
}
function frame4(){
stop();
SoundManager.initiate();
ssIntro.buttonMode = true;
ssIntro.useHandCursor = true;
ssIntro.x = 320;
ssIntro.y = 240;
ssIntro.width = 26573;
ssIntro.height = 4489.7;
ssIntro.addEventListener(MouseEvent.CLICK, ssIntroClicked);
Tweener.addTween(ssIntro, {x:491.3, time:1.5});
Tweener.addTween(ssIntro, {width:389.4, time:2});
Tweener.addTween(ssIntro, {height:65.8, time:2});
Tweener.addTween(ssIntro, {x:320, time:3, delay:4});
Tweener.addTween(ssIntro, {width:26573, time:3, delay:4, onComplete:function (){
ssIntro.removeEventListener(MouseEvent.CLICK, ssIntroClicked);
play();
}});
Tweener.addTween(ssIntro, {height:4489.7, time:3, delay:4});
SoundManager.playFx(25);
}
function frame15(){
stop();
addChild(GameManager.screenDisplay);
addChild(GameManager.interfaceDisplay);
addChild(GameManager.fadeDisplay);
GameManager.initiateMusicControls();
playMoreGamesButton.addEventListener(MouseEvent.CLICK, playMoreClicked);
agButton.addEventListener(MouseEvent.CLICK, agClicked);
sfbButton.addEventListener(MouseEvent.CLICK, sfbClicked);
ssButton.addEventListener(MouseEvent.CLICK, ssClicked);
play();
}
function frame16(){
stage.frameRate = 14;
}
public function checkToMove(_arg1:Event){
if (agTeaserClip.timeToMoveOn){
stage.removeEventListener(Event.ENTER_FRAME, checkToMove);
agTeaserClip.removeEventListener(MouseEvent.CLICK, sponsorClicked);
play();
};
}
function frame55(){
stop();
stage.stageFocusRect = false;
stage.frameRate = 35;
GameManager.showMap = true;
GameManager.initiate();
}
public function agClicked(_arg1:MouseEvent){
var _local2:URLRequest = new URLRequest("http://www.armorgames.com/");
navigateToURL(_local2, "_blank");
}
public function ssIntroClicked(_arg1:MouseEvent){
var _local2:URLRequest = new URLRequest("http://www.sinistersea.com/");
navigateToURL(_local2, "_blank");
}
function frame3(){
stop();
stage.addEventListener(Event.ENTER_FRAME, checkToMove);
agTeaserClip.addEventListener(MouseEvent.CLICK, sponsorClicked);
agTeaserClip.buttonMode = true;
agTeaserClip.useHandCursor = true;
}
public function ssClicked(_arg1:MouseEvent){
var _local2:URLRequest = new URLRequest("http://www.sinistersea.com/");
navigateToURL(_local2, "_blank");
}
function frame1(){
stop();
bytestotal = stage.loaderInfo.bytesTotal;
bytesloaded = stage.loaderInfo.bytesLoaded;
sclbar = Math.round(((bytesloaded * 100) / bytestotal));
addEventListener(Event.ENTER_FRAME, stepFrame);
}
public function sponsorClicked(_arg1:MouseEvent){
var _local2:URLRequest = new URLRequest("http://www.armorgames.com/");
navigateToURL(_local2, "_blank");
}
function frame26(){
SoundManager.playFx(22);
}
public function startGame(_arg1:MouseEvent){
SoundManager.playFx(10);
startGameButton.removeEventListener(MouseEvent.CLICK, startGame);
playMoreGamesButton.removeEventListener(MouseEvent.CLICK, playMoreClicked);
agButton.removeEventListener(MouseEvent.CLICK, agClicked);
sfbButton.removeEventListener(MouseEvent.CLICK, sfbClicked);
ssButton.removeEventListener(MouseEvent.CLICK, ssClicked);
play();
}
function frame43(){
stop();
startGameButton.addEventListener(MouseEvent.CLICK, startGame);
SoundManager.currentMusic = 1;
SoundManager.startMusic();
}
public function sfbClicked(_arg1:MouseEvent){
var _local2:URLRequest = new URLRequest("http://www.superflashbros.net/");
navigateToURL(_local2, "_blank");
}
}
}//package KingdomCrusher_fla
Section 13
//SHOP19_205 (KingdomCrusher_fla.SHOP19_205)
package KingdomCrusher_fla {
import flash.display.*;
public dynamic class SHOP19_205 extends MovieClip {
public function SHOP19_205(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package KingdomCrusher_fla
Section 14
//SHOP20_196 (KingdomCrusher_fla.SHOP20_196)
package KingdomCrusher_fla {
import flash.display.*;
public dynamic class SHOP20_196 extends MovieClip {
public function SHOP20_196(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package KingdomCrusher_fla
Section 15
//SHOP21_210 (KingdomCrusher_fla.SHOP21_210)
package KingdomCrusher_fla {
import flash.display.*;
public dynamic class SHOP21_210 extends MovieClip {
public function SHOP21_210(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package KingdomCrusher_fla
Section 16
//sprite503_234 (KingdomCrusher_fla.sprite503_234)
package KingdomCrusher_fla {
import flash.display.*;
public dynamic class sprite503_234 extends MovieClip {
public function sprite503_234(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame3(){
stop();
}
function frame4(){
stop();
}
}
}//package KingdomCrusher_fla
Section 17
//sprite807_209 (KingdomCrusher_fla.sprite807_209)
package KingdomCrusher_fla {
import flash.display.*;
public dynamic class sprite807_209 extends MovieClip {
public function sprite807_209(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame3(){
stop();
}
function frame4(){
stop();
}
}
}//package KingdomCrusher_fla
Section 18
//sprite848_207 (KingdomCrusher_fla.sprite848_207)
package KingdomCrusher_fla {
import flash.display.*;
public dynamic class sprite848_207 extends MovieClip {
public var brickDescription:MovieClip;
public var purchaseText:MovieClip;
public function sprite848_207(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame4(){
stop();
}
function frame3(){
stop();
}
}
}//package KingdomCrusher_fla
Section 19
//Action (org.flintparticles.common.actions.Action)
package org.flintparticles.common.actions {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
public interface Action {
function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void;
function addedToEmitter(_arg1:Emitter):void;
function removedFromEmitter(_arg1:Emitter):void;
function getDefaultPriority():Number;
}
}//package org.flintparticles.common.actions
Section 20
//ActionBase (org.flintparticles.common.actions.ActionBase)
package org.flintparticles.common.actions {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
public class ActionBase implements Action {
public function addedToEmitter(_arg1:Emitter):void{
}
public function removedFromEmitter(_arg1:Emitter):void{
}
public function getDefaultPriority():Number{
return (0);
}
public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
}
}
}//package org.flintparticles.common.actions
Section 21
//Age (org.flintparticles.common.actions.Age)
package org.flintparticles.common.actions {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.energyEasing.*;
public class Age extends ActionBase {
private var _easing:Function;
public function Age(_arg1:Function=null){
if (_arg1 == null){
_easing = Linear.easeNone;
} else {
_easing = _arg1;
};
}
public function set easing(_arg1:Function):void{
_easing = _arg1;
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
_arg2.age = (_arg2.age + _arg3);
if (_arg2.age >= _arg2.lifetime){
_arg2.energy = 0;
_arg2.isDead = true;
} else {
_arg2.energy = _easing(_arg2.age, _arg2.lifetime);
};
}
public function get easing():Function{
return (_easing);
}
}
}//package org.flintparticles.common.actions
Section 22
//ColorChange (org.flintparticles.common.actions.ColorChange)
package org.flintparticles.common.actions {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.utils.*;
public class ColorChange extends ActionBase {
private var _startColor:uint;
private var _endColor:uint;
public function ColorChange(_arg1:uint, _arg2:uint){
_startColor = _arg1;
_endColor = _arg2;
}
public function get startColor():uint{
return (_startColor);
}
public function set startColor(_arg1:uint):void{
_startColor = _arg1;
}
public function get endColor():uint{
return (_endColor);
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
_arg2.color = interpolateColors(_startColor, _endColor, _arg2.energy);
}
public function set endColor(_arg1:uint):void{
_endColor = _arg1;
}
}
}//package org.flintparticles.common.actions
Section 23
//Fade (org.flintparticles.common.actions.Fade)
package org.flintparticles.common.actions {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
public class Fade extends ActionBase {
private var _endAlpha:Number;
private var _diffAlpha:Number;
public function Fade(_arg1:Number=1, _arg2:Number=0){
_diffAlpha = (_arg1 - _arg2);
_endAlpha = _arg2;
}
public function get endAlpha():Number{
return (_endAlpha);
}
public function set endAlpha(_arg1:Number):void{
_diffAlpha = ((_endAlpha + _diffAlpha) - _arg1);
_endAlpha = _arg1;
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
var _local4:Number = (_endAlpha + (_diffAlpha * _arg2.energy));
_arg2.color = ((_arg2.color & 0xFFFFFF) | (Math.round((_local4 * 0xFF)) << 24));
}
override public function getDefaultPriority():Number{
return (-5);
}
public function set startAlpha(_arg1:Number):void{
_diffAlpha = (_arg1 - _endAlpha);
}
public function get startAlpha():Number{
return ((_endAlpha + _diffAlpha));
}
}
}//package org.flintparticles.common.actions
Section 24
//ScaleImage (org.flintparticles.common.actions.ScaleImage)
package org.flintparticles.common.actions {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
public class ScaleImage extends ActionBase {
private var _diffScale:Number;
private var _endScale:Number;
public function ScaleImage(_arg1:Number=1, _arg2:Number=1){
_diffScale = (_arg1 - _arg2);
_endScale = _arg2;
}
public function set startScale(_arg1:Number):void{
_diffScale = (_arg1 - _endScale);
}
public function set endScale(_arg1:Number):void{
_diffScale = ((_endScale + _diffScale) - _arg1);
_endScale = _arg1;
}
public function get startScale():Number{
return ((_endScale + _diffScale));
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
_arg2.scale = (_endScale + (_diffScale * _arg2.energy));
}
public function get endScale():Number{
return (_endScale);
}
}
}//package org.flintparticles.common.actions
Section 25
//Activity (org.flintparticles.common.activities.Activity)
package org.flintparticles.common.activities {
import org.flintparticles.common.emitters.*;
public interface Activity {
function initialize(_arg1:Emitter):void;
function removedFromEmitter(_arg1:Emitter):void;
function update(_arg1:Emitter, _arg2:Number):void;
function addedToEmitter(_arg1:Emitter):void;
function getDefaultPriority():Number;
}
}//package org.flintparticles.common.activities
Section 26
//Blast (org.flintparticles.common.counters.Blast)
package org.flintparticles.common.counters {
import org.flintparticles.common.emitters.*;
public class Blast implements Counter {
private var _startCount:uint;
public function Blast(_arg1:uint){
_startCount = _arg1;
}
public function stop():void{
}
public function updateEmitter(_arg1:Emitter, _arg2:Number):uint{
return (0);
}
public function startEmitter(_arg1:Emitter):uint{
return (_startCount);
}
public function resume():void{
}
public function set startCount(_arg1:Number):void{
_startCount = _arg1;
}
public function get startCount():Number{
return (_startCount);
}
}
}//package org.flintparticles.common.counters
Section 27
//Counter (org.flintparticles.common.counters.Counter)
package org.flintparticles.common.counters {
import org.flintparticles.common.emitters.*;
public interface Counter {
function stop():void;
function startEmitter(_arg1:Emitter):uint;
function updateEmitter(_arg1:Emitter, _arg2:Number):uint;
function resume():void;
}
}//package org.flintparticles.common.counters
Section 28
//ZeroCounter (org.flintparticles.common.counters.ZeroCounter)
package org.flintparticles.common.counters {
import org.flintparticles.common.emitters.*;
public class ZeroCounter implements Counter {
public function stop():void{
}
public function updateEmitter(_arg1:Emitter, _arg2:Number):uint{
return (0);
}
public function startEmitter(_arg1:Emitter):uint{
return (0);
}
public function resume():void{
}
}
}//package org.flintparticles.common.counters
Section 29
//Dot (org.flintparticles.common.displayObjects.Dot)
package org.flintparticles.common.displayObjects {
import flash.display.*;
public class Dot extends Shape {
public function Dot(_arg1:Number, _arg2:uint=0xFFFFFF, _arg3:String="normal"){
graphics.beginFill(_arg2);
graphics.drawCircle(0, 0, _arg1);
graphics.endFill();
blendMode = _arg3;
}
}
}//package org.flintparticles.common.displayObjects
Section 30
//Line (org.flintparticles.common.displayObjects.Line)
package org.flintparticles.common.displayObjects {
import flash.display.*;
public class Line extends Shape {
public function Line(_arg1:Number, _arg2:uint=0xFFFFFF, _arg3:String="normal"){
graphics.lineStyle(1, _arg2);
graphics.moveTo((-(_arg1) * 0.5), 0);
graphics.lineTo((_arg1 * 0.5), 0);
blendMode = _arg3;
}
}
}//package org.flintparticles.common.displayObjects
Section 31
//RadialDot (org.flintparticles.common.displayObjects.RadialDot)
package org.flintparticles.common.displayObjects {
import flash.geom.*;
import flash.display.*;
public class RadialDot extends Shape {
public function RadialDot(_arg1:Number, _arg2:uint=0xFFFFFF, _arg3:String="normal"){
var _local4:Matrix = new Matrix();
_local4.createGradientBox((_arg1 * 2), (_arg1 * 2), 0, -(_arg1), -(_arg1));
graphics.beginGradientFill(GradientType.RADIAL, [_arg2, _arg2], [1, 0], [0, 0xFF], _local4);
graphics.drawCircle(0, 0, _arg1);
graphics.endFill();
blendMode = _arg3;
}
}
}//package org.flintparticles.common.displayObjects
Section 32
//Emitter (org.flintparticles.common.emitters.Emitter)
package org.flintparticles.common.emitters {
import flash.events.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.initializers.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.common.activities.*;
import org.flintparticles.common.counters.*;
import org.flintparticles.common.events.*;
import org.flintparticles.common.utils.*;
public class Emitter extends EventDispatcher {
protected var _running:Boolean;// = false
protected var _activities:PriorityArray;
protected var _particles:Array;
protected var _initializers:PriorityArray;
protected var _counter:Counter;
protected var _started:Boolean;// = false
protected var _actions:PriorityArray;
protected var _useInternalTick:Boolean;// = true
protected var _particleFactory:ParticleFactory;
protected var _fixedFrameTime:Number;// = 0
protected var _maximumFrameTime:Number;// = 0.1
public function Emitter(){
_particles = new Array();
_actions = new PriorityArray();
_initializers = new PriorityArray();
_activities = new PriorityArray();
_counter = new ZeroCounter();
}
public function addInitializer(_arg1:Initializer, _arg2:Number=NaN):void{
if (isNaN(_arg2)){
_arg2 = _arg1.getDefaultPriority();
};
_initializers.add(_arg1, _arg2);
_arg1.addedToEmitter(this);
}
public function stop():void{
if (_useInternalTick){
FrameUpdater.instance.removeEventListener(UpdateEvent.UPDATE, updateEventListener);
};
_started = false;
killAllParticles();
}
public function killAllParticles():void{
var _local1:int = _particles.length;
var _local2:int;
while (_local2 < _local1) {
dispatchEvent(new ParticleEvent(ParticleEvent.PARTICLE_DEAD, _particles[_local2]));
_particleFactory.disposeParticle(_particles[_local2]);
_local2++;
};
_particles.length = 0;
}
public function set fixedFrameTime(_arg1:Number):void{
_fixedFrameTime = _arg1;
}
public function get maximumFrameTime():Number{
return (_maximumFrameTime);
}
public function get useInternalTick():Boolean{
return (_useInternalTick);
}
protected function createParticle():Particle{
var _local1:Particle = _particleFactory.createParticle();
var _local2:int = _initializers.length;
initParticle(_local1);
var _local3:int;
while (_local3 < _local2) {
_initializers[_local3].initialize(this, _local1);
_local3++;
};
_particles.push(_local1);
dispatchEvent(new ParticleEvent(ParticleEvent.PARTICLE_CREATED, _local1));
return (_local1);
}
public function get particleFactory():ParticleFactory{
return (_particleFactory);
}
private function updateEventListener(_arg1:UpdateEvent):void{
if (_fixedFrameTime){
update(_fixedFrameTime);
} else {
update(_arg1.time);
};
}
public function get particles():Array{
return (_particles);
}
protected function sortParticles():void{
}
public function removeActivity(_arg1:Activity):void{
if (_activities.remove(_arg1)){
_arg1.removedFromEmitter(this);
};
}
public function set maximumFrameTime(_arg1:Number):void{
_maximumFrameTime = _arg1;
}
protected function initParticle(_arg1:Particle):void{
}
public function addAction(_arg1:Action, _arg2:Number=NaN):void{
if (isNaN(_arg2)){
_arg2 = _arg1.getDefaultPriority();
};
_actions.add(_arg1, _arg2);
_arg1.addedToEmitter(this);
}
public function hasInitializerOfType(_arg1:Class):Boolean{
var _local2:uint = _initializers.length;
var _local3:uint;
while (_local3 < _local2) {
if ((_initializers[_local3] is _arg1)){
return (true);
};
_local3++;
};
return (false);
}
public function resume():void{
_running = true;
}
public function removeInitializer(_arg1:Initializer):void{
if (_initializers.remove(_arg1)){
_arg1.removedFromEmitter(this);
};
}
public function get running():Boolean{
return (_running);
}
public function hasActionOfType(_arg1:Class):Boolean{
var _local2:uint = _actions.length;
var _local3:uint;
while (_local3 < _local2) {
if ((_actions[_local3] is _arg1)){
return (true);
};
_local3++;
};
return (false);
}
public function get fixedFrameTime():Number{
return (_fixedFrameTime);
}
public function set particleFactory(_arg1:ParticleFactory):void{
_particleFactory = _arg1;
}
public function hasActivity(_arg1:Activity):Boolean{
return (_activities.contains(_arg1));
}
public function addActivity(_arg1:Activity, _arg2:Number=NaN):void{
if (isNaN(_arg2)){
_arg2 = _arg1.getDefaultPriority();
};
_activities.add(_arg1, _arg2);
_arg1.addedToEmitter(this);
}
public function update(_arg1:Number):void{
var _local2:int;
var _local3:Particle;
var _local5:Action;
var _local6:int;
var _local7:int;
if (!_running){
return;
};
if (_arg1 > _maximumFrameTime){
_arg1 = _maximumFrameTime;
};
var _local4:int = _counter.updateEmitter(this, _arg1);
_local2 = 0;
while (_local2 < _local4) {
createParticle();
_local2++;
};
sortParticles();
_local4 = _activities.length;
_local2 = 0;
while (_local2 < _local4) {
_activities[_local2].update(this, _arg1);
_local2++;
};
if (_particles.length > 0){
_local4 = _actions.length;
_local6 = _particles.length;
_local7 = 0;
while (_local7 < _local4) {
_local5 = _actions[_local7];
_local2 = 0;
while (_local2 < _local6) {
_local3 = _particles[_local2];
_local5.update(this, _local3, _arg1);
_local2++;
};
_local7++;
};
_local2 = _local6;
while (_local2--) {
_local3 = _particles[_local2];
if (_local3.isDead){
dispatchEvent(new ParticleEvent(ParticleEvent.PARTICLE_DEAD, _local3));
_particleFactory.disposeParticle(_local3);
_particles.splice(_local2, 1);
};
};
} else {
dispatchEvent(new EmitterEvent(EmitterEvent.EMITTER_EMPTY));
};
dispatchEvent(new EmitterEvent(EmitterEvent.EMITTER_UPDATED));
}
public function addExistingParticles(_arg1:Array, _arg2:Boolean=false):void{
var _local4:int;
var _local5:int;
var _local6:int;
var _local3:int = _arg1.length;
if (_arg2){
_local5 = _initializers.length;
_local6 = 0;
while (_local6 < _local5) {
_local4 = 0;
while (_local4 < _local3) {
_initializers[_local6].initialize(this, _arg1[_local4]);
_local4++;
};
_local6++;
};
};
_local4 = 0;
while (_local4 < _local3) {
_particles.push(_arg1[_local4]);
dispatchEvent(new ParticleEvent(ParticleEvent.PARTICLE_ADDED, _arg1[_local4]));
_local4++;
};
}
public function removeAction(_arg1:Action):void{
if (_actions.remove(_arg1)){
_arg1.removedFromEmitter(this);
};
}
public function hasActivityOfType(_arg1:Class):Boolean{
var _local2:uint = _activities.length;
var _local3:uint;
while (_local3 < _local2) {
if ((_activities[_local3] is _arg1)){
return (true);
};
_local3++;
};
return (false);
}
public function set useInternalTick(_arg1:Boolean):void{
if (_useInternalTick != _arg1){
_useInternalTick = _arg1;
if (_started){
if (_useInternalTick){
FrameUpdater.instance.addEventListener(UpdateEvent.UPDATE, updateEventListener, false, 0, true);
} else {
FrameUpdater.instance.removeEventListener(UpdateEvent.UPDATE, updateEventListener);
};
};
};
}
public function hasInitializer(_arg1:Initializer):Boolean{
return (_initializers.contains(_arg1));
}
public function start():void{
if (_useInternalTick){
FrameUpdater.instance.addEventListener(UpdateEvent.UPDATE, updateEventListener, false, 0, true);
};
_started = true;
_running = true;
var _local1:int = _activities.length;
var _local2:int;
while (_local2 < _local1) {
_activities[_local2].initialize(this);
_local2++;
};
_local1 = _counter.startEmitter(this);
_local2 = 0;
while (_local2 < _local1) {
createParticle();
_local2++;
};
}
public function hasAction(_arg1:Action):Boolean{
return (_actions.contains(_arg1));
}
public function pause():void{
_running = false;
}
public function set counter(_arg1:Counter):void{
_counter = _arg1;
}
public function get counter():Counter{
return (_counter);
}
public function runAhead(_arg1:Number, _arg2:Number=10):void{
var _local3:Number = _maximumFrameTime;
var _local4:Number = (1 / _arg2);
_maximumFrameTime = _local4;
while (_arg1 > 0) {
_arg1 = (_arg1 - _local4);
update(_local4);
};
_maximumFrameTime = _local3;
}
}
}//package org.flintparticles.common.emitters
Section 33
//Linear (org.flintparticles.common.energyEasing.Linear)
package org.flintparticles.common.energyEasing {
public class Linear {
public static function easeOut(_arg1:Number, _arg2:Number):Number{
return ((1 - (_arg1 / _arg2)));
}
public static function easeIn(_arg1:Number, _arg2:Number):Number{
return ((1 - (_arg1 / _arg2)));
}
public static function easeInOut(_arg1:Number, _arg2:Number):Number{
return ((1 - (_arg1 / _arg2)));
}
public static function easeNone(_arg1:Number, _arg2:Number):Number{
return ((1 - (_arg1 / _arg2)));
}
}
}//package org.flintparticles.common.energyEasing
Section 34
//EmitterEvent (org.flintparticles.common.events.EmitterEvent)
package org.flintparticles.common.events {
import flash.events.*;
public class EmitterEvent extends Event {
public static var EMITTER_UPDATED:String = "emitterUpdated";
public static var EMITTER_EMPTY:String = "emitterEmpty";
public function EmitterEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
}
}//package org.flintparticles.common.events
Section 35
//ParticleEvent (org.flintparticles.common.events.ParticleEvent)
package org.flintparticles.common.events {
import flash.events.*;
import org.flintparticles.common.particles.*;
public class ParticleEvent extends Event {
public var particle:Particle;
public static var PARTICLE_ADDED:String = "particleAdded";
public static var PARTICLE_DEAD:String = "particleDead";
public static var PARTICLE_CREATED:String = "particleCreated";
public function ParticleEvent(_arg1:String, _arg2:Particle=null, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
this.particle = _arg2;
}
}
}//package org.flintparticles.common.events
Section 36
//UpdateEvent (org.flintparticles.common.events.UpdateEvent)
package org.flintparticles.common.events {
import flash.events.*;
public class UpdateEvent extends Event {
public var time:Number;
public static var UPDATE:String = "update";
public function UpdateEvent(_arg1:String, _arg2:Number=NaN, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
this.time = _arg2;
}
}
}//package org.flintparticles.common.events
Section 37
//ColorInit (org.flintparticles.common.initializers.ColorInit)
package org.flintparticles.common.initializers {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.utils.*;
public class ColorInit extends InitializerBase {
private var _max:uint;
private var _min:uint;
public function ColorInit(_arg1:uint, _arg2:uint){
_min = _arg1;
_max = _arg2;
}
public function set minColor(_arg1:uint):void{
_min = _arg1;
}
public function get color():uint{
return (((_min == _max)) ? _min : interpolateColors(_max, _min, 0.5));
}
public function set color(_arg1:uint):void{
_max = (_min = _arg1);
}
override public function initialize(_arg1:Emitter, _arg2:Particle):void{
if (_max == _min){
_arg2.color = _min;
} else {
_arg2.color = interpolateColors(_min, _max, Math.random());
};
}
public function get minColor():uint{
return (_min);
}
public function set maxColor(_arg1:uint):void{
_max = _arg1;
}
public function get maxColor():uint{
return (_max);
}
}
}//package org.flintparticles.common.initializers
Section 38
//Initializer (org.flintparticles.common.initializers.Initializer)
package org.flintparticles.common.initializers {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
public interface Initializer {
function initialize(_arg1:Emitter, _arg2:Particle):void;
function addedToEmitter(_arg1:Emitter):void;
function removedFromEmitter(_arg1:Emitter):void;
function getDefaultPriority():Number;
}
}//package org.flintparticles.common.initializers
Section 39
//InitializerBase (org.flintparticles.common.initializers.InitializerBase)
package org.flintparticles.common.initializers {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
public class InitializerBase implements Initializer {
public function initialize(_arg1:Emitter, _arg2:Particle):void{
}
public function addedToEmitter(_arg1:Emitter):void{
}
public function removedFromEmitter(_arg1:Emitter):void{
}
public function getDefaultPriority():Number{
return (0);
}
}
}//package org.flintparticles.common.initializers
Section 40
//Lifetime (org.flintparticles.common.initializers.Lifetime)
package org.flintparticles.common.initializers {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
public class Lifetime extends InitializerBase {
private var _max:Number;
private var _min:Number;
public function Lifetime(_arg1:Number, _arg2:Number=NaN){
_max = _arg2;
_min = _arg1;
}
public function get lifetime():Number{
return (((_min == _max)) ? _min : ((_max + _min) * 0.5));
}
public function get maxLifetime():Number{
return (_max);
}
override public function initialize(_arg1:Emitter, _arg2:Particle):void{
if (isNaN(_max)){
_arg2.lifetime = _min;
} else {
_arg2.lifetime = (_min + (Math.random() * (_max - _min)));
};
}
public function set lifetime(_arg1:Number):void{
_max = (_min = _arg1);
}
public function set minLifetime(_arg1:Number):void{
_min = _arg1;
}
public function set maxLifetime(_arg1:Number):void{
_max = _arg1;
}
public function get minLifetime():Number{
return (_min);
}
}
}//package org.flintparticles.common.initializers
Section 41
//SharedImage (org.flintparticles.common.initializers.SharedImage)
package org.flintparticles.common.initializers {
import flash.display.*;
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
public class SharedImage extends InitializerBase {
private var _image:DisplayObject;
public function SharedImage(_arg1:DisplayObject){
_image = _arg1;
}
override public function initialize(_arg1:Emitter, _arg2:Particle):void{
_arg2.image = _image;
}
public function set image(_arg1:DisplayObject):void{
_image = _arg1;
}
public function get image():DisplayObject{
return (_image);
}
}
}//package org.flintparticles.common.initializers
Section 42
//Particle (org.flintparticles.common.particles.Particle)
package org.flintparticles.common.particles {
import flash.geom.*;
import flash.utils.*;
public class Particle {
public var energy:Number;// = 1
public var lifetime:Number;// = 0
public var scale:Number;// = 1
public var image;// = null
public var color:uint;// = 4294967295
public var collisionRadius:Number;// = 1
private var _colorTransform:ColorTransform;// = null
private var _previousColor:uint;
public var isDead:Boolean;// = false
public var mass:Number;// = 1
private var _dictionary:Dictionary;// = null
public var age:Number;// = 0
public function get dictionary():Dictionary{
if (_dictionary == null){
_dictionary = new Dictionary();
};
return (_dictionary);
}
public function get colorTransform():ColorTransform{
if (((!(_colorTransform)) || (!((_previousColor == color))))){
_colorTransform = new ColorTransform((((color >>> 16) & 0xFF) / 0xFF), (((color >>> 8) & 0xFF) / 0xFF), ((color & 0xFF) / 0xFF), (((color >>> 24) & 0xFF) / 0xFF), 0, 0, 0, 0);
_previousColor = color;
};
return (_colorTransform);
}
public function get alpha():Number{
return ((((color & 4278190080) >>> 24) / 0xFF));
}
public function initialize():void{
color = 4294967295;
scale = 1;
mass = 1;
collisionRadius = 1;
lifetime = 0;
age = 0;
energy = 1;
isDead = false;
image = null;
_dictionary = null;
_colorTransform = null;
}
}
}//package org.flintparticles.common.particles
Section 43
//ParticleFactory (org.flintparticles.common.particles.ParticleFactory)
package org.flintparticles.common.particles {
public interface ParticleFactory {
function createParticle():Particle;
function disposeParticle(_arg1:Particle):void;
}
}//package org.flintparticles.common.particles
Section 44
//Renderer (org.flintparticles.common.renderers.Renderer)
package org.flintparticles.common.renderers {
import org.flintparticles.common.emitters.*;
public interface Renderer {
function removeEmitter(_arg1:Emitter):void;
function addEmitter(_arg1:Emitter):void;
}
}//package org.flintparticles.common.renderers
Section 45
//SpriteRendererBase (org.flintparticles.common.renderers.SpriteRendererBase)
package org.flintparticles.common.renderers {
import flash.events.*;
import flash.display.*;
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.events.*;
public class SpriteRendererBase extends Sprite implements Renderer {
protected var _emitters:Array;
public function SpriteRendererBase(){
_emitters = new Array();
mouseEnabled = false;
mouseChildren = false;
addEventListener(Event.ADDED_TO_STAGE, addedToStage, false, 0, true);
}
private function particleAdded(_arg1:ParticleEvent):void{
addParticle(_arg1.particle);
if (stage){
stage.invalidate();
};
}
private function addedToStage(_arg1:Event):void{
if (stage){
stage.invalidate();
};
}
public function get emitters():Array{
return (_emitters);
}
protected function addParticle(_arg1:Particle):void{
}
private function updateParticles(_arg1:Event):void{
var _local2:Array = new Array();
var _local3:int;
while (_local3 < _emitters.length) {
_local2 = _local2.concat(_emitters[_local3].particles);
_local3++;
};
renderParticles(_local2);
}
private function emitterUpdated(_arg1:EmitterEvent):void{
if (stage){
stage.invalidate();
};
}
public function removeEmitter(_arg1:Emitter):void{
var _local3:Particle;
var _local2:int;
while (_local2 < _emitters.length) {
if (_emitters[_local2] == _arg1){
_emitters.splice(_local2, 1);
_arg1.removeEventListener(EmitterEvent.EMITTER_UPDATED, emitterUpdated);
_arg1.removeEventListener(ParticleEvent.PARTICLE_CREATED, particleAdded);
_arg1.removeEventListener(ParticleEvent.PARTICLE_ADDED, particleAdded);
_arg1.removeEventListener(ParticleEvent.PARTICLE_DEAD, particleRemoved);
for each (_local3 in _arg1.particles) {
removeParticle(_local3);
};
if (_emitters.length == 0){
removeEventListener(Event.RENDER, updateParticles);
renderParticles([]);
} else {
stage.invalidate();
};
return;
};
_local2++;
};
}
protected function renderParticles(_arg1:Array):void{
}
protected function removeParticle(_arg1:Particle):void{
}
private function particleRemoved(_arg1:ParticleEvent):void{
removeParticle(_arg1.particle);
if (stage){
stage.invalidate();
};
}
public function addEmitter(_arg1:Emitter):void{
var _local2:Particle;
_emitters.push(_arg1);
if (stage){
stage.invalidate();
};
_arg1.addEventListener(EmitterEvent.EMITTER_UPDATED, emitterUpdated, false, 0, true);
_arg1.addEventListener(ParticleEvent.PARTICLE_CREATED, particleAdded, false, 0, true);
_arg1.addEventListener(ParticleEvent.PARTICLE_ADDED, particleAdded, false, 0, true);
_arg1.addEventListener(ParticleEvent.PARTICLE_DEAD, particleRemoved, false, 0, true);
for each (_local2 in _arg1.particles) {
addParticle(_local2);
};
if (_emitters.length == 1){
addEventListener(Event.RENDER, updateParticles, false, 0, true);
};
}
}
}//package org.flintparticles.common.renderers
Section 46
//FrameUpdater (org.flintparticles.common.utils.FrameUpdater)
package org.flintparticles.common.utils {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import org.flintparticles.common.events.*;
public class FrameUpdater extends EventDispatcher {
private var _shape:Shape;
private var _time:Number;
private static var _instance:FrameUpdater;
public function FrameUpdater(){
_shape = new Shape();
_shape.addEventListener(Event.ENTER_FRAME, frameUpdate, false, 0, true);
_time = getTimer();
}
private function frameUpdate(_arg1:Event):void{
var _local2:int = _time;
_time = getTimer();
var _local3:Number = ((_time - _local2) * 0.001);
dispatchEvent(new UpdateEvent(UpdateEvent.UPDATE, _local3));
}
public static function get instance():FrameUpdater{
if (_instance == null){
_instance = new (FrameUpdater);
};
return (_instance);
}
}
}//package org.flintparticles.common.utils
Section 47
//interpolateColors (org.flintparticles.common.utils.interpolateColors)
package org.flintparticles.common.utils {
public function interpolateColors(_arg1:uint, _arg2:uint, _arg3:Number):uint{
var _local4:Number = (1 - _arg3);
var _local5:uint = Math.round(((((_arg1 >>> 16) & 0xFF) * _arg3) + (((_arg2 >>> 16) & 0xFF) * _local4)));
var _local6:uint = Math.round(((((_arg1 >>> 8) & 0xFF) * _arg3) + (((_arg2 >>> 8) & 0xFF) * _local4)));
var _local7:uint = Math.round((((_arg1 & 0xFF) * _arg3) + ((_arg2 & 0xFF) * _local4)));
var _local8:uint = Math.round(((((_arg1 >>> 24) & 0xFF) * _arg3) + (((_arg2 >>> 24) & 0xFF) * _local4)));
return (((((_local8 << 24) | (_local5 << 16)) | (_local6 << 8)) | _local7));
}
}//package org.flintparticles.common.utils
Section 48
//Maths (org.flintparticles.common.utils.Maths)
package org.flintparticles.common.utils {
public class Maths {
private static const DEGTORAD:Number = 0.0174532925199433;
private static const RADTODEG:Number = 57.2957795130823;
public static function asRadians(_arg1:Number):Number{
return ((_arg1 * DEGTORAD));
}
public static function asDegrees(_arg1:Number):Number{
return ((_arg1 * RADTODEG));
}
}
}//package org.flintparticles.common.utils
Section 49
//PriorityArray (org.flintparticles.common.utils.PriorityArray)
package org.flintparticles.common.utils {
import flash.utils.*;
public class PriorityArray extends Proxy {
private var _values:Array;
public function PriorityArray(){
_values = new Array();
}
public function remove(_arg1):Boolean{
var _local2:uint = _values.length;
while (_local2--) {
if (_values[_local2].value == _arg1){
_values.splice(_local2, 1);
return (true);
};
};
return (false);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return ((_arg1 - 1).toString());
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:uint = uint(_arg1);
if ((((_local3 == _arg1)) && ((_local3 < _values.length)))){
_values[_local3].value = _arg2;
};
}
public function add(_arg1, _arg2:Number):uint{
var _local3:uint = _values.length;
var _local4:uint;
while (_local4 < _local3) {
if (_values[_local4].priority < _arg2){
break;
};
_local4++;
};
_values.splice(_local4, 0, new Pair(_arg2, _arg1));
return (_values.length);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
var _local2:int = int(_arg1);
if ((((((_local2 == _arg1)) && ((_local2 < _values.length)))) && (_values[_local2]))){
return (_values[_local2].value);
};
return (undefined);
}
public function clear():void{
_values.length = 0;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
if (_arg1 < _values.length){
return ((_arg1 + 1));
};
return (0);
}
public function get length():uint{
return (_values.length);
}
public function removeAt(_arg1:uint){
var _local2:* = _values[_arg1].value;
_values.splice(_arg1, 1);
return (_local2);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextValue(_arg1:int){
return (_values[(_arg1 - 1)]);
}
public function contains(_arg1):Boolean{
var _local2:uint = _values.length;
while (_local2--) {
if (_values[_local2].value == _arg1){
return (true);
};
};
return (false);
}
}
}//package org.flintparticles.common.utils
class Pair {
private var value;
private var priority:Number;
private function Pair(_arg1:Number, _arg2){
this.priority = _arg1;
this.value = _arg2;
}
}
Section 50
//Accelerate (org.flintparticles.twoD.actions.Accelerate)
package org.flintparticles.twoD.actions {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.twoD.particles.*;
public class Accelerate extends ActionBase {
private var _x:Number;
private var _y:Number;
public function Accelerate(_arg1:Number, _arg2:Number){
_x = _arg1;
_y = _arg2;
}
public function set x(_arg1:Number):void{
_x = _arg1;
}
public function get y():Number{
return (_y);
}
public function get x():Number{
return (_x);
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
var _local4:Particle2D = Particle2D(_arg2);
Particle2D(_arg2).velX = (_local4.velX + (_x * _arg3));
_local4.velY = (_local4.velY + (_y * _arg3));
}
public function set y(_arg1:Number):void{
_y = _arg1;
}
}
}//package org.flintparticles.twoD.actions
Section 51
//LinearDrag (org.flintparticles.twoD.actions.LinearDrag)
package org.flintparticles.twoD.actions {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.twoD.particles.*;
public class LinearDrag extends ActionBase {
private var _drag:Number;
public function LinearDrag(_arg1:Number){
_drag = _arg1;
}
public function get drag():Number{
return (_drag);
}
public function set drag(_arg1:Number):void{
_drag = _arg1;
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
var _local4:Particle2D;
_local4 = Particle2D(_arg2);
var _local5:Number = (1 - ((_drag * _arg3) / _local4.mass));
if (_local5 < 0){
_local4.velX = 0;
_local4.velY = 0;
} else {
_local4.velX = (_local4.velX * _local5);
_local4.velY = (_local4.velY * _local5);
};
}
}
}//package org.flintparticles.twoD.actions
Section 52
//Move (org.flintparticles.twoD.actions.Move)
package org.flintparticles.twoD.actions {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.twoD.particles.*;
public class Move extends ActionBase {
private var p:Particle2D;
override public function getDefaultPriority():Number{
return (-10);
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
p = Particle2D(_arg2);
p.x = (p.x + (p.velX * _arg3));
p.y = (p.y + (p.velY * _arg3));
}
}
}//package org.flintparticles.twoD.actions
Section 53
//RandomDrift (org.flintparticles.twoD.actions.RandomDrift)
package org.flintparticles.twoD.actions {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.twoD.particles.*;
public class RandomDrift extends ActionBase {
private var _sizeX:Number;
private var _sizeY:Number;
public function RandomDrift(_arg1:Number, _arg2:Number){
_sizeX = (_arg1 * 2);
_sizeY = (_arg2 * 2);
}
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
var _local4:Particle2D = Particle2D(_arg2);
Particle2D(_arg2).velX = (_local4.velX + (((Math.random() - 0.5) * _sizeX) * _arg3));
_local4.velY = (_local4.velY + (((Math.random() - 0.5) * _sizeY) * _arg3));
}
public function get driftY():Number{
return ((_sizeY / 2));
}
public function set driftY(_arg1:Number):void{
_sizeY = (_arg1 * 2);
}
public function set driftX(_arg1:Number):void{
_sizeX = (_arg1 * 2);
}
public function get driftX():Number{
return ((_sizeX / 2));
}
}
}//package org.flintparticles.twoD.actions
Section 54
//RotateToDirection (org.flintparticles.twoD.actions.RotateToDirection)
package org.flintparticles.twoD.actions {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.twoD.particles.*;
public class RotateToDirection extends ActionBase {
override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{
var _local4:Particle2D = Particle2D(_arg2);
_local4.rotation = Math.atan2(_local4.velY, _local4.velX);
}
}
}//package org.flintparticles.twoD.actions
Section 55
//Emitter2D (org.flintparticles.twoD.emitters.Emitter2D)
package org.flintparticles.twoD.emitters {
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.utils.*;
import org.flintparticles.twoD.particles.*;
public class Emitter2D extends Emitter {
protected var _y:Number;// = 0
public var spaceSort:Boolean;// = false
public var spaceSortedX:Array;
protected var _x:Number;// = 0
protected var _rotation:Number;// = 0
protected static var _creator:ParticleCreator2D = new ParticleCreator2D();
public function Emitter2D(){
_particleFactory = _creator;
}
public function get y():Number{
return (_y);
}
override protected function initParticle(_arg1:Particle):void{
var _local2:Particle2D;
_local2 = Particle2D(_arg1);
_local2.x = _x;
_local2.y = _y;
_local2.rotation = _rotation;
}
override protected function sortParticles():void{
var _local1:int;
var _local2:int;
if (spaceSort){
spaceSortedX = _particles.sortOn("x", (Array.NUMERIC | Array.RETURNINDEXEDARRAY));
_local1 = _particles.length;
_local2 = 0;
while (_local2 < _local1) {
_particles[spaceSortedX[_local2]].sortID = _local2;
_local2++;
};
};
}
public function set x(_arg1:Number):void{
_x = _arg1;
}
public function set rotRadians(_arg1:Number):void{
_rotation = _arg1;
}
public function get x():Number{
return (_x);
}
public function get rotRadians():Number{
return (_rotation);
}
public function set rotation(_arg1:Number):void{
_rotation = Maths.asRadians(_arg1);
}
public function get rotation():Number{
return (Maths.asDegrees(_rotation));
}
public function set y(_arg1:Number):void{
_y = _arg1;
}
public static function get defaultParticleFactory():ParticleFactory{
return (_creator);
}
}
}//package org.flintparticles.twoD.emitters
Section 56
//Position (org.flintparticles.twoD.initializers.Position)
package org.flintparticles.twoD.initializers {
import flash.geom.*;
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.initializers.*;
import org.flintparticles.twoD.zones.*;
import org.flintparticles.twoD.particles.*;
public class Position extends InitializerBase {
private var _zone:Zone2D;
public function Position(_arg1:Zone2D){
_zone = _arg1;
}
override public function initialize(_arg1:Emitter, _arg2:Particle):void{
var _local5:Number;
var _local6:Number;
var _local3:Particle2D = Particle2D(_arg2);
var _local4:Point = _zone.getLocation();
if (_local3.rotation == 0){
_local3.x = (_local3.x + _local4.x);
_local3.y = (_local3.y + _local4.y);
} else {
_local5 = Math.sin(_local3.rotation);
_local6 = Math.cos(_local3.rotation);
_local3.x = (_local3.x + ((_local6 * _local4.x) - (_local5 * _local4.y)));
_local3.y = (_local3.y + ((_local6 * _local4.y) + (_local5 * _local4.x)));
};
}
public function set zone(_arg1:Zone2D):void{
_zone = _arg1;
}
public function get zone():Zone2D{
return (_zone);
}
}
}//package org.flintparticles.twoD.initializers
Section 57
//Velocity (org.flintparticles.twoD.initializers.Velocity)
package org.flintparticles.twoD.initializers {
import flash.geom.*;
import org.flintparticles.common.emitters.*;
import org.flintparticles.common.particles.*;
import org.flintparticles.common.initializers.*;
import org.flintparticles.twoD.zones.*;
import org.flintparticles.twoD.particles.*;
public class Velocity extends InitializerBase {
private var _zone:Zone2D;
public function Velocity(_arg1:Zone2D){
_zone = _arg1;
}
override public function initialize(_arg1:Emitter, _arg2:Particle):void{
var _local3:Particle2D;
var _local5:Number;
var _local6:Number;
_local3 = Particle2D(_arg2);
var _local4:Point = _zone.getLocation();
if (_local3.rotation == 0){
_local3.velX = _local4.x;
_local3.velY = _local4.y;
} else {
_local5 = Math.sin(_local3.rotation);
_local6 = Math.cos(_local3.rotation);
_local3.velX = ((_local6 * _local4.x) - (_local5 * _local4.y));
_local3.velY = ((_local6 * _local4.y) + (_local5 * _local4.x));
};
}
public function set zone(_arg1:Zone2D):void{
_zone = _arg1;
}
public function get zone():Zone2D{
return (_zone);
}
}
}//package org.flintparticles.twoD.initializers
Section 58
//Particle2D (org.flintparticles.twoD.particles.Particle2D)
package org.flintparticles.twoD.particles {
import flash.geom.*;
import org.flintparticles.common.particles.*;
public class Particle2D extends Particle {
public var sortID:uint;// = 0
private var _inertia:Number;
public var velY:Number;// = 0
private var _previousRadius:Number;
private var _previousMass:Number;
public var angVelocity:Number;// = 0
public var x:Number;// = 0
public var y:Number;// = 0
public var velX:Number;// = 0
public var rotation:Number;// = 0
override public function initialize():void{
super.initialize();
x = 0;
y = 0;
velX = 0;
velY = 0;
rotation = 0;
angVelocity = 0;
sortID = 0;
}
public function get matrixTransform():Matrix{
var _local1:Number = (scale * Math.cos(rotation));
var _local2:Number = (scale * Math.sin(rotation));
return (new Matrix(_local1, _local2, -(_local2), _local1, x, y));
}
public function get inertia():Number{
if (((!((mass == _previousMass))) || (!((collisionRadius == _previousRadius))))){
_inertia = (((mass * collisionRadius) * collisionRadius) * 0.5);
_previousMass = mass;
_previousRadius = collisionRadius;
};
return (_inertia);
}
}
}//package org.flintparticles.twoD.particles
Section 59
//ParticleCreator2D (org.flintparticles.twoD.particles.ParticleCreator2D)
package org.flintparticles.twoD.particles {
import org.flintparticles.common.particles.*;
public class ParticleCreator2D implements ParticleFactory {
private var _particles:Array;
public function ParticleCreator2D(){
_particles = new Array();
}
public function clearAllParticles():void{
_particles = new Array();
}
public function disposeParticle(_arg1:Particle):void{
if ((_arg1 is Particle2D)){
_arg1.initialize();
_particles.push(_arg1);
};
}
public function createParticle():Particle{
if (_particles.length){
return (_particles.pop());
};
return (new Particle2D());
}
}
}//package org.flintparticles.twoD.particles
Section 60
//BitmapRenderer (org.flintparticles.twoD.renderers.BitmapRenderer)
package org.flintparticles.twoD.renderers {
import flash.geom.*;
import flash.display.*;
import flash.filters.*;
import org.flintparticles.twoD.particles.*;
import org.flintparticles.common.renderers.*;
public class BitmapRenderer extends SpriteRendererBase {
protected var _canvas:Rectangle;
protected var _bitmap:Bitmap;
protected var _smoothing:Boolean;
protected var _bitmapData:BitmapData;
protected var _postFilters:Array;
protected var _preFilters:Array;
protected var _colorMap:Array;
protected static var ZERO_POINT:Point = new Point(0, 0);
public function BitmapRenderer(_arg1:Rectangle, _arg2:Boolean=false){
mouseEnabled = false;
mouseChildren = false;
_smoothing = _arg2;
_preFilters = new Array();
_postFilters = new Array();
_canvas = _arg1;
createBitmap();
}
public function get canvas():Rectangle{
return (_canvas);
}
public function set canvas(_arg1:Rectangle):void{
_canvas = _arg1;
createBitmap();
}
public function removeFilter(_arg1:BitmapFilter):void{
var _local2:int;
while (_local2 < _preFilters.length) {
if (_preFilters[_local2] == _arg1){
_preFilters.splice(_local2, 1);
return;
};
_local2++;
};
_local2 = 0;
while (_local2 < _postFilters.length) {
if (_postFilters[_local2] == _arg1){
_postFilters.splice(_local2, 1);
return;
};
_local2++;
};
}
override protected function renderParticles(_arg1:Array):void{
var _local2:int;
var _local3:int;
if (!_bitmap){
return;
};
_bitmapData.lock();
_local3 = _preFilters.length;
_local2 = 0;
while (_local2 < _local3) {
_bitmapData.applyFilter(_bitmapData, _bitmapData.rect, BitmapRenderer.ZERO_POINT, _preFilters[_local2]);
_local2++;
};
if ((((_local3 == 0)) && ((_postFilters.length == 0)))){
_bitmapData.fillRect(_bitmap.bitmapData.rect, 0);
};
_local3 = _arg1.length;
if (_local3){
_local2 = _local3;
while (_local2--) {
drawParticle(_arg1[_local2]);
};
};
_local3 = _postFilters.length;
_local2 = 0;
while (_local2 < _local3) {
_bitmapData.applyFilter(_bitmapData, _bitmapData.rect, BitmapRenderer.ZERO_POINT, _postFilters[_local2]);
_local2++;
};
if (_colorMap){
_bitmapData.paletteMap(_bitmapData, _bitmapData.rect, ZERO_POINT, _colorMap[1], _colorMap[2], _colorMap[3], _colorMap[0]);
};
_bitmapData.unlock();
}
protected function drawParticle(_arg1:Particle2D):void{
var _local2:Matrix;
_local2 = _arg1.matrixTransform;
_local2.translate(-(_canvas.x), -(_canvas.y));
_bitmapData.draw(_arg1.image, _local2, _arg1.colorTransform, DisplayObject(_arg1.image).blendMode, null, _smoothing);
}
public function setPaletteMap(_arg1:Array=null, _arg2:Array=null, _arg3:Array=null, _arg4:Array=null):void{
_colorMap = new Array(4);
_colorMap[0] = _arg4;
_colorMap[1] = _arg1;
_colorMap[2] = _arg2;
_colorMap[3] = _arg3;
}
public function clearPaletteMap():void{
_colorMap = null;
}
public function addFilter(_arg1:BitmapFilter, _arg2:Boolean=false):void{
if (_arg2){
_postFilters.push(_arg1);
} else {
_preFilters.push(_arg1);
};
}
protected function createBitmap():void{
if (!_canvas){
return;
};
if (((_bitmap) && (_bitmapData))){
_bitmapData.dispose();
_bitmapData = null;
};
if (_bitmap){
removeChild(_bitmap);
};
_bitmap = new Bitmap(null, "auto", _smoothing);
_bitmapData = new BitmapData(_canvas.width, _canvas.height, true, 0);
_bitmap.bitmapData = _bitmapData;
addChild(_bitmap);
_bitmap.x = _canvas.x;
_bitmap.y = _canvas.y;
}
}
}//package org.flintparticles.twoD.renderers
Section 61
//DiscSectorZone (org.flintparticles.twoD.zones.DiscSectorZone)
package org.flintparticles.twoD.zones {
import flash.geom.*;
public class DiscSectorZone implements Zone2D {
private var _minAngle:Number;
private var _innerRadius:Number;
private var _minAllowed:Number;
private var _outerRadius:Number;
private var _center:Point;
private var _maxAngle:Number;
private var _innerSq:Number;
private var _outerSq:Number;
private static var TWOPI:Number = 6.28318530717959;
public function DiscSectorZone(_arg1:Point, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
if (_arg2 < _arg3){
throw (new Error((((("The outerRadius (" + _arg2) + ") can't be smaller than the innerRadius (") + _arg3) + ") in your DiscSectorZone. N.B. the outerRadius is the second argument in the constructor and the innerRadius is the third argument.")));
};
_center = _arg1;
_innerRadius = _arg3;
_outerRadius = _arg2;
_innerSq = (_innerRadius * _innerRadius);
_outerSq = (_outerRadius * _outerRadius);
_minAngle = _arg4;
_maxAngle = _arg5;
while (_maxAngle > TWOPI) {
_maxAngle = (_maxAngle - TWOPI);
};
while (_maxAngle < 0) {
_maxAngle = (_maxAngle + TWOPI);
};
_minAllowed = (_maxAngle - TWOPI);
if (_arg4 == _arg5){
_minAngle = _maxAngle;
} else {
_minAngle = clamp(_minAngle);
};
}
public function set minAngle(_arg1:Number):void{
_minAngle = clamp(_arg1);
}
public function get innerRadius():Number{
return (_innerRadius);
}
public function getArea():Number{
return (((Math.PI * _outerSq) - (Math.PI * _innerSq)));
}
public function get maxAngle():Number{
return (_maxAngle);
}
public function set innerRadius(_arg1:Number):void{
_innerRadius = _arg1;
_innerSq = (_innerRadius * _innerRadius);
}
public function set outerRadius(_arg1:Number):void{
_outerRadius = _arg1;
_outerSq = (_outerRadius * _outerRadius);
}
public function set maxAngle(_arg1:Number):void{
_maxAngle = _arg1;
while (_maxAngle > TWOPI) {
_maxAngle = (_maxAngle - TWOPI);
};
while (_maxAngle < 0) {
_maxAngle = (_maxAngle + TWOPI);
};
_minAllowed = (_maxAngle - TWOPI);
}
public function contains(_arg1:Number, _arg2:Number):Boolean{
_arg1 = (_arg1 - _center.x);
_arg2 = (_arg2 - _center.y);
var _local3:Number = ((_arg1 * _arg1) + (_arg2 * _arg2));
if ((((_local3 > _outerSq)) || ((_local3 < _innerSq)))){
return (false);
};
var _local4:Number = Math.atan2(_arg2, _arg1);
_local4 = clamp(_local4);
return ((_local4 >= _minAngle));
}
public function get minAngle():Number{
return (_minAngle);
}
public function get center():Point{
return (_center);
}
public function getLocation():Point{
var _local1:Number = Math.random();
var _local2:Point = Point.polar((_innerRadius + ((1 - (_local1 * _local1)) * (_outerRadius - _innerRadius))), (_minAngle + (Math.random() * (_maxAngle - _minAngle))));
_local2.x = (_local2.x + _center.x);
_local2.y = (_local2.y + _center.y);
return (_local2);
}
public function get outerRadius():Number{
return (_outerRadius);
}
public function set center(_arg1:Point):void{
_center = _arg1;
}
private function clamp(_arg1:Number):Number{
while (_arg1 > _maxAngle) {
_arg1 = (_arg1 - TWOPI);
};
while (_arg1 < _minAllowed) {
_arg1 = (_arg1 + TWOPI);
};
return (_arg1);
}
}
}//package org.flintparticles.twoD.zones
Section 62
//DiscZone (org.flintparticles.twoD.zones.DiscZone)
package org.flintparticles.twoD.zones {
import flash.geom.*;
public class DiscZone implements Zone2D {
private var _innerRadius:Number;
private var _outerRadius:Number;
private var _center:Point;
private var _innerSq:Number;
private var _outerSq:Number;
private static const TWOPI:Number = 6.28318530717959;
public function DiscZone(_arg1:Point, _arg2:Number, _arg3:Number=0){
if (_arg2 < _arg3){
throw (new Error((((("The outerRadius (" + _arg2) + ") can't be smaller than the innerRadius (") + _arg3) + ") in your DiscZone. N.B. the outerRadius is the second argument in the constructor and the innerRadius is the third argument.")));
};
_center = _arg1;
_innerRadius = _arg3;
_outerRadius = _arg2;
_innerSq = (_innerRadius * _innerRadius);
_outerSq = (_outerRadius * _outerRadius);
}
public function set outerRadius(_arg1:Number):void{
_outerRadius = _arg1;
_outerSq = (_outerRadius * _outerRadius);
}
public function get center():Point{
return (_center);
}
public function getArea():Number{
return ((Math.PI * (_outerSq - _innerSq)));
}
public function getLocation():Point{
var _local1:Number = Math.random();
var _local2:Point = Point.polar((_innerRadius + ((1 - (_local1 * _local1)) * (_outerRadius - _innerRadius))), (Math.random() * TWOPI));
_local2.x = (_local2.x + _center.x);
_local2.y = (_local2.y + _center.y);
return (_local2);
}
public function get outerRadius():Number{
return (_outerRadius);
}
public function get innerRadius():Number{
return (_innerRadius);
}
public function set innerRadius(_arg1:Number):void{
_innerRadius = _arg1;
_innerSq = (_innerRadius * _innerRadius);
}
public function set center(_arg1:Point):void{
_center = _arg1;
}
public function contains(_arg1:Number, _arg2:Number):Boolean{
_arg1 = (_arg1 - _center.x);
_arg2 = (_arg2 - _center.y);
var _local3:Number = ((_arg1 * _arg1) + (_arg2 * _arg2));
return ((((_local3 <= _outerSq)) && ((_local3 >= _innerSq))));
}
}
}//package org.flintparticles.twoD.zones
Section 63
//Zone2D (org.flintparticles.twoD.zones.Zone2D)
package org.flintparticles.twoD.zones {
import flash.geom.*;
public interface Zone2D {
function getArea():Number;
function getLocation():Point;
function contains(_arg1:Number, _arg2:Number):Boolean;
}
}//package org.flintparticles.twoD.zones
Section 64
//AABRDetector (org.generalrelativity.foam.dynamics.collision.coarse.AABRDetector)
package org.generalrelativity.foam.dynamics.collision.coarse {
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.collision.*;
import flash.utils.*;
import org.generalrelativity.foam.dynamics.collision.geom.*;
import org.generalrelativity.foam.dynamics.collision.fine.sat.*;
import org.generalrelativity.foam.dynamics.enum.*;
public class AABRDetector implements ICoarseCollisionDetector {
private var _staticAABRCache:Dictionary;
private var _dynamicLength:int;
private var _factory:ICollisionFactory;
private var _dynamicCollidables:Array;
private var _staticCollidables:Array;
private var _dynamicAABRCache:Dictionary;
private var _collidablesLength:int;
public function AABRDetector(){
_staticAABRCache = new Dictionary(true);
_dynamicAABRCache = new Dictionary(true);
_staticCollidables = new Array();
_dynamicCollidables = new Array();
_factory = new SATCollisionFactory();
}
public function getCandidates():Array{
var _local2:AABR;
var _local3:AABR;
var _local5:int;
_dynamicAABRCache = new Dictionary(true);
var _local1:Array = new Array();
var _local4 = -1;
var _local6:Array = _dynamicCollidables.concat(_staticCollidables);
while (++_local4 < _dynamicLength) {
_local2 = getBoundedAABR(_dynamicCollidables[_local4]);
_local5 = _local4;
while (++_local5 < _collidablesLength) {
_local3 = getBoundedAABR(_local6[_local5]);
if (_local2.hasCollision(_local3)){
_local1.push(_factory.getCollisionDetector(_local6[_local4], _local6[_local5]));
};
};
};
return (_local1);
}
private function getBoundedAABR(_arg1:IBody):AABR{
if (_dynamicAABRCache[_arg1]){
return (AABR(_dynamicAABRCache[_arg1]));
};
if (_staticAABRCache[_arg1]){
return (AABR(_staticAABRCache[_arg1]));
};
var _local2:AABR = new AABR();
_local2.bound(_arg1);
return (_local2);
}
public function set factory(_arg1:ICollisionFactory):void{
_factory = _arg1;
}
public function removeCollidable(_arg1:ISimulatable):void{
var _local2:int = _dynamicCollidables.indexOf(_arg1);
if (_local2 > -1){
_dynamicCollidables.splice(_dynamicCollidables.indexOf(_arg1), 1);
} else {
_local2 = _staticCollidables.indexOf(_arg1);
if (_local2 > -1){
_staticCollidables.splice(_staticCollidables.indexOf(_arg1), 1);
};
};
_dynamicLength = _dynamicCollidables.length;
_collidablesLength = (_dynamicLength + _staticCollidables.length);
}
public function addCollidable(_arg1:ISimulatable):void{
if (_arg1.mass == Simplification.INFINITE_MASS){
_staticCollidables.push(_arg1);
} else {
_dynamicCollidables.push(_arg1);
_dynamicLength++;
};
_collidablesLength++;
}
public function getDynamicCollidables():Array{
return (_dynamicCollidables);
}
}
}//package org.generalrelativity.foam.dynamics.collision.coarse
Section 65
//CollisionType (org.generalrelativity.foam.dynamics.collision.enum.CollisionType)
package org.generalrelativity.foam.dynamics.collision.enum {
public class CollisionType {
public static const CIRCLE:String = "circle";
public static const ABSTRACT_PARTICLE:String = "abstract_particle";
public static const CUBIC_BEZIER_CURVE:String = "cubic_bezier_curve";
public static const RIGID_BODY:String = "rigid_body";
}
}//package org.generalrelativity.foam.dynamics.collision.enum
Section 66
//AxisProjection (org.generalrelativity.foam.dynamics.collision.fine.sat.AxisProjection)
package org.generalrelativity.foam.dynamics.collision.fine.sat {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
public class AxisProjection {
public var min:Number;
public var max:Number;
public function AxisProjection(_arg1:IBody, _arg2:Vector){
project(_arg1, _arg2);
}
protected function project(_arg1:IBody, _arg2:Vector):void{
var _local3:RotationMatrix = _arg1.rotation;
var _local4:Number = _arg2.dot(_local3.getVectorProduct(Vector(_arg1.vertices[0])).plus(_arg1.position));
min = _local4;
max = _local4;
var _local5:Number = 0;
while (++_local5 < _arg1.vertices.length) {
_local4 = _arg2.dot(_local3.getVectorProduct(Vector(_arg1.vertices[_local5])).plus(_arg1.position));
if (_local4 < min){
min = _local4;
} else {
if (_local4 > max){
max = _local4;
};
};
};
}
public function getDistance(_arg1:AxisProjection):Number{
if (min < _arg1.min){
return ((_arg1.min - max));
};
return ((min - _arg1.max));
}
}
}//package org.generalrelativity.foam.dynamics.collision.fine.sat
Section 67
//BezierDetector (org.generalrelativity.foam.dynamics.collision.fine.sat.BezierDetector)
package org.generalrelativity.foam.dynamics.collision.fine.sat {
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.collision.*;
import org.generalrelativity.foam.dynamics.element.body.*;
public class BezierDetector implements IFineCollisionDetector {
protected var body2:IBody;
protected var detectors:Array;
protected var curve:CubicBezierCurve;
public function BezierDetector(_arg1:CubicBezierCurve, _arg2:IBody){
this.curve = _arg1;
this.body2 = _arg2;
}
public function hasCollision():Boolean{
var _local1:IFineCollisionDetector;
var _local2:IBody;
detectors = new Array();
for each (_local2 in curve.lines) {
if ((body2 is Circle)){
_local1 = new CirclePolygonDetector(Circle(body2), _local2);
} else {
_local1 = new PolygonPolygonDetector(_local2, body2);
};
if (_local1.hasCollision()){
detectors.push(_local1);
};
};
return ((detectors.length > 0));
}
public function getContacts():Array{
var _local1:Array = new Array();
while (detectors.length) {
_local1 = _local1.concat(IFineCollisionDetector(detectors.pop()).getContacts());
};
return (_local1);
}
}
}//package org.generalrelativity.foam.dynamics.collision.fine.sat
Section 68
//CircleAxisProjection (org.generalrelativity.foam.dynamics.collision.fine.sat.CircleAxisProjection)
package org.generalrelativity.foam.dynamics.collision.fine.sat {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.element.body.*;
public class CircleAxisProjection extends AxisProjection {
public function CircleAxisProjection(_arg1:Circle, _arg2:Vector){
super(_arg1, _arg2);
}
override protected function project(_arg1:IBody, _arg2:Vector):void{
var _local3:Circle = Circle(_arg1);
var _local4:Number = _arg2.dot(_local3.position);
min = (_local4 - _local3.radius);
max = (_local4 + _local3.radius);
}
}
}//package org.generalrelativity.foam.dynamics.collision.fine.sat
Section 69
//CircleCircleDetector (org.generalrelativity.foam.dynamics.collision.fine.sat.CircleCircleDetector)
package org.generalrelativity.foam.dynamics.collision.fine.sat {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.collision.*;
import org.generalrelativity.foam.dynamics.element.body.*;
public class CircleCircleDetector implements IFineCollisionDetector {
public var circle1:Circle;
public var dist:Number;
public var circle2:Circle;
public function CircleCircleDetector(_arg1:Circle, _arg2:Circle){
this.circle1 = _arg1;
this.circle2 = _arg2;
}
public function getContacts():Array{
dist = Math.sqrt(dist);
var _local1:Vector = circle1.position.minus(circle2.position);
var _local2:Number = ((circle1.radius + circle2.radius) - dist);
_local1.normalize();
var _local3:Vector = _local1.times(_local2);
_local3.dividedByEquals((circle1.inverseMass + circle2.inverseMass));
circle1.x = (circle1.x + (_local3.x * circle1.inverseMass));
circle1.y = (circle1.y + (_local3.y * circle1.inverseMass));
circle2.x = (circle2.x - (_local3.x * circle2.inverseMass));
circle2.y = (circle2.y - (_local3.y * circle2.inverseMass));
var _local4:Vector = circle1.position.minus(_local1.times(circle1.radius));
return ([new Contact(_local4, circle1, circle2, _local1)]);
}
public function hasCollision():Boolean{
var _local1:Vector = circle1.position.minus(circle2.position);
dist = _local1.dot(_local1);
return ((dist <= ((circle1.radius + circle2.radius) * (circle1.radius + circle2.radius))));
}
}
}//package org.generalrelativity.foam.dynamics.collision.fine.sat
Section 70
//CirclePolygonDetector (org.generalrelativity.foam.dynamics.collision.fine.sat.CirclePolygonDetector)
package org.generalrelativity.foam.dynamics.collision.fine.sat {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.collision.*;
import org.generalrelativity.foam.dynamics.element.body.*;
public class CirclePolygonDetector implements IFineCollisionDetector {
public var body:IBody;
public var minDistance:Number;
public var penetrationAxis:Vector;
public var circle:Circle;
public function CirclePolygonDetector(_arg1:Circle, _arg2:IBody){
this.circle = _arg1;
this.body = _arg2;
}
public function getContacts():Array{
var _local1:Vector = circle.position.minus(body.position);
if (_local1.dot(penetrationAxis) < 0){
penetrationAxis.negate();
};
var _local2:Vector = penetrationAxis.times(minDistance);
_local2.dividedByEquals((circle.inverseMass + body.inverseMass));
if ((((circle.foamLabel == 2)) && ((body.foamLabel == 3)))){
if (circle.foamSubLabel == 13){
switch (body.foamSubLabel){
case 3:
break;
default:
circle.doNotCollide = true;
break;
};
};
if (circle.foamSubLabel == 14){
switch (body.foamSubLabel){
case 1:
circle.doNotCollide = true;
break;
case 3:
circle.doNotCollide = true;
break;
};
};
};
if (!circle.doNotCollide){
circle.x = (circle.x + (_local2.x * circle.inverseMass));
circle.y = (circle.y + (_local2.y * circle.inverseMass));
};
if (!body.doNotCollide){
body.x = (body.x - (_local2.x * body.inverseMass));
body.y = (body.y - (_local2.y * body.inverseMass));
};
var _local3:Vector = circle.position.minus(penetrationAxis.times(circle.radius));
return ([new Contact(_local3, circle, body, penetrationAxis)]);
}
public function hasCollision():Boolean{
var _local1:Vector;
var _local2:CircleAxisProjection;
var _local3:AxisProjection;
var _local8:Vector;
var _local10:Vector;
var _local11:Vector;
var _local12:Number;
var _local13:Vector;
var _local14:Number;
if ((((circle.inverseMass == 0)) && ((body.inverseMass == 0)))){
return (false);
};
var _local4:RotationMatrix = body.rotation;
minDistance = Number.MAX_VALUE;
var _local5:Array = body.edges;
var _local6:int = _local5.length;
var _local7:Number = -1;
while (++_local7 < _local6) {
_local1 = _local4.getVectorProduct((_local5[_local7] as Vector));
_local11 = new Vector(-(_local1.y), _local1.x);
_local11.normalize();
_local2 = new CircleAxisProjection(circle, _local11);
_local3 = new AxisProjection(body, _local11);
_local12 = _local2.getDistance(_local3);
if (_local12 > 0){
return (false);
};
_local12 = Math.abs(_local12);
if (_local12 < minDistance){
minDistance = _local12;
penetrationAxis = _local11;
};
};
var _local9:Number = Number.MAX_VALUE;
for each (_local10 in body.vertices) {
_local8 = body.rotation.getVectorProduct(_local10).plus(body.position);
_local13 = circle.position.minus(_local8);
_local14 = ((_local13.x * _local13.x) + (_local13.y * _local13.y));
if (_local14 < _local9){
_local9 = _local14;
_local11 = _local13;
};
};
_local11.normalize();
_local2 = new CircleAxisProjection(circle, _local11);
_local3 = new AxisProjection(body, _local11);
_local12 = _local3.getDistance(_local2);
if (_local12 > 0){
return (false);
};
_local12 = Math.abs(_local12);
if (_local12 < minDistance){
minDistance = _local12;
penetrationAxis = _local11;
};
return (true);
}
}
}//package org.generalrelativity.foam.dynamics.collision.fine.sat
Section 71
//PointPolygonDetector (org.generalrelativity.foam.dynamics.collision.fine.sat.PointPolygonDetector)
package org.generalrelativity.foam.dynamics.collision.fine.sat {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.element.body.*;
public class PointPolygonDetector {
protected var point:Vector;
protected var body:IBody;
protected static const EPSILON:Number = 15;
public function PointPolygonDetector(_arg1:IBody, _arg2:Vector){
this.body = _arg1;
this.point = _arg2;
}
public function hasCollision():Boolean{
var _local1:Vector;
var _local4:Vector;
var _local5:AxisProjection;
var _local6:Number;
var _local8:Number;
if ((body is Circle)){
_local8 = point.minus(body.position).magnitude;
if (_local8 <= Circle(body).radius){
return (true);
};
return (false);
};
var _local2:RotationMatrix = body.rotation;
var _local3:int = body.edges.length;
var _local7:Number = -1;
while (++_local7 < _local3) {
_local1 = _local2.getVectorProduct((body.edges[_local7] as Vector));
_local4 = new Vector(-(_local1.y), _local1.x);
_local4.normalize();
_local5 = new AxisProjection(body, _local4);
_local6 = _local4.dot(point);
if (((((_local6 + PointPolygonDetector.EPSILON) < _local5.min)) || (((_local6 - PointPolygonDetector.EPSILON) > _local5.max)))){
return (false);
};
};
_local4 = point.minus(body.position);
_local4.normalize();
_local5 = new AxisProjection(body, _local4);
_local6 = _local4.dot(point);
if (((((_local6 + PointPolygonDetector.EPSILON) < _local5.min)) || (((_local6 - PointPolygonDetector.EPSILON) > _local5.max)))){
return (false);
};
return (true);
}
}
}//package org.generalrelativity.foam.dynamics.collision.fine.sat
Section 72
//PolygonPolygonDetector (org.generalrelativity.foam.dynamics.collision.fine.sat.PolygonPolygonDetector)
package org.generalrelativity.foam.dynamics.collision.fine.sat {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.collision.*;
import flash.utils.*;
public class PolygonPolygonDetector implements IFineCollisionDetector {
public var minDistance:Number;
public var penetrationAxis:Vector;
public var body1:IBody;
public var body2:IBody;
private var swapBodies:Boolean;
public static const EPSILON:Number = 0.1;
public function PolygonPolygonDetector(_arg1:IBody, _arg2:IBody){
this.body1 = _arg1;
this.body2 = _arg2;
swapBodies = true;
}
public function getContacts():Array{
var _local4:Array;
var _local7:Vector;
var _local8:Array;
var _local9:Array;
var _local10:IBody;
var _local11:Vector;
var _local12:Number;
var _local13:Vector;
var _local14:Dictionary;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Array;
if (swapBodies){
_local10 = body1;
body1 = body2;
body2 = _local10;
};
var _local1:Vector = body1.position.minus(body2.position);
if (_local1.dot(penetrationAxis) < 0){
penetrationAxis.negate();
};
var _local2:Vector = penetrationAxis.times(minDistance);
_local2.dividedByEquals((body1.inverseMass + body2.inverseMass));
body1.x = (body1.x + (_local2.x * body1.inverseMass));
body1.y = (body1.y + (_local2.y * body1.inverseMass));
body2.x = (body2.x - (_local2.x * body2.inverseMass));
body2.y = (body2.y - (_local2.y * body2.inverseMass));
var _local3:Number = Number.MAX_VALUE;
var _local5:Vector = penetrationAxis.clone();
var _local6:RotationMatrix = body1.rotation;
for each (_local7 in body1.vertices) {
_local11 = _local6.getVectorProduct(_local7).plus(body1.position);
_local12 = _local5.dot(_local11);
if (_local12 < (_local3 + PolygonPolygonDetector.EPSILON)){
if (Math.abs((_local3 - _local12)) < PolygonPolygonDetector.EPSILON){
_local4 = [_local4[0], _local11];
} else {
_local4 = [_local11];
_local3 = _local12;
};
};
};
if (_local4.length == 1){
return ([new Contact(_local4[0], body1, body2, penetrationAxis)]);
};
_local3 = Number.MAX_VALUE;
_local5.negate();
_local6 = body2.rotation;
for each (_local7 in body2.vertices) {
_local11 = _local6.getVectorProduct(_local7).plus(body2.position);
_local12 = _local5.dot(_local11);
if (_local12 < (_local3 + PolygonPolygonDetector.EPSILON)){
if (Math.abs((_local3 - _local12)) < PolygonPolygonDetector.EPSILON){
_local8 = [_local8[0], _local11];
} else {
_local8 = [_local11];
_local3 = _local12;
};
};
};
_local9 = new Array();
if (_local8.length == 2){
_local13 = penetrationAxis.getPerp().getUnit();
_local14 = new Dictionary(true);
_local15 = _local13.dot((_local4[0] as Vector));
_local16 = _local13.dot((_local4[1] as Vector));
_local17 = _local13.dot((_local8[0] as Vector));
_local18 = _local13.dot((_local8[1] as Vector));
_local14[_local15] = _local4[0];
_local14[_local16] = _local4[1];
_local14[_local17] = _local8[0];
_local14[_local18] = _local8[1];
_local19 = [_local15, _local16, _local17, _local18];
_local19.sort(Array.DESCENDING);
_local9.push(new Contact(_local14[_local19[1]], body1, body2, penetrationAxis), new Contact(_local14[_local19[2]], body1, body2, penetrationAxis));
} else {
_local9.push(new Contact(_local8[0], body1, body2, penetrationAxis));
};
return (_local9);
}
public function hasCollision():Boolean{
var _local1:Vector;
var _local2:AxisProjection;
var _local3:AxisProjection;
var _local8:Vector;
var _local9:Number;
if ((((body1.inverseMass == 0)) && ((body2.inverseMass == 0)))){
return (false);
};
var _local4:RotationMatrix = body1.rotation;
minDistance = Number.MAX_VALUE;
var _local5:Array = body1.edges.concat(body2.edges);
var _local6:int = _local5.length;
var _local7:Number = -1;
while (++_local7 < _local6) {
if (_local7 == body1.edges.length){
_local4 = body2.rotation;
};
_local1 = _local4.getVectorProduct((_local5[_local7] as Vector));
_local8 = new Vector(-(_local1.y), _local1.x);
_local8.normalize();
_local2 = new AxisProjection(body1, _local8);
_local3 = new AxisProjection(body2, _local8);
_local9 = _local2.getDistance(_local3);
if (_local9 > 0){
return (false);
};
_local9 = ((_local9 < 0)) ? -(_local9) : _local9;
if (_local9 < minDistance){
minDistance = _local9;
penetrationAxis = _local8;
if (((swapBodies) && ((_local7 > body1.edges.length)))){
swapBodies = false;
};
};
};
return (true);
}
}
}//package org.generalrelativity.foam.dynamics.collision.fine.sat
Section 73
//SATCollisionFactory (org.generalrelativity.foam.dynamics.collision.fine.sat.SATCollisionFactory)
package org.generalrelativity.foam.dynamics.collision.fine.sat {
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.collision.*;
import flash.utils.*;
import org.generalrelativity.foam.dynamics.element.body.*;
import org.generalrelativity.foam.dynamics.collision.enum.*;
public class SATCollisionFactory implements ICollisionFactory {
private var detectorMap:Dictionary;
public function SATCollisionFactory(){
buildDetectorMap();
}
private function buildDetectorMap():void{
detectorMap = new Dictionary(true);
var _local1:Dictionary = new Dictionary(true);
_local1[CollisionType.CIRCLE] = CirclePolygonDetector;
_local1[CollisionType.CUBIC_BEZIER_CURVE] = BezierDetector;
_local1[CollisionType.RIGID_BODY] = PolygonPolygonDetector;
var _local2:Dictionary = new Dictionary(true);
_local2[CollisionType.RIGID_BODY] = CirclePolygonDetector;
_local2[CollisionType.CIRCLE] = CircleCircleDetector;
_local2[CollisionType.CUBIC_BEZIER_CURVE] = BezierDetector;
var _local3:Dictionary = new Dictionary(true);
_local3[CollisionType.RIGID_BODY] = BezierDetector;
_local3[CollisionType.CIRCLE] = BezierDetector;
detectorMap[CollisionType.RIGID_BODY] = _local1;
detectorMap[CollisionType.CIRCLE] = _local2;
detectorMap[CollisionType.CUBIC_BEZIER_CURVE] = _local3;
}
public function getCollisionDetector(_arg1:ISimulatable, _arg2:ISimulatable):IFineCollisionDetector{
var _local3:Class = detectorMap[_arg1.collisionTypeID][_arg2.collisionTypeID];
if ((((_arg2 is Circle)) || ((_arg2 is CubicBezierCurve)))){
return (IFineCollisionDetector(new _local3(_arg2, _arg1)));
};
return (IFineCollisionDetector(new _local3(_arg1, _arg2)));
}
}
}//package org.generalrelativity.foam.dynamics.collision.fine.sat
Section 74
//AABR (org.generalrelativity.foam.dynamics.collision.geom.AABR)
package org.generalrelativity.foam.dynamics.collision.geom {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.element.body.*;
public class AABR {
public var minX:Number;
public var minY:Number;
public var maxX:Number;
public var maxY:Number;
public function bound(_arg1:IBody):void{
var _local2:Number;
var _local3:RotationMatrix;
var _local4:int;
var _local5:Vector;
if ((_arg1 is Circle)){
_local2 = Circle(_arg1).radius;
minX = (_arg1.x - _local2);
maxX = (_arg1.x + _local2);
minY = (_arg1.y - _local2);
maxY = (_arg1.y + _local2);
} else {
minX = (maxX = _arg1.x);
minY = (maxY = _arg1.y);
_local3 = _arg1.rotation;
_local4 = -1;
for each (_local5 in _arg1.vertices) {
updateBounds(_arg1.position.plus(_local3.getVectorProduct(_local5)));
};
};
}
public function hasCollision(_arg1:AABR):Boolean{
if (maxX < _arg1.minX){
return (false);
};
if (maxY < _arg1.minY){
return (false);
};
if (_arg1.maxX < minX){
return (false);
};
if (_arg1.maxY < minY){
return (false);
};
return (true);
}
private function updateBounds(_arg1:Vector):void{
if (_arg1.x < minX){
minX = _arg1.x;
} else {
if (_arg1.x > maxX){
maxX = _arg1.x;
};
};
if (_arg1.y < minY){
minY = _arg1.y;
} else {
if (_arg1.y > maxY){
maxY = _arg1.y;
};
};
}
}
}//package org.generalrelativity.foam.dynamics.collision.geom
Section 75
//CollisionResolver (org.generalrelativity.foam.dynamics.collision.CollisionResolver)
package org.generalrelativity.foam.dynamics.collision {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
public class CollisionResolver {
public static function resolve(_arg1:Array):void{
var _local2:IBody;
var _local3:IBody;
var _local4:Vector;
var _local5:Vector;
var _local8:Contact;
var _local9:Vector;
var _local10:Vector;
var _local11:Vector;
var _local12:Vector;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Vector;
var _local17:Vector;
var _local18:Vector;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Vector;
var _local23:Number;
var _local24:Vector;
var _local25:Number;
var _local26:Vector;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local6:Number = 0;
var _local7:Boolean;
for each (_local8 in _arg1) {
_local2 = _local8.body1;
_local3 = _local8.body2;
if (_local2.foamLabel == 2){
_local2.isHit = false;
if (_local3.foamLabel == 4){
_local2.lifeLeft = (_local2.lifeLeft - 100);
} else {
switch (_local2.foamSubLabel){
case 12:
switch (_local3.foamSubLabel){
case 99:
_local3.isBurned = true;
_local3.lifeLeft = (_local3.lifeLeft - 500);
_local2.lifeLeft = (_local2.lifeLeft - 100);
break;
case 0:
_local3.lifeLeft = (_local3.lifeLeft - 100);
_local2.doNotCollide = true;
break;
case 1:
_local3.turnToStone = true;
_local3.lifeLeft = 60;
_local2.lifeLeft = (_local2.lifeLeft - 100);
break;
case 2:
_local2.lifeLeft = (_local2.lifeLeft - 100);
break;
case 3:
_local2.lifeLeft = (_local2.lifeLeft - 100);
break;
case 4:
_local3.lifeLeft = (_local3.lifeLeft - 100);
_local2.doNotCollide = true;
break;
};
break;
case 13:
switch (_local3.foamSubLabel){
case 99:
_local3.isFrozen = true;
_local3.lifeLeft = (_local3.lifeLeft - 500);
_local2.doNotCollide = true;
break;
case 0:
_local3.isFrozen = true;
_local2.doNotCollide = true;
break;
case 1:
_local3.isFrozen = true;
_local2.doNotCollide = true;
break;
case 2:
_local3.isFrozen = true;
_local2.doNotCollide = true;
break;
case 3:
_local2.lifeLeft = (_local2.lifeLeft - 100);
break;
case 4:
_local2.doNotCollide = true;
break;
};
break;
case 14:
switch (_local3.foamSubLabel){
case 99:
_local3.isShocked = true;
_local3.lifeLeft = (_local3.lifeLeft - 500);
_local2.lifeLeft = (_local2.lifeLeft - 100);
break;
case 0:
_local3.lifeLeft = (_local3.lifeLeft - 100);
_local2.lifeLeft = (_local2.lifeLeft - 100);
break;
case 1:
_local2.doNotCollide = true;
break;
case 2:
_local2.lifeLeft = (_local2.lifeLeft - 100);
break;
case 3:
_local2.doNotCollide = true;
break;
case 4:
_local3.lifeLeft = (_local3.lifeLeft - 100);
_local2.lifeLeft = (_local2.lifeLeft - 100);
break;
};
break;
case 15:
_local3.lifeLeft = (_local3.lifeLeft - 14);
if (((!((_local3.foamSubLabel == 99))) || (!((_local3.foamLabel == 4))))){
_local2.lifeLeft = (_local2.lifeLeft - Math.max(_local3.lifeLeft, 20));
} else {
_local2.lifeLeft = (_local2.lifeLeft - 100);
};
if (_local2.lifeLeft > 0){
_local2.isHit = true;
};
break;
case 16:
_local3.lifeLeft = (_local3.lifeLeft - 20);
if (((!((_local3.foamSubLabel == 99))) || (!((_local3.foamLabel == 4))))){
_local2.lifeLeft = (_local2.lifeLeft - Math.max(_local3.lifeLeft, 20));
} else {
_local2.lifeLeft = (_local2.lifeLeft - 100);
};
if (_local2.lifeLeft > 0){
_local2.isHit = true;
};
break;
case 17:
_local3.lifeLeft = (_local3.lifeLeft - 27);
if (((!((_local3.foamSubLabel == 99))) || (!((_local3.foamLabel == 4))))){
_local2.lifeLeft = (_local2.lifeLeft - Math.max(_local3.lifeLeft, 20));
} else {
_local2.lifeLeft = (_local2.lifeLeft - 100);
};
if (_local2.lifeLeft > 0){
_local2.isHit = true;
};
break;
case 18:
_local3.lifeLeft = (_local3.lifeLeft - 35);
if (((!((_local3.foamSubLabel == 99))) || (!((_local3.foamLabel == 4))))){
if ((((_local3.foamSubLabel == 0)) || ((_local3.foamSubLabel == 1)))){
_local2.doNotCollide = true;
};
_local2.lifeLeft = (_local2.lifeLeft - Math.max(_local3.lifeLeft, 20));
} else {
_local2.lifeLeft = (_local2.lifeLeft - 100);
};
if (_local2.lifeLeft > 0){
_local2.isHit = true;
};
break;
case 19:
_local3.lifeLeft = (_local3.lifeLeft - 45);
if (((!((_local3.foamSubLabel == 99))) || (!((_local3.foamLabel == 4))))){
if ((((_local3.foamSubLabel >= 0)) && ((_local3.foamSubLabel <= 2)))){
_local2.doNotCollide = true;
};
_local2.lifeLeft = (_local2.lifeLeft - Math.max(_local3.lifeLeft, 20));
} else {
_local2.lifeLeft = (_local2.lifeLeft - 100);
};
if (_local2.lifeLeft > 0){
_local2.isHit = true;
};
break;
};
};
};
if (_local3.foamLabel == 2){
_local3.isHit = false;
if (_local2.foamLabel == 4){
_local3.lifeLeft = (_local3.lifeLeft - 100);
} else {
switch (_local3.foamSubLabel){
case 12:
switch (_local2.foamSubLabel){
case 99:
_local2.isBurned = true;
_local2.lifeLeft = (_local2.lifeLeft - 500);
_local3.lifeLeft = (_local3.lifeLeft - 100);
break;
case 0:
_local2.lifeLeft = (_local2.lifeLeft - 100);
_local3.doNotCollide = true;
break;
case 1:
_local2.turnToStone = true;
_local2.lifeLeft = 60;
_local3.lifeLeft = (_local3.lifeLeft - 100);
break;
case 2:
_local3.lifeLeft = (_local3.lifeLeft - 100);
break;
case 3:
_local3.lifeLeft = (_local3.lifeLeft - 100);
break;
case 4:
_local2.lifeLeft = (_local2.lifeLeft - 100);
_local3.doNotCollide = true;
break;
};
break;
case 13:
switch (_local2.foamSubLabel){
case 99:
_local2.isFrozen = true;
_local2.lifeLeft = (_local2.lifeLeft - 500);
_local3.lifeLeft = (_local3.lifeLeft - 100);
break;
case 0:
_local2.isFrozen = true;
_local3.doNotCollide = true;
break;
case 1:
_local2.isFrozen = true;
_local3.doNotCollide = true;
break;
case 2:
_local2.isFrozen = true;
_local3.doNotCollide = true;
break;
case 3:
_local3.lifeLeft = (_local3.lifeLeft - 100);
break;
case 5:
_local3.doNotCollide = true;
break;
};
break;
case 14:
switch (_local2.foamSubLabel){
case 99:
_local2.isShocked = true;
_local2.lifeLeft = (_local2.lifeLeft - 500);
_local3.lifeLeft = (_local3.lifeLeft - 100);
break;
case 0:
_local2.lifeLeft = (_local2.lifeLeft - 100);
_local3.lifeLeft = (_local3.lifeLeft - 100);
break;
case 1:
_local3.doNotCollide = true;
break;
case 2:
_local3.lifeLeft = (_local3.lifeLeft - 100);
break;
case 3:
_local3.doNotCollide = true;
break;
case 4:
_local2.lifeLeft = (_local2.lifeLeft - 100);
_local3.lifeLeft = (_local3.lifeLeft - 100);
break;
};
break;
case 15:
_local2.lifeLeft = (_local2.lifeLeft - 14);
if (((!((_local2.foamSubLabel == 99))) || (!((_local2.foamLabel == 4))))){
_local3.lifeLeft = (_local3.lifeLeft - Math.max(_local2.lifeLeft, 20));
} else {
_local3.lifeLeft = (_local3.lifeLeft - 100);
};
if (_local3.lifeLeft > 0){
_local3.isHit = true;
};
break;
case 16:
_local2.lifeLeft = (_local2.lifeLeft - 20);
if (((!((_local2.foamSubLabel == 99))) || (!((_local2.foamLabel == 4))))){
_local3.lifeLeft = (_local3.lifeLeft - Math.max(_local2.lifeLeft, 20));
} else {
_local3.lifeLeft = (_local3.lifeLeft - 100);
};
if (_local3.lifeLeft > 0){
_local3.isHit = true;
};
break;
case 17:
_local2.lifeLeft = (_local2.lifeLeft - 27);
if (((!((_local2.foamSubLabel == 99))) || (!((_local2.foamLabel == 4))))){
_local3.lifeLeft = (_local3.lifeLeft - Math.max(_local2.lifeLeft, 20));
} else {
_local3.lifeLeft = (_local3.lifeLeft - 100);
};
if (_local3.lifeLeft > 0){
_local3.isHit = true;
};
break;
case 18:
_local2.lifeLeft = (_local2.lifeLeft - 35);
if (((!((_local2.foamSubLabel == 99))) || (!((_local2.foamLabel == 4))))){
if ((((_local2.foamSubLabel == 0)) || ((_local2.foamSubLabel == 1)))){
_local3.doNotCollide = true;
};
_local3.lifeLeft = (_local3.lifeLeft - Math.max(_local2.lifeLeft, 20));
} else {
_local3.lifeLeft = (_local3.lifeLeft - 100);
};
if (_local3.lifeLeft > 0){
_local3.isHit = true;
};
break;
case 19:
_local2.lifeLeft = (_local2.lifeLeft - 45);
if (((!((_local2.foamSubLabel == 99))) || (!((_local2.foamLabel == 4))))){
if ((((_local2.foamSubLabel >= 0)) && ((_local2.foamSubLabel <= 2)))){
_local3.doNotCollide = true;
};
_local3.lifeLeft = (_local3.lifeLeft - Math.max(_local2.lifeLeft, 20));
} else {
_local3.lifeLeft = (_local3.lifeLeft - 100);
};
if (_local3.lifeLeft > 0){
_local3.isHit = true;
};
break;
};
};
};
_local9 = _local8.position.minus(_local8.body1.position);
_local10 = _local8.position.minus(_local8.body2.position);
_local11 = _local9.getPerp();
_local12 = _local10.getPerp();
_local13 = _local11.dot(_local8.normal);
_local14 = _local12.dot(_local8.normal);
_local15 = _local8.normal.dot(_local8.normal.times((_local2.inverseMass + _local3.inverseMass)));
_local15 = (_local15 + ((_local13 * _local13) * _local2.inverseI));
_local15 = (_local15 + ((_local14 * _local14) * _local3.inverseI));
_local16 = _local11.times(_local2.av).plus(_local2.velocity);
_local17 = _local12.times(_local3.av).plus(_local3.velocity);
_local18 = _local16.minus(_local17);
_local19 = _local18.dot(_local8.normal);
_local20 = ((_local2.elasticity + _local3.elasticity) * 0.5);
_local21 = ((-((1 + _local20)) * _local19) / _local15);
_local22 = _local8.normal.times((_local21 * _local2.inverseMass));
_local23 = (_local11.dot(_local8.normal.times(_local21)) * _local2.inverseI);
_local24 = _local8.normal.times((-(_local21) * _local3.inverseMass));
_local25 = (_local12.dot(_local8.normal.times(-(_local21))) * _local3.inverseI);
_local26 = _local8.normal.getPerp();
_local27 = _local11.dot(_local26);
_local28 = _local12.dot(_local26);
_local15 = _local26.dot(_local26.times((_local2.inverseMass + _local3.inverseMass)));
_local15 = (_local15 + ((_local27 * _local27) * _local2.inverseI));
_local15 = (_local15 + ((_local28 * _local28) * _local3.inverseI));
_local29 = _local18.dot(_local26);
_local21 = (((-(_local29) / _local15) * (_local2.friction + _local3.friction)) * 0.5);
_local22.plusEquals(_local26.times((_local21 * _local2.inverseMass)));
_local23 = (_local23 + (_local11.dot(_local26.times(_local21)) * _local2.inverseI));
_local24.plusEquals(_local26.times((-(_local21) * _local3.inverseMass)));
_local25 = (_local25 + (_local12.dot(_local26.times(-(_local21))) * _local3.inverseI));
if (!_local2.doNotCollide){
_local2.vx = (_local2.vx + _local22.x);
_local2.vy = (_local2.vy + _local22.y);
_local2.av = (_local2.av + _local23);
};
_local2.doNotCollide = false;
if (!_local3.doNotCollide){
_local3.vx = (_local3.vx + _local24.x);
_local3.vy = (_local3.vy + _local24.y);
_local3.av = (_local3.av + _local25);
};
_local3.doNotCollide = false;
if (_local2.foamLabel == 1){
if (_local3.foamLabel == 5){
_local2.lifeLeft = 0;
};
_local4 = _local22;
_local4.x = Math.abs(_local4.x);
_local4.y = Math.abs(_local4.y);
if ((((_local4.x > 9)) || ((_local4.y > 9)))){
if (!_local7){
_local7 = true;
if (_local4.x > 9){
_local6 = _local4.x;
};
if (_local4.y > 9){
if (_local4.y > _local6){
_local6 = _local4.y;
};
};
_local6 = (_local6 / 2);
_local2.lifeLeft = (_local2.lifeLeft - _local6);
if (_local2.lifeLeft < 0){
_local2.lifeLeft = 0;
};
};
};
} else {
if (_local3.foamLabel == 1){
if (_local2.foamLabel == 5){
_local3.lifeLeft = 0;
};
_local4 = _local24;
_local4.x = Math.abs(_local4.x);
_local4.y = Math.abs(_local4.y);
if ((((_local4.x > 9)) || ((_local4.y > 9)))){
if (!_local7){
_local7 = true;
if (_local4.x > 9){
_local6 = _local4.x;
};
if (_local4.y > 9){
if (_local4.y > _local6){
_local6 = _local4.y;
};
};
_local6 = (_local6 / 2);
_local3.lifeLeft = (_local3.lifeLeft - _local6);
if (_local3.lifeLeft < 0){
_local3.lifeLeft = 0;
};
};
};
};
};
};
}
}
}//package org.generalrelativity.foam.dynamics.collision
Section 76
//Contact (org.generalrelativity.foam.dynamics.collision.Contact)
package org.generalrelativity.foam.dynamics.collision {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
public class Contact {
public var body2:IBody;
public var normal:Vector;
public var position:Vector;
public var body1:IBody;
public function Contact(_arg1:Vector, _arg2:IBody, _arg3:IBody, _arg4:Vector){
this.position = _arg1;
this.body1 = _arg2;
this.body2 = _arg3;
this.normal = _arg4;
}
}
}//package org.generalrelativity.foam.dynamics.collision
Section 77
//ICoarseCollisionDetector (org.generalrelativity.foam.dynamics.collision.ICoarseCollisionDetector)
package org.generalrelativity.foam.dynamics.collision {
import org.generalrelativity.foam.dynamics.element.*;
public interface ICoarseCollisionDetector {
function addCollidable(_arg1:ISimulatable):void;
function set factory(_arg1:ICollisionFactory):void;
function removeCollidable(_arg1:ISimulatable):void;
function getCandidates():Array;
function getDynamicCollidables():Array;
}
}//package org.generalrelativity.foam.dynamics.collision
Section 78
//ICollisionFactory (org.generalrelativity.foam.dynamics.collision.ICollisionFactory)
package org.generalrelativity.foam.dynamics.collision {
import org.generalrelativity.foam.dynamics.element.*;
public interface ICollisionFactory {
function getCollisionDetector(_arg1:ISimulatable, _arg2:ISimulatable):IFineCollisionDetector;
}
}//package org.generalrelativity.foam.dynamics.collision
Section 79
//IFineCollisionDetector (org.generalrelativity.foam.dynamics.collision.IFineCollisionDetector)
package org.generalrelativity.foam.dynamics.collision {
public interface IFineCollisionDetector {
function hasCollision():Boolean;
function getContacts():Array;
}
}//package org.generalrelativity.foam.dynamics.collision
Section 80
//Circle (org.generalrelativity.foam.dynamics.element.body.Circle)
package org.generalrelativity.foam.dynamics.element.body {
import org.generalrelativity.foam.dynamics.enum.*;
import org.generalrelativity.foam.dynamics.collision.enum.*;
public class Circle extends RigidBody {
public var radius:Number;
public function Circle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=100, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0.5, _arg8:Number=0.15, _arg9:Number=0, _arg10:Number=0){
this.radius = _arg3;
super(_arg1, _arg2, _arg4, null, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
}
override protected function calculateInertiaTensor():void{
if (mass == Simplification.INFINITE_MASS){
_I = Simplification.INFINITE_MASS;
_inverseI = 0;
return;
};
_I = ((radius * radius) * mass);
_inverseI = (1 / _I);
}
override public function get collisionTypeID():String{
return (CollisionType.CIRCLE);
}
}
}//package org.generalrelativity.foam.dynamics.element.body
Section 81
//CubicBezierCurve (org.generalrelativity.foam.dynamics.element.body.CubicBezierCurve)
package org.generalrelativity.foam.dynamics.element.body {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.enum.*;
import org.generalrelativity.foam.dynamics.collision.enum.*;
public class CubicBezierCurve extends RigidBody {
public var lines:Array;
protected var height:Number;
protected var resolution:int;
protected var control1:Vector;
protected var control2:Vector;
protected var anchor1:Vector;
protected var anchor2:Vector;
public function CubicBezierCurve(_arg1:Number, _arg2:Number, _arg3:Vector, _arg4:Vector, _arg5:Vector, _arg6:Vector, _arg7:int=7, _arg8:Number=INF, _arg9:Number=0, _arg10:Number=0, _arg11:Number=0, _arg12:Number=0, _arg13:Number=0.2, _arg14:Number=0.15, _arg15:Number=150){
super(_arg1, _arg2, _arg8, null, _arg9, _arg10, _arg13, _arg14, _arg11, _arg12);
this.height = _arg15;
this.resolution = _arg7;
this.control1 = _arg3;
this.control2 = _arg5;
this.anchor1 = _arg4;
this.anchor2 = _arg6;
createLines();
}
protected function createLines():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local9:Number;
var _local10:Number;
var _local13:Number;
var _local14:Number;
var _local15:RigidBody;
var _local8:Number = (1 / resolution);
var _local11:Number = control1.x;
var _local12:Number = control1.y;
lines = new Array();
while (++_local1 <= resolution) {
_local2 = (_local8 * _local1);
_local3 = (_local2 * _local2);
_local4 = (_local3 * _local2);
_local5 = (1 - _local2);
_local6 = ((1 - _local2) * _local5);
_local7 = (_local6 * _local5);
_local9 = ((((_local7 * control1.x) + (((3 * _local2) * _local6) * anchor1.x)) + (((3 * anchor2.x) * _local3) * _local5)) + (control2.x * _local4));
_local10 = ((((_local7 * control1.y) + (((3 * _local2) * _local6) * anchor1.y)) + (((3 * anchor2.y) * _local3) * _local5)) + (control2.y * _local4));
_local13 = (_local9 - _local11);
_local14 = (_local10 - _local12);
_local15 = new RigidBody(((x + _local11) + (_local13 / 2)), ((y + _local12) + (_local14 / 2)), Simplification.INFINITE_MASS, [new Vector((_local13 / 2), (_local14 / 2)), new Vector((-(_local13) / 2), (-(_local14) / 2))], 0, 0, 0, 0, friction);
_local11 = _local9;
_local12 = _local10;
lines.push(_local15);
};
}
override protected function calculateInertiaTensor():void{
if (mass == Simplification.INFINITE_MASS){
_I = Simplification.INFINITE_MASS;
_inverseI = 0;
return;
};
_I = ((control1.magnitude * mass) / 3);
_I = (_I + ((control2.magnitude * mass) / 3));
_I = (_I + (((anchor1.magnitude * mass) / 3) * 0.5));
_I = (_I + (((anchor2.magnitude * mass) / 3) * 0.5));
_inverseI = (1 / _I);
}
override public function get collisionTypeID():String{
return (CollisionType.CUBIC_BEZIER_CURVE);
}
}
}//package org.generalrelativity.foam.dynamics.element.body
Section 82
//RigidBody (org.generalrelativity.foam.dynamics.element.body.RigidBody)
package org.generalrelativity.foam.dynamics.element.body {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.ode.*;
import org.generalrelativity.foam.util.*;
import org.generalrelativity.foam.dynamics.enum.*;
import org.generalrelativity.foam.dynamics.collision.enum.*;
import org.generalrelativity.foam.dynamics.element.particle.*;
public class RigidBody extends SimpleParticle implements IODE, ISimulatable, IBody {
protected var _I:Number;
protected var _edges:Array;
protected var _vertices:Array;
protected var _rotation:RotationMatrix;
protected var _torque:Number;
protected var _inverseI:Number;
public function RigidBody(_arg1:Number, _arg2:Number, _arg3:Number=100, _arg4:Array=null, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0.2, _arg8:Number=0.25, _arg9:Number=0, _arg10:Number=0){
if (_arg4){
_vertices = _arg4;
_edges = ShapeUtil.getEdges(_arg4);
};
super(_arg1, _arg2, _arg5, _arg6, _arg3, _arg7, _arg8, 6);
this.q = _arg9;
this.av = _arg10;
_rotation = new RotationMatrix(_arg9);
clearTorque();
calculateInertiaTensor();
}
public function clearTorque():void{
_torque = 0;
}
public function get vertices():Array{
return (_vertices);
}
public function get I():Number{
return (_I);
}
public function set q(_arg1:Number):void{
_state[4] = _arg1;
}
public function getVelocityAtPoint(_arg1:Vector):Vector{
var _local2:Vector = _arg1.minus(position).getPerp();
_local2.normalize();
return (velocity.plus(_local2.times(av)));
}
public function addTorque(_arg1:Number):void{
_torque = (_torque + _arg1);
}
public function get edges():Array{
return (_edges);
}
public function get inverseI():Number{
return (_inverseI);
}
override public function get collisionTypeID():String{
return (CollisionType.RIGID_BODY);
}
public function set av(_arg1:Number):void{
_state[5] = _arg1;
}
public function get torque():Number{
return (_torque);
}
protected function calculateInertiaTensor():void{
var _local2:Vector;
if (mass == Simplification.INFINITE_MASS){
_I = Simplification.INFINITE_MASS;
_inverseI = 0;
return;
};
_I = 0;
var _local1:Number = (mass / _vertices.length);
for each (_local2 in _vertices) {
_I = (_I + (_local2.dot(_local2) * _local1));
};
_inverseI = (1 / _I);
}
public function get q():Number{
return (_state[4]);
}
public function addForceAtPoint(_arg1:Vector, _arg2:Vector):void{
addForce(_arg2);
addTorque(_arg1.getPerp().dot(_arg2));
}
public function get av():Number{
return (_state[5]);
}
override public function getDerivative(_arg1:Array, _arg2:Array):void{
this._state = _arg1;
accumulateForces();
_arg2[0] = _arg1[2];
_arg2[1] = _arg1[3];
_arg2[2] = (_force.x * _inverseMass);
_arg2[3] = (_force.y * _inverseMass);
_arg2[4] = _arg1[5];
_arg2[5] = (_torque * _inverseI);
clearForces();
clearTorque();
}
public function get rotation():RotationMatrix{
if (_rotation.theta != q){
_rotation = new RotationMatrix(q);
};
return (_rotation);
}
}
}//package org.generalrelativity.foam.dynamics.element.body
Section 83
//SimpleParticle (org.generalrelativity.foam.dynamics.element.particle.SimpleParticle)
package org.generalrelativity.foam.dynamics.element.particle {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.force.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.ode.*;
import org.generalrelativity.foam.util.*;
import org.generalrelativity.foam.dynamics.enum.*;
import org.generalrelativity.foam.dynamics.collision.enum.*;
public class SimpleParticle implements IODE, ISimulatable {
protected var _isHit:Boolean;// = false
protected var _alreadyDead:Boolean;// = false
protected var _foamSubLabel:int;// = 0
protected var _elasticity:Number;
protected var _friction:Number;
protected var _lifeLeft:int;// = 100
protected var _isAlive:Boolean;// = true
protected var _inverseMass:Number;
protected var _state:Array;
protected var _generators:Array;
protected var _doNotCollide:Boolean;// = false
protected var _isShocked:Boolean;// = false
protected var _turnToStone:Boolean;// = false
protected var _foamLabel:int;// = 0
protected var _isFrozen:Boolean;// = false
protected var _mass:Number;
protected var _isBurned:Boolean;// = false
protected var _force:Vector;
public function SimpleParticle(_arg1:Number, _arg2:Number, _arg3:Number=0, _arg4:Number=0, _arg5:Number=100, _arg6:Number=0.2, _arg7:Number=0.25, _arg8:uint=4){
_state = new Array(_arg8);
_generators = new Array();
this.x = _arg1;
this.y = _arg2;
this.vx = _arg3;
this.vy = _arg4;
this.mass = _arg5;
this.friction = _arg6;
this.elasticity = _arg7;
clearForces();
}
public function get friction():Number{
return (_friction);
}
public function set friction(_arg1:Number):void{
_friction = MathUtil.clamp(0, 1, _arg1);
}
public function get isHit():Boolean{
return (_isHit);
}
public function set x(_arg1:Number):void{
_state[0] = _arg1;
}
public function set isHit(_arg1:Boolean):void{
_isHit = _arg1;
}
public function get lifeLeft():int{
return (_lifeLeft);
}
public function addForceGenerator(_arg1:IForceGenerator):void{
if (_generators.indexOf(_arg1) == -1){
_generators.push(_arg1);
};
}
public function get isShocked():Boolean{
return (_isShocked);
}
public function get position():Vector{
return (new Vector(x, y));
}
public function get foamLabel():int{
return (_foamLabel);
}
public function get inverseMass():Number{
return (_inverseMass);
}
public function set lifeLeft(_arg1:int):void{
_lifeLeft = _arg1;
}
public function get isFrozen():Boolean{
return (_isFrozen);
}
public function get turnToStone():Boolean{
return (_turnToStone);
}
public function set isShocked(_arg1:Boolean):void{
_isShocked = _arg1;
}
public function get foamSubLabel():int{
return (_foamSubLabel);
}
public function set elasticity(_arg1:Number):void{
_elasticity = MathUtil.clamp(0, 1, _arg1);
}
public function get isBurned():Boolean{
return (_isBurned);
}
public function get y():Number{
return (_state[1]);
}
public function set vy(_arg1:Number):void{
_state[3] = _arg1;
}
public function get x():Number{
return (_state[0]);
}
public function set vx(_arg1:Number):void{
_state[2] = _arg1;
}
public function set foamLabel(_arg1:int):void{
_foamLabel = _arg1;
}
public function get state():Array{
return (_state);
}
public function clearForces():void{
_force = new Vector();
}
public function set isAlive(_arg1:Boolean):void{
_isAlive = _arg1;
}
public function get collisionTypeID():String{
return (CollisionType.ABSTRACT_PARTICLE);
}
public function getDerivative(_arg1:Array, _arg2:Array):void{
this._state = _arg1;
accumulateForces();
_arg2[0] = _arg1[2];
_arg2[1] = _arg1[3];
_arg2[2] = (_force.x * inverseMass);
_arg2[3] = (_force.y * inverseMass);
clearForces();
}
public function set doNotCollide(_arg1:Boolean):void{
_doNotCollide = _arg1;
}
public function get elasticity():Number{
return (_elasticity);
}
public function set alreadyDead(_arg1:Boolean):void{
_alreadyDead = _arg1;
}
public function get vx():Number{
return (_state[2]);
}
public function get vy():Number{
return (_state[3]);
}
public function removeForceGenerator(_arg1:IForceGenerator):void{
var _local2:int = _generators.indexOf(_arg1);
if (_local2 > -1){
_generators.splice(_generators.indexOf(_arg1), 1);
};
}
public function addForce(_arg1:Vector):void{
_force.plusEquals(_arg1);
}
public function set isFrozen(_arg1:Boolean):void{
_isFrozen = _arg1;
}
public function get doNotCollide():Boolean{
return (_doNotCollide);
}
public function set foamSubLabel(_arg1:int):void{
_foamSubLabel = _arg1;
}
public function set turnToStone(_arg1:Boolean):void{
_turnToStone = _arg1;
}
public function get alreadyDead():Boolean{
return (_alreadyDead);
}
public function get isAlive():Boolean{
return (_isAlive);
}
public function set mass(_arg1:Number):void{
_mass = _arg1;
if (_mass == Simplification.INFINITE_MASS){
_inverseMass = 0;
} else {
_inverseMass = (1 / _arg1);
};
}
public function get force():Vector{
return (_force);
}
public function set isBurned(_arg1:Boolean):void{
_isBurned = _arg1;
}
public function accumulateForces():void{
var _local1:IForceGenerator;
for each (_local1 in _generators) {
_local1.generate(this);
};
}
public function set y(_arg1:Number):void{
_state[1] = _arg1;
}
public function get mass():Number{
return (_mass);
}
public function get velocity():Vector{
return (new Vector(vx, vy));
}
}
}//package org.generalrelativity.foam.dynamics.element.particle
Section 84
//IBody (org.generalrelativity.foam.dynamics.element.IBody)
package org.generalrelativity.foam.dynamics.element {
import org.generalrelativity.foam.math.*;
public interface IBody extends ISimulatable {
function get vertices():Array;
function set q(_arg1:Number):void;
function get I():Number;
function set av(_arg1:Number):void;
function addTorque(_arg1:Number):void;
function getVelocityAtPoint(_arg1:Vector):Vector;
function get q():Number;
function addForceAtPoint(_arg1:Vector, _arg2:Vector):void;
function get av():Number;
function get edges():Array;
function clearTorque():void;
function get inverseI():Number;
function get rotation():RotationMatrix;
}
}//package org.generalrelativity.foam.dynamics.element
Section 85
//ISimulatable (org.generalrelativity.foam.dynamics.element.ISimulatable)
package org.generalrelativity.foam.dynamics.element {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.force.*;
public interface ISimulatable {
function get elasticity():Number;
function set elasticity(_arg1:Number):void;
function get vx():Number;
function get isAlive():Boolean;
function set vx(_arg1:Number):void;
function set foamLabel(_arg1:int):void;
function set isAlive(_arg1:Boolean):void;
function get isBurned():Boolean;
function get isHit():Boolean;
function get vy():Number;
function get inverseMass():Number;
function removeForceGenerator(_arg1:IForceGenerator):void;
function set lifeLeft(_arg1:int):void;
function get foamLabel():int;
function addForce(_arg1:Vector):void;
function set foamSubLabel(_arg1:int):void;
function set isFrozen(_arg1:Boolean):void;
function set vy(_arg1:Number):void;
function get doNotCollide():Boolean;
function set isHit(_arg1:Boolean):void;
function set turnToStone(_arg1:Boolean):void;
function get alreadyDead():Boolean;
function get velocity():Vector;
function get position():Vector;
function get lifeLeft():int;
function clearForces():void;
function get collisionTypeID():String;
function set mass(_arg1:Number):void;
function get foamSubLabel():int;
function get isFrozen():Boolean;
function get force():Vector;
function set doNotCollide(_arg1:Boolean):void;
function get turnToStone():Boolean;
function set isShocked(_arg1:Boolean):void;
function addForceGenerator(_arg1:IForceGenerator):void;
function set x(_arg1:Number):void;
function accumulateForces():void;
function set y(_arg1:Number):void;
function get mass():Number;
function set isBurned(_arg1:Boolean):void;
function get x():Number;
function get y():Number;
function get friction():Number;
function set friction(_arg1:Number):void;
function get isShocked():Boolean;
function set alreadyDead(_arg1:Boolean):void;
}
}//package org.generalrelativity.foam.dynamics.element
Section 86
//Simplification (org.generalrelativity.foam.dynamics.enum.Simplification)
package org.generalrelativity.foam.dynamics.enum {
public class Simplification {
public static const INFINITE_MASS:Number = INF;
}
}//package org.generalrelativity.foam.dynamics.enum
Section 87
//Bungee (org.generalrelativity.foam.dynamics.force.spring.Bungee)
package org.generalrelativity.foam.dynamics.force.spring {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
public class Bungee extends Spring {
public function Bungee(_arg1:ISimulatable, _arg2:ISimulatable, _arg3:Number=0.01, _arg4:Number=0.4){
super(_arg1, _arg2, _arg3, _arg4);
}
override public function generate(_arg1:ISimulatable):void{
var _local2:Vector = new Vector((element1.x - element2.x), (element1.y - element2.y));
var _local3:Number = _local2.magnitude;
if (_local3 <= _restLength){
return;
};
_force = _local2.times((-(k) * (_local3 - _restLength)));
_force.minusEquals(new Vector(element1.vx, element1.vy).times(damp));
element1.addForce(_force);
}
}
}//package org.generalrelativity.foam.dynamics.force.spring
Section 88
//MouseSpring (org.generalrelativity.foam.dynamics.force.spring.MouseSpring)
package org.generalrelativity.foam.dynamics.force.spring {
import flash.display.*;
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.force.*;
import org.generalrelativity.foam.dynamics.element.*;
public class MouseSpring extends SimpleForceGenerator implements IForceGenerator {
protected var displayObject:DisplayObject;
protected var body:IBody;
protected var k:Number;
protected var damp:Number;
protected var point:Vector;
protected var restLength:Number;
public function MouseSpring(_arg1:IBody, _arg2:Vector, _arg3:DisplayObject){
this.body = _arg1;
this.point = _arg1.rotation.getTransposeVectorProduct(_arg2);
this.displayObject = _arg3;
restLength = 40;
k = 0.001;
damp = 0.3;
_arg1.addForceGenerator(this);
}
public function getPointInWorldSpace():Vector{
var _local1:RotationMatrix = body.rotation;
var _local2:Vector = _local1.getVectorProduct(point);
return (_local2.plus(body.position));
}
public function destroy():void{
body.removeForceGenerator(this);
}
override public function generate(_arg1:ISimulatable):void{
var _local2:RotationMatrix = body.rotation;
var _local3:Vector = _local2.getVectorProduct(point);
var _local4:Vector = getPointInWorldSpace();
var _local5:Vector = new Vector((_local4.x - displayObject.mouseX), (_local4.y - displayObject.mouseY));
if (_local5.magnitude < restLength){
return;
};
_force = _local5.times((-(k) * (_local5.magnitude - restLength)));
_force.minusEquals(body.velocity.times(damp));
body.addForceAtPoint(_local3, _force);
}
}
}//package org.generalrelativity.foam.dynamics.force.spring
Section 89
//RigidBodyBungee (org.generalrelativity.foam.dynamics.force.spring.RigidBodyBungee)
package org.generalrelativity.foam.dynamics.force.spring {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
public class RigidBodyBungee extends RigidBodySpring {
public function RigidBodyBungee(_arg1:IBody, _arg2:Vector, _arg3:IBody, _arg4:Vector, _arg5:Number=0.01, _arg6:Number=0.01){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
}
override public function generate(_arg1:ISimulatable):void{
var _local2:RotationMatrix = IBody(element1).rotation;
var _local3:Vector = _local2.getVectorProduct(point1);
var _local4:Vector = _local3.plus(element1.position);
var _local5:RotationMatrix = IBody(element2).rotation;
var _local6:Vector = _local5.getVectorProduct(point2);
var _local7:Vector = _local6.plus(element2.position);
var _local8:Vector = new Vector((_local4.x - _local7.x), (_local4.y - _local7.y));
var _local9:Number = _local8.magnitude;
if (_local9 <= _restLength){
return;
};
_force = _local8.times((-(k) * (_local8.magnitude - _restLength)));
_force.minusEquals(IBody(element1).getVelocityAtPoint(_local3).times(damp));
IBody(element1).addForceAtPoint(_local3, _force);
}
override public function clone(_arg1:Boolean=true):Spring{
if (_arg1){
return (new RigidBodyBungee(IBody(element2), point2, IBody(element1), point1, k, damp));
};
return (new RigidBodyBungee(IBody(element1), point1, IBody(element2), point2, k, damp));
}
}
}//package org.generalrelativity.foam.dynamics.force.spring
Section 90
//RigidBodySpring (org.generalrelativity.foam.dynamics.force.spring.RigidBodySpring)
package org.generalrelativity.foam.dynamics.force.spring {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.util.*;
public class RigidBodySpring extends Spring {
protected var point1:Vector;
protected var point2:Vector;
public function RigidBodySpring(_arg1:IBody, _arg2:Vector, _arg3:IBody, _arg4:Vector, _arg5:Number=0.01, _arg6:Number=0.01){
super(_arg1, _arg3, _arg5, _arg6);
this.point1 = _arg2;
this.point2 = _arg4;
var _local7:Vector = _arg1.rotation.getVectorProduct(_arg2);
var _local8:Vector = _arg3.rotation.getVectorProduct(_arg4);
restLength = MathUtil.distance((_arg1.x + _local7.x), (_arg3.x + _local8.x), (_arg1.y + _local7.y), (_arg3.y + _local8.y));
}
override public function getPoint1InWorldSpace():Vector{
var _local1:RotationMatrix = IBody(element1).rotation;
var _local2:Vector = _local1.getVectorProduct(point1);
return (_local2.plus(element1.position));
}
override public function generate(_arg1:ISimulatable):void{
var _local2:RotationMatrix = IBody(element1).rotation;
var _local3:Vector = _local2.getVectorProduct(point1);
var _local4:Vector = _local3.plus(new Vector(element1.x, element1.y));
var _local5:RotationMatrix = IBody(element2).rotation;
var _local6:Vector = _local5.getVectorProduct(point2);
var _local7:Vector = _local6.plus(new Vector(element2.x, element2.y));
var _local8:Vector = new Vector((_local4.x - _local7.x), (_local4.y - _local7.y));
_force = _local8.times((-(k) * (_local8.magnitude - _restLength)));
_force.minusEquals(IBody(element1).getVelocityAtPoint(_local3).times(damp));
IBody(element1).addForceAtPoint(_local3, _force);
}
override public function getPoint2InWorldSpace():Vector{
var _local1:RotationMatrix = IBody(element2).rotation;
var _local2:Vector = _local1.getVectorProduct(point2);
return (_local2.plus(element2.position));
}
override public function clone(_arg1:Boolean=true):Spring{
if (_arg1){
return (new RigidBodySpring(IBody(element2), point2, IBody(element1), point1, k, damp));
};
return (new RigidBodySpring(IBody(element1), point1, IBody(element2), point2, k, damp));
}
}
}//package org.generalrelativity.foam.dynamics.force.spring
Section 91
//Spring (org.generalrelativity.foam.dynamics.force.spring.Spring)
package org.generalrelativity.foam.dynamics.force.spring {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.force.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.util.*;
public class Spring extends SimpleForceGenerator implements IForceGenerator {
protected var damp:Number;
protected var k:Number;
protected var element1:ISimulatable;
protected var _restLength:Number;
protected var element2:ISimulatable;
public function Spring(_arg1:ISimulatable, _arg2:ISimulatable, _arg3:Number=0.01, _arg4:Number=0.4){
this.element1 = _arg1;
this.element2 = _arg2;
this.k = _arg3;
this.damp = _arg4;
_arg1.addForceGenerator(this);
restLength = MathUtil.distance(_arg1.x, _arg2.x, _arg1.y, _arg2.y);
}
public function invert():void{
element1.removeForceGenerator(this);
var _local1:ISimulatable = ISimulatable(element2);
element2 = element1;
element1 = _local1;
element1.addForceGenerator(this);
}
public function getPoint1InWorldSpace():Vector{
return (element1.position);
}
public function getPoint2InWorldSpace():Vector{
return (element2.position);
}
public function set restLength(_arg1:Number):void{
_restLength = _arg1;
}
override public function generate(_arg1:ISimulatable):void{
var _local2:Vector = new Vector((element1.x - element2.x), (element1.y - element2.y));
_force = _local2.times((-(k) * (_local2.magnitude - _restLength)));
_force.minusEquals(new Vector(element1.vx, element1.vy).times(damp));
element1.addForce(_force);
}
public function clone(_arg1:Boolean=true):Spring{
if (_arg1){
return (new Spring(element2, element1, k, damp));
};
return (new Spring(element1, element2, k, damp));
}
public static function createDoubleSidedSpring(_arg1:ISimulatable, _arg2:ISimulatable, _arg3:Number=0.01, _arg4:Number=0.1):void{
var _local5:Spring = new Spring(_arg1, _arg2, _arg3, _arg4);
_local5 = new Spring(_arg2, _arg1, _arg3, _arg4);
}
}
}//package org.generalrelativity.foam.dynamics.force.spring
Section 92
//Friction (org.generalrelativity.foam.dynamics.force.Friction)
package org.generalrelativity.foam.dynamics.force {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
public class Friction extends SimpleForceGenerator implements IForceGenerator {
protected var coefficient:Number;
public function Friction(_arg1:Number=0.1){
this.coefficient = _arg1;
}
override public function generate(_arg1:ISimulatable):void{
var _local2:IBody;
_arg1.addForce(new Vector(((-(_arg1.vx) * coefficient) * _arg1.mass), ((-(_arg1.vy) * coefficient) * _arg1.mass)));
if ((_arg1 is IBody)){
_local2 = IBody(_arg1);
_local2.addTorque(((-(_local2.av) * coefficient) * _local2.I));
};
}
}
}//package org.generalrelativity.foam.dynamics.force
Section 93
//Gravity (org.generalrelativity.foam.dynamics.force.Gravity)
package org.generalrelativity.foam.dynamics.force {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
public class Gravity extends SimpleForceGenerator implements IForceGenerator {
public function Gravity(_arg1:Vector){
super(_arg1);
}
override public function generate(_arg1:ISimulatable):void{
_arg1.addForce(_force.times(_arg1.mass));
}
}
}//package org.generalrelativity.foam.dynamics.force
Section 94
//IForceGenerator (org.generalrelativity.foam.dynamics.force.IForceGenerator)
package org.generalrelativity.foam.dynamics.force {
import org.generalrelativity.foam.dynamics.element.*;
public interface IForceGenerator {
function generate(_arg1:ISimulatable):void;
}
}//package org.generalrelativity.foam.dynamics.force
Section 95
//SimpleForceGenerator (org.generalrelativity.foam.dynamics.force.SimpleForceGenerator)
package org.generalrelativity.foam.dynamics.force {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
public class SimpleForceGenerator implements IForceGenerator {
protected var _force:Vector;
public function SimpleForceGenerator(_arg1:Vector=null):void{
_force = _arg1;
}
public function generate(_arg1:ISimulatable):void{
_arg1.addForce(_force);
}
}
}//package org.generalrelativity.foam.dynamics.force
Section 96
//AbstractSolver (org.generalrelativity.foam.dynamics.ode.solver.AbstractSolver)
package org.generalrelativity.foam.dynamics.ode.solver {
import org.generalrelativity.foam.dynamics.ode.*;
public class AbstractSolver implements IODESolver {
protected var _ode:IODE;
public function AbstractSolver(_arg1:IODE):void{
_ode = _arg1;
}
public function get ode():IODE{
return (_ode);
}
public function step(_arg1:Number):void{
throw (new Error("AbstractSolver.step must be overridden"));
}
}
}//package org.generalrelativity.foam.dynamics.ode.solver
Section 97
//RK4 (org.generalrelativity.foam.dynamics.ode.solver.RK4)
package org.generalrelativity.foam.dynamics.ode.solver {
import org.generalrelativity.foam.dynamics.ode.*;
public class RK4 extends AbstractSolver implements IODESolver {
private var k1:Array;
private var k2:Array;
private var k3:Array;
private var k4:Array;
public function RK4(_arg1:IODE){
var ode = _arg1;
super(ode);
try {
k1 = new Array(ode.state.length);
k2 = new Array(ode.state.length);
k3 = new Array(ode.state.length);
k4 = new Array(ode.state.length);
} catch(error:Error) {
k1 = new Array();
k2 = new Array();
k3 = new Array();
k4 = new Array();
};
}
override public function step(_arg1:Number):void{
var _local2:Array = new Array(_ode.state.length);
var _local3:Array = _ode.state;
var _local4 = -1;
_ode.getDerivative(_local3, k1);
while (++_local4 < _local3.length) {
_local2[_local4] = (_local3[_local4] + ((k1[_local4] * _arg1) * 0.5));
};
_local4 = -1;
_ode.getDerivative(_local2, k2);
while (++_local4 < _local3.length) {
_local2[_local4] = (_local3[_local4] + ((k2[_local4] * _arg1) * 0.5));
};
_local4 = -1;
_ode.getDerivative(_local2, k3);
while (++_local4 < _local3.length) {
_local2[_local4] = (_local3[_local4] + (k3[_local4] * _arg1));
};
_local4 = -1;
_ode.getDerivative(_local2, k4);
while (++_local4 < _local3.length) {
_local3[_local4] = (_local3[_local4] + ((_arg1 * (((k1[_local4] + (2 * k2[_local4])) + (2 * k3[_local4])) + k4[_local4])) / 6));
};
}
}
}//package org.generalrelativity.foam.dynamics.ode.solver
Section 98
//IODE (org.generalrelativity.foam.dynamics.ode.IODE)
package org.generalrelativity.foam.dynamics.ode {
public interface IODE {
function get state():Array;
function getDerivative(_arg1:Array, _arg2:Array):void;
}
}//package org.generalrelativity.foam.dynamics.ode
Section 99
//IODESolver (org.generalrelativity.foam.dynamics.ode.IODESolver)
package org.generalrelativity.foam.dynamics.ode {
public interface IODESolver {
function get ode():IODE;
function step(_arg1:Number):void;
}
}//package org.generalrelativity.foam.dynamics.ode
Section 100
//PhysicsEngine (org.generalrelativity.foam.dynamics.PhysicsEngine)
package org.generalrelativity.foam.dynamics {
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.collision.*;
import org.generalrelativity.foam.dynamics.ode.*;
import org.generalrelativity.foam.dynamics.collision.fine.sat.*;
import org.generalrelativity.foam.dynamics.collision.coarse.*;
public class PhysicsEngine {
private var _solverIterations:int;
private var _coarseDetector:ICoarseCollisionDetector;
private var _odeSolvers:Array;
private var _numODESolvers:int;
public static const SOLVER_ITERATIONS:int = 3;
public static const DEFAULT_COARSE_COLLISION_DETECTOR:Class = AABRDetector;
public function PhysicsEngine(){
_odeSolvers = new Array();
_solverIterations = PhysicsEngine.SOLVER_ITERATIONS;
}
public function addODESolver(_arg1:IODESolver):void{
_odeSolvers.push(_arg1);
_numODESolvers = _odeSolvers.length;
}
public function removeCollidable(_arg1:ISimulatable):void{
_coarseDetector.removeCollidable(_arg1);
}
public function setCoarseCollisionDetector(_arg1:ICoarseCollisionDetector):void{
_coarseDetector = _arg1;
}
public function addCollidable(_arg1:ISimulatable):void{
if (!_coarseDetector){
_coarseDetector = new PhysicsEngine.DEFAULT_COARSE_COLLISION_DETECTOR();
};
_coarseDetector.addCollidable(_arg1);
}
public function step(_arg1:Number=1):void{
var _local2:int;
var _local3:int;
var _local4:Number = (_arg1 / _solverIterations);
while (++_local3 <= _solverIterations) {
_local2 = _numODESolvers;
while (--_local2 > -1) {
IODESolver(_odeSolvers[_local2]).step(_local4);
};
if (_coarseDetector){
resolveCollisions();
};
};
}
private function resolveCollisions():void{
var _local2:IFineCollisionDetector;
var _local1:Array = _coarseDetector.getCandidates();
for each (_local2 in _local1) {
if (_local2.hasCollision()){
CollisionResolver.resolve(_local2.getContacts());
};
};
}
public function set solverIterations(_arg1:int):void{
_solverIterations = Math.max(Math.abs(_arg1), 1);
}
public function setCollisionFactory(_arg1:ICollisionFactory):void{
_coarseDetector.factory = _arg1;
}
public function getBodyUnderPoint(_arg1:Vector):IBody{
var _local2:PointPolygonDetector;
var _local3:IODESolver;
for each (_local3 in _odeSolvers) {
if ((_local3.ode is IBody)){
_local2 = new PointPolygonDetector(IBody(_local3.ode), _arg1);
if (_local2.hasCollision()){
return (IBody(_local3.ode));
};
};
};
return (null);
}
public function removeODESolver(_arg1:IODESolver):void{
var _local2:int = _odeSolvers.indexOf(_arg1);
if (_local2 > -1){
_odeSolvers.splice(_odeSolvers.indexOf(_arg1), 1);
};
_numODESolvers = _odeSolvers.length;
}
}
}//package org.generalrelativity.foam.dynamics
Section 101
//RotationMatrix (org.generalrelativity.foam.math.RotationMatrix)
package org.generalrelativity.foam.math {
public class RotationMatrix {
protected var r21:Number;
protected var r11:Number;
protected var r12:Number;
protected var r22:Number;
protected var _theta:Number;
public function RotationMatrix(_arg1:Number=0){
this.theta = _arg1;
}
public function get theta():Number{
return (_theta);
}
public function getTransposeVectorProduct(_arg1:Vector):Vector{
return (new Vector(((r11 * _arg1.x) + (r21 * _arg1.y)), ((r12 * _arg1.x) + (r22 * _arg1.y))));
}
public function getVectorProduct(_arg1:Vector):Vector{
return (new Vector(((r11 * _arg1.x) + (r12 * _arg1.y)), ((r21 * _arg1.x) + (r22 * _arg1.y))));
}
public function set theta(_arg1:Number):void{
_theta = _arg1;
r11 = Math.cos(theta);
r21 = Math.sin(theta);
r12 = -(r21);
r22 = r11;
}
}
}//package org.generalrelativity.foam.math
Section 102
//Vector (org.generalrelativity.foam.math.Vector)
package org.generalrelativity.foam.math {
public class Vector {
public var y:Number;
public var x:Number;
public function Vector(_arg1:Number=0, _arg2:Number=0){
this.x = _arg1;
this.y = _arg2;
}
public function dividedByEquals(_arg1:Number):void{
x = (x / _arg1);
y = (y / _arg1);
}
public function dividedBy(_arg1:Number):Vector{
return (new Vector((x / _arg1), (y / _arg1)));
}
public function getAngle(_arg1:Vector):Number{
return (Math.atan2((_arg1.y - y), (_arg1.x - x)));
}
public function timesEquals(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function times(_arg1:Number):Vector{
return (new Vector((x * _arg1), (y * _arg1)));
}
public function cross(_arg1:Vector):Number{
return (((x * _arg1.y) - (y * _arg1.x)));
}
public function getUnit():Vector{
return (dividedBy(magnitude));
}
public function dot(_arg1:Vector):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
public function crossScalar(_arg1:Number):Vector{
return (new Vector((-(_arg1) * y), (_arg1 * x)));
}
public function normalize():void{
dividedByEquals(magnitude);
}
public function minusEquals(_arg1:Vector):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function negate():void{
x = (x * -1);
y = (y * -1);
}
public function getPerp():Vector{
return (new Vector(-(y), x));
}
public function minus(_arg1:Vector):Vector{
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function plusEquals(_arg1:Vector):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function plus(_arg1:Vector):Vector{
return (new Vector((x + _arg1.x), (y + _arg1.y)));
}
public function clone():Vector{
return (new Vector(x, y));
}
public function get magnitude():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public static function project(_arg1:Number, _arg2:Number):Vector{
return (new Vector((Math.cos(_arg1) * _arg2), (Math.sin(_arg1) * _arg2)));
}
}
}//package org.generalrelativity.foam.math
Section 103
//MathUtil (org.generalrelativity.foam.util.MathUtil)
package org.generalrelativity.foam.util {
public class MathUtil {
public static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg3 < _arg1){
return (_arg1);
};
if (_arg3 > _arg2){
return (_arg2);
};
return (_arg3);
}
public static function distance(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number = (_arg1 - _arg2);
var _local6:Number = (_arg3 - _arg4);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
}
}//package org.generalrelativity.foam.util
Section 104
//RenderingUtil (org.generalrelativity.foam.util.RenderingUtil)
package org.generalrelativity.foam.util {
import flash.display.*;
import org.generalrelativity.foam.math.*;
public class RenderingUtil {
public static function drawHash(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:RotationMatrix, _arg5:int=3, _arg6:int=8):void{
_arg1.lineStyle(1);
var _local7:Vector = _arg4.getVectorProduct(new Vector(-(_arg5), -(_arg5)));
_arg1.moveTo((_arg2 + _local7.x), (_arg3 + _local7.y));
_local7 = _arg4.getVectorProduct(new Vector(_arg5, _arg5));
_arg1.lineTo((_arg2 + _local7.x), (_arg3 + _local7.y));
_local7 = _arg4.getVectorProduct(new Vector(-(_arg5), _arg5));
_arg1.moveTo((_arg2 + _local7.x), (_arg3 + _local7.y));
_local7 = _arg4.getVectorProduct(new Vector(_arg5, -(_arg5)));
_arg1.lineTo((_arg2 + _local7.x), (_arg3 + _local7.y));
_arg1.drawCircle(_arg2, _arg3, _arg6);
}
public static function drawVector(_arg1:Graphics, _arg2:Vector, _arg3:Number=0, _arg4:Number=0, _arg5:Number=3):void{
_arg1.moveTo(_arg3, _arg4);
var _local6:Vector = _arg2.getUnit().times(_arg5);
var _local7:Vector = Vector.project((Math.atan2(_arg2.y, _arg2.x) - (Math.PI / 2)), _arg5);
_arg1.lineTo((_arg3 + _arg2.x), (_arg4 + _arg2.y));
_arg1.lineTo(((_arg3 + _arg2.x) + _local7.x), ((_arg4 + _arg2.y) + _local7.y));
_arg1.lineTo(((_arg3 + _arg2.x) + _local6.x), ((_arg4 + _arg2.y) + _local6.y));
_local7.negate();
_arg1.lineTo(((_arg3 + _arg2.x) + _local7.x), ((_arg4 + _arg2.y) + _local7.y));
_arg1.lineTo((_arg3 + _arg2.x), (_arg4 + _arg2.y));
_arg1.endFill();
}
}
}//package org.generalrelativity.foam.util
Section 105
//ShapeUtil (org.generalrelativity.foam.util.ShapeUtil)
package org.generalrelativity.foam.util {
import org.generalrelativity.foam.math.*;
public class ShapeUtil {
public static function getEdges(_arg1:Array):Array{
var _local3:Vector;
var _local4:Vector;
var _local2:Array = new Array();
var _local5 = -1;
while (++_local5 < _arg1.length) {
_local3 = (_arg1[_local5] as Vector);
if ((_local5 + 1) == _arg1.length){
_local4 = (_arg1[0] as Vector);
} else {
_local4 = (_arg1[(_local5 + 1)] as Vector);
};
_local2.push(_local3.minus(_local4));
};
return (_local2);
}
public static function createRectangle(_arg1:Number, _arg2:Number):Array{
return ([new Vector((-(_arg1) / 2), (-(_arg2) / 2)), new Vector((_arg1 / 2), (-(_arg2) / 2)), new Vector((_arg1 / 2), (_arg2 / 2)), new Vector((-(_arg1) / 2), (_arg2 / 2))]);
}
public static function createSymmetricPolygon(_arg1:int=3, _arg2:Number=50, _arg3:Number=0):Array{
var _local4:Array = new Array();
var _local5:Number = (((360 / _arg1) * Math.PI) / 180);
var _local6:int = _arg1;
while (_local6--) {
_local4.push(new Vector((Math.cos(_arg3) * _arg2), (Math.sin(_arg3) * _arg2)));
_arg3 = (_arg3 + _local5);
};
return (_local4);
}
}
}//package org.generalrelativity.foam.util
Section 106
//SimpleMap (org.generalrelativity.foam.util.SimpleMap)
package org.generalrelativity.foam.util {
public class SimpleMap {
protected var _values:Array;
protected var _keys:Array;
public function SimpleMap(){
_keys = new Array();
_values = new Array();
}
public function remove(_arg1):void{
var _local2:int = getKeyIndex(_arg1);
if (_local2 > -1){
_keys.splice(_local2, 1);
_values.splice(_local2, 1);
};
}
public function getKeyIndex(_arg1):int{
return (_keys.indexOf(_arg1));
}
public function get length():int{
return (_keys.length);
}
public function put(_arg1, _arg2):void{
var _local3:int = getKeyIndex(_arg1);
if (_local3 > -1){
_values[_local3] = _arg2;
} else {
_keys.push(_arg1);
_values.push(_arg2);
};
}
public function getKey(_arg1){
var _local2:int = getValueIndex(_arg1);
if (_local2 > -1){
return (_keys[_local2]);
};
}
public function get values():Array{
return (_values.slice());
}
public function has(_arg1):Boolean{
return ((getKeyIndex(_arg1) > -1));
}
public function get keys():Array{
return (_keys.slice());
}
public function getValueIndex(_arg1):int{
return (_values.indexOf(_arg1));
}
public function getValue(_arg1){
var _local2:int = getKeyIndex(_arg1);
if (_local2 > -1){
return (_values[_local2]);
};
}
}
}//package org.generalrelativity.foam.util
Section 107
//DisplayObjectData (org.generalrelativity.foam.view.DisplayObjectData)
package org.generalrelativity.foam.view {
import flash.display.*;
public dynamic class DisplayObjectData {
protected var _displayObject:DisplayObject;
public var offsetX:Number;
public var offsetY:Number;
public var autoCenter:Boolean;
public var hasBeenDisplayed:Boolean;
public function DisplayObjectData(_arg1, _arg2:Number=0, _arg3:Number=0, _arg4:Boolean=true){
this.displayObject = _arg1;
this.offsetX = _arg2;
this.offsetY = _arg3;
this.autoCenter = _arg4;
}
public function get displayObject():DisplayObject{
return (_displayObject);
}
public function set displayObject(_arg1):void{
if ((_arg1 is DisplayObject)){
_displayObject = _arg1;
} else {
if ((_arg1 is Class)){
_displayObject = new (_arg1);
} else {
throw (new ArgumentError("DisplayObjectData.displayObject must be a DisplayObject or DisplayObject Class"));
};
};
}
}
}//package org.generalrelativity.foam.view
Section 108
//DisplayObjectFoamRenderer (org.generalrelativity.foam.view.DisplayObjectFoamRenderer)
package org.generalrelativity.foam.view {
import flash.display.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.util.*;
public class DisplayObjectFoamRenderer extends SimpleFoamRenderer implements IFoamRenderer {
protected var _containerMap:SimpleMap;
public function DisplayObjectFoamRenderer(){
_containerMap = new SimpleMap();
}
override public function draw():void{
var _local1:DisplayObject;
var _local2:Renderable;
staticCanvas.graphics.clear();
currentCanvas = staticCanvas;
for each (_local2 in _staticRenderables) {
if (_containerMap.has(_local2)){
_local1 = (_containerMap.getValue(_local2) as DisplayObject);
if ((_local2.element is ISimulatable)){
_local1.x = ISimulatable(_local2.element).x;
_local1.y = ISimulatable(_local2.element).y;
if ((_local2.element is IBody)){
_local1.rotation = ((IBody(_local2.element).q * 180) / Math.PI);
};
};
} else {
proxy(_local2, 0, null);
};
};
}
override public function getDisplayObject(_arg1:Renderable):DisplayObject{
return (this);
}
override public function redraw():void{
var _local1:DisplayObject;
var _local2:Renderable;
auxillaryCanvas.graphics.clear();
dynamicCanvas.graphics.clear();
currentCanvas = dynamicCanvas;
for each (_local2 in _dynamicRenderables) {
if (_containerMap.has(_local2)){
_local1 = (_containerMap.getValue(_local2) as DisplayObject);
if ((_local2.element is ISimulatable)){
_local1.x = ISimulatable(_local2.element).x;
_local1.y = ISimulatable(_local2.element).y;
if ((_local2.element is IBody)){
_local1.rotation = ((IBody(_local2.element).q * 180) / Math.PI);
};
};
} else {
proxy(_local2, 0, null);
};
};
}
override public function addRenderable(_arg1:Renderable):void{
var _local2:Sprite;
var _local3:DisplayObject;
if (_arg1.data.displayObject){
_local2 = (addChild(new Sprite()) as Sprite);
_local3 = _local2.addChild(_arg1.data.displayObject);
if (!_arg1.data.hasBeenDisplayed){
if (_arg1.data.offsetX){
_local3.x = (_local3.x + _arg1.data.offsetX);
};
if (_arg1.data.offsetY){
_local3.y = (_local3.y + _arg1.data.offsetY);
};
if (_arg1.data.autoCenter){
_local3.x = (_local3.x - (_local3.width / 2));
_local3.y = (_local3.y - (_local3.height / 2));
};
_arg1.data.hasBeenDisplayed = true;
};
_containerMap.put(_arg1, _local2);
};
super.addRenderable(_arg1);
draw();
redraw();
}
override public function removeRenderable(_arg1:Renderable):void{
var _local2:Sprite;
if (_containerMap.has(_arg1)){
_local2 = (_containerMap.getValue(_arg1) as Sprite);
removeChild(_local2);
};
super.removeRenderable(_arg1);
}
}
}//package org.generalrelativity.foam.view
Section 109
//IFoamRenderer (org.generalrelativity.foam.view.IFoamRenderer)
package org.generalrelativity.foam.view {
import flash.display.*;
public interface IFoamRenderer {
function addRenderable(_arg1:Renderable):void;
function get renderables():Array;
function removeRenderable(_arg1:Renderable):void;
function copy(_arg1:IFoamRenderer):void;
function redraw():void;
function getDisplayObject(_arg1:Renderable):DisplayObject;
function draw():void;
}
}//package org.generalrelativity.foam.view
Section 110
//Renderable (org.generalrelativity.foam.view.Renderable)
package org.generalrelativity.foam.view {
import flash.utils.*;
public class Renderable {
public var data;
public var isDynamic:Boolean;
public var element;
public var renderMethodKey:Class;
public function Renderable(_arg1, _arg2:Boolean=true, _arg3=null){
this.element = _arg1;
this.isDynamic = _arg2;
if (_arg3){
this.data = _arg3;
} else {
this.data = new Object();
};
this.renderMethodKey = (getDefinitionByName(getQualifiedClassName(_arg1)) as Class);
}
}
}//package org.generalrelativity.foam.view
Section 111
//SimpleFoamRenderer (org.generalrelativity.foam.view.SimpleFoamRenderer)
package org.generalrelativity.foam.view {
import flash.display.*;
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.element.body.*;
import org.generalrelativity.foam.dynamics.force.spring.*;
import org.generalrelativity.foam.util.*;
public class SimpleFoamRenderer extends Sprite implements IFoamRenderer {
protected var _dynamicRenderables:Array;
protected var staticCanvas:Sprite;
protected var auxillaryCanvas:Sprite;
protected var _staticRenderables:Array;
protected var currentCanvas:Sprite;
protected var dynamicCanvas:Sprite;
public static const DEFAULT_COLOR:uint = 0xFFFFFF;
public function SimpleFoamRenderer(){
staticCanvas = (addChild(new Sprite()) as Sprite);
dynamicCanvas = (addChild(new Sprite()) as Sprite);
auxillaryCanvas = (addChild(new Sprite()) as Sprite);
_staticRenderables = new Array();
_dynamicRenderables = new Array();
}
public function addRenderable(_arg1:Renderable):void{
setupRenderDataDefaults(_arg1);
if (_arg1.isDynamic){
_dynamicRenderables.push(_arg1);
} else {
_staticRenderables.push(_arg1);
};
}
public function get renderables():Array{
return (_staticRenderables.concat(_dynamicRenderables));
}
public function draw():void{
currentCanvas = staticCanvas;
currentCanvas.graphics.clear();
_staticRenderables.forEach(proxy);
redraw();
}
protected function drawSpring(_arg1:Spring):void{
currentCanvas.graphics.lineStyle(1, 0xFF0000);
var _local2:Vector = _arg1.getPoint1InWorldSpace();
var _local3:Vector = _arg1.getPoint2InWorldSpace();
currentCanvas.graphics.moveTo(_local2.x, _local2.y);
currentCanvas.graphics.lineTo(_local3.x, _local3.y);
}
public function redraw():void{
auxillaryCanvas.graphics.clear();
dynamicCanvas.graphics.clear();
currentCanvas = dynamicCanvas;
_dynamicRenderables.forEach(proxy);
}
protected function drawMouseSpring(_arg1:MouseSpring):void{
currentCanvas.graphics.lineStyle(1, 0xFF0000);
var _local2:Vector = _arg1.getPointInWorldSpace();
currentCanvas.graphics.moveTo(_local2.x, _local2.y);
currentCanvas.graphics.lineTo(mouseX, mouseY);
}
protected function drawPolygon(_arg1:RigidBody, _arg2:uint, _arg3:Number):void{
currentCanvas.graphics.lineStyle(3, 0x333333, 0.4);
currentCanvas.graphics.beginFill(_arg2, _arg3);
var _local4:RotationMatrix = _arg1.rotation;
var _local5:Vector = _local4.getVectorProduct((_arg1.vertices[0] as Vector));
var _local6:Vector = _local5;
currentCanvas.graphics.moveTo((_arg1.x + _local6.x), (_arg1.y + _local6.y));
var _local7:int;
while (++_local7 < _arg1.vertices.length) {
_local5 = _local4.getVectorProduct((_arg1.vertices[_local7] as Vector));
currentCanvas.graphics.lineTo((_arg1.x + _local5.x), (_arg1.y + _local5.y));
};
currentCanvas.graphics.lineTo((_arg1.x + _local6.x), (_arg1.y + _local6.y));
currentCanvas.graphics.beginFill(0xFFFFFF);
if (_arg1.vertices.length > 2){
RenderingUtil.drawHash(currentCanvas.graphics, _arg1.x, _arg1.y, _arg1.rotation);
};
currentCanvas.graphics.endFill();
}
public function removeRenderable(_arg1:Renderable):void{
var _local2:Array;
if (_arg1.isDynamic){
_local2 = _dynamicRenderables;
} else {
_local2 = _staticRenderables;
};
var _local3:int = _local2.indexOf(_arg1);
if (_local3 > -1){
_local2.splice(_local3, 1);
};
}
public function getDisplayObject(_arg1:Renderable):DisplayObject{
if (_staticRenderables.indexOf(_arg1) != -1){
return (staticCanvas);
};
if (_dynamicRenderables.indexOf(_arg1) != -1){
return (dynamicCanvas);
};
return (null);
}
protected function setupRenderDataDefaults(_arg1:Renderable):void{
if (_arg1.data.color == null){
_arg1.data.color = SimpleFoamRenderer.DEFAULT_COLOR;
};
if (!_arg1.data.alpha){
_arg1.data.alpha = 0.5;
};
if (!_arg1.data.hashSize){
_arg1.data.hashSize = 10;
};
}
protected function drawCircle(_arg1:Circle, _arg2:uint, _arg3:Number, _arg4:int):void{
currentCanvas.graphics.lineStyle(1, 0x333333);
currentCanvas.graphics.beginFill(_arg2, _arg3);
currentCanvas.graphics.drawCircle(_arg1.x, _arg1.y, _arg1.radius);
currentCanvas.graphics.endFill();
currentCanvas.graphics.beginFill(0xFFFFFF);
RenderingUtil.drawHash(currentCanvas.graphics, _arg1.x, _arg1.y, _arg1.rotation, _arg4);
currentCanvas.graphics.endFill();
}
protected function proxy(_arg1:Renderable, _arg2:int, _arg3:Array):void{
switch (_arg1.renderMethodKey){
case Circle:
drawCircle(Circle(_arg1.element), _arg1.data.color, _arg1.data.alpha, _arg1.data.hashSize);
break;
case RigidBody:
drawPolygon(RigidBody(_arg1.element), _arg1.data.color, _arg1.data.alpha);
break;
case Spring:
currentCanvas = auxillaryCanvas;
drawSpring(Spring(_arg1.element));
currentCanvas = dynamicCanvas;
break;
case Bungee:
currentCanvas = auxillaryCanvas;
drawSpring(Spring(_arg1.element));
currentCanvas = dynamicCanvas;
break;
case RigidBodySpring:
currentCanvas = auxillaryCanvas;
drawSpring(Spring(_arg1.element));
currentCanvas = dynamicCanvas;
break;
case RigidBodyBungee:
currentCanvas = auxillaryCanvas;
drawSpring(Spring(_arg1.element));
currentCanvas = dynamicCanvas;
break;
case MouseSpring:
currentCanvas = auxillaryCanvas;
drawMouseSpring(MouseSpring(_arg1.element));
currentCanvas = dynamicCanvas;
break;
};
}
public function copy(_arg1:IFoamRenderer):void{
var _local3:Renderable;
var _local2:Array = renderables;
for each (_local3 in _local2) {
_arg1.addRenderable(_local3);
};
}
}
}//package org.generalrelativity.foam.view
Section 112
//Foam (org.generalrelativity.foam.Foam)
package org.generalrelativity.foam {
import flash.events.*;
import flash.display.*;
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.force.*;
import org.generalrelativity.foam.view.*;
import org.generalrelativity.foam.dynamics.element.*;
import org.generalrelativity.foam.dynamics.collision.*;
import org.generalrelativity.foam.dynamics.ode.*;
import org.generalrelativity.foam.dynamics.force.spring.*;
import org.generalrelativity.foam.dynamics.*;
import org.generalrelativity.foam.util.*;
import org.generalrelativity.foam.dynamics.enum.*;
import org.generalrelativity.foam.dynamics.ode.solver.*;
public class Foam extends Sprite {
private var _solverMap:SimpleMap;
private var _isSimulating:Boolean;
private var _mouseSpring:MouseSpring;
private var _engine:PhysicsEngine;
private var _renderer:IFoamRenderer;
private var _useMouseDragger:Boolean;
private var _renderMap:SimpleMap;
private var _globalForceGenerators:Array;
private var _defaultSolver:Class;
private var _timestep:Number;
private var _callOnAddedToStage:Array;
public static const DEFAULT_ODE_SOLVER:Class = RK4;
public static const STEP:String = "step";
public function Foam(){
_solverMap = new SimpleMap();
_renderMap = new SimpleMap();
_engine = new PhysicsEngine();
_globalForceGenerators = new Array();
_callOnAddedToStage = new Array();
_defaultSolver = Foam.DEFAULT_ODE_SOLVER;
_timestep = 1;
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);
}
private function onMouseUp(_arg1:MouseEvent):void{
_mouseSpring.destroy();
stopDrawing(_mouseSpring);
stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}
public function stopSimulating(_arg1:ISimulatable):void{
if (_solverMap.has(_arg1)){
_engine.removeODESolver(IODESolver(_solverMap.getValue(_arg1)));
_solverMap.remove(_arg1);
stopColliding(_arg1);
};
if (!_solverMap.keys.length){
stop();
};
}
public function setRenderer(_arg1:IFoamRenderer):void{
if (_renderer){
_renderer.copy(_arg1);
removeChild(DisplayObject(_renderer));
};
_renderer = _arg1;
addChild(DisplayObject(_renderer));
}
private function onMouseDown(_arg1:MouseEvent):void{
var _local2:Vector = new Vector(mouseX, mouseY);
var _local3:IBody = _engine.getBodyUnderPoint(_local2);
if (_local3){
_mouseSpring = new MouseSpring(_local3, _local2.minus(_local3.position), this);
addRenderable(new Renderable(_mouseSpring));
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp, false, 0, true);
};
}
public function stop():void{
if (_isSimulating){
_isSimulating = false;
removeEventListener(Event.ENTER_FRAME, stepForward);
};
}
public function removeGlobalForceGenerator(_arg1:IForceGenerator, _arg2:Boolean=false):void{
var _local4:ISimulatable;
var _local3:int = _globalForceGenerators.indexOf(_arg1);
if (_local3 > -1){
if (!_arg2){
for each (_local4 in _solverMap.keys) {
_local4.removeForceGenerator(_arg1);
};
};
_globalForceGenerators.splice(_globalForceGenerators.indexOf(_arg1), 1);
};
}
public function useMouseDragger(_arg1:Boolean):void{
if (!stage){
if (_callOnAddedToStage.indexOf(useMouseDragger) == -1){
_callOnAddedToStage.push(useMouseDragger, [_arg1]);
};
return;
};
if (_useMouseDragger != _arg1){
_useMouseDragger = _arg1;
if (_useMouseDragger){
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, false, 0, true);
} else {
stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
};
};
}
public function stepBackward(_arg1:Event=null):void{
_engine.step(-(_timestep));
_renderer.redraw();
dispatchEvent(new Event(Foam.STEP));
}
public function removeElement(_arg1:ISimulatable):void{
stopDrawing(_arg1);
stopSimulating(_arg1);
}
public function stopColliding(_arg1:ISimulatable):void{
_engine.removeCollidable(_arg1);
}
public function get engine():PhysicsEngine{
return (_engine);
}
public function get simulatables():Array{
return (_solverMap.keys);
}
public function stepForward(_arg1:Event=null):void{
_engine.step(_timestep);
_renderer.redraw();
dispatchEvent(new Event(Foam.STEP));
}
public function simulate():void{
if (((!(_isSimulating)) && (_solverMap.length))){
_isSimulating = true;
_renderer.draw();
addEventListener(Event.ENTER_FRAME, stepForward, false, 0, true);
};
}
public function get timestep():Number{
return (_timestep);
}
public function addGlobalForceGenerator(_arg1:IForceGenerator, _arg2:Boolean=true):void{
var _local3:ISimulatable;
if (_arg2){
for each (_local3 in _solverMap.keys) {
_local3.addForceGenerator(_arg1);
};
};
_globalForceGenerators.push(_arg1);
}
public function setCoarseCollisionDetector(_arg1:ICoarseCollisionDetector):void{
_engine.setCoarseCollisionDetector(_arg1);
}
public function set defaultSolver(_arg1:Class):void{
_defaultSolver = _arg1;
}
public function addRenderable(_arg1:Renderable):void{
_renderMap.put(_arg1.element, _arg1);
_renderer.addRenderable(_arg1);
}
public function set timestep(_arg1:Number):void{
_timestep = _arg1;
}
public function set solverIterations(_arg1:int):void{
_engine.solverIterations = _arg1;
}
private function onAddedToStage(_arg1:Event):void{
var _local2:Array;
var _local3:Function;
while (_callOnAddedToStage.length) {
_local2 = _callOnAddedToStage.pop();
_local3 = _callOnAddedToStage.pop();
_local3.apply(this, _local2);
};
}
public function setCollisionFactory(_arg1:ICollisionFactory):void{
_engine.setCollisionFactory(_arg1);
}
public function stopDrawing(_arg1):void{
if (_renderMap.has(_arg1)){
_renderer.removeRenderable(Renderable(_renderMap.getValue(_arg1)));
_renderMap.remove(_arg1);
if (_isSimulating){
_renderer.draw();
};
};
}
public function addElement(_arg1:ISimulatable, _arg2:Boolean=true, _arg3:Boolean=true, _arg4=null, _arg5:IODESolver=null):void{
var _local6:IForceGenerator;
if (((!((_arg1.mass == Simplification.INFINITE_MASS))) && ((_arg1 is IODE)))){
if (!_arg5){
_arg5 = new _defaultSolver(_arg1);
};
_solverMap.put(_arg1, _arg5);
_engine.addODESolver(_arg5);
for each (_local6 in _globalForceGenerators) {
_arg1.addForceGenerator(_local6);
};
};
if (_arg2){
_engine.addCollidable(_arg1);
};
if (_arg3){
if (!_renderer){
_renderer = new SimpleFoamRenderer();
addChild(DisplayObject(_renderer));
};
addRenderable(new Renderable(_arg1, !((_arg1.mass == Simplification.INFINITE_MASS)), _arg4));
};
}
}
}//package org.generalrelativity.foam
Section 113
//AGButton (AGButton)
package {
import flash.display.*;
public dynamic class AGButton extends SimpleButton {
}
}//package
Section 114
//BackgroundLayer (BackgroundLayer)
package {
import flash.display.*;
public class BackgroundLayer extends Sprite {
const WONLEVELFX:int = 5;
const LIGHTNINGPROJECTILE:int = 14;
const HURT2FX:int = 14;
const CATAPULT:int = 2;
const MOVEDESKIMOFX:int = 6;
const FOREST:int = 2;
const BIGBOULDERTRACTION:Number = 0.9;
const ICEWITCH:int = 5;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const IRONRIMMEDPROJECTILE:int = 16;
const ESKIMOFRICTION:Number = 0.9;
const FOAMESKIMO:int = 1;
const DRAGONFX:int = 19;
const KNIGHTPROJECTILE:int = 19;
const TITLE:int = 1;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const TREEHEIGHT:int = 100;
const NUMLEVELS:int = 20;
const HURT1FX:int = 13;
const TOPBOUNDARY:int = 0;
const ESKIMODIEDFX:int = 9;
const SHOCKWITCH:int = 6;
const ICE:int = 4;
const BIGBOULDERSIZE:int = 25;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const SCREENHEIGHT:int = 480;
const ICEPROJECTILE:int = 13;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const CLIFFS:int = 4;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const WOOD:int = 0;
const BATTLE:int = 6;
const WITCHFX:int = 23;
const SCREENWIDTH:int = 640;
const BUTTONSHORTFX:int = 29;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const STATE_PLACINGESKIMO:int = 1;
const IRON:int = 3;
const SHOTHITFX:int = 22;
const TREEWIDTH:int = 20;
const SHOCKFX:int = 21;
const ICEBLOCKMASS:int = 20;
const FOAMBLOCK:int = 3;
const DELETE_BLOCK:int = 2;
const BUTTONCLICKFX:int = 10;
const BIGBOULDER1:int = 99;
const BIGBOULDER2:int = 102;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const NOPEFX:int = 12;
const TREBUCHET_CLEARANCE:int = 150;
const SCROLLLIMIT:int = 25;
const TREBUCHET:int = 1;
const HOLDBLOCK:int = 104;
const SHOCKDRAGON:int = 3;
const ROCKPROJECTILE:int = 15;
const BACKTOPBOUNDARY:int = 0;
const ESKIMOMASS:int = 200;
const COINFX:int = 18;
const PLACEDBLOCKFX:int = 7;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const ESKIMOWIDTH:int = 15;
const FIREWITCH:int = 4;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const BLOCKWIDTH:int = 35;
const SPACEBAR:int = 32;
const BIGBOULDERMASS:int = 100;
const CATAPULTSHOTFX:int = 17;
const SCROLLAMOUNT:int = 20;
const FISTPOUNDSOUND:int = 27;
const MUDCOST:int = 1;
const CANNONBALLPROJECTILE:int = 17;
const FOAMBOULDER:int = 2;
const THRONEWIDTH:int = 31;
const SLOPEFRICTION:Number = 0;
const FOAMLANDSCAPE:int = 4;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const LAKE:int = 3;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const FLYERCLOSESPEED:int = 4;
const BACKLEFTBOUNDARY:int = 0;
const MUD:int = 1;
const TREE:int = 103;
const DECREASESIZE:int = 40;
const TREEMASS:Number = 50;
const TREEBOUNCE:Number = 0.1;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const MEDBOULDER1:int = 98;
const MEDBOULDER2:int = 101;
const EXPORT:int = 96;
const BIGBOULDERBOUNCE:Number = 0.5;
const TREBUCHETSHOTFX:int = 16;
const NOBLOCKSFX:int = 11;
const SLOPE_POINT:int = 51;
const LOSTLEVELFX:int = 3;
const NO_BUILD_STATE:int = 0;
const STATE_AVALANCHE:int = 3;
const REMOVEDBLOCKFX:int = 8;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FOAMCATAPULT:int = 5;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const ICEBLOCKFRICTION:Number = 0.7;
const SLOPE_STARTING_POINT:int = 49;
const ICEBLOCKBOUNCE:Number = 0;
const SMALLBOULDER2:int = 100;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const SMALLBOULDER1:int = 97;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
public var moveSpeedX:Number;// = 0
public var moveSpeedY:Number;// = 0
public var backHeight:Number;// = 0
public var backWidth:Number;// = 0
}
}//package
Section 115
//BattleMusic (BattleMusic)
package {
import flash.media.*;
public dynamic class BattleMusic extends Sound {
}
}//package
Section 116
//BeatenCrown (BeatenCrown)
package {
import flash.display.*;
public dynamic class BeatenCrown extends MovieClip {
}
}//package
Section 117
//Block (Block)
package {
import flash.events.*;
import flash.display.*;
import org.generalrelativity.foam.view.*;
import org.flintparticles.twoD.renderers.*;
import flash.net.*;
import mochi.*;
public class Block extends MovieClip {
const WONLEVELFX:int = 5;
const LIGHTNINGPROJECTILE:int = 14;
const HURT2FX:int = 14;
const CATAPULT:int = 2;
const MOVEDESKIMOFX:int = 6;
const FOREST:int = 2;
const BIGBOULDERTRACTION:Number = 0.9;
const ICEWITCH:int = 5;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const IRONRIMMEDPROJECTILE:int = 16;
const ESKIMOFRICTION:Number = 0.9;
const FOAMESKIMO:int = 1;
const DRAGONFX:int = 19;
const KNIGHTPROJECTILE:int = 19;
const TITLE:int = 1;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const TREEHEIGHT:int = 100;
const NUMLEVELS:int = 20;
const HURT1FX:int = 13;
const TOPBOUNDARY:int = 0;
const ESKIMODIEDFX:int = 9;
const SHOCKWITCH:int = 6;
const ICE:int = 4;
const BIGBOULDERSIZE:int = 25;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const SCREENHEIGHT:int = 480;
const ICEPROJECTILE:int = 13;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const CLIFFS:int = 4;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const WOOD:int = 0;
const BATTLE:int = 6;
const WITCHFX:int = 23;
const SCREENWIDTH:int = 640;
const BUTTONSHORTFX:int = 29;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const STATE_PLACINGESKIMO:int = 1;
const IRON:int = 3;
const SHOTHITFX:int = 22;
const TREEWIDTH:int = 20;
const SHOCKFX:int = 21;
const ICEBLOCKMASS:int = 20;
const FOAMBLOCK:int = 3;
const DELETE_BLOCK:int = 2;
const BUTTONCLICKFX:int = 10;
const BIGBOULDER1:int = 99;
const BIGBOULDER2:int = 102;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const NOPEFX:int = 12;
const TREBUCHET_CLEARANCE:int = 150;
const SCROLLLIMIT:int = 25;
const TREBUCHET:int = 1;
const HOLDBLOCK:int = 104;
const SHOCKDRAGON:int = 3;
const ROCKPROJECTILE:int = 15;
const BACKTOPBOUNDARY:int = 0;
const ESKIMOMASS:int = 200;
const COINFX:int = 18;
const PLACEDBLOCKFX:int = 7;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const ESKIMOWIDTH:int = 15;
const FIREWITCH:int = 4;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const BLOCKWIDTH:int = 35;
const SPACEBAR:int = 32;
const BIGBOULDERMASS:int = 100;
const CATAPULTSHOTFX:int = 17;
const SCROLLAMOUNT:int = 20;
const FISTPOUNDSOUND:int = 27;
const MUDCOST:int = 1;
const CANNONBALLPROJECTILE:int = 17;
const FOAMBOULDER:int = 2;
const THRONEWIDTH:int = 31;
const SLOPEFRICTION:Number = 0;
const FOAMLANDSCAPE:int = 4;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const LAKE:int = 3;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const FLYERCLOSESPEED:int = 4;
const BACKLEFTBOUNDARY:int = 0;
const MUD:int = 1;
const TREE:int = 103;
const DECREASESIZE:int = 40;
const TREEMASS:Number = 50;
const TREEBOUNCE:Number = 0.1;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const MEDBOULDER1:int = 98;
const MEDBOULDER2:int = 101;
const EXPORT:int = 96;
const BIGBOULDERBOUNCE:Number = 0.5;
const TREBUCHETSHOTFX:int = 16;
const NOBLOCKSFX:int = 11;
const SLOPE_POINT:int = 51;
const LOSTLEVELFX:int = 3;
const NO_BUILD_STATE:int = 0;
const STATE_AVALANCHE:int = 3;
const REMOVEDBLOCKFX:int = 8;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FOAMCATAPULT:int = 5;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const ICEBLOCKFRICTION:Number = 0.7;
const SLOPE_STARTING_POINT:int = 49;
const ICEBLOCKBOUNCE:Number = 0;
const SMALLBOULDER2:int = 100;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const SMALLBOULDER1:int = 97;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
public var blockWorth:int;// = 1
public var blockHere:Boolean;// = false
public var blockHighlight:BlockHighlight;
public var linkId:int;// = 0
public var xPos:int;// = 0
public var yPos:int;// = 0
public var blockType:int;// = 0
public var permanentlyEmpty:Boolean;// = false
public function Block(_arg1:int, _arg2:int){
blockHighlight = new BlockHighlight();
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9);
this.mouseChildren = false;
yPos = _arg1;
xPos = _arg2;
}
private function mouseOverClip(_arg1:MouseEvent){
if (!permanentlyEmpty){
addChild(blockHighlight);
if (_arg1.buttonDown){
if (_arg1.target.parent.parent.mouseBuildState == DELETE_BLOCK){
if (blockHere){
removeBlock(_arg1);
if (_arg1.target.parent.parent.currentBlocks < _arg1.target.parent.parent.maxBlocks){
_arg1.target.parent.parent.currentBlocks = (_arg1.target.parent.parent.currentBlocks + blockWorth);
};
_arg1.target.parent.parent.leftHud.bricksAvailableText.text = String(_arg1.target.parent.parent.currentBlocks);
};
} else {
if ((((_arg1.target.parent.parent.mouseBuildState == BUILD_BLOCK)) && (!(_arg1.target.parent.parent.dontBuildFlag)))){
blockType = _arg1.target.parent.parent.currentBrickType;
blockWorth = _arg1.target.parent.parent.currentBrickCost[blockType];
if ((((_arg1.target.parent.parent.currentBlocks >= blockWorth)) && (!(blockHere)))){
addBlock();
_arg1.target.parent.parent.currentBlocks = (_arg1.target.parent.parent.currentBlocks - blockWorth);
_arg1.target.parent.parent.leftHud.bricksAvailableText.text = String(_arg1.target.parent.parent.currentBlocks);
} else {
if (_arg1.target.parent.parent.currentBlocks <= 0){
SoundManager.playFx(NOBLOCKSFX);
};
};
};
};
_arg1.target.parent.parent.updateHudBricks();
};
};
}
function frame3(){
stop();
}
function frame4(){
stop();
}
function frame7(){
stop();
}
function frame5(){
stop();
}
function frame8(){
stop();
}
public function deactivate(){
removeEventListener(MouseEvent.MOUSE_DOWN, mousePressed);
removeEventListener(MouseEvent.MOUSE_OVER, mouseOverClip);
removeEventListener(MouseEvent.MOUSE_OUT, mouseLeftClip);
buttonMode = false;
useHandCursor = false;
}
private function addBlock(){
SoundManager.playFx(PLACEDBLOCKFX);
gotoAndStop((blockType + 1));
blockHere = true;
}
function frame2(){
stop();
}
private function removeBlock(_arg1:MouseEvent){
SoundManager.playFx(REMOVEDBLOCKFX);
gotoAndStop(((_arg1.target.parent.parent.currentBrickType + 1) + 4));
blockHere = false;
}
function frame9(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
public function activate(){
addEventListener(MouseEvent.MOUSE_DOWN, mousePressed);
addEventListener(MouseEvent.ROLL_OVER, mouseOverClip);
addEventListener(MouseEvent.ROLL_OUT, mouseLeftClip);
buttonMode = true;
useHandCursor = true;
}
private function mouseLeftClip(_arg1:MouseEvent){
if (!permanentlyEmpty){
removeChild(blockHighlight);
};
}
private function mousePressed(_arg1:MouseEvent){
if (!permanentlyEmpty){
if (blockHere){
_arg1.target.parent.parent.mouseBuildState = DELETE_BLOCK;
removeBlock(_arg1);
if (_arg1.target.parent.parent.currentBlocks < _arg1.target.parent.parent.maxBlocks){
_arg1.target.parent.parent.currentBlocks = (_arg1.target.parent.parent.currentBlocks + blockWorth);
};
_arg1.target.parent.parent.leftHud.bricksAvailableText.text = String(_arg1.target.parent.parent.currentBlocks);
} else {
if (!_arg1.target.parent.parent.dontBuildFlag){
blockType = _arg1.target.parent.parent.currentBrickType;
blockWorth = _arg1.target.parent.parent.currentBrickCost[blockType];
_arg1.target.parent.parent.mouseBuildState = BUILD_BLOCK;
if (_arg1.target.parent.parent.currentBlocks >= blockWorth){
addBlock();
_arg1.target.parent.parent.currentBlocks = (_arg1.target.parent.parent.currentBlocks - blockWorth);
_arg1.target.parent.parent.leftHud.bricksAvailableText.text = String(_arg1.target.parent.parent.currentBlocks);
} else {
SoundManager.playFx(NOBLOCKSFX);
};
};
};
_arg1.target.parent.parent.updateHudBricks();
};
}
}
}//package
Section 118
//BlockExplosion (BlockExplosion)
package {
import flash.geom.*;
import org.flintparticles.common.initializers.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.common.counters.*;
import org.flintparticles.twoD.zones.*;
import org.flintparticles.twoD.emitters.*;
import org.flintparticles.twoD.actions.*;
import org.flintparticles.twoD.initializers.*;
import org.flintparticles.common.displayObjects.*;
public class BlockExplosion {
public var littleStones:Emitter2D;
public var fire:Emitter2D;
public var centerFire:Emitter2D;
public var stones:Emitter2D;
public var emitterArray:Array;
public var backFire:Emitter2D;
public var yPos:int;// = 0
public var xPos:int;// = 0
public function BlockExplosion(_arg1:int, _arg2:int){
stones = new Emitter2D();
littleStones = new Emitter2D();
fire = new Emitter2D();
centerFire = new Emitter2D();
backFire = new Emitter2D();
emitterArray = new Array();
super();
xPos = _arg1;
yPos = _arg2;
stones.counter = new Blast(8);
stones.addInitializer(new Lifetime(0.25, 0.75));
stones.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 40, 1)));
stones.addInitializer(new SharedImage(new RadialDot(20)));
stones.addInitializer(new ColorInit(4279308561, 4291611852));
stones.addAction(new Age());
stones.addAction(new Move());
stones.addAction(new Fade(0.5, 0));
stones.addAction(new RandomDrift(30, 30));
stones.x = _arg1;
stones.y = _arg2;
stones.start();
littleStones.counter = new Blast(10);
littleStones.addInitializer(new Lifetime(0.25, 0.75));
littleStones.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 150, 1)));
littleStones.addInitializer(new SharedImage(new RadialDot(5)));
littleStones.addInitializer(new ColorInit(4294967040, 4294901760));
littleStones.addAction(new Age());
littleStones.addAction(new Move());
littleStones.addAction(new Fade(1, 0));
littleStones.addAction(new RandomDrift(150, 150));
littleStones.x = _arg1;
littleStones.y = _arg2;
littleStones.start();
fire.counter = new Blast(5);
fire.addInitializer(new Lifetime(2, 3));
fire.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 20, 1)));
fire.addInitializer(new SharedImage(new Dot(5)));
fire.addAction(new Age());
fire.addAction(new Move());
fire.addAction(new ColorChange(2113915904, 0xCC0000));
fire.addAction(new ScaleImage(5, 1));
fire.x = _arg1;
fire.y = _arg2;
fire.start();
emitterArray.push(stones);
emitterArray.push(littleStones);
emitterArray.push(fire);
}
}
}//package
Section 119
//BlockHighlight (BlockHighlight)
package {
import flash.display.*;
public dynamic class BlockHighlight extends MovieClip {
}
}//package
Section 120
//BlockSkin (BlockSkin)
package {
import flash.display.*;
public dynamic class BlockSkin extends MovieClip {
public function BlockSkin(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame3(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame8(){
stop();
}
function frame9(){
stop();
}
}
}//package
Section 121
//BrickShop (BrickShop)
package {
import flash.display.*;
import org.generalrelativity.foam.view.*;
import org.flintparticles.twoD.renderers.*;
import flash.text.*;
import flash.net.*;
import mochi.*;
public class BrickShop extends MovieClip {
const WONLEVELFX:int = 5;
const LIGHTNINGPROJECTILE:int = 14;
const HURT2FX:int = 14;
const CATAPULT:int = 2;
const MOVEDESKIMOFX:int = 6;
const FOREST:int = 2;
const BIGBOULDERTRACTION:Number = 0.9;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const IRONRIMMEDPROJECTILE:int = 16;
const ESKIMOFRICTION:Number = 0.9;
const ICEWITCH:int = 5;
const DRAGONFX:int = 19;
const FOAMESKIMO:int = 1;
const KNIGHTPROJECTILE:int = 19;
const TITLE:int = 1;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const TREEHEIGHT:int = 100;
const NUMLEVELS:int = 20;
const HURT1FX:int = 13;
const TOPBOUNDARY:int = 0;
const SHOCKWITCH:int = 6;
const BIGBOULDERSIZE:int = 25;
const ICE:int = 4;
const SCREENHEIGHT:int = 480;
const ICEPROJECTILE:int = 13;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const CLIFFS:int = 4;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const WOOD:int = 0;
const BATTLE:int = 6;
const WITCHFX:int = 23;
const SCREENWIDTH:int = 640;
const BUTTONSHORTFX:int = 29;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const STATE_PLACINGESKIMO:int = 1;
const ESKIMODIEDFX:int = 9;
const TREEWIDTH:int = 20;
const SHOTHITFX:int = 22;
const SHOCKFX:int = 21;
const ICEBLOCKMASS:int = 20;
const IRON:int = 3;
const FOAMBLOCK:int = 3;
const DELETE_BLOCK:int = 2;
const BIGBOULDER1:int = 99;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const BUTTONCLICKFX:int = 10;
const TREBUCHET_CLEARANCE:int = 150;
const BIGBOULDER2:int = 102;
const SCROLLLIMIT:int = 25;
const TREBUCHET:int = 1;
const NOPEFX:int = 12;
const HOLDBLOCK:int = 104;
const ROCKPROJECTILE:int = 15;
const BACKTOPBOUNDARY:int = 0;
const ESKIMOMASS:int = 200;
const PLACEDBLOCKFX:int = 7;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const SHOCKDRAGON:int = 3;
const ESKIMOWIDTH:int = 15;
const FIREWITCH:int = 4;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const COINFX:int = 18;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const BLOCKWIDTH:int = 35;
const SPACEBAR:int = 32;
const BIGBOULDERMASS:int = 100;
const CATAPULTSHOTFX:int = 17;
const SCROLLAMOUNT:int = 20;
const FISTPOUNDSOUND:int = 27;
const MUDCOST:int = 1;
const CANNONBALLPROJECTILE:int = 17;
const THRONEWIDTH:int = 31;
const FOAMBOULDER:int = 2;
const SLOPEFRICTION:Number = 0;
const FOAMLANDSCAPE:int = 4;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const LAKE:int = 3;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const FLYERCLOSESPEED:int = 4;
const BACKLEFTBOUNDARY:int = 0;
const MUD:int = 1;
const TREE:int = 103;
const DECREASESIZE:int = 40;
const TREEMASS:Number = 50;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const TREEBOUNCE:Number = 0.1;
const MEDBOULDER1:int = 98;
const MEDBOULDER2:int = 101;
const EXPORT:int = 96;
const BIGBOULDERBOUNCE:Number = 0.5;
const TREBUCHETSHOTFX:int = 16;
const NOBLOCKSFX:int = 11;
const SLOPE_POINT:int = 51;
const LOSTLEVELFX:int = 3;
const NO_BUILD_STATE:int = 0;
const STATE_AVALANCHE:int = 3;
const REMOVEDBLOCKFX:int = 8;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FOAMCATAPULT:int = 5;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const ICEBLOCKFRICTION:Number = 0.7;
const SLOPE_STARTING_POINT:int = 49;
const ICEBLOCKBOUNCE:Number = 0;
const SMALLBOULDER2:int = 100;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const SMALLBOULDER1:int = 97;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
public var brickSelected:int;// = 1
public var speechBubble:MovieClip;
public var currentGoldText:TextField;
public var exitBarrel:SimpleButton;
public var stoneBarrel:MovieClip;
public var mudBarrel:MovieClip;
public var ironBarrel:MovieClip;
public var bricksAvailable:Array;
public var canBuy:Boolean;// = false
public var ironCost:int;// = 75
public var currentCost:int;// = 0
public var mudCost:int;// = 25
public var stoneCost:int;// = 50
public var currentBlockType:int;// = 0
public function BrickShop(){
bricksAvailable = [true, false, false, false];
super();
speechBubble.purchaseText.useHandCursor = true;
speechBubble.purchaseText.buttonMode = true;
mudBarrel.useHandCursor = true;
mudBarrel.buttonMode = true;
mudBarrel.mouseChildren = false;
stoneBarrel.useHandCursor = true;
stoneBarrel.buttonMode = true;
stoneBarrel.mouseChildren = false;
ironBarrel.useHandCursor = true;
ironBarrel.buttonMode = true;
ironBarrel.mouseChildren = false;
}
}
}//package
Section 122
//ButtonClickedSound (ButtonClickedSound)
package {
import flash.media.*;
public dynamic class ButtonClickedSound extends Sound {
}
}//package
Section 123
//ButtonShortSound (ButtonShortSound)
package {
import flash.media.*;
public dynamic class ButtonShortSound extends Sound {
}
}//package
Section 124
//Cannonball1 (Cannonball1)
package {
import flash.display.*;
public dynamic class Cannonball1 extends MovieClip {
}
}//package
Section 125
//Catapult (Catapult)
package {
import flash.display.*;
public class Catapult extends MovieClip {
const WONLEVELFX:int = 5;
const LIGHTNINGPROJECTILE:int = 14;
const HURT2FX:int = 14;
const CATAPULT:int = 2;
const MOVEDESKIMOFX:int = 6;
const FOREST:int = 2;
const BIGBOULDERTRACTION:Number = 0.9;
const ICEWITCH:int = 5;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const IRONRIMMEDPROJECTILE:int = 16;
const ESKIMOFRICTION:Number = 0.9;
const FOAMESKIMO:int = 1;
const DRAGONFX:int = 19;
const KNIGHTPROJECTILE:int = 19;
const TITLE:int = 1;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const TREEHEIGHT:int = 100;
const NUMLEVELS:int = 20;
const HURT1FX:int = 13;
const TOPBOUNDARY:int = 0;
const ESKIMODIEDFX:int = 9;
const SHOCKWITCH:int = 6;
const ICE:int = 4;
const BIGBOULDERSIZE:int = 25;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const SCREENHEIGHT:int = 480;
const ICEPROJECTILE:int = 13;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const CLIFFS:int = 4;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const WOOD:int = 0;
const BATTLE:int = 6;
const WITCHFX:int = 23;
const SCREENWIDTH:int = 640;
const BUTTONSHORTFX:int = 29;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const STATE_PLACINGESKIMO:int = 1;
const IRON:int = 3;
const SHOTHITFX:int = 22;
const TREEWIDTH:int = 20;
const SHOCKFX:int = 21;
const ICEBLOCKMASS:int = 20;
const FOAMBLOCK:int = 3;
const DELETE_BLOCK:int = 2;
const BUTTONCLICKFX:int = 10;
const BIGBOULDER1:int = 99;
const BIGBOULDER2:int = 102;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const NOPEFX:int = 12;
const TREBUCHET_CLEARANCE:int = 150;
const TREBUCHET:int = 1;
const SCROLLLIMIT:int = 25;
const HOLDBLOCK:int = 104;
const SHOCKDRAGON:int = 3;
const BACKTOPBOUNDARY:int = 0;
const ROCKPROJECTILE:int = 15;
const ESKIMOMASS:int = 200;
const COINFX:int = 18;
const PLACEDBLOCKFX:int = 7;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const ESKIMOWIDTH:int = 15;
const FIREWITCH:int = 4;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const BLOCKWIDTH:int = 35;
const SPACEBAR:int = 32;
const BIGBOULDERMASS:int = 100;
const CATAPULTSHOTFX:int = 17;
const SCROLLAMOUNT:int = 20;
const FISTPOUNDSOUND:int = 27;
const MUDCOST:int = 1;
const CANNONBALLPROJECTILE:int = 17;
const FOAMBOULDER:int = 2;
const THRONEWIDTH:int = 31;
const SLOPEFRICTION:Number = 0;
const FOAMLANDSCAPE:int = 4;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const LAKE:int = 3;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const FLYERCLOSESPEED:int = 4;
const BACKLEFTBOUNDARY:int = 0;
const MUD:int = 1;
const TREE:int = 103;
const DECREASESIZE:int = 40;
const TREEMASS:Number = 50;
const TREEBOUNCE:Number = 0.1;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const MEDBOULDER2:int = 101;
const EXPORT:int = 96;
const BIGBOULDERBOUNCE:Number = 0.5;
const MEDBOULDER1:int = 98;
const TREBUCHETSHOTFX:int = 16;
const NOBLOCKSFX:int = 11;
const SLOPE_POINT:int = 51;
const LOSTLEVELFX:int = 3;
const NO_BUILD_STATE:int = 0;
const STATE_AVALANCHE:int = 3;
const REMOVEDBLOCKFX:int = 8;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FOAMCATAPULT:int = 5;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const ICEBLOCKFRICTION:Number = 0.7;
const SLOPE_STARTING_POINT:int = 49;
const ICEBLOCKBOUNCE:Number = 0;
const SMALLBOULDER2:int = 100;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const SMALLBOULDER1:int = 97;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
public var reloadTime:int;// = 0
private var initialCounter:int;// = 0
public var reloadCounter:int;// = 0
public var shotCount:int;// = 0
public var animationDelay:int;// = 22
public var initialDelay:int;// = 0
public var passedInitialDelay:Boolean;// = false
public var type:int;// = 0
public var readyToShoot:Boolean;// = false
public var startAnimation:Boolean;// = false
public var shotType:int;// = 0
public var projectile:Projectiles;
public function Catapult(){
addFrameScript(0, frame1, 44, frame45);
}
function frame1(){
stop();
}
function frame45(){
gotoAndStop(1);
}
public function update(){
if (!passedInitialDelay){
initialCounter++;
if (initialCounter == (initialDelay - animationDelay)){
startAnimation = true;
} else {
startAnimation = false;
};
if (initialCounter > initialDelay){
passedInitialDelay = true;
readyToShoot = true;
};
} else {
if ((((reloadCounter == (reloadTime - animationDelay))) && ((shotCount > 0)))){
startAnimation = true;
} else {
startAnimation = false;
};
if (readyToShoot){
readyToShoot = false;
shotCount--;
reloadCounter = 0;
} else {
reloadCounter++;
if ((((reloadCounter >= reloadTime)) && ((shotCount > 0)))){
readyToShoot = true;
};
};
};
}
}
}//package
Section 126
//CatapultShotSound (CatapultShotSound)
package {
import flash.media.*;
public dynamic class CatapultShotSound extends Sound {
}
}//package
Section 127
//CliffBackground1 (CliffBackground1)
package {
public dynamic class CliffBackground1 extends BackgroundLayer {
}
}//package
Section 128
//CliffBackground2 (CliffBackground2)
package {
public dynamic class CliffBackground2 extends BackgroundLayer {
}
}//package
Section 129
//CliffBackground3 (CliffBackground3)
package {
public dynamic class CliffBackground3 extends BackgroundLayer {
}
}//package
Section 130
//CliffClouds (CliffClouds)
package {
import flash.display.*;
public dynamic class CliffClouds extends MovieClip {
}
}//package
Section 131
//CliffLevel1 (CliffLevel1)
package {
import flash.display.*;
public dynamic class CliffLevel1 extends Sprite {
}
}//package
Section 132
//CliffLevel2 (CliffLevel2)
package {
import flash.display.*;
public dynamic class CliffLevel2 extends Sprite {
}
}//package
Section 133
//CliffLevel3 (CliffLevel3)
package {
import flash.display.*;
public dynamic class CliffLevel3 extends Sprite {
}
}//package
Section 134
//CliffLevel4 (CliffLevel4)
package {
import flash.display.*;
public dynamic class CliffLevel4 extends Sprite {
}
}//package
Section 135
//CliffLevel5 (CliffLevel5)
package {
import flash.display.*;
public dynamic class CliffLevel5 extends Sprite {
}
}//package
Section 136
//CliffMusic (CliffMusic)
package {
import flash.media.*;
public dynamic class CliffMusic extends Sound {
}
}//package
Section 137
//CloseHUDButton (CloseHUDButton)
package {
import flash.display.*;
public dynamic class CloseHUDButton extends MovieClip {
public function CloseHUDButton(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 138
//CoinSound (CoinSound)
package {
import flash.media.*;
public dynamic class CoinSound extends Sound {
}
}//package
Section 139
//Collision (Collision)
package {
import flash.geom.*;
import flash.display.*;
public class Collision {
public function isColliding(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number=0):Boolean{
var _local4:Rectangle = getCollision(_arg1, _arg2, _arg3);
if (((!((_local4 == null))) && ((_local4.size.length > 0)))){
return (true);
};
return (false);
}
private function getAlphaMap(_arg1:DisplayObject, _arg2:Rectangle, _arg3:uint, _arg4:Rectangle):BitmapData{
var _local5:BitmapData = new BitmapData(_arg2.width, _arg2.height, true, 0);
var _local6:Matrix = new Matrix();
var _local7:Number = (_arg1.x - _arg4.x);
var _local8:Number = (_arg1.y - _arg4.y);
var _local9:Number = ((_arg4.x + _local7) - _arg2.x);
var _local10:Number = ((_arg4.y + _local8) - _arg2.y);
_local6.translate(_local9, _local10);
_local5.draw(_arg1, _local6);
var _local11:BitmapData = new BitmapData(_arg2.width, _arg2.height, false, 0);
_local11.copyChannel(_local5, _local5.rect, new Point(0, 0), BitmapDataChannel.ALPHA, _arg3);
return (_local11);
}
public function getCollision(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number=0):Rectangle{
var _local4:Rectangle;
var _local5:DisplayObjectContainer;
var _local6:Rectangle;
var _local7:Rectangle;
var _local8:Boolean;
var _local9:Rectangle;
var _local10:BitmapData;
var _local11:BitmapData;
var _local12:uint;
var _local13:Number;
if (_arg1.parent == _arg2.parent){
_local5 = _arg1.parent;
_local6 = _arg1.getBounds(_local5);
_local7 = _arg2.getBounds(_local5);
_local8 = _local6.intersects(_local7);
if (_local8){
_local9 = _local6.union(_local7);
_local10 = getAlphaMap(_arg1, _local9, BitmapDataChannel.RED, _local6);
_local11 = getAlphaMap(_arg2, _local9, BitmapDataChannel.GREEN, _local7);
_local10.draw(_local11, new Matrix(), new ColorTransform(), BlendMode.LIGHTEN);
if (_arg3 > 1){
_arg3 = 1;
};
if (_arg3 < 0){
_arg3 = 0;
};
if (_arg3 == 0){
_local12 = 65792;
} else {
_local13 = Math.round((_arg3 * 0xFF));
_local12 = (((_local13 << 16) | (_local13 << 8)) | 0);
};
_local4 = _local10.getColorBoundsRect(_local12, _local12);
_local10.getColorBoundsRect(_local12, _local12).x = (_local4.x + _local9.x);
_local4.y = (_local4.y + _local9.y);
return (_local4);
};
};
return (_local4);
}
public function getCollisionPoint(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number=0):Point{
var _local4:Point;
var _local6:Number;
var _local7:Number;
var _local5:Rectangle = getCollision(_arg1, _arg2, _arg3);
if (((!((_local5 == null))) && ((_local5.size.length > 0)))){
_local6 = ((_local5.left + _local5.right) / 2);
_local7 = ((_local5.top + _local5.bottom) / 2);
_local4 = new Point(_local6, _local7);
};
return (_local4);
}
}
}//package
Section 140
//DragonSound (DragonSound)
package {
import flash.media.*;
public dynamic class DragonSound extends Sound {
}
}//package
Section 141
//EskimoDiedSound (EskimoDiedSound)
package {
import flash.media.*;
public dynamic class EskimoDiedSound extends Sound {
}
}//package
Section 142
//EverythingHolder (EverythingHolder)
package {
import flash.display.*;
public dynamic class EverythingHolder extends MovieClip {
public function EverythingHolder(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14, 14, frame15, 15, frame16, 16, frame17, 17, frame18, 18, frame19, 19, frame20, 20, frame21, 21, frame22, 22, frame23, 23, frame24, 24, frame25, 25, frame26, 26, frame27, 27, frame28, 28, frame29, 29, frame30, 30, frame31, 31, frame32, 32, frame33, 33, frame34, 34, frame35, 35, frame36, 36, frame37, 37, frame38, 38, frame39, 39, frame40, 40, frame41, 41, frame42, 42, frame43, 43, frame44, 44, frame45, 45, frame46, 46, frame47, 47, frame48, 48, frame49, 49, frame50, 50, frame51, 51, frame52, 52, frame53, 53, frame54, 54, frame55, 55, frame56, 56, frame57, 57, frame58, 58, frame59, 59, frame60, 60, frame61, 61, frame62, 62, frame63, 63, frame64, 64, frame65, 65, frame66, 66, frame67, 67, frame68, 68, frame69, 69, frame70, 70, frame71, 71, frame72, 72, frame73, 73, frame74, 74, frame75, 75, frame76, 76, frame77, 77, frame78, 78, frame79, 79, frame80, 80, frame81, 81, frame82, 82, frame83, 83, frame84, 84, frame85, 85, frame86, 86, frame87, 87, frame88, 88, frame89, 89, frame90, 90, frame91, 91, frame92, 92, frame93, 93, frame94, 94, frame95, 95, frame96, 96, frame97, 97, frame98, 98, frame99, 99, frame100, 100, frame101, 101, frame102, 102, frame103, 103, frame104, 104, frame105, 105, frame106, 106, frame107, 107, frame108, 108, frame109, 109, frame110, 110, frame111, 111, frame112, 112, frame113, 113, frame114, 114, frame115, 115, frame116, 116, frame117, 117, frame118, 118, frame119, 119, frame120, 120, frame121, 121, frame122, 122, frame123, 123, frame124);
}
function frame70(){
stop();
}
function frame71(){
stop();
}
function frame72(){
stop();
}
function frame73(){
stop();
}
function frame74(){
stop();
}
function frame75(){
stop();
}
function frame76(){
stop();
}
function frame77(){
stop();
}
function frame78(){
stop();
}
function frame79(){
stop();
}
function frame80(){
stop();
}
function frame81(){
stop();
}
function frame82(){
stop();
}
function frame83(){
stop();
}
function frame84(){
stop();
}
function frame85(){
stop();
}
function frame86(){
stop();
}
function frame87(){
stop();
}
function frame88(){
stop();
}
function frame89(){
stop();
}
function frame90(){
stop();
}
function frame91(){
stop();
}
function frame92(){
stop();
}
function frame93(){
stop();
}
function frame94(){
stop();
}
function frame95(){
stop();
}
function frame96(){
stop();
}
function frame97(){
stop();
}
function frame98(){
stop();
}
function frame99(){
stop();
}
function frame12(){
stop();
}
function frame13(){
stop();
}
function frame14(){
stop();
}
function frame15(){
stop();
}
function frame16(){
stop();
}
function frame10(){
stop();
}
function frame11(){
stop();
}
function frame19(){
stop();
}
function frame17(){
stop();
}
function frame18(){
stop();
}
function frame100(){
stop();
}
function frame2(){
stop();
}
function frame102(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
}
function frame9(){
stop();
}
function frame3(){
stop();
}
function frame23(){
stop();
}
function frame24(){
stop();
}
function frame25(){
stop();
}
function frame26(){
stop();
}
function frame20(){
stop();
}
function frame21(){
stop();
}
function frame22(){
stop();
}
function frame103(){
stop();
}
function frame104(){
stop();
}
function frame105(){
stop();
}
function frame27(){
stop();
}
function frame8(){
stop();
}
function frame29(){
stop();
}
function frame109(){
stop();
}
function frame101(){
stop();
}
function frame28(){
stop();
}
function frame107(){
stop();
}
function frame108(){
stop();
}
function frame112(){
stop();
}
function frame113(){
stop();
}
function frame114(){
stop();
}
function frame115(){
stop();
}
function frame116(){
stop();
}
function frame30(){
stop();
}
function frame31(){
stop();
}
function frame32(){
stop();
}
function frame33(){
stop();
}
function frame34(){
stop();
}
function frame35(){
stop();
}
function frame36(){
stop();
}
function frame37(){
stop();
}
function frame38(){
stop();
}
function frame39(){
stop();
}
function frame106(){
stop();
}
function frame117(){
stop();
}
function frame118(){
stop();
}
function frame110(){
stop();
}
function frame111(){
stop();
}
function frame120(){
stop();
}
function frame121(){
stop();
}
function frame119(){
stop();
}
function frame123(){
stop();
}
function frame124(){
stop();
}
function frame40(){
stop();
}
function frame41(){
stop();
}
function frame42(){
stop();
}
function frame43(){
stop();
}
function frame44(){
stop();
}
function frame45(){
stop();
}
function frame46(){
stop();
}
function frame47(){
stop();
}
function frame48(){
stop();
}
function frame49(){
stop();
}
function frame122(){
stop();
}
function frame50(){
stop();
}
function frame51(){
stop();
}
function frame52(){
stop();
}
function frame53(){
stop();
}
function frame54(){
stop();
}
function frame55(){
stop();
}
function frame56(){
stop();
}
function frame57(){
stop();
}
function frame58(){
stop();
}
function frame59(){
stop();
}
function frame60(){
stop();
}
function frame61(){
stop();
}
function frame62(){
stop();
}
function frame63(){
stop();
}
function frame64(){
stop();
}
function frame65(){
stop();
}
function frame66(){
stop();
}
function frame67(){
stop();
}
function frame68(){
stop();
}
function frame69(){
stop();
}
}
}//package
Section 143
//FireBall (FireBall)
package {
import flash.display.*;
public dynamic class FireBall extends MovieClip {
}
}//package
Section 144
//FireDragon (FireDragon)
package {
public dynamic class FireDragon extends Flyer {
}
}//package
Section 145
//FireWitch (FireWitch)
package {
public dynamic class FireWitch extends Flyer {
}
}//package
Section 146
//FistPoundSound (FistPoundSound)
package {
import flash.media.*;
public dynamic class FistPoundSound extends Sound {
}
}//package
Section 147
//FloatThrone (FloatThrone)
package {
import flash.display.*;
public dynamic class FloatThrone extends MovieClip {
public var noThrone:MovieClip;
}
}//package
Section 148
//Flyer (Flyer)
package {
import flash.display.*;
public class Flyer extends MovieClip {
const WONLEVELFX:int = 5;
const LIGHTNINGPROJECTILE:int = 14;
const HURT2FX:int = 14;
const CATAPULT:int = 2;
const MOVEDESKIMOFX:int = 6;
const FOREST:int = 2;
const BIGBOULDERTRACTION:Number = 0.9;
const ICEWITCH:int = 5;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const IRONRIMMEDPROJECTILE:int = 16;
const ESKIMOFRICTION:Number = 0.9;
const FOAMESKIMO:int = 1;
const DRAGONFX:int = 19;
const KNIGHTPROJECTILE:int = 19;
const TITLE:int = 1;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const TREEHEIGHT:int = 100;
const NUMLEVELS:int = 20;
const HURT1FX:int = 13;
const TOPBOUNDARY:int = 0;
const ESKIMODIEDFX:int = 9;
const SHOCKWITCH:int = 6;
const ICE:int = 4;
const BIGBOULDERSIZE:int = 25;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const SCREENHEIGHT:int = 480;
const ICEPROJECTILE:int = 13;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const CLIFFS:int = 4;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const WOOD:int = 0;
const BATTLE:int = 6;
const WITCHFX:int = 23;
const SCREENWIDTH:int = 640;
const BUTTONSHORTFX:int = 29;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const STATE_PLACINGESKIMO:int = 1;
const IRON:int = 3;
const SHOTHITFX:int = 22;
const TREEWIDTH:int = 20;
const SHOCKFX:int = 21;
const ICEBLOCKMASS:int = 20;
const FOAMBLOCK:int = 3;
const DELETE_BLOCK:int = 2;
const BUTTONCLICKFX:int = 10;
const BIGBOULDER1:int = 99;
const BIGBOULDER2:int = 102;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const NOPEFX:int = 12;
const TREBUCHET_CLEARANCE:int = 150;
const SCROLLLIMIT:int = 25;
const TREBUCHET:int = 1;
const HOLDBLOCK:int = 104;
const SHOCKDRAGON:int = 3;
const ROCKPROJECTILE:int = 15;
const BACKTOPBOUNDARY:int = 0;
const ESKIMOMASS:int = 200;
const COINFX:int = 18;
const PLACEDBLOCKFX:int = 7;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const ESKIMOWIDTH:int = 15;
const FIREWITCH:int = 4;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const BLOCKWIDTH:int = 35;
const SPACEBAR:int = 32;
const BIGBOULDERMASS:int = 100;
const CATAPULTSHOTFX:int = 17;
const SCROLLAMOUNT:int = 20;
const FISTPOUNDSOUND:int = 27;
const MUDCOST:int = 1;
const CANNONBALLPROJECTILE:int = 17;
const FOAMBOULDER:int = 2;
const THRONEWIDTH:int = 31;
const SLOPEFRICTION:Number = 0;
const FOAMLANDSCAPE:int = 4;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const LAKE:int = 3;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const FLYERCLOSESPEED:int = 4;
const BACKLEFTBOUNDARY:int = 0;
const MUD:int = 1;
const TREE:int = 103;
const DECREASESIZE:int = 40;
const TREEMASS:Number = 50;
const TREEBOUNCE:Number = 0.1;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const MEDBOULDER1:int = 98;
const MEDBOULDER2:int = 101;
const EXPORT:int = 96;
const BIGBOULDERBOUNCE:Number = 0.5;
const TREBUCHETSHOTFX:int = 16;
const NOBLOCKSFX:int = 11;
const SLOPE_POINT:int = 51;
const LOSTLEVELFX:int = 3;
const NO_BUILD_STATE:int = 0;
const STATE_AVALANCHE:int = 3;
const REMOVEDBLOCKFX:int = 8;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FOAMCATAPULT:int = 5;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const ICEBLOCKFRICTION:Number = 0.7;
const SLOPE_STARTING_POINT:int = 49;
const ICEBLOCKBOUNCE:Number = 0;
const SMALLBOULDER2:int = 100;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const SMALLBOULDER1:int = 97;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
public var clipLength:int;// = 0
public var clipHeight:int;// = 0
public var readyToFire:Boolean;// = true
public var fireCounter:int;// = 50
private var firePoint:int;// = 50
public var flyerType:String;// = ""
public function update(){
if (!readyToFire){
fireCounter++;
if (fireCounter >= firePoint){
fireCounter = 0;
readyToFire = true;
};
} else {
readyToFire = false;
};
}
}
}//package
Section 149
//FlyerShotSound (FlyerShotSound)
package {
import flash.media.*;
public dynamic class FlyerShotSound extends Sound {
}
}//package
Section 150
//ForestBackground1 (ForestBackground1)
package {
public dynamic class ForestBackground1 extends BackgroundLayer {
}
}//package
Section 151
//ForestBackground2 (ForestBackground2)
package {
public dynamic class ForestBackground2 extends BackgroundLayer {
}
}//package
Section 152
//ForestBackground3 (ForestBackground3)
package {
public dynamic class ForestBackground3 extends BackgroundLayer {
}
}//package
Section 153
//ForestClouds (ForestClouds)
package {
import flash.display.*;
public dynamic class ForestClouds extends MovieClip {
}
}//package
Section 154
//ForestLevel1 (ForestLevel1)
package {
import flash.display.*;
public dynamic class ForestLevel1 extends Sprite {
}
}//package
Section 155
//ForestLevel2 (ForestLevel2)
package {
import flash.display.*;
public dynamic class ForestLevel2 extends Sprite {
}
}//package
Section 156
//ForestLevel3 (ForestLevel3)
package {
import flash.display.*;
public dynamic class ForestLevel3 extends Sprite {
}
}//package
Section 157
//ForestLevel4 (ForestLevel4)
package {
import flash.display.*;
public dynamic class ForestLevel4 extends Sprite {
}
}//package
Section 158
//ForestLevel5 (ForestLevel5)
package {
import flash.display.*;
public dynamic class ForestLevel5 extends Sprite {
}
}//package
Section 159
//ForestMusic (ForestMusic)
package {
import flash.media.*;
public dynamic class ForestMusic extends Sound {
}
}//package
Section 160
//ForestWater (ForestWater)
package {
import flash.display.*;
public dynamic class ForestWater extends MovieClip {
}
}//package
Section 161
//ForestWater2 (ForestWater2)
package {
import flash.display.*;
public dynamic class ForestWater2 extends MovieClip {
}
}//package
Section 162
//FreezeSound (FreezeSound)
package {
import flash.media.*;
public dynamic class FreezeSound extends Sound {
}
}//package
Section 163
//FxButton (FxButton)
package {
import flash.display.*;
public dynamic class FxButton extends MovieClip {
}
}//package
Section 164
//GameLevel (GameLevel)
package {
import flash.events.*;
import caurina.transitions.*;
import flash.geom.*;
import flash.display.*;
import org.generalrelativity.foam.math.*;
import org.generalrelativity.foam.dynamics.force.*;
import org.generalrelativity.foam.view.*;
import org.generalrelativity.foam.dynamics.element.body.*;
import org.generalrelativity.foam.dynamics.force.spring.*;
import org.generalrelativity.foam.util.*;
import org.generalrelativity.foam.dynamics.enum.*;
import org.flintparticles.twoD.renderers.*;
import org.generalrelativity.foam.*;
import flash.net.*;
import mochi.*;
import flash.ui.*;
public class GameLevel extends Sprite {
const LIGHTNINGPROJECTILE:int = 14;
const CATAPULT:int = 2;
const ICEWITCH:int = 5;
const FOREST:int = 2;
const FOAMESKIMO:int = 1;
const IRONRIMMEDPROJECTILE:int = 16;
const KNIGHTPROJECTILE:int = 19;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const NUMLEVELS:int = 20;
const TOPBOUNDARY:int = 0;
const SCREENHEIGHT:int = 480;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const BATTLE:int = 6;
const SCREENWIDTH:int = 640;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const IRON:int = 3;
const SHOTHITFX:int = 22;
const TREEWIDTH:int = 20;
const DELETE_BLOCK:int = 2;
const BUTTONCLICKFX:int = 10;
const BIGBOULDER1:int = 99;
const BIGBOULDER2:int = 102;
const TREBUCHET_CLEARANCE:int = 150;
const SCROLLLIMIT:int = 25;
const BACKTOPBOUNDARY:int = 0;
const ESKIMOMASS:int = 200;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const ESKIMOWIDTH:int = 15;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const SPACEBAR:int = 32;
const BLOCKWIDTH:int = 35;
const BIGBOULDERMASS:int = 100;
const SCROLLAMOUNT:int = 20;
const MUDCOST:int = 1;
const FOAMBOULDER:int = 2;
const THRONEWIDTH:int = 31;
const SLOPEFRICTION:Number = 0;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const LAKE:int = 3;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const FLYERCLOSESPEED:int = 4;
const NOBLOCKSFX:int = 11;
const DECREASESIZE:int = 40;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const MEDBOULDER1:int = 98;
const MEDBOULDER2:int = 101;
const BIGBOULDERBOUNCE:Number = 0.5;
const TREBUCHETSHOTFX:int = 16;
const SLOPE_POINT:int = 51;
const REMOVEDBLOCKFX:int = 8;
const NO_BUILD_STATE:int = 0;
const FOAMCATAPULT:int = 5;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const ICEBLOCKFRICTION:Number = 0.7;
const SLOPE_STARTING_POINT:int = 49;
const ICEBLOCKBOUNCE:Number = 0;
const SMALLBOULDER2:int = 100;
const SMALLBOULDER1:int = 97;
const WONLEVELFX:int = 5;
const MOVEDESKIMOFX:int = 6;
const HURT2FX:int = 14;
const BIGBOULDERTRACTION:Number = 0.9;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const ESKIMOFRICTION:Number = 0.9;
const DRAGONFX:int = 19;
const TITLE:int = 1;
const TREEHEIGHT:int = 100;
const HURT1FX:int = 13;
const ESKIMODIEDFX:int = 9;
const SHOCKWITCH:int = 6;
const ICE:int = 4;
const BIGBOULDERSIZE:int = 25;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const CLIFFS:int = 4;
const ICEPROJECTILE:int = 13;
const WOOD:int = 0;
const WITCHFX:int = 23;
const BUTTONSHORTFX:int = 29;
const STATE_PLACINGESKIMO:int = 1;
const NOPEFX:int = 12;
const SHOCKFX:int = 21;
const ICEBLOCKMASS:int = 20;
const FOAMBLOCK:int = 3;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const TREBUCHET:int = 1;
const HOLDBLOCK:int = 104;
const SHOCKDRAGON:int = 3;
const ROCKPROJECTILE:int = 15;
const PLACEDBLOCKFX:int = 7;
const COINFX:int = 18;
const FIREWITCH:int = 4;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const CATAPULTSHOTFX:int = 17;
const CANNONBALLPROJECTILE:int = 17;
const FISTPOUNDSOUND:int = 27;
const FOAMLANDSCAPE:int = 4;
const BACKLEFTBOUNDARY:int = 0;
const TREEMASS:Number = 50;
const MUD:int = 1;
const TREE:int = 103;
const LOSTLEVELFX:int = 3;
const TREEBOUNCE:Number = 0.1;
const EXPORT:int = 96;
const STATE_AVALANCHE:int = 3;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
public var maxBlocks:int;// = 0
private var moveClouds:MovieClip;
private var hudBricks:Array;
private var signTutorial:SignTutorial;
private var foregroundHeight:Number;// = 0
public var currentBlocks:int;// = 0
private var zoomedIn:Boolean;// = true
private var treeStands:Array;
private var trees:Array;
private var flyerBoundary:Number;// = 0
private var flyingThings:Array;
private var slopeShape:Sprite;
private var renderer:BitmapRenderer;
private var viewPosX:int;// = 0
private var viewPosY:int;// = 0
private var lowestYPoint:Number;// = 0
private var linkPhysics:Array;
private var blockPhysics:Array;
private var foregroundGraphics:Sprite;
private var upPressed:Boolean;// = false
private var downPressed:Boolean;// = false
public var rightHud:RightHud;
private var scrollArrow:ScrollArrow;
public var mouseBuildState:int;// = 0
public var levelScore:int;// = 0
private var currentGold:int;// = 0
private var mouseClip:MovieClip;
private var currentLevel:int;// = 0
private var scoreScreen:ScoreScreen;
public var currentBrickType:int;// = 0
private var arms:Array;
private var inShop:Boolean;// = false
private var approachFlyers:Array;
private var zoomAmount:Number;// = 1
private var leftPressed:Boolean;// = false
public var currentBrickCost:Array;
private var blockGraphics:Array;
private var foregroundWidth:Number;// = 0
public var maxTime:int;// = 0
private var rightPressed:Boolean;// = false
private var prevHealth:int;// = 100
public var levelWon:Boolean;// = true
private var slopePoints:Array;
private var screenObscurer:ScreenObscurer;
public var dontBuildFlag:Boolean;// = false
private var foregroundBoulders:Array;
private var hurtSoundUpdater:int;// = 0
private var levelBackground1:BackgroundLayer;
private var levelBackground2:BackgroundLayer;
private var levelBackground3:BackgroundLayer;
private var mouseHidden:Boolean;// = false
private var particles:Array;
private var foam:Foam;
private var throneSkin:RedThrone;
private var brickShop:BrickShop;
private var eskimoMarker:RigidBody;
private var playedSplash:Boolean;// = false
private var armLastHit:Array;
private var clipsToRemove:Array;
private var validSpot:Boolean;// = false
private var levelState:int;// = 0
public var leftHud:LeftHud;
private var projectiles:Array;
private var lineSegments:Array;
public var currentTime:int;// = 0
private var levelForeground:Sprite;
private var viewSpeedX:int;// = 0
private var viewSpeedY:int;// = 0
public var iceBlocks:Array;
public function GameLevel(_arg1:int){
var _local2:RigidBody;
var _local3:Flyer;
var _local4:HudRepBrick;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local10:int;
var _local11:int;
var _local15:int;
var _local17:int;
var _local18:int;
var _local21:*;
var _local22:Circle;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
super();
levelForeground = new Sprite();
slopePoints = new Array();
lineSegments = new Array();
foregroundBoulders = new Array();
trees = new Array();
treeStands = new Array();
flyingThings = new Array();
approachFlyers = new Array();
slopeShape = new Sprite();
blockPhysics = new Array();
blockGraphics = new Array();
linkPhysics = new Array();
iceBlocks = new Array();
clipsToRemove = new Array();
throneSkin = new RedThrone();
throneSkin.moveKingText.visible = false;
scoreScreen = new ScoreScreen();
leftHud = new LeftHud();
rightHud = new RightHud();
hudBricks = new Array();
projectiles = new Array();
currentBrickCost = new Array(WOODCOST, MUDCOST, STONECOST, IRONCOST);
brickShop = new BrickShop();
particles = new Array();
foam = new Foam();
scrollArrow = new ScrollArrow();
mouseClip = new FloatThrone();
currentLevel = _arg1;
currentGold = GameManager.playerGold;
levelState = STATE_PLACINGESKIMO;
levelBackground1 = new GameManager.levelInfo[_arg1].backgroundLayer1();
levelBackground2 = new GameManager.levelInfo[_arg1].backgroundLayer2();
levelBackground3 = new GameManager.levelInfo[_arg1].backgroundLayer3();
foregroundGraphics = new GameManager.levelInfo[_arg1].foregroundGraphics();
foregroundWidth = GameManager.levelInfo[_arg1].levelWidth;
foregroundHeight = GameManager.levelInfo[_arg1].levelHeight;
levelBackground3.backWidth = GameManager.levelInfo[_arg1].background3Width;
levelBackground3.backHeight = GameManager.levelInfo[_arg1].background3Height;
levelBackground2.backWidth = GameManager.levelInfo[_arg1].background2Width;
levelBackground2.backHeight = GameManager.levelInfo[_arg1].background2Height;
levelForeground.x = (-1 * ((foregroundWidth - SCREENWIDTH) / 2));
levelForeground.y = (-1 * ((foregroundHeight - SCREENHEIGHT) / 2));
moveClouds = new GameManager.levelInfo[_arg1].cloudType();
moveClouds.y = GameManager.levelInfo[_arg1].cloudPosY;
levelBackground1.x = (SCREENWIDTH / 2);
levelBackground1.y = (SCREENHEIGHT / 2);
levelBackground2.x = (SCREENWIDTH / 2);
levelBackground2.y = (SCREENHEIGHT / 2);
levelBackground3.x = (SCREENWIDTH / 2);
levelBackground3.y = (SCREENHEIGHT / 2);
viewSpeedX = (((foregroundWidth - SCREENWIDTH) / 2) / SCROLLLIMIT);
viewSpeedY = (((foregroundHeight - SCREENHEIGHT) / 2) / SCROLLLIMIT);
levelBackground3.moveSpeedX = (((levelBackground3.backWidth - SCREENWIDTH) / 2) / SCROLLLIMIT);
levelBackground3.moveSpeedY = (((levelBackground3.backHeight - SCREENHEIGHT) / 2) / SCROLLLIMIT);
levelBackground2.moveSpeedX = (((levelBackground2.backWidth - SCREENWIDTH) / 2) / SCROLLLIMIT);
levelBackground2.moveSpeedY = (((levelBackground2.backHeight - SCREENHEIGHT) / 2) / SCROLLLIMIT);
addChild(levelBackground1);
addChild(levelBackground2);
addChild(levelBackground3);
addChild(levelForeground);
setChildIndex(levelBackground1, GameManager.levelInfo[_arg1].background1Depth);
setChildIndex(levelBackground2, GameManager.levelInfo[_arg1].background2Depth);
setChildIndex(levelBackground3, GameManager.levelInfo[_arg1].background3Depth);
setChildIndex(levelForeground, GameManager.levelInfo[_arg1].foregroundDepth);
levelForeground.addChild(moveClouds);
leftHud.notPurchased.visible = false;
leftHud.closeHudButton.gotoAndStop("close");
leftHud.currentGoldText.text = String(currentGold);
rightHud.healthContainer.healthBar.gotoAndStop(100);
leftHud.zoomButton.gotoAndStop(1);
leftHud.woodBrick.gotoAndStop("wood");
leftHud.mudBrick.gotoAndStop("mud");
leftHud.mudBrick.alpha = 0.3;
leftHud.stoneBrick.gotoAndStop("stone");
leftHud.stoneBrick.alpha = 0.3;
leftHud.ironBrick.gotoAndStop("iron");
leftHud.ironBrick.alpha = 0.3;
leftHud.woodBrick.buttonMode = true;
leftHud.woodBrick.useHandCursor = true;
leftHud.mudBrick.buttonMode = true;
leftHud.mudBrick.useHandCursor = true;
leftHud.stoneBrick.buttonMode = true;
leftHud.stoneBrick.useHandCursor = true;
leftHud.ironBrick.buttonMode = true;
leftHud.ironBrick.useHandCursor = true;
leftHud.woodBrick.addEventListener(MouseEvent.CLICK, switchBricks);
leftHud.mudBrick.addEventListener(MouseEvent.CLICK, switchBricks);
leftHud.stoneBrick.addEventListener(MouseEvent.CLICK, switchBricks);
leftHud.ironBrick.addEventListener(MouseEvent.CLICK, switchBricks);
addChild(leftHud);
rightHud.x = 700;
rightHud.timeContainer.timeBar.gotoAndStop(100);
addChild(rightHud);
var _local12:int;
var _local13:int;
var _local14:int;
while (_local14 < GameManager.levelInfo[_arg1].startingBlocks) {
_local4 = new HudRepBrick();
if (_local12 == 5){
_local12 = 0;
_local13++;
};
_local4.x = (107 - (_local12 * 15));
_local4.y = (200 - (_local13 * 15));
leftHud.addChild(_local4);
if (_local14 == (GameManager.levelInfo[_arg1].startingBlocks - 1)){
_local4.gotoAndStop("selected");
};
hudBricks.push(_local4);
_local12++;
_local14++;
};
_local14 = 0;
while (_local14 <= IRON) {
if (GameManager.bricksPurchased[_local14]){
brickShop.bricksAvailable[_local14] = true;
};
_local14++;
};
maxBlocks = GameManager.levelInfo[_arg1].startingBlocks;
currentBlocks = maxBlocks;
leftHud.bricksAvailableText.text = String(maxBlocks);
leftHud.brickTypeLabel.gotoAndStop("wood");
levelForeground.addChild(foam);
foam.setRenderer(new DisplayObjectFoamRenderer());
foam.solverIterations = 2;
foam.addGlobalForceGenerator(new Gravity(new Vector(0, 1.3)));
foam.addGlobalForceGenerator(new Friction(0.01));
var _local16:int = GameManager.levelInfo[_arg1].slopePointPos[0].length;
slopeShape.graphics.lineStyle(5, 0);
slopeShape.graphics.beginFill(0xCCCCCC);
slopeShape.graphics.moveTo(GameManager.levelInfo[_arg1].slopePointPos[0][0], GameManager.levelInfo[_arg1].slopePointPos[1][0]);
lowestYPoint = GameManager.levelInfo[_arg1].slopePointPos[1][0];
_local11 = 0;
_local14 = 1;
while (_local14 < _local16) {
if (GameManager.levelInfo[_arg1].slopePointPos[1][_local14] > lowestYPoint){
lowestYPoint = GameManager.levelInfo[_arg1].slopePointPos[1][_local14];
};
slopeShape.graphics.lineTo(GameManager.levelInfo[_arg1].slopePointPos[0][_local14], GameManager.levelInfo[_arg1].slopePointPos[1][_local14]);
_local26 = getMidPoint(GameManager.levelInfo[_arg1].slopePointPos[0][(_local14 - 1)], GameManager.levelInfo[_arg1].slopePointPos[0][_local14]);
_local27 = getMidPoint(GameManager.levelInfo[_arg1].slopePointPos[1][(_local14 - 1)], GameManager.levelInfo[_arg1].slopePointPos[1][_local14]);
_local28 = (getDistance(GameManager.levelInfo[_arg1].slopePointPos[0][(_local14 - 1)], GameManager.levelInfo[_arg1].slopePointPos[1][(_local14 - 1)], GameManager.levelInfo[_arg1].slopePointPos[0][_local14], GameManager.levelInfo[_arg1].slopePointPos[1][_local14]) / 2);
_local29 = getTargetRotation((GameManager.levelInfo[_arg1].slopePointPos[0][(_local14 - 1)] - GameManager.levelInfo[_arg1].slopePointPos[0][_local14]), (GameManager.levelInfo[_arg1].slopePointPos[1][(_local14 - 1)] - GameManager.levelInfo[_arg1].slopePointPos[1][_local14]));
_local2 = new RigidBody(_local26, _local27, Simplification.INFINITE_MASS, ShapeUtil.createSymmetricPolygon(2, _local28), 0, 0, SLOPEFRICTION, SLOPEBOUNCE, _local29, 0);
_local2.foamLabel = FOAMLANDSCAPE;
foam.addElement(_local2);
foam.stopDrawing(_local2);
lineSegments.push(_local2);
if (_local14 == (_local16 - 1)){
slopeShape.graphics.lineStyle(0, 0);
slopeShape.graphics.lineTo(GameManager.levelInfo[_arg1].slopePointPos[0][_local14], 1700);
slopeShape.graphics.lineTo(0, 2000);
slopeShape.graphics.lineTo(GameManager.levelInfo[_arg1].slopePointPos[0][0], GameManager.levelInfo[_arg1].slopePointPos[1][0]);
_local2 = new RigidBody((_local26 + 1000), (_local27 + 1000), Simplification.INFINITE_MASS, ShapeUtil.createSymmetricPolygon(2, _local28), 0, 0, SLOPEFRICTION, SLOPEBOUNCE, _local29, 0);
_local2.foamLabel = FOAMLANDSCAPE;
foam.addElement(_local2);
foam.stopDrawing(_local2);
lineSegments.push(_local2);
};
_local14++;
};
slopeShape.visible = false;
levelForeground.addChildAt(slopeShape, 0);
if (GameManager.levelInfo[_arg1].levelType == FOREST){
levelBackground3.y = lowestYPoint;
};
_local15 = GameManager.levelInfo[_arg1].treePos[0].length;
_local11 = 0;
var _local19:int = GameManager.levelInfo[_arg1].treePos[0].length;
var _local20:Number = 0;
_local14 = 0;
while (_local14 < _local19) {
switch (GameManager.levelInfo[_arg1].treePos[6][_local14]){
case TREBUCHET:
_local21 = new Trebuchet();
_local21.type = TREBUCHET;
break;
case CATAPULT:
_local21 = new Catapult();
_local21.type = CATAPULT;
break;
};
_local21.x = GameManager.levelInfo[_arg1].treePos[0][_local14];
_local21.y = GameManager.levelInfo[_arg1].treePos[1][_local14];
_local22 = new Circle(_local21.x, (_local21.y - 40), 75, Simplification.INFINITE_MASS, 0, 0, 0.5, 0.15, 0, 0);
_local22.foamLabel = FOAMCATAPULT;
_local22.foamSubLabel = FOAMCATAPULT;
foam.addElement(_local22);
foam.stopDrawing(_local22);
lineSegments.push(_local22);
if (_local14 == (_local19 - 1)){
_local22 = new Circle((_local21.x + 3000), (_local21.y - 4000), 75, Simplification.INFINITE_MASS, 0, 0, 0.5, 0.15, 0, 0);
_local22.foamLabel = FOAMCATAPULT;
_local22.foamSubLabel = FOAMCATAPULT;
foam.addElement(_local22);
foam.stopColliding(_local22);
lineSegments.push(_local22);
};
_local21.reloadTime = GameManager.levelInfo[_arg1].treePos[2][_local14];
_local21.initialDelay = GameManager.levelInfo[_arg1].treePos[3][_local14];
_local21.shotCount = GameManager.levelInfo[_arg1].treePos[4][_local14];
_local21.shotType = GameManager.levelInfo[_arg1].treePos[5][_local14];
_local21.projectile.gotoAndStop(GameManager.levelInfo[_arg1].treePos[5][_local14]);
levelForeground.addChild(_local21);
_local20 = ((_local21.initialDelay + (_local21.reloadTime * _local21.shotCount)) + 170);
if (_local20 > maxTime){
maxTime = _local20;
};
trees.push(_local21);
_local14++;
};
levelForeground.addChild(foregroundGraphics);
currentTime = maxTime;
_local15 = GameManager.levelInfo[_arg1].dragons.length;
_local11 = 0;
var _local23:int = GameManager.levelInfo[_arg1].dragons.length;
_local14 = 0;
while (_local14 < _local23) {
switch (GameManager.levelInfo[_arg1].dragons[_local14]){
case FIREDRAGON:
_local3 = new FireDragon();
_local3.flyerType = "FireDragon";
break;
case ICEDRAGON:
_local3 = new IceDragon();
_local3.flyerType = "IceDragon";
break;
case SHOCKDRAGON:
_local3 = new ShockDragon();
_local3.flyerType = "ShockDragon";
break;
case FIREWITCH:
_local3 = new FireWitch();
_local3.flyerType = "FireWitch";
break;
case ICEWITCH:
_local3 = new IceWitch();
_local3.flyerType = "IceWitch";
break;
case SHOCKWITCH:
_local3 = new ShockWitch();
_local3.flyerType = "ShockWitch";
break;
default:
_local3 = new FireDragon();
_local3.flyerType = "FireDragon";
break;
};
_local3.scaleX = 0.25;
_local3.scaleY = 0.25;
_local3.clipLength = 250;
_local3.clipHeight = 40;
_local3.x = (-100 - (_local14 * -250));
_local3.y = (100 + (_local14 * 25));
_local3.fireCounter = (_local14 * 10);
levelForeground.addChildAt(_local3, 0);
flyingThings.push(_local3);
_local14++;
};
var _local24:Number = (SCREENWIDTH / GameManager.levelInfo[currentLevel].levelWidth);
var _local25:Number = (SCREENHEIGHT / GameManager.levelInfo[currentLevel].levelHeight);
if (_local24 < _local25){
zoomAmount = _local24;
} else {
zoomAmount = _local25;
};
flyerBoundary = (((640 - (zoomAmount * foregroundWidth)) * (1 / zoomAmount)) + foregroundWidth);
zoomAmount = 1;
flyerBoundary = (flyerBoundary + 100);
if (GameManager.levelInfo[_arg1].cloudsOnBottom){
levelForeground.setChildIndex(moveClouds, 0);
} else {
levelForeground.setChildIndex(moveClouds, (levelForeground.numChildren - 1));
};
if (currentLevel == 0){
signTutorial = new SignTutorial();
signTutorial.x = 1320.4;
signTutorial.y = 256.7;
levelForeground.addChild(signTutorial);
};
renderer = new BitmapRenderer(new Rectangle(0, 0, flyerBoundary, foregroundHeight));
levelForeground.addChild(renderer);
updateAvailableBricks();
}
public function randRange(_arg1:Number, _arg2:Number):Number{
return (Math.floor((_arg1 + (Math.random() * ((_arg2 - _arg1) + 1)))));
}
private function changeBricks(){
leftHud.brickTypeLabel.gotoAndStop((currentBrickType + 1));
leftHud.hudExampleBrick.gotoAndStop((currentBrickType + 1));
leftHud.brickCostText.text = ("Worth: " + String(currentBrickCost[currentBrickType]));
if (!brickShop.bricksAvailable[currentBrickType]){
dontBuildFlag = true;
leftHud.notPurchased.visible = true;
} else {
dontBuildFlag = false;
leftHud.notPurchased.visible = false;
};
updateHudBricks();
updateBricksToPlace();
}
private function mouseOverBarrel(_arg1:MouseEvent){
if (_arg1.target == brickShop.mudBarrel){
brickShop.speechBubble.gotoAndStop((MUD + 1));
};
if (_arg1.target == brickShop.stoneBarrel){
brickShop.speechBubble.gotoAndStop((STONE + 1));
};
if (_arg1.target == brickShop.ironBarrel){
brickShop.speechBubble.gotoAndStop((IRON + 1));
};
}
private function clickedEskimo(_arg1:MouseEvent){
mouseClip.buttonMode = false;
mouseClip.useHandCursor = false;
mouseClip.x = mouseX;
mouseClip.y = mouseY;
mouseClip.removeEventListener(MouseEvent.CLICK, clickedEskimo);
mouseClip.removeEventListener(MouseEvent.MOUSE_OVER, mouseOverKing);
mouseClip.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutKing);
mouseClip.moveKingText.visible = false;
var _local2:* = mouseClip.x;
var _local3:* = mouseClip.y;
levelForeground.removeChild(mouseClip);
mouseClip = new FloatThrone();
mouseClip.noThrone.visible = false;
mouseClip.x = _local2;
mouseClip.y = _local3;
levelForeground.addChild(mouseClip);
mouseClip.addEventListener(MouseEvent.CLICK, placeEskimo);
removeBlocks();
currentBlocks = maxBlocks;
updateHudBricks();
leftHud.bricksAvailableText.text = String(currentBlocks);
levelState = STATE_PLACINGESKIMO;
SoundManager.playFx(MOVEDESKIMOFX);
if (currentLevel == 0){
signTutorial.gotoAndStop(1);
};
}
private function updateBricksToPlace(){
var _local1:int;
var _local2:int;
if (levelState == STATE_BUILDINGIGLOO){
_local1 = 0;
while (_local1 < 6) {
_local2 = 0;
while (_local2 < 9) {
if (((!(iceBlocks[_local1][_local2].blockHere)) && (!(iceBlocks[_local1][_local2].permanentlyEmpty)))){
iceBlocks[_local1][_local2].gotoAndStop(((currentBrickType + 1) + 4));
};
_local2++;
};
_local1++;
};
};
}
private function hideHud(_arg1:MouseEvent){
leftHud.closeHudButton.removeEventListener(MouseEvent.CLICK, hideHud);
leftHud.closeHudButton.gotoAndStop("open");
Tweener.addTween(leftHud, {x:-133, time:2});
leftHud.closeHudButton.addEventListener(MouseEvent.CLICK, showHud);
}
private function stepLevel(_arg1:Event){
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Circle;
var _local18:Circle;
var _local19:MovieClip;
var _local20:int;
var _local21:int;
var _local22:int;
var _local25:int;
var _local26:int;
var _local27:Collision;
var _local28:Rectangle;
var _local29:StoneExplosion;
var _local30:SmokeTrail;
var _local31:IceTrail;
var _local32:ShockTrail;
var _local33:StoneTrail;
var _local34:Number;
var _local35:Number;
var _local36:int;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:Object;
var _local45:Circle;
var _local46:MovieClip;
var _local47:BlockExplosion;
var _local48:int;
if (!inShop){
scrollLevel();
};
var _local23:int = flyingThings.length;
var _local24:int = (_local23 - 1);
while (_local24 >= 0) {
flyingThings[_local24].x = (flyingThings[_local24].x + FLYERFARSPEED);
if (flyingThings[_local24].x > flyerBoundary){
if (levelState == STATE_AVALANCHE){
flyingThings[_local24].scaleX = 1;
flyingThings[_local24].scaleY = 1;
flyingThings[_local24].x = -500;
flyingThings[_local24].y = (eskimoMarker.y - 300);
switch (flyingThings[_local24].flyerType){
case "FireDragon":
SoundManager.playFx(DRAGONFX);
break;
case "IceDragon":
SoundManager.playFx(DRAGONFX);
break;
case "ShockDragon":
SoundManager.playFx(DRAGONFX);
break;
case "FireWitch":
SoundManager.playFx(WITCHFX);
break;
case "IceWitch":
SoundManager.playFx(WITCHFX);
break;
case "ShockWitch":
SoundManager.playFx(WITCHFX);
break;
};
levelForeground.setChildIndex(flyingThings[_local24], (levelForeground.numChildren - 1));
approachFlyers.push(flyingThings[_local24]);
flyingThings.splice(_local24, 1);
} else {
flyingThings[_local24].x = -50;
};
};
_local24--;
};
switch (levelState){
case STATE_PLACINGESKIMO:
_local2 = 0;
_local3 = 0;
if (zoomedIn){
mouseClip.x = (mouseX - levelForeground.x);
mouseClip.y = (mouseY - levelForeground.y);
_local2 = mouseX;
_local3 = mouseY;
} else {
mouseClip.x = levelForeground.mouseX;
mouseClip.y = levelForeground.mouseY;
_local2 = mouseX;
_local3 = mouseY;
};
validSpot = true;
if (((((((slopeShape.hitTestPoint(_local2, (_local3 + (THRONEHEIGHT * zoomAmount)), true)) || (slopeShape.hitTestPoint(_local2, (_local3 - (THRONEHEIGHT * zoomAmount)), true)))) || (slopeShape.hitTestPoint((_local2 + (THRONEWIDTH * zoomAmount)), _local3, true)))) || (slopeShape.hitTestPoint((_local2 - (THRONEWIDTH * zoomAmount)), _local3, true)))){
validSpot = false;
} else {
_local10 = GameManager.levelInfo[currentLevel].treePos[0].length;
_local11 = 0;
while (_local11 < _local10) {
if (getDistance(GameManager.levelInfo[currentLevel].treePos[0][_local11], GameManager.levelInfo[currentLevel].treePos[1][_local11], mouseClip.x, mouseClip.y) < TREBUCHET_CLEARANCE){
validSpot = false;
};
_local11++;
};
};
if (validSpot){
mouseClip.noThrone.visible = false;
} else {
mouseClip.noThrone.visible = true;
};
_local25 = trees.length;
_local24 = 0;
while (_local24 < _local25) {
if (mouseClip.x < trees[_local24].x){
trees[_local24].scaleX = -1;
if (trees[_local24].type == CATAPULT){
trees[_local24].scaleX = 1;
};
} else {
trees[_local24].scaleX = 1;
if (trees[_local24].type == CATAPULT){
trees[_local24].scaleX = -1;
};
};
_local24++;
};
break;
case STATE_BUILDINGIGLOO:
if (mouseClip.kingClip.currentFrame == 43){
mouseClip.kingClip.gotoAndPlay("normal");
};
if ((((((currentLevel == 0)) && ((currentBlocks < maxBlocks)))) && ((signTutorial.currentFrame == 37)))){
signTutorial.play();
};
break;
case STATE_AVALANCHE:
if (mouseClip.kingClip.currentFrame == 43){
mouseClip.kingClip.gotoAndPlay("normal");
};
if ((((((mouseClip.kingClip.currentFrame == 119)) || ((mouseClip.kingClip.currentFrame == 159)))) || ((mouseClip.kingClip.currentFrame == 199)))){
mouseClip.kingClip.gotoAndPlay("falling");
};
_local24 = (projectiles.length - 1);
while (_local24 >= 0) {
if (projectiles[_local24].isHit){
SoundManager.playFx(SHOTHITSHORTFX);
};
projectiles[_local24].isHit = false;
if (projectiles[_local24].lifeLeft <= 0){
if (projectiles[_local24].isAlive){
_local29 = new StoneExplosion(projectiles[_local24].x, projectiles[_local24].y);
addParticles(_local29);
if (((!((projectiles[_local24].foamSubLabel == ICEPROJECTILE))) && (!((projectiles[_local24].foamSubLabel == LIGHTNINGPROJECTILE))))){
SoundManager.playFx(SHOTHITFX);
};
if (projectiles[_local24].foamSubLabel == LIGHTNINGPROJECTILE){
SoundManager.playFx(SHOCKFX);
};
};
projectiles[_local24].isAlive = false;
foam.stopColliding(projectiles[_local24]);
foam.stopDrawing(projectiles[_local24]);
};
if ((((projectiles[_local24].x < -50)) || ((projectiles[_local24].x > (GameManager.levelInfo[currentLevel].levelWidth + 50))))){
projectiles[_local24].isAlive = false;
foam.stopColliding(projectiles[_local24]);
foam.stopDrawing(projectiles[_local24]);
};
if (projectiles[_local24].isAlive){
switch (projectiles[_local24].foamSubLabel){
case FIREPROJECTILE:
if (randRange(1, 2) >= 2){
_local30 = new SmokeTrail(projectiles[_local24].x, projectiles[_local24].y);
addParticles(_local30);
};
break;
case ICEPROJECTILE:
if (randRange(1, 2) >= 2){
_local31 = new IceTrail(projectiles[_local24].x, projectiles[_local24].y);
addParticles(_local31);
};
break;
case LIGHTNINGPROJECTILE:
if (randRange(1, 2) >= 2){
_local32 = new ShockTrail(projectiles[_local24].x, projectiles[_local24].y);
addParticles(_local32);
};
break;
default:
if (randRange(1, 4) >= 4){
_local33 = new StoneTrail(projectiles[_local24].x, projectiles[_local24].y);
addParticles(_local33);
};
break;
};
};
_local24--;
};
_local24 = (particles.length - 1);
while (_local24 >= 0) {
if (particles[_local24].particles.length <= 0){
renderer.removeEmitter(particles[_local24]);
particles.splice(_local24, 1);
};
_local24--;
};
_local5 = trees.length;
_local12 = 0;
while (_local12 < _local5) {
if (trees[_local12].startAnimation){
trees[_local12].gotoAndPlay(2);
if (trees[_local12].type == TREBUCHET){
SoundManager.playFx(TREBUCHETSHOTFX);
} else {
SoundManager.playFx(CATAPULTSHOTFX);
};
};
if (((trees[_local12].readyToShoot) && ((Math.abs((eskimoMarker.x - trees[_local12].x)) > 100)))){
_local34 = 1.3;
_local35 = 2.1;
_local36 = 1;
_local37 = -193;
_local38 = -349;
if (trees[_local12].type == CATAPULT){
_local34 = 1;
_local35 = 1.8;
_local37 = 88;
_local38 = -141;
};
if (eskimoMarker.x < trees[_local12].x){
_local36 = -1;
_local41 = (_local41 * -1);
};
_local37 = (_local37 * _local36);
_local39 = (trees[_local12].x + _local37);
_local40 = (trees[_local12].y + _local38);
_local41 = Math.abs((eskimoMarker.x - _local39));
_local42 = Math.abs((_local40 - eskimoMarker.y));
_local43 = getDistance(_local39, _local40, eskimoMarker.x, eskimoMarker.y);
if (eskimoMarker.y > _local40){
_local42 = (_local42 * -1);
};
_local13 = ((-1 * ((_local41 * _local41) * _local35)) / (((2 * (Math.cos(_local34) * Math.cos(_local34))) * _local42) - ((2 * (Math.cos(_local34) * Math.sin(_local34))) * _local41)));
_local13 = Math.sqrt(_local13);
_local17 = new Circle(_local39, _local40, 12, 20, ((_local13 * _local36) * Math.cos(_local34)), ((-1 * _local13) * Math.sin(_local34)), 0.5, 0.15, 0, 0.25);
_local17.foamLabel = FOAMBOULDER;
switch (trees[_local12].shotType){
case ROCKPROJECTILE:
_local44 = new Rock1();
_local17.foamSubLabel = ROCKPROJECTILE;
_local17.lifeLeft = 20;
break;
case IRONRIMMEDPROJECTILE:
_local44 = new IronRock1();
_local17.foamSubLabel = IRONRIMMEDPROJECTILE;
_local17.lifeLeft = 25;
break;
case CANNONBALLPROJECTILE:
_local44 = new Cannonball1();
_local17.foamSubLabel = CANNONBALLPROJECTILE;
_local17.lifeLeft = 30;
break;
case SPIKEBALLPROJECTILE:
_local44 = new SpikeBall1();
_local17.foamSubLabel = SPIKEBALLPROJECTILE;
_local17.lifeLeft = 50;
break;
case KNIGHTPROJECTILE:
_local44 = new KnightBomber();
_local17.foamSubLabel = KNIGHTPROJECTILE;
_local17.lifeLeft = 70;
break;
case FIREPROJECTILE:
_local44 = new FireBall();
_local17.foamSubLabel = FIREPROJECTILE;
_local17.lifeLeft = 20;
break;
default:
_local44 = new Rock1();
_local17.foamSubLabel = ROCKPROJECTILE;
_local17.lifeLeft = 20;
break;
};
foam.addElement(_local17, true, true, new DisplayObjectData(_local44, 0, 0));
projectiles.push(_local17);
};
trees[_local12].update();
_local12++;
};
_local24 = (approachFlyers.length - 1);
while (_local24 >= 0) {
approachFlyers[_local24].x = (approachFlyers[_local24].x + FLYERCLOSESPEED);
approachFlyers[_local24].update();
if ((((approachFlyers[_local24].x > -150)) && ((approachFlyers[_local24].x < (GameManager.levelInfo[currentLevel].levelWidth + 100))))){
if (approachFlyers[_local24].readyToFire){
switch (approachFlyers[_local24].flyerType){
case "FireDragon":
_local45 = new Circle((approachFlyers[_local24].x + 250), (approachFlyers[_local24].y + 50), 12, 20, 8, 0, 0.5, 0.15, 0, 0.5);
_local45.lifeLeft = 20;
_local45.foamLabel = FOAMBOULDER;
_local45.foamSubLabel = FIREPROJECTILE;
_local46 = new FireBall();
break;
case "IceDragon":
_local45 = new Circle((approachFlyers[_local24].x + 250), (approachFlyers[_local24].y + 50), 12, 20, 8, 0, 0.5, 0.15, 0, 0.5);
_local45.lifeLeft = 20;
_local45.foamLabel = FOAMBOULDER;
_local45.foamSubLabel = ICEPROJECTILE;
_local46 = new IceBall();
break;
case "ShockDragon":
_local45 = new Circle((approachFlyers[_local24].x + 250), (approachFlyers[_local24].y + 50), 12, 20, 8, 0, 0.5, 0.15, 0, 0.5);
_local45.lifeLeft = 20;
_local45.foamLabel = FOAMBOULDER;
_local45.foamSubLabel = LIGHTNINGPROJECTILE;
_local46 = new ShockBall();
break;
case "FireWitch":
_local45 = new Circle((approachFlyers[_local24].x + 100), (approachFlyers[_local24].y + 36), 12, 20, -8, -5, 0.5, 0.15, 0, 0.5);
_local45.lifeLeft = 20;
_local45.foamLabel = FOAMBOULDER;
_local45.foamSubLabel = FIREPROJECTILE;
_local46 = new FireBall();
break;
case "IceWitch":
_local45 = new Circle((approachFlyers[_local24].x + 100), (approachFlyers[_local24].y + 36), 12, 20, -8, -5, 0.5, 0.15, 0, 0.5);
_local45.lifeLeft = 20;
_local45.foamLabel = FOAMBOULDER;
_local45.foamSubLabel = ICEPROJECTILE;
_local46 = new IceBall();
break;
case "ShockWitch":
_local45 = new Circle((approachFlyers[_local24].x + 100), (approachFlyers[_local24].y + 36), 12, 20, -8, -5, 0.5, 0.15, 0, 0.5);
_local45.lifeLeft = 20;
_local45.foamLabel = FOAMBOULDER;
_local45.foamSubLabel = LIGHTNINGPROJECTILE;
_local46 = new ShockBall();
break;
default:
_local45 = new Circle((approachFlyers[_local24].x + 100), (approachFlyers[_local24].y + 36), 12, 20, -8, -5, 0.5, 0.15, 0, 0.5);
_local45.lifeLeft = 20;
_local45.foamLabel = FOAMBOULDER;
_local45.foamSubLabel = FIREPROJECTILE;
_local46 = new FireBall();
break;
};
foam.addElement(_local45, true, true, new DisplayObjectData(_local46, 0, 0));
projectiles.push(_local45);
SoundManager.playFx(FLYERSHOTFX);
};
};
if (approachFlyers[_local24].x > (GameManager.levelInfo[currentLevel].levelWidth + 500)){
levelForeground.removeChild(approachFlyers[_local24]);
approachFlyers.splice(_local24, 1);
};
_local24--;
};
_local24 = (blockPhysics.length - 1);
while (_local24 >= 0) {
if (blockPhysics[_local24].lifeLeft <= 0){
blockPhysics[_local24].isAlive = false;
if (!blockPhysics[_local24].alreadyDead){
blockPhysics[_local24].alreadyDead = true;
_local47 = new BlockExplosion((blockPhysics[_local24].x - 10), (blockPhysics[_local24].y - 10));
addParticles(_local47);
foam.stopColliding(blockPhysics[_local24]);
levelForeground.removeChild(blockGraphics[_local24]);
};
};
if (blockPhysics[_local24].turnToStone){
blockPhysics[_local24].lifeLeft = 30;
blockGraphics[_local24].gotoAndStop((STONE + 1));
blockPhysics[_local24].turnToStone = false;
};
if (blockPhysics[_local24].isFrozen){
blockPhysics[_local24].lifeLeft = 1;
blockPhysics[_local24].foamSubLabel = ICE;
blockGraphics[_local24].gotoAndStop("ice");
SoundManager.playFx(FREEZEFX);
blockPhysics[_local24].isFrozen = false;
};
_local24--;
};
_local24 = (clipsToRemove.length - 1);
while (_local24 >= 0) {
if (clipsToRemove[_local24].currentLabel == "removeMe"){
levelForeground.removeChild(clipsToRemove[_local24]);
clipsToRemove.splice(_local24, 1);
};
_local24--;
};
_local26 = arms.length;
_local24 = 0;
while (_local24 < _local26) {
if (arms[_local24].currentFrame == 1){
armLastHit[_local24] = false;
};
if (((((!(armLastHit[_local24])) && ((arms[_local24].currentFrame >= 18)))) && ((arms[_local24].currentFrame <= 20)))){
_local48 = (blockGraphics.length - 1);
while (_local48 >= 0) {
_local27 = new Collision();
_local28 = _local27.getCollision(arms[_local24], blockGraphics[_local48]);
if (_local28 != null){
blockPhysics[_local48].lifeLeft = 0;
armLastHit[_local24] = true;
};
_local48--;
};
_local27 = new Collision();
_local28 = _local27.getCollision(arms[_local24], mouseClip);
if (_local28 != null){
eskimoMarker.lifeLeft = (eskimoMarker.lifeLeft - 20);
SoundManager.playFx(SHOTHITFX);
armLastHit[_local24] = true;
};
if (arms[_local24].currentFrame == 20){
SoundManager.playFx(FISTPOUNDSOUND);
};
};
_local24++;
};
_local9 = int(((eskimoMarker.lifeLeft / MAXHEALTH) * 100));
mouseClip.rotation = ((eskimoMarker.q * 180) / Math.PI);
mouseClip.x = eskimoMarker.x;
if ((((mouseClip.rotation > 60)) || ((mouseClip.rotation < -60)))){
mouseClip.y = (eskimoMarker.y - 15);
} else {
mouseClip.y = eskimoMarker.y;
};
if (mouseClip.rotation > 45){
mouseClip.rotation = (45 - (mouseClip.rotation - 45));
};
if (mouseClip.rotation < -45){
mouseClip.rotation = (-45 - (mouseClip.rotation + 45));
};
if (_local9 < (prevHealth - 5)){
if (mouseClip.kingClip.currentFrame < 45){
mouseClip.kingClip.gotoAndPlay("falling");
};
SoundManager.playFx((13 + hurtSoundUpdater));
if (hurtSoundUpdater >= 2){
hurtSoundUpdater = 0;
} else {
hurtSoundUpdater++;
};
};
if (eskimoMarker.isBurned){
mouseClip.kingClip.gotoAndPlay("burning");
eskimoMarker.isBurned = false;
} else {
if (eskimoMarker.isFrozen){
mouseClip.kingClip.gotoAndPlay("frozen");
eskimoMarker.isFrozen = false;
SoundManager.playFx(FREEZEFX);
} else {
if (eskimoMarker.isShocked){
mouseClip.kingClip.gotoAndPlay("shocked");
eskimoMarker.isShocked = false;
};
};
};
prevHealth = _local9;
rightHud.healthContainer.healthBar.gotoAndStop(_local9);
if (_local9 <= 0){
if (levelWon){
SoundManager.playFx(ESKIMODIEDFX);
};
levelWon = false;
};
if (mouseClip.kingClip.currentFrame == 54){
if (_local9 <= 0){
mouseClip.kingClip.gotoAndStop("fallen");
};
};
if (mouseClip.kingClip.currentFrame == 84){
if (_local9 <= 0){
mouseClip.kingClip.gotoAndStop("fallen");
} else {
mouseClip.kingClip.gotoAndPlay("normal");
};
};
if ((((((eskimoMarker.x < 0)) || ((eskimoMarker.x > foregroundWidth)))) || ((eskimoMarker.y > foregroundHeight)))){
if (levelWon){
SoundManager.playFx(ESKIMODIEDFX);
};
levelWon = false;
if (((!(playedSplash)) && ((((GameManager.levelInfo[currentLevel].levelType == LAKE)) || ((GameManager.levelInfo[currentLevel].levelType == SWAMP)))))){
playedSplash = true;
SoundManager.playFx(SPLASHSOUND);
};
eskimoMarker.lifeLeft = 0;
rightHud.healthContainer.healthBar.gotoAndStop(0);
};
if (levelWon){
currentTime--;
} else {
currentTime = (currentTime - 5);
};
if (currentTime <= 0){
foam.stop();
rightHud.timeContainer.timeBar.gotoAndStop(0);
endLevel();
} else {
_local22 = int(((currentTime / maxTime) * 100));
rightHud.timeContainer.timeBar.gotoAndStop(_local22);
};
break;
default:
break;
};
}
private function shopClicked(_arg1:MouseEvent){
SoundManager.playFx(BUTTONCLICKFX);
inShop = true;
brickShop.alpha = 0;
brickShop.currentGoldText.text = leftHud.currentGoldText.text;
addChild(brickShop);
Tweener.addTween(brickShop, {alpha:1, time:2});
brickShop.mudBarrel.addEventListener(MouseEvent.MOUSE_OVER, mouseOverBarrel);
brickShop.stoneBarrel.addEventListener(MouseEvent.MOUSE_OVER, mouseOverBarrel);
brickShop.ironBarrel.addEventListener(MouseEvent.MOUSE_OVER, mouseOverBarrel);
brickShop.mudBarrel.addEventListener(MouseEvent.MOUSE_OUT, mouseOutBarrel);
brickShop.stoneBarrel.addEventListener(MouseEvent.MOUSE_OUT, mouseOutBarrel);
brickShop.ironBarrel.addEventListener(MouseEvent.MOUSE_OUT, mouseOutBarrel);
brickShop.mudBarrel.addEventListener(MouseEvent.CLICK, mouseClickedBarrel);
brickShop.stoneBarrel.addEventListener(MouseEvent.CLICK, mouseClickedBarrel);
brickShop.ironBarrel.addEventListener(MouseEvent.CLICK, mouseClickedBarrel);
brickShop.speechBubble.purchaseText.addEventListener(MouseEvent.CLICK, buyBrickClicked);
brickShop.exitBarrel.addEventListener(MouseEvent.CLICK, exitShop);
}
private function zoomIn(_arg1:MouseEvent){
var param1 = _arg1;
var e:* = param1;
leftHud.zoomButton.removeEventListener(MouseEvent.CLICK, zoomIn);
Tweener.addTween(levelForeground, {scaleX:1, time:2, onComplete:function (){
zoomedIn = true;
}});
Tweener.addTween(levelForeground, {scaleY:1, time:2});
Tweener.addTween(levelBackground2, {scaleX:1, time:2});
Tweener.addTween(levelBackground2, {scaleY:1, time:2});
Tweener.addTween(levelBackground3, {scaleX:1, time:2});
Tweener.addTween(levelBackground3, {scaleY:1, time:2});
Tweener.addTween(levelForeground, {x:(-1 * ((foregroundWidth - SCREENWIDTH) / 2)), time:2});
Tweener.addTween(levelForeground, {y:(-1 * ((foregroundHeight - SCREENHEIGHT) / 2)), time:2});
if (GameManager.levelInfo[currentLevel].levelType == FOREST){
Tweener.addTween(levelBackground3, {y:lowestYPoint, time:2});
};
viewPosX = 0;
viewPosY = 0;
zoomAmount = 1;
leftHud.zoomButton.addEventListener(MouseEvent.CLICK, zoomOut);
leftHud.zoomButton.zoomText.text = "ZOOM OUT-";
}
public function nextLevel(_arg1:MouseEvent){
SoundManager.playFx(BUTTONCLICKFX);
deactivate();
GameManager.nextLevel(currentLevel);
}
private function updateAvailableBricks(){
if (brickShop.bricksAvailable[MUD]){
leftHud.mudBrick.alpha = 1;
};
if (brickShop.bricksAvailable[STONE]){
leftHud.stoneBrick.alpha = 1;
};
if (brickShop.bricksAvailable[IRON]){
leftHud.ironBrick.alpha = 1;
};
}
public function deactivate(){
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyReleased);
}
private function switchBricks(_arg1:MouseEvent){
if (_arg1.target == leftHud.woodBrick){
currentBrickType = WOOD;
};
if (_arg1.target == leftHud.mudBrick){
currentBrickType = MUD;
};
if (_arg1.target == leftHud.stoneBrick){
currentBrickType = STONE;
};
if (_arg1.target == leftHud.ironBrick){
currentBrickType = IRON;
};
changeBricks();
}
private function scrollLevel(){
var _local1:Boolean;
var _local2 = "O";
var _local3 = "O";
var _local4 = "O";
var _local5 = "O";
var _local6:Boolean;
if ((((stage.mouseY < 53)) && ((stage.mouseX < 137)))){
_local6 = true;
};
if ((((stage.mouseY < 90)) && ((stage.mouseX > 551)))){
_local6 = true;
};
if ((((((stage.mouseY > 232)) && ((stage.mouseY < 254)))) && ((stage.mouseX < 50)))){
_local6 = true;
};
if (zoomedIn){
if ((((((stage.mouseY < 30)) || (upPressed))) && (!(_local6)))){
if (viewPosY > (-1 * SCROLLLIMIT)){
if (!mouseHidden){
scrollArrow.x = mouseX;
scrollArrow.y = mouseY;
addChild(scrollArrow);
mouseHidden = true;
} else {
scrollArrow.x = mouseX;
scrollArrow.y = mouseY;
};
viewPosY--;
levelForeground.y = (levelForeground.y + viewSpeedY);
levelBackground3.y = (levelBackground3.y + levelBackground3.moveSpeedY);
levelBackground2.y = (levelBackground2.y + levelBackground2.moveSpeedY);
if (viewSpeedY != 0){
_local1 = true;
};
_local2 = "X";
};
} else {
if ((((((stage.mouseY >= 450)) || (downPressed))) && (!(_local6)))){
if (viewPosY < SCROLLLIMIT){
if (!mouseHidden){
scrollArrow.x = mouseX;
scrollArrow.y = mouseY;
addChild(scrollArrow);
mouseHidden = true;
} else {
scrollArrow.x = mouseX;
scrollArrow.y = mouseY;
};
viewPosY++;
levelForeground.y = (levelForeground.y - viewSpeedY);
levelBackground3.y = (levelBackground3.y - levelBackground3.moveSpeedY);
levelBackground2.y = (levelBackground2.y - levelBackground2.moveSpeedY);
if (viewSpeedY != 0){
_local1 = true;
};
_local3 = "X";
};
};
};
if ((((((stage.mouseX < 30)) || (leftPressed))) && (!(_local6)))){
if (viewPosX > (-1 * SCROLLLIMIT)){
if (!mouseHidden){
scrollArrow.x = mouseX;
scrollArrow.y = mouseY;
addChild(scrollArrow);
mouseHidden = true;
} else {
scrollArrow.x = mouseX;
scrollArrow.y = mouseY;
};
viewPosX--;
levelForeground.x = (levelForeground.x + viewSpeedX);
levelBackground3.x = (levelBackground3.x + levelBackground3.moveSpeedX);
levelBackground2.x = (levelBackground2.x + levelBackground2.moveSpeedX);
_local1 = true;
_local4 = "X";
};
} else {
if ((((((stage.mouseX > 610)) || (rightPressed))) && (!(_local6)))){
if (viewPosX < SCROLLLIMIT){
if (!mouseHidden){
scrollArrow.x = mouseX;
scrollArrow.y = mouseY;
addChild(scrollArrow);
mouseHidden = true;
} else {
scrollArrow.x = mouseX;
scrollArrow.y = mouseY;
};
viewPosX++;
levelForeground.x = (levelForeground.x - viewSpeedX);
levelBackground3.x = (levelBackground3.x - levelBackground3.moveSpeedX);
levelBackground2.x = (levelBackground2.x - levelBackground2.moveSpeedX);
_local1 = true;
_local5 = "X";
};
};
};
};
if (!_local1){
if (mouseHidden){
removeChild(scrollArrow);
mouseHidden = false;
};
} else {
scrollArrow.gotoAndStop((((_local2 + _local5) + _local3) + _local4));
};
}
private function keyReleased(_arg1:KeyboardEvent){
switch (_arg1.keyCode){
case Keyboard.UP:
upPressed = false;
break;
case Keyboard.DOWN:
downPressed = false;
break;
case Keyboard.LEFT:
leftPressed = false;
break;
case Keyboard.RIGHT:
rightPressed = false;
break;
default:
break;
};
}
private function showHud(_arg1:MouseEvent){
leftHud.closeHudButton.removeEventListener(MouseEvent.CLICK, showHud);
leftHud.closeHudButton.gotoAndStop("close");
Tweener.addTween(leftHud, {x:0, time:2});
leftHud.closeHudButton.addEventListener(MouseEvent.CLICK, hideHud);
}
private function keyPressed(_arg1:KeyboardEvent){
var _local2:MouseEvent;
var _local3:MouseEvent;
switch (_arg1.keyCode){
case Keyboard.UP:
upPressed = true;
break;
case Keyboard.DOWN:
downPressed = true;
break;
case Keyboard.LEFT:
leftPressed = true;
break;
case Keyboard.RIGHT:
rightPressed = true;
break;
case 49:
currentBrickType = WOOD;
changeBricks();
break;
case 50:
currentBrickType = MUD;
changeBricks();
break;
case 51:
currentBrickType = STONE;
changeBricks();
break;
case 52:
currentBrickType = IRON;
changeBricks();
break;
case 90:
_local2 = new MouseEvent(MouseEvent.CLICK);
if (zoomedIn){
zoomOut(_local2);
} else {
zoomIn(_local2);
};
break;
case 32:
_local3 = new MouseEvent(MouseEvent.CLICK);
startBattle(_local3);
break;
default:
break;
};
}
public function activate(){
stage.focus = this;
mouseClip.x = mouseX;
mouseClip.y = mouseY;
mouseClip.noThrone.visible = false;
levelForeground.addChild(mouseClip);
mouseClip.addEventListener(MouseEvent.CLICK, placeEskimo);
addEventListener(Event.ENTER_FRAME, stepLevel);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
leftHud.brickSelectRight.addEventListener(MouseEvent.CLICK, rightSelectClicked);
leftHud.brickSelectLeft.addEventListener(MouseEvent.CLICK, leftSelectClicked);
leftHud.levelShopButton.addEventListener(MouseEvent.CLICK, shopClicked);
leftHud.zoomButton.addEventListener(MouseEvent.CLICK, zoomOut);
leftHud.zoomButton.addEventListener(MouseEvent.MOUSE_OVER, zoomOver);
leftHud.zoomButton.addEventListener(MouseEvent.MOUSE_OUT, zoomOverOut);
leftHud.zoomButton.mouseChildren = false;
leftHud.zoomButton.buttonMode = true;
leftHud.zoomButton.useHandCursor = true;
leftHud.closeHudButton.addEventListener(MouseEvent.CLICK, hideHud);
leftHud.closeHudButton.useHandCursor = true;
leftHud.closeHudButton.buttonMode = true;
leftHud.levelMapButton.addEventListener(MouseEvent.CLICK, exitFromPlacement);
}
public function placeEskimo(_arg1:MouseEvent){
var _local2:Number;
var _local3:Number;
if (validSpot){
mouseClip.removeEventListener(MouseEvent.CLICK, placeEskimo);
_local2 = mouseClip.x;
_local3 = mouseClip.y;
levelForeground.removeChild(mouseClip);
mouseClip = new RedThrone();
mouseClip.addEventListener(MouseEvent.MOUSE_OVER, mouseOverKing);
mouseClip.addEventListener(MouseEvent.MOUSE_OUT, mouseOutKing);
mouseClip.x = _local2;
mouseClip.y = _local3;
levelForeground.addChild(mouseClip);
mouseClip.kingClip.gotoAndPlay(2);
mouseClip.addEventListener(MouseEvent.CLICK, clickedEskimo);
mouseClip.buttonMode = true;
mouseClip.useHandCursor = true;
levelState = STATE_BUILDINGIGLOO;
addEventListener(MouseEvent.MOUSE_UP, mouseButtonUp);
populateBlocks();
SoundManager.playFx(GOODSPOTFX);
leftHud.startBattleButton.addEventListener(MouseEvent.CLICK, startBattle);
if (currentLevel == 0){
signTutorial.play();
};
if (GameManager.levelInfo[currentLevel].cloudsOnBottom){
levelForeground.setChildIndex(moveClouds, 0);
} else {
levelForeground.setChildIndex(moveClouds, (levelForeground.numChildren - 1));
};
} else {
SoundManager.playFx(NOPEFX);
};
}
public function getTargetRotation(_arg1:Number, _arg2:Number):Number{
var _local3:* = Math.atan2(_arg2, _arg1);
return (_local3);
}
private function mouseButtonUp(_arg1:MouseEvent){
mouseBuildState = NO_BUILD_STATE;
}
private function exitShop(_arg1:MouseEvent){
var param1 = _arg1;
SoundManager.playFx(BUTTONSHORTFX);
var e:* = param1;
inShop = false;
brickShop.mudBarrel.removeEventListener(MouseEvent.MOUSE_OVER, mouseOverBarrel);
brickShop.stoneBarrel.removeEventListener(MouseEvent.MOUSE_OVER, mouseOverBarrel);
brickShop.ironBarrel.removeEventListener(MouseEvent.MOUSE_OVER, mouseOverBarrel);
brickShop.mudBarrel.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutBarrel);
brickShop.stoneBarrel.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutBarrel);
brickShop.ironBarrel.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutBarrel);
brickShop.mudBarrel.removeEventListener(MouseEvent.CLICK, mouseClickedBarrel);
brickShop.stoneBarrel.removeEventListener(MouseEvent.CLICK, mouseClickedBarrel);
brickShop.ironBarrel.removeEventListener(MouseEvent.CLICK, mouseClickedBarrel);
brickShop.speechBubble.purchaseText.removeEventListener(MouseEvent.CLICK, buyBrickClicked);
brickShop.exitBarrel.removeEventListener(MouseEvent.CLICK, exitShop);
Tweener.addTween(brickShop, {alpha:0, time:2, onComplete:function (){
removeChild(brickShop);
}});
if (!brickShop.bricksAvailable[currentBrickType]){
dontBuildFlag = true;
leftHud.notPurchased.visible = true;
} else {
dontBuildFlag = false;
leftHud.notPurchased.visible = false;
};
leftHud.currentGoldText.text = String(currentGold);
updateHudBricks();
}
public function updateHudBricks(){
var _local1:int;
while (_local1 < maxBlocks) {
if (_local1 < currentBlocks){
if (leftHud.notPurchased.visible){
hudBricks[_local1].visible = false;
} else {
hudBricks[_local1].visible = true;
};
hudBricks[_local1].gotoAndStop("normal");
if (_local1 >= (currentBlocks - currentBrickCost[currentBrickType])){
hudBricks[_local1].gotoAndStop("selected");
};
} else {
hudBricks[_local1].visible = false;
};
_local1++;
};
}
public function getDistance(_arg1:int, _arg2:int, _arg3:int, _arg4:int):Number{
return (Math.sqrt((((_arg3 - _arg1) * (_arg3 - _arg1)) + ((_arg4 - _arg2) * (_arg4 - _arg2)))));
}
private function mouseOutBarrel(_arg1:MouseEvent){
brickShop.speechBubble.gotoAndStop(brickShop.brickSelected);
}
public function getMidPoint(_arg1:int, _arg2:int):Number{
return (((_arg1 + _arg2) / 2));
}
public function newLevel(_arg1:MouseEvent){
SoundManager.playFx(BUTTONCLICKFX);
deactivate();
GameManager.showMap = true;
GameManager.returnToTitle();
}
private function exitFromPlacement(_arg1:MouseEvent){
removeEventListener(Event.ENTER_FRAME, stepLevel);
SoundManager.playFx(BUTTONCLICKFX);
deactivate();
GameManager.showMap = true;
GameManager.returnToTitle();
}
private function mouseClickedBarrel(_arg1:MouseEvent){
SoundManager.playFx(BUTTONSHORTFX);
if (_arg1.target == brickShop.mudBarrel){
brickShop.currentBlockType = MUD;
brickShop.currentCost = brickShop.mudCost;
brickShop.speechBubble.gotoAndStop((MUD + 1));
brickShop.brickSelected = (MUD + 1);
brickShop.mudBarrel.brickPile.gotoAndStop("selected");
brickShop.stoneBarrel.brickPile.gotoAndStop("normal");
brickShop.ironBarrel.brickPile.gotoAndStop("normal");
if (brickShop.bricksAvailable[MUD]){
brickShop.speechBubble.purchaseText.gotoAndStop(3);
brickShop.canBuy = false;
} else {
if (currentGold < brickShop.mudCost){
brickShop.speechBubble.purchaseText.gotoAndStop(2);
brickShop.canBuy = false;
} else {
brickShop.speechBubble.purchaseText.gotoAndStop(1);
brickShop.canBuy = true;
};
};
};
if (_arg1.target == brickShop.stoneBarrel){
brickShop.currentBlockType = STONE;
brickShop.currentCost = brickShop.stoneCost;
brickShop.speechBubble.gotoAndStop((STONE + 1));
brickShop.brickSelected = (STONE + 1);
brickShop.stoneBarrel.brickPile.gotoAndStop("selected");
brickShop.mudBarrel.brickPile.gotoAndStop("normal");
brickShop.ironBarrel.brickPile.gotoAndStop("normal");
if (brickShop.bricksAvailable[STONE]){
brickShop.speechBubble.purchaseText.gotoAndStop(3);
brickShop.canBuy = false;
} else {
if (currentGold < brickShop.stoneCost){
brickShop.speechBubble.purchaseText.gotoAndStop(2);
brickShop.canBuy = false;
} else {
brickShop.speechBubble.purchaseText.gotoAndStop(1);
brickShop.canBuy = true;
};
};
};
if (_arg1.target == brickShop.ironBarrel){
brickShop.currentBlockType = IRON;
brickShop.currentCost = brickShop.ironCost;
brickShop.speechBubble.gotoAndStop((IRON + 1));
brickShop.brickSelected = (IRON + 1);
brickShop.ironBarrel.brickPile.gotoAndStop("selected");
brickShop.stoneBarrel.brickPile.gotoAndStop("normal");
brickShop.mudBarrel.brickPile.gotoAndStop("normal");
if (brickShop.bricksAvailable[IRON]){
brickShop.speechBubble.purchaseText.gotoAndStop(3);
brickShop.canBuy = false;
} else {
if (currentGold < brickShop.ironCost){
brickShop.speechBubble.purchaseText.gotoAndStop(2);
brickShop.canBuy = false;
} else {
brickShop.speechBubble.purchaseText.gotoAndStop(1);
brickShop.canBuy = true;
};
};
};
}
private function buyBrickClicked(_arg1:MouseEvent){
if (brickShop.canBuy){
currentGold = (currentGold - brickShop.currentCost);
brickShop.currentGoldText.text = String(currentGold);
brickShop.bricksAvailable[brickShop.currentBlockType] = true;
GameManager.bricksPurchased[brickShop.currentBlockType] = true;
brickShop.speechBubble.purchaseText.gotoAndStop(4);
brickShop.canBuy = false;
SoundManager.playFx(COINFX);
updateAvailableBricks();
};
}
private function mouseOverKing(_arg1:MouseEvent){
mouseClip.moveKingText.visible = true;
}
public function tryAgain(_arg1:MouseEvent){
SoundManager.playFx(BUTTONCLICKFX);
deactivate();
GameManager.restartLevel(currentLevel);
}
private function zoomOut(_arg1:MouseEvent){
leftHud.zoomButton.removeEventListener(MouseEvent.CLICK, zoomOut);
var _local2:* = (SCREENWIDTH / GameManager.levelInfo[currentLevel].levelWidth);
var _local3:* = (SCREENHEIGHT / GameManager.levelInfo[currentLevel].levelHeight);
if (_local2 < _local3){
zoomAmount = _local2;
} else {
zoomAmount = _local3;
};
Tweener.addTween(levelForeground, {scaleX:zoomAmount, time:2});
Tweener.addTween(levelForeground, {scaleY:zoomAmount, time:2});
Tweener.addTween(levelBackground2, {scaleX:zoomAmount, time:2});
Tweener.addTween(levelBackground2, {scaleY:zoomAmount, time:2});
Tweener.addTween(levelBackground3, {scaleX:zoomAmount, time:2});
Tweener.addTween(levelBackground3, {scaleY:zoomAmount, time:2});
Tweener.addTween(levelForeground, {x:0, time:2});
Tweener.addTween(levelForeground, {y:0, time:2});
Tweener.addTween(levelBackground2, {x:(SCREENWIDTH / 2), time:2});
Tweener.addTween(levelBackground2, {y:(SCREENHEIGHT / 2), time:2});
Tweener.addTween(levelBackground3, {x:(SCREENWIDTH / 2), time:2});
if (GameManager.levelInfo[currentLevel].levelType == FOREST){
Tweener.addTween(levelBackground3, {y:(lowestYPoint * zoomAmount), time:2});
} else {
Tweener.addTween(levelBackground3, {y:(SCREENHEIGHT / 2), time:2});
};
zoomedIn = false;
leftHud.zoomButton.addEventListener(MouseEvent.CLICK, zoomIn);
leftHud.zoomButton.zoomText.text = "ZOOM IN-";
}
private function zoomOverOut(_arg1:MouseEvent){
leftHud.zoomButton.gotoAndStop(1);
}
private function leftSelectClicked(_arg1:MouseEvent){
currentBrickType--;
if (currentBrickType < WOOD){
currentBrickType = IRON;
};
changeBricks();
}
private function rightSelectClicked(_arg1:MouseEvent){
currentBrickType++;
if (currentBrickType > IRON){
currentBrickType = WOOD;
};
changeBricks();
}
private function populateBlocks(){
var _local1:Block;
var _local2:int;
var _local3:int;
var _local4:int;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local12:int;
var _local5:* = (mouseClip.x - 140);
var _local6:* = (mouseClip.y - 148);
var _local10:* = levelForeground.x;
var _local11:* = levelForeground.y;
if (!zoomedIn){
_local5 = (mouseX - (140 * zoomAmount));
_local6 = (mouseY - (148 * zoomAmount));
_local9 = (_local9 * zoomAmount);
};
while (_local12 < 6) {
iceBlocks[_local12] = new Array();
_local2 = 0;
while (_local2 < 9) {
_local1 = new Block(_local12, _local2);
_local1.gotoAndStop(((currentBrickType + 1) + 4));
_local1.x = ((mouseClip.x - 140) + (_local2 * BLOCKWIDTH));
_local1.y = ((mouseClip.y - 148) + (_local12 * BLOCKHEIGHT));
levelForeground.addChild(_local1);
_local1.activate();
_local7 = (_local5 + (_local2 * (BLOCKWIDTH * zoomAmount)));
_local8 = (_local6 + (_local12 * (BLOCKHEIGHT * zoomAmount)));
if ((((((((_local2 >= 3)) && ((_local2 <= 5)))) && ((_local12 >= 3)))) && ((_local12 <= 5)))){
_local1.visible = false;
_local1.permanentlyEmpty = true;
} else {
if (((((((slopeShape.hitTestPoint(((_local7 + _local10) - _local9), ((_local8 + _local11) - _local9), true)) || (slopeShape.hitTestPoint(((_local7 + _local10) + _local9), ((_local8 + _local11) - _local9), true)))) || (slopeShape.hitTestPoint(((_local7 + _local10) + _local9), ((_local8 + _local11) + _local9), true)))) || (slopeShape.hitTestPoint(((_local7 + _local10) - _local9), ((_local8 + _local11) + _local9), true)))){
_local1.visible = false;
_local1.permanentlyEmpty = true;
} else {
_local3 = GameManager.levelInfo[currentLevel].treePos[0].length;
_local4 = 0;
while (_local4 < _local3) {
if (getDistance(GameManager.levelInfo[currentLevel].treePos[0][_local4], GameManager.levelInfo[currentLevel].treePos[1][_local4], _local1.x, _local1.y) < TREBUCHET_CLEARANCE){
_local1.visible = false;
_local1.permanentlyEmpty = true;
};
_local4++;
};
};
};
iceBlocks[_local12].push(_local1);
_local2++;
};
_local12++;
};
}
private function addParticles(_arg1:Object){
var _local3:int;
var _local2:int = _arg1.emitterArray.length;
while (_local3 < _local2) {
renderer.addEmitter(_arg1.emitterArray[_local3]);
particles.push(_arg1.emitterArray[_local3]);
_local3++;
};
}
private function removeBlocks(){
var _local2:int;
var _local4:int;
var _local1:int = iceBlocks.length;
var _local3:int = (_local1 - 1);
while (_local3 >= 0) {
_local2 = iceBlocks[_local3].length;
_local4 = (_local2 - 1);
while (_local4 >= 0) {
iceBlocks[_local3][_local4].deactivate();
levelForeground.removeChild(iceBlocks[_local3][_local4]);
_local4--;
};
_local3--;
};
}
private function zoomOver(_arg1:MouseEvent){
leftHud.zoomButton.gotoAndPlay(2);
}
public function endLevel(){
screenObscurer = new ScreenObscurer();
addChild(screenObscurer);
removeEventListener(Event.ENTER_FRAME, stepLevel);
if (levelWon){
GameManager.levelInfo[currentLevel].beaten = true;
GameManager.calculateGold();
GameManager.levelBeaten(currentLevel);
scoreScreen.winStuff.goldEarningsText.text = (("YOU EARNED " + String(GameManager.levelInfo[currentLevel].levelBonus)) + " GOLD!");
SoundManager.playFx(WONLEVELFX);
scoreScreen.loseStuff.visible = false;
scoreScreen.continueButton.addEventListener(MouseEvent.CLICK, nextLevel);
} else {
SoundManager.playFx(LOSTLEVELFX);
scoreScreen.winStuff.visible = false;
scoreScreen.continueButton.addEventListener(MouseEvent.CLICK, tryAgain);
};
scoreScreen.returnButton.addEventListener(MouseEvent.CLICK, newLevel);
scoreScreen.x = 320;
scoreScreen.y = -200;
addChild(scoreScreen);
Tweener.addTween(scoreScreen, {y:240, time:2});
}
private function mouseOutKing(_arg1:MouseEvent){
mouseClip.moveKingText.visible = false;
}
private function startBattle(_arg1:MouseEvent){
if (levelState == STATE_BUILDINGIGLOO){
leftHud.startBattleButton.removeEventListener(MouseEvent.CLICK, startBattle);
levelState = STATE_AVALANCHE;
startAvalanche();
};
}
private function startAvalanche(){
var _local1:RigidBody;
var _local2:Bungee;
var _local3:int;
var _local4:BlockSkin;
var _local5:int;
var _local9:Number;
var _local12:GiantArm;
while (_local5 < 6) {
_local3 = 0;
while (_local3 < 9) {
if (iceBlocks[_local5][_local3].blockHere){
_local1 = new RigidBody((iceBlocks[_local5][_local3].x + (iceBlocks[_local5][_local3].width / 2)), (iceBlocks[_local5][_local3].y + (iceBlocks[_local5][_local3].height / 2)), Simplification.INFINITE_MASS, ShapeUtil.createRectangle(BLOCKWIDTH, BLOCKHEIGHT));
_local1.foamLabel = FOAMBLOCK;
_local1.foamSubLabel = iceBlocks[_local5][_local3].blockType;
_local4 = new BlockSkin();
_local4.gotoAndStop((iceBlocks[_local5][_local3].blockType + 1));
switch (iceBlocks[_local5][_local3].blockType){
case WOOD:
_local1.lifeLeft = 20;
break;
case MUD:
_local1.lifeLeft = 15;
break;
case STONE:
_local1.lifeLeft = 35;
break;
case IRON:
_local1.lifeLeft = 50;
break;
default:
break;
};
foam.addElement(_local1, true, false);
blockPhysics.push(_local1);
_local4.x = (_local1.x - 16);
_local4.y = (_local1.y - 16);
levelForeground.addChild(_local4);
blockGraphics.push(_local4);
};
_local3++;
};
_local5++;
};
removeBlocks();
mouseClip.removeEventListener(MouseEvent.CLICK, clickedEskimo);
mouseClip.removeEventListener(MouseEvent.MOUSE_OVER, mouseOverKing);
mouseClip.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutKing);
mouseClip.moveKingText.visible = false;
eskimoMarker = new RigidBody(mouseClip.x, mouseClip.y, ESKIMOMASS, ShapeUtil.createRectangle((THRONEWIDTH * 2), (THRONEHEIGHT * 2)));
eskimoMarker.foamLabel = FOAMESKIMO;
eskimoMarker.foamSubLabel = KINGSUBLABEL;
eskimoMarker.lifeLeft = 100;
foam.addElement(eskimoMarker, true, false);
Tweener.addTween(leftHud, {x:-200, time:1});
var _local6 = 583;
if ((foregroundWidth - mouseClip.x) < 200){
_local6 = 0;
};
Tweener.addTween(rightHud, {x:_local6, time:1});
SoundManager.switchMusic(BATTLE);
_local5 = 0;
while (_local5 < trees.length) {
if (mouseClip.x < trees[_local5].x){
trees[_local5].scaleX = -1;
if (trees[_local5].type == CATAPULT){
trees[_local5].scaleX = 1;
};
};
_local5++;
};
var _local7:int = flyingThings.length;
var _local8:Number = 0;
_local5 = 0;
while (_local5 < _local7) {
_local9 = (((flyerBoundary - flyingThings[_local5].x) / FLYERFARSPEED) + ((flyerBoundary + 500) / FLYERCLOSESPEED));
if (_local9 > _local8){
_local8 = _local9;
};
_local5++;
};
if (_local8 > maxTime){
maxTime = _local8;
currentTime = maxTime;
};
var _local10:int = GameManager.levelInfo[currentLevel].arms[0].length;
arms = new Array();
armLastHit = new Array();
var _local11:int;
while (_local11 < _local10) {
_local12 = new GiantArm();
_local12.scaleX = 3;
_local12.scaleY = 3;
_local12.x = (GameManager.levelInfo[currentLevel].arms[0][_local11] - 300);
_local12.y = GameManager.levelInfo[currentLevel].arms[1][_local11];
if ((_local11 % 2) == 0){
_local12.gotoAndPlay(60);
};
levelForeground.addChild(_local12);
arms.push(_local12);
armLastHit.push(false);
_local11++;
};
leftHud.woodBrick.removeEventListener(MouseEvent.CLICK, switchBricks);
leftHud.mudBrick.removeEventListener(MouseEvent.CLICK, switchBricks);
leftHud.stoneBrick.removeEventListener(MouseEvent.CLICK, switchBricks);
leftHud.ironBrick.removeEventListener(MouseEvent.CLICK, switchBricks);
foam.simulate();
}
}
}//package
Section 165
//GameManager (GameManager)
package {
import flash.events.*;
import caurina.transitions.*;
import flash.display.*;
import org.generalrelativity.foam.view.*;
import org.flintparticles.twoD.renderers.*;
import flash.net.*;
import mochi.*;
public final class GameManager {
const WONLEVELFX:int = 5;
const LIGHTNINGPROJECTILE:int = 14;
const HURT2FX:int = 14;
const CATAPULT:int = 2;
const MOVEDESKIMOFX:int = 6;
const FOREST:int = 2;
const BIGBOULDERTRACTION:Number = 0.9;
const ICEWITCH:int = 5;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const IRONRIMMEDPROJECTILE:int = 16;
const ESKIMOFRICTION:Number = 0.9;
const FOAMESKIMO:int = 1;
const DRAGONFX:int = 19;
const KNIGHTPROJECTILE:int = 19;
const TITLE:int = 1;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const TREEHEIGHT:int = 100;
const NUMLEVELS:int = 20;
const HURT1FX:int = 13;
const TOPBOUNDARY:int = 0;
const ESKIMODIEDFX:int = 9;
const SHOCKWITCH:int = 6;
const ICE:int = 4;
const BIGBOULDERSIZE:int = 25;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const SCREENHEIGHT:int = 480;
const ICEPROJECTILE:int = 13;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const CLIFFS:int = 4;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const WOOD:int = 0;
const BATTLE:int = 6;
const WITCHFX:int = 23;
const SCREENWIDTH:int = 640;
const BUTTONSHORTFX:int = 29;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const STATE_PLACINGESKIMO:int = 1;
const IRON:int = 3;
const SHOTHITFX:int = 22;
const TREEWIDTH:int = 20;
const SHOCKFX:int = 21;
const ICEBLOCKMASS:int = 20;
const FOAMBLOCK:int = 3;
const DELETE_BLOCK:int = 2;
const BUTTONCLICKFX:int = 10;
const BIGBOULDER1:int = 99;
const BIGBOULDER2:int = 102;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const NOPEFX:int = 12;
const TREBUCHET_CLEARANCE:int = 150;
const SCROLLLIMIT:int = 25;
const TREBUCHET:int = 1;
const HOLDBLOCK:int = 104;
const SHOCKDRAGON:int = 3;
const ROCKPROJECTILE:int = 15;
const BACKTOPBOUNDARY:int = 0;
const ESKIMOMASS:int = 200;
const COINFX:int = 18;
const PLACEDBLOCKFX:int = 7;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const ESKIMOWIDTH:int = 15;
const FIREWITCH:int = 4;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const BLOCKWIDTH:int = 35;
const SPACEBAR:int = 32;
const BIGBOULDERMASS:int = 100;
const CATAPULTSHOTFX:int = 17;
const SCROLLAMOUNT:int = 20;
const FISTPOUNDSOUND:int = 27;
const MUDCOST:int = 1;
const CANNONBALLPROJECTILE:int = 17;
const FOAMBOULDER:int = 2;
const THRONEWIDTH:int = 31;
const SLOPEFRICTION:Number = 0;
const FOAMLANDSCAPE:int = 4;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const LAKE:int = 3;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const FLYERCLOSESPEED:int = 4;
const BACKLEFTBOUNDARY:int = 0;
const MUD:int = 1;
const TREE:int = 103;
const DECREASESIZE:int = 40;
const TREEMASS:Number = 50;
const TREEBOUNCE:Number = 0.1;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const MEDBOULDER1:int = 98;
const MEDBOULDER2:int = 101;
const EXPORT:int = 96;
const BIGBOULDERBOUNCE:Number = 0.5;
const TREBUCHETSHOTFX:int = 16;
const NOBLOCKSFX:int = 11;
const SLOPE_POINT:int = 51;
const LOSTLEVELFX:int = 3;
const NO_BUILD_STATE:int = 0;
const STATE_AVALANCHE:int = 3;
const REMOVEDBLOCKFX:int = 8;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FOAMCATAPULT:int = 5;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const ICEBLOCKFRICTION:Number = 0.7;
const SLOPE_STARTING_POINT:int = 49;
const ICEBLOCKBOUNCE:Number = 0;
const SMALLBOULDER2:int = 100;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const SMALLBOULDER1:int = 97;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
public static var playerGold:int = 0;
private static var currentLevel:GameLevel;
public static var lastSubmittedScore:int = 0;
public static var showMap:Boolean = false;
private static var currentScore:int = 0;
public static var transitionScreen:TransitionScreen = new TransitionScreen();
public static var fxButton:ToggleButton = new ToggleButton();
public static var fadeDisplay:Sprite = new Sprite();
private static var wonGameScreen:WonGameScreen;
public static var screenDisplay:Sprite = new Sprite();
public static var musicButton:ToggleButton = new ToggleButton();
public static var congratsShown:Boolean = false;
public static var interfaceDisplay:Sprite = new Sprite();
public static var musicPlaying:Boolean = false;
public static var levelInfo:Array = new Array();
public static var resumeLSO:SharedObject = SharedObject.getLocal("kingdomCrusherResume");
private static var titleScreen:GameTitleScreen;
public static var bricksPurchased:Array = [true, false, false, false];
private static var goThereIntro:GoThereIntro;
private static var ssIntro:LogoIntroClip;
public static function removeTransition(){
fadeDisplay.removeChild(transitionScreen);
}
public static function endIntro(){
transitionScreen.alpha = 1;
fadeDisplay.addChild(transitionScreen);
goThereIntro.removeEventListener(MouseEvent.ROLL_OVER, mouseOverGoThere);
goThereIntro.removeEventListener(MouseEvent.ROLL_OUT, mouseOverGoThere);
goThereIntro.removeEventListener(MouseEvent.CLICK, clickedGoThere);
screenDisplay.removeChild(goThereIntro);
screenDisplay.removeChild(ssIntro);
ssIntro = null;
loadTitle();
}
public static function removeLevel_Restart(_arg1:int){
screenDisplay.removeChild(currentLevel);
loadLevel(_arg1);
fadeIn();
}
public static function initiate(){
var _local1:int;
var _local2:int;
populateLevels();
fadeDisplay.mouseEnabled = false;
fadeDisplay.mouseChildren = false;
transitionScreen.mouseEnabled = false;
transitionScreen.mouseChildren = false;
loadInitialTitle();
if (resumeLSO.data.previouslyViewed){
_local1 = 0;
while (_local1 < 20) {
levelInfo[_local1].beaten = resumeLSO.data.beatenArray[_local1];
levelInfo[_local1].isAvailable = resumeLSO.data.availableArray[_local1];
_local1++;
};
bricksPurchased[1] = resumeLSO.data.bricksPurchasedArray[1];
bricksPurchased[2] = resumeLSO.data.bricksPurchasedArray[2];
bricksPurchased[3] = resumeLSO.data.bricksPurchasedArray[3];
} else {
resumeLSO.data.previouslyViewed = true;
resumeLSO.data.beatenArray = new Array();
resumeLSO.data.availableArray = new Array();
resumeLSO.data.bricksPurchasedArray = [true, false, false, false];
_local2 = 0;
while (_local2 < 20) {
resumeLSO.data.beatenArray.push(false);
resumeLSO.data.availableArray.push(false);
_local2++;
};
resumeLSO.data.availableArray[0] = true;
};
}
private static function mouseOverGoThere(_arg1:MouseEvent){
goThereIntro.gotoAndPlay(2);
}
public static function clearTitle(_arg1:int){
screenDisplay.removeChild(titleScreen);
loadLevel(_arg1);
}
public static function levelBeaten(_arg1:int){
var sentLevel = _arg1;
levelInfo[sentLevel].beaten = true;
resumeLSO.data.bricksPurchasedArray[1] = bricksPurchased[1];
resumeLSO.data.bricksPurchasedArray[2] = bricksPurchased[2];
resumeLSO.data.bricksPurchasedArray[3] = bricksPurchased[3];
if (sentLevel < 19){
levelInfo[(sentLevel + 1)].isAvailable = true;
};
var i:int;
while (i < 20) {
resumeLSO.data.beatenArray[i] = levelInfo[i].beaten;
resumeLSO.data.availableArray[i] = levelInfo[i].isAvailable;
i = (i + 1);
};
try {
resumeLSO.flush();
} catch(e:Error) {
};
}
public static function removeLevel_Title(){
screenDisplay.removeChild(currentLevel);
loadTitle();
fadeIn();
}
public static function loadIntro(){
ssIntro = new LogoIntroClip();
ssIntro.x = 320;
ssIntro.y = 240;
ssIntro.width = 26573;
ssIntro.height = 4489.7;
screenDisplay.addChild(ssIntro);
Tweener.addTween(ssIntro, {x:491.3, time:1.5, onComplete:addGoThere});
Tweener.addTween(ssIntro, {width:389.4, time:2});
Tweener.addTween(ssIntro, {height:65.8, time:2});
Tweener.addTween(ssIntro, {x:1200, time:3, delay:4});
Tweener.addTween(ssIntro, {width:26573, time:3, delay:4, onComplete:endIntro});
Tweener.addTween(ssIntro, {height:4489.7, time:3, delay:4});
}
public static function removeLevel_WonGame(){
screenDisplay.removeChild(currentLevel);
loadWonScreen();
fadeIn();
}
private static function mouseOutGoThere(_arg1:MouseEvent){
goThereIntro.gotoAndStop(1);
}
public static function restartLevel(_arg1:int){
startFadeOut();
Tweener.addTween(transitionScreen, {alpha:1, time:2, onComplete:removeLevel_Restart, onCompleteParams:[_arg1]});
}
public static function leaveWonScreen(){
startFadeOut();
Tweener.addTween(transitionScreen, {alpha:1, time:2, onComplete:removeWonScreen_Title});
}
private static function clickedGoThere(_arg1:MouseEvent){
var _local2:URLRequest = new URLRequest("http://www.sinistersea.com");
navigateToURL(_local2, "_blank");
}
public static function loadTitle(){
SoundManager.switchMusic(1);
titleScreen = new GameTitleScreen();
screenDisplay.addChild(titleScreen);
titleScreen.activate();
musicButton.clip.visible = true;
fxButton.clip.visible = true;
fadeIn();
if (showMap){
titleScreen.showMap();
showMap = false;
};
}
public static function fadeIn(){
transitionScreen.alpha = 1;
Tweener.addTween(transitionScreen, {alpha:0, time:2, onComplete:removeTransition});
}
public static function fxToggle(_arg1:MouseEvent){
SoundManager.fxToggle();
if (fxButton.isOn){
fxButton.turnOff();
} else {
fxButton.turnOn();
};
}
public static function returnToTitle(){
startFadeOut();
Tweener.addTween(transitionScreen, {alpha:1, time:2, onComplete:removeLevel_Title});
}
public static function loadLevel(_arg1:int){
var sentLevel = _arg1;
calculateGold();
resumeLSO.data.bricksPurchasedArray[1] = bricksPurchased[1];
resumeLSO.data.bricksPurchasedArray[2] = bricksPurchased[2];
resumeLSO.data.bricksPurchasedArray[3] = bricksPurchased[3];
try {
resumeLSO.flush();
} catch(e:Error) {
};
currentLevel = new GameLevel(sentLevel);
screenDisplay.addChild(currentLevel);
currentLevel.activate();
SoundManager.switchMusic(levelInfo[sentLevel].levelType);
fadeIn();
}
public static function musicToggle(_arg1:MouseEvent){
SoundManager.musicToggle();
if (musicButton.isOn){
musicButton.turnOff();
} else {
musicButton.turnOn();
};
}
public static function loadWonScreen(){
wonGameScreen = new WonGameScreen();
screenDisplay.addChild(wonGameScreen);
wonGameScreen.activate();
SoundManager.switchMusic(1);
fadeIn();
}
public static function leaveTitle(_arg1:int){
titleScreen.clearLevelMarkers();
titleScreen.mapSelect.gotoAndPlay("endFold");
startFadeOut();
SoundManager.stopMusic();
Tweener.addTween(transitionScreen, {alpha:1, time:2, onComplete:clearTitle, onCompleteParams:[_arg1]});
}
public static function initiateMusicControls(){
musicButton.clip = new MusicButton();
fxButton.clip = new FxButton();
musicButton.clip.x = 590;
musicButton.clip.y = 10;
fxButton.clip.x = 588;
fxButton.clip.y = 55;
interfaceDisplay.addChild(musicButton.clip);
interfaceDisplay.addChild(fxButton.clip);
musicButton.activate();
fxButton.activate();
musicButton.turnOn();
fxButton.turnOn();
musicButton.clip.addEventListener(MouseEvent.CLICK, musicToggle);
fxButton.clip.addEventListener(MouseEvent.CLICK, fxToggle);
}
public static function calculateGold(){
var _local1:int = levelInfo.length;
playerGold = 0;
var _local2:int;
while (_local2 < _local1) {
if (levelInfo[_local2].beaten){
playerGold = (playerGold + levelInfo[_local2].levelBonus);
};
_local2++;
};
if (bricksPurchased[1]){
playerGold = (playerGold - 25);
};
if (bricksPurchased[2]){
playerGold = (playerGold - 50);
};
if (bricksPurchased[3]){
playerGold = (playerGold - 75);
};
}
public static function startFadeOut(){
transitionScreen.alpha = 0;
fadeDisplay.addChild(transitionScreen);
}
private static function populateLevels(){
var _local1:LevelData;
var _local2:int;
while (_local2 < 20) {
_local1 = new LevelData(_local2);
levelInfo.push(_local1);
_local2++;
};
}
public static function loadInitialTitle(){
titleScreen = new GameTitleScreen();
screenDisplay.addChild(titleScreen);
titleScreen.activate();
musicButton.clip.visible = true;
fxButton.clip.visible = true;
if (showMap){
titleScreen.showMap();
showMap = false;
};
}
private static function addGoThere(){
goThereIntro = new GoThereIntro();
goThereIntro.useHandCursor = true;
goThereIntro.buttonMode = true;
screenDisplay.addChild(goThereIntro);
goThereIntro.addEventListener(MouseEvent.ROLL_OVER, mouseOverGoThere);
goThereIntro.addEventListener(MouseEvent.ROLL_OUT, mouseOutGoThere);
goThereIntro.addEventListener(MouseEvent.CLICK, clickedGoThere);
}
public static function removeWonScreen_Title(){
screenDisplay.removeChild(wonGameScreen);
showMap = true;
loadTitle();
fadeIn();
}
public static function nextLevel(_arg1:int){
startFadeOut();
_arg1++;
if (_arg1 <= 19){
Tweener.addTween(transitionScreen, {alpha:1, time:2, onComplete:removeLevel_Restart, onCompleteParams:[_arg1]});
} else {
Tweener.addTween(transitionScreen, {alpha:1, time:2, onComplete:removeLevel_WonGame});
};
}
}
}//package
Section 166
//GameTitleScreen (GameTitleScreen)
package {
import flash.events.*;
import caurina.transitions.*;
import flash.display.*;
import org.generalrelativity.foam.view.*;
import org.flintparticles.twoD.renderers.*;
import flash.net.*;
import mochi.*;
public class GameTitleScreen extends MovieClip {
const WONLEVELFX:int = 5;
const LIGHTNINGPROJECTILE:int = 14;
const HURT2FX:int = 14;
const CATAPULT:int = 2;
const MOVEDESKIMOFX:int = 6;
const FOREST:int = 2;
const BIGBOULDERTRACTION:Number = 0.9;
const ICEWITCH:int = 5;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const IRONRIMMEDPROJECTILE:int = 16;
const ESKIMOFRICTION:Number = 0.9;
const FOAMESKIMO:int = 1;
const DRAGONFX:int = 19;
const KNIGHTPROJECTILE:int = 19;
const TITLE:int = 1;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const TREEHEIGHT:int = 100;
const NUMLEVELS:int = 20;
const HURT1FX:int = 13;
const TOPBOUNDARY:int = 0;
const ESKIMODIEDFX:int = 9;
const SHOCKWITCH:int = 6;
const ICE:int = 4;
const BIGBOULDERSIZE:int = 25;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const SCREENHEIGHT:int = 480;
const ICEPROJECTILE:int = 13;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const CLIFFS:int = 4;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const WOOD:int = 0;
const BATTLE:int = 6;
const WITCHFX:int = 23;
const SCREENWIDTH:int = 640;
const BUTTONSHORTFX:int = 29;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const STATE_PLACINGESKIMO:int = 1;
const IRON:int = 3;
const SHOTHITFX:int = 22;
const TREEWIDTH:int = 20;
const SHOCKFX:int = 21;
const ICEBLOCKMASS:int = 20;
const FOAMBLOCK:int = 3;
const DELETE_BLOCK:int = 2;
const BUTTONCLICKFX:int = 10;
const BIGBOULDER1:int = 99;
const BIGBOULDER2:int = 102;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const NOPEFX:int = 12;
const TREBUCHET_CLEARANCE:int = 150;
const SCROLLLIMIT:int = 25;
const TREBUCHET:int = 1;
const HOLDBLOCK:int = 104;
const SHOCKDRAGON:int = 3;
const ROCKPROJECTILE:int = 15;
const BACKTOPBOUNDARY:int = 0;
const ESKIMOMASS:int = 200;
const COINFX:int = 18;
const PLACEDBLOCKFX:int = 7;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const ESKIMOWIDTH:int = 15;
const FIREWITCH:int = 4;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const BLOCKWIDTH:int = 35;
const SPACEBAR:int = 32;
const BIGBOULDERMASS:int = 100;
const CATAPULTSHOTFX:int = 17;
const SCROLLAMOUNT:int = 20;
const FISTPOUNDSOUND:int = 27;
const MUDCOST:int = 1;
const CANNONBALLPROJECTILE:int = 17;
const FOAMBOULDER:int = 2;
const THRONEWIDTH:int = 31;
const SLOPEFRICTION:Number = 0;
const FOAMLANDSCAPE:int = 4;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const LAKE:int = 3;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const FLYERCLOSESPEED:int = 4;
const BACKLEFTBOUNDARY:int = 0;
const MUD:int = 1;
const TREE:int = 103;
const DECREASESIZE:int = 40;
const TREEMASS:Number = 50;
const TREEBOUNCE:Number = 0.1;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const MEDBOULDER1:int = 98;
const MEDBOULDER2:int = 101;
const EXPORT:int = 96;
const BIGBOULDERBOUNCE:Number = 0.5;
const TREBUCHETSHOTFX:int = 16;
const NOBLOCKSFX:int = 11;
const SLOPE_POINT:int = 51;
const LOSTLEVELFX:int = 3;
const NO_BUILD_STATE:int = 0;
const STATE_AVALANCHE:int = 3;
const REMOVEDBLOCKFX:int = 8;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FOAMCATAPULT:int = 5;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const ICEBLOCKFRICTION:Number = 0.7;
const SLOPE_STARTING_POINT:int = 49;
const ICEBLOCKBOUNCE:Number = 0;
const SMALLBOULDER2:int = 100;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const SMALLBOULDER1:int = 97;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
private var startHereAdded:Boolean;// = false
public var levelMarkers:Array;
private var selectTransition:TransitionScreen;
public var mapSelect:MapSelect;
public var totalScore:int;// = 0
private var allBeaten:Boolean;// = true
public function GameTitleScreen(){
levelMarkers = new Array();
selectTransition = new TransitionScreen();
mapSelect = new MapSelect();
super();
}
private function startGameClicked(_arg1:MouseEvent){
showMap();
}
public function clearLevelMarkers(){
var _local1:int;
while (_local1 < NUMLEVELS) {
levelMarkers[_local1].deactivate();
removeChild(levelMarkers[_local1]);
_local1++;
};
}
public function deactivate(){
if (startHereAdded){
};
}
private function okClicked(_arg1:MouseEvent){
SoundManager.playFx(BUTTONCLICKFX);
}
public function activate(){
}
public function showMap(){
deactivate();
selectTransition.alpha = 0;
addChild(selectTransition);
Tweener.addTween(selectTransition, {alpha:0.75, time:2});
addChild(mapSelect);
mapSelect.alpha = 0;
Tweener.addTween(mapSelect, {alpha:1, time:0.75, onComplete:populateMarkers});
mapSelect.gotoAndStop("flatMap");
}
public function populateMarkers(){
var _local1:LevelMarker;
mapSelect.gotoAndStop(21);
var _local2:int;
while (_local2 < NUMLEVELS) {
_local1 = new LevelMarker(_local2);
_local1.x = GameManager.levelInfo[_local2].mapPosX;
_local1.y = GameManager.levelInfo[_local2].mapPosY;
addChild(_local1);
if (GameManager.levelInfo[_local2].beaten){
_local1.makeBeaten();
mapSelect.gotoAndStop((22 + _local2));
};
if (GameManager.levelInfo[_local2].isAvailable){
_local1.makeAvailable();
};
if ((((_local2 == 1)) && (!(GameManager.levelInfo[_local2].isAvailable)))){
startHereAdded = true;
} else {
startHereAdded = false;
};
levelMarkers.push(_local1);
_local2++;
};
_local2 = 0;
while (_local2 < NUMLEVELS) {
levelMarkers[_local2].activate();
_local2++;
};
}
public function congratsComplete(){
activate();
}
}
}//package
Section 167
//GiantArm (GiantArm)
package {
import flash.display.*;
public dynamic class GiantArm extends MovieClip {
}
}//package
Section 168
//GoodSpotSound (GoodSpotSound)
package {
import flash.media.*;
public dynamic class GoodSpotSound extends Sound {
}
}//package
Section 169
//GoThereIntro (GoThereIntro)
package {
import flash.display.*;
public dynamic class GoThereIntro extends MovieClip {
}
}//package
Section 170
//HudRepBrick (HudRepBrick)
package {
import flash.display.*;
public dynamic class HudRepBrick extends MovieClip {
public function HudRepBrick(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 171
//Hurt1Sound (Hurt1Sound)
package {
import flash.media.*;
public dynamic class Hurt1Sound extends Sound {
}
}//package
Section 172
//Hurt2Sound (Hurt2Sound)
package {
import flash.media.*;
public dynamic class Hurt2Sound extends Sound {
}
}//package
Section 173
//Hurt3Sound (Hurt3Sound)
package {
import flash.media.*;
public dynamic class Hurt3Sound extends Sound {
}
}//package
Section 174
//IceBall (IceBall)
package {
import flash.display.*;
public dynamic class IceBall extends MovieClip {
}
}//package
Section 175
//IceDragon (IceDragon)
package {
public dynamic class IceDragon extends Flyer {
}
}//package
Section 176
//IceTrail (IceTrail)
package {
import flash.geom.*;
import org.flintparticles.common.initializers.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.common.counters.*;
import org.flintparticles.twoD.zones.*;
import org.flintparticles.twoD.emitters.*;
import org.flintparticles.twoD.actions.*;
import org.flintparticles.twoD.initializers.*;
import org.flintparticles.common.displayObjects.*;
public class IceTrail {
public var stoneTrail:Emitter2D;
public var emitterArray:Array;
public function IceTrail(_arg1:int, _arg2:int){
stoneTrail = new Emitter2D();
emitterArray = new Array();
super();
stoneTrail.counter = new Blast(10);
stoneTrail.addInitializer(new Lifetime(0.25, 0.75));
stoneTrail.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 80, 40)));
stoneTrail.addInitializer(new SharedImage(new RadialDot(4)));
stoneTrail.addInitializer(new ColorInit(4294967295, 4294967295));
stoneTrail.addAction(new Age());
stoneTrail.addAction(new Move());
stoneTrail.addAction(new Fade(0.75, 0));
stoneTrail.addAction(new RandomDrift(15, 15));
stoneTrail.x = _arg1;
stoneTrail.y = _arg2;
stoneTrail.start();
emitterArray.push(stoneTrail);
}
}
}//package
Section 177
//IceWitch (IceWitch)
package {
public dynamic class IceWitch extends Flyer {
}
}//package
Section 178
//IntroMusic (IntroMusic)
package {
import flash.media.*;
public dynamic class IntroMusic extends Sound {
}
}//package
Section 179
//IronRock1 (IronRock1)
package {
import flash.display.*;
public dynamic class IronRock1 extends MovieClip {
}
}//package
Section 180
//King (King)
package {
import flash.display.*;
public dynamic class King extends MovieClip {
public function King(){
addFrameScript(43, frame44, 83, frame84, 118, frame119, 158, frame159, 198, frame199);
}
function frame199(){
gotoAndPlay("falling");
}
function frame159(){
gotoAndPlay("falling");
}
function frame84(){
gotoAndPlay(1);
}
function frame119(){
gotoAndPlay("falling");
}
function frame44(){
gotoAndPlay(1);
}
}
}//package
Section 181
//KING13 (KING13)
package {
import flash.display.*;
public dynamic class KING13 extends MovieClip {
}
}//package
Section 182
//KnightBomber (KnightBomber)
package {
import flash.display.*;
public dynamic class KnightBomber extends MovieClip {
}
}//package
Section 183
//LakeBackground1 (LakeBackground1)
package {
public dynamic class LakeBackground1 extends BackgroundLayer {
}
}//package
Section 184
//LakeBackground2 (LakeBackground2)
package {
public dynamic class LakeBackground2 extends BackgroundLayer {
}
}//package
Section 185
//LakeBackground3 (LakeBackground3)
package {
public dynamic class LakeBackground3 extends BackgroundLayer {
}
}//package
Section 186
//LakeClouds (LakeClouds)
package {
import flash.display.*;
public dynamic class LakeClouds extends MovieClip {
}
}//package
Section 187
//LakeLevel1 (LakeLevel1)
package {
import flash.display.*;
public dynamic class LakeLevel1 extends MovieClip {
}
}//package
Section 188
//LakeLevel2 (LakeLevel2)
package {
import flash.display.*;
public dynamic class LakeLevel2 extends Sprite {
}
}//package
Section 189
//LakeLevel3 (LakeLevel3)
package {
import flash.display.*;
public dynamic class LakeLevel3 extends Sprite {
}
}//package
Section 190
//LakeLevel4 (LakeLevel4)
package {
import flash.display.*;
public dynamic class LakeLevel4 extends Sprite {
}
}//package
Section 191
//LakeLevel5 (LakeLevel5)
package {
import flash.display.*;
public dynamic class LakeLevel5 extends Sprite {
}
}//package
Section 192
//LakeMusic (LakeMusic)
package {
import flash.media.*;
public dynamic class LakeMusic extends Sound {
}
}//package
Section 193
//LakeWater (LakeWater)
package {
import flash.display.*;
public dynamic class LakeWater extends MovieClip {
public var test:LakeWaterOverlay;
}
}//package
Section 194
//LakeWaterOverlay (LakeWaterOverlay)
package {
import flash.display.*;
public dynamic class LakeWaterOverlay extends MovieClip {
}
}//package
Section 195
//LeftHud (LeftHud)
package {
import flash.display.*;
import flash.text.*;
public dynamic class LeftHud extends MovieClip {
public var brickCostText:TextField;
public var brickSelectLeft:SimpleButton;
public var currentGoldText:TextField;
public var startBattleButton:StartBattleButton;
public var hudExampleBrick:BlockSkin;
public var levelMapButton:SimpleButton;
public var ironBrick:SmallBricks;
public var woodBrick:SmallBricks;
public var stoneBrick:SmallBricks;
public var bricksAvailableText:TextField;
public var mudBrick:SmallBricks;
public var levelShopButton:SimpleButton;
public var notPurchased:TextField;
public var closeHudButton:CloseHUDButton;
public var zoomButton:MovieClip;
public var brickTypeLabel:MovieClip;
public var brickSelectRight:SimpleButton;
public function LeftHud(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 196
//LevelData (LevelData)
package {
import flash.events.*;
import org.generalrelativity.foam.view.*;
import org.flintparticles.twoD.renderers.*;
import flash.net.*;
import mochi.*;
public class LevelData {
const WONLEVELFX:int = 5;
const LIGHTNINGPROJECTILE:int = 14;
const HURT2FX:int = 14;
const CATAPULT:int = 2;
const MOVEDESKIMOFX:int = 6;
const FOREST:int = 2;
const BIGBOULDERTRACTION:Number = 0.9;
const ICEWITCH:int = 5;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const IRONRIMMEDPROJECTILE:int = 16;
const ESKIMOFRICTION:Number = 0.9;
const FOAMESKIMO:int = 1;
const DRAGONFX:int = 19;
const KNIGHTPROJECTILE:int = 19;
const TITLE:int = 1;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const TREEHEIGHT:int = 100;
const NUMLEVELS:int = 20;
const HURT1FX:int = 13;
const TOPBOUNDARY:int = 0;
const ESKIMODIEDFX:int = 9;
const SHOCKWITCH:int = 6;
const ICE:int = 4;
const BIGBOULDERSIZE:int = 25;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const SCREENHEIGHT:int = 480;
const ICEPROJECTILE:int = 13;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const CLIFFS:int = 4;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const WOOD:int = 0;
const BATTLE:int = 6;
const WITCHFX:int = 23;
const SCREENWIDTH:int = 640;
const BUTTONSHORTFX:int = 29;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const STATE_PLACINGESKIMO:int = 1;
const IRON:int = 3;
const SHOTHITFX:int = 22;
const TREEWIDTH:int = 20;
const SHOCKFX:int = 21;
const ICEBLOCKMASS:int = 20;
const FOAMBLOCK:int = 3;
const DELETE_BLOCK:int = 2;
const BUTTONCLICKFX:int = 10;
const BIGBOULDER1:int = 99;
const BIGBOULDER2:int = 102;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const NOPEFX:int = 12;
const TREBUCHET_CLEARANCE:int = 150;
const SCROLLLIMIT:int = 25;
const TREBUCHET:int = 1;
const HOLDBLOCK:int = 104;
const SHOCKDRAGON:int = 3;
const ROCKPROJECTILE:int = 15;
const BACKTOPBOUNDARY:int = 0;
const ESKIMOMASS:int = 200;
const COINFX:int = 18;
const PLACEDBLOCKFX:int = 7;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const ESKIMOWIDTH:int = 15;
const FIREWITCH:int = 4;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const BLOCKWIDTH:int = 35;
const SPACEBAR:int = 32;
const BIGBOULDERMASS:int = 100;
const CATAPULTSHOTFX:int = 17;
const SCROLLAMOUNT:int = 20;
const FISTPOUNDSOUND:int = 27;
const MUDCOST:int = 1;
const CANNONBALLPROJECTILE:int = 17;
const FOAMBOULDER:int = 2;
const THRONEWIDTH:int = 31;
const SLOPEFRICTION:Number = 0;
const FOAMLANDSCAPE:int = 4;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const LAKE:int = 3;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const FLYERCLOSESPEED:int = 4;
const BACKLEFTBOUNDARY:int = 0;
const MUD:int = 1;
const TREE:int = 103;
const DECREASESIZE:int = 40;
const TREEMASS:Number = 50;
const TREEBOUNCE:Number = 0.1;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const MEDBOULDER1:int = 98;
const MEDBOULDER2:int = 101;
const EXPORT:int = 96;
const BIGBOULDERBOUNCE:Number = 0.5;
const TREBUCHETSHOTFX:int = 16;
const NOBLOCKSFX:int = 11;
const SLOPE_POINT:int = 51;
const LOSTLEVELFX:int = 3;
const NO_BUILD_STATE:int = 0;
const STATE_AVALANCHE:int = 3;
const REMOVEDBLOCKFX:int = 8;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FOAMCATAPULT:int = 5;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const ICEBLOCKFRICTION:Number = 0.7;
const SLOPE_STARTING_POINT:int = 49;
const ICEBLOCKBOUNCE:Number = 0;
const SMALLBOULDER2:int = 100;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const SMALLBOULDER1:int = 97;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
public var mapPosY:int;// = 0
public var levelNumber:int;// = 0
public var background3Width:int;// = 0
public var arms:Array;
public var mapPosX:int;// = 0
public var levelName:String;
public var treePos:Array;
public var background3Height:int;// = 0
public var cloudPosY:Number;// = 0
public var background2Depth:int;// = 0
public var levelWidth:Number;// = 0
public var isAvailable:Boolean;// = false
public var dragons:Array;
public var levelType:int;// = 0
public var beaten:Boolean;// = false
public var foregroundBoulderPos:Array;
public var levelBonus:int;// = 0
public var foregroundGraphics:Object;
public var background3Depth:int;// = 0
public var backgroundBoulderPos:Array;
public var background2Height:int;// = 0
public var cloudType:Object;
public var bestScore:int;// = 0
public var foregroundDepth:int;// = 0
public var slopePointPos:Array;
public var background2Width:int;// = 0
public var background1Depth:int;// = 0
public var backgroundType:Object;
public var levelHeight:Number;// = 0
public var backgroundLayer2:Object;
public var backgroundLayer3:Object;
public var startingBlocks:int;// = 0
public var cloudsOnBottom:Boolean;// = false
public var backgroundLayer1:Object;
public function LevelData(_arg1:int){
slopePointPos = new Array();
foregroundBoulderPos = new Array();
backgroundBoulderPos = new Array();
treePos = new Array();
dragons = new Array();
arms = new Array();
super();
levelNumber = _arg1;
populateLevel();
}
public function deactivate(){
}
public function populateLevel(){
switch (levelNumber){
case 0:
levelName = "Forest1";
levelType = FOREST;
startingBlocks = 5;
levelBonus = 5;
mapPosX = 132;
mapPosY = 0x0101;
isAvailable = true;
backgroundLayer1 = ForestBackground1;
backgroundLayer2 = ForestBackground2;
backgroundLayer3 = ForestBackground3;
foregroundGraphics = ForestLevel1;
levelWidth = 1660;
levelHeight = 600;
background2Height = 500;
background2Width = 800;
background3Height = 600;
background3Width = 0x0500;
background1Depth = 0;
background2Depth = 1;
background3Depth = 3;
foregroundDepth = 2;
cloudsOnBottom = true;
cloudType = ForestClouds;
cloudPosY = -100;
slopePointPos[0] = [0, 88, 171, 0x0101, 302, 345, 448, 576, 688, 797, 891, 990, 1055, 1106, 1214, 1254, 1358, 1411, 1423, 1545, 1566, 1662];
slopePointPos[1] = [462, 473, 473, 434, 434, 454, 486, 486, 450, 432, 432, 432, 441, 462, 462, 450, 431, 405, 383, 345, 381, 386];
treePos[0] = [875];
treePos[1] = [432];
treePos[2] = [100];
treePos[3] = [100];
treePos[4] = [3];
treePos[5] = [15];
treePos[6] = [1];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
case 1:
levelName = "Forest2";
levelType = FOREST;
startingBlocks = 6;
levelBonus = 5;
mapPosX = 157;
mapPosY = 205;
isAvailable = false;
backgroundLayer1 = ForestBackground1;
backgroundLayer2 = ForestBackground2;
backgroundLayer3 = ForestBackground3;
foregroundGraphics = ForestLevel2;
levelWidth = 1680;
levelHeight = 600;
background2Height = 500;
background2Width = 800;
background3Height = 600;
background3Width = 0x0500;
background1Depth = 0;
background2Depth = 1;
background3Depth = 3;
foregroundDepth = 2;
cloudsOnBottom = true;
cloudType = ForestClouds;
cloudPosY = -100;
slopePointPos[0] = [0, 84, 128, 202, 325, 388, 410, 449, 495, 504, 572, 603, 675, 705, 738, 779, 831, 872, 907, 918, 967, 975, 1016, 1096, 1134, 1145, 1175, 1206, 1232, 1255, 1489, 1507, 1535, 1573, 1564, 1680];
slopePointPos[1] = [385, 424, 468, 483, 483, 469, 448, 385, 379, 395, 398, 408, 396, 481, 498, 506, 526, 526, 506, 473, 473, 501, 517, 517, 490, 452, 445, 460, 464, 503, 503, 407, 379, 283, 244, 172];
treePos[0] = [247, 1370];
treePos[1] = [483, 503];
treePos[2] = [100, 100];
treePos[3] = [100, 175];
treePos[4] = [4, 4];
treePos[5] = [15, 15];
treePos[6] = [1, 1];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
case 2:
levelName = "Forest3";
levelType = FOREST;
startingBlocks = 10;
levelBonus = 5;
mapPosX = 122;
mapPosY = 154;
isAvailable = false;
backgroundLayer1 = ForestBackground1;
backgroundLayer2 = ForestBackground2;
backgroundLayer3 = ForestBackground3;
foregroundGraphics = ForestLevel3;
levelWidth = 1660;
levelHeight = 1240;
background2Height = 500;
background2Width = 800;
background3Height = 600;
background3Width = 0x0500;
background1Depth = 0;
background2Depth = 1;
background3Depth = 3;
foregroundDepth = 2;
cloudsOnBottom = true;
cloudType = ForestClouds;
cloudPosY = -100;
slopePointPos[0] = [0, 51, 64, 64, 83, 199, 231, 231, 264, 382, 418, 410, 435, 526, 555, 709, 866, 878, 930, 963, 1114, 1150, 1270, 1321, 1342, 1355, 1504, 1523, 0x0606, 1492, 1633, 1641, 1680];
slopePointPos[1] = [334, 370, 393, 441, 490, 490, 602, 651, 761, 761, 874, 906, 973, 973, 1027, 1108, 1108, 1085, 1085, 1055, 1055, 976, 976, 925, 871, 782, 782, 657, 592, 0x0200, 515, 398, 354];
treePos[0] = [1023, 1208, 1422, 1552];
treePos[1] = [1055, 976, 782, 0x0202];
treePos[2] = [100, 100, 100, 100];
treePos[3] = [100, 135, 175, 0x0101];
treePos[4] = [3, 3, 3, 3];
treePos[5] = [15, 16, 15, 16];
treePos[6] = [2, 2, 2, 2];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
case 3:
levelName = "Forest4";
levelType = FOREST;
startingBlocks = 20;
levelBonus = 10;
mapPosX = 127;
mapPosY = 96;
isAvailable = false;
backgroundLayer1 = ForestBackground1;
backgroundLayer2 = ForestBackground2;
backgroundLayer3 = ForestBackground3;
foregroundGraphics = ForestLevel4;
levelWidth = 1680;
levelHeight = 900;
background2Height = 500;
background2Width = 800;
background3Height = 600;
background3Width = 0x0500;
background1Depth = 0;
background2Depth = 1;
background3Depth = 3;
foregroundDepth = 2;
cloudsOnBottom = true;
cloudType = ForestClouds;
cloudPosY = -100;
slopePointPos[0] = [0, 127, 215, 359, 507, 590, 629, 659, 678, 719, 767, 910, 941, 998, 1018, 1030, 1030, 1075, 1125, 1217, 0x0505, 1408, 1523, 1567, 1584, 1682];
slopePointPos[1] = [777, 777, 801, 801, 777, 697, 554, 507, 444, 361, 330, 330, 374, 417, 479, 557, 664, 716, 759, 0x0300, 801, 801, 750, 750, 776, 742];
treePos[0] = [239, 1344];
treePos[1] = [791, 782];
treePos[2] = [100, 100];
treePos[3] = [100, 175];
treePos[4] = [3, 3];
treePos[5] = [16, 16];
treePos[6] = [1, 1];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
case 4:
levelName = "Forest5";
levelType = FOREST;
startingBlocks = 5;
levelBonus = 10;
mapPosX = 187;
mapPosY = 89;
isAvailable = false;
backgroundLayer1 = ForestBackground1;
backgroundLayer2 = ForestBackground2;
backgroundLayer3 = ForestBackground3;
foregroundGraphics = ForestLevel5;
levelWidth = 1680;
levelHeight = 600;
background2Height = 500;
background2Width = 800;
background3Height = 600;
background3Width = 0x0500;
background1Depth = 0;
background2Depth = 1;
background3Depth = 3;
foregroundDepth = 2;
cloudsOnBottom = true;
cloudType = ForestClouds;
cloudPosY = -100;
slopePointPos[0] = [0, 131, 259, 341, 379, 385, 436, 499, 518, 546, 600, 641, 719, 802, 885, 902, 970, 1016, 1051, 1122, 1221, 1278, 1292, 1292, 1306, 1378, 1393, 1411, 1449, 1520, 1570, 1610, 1638, 1680];
slopePointPos[1] = [481, 495, 465, 465, 481, 525, 532, 532, 486, 465, 458, 458, 447, 447, 490, 519, 519, 441, 432, 422, 422, 465, 500, 525, 549, 549, 511, 486, 475, 483, 524, 511, 486, 478];
treePos[0] = [];
treePos[1] = [];
treePos[2] = [];
treePos[3] = [];
treePos[4] = [];
treePos[5] = [];
treePos[6] = [];
dragons = [FIREDRAGON, FIREWITCH, FIREDRAGON];
arms[0] = [];
arms[1] = [];
break;
case 5:
levelName = "Cliff1";
levelType = CLIFFS;
startingBlocks = 9;
levelBonus = 5;
mapPosX = 455;
mapPosY = 95;
isAvailable = false;
backgroundLayer1 = CliffBackground1;
backgroundLayer2 = CliffBackground3;
backgroundLayer3 = CliffBackground2;
foregroundGraphics = CliffLevel1;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = false;
cloudType = CliffClouds;
levelWidth = 1680;
levelHeight = 900;
cloudPosY = (levelHeight - 80);
slopePointPos[0] = [0, 62, 101, 114, 138, 253, 269, 269, 282, 295, 295, 315, 322, 361, 630, 683, 704, 746, 782, 879, 903, 903, 974, 1005, 1047, 1074, 1315, 1355, 1371, 1392, 1392, 1418, 1516, 1549, 1565, 1591, 1623, 1682];
slopePointPos[1] = [833, 757, 551, 477, 250, 250, 489, 529, 615, 642, 693, 755, 823, 833, 833, 799, 753, 574, 569, 567, 611, 757, 769, 801, 833, 861, 861, 819, 777, 699, 450, 250, 250, 450, 615, 701, 823, 873];
treePos[0] = [476, 1187];
treePos[1] = [833, 862];
treePos[2] = [100, 100];
treePos[3] = [145, 100];
treePos[4] = [3, 3];
treePos[5] = [17, 12];
treePos[6] = [1, 1];
dragons = [];
arms[0] = [180, 1455];
arms[1] = [-30, -30];
break;
case 6:
levelName = "Cliff2";
levelType = CLIFFS;
startingBlocks = 20;
levelBonus = 5;
mapPosX = 0x0200;
mapPosY = 102;
isAvailable = false;
backgroundLayer1 = CliffBackground1;
backgroundLayer2 = CliffBackground3;
backgroundLayer3 = CliffBackground2;
foregroundGraphics = CliffLevel2;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = false;
cloudType = CliffClouds;
levelWidth = 0x0500;
levelHeight = 800;
cloudPosY = (levelHeight - 80);
slopePointPos[0] = [0, 98, 158, 270, 357, 462, 506, 555, 555, 577, 577, 604, 683, 731, 852, 898, 995, 1041, 1057, 1062, 1090, 1144, 1206, 1255, 0x0500];
slopePointPos[1] = [751, 751, 774, 774, 763, 763, 736, 655, 615, 535, 489, 444, 444, 453, 452, 418, 418, 370, 299, 246, 163, 134, 98, 55, 27];
treePos[0] = [222];
treePos[1] = [766];
treePos[2] = [100];
treePos[3] = [150];
treePos[4] = [5];
treePos[5] = [17];
treePos[6] = [1];
dragons = [ICEDRAGON];
arms[0] = [];
arms[1] = [];
break;
case 7:
levelName = "Cliff3";
levelType = CLIFFS;
startingBlocks = 5;
levelBonus = 10;
mapPosX = 489;
mapPosY = 177;
isAvailable = false;
backgroundLayer1 = CliffBackground1;
backgroundLayer2 = CliffBackground3;
backgroundLayer3 = CliffBackground2;
foregroundGraphics = CliffLevel3;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = false;
cloudType = CliffClouds;
levelWidth = 1680;
levelHeight = 0x0500;
cloudPosY = (levelHeight - 80);
slopePointPos[0] = [0, 138, 122, 117, 89, 70, 70, 222, 211, 233, 251, 190, 156, 165, 169, 213, 333, 331, 311, 267, 185, 171, 148, 352, 342, 397, 538, 750, 876, 960, 1011, 1144, 1304, 1499, 1683];
slopePointPos[1] = [0, 0, 44, 99, 174, 0x0100, 316, 316, 425, 461, 511, 586, 657, 706, 769, 776, 776, 823, 866, 912, 964, 1063, 1138, 1138, 1187, 1198, 1209, 1209, 1147, 1096, 1048, 1046, 1105, 1103, 1177];
treePos[0] = [610, 1069, 1418];
treePos[1] = [1208, 1046, 1103];
treePos[2] = [100, 100, 100];
treePos[3] = [100, 125, 239];
treePos[4] = [4, 4, 5];
treePos[5] = [17, 17, 16];
treePos[6] = [1, 2, 2];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
case 8:
levelName = "Cliff4";
levelType = CLIFFS;
startingBlocks = 13;
levelBonus = 10;
mapPosX = 0x0202;
mapPosY = 206;
isAvailable = false;
backgroundLayer1 = CliffBackground1;
backgroundLayer2 = CliffBackground3;
backgroundLayer3 = CliffBackground2;
foregroundGraphics = CliffLevel4;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = false;
cloudType = CliffClouds;
levelWidth = 1680;
levelHeight = 1000;
cloudPosY = (levelHeight - 80);
slopePointPos[0] = [0, 66, 81, 133, 144, 172, 290, 349, 377, 365, 352, 569, 553, 553, 587, 606, 631, 783, 809, 804, 865, 864, 840, 1030, 1022, 1022, 1038, 1038, 1069, 1107, 1184, 1308, 1339, 1316, 1535, 1578, 1610, 1656, 1680];
slopePointPos[1] = [157, 343, 477, 634, 718, 749, 749, 648, 539, 474, 437, 440, 476, 622, 724, 849, 919, 917, 789, 716, 404, 290, 259, 259, 335, 600, 669, 748, 807, 818, 786, 786, 687, 592, 594, 485, 377, 285, 189];
treePos[0] = [450, 927, 1422];
treePos[1] = [439, 259, 593];
treePos[2] = [100, 100, 100];
treePos[3] = [100, 125, 355];
treePos[4] = [4, 4, 4];
treePos[5] = [18, 16, 15];
treePos[6] = [1, 1, 1];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
case 9:
levelName = "Cliff5";
levelType = CLIFFS;
startingBlocks = 20;
levelBonus = 15;
mapPosX = 481;
mapPosY = 244;
isAvailable = false;
backgroundLayer1 = CliffBackground1;
backgroundLayer2 = CliffBackground3;
backgroundLayer3 = CliffBackground2;
foregroundGraphics = CliffLevel5;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = false;
cloudType = CliffClouds;
levelWidth = 1680;
levelHeight = 1000;
cloudPosY = (levelHeight - 80);
slopePointPos[0] = [0, 136, 135, 177, 312, 371, 380, 422, 447, 507, 507, 635, 635, 668, 668, 678, 783, 821, 821, 920, 980, 962, 979, 993, 1100, 1122, 1154, 1167, 1207, 1207, 1319, 1323, 1353, 1486, 1505, 1437, 1579, 1613, 1680];
slopePointPos[1] = [181, 181, 253, 348, 348, 415, 491, 581, 695, 864, 1423, 1423, 967, 853, 759, 639, 636, 898, 1443, 1443, 878, 698, 591, 560, 557, 712, 797, 936, 1081, 1452, 1440, 953, 477, 477, 373, 272, 275, 169, 117];
treePos[0] = [78, 245, 1411, 1496];
treePos[1] = [180, 346, 476, 272];
treePos[2] = [100, 100, 100, 100];
treePos[3] = [100, 175, 329, 375];
treePos[4] = [2, 2, 3, 3];
treePos[5] = [12, 12, 17, 17];
treePos[6] = [2, 2, 2, 2];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
case 10:
levelName = "Lake1";
levelType = LAKE;
startingBlocks = 20;
levelBonus = 15;
mapPosX = 0x0200;
mapPosY = 322;
isAvailable = false;
backgroundLayer1 = LakeBackground1;
backgroundLayer2 = LakeBackground2;
backgroundLayer3 = LakeBackground3;
foregroundGraphics = LakeLevel1;
levelWidth = 1273;
levelHeight = 480;
background2Height = 480;
background2Width = 800;
background3Height = 480;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = true;
cloudType = LakeClouds;
cloudPosY = -100;
slopePointPos[0] = [0, 65, 116, 172, 203, 218, 233, 220, 275, 322, 347, 421, 530, 579, 619, 679, 753, 830, 867, 895, 937, 952, 990, 1069, 1106, 1164, 1213, 1220, 1230, 1231, 1273];
slopePointPos[1] = [383, 356, 344, 344, 319, 317, 328, 357, 372, 389, 382, 384, 356, 366, 390, 390, 386, 375, 377, 357, 357, 369, 369, 362, 362, 376, 397, 363, 364, 391, 373];
treePos[0] = [];
treePos[1] = [];
treePos[2] = [];
treePos[3] = [];
treePos[4] = [];
treePos[5] = [];
treePos[6] = [];
dragons = [FIREDRAGON, FIREWITCH, ICEWITCH, ICEDRAGON];
arms[0] = [];
arms[1] = [];
break;
case 11:
levelName = "Lake2";
levelType = LAKE;
startingBlocks = 20;
levelBonus = 25;
mapPosX = 509;
mapPosY = 382;
isAvailable = false;
backgroundLayer1 = LakeBackground1;
backgroundLayer2 = LakeBackground2;
backgroundLayer3 = LakeBackground3;
foregroundGraphics = LakeLevel2;
levelWidth = 0x0500;
levelHeight = 0x0500;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = true;
cloudType = LakeClouds;
cloudPosY = -100;
slopePointPos[0] = [0, 252, 153, 181, 177, 417, 416, 481, 495, 531, 589, 626, 652, 751, 791, 783, 814, 822, 857, 883, 898, 1130, 1132, 1168, 1180, 1043, 0x0500];
slopePointPos[1] = [1036, 1036, 1106, 1144, 1437, 1443, 1180, 1062, 958, 878, 546, 460, 434, 434, 569, 678, 755, 959, 1099, 1263, 1454, 1449, 1176, 1122, 1004, 938, 938];
treePos[0] = [133, 1148];
treePos[1] = [1036, 936];
treePos[2] = [100, 100];
treePos[3] = [100, 185];
treePos[4] = [4, 4];
treePos[5] = [17, 17];
treePos[6] = [1, 1];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
case 12:
levelName = "Lake3";
levelType = LAKE;
startingBlocks = 22;
levelBonus = 25;
mapPosX = 450;
mapPosY = 386;
isAvailable = false;
backgroundLayer1 = LakeBackground1;
backgroundLayer2 = LakeBackground2;
backgroundLayer3 = LakeBackground3;
foregroundGraphics = LakeLevel3;
levelWidth = 1680;
levelHeight = 480;
background2Height = 480;
background2Width = 800;
background3Height = 480;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = true;
cloudType = LakeClouds;
cloudPosY = -100;
slopePointPos[0] = [0, 92, 215, 201, 228, 339, 374, 425, 425, 458, 524, 558, 558, 591, 607, 688, 699, 711, 718, 840, 831, 840, 872, 969, 993, 1016, 1026, 1104, 1119, 1149, 1166, 1277, 1277, 1264, 1379, 1391, 1406, 1408, 1483, 1487, 1509, 1530, 1604, 1656];
slopePointPos[1] = [557, 376, 376, 407, 694, 694, 404, 353, 283, 265, 265, 304, 377, 484, 695, 688, 421, 392, 342, 342, 406, 536, 691, 680, 434, 400, 293, 293, 368, 428, 701, 701, 425, 376, 376, 400, 529, 698, 695, 412, 221, 200, 200, 731];
treePos[0] = [155, 783, 1328];
treePos[1] = [376, 341, 375];
treePos[2] = [100, 100, 100];
treePos[3] = [100, 235, 365];
treePos[4] = [10, 10, 10];
treePos[5] = [15, 15, 15];
treePos[6] = [2, 2, 2];
dragons = [ICEDRAGON];
arms[0] = [1560];
arms[1] = [-70];
break;
case 13:
levelName = "Lake4";
levelType = LAKE;
startingBlocks = 15;
levelBonus = 25;
mapPosX = 439;
mapPosY = 353;
isAvailable = false;
backgroundLayer1 = LakeBackground1;
backgroundLayer2 = LakeBackground2;
backgroundLayer3 = LakeBackground3;
foregroundGraphics = LakeLevel4;
levelWidth = 0x0500;
levelHeight = 800;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = true;
cloudType = LakeClouds;
cloudPosY = -100;
slopePointPos[0] = [0, 58, 116, 180, 199, 235, 285, 426, 481, 503, 543, 588, 628, 719, 759, 794, 825, 868, 886, 904, 1046, 1075, 1097, 1115, 1147, 1263, 0x0500];
slopePointPos[1] = [729, 707, 657, 620, 571, 518, 488, 488, 528, 590, 656, 703, 715, 716, 694, 651, 584, 542, 495, 469, 469, 510, 557, 667, 709, 747, 747];
treePos[0] = [358, 968];
treePos[1] = [489, 470];
treePos[2] = [100, 100];
treePos[3] = [100, 155];
treePos[4] = [3, 3];
treePos[5] = [12, 17];
treePos[6] = [2, 2];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
case 14:
levelName = "Lake5";
levelType = LAKE;
startingBlocks = 7;
levelBonus = 25;
mapPosX = 382;
mapPosY = 388;
isAvailable = false;
backgroundLayer1 = LakeBackground1;
backgroundLayer2 = LakeBackground2;
backgroundLayer3 = LakeBackground3;
foregroundGraphics = LakeLevel5;
levelWidth = 0x0500;
levelHeight = 600;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = true;
cloudType = LakeClouds;
cloudPosY = -100;
slopePointPos[0] = [0, 159, 215, 279, 313, 371, 471, 525, 792, 829, 940, 1039, 1113, 1190, 1284];
slopePointPos[1] = [670, 580, 523, 477, 434, 411, 411, 540, 540, 410, 410, 463, 557, 591, 670];
treePos[0] = [644];
treePos[1] = [541];
treePos[2] = [100];
treePos[3] = [100];
treePos[4] = [3];
treePos[5] = [18];
treePos[6] = [1];
dragons = [SHOCKWITCH];
arms[0] = [];
arms[1] = [];
break;
case 15:
levelName = "Swamp1";
levelType = SWAMP;
startingBlocks = 18;
levelBonus = 25;
mapPosX = 261;
mapPosY = 388;
isAvailable = false;
backgroundLayer1 = SwampBackground1;
backgroundLayer2 = SwampBackground2;
backgroundLayer3 = SwampBackground3;
foregroundGraphics = SwampLevel1;
levelWidth = 0x0500;
levelHeight = 900;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = false;
cloudType = SwampClouds;
cloudPosY = (levelHeight - 80);
slopePointPos[0] = [0, 253, 281, 348, 420, 368, 383, 388, 419, 613, 640, 659, 689, 679, 688, 723, 716, 700, 681, 714, 749, 987, 1044, 1073, 1129, 1240, 1234, 1281];
slopePointPos[1] = [233, 233, 277, 344, 336, 377, 437, 474, 486, 486, 508, 511, 490, 478, 466, 499, 509, 503, 528, 663, 731, 731, 754, 793, 834, 864, 831, 822];
treePos[0] = [132, 862];
treePos[1] = [233, 730];
treePos[2] = [100, 100];
treePos[3] = [100, 150];
treePos[4] = [2, 2];
treePos[5] = [19, 19];
treePos[6] = [1, 1];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
case 16:
levelName = "Swamp2";
levelType = SWAMP;
startingBlocks = 10;
levelBonus = 25;
mapPosX = 201;
mapPosY = 380;
isAvailable = false;
backgroundLayer1 = SwampBackground1;
backgroundLayer2 = SwampBackground2;
backgroundLayer3 = SwampBackground3;
foregroundGraphics = SwampLevel2;
levelWidth = 0x0500;
levelHeight = 800;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = false;
cloudType = SwampClouds;
cloudPosY = (levelHeight - 80);
slopePointPos[0] = [0, 46, 73, 94, 153, 153, 178, 267, 288, 288, 303, 330, 385, 430, 484, 535, 548, 571, 539, 779, 730, 743, 751, 781, 862, 894, 927, 946, 985, 1008, 1120, 1138, 1138, 1158, 1182, 1224, 0x0500];
slopePointPos[1] = [765, 739, 693, 567, 382, 267, 174, 174, 492, 547, 673, 735, 723, 754, 742, 709, 633, 564, 530, 530, 573, 628, 718, 736, 745, 730, 628, 0x0202, 420, 165, 165, 282, 465, 637, 732, 774, 780];
treePos[0] = [640];
treePos[1] = [529];
treePos[2] = [100];
treePos[3] = [100];
treePos[4] = [4];
treePos[5] = [18];
treePos[6] = [1];
dragons = [SHOCKDRAGON];
arms[0] = [215, 1060];
arms[1] = [-100, -120];
break;
case 17:
levelName = "Swamp3";
levelType = SWAMP;
startingBlocks = 30;
levelBonus = 30;
mapPosX = 157;
mapPosY = 356;
isAvailable = false;
backgroundLayer1 = SwampBackground1;
backgroundLayer2 = SwampBackground2;
backgroundLayer3 = SwampBackground3;
foregroundGraphics = SwampLevel3;
levelWidth = 1680;
levelHeight = 1000;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = false;
cloudType = SwampClouds;
cloudPosY = (levelHeight - 80);
slopePointPos[0] = [0, 64, 133, 133, 154, 293, 146, 102, 96, 138, 179, 239, 291, 356, 385, 431, 467, 543, 588, 684, 651, 883, 840, 889, 1001, 1072, 1099, 1048, 1187, 1202, 1261, 1318, 1341, 1329, 1456, 1448, 1477, 1540, 1587, 1553, 1593, 1628, 1639, 1680];
slopePointPos[1] = [236, 287, 318, 351, 408, 407, 488, 574, 616, 701, 724, 724, 703, 674, 672, 676, 653, 642, 684, 697, 650, 650, 698, 724, 724, 655, 592, 553, 553, 579, 601, 576, 519, 492, 492, 557, 586, 575, 519, 377, 327, 254, 213, 187];
treePos[0] = [226, 760, 200, 1399];
treePos[1] = [409, 650, 720, 491];
treePos[2] = [100, 100, 100, 100];
treePos[3] = [100, 412, 342, 232];
treePos[4] = [3, 1, 5, 5];
treePos[5] = [12, 19, 15, 16];
treePos[6] = [2, 1, 2, 2];
dragons = [SHOCKWITCH, FIREDRAGON, ICEWITCH];
arms[0] = [];
arms[1] = [];
break;
case 18:
levelName = "Swamp4";
levelType = SWAMP;
startingBlocks = 20;
levelBonus = 40;
mapPosX = 131;
mapPosY = 385;
isAvailable = false;
backgroundLayer1 = SwampBackground1;
backgroundLayer2 = SwampBackground2;
backgroundLayer3 = SwampBackground3;
foregroundGraphics = SwampLevel4;
levelWidth = 990;
levelHeight = 680;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = false;
cloudType = SwampClouds;
cloudPosY = (levelHeight - 80);
slopePointPos[0] = [0, 125, 138, 228, 441, 473, 487, 500, 500, 505, 990];
slopePointPos[1] = [329, 329, 427, 784, 784, 580, 531, 415, 343, 329, 329];
treePos[0] = [566, 749, 918];
treePos[1] = [329, 328, 328];
treePos[2] = [100, 100, 100];
treePos[3] = [100, 432, 712];
treePos[4] = [3, 2, 1];
treePos[5] = [17, 18, 19];
treePos[6] = [2, 2, 2];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
case 19:
levelName = "Swamp5";
levelType = SWAMP;
startingBlocks = 30;
levelBonus = 50;
mapPosX = 121;
mapPosY = 327;
isAvailable = false;
backgroundLayer1 = SwampBackground1;
backgroundLayer2 = SwampBackground2;
backgroundLayer3 = SwampBackground3;
foregroundGraphics = SwampLevel5;
levelWidth = 1680;
levelHeight = 0x0500;
background2Height = 600;
background2Width = 800;
background3Height = 0x0300;
background3Width = 0x0400;
background1Depth = 0;
background2Depth = 1;
background3Depth = 2;
foregroundDepth = 3;
cloudsOnBottom = false;
cloudType = SwampClouds;
cloudPosY = (levelHeight - 80);
slopePointPos[0] = [0, 153, 153, 78, 337, 0x0101, 0x0101, 376, 376, 352, 524, 489, 489, 601, 601, 563, 706, 706, 1018, 1018, 1188, 1142, 1142, 1246, 1246, 1214, 1394, 1365, 1365, 1463, 1463, 1399, 1641, 1574, 1574];
slopePointPos[1] = [1456, 1351, 820, 785, 785, 819, 1546, 1546, 648, 607, 607, 648, 1546, 1546, 814, 770, 0x0303, 1002, 1002, 0x0303, 0x0303, 811, 1546, 1546, 640, 600, 600, 648, 1546, 1546, 811, 0x0300, 0x0300, 810, 1600];
treePos[0] = [202, 438, 639, 1097, 1296, 1534];
treePos[1] = [787, 610, 769, 770, 602, 766];
treePos[2] = [100, 100, 100, 100, 100, 100];
treePos[3] = [100, 232, 342, 363, 249, 120];
treePos[4] = [1, 2, 3, 3, 2, 1];
treePos[5] = [19, 17, 17, 17, 17, 19];
treePos[6] = [1, 2, 2, 2, 2, 1];
dragons = [];
arms[0] = [];
arms[1] = [];
break;
};
}
public function activate(){
}
private function startGame(_arg1:MouseEvent){
deactivate();
}
}
}//package
Section 197
//LevelMarker (LevelMarker)
package {
import flash.events.*;
import flash.display.*;
public class LevelMarker extends MovieClip {
const WONLEVELFX:int = 5;
const LIGHTNINGPROJECTILE:int = 14;
const HURT2FX:int = 14;
const CATAPULT:int = 2;
const MOVEDESKIMOFX:int = 6;
const FOREST:int = 2;
const BIGBOULDERTRACTION:Number = 0.9;
const ICEWITCH:int = 5;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const IRONRIMMEDPROJECTILE:int = 16;
const ESKIMOFRICTION:Number = 0.9;
const FOAMESKIMO:int = 1;
const DRAGONFX:int = 19;
const KNIGHTPROJECTILE:int = 19;
const TITLE:int = 1;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const TREEHEIGHT:int = 100;
const NUMLEVELS:int = 20;
const HURT1FX:int = 13;
const TOPBOUNDARY:int = 0;
const ESKIMODIEDFX:int = 9;
const SHOCKWITCH:int = 6;
const ICE:int = 4;
const BIGBOULDERSIZE:int = 25;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const SCREENHEIGHT:int = 480;
const ICEPROJECTILE:int = 13;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const CLIFFS:int = 4;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const WOOD:int = 0;
const BATTLE:int = 6;
const WITCHFX:int = 23;
const SCREENWIDTH:int = 640;
const BUTTONSHORTFX:int = 29;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const STATE_PLACINGESKIMO:int = 1;
const IRON:int = 3;
const SHOTHITFX:int = 22;
const TREEWIDTH:int = 20;
const SHOCKFX:int = 21;
const FOAMBLOCK:int = 3;
const DELETE_BLOCK:int = 2;
const ICEBLOCKMASS:int = 20;
const BUTTONCLICKFX:int = 10;
const BIGBOULDER1:int = 99;
const BIGBOULDER2:int = 102;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const NOPEFX:int = 12;
const TREBUCHET_CLEARANCE:int = 150;
const SCROLLLIMIT:int = 25;
const TREBUCHET:int = 1;
const HOLDBLOCK:int = 104;
const SHOCKDRAGON:int = 3;
const BACKTOPBOUNDARY:int = 0;
const ROCKPROJECTILE:int = 15;
const COINFX:int = 18;
const ESKIMOMASS:int = 200;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const PLACEDBLOCKFX:int = 7;
const ESKIMOWIDTH:int = 15;
const FIREWITCH:int = 4;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const BLOCKWIDTH:int = 35;
const SPACEBAR:int = 32;
const BIGBOULDERMASS:int = 100;
const CATAPULTSHOTFX:int = 17;
const SCROLLAMOUNT:int = 20;
const FISTPOUNDSOUND:int = 27;
const MUDCOST:int = 1;
const CANNONBALLPROJECTILE:int = 17;
const FOAMBOULDER:int = 2;
const THRONEWIDTH:int = 31;
const SLOPEFRICTION:Number = 0;
const FOAMLANDSCAPE:int = 4;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const FLYERCLOSESPEED:int = 4;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const LAKE:int = 3;
const BACKLEFTBOUNDARY:int = 0;
const MUD:int = 1;
const TREE:int = 103;
const DECREASESIZE:int = 40;
const TREEMASS:Number = 50;
const TREEBOUNCE:Number = 0.1;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const MEDBOULDER1:int = 98;
const MEDBOULDER2:int = 101;
const EXPORT:int = 96;
const BIGBOULDERBOUNCE:Number = 0.5;
const TREBUCHETSHOTFX:int = 16;
const NOBLOCKSFX:int = 11;
const SLOPE_POINT:int = 51;
const LOSTLEVELFX:int = 3;
const NO_BUILD_STATE:int = 0;
const STATE_AVALANCHE:int = 3;
const REMOVEDBLOCKFX:int = 8;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FOAMCATAPULT:int = 5;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const ICEBLOCKFRICTION:Number = 0.7;
const ICEBLOCKBOUNCE:Number = 0;
const SLOPE_STARTING_POINT:int = 49;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const SMALLBOULDER1:int = 97;
const SMALLBOULDER2:int = 100;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
public var levelNumber:int;// = 0
public var isBeaten:Boolean;// = false
public var isAvailable:Boolean;// = false
public var beatenFlag:BeatenCrown;
public var markerHover:MovieClip;
public function LevelMarker(_arg1:int){
this.mouseChildren = false;
levelNumber = _arg1;
gotoAndStop("unavailable");
markerHover.visible = false;
beatenFlag.visible = false;
}
private function mouseOverClip(_arg1:MouseEvent){
if (isAvailable){
markerHover.visible = true;
};
}
private function startLevel(_arg1:MouseEvent){
GameManager.leaveTitle(levelNumber);
SoundManager.playFx(BUTTONCLICKFX);
}
public function makeBeaten(){
isBeaten = true;
beatenFlag.visible = true;
}
public function deactivate(){
if (isAvailable){
removeEventListener(MouseEvent.CLICK, startLevel);
};
removeEventListener(MouseEvent.ROLL_OVER, mouseOverClip);
removeEventListener(MouseEvent.ROLL_OUT, mouseOutClip);
}
public function makeAvailable(){
isAvailable = true;
gotoAndStop("available");
if (isBeaten){
beatenFlag.visible = true;
};
}
public function activate(){
if (isAvailable){
addEventListener(MouseEvent.CLICK, startLevel);
this.buttonMode = true;
this.useHandCursor = true;
};
addEventListener(MouseEvent.ROLL_OVER, mouseOverClip);
addEventListener(MouseEvent.ROLL_OUT, mouseOutClip);
}
private function mouseOutClip(_arg1:MouseEvent){
if (isAvailable){
markerHover.visible = false;
};
}
}
}//package
Section 198
//LogoIntroClip (LogoIntroClip)
package {
import flash.display.*;
public dynamic class LogoIntroClip extends MovieClip {
}
}//package
Section 199
//LostLevelSound (LostLevelSound)
package {
import flash.media.*;
public dynamic class LostLevelSound extends Sound {
}
}//package
Section 200
//MapSelect (MapSelect)
package {
import flash.display.*;
public dynamic class MapSelect extends MovieClip {
}
}//package
Section 201
//MarkerHover (MarkerHover)
package {
import flash.display.*;
public dynamic class MarkerHover extends MovieClip {
}
}//package
Section 202
//MovedEskimoSound (MovedEskimoSound)
package {
import flash.media.*;
public dynamic class MovedEskimoSound extends Sound {
}
}//package
Section 203
//MusicButton (MusicButton)
package {
import flash.display.*;
public dynamic class MusicButton extends MovieClip {
}
}//package
Section 204
//NoBlocksSound (NoBlocksSound)
package {
import flash.media.*;
public dynamic class NoBlocksSound extends Sound {
}
}//package
Section 205
//NopeSound (NopeSound)
package {
import flash.media.*;
public dynamic class NopeSound extends Sound {
}
}//package
Section 206
//PlacedBlockSound (PlacedBlockSound)
package {
import flash.media.*;
public dynamic class PlacedBlockSound extends Sound {
}
}//package
Section 207
//PlayMoreGamesButton (PlayMoreGamesButton)
package {
import flash.display.*;
public dynamic class PlayMoreGamesButton extends SimpleButton {
}
}//package
Section 208
//Projectiles (Projectiles)
package {
import flash.display.*;
public dynamic class Projectiles extends MovieClip {
public function Projectiles(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14, 14, frame15, 15, frame16, 16, frame17, 17, frame18, 18, frame19);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame3(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame8(){
stop();
}
function frame10(){
stop();
}
function frame11(){
stop();
}
function frame12(){
stop();
}
function frame13(){
stop();
}
function frame14(){
stop();
}
function frame15(){
stop();
}
function frame16(){
stop();
}
function frame9(){
stop();
}
function frame18(){
stop();
}
function frame19(){
stop();
}
function frame17(){
stop();
}
}
}//package
Section 209
//RedThrone (RedThrone)
package {
import flash.display.*;
import flash.text.*;
public dynamic class RedThrone extends MovieClip {
public var moveKingText:TextField;
public var kingClip:King;
}
}//package
Section 210
//RemovedBlockSound (RemovedBlockSound)
package {
import flash.media.*;
public dynamic class RemovedBlockSound extends Sound {
}
}//package
Section 211
//ReturnToMapButton (ReturnToMapButton)
package {
import flash.display.*;
public dynamic class ReturnToMapButton extends SimpleButton {
}
}//package
Section 212
//RightHud (RightHud)
package {
import flash.display.*;
public dynamic class RightHud extends MovieClip {
public var timeContainer:MovieClip;
public var healthContainer:MovieClip;
}
}//package
Section 213
//Rock1 (Rock1)
package {
import flash.display.*;
public dynamic class Rock1 extends MovieClip {
}
}//package
Section 214
//ScoreScreen (ScoreScreen)
package {
import flash.display.*;
public dynamic class ScoreScreen extends MovieClip {
public var returnButton:SimpleButton;
public var winStuff:MovieClip;
public var continueButton:SimpleButton;
public var loseStuff:MovieClip;
}
}//package
Section 215
//ScreenObscurer (ScreenObscurer)
package {
import flash.display.*;
public dynamic class ScreenObscurer extends MovieClip {
public function ScreenObscurer(){
addFrameScript(18, frame19);
}
function frame19(){
stop();
}
}
}//package
Section 216
//ScrollArrow (ScrollArrow)
package {
import flash.display.*;
public dynamic class ScrollArrow extends MovieClip {
public function ScrollArrow(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame3(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame8(){
stop();
}
}
}//package
Section 217
//ShockBall (ShockBall)
package {
import flash.display.*;
public dynamic class ShockBall extends MovieClip {
}
}//package
Section 218
//ShockDragon (ShockDragon)
package {
public dynamic class ShockDragon extends Flyer {
}
}//package
Section 219
//ShockSound (ShockSound)
package {
import flash.media.*;
public dynamic class ShockSound extends Sound {
}
}//package
Section 220
//ShockTrail (ShockTrail)
package {
import flash.geom.*;
import org.flintparticles.common.initializers.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.common.counters.*;
import org.flintparticles.twoD.zones.*;
import org.flintparticles.twoD.emitters.*;
import org.flintparticles.twoD.actions.*;
import org.flintparticles.twoD.initializers.*;
import org.flintparticles.common.displayObjects.*;
public class ShockTrail {
public var stoneTrail:Emitter2D;
public var emitterArray:Array;
public function ShockTrail(_arg1:int, _arg2:int){
stoneTrail = new Emitter2D();
emitterArray = new Array();
super();
stoneTrail.counter = new Blast(10);
stoneTrail.addInitializer(new Lifetime(0.25, 0.75));
stoneTrail.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 80, 40)));
stoneTrail.addInitializer(new SharedImage(new Line(10)));
stoneTrail.addInitializer(new ColorInit(4294967040, 4294967295));
stoneTrail.addAction(new Age());
stoneTrail.addAction(new Move());
stoneTrail.addAction(new RotateToDirection());
stoneTrail.addAction(new Fade(1, 0));
stoneTrail.x = _arg1;
stoneTrail.y = _arg2;
stoneTrail.start();
emitterArray.push(stoneTrail);
}
}
}//package
Section 221
//ShockWitch (ShockWitch)
package {
public dynamic class ShockWitch extends Flyer {
}
}//package
Section 222
//ShotHitShortSound (ShotHitShortSound)
package {
import flash.media.*;
public dynamic class ShotHitShortSound extends Sound {
}
}//package
Section 223
//ShotHitSound (ShotHitSound)
package {
import flash.media.*;
public dynamic class ShotHitSound extends Sound {
}
}//package
Section 224
//SignTutorial (SignTutorial)
package {
import flash.display.*;
public dynamic class SignTutorial extends MovieClip {
public function SignTutorial(){
addFrameScript(0, frame1, 36, frame37, 67, frame68);
}
function frame37(){
stop();
}
function frame1(){
stop();
}
function frame68(){
stop();
}
}
}//package
Section 225
//SmallBlock (SmallBlock)
package {
import flash.display.*;
public dynamic class SmallBlock extends MovieClip {
public function SmallBlock(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame3(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame8(){
stop();
}
function frame9(){
stop();
}
}
}//package
Section 226
//SmallBricks (SmallBricks)
package {
import flash.display.*;
public dynamic class SmallBricks extends MovieClip {
public function SmallBricks(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame3(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
}
}//package
Section 227
//SmokeTrail (SmokeTrail)
package {
import flash.geom.*;
import org.flintparticles.common.initializers.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.common.counters.*;
import org.flintparticles.twoD.zones.*;
import org.flintparticles.twoD.emitters.*;
import org.flintparticles.twoD.actions.*;
import org.flintparticles.twoD.initializers.*;
import org.flintparticles.common.displayObjects.*;
public class SmokeTrail {
public var emitterArray:Array;
public var fire:Emitter2D;
public var smoke:Emitter2D;
public function SmokeTrail(_arg1:int, _arg2:int){
smoke = new Emitter2D();
fire = new Emitter2D();
emitterArray = new Array();
super();
smoke.counter = new Blast(2);
smoke.addInitializer(new Lifetime(2, 3));
smoke.addInitializer(new Velocity(new DiscSectorZone(new Point(0, 0), 40, 30, ((-4 * Math.PI) / 7), ((-3 * Math.PI) / 7))));
smoke.addInitializer(new SharedImage(new RadialDot(6)));
smoke.addAction(new Age());
smoke.addAction(new Move());
smoke.addAction(new LinearDrag(0.01));
smoke.addAction(new ScaleImage(1, 15));
smoke.addAction(new Fade(0.15, 0));
smoke.addAction(new RandomDrift(15, 15));
smoke.x = _arg1;
smoke.y = _arg2;
smoke.start();
fire.counter = new Blast(5);
fire.addInitializer(new Lifetime(1, 2));
fire.addInitializer(new Velocity(new DiscSectorZone(new Point(0, 0), 20, 10, -(Math.PI), 0)));
fire.addInitializer(new Position(new DiscZone(new Point(0, 0), 3)));
fire.addInitializer(new SharedImage(new RadialDot(8)));
fire.addAction(new Age());
fire.addAction(new Move());
fire.addAction(new LinearDrag(1));
fire.addAction(new Accelerate(0, -40));
fire.addAction(new ColorChange(4294953984, 0xCC0000));
fire.addAction(new ScaleImage(1, 1.5));
fire.x = _arg1;
fire.y = _arg2;
fire.start();
emitterArray.push(smoke);
emitterArray.push(fire);
}
}
}//package
Section 228
//SoundManager (SoundManager)
package {
import caurina.transitions.*;
import flash.media.*;
public final class SoundManager {
public static var removedBlockSound:RemovedBlockSound = new RemovedBlockSound();
public static var ssIntroSound:SSIntroSound = new SSIntroSound();
public static var forestMusic:ForestMusic = new ForestMusic();
public static var catapultShotSound:CatapultShotSound = new CatapultShotSound();
public static var shockSound:ShockSound = new ShockSound();
public static var witchSound:WitchSound = new WitchSound();
public static var shotHitShortSound:ShotHitShortSound = new ShotHitShortSound();
public static var introMusic:IntroMusic = new IntroMusic();
public static var musicChannel:SoundChannel = new SoundChannel();
public static var placedBlockSound:PlacedBlockSound = new PlacedBlockSound();
public static var wonLevelSound:WonLevelSound = new WonLevelSound();
public static var cliffMusic:CliffMusic = new CliffMusic();
public static var noBlocksSound:NoBlocksSound = new NoBlocksSound();
public static var currentMusic:int = 1;
public static var hurt1Sound:Hurt1Sound = new Hurt1Sound();
public static var lostLevelSound:LostLevelSound = new LostLevelSound();
public static var swampMusic:SwampMusic = new SwampMusic();
public static var flyerShotSound:FlyerShotSound = new FlyerShotSound();
public static var freezeSound:FreezeSound = new FreezeSound();
public static var nopeSound:NopeSound = new NopeSound();
public static var fxTransform:SoundTransform = new SoundTransform();
public static var dragonSound:DragonSound = new DragonSound();
public static var buttonShortSound:ButtonShortSound = new ButtonShortSound();
public static var musicTransform:SoundTransform = new SoundTransform();
public static var musicPlaying:Boolean = false;
public static var hurt2Sound:Hurt2Sound = new Hurt2Sound();
public static var battleMusic:BattleMusic = new BattleMusic();
public static var movedEskimoSound:MovedEskimoSound = new MovedEskimoSound();
public static var fxOn:Boolean = true;
public static var lakeMusic:LakeMusic = new LakeMusic();
public static var trebuchetShotSound:TrebuchetShotSound = new TrebuchetShotSound();
public static var fxChannel:SoundChannel = new SoundChannel();
public static var musicOn:Boolean = true;
public static var shotHitSound:ShotHitSound = new ShotHitSound();
public static var splashSound:SplashSound = new SplashSound();
public static var hurt3Sound:Hurt3Sound = new Hurt3Sound();
public static var fistPoundSound:FistPoundSound = new FistPoundSound();
public static var goodSpotSound:GoodSpotSound = new GoodSpotSound();
public static var buttonClickedSound:ButtonClickedSound = new ButtonClickedSound();
public static var eskimoDiedSound:EskimoDiedSound = new EskimoDiedSound();
public static var coinSound:CoinSound = new CoinSound();
public static function initiate(){
musicTransform.volume = 0;
musicChannel.soundTransform = musicTransform;
}
public static function playFx(_arg1:int){
if (fxOn){
switch (_arg1){
case 1:
break;
case 2:
fxChannel = goodSpotSound.play();
break;
case 3:
fxChannel = lostLevelSound.play();
break;
case 5:
fxChannel = wonLevelSound.play();
break;
case 6:
fxChannel = movedEskimoSound.play();
break;
case 7:
fxChannel = placedBlockSound.play();
break;
case 8:
fxChannel = removedBlockSound.play();
break;
case 9:
fxChannel = eskimoDiedSound.play();
break;
case 10:
fxChannel = buttonClickedSound.play();
break;
case 11:
fxChannel = noBlocksSound.play();
break;
case 12:
fxChannel = nopeSound.play();
break;
case 13:
fxChannel = hurt1Sound.play();
break;
case 14:
fxChannel = hurt2Sound.play();
break;
case 15:
fxChannel = hurt3Sound.play();
break;
case 16:
fxChannel = trebuchetShotSound.play();
break;
case 17:
fxChannel = catapultShotSound.play();
break;
case 18:
fxChannel = coinSound.play();
break;
case 19:
fxChannel = dragonSound.play();
break;
case 20:
fxChannel = flyerShotSound.play();
break;
case 21:
fxChannel = shockSound.play();
break;
case 22:
fxChannel = shotHitSound.play();
break;
case 23:
fxChannel = witchSound.play();
break;
case 24:
fxChannel = freezeSound.play();
break;
case 25:
fxChannel = ssIntroSound.play();
break;
case 26:
fxChannel = shotHitShortSound.play();
break;
case 27:
fxChannel = fistPoundSound.play();
break;
case 28:
fxChannel = splashSound.play();
break;
case 29:
fxChannel = buttonShortSound.play();
break;
};
};
}
public static function stopAndStartMusic(){
Tweener.addTween(musicTransform, {volume:0, time:1, onUpdate:function (){
musicChannel.soundTransform = musicTransform;
}, onComplete:function (){
musicChannel.stop();
startMusic();
}});
}
public static function fxToggle(){
if (fxOn){
Tweener.addTween(fxTransform, {volume:0, time:1, onUpdate:function (){
fxChannel.soundTransform = fxTransform;
}, onComplete:function (){
fxChannel.stop();
}});
fxOn = false;
} else {
fxOn = true;
};
}
public static function stopMusic(){
Tweener.addTween(musicTransform, {volume:0, time:1, onUpdate:function (){
musicChannel.soundTransform = musicTransform;
}, onComplete:function (){
musicChannel.stop();
musicPlaying = false;
}});
}
public static function startMusic(){
if (musicOn){
switch (currentMusic){
case 1:
musicChannel = introMusic.play(0, int.MAX_VALUE);
break;
case 2:
musicChannel = forestMusic.play(0, int.MAX_VALUE);
break;
case 3:
musicChannel = lakeMusic.play(0, int.MAX_VALUE);
break;
case 4:
musicChannel = cliffMusic.play(0, int.MAX_VALUE);
break;
case 5:
musicChannel = swampMusic.play(0, int.MAX_VALUE);
break;
case 6:
musicChannel = battleMusic.play(0, int.MAX_VALUE);
break;
};
Tweener.addTween(musicTransform, {volume:1, time:3, onUpdate:function (){
musicChannel.soundTransform = musicTransform;
}});
musicPlaying = true;
};
}
public static function switchMusic(_arg1:int){
currentMusic = _arg1;
if (musicOn){
if (musicPlaying){
stopAndStartMusic();
} else {
startMusic();
};
};
}
public static function musicToggle(){
if (musicOn){
stopMusic();
musicOn = false;
} else {
musicOn = true;
startMusic();
};
}
}
}//package
Section 229
//SpikeBall1 (SpikeBall1)
package {
import flash.display.*;
public dynamic class SpikeBall1 extends MovieClip {
}
}//package
Section 230
//SplashSound (SplashSound)
package {
import flash.media.*;
public dynamic class SplashSound extends Sound {
}
}//package
Section 231
//SSButon (SSButon)
package {
import flash.display.*;
public dynamic class SSButon extends SimpleButton {
}
}//package
Section 232
//SSIntroSound (SSIntroSound)
package {
import flash.media.*;
public dynamic class SSIntroSound extends Sound {
}
}//package
Section 233
//SSTitleButton (SSTitleButton)
package {
import flash.display.*;
public dynamic class SSTitleButton extends SimpleButton {
}
}//package
Section 234
//StartBattleButton (StartBattleButton)
package {
import flash.display.*;
public dynamic class StartBattleButton extends SimpleButton {
}
}//package
Section 235
//StoneExplosion (StoneExplosion)
package {
import flash.geom.*;
import org.flintparticles.common.initializers.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.common.counters.*;
import org.flintparticles.twoD.zones.*;
import org.flintparticles.twoD.emitters.*;
import org.flintparticles.twoD.actions.*;
import org.flintparticles.twoD.initializers.*;
import org.flintparticles.common.displayObjects.*;
public class StoneExplosion {
public var littleStones:Emitter2D;
public var fire:Emitter2D;
public var centerFire:Emitter2D;
public var stones:Emitter2D;
public var emitterArray:Array;
public var backFire:Emitter2D;
public var yPos:int;// = 0
public var xPos:int;// = 0
public function StoneExplosion(_arg1:int, _arg2:int){
stones = new Emitter2D();
littleStones = new Emitter2D();
fire = new Emitter2D();
centerFire = new Emitter2D();
backFire = new Emitter2D();
emitterArray = new Array();
super();
xPos = _arg1;
yPos = _arg2;
stones.counter = new Blast(8);
stones.addInitializer(new Lifetime(0.25, 0.75));
stones.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 40, 1)));
stones.addInitializer(new SharedImage(new RadialDot(20)));
stones.addInitializer(new ColorInit(4279308561, 4291611852));
stones.addAction(new Age());
stones.addAction(new Move());
stones.addAction(new Fade(0.5, 0));
stones.addAction(new RandomDrift(30, 30));
stones.x = _arg1;
stones.y = _arg2;
stones.start();
littleStones.counter = new Blast(10);
littleStones.addInitializer(new Lifetime(0.25, 0.75));
littleStones.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 150, 1)));
littleStones.addInitializer(new SharedImage(new RadialDot(5)));
littleStones.addInitializer(new ColorInit(4291611852, 4281545523));
littleStones.addAction(new Age());
littleStones.addAction(new Move());
littleStones.addAction(new Fade(1, 0));
littleStones.addAction(new RandomDrift(150, 150));
littleStones.x = _arg1;
littleStones.y = _arg2;
littleStones.start();
emitterArray.push(stones);
emitterArray.push(littleStones);
}
}
}//package
Section 236
//StoneTrail (StoneTrail)
package {
import flash.geom.*;
import org.flintparticles.common.initializers.*;
import org.flintparticles.common.actions.*;
import org.flintparticles.common.counters.*;
import org.flintparticles.twoD.zones.*;
import org.flintparticles.twoD.emitters.*;
import org.flintparticles.twoD.actions.*;
import org.flintparticles.twoD.initializers.*;
import org.flintparticles.common.displayObjects.*;
public class StoneTrail {
public var stoneTrail:Emitter2D;
public var emitterArray:Array;
public function StoneTrail(_arg1:int, _arg2:int){
stoneTrail = new Emitter2D();
emitterArray = new Array();
super();
stoneTrail.counter = new Blast(1);
stoneTrail.addInitializer(new Lifetime(0.25, 0.75));
stoneTrail.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 20, 1)));
stoneTrail.addInitializer(new SharedImage(new RadialDot(4)));
stoneTrail.addInitializer(new ColorInit(4278190080, 4284900966));
stoneTrail.addAction(new Age());
stoneTrail.addAction(new Move());
stoneTrail.addAction(new Fade(0.75, 0));
stoneTrail.addAction(new RandomDrift(15, 15));
stoneTrail.x = _arg1;
stoneTrail.y = _arg2;
stoneTrail.start();
emitterArray.push(stoneTrail);
}
}
}//package
Section 237
//SuperFlashBrosButton (SuperFlashBrosButton)
package {
import flash.display.*;
public dynamic class SuperFlashBrosButton extends SimpleButton {
}
}//package
Section 238
//SwampBackground1 (SwampBackground1)
package {
public dynamic class SwampBackground1 extends BackgroundLayer {
}
}//package
Section 239
//SwampBackground2 (SwampBackground2)
package {
public dynamic class SwampBackground2 extends BackgroundLayer {
}
}//package
Section 240
//SwampBackground3 (SwampBackground3)
package {
public dynamic class SwampBackground3 extends BackgroundLayer {
}
}//package
Section 241
//SwampClouds (SwampClouds)
package {
import flash.display.*;
public dynamic class SwampClouds extends MovieClip {
}
}//package
Section 242
//SwampLevel1 (SwampLevel1)
package {
import flash.display.*;
public dynamic class SwampLevel1 extends Sprite {
}
}//package
Section 243
//SwampLevel2 (SwampLevel2)
package {
import flash.display.*;
public dynamic class SwampLevel2 extends Sprite {
}
}//package
Section 244
//SwampLevel3 (SwampLevel3)
package {
import flash.display.*;
public dynamic class SwampLevel3 extends Sprite {
}
}//package
Section 245
//SwampLevel4 (SwampLevel4)
package {
import flash.display.*;
public dynamic class SwampLevel4 extends Sprite {
}
}//package
Section 246
//SwampLevel5 (SwampLevel5)
package {
import flash.display.*;
public dynamic class SwampLevel5 extends Sprite {
}
}//package
Section 247
//SwampMusic (SwampMusic)
package {
import flash.media.*;
public dynamic class SwampMusic extends Sound {
}
}//package
Section 248
//Symbol1 (Symbol1)
package {
import flash.display.*;
public dynamic class Symbol1 extends SimpleButton {
public var startGameButton:SimpleButton;
}
}//package
Section 249
//ToggleButton (ToggleButton)
package {
import flash.events.*;
import flash.display.*;
public class ToggleButton {
public var idNumber:int;// = 0
public var isOn:Boolean;// = false
public var isMouseOver:Boolean;// = false
public var clip:MovieClip;
public function turnOn(){
isOn = true;
if (isMouseOver){
clip.gotoAndStop("onOver");
} else {
clip.gotoAndStop("on");
};
}
public function mouseOverButton(_arg1:MouseEvent){
isMouseOver = true;
if (isOn){
clip.gotoAndStop("onOver");
} else {
clip.gotoAndStop("offOver");
};
}
public function deactivate(){
clip.removeEventListener(MouseEvent.MOUSE_OVER, mouseOverButton);
clip.removeEventListener(MouseEvent.MOUSE_OUT, mouseOffButton);
clip.buttonMode = false;
}
public function turnOff(){
isOn = false;
if (isMouseOver){
clip.gotoAndStop("offOver");
} else {
clip.gotoAndStop("off");
};
}
public function activate(){
clip.addEventListener(MouseEvent.MOUSE_OVER, mouseOverButton);
clip.addEventListener(MouseEvent.MOUSE_OUT, mouseOffButton);
clip.buttonMode = true;
}
public function mouseClickedButton(_arg1:MouseEvent){
if (isOn){
isOn = false;
clip.gotoAndStop("offOver");
} else {
isOn = true;
clip.gotoAndStop("onOver");
};
}
public function mouseOffButton(_arg1:MouseEvent){
isMouseOver = false;
if (isOn){
clip.gotoAndStop("on");
} else {
clip.gotoAndStop("off");
};
}
}
}//package
Section 250
//TransitionScreen (TransitionScreen)
package {
import flash.display.*;
public dynamic class TransitionScreen extends MovieClip {
}
}//package
Section 251
//Trebuchet (Trebuchet)
package {
import flash.display.*;
import org.generalrelativity.foam.view.*;
import org.flintparticles.twoD.renderers.*;
import flash.net.*;
import mochi.*;
public class Trebuchet extends MovieClip {
const WONLEVELFX:int = 5;
const LIGHTNINGPROJECTILE:int = 14;
const HURT2FX:int = 14;
const CATAPULT:int = 2;
const MOVEDESKIMOFX:int = 6;
const FOREST:int = 2;
const BIGBOULDERTRACTION:Number = 0.9;
const ICEWITCH:int = 5;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const IRONRIMMEDPROJECTILE:int = 16;
const ESKIMOFRICTION:Number = 0.9;
const FOAMESKIMO:int = 1;
const DRAGONFX:int = 19;
const KNIGHTPROJECTILE:int = 19;
const TITLE:int = 1;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const TREEHEIGHT:int = 100;
const NUMLEVELS:int = 20;
const HURT1FX:int = 13;
const TOPBOUNDARY:int = 0;
const ESKIMODIEDFX:int = 9;
const SHOCKWITCH:int = 6;
const ICE:int = 4;
const BIGBOULDERSIZE:int = 25;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const SCREENHEIGHT:int = 480;
const ICEPROJECTILE:int = 13;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const CLIFFS:int = 4;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const WOOD:int = 0;
const BATTLE:int = 6;
const WITCHFX:int = 23;
const SCREENWIDTH:int = 640;
const BUTTONSHORTFX:int = 29;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const STATE_PLACINGESKIMO:int = 1;
const IRON:int = 3;
const SHOTHITFX:int = 22;
const TREEWIDTH:int = 20;
const SHOCKFX:int = 21;
const ICEBLOCKMASS:int = 20;
const FOAMBLOCK:int = 3;
const DELETE_BLOCK:int = 2;
const BUTTONCLICKFX:int = 10;
const BIGBOULDER1:int = 99;
const BIGBOULDER2:int = 102;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const NOPEFX:int = 12;
const TREBUCHET_CLEARANCE:int = 150;
const SCROLLLIMIT:int = 25;
const TREBUCHET:int = 1;
const HOLDBLOCK:int = 104;
const SHOCKDRAGON:int = 3;
const BACKTOPBOUNDARY:int = 0;
const ROCKPROJECTILE:int = 15;
const ESKIMOMASS:int = 200;
const COINFX:int = 18;
const PLACEDBLOCKFX:int = 7;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const ESKIMOWIDTH:int = 15;
const FIREWITCH:int = 4;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const BLOCKWIDTH:int = 35;
const SPACEBAR:int = 32;
const BIGBOULDERMASS:int = 100;
const CATAPULTSHOTFX:int = 17;
const SCROLLAMOUNT:int = 20;
const FISTPOUNDSOUND:int = 27;
const MUDCOST:int = 1;
const CANNONBALLPROJECTILE:int = 17;
const FOAMBOULDER:int = 2;
const THRONEWIDTH:int = 31;
const SLOPEFRICTION:Number = 0;
const FOAMLANDSCAPE:int = 4;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const FLYERCLOSESPEED:int = 4;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const LAKE:int = 3;
const BACKLEFTBOUNDARY:int = 0;
const MUD:int = 1;
const TREE:int = 103;
const DECREASESIZE:int = 40;
const TREEMASS:Number = 50;
const TREEBOUNCE:Number = 0.1;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const MEDBOULDER1:int = 98;
const MEDBOULDER2:int = 101;
const EXPORT:int = 96;
const BIGBOULDERBOUNCE:Number = 0.5;
const TREBUCHETSHOTFX:int = 16;
const NOBLOCKSFX:int = 11;
const SLOPE_POINT:int = 51;
const LOSTLEVELFX:int = 3;
const NO_BUILD_STATE:int = 0;
const STATE_AVALANCHE:int = 3;
const REMOVEDBLOCKFX:int = 8;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FOAMCATAPULT:int = 5;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const ICEBLOCKFRICTION:Number = 0.7;
const SLOPE_STARTING_POINT:int = 49;
const ICEBLOCKBOUNCE:Number = 0;
const SMALLBOULDER1:int = 97;
const SMALLBOULDER2:int = 100;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
public var reloadTime:int;// = 0
private var initialCounter:int;// = 0
public var reloadCounter:int;// = 0
public var shotCount:int;// = 0
public var animationDelay:int;// = 15
public var trebuchetArm:MovieClip;
public var initialDelay:int;// = 0
public var passedInitialDelay:Boolean;// = false
public var type:int;// = 0
public var readyToShoot:Boolean;// = false
public var startAnimation:Boolean;// = false
public var shotType:int;// = 0
public var projectile:Projectiles;
public function Trebuchet(){
addFrameScript(0, frame1, 1, frame2, 84, frame85);
}
function frame2(){
trebuchetArm.gotoAndPlay(2);
trebuchetArm.barrel.gotoAndPlay(2);
trebuchetArm.throwerArm.gotoAndPlay(2);
trebuchetArm.throwerArm.thrower.gotoAndPlay(2);
}
function frame1(){
stop();
trebuchetArm.stop();
trebuchetArm.barrel.stop();
trebuchetArm.throwerArm.stop();
trebuchetArm.throwerArm.thrower.stop();
}
public function update(){
if (!passedInitialDelay){
initialCounter++;
if (initialCounter == (initialDelay - animationDelay)){
startAnimation = true;
} else {
startAnimation = false;
};
if (initialCounter > initialDelay){
passedInitialDelay = true;
readyToShoot = true;
};
} else {
if ((((reloadCounter == (reloadTime - animationDelay))) && ((shotCount > 0)))){
startAnimation = true;
} else {
startAnimation = false;
};
if (readyToShoot){
readyToShoot = false;
shotCount--;
reloadCounter = 0;
} else {
reloadCounter++;
if ((((reloadCounter >= reloadTime)) && ((shotCount > 0)))){
readyToShoot = true;
};
};
};
}
function frame85(){
gotoAndStop(1);
}
}
}//package
Section 252
//TrebuchetShotSound (TrebuchetShotSound)
package {
import flash.media.*;
public dynamic class TrebuchetShotSound extends Sound {
}
}//package
Section 253
//WitchSound (WitchSound)
package {
import flash.media.*;
public dynamic class WitchSound extends Sound {
}
}//package
Section 254
//WonGameScreen (WonGameScreen)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class WonGameScreen extends MovieClip {
const WONLEVELFX:int = 5;
const LIGHTNINGPROJECTILE:int = 14;
const HURT2FX:int = 14;
const CATAPULT:int = 2;
const MOVEDESKIMOFX:int = 6;
const FOREST:int = 2;
const BIGBOULDERTRACTION:Number = 0.9;
const AVALANCHEFX:int = 1;
const RIGHTBOUNDARY:int = -640;
const IRONRIMMEDPROJECTILE:int = 16;
const ESKIMOFRICTION:Number = 0.9;
const ICEWITCH:int = 5;
const DRAGONFX:int = 19;
const FOAMESKIMO:int = 1;
const KNIGHTPROJECTILE:int = 19;
const TITLE:int = 1;
const ICEDRAGON:int = 2;
const STONE:int = 2;
const THRONEHEIGHT:int = 43;
const GOODSPOTFX:int = 2;
const TREEHEIGHT:int = 100;
const NUMLEVELS:int = 20;
const HURT1FX:int = 13;
const TOPBOUNDARY:int = 0;
const ESKIMODIEDFX:int = 9;
const SHOCKWITCH:int = 6;
const ICE:int = 4;
const BIGBOULDERSIZE:int = 25;
const SLOPE_ENDING_POINT:int = 50;
const SPIKEBALLPROJECTILE:int = 18;
const SCREENHEIGHT:int = 480;
const ICEPROJECTILE:int = 13;
const IRONCOST:int = 3;
const TREEFRICTION:Number = 0;
const CLIFFS:int = 4;
const BACKRIGHTBOUNDARY:int = -320;
const MAXHEALTH:int = 100;
const FIREPROJECTILE:int = 12;
const WOOD:int = 0;
const BATTLE:int = 6;
const WITCHFX:int = 23;
const SCREENWIDTH:int = 640;
const BUTTONSHORTFX:int = 29;
const SWAMP:int = 5;
const LEVELWIDTH:int = 0x0500;
const STATE_PLACINGESKIMO:int = 1;
const IRON:int = 3;
const SHOTHITFX:int = 22;
const TREEWIDTH:int = 20;
const SHOCKFX:int = 21;
const ICEBLOCKMASS:int = 20;
const FOAMBLOCK:int = 3;
const DELETE_BLOCK:int = 2;
const BUTTONCLICKFX:int = 10;
const BIGBOULDER1:int = 99;
const BIGBOULDER2:int = 102;
const BIGBOULDERFRICTION:Number = 0.1;
const SPLASHSOUND:int = 28;
const NOPEFX:int = 12;
const TREBUCHET_CLEARANCE:int = 150;
const SCROLLLIMIT:int = 25;
const TREBUCHET:int = 1;
const HOLDBLOCK:int = 104;
const SHOCKDRAGON:int = 3;
const BACKTOPBOUNDARY:int = 0;
const ROCKPROJECTILE:int = 15;
const ESKIMOMASS:int = 200;
const COINFX:int = 18;
const PLACEDBLOCKFX:int = 7;
const LEFTBOUNDARY:int = 0;
const DRAG:int = 57;
const ESKIMOBOUNCE:Number = 0.3;
const ESKIMOWIDTH:int = 15;
const FIREWITCH:int = 4;
const INCREASESIZE:int = 38;
const KINGSUBLABEL:int = 99;
const BUILD_BLOCK:int = 1;
const BOTTOMBOUNDARY:int = -800;
const BLOCKWIDTH:int = 35;
const SPACEBAR:int = 32;
const BIGBOULDERMASS:int = 100;
const SCROLLAMOUNT:int = 20;
const FISTPOUNDSOUND:int = 27;
const MUDCOST:int = 1;
const CATAPULTSHOTFX:int = 17;
const CANNONBALLPROJECTILE:int = 17;
const THRONEWIDTH:int = 31;
const FOAMBOULDER:int = 2;
const SLOPEFRICTION:Number = 0;
const FOAMLANDSCAPE:int = 4;
const LEVELHEIGHT:int = 0x0500;
const FLYERSHOTFX:int = 20;
const LAKE:int = 3;
const STONECOST:int = 2;
const BACKGROUNDSCROLLAMOUNT:int = 10;
const FLYERCLOSESPEED:int = 4;
const BACKLEFTBOUNDARY:int = 0;
const MUD:int = 1;
const TREE:int = 103;
const DECREASESIZE:int = 40;
const TREEMASS:Number = 50;
const FREEZEFX:int = 24;
const DELETE:int = 48;
const TREEBOUNCE:Number = 0.1;
const MEDBOULDER1:int = 98;
const MEDBOULDER2:int = 101;
const EXPORT:int = 96;
const BIGBOULDERBOUNCE:Number = 0.5;
const TREBUCHETSHOTFX:int = 16;
const NOBLOCKSFX:int = 11;
const SLOPE_POINT:int = 51;
const LOSTLEVELFX:int = 3;
const NO_BUILD_STATE:int = 0;
const STATE_AVALANCHE:int = 3;
const REMOVEDBLOCKFX:int = 8;
const FIREDRAGON:int = 1;
const STATE_BUILDINGIGLOO:int = 2;
const FOAMCATAPULT:int = 5;
const FLYERFARSPEED:int = 2;
const SLOPEBOUNCE:Number = 0.25;
const BLOCKHEIGHT:int = 35;
const ESKIMOHEIGHT:int = 26;
const ICEBLOCKFRICTION:Number = 0.7;
const SLOPE_STARTING_POINT:int = 49;
const ICEBLOCKBOUNCE:Number = 0;
const SMALLBOULDER1:int = 97;
const SMALLBOULDER2:int = 100;
const SHOTHITSHORTFX:int = 26;
const HURT3FX:int = 15;
const WOODCOST:int = 1;
const BACKBOTTOMBOUNDARY:int = -400;
public var returnToMapButton:ReturnToMapButton;
public var trebuchetArm:MovieClip;
public var sfbButton:SuperFlashBrosButton;
public var agButton:AGButton;
public var playMoreButton:PlayMoreGamesButton;
public var ssButton:SSButon;
public function deactivate(){
ssButton.removeEventListener(MouseEvent.CLICK, ssClicked);
sfbButton.removeEventListener(MouseEvent.CLICK, sfbClicked);
agButton.removeEventListener(MouseEvent.CLICK, agClicked);
playMoreButton.removeEventListener(MouseEvent.CLICK, agClicked);
returnToMapButton.removeEventListener(MouseEvent.CLICK, returnClicked);
}
private function sfbClicked(_arg1:MouseEvent){
var _local2:URLRequest = new URLRequest("http://www.superflashbros.net");
navigateToURL(_local2, "_blank");
}
public function returnClicked(_arg1:MouseEvent){
deactivate();
GameManager.leaveWonScreen();
}
public function activate(){
ssButton.addEventListener(MouseEvent.CLICK, ssClicked);
sfbButton.addEventListener(MouseEvent.CLICK, sfbClicked);
agButton.addEventListener(MouseEvent.CLICK, agClicked);
playMoreButton.addEventListener(MouseEvent.CLICK, agClicked);
returnToMapButton.addEventListener(MouseEvent.CLICK, returnClicked);
}
private function agClicked(_arg1:MouseEvent){
var _local2:URLRequest = new URLRequest("http://www.armorgames.com");
navigateToURL(_local2, "_blank");
}
private function ssClicked(_arg1:MouseEvent){
var _local2:URLRequest = new URLRequest("http://www.sinistersea.com");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 255
//WonLevelSound (WonLevelSound)
package {
import flash.media.*;
public dynamic class WonLevelSound extends Sound {
}
}//package