Section 1
//mcBall_2 (assets_fla.mcBall_2)
package assets_fla {
import flash.display.*;
public dynamic class mcBall_2 extends MovieClip {
public function mcBall_2(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package assets_fla
Section 2
//GameEvent (com.pandaland.events.GameEvent)
package com.pandaland.events {
import flash.events.*;
public class GameEvent extends Event {
private var pData:Object;
public static const FINISHED:String = "gameFinished";
public static const MATCH_RESULT:String = "matchResult";
public static const ABORTED:String = "gameAborted";
public function GameEvent(tType:String, tData:Object=null, tBubbles:Boolean=true){
super(tType, tBubbles);
pData = tData;
}
public function get data():Object{
return (pData);
}
override public function toString():String{
return ("[Instance of: com.pandaland.events.GameEvent ]");
}
}
}//package com.pandaland.events
Section 3
//ColorShortcuts (com.pandaland.games.filler.caurina.transitions.properties.ColorShortcuts)
package com.pandaland.games.filler.caurina.transitions.properties {
import flash.geom.*;
import com.pandaland.games.filler.caurina.transitions.*;
import flash.filters.*;
public class ColorShortcuts {
private static var LUMINANCE_B:Number = 0.072169;
private static var LUMINANCE_G:Number = 0.71516;
private static var LUMINANCE_R:Number = 0.212671;
public function ColorShortcuts(){
super();
trace("This is an static class and should not be instantiated.");
}
public static function _color_splitter(p_value, p_parameters:Array):Array{
var nArray:Array = new Array();
if (p_value == null){
nArray.push({name:"_color_redMultiplier", value:1});
nArray.push({name:"_color_redOffset", value:0});
nArray.push({name:"_color_greenMultiplier", value:1});
nArray.push({name:"_color_greenOffset", value:0});
nArray.push({name:"_color_blueMultiplier", value:1});
nArray.push({name:"_color_blueOffset", value:0});
} else {
nArray.push({name:"_color_redMultiplier", value:0});
nArray.push({name:"_color_redOffset", value:AuxFunctions.numberToR(p_value)});
nArray.push({name:"_color_greenMultiplier", value:0});
nArray.push({name:"_color_greenOffset", value:AuxFunctions.numberToG(p_value)});
nArray.push({name:"_color_blueMultiplier", value:0});
nArray.push({name:"_color_blueOffset", value:AuxFunctions.numberToB(p_value)});
};
return (nArray);
}
public static function _contrast_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var mc:Number;
var co:Number;
mc = (p_value + 1);
co = Math.round((p_value * -128));
var cfm:ColorTransform = new ColorTransform(mc, mc, mc, 1, co, co, co, 0);
p_obj.transform.colorTransform = cfm;
}
public static function _brightness_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
var isTint:Boolean = p_parameters[0];
var cfm:ColorTransform = p_obj.transform.colorTransform;
var mc:Number = (1 - (((cfm.redMultiplier + cfm.greenMultiplier) + cfm.blueMultiplier) / 3));
var co:Number = (((cfm.redOffset + cfm.greenOffset) + cfm.blueOffset) / 3);
if (isTint){
return (((co > 0)) ? (co / 0xFF) : -(mc));
//unresolved jump
};
return ((co / 100));
}
public static function _saturation_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
var mtx:Array = getObjectMatrix(p_obj);
var isDumb:Boolean = p_parameters[0];
var rl:Number = (isDumb) ? (1 / 3) : LUMINANCE_R;
var gl:Number = (isDumb) ? (1 / 3) : LUMINANCE_G;
var bl:Number = (isDumb) ? (1 / 3) : LUMINANCE_B;
var mc:Number = (((((mtx[0] - rl) / (1 - rl)) + ((mtx[6] - gl) / (1 - gl))) + ((mtx[12] - bl) / (1 - bl))) / 3);
var cc:Number = (1 - (((((((mtx[1] / gl) + (mtx[2] / bl)) + (mtx[5] / rl)) + (mtx[7] / bl)) + (mtx[10] / rl)) + (mtx[11] / gl)) / 6));
return (((mc + cc) / 2));
}
public static function _oldColor_property_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
return ((p_obj.transform.colorTransform[p_parameters[0]] * 100));
}
public static function _brightness_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var mc:Number;
var co:Number;
var isTint:Boolean = p_parameters[0];
if (isTint){
mc = (1 - Math.abs(p_value));
co = ((p_value > 0)) ? Math.round((p_value * 0xFF)) : 0;
} else {
mc = 1;
co = Math.round((p_value * 100));
};
var cfm:ColorTransform = new ColorTransform(mc, mc, mc, 1, co, co, co, 0);
p_obj.transform.colorTransform = cfm;
}
public static function _saturation_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var isDumb:Boolean = p_parameters[0];
var rl:Number = (isDumb) ? (1 / 3) : LUMINANCE_R;
var gl:Number = (isDumb) ? (1 / 3) : LUMINANCE_G;
var bl:Number = (isDumb) ? (1 / 3) : LUMINANCE_B;
var sf:Number = p_value;
var nf:Number = (1 - sf);
var nr:Number = (rl * nf);
var ng:Number = (gl * nf);
var nb:Number = (bl * nf);
var mtx:Array = [(nr + sf), ng, nb, 0, 0, nr, (ng + sf), nb, 0, 0, nr, ng, (nb + sf), 0, 0, 0, 0, 0, 1, 0];
setObjectMatrix(p_obj, mtx);
}
private static function getObjectMatrix(p_obj:Object):Array{
var i:Number = 0;
while (i < p_obj.filters.length) {
if ((p_obj.filters[i] is ColorMatrixFilter)){
return (p_obj.filters[i].matrix.concat());
};
i++;
};
return ([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]);
}
public static function getHueDistance(mtx1:Array, mtx2:Array):Number{
return (((Math.abs((mtx1[0] - mtx2[0])) + Math.abs((mtx1[1] - mtx2[1]))) + Math.abs((mtx1[2] - mtx2[2]))));
}
public static function _hue_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
setObjectMatrix(p_obj, getHueMatrix(p_value));
}
public static function _hue_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
var i:Number;
var angleToSplit:Number;
var mtx:Array = getObjectMatrix(p_obj);
var hues:Array = [];
hues[0] = {angle:-179.9, matrix:getHueMatrix(-179.9)};
hues[1] = {angle:180, matrix:getHueMatrix(180)};
i = 0;
while (i < hues.length) {
hues[i].distance = getHueDistance(mtx, hues[i].matrix);
i++;
};
var maxTries:Number = 15;
i = 0;
while (i < maxTries) {
if (hues[0].distance < hues[1].distance){
angleToSplit = 1;
} else {
angleToSplit = 0;
};
hues[angleToSplit].angle = ((hues[0].angle + hues[1].angle) / 2);
hues[angleToSplit].matrix = getHueMatrix(hues[angleToSplit].angle);
hues[angleToSplit].distance = getHueDistance(mtx, hues[angleToSplit].matrix);
i++;
};
return (hues[angleToSplit].angle);
}
public static function getHueMatrix(hue:Number):Array{
var ha:Number = ((hue * Math.PI) / 180);
var rl:Number = LUMINANCE_R;
var gl:Number = LUMINANCE_G;
var bl:Number = LUMINANCE_B;
var c:Number = Math.cos(ha);
var s:Number = Math.sin(ha);
var mtx:Array = [((rl + (c * (1 - rl))) + (s * -(rl))), ((gl + (c * -(gl))) + (s * -(gl))), ((bl + (c * -(bl))) + (s * (1 - bl))), 0, 0, ((rl + (c * -(rl))) + (s * 0.143)), ((gl + (c * (1 - gl))) + (s * 0.14)), ((bl + (c * -(bl))) + (s * -0.283)), 0, 0, ((rl + (c * -(rl))) + (s * -((1 - rl)))), ((gl + (c * -(gl))) + (s * gl)), ((bl + (c * (1 - bl))) + (s * bl)), 0, 0, 0, 0, 0, 1, 0];
return (mtx);
}
public static function _color_property_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
return (p_obj.transform.colorTransform[p_parameters[0]]);
}
public static function init():void{
Tweener.registerSpecialProperty("_color_ra", _oldColor_property_get, _oldColor_property_set, ["redMultiplier"]);
Tweener.registerSpecialProperty("_color_rb", _color_property_get, _color_property_set, ["redOffset"]);
Tweener.registerSpecialProperty("_color_ga", _oldColor_property_get, _oldColor_property_set, ["greenMultiplier"]);
Tweener.registerSpecialProperty("_color_gb", _color_property_get, _color_property_set, ["greenOffset"]);
Tweener.registerSpecialProperty("_color_ba", _oldColor_property_get, _oldColor_property_set, ["blueMultiplier"]);
Tweener.registerSpecialProperty("_color_bb", _color_property_get, _color_property_set, ["blueOffset"]);
Tweener.registerSpecialProperty("_color_aa", _oldColor_property_get, _oldColor_property_set, ["alphaMultiplier"]);
Tweener.registerSpecialProperty("_color_ab", _color_property_get, _color_property_set, ["alphaOffset"]);
Tweener.registerSpecialProperty("_color_redMultiplier", _color_property_get, _color_property_set, ["redMultiplier"]);
Tweener.registerSpecialProperty("_color_redOffset", _color_property_get, _color_property_set, ["redOffset"]);
Tweener.registerSpecialProperty("_color_greenMultiplier", _color_property_get, _color_property_set, ["greenMultiplier"]);
Tweener.registerSpecialProperty("_color_greenOffset", _color_property_get, _color_property_set, ["greenOffset"]);
Tweener.registerSpecialProperty("_color_blueMultiplier", _color_property_get, _color_property_set, ["blueMultiplier"]);
Tweener.registerSpecialProperty("_color_blueOffset", _color_property_get, _color_property_set, ["blueOffset"]);
Tweener.registerSpecialProperty("_color_alphaMultiplier", _color_property_get, _color_property_set, ["alphaMultiplier"]);
Tweener.registerSpecialProperty("_color_alphaOffset", _color_property_get, _color_property_set, ["alphaOffset"]);
Tweener.registerSpecialPropertySplitter("_color", _color_splitter);
Tweener.registerSpecialPropertySplitter("_colorTransform", _colorTransform_splitter);
Tweener.registerSpecialProperty("_brightness", _brightness_get, _brightness_set, [false]);
Tweener.registerSpecialProperty("_tintBrightness", _brightness_get, _brightness_set, [true]);
Tweener.registerSpecialProperty("_contrast", _contrast_get, _contrast_set);
Tweener.registerSpecialProperty("_hue", _hue_get, _hue_set);
Tweener.registerSpecialProperty("_saturation", _saturation_get, _saturation_set, [false]);
Tweener.registerSpecialProperty("_dumbSaturation", _saturation_get, _saturation_set, [true]);
}
private static function setObjectMatrix(p_obj:Object, p_matrix:Array):void{
var cmtx:ColorMatrixFilter;
var objFilters:Array = p_obj.filters.concat();
var found:Boolean;
var i:Number = 0;
while (i < objFilters.length) {
if ((objFilters[i] is ColorMatrixFilter)){
objFilters[i].matrix = p_matrix.concat();
found = true;
};
i++;
};
if (!found){
cmtx = new ColorMatrixFilter(p_matrix);
objFilters[objFilters.length] = cmtx;
};
p_obj.filters = objFilters;
}
public static function _color_property_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var cfm:ColorTransform = p_obj.transform.colorTransform;
cfm[p_parameters[0]] = p_value;
p_obj.transform.colorTransform = cfm;
}
public static function _oldColor_property_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var tf:ColorTransform = p_obj.transform.colorTransform;
tf[p_parameters[0]] = (p_value / 100);
p_obj.transform.colorTransform = tf;
}
public static function _contrast_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
var mc:Number;
var co:Number;
var cfm:ColorTransform = p_obj.transform.colorTransform;
mc = ((((cfm.redMultiplier + cfm.greenMultiplier) + cfm.blueMultiplier) / 3) - 1);
co = ((((cfm.redOffset + cfm.greenOffset) + cfm.blueOffset) / 3) / -128);
return (((mc + co) / 2));
}
public static function _colorTransform_splitter(p_value:Object, p_parameters:Array):Array{
var nArray:Array = new Array();
if (p_value == null){
nArray.push({name:"_color_redMultiplier", value:1});
nArray.push({name:"_color_redOffset", value:0});
nArray.push({name:"_color_greenMultiplier", value:1});
nArray.push({name:"_color_greenOffset", value:0});
nArray.push({name:"_color_blueMultiplier", value:1});
nArray.push({name:"_color_blueOffset", value:0});
} else {
if (p_value.ra != undefined){
nArray.push({name:"_color_ra", value:p_value.ra});
};
if (p_value.rb != undefined){
nArray.push({name:"_color_rb", value:p_value.rb});
};
if (p_value.ga != undefined){
nArray.push({name:"_color_ba", value:p_value.ba});
};
if (p_value.gb != undefined){
nArray.push({name:"_color_bb", value:p_value.bb});
};
if (p_value.ba != undefined){
nArray.push({name:"_color_ga", value:p_value.ga});
};
if (p_value.bb != undefined){
nArray.push({name:"_color_gb", value:p_value.gb});
};
if (p_value.aa != undefined){
nArray.push({name:"_color_aa", value:p_value.aa});
};
if (p_value.ab != undefined){
nArray.push({name:"_color_ab", value:p_value.ab});
};
if (p_value.redMultiplier != undefined){
nArray.push({name:"_color_redMultiplier", value:p_value.redMultiplier});
};
if (p_value.redOffset != undefined){
nArray.push({name:"_color_redOffset", value:p_value.redOffset});
};
if (p_value.blueMultiplier != undefined){
nArray.push({name:"_color_blueMultiplier", value:p_value.blueMultiplier});
};
if (p_value.blueOffset != undefined){
nArray.push({name:"_color_blueOffset", value:p_value.blueOffset});
};
if (p_value.greenMultiplier != undefined){
nArray.push({name:"_color_greenMultiplier", value:p_value.greenMultiplier});
};
if (p_value.greenOffset != undefined){
nArray.push({name:"_color_greenOffset", value:p_value.greenOffset});
};
if (p_value.alphaMultiplier != undefined){
nArray.push({name:"_color_alphaMultiplier", value:p_value.alphaMultiplier});
};
if (p_value.alphaOffset != undefined){
nArray.push({name:"_color_alphaOffset", value:p_value.alphaOffset});
};
};
return (nArray);
}
}
}//package com.pandaland.games.filler.caurina.transitions.properties
Section 4
//DisplayShortcuts (com.pandaland.games.filler.caurina.transitions.properties.DisplayShortcuts)
package com.pandaland.games.filler.caurina.transitions.properties {
import flash.geom.*;
import com.pandaland.games.filler.caurina.transitions.*;
public class DisplayShortcuts {
public function DisplayShortcuts(){
super();
trace("This is an static class and should not be instantiated.");
}
public static function init():void{
Tweener.registerSpecialProperty("_frame", _frame_get, _frame_set);
Tweener.registerSpecialProperty("_autoAlpha", _autoAlpha_get, _autoAlpha_set);
Tweener.registerSpecialPropertySplitter("_scale", _scale_splitter);
Tweener.registerSpecialPropertySplitter("_scrollRect", _scrollRect_splitter);
Tweener.registerSpecialProperty("_scrollRect_x", _scrollRect_property_get, _scrollRect_property_set, ["x"]);
Tweener.registerSpecialProperty("_scrollRect_y", _scrollRect_property_get, _scrollRect_property_set, ["y"]);
Tweener.registerSpecialProperty("_scrollRect_left", _scrollRect_property_get, _scrollRect_property_set, ["left"]);
Tweener.registerSpecialProperty("_scrollRect_right", _scrollRect_property_get, _scrollRect_property_set, ["right"]);
Tweener.registerSpecialProperty("_scrollRect_top", _scrollRect_property_get, _scrollRect_property_set, ["top"]);
Tweener.registerSpecialProperty("_scrollRect_bottom", _scrollRect_property_get, _scrollRect_property_set, ["bottom"]);
Tweener.registerSpecialProperty("_scrollRect_width", _scrollRect_property_get, _scrollRect_property_set, ["width"]);
Tweener.registerSpecialProperty("_scrollRect_height", _scrollRect_property_get, _scrollRect_property_set, ["height"]);
}
public static function _frame_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
p_obj.gotoAndStop(Math.round(p_value));
}
public static function _autoAlpha_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
p_obj.alpha = p_value;
p_obj.visible = (p_value > 0);
}
public static function _frame_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
return (p_obj.currentFrame);
}
public static function _scrollRect_splitter(p_value:Rectangle, p_parameters:Array, p_extra:Object=null):Array{
var nArray:Array = new Array();
if (p_value == null){
nArray.push({name:"_scrollRect_x", value:0});
nArray.push({name:"_scrollRect_y", value:0});
nArray.push({name:"_scrollRect_width", value:100});
nArray.push({name:"_scrollRect_height", value:100});
} else {
nArray.push({name:"_scrollRect_x", value:p_value.x});
nArray.push({name:"_scrollRect_y", value:p_value.y});
nArray.push({name:"_scrollRect_width", value:p_value.width});
nArray.push({name:"_scrollRect_height", value:p_value.height});
};
return (nArray);
}
public static function _autoAlpha_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
return (p_obj.alpha);
}
public static function _scrollRect_property_get(p_obj:Object, p_parameters:Array, p_extra:Object=null):Number{
return (p_obj.scrollRect[p_parameters[0]]);
}
public static function _scale_splitter(p_value:Number, p_parameters:Array):Array{
var nArray:Array = new Array();
nArray.push({name:"scaleX", value:p_value});
nArray.push({name:"scaleY", value:p_value});
return (nArray);
}
public static function _scrollRect_property_set(p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object=null):void{
var rect:Rectangle = p_obj.scrollRect;
rect[p_parameters[0]] = Math.round(p_value);
p_obj.scrollRect = rect;
}
}
}//package com.pandaland.games.filler.caurina.transitions.properties
Section 5
//AuxFunctions (com.pandaland.games.filler.caurina.transitions.AuxFunctions)
package com.pandaland.games.filler.caurina.transitions {
public class AuxFunctions {
public function AuxFunctions(){
super();
}
public static function concatObjects(... _args):Object{
var currentObject:Object;
var prop:String;
var finalObject:Object = {};
var i:int;
while (i < _args.length) {
currentObject = _args[i];
for (prop in currentObject) {
if (currentObject[prop] == null){
delete finalObject[prop];
} else {
finalObject[prop] = currentObject[prop];
};
};
i++;
};
return (finalObject);
}
public static function numberToG(p_num:Number):Number{
return (((p_num & 0xFF00) >> 8));
}
public static function numberToR(p_num:Number):Number{
return (((p_num & 0xFF0000) >> 16));
}
public static function isInArray(p_string:String, p_array:Array):Boolean{
var l:uint = p_array.length;
var i:uint;
while (i < l) {
if (p_array[i] == p_string){
return (true);
};
i++;
};
return (false);
}
public static function getObjectLength(p_object:Object):uint{
var pName:String;
var totalProperties:uint;
for (pName in p_object) {
totalProperties++;
};
return (totalProperties);
}
public static function numberToB(p_num:Number):Number{
return ((p_num & 0xFF));
}
}
}//package com.pandaland.games.filler.caurina.transitions
Section 6
//Equations (com.pandaland.games.filler.caurina.transitions.Equations)
package com.pandaland.games.filler.caurina.transitions {
public class Equations {
public function Equations(){
super();
trace("Equations is a static class and should not be instantiated.");
}
public static function easeOutBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
if (t < (1 / 2.75)){
return (((c * ((7.5625 * t) * t)) + b));
};
if (t < (2 / 2.75)){
t = (t - (1.5 / 2.75));
return (((c * (((7.5625 * t) * t) + 0.75)) + b));
};
if (t < (2.5 / 2.75)){
t = (t - (2.25 / 2.75));
return (((c * (((7.5625 * t) * t) + 0.9375)) + b));
};
t = (t - (2.625 / 2.75));
return (((c * (((7.5625 * t) * t) + 0.984375)) + b));
}
public static function easeInOutElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number;
if (t == 0){
return (b);
};
t = (t / (d / 2));
if (t == 2){
return ((b + c));
};
var p:Number = (((!(Boolean(p_params))) || (isNaN(p_params.period)))) ? (d * (0.3 * 1.5)) : p_params.period;
var a:Number = (((!(Boolean(p_params))) || (isNaN(p_params.amplitude)))) ? 0 : p_params.amplitude;
if (((!(Boolean(a))) || ((a < Math.abs(c))))){
a = c;
s = (p / 4);
} else {
s = ((p / (2 * Math.PI)) * Math.asin((c / a)));
};
if (t < 1){
--t;
return (((-0.5 * ((a * Math.pow(2, (10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p)))) + b));
};
--t;
return ((((((a * Math.pow(2, (-10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p))) * 0.5) + c) + b));
}
public static function easeInOutQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / (d / 2));
if (t < 1){
return (((((c / 2) * t) * t) + b));
};
--t;
return ((((-(c) / 2) * ((t * (t - 2)) - 1)) + b));
}
public static function easeInOutBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (((easeInBounce((t * 2), 0, c, d) * 0.5) + b));
};
return ((((easeOutBounce(((t * 2) - d), 0, c, d) * 0.5) + (c * 0.5)) + b));
}
public static function easeInOutBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number = (((!(Boolean(p_params))) || (isNaN(p_params.overshoot)))) ? 1.70158 : p_params.overshoot;
t = (t / (d / 2));
if (t < 1){
s = (s * 1.525);
return ((((c / 2) * ((t * t) * (((s + 1) * t) - s))) + b));
};
t = (t - 2);
s = (s * 1.525);
return ((((c / 2) * (((t * t) * (((s + 1) * t) + s)) + 2)) + b));
}
public static function easeOutInCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutCubic((t * 2), b, (c / 2), d, p_params));
};
return (easeInCubic(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeNone(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return ((((c * t) / d) + b));
}
public static function easeOutBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number = (((!(Boolean(p_params))) || (isNaN(p_params.overshoot)))) ? 1.70158 : p_params.overshoot;
t = ((t / d) - 1);
return (((c * (((t * t) * (((s + 1) * t) + s)) + 1)) + b));
}
public static function easeInOutSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return ((((-(c) / 2) * (Math.cos(((Math.PI * t) / d)) - 1)) + b));
}
public static function easeInBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number = (((!(Boolean(p_params))) || (isNaN(p_params.overshoot)))) ? 1.70158 : p_params.overshoot;
t = (t / d);
return (((((c * t) * t) * (((s + 1) * t) - s)) + b));
}
public static function easeInQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return ((((((c * t) * t) * t) * t) + b));
}
public static function easeOutInQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutQuint((t * 2), b, (c / 2), d, p_params));
};
return (easeInQuint(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeOutInBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutBounce((t * 2), b, (c / 2), d, p_params));
};
return (easeInBounce(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
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(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return (((t)==d) ? (b + c) : (((c * 1.001) * (-(Math.pow(2, ((-10 * t) / d))) + 1)) + b));
}
public static function easeOutInBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutBack((t * 2), b, (c / 2), d, p_params));
};
return (easeInBack(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeInExpo(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return (((t)==0) ? b : (((c * Math.pow(2, (10 * ((t / d) - 1)))) + b) - (c * 0.001)));
}
public static function easeInCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return (((((c * t) * t) * t) + b));
}
public static function easeInQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return (((((((c * t) * t) * t) * t) * t) + b));
}
public static function easeInOutCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / (d / 2));
if (t < 1){
return ((((-(c) / 2) * (Math.sqrt((1 - (t * t))) - 1)) + b));
};
t = (t - 2);
return ((((c / 2) * (Math.sqrt((1 - (t * t))) + 1)) + b));
}
public static function easeInQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return ((((c * t) * t) + b));
}
public static function easeInBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return (((c - easeOutBounce((d - t), 0, c, d)) + b));
}
public static function easeOutInExpo(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutExpo((t * 2), b, (c / 2), d, p_params));
};
return (easeInExpo(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeOutQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = ((t / d) - 1);
return (((-(c) * ((((t * t) * t) * t) - 1)) + b));
}
public static function easeInSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return ((((-(c) * Math.cos(((t / d) * (Math.PI / 2)))) + c) + b));
}
public static function easeInOutQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / (d / 2));
if (t < 1){
return (((((((c / 2) * t) * t) * t) * t) + b));
};
t = (t - 2);
return ((((-(c) / 2) * ((((t * t) * t) * t) - 2)) + b));
}
public static function easeOutQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return ((((-(c) * t) * (t - 2)) + b));
}
public static function easeOutInElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutElastic((t * 2), b, (c / 2), d, p_params));
};
return (easeInElastic(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeInElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number;
if (t == 0){
return (b);
};
t = (t / d);
if (t == 1){
return ((b + c));
};
var p:Number = (((!(Boolean(p_params))) || (isNaN(p_params.period)))) ? (d * 0.3) : p_params.period;
var a:Number = (((!(Boolean(p_params))) || (isNaN(p_params.amplitude)))) ? 0 : p_params.amplitude;
if (((!(Boolean(a))) || ((a < Math.abs(c))))){
a = c;
s = (p / 4);
} else {
s = ((p / (2 * Math.PI)) * Math.asin((c / a)));
};
--t;
return ((-(((a * Math.pow(2, (10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p)))) + b));
}
public static function easeOutCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = ((t / d) - 1);
return (((c * (((t * t) * t) + 1)) + b));
}
public static function easeOutQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = ((t / d) - 1);
return (((c * (((((t * t) * t) * t) * t) + 1)) + b));
}
public static function easeOutInQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutQuad((t * 2), b, (c / 2), d, p_params));
};
return (easeInQuad(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeOutSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
return (((c * Math.sin(((t / d) * (Math.PI / 2)))) + b));
}
public static function easeInOutCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / (d / 2));
if (t < 1){
return ((((((c / 2) * t) * t) * t) + b));
};
t = (t - 2);
return ((((c / 2) * (((t * t) * t) + 2)) + b));
}
public static function easeInOutQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / (d / 2));
if (t < 1){
return ((((((((c / 2) * t) * t) * t) * t) * t) + b));
};
t = (t - 2);
return ((((c / 2) * (((((t * t) * t) * t) * t) + 2)) + b));
}
public static function easeInCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = (t / d);
return (((-(c) * (Math.sqrt((1 - (t * t))) - 1)) + b));
}
public static function easeOutInSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutSine((t * 2), b, (c / 2), d, p_params));
};
return (easeInSine(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeInOutExpo(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t == 0){
return (b);
};
if (t == d){
return ((b + c));
};
t = (t / (d / 2));
if (t < 1){
return (((((c / 2) * Math.pow(2, (10 * (t - 1)))) + b) - (c * 0.0005)));
};
--t;
return (((((c / 2) * 1.0005) * (-(Math.pow(2, (-10 * t))) + 2)) + b));
}
public static function easeOutElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
var s:Number;
if (t == 0){
return (b);
};
t = (t / d);
if (t == 1){
return ((b + c));
};
var p:Number = (((!(Boolean(p_params))) || (isNaN(p_params.period)))) ? (d * 0.3) : p_params.period;
var a:Number = (((!(Boolean(p_params))) || (isNaN(p_params.amplitude)))) ? 0 : p_params.amplitude;
if (((!(Boolean(a))) || ((a < Math.abs(c))))){
a = c;
s = (p / 4);
} else {
s = ((p / (2 * Math.PI)) * Math.asin((c / a)));
};
return (((((a * Math.pow(2, (-10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p))) + c) + b));
}
public static function easeOutCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
t = ((t / d) - 1);
return (((c * Math.sqrt((1 - (t * t)))) + b));
}
public static function easeOutInQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutQuart((t * 2), b, (c / 2), d, p_params));
};
return (easeInQuart(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
public static function easeOutInCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{
if (t < (d / 2)){
return (easeOutCirc((t * 2), b, (c / 2), d, p_params));
};
return (easeInCirc(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params));
}
}
}//package com.pandaland.games.filler.caurina.transitions
Section 7
//PropertyInfoObj (com.pandaland.games.filler.caurina.transitions.PropertyInfoObj)
package com.pandaland.games.filler.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(p_valueStart:Number, p_valueComplete:Number, p_originalValueComplete:Object, p_arrayIndex:Number, p_extra:Object, p_isSpecialProperty:Boolean, p_modifierFunction:Function, p_modifierParameters:Array){
super();
valueStart = p_valueStart;
valueComplete = p_valueComplete;
originalValueComplete = p_originalValueComplete;
arrayIndex = p_arrayIndex;
extra = p_extra;
isSpecialProperty = p_isSpecialProperty;
hasModifier = Boolean(p_modifierFunction);
modifierFunction = p_modifierFunction;
modifierParameters = p_modifierParameters;
}
public function toString():String{
var returnStr:String = "\n[PropertyInfoObj ";
returnStr = (returnStr + ("valueStart:" + String(valueStart)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("valueComplete:" + String(valueComplete)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("originalValueComplete:" + String(originalValueComplete)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("arrayIndex:" + String(arrayIndex)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("extra:" + String(extra)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("isSpecialProperty:" + String(isSpecialProperty)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("hasModifier:" + String(hasModifier)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("modifierFunction:" + String(modifierFunction)));
returnStr = (returnStr + ", ");
returnStr = (returnStr + ("modifierParameters:" + String(modifierParameters)));
returnStr = (returnStr + "]\n");
return (returnStr);
}
public function clone():PropertyInfoObj{
var nProperty:PropertyInfoObj = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters);
return (nProperty);
}
}
}//package com.pandaland.games.filler.caurina.transitions
Section 8
//SpecialProperty (com.pandaland.games.filler.caurina.transitions.SpecialProperty)
package com.pandaland.games.filler.caurina.transitions {
public class SpecialProperty {
public var parameters:Array;
public var getValue:Function;
public var preProcess:Function;
public var setValue:Function;
public function SpecialProperty(p_getFunction:Function, p_setFunction:Function, p_parameters:Array=null, p_preProcessFunction:Function=null){
super();
getValue = p_getFunction;
setValue = p_setFunction;
parameters = p_parameters;
preProcess = p_preProcessFunction;
}
public function toString():String{
var value:String = "";
value = (value + "[SpecialProperty ");
value = (value + ("getValue:" + String(getValue)));
value = (value + ", ");
value = (value + ("setValue:" + String(setValue)));
value = (value + ", ");
value = (value + ("parameters:" + String(parameters)));
value = (value + ", ");
value = (value + ("preProcess:" + String(preProcess)));
value = (value + "]");
return (value);
}
}
}//package com.pandaland.games.filler.caurina.transitions
Section 9
//SpecialPropertyModifier (com.pandaland.games.filler.caurina.transitions.SpecialPropertyModifier)
package com.pandaland.games.filler.caurina.transitions {
public class SpecialPropertyModifier {
public var getValue:Function;
public var modifyValues:Function;
public function SpecialPropertyModifier(p_modifyFunction:Function, p_getFunction:Function){
super();
modifyValues = p_modifyFunction;
getValue = p_getFunction;
}
public function toString():String{
var value:String = "";
value = (value + "[SpecialPropertyModifier ");
value = (value + ("modifyValues:" + String(modifyValues)));
value = (value + ", ");
value = (value + ("getValue:" + String(getValue)));
value = (value + "]");
return (value);
}
}
}//package com.pandaland.games.filler.caurina.transitions
Section 10
//SpecialPropertySplitter (com.pandaland.games.filler.caurina.transitions.SpecialPropertySplitter)
package com.pandaland.games.filler.caurina.transitions {
public class SpecialPropertySplitter {
public var parameters:Array;
public var splitValues:Function;
public function SpecialPropertySplitter(p_splitFunction:Function, p_parameters:Array){
super();
splitValues = p_splitFunction;
parameters = p_parameters;
}
public function toString():String{
var value:String = "";
value = (value + "[SpecialPropertySplitter ");
value = (value + ("splitValues:" + String(splitValues)));
value = (value + ", ");
value = (value + ("parameters:" + String(parameters)));
value = (value + "]");
return (value);
}
}
}//package com.pandaland.games.filler.caurina.transitions
Section 11
//Tweener (com.pandaland.games.filler.caurina.transitions.Tweener)
package com.pandaland.games.filler.caurina.transitions {
import flash.utils.*;
import flash.display.*;
import flash.events.*;
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(){
super();
trace("Tweener is a static class and should not be instantiated.");
}
public static function registerSpecialPropertyModifier(p_name:String, p_modifyFunction:Function, p_getFunction:Function):void{
if (!_inited){
init();
};
var spm:SpecialPropertyModifier = new SpecialPropertyModifier(p_modifyFunction, p_getFunction);
_specialPropertyModifierList[p_name] = spm;
}
public static function registerSpecialProperty(p_name:String, p_getFunction:Function, p_setFunction:Function, p_parameters:Array=null, p_preProcessFunction:Function=null):void{
if (!_inited){
init();
};
var sp:SpecialProperty = new SpecialProperty(p_getFunction, p_setFunction, p_parameters, p_preProcessFunction);
_specialPropertyList[p_name] = sp;
}
public static function init(p_object=null):void{
_inited = true;
_transitionList = new Object();
Equations.init();
_specialPropertyList = new Object();
_specialPropertyModifierList = new Object();
_specialPropertySplitterList = new Object();
}
private static function updateTweens():Boolean{
var i:int;
if (_tweenList.length == 0){
return (false);
};
i = 0;
while (i < _tweenList.length) {
if ((((_tweenList[i] == undefined)) || (!(_tweenList[i].isPaused)))){
if (!updateTweenByIndex(i)){
removeTweenByIndex(i);
};
if (_tweenList[i] == null){
removeTweenByIndex(i, true);
i--;
};
};
i++;
};
return (true);
}
public static function addCaller(p_scopes:Object=null, p_parameters:Object=null):Boolean{
var i:Number;
var j:Number;
var rScopes:Array;
var rTransition:Function;
var nTween:TweenListObj;
var myT:Number;
var trans:String;
if (!Boolean(p_scopes)){
return (false);
};
if ((p_scopes is Array)){
rScopes = p_scopes.concat();
} else {
rScopes = [p_scopes];
};
var p_obj:Object = p_parameters;
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var rTime:Number = (isNaN(p_obj.time)) ? 0 : p_obj.time;
var rDelay:Number = (isNaN(p_obj.delay)) ? 0 : p_obj.delay;
if (typeof(p_obj.transition) == "string"){
trans = p_obj.transition.toLowerCase();
rTransition = _transitionList[trans];
} else {
rTransition = p_obj.transition;
};
if (!Boolean(rTransition)){
rTransition = _transitionList["easeoutexpo"];
};
i = 0;
while (i < rScopes.length) {
if (p_obj.useFrames == true){
nTween = new TweenListObj(rScopes[i], (_currentTimeFrame + (rDelay / _timeScale)), (_currentTimeFrame + ((rDelay + rTime) / _timeScale)), true, rTransition, p_obj.transitionParams);
} else {
nTween = new TweenListObj(rScopes[i], (_currentTime + ((rDelay * 1000) / _timeScale)), (_currentTime + (((rDelay * 1000) + (rTime * 1000)) / _timeScale)), false, rTransition, p_obj.transitionParams);
};
nTween.properties = null;
nTween.onStart = p_obj.onStart;
nTween.onUpdate = p_obj.onUpdate;
nTween.onComplete = p_obj.onComplete;
nTween.onOverwrite = p_obj.onOverwrite;
nTween.onStartParams = p_obj.onStartParams;
nTween.onUpdateParams = p_obj.onUpdateParams;
nTween.onCompleteParams = p_obj.onCompleteParams;
nTween.onOverwriteParams = p_obj.onOverwriteParams;
nTween.onStartScope = p_obj.onStartScope;
nTween.onUpdateScope = p_obj.onUpdateScope;
nTween.onCompleteScope = p_obj.onCompleteScope;
nTween.onOverwriteScope = p_obj.onOverwriteScope;
nTween.onErrorScope = p_obj.onErrorScope;
nTween.isCaller = true;
nTween.count = p_obj.count;
nTween.waitFrames = p_obj.waitFrames;
_tweenList.push(nTween);
if ((((rTime == 0)) && ((rDelay == 0)))){
myT = (_tweenList.length - 1);
updateTweenByIndex(myT);
removeTweenByIndex(myT);
};
i++;
};
return (true);
}
public static function pauseAllTweens():Boolean{
var i:uint;
if (!Boolean(_tweenList)){
return (false);
};
var paused:Boolean;
i = 0;
while (i < _tweenList.length) {
pauseTweenByIndex(i);
paused = true;
i++;
};
return (paused);
}
public static function removeTweens(p_scope:Object, ... _args):Boolean{
var i:uint;
var properties:Array = new Array();
i = 0;
while (i < _args.length) {
if ((((typeof(_args[i]) == "string")) && (!(AuxFunctions.isInArray(_args[i], properties))))){
properties.push(_args[i]);
};
i++;
};
return (affectTweens(removeTweenByIndex, p_scope, properties));
}
public static function splitTweens(p_tween:Number, p_properties:Array):uint{
var i:uint;
var pName:String;
var found:Boolean;
var originalTween:TweenListObj = _tweenList[p_tween];
var newTween:TweenListObj = originalTween.clone(false);
i = 0;
while (i < p_properties.length) {
pName = p_properties[i];
if (Boolean(originalTween.properties[pName])){
originalTween.properties[pName] = undefined;
delete originalTween.properties[pName];
};
i++;
};
for (pName in newTween.properties) {
found = false;
i = 0;
while (i < p_properties.length) {
if (p_properties[i] == pName){
found = true;
break;
};
i++;
};
if (!found){
newTween.properties[pName] = undefined;
delete newTween.properties[pName];
};
};
_tweenList.push(newTween);
return ((_tweenList.length - 1));
}
public static function updateFrame():void{
_currentTimeFrame++;
}
public static function resumeTweenByIndex(p_tween:Number):Boolean{
var tTweening:TweenListObj = _tweenList[p_tween];
if ((((tTweening == null)) || (!(tTweening.isPaused)))){
return (false);
};
var cTime:Number = getCurrentTweeningTime(tTweening);
tTweening.timeStart = (tTweening.timeStart + (cTime - tTweening.timePaused));
tTweening.timeComplete = (tTweening.timeComplete + (cTime - tTweening.timePaused));
tTweening.timePaused = undefined;
tTweening.isPaused = false;
return (true);
}
public static function getVersion():String{
return ("AS3 1.31.68");
}
public static function onEnterFrame(e:Event):void{
updateTime();
updateFrame();
var hasUpdated:Boolean;
hasUpdated = updateTweens();
if (!hasUpdated){
stopEngine();
};
}
public static function updateTime():void{
_currentTime = getTimer();
}
private static function updateTweenByIndex(i: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 = i;
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);
//unresolved if
if (Boolean(tTweening.onUpdate)){
eventScope = (Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope;
tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams);
continue;
var _slot1 = e;
handleError(tTweening, _slot1, "onUpdate");
};
} while (tTweening.timesCalled++, !(tTweening.timesCalled >= tTweening.count));
} 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;
tTweening.onStart.apply(eventScope, tTweening.onStartParams);
//unresolved jump
var _slot1 = e;
handleError(tTweening, _slot1, "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;
tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams);
//unresolved jump
var _slot1 = e;
handleError(tTweening, _slot1, "onUpdate");
};
} else {
tTweening.updatesSkipped++;
};
};
if (((isOver) && (Boolean(tTweening.onComplete)))){
eventScope = (Boolean(tTweening.onCompleteScope)) ? tTweening.onCompleteScope : tScope;
tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams);
//unresolved jump
var _slot1 = e;
handleError(tTweening, _slot1, "onComplete");
};
return (!(isOver));
};
return (true);
}
public static function setTimeScale(p_time:Number):void{
var i:Number;
var cTime:Number;
if (isNaN(p_time)){
p_time = 1;
};
if (p_time < 1E-5){
p_time = 1E-5;
};
if (p_time != _timeScale){
if (_tweenList != null){
i = 0;
while (i < _tweenList.length) {
cTime = getCurrentTweeningTime(_tweenList[i]);
_tweenList[i].timeStart = (cTime - (((cTime - _tweenList[i].timeStart) * _timeScale) / p_time));
_tweenList[i].timeComplete = (cTime - (((cTime - _tweenList[i].timeComplete) * _timeScale) / p_time));
if (_tweenList[i].timePaused != undefined){
_tweenList[i].timePaused = (cTime - (((cTime - _tweenList[i].timePaused) * _timeScale) / p_time));
};
i++;
};
};
_timeScale = p_time;
};
}
public static function resumeAllTweens():Boolean{
var i:uint;
if (!Boolean(_tweenList)){
return (false);
};
var resumed:Boolean;
i = 0;
while (i < _tweenList.length) {
resumeTweenByIndex(i);
resumed = true;
i++;
};
return (resumed);
}
private static function handleError(pTweening:TweenListObj, pError:Error, pCallBackName:String):void{
var eventScope:Object;
var pTweening = pTweening;
var pError = pError;
var pCallBackName = pCallBackName;
if (((Boolean(pTweening.onError)) && ((pTweening.onError is Function)))){
eventScope = (Boolean(pTweening.onErrorScope)) ? pTweening.onErrorScope : pTweening.scope;
pTweening.onError.apply(pTweening.scope, [pTweening.scope, pError]);
//unresolved jump
var _slot1 = metaError;
printError(((((String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n ") + pError.getStackTrace()) + "\nonError error: ") + _slot1.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 i:uint;
if (!Boolean(_tweenList)){
return (false);
};
var removed:Boolean;
i = 0;
while (i < _tweenList.length) {
removeTweenByIndex(i);
removed = true;
i++;
};
return (removed);
}
public static function addTween(p_scopes:Object=null, p_parameters:Object=null):Boolean{
var i:Number;
var j:Number;
var istr:String;
var jstr:String;
var rScopes:Array;
var rTransition:Function;
var nProperties:Object;
var nTween:TweenListObj;
var myT:Number;
var cTime:Number;
var splitProperties:Array;
var splitProperties2:Array;
var tempModifiedProperties:Array;
var trans:String;
if (!Boolean(p_scopes)){
return (false);
};
if ((p_scopes is Array)){
rScopes = p_scopes.concat();
} else {
rScopes = [p_scopes];
};
var p_obj:Object = TweenListObj.makePropertiesChain(arguments[(arguments.length - 1)]);
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var rTime:Number = (isNaN(p_obj.time)) ? 0 : p_obj.time;
var rDelay:Number = (isNaN(p_obj.delay)) ? 0 : p_obj.delay;
var rProperties:Array = new Array();
var restrictedWords: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 modifiedProperties:Object = new Object();
for (istr in p_obj) {
if (!restrictedWords[istr]){
if (_specialPropertySplitterList[istr]){
splitProperties = _specialPropertySplitterList[istr].splitValues(p_obj[istr], _specialPropertySplitterList[istr].parameters);
i = 0;
while (i < splitProperties.length) {
if (_specialPropertySplitterList[splitProperties[i].name]){
splitProperties2 = _specialPropertySplitterList[splitProperties[i].name].splitValues(splitProperties[i].value, _specialPropertySplitterList[splitProperties[i].name].parameters);
j = 0;
while (j < splitProperties2.length) {
rProperties[splitProperties2[j].name] = {valueStart:undefined, valueComplete:splitProperties2[j].value, arrayIndex:splitProperties2[j].arrayIndex, isSpecialProperty:false};
j++;
};
} else {
rProperties[splitProperties[i].name] = {valueStart:undefined, valueComplete:splitProperties[i].value, arrayIndex:splitProperties[i].arrayIndex, isSpecialProperty:false};
};
i++;
};
} else {
if (_specialPropertyModifierList[istr] != undefined){
tempModifiedProperties = _specialPropertyModifierList[istr].modifyValues(p_obj[istr]);
i = 0;
while (i < tempModifiedProperties.length) {
modifiedProperties[tempModifiedProperties[i].name] = {modifierParameters:tempModifiedProperties[i].parameters, modifierFunction:_specialPropertyModifierList[istr].getValue};
i++;
};
} else {
rProperties[istr] = {valueStart:undefined, valueComplete:p_obj[istr]};
};
};
};
};
for (istr in rProperties) {
if (_specialPropertyList[istr] != undefined){
rProperties[istr].isSpecialProperty = true;
} else {
if (rScopes[0][istr] == undefined){
printError((((("The property '" + istr) + "' doesn't seem to be a normal object property of ") + String(rScopes[0])) + " or a registered special property."));
};
};
};
for (istr in modifiedProperties) {
if (rProperties[istr] != undefined){
rProperties[istr].modifierParameters = modifiedProperties[istr].modifierParameters;
rProperties[istr].modifierFunction = modifiedProperties[istr].modifierFunction;
};
};
if (typeof(p_obj.transition) == "string"){
trans = p_obj.transition.toLowerCase();
rTransition = _transitionList[trans];
} else {
rTransition = p_obj.transition;
};
if (!Boolean(rTransition)){
rTransition = _transitionList["easeoutexpo"];
};
i = 0;
while (i < rScopes.length) {
nProperties = new Object();
for (istr in rProperties) {
nProperties[istr] = new PropertyInfoObj(rProperties[istr].valueStart, rProperties[istr].valueComplete, rProperties[istr].valueComplete, rProperties[istr].arrayIndex, {}, rProperties[istr].isSpecialProperty, rProperties[istr].modifierFunction, rProperties[istr].modifierParameters);
};
if (p_obj.useFrames == true){
nTween = new TweenListObj(rScopes[i], (_currentTimeFrame + (rDelay / _timeScale)), (_currentTimeFrame + ((rDelay + rTime) / _timeScale)), true, rTransition, p_obj.transitionParams);
} else {
nTween = new TweenListObj(rScopes[i], (_currentTime + ((rDelay * 1000) / _timeScale)), (_currentTime + (((rDelay * 1000) + (rTime * 1000)) / _timeScale)), false, rTransition, p_obj.transitionParams);
};
nTween.properties = nProperties;
nTween.onStart = p_obj.onStart;
nTween.onUpdate = p_obj.onUpdate;
nTween.onComplete = p_obj.onComplete;
nTween.onOverwrite = p_obj.onOverwrite;
nTween.onError = p_obj.onError;
nTween.onStartParams = p_obj.onStartParams;
nTween.onUpdateParams = p_obj.onUpdateParams;
nTween.onCompleteParams = p_obj.onCompleteParams;
nTween.onOverwriteParams = p_obj.onOverwriteParams;
nTween.onStartScope = p_obj.onStartScope;
nTween.onUpdateScope = p_obj.onUpdateScope;
nTween.onCompleteScope = p_obj.onCompleteScope;
nTween.onOverwriteScope = p_obj.onOverwriteScope;
nTween.onErrorScope = p_obj.onErrorScope;
nTween.rounded = p_obj.rounded;
nTween.skipUpdates = p_obj.skipUpdates;
removeTweensByTime(nTween.scope, nTween.properties, nTween.timeStart, nTween.timeComplete);
_tweenList.push(nTween);
if ((((rTime == 0)) && ((rDelay == 0)))){
myT = (_tweenList.length - 1);
updateTweenByIndex(myT);
removeTweenByIndex(myT);
};
i++;
};
return (true);
}
public static function registerTransition(p_name:String, p_function:Function):void{
if (!_inited){
init();
};
_transitionList[p_name] = p_function;
}
public static function printError(p_message:String):void{
trace(("## [Tweener] Error: " + p_message));
}
private static function affectTweens(p_affectFunction:Function, p_scope:Object, p_properties:Array):Boolean{
var i:uint;
var affectedProperties:Array;
var j:uint;
var objectProperties:uint;
var slicedTweenIndex:uint;
var affected:Boolean;
if (!Boolean(_tweenList)){
return (false);
};
i = 0;
while (i < _tweenList.length) {
if (((_tweenList[i]) && ((_tweenList[i].scope == p_scope)))){
if (p_properties.length == 0){
p_affectFunction(i);
affected = true;
} else {
affectedProperties = new Array();
j = 0;
while (j < p_properties.length) {
if (Boolean(_tweenList[i].properties[p_properties[j]])){
affectedProperties.push(p_properties[j]);
};
j++;
};
if (affectedProperties.length > 0){
objectProperties = AuxFunctions.getObjectLength(_tweenList[i].properties);
if (objectProperties == affectedProperties.length){
p_affectFunction(i);
affected = true;
} else {
slicedTweenIndex = splitTweens(i, affectedProperties);
p_affectFunction(slicedTweenIndex);
affected = true;
};
};
};
};
i++;
};
return (affected);
}
public static function getTweens(p_scope:Object):Array{
var i:uint;
var pName:String;
if (!Boolean(_tweenList)){
return ([]);
};
var tList:Array = new Array();
i = 0;
while (i < _tweenList.length) {
if (((Boolean(_tweenList[i])) && ((_tweenList[i].scope == p_scope)))){
for (pName in _tweenList[i].properties) {
tList.push(pName);
};
};
i++;
};
return (tList);
}
public static function isTweening(p_scope:Object):Boolean{
var i:uint;
if (!Boolean(_tweenList)){
return (false);
};
i = 0;
while (i < _tweenList.length) {
if (((Boolean(_tweenList[i])) && ((_tweenList[i].scope == p_scope)))){
return (true);
};
i++;
};
return (false);
}
public static function pauseTweenByIndex(p_tween:Number):Boolean{
var tTweening:TweenListObj = _tweenList[p_tween];
if ((((tTweening == null)) || (tTweening.isPaused))){
return (false);
};
tTweening.timePaused = getCurrentTweeningTime(tTweening);
tTweening.isPaused = true;
return (true);
}
public static function getCurrentTweeningTime(p_tweening:Object):Number{
return ((p_tweening.useFrames) ? _currentTimeFrame : _currentTime);
}
public static function getTweenCount(p_scope:Object):Number{
var i:uint;
if (!Boolean(_tweenList)){
return (0);
};
var c:Number = 0;
i = 0;
while (i < _tweenList.length) {
if (((Boolean(_tweenList[i])) && ((_tweenList[i].scope == p_scope)))){
c = (c + AuxFunctions.getObjectLength(_tweenList[i].properties));
};
i++;
};
return (c);
}
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(p_scope:Object, p_properties:Object, p_timeStart:Number, p_timeComplete:Number):Boolean{
var removedLocally:Boolean;
var i:uint;
var pName:String;
var eventScope:Object;
var p_scope = p_scope;
var p_properties = p_properties;
var p_timeStart = p_timeStart;
var p_timeComplete = p_timeComplete;
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;
_tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams);
//unresolved jump
var _slot1 = e;
handleError(_tweenList[i], _slot1, "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(p_name:String, p_splitFunction:Function, p_parameters:Array=null):void{
if (!_inited){
init();
};
var sps:SpecialPropertySplitter = new SpecialPropertySplitter(p_splitFunction, p_parameters);
_specialPropertySplitterList[p_name] = sps;
}
public static function removeTweenByIndex(i:Number, p_finalRemoval:Boolean=false):Boolean{
_tweenList[i] = null;
if (p_finalRemoval){
_tweenList.splice(i, 1);
};
return (true);
}
public static function resumeTweens(p_scope:Object, ... _args):Boolean{
var i:uint;
var properties:Array = new Array();
i = 0;
while (i < _args.length) {
if ((((typeof(_args[i]) == "string")) && (!(AuxFunctions.isInArray(_args[i], properties))))){
properties.push(_args[i]);
};
i++;
};
return (affectTweens(resumeTweenByIndex, p_scope, properties));
}
public static function pauseTweens(p_scope:Object, ... _args):Boolean{
var i:uint;
var properties:Array = new Array();
i = 0;
while (i < _args.length) {
if ((((typeof(_args[i]) == "string")) && (!(AuxFunctions.isInArray(_args[i], properties))))){
properties.push(_args[i]);
};
i++;
};
return (affectTweens(pauseTweenByIndex, p_scope, properties));
}
}
}//package com.pandaland.games.filler.caurina.transitions
Section 12
//TweenListObj (com.pandaland.games.filler.caurina.transitions.TweenListObj)
package com.pandaland.games.filler.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(p_scope:Object, p_timeStart:Number, p_timeComplete:Number, p_useFrames:Boolean, p_transition:Function, p_transitionParams:Object){
super();
scope = p_scope;
timeStart = p_timeStart;
timeComplete = p_timeComplete;
useFrames = p_useFrames;
transition = p_transition;
transitionParams = p_transitionParams;
properties = new Object();
isPaused = false;
timePaused = undefined;
isCaller = false;
updatesSkipped = 0;
timesCalled = 0;
skipUpdates = 0;
hasStarted = false;
}
public function clone(omitEvents:Boolean):TweenListObj{
var pName:String;
var nTween:TweenListObj = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams);
nTween.properties = new Array();
for (pName in properties) {
nTween.properties[pName] = properties[pName].clone();
};
nTween.skipUpdates = skipUpdates;
nTween.updatesSkipped = updatesSkipped;
if (!omitEvents){
nTween.onStart = onStart;
nTween.onUpdate = onUpdate;
nTween.onComplete = onComplete;
nTween.onOverwrite = onOverwrite;
nTween.onError = onError;
nTween.onStartParams = onStartParams;
nTween.onUpdateParams = onUpdateParams;
nTween.onCompleteParams = onCompleteParams;
nTween.onOverwriteParams = onOverwriteParams;
nTween.onStartScope = onStartScope;
nTween.onUpdateScope = onUpdateScope;
nTween.onCompleteScope = onCompleteScope;
nTween.onOverwriteScope = onOverwriteScope;
nTween.onErrorScope = onErrorScope;
};
nTween.rounded = rounded;
nTween.isPaused = isPaused;
nTween.timePaused = timePaused;
nTween.isCaller = isCaller;
nTween.count = count;
nTween.timesCalled = timesCalled;
nTween.waitFrames = waitFrames;
nTween.hasStarted = hasStarted;
return (nTween);
}
public function toString():String{
var i:String;
var returnStr:String = "\n[TweenListObj ";
returnStr = (returnStr + ("scope:" + String(scope)));
returnStr = (returnStr + ", properties:");
var isFirst:Boolean;
for (i in properties) {
if (!isFirst){
returnStr = (returnStr + ",");
};
returnStr = (returnStr + ("[name:" + properties[i].name));
returnStr = (returnStr + (",valueStart:" + properties[i].valueStart));
returnStr = (returnStr + (",valueComplete:" + properties[i].valueComplete));
returnStr = (returnStr + "]");
isFirst = false;
};
returnStr = (returnStr + (", timeStart:" + String(timeStart)));
returnStr = (returnStr + (", timeComplete:" + String(timeComplete)));
returnStr = (returnStr + (", useFrames:" + String(useFrames)));
returnStr = (returnStr + (", transition:" + String(transition)));
returnStr = (returnStr + (", transitionParams:" + String(transitionParams)));
if (skipUpdates){
returnStr = (returnStr + (", skipUpdates:" + String(skipUpdates)));
};
if (updatesSkipped){
returnStr = (returnStr + (", updatesSkipped:" + String(updatesSkipped)));
};
if (Boolean(onStart)){
returnStr = (returnStr + (", onStart:" + String(onStart)));
};
if (Boolean(onUpdate)){
returnStr = (returnStr + (", onUpdate:" + String(onUpdate)));
};
if (Boolean(onComplete)){
returnStr = (returnStr + (", onComplete:" + String(onComplete)));
};
if (Boolean(onOverwrite)){
returnStr = (returnStr + (", onOverwrite:" + String(onOverwrite)));
};
if (Boolean(onError)){
returnStr = (returnStr + (", onError:" + String(onError)));
};
if (onStartParams){
returnStr = (returnStr + (", onStartParams:" + String(onStartParams)));
};
if (onUpdateParams){
returnStr = (returnStr + (", onUpdateParams:" + String(onUpdateParams)));
};
if (onCompleteParams){
returnStr = (returnStr + (", onCompleteParams:" + String(onCompleteParams)));
};
if (onOverwriteParams){
returnStr = (returnStr + (", onOverwriteParams:" + String(onOverwriteParams)));
};
if (onStartScope){
returnStr = (returnStr + (", onStartScope:" + String(onStartScope)));
};
if (onUpdateScope){
returnStr = (returnStr + (", onUpdateScope:" + String(onUpdateScope)));
};
if (onCompleteScope){
returnStr = (returnStr + (", onCompleteScope:" + String(onCompleteScope)));
};
if (onOverwriteScope){
returnStr = (returnStr + (", onOverwriteScope:" + String(onOverwriteScope)));
};
if (onErrorScope){
returnStr = (returnStr + (", onErrorScope:" + String(onErrorScope)));
};
if (rounded){
returnStr = (returnStr + (", rounded:" + String(rounded)));
};
if (isPaused){
returnStr = (returnStr + (", isPaused:" + String(isPaused)));
};
if (timePaused){
returnStr = (returnStr + (", timePaused:" + String(timePaused)));
};
if (isCaller){
returnStr = (returnStr + (", isCaller:" + String(isCaller)));
};
if (count){
returnStr = (returnStr + (", count:" + String(count)));
};
if (timesCalled){
returnStr = (returnStr + (", timesCalled:" + String(timesCalled)));
};
if (waitFrames){
returnStr = (returnStr + (", waitFrames:" + String(waitFrames)));
};
if (hasStarted){
returnStr = (returnStr + (", hasStarted:" + String(hasStarted)));
};
returnStr = (returnStr + "]\n");
return (returnStr);
}
public static function makePropertiesChain(p_obj:Object):Object{
var chainedObject:Object;
var chain:Object;
var currChainObj:Object;
var len:Number;
var i:Number;
var k:Number;
var baseObject:Object = p_obj.base;
if (baseObject){
chainedObject = {};
if ((baseObject is Array)){
chain = [];
k = 0;
while (k < baseObject.length) {
chain.push(baseObject[k]);
k++;
};
} else {
chain = [baseObject];
};
chain.push(p_obj);
len = chain.length;
i = 0;
while (i < len) {
if (chain[i]["base"]){
currChainObj = AuxFunctions.concatObjects(makePropertiesChain(chain[i]["base"]), chain[i]);
} else {
currChainObj = chain[i];
};
chainedObject = AuxFunctions.concatObjects(chainedObject, currChainObj);
i++;
};
if (chainedObject["base"]){
delete chainedObject["base"];
};
return (chainedObject);
//unresolved jump
};
return (p_obj);
}
}
}//package com.pandaland.games.filler.caurina.transitions
Section 13
//Balls (com.pandaland.games.filler.elements.Balls)
package com.pandaland.games.filler.elements {
import com.pandaland.games.filler.*;
import org.cove.ape.*;
public class Balls extends Group {
private var userBall:UserBall;
private var growing:Boolean;
public function Balls(){
super();
collideInternal = true;
}
public function run():void{
if (growing){
userBall.radius = (userBall.radius + 2);
};
}
public function stopGrowing():void{
growing = false;
userBall.growing = false;
SoundController.stopGrow();
}
public function getParticles():Array{
return (particles);
}
public function addUserBall():void{
var b:UserBall;
b = new UserBall(GameEngine.instance.mouseX, GameEngine.instance.mouseY, 10, false, 1, 0.1);
b.setStyle(1, 0xFFFFFF, 1, 0xFF0000, 0.3);
addParticle(b);
b.growing = true;
userBall = b;
growing = true;
SoundController.playGrow();
}
private function getRandomVector():Vector{
var v:Vector;
v = new Vector();
v.x = ((Math.random() * 4) + 4);
v.y = (10 - v.x);
return (v);
}
public function addEnemyBalls(count:int):void{
var b:EnemyBall;
var i:Number = 1;
while (i < count) {
b = new EnemyBall((Math.random() * GameEngine.WIDTH), (Math.random() * GameEngine.HEIGHT), 10, false, 1, 0.5, 0.2);
b.setStyle(1, 0xFFFFFF, 1, 0xCCCCCC, 0.5);
b.velocity = getRandomVector();
addParticle(b);
i++;
};
}
}
}//package com.pandaland.games.filler.elements
Section 14
//BoundingBox (com.pandaland.games.filler.elements.BoundingBox)
package com.pandaland.games.filler.elements {
import org.cove.ape.*;
public class BoundingBox extends Group {
public function BoundingBox(){
var rr:RectangleParticle;
super();
var alpha:Number = 0;
rr = new RectangleParticle(0, -26, 1200, 50, 0, true, 1, 0.5);
rr.setStyle(1, 0xFF0000, alpha, 0xFF0000, alpha);
addParticle(rr);
rr = new RectangleParticle(0, 365, 1200, 50, 0, true, 1, 0.5);
rr.setStyle(1, 0xFF0000, alpha, 0xFF0000, alpha);
addParticle(rr);
rr = new RectangleParticle(-25, 0, 50, 800, 0, true, 1, 0.5);
rr.setStyle(1, 0xFF00, alpha, 0xFF00, alpha);
addParticle(rr);
rr = new RectangleParticle(554, 0, 50, 800, 0, true, 1, 0.5);
rr.setStyle(1, 0xFF00, alpha, 0xFF00, alpha);
addParticle(rr);
}
}
}//package com.pandaland.games.filler.elements
Section 15
//EnemyBall (com.pandaland.games.filler.elements.EnemyBall)
package com.pandaland.games.filler.elements {
import org.cove.ape.*;
public class EnemyBall extends CircleParticle {
public function EnemyBall(x:Number, y:Number, radius:Number, fixed:Boolean=false, mass:Number=1, elasticity:Number=0.3, friction:Number=0){
displayObject = new mcBallTex();
displayObjectOffset = new Vector();
mcBallTex(displayObject).mc.gotoAndStop(3);
super(x, y, radius, fixed, mass, elasticity, friction);
}
override public function addMasslessForce(f:Vector):void{
}
override public function paint():void{
sprite.x = getCurrentVector().x;
sprite.y = getCurrentVector().y;
sprite.width = (radius * 2);
sprite.height = (radius * 2);
var vel:Vector = velocity;
vel = vel.normalize();
vel = vel.mult(5.55);
velocity = vel;
}
}
}//package com.pandaland.games.filler.elements
Section 16
//UserBall (com.pandaland.games.filler.elements.UserBall)
package com.pandaland.games.filler.elements {
import com.pandaland.games.filler.*;
import org.cove.ape.*;
public class UserBall extends CircleParticle {
public var growing:Boolean;
public function UserBall(x:Number, y:Number, radius:Number, fixed:Boolean=false, mass:Number=1, elasticity:Number=0.3, friction:Number=0){
displayObject = new mcBallTex();
displayObjectOffset = new Vector();
mcBallTex(displayObject).mc.gotoAndStop(2);
super(x, y, radius, fixed, mass, elasticity, friction);
growing = false;
}
override public function addMasslessForce(f:Vector):void{
if (!growing){
forces.plusEquals(f);
};
}
override public function paint():void{
sprite.x = getCurrentVector().x;
sprite.y = getCurrentVector().y;
sprite.width = (radius * 2);
sprite.height = (radius * 2);
if (growing){
px = (px + ((GameEngine.instance.mouseX - px) / 12));
py = (py + ((GameEngine.instance.mouseY - py) / 12));
};
}
}
}//package com.pandaland.games.filler.elements
Section 17
//FillerMain (com.pandaland.games.filler.FillerMain)
package com.pandaland.games.filler {
import flash.display.*;
import com.pandaland.games.*;
import com.pandaland.games.filler.caurina.transitions.properties.*;
public class FillerMain extends AbstractGame {
private var bg:Bitmap;
private var game:GameEngine;
private var gui:Gui;
private var gameMask:Sprite;
private static var sInst:FillerMain;
public function FillerMain(){
sInst = this;
super("filler");
}
public function setPoints(p:Number):void{
pScore = p;
}
override protected function startGame():void{
trace("the system is initialized, start your engines here in", pLangID);
SoundController.getInstance();
ColorShortcuts.init();
DisplayShortcuts.init();
bg = new Bitmap(new bgBmp(0, 0));
addChild(bg);
game = new GameEngine();
addChild(game);
gui = new Gui();
addChild(gui);
gui.init();
game.init(gui);
gameMask = new Sprite();
gameMask.graphics.beginFill(0);
gameMask.graphics.drawRect(game.x, game.y, 530, 340);
game.mask = gameMask;
gui.showIntro();
}
override protected function initLangs():void{
pLangs["DE"] = <snippets>
<INTRO_HEADLINE><![CDATA[Anleitung]]></INTRO_HEADLINE>
<INTRO><![CDATA[Du musst mindestens zwei Drittel der Fläche mit Bällen auffüllen, um den nächsten Level zu erreichen. Klicke mit der Maus um einen Ball wachsen zu lassen.]]></INTRO>
<INTRO_BTN><![CDATA[Spiel starten]]></INTRO_BTN>
<END_HEADLINE><![CDATA[Spielende]]></END_HEADLINE>
<END><![CDATA[Versuchs gleich nochmal!]]></END>
<BTN_PLAYAGAIN><![CDATA[Nochmal spielen]]></BTN_PLAYAGAIN>
<END_BTN><![CDATA[Spiel beenden]]></END_BTN>
<LEVELUP_HEADLINE><![CDATA[Level geschafft!]]></LEVELUP_HEADLINE>
<LEVELUP><![CDATA[Klicke für nächsten Level.]]></LEVELUP>
<LEVELUP_BTN><![CDATA[weiter]]></LEVELUP_BTN>
<GAME_LEVEL><![CDATA[Level:]]></GAME_LEVEL>
<GAME_POINTS><![CDATA[Punkte:]]></GAME_POINTS>
<GAME_TIME><![CDATA[Zeit:]]></GAME_TIME>
<GAME_LIFES><![CDATA[Leben:]]></GAME_LIFES>
<GAME_BALLS><![CDATA[Bälle:]]></GAME_BALLS>
<GAME_FILLED><![CDATA[gefüllt]]></GAME_FILLED>
<GAME_BREAK><![CDATA[Pause]]></GAME_BREAK>
<GAME_RESTART><![CDATA[Neustart]]></GAME_RESTART>
<PLAY_CHAT><![CDATA[Spielen & Chatten]]></PLAY_CHAT>
</snippets>
;
pLangs["EN"] = <snippets>
<END><![CDATA[Try Again!]]></END>
<END_BTN><![CDATA[Finish]]></END_BTN>
<BTN_PLAYAGAIN><![CDATA[Again]]></BTN_PLAYAGAIN>
<END_HEADLINE><![CDATA[Game over]]></END_HEADLINE>
<GAME_BALLS><![CDATA[Balls:]]></GAME_BALLS>
<GAME_BREAK><![CDATA[Pause]]></GAME_BREAK>
<GAME_FILLED><![CDATA[filled]]></GAME_FILLED>
<GAME_LEVEL><![CDATA[Level:]]></GAME_LEVEL>
<GAME_LIFES><![CDATA[Lives:]]></GAME_LIFES>
<GAME_POINTS><![CDATA[Points:]]></GAME_POINTS>
<GAME_RESTART><![CDATA[Restart]]></GAME_RESTART>
<GAME_TIME><![CDATA[Time:]]></GAME_TIME>
<INTRO><![CDATA[You need to fill up at least two thirds of the area with balls, in order to reach the next level. Using your mouse, click to increase the size of your ball.]]></INTRO>
<INTRO_BTN><![CDATA[Begin game]]></INTRO_BTN>
<INTRO_HEADLINE><![CDATA[Instructions]]></INTRO_HEADLINE>
<LEVELUP><![CDATA[Click to reach the next level.]]></LEVELUP>
<LEVELUP_BTN><![CDATA[continue]]></LEVELUP_BTN>
<LEVELUP_HEADLINE><![CDATA[Level completed!]]></LEVELUP_HEADLINE>
<PLAY_CHAT><![CDATA[Play & Chat]]></PLAY_CHAT>
</snippets>
;
pLangs["ES"] = <snippets>
<END><![CDATA[¡Inténtalo de nuevo!]]></END>
<END_BTN><![CDATA[Finalizar]]></END_BTN>
<BTN_PLAYAGAIN><![CDATA[Jugar otra vez]]></BTN_PLAYAGAIN>
<END_HEADLINE><![CDATA[Fin del juego]]></END_HEADLINE>
<GAME_BALLS><![CDATA[Balones:]]></GAME_BALLS>
<GAME_BREAK><![CDATA[Pausa]]></GAME_BREAK>
<GAME_FILLED><![CDATA[lleno]]></GAME_FILLED>
<GAME_LEVEL><![CDATA[Nivel:]]></GAME_LEVEL>
<GAME_LIFES><![CDATA[Vidas:]]></GAME_LIFES>
<GAME_POINTS><![CDATA[Puntos:]]></GAME_POINTS>
<GAME_RESTART><![CDATA[Empezar de nuevo]]></GAME_RESTART>
<GAME_TIME><![CDATA[Tiempo:]]></GAME_TIME>
<INTRO><![CDATA[Tienes que rellenar la botella con balones, por lo menos dos tercios, para pasar al siguiente nivel. Pincha con el ratón para que aumente el tamaño del balón. ]]></INTRO>
<INTRO_BTN><![CDATA[Empezar el juego]]></INTRO_BTN>
<INTRO_HEADLINE><![CDATA[Instrucciones]]></INTRO_HEADLINE>
<LEVELUP><![CDATA[Click para pasar al siguiente nivel.]]></LEVELUP>
<LEVELUP_BTN><![CDATA[seguir]]></LEVELUP_BTN>
<LEVELUP_HEADLINE><![CDATA[¡Nivel superado!]]></LEVELUP_HEADLINE>
<PLAY_CHAT><![CDATA[Jugar & Chatear]]></PLAY_CHAT>
</snippets>
;
pLangs["US"] = <snippets>
<END><![CDATA[Try Again!]]></END>
<END_BTN><![CDATA[Finish]]></END_BTN>
<BTN_PLAYAGAIN><![CDATA[Again]]></BTN_PLAYAGAIN>
<END_HEADLINE><![CDATA[Game over]]></END_HEADLINE>
<GAME_BALLS><![CDATA[Balls:]]></GAME_BALLS>
<GAME_BREAK><![CDATA[Pause]]></GAME_BREAK>
<GAME_FILLED><![CDATA[filled]]></GAME_FILLED>
<GAME_LEVEL><![CDATA[Level:]]></GAME_LEVEL>
<GAME_LIFES><![CDATA[Lives:]]></GAME_LIFES>
<GAME_POINTS><![CDATA[Points:]]></GAME_POINTS>
<GAME_RESTART><![CDATA[Restart]]></GAME_RESTART>
<GAME_TIME><![CDATA[Time:]]></GAME_TIME>
<INTRO><![CDATA[You need to fill up at least two thirds of the area with balls, in order to reach the next level. Using your mouse, click to increase the size of your ball.]]></INTRO>
<INTRO_BTN><![CDATA[Begin game]]></INTRO_BTN>
<INTRO_HEADLINE><![CDATA[Instructions]]></INTRO_HEADLINE>
<LEVELUP><![CDATA[Click to reach the next level.]]></LEVELUP>
<LEVELUP_BTN><![CDATA[continue]]></LEVELUP_BTN>
<LEVELUP_HEADLINE><![CDATA[Level completed!]]></LEVELUP_HEADLINE>
<PLAY_CHAT><![CDATA[Play & Chat]]></PLAY_CHAT>
</snippets>
;
pLangs["PL"] = <snippets>
<END><![CDATA[Spróbuj jeszcze raz!]]></END>
<END_BTN><![CDATA[Anuluj]]></END_BTN>
<BTN_PLAYAGAIN><![CDATA[Zagraj jeszcze raz]]></BTN_PLAYAGAIN>
<END_HEADLINE><![CDATA[Koniec gry]]></END_HEADLINE>
<GAME_BALLS><![CDATA[Piłki:]]></GAME_BALLS>
<GAME_BREAK><![CDATA[Przerwa]]></GAME_BREAK>
<GAME_FILLED><![CDATA[pełne]]></GAME_FILLED>
<GAME_LEVEL><![CDATA[Poziom:]]></GAME_LEVEL>
<GAME_LIFES><![CDATA[Życie:]]></GAME_LIFES>
<GAME_POINTS><![CDATA[Punkty:]]></GAME_POINTS>
<GAME_RESTART><![CDATA[Od nowa]]></GAME_RESTART>
<GAME_TIME><![CDATA[Czas:]]></GAME_TIME>
<INTRO><![CDATA[Aby przejść do kolejnego poziomu, twoje balony muszą zapełnić dwie trzecie przestrzeni. Kliknij na myszkę by nadmuchać balony ale uważaj by nie pękły.]]></INTRO>
<INTRO_BTN><![CDATA[Początek gry]]></INTRO_BTN>
<INTRO_HEADLINE><![CDATA[Instrukcja]]></INTRO_HEADLINE>
<LEVELUP><![CDATA[Kliknij by przejść do następnego poziomu.]]></LEVELUP>
<LEVELUP_BTN><![CDATA[do przodu]]></LEVELUP_BTN>
<LEVELUP_HEADLINE><![CDATA[Poziom dokonany!]]></LEVELUP_HEADLINE>
<PLAY_CHAT><![CDATA[Graj i czatuj!]]></PLAY_CHAT>
</snippets>
;
pLangs["NL"] = <snippets>
<END><![CDATA[Probeer het nog een keer!]]></END>
<END_BTN><![CDATA[Beëindigen]]></END_BTN>
<BTN_PLAYAGAIN><![CDATA[Nogmaals spelen]]></BTN_PLAYAGAIN>
<END_HEADLINE><![CDATA[Einde van het spel]]></END_HEADLINE>
<GAME_BALLS><![CDATA[Ballonnen]]></GAME_BALLS>
<GAME_BREAK><![CDATA[Pauze]]></GAME_BREAK>
<GAME_FILLED><![CDATA[geladen]]></GAME_FILLED>
<GAME_LEVEL><![CDATA[Level:]]></GAME_LEVEL>
<GAME_LIFES><![CDATA[Leven:]]></GAME_LIFES>
<GAME_POINTS><![CDATA[Punten:]]></GAME_POINTS>
<GAME_RESTART><![CDATA[Herstarten]]></GAME_RESTART>
<GAME_TIME><![CDATA[Tijd:]]></GAME_TIME>
<INTRO><![CDATA[Je moet minstens twee derde van het kader met ballonnen vullen om het volgende level te bereiken. Hiervoor klik je met de muis op een punt in het kader om de ballon te laten groeien.
]]></INTRO>
<INTRO_BTN><![CDATA[Spel starten]]></INTRO_BTN>
<INTRO_HEADLINE><![CDATA[Instructie]]></INTRO_HEADLINE>
<LEVELUP><![CDATA[Klik voor het volgende level.]]></LEVELUP>
<LEVELUP_BTN><![CDATA[verder]]></LEVELUP_BTN>
<LEVELUP_HEADLINE><![CDATA[Level gehaald!]]></LEVELUP_HEADLINE>
<PLAY_CHAT><![CDATA[Spelen & Chat]]></PLAY_CHAT>
</snippets>
;
pLangs["FR"] = <snippets>
<END><![CDATA[Essaie à nouveau!]]></END>
<END_BTN><![CDATA[Annuler]]></END_BTN>
<BTN_PLAYAGAIN><![CDATA[Rejouer]]></BTN_PLAYAGAIN>
<END_HEADLINE><![CDATA[Fin du jeu]]></END_HEADLINE>
<GAME_BALLS><![CDATA[Ballons]]></GAME_BALLS>
<GAME_BREAK><![CDATA[Pause]]></GAME_BREAK>
<GAME_FILLED><![CDATA[rempli]]></GAME_FILLED>
<GAME_LEVEL><![CDATA[Niveau]]></GAME_LEVEL>
<GAME_LIFES><![CDATA[Vies:]]></GAME_LIFES>
<GAME_POINTS><![CDATA[Points:]]></GAME_POINTS>
<GAME_RESTART><![CDATA[Recommencer]]></GAME_RESTART>
<GAME_TIME><![CDATA[Temps:]]></GAME_TIME>
<INTRO><![CDATA[Tu dois remplir au moins deux tiers de la bouteille avec des ballons pour atteindre le niveau suivant. Clique avec ta souris pour faire augmenter la taille du ballon.]]></INTRO>
<INTRO_BTN><![CDATA[Commencer le jeu]]></INTRO_BTN>
<INTRO_HEADLINE><![CDATA[Instructions]]></INTRO_HEADLINE>
<LEVELUP><![CDATA[Clique pour accéder au niveau suivant.]]></LEVELUP>
<LEVELUP_BTN><![CDATA[suite]]></LEVELUP_BTN>
<LEVELUP_HEADLINE><![CDATA[Niveau réussi!]]></LEVELUP_HEADLINE>
<PLAY_CHAT><![CDATA[Jouer et Tchater]]></PLAY_CHAT>
</snippets>
;
}
override public function destroy():void{
super.destroy();
game.destroy();
removeChild(game);
removeChild(gui);
removeChild(bg);
game = null;
gui = null;
gameMask = null;
bg = null;
sInst = null;
}
public static function get inst():FillerMain{
return (sInst);
}
}
}//package com.pandaland.games.filler
Section 18
//GameEngine (com.pandaland.games.filler.GameEngine)
package com.pandaland.games.filler {
import flash.utils.*;
import flash.display.*;
import flash.events.*;
import org.cove.ape.*;
import com.pandaland.games.filler.elements.*;
public class GameEngine extends Sprite {
private var timer:Timer;
private var gameBounds:BoundingBox;
private var balls:Balls;
private var gui:Gui;
public static var LEVEL:int = 0;
public static var PERCENT:int = 0;
public static var WIDTH:int = 530;
public static var HEIGHT:int = 340;
public static var TIME:int = 0;
public static var SCORE:int = 0;
public static var BALLS:int = 0;
public static var instance:GameEngine;
public static var LIFES:int = 0;
public function GameEngine(){
super();
instance = this;
}
private function addBall():Boolean{
if (BALLS >= 1){
BALLS--;
gui.update();
return (true);
};
BALLS--;
if (BALLS < 0){
BALLS = 0;
};
gui.update();
if (looseLife()){
return (true);
};
return (false);
}
public function looseLife():Boolean{
if (LIFES >= 1){
LIFES--;
gui.update();
return (true);
};
LIFES--;
if (LIFES < 0){
LIFES = 0;
};
gui.update();
showGameEnd();
return (false);
}
private function calcArea():void{
var c:CircleParticle;
var all:Number = (WIDTH * HEIGHT);
var clear:Number = 0;
var ps:Array = balls.getParticles();
var i:Number = 0;
while (i < ps.length) {
c = ps[i];
if ((c is UserBall)){
if (UserBall(c).collidable){
clear = (clear + ((c.radius * c.radius) * Math.PI));
};
};
i++;
};
var old:Number = PERCENT;
PERCENT = Math.floor(((clear / all) * 100));
SCORE = (SCORE + Math.floor((PERCENT - old)));
if (PERCENT >= 66){
levelUp();
};
gui.update();
}
public function resumeGame():void{
SoundController.fadeInLoop();
stage.addEventListener(Event.ENTER_FRAME, run);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
if (timer){
timer.stop();
timer = null;
};
timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, tick);
timer.start();
}
public function pauseGame(tValue:Boolean=false):void{
if (!tValue){
SoundController.fadeOutLoop();
};
if (stage != null){
stage.removeEventListener(Event.ENTER_FRAME, run);
stage.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUp);
};
timer.stop();
}
public function destroy():void{
pauseGame(true);
instance = null;
SoundController.destroy();
}
private function run(e:Event):void{
APEngine.step();
APEngine.paint();
balls.run();
}
private function showGameEnd():void{
pauseGame();
FillerMain.inst.addScore(GameEngine.SCORE);
gui.update();
gui.showGameOver();
SoundController.fadeOutLoop();
SoundController.playGameOver();
}
public function startNextLevel():void{
LEVEL++;
BALLS = 20;
PERCENT = 0;
TIME = (100 - LEVEL);
prepareGame();
resumeGame();
}
public function init(gui:Gui):void{
this.gui = gui;
x = 121;
y = 107;
APEngine.init((1 / 4));
APEngine.container = this;
APEngine.addMasslessForce(new Vector(0, 3));
gameBounds = new BoundingBox();
APEngine.addGroup(gameBounds);
timer = new Timer(1000);
resetGame();
}
private function showIntructions():void{
gui.update();
}
private function prepareGame():void{
gui.update();
if (balls){
APEngine.removeGroup(balls);
balls = null;
};
balls = new Balls();
balls.addEnemyBalls((LEVEL + 2));
APEngine.addGroup(balls);
balls.addCollidableList(new Array(gameBounds));
}
private function tick(e:TimerEvent):void{
TIME--;
if (TIME < 0){
TIME = 0;
};
gui.update();
}
private function mouseUp(e:MouseEvent):void{
if (inBounds()){
balls.stopGrowing();
calcArea();
stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUp);
};
}
private function resetGame():void{
LIFES = 3;
BALLS = 20;
LEVEL = 1;
PERCENT = 0;
SCORE = 0;
TIME = 100;
}
private function mouseDown(e:MouseEvent):void{
if (inBounds()){
if (addBall()){
balls.addUserBall();
};
gui.update();
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
};
}
public function reStart():void{
pauseGame();
resetGame();
prepareGame();
resumeGame();
}
private function inBounds():Boolean{
if ((((mouseX > 0)) && ((mouseY > 0)))){
if ((((mouseX < WIDTH)) && ((mouseY < HEIGHT)))){
return (true);
};
};
return (false);
}
private function levelUp():void{
pauseGame();
SCORE = (SCORE + TIME);
LIFES = (LIFES + 1);
if (LIFES > 10){
LIFES = 10;
};
gui.update();
gui.showNextLevelView();
SoundController.fadeOutLoop();
SoundController.playLvlUp();
}
public static function removeBall(b:AbstractParticle):void{
instance.balls.removeParticle(b);
}
public static function stopBallGrowing():void{
instance.balls.stopGrowing();
SoundController.stopGrow();
}
public static function restart():void{
instance.reStart();
}
public static function gameBreak():void{
if (instance.timer.running){
instance.pauseGame();
} else {
instance.resumeGame();
};
}
}
}//package com.pandaland.games.filler
Section 19
//Gui (com.pandaland.games.filler.Gui)
package com.pandaland.games.filler {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import de.dib.ui.*;
public class Gui extends Sprite {
private var txtScore:TextField;
private var txtBalls:TextField;
private var restartBtn:StandardButton;
private var nextLevel:mcLevelComplete;
private var txtTime:TextField;
private var breakBtn:StandardButton;
private var gameOver:mcGameover;
private var intro:mcIntro;
private var txtLevel:TextField;
private var txtPercent:TextField;
private var txtLives:TextField;
private var gui:mcGui;
public function Gui(){
super();
}
private function hideNextLevelView():void{
if (!nextLevel){
return;
};
removeChild(nextLevel);
nextLevel = null;
}
public function update():void{
txtPercent.text = ((GameEngine.PERCENT + "% ") + FillerMain.inst.getSnippet("GAME_FILLED"));
txtScore.text = ((FillerMain.inst.getSnippet("GAME_POINTS") + " ") + String(GameEngine.SCORE));
txtLevel.text = ((FillerMain.inst.getSnippet("GAME_LEVEL") + " ") + String(GameEngine.LEVEL));
txtTime.text = ((FillerMain.inst.getSnippet("GAME_TIME") + " ") + String(GameEngine.TIME));
txtLives.text = ((FillerMain.inst.getSnippet("GAME_LIFES") + " ") + String(GameEngine.LIFES));
txtBalls.text = ((FillerMain.inst.getSnippet("GAME_BALLS") + " ") + String(GameEngine.BALLS));
}
public function hideIntro():void{
if (!intro){
return;
};
removeChild(intro);
intro = null;
gui.visible = true;
}
private function restart():void{
GameEngine.restart();
hideIntro();
hideNextLevelView();
hideGameOver();
}
public function init():void{
gui = new mcGui();
addChild(gui);
txtPercent = gui.txtPercent;
txtScore = gui.txtScore;
txtLevel = gui.txtLevel;
txtTime = gui.txtTime;
txtLives = gui.txtLives;
txtBalls = gui.txtBalls;
gui.txtBtn1.text = FillerMain.inst.getSnippet("GAME_BREAK");
gui.txtBtn1.autoSize = TextFieldAutoSize.LEFT;
gui.btn1.width = (gui.txtBtn1.width + 22);
gui.txtBtn1.mouseEnabled = false;
breakBtn = new StandardButton();
breakBtn.init(gui.btn1, GameEngine.gameBreak);
gui.txtBtn2.text = FillerMain.inst.getSnippet("GAME_RESTART");
gui.txtBtn2.autoSize = TextFieldAutoSize.LEFT;
gui.btn2.width = (gui.txtBtn2.width + 22);
gui.txtBtn2.mouseEnabled = false;
restartBtn = new StandardButton();
restartBtn.init(gui.btn2, restart);
update();
}
public function showGameOver():void{
gameOver = new mcGameover();
addChild(gameOver);
var ch:Function = function (e:MouseEvent):void{
GameEngine.instance.reStart();
hideGameOver();
};
gameOver.txtBtn.mouseEnabled = false;
gameOver.btn.addEventListener(MouseEvent.CLICK, ch);
gameOver.btn.buttonMode = true;
gameOver.txtBtnFinish.mouseEnabled = false;
gameOver.btnFinish.addEventListener(MouseEvent.CLICK, finish);
gameOver.btnFinish.buttonMode = true;
gameOver.txtHeadline.text = FillerMain.inst.getSnippet("END_HEADLINE");
gameOver.txtText.text = FillerMain.inst.getSnippet("END");
gameOver.txtBtn.text = FillerMain.inst.getSnippet("BTN_PLAYAGAIN");
if (FillerMain.inst.isStandAlone()){
gameOver.txtBtnFinish.text = FillerMain.inst.getSnippet("PLAY_CHAT");
} else {
gameOver.txtBtnFinish.text = FillerMain.inst.getSnippet("END_BTN");
};
}
private function finish(e:MouseEvent):void{
FillerMain.inst.finishGame();
}
private function hideGameOver():void{
if (!gameOver){
return;
};
removeChild(gameOver);
gameOver = null;
}
public function showNextLevelView():void{
nextLevel = new mcLevelComplete();
addChild(nextLevel);
var ch:Function = function (e:MouseEvent):void{
GameEngine.instance.startNextLevel();
hideNextLevelView();
};
nextLevel.txtBtn.mouseEnabled = false;
nextLevel.btn.addEventListener(MouseEvent.CLICK, ch);
nextLevel.btn.buttonMode = true;
nextLevel.txtHeadline.text = FillerMain.inst.getSnippet("LEVELUP_HEADLINE");
nextLevel.txtText.text = FillerMain.inst.getSnippet("LEVELUP");
nextLevel.txtBtn.text = FillerMain.inst.getSnippet("LEVELUP_BTN");
}
public function showIntro():void{
gui.visible = false;
intro = new mcIntro();
addChild(intro);
var ch:Function = function (e:MouseEvent):void{
GameEngine.instance.reStart();
hideIntro();
};
intro.txtBtn.mouseEnabled = false;
intro.btn.addEventListener(MouseEvent.CLICK, ch);
intro.btn.buttonMode = true;
intro.txtHeadline.text = FillerMain.inst.getSnippet("INTRO_HEADLINE");
intro.txtText.text = FillerMain.inst.getSnippet("INTRO");
intro.txtBtn.text = FillerMain.inst.getSnippet("INTRO_BTN");
}
}
}//package com.pandaland.games.filler
Section 20
//SoundController (com.pandaland.games.filler.SoundController)
package com.pandaland.games.filler {
import flash.utils.*;
import flash.events.*;
import flash.media.*;
public class SoundController {
private var sounds:Object;
private var channels:Object;
private static var fadeTimer:Timer;
private static var instance:SoundController;
private static var loopVolume:Number;
public function SoundController(){
super();
init();
}
private function _destroy():void{
if (SoundChannel(instance.channels.explosion) != null){
SoundChannel(instance.channels.explosion).stop();
};
if (SoundChannel(instance.channels.grow) != null){
SoundChannel(instance.channels.grow).stop();
};
if (SoundChannel(instance.channels.gameOver) != null){
SoundChannel(instance.channels.gameOver).stop();
};
if (SoundChannel(instance.channels.lvlUp) != null){
SoundChannel(instance.channels.lvlUp).stop();
};
if (SoundChannel(instance.channels.loop) != null){
SoundChannel(instance.channels.loop).stop();
};
}
private function init():void{
sounds = {};
sounds.explosion = new sndExplosion();
sounds.grow = new sndGrow();
sounds.gameOver = new sndOver();
sounds.lvlUp = new sndLevelUp();
sounds.loop = new sndLoop();
channels = {};
}
public static function destroy():void{
if (instance != null){
instance._destroy();
instance.sounds = null;
instance.channels = null;
instance = null;
};
}
public static function playExplosion():void{
instance.channels.explosion = instance.sounds.explosion.play();
var t:SoundTransform = SoundChannel(instance.channels.explosion).soundTransform;
t.volume = 0.8;
SoundChannel(instance.channels.explosion).soundTransform = t;
}
public static function stopGrow():void{
SoundChannel(instance.channels.grow).stop();
}
public static function fadeInLoop():void{
if (instance.channels.loop){
SoundChannel(instance.channels.loop).stop();
};
instance.channels.loop = Sound(instance.sounds.loop).play(0, int.MAX_VALUE);
var t:SoundTransform = SoundChannel(instance.channels.loop).soundTransform;
t.volume = 0;
SoundChannel(instance.channels.loop).soundTransform = t;
loopVolume = 0;
if (fadeTimer){
fadeTimer.stop();
};
fadeTimer = new Timer(100, 10);
fadeTimer.addEventListener(TimerEvent.TIMER, fadeInLoopTick);
fadeTimer.start();
}
public static function playGrow():void{
instance.channels.grow = instance.sounds.grow.play();
var t:SoundTransform = SoundChannel(instance.channels.grow).soundTransform;
t.volume = 0.7;
SoundChannel(instance.channels.grow).soundTransform = t;
}
public static function getInstance():SoundController{
if (instance == null){
instance = new (SoundController);
};
return (instance);
}
public static function playLvlUp():void{
instance.channels.lvlUp = instance.sounds.lvlUp.play();
}
private static function fadeInLoopTick(e:TimerEvent):void{
loopVolume = (loopVolume + 0.1);
var t:SoundTransform = SoundChannel(instance.channels.loop).soundTransform;
t.volume = loopVolume;
SoundChannel(instance.channels.loop).soundTransform = t;
}
private static function fadeOutLoopTick(e:TimerEvent):void{
loopVolume = (loopVolume - 0.1);
var t:SoundTransform = SoundChannel(instance.channels.loop).soundTransform;
t.volume = loopVolume;
SoundChannel(instance.channels.loop).soundTransform = t;
}
public static function fadeOutLoop():void{
if (fadeTimer){
fadeTimer.stop();
};
fadeTimer = new Timer(100, 10);
fadeTimer.addEventListener(TimerEvent.TIMER, fadeOutLoopTick);
fadeTimer.start();
}
public static function playGameOver():void{
instance.channels.gameOver = instance.sounds.gameOver.play();
}
}
}//package com.pandaland.games.filler
Section 21
//AbstractGame (com.pandaland.games.AbstractGame)
package com.pandaland.games {
import flash.utils.*;
import flash.display.*;
import flash.events.*;
import de.scriptlibs.util.*;
import com.pandaland.events.*;
import flash.net.*;
public class AbstractGame extends Sprite implements IGames {
protected var pScore:Number;
protected var pSnippets:XMLList;
protected var pID:String;
protected var pStandAlone:Boolean;
protected var pPartnerID:String;
protected var pDomain:String;
protected var pLangs:Object;
protected var pLangID:String;
protected var pForwards:Object;
protected var pTarget:String;
protected var pForward:String;
private static const DEF_LANG:String = "EN";
private static const DEF_PARTNER:String = "0";
public function AbstractGame(tID:String){
super();
pLangs = {};
pID = tID;
pStandAlone = !((stage == null));
pScore = 0;
pTarget = "_blank";
pForwards = {DE:"http://www.panfu.de", NL:"http://www.panfu.nl", ES:"http://www.panfu.es", FR:"http://www.panfu.fr", PL:"http://www.panfu.pl", EN:"http://www.panfu.com", US:"http://www.panfu.com"};
initStandAlone();
}
protected function get langID():String{
return (pLangID);
}
protected function set langID(tLangID:String):void{
pLangID = tLangID.toUpperCase();
}
private function initStandAlone():void{
var tURL:String;
var tParams:Object;
var tConf:Dictionary;
var tLangPartnerData:Object;
if (pStandAlone){
tURL = loaderInfo.url;
tParams = loaderInfo.parameters;
pDomain = identifyDomain(tURL);
pTarget = ((tParams.target) || (pTarget));
pPartnerID = DEF_PARTNER;
if (tParams.langId != null){
tConf = new Dictionary();
tConf["lang"] = tParams.langId;
init(tConf);
} else {
initLangs();
tLangPartnerData = getLangAndPartnerFromURL(tURL.substring((tURL.lastIndexOf("/") + 1), tURL.length));
langID = tLangPartnerData.langID;
pPartnerID = tLangPartnerData.partnerID;
onSnippetsLoaded(getSnippets(this.langID));
};
pForward = ((tParams.forward) || (pForwards[this.langID]));
};
}
private function onSnippetsLoaded(tSnippets:XMLList):void{
SnippetManager.init(pID, tSnippets);
startGame();
}
protected function initLangs():void{
}
public function init(tData:Dictionary):void{
pLangID = ((tData["lang"]) || (DEF_LANG));
var tPath:String = ((tData["snippets"]) || (Strings.parse("swf/games/$$id$$/conf/filler_text_snippets_$$lang$$.xml", {id:pID, lang:pLangID})));
XMLLoader.load(onSnippetsLoaded, onErrorLoading, tPath);
}
public function handleStandAloneFinish():void{
var tForward:String;
if (pStandAlone){
tForward = ((((((pForward + "?partnerId=") + pPartnerID) + "&domain=") + pDomain) + "_") + pID);
navigateToURL(new URLRequest(tForward), pTarget);
};
}
private function onErrorLoading(tEvent:IOErrorEvent):void{
trace(tEvent);
}
public function finishGame():void{
if (isStandAlone()){
handleStandAloneFinish();
} else {
dispatchEvent(new GameEvent(GameEvent.FINISHED));
};
}
public function getSnippet(tPath:String, tParams:Object=null):String{
return (SnippetManager.getSnippet(pID, tPath, tParams));
}
public function getDisplayObject():DisplayObject{
return (this);
}
private function getSnippets(tLangID:String):XMLList{
return (XMLList(pLangs[tLangID]));
}
public function isStandAlone():Boolean{
return (pStandAlone);
}
private function identifyDomain(tURL:String):String{
var tPath:String = tURL.split("//")[1];
var tDomain:String = ((tPath.split("/")[0]) || ("localhost"));
return (tDomain);
}
protected function startGame():void{
}
private function getLangAndPartnerFromURL(tURL:String):Object{
var tLangID:String;
var tPartnerID:String;
var i:int;
var tSplitURL:Array = tURL.split("_");
if (tSplitURL.length >= 2){
tSplitURL = tSplitURL.splice((tSplitURL.length - 2), tSplitURL.length);
i = 0;
while (i < tSplitURL.length) {
if (!isNaN(parseInt(tSplitURL[i]))){
tPartnerID = parseInt(tSplitURL[i]).toString();
tLangID = tSplitURL[(1 - i)].substring(0, ((tSplitURL[(1 - i)].indexOf(".") > -1)) ? tSplitURL[(1 - i)].indexOf(".") : tSplitURL[(1 - i)].length);
break;
};
tLangID = tSplitURL[(tSplitURL.length - 1)].substring(0, tSplitURL[(tSplitURL.length - 1)].indexOf("."));
tLangID = ((tLangID.length <= 3)) ? tLangID : DEF_LANG;
i++;
};
} else {
return ({partnerID:DEF_PARTNER, langID:DEF_LANG});
};
return ({partnerID:(tPartnerID) ? tPartnerID : DEF_PARTNER, langID:(tLangID) ? tLangID : DEF_LANG});
}
public function addScore(tScore:Number):void{
trace("Filler game AbstractGame addScore() is not sending MATCH_RESULT event");
pScore = (pScore + tScore);
}
public function destroy():void{
pScore = 0;
}
public function getPoints():Number{
return (pScore);
}
}
}//package com.pandaland.games
Section 22
//IGames (com.pandaland.games.IGames)
package com.pandaland.games {
import flash.utils.*;
import flash.display.*;
public interface IGames {
function init(:Dictionary):void;
function getPoints():Number;
function destroy():void;
function getDisplayObject():DisplayObject;
}
}//package com.pandaland.games
Section 23
//StandardButton (de.dib.ui.StandardButton)
package de.dib.ui {
import flash.display.*;
import flash.events.*;
import com.pandaland.games.filler.caurina.transitions.*;
public class StandardButton {
private var action:Function;
private var gfx:Sprite;
public function StandardButton(){
super();
}
public function init(gfx:Sprite, action:Function):void{
this.action = action;
this.gfx = gfx;
gfx.buttonMode = true;
gfx.addEventListener(MouseEvent.ROLL_OVER, rollOver);
gfx.addEventListener(MouseEvent.ROLL_OUT, rollOut);
gfx.addEventListener(MouseEvent.CLICK, click);
}
private function rollOut(e:MouseEvent):void{
Tweener.addTween(gfx, {_brightness:0, time:0.3});
}
private function click(e:MouseEvent):void{
action();
}
private function rollOver(e:MouseEvent):void{
Tweener.addTween(gfx, {_brightness:0.199, time:0.3});
}
}
}//package de.dib.ui
Section 24
//Events (de.scriptlibs.event.Events)
package de.scriptlibs.event {
import flash.events.*;
public class Events {
private var pEvents:Object;
public function Events():void{
super();
pEvents = {};
}
public function hasEvent(tID:String):Boolean{
return (!((pEvents[tID] == undefined)));
}
public function add(tDispatcher:IEventDispatcher, tType:String, tListener:Function, tID:String=null, tActive:Boolean=true, tUseCapture:Boolean=false, tPriority:int=0, tUseWeak:Boolean=true):void{
tID = ((tID) || (tType));
if (pEvents[tID]){
throw (new Error(((tID + " is already a registered event by ") + pEvents[tID])));
};
pEvents[tID] = new EventData(tDispatcher, tType, tListener, tActive, tUseCapture, tPriority, tUseWeak);
}
public function remove(tID:String):void{
var tEvent:EventData = pEvents[tID];
if (tEvent != null){
tEvent.remove();
delete pEvents[tID];
};
}
public function activate(tID:String, tActive:Boolean=true):void{
var tEvent:EventData = pEvents[tID];
if (tEvent != null){
if (tActive){
tEvent.add();
} else {
tEvent.remove();
};
};
}
public function removeAll():void{
var tID:String;
for (tID in pEvents) {
remove(tID);
};
}
}
}//package de.scriptlibs.event
import flash.events.*;
class EventData {
private var pListener:Function;
private var pType:String;
private var pUseWeak:Boolean;
private var pPriority:int;
private var pUseCapture:Boolean;
private var pDispatcher:IEventDispatcher;
private function EventData(tDispatcher:IEventDispatcher, tType:String, tListener:Function, tActive:Boolean, tUseCapture:Boolean, tPriority:int=0, tUseWeak:Boolean=true){
super();
pDispatcher = tDispatcher;
pType = tType;
pListener = tListener;
pUseCapture = tUseCapture;
pPriority = tPriority;
pUseWeak = tUseWeak;
if (tActive){
add();
};
}
public function add():void{
pDispatcher.addEventListener(pType, pListener, pUseCapture, pPriority, pUseWeak);
}
public function remove():void{
pDispatcher.removeEventListener(pType, pListener, pUseCapture);
}
}
Section 25
//Arrays (de.scriptlibs.util.Arrays)
package de.scriptlibs.util {
public class Arrays {
public function Arrays(){
super();
}
public static function findAll(tArray:Array, tCriteria:Object):Array{
var tItem:Object;
var tKey:String;
var tResult:Array = [];
for each (tItem in tArray) {
for (tKey in tCriteria) {
if (tItem[tKey] != tCriteria[tKey]){
break;
};
tResult.push(tItem);
};
};
return (tResult);
}
public static function find(tArray:Array, tCriteria:Object):Object{
var tItem:Object;
var tKey:String;
for each (tItem in tArray) {
for (tKey in tCriteria) {
if (tItem[tKey] != tCriteria[tKey]){
break;
};
return (tItem);
};
};
return (null);
}
public static function remove(tArray:Array, tObject:Object):void{
var tPos:int = tArray.indexOf(tObject);
if (tPos >= 0){
tArray.splice(tPos, 1);
};
}
public static function last(tArray:Array):Object{
return (tArray[(tArray.length - 1)]);
}
}
}//package de.scriptlibs.util
Section 26
//SnippetManager (de.scriptlibs.util.SnippetManager)
package de.scriptlibs.util {
public class SnippetManager {
private static var sSnippets:Object = {};
public function SnippetManager(){
super();
}
public static function init(tID:String, tSnippets:XMLList, tPaths:XMLList=null):void{
sSnippets[tID] = new Snippets(tSnippets, tPaths);
}
public static function getSnippets(tID:String):Snippets{
return (sSnippets[tID]);
}
public static function getSnippet(tID:String, tPath:String, tParams:Object=null):String{
return ((getSnippets(tID)) ? getSnippets(tID).getSnippet(tPath, tParams) : "");
}
}
}//package de.scriptlibs.util
Section 27
//Snippets (de.scriptlibs.util.Snippets)
package de.scriptlibs.util {
public class Snippets {
private var pSnippets:XMLList;
private static const PATH_SEP:String = "/";
private static const SNIPPET_SEP:String = "$$";
private static var sPaths:XMLList;
private static var sPathFinder:RegExp;
public function Snippets(tSnippets:XMLList, tPaths:XMLList=null){
super();
sPathFinder = /(\$\$(\/.*?)\$\$)/g;
sPaths = tPaths;
pSnippets = tSnippets;
}
private function findSnippet(tPath:String):String{
var tName:String;
var tSnippets:XMLList = pSnippets;
var tList:Array = tPath.split(PATH_SEP);
for each (tName in tList) {
tSnippets = tSnippets[tName];
};
return (Strings.parseSnippet(tSnippets.toString(), sPathFinder, sPaths));
}
public function getSnippet(tPath:String, tParams:Object=null):String{
var tSnippet:String = findSnippet(tPath);
if (tSnippet != null){
return (Strings.parse(tSnippet, tParams));
};
return (null);
}
}
}//package de.scriptlibs.util
Section 28
//Strings (de.scriptlibs.util.Strings)
package de.scriptlibs.util {
public class Strings {
private static const PATH_SEP:String = "/";
private static const SEP:String = "$$";
private static var sPaths:XMLList;
private static var sPathFinder:RegExp;
public function Strings(){
super();
}
public static function checkEmailAddress(tAddress:String):int{
var tDomainPart:String;
var tEnd:uint;
var tChars:String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@-_.";
if (!tAddress){
return (-11);
};
var i:uint;
while (i < tAddress.length) {
if (tChars.indexOf(tAddress.charAt(i)) == -1){
return (-1);
};
i++;
};
if (tChars.indexOf("@") == -1){
return (-2);
};
var tParts:Array = tAddress.split("@");
if (tParts.length != 2){
return (-3);
};
if ((((tParts[0].length < 1)) || ((tParts[0].length > 64)))){
return (-4);
};
if ((((tParts[1].length < 5)) || ((tParts[0].length > 0xFF)))){
return (-5);
};
if (tParts[0].charAt(0) == "."){
return (-6);
};
if (tParts[0].charAt((tParts[0].length - 1)) == "."){
return (-7);
};
if (tParts[1].indexOf(".") == -1){
return (-8);
};
var tDomainParts:Array = tParts[1].split(".");
for each (tDomainPart in tDomainParts) {
if (tDomainPart.length < 2){
return (-9);
};
};
tEnd = tDomainParts[(tDomainParts.length - 1)].length;
if ((((tEnd < 2)) || ((tEnd > 4)))){
return (-10);
};
return (1);
}
public static function trim(tString:String):String{
return (tString.replace(/^(\s*(.*?)\s*)$/smg, "$2"));
}
public static function parseSnippet(tSnippet:String, tPathFinder:RegExp, tPaths:XMLList=null):String{
sPaths = tPaths;
sPathFinder = tPathFinder;
tSnippet = tSnippet.replace(sPathFinder, resolvePath);
return (tSnippet);
}
protected static function resolvePath():String{
var tNode:XMLList;
var tList:Array;
var tName:String;
var tPath:String = arguments[2];
var tResult:String = "";
if ((((tPath.indexOf(PATH_SEP) == 0)) && (!((sPaths == null))))){
tNode = sPaths;
tList = tPath.split(PATH_SEP);
tList.shift();
for each (tName in tList) {
tNode = tNode[tName];
};
tResult = tNode.toString();
};
tResult = parseSnippet(tResult, sPathFinder);
return (tResult);
}
public static function parse(tString:String, tParams:Object=null, tSep:String="$$"):String{
var tKey:String;
var tList:Array;
for (tKey in tParams) {
tList = tString.split(((tSep + tKey) + tSep));
tString = tList.join(tParams[tKey]);
};
return (tString);
}
}
}//package de.scriptlibs.util
Section 29
//XMLLoader (de.scriptlibs.util.XMLLoader)
package de.scriptlibs.util {
import flash.events.*;
import flash.net.*;
import de.scriptlibs.event.*;
public class XMLLoader {
private var pLoader:URLLoader;
private var pEvents:Events;
private var pDestroy:Boolean;
private var pSuccessHandler:Function;
private var pErrorHandler:Function;
private var pRequest:URLRequest;
private static var sLoaders:Array = [];
public function XMLLoader(tSuccessHandler:Function, tErrorHandler:Function, tPath:String="", tDestroy:Boolean=true){
super();
pSuccessHandler = tSuccessHandler;
pErrorHandler = tErrorHandler;
pDestroy = tDestroy;
pLoader = new URLLoader();
pEvents = new Events();
pEvents.add(pLoader, Event.COMPLETE, onLoadComplete);
pEvents.add(pLoader, IOErrorEvent.IO_ERROR, onLoadError);
if (tPath != ""){
load(tPath);
};
}
private function onLoadComplete(tEvent:Event):void{
var tData:XMLList;
var tEvent = tEvent;
tData = new XMLList(tEvent.target.data);
tData.ignoreWhitespace = true;
tData.ignoreComments = true;
//unresolved jump
var _slot1 = tError;
trace(pRequest.url);
trace(_slot1);
finishLoading();
if (pSuccessHandler != null){
pSuccessHandler(tData);
};
}
public function load(tPath:String):void{
if (pRequest == null){
pRequest = new URLRequest(tPath);
pLoader.load(pRequest);
};
}
private function finishLoading():void{
pRequest = null;
if (pDestroy){
destroy();
};
}
public function destroy(tForce:Boolean=false):void{
if (((tForce) || ((pRequest == null)))){
pEvents.removeAll();
Arrays.remove(sLoaders, this);
} else {
pDestroy = true;
};
}
private function onLoadError(tEvent:IOErrorEvent):void{
finishLoading();
if (pErrorHandler != null){
pErrorHandler(tEvent);
};
}
public static function create(tSuccessHandler:Function, tErrorHandler:Function, tPath:String=""):XMLLoader{
return (new XMLLoader(tSuccessHandler, tErrorHandler, tPath, false));
}
public static function load(tSuccessHandler:Function, tErrorHandler:Function, tPath:String=""):void{
sLoaders.push(new XMLLoader(tSuccessHandler, tErrorHandler, tPath, true));
}
}
}//package de.scriptlibs.util
Section 30
//AbstractCollection (org.cove.ape.AbstractCollection)
package org.cove.ape {
import flash.utils.*;
import flash.display.*;
public class AbstractCollection {
private var _sprite:Sprite;
private var _particles:Array;
private var _isParented:Boolean;
private var _constraints:Array;
public function AbstractCollection(){
super();
if (getQualifiedClassName(this) == "org.cove.ape::AbstractCollection"){
throw (new ArgumentError("AbstractCollection can't be instantiated directly"));
};
_isParented = false;
_particles = new Array();
_constraints = new Array();
}
public function removeConstraint(c:AbstractConstraint):void{
var cpos:int = constraints.indexOf(c);
if (cpos == -1){
return;
};
constraints.splice(cpos, 1);
c.cleanup();
}
public function getAll():Array{
return (particles.concat(constraints));
}
function checkCollisionsVsCollection(ac:AbstractCollection):void{
var pga:AbstractParticle;
var acplen:int;
var x:int;
var acclen:int;
var pgb:AbstractParticle;
var cgb:SpringConstraint;
var cga:SpringConstraint;
var n:int;
var plen:int = _particles.length;
var j:int;
while (j < plen) {
pga = _particles[j];
if (!pga.collidable){
} else {
acplen = ac.particles.length;
x = 0;
while (x < acplen) {
pgb = ac.particles[x];
if (pgb.collidable){
CollisionDetector.test(pga, pgb);
};
x++;
};
acclen = ac.constraints.length;
x = 0;
while (x < acclen) {
cgb = ac.constraints[x];
if (((cgb.collidable) && (!(cgb.isConnectedTo(pga))))){
cgb.scp.updatePosition();
CollisionDetector.test(pga, cgb.scp);
};
x++;
};
};
j++;
};
var clen:int = _constraints.length;
j = 0;
while (j < clen) {
cga = _constraints[j];
if (!cga.collidable){
} else {
acplen = ac.particles.length;
n = 0;
while (n < acplen) {
pgb = ac.particles[n];
if (((pgb.collidable) && (!(cga.isConnectedTo(pgb))))){
cga.scp.updatePosition();
CollisionDetector.test(pgb, cga.scp);
};
n++;
};
};
j++;
};
}
public function get sprite():Sprite{
if (_sprite != null){
return (_sprite);
};
if (APEngine.container == null){
throw (new Error("The container property of the APEngine class has not been set"));
};
_sprite = new Sprite();
APEngine.container.addChild(_sprite);
return (_sprite);
}
function checkInternalCollisions():void{
var pa:AbstractParticle;
var i:int;
var clen:int;
var n:int;
var pb:AbstractParticle;
var c:SpringConstraint;
var plen:int = _particles.length;
var j:int;
while (j < plen) {
pa = _particles[j];
if (pa){
//unresolved if
} else {
i = (j + 1);
while (i < plen) {
pb = _particles[i];
if (((pa) && (pb))){
if (pb.collidable){
CollisionDetector.test(pa, pb);
};
};
i++;
};
clen = _constraints.length;
n = 0;
while (n < clen) {
c = _constraints[n];
if (((c.collidable) && (!(c.isConnectedTo(pa))))){
c.scp.updatePosition();
CollisionDetector.test(pa, c.scp);
};
n++;
};
};
j++;
};
}
public function addParticle(p:AbstractParticle):void{
particles.push(p);
if (isParented){
p.init();
};
}
public function init():void{
var i:int;
while (i < particles.length) {
particles[i].init();
i++;
};
i = 0;
while (i < constraints.length) {
constraints[i].init();
i++;
};
}
function satisfyConstraints():void{
var c:AbstractConstraint;
var len:int = _constraints.length;
var i:int;
while (i < len) {
c = _constraints[i];
c.resolve();
i++;
};
}
function get isParented():Boolean{
return (_isParented);
}
public function paint():void{
var p:AbstractParticle;
var c:SpringConstraint;
var len:int = _particles.length;
var i:int;
while (i < len) {
p = _particles[i];
if (((!(p.fixed)) || (p.alwaysRepaint))){
p.paint();
};
i++;
};
len = _constraints.length;
i = 0;
while (i < len) {
c = _constraints[i];
if (((!(c.fixed)) || (c.alwaysRepaint))){
c.paint();
};
i++;
};
}
public function addConstraint(c:AbstractConstraint):void{
constraints.push(c);
if (isParented){
c.init();
};
}
function set isParented(b:Boolean):void{
_isParented = b;
}
public function removeParticle(p:AbstractParticle):void{
trace(("remove: " + p));
var ppos:int = particles.indexOf(p);
if (ppos == -1){
return;
};
particles.splice(ppos, 1);
p.cleanup();
}
public function cleanup():void{
var i:int;
while (i < particles.length) {
particles[i].cleanup();
i++;
};
i = 0;
while (i < constraints.length) {
constraints[i].cleanup();
i++;
};
}
public function get particles():Array{
return (_particles);
}
function integrate(dt2:Number):void{
var p:AbstractParticle;
var len:int = _particles.length;
var i:int;
while (i < len) {
p = _particles[i];
p.update(dt2);
i++;
};
}
public function get constraints():Array{
return (_constraints);
}
}
}//package org.cove.ape
Section 31
//AbstractConstraint (org.cove.ape.AbstractConstraint)
package org.cove.ape {
import flash.utils.*;
public class AbstractConstraint extends AbstractItem {
private var _stiffness:Number;
public function AbstractConstraint(stiffness:Number){
super();
if (getQualifiedClassName(this) == "org.cove.ape::AbstractConstraint"){
throw (new ArgumentError("AbstractConstraint can't be instantiated directly"));
};
this.stiffness = stiffness;
setStyle();
}
function resolve():void{
}
public function set stiffness(s:Number):void{
_stiffness = s;
}
public function get stiffness():Number{
return (_stiffness);
}
}
}//package org.cove.ape
Section 32
//AbstractItem (org.cove.ape.AbstractItem)
package org.cove.ape {
import flash.display.*;
public class AbstractItem {
var lineAlpha:Number;
var lineColor:uint;
protected var displayObjectOffset:Vector;
var lineThickness:Number;
protected var displayObject:DisplayObject;
var fillAlpha:Number;
private var _sprite:Sprite;
var fillColor:uint;
private var _visible:Boolean;
private var _alwaysRepaint:Boolean;
var displayObjectRotation:Number;
public function AbstractItem(){
super();
_visible = true;
_alwaysRepaint = false;
}
public function setLine(thickness:Number=0, color:uint=0, alpha:Number=1):void{
lineThickness = thickness;
lineColor = color;
lineAlpha = alpha;
}
public function set visible(v:Boolean):void{
_visible = v;
sprite.visible = v;
}
public function setFill(color:uint=0xFFFFFF, alpha:Number=1):void{
fillColor = color;
fillAlpha = alpha;
}
public function init():void{
}
public function get sprite():Sprite{
if (_sprite != null){
return (_sprite);
};
if (APEngine.container == null){
throw (new Error("The container property of the APEngine class has not been set"));
};
_sprite = new Sprite();
APEngine.container.addChild(_sprite);
return (_sprite);
}
public function paint():void{
}
public function cleanup():void{
sprite.graphics.clear();
var i:int;
while (i < sprite.numChildren) {
sprite.removeChildAt(i);
i++;
};
}
public function setStyle(lineThickness:Number=0, lineColor:uint=0, lineAlpha:Number=1, fillColor:uint=0xFFFFFF, fillAlpha:Number=1):void{
setLine(lineThickness, lineColor, lineAlpha);
setFill(fillColor, fillAlpha);
}
public function get visible():Boolean{
return (_visible);
}
final public function set alwaysRepaint(b:Boolean):void{
_alwaysRepaint = b;
}
final public function get alwaysRepaint():Boolean{
return (_alwaysRepaint);
}
}
}//package org.cove.ape
Section 33
//AbstractParticle (org.cove.ape.AbstractParticle)
package org.cove.ape {
import flash.utils.*;
import flash.display.*;
import com.pandaland.games.filler.*;
import com.pandaland.games.filler.caurina.transitions.*;
import com.pandaland.games.filler.elements.*;
public class AbstractParticle extends AbstractItem {
private var _collidable:Boolean;
private var _center:Vector;
private var collision:Collision;
var prev:Vector;
private var _kfr:Number;
var interval:Interval;
private var _invMass:Number;
var curr:Vector;
private var _mass:Number;
private var temp:Vector;
private var _friction:Number;
var samp:Vector;
private var _multisample:int;
private var _fixed:Boolean;
protected var forces:Vector;
public function AbstractParticle(x:Number, y:Number, isFixed:Boolean, mass:Number, elasticity:Number, friction:Number){
super();
if (getQualifiedClassName(this) == "org.cove.ape::AbstractParticle"){
throw (new ArgumentError("AbstractParticle can't be instantiated directly"));
};
interval = new Interval(0, 0);
curr = new Vector(x, y);
prev = new Vector(x, y);
samp = new Vector();
temp = new Vector();
fixed = isFixed;
forces = new Vector();
collision = new Collision(new Vector(), new Vector());
collidable = true;
this.mass = mass;
this.elasticity = elasticity;
this.friction = friction;
setStyle();
_center = new Vector();
_multisample = 0;
}
private function destroy():void{
GameEngine.removeBall(this);
}
function get invMass():Number{
return ((fixed) ? 0 : _invMass);
}
public function get px():Number{
return (curr.x);
}
public function get py():Number{
return (curr.y);
}
public function setDisplay(d:DisplayObject, offsetX:Number=0, offsetY:Number=0, rotation:Number=0):void{
displayObject = d;
displayObjectRotation = rotation;
displayObjectOffset = new Vector(offsetX, offsetY);
}
public function set px(x:Number):void{
curr.x = x;
prev.x = x;
}
public function set py(y:Number):void{
curr.y = y;
prev.y = y;
}
function getComponents(collisionNormal:Vector):Collision{
var vel:Vector = velocity;
var vdotn:Number = collisionNormal.dot(vel);
collision.vn = collisionNormal.mult(vdotn);
collision.vt = vel.minus(collision.vn);
return (collision);
}
public function get mass():Number{
return (_mass);
}
function initDisplay():void{
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
sprite.addChild(displayObject);
}
public function get multisample():int{
return (_multisample);
}
public function get position():Vector{
return (new Vector(curr.x, curr.y));
}
function resolveCollision(mtd:Vector, vel:Vector, n:Vector, d:Number, o:int, p:AbstractParticle):void{
curr.plusEquals(mtd);
velocity = vel;
if ((this is UserBall)){
if ((p is EnemyBall)){
if (UserBall(this).growing){
GameEngine.instance.looseLife();
SoundController.playExplosion();
SoundController.stopGrow();
collidable = false;
Tweener.addTween(sprite, {_color:0xFF0000, time:0.2});
Tweener.addTween(sprite, {_scale:3.5, alpha:0, time:0.5, onComplete:destroy});
};
} else {
if (UserBall(this).growing){
if (p.fixed == false){
GameEngine.stopBallGrowing();
} else {
if (UserBall(this).radius > ((GameEngine.HEIGHT / 2) - 10)){
GameEngine.stopBallGrowing();
};
};
};
};
};
}
public function get elasticity():Number{
return (_kfr);
}
public function addMasslessForce(f:Vector):void{
forces.plusEquals(f);
}
public function set collidable(b:Boolean):void{
_collidable = b;
}
public function set velocity(v:Vector):void{
prev = curr.minus(v);
}
public function set multisample(m:int):void{
_multisample = m;
}
public function addForce(f:Vector):void{
forces.plusEquals(f.mult(invMass));
}
public function set position(p:Vector):void{
curr.copy(p);
prev.copy(p);
}
public function get center():Vector{
_center.setTo(px, py);
return (_center);
}
public function update(dt2:Number):void{
if (fixed){
return;
};
addForce(APEngine.force);
addMasslessForce(APEngine.masslessForce);
temp.copy(curr);
var nv:Vector = velocity.plus(forces.multEquals(dt2));
curr.plusEquals(nv.multEquals(APEngine.damping));
prev.copy(temp);
forces.setTo(0, 0);
}
public function get velocity():Vector{
return (curr.minus(prev));
}
public function getForces():Vector{
return (forces);
}
public function get collidable():Boolean{
return (_collidable);
}
public function set mass(m:Number):void{
if (m <= 0){
throw (new ArgumentError("mass may not be set <= 0"));
};
_mass = m;
_invMass = (1 / _mass);
}
public function getCurrentVector():Vector{
return (curr);
}
public function set fixed(f:Boolean):void{
_fixed = f;
}
public function set elasticity(k:Number):void{
_kfr = k;
}
public function set friction(f:Number):void{
if ((((f < 0)) || ((f > 1)))){
throw (new ArgumentError("Legal friction must be >= 0 and <=1"));
};
_friction = f;
}
public function get friction():Number{
return (_friction);
}
public function get fixed():Boolean{
return (_fixed);
}
}
}//package org.cove.ape
Section 34
//APEngine (org.cove.ape.APEngine)
package org.cove.ape {
import flash.display.*;
public final class APEngine {
private static var _container:DisplayObjectContainer;
private static var _damping:Number;
private static var _constraintCollisionCycles:int;
private static var groups:Array;
static var masslessForce:Vector;
private static var _constraintCycles:int;
static var force:Vector;
private static var timeStep:Number;
private static var numGroups:int;
public function APEngine(){
super();
}
public static function get container():DisplayObjectContainer{
return (_container);
}
public static function get constraintCollisionCycles():int{
return (_constraintCollisionCycles);
}
public static function set damping(d:Number):void{
_damping = d;
}
public static function step():void{
integrate();
var j:int;
while (j < _constraintCycles) {
satisfyConstraints();
j++;
};
var i:int;
while (i < _constraintCollisionCycles) {
satisfyConstraints();
checkCollisions();
i++;
};
}
public static function init(dt:Number=0.25):void{
timeStep = (dt * dt);
numGroups = 0;
groups = new Array();
force = new Vector(0, 0);
masslessForce = new Vector(0, 0);
damping = 1;
_constraintCycles = 0;
_constraintCollisionCycles = 1;
}
public static function get constraintCycles():int{
return (_constraintCycles);
}
public static function set constraintCollisionCycles(numCycles:int):void{
_constraintCollisionCycles = numCycles;
}
public static function set constraintCycles(numCycles:int):void{
_constraintCycles = numCycles;
}
public static function addForce(v:Vector):void{
force.plusEquals(v);
}
public static function get damping():Number{
return (_damping);
}
public static function set container(d:DisplayObjectContainer):void{
_container = d;
}
public static function addGroup(g:Group):void{
groups.push(g);
g.isParented = true;
numGroups++;
g.init();
}
public static function removeGroup(g:Group):void{
var gpos:int = groups.indexOf(g);
if (gpos == -1){
return;
};
groups.splice(gpos, 1);
g.isParented = false;
numGroups--;
g.cleanup();
}
public static function paint():void{
var g:Group;
var j:int;
while (j < numGroups) {
g = groups[j];
g.paint();
j++;
};
}
private static function checkCollisions():void{
var g:Group;
var j:int;
while (j < numGroups) {
g = groups[j];
g.checkCollisions();
j++;
};
}
private static function integrate():void{
var g:Group;
var j:int;
while (j < numGroups) {
g = groups[j];
g.integrate(timeStep);
j++;
};
}
private static function satisfyConstraints():void{
var g:Group;
var j:int;
while (j < numGroups) {
g = groups[j];
g.satisfyConstraints();
j++;
};
}
public static function addMasslessForce(v:Vector):void{
masslessForce.plusEquals(v);
}
}
}//package org.cove.ape
Section 35
//CircleParticle (org.cove.ape.CircleParticle)
package org.cove.ape {
public class CircleParticle extends AbstractParticle {
private var _radius:Number;
public function CircleParticle(x:Number, y:Number, radius:Number, fixed:Boolean=false, mass:Number=1, elasticity:Number=0.3, friction:Number=0){
super(x, y, fixed, mass, elasticity, friction);
_radius = radius;
}
override public function init():void{
cleanup();
if (displayObject != null){
initDisplay();
} else {
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawCircle(0, 0, radius);
sprite.graphics.endFill();
};
paint();
}
public function set radius(r:Number):void{
_radius = r;
}
function getProjection(axis:Vector):Interval{
var c:Number = samp.dot(axis);
interval.min = (c - _radius);
interval.max = (c + _radius);
return (interval);
}
function getIntervalY():Interval{
interval.min = (curr.y - _radius);
interval.max = (curr.y + _radius);
return (interval);
}
public function get radius():Number{
return (_radius);
}
function getIntervalX():Interval{
interval.min = (curr.x - _radius);
interval.max = (curr.x + _radius);
return (interval);
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
}
}
}//package org.cove.ape
Section 36
//Collision (org.cove.ape.Collision)
package org.cove.ape {
import org.cove.ape.*;
final class Collision {
var vn:Vector;
var vt:Vector;
function Collision(vn:Vector, vt:Vector){
super();
this.vn = vn;
this.vt = vt;
}
}
}//package org.cove.ape
Section 37
//CollisionDetector (org.cove.ape.CollisionDetector)
package org.cove.ape {
import org.cove.ape.*;
final class CollisionDetector {
function CollisionDetector(){
super();
}
private static function testOBBvsCircle(ra:RectangleParticle, ca:CircleParticle):Boolean{
var collisionNormal:Vector;
var boxAxis:Vector;
var depth:Number;
var vertex:Vector;
var mag:Number;
var collisionDepth:Number = Number.POSITIVE_INFINITY;
var depths:Array = new Array(2);
var i:int;
while (i < 2) {
boxAxis = ra.axes[i];
depth = testIntervals(ra.getProjection(boxAxis), ca.getProjection(boxAxis));
if (depth == 0){
return (false);
};
if (Math.abs(depth) < Math.abs(collisionDepth)){
collisionNormal = boxAxis;
collisionDepth = depth;
};
depths[i] = depth;
i++;
};
var r:Number = ca.radius;
if ((((Math.abs(depths[0]) < r)) && ((Math.abs(depths[1]) < r)))){
vertex = closestVertexOnOBB(ca.samp, ra);
collisionNormal = vertex.minus(ca.samp);
mag = collisionNormal.magnitude();
collisionDepth = (r - mag);
if (collisionDepth > 0){
collisionNormal.divEquals(mag);
} else {
return (false);
};
};
CollisionResolver.resolveParticleParticle(ra, ca, collisionNormal, collisionDepth);
return (true);
}
static function test(objA:AbstractParticle, objB:AbstractParticle):void{
if (((objA.fixed) && (objB.fixed))){
return;
};
if ((((objA.multisample == 0)) && ((objB.multisample == 0)))){
normVsNorm(objA, objB);
} else {
if ((((objA.multisample > 0)) && ((objB.multisample == 0)))){
sampVsNorm(objA, objB);
} else {
if ((((objB.multisample > 0)) && ((objA.multisample == 0)))){
sampVsNorm(objB, objA);
} else {
if (objA.multisample == objB.multisample){
sampVsSamp(objA, objB);
} else {
normVsNorm(objA, objB);
};
};
};
};
}
private static function testIntervals(intervalA:Interval, intervalB:Interval):Number{
if (intervalA.max < intervalB.min){
return (0);
};
if (intervalB.max < intervalA.min){
return (0);
};
var lenA:Number = (intervalB.max - intervalA.min);
var lenB:Number = (intervalB.min - intervalA.max);
return (((Math.abs(lenA))<Math.abs(lenB)) ? lenA : lenB);
}
private static function normVsNorm(objA:AbstractParticle, objB:AbstractParticle):void{
objA.samp.copy(objA.curr);
objB.samp.copy(objB.curr);
testTypes(objA, objB);
}
private static function testCirclevsCircle(ca:CircleParticle, cb:CircleParticle):Boolean{
var depthX:Number = testIntervals(ca.getIntervalX(), cb.getIntervalX());
if (depthX == 0){
return (false);
};
var depthY:Number = testIntervals(ca.getIntervalY(), cb.getIntervalY());
if (depthY == 0){
return (false);
};
var collisionNormal:Vector = ca.samp.minus(cb.samp);
var mag:Number = collisionNormal.magnitude();
var collisionDepth:Number = ((ca.radius + cb.radius) - mag);
if (collisionDepth > 0){
collisionNormal.divEquals(mag);
CollisionResolver.resolveParticleParticle(ca, cb, collisionNormal, collisionDepth);
return (true);
};
return (false);
}
private static function testTypes(objA:AbstractParticle, objB:AbstractParticle):Boolean{
if ((((objA is RectangleParticle)) && ((objB is RectangleParticle)))){
return (testOBBvsOBB((objA as RectangleParticle), (objB as RectangleParticle)));
};
if ((((objA is CircleParticle)) && ((objB is CircleParticle)))){
return (testCirclevsCircle((objA as CircleParticle), (objB as CircleParticle)));
};
if ((((objA is RectangleParticle)) && ((objB is CircleParticle)))){
return (testOBBvsCircle((objA as RectangleParticle), (objB as CircleParticle)));
};
if ((((objA is CircleParticle)) && ((objB is RectangleParticle)))){
return (testOBBvsCircle((objB as RectangleParticle), (objA as CircleParticle)));
};
return (false);
}
private static function sampVsNorm(objA:AbstractParticle, objB:AbstractParticle):void{
var s:Number = (1 / (objA.multisample + 1));
var t:Number = s;
objB.samp.copy(objB.curr);
var i:int;
while (i <= objA.multisample) {
objA.samp.setTo((objA.prev.x + (t * (objA.curr.x - objA.prev.x))), (objA.prev.y + (t * (objA.curr.y - objA.prev.y))));
if (testTypes(objA, objB)){
return;
};
t = (t + s);
i++;
};
}
private static function closestVertexOnOBB(p:Vector, r:RectangleParticle):Vector{
var dist:Number;
var d:Vector = p.minus(r.samp);
var q:Vector = new Vector(r.samp.x, r.samp.y);
var i:int;
while (i < 2) {
dist = d.dot(r.axes[i]);
if (dist >= 0){
dist = r.extents[i];
} else {
if (dist < 0){
dist = -(r.extents[i]);
};
};
q.plusEquals(r.axes[i].mult(dist));
i++;
};
return (q);
}
private static function testOBBvsOBB(ra:RectangleParticle, rb:RectangleParticle):Boolean{
var collisionNormal:Vector;
var axisA:Vector;
var depthA:Number;
var axisB:Vector;
var depthB:Number;
var absA:Number;
var absB:Number;
var altb:Boolean;
var collisionDepth:Number = Number.POSITIVE_INFINITY;
var i:int;
while (i < 2) {
axisA = ra.axes[i];
depthA = testIntervals(ra.getProjection(axisA), rb.getProjection(axisA));
if (depthA == 0){
return (false);
};
axisB = rb.axes[i];
depthB = testIntervals(ra.getProjection(axisB), rb.getProjection(axisB));
if (depthB == 0){
return (false);
};
absA = Math.abs(depthA);
absB = Math.abs(depthB);
if ((((absA < Math.abs(collisionDepth))) || ((absB < Math.abs(collisionDepth))))){
altb = (absA < absB);
collisionNormal = (altb) ? axisA : axisB;
collisionDepth = (altb) ? depthA : depthB;
};
i++;
};
CollisionResolver.resolveParticleParticle(ra, rb, collisionNormal, collisionDepth);
return (true);
}
private static function sampVsSamp(objA:AbstractParticle, objB:AbstractParticle):void{
var s:Number = (1 / (objA.multisample + 1));
var t:Number = s;
var i:int;
while (i <= objA.multisample) {
objA.samp.setTo((objA.prev.x + (t * (objA.curr.x - objA.prev.x))), (objA.prev.y + (t * (objA.curr.y - objA.prev.y))));
objB.samp.setTo((objB.prev.x + (t * (objB.curr.x - objB.prev.x))), (objB.prev.y + (t * (objB.curr.y - objB.prev.y))));
if (testTypes(objA, objB)){
return;
};
t = (t + s);
i++;
};
}
}
}//package org.cove.ape
Section 38
//CollisionResolver (org.cove.ape.CollisionResolver)
package org.cove.ape {
import org.cove.ape.*;
import com.pandaland.games.filler.elements.*;
final class CollisionResolver {
function CollisionResolver(){
super();
}
static function resolveParticleParticle(pa:AbstractParticle, pb:AbstractParticle, normal:Vector, depth:Number):void{
pa.curr.copy(pa.samp);
pb.curr.copy(pb.samp);
if ((((pa is EnemyBall)) && ((pb is UserBall)))){
pa.mass = 1E-15;
pb.mass = 1E16;
};
if ((((pb is EnemyBall)) && ((pa is UserBall)))){
pb.mass = 1E-15;
pa.mass = 1E16;
};
var mtd:Vector = normal.mult(depth);
var te:Number = (pa.elasticity + pb.elasticity);
var sumInvMass:Number = (pa.invMass + pb.invMass);
var tf:Number = clamp((1 - (pa.friction + pb.friction)), 0, 1);
var ca:Collision = pa.getComponents(normal);
var cb:Collision = pb.getComponents(normal);
var vnA:Vector = cb.vn.mult(((te + 1) * pa.invMass)).plus(ca.vn.mult((pb.invMass - (te * pa.invMass)))).divEquals(sumInvMass);
var vnB:Vector = ca.vn.mult(((te + 1) * pb.invMass)).plus(cb.vn.mult((pa.invMass - (te * pb.invMass)))).divEquals(sumInvMass);
if ((pa is UserBall)){
ca.vt.multEquals(tf);
};
if ((pb is UserBall)){
cb.vt.multEquals(tf);
};
var mtdA:Vector = mtd.mult((pa.invMass / sumInvMass));
var mtdB:Vector = mtd.mult((-(pb.invMass) / sumInvMass));
vnA.plusEquals(ca.vt);
vnB.plusEquals(cb.vt);
if (!pa.fixed){
pa.resolveCollision(mtdA, vnA, normal, depth, -1, pb);
};
if (!pb.fixed){
pb.resolveCollision(mtdB, vnB, normal, depth, 1, pa);
};
pa.mass = 1;
pb.mass = 1;
}
static function clamp(input:Number, min:Number, max:Number):Number{
if (input > max){
return (max);
};
if (input < min){
return (min);
};
return (input);
}
}
}//package org.cove.ape
Section 39
//Composite (org.cove.ape.Composite)
package org.cove.ape {
public class Composite extends AbstractCollection {
private var delta:Vector;
public function Composite(){
super();
delta = new Vector();
}
public function rotateByAngle(angleDegrees:Number, center:Vector):void{
var angleRadians:Number = (angleDegrees * MathUtil.PI_OVER_ONE_EIGHTY);
rotateByRadian(angleRadians, center);
}
public function rotateByRadian(angleRadians:Number, center:Vector):void{
var p:AbstractParticle;
var radius:Number;
var angle:Number;
var pa:Array = particles;
var len:int = pa.length;
var i:int;
while (i < len) {
p = pa[i];
radius = p.center.distance(center);
angle = (getRelativeAngle(center, p.center) + angleRadians);
p.px = ((Math.cos(angle) * radius) + center.x);
p.py = ((Math.sin(angle) * radius) + center.y);
i++;
};
}
public function get fixed():Boolean{
var i:int;
while (i < particles.length) {
if (!particles[i].fixed){
return (false);
};
i++;
};
return (true);
}
private function getRelativeAngle(center:Vector, p:Vector):Number{
delta.setTo((p.x - center.x), (p.y - center.y));
return (Math.atan2(delta.y, delta.x));
}
public function set fixed(b:Boolean):void{
var i:int;
while (i < particles.length) {
particles[i].fixed = b;
i++;
};
}
}
}//package org.cove.ape
Section 40
//Group (org.cove.ape.Group)
package org.cove.ape {
public class Group extends AbstractCollection {
private var _composites:Array;
private var _collisionList:Array;
private var _collideInternal:Boolean;
public function Group(collideInternal:Boolean=false){
super();
_composites = new Array();
_collisionList = new Array();
this.collideInternal = collideInternal;
}
public function addCollidableList(list:Array):void{
var g:Group;
var i:int;
while (i < list.length) {
g = list[i];
collisionList.push(g);
i++;
};
}
function checkCollisions():void{
var g:Group;
if (collideInternal){
checkCollisionGroupInternal();
};
var len:int = collisionList.length;
var i:int;
while (i < len) {
g = collisionList[i];
checkCollisionVsGroup(g);
i++;
};
}
public function removeComposite(c:Composite):void{
var cpos:int = composites.indexOf(c);
if (cpos == -1){
return;
};
composites.splice(cpos, 1);
c.isParented = false;
c.cleanup();
}
override public function cleanup():void{
super.cleanup();
var i:int;
while (i < composites.length) {
composites[i].cleanup();
i++;
};
}
public function removeCollidable(g:Group):void{
var pos:int = collisionList.indexOf(g);
if (pos == -1){
return;
};
collisionList.splice(pos, 1);
}
public function addComposite(c:Composite):void{
composites.push(c);
c.isParented = true;
if (isParented){
c.init();
};
}
public function addCollidable(g:Group):void{
collisionList.push(g);
}
override function integrate(dt2:Number):void{
var cmp:Composite;
super.integrate(dt2);
var len:int = _composites.length;
var i:int;
while (i < len) {
cmp = _composites[i];
cmp.integrate(dt2);
i++;
};
}
public function get composites():Array{
return (_composites);
}
override public function init():void{
super.init();
var i:int;
while (i < composites.length) {
composites[i].init();
i++;
};
}
override public function getAll():Array{
return (particles.concat(constraints).concat(composites));
}
public function get collisionList():Array{
return (_collisionList);
}
private function checkCollisionGroupInternal():void{
var ca:Composite;
var i:int;
var cb:Composite;
checkInternalCollisions();
var clen:int = _composites.length;
var j:int;
while (j < clen) {
ca = _composites[j];
ca.checkCollisionsVsCollection(this);
i = (j + 1);
while (i < clen) {
cb = _composites[i];
ca.checkCollisionsVsCollection(cb);
i++;
};
j++;
};
}
override function satisfyConstraints():void{
var cmp:Composite;
super.satisfyConstraints();
var len:int = _composites.length;
var i:int;
while (i < len) {
cmp = _composites[i];
cmp.satisfyConstraints();
i++;
};
}
public function get collideInternal():Boolean{
return (_collideInternal);
}
public function set collideInternal(b:Boolean):void{
_collideInternal = b;
}
override public function paint():void{
var c:Composite;
super.paint();
var len:int = _composites.length;
var i:int;
while (i < len) {
c = _composites[i];
c.paint();
i++;
};
}
private function checkCollisionVsGroup(g:Group):void{
var c:Composite;
var j:int;
var gc:Composite;
checkCollisionsVsCollection(g);
var clen:int = _composites.length;
var gclen:int = g.composites.length;
var i:int;
while (i < clen) {
c = _composites[i];
c.checkCollisionsVsCollection(g);
j = 0;
while (j < gclen) {
gc = g.composites[j];
c.checkCollisionsVsCollection(gc);
j++;
};
i++;
};
j = 0;
while (j < gclen) {
gc = g.composites[j];
checkCollisionsVsCollection(gc);
j++;
};
}
}
}//package org.cove.ape
Section 41
//Interval (org.cove.ape.Interval)
package org.cove.ape {
final class Interval {
var min:Number;
var max:Number;
function Interval(min:Number, max:Number){
super();
this.min = min;
this.max = max;
}
function toString():String{
return (((min + " : ") + max));
}
}
}//package org.cove.ape
Section 42
//MathUtil (org.cove.ape.MathUtil)
package org.cove.ape {
final class MathUtil {
static var ONE_EIGHTY_OVER_PI:Number = 57.2957795130823;
static var PI_OVER_ONE_EIGHTY:Number = 0.0174532925199433;
function MathUtil(){
super();
}
static function clamp(n:Number, min:Number, max:Number):Number{
if (n < min){
return (min);
};
if (n > max){
return (max);
};
return (n);
}
static function sign(val:Number):int{
if (val < 0){
return (-1);
};
return (1);
}
}
}//package org.cove.ape
Section 43
//RectangleParticle (org.cove.ape.RectangleParticle)
package org.cove.ape {
public class RectangleParticle extends AbstractParticle {
private var _axes:Array;
private var _radian:Number;
private var _extents:Array;
public function RectangleParticle(x:Number, y:Number, width:Number, height:Number, rotation:Number=0, fixed:Boolean=false, mass:Number=1, elasticity:Number=0.3, friction:Number=0){
super(x, y, fixed, mass, elasticity, friction);
_extents = new Array((width / 2), (height / 2));
_axes = new Array(new Vector(0, 0), new Vector(0, 0));
radian = rotation;
}
public function get radian():Number{
return (_radian);
}
public function set radian(t:Number):void{
_radian = t;
setAxes(t);
}
function get axes():Array{
return (_axes);
}
public function set angle(a:Number):void{
radian = (a * MathUtil.PI_OVER_ONE_EIGHTY);
}
function get extents():Array{
return (_extents);
}
public function set width(w:Number):void{
_extents[0] = (w / 2);
}
public function get width():Number{
return ((_extents[0] * 2));
}
public function set height(h:Number):void{
_extents[1] = (h / 2);
}
override public function init():void{
var w:Number;
var h:Number;
cleanup();
if (displayObject != null){
initDisplay();
} else {
w = (extents[0] * 2);
h = (extents[1] * 2);
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawRect((-(w) / 2), (-(h) / 2), w, h);
sprite.graphics.endFill();
};
paint();
}
public function get height():Number{
return ((_extents[1] * 2));
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
function getProjection(axis:Vector):Interval{
var radius:Number = ((extents[0] * Math.abs(axis.dot(axes[0]))) + (extents[1] * Math.abs(axis.dot(axes[1]))));
var c:Number = samp.dot(axis);
interval.min = (c - radius);
interval.max = (c + radius);
return (interval);
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
sprite.rotation = angle;
}
private function setAxes(t:Number):void{
var s:Number = Math.sin(t);
var c:Number = Math.cos(t);
axes[0].x = c;
axes[0].y = s;
axes[1].x = -(s);
axes[1].y = c;
}
}
}//package org.cove.ape
Section 44
//SpringConstraint (org.cove.ape.SpringConstraint)
package org.cove.ape {
import flash.display.*;
public class SpringConstraint extends AbstractConstraint {
private var _collidable:Boolean;
private var p1:AbstractParticle;
private var p2:AbstractParticle;
private var _scp:SpringConstraintParticle;
private var _restLength:Number;
public function SpringConstraint(p1:AbstractParticle, p2:AbstractParticle, stiffness:Number=0.5, collidable:Boolean=false, rectHeight:Number=1, rectScale:Number=1, scaleToLength:Boolean=false){
super(stiffness);
this.p1 = p1;
this.p2 = p2;
checkParticlesLocation();
_restLength = currLength;
setCollidable(collidable, rectHeight, rectScale, scaleToLength);
}
public function get fixed():Boolean{
return (((p1.fixed) && (p2.fixed)));
}
public function get rectScale():Number{
return (scp.rectScale);
}
public function set rectScale(s:Number):void{
if (scp == null){
return;
};
scp.rectScale = s;
}
public function setDisplay(d:DisplayObject, offsetX:Number=0, offsetY:Number=0, rotation:Number=0):void{
if (collidable){
scp.setDisplay(d, offsetX, offsetY, rotation);
} else {
displayObject = d;
displayObjectRotation = rotation;
displayObjectOffset = new Vector(offsetX, offsetY);
};
}
override public function init():void{
cleanup();
if (collidable){
scp.init();
} else {
if (displayObject != null){
initDisplay();
};
};
paint();
}
function initDisplay():void{
if (collidable){
scp.initDisplay();
} else {
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
sprite.addChild(displayObject);
};
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
public function get center():Vector{
return (p1.curr.plus(p2.curr).divEquals(2));
}
public function set rectHeight(h:Number):void{
if (scp == null){
return;
};
scp.rectHeight = h;
}
public function get restLength():Number{
return (_restLength);
}
override public function paint():void{
var c:Vector;
if (collidable){
scp.paint();
} else {
if (displayObject != null){
c = center;
sprite.x = c.x;
sprite.y = c.y;
sprite.rotation = angle;
} else {
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.moveTo(p1.px, p1.py);
sprite.graphics.lineTo(p2.px, p2.py);
};
};
}
function get scp():SpringConstraintParticle{
return (_scp);
}
public function get collidable():Boolean{
return (_collidable);
}
public function setCollidable(b:Boolean, rectHeight:Number, rectScale:Number, scaleToLength:Boolean=false):void{
_collidable = b;
_scp = null;
if (_collidable){
_scp = new SpringConstraintParticle(p1, p2, this, rectHeight, rectScale, scaleToLength);
};
}
public function isConnectedTo(p:AbstractParticle):Boolean{
return ((((p == p1)) || ((p == p2))));
}
public function get rectHeight():Number{
return (scp.rectHeight);
}
override function resolve():void{
if (((p1.fixed) && (p2.fixed))){
return;
};
var deltaLength:Number = currLength;
var diff:Number = ((deltaLength - restLength) / (deltaLength * (p1.invMass + p2.invMass)));
var dmds:Vector = delta.mult((diff * stiffness));
p1.curr.minusEquals(dmds.mult(p1.invMass));
p2.curr.plusEquals(dmds.mult(p2.invMass));
}
public function set fixedEndLimit(f:Number):void{
if (scp == null){
return;
};
scp.fixedEndLimit = f;
}
public function get radian():Number{
var d:Vector = delta;
return (Math.atan2(d.y, d.x));
}
public function set restLength(r:Number):void{
if (r <= 0){
throw (new ArgumentError("restLength must be greater than 0"));
};
_restLength = r;
}
public function get currLength():Number{
return (p1.curr.distance(p2.curr));
}
public function get fixedEndLimit():Number{
return (scp.fixedEndLimit);
}
private function checkParticlesLocation():void{
if ((((p1.curr.x == p2.curr.x)) && ((p1.curr.y == p2.curr.y)))){
p2.curr.x = (p2.curr.x + 0.0001);
};
}
function get delta():Vector{
return (p1.curr.minus(p2.curr));
}
}
}//package org.cove.ape
Section 45
//SpringConstraintParticle (org.cove.ape.SpringConstraintParticle)
package org.cove.ape {
import flash.display.*;
import org.cove.ape.*;
class SpringConstraintParticle extends RectangleParticle {
private var p1:AbstractParticle;
private var lambda:Vector;
private var p2:AbstractParticle;
private var _rectHeight:Number;
private var avgVelocity:Vector;
private var rca:Vector;
private var rcb:Vector;
private var _rectScale:Number;
private var parent:SpringConstraint;
private var scaleToLength:Boolean;
private var s:Number;
private var _fixedEndLimit:Number;
function SpringConstraintParticle(p1:AbstractParticle, p2:AbstractParticle, p:SpringConstraint, rectHeight:Number, rectScale:Number, scaleToLength:Boolean){
super(0, 0, 0, 0, 0, false);
this.p1 = p1;
this.p2 = p2;
lambda = new Vector(0, 0);
avgVelocity = new Vector(0, 0);
parent = p;
this.rectScale = rectScale;
this.rectHeight = rectHeight;
this.scaleToLength = scaleToLength;
fixedEndLimit = 0;
rca = new Vector();
rcb = new Vector();
}
private function setCorners(r:RectangleParticle, i:int):void{
var rx:Number = r.curr.x;
var ry:Number = r.curr.y;
var axes:Array = r.axes;
var extents:Array = r.extents;
var ae0_x:Number = (axes[0].x * extents[0]);
var ae0_y:Number = (axes[0].y * extents[0]);
var ae1_x:Number = (axes[1].x * extents[1]);
var ae1_y:Number = (axes[1].y * extents[1]);
var emx:Number = (ae0_x - ae1_x);
var emy:Number = (ae0_y - ae1_y);
var epx:Number = (ae0_x + ae1_x);
var epy:Number = (ae0_y + ae1_y);
if (i == 0){
rca.x = (rx - epx);
rca.y = (ry - epy);
rcb.x = (rx + emx);
rcb.y = (ry + emy);
} else {
if (i == 1){
rca.x = (rx + emx);
rca.y = (ry + emy);
rcb.x = (rx + epx);
rcb.y = (ry + epy);
} else {
if (i == 2){
rca.x = (rx + epx);
rca.y = (ry + epy);
rcb.x = (rx - emx);
rcb.y = (ry - emy);
} else {
if (i == 3){
rca.x = (rx - emx);
rca.y = (ry - emy);
rcb.x = (rx - epx);
rcb.y = (ry - epy);
};
};
};
};
}
override function get invMass():Number{
if (((p1.fixed) && (p2.fixed))){
return (0);
};
return ((1 / ((p1.mass + p2.mass) / 2)));
}
function get rectScale():Number{
return (_rectScale);
}
function set rectScale(s:Number):void{
_rectScale = s;
}
override public function get friction():Number{
return (((p1.friction + p2.friction) / 2));
}
override public function init():void{
var inner:Sprite;
var w:Number;
var h:Number;
if (displayObject != null){
initDisplay();
} else {
inner = new Sprite();
parent.sprite.addChild(inner);
inner.name = "inner";
w = (parent.currLength * rectScale);
h = rectHeight;
inner.graphics.clear();
inner.graphics.lineStyle(parent.lineThickness, parent.lineColor, parent.lineAlpha);
inner.graphics.beginFill(parent.fillColor, parent.fillAlpha);
inner.graphics.drawRect((-(w) / 2), (-(h) / 2), w, h);
inner.graphics.endFill();
};
paint();
}
override function initDisplay():void{
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
var inner:Sprite = new Sprite();
inner.name = "inner";
inner.addChild(displayObject);
parent.sprite.addChild(inner);
}
function set rectHeight(r:Number):void{
_rectHeight = r;
}
function updatePosition():void{
var c:Vector = parent.center;
curr.setTo(c.x, c.y);
width = (scaleToLength) ? (parent.currLength * rectScale) : (parent.restLength * rectScale);
height = rectHeight;
radian = parent.radian;
}
override public function get velocity():Vector{
var p1v:Vector = p1.velocity;
var p2v:Vector = p2.velocity;
avgVelocity.setTo(((p1v.x + p2v.x) / 2), ((p1v.y + p2v.y) / 2));
return (avgVelocity);
}
override public function paint():void{
var c:Vector = parent.center;
var s:Sprite = parent.sprite;
if (scaleToLength){
s.getChildByName("inner").width = (parent.currLength * rectScale);
} else {
if (displayObject != null){
s.getChildByName("inner").width = (parent.restLength * rectScale);
};
};
s.x = c.x;
s.y = c.y;
s.rotation = parent.angle;
}
private function getContactPointParam(p:AbstractParticle):Number{
var t:Number;
var shortestIndex:Number;
var paramList:Array;
var shortestDistance:Number;
var i:int;
var d:Number;
if ((p is CircleParticle)){
t = closestParamPoint(p.curr);
} else {
if ((p is RectangleParticle)){
paramList = new Array(4);
shortestDistance = Number.POSITIVE_INFINITY;
i = 0;
while (i < 4) {
setCorners((p as RectangleParticle), i);
d = closestPtSegmentSegment();
if (d < shortestDistance){
shortestDistance = d;
shortestIndex = i;
paramList[i] = s;
};
i++;
};
t = paramList[shortestIndex];
};
};
return (t);
}
function set fixedEndLimit(f:Number):void{
_fixedEndLimit = f;
}
private function closestPtSegmentSegment():Number{
var t:Number;
var pp1:Vector = p1.curr;
var pq1:Vector = p2.curr;
var pp2:Vector = rca;
var pq2:Vector = rcb;
var d1:Vector = pq1.minus(pp1);
var d2:Vector = pq2.minus(pp2);
var r:Vector = pp1.minus(pp2);
var a:Number = d1.dot(d1);
var e:Number = d2.dot(d2);
var f:Number = d2.dot(r);
var c:Number = d1.dot(r);
var b:Number = d1.dot(d2);
var denom:Number = ((a * e) - (b * b));
if (denom != 0){
s = MathUtil.clamp((((b * f) - (c * e)) / denom), 0, 1);
} else {
s = 0.5;
};
t = (((b * s) + f) / e);
if (t < 0){
t = 0;
s = MathUtil.clamp((-(c) / a), 0, 1);
} else {
if (t > 0){
t = 1;
s = MathUtil.clamp(((b - c) / a), 0, 1);
};
};
var c1:Vector = pp1.plus(d1.mult(s));
var c2:Vector = pp2.plus(d2.mult(t));
var c1mc2:Vector = c1.minus(c2);
return (c1mc2.dot(c1mc2));
}
override function resolveCollision(mtd:Vector, vel:Vector, n:Vector, d:Number, o:int, p:AbstractParticle):void{
var denom:Number;
var corrParticle:AbstractParticle;
var t:Number = getContactPointParam(p);
var c1:Number = (1 - t);
var c2:Number = t;
if (p1.fixed){
if (c2 <= fixedEndLimit){
return;
};
lambda.setTo((mtd.x / c2), (mtd.y / c2));
p2.curr.plusEquals(lambda);
p2.velocity = vel;
} else {
if (p2.fixed){
if (c1 <= fixedEndLimit){
return;
};
lambda.setTo((mtd.x / c1), (mtd.y / c1));
p1.curr.plusEquals(lambda);
p1.velocity = vel;
} else {
denom = ((c1 * c1) + (c2 * c2));
if (denom == 0){
return;
};
lambda.setTo((mtd.x / denom), (mtd.y / denom));
p1.curr.plusEquals(lambda.mult(c1));
p2.curr.plusEquals(lambda.mult(c2));
if (t == 0.5){
p1.velocity = vel;
p2.velocity = vel;
} else {
corrParticle = ((t)<0.5) ? p1 : p2;
corrParticle.velocity = vel;
};
};
};
}
function get rectHeight():Number{
return (_rectHeight);
}
function get fixedEndLimit():Number{
return (_fixedEndLimit);
}
override public function get elasticity():Number{
return (((p1.elasticity + p2.elasticity) / 2));
}
override public function get mass():Number{
return (((p1.mass + p2.mass) / 2));
}
private function closestParamPoint(c:Vector):Number{
var ab:Vector = p2.curr.minus(p1.curr);
var t:Number = (ab.dot(c.minus(p1.curr)) / ab.dot(ab));
return (MathUtil.clamp(t, 0, 1));
}
}
}//package org.cove.ape
Section 46
//Vector (org.cove.ape.Vector)
package org.cove.ape {
public class Vector {
public var x:Number;
public var y:Number;
public function Vector(px:Number=0, py:Number=0){
super();
x = px;
y = py;
}
public function cross(v:Vector):Number{
return (((x * v.y) - (y * v.x)));
}
public function magnitude():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function divEquals(s:Number):Vector{
if (s == 0){
s = 0.0001;
};
x = (x / s);
y = (y / s);
return (this);
}
public function times(v:Vector):Vector{
return (new Vector((x * v.x), (y * v.y)));
}
public function plusEquals(v:Vector):Vector{
x = (x + v.x);
y = (y + v.y);
return (this);
}
public function dot(v:Vector):Number{
return (((x * v.x) + (y * v.y)));
}
public function toString():String{
return (((x + " : ") + y));
}
public function normalize():Vector{
var m:Number = magnitude();
if (m == 0){
m = 0.0001;
};
return (mult((1 / m)));
}
public function minusEquals(v:Vector):Vector{
x = (x - v.x);
y = (y - v.y);
return (this);
}
public function copy(v:Vector):void{
x = v.x;
y = v.y;
}
public function multEquals(s:Number):Vector{
x = (x * s);
y = (y * s);
return (this);
}
public function minus(v:Vector):Vector{
return (new Vector((x - v.x), (y - v.y)));
}
public function plus(v:Vector):Vector{
return (new Vector((x + v.x), (y + v.y)));
}
public function distance(v:Vector):Number{
var delta:Vector = this.minus(v);
return (delta.magnitude());
}
public function setTo(px:Number, py:Number):void{
x = px;
y = py;
}
public function mult(s:Number):Vector{
return (new Vector((x * s), (y * s)));
}
}
}//package org.cove.ape
Section 47
//bgBmp (bgBmp)
package {
import flash.display.*;
public dynamic class bgBmp extends BitmapData {
public function bgBmp(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 48
//mcBallTex (mcBallTex)
package {
import flash.display.*;
public dynamic class mcBallTex extends MovieClip {
public var mc:MovieClip;
}
}//package
Section 49
//mcGameover (mcGameover)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcGameover extends MovieClip {
public var btnFinish:MovieClip;
public var btn:MovieClip;
public var txtHeadline:TextField;
public var txtBtnFinish:TextField;
public var txtText:TextField;
public var txtBtn:TextField;
}
}//package
Section 50
//mcGui (mcGui)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcGui extends MovieClip {
public var txtScore:TextField;
public var txtLevel:TextField;
public var txtTime:TextField;
public var btn1:MovieClip;
public var txtLives:TextField;
public var btn2:MovieClip;
public var txtPercent:TextField;
public var txtBalls:TextField;
public var txtBtn1:TextField;
public var txtBtn2:TextField;
}
}//package
Section 51
//mcIntro (mcIntro)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcIntro extends MovieClip {
public var btn:MovieClip;
public var txtHeadline:TextField;
public var txtText:TextField;
public var txtBtn:TextField;
}
}//package
Section 52
//mcLevelComplete (mcLevelComplete)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcLevelComplete extends MovieClip {
public var btn:MovieClip;
public var txtHeadline:TextField;
public var txtText:TextField;
public var txtBtn:TextField;
}
}//package
Section 53
//mcText (mcText)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcText extends MovieClip {
public var txt:TextField;
}
}//package
Section 54
//sndBounce (sndBounce)
package {
import flash.media.*;
public dynamic class sndBounce extends Sound {
}
}//package
Section 55
//sndCrash (sndCrash)
package {
import flash.media.*;
public dynamic class sndCrash extends Sound {
}
}//package
Section 56
//sndExplosion (sndExplosion)
package {
import flash.media.*;
public dynamic class sndExplosion extends Sound {
}
}//package
Section 57
//sndGrow (sndGrow)
package {
import flash.media.*;
public dynamic class sndGrow extends Sound {
}
}//package
Section 58
//sndLevelUp (sndLevelUp)
package {
import flash.media.*;
public dynamic class sndLevelUp extends Sound {
}
}//package
Section 59
//sndLoop (sndLoop)
package {
import flash.media.*;
public dynamic class sndLoop extends Sound {
}
}//package
Section 60
//sndOver (sndOver)
package {
import flash.media.*;
public dynamic class sndOver extends Sound {
}
}//package
Section 61
//sndWallCrash (sndWallCrash)
package {
import flash.media.*;
public dynamic class sndWallCrash extends Sound {
}
}//package