Section 1
//AbstractFactory (Base.AbstractFactory)
package Base {
import flash.utils.*;
public class AbstractFactory {
var initFunction:String;
var _objectsIdle:Array;
var _objectsAll:Array;
var ClassReference:Class;
var _gameContext:GameEntry;
var _objectsActive:Array;
var initParams:Array;
public function AbstractFactory(_arg1:GameEntry, _arg2:String, _arg3:String="", _arg4:Array=null, _arg5:int=1){
var _local6:*;
var _local7:int;
var _local8:Object;
var _local9:Function;
var _local10:*;
super();
_gameContext = _arg1;
_objectsAll = new Array();
_objectsIdle = new Array();
_objectsActive = new Array();
ClassReference = (getDefinitionByName(_arg2) as Class);
initFunction = _arg3;
initParams = new Array(this);
_local6 = 0;
while (_local6 < _arg4.length) {
initParams.push(_arg4[_local6]);
_local6++;
};
_local7 = _arg5;
while (_local7--) {
_local8 = new ClassReference(_gameContext);
_local9 = _local8[initFunction];
_local10 = _local9.apply(_local8, initParams);
_objectsAll.push(_local8);
_objectsIdle.push(_local8);
};
}
public function getInstance(){
var _local1:Object;
var _local2:Function;
var _local3:*;
if (_objectsIdle.length > 0){
_local1 = _objectsIdle.pop();
} else {
_local1 = new ClassReference(_gameContext);
_local2 = _local1[initFunction];
_local3 = _local2.apply(_local1, initParams);
_objectsAll.push(_local1);
};
_objectsActive.push(_local1);
return ((_local1 as ClassReference));
}
public function get objectsIdle():Array{
return (_objectsIdle);
}
public function deleteInstance(_arg1:Object):void{
var _local2:int;
_local2 = -1;
_local2 = _objectsAll.indexOf(_arg1);
if (_local2 == -1){
return;
};
_objectsAll.splice(_local2, 1);
_local2 = _objectsIdle.indexOf(_arg1);
if (_local2 == -1){
return;
};
_objectsIdle.splice(_local2, 1);
_local2 = _objectsActive.indexOf(_arg1);
if (_local2 == -1){
return;
};
_objectsActive.splice(_local2, 1);
}
public function returnInstance(_arg1:Object):void{
var _local2:int;
_local2 = _objectsActive.indexOf(_arg1);
if (_local2 == -1){
return;
};
_objectsActive.splice(_local2, 1);
_objectsIdle.push(_arg1);
}
public function get objectsAll():Array{
return (_objectsAll);
}
public function get objectsActive():Array{
return (_objectsActive);
}
public function applyFunctionToGroup(_arg1:Array, _arg2:String, _arg3:Array):void{
var _local4:int;
var _local5:Object;
var _local6:Function;
var _local7:*;
_local4 = _arg1.length;
while (_local4--) {
_local5 = _arg1[_local4];
_local6 = _local5[_arg2];
_local7 = _local6.apply(_local5, _arg3);
};
}
}
}//package Base
Section 2
//AnimationEvent (Base.AnimationEvent)
package Base {
import flash.events.*;
import flash.display.*;
public class AnimationEvent extends Event {
private var _mc:MovieClip;
public static const COMPLETE:String = "complete";
public function AnimationEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:MovieClip=null){
super(_arg1, _arg2, _arg3);
_mc = _arg4;
}
public function getMovieClip():MovieClip{
return (_mc);
}
}
}//package Base
Section 3
//FuncProxy (Base.FuncProxy)
package Base {
public dynamic class FuncProxy {
public static function create(_arg1:Object, _arg2:Function, ... _args):Function{
var aParameters:Array;
var i:Number;
var fProxy:Function;
var oTarget = _arg1;
var fFunction = _arg2;
var rest = _args;
aParameters = new Array();
i = 2;
while (i < rest.length) {
aParameters[(i - 2)] = rest[i];
i = (i + 1);
};
fProxy = function ():void{
var _local1:Array;
_local1 = rest.concat(aParameters);
fFunction.apply(oTarget, _local1);
};
return (fProxy);
}
}
}//package Base
Section 4
//GameEntry (Base.GameEntry)
package Base {
import flash.events.*;
import flash.display.*;
import UI.*;
import Game.*;
import Pad.*;
public class GameEntry extends Sprite {
private var _gameData:GameData;
private var _profiler:Profile;
private var _gameMgr:GameManager;
private var _padMgr:PadManager;
private var _timeMgr:Time;
private var _uiMgr:UIManager;
private var _spriteAnimator:SpriteEntityAnimator;
public var _stage:Stage;
public function GameEntry(){
trace("|----@ GAME ENTRY @----|");
_stage = this.stage;
this.addEventListener(Event.ENTER_FRAME, Update, false, 1, true);
_timeMgr = new Time();
_padMgr = new PadManager(this);
_uiMgr = new UIManager(this);
_gameData = new GameData(this);
_gameMgr = new GameManager(this);
_spriteAnimator = new SpriteEntityAnimator(this);
}
public function getUIManager():UIManager{
return (_uiMgr);
}
public function getGameManager():GameManager{
return (_gameMgr);
}
public function getStageSprite(){
return (_stage);
}
public function getGameData():GameData{
return (_gameData);
}
public function getProfiler():Profile{
return (_profiler);
}
public function getDT(){
return (_timeMgr.getElapsedTime());
}
public function getPadManager():PadManager{
return (_padMgr);
}
public function getParent(){
return (_stage);
}
public function getSpriteAnimator():SpriteEntityAnimator{
return (_spriteAnimator);
}
function Update(_arg1:Event):void{
_timeMgr.markTimeThisTick();
_uiMgr.Update();
_padMgr.Update();
_gameMgr.Update();
_spriteAnimator.Update();
}
public function getTimeManager(){
return (_timeMgr);
}
}
}//package Base
Section 5
//GameState (Base.GameState)
package Base {
public class GameState extends State {
private var _isTransitioning:Boolean;
private static var _isFading:Boolean;
private static var _lastTransitionFrame:Number;
private static var _screenFade:SpriteEntity;
private static var _fadeSpeed:Number;
private static var _levelToReach:Number;
private static var _transition:SpriteEntity;
private static var _currentAlphaVal:Number;
public function getTransitionFrame():Number{
if (_transition){
return (_transition.getCurrentFrame());
};
return (_lastTransitionFrame);
}
public function startScreenTransition(_arg1:GameEntry, _arg2:String, _arg3:int, _arg4:int):void{
_transition = new SpriteEntity(_arg1, _arg2, _arg1._stage);
_transition.startAnimating(_arg3, _arg4, false);
}
override public function CPUDecision(_arg1:GameEntry):void{
}
public function startFadeIn(_arg1:Number):void{
_isFading = true;
_levelToReach = 0;
_fadeSpeed = _arg1;
}
override public function Update(_arg1:GameEntry):void{
}
override public function NetworkDecision(_arg1:GameEntry):void{
}
public function startFadeOut(_arg1:GameEntry, _arg2:String, _arg3:Number, _arg4:Number=1):void{
trace(("spriteName " + _arg2));
_screenFade = new SpriteEntity(_arg1, _arg2, _arg1._stage);
_fadeSpeed = _arg3;
_levelToReach = _arg4;
_currentAlphaVal = 0;
_isFading = true;
_screenFade.getMovieClip().alpha = _currentAlphaVal;
}
public function handleFadeOut():void{
if (_isFading){
_currentAlphaVal = (_currentAlphaVal + _fadeSpeed);
if (_currentAlphaVal >= _levelToReach){
_currentAlphaVal = _levelToReach;
_isFading = false;
};
_screenFade.getMovieClip().alpha = _currentAlphaVal;
};
}
override public function Entry(_arg1:GameEntry):void{
}
override public function PadInput(_arg1:GameEntry):void{
}
public function handleFadeIn():void{
_currentAlphaVal = (_currentAlphaVal - _fadeSpeed);
if (_currentAlphaVal <= _levelToReach){
_currentAlphaVal = _levelToReach;
_isFading = false;
_screenFade.removeSprite();
_screenFade = null;
};
_screenFade.getMovieClip().alpha = _currentAlphaVal;
}
public function continueFadeOut(_arg1:Number, _arg2:Number):void{
_isFading = true;
_levelToReach = _arg2;
}
public function isTransitioning():Boolean{
if (_transition){
if (_transition.isAnimating()){
_transition.animateSprite();
return (true);
};
_lastTransitionFrame = _transition.getCurrentFrame();
_transition.removeSprite();
_transition = null;
};
return (false);
}
public function isFading():Boolean{
return (_isFading);
}
override public function Exit(_arg1:GameEntry):void{
}
}
}//package Base
Section 6
//PM_PRNG (Base.PM_PRNG)
package Base {
public class PM_PRNG {
public static var seed:uint = 1;
public static function nextDoubleRange(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + ((_arg2 - _arg1) * nextDouble())));
}
public static function nextIntRange(_arg1:Number, _arg2:Number):uint{
_arg1 = (_arg1 - 0.4999);
_arg2 = (_arg2 + 0.4999);
return (Math.round((_arg1 + ((_arg2 - _arg1) * nextDouble()))));
}
public static function nextDouble():Number{
return ((gen() / 2147483647));
}
public static function gen():uint{
return ((seed = ((seed * 16807) % 2147483647)));
}
public static function nextInt():uint{
return (gen());
}
}
}//package Base
Section 7
//Profile (Base.Profile)
package Base {
import flash.utils.*;
public class Profile {
private var _profiles:Array;
private var _gameContext:GameEntry;
public function Profile(_arg1:GameEntry){
_gameContext = _arg1;
_profiles = [];
}
public function StartProfile(_arg1:String):void{
var _local2:int;
var _local3:int;
_local2 = getTimer();
_local3 = 0;
while (_local3 < _profiles.length) {
if (_profiles[_local3].name == _arg1){
_profiles[_local3].startTime = _local2;
_profiles[_local3].endTime = 0;
};
_local3++;
};
}
public function EndProfile(_arg1:String):void{
var _local2:int;
var _local3:int;
_local2 = getTimer();
_local3 = 0;
while (_local3 < _profiles.length) {
if (_profiles[_local3].name == _arg1){
_profiles[_local3].endTime = _local2;
};
_local3++;
};
}
public function RegisterProfile(_arg1:String):void{
var _local2:Number;
trace(("**** registering profile ****" + _arg1));
_profiles.push(new Object());
_local2 = (_profiles.length - 1);
_profiles[_local2].name = _arg1;
_profiles[_local2].startTime = 0;
_profiles[_local2].endTime = 0;
}
public function ReportProfile():void{
var _local1:int;
var _local2:int;
trace("*********************************");
trace(("Reporting Profile " + _profiles.length));
trace(("frameRate: " + (1 / _gameContext.getTimeManager().getAverageTime())));
_local1 = 0;
while (_local1 < _profiles.length) {
_local2 = (_profiles[_local1].endTime - _profiles[_local1].startTime);
trace(((("Profile " + _profiles[_local1].name) + ": ") + _local2));
_local1++;
};
trace("*********************************");
}
}
}//package Base
Section 8
//SoundModule (Base.SoundModule)
package Base {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class SoundModule {
private const soundVolDefault:Number = 1;
private const musicVolDefault:Number = 1;
private var fadeInChannel:SoundChannel;
private var hash:Object;
private var currMusic:String;// = null
private var fadeOutStep:Number;
private var fadeOutStr:String;
private var musicVolTarget:Number;// = 1
private var fadeInStr:String;
private var fadeInSoundInterval:uint;
private var fadeInStep:Number;
private var fadeInMusicInterval:uint;
private var musicMute:Boolean;
private var mutedVolume:Number;// = 1
private var fadeOutSoundInterval:uint;
private var activeSounds:Array;
private var currMusicChannel:SoundChannel;
private var fadeOutChannel:SoundChannel;
private var fadeOutMusicInterval:uint;
private static var MAX_SOUNDS:Number = 30;
public function SoundModule(){
musicVolTarget = 1;
currMusic = null;
mutedVolume = 1;
super();
hash = new Object();
activeSounds = new Array();
}
public function getCurrentMusicChannel():SoundChannel{
return (currMusicChannel);
}
public function updateFadeOutChannel(_arg1:Timer, _arg2:SoundChannel, _arg3:Number, ... _args):void{
var _local5:Number;
var _local6:SoundTransform;
_local5 = (_arg2.soundTransform.volume - _arg3);
_local6 = new SoundTransform(_local5, 0);
if (_local5 <= 0){
_arg1.stop();
_arg1.removeEventListener(TimerEvent.TIMER, this.updateFadeOutChannel);
_arg1 = null;
_arg2.stop();
deactivateChannel(_arg2);
_arg2 = null;
} else {
_arg2.soundTransform = _local6;
};
}
public function setMusicMute(_arg1:Boolean):void{
var _local2:SoundTransform;
if (currMusicChannel == null){
musicMute = _arg1;
return;
};
if (fadeInSoundInterval > 0){
clearInterval(fadeInSoundInterval);
fadeInSoundInterval = 0;
};
switch (_arg1){
case true:
_local2 = new SoundTransform(0, 0);
currMusicChannel.soundTransform = _local2;
musicMute = true;
break;
case false:
_local2 = new SoundTransform(mutedVolume, 0);
currMusicChannel.soundTransform = _local2;
musicMute = false;
break;
};
}
public function getMusicMute():Boolean{
return (musicMute);
}
public function crossFadeMusic(_arg1:SoundChannel, _arg2:SoundChannel, _arg3:Number):void{
if (_arg1 != null){
addChannelToFadeOut(_arg1, _arg3);
};
if (_arg2 != null){
addChannelToFadeIn(_arg2, _arg3);
};
}
public function stopSound(_arg1:SoundChannel):void{
var _local2:Number;
_local2 = activeSounds.length;
while (_local2--) {
if (activeSounds[_local2][1] == _arg1){
_arg1.stop();
_arg1 = null;
activeSounds.splice(_local2, 1);
break;
};
};
}
public function addChannelToFadeOut(_arg1:SoundChannel, _arg2:Number):void{
var _local3:SoundTransform;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Timer;
_local3 = _arg1.soundTransform;
_local4 = (_local3.volume * 100);
_local5 = (_local4 / _arg2);
_local6 = (_arg2 / _local4);
_local7 = (_arg2 / _local6);
if (_local5 < 0.02){
_local5 = 0.02;
};
_local8 = new Timer(_local7, _local6);
_local8.addEventListener(TimerEvent.TIMER, FuncProxy.create(this, updateFadeOutChannel, _local8, _arg1, _local5));
_local8.start();
}
public function updateFadeInChannel(_arg1:Timer, _arg2:SoundChannel, _arg3:Number, ... _args):void{
var _local5:Number;
var _local6:SoundTransform;
_local5 = (_arg2.soundTransform.volume + _arg3);
_local6 = new SoundTransform(_local5, 0);
if (_local5 >= musicVolTarget){
_arg1.stop();
_arg1.removeEventListener(TimerEvent.TIMER, this.updateFadeOutChannel);
_arg1 = null;
} else {
_arg2.soundTransform = _local6;
};
}
public function playSound(_arg1:String, _arg2:Number=1, _arg3:Number=0, _arg4:Number=0, _arg5:int=0, _arg6:Boolean=false):SoundChannel{
var _local7:Number;
var _local8:Sound;
var _local9:SoundTransform;
var _local10:SoundChannel;
if (_arg2 > 1){
_arg2 = 1;
};
if ((((_arg3 < -1)) || ((_arg3 > 1)))){
_arg3 = 0;
};
if (!_arg6){
_local7 = activeSounds.length;
if (_local7 > 0){
while (_local7--) {
if (activeSounds[_local7][0] == _arg1){
return (null);
};
};
};
};
if (activeSounds.length < MAX_SOUNDS){
_local8 = hash[_arg1];
_local9 = new SoundTransform(_arg2, _arg3);
_local10 = _local8.play(_arg4, _arg5, _local9);
if (_local10 == null){
trace("Sound Failed to Play");
return (null);
};
activeSounds.push([_arg1, _local10]);
_local10.addEventListener(Event.SOUND_COMPLETE, FuncProxy.create(this, soundCompleteHandler, _arg1, _local10));
return (_local10);
} else {
trace("Active Sounds exceeds Maximum Allowed");
};
return (null);
}
public function startLoopFade(_arg1:String, _arg2:Number, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0, _arg6:int=9999, _arg7:Boolean=false):SoundChannel{
var _local8:Number;
var _local9:Sound;
var _local10:SoundTransform;
var _local11:SoundChannel;
if (!_arg7){
_local8 = activeSounds.length;
if (_local8 > 0){
while (_local8--) {
if (activeSounds[_local8][0] == _arg1){
trace(("Sound Already Playing:" + _arg1), _local8);
return (null);
};
};
};
};
if (activeSounds.length < MAX_SOUNDS){
_local9 = hash[_arg1];
_local10 = new SoundTransform(0, _arg4);
_local11 = _local9.play(_arg5, _arg6, _local10);
if (_local11 == null){
trace("Loop Sound Failed to Play");
return (null);
};
activeSounds.push([_arg1, _local11]);
addChannelToFadeIn(_local11, _arg2);
return (_local11);
} else {
trace("Active Sounds exceeds Maximum Allowed");
};
return (null);
}
public function traceActiveSounds():void{
var _local1:Number;
trace("");
_local1 = activeSounds.length;
while (_local1--) {
trace((("[" + activeSounds[_local1][0]) + "]"));
};
trace("");
}
public function loadSound(_arg1:String):void{
var _local2:Class;
var _local3:Sound;
_local2 = (getDefinitionByName(_arg1) as Class);
_local3 = (new (_local2) as Sound);
hash[_arg1] = _local3;
}
public function soundCompleteHandler(_arg1:String, _arg2:SoundChannel):void{
deactivateChannel(_arg2);
_arg2.removeEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
_arg2 = null;
}
public function stopMusic():void{
if (currMusicChannel == null){
return;
};
addChannelToFadeOut(currMusicChannel, 2000);
currMusicChannel = null;
}
public function playMusic(_arg1:String, _arg2:Number=1, _arg3:Number=1):SoundChannel{
var _local4:SoundChannel;
var _local5:Sound;
var _local6:SoundTransform;
_local4 = currMusicChannel;
currMusicChannel = null;
_local5 = hash[_arg1];
if (musicMute){
musicVolTarget = 0;
} else {
musicVolTarget = _arg3;
};
mutedVolume = _arg3;
_local6 = new SoundTransform(_arg2, 0);
currMusicChannel = _local5.play(0, 9999, _local6);
if (currMusicChannel == null){
return (null);
};
currMusicChannel.addEventListener(Event.SOUND_COMPLETE, FuncProxy.create(this, soundCompleteHandler, _arg1));
if (_arg2 != _arg3){
crossFadeMusic(_local4, currMusicChannel, 2000);
} else {
if (_local4 != null){
addChannelToFadeOut(_local4, 2000);
};
};
return (currMusicChannel);
}
public function stopAllSounds():void{
var _local1:Number;
var _local2:SoundChannel;
_local1 = activeSounds.length;
while (_local1--) {
_local2 = activeSounds[_local1][1];
_local2.stop();
_local2 = null;
};
activeSounds = new Array();
}
public function unMuteSound(_arg1:SoundChannel, _arg2:Number=1):void{
var _local3:SoundTransform;
_local3 = new SoundTransform(_arg2, 0);
_arg1.soundTransform = _local3;
}
public function deactivateChannel(_arg1:SoundChannel):void{
var _local2:int;
_local2 = activeSounds.length;
while (_local2--) {
if (activeSounds[_local2][1] == _arg1){
activeSounds.splice(_local2, 1);
_arg1 = null;
return;
};
};
}
public function addChannelToFadeIn(_arg1:SoundChannel, _arg2:Number):void{
var _local3:SoundTransform;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Timer;
_local3 = _arg1.soundTransform;
_local4 = (musicVolTarget * 100);
_local5 = (_local4 / _arg2);
_local6 = (_arg2 / _local4);
_local7 = (_arg2 / _local6);
if (_local5 < 0.02){
_local5 = 0.02;
};
_local8 = new Timer(_local7, _local6);
_local8.addEventListener(TimerEvent.TIMER, FuncProxy.create(this, updateFadeInChannel, _local8, _arg1, _local5));
_local8.start();
}
public function muteSound(_arg1:SoundChannel):void{
var _local2:SoundTransform;
_local2 = new SoundTransform(0, 0);
_arg1.soundTransform = _local2;
}
}
}//package Base
Section 9
//SpriteAnimator (Base.SpriteAnimator)
package Base {
import flash.events.*;
import flash.display.*;
public class SpriteAnimator extends EventDispatcher {
public var _loopAnim:Boolean;
public var _startFrame:int;
public var _isPlayingBackwards:Boolean;
public var _animateTimer:Number;
public var _framerate:Number;
var _gameContext:GameEntry;
public var _c:int;
public var _animate:Boolean;
public var _endFrame:int;
var _mc:MovieClip;
public var _lastFrame:int;
public function SpriteAnimator(_arg1:GameEntry, _arg2:MovieClip){
_gameContext = _arg1;
_mc = _arg2;
_animateTimer = 0;
}
public function reverseAnimation():void{
var _local1:*;
var _local2:*;
_local1 = _endFrame;
_local2 = _startFrame;
_startFrame = _local1;
_endFrame = _local2;
_isPlayingBackwards = ((_startFrame)>_endFrame) ? true : false;
}
public function getCurrentFrame():int{
return (_mc.currentFrame);
}
public function doneAnimating():void{
if (_animate == false){
return;
};
_animate = false;
if (hasEventListener(AnimationEvent.COMPLETE)){
dispatchEvent(new AnimationEvent(AnimationEvent.COMPLETE, false, false, _mc));
};
}
public function getEndFrame():Number{
return (_endFrame);
}
public function setFramerate(_arg1:int):void{
_framerate = (1 / _arg1);
}
public function isAnimating():Boolean{
return (_animate);
}
public function moveToFrame(_arg1:int):void{
_mc.gotoAndStop(_arg1);
_lastFrame = _arg1;
}
public function getFramerate():Number{
return (_framerate);
}
public function startAnimating(_arg1:int, _arg2:int, _arg3:Boolean=false, _arg4:Number=32){
_c = _arg1;
_startFrame = _arg1;
_endFrame = _arg2;
moveToFrame(_arg1);
_framerate = (1 / _arg4);
_loopAnim = _arg3;
_animate = true;
_animateTimer = _framerate;
_isPlayingBackwards = ((_startFrame)>_endFrame) ? true : false;
}
public function isLooping():Boolean{
return (_loopAnim);
}
public function getStartFrame():Number{
return (_startFrame);
}
public function animateSprite():int{
_animateTimer = (_animateTimer - _gameContext.getDT());
if (_animateTimer <= 0){
_animateTimer = _framerate;
if (_startFrame <= _endFrame){
_c++;
if (_c > _endFrame){
if (_loopAnim){
_c = _startFrame;
} else {
doneAnimating();
_c = _endFrame;
return (1);
};
};
} else {
_c--;
if (_c < _endFrame){
if (_loopAnim){
_c = _startFrame;
} else {
doneAnimating();
_c = _endFrame;
return (1);
};
};
};
moveToFrame(_c);
};
return (0);
}
}
}//package Base
Section 10
//SpriteEntity (Base.SpriteEntity)
package Base {
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
public class SpriteEntity {
private var _selectableChildren:Array;
public var _lastFrame:int;
private var _mouseRollOff:Boolean;
public var _loopAnim:Boolean;
public var _mc:MovieClip;
public var _clipHeight:Number;
private var _isSelectable:Boolean;
public var _flipped:Boolean;
public var _isPlayingBackwards:Boolean;
private var _returnVal:int;
public var _framerate:Number;
private var _children:Array;
var mouseWasOverLastFrame:Boolean;// = false
private var _mouseIsOver:Boolean;
private var _startingPositionX:Number;
private var _startingPositionY:Number;
private var _moveSpeed:Number;
public var _centerPoint:Number;
private var _mouseRollOn:Boolean;
private var _gameContext:GameEntry;
public var _animate:Boolean;
private var _destPosX:Number;
private var _destPosY:Number;
public var _spName:String;
public var _faceDir:Number;
public var _endFrame:int;
public var _animateTimer:Number;
public var _startFrame:int;
public var _clipWidth:Number;
public var _c:int;
public function SpriteEntity(_arg1:GameEntry, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Number=0, _arg5:Number=0, _arg6:Boolean=false, _arg7:int=-1, _arg8:int=-1){
var _local9:*;
var _local10:Class;
mouseWasOverLastFrame = false;
super();
_gameContext = _arg1;
_local9 = _arg3.getChildByName(_arg2);
if (_arg6){
_local9 = null;
};
if (_local9){
_mc = _local9;
} else {
_local10 = (getDefinitionByName(_arg2) as Class);
_mc = new (_local10);
_mc.name = _arg2;
_mc.x = _arg4;
_mc.y = _arg5;
if (_arg7 < 0){
_arg3.addChild(_mc);
} else {
_arg3.addChildAt(_mc, _arg7);
};
};
_spName = _arg2;
_mc.visible = true;
_mc.gotoAndStop(1);
_flipped = false;
_c = 1;
_startFrame = 0;
_endFrame = 0;
_lastFrame = 0;
_framerate = 32;
_animateTimer = 0;
_animate = false;
_loopAnim = false;
_isPlayingBackwards = false;
_returnVal = _arg8;
_mc.mouseEnabled = false;
_isSelectable = false;
if (_returnVal > -1){
setSelectable(_arg8);
};
_mouseIsOver = false;
_mouseRollOn = false;
_mouseRollOff = false;
_children = [];
_selectableChildren = [];
}
public function setRotation(_arg1:Number){
_mc.rotation = _arg1;
}
public function setDestPosX(_arg1:Number){
_destPosX = _arg1;
}
public function getArea():Number{
return ((_mc.width * _mc.height));
}
public function animateSprite():int{
_animateTimer = (_animateTimer - _gameContext.getDT());
if (_animateTimer <= 0){
_animateTimer = _framerate;
if (_startFrame <= _endFrame){
_c++;
if (_c > _endFrame){
if (_loopAnim){
_c = _startFrame;
} else {
doneAnimating();
_c = _endFrame;
return (1);
};
};
} else {
_c--;
if (_c < _endFrame){
if (_loopAnim){
_c = _startFrame;
} else {
doneAnimating();
_c = _endFrame;
return (1);
};
};
};
moveToFrame(_c);
};
return (0);
}
public function getVisibility():Boolean{
return (_mc.visible);
}
public function addNestedChild(_arg1:String, _arg2:int=-1):SpriteEntity{
var _local3:SpriteEntity;
_local3 = new SpriteEntity(_gameContext, _arg1, _mc);
if (_arg2 > -1){
_local3.setSelectable(_arg2);
_selectableChildren.push(_local3);
} else {
_children.push(_local3);
};
return (_local3);
}
public function setPositionX(_arg1:Number){
_mc.x = _arg1;
}
public function setPositionY(_arg1:Number){
_mc.y = _arg1;
}
public function getWidth():Number{
return (_mc.width);
}
public function isMouseOver():Boolean{
var _local1:Rectangle;
if (_mc.visible == false){
return (false);
};
_mouseRollOn = false;
_mouseRollOff = false;
_local1 = _mc.getBounds(_gameContext._stage);
if ((((((((_gameContext.getPadManager().getMousePosX() < _local1.left)) || ((_gameContext.getPadManager().getMousePosX() > _local1.right)))) || ((_gameContext.getPadManager().getMousePosY() < _local1.top)))) || ((_gameContext.getPadManager().getMousePosY() > _local1.bottom)))){
if (mouseWasOverLastFrame){
_mouseRollOff = true;
};
mouseWasOverLastFrame = false;
_mouseIsOver = false;
return (false);
};
if (_mouseIsOver){
mouseWasOverLastFrame = true;
} else {
_mouseRollOn = true;
mouseWasOverLastFrame = true;
};
_mouseIsOver = true;
return (true);
}
public function getFramerate():Number{
return (_framerate);
}
public function setVisibility(_arg1:Boolean){
_mc.visible = _arg1;
}
public function startAnimating(_arg1:int, _arg2:int, _arg3:Boolean=false, _arg4:Number=32){
_c = _arg1;
_startFrame = _arg1;
_endFrame = _arg2;
moveToFrame(_arg1);
_framerate = (1 / _arg4);
_loopAnim = _arg3;
_animate = true;
_animateTimer = _framerate;
_isPlayingBackwards = ((_startFrame)>_endFrame) ? true : false;
}
public function getHeight():Number{
return (_mc.height);
}
public function getStartFrame():Number{
return (_startFrame);
}
public function getReturnVal():int{
return (_returnVal);
}
public function addNewChild(_arg1:String, _arg2:int, _arg3:int, _arg4:Boolean=false, _arg5:int=-1):SpriteEntity{
var _local6:SpriteEntity;
_local6 = new SpriteEntity(_gameContext, _arg1, _mc, _arg2, _arg3, _arg4);
if (_arg5 > -1){
_local6.setSelectable(_arg5);
_selectableChildren.push(_local6);
} else {
_children.push(_local6);
};
return (_local6);
}
public function setFaceDir(_arg1:Number):void{
_faceDir = _arg1;
}
public function setStartingPositionToPosition():void{
_startingPositionX = getPositionX();
_startingPositionY = getPositionY();
}
public function getSelectableChild(_arg1:int):SpriteEntity{
return (_selectableChildren[_arg1]);
}
public function getStartingPositionX():Number{
return (_startingPositionX);
}
public function getStartingPositionY():Number{
return (_startingPositionY);
}
public function isLooping():Boolean{
return (_loopAnim);
}
public function getMoveSpeed():Number{
return (_moveSpeed);
}
public function getScaleY():Number{
return (_mc.scaleY);
}
public function setScaleX(_arg1:Number):void{
_mc.scaleX = _arg1;
}
public function setScaleY(_arg1:Number):void{
_mc.scaleY = _arg1;
}
public function getScaleX():Number{
return (_mc.scaleX);
}
public function isAnimating():Boolean{
return (_animate);
}
public function getSelectable():Boolean{
return (_isSelectable);
}
public function getChild(_arg1:int):SpriteEntity{
return (_selectableChildren[_arg1]);
}
public function setSelectable(_arg1:int):void{
_isSelectable = true;
_returnVal = _arg1;
_mc.mouseEnabled = true;
_mc.buttonMode = true;
_mc.useHandCursor = true;
}
public function removeSprite():void{
var _local1:int;
_local1 = 0;
_local1 = _children.length;
if (_local1 > 0){
while (_local1--) {
_children[_local1] = null;
};
_children = [];
};
_local1 = _selectableChildren.length;
if (_local1 > 0){
while (_local1--) {
_selectableChildren[_local1] = null;
};
_selectableChildren = [];
};
_mc.parent.removeChild(_mc);
_mc = null;
}
public function getSelectableChildren():Array{
return (_selectableChildren);
}
public function getNumChildren():Number{
return (_children.length);
}
public function getChildren():Array{
return (_children);
}
public function setFramerate(_arg1:int):void{
_framerate = (1 / _arg1);
}
public function isMouseRollOff():Boolean{
return (_mouseRollOff);
}
public function getPositionX():Number{
return (_mc.x);
}
public function getPositionY():Number{
return (_mc.y);
}
public function moveToFrame(_arg1:int):void{
_mc.gotoAndStop(_arg1);
_lastFrame = _arg1;
}
public function setPosition(_arg1:Number, _arg2:Number){
_mc.x = _arg1;
_mc.y = _arg2;
}
public function scaleSprite(_arg1:Number):void{
_mc.scaleX = (_mc.scaleX * _arg1);
_mc.scaleY = (_mc.scaleY * _arg1);
}
public function setMoveSpeed(_arg1:Number){
_moveSpeed = _arg1;
}
public function playFlipped(){
if (_flipped){
return;
};
_flipped = true;
_mc.scaleX = (_mc.scaleX * -1);
}
public function isMouseRollOn():Boolean{
return (_mouseRollOn);
}
public function getFaceDir():Number{
return (_faceDir);
}
public function getDestPosY():Number{
return (_destPosY);
}
public function setFlipped():void{
_flipped = (_flipped) ? false : true;
_mc.scaleX = (_mc.scaleX * -1);
}
public function reverseAnimation():void{
var _local1:*;
var _local2:*;
_local1 = _endFrame;
_local2 = _startFrame;
_startFrame = _local1;
_endFrame = _local2;
_isPlayingBackwards = ((_startFrame)>_endFrame) ? true : false;
}
public function getEndFrame():Number{
return (_endFrame);
}
public function setDestPosY(_arg1:Number){
_destPosY = _arg1;
}
public function getDestPosX():Number{
return (_destPosX);
}
public function isAtDestination():Boolean{
return (((((_mc.x == _destPosX)) && ((_mc.y == _destPosY)))) ? true : false);
}
public function getSelectableChildMouseIsOver():SpriteEntity{
var _local1:int;
_local1 = _selectableChildren.length;
while (_local1--) {
if (_selectableChildren[_local1].isMouseOver()){
return (_selectableChildren[_local1]);
};
};
return (null);
}
public function getNumSelectableChildren():Number{
return (_selectableChildren.length);
}
public function isVisible():Boolean{
return (_mc.visible);
}
public function getCurrentFrame():int{
return (_mc.currentFrame);
}
public function getMovieClip():MovieClip{
return (_mc);
}
public function playUnflipped(){
if (_flipped){
_mc.scaleX = (_mc.scaleX * -1);
};
_flipped = false;
}
public function doneAnimating():void{
_animate = false;
}
public function isFlipped():Boolean{
return (_flipped);
}
}
}//package Base
Section 11
//SpriteEntityAnimator (Base.SpriteEntityAnimator)
package Base {
public class SpriteEntityAnimator {
var _animateTimer:int;
var _gameContext:GameEntry;
var toAnimate:Array;
var toRemove:Array;
public function SpriteEntityAnimator(_arg1:GameEntry){
_gameContext = _arg1;
toAnimate = new Array();
toRemove = new Array();
_animateTimer = 0;
}
public function addSpriteToAnimate(_arg1:SpriteEntity, _arg2:Object, _arg3:Function, _arg4:Array):void{
toAnimate.push(new Array(_arg1, _arg2, _arg3, _arg4));
}
public function Update():void{
var _local1:int;
var _local2:SpriteEntity;
var _local3:int;
var _local4:int;
var _local5:Object;
var _local6:Function;
var _local7:Array;
_local1 = toAnimate.length;
if (_local1 < 1){
return;
};
_local2 = null;
toRemove = [];
while (_local1--) {
_local2 = toAnimate[_local1][0];
_local3 = _local2.animateSprite();
if (_local3 == 1){
toRemove.push(_local1);
};
};
_local1 = toRemove.length;
if (_local1 > 0){
_local4 = toRemove[_local1];
_local2 = toAnimate[_local4][0];
_local5 = toAnimate[_local4][1];
_local6 = toAnimate[_local4][2];
_local7 = toAnimate[_local4][3];
_local6.apply(_local5, _local7);
toAnimate.splice(_local4, 1);
};
}
}
}//package Base
Section 12
//State (Base.State)
package Base {
public class State {
public function Entry(_arg1:GameEntry):void{
}
public function CPUDecision(_arg1:GameEntry):void{
}
public function Exit(_arg1:GameEntry):void{
}
public function Update(_arg1:GameEntry):void{
}
public function NetworkDecision(_arg1:GameEntry):void{
}
public function PadInput(_arg1:GameEntry):void{
}
}
}//package Base
Section 13
//Time (Base.Time)
package Base {
import flash.utils.*;
class Time {
private var _timer:Timer;
private var _averageTime:Array;
private var _startTime;
private var _timeLastTick;
private var _currentTime;
private var _gameSpeed;
private var _currentPlaceInAvgArray;
static var MAX_GAME_SPEED = 100;
static var MIN_GAME_SPEED = 0.001;
static var INITIAL_GAME_SPEED = 1;
function Time(){
_timer = new Timer(0, 0);
_timer.start();
_currentTime = 0;
_timeLastTick = 0.001;
_gameSpeed = INITIAL_GAME_SPEED;
_startTime = ((getTimer() * INITIAL_GAME_SPEED) / 1000);
_averageTime = new Array(0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666, 0.01666);
_currentPlaceInAvgArray = 0;
_currentTime = getTimer();
}
public function resetStartTime():void{
_startTime = ((getTimer() * INITIAL_GAME_SPEED) / 1000);
}
public function setGameSpeed(_arg1:Number){
_gameSpeed = _arg1;
if (_gameSpeed < MIN_GAME_SPEED){
_gameSpeed = MIN_GAME_SPEED;
} else {
if (_gameSpeed > MAX_GAME_SPEED){
_gameSpeed = MIN_GAME_SPEED;
};
};
}
public function getTotalTimeElapsed():Number{
return ((_currentTime - _startTime));
}
public function getAverageTime():Number{
var _local1:*;
var _local2:*;
_local1 = 0;
_local2 = 0;
while (_local2 < 10) {
_local1 = (_local1 + _averageTime[_local2]);
_local2++;
};
_local1 = (_local1 / 10);
return (_local1);
}
public function getFramerate():Number{
return (Math.floor((1 / getAverageTime())));
}
public function getElapsedTime():Number{
return (_timeLastTick);
}
public function markTimeThisTick(){
var _local1:*;
_local1 = (((getTimer() * _gameSpeed) / 1000) - _startTime);
_timeLastTick = (_local1 - _currentTime);
_currentTime = _local1;
var _local2 = _currentPlaceInAvgArray++;
_averageTime[_local2] = _timeLastTick;
if (_currentPlaceInAvgArray >= 10){
_currentPlaceInAvgArray = 0;
};
if (_timeLastTick <= 0){
_timeLastTick = 0.001;
};
}
public function getCurTime():Number{
return (_currentTime);
}
public function getGameSpeed():Number{
return (_gameSpeed);
}
}
}//package Base
Section 14
//CN_Game (code.CN_Game)
package code {
import flash.events.*;
import flash.display.*;
public class CN_Game extends MovieClip {
public var loadDisplay:MovieClip;
var displayProgress:Boolean;// = true
var displayAnim:Boolean;// = true
var state:int;// = 0
public function CN_Game(){
state = 0;
displayProgress = true;
displayAnim = true;
super();
addFrameScript(119, frame120);
addEventListener("enterFrame", UpdateLoader, false, 0, true);
}
public function UpdateLoader(_arg1:Event):void{
var _local2:*;
var _local3:int;
switch (state){
case 0:
if (this.framesLoaded >= 5){
_local3 = (displayProgress) ? 5 : 2;
gotoAndStop(_local3);
state++;
};
break;
case 1:
trace(("this.loadDisplay:" + this.loadDisplay));
if (displayProgress){
if (this.loadDisplay != null){
this.loadDisplay.gotoAndStop(2);
state++;
};
return;
};
state++;
break;
case 2:
_local2 = Math.round(((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100));
if (displayProgress){
this.loadDisplay.done_txt.text = (_local2 + "%");
};
if (_local2 >= 100){
state++;
};
break;
case 3:
if (((displayProgress) && (displayAnim))){
this.loadDisplay.gotoAndPlay(3);
state++;
return;
};
state = (state + 2);
break;
case 4:
if (this.loadDisplay.currentFrame < 39){
return;
};
state++;
break;
case 5:
gotoAndPlay(99);
removeEventListener("enterFrame", UpdateLoader);
break;
};
}
function frame120(){
stop();
}
}
}//package code
Section 15
//Spark (Effects.Spark)
package Effects {
import Base.*;
import flash.display.*;
public class Spark extends SpriteEntity {
public function Spark(_arg1:GameEntry, _arg2:String, _arg3:DisplayObjectContainer, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int){
var _local9:Function;
var _local10:Array;
super(_arg1, _arg2, _arg3, _arg4, _arg5, true);
startAnimating(_arg6, _arg7);
_local9 = new Function();
_local9 = remove;
_local10 = new Array();
_arg1.getSpriteAnimator().addSpriteToAnimate(this, this, _local9, _local10);
}
public function remove():void{
removeSprite();
delete ??getglobalscope
[this];
}
}
}//package Effects
Section 16
//bonus_multiplier_43 (Flapjack_AdventureBound_fla.bonus_multiplier_43)
package Flapjack_AdventureBound_fla {
import flash.display.*;
import flash.text.*;
public dynamic class bonus_multiplier_43 extends MovieClip {
public var txtNumSuccess:TextField;
public function bonus_multiplier_43(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Flapjack_AdventureBound_fla
Section 17
//bonus_parts_20 (Flapjack_AdventureBound_fla.bonus_parts_20)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class bonus_parts_20 extends MovieClip {
public function bonus_parts_20(){
addFrameScript(37, frame38);
}
function frame38(){
stop();
}
}
}//package Flapjack_AdventureBound_fla
Section 18
//bouns_transition_19 (Flapjack_AdventureBound_fla.bouns_transition_19)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class bouns_transition_19 extends MovieClip {
public var btnAnimation:MovieClip;
public var btnPlay:MovieClip;
}
}//package Flapjack_AdventureBound_fla
Section 19
//coin_chain_counter_42 (Flapjack_AdventureBound_fla.coin_chain_counter_42)
package Flapjack_AdventureBound_fla {
import flash.display.*;
import flash.text.*;
public dynamic class coin_chain_counter_42 extends MovieClip {
public var numCombos:TextField;
}
}//package Flapjack_AdventureBound_fla
Section 20
//collectPositionIndicator_36 (Flapjack_AdventureBound_fla.collectPositionIndicator_36)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class collectPositionIndicator_36 extends MovieClip {
public var _checkpointMarker:MovieClip;
public var _heroMarker:MovieClip;
}
}//package Flapjack_AdventureBound_fla
Section 21
//compassBTN_17 (Flapjack_AdventureBound_fla.compassBTN_17)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class compassBTN_17 extends MovieClip {
public function compassBTN_17(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package Flapjack_AdventureBound_fla
Section 22
//endLevelComb_47 (Flapjack_AdventureBound_fla.endLevelComb_47)
package Flapjack_AdventureBound_fla {
import flash.display.*;
import flash.text.*;
public dynamic class endLevelComb_47 extends MovieClip {
public var _scoreTotal:TextField;
public var _numPoints:TextField;
public var _scoreSubTotal:TextField;
public var _numBonus:TextField;
}
}//package Flapjack_AdventureBound_fla
Section 23
//game_over_comp_22 (Flapjack_AdventureBound_fla.game_over_comp_22)
package Flapjack_AdventureBound_fla {
import flash.display.*;
import flash.text.*;
public dynamic class game_over_comp_22 extends MovieClip {
public var btnContinue:MovieClip;
public var btnReplay:MovieClip;
public var _scoreTotal:TextField;
}
}//package Flapjack_AdventureBound_fla
Section 24
//getReadtTxtPng_32 (Flapjack_AdventureBound_fla.getReadtTxtPng_32)
package Flapjack_AdventureBound_fla {
import flash.display.*;
import flash.text.*;
public dynamic class getReadtTxtPng_32 extends MovieClip {
public var numLevels:TextField;
}
}//package Flapjack_AdventureBound_fla
Section 25
//HUD_CollectMode_35 (Flapjack_AdventureBound_fla.HUD_CollectMode_35)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class HUD_CollectMode_35 extends MovieClip {
public var levelIndicator:MovieClip;
public var headIcons:MovieClip;
public var combo:MovieClip;
}
}//package Flapjack_AdventureBound_fla
Section 26
//hud_hero_icons_39 (Flapjack_AdventureBound_fla.hud_hero_icons_39)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class hud_hero_icons_39 extends MovieClip {
public var knuck:MovieClip;
public var flap:MovieClip;
}
}//package Flapjack_AdventureBound_fla
Section 27
//HUD_SpendMode_34 (Flapjack_AdventureBound_fla.HUD_SpendMode_34)
package Flapjack_AdventureBound_fla {
import flash.display.*;
import flash.text.*;
public dynamic class HUD_SpendMode_34 extends MovieClip {
public var txtTries:TextField;
public var txtNumSuccess:TextField;
}
}//package Flapjack_AdventureBound_fla
Section 28
//instructions_transition_16 (Flapjack_AdventureBound_fla.instructions_transition_16)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class instructions_transition_16 extends MovieClip {
public var btnPlay:MovieClip;
}
}//package Flapjack_AdventureBound_fla
Section 29
//life_preserver_mc_24 (Flapjack_AdventureBound_fla.life_preserver_mc_24)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class life_preserver_mc_24 extends MovieClip {
public function life_preserver_mc_24(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Flapjack_AdventureBound_fla
Section 30
//loaderingbar2copy_2 (Flapjack_AdventureBound_fla.loaderingbar2copy_2)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class loaderingbar2copy_2 extends MovieClip {
public var mainLoadingBar_mc:MovieClip;
public function loaderingbar2copy_2(){
addFrameScript(11, frame12);
}
function frame12(){
gotoAndPlay(1);
}
}
}//package Flapjack_AdventureBound_fla
Section 31
//loading_5 (Flapjack_AdventureBound_fla.loading_5)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class loading_5 extends MovieClip {
public function loading_5(){
addFrameScript(29, frame30);
}
function frame30(){
gotoAndPlay(1);
}
}
}//package Flapjack_AdventureBound_fla
Section 32
//music_btn_mc_44 (Flapjack_AdventureBound_fla.music_btn_mc_44)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class music_btn_mc_44 extends MovieClip {
public function music_btn_mc_44(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Flapjack_AdventureBound_fla
Section 33
//nextBtn_13 (Flapjack_AdventureBound_fla.nextBtn_13)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class nextBtn_13 extends MovieClip {
public function nextBtn_13(){
addFrameScript(37, frame38);
}
function frame38(){
stop();
}
}
}//package Flapjack_AdventureBound_fla
Section 34
//Number100_30 (Flapjack_AdventureBound_fla.Number100_30)
package Flapjack_AdventureBound_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Number100_30 extends MovieClip {
public var tally:TextField;
}
}//package Flapjack_AdventureBound_fla
Section 35
//Play_btn_9 (Flapjack_AdventureBound_fla.Play_btn_9)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class Play_btn_9 extends MovieClip {
public function Play_btn_9(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Flapjack_AdventureBound_fla
Section 36
//preloader_1 (Flapjack_AdventureBound_fla.preloader_1)
package Flapjack_AdventureBound_fla {
import flash.display.*;
import flash.text.*;
public dynamic class preloader_1 extends MovieClip {
public var done_txt:TextField;
public var parentLoader_mc:MovieClip;
public function preloader_1(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package Flapjack_AdventureBound_fla
Section 37
//storyTransition_12 (Flapjack_AdventureBound_fla.storyTransition_12)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class storyTransition_12 extends MovieClip {
public var btnAnimation:MovieClip;
public var btnPlay:MovieClip;
}
}//package Flapjack_AdventureBound_fla
Section 38
//titleContainer_8 (Flapjack_AdventureBound_fla.titleContainer_8)
package Flapjack_AdventureBound_fla {
import flash.display.*;
public dynamic class titleContainer_8 extends MovieClip {
public var btnPlay:MovieClip;
}
}//package Flapjack_AdventureBound_fla
Section 39
//G_GameOver (Game.GameStates.G_GameOver)
package Game.GameStates {
import Base.*;
import flash.display.*;
import UI.*;
import Game.*;
public class G_GameOver extends GameState {
var ui:UIManager;
var sMod:SoundModule;
var startOver:Boolean;
var _gameContext:GameEntry;
var screen:SpriteEntity;
var gameData:GameData;
override public function Entry(_arg1:GameEntry):void{
var _local2:MovieClip;
var _local3:UIButton;
var _local4:UIButton;
trace("@ --> ENTER G_GAME_OVER");
_gameContext = _arg1;
gameData = _gameContext.getGameData();
ui = _gameContext.getUIManager();
sMod = gameData.getSoundModule();
startOver = false;
sMod.playMusic(SoundData.getSoundName(SoundData.BONUS_WHARF_LOOP), 0);
screen = ui.getScreen();
_local2 = (screen.getMovieClip().getChildByName("container") as MovieClip);
_local3 = ui.addButton(_local2, "btnReplay", 1);
_local3.addButtonAnimation(UIButton.STATE_OUT, 1, 1);
_local3.addButtonAnimation(UIButton.STATE_OVER, 2, 15);
_local3.addButtonAnimation(UIButton.STATE_DOWN, 1, 1);
_local3.addButtonSounds(UIButton.STATE_OVER, SoundData.BTN_PRESERVER_OVER);
_local4 = ui.addButton(_local2, "btnContinue", 2);
_local4.addButtonAnimation(UIButton.STATE_OUT, 1, 1);
_local4.addButtonAnimation(UIButton.STATE_OVER, 2, 15);
_local4.addButtonAnimation(UIButton.STATE_DOWN, 1, 1);
_local4.addButtonSounds(UIButton.STATE_OVER, SoundData.BTN_PRESERVER_OVER);
if (gameData._currLevel > 20){
gameData._tracker.sendEventCustom("GameOver_Level_20_Plus");
} else {
if (gameData._currLevel >= 15){
gameData._tracker.sendEventCustom("GameOver_Level_16_to_20");
} else {
if (gameData._currLevel >= 10){
gameData._tracker.sendEventCustom("GameOver_Level_11_to_15");
} else {
if (gameData._currLevel >= 5){
gameData._tracker.sendEventCustom("GameOver_Level_6_to_10");
} else {
gameData._tracker.sendEventCustom("GameOver_Level_1_to_5");
};
};
};
};
}
override public function Update(_arg1:GameEntry):void{
if (startOver){
if (screen.animateSprite() == 1){
_gameContext.getGameManager().setNextState(G_TitleCard);
};
return;
};
switch (ui.getUIReturnVal()){
case 1:
gameData.Init();
gameData.resetLevelNum();
screen.startAnimating(20, 40, false);
startOver = true;
gameData._tracker.sendEventCustom("Restart");
trace("Start Over");
break;
case 2:
gameData.Init();
screen.startAnimating(20, 1, false);
gameData.playSoundByEvent(SoundData.SCREEN_TRANSITION);
_gameContext.getGameManager().setNextState(G_LevelPlay);
gameData._tracker.sendEventCustom("Continue");
trace("Continue");
break;
};
}
public function handleReplay():void{
gameData._gameReplay = true;
}
override public function Exit(_arg1:GameEntry):void{
trace("@ <-- EXIT G_GAME_OVER");
}
}
}//package Game.GameStates
Section 40
//G_Instructions (Game.GameStates.G_Instructions)
package Game.GameStates {
import Base.*;
import flash.events.*;
import flash.display.*;
import UI.*;
import Game.*;
public class G_Instructions extends GameState {
var step:Function;
var transEnd:Boolean;
var _gameContext:GameEntry;
var uiMgr:UIManager;
var screen:SpriteEntity;
var goExit:Boolean;// = false
var gameData:GameData;
public function G_Instructions(){
goExit = false;
super();
}
public function handleTransitionEnd(_arg1:Event):void{
}
public function waitForTransition():void{
if (transEnd){
};
}
override public function Entry(_arg1:GameEntry):void{
var _local2:MovieClip;
var _local3:UIButton;
trace("@ --> ENTER G_INSTRUCTIONS");
_gameContext = _arg1;
uiMgr = _arg1.getUIManager();
gameData = _arg1.getGameData();
transEnd = false;
screen = uiMgr.showScreen("scrn_Instruct", gameData.getGameLayer(GameData.STAGE));
_local2 = (screen.getMovieClip().getChildByName("container") as MovieClip);
_local3 = uiMgr.addButton(_local2, "btnPlay", 1);
_local3.addButtonAnimation(UIButton.STATE_OUT, 1, 1);
_local3.addButtonAnimation(UIButton.STATE_OVER, 20, 25);
_local3.addButtonSounds(UIButton.STATE_OVER, SoundData.BTN_PLAY_OVER);
step = new Function();
step = waitForUserInput;
}
public function waitForUserInput():void{
var _local1:int;
_local1 = uiMgr.getUIReturnVal();
switch (_local1){
case 1:
screen.startAnimating(20, 27, false);
gameData.playSoundByEvent(SoundData.SCREEN_TRANSITION);
_gameContext.getGameManager().setNextState(G_LevelPlay);
break;
};
}
public function addScreenBelowCurrentScreen():void{
}
override public function Update(_arg1:GameEntry):void{
step();
}
public function startTransition():void{
step = waitForTransition;
}
override public function Exit(_arg1:GameEntry):void{
trace("@ <-- EXIT G_INSTRUCTIONS");
}
}
}//package Game.GameStates
Section 41
//G_LevelPlay (Game.GameStates.G_LevelPlay)
package Game.GameStates {
import Base.*;
import flash.events.*;
import flash.display.*;
import UI.*;
import flash.media.*;
import flash.utils.*;
import org.cove.ape.*;
import Game.*;
import Pad.*;
import flash.text.*;
import flash.geom.*;
import Effects.*;
import Game.AIStates.*;
public class G_LevelPlay extends GameState {
var tokenGroup:Group;
var endCollectMode:Boolean;// = false
var isContraptionActive:Boolean;// = false
var patternBuckets:Array;
var offsetX:Number;// = 0
var heroToLaunch:HeroCollect_SP;
var frTik:int;
var isCatchingHero:Boolean;// = false
var paddleX:Number;// = 300
var dock:SpriteEntity;
var collectTimer:Timer;
var bubbleDuration:Number;// = 222
var boundry:Group;
var meterConstraint:Group;
var MusicLoop:SoundChannel;
var instructScreen:SpriteEntity;
var wave1:Wave;
var wave2:Wave;
var wave3:Wave;
var paddleCenter:Number;// = 0
var curProgression:Array;
var velMult:Number;// = 0.15
var isSpawningPaused:Boolean;// = true
var isSuperShootArmed:Boolean;// = false
var meterGroup:Group;
var meterTarget:MeterTarget;
var crateGroup:Group;
var spoutHeight:Number;// = 100
var paddleSpout:Confinement;
var WharfLoop:SoundChannel;
var state:int;
var pad:PadManager;
var ui:UIManager;
var tik:Timer;
var checkpointTimer:Timer;
var idleTiks:int;// = 0
var OceanLoop:SoundChannel;
var tokenDuration:Number;// = 222
var gullLoop:SoundChannel;
var gameData:GameData;
var step:Function;
var tokenFactory:AbstractFactory;
var sndMod:SoundModule;
var paddleTail:CircleParticle;
var isSuperShootActive:Boolean;// = false
var dockScroll:Rectangle;
var patterns:Array;
var btnAnimate:MovieClip;
var board:Sprite;
var paddleConstraint:Group;
var instructionType:int;
var numActiveTokens:int;// = 0
var spawnerOff:Boolean;// = true
var mNe:Number;
var mNf:Number;
var mNm:Number;
var levelEndSign:SpriteEntity;
var frCnt:int;
var progressions:Array;
var rollOver:Boolean;// = false
var getReadyToSpend:Boolean;// = false
var curPatternY:Number;
var numPattern:int;// = 0
var tConfine:Confinement;
var obstacleGroup:Group;
var curPattern:Array;
var curPatternX:Number;
var useContraption:Boolean;// = false
var isLaunching:Boolean;// = false
var isBirdsActive:Boolean;// = false
var chekpointHasHero:Boolean;// = false
var oContraption:Contraption;
var hero_a:HeroCollect_SP;
var hero_b:HeroCollect_SP;
var hero_c:HeroSpend;
var dockFull:Sprite;
var startSuperShoot:Boolean;// = false
var paddle:Paddle;
var curPatternPool:Array;
var dockScrollAmount:Number;// = 8
var paddleCatch:PaddleCatch;
var scrBonusInstruct:SpriteEntity;
var obstacleFactory:AbstractFactory;
var isSprinting:Boolean;// = false
var meterNeedle:MeterNeedle;
var isPlayingSuperLoop:Boolean;// = false
var checkpoint:Checkpoint;
var superShootState:int;// = 1
var world:Group;
var numSpent:Number;// = 0
var spawnCountThisLevel:int;// = 1
var _gameContext:GameEntry;
var heroInWater:HeroCollect_SP;
var paddleForce:VectorForce;
var scrEndLevel:SpriteEntity;
var paddleVX:Number;// = 0
var playButton:MovieClip;
var spawnNewPattern:Boolean;// = true
var crateFactory:AbstractFactory;
var isInPlay:Boolean;// = false
var obstacleSpawns:Array;
public var tokenSpeed:Number;// = 1.5
var gameOverScreen:SpriteEntity;
var totalScoreText:TextField;
var useGulls:Boolean;// = false
public function G_LevelPlay(){
paddleX = 300;
paddleCenter = 0;
paddleVX = 0;
obstacleSpawns = [[[-50, 160], [-100, 180]], [[-60, 130], [-100, 180], [-140, 120]], [[-50, 70], [-100, 100], [-250, 90]], [[-25, 60], [-100, 60], [-170, 85]], [[-25, 60], [-100, 60], [-170, 85], [-300, 80]]];
chekpointHasHero = false;
endCollectMode = false;
isInPlay = false;
getReadyToSpend = false;
velMult = 0.15;
isCatchingHero = false;
isPlayingSuperLoop = false;
isSprinting = false;
startSuperShoot = false;
isSuperShootActive = false;
isSuperShootArmed = false;
superShootState = 1;
isLaunching = false;
spoutHeight = 100;
spawnerOff = true;
spawnNewPattern = true;
spawnCountThisLevel = 1;
isSpawningPaused = true;
curPattern = [];
numPattern = 0;
offsetX = 0;
useGulls = false;
useContraption = false;
progressions = [["collect_1", "collect_2", "collect_3", "collect_4", "super_1", "super_2", "crate_1", "crate_2", "gulls", "pilot"], [80, 20, 0, 0, 0, 0, 0, 0, false, false], [75, 25, 0, 0, 0, 0, 0, 0, true, false], [55, 20, 15, 0, 10, 0, 0, 0, false, true], [45, 10, 10, 0, 5, 0, 20, 10, true, true], [30, 20, 15, 0, 25, 10, 0, 0, true, false], [30, 15, 10, 25, 5, 5, 5, 5, true, true], [30, 20, 15, 10, 5, 15, 5, 0, true, true], [25, 15, 10, 25, 5, 5, 10, 5, true, true], [25, 15, 10, 5, 0, 10, 20, 15, true, true], [25, 20, 20, 10, 5, 10, 5, 5, true, true], [20, 10, 20, 20, 5, 10, 5, 10, true, true], [20, 10, 20, 10, 0, 0, 20, 20, true, true], [20, 20, 20, 5, 15, 15, 0, 5, true, true], [5, 20, 15, 30, 5, 10, 5, 10, true, true], [35, 20, 10, 10, 5, 10, 5, 5, true, true], [15, 10, 20, 25, 10, 5, 10, 5, true, true], [10, 10, 20, 10, 20, 20, 5, 5, true, true], [10, 20, 20, 5, 5, 5, 20, 15, true, true], [35, 20, 20, 5, 5, 5, 5, 5, true, true], [5, 10, 25, 30, 5, 10, 5, 10, true, true], [15, 20, 25, 15, 5, 10, 5, 5, true, true]];
patternBuckets = [[0, 10], [11, 23], [24, 68], [69, 80], [81, 83], [84, 87], [88, 95], [96, 114]];
patterns = [[[288, 192, 1], [360, 192, 1]], [[288, 144, 1], [360, 144, 1]], [[288, 120, 1], [360, 120, 1]], [[432, 192, 1], [504, 192, 1]], [[432, 144, 1], [504, 144, 1]], [[432, 120, 1], [504, 120, 1]], [[384, 216, 1], [456, 216, 1], [421, 24, 1]], [[480, 216, 1], [552, 216, 1], [517, 24, 1]], [[312, 168, 1], [312, 120, 1], [312, 72, 1]], [[504, 168, 1], [504, 120, 1], [504, 72, 1]], [[504, 216, 1], [504, 96, 1], [504, 48, 1], [504, 168, 1]], [[216, 168, 1], [288, 168, 1], [384, 168, 1], [456, 168, 1]], [[216, 120, 1], [288, 120, 1], [480, 120, 1], [552, 120, 1]], [[240, 168, 1], [312, 168, 1], [264, 24, 1], [432, 168, 1], [504, 168, 1], [456, 24, 1]], [[216, 216, 1], [240, 96, 1], [288, 168, 1], [432, 192, 1], [456, 24, 1], [504, 192, 1], [264, 24, 1], [504, 144, 1]], [[264, 168, 1], [264, 120, 1], [264, 72, 1], [456, 168, 1], [456, 120, 1], [456, 72, 1]], [[288, 216, 1], [360, 216, 1], [480, 24, 1], [504, 24, 1]], [[229, 192, 1], [264, 24, 1], [288, 120, 1], [456, 24, 1], [408, 120, 1], [480, 192, 1]], [[312, 24, 1], [264, 168, 1], [480, 24, 1], [288, 24, 1], [336, 168, 1], [480, 72, 1], [480, 144, 1]], [[480, 72, 1], [528, 72, 1], [528, 120, 1], [480, 120, 1], [288, 72, 1], [336, 72, 1], [336, 120, 1], [288, 120, 1]], [[408, 24, 1], [312, 24, 1], [264, 24, 1], [456, 24, 1]], [[480, 168, 1], [408, 168, 1], [312, 24, 1], [264, 168, 1], [456, 24, 1]], [[312, 216, 1], [312, 96, 1], [312, 48, 1], [312, 168, 1], [528, 216, 1], [528, 96, 1], [528, 48, 1], [528, 168, 1]], [[211, 120, 1], [432, 120, 1]], [[240, 120, 1], [504, 120, 1], [432, 24, 1], [312, 24, 1], [264, 24, 1], [480, 24, 1], [384, 120, -1], [384, 72, -1]], [[480, 72, 1], [528, 72, 1], [528, 120, 1], [480, 120, 1], [288, 72, 1], [336, 72, 1], [336, 120, 1], [288, 120, 1], [408, 120, -1], [408, 72, -1]], [[216, 120, 1], [288, 120, 1], [480, 120, 1], [552, 120, 1], [384, 144, -1], [384, 96, -1]], [[312, 216, 1], [312, 96, 1], [312, 48, 1], [312, 168, 1], [528, 216, 1], [528, 96, 1], [528, 48, 1], [528, 168, 1], [432, 96, -1], [432, 168, -1]], [[211, 120, 1], [384, 120, -1], [480, 120, 1]], [[288, 216, 1], [336, 216, -1], [384, 216, 1]], [[456, 216, 1], [504, 216, -1], [552, 216, 1]], [[288, 144, 1], [336, 168, -1], [384, 144, 1], [336, 24, 1]], [[432, 144, 1], [480, 168, -1], [528, 144, 1], [480, 24, 1]], [[336, 96, 1], [360, 168, -1], [384, 96, 1], [360, 24, 1]], [[480, 96, 1], [504, 168, -1], [528, 96, 1], [504, 24, 1]], [[336, 216, 1], [384, 216, -1], [432, 216, 1], [384, 24, 1], [384, 168, -1]], [[456, 216, 1], [504, 216, -1], [552, 216, 1], [504, 24, 1], [504, 168, -1]], [[336, 192, -1], [504, 24, 1], [504, 192, -1], [336, 24, 1]], [[240, 168, 1], [264, 216, -1], [240, 72, 1], [240, 120, 1], [312, 168, 1], [456, 168, 1], [480, 216, -1], [456, 72, 1], [456, 120, 1], [528, 168, 1]], [[240, 24, -1], [336, 24, 1], [432, 24, -1]], [[240, 24, -1], [312, 24, 1], [384, 24, -1], [456, 24, 1], [528, 24, -1]], [[240, 144, -1], [336, 144, 1], [504, 144, -1], [408, 144, 1]], [[288, 96, -1], [360, 96, 1], [504, 96, -1], [432, 96, 1]], [[288, 96, -1], [360, 96, 1], [504, 96, -1], [432, 96, 1], [264, 168, -1], [360, 168, 1], [528, 168, -1], [432, 168, 1]], [[264, 24, -1], [336, 24, 1], [408, 24, -1]], [[384, 24, -1], [456, 24, 1], [528, 24, -1]], [[264, 144, -1], [312, 144, 1], [432, 144, -1], [384, 144, 1]], [[384, 144, -1], [432, 144, 1], [552, 144, -1], [504, 144, 1]], [[264, 96, -1], [312, 96, 1], [432, 96, -1], [384, 96, 1]], [[384, 96, -1], [432, 96, 1], [552, 96, -1], [504, 96, 1]], [[336, 96, -1], [384, 96, 1], [504, 96, -1], [456, 96, 1], [336, 168, -1], [384, 168, 1], [504, 168, -1], [456, 168, 1]], [[192, 96, -1], [240, 96, 1], [360, 96, -1], [312, 96, 1], [192, 168, -1], [240, 168, 1], [360, 168, -1], [312, 168, 1]], [[336, 48, -1], [384, 48, 1], [456, 48, -1], [408, 48, 1], [312, 168, -1], [360, 168, 1], [480, 168, -1], [432, 168, 1]], [[216, 48, -1], [264, 48, 1], [336, 48, -1], [288, 48, 1], [192, 168, -1], [240, 168, 1], [360, 168, -1], [312, 168, 1]], [[211, 120, 1], [336, 120, -1], [480, 120, 1], [408, 120, -1]], [[240, 120, 1], [384, 120, -1], [528, 120, 1], [456, 120, -1], [240, 72, 1], [528, 72, 1], [312, 120, -1]], [[504, 96, 1], [504, 192, 1], [504, 48, -1], [360, 144, 1], [504, 144, 1], [360, 72, 1]], [[504, 96, 1], [504, 192, 1], [504, 48, -1], [360, 144, 1], [504, 144, 1], [360, 72, 1]], [[480, 24, -1], [480, 168, 1], [480, 120, 1], [312, 72, 1], [312, 168, 1], [312, 120, 1], [336, 216, -1], [480, 72, 1]], [[480, 24, -1], [336, 168, 1], [336, 120, 1], [456, 72, 1], [456, 168, 1], [456, 120, 1], [480, 216, -1], [336, 72, 1]], [[384, 168, 1], [408, 216, -1], [384, 72, 1], [384, 120, 1], [432, 96, 1], [456, 168, -1]], [[264, 168, 1], [288, 216, -1], [264, 72, 1], [264, 120, 1], [312, 96, 1], [336, 168, -1]], [[432, 168, 1], [456, 216, -1], [432, 72, 1], [432, 120, 1], [480, 96, 1], [456, 24, -1]], [[288, 168, 1], [312, 216, -1], [288, 72, 1], [288, 120, 1], [336, 96, 1], [312, 24, -1]], [[384, 168, 1], [384, 120, 1], [432, 120, 1], [408, 72, -1], [432, 168, 1]], [[240, 168, 1], [240, 120, 1], [288, 120, 1], [264, 72, -1], [288, 168, 1]], [[384, 168, 1], [384, 120, 1], [480, 120, 1], [384, 48, -1], [480, 168, 1], [480, 72, 1]], [[384, 168, 1], [384, 120, 1], [432, 120, 1], [408, 24, -1], [432, 168, 1], [384, 72, 1], [408, 216, -1]], [[240, 168, 1], [240, 120, 1], [288, 120, 1], [264, 24, -1], [288, 168, 1], [240, 72, 1], [264, 216, -1]], [[312, 24, 1], [480, 192, -1], [312, 168, -1], [480, 24, 1], [264, 216, 1], [312, 216, -1], [360, 216, 1], [456, 96, 1], [504, 96, 1]], [[288, 96, -1], [336, 96, 1], [432, 96, -1], [384, 96, 1], [480, 96, 1], [576, 96, -1], [528, 96, 1]], [[264, 96, -1], [312, 96, 1], [408, 96, -1], [360, 96, 1], [264, 168, -1], [312, 168, 1], [408, 168, -1], [360, 168, 1], [456, 96, 1], [552, 96, -1], [504, 96, 1], [456, 168, 1], [552, 168, -1], [504, 168, 1]], [[264, 96, -1], [312, 96, 1], [408, 96, -1], [360, 96, 1], [264, 168, -1], [312, 168, 1], [408, 168, -1], [360, 168, 1], [312, 24, 1], [264, 24, -1], [336, 24, 1], [384, 24, -1]], [[384, 96, -1], [432, 96, 1], [528, 96, -1], [480, 96, 1], [384, 168, -1], [432, 168, 1], [528, 168, -1], [480, 168, 1], [432, 24, 1], [384, 24, -1], [456, 24, 1], [504, 24, -1]], [[264, 24, -1], [336, 24, 1], [408, 24, -1], [480, 24, 1], [552, 24, -1], [120, 24, -1], [192, 24, 1]], [[312, 24, 1], [312, 168, -1], [264, 216, 1], [360, 216, 1], [432, 24, -1], [504, 24, 1], [552, 24, -1], [480, 24, 1]], [[312, 24, 1], [312, 216, -1], [288, 168, 1], [360, 168, 1], [264, 24, -1], [384, 24, -1], [336, 24, 1]], [[480, 24, 1], [480, 216, -1], [456, 168, 1], [528, 168, 1], [432, 24, -1], [552, 24, -1], [504, 24, 1]], [[288, 96, 1], [312, 216, -1], [288, 168, 1], [360, 168, 1], [432, 96, -1], [480, 96, -1], [312, 24, 1], [552, 96, 1], [552, 144, 1], [552, 48, 1]], [[240, 24, -1], [360, 24, -1], [288, 24, 1], [312, 24, 1], [432, 96, -1], [432, 144, -1], [480, 96, 1], [480, 144, 1], [480, 48, 1], [528, 96, 1], [528, 144, 1], [528, 48, 1], [576, 96, -1], [576, 144, -1]], [[216, 120, -1], [360, 120, -1], [288, 24, 1], [312, 24, 1], [288, 216, -1], [432, 120, -1], [504, 96, 1], [504, 144, 1], [504, 48, 1], [264, 120, 1], [264, 168, 1]], [[456, 144, 1], [408, 144, 1], [360, 144, 1], [312, 144, 1], [264, 144, 1], [216, 144, 1]], [[408, 144, 1], [384, 144, 1], [336, 144, 1], [312, 144, 1], [264, 144, 1], [240, 144, 1], [480, 144, 1], [456, 144, 1]], [[432, 144, 1], [384, 144, 1], [336, 144, 1], [288, 144, 1], [240, 144, 1], [192, 144, 1], [480, 144, 1], [528, 144, 1], [576, 144, 1]], [[456, 144, 1], [408, 144, 1], [360, 144, 1], [312, 144, 1], [264, 144, 1], [216, 144, 1], [264, 216, -1], [312, 216, -1], [360, 216, -1], [408, 216, -1]], [[456, 144, 1], [408, 144, 1], [360, 144, 1], [312, 144, 1], [264, 144, 1], [216, 144, 1], [264, 216, -1], [312, 216, -1], [360, 216, -1], [408, 216, -1], [264, 72, -1], [312, 72, -1], [360, 72, -1], [408, 72, -1]], [[576, 144, 1], [528, 144, 1], [480, 144, 1], [432, 144, 1], [384, 144, 1], [336, 144, 1], [384, 216, -1], [432, 216, -1], [480, 216, -1], [528, 216, -1], [240, 144, -1], [240, 168, -1], [240, 192, -1], [240, 216, -1], [288, 144, 1]], [[384, 168, 1], [336, 168, 1], [288, 168, 1], [432, 144, 1], [384, 144, 1], [336, 144, 1], [384, 216, -1], [432, 216, -1], [480, 216, -1], [336, 216, -1], [240, 144, -1], [240, 168, -1], [240, 192, -1], [240, 216, -1], [288, 144, 1], [432, 168, 1], [576, 144, -1], [576, 168, -1], [576, 192, -1], [576, 216, -1], [480, 168, 1], [528, 144, 1], [480, 144, 1], [528, 168, 1]], [[360, 72, 4]], [[504, 72, 4]], [[360, 72, 4], [528, 72, 4]], [[288, 120, 4], [528, 120, 4]], [[360, 96, 4], [528, 144, 1], [528, 72, 1], [528, 24, 1]], [[528, 48, 4], [336, 168, 1], [408, 168, 1], [360, 24, 1], [384, 24, 1]], [[480, 48, 4], [288, 144, 1], [480, 144, 1], [480, 96, 1], [288, 96, 1], [288, 48, 1]], [[312, 96, 4], [504, 120, 4], [264, 168, 1], [288, 24, 1], [264, 96, 1]], [[336, 72, 4], [528, 72, 4], [432, 72, -1]], [[216, 72, 4], [408, 72, 4], [312, 72, -1]], [[360, 72, 4], [504, 72, 4], [432, 72, -1]], [[216, 72, 4], [360, 72, 4], [288, 72, -1]], [[408, 48, 4], [408, 216, -1]], [[312, 72, 4], [456, 72, 4], [384, 72, -1], [528, 72, -1]], [[360, 120, 4], [504, 48, 4], [432, 72, -1], [576, 72, -1]], [[336, 72, 4], [576, 72, 4], [456, 72, -1], [504, 72, -1], [408, 72, -1]], [[336, 48, 4], [504, 72, 4], [240, 24, -1], [432, 24, -1], [432, 72, -1]], [[336, 72, 4], [528, 72, 4], [432, 72, -1]], [[504, 48, 4], [312, 48, 1], [312, 96, 1], [312, 144, 1], [408, 48, -1], [240, 48, -1], [504, 216, -1], [408, 96, -1], [480, 168, 1], [480, 120, 1]], [[216, 120, 1], [288, 120, 1], [384, 144, -1], [384, 96, -1], [504, 48, 4]], [[480, 144, 1], [504, 216, -1], [504, 48, 4]], [[288, 144, 1], [312, 216, -1], [312, 48, 4]], [[384, 144, 1], [384, 24, -1], [384, 96, 4], [384, 192, 1]], [[264, 144, 1], [264, 24, -1], [264, 96, 4], [264, 192, 1]], [[528, 144, 1], [528, 24, -1], [528, 96, 4], [528, 192, 1]], [[360, 72, 1], [480, 24, -1], [480, 96, 4], [360, 120, 1]], [[504, 72, 1], [504, 24, -1], [360, 96, 4], [504, 120, 1], [504, 168, 1]]];
tokenSpeed = 1.5;
tokenDuration = 222;
bubbleDuration = 222;
numActiveTokens = 0;
isBirdsActive = false;
isContraptionActive = false;
rollOver = false;
idleTiks = 0;
numSpent = 0;
dockScrollAmount = 8;
super();
}
function initGameEngine():void{
var _local1:RectangleParticle;
var _local2:RectangleParticle;
var _local3:*;
var _local4:*;
sndMod = gameData.getSoundModule();
gameData.configGameLayers();
gameData.addOverlayContainer();
board = (gameData.getGameLayer(GameData.BOARD) as Sprite);
APEngine.init(1);
APEngine.container = gameData._board;
APEngine.addForce(new VectorForce(false, 0, 1));
APEngine.damping = 1;
boundry = new Group();
APEngine.addGroup(boundry);
_local1 = new RectangleParticle(-35, 200, 50, 600, 0, true, 1, 1E-6, 0);
_local2 = new RectangleParticle(635, 200, 50, 600, 0, true, 1, 1E-6, 0);
_local3 = new Ground(_gameContext, 300, 475, 900, 50, 0, true, 1, 1E-6, 0);
_local4 = new RectangleParticle(300, -100, 900, 50, 0, true, 1, 1E-6, 0);
boundry.addParticle(_local1);
boundry.addParticle(_local2);
boundry.addParticle(_local3);
boundry.addParticle(_local4);
gameData.showHUD();
gameData.configureHUD();
initCollectMode();
initSpendMode();
instructionType = 0;
step = enterGameStart;
}
function playCollectMode():void{
if (gameData.getGameMode() == GameData.GAME_PAUSED){
trace("Paused");
return;
};
if (gameData._showInstructions){
gameData.setGameMode(GameData.GAME_PAUSED);
instructionType = 1;
step = startInstructions;
return;
};
gameData.updateCamera();
updateTokenSpawner();
updateTokens();
gameData.updateHUD();
paddleMove(_gameContext.mouseX);
hero_a.updateState();
hero_b.updateState();
checkpoint.updateState();
if (isBirdsActive){
updateAirObstacles();
};
if (isContraptionActive){
updateContraption();
};
if (isSuperShootActive){
updateSuperShoot();
};
if (getReadyToSpend){
levelEndSign.setPositionX((levelEndSign.getPositionX() - 3));
if (levelEndSign.getPositionX() <= -50){
levelEndSign.setPositionX(700);
step = enterCollectModeToSpend;
return;
};
if (levelEndSign.getPositionX() <= 300){
if (((isSuperShootActive) || (isPlayingSuperLoop))){
killSuperShoot();
spawnerOff = true;
};
if (hero_a.isConfined){
hero_a.breakOut();
};
if (hero_b.isConfined){
hero_b.breakOut();
};
return;
};
};
if (((hero_a.isInWater) && (hero_b.isInWater))){
frTik = 0;
frCnt = 45;
step = enterCollectModeToGameOver;
return;
};
if ((((hero_a.state == HeroCollect_SP.SPLASH_DOWN)) || ((hero_b.state == HeroCollect_SP.SPLASH_DOWN)))){
if (heroInWater != null){
trace("Already Hero In Water");
return;
};
heroInWater = ((hero_a.state)==HeroCollect_SP.SPLASH_DOWN) ? hero_a : hero_b;
checkpoint.addRescue(heroInWater);
} else {
if (heroInWater != null){
heroInWater = null;
};
};
if (((pad.getMouseStillPressed()) && ((pad.getMousePosY() < 360)))){
if (((((((((((hero_a.isHome) && (!(hero_a.isDisabled)))) && (hero_b.isHome))) && (!(hero_b.isDisabled)))) && ((pad.getMouseTimePressed() > 0.6)))) && (!(isSuperShootArmed)))){
paddle.animator.startAnimating(60, 62, false);
startSuperShoot = true;
isSuperShootArmed = true;
};
};
if (((pad.getMouseReleased()) && ((pad.getMousePosY() < 360)))){
if (isSuperShootArmed){
paddle.playAnimation(Paddle.ANIM_SUPERSHOOT);
hero_a.launch(paddleCenter, (paddleCatch.py - 10), 0, -18);
hero_b.launch(paddleCenter, paddleCatch.py, 0, -18);
paddleSpout.setPosition(paddleCenter, (paddleCatch.py - 20));
frTik = 0;
frCnt = 100;
velMult = 0.05;
isLaunching = true;
superShootState = 1;
isSuperShootActive = true;
isSuperShootArmed = false;
gameData.playSoundByEvent(SoundData.MAIN_BUBBIE_PWR_SHOT);
return;
};
if (heroToLaunch.isDisabled){
heroToLaunch = ((heroToLaunch)==hero_a) ? hero_b : hero_a;
};
if (heroToLaunch.isHome){
paddle.playAnimation(Paddle.ANIM_SHOOT);
isLaunching = true;
heroToLaunch.launch(paddleCenter, paddleCatch.py, 0, -32);
gameData.playSoundByEvent(SoundData.MAIN_BUBBIE_SHOT);
heroToLaunch = ((heroToLaunch)==hero_a) ? hero_b : hero_a;
};
};
}
function startBonusStory():void{
var _local1:MovieClip;
scrBonusInstruct = new SpriteEntity(_gameContext, "scrn_BonusInstructions", gameData.getGameLayer(GameData.WORLD));
_local1 = (scrBonusInstruct.getMovieClip().getChildByName("container") as MovieClip);
playButton = (_local1.getChildByName("btnPlay") as MovieClip);
playButton.buttonMode = true;
playButton.useHandCursor = true;
btnAnimate = (_local1.getChildByName("btnAnimation") as MovieClip);
btnAnimate.gotoAndStop(1);
scrBonusInstruct.startAnimating(1, 20, false);
step = playBonusStory;
}
function logTime(_arg1:TimerEvent=null):void{
if (gameData.getGameMode() == GameData.GAME_PAUSED){
return;
};
if (isInPlay){
gameData._time++;
};
if ((((gameData._time == 95)) && ((endCollectMode == false)))){
startCollectModeToSpend();
};
}
function destroyTokens(){
var _local1:int;
var _local2:*;
_local1 = tokenGroup.particles.length;
while (_local1--) {
_local2 = tokenGroup.particles[_local1];
_local2.selfDestruct();
tokenGroup.removeParticle(_local2);
};
}
function enterCollectModeToReady():void{
isInPlay = false;
gameData.updateCamera();
hero_a.reset();
hero_b.reset();
frTik = 0;
paddle.playAnimation(Paddle.ANIM_DIVE_DOWN);
destroyTokens();
updateTokens();
checkpoint.reset();
checkpoint.updateState();
if (isBirdsActive){
updateAirObstacles();
};
if (isContraptionActive){
updateContraption();
};
gameData.updateHUD();
step = playCollectModeToReady;
}
override public function Entry(_arg1:GameEntry):void{
trace(("@ --> ENTER " + this));
_gameContext = _arg1;
gameData = _arg1.getGameData();
gameData.setGameState(this);
pad = _arg1.getPadManager();
ui = _arg1.getUIManager();
step = new Function();
step = initGameEngine;
}
function paddleMove(_arg1:Number):void{
var _local2:int;
paddleCenter = paddle.px;
paddleVX = (_arg1 - paddleCenter);
if (Math.abs(paddleVX) >= 5){
paddleVX = (paddleVX * velMult);
paddleForce.vx = paddleVX;
paddle.addForce(paddleForce);
} else {
paddleVX = 0;
paddle.velocity.setTo(0, 0);
};
paddleCatch.px = (paddleCenter + (paddleVX * 0.4));
paddleTail.px = ((paddleCenter + (paddleVX * 0.4)) - 70);
_local2 = paddle.animator.animateSprite();
if (isSuperShootArmed){
return;
};
if (isSuperShootActive){
if (isPlayingSuperLoop){
return;
};
if (_local2 == 1){
paddle.playAnimation(Paddle.ANIM_SUPERLOOP);
isPlayingSuperLoop = true;
};
return;
};
if (isCatchingHero){
if (_local2 == 1){
isCatchingHero = false;
};
return;
};
if (isLaunching){
if (_local2 == 1){
isLaunching = false;
};
return;
};
if (paddleVX > 25){
paddle.animator.moveToFrame(100);
if (isSprinting){
return;
};
isSprinting = true;
gameData.playSoundByEvent(SoundData.MAIN_BUBBIE_SPRINT);
} else {
if (paddleVX > 10){
paddle.animator.moveToFrame(80);
} else {
isSprinting = false;
paddle.animator.moveToFrame(5);
};
};
}
function playBonusStory():void{
var _local1:*;
var _local2:*;
scrBonusInstruct.animateSprite();
if (((pad.getMouseJustPressed()) && (rollOver))){
resetDockMove();
dockFull.visible = true;
scrBonusInstruct.startAnimating(40, 47, false);
step = exitBonusStory;
return;
};
_local1 = pad.getMousePosX();
_local2 = pad.getMousePosY();
if ((((((((((_local1 >= 378)) && ((_local1 <= 520)))) && ((_local2 >= 328)))) && ((_local2 <= 375)))) && ((rollOver == false)))){
rollOver = true;
gameData.playSoundByEvent(SoundData.BTN_SCRIBBLE_OVER);
btnAnimate.gotoAndPlay(20);
} else {
if ((((((((_local1 <= 378)) || ((_local1 >= 520)))) || ((_local2 <= 328)))) || ((((_local2 >= 375)) && ((rollOver == true)))))){
rollOver = false;
btnAnimate.gotoAndStop(1);
};
};
}
public function toString():String{
return ("G_LevelPlay()");
}
function spawnAirborneObstacles(_arg1:TimerEvent=null):void{
var _local2:int;
var _local3:Number;
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:AirObstacle;
var _local8:int;
_local2 = (obstacleSpawns.length - 1);
_local3 = PM_PRNG.nextIntRange(0, _local2);
_local4 = obstacleSpawns[_local3].length;
while (_local4--) {
_local5 = obstacleSpawns[_local3][_local4][0];
_local6 = obstacleSpawns[_local3][_local4][1];
_local7 = obstacleFactory.getInstance();
_local8 = 10;
_local7.spawn(_local5, _local6, _local8);
obstacleGroup.addParticle(_local7);
};
gullLoop = sndMod.startLoopFade(SoundData.getSoundName(SoundData.MAIN_GULLS_LOOP), 2000);
isBirdsActive = true;
}
function enterEndLevel():void{
if (scrEndLevel.animateSprite() == 1){
hero_c.setVisibility(false);
meterTarget.visible = false;
meterNeedle.visible = false;
dockFull.visible = false;
gameData.setHudMode(0);
gameData.resetHUD();
gameData.updateHUD();
gameData.playSoundByEvent(SoundData.BONUS_SCORE_CALC);
step = playEndLevel;
};
}
function updateDockMove():void{
var _local1:Number;
_local1 = (dockScroll.x + dockScrollAmount);
dockScroll.x = ((_local1)>=2717) ? 0 : _local1;
dockFull.scrollRect = dockScroll;
}
function updateTokenSpawner():void{
var _local1:int;
var _local2:int;
if (((getReadyToSpend) || (endCollectMode))){
return;
};
if (((!(spawnNewPattern)) && ((numActiveTokens == 0)))){
destroyTokens();
spawnNewPattern = true;
};
if (spawnNewPattern){
spawnNewPattern = false;
curPattern = getNewPattern();
spawnPattern();
if (getReadyToSpend){
return;
};
if (useGulls){
if (isBirdsActive){
return;
};
_local1 = PM_PRNG.nextDoubleRange(0, 100);
if (_local1 < 25){
spawnAirborneObstacles();
};
};
if (useContraption){
if (isContraptionActive){
return;
};
_local2 = PM_PRNG.nextDoubleRange(0, 100);
if (_local2 < 25){
spawnContraption();
};
};
};
}
public function setIsCatching():void{
isCatchingHero = true;
}
function exitSpendMode():void{
showEndLevelScore();
gameData.playSoundByEvent(SoundData.SCREEN_TRANSITION);
scrEndLevel.startAnimating(1, 20, false);
step = enterEndLevel;
}
function exitEndLevel():void{
if (scrEndLevel.animateSprite() == 1){
step = enterCollectModeFromSpend;
};
}
function showEndLevelScore():void{
var _local1:MovieClip;
var _local2:Number;
_local1 = scrEndLevel.getMovieClip()._comp;
_local1._numPoints.text = String(gameData._scoreLevel);
_local1._numBonus.text = String(gameData._clkSuccess);
if (gameData._clkSuccess > 0){
_local2 = (gameData._scoreLevel * gameData._clkSuccess);
} else {
_local2 = gameData._scoreLevel;
};
_local1._scoreSubTotal.text = String(_local2);
gameData._score = (gameData._score + _local2);
_local1._scoreTotal.text = String(gameData._score);
}
function exitCollectModeToSpend():void{
hero_a.reset();
hero_b.reset();
checkpoint.reset();
checkpoint.updateState();
if (gameData._currLevel > 1){
step = enterPlaySpendMode;
return;
};
step = startBonusStory;
}
function initCollectMode():void{
var _local1:Group;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:Array;
var _local16:Group;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Confinement;
var _local22:CircleParticle;
var _local23:CircleParticle;
var _local24:Confinement;
var _local25:CircleParticle;
var _local26:CircleParticle;
gameData.configBackground();
world = new Group();
APEngine.addGroup(world);
levelEndSign = new SpriteEntity(_gameContext, "endLevelSign", board, 700, 275);
wave3 = new Wave(_gameContext, 3, 250, 360, 700, 150);
world.addParticle(wave3);
_local1 = new Group();
checkpoint = new Checkpoint(_gameContext, 700, 370);
APEngine.addGroup(_local1);
_local1.addParticle(checkpoint);
_local1.addCollidable(world);
wave2 = new Wave(_gameContext, 2, 300, 420, 700, 150);
world.addParticle(wave2);
dock = new SpriteEntity(_gameContext, "spr_dock", board, 600, 234);
_local2 = 300;
_local3 = 340;
_local4 = 60;
_local5 = 200;
_local6 = 0.5;
_local7 = 0;
paddleForce = new VectorForce(false, 0, 0);
paddle = new Paddle(_gameContext, _local2, _local3, _local4, false, _local5, _local6, _local7);
world.addParticle(paddle);
paddleCatch = new PaddleCatch(_gameContext, _local2, (_local3 - _local4), 35, true, 1, 1E-5, 1);
paddleCatch.setStyle(0, 0, 0, 0xFFFFFF, 0);
world.addParticle(paddleCatch);
paddleTail = new CircleParticle((_local2 - 70), (_local3 + 10), 20, true, 1, 0.4, _local7);
paddleTail.setStyle(0, 0, 0, 0xFFFFFF, 0);
world.addParticle(paddleTail);
paddleSpout = new Confinement(_gameContext, -200, 0, 80, 150, 60);
world.addComposite(paddleSpout);
_local8 = 10;
_local9 = 100;
_local10 = 800;
paddleConstraint = new Group();
APEngine.addGroup(paddleConstraint);
_local11 = new RectangleParticle((-20 + (-(_local8) / 2)), _local3, _local8, _local9, 0, true, 100, 1E-8, 1);
_local11.setStyle(0, 0, 0, 0xFFFFFF, 0);
paddleConstraint.addParticle(_local11);
_local12 = new RectangleParticle((620 + (_local8 / 2)), _local3, _local8, _local9, 0, true, 100, 1E-8, 1);
_local12.setStyle(0, 0, 0, 0xFFFFFF, 0);
paddleConstraint.addParticle(_local12);
_local13 = new RectangleParticle(_local2, (_local3 - ((_local8 / 2) + _local4)), _local10, _local8, 0, true, 100, 1E-8, 0);
_local13.setStyle(0, 0, 0, 0xFFFFFF, 0);
paddleConstraint.addParticle(_local13);
_local14 = new RectangleParticle(_local2, (_local3 + ((_local8 / 2) + _local4)), _local10, _local8, 0, true, 100, 1E-8, 1);
_local14.setStyle(0, 0, 0, 0xFFFFFF, 0);
paddleConstraint.addParticle(_local14);
world.addCollidableList(new Array(paddleConstraint));
tokenGroup = new Group();
APEngine.addGroup(tokenGroup);
crateGroup = new Group();
APEngine.addGroup(crateGroup);
_local15 = new Array(tokenGroup);
tokenFactory = new AbstractFactory(_gameContext, "Game::Token", "initFactoryObject", _local15, 10);
crateFactory = new AbstractFactory(_gameContext, "Game::Crate", "initFactoryObject", _local15, 4);
obstacleGroup = new Group();
APEngine.addGroup(obstacleGroup);
_local15 = new Array(obstacleGroup);
obstacleFactory = new AbstractFactory(_gameContext, "Game::AirObstacle", "initFactoryObject", _local15, 5);
oContraption = new Contraption(_gameContext, -200, -100, 50, 100);
world.addParticle(oContraption);
spawnerOff = false;
_local16 = new Group();
APEngine.addGroup(_local16);
_local17 = 7;
_local18 = 0.2;
_local19 = 0;
_local20 = 0;
_local21 = new Confinement(_gameContext, -200, 0, 50, 50, 10);
world.addComposite(_local21);
_local22 = new CircleParticle(275, 430, 15, false, _local17, _local18, _local19);
_local23 = new CircleParticle(275, 450, 10, false, 2, _local18, _local19);
hero_a = new HeroCollect_SP(_gameContext, 1, _local21, _local22, _local23);
_local24 = new Confinement(_gameContext, -200, 0, 50, 50, 10);
world.addComposite(_local24);
_local25 = new CircleParticle(275, 430, 15, false, _local17, _local18, _local19);
_local26 = new CircleParticle(275, 450, 10, false, 2, _local18, _local19);
hero_b = new HeroCollect_SP(_gameContext, 2, _local24, _local25, _local26);
_local16.addParticle(_local22);
_local16.addParticle(_local23);
_local16.addParticle(_local25);
_local16.addParticle(_local26);
_local16.addConstraint(hero_a);
_local16.addConstraint(hero_b);
_local16.addCollidableList(new Array(world, boundry, tokenGroup, crateGroup, obstacleGroup));
heroToLaunch = hero_a;
wave1 = new Wave(_gameContext, 1, 300, 415, 900, 150);
world.addParticle(wave1);
collectTimer = new Timer(1000, 0);
collectTimer.addEventListener(TimerEvent.TIMER, logTime, false, 1, true);
}
function updateContraption():void{
oContraption.updateMove();
if (oContraption.isActive == false){
isContraptionActive = false;
};
}
public function spawnCrateTokens(_arg1:Number, _arg2:Number, _arg3:Number=6):void{
var _local4:Number;
var _local5:Number;
var _local6:int;
var _local7:int;
var _local8:Number;
while (_arg3--) {
_local4 = PM_PRNG.nextDoubleRange((_arg1 - 5), (_arg1 + 5));
_local5 = PM_PRNG.nextDoubleRange((_arg2 - 50), _arg2);
_local6 = SoundData.MAIN_HERO_COLLECT_TOKEN;
_local7 = (((spawnCountThisLevel++ % 10))==0) ? 2 : 1;
_local8 = (_arg3 * 10);
spawnToken(_local8, _local7, _local4, _local5, _local6);
};
}
function spawnContraption(_arg1:TimerEvent=null):void{
var _local2:Number;
_local2 = PM_PRNG.nextDoubleRange(100, 200);
oContraption.spawn(-100, _local2);
isContraptionActive = true;
}
function playGameStart():void{
var _local1:int;
_local1 = ui.getScreen().animateSprite();
if (_local1 == 1){
scrEndLevel = ui.showScreen("scrn_End_Level", gameData.getGameLayer(GameData.WORLD));
step = enterCollectReady;
};
}
function playEndLevel():void{
if (pad.getMouseJustPressed()){
gameData.playSoundByEvent(SoundData.SCREEN_TRANSITION);
scrEndLevel.startAnimating(20, 1, false);
step = exitEndLevel;
};
}
function exitCollectReady():void{
gameData.updateCamera();
if (isBirdsActive){
updateAirObstacles();
};
if (paddle.animator.animateSprite() == 1){
endCollectMode = false;
spawnerOff = false;
isInPlay = true;
paddle.playAnimation(Paddle.ANIM_IDLE);
step = playCollectMode;
};
}
override public function Update(_arg1:GameEntry):void{
step();
APEngine.step();
APEngine.paint();
}
function setProgression():void{
var _local1:*;
var _local2:int;
var _local3:int;
if (gameData._currLevel < (progressions.length - 1)){
curProgression = progressions[gameData._currLevel];
} else {
_local2 = PM_PRNG.nextIntRange((progressions.length - 6), (progressions.length - 1));
curProgression = progressions[_local2];
};
curPatternPool = new Array();
_local1 = 0;
while (_local1 < (curProgression.length - 2)) {
_local3 = curProgression[_local1];
while (_local3--) {
curPatternPool.push(_local1);
};
_local1++;
};
useGulls = curProgression[8];
useContraption = curProgression[9];
}
function tracePatternNum(_arg1:int):void{
switch (_arg1){
case 0:
trace("Collect 1");
break;
case 1:
trace("Collect 2");
break;
case 2:
trace("Collect 3");
break;
case 3:
trace("Collect 4");
break;
case 4:
trace("Super 1");
break;
case 5:
trace("Super 2");
break;
case 6:
trace("Crate 1");
break;
case 7:
trace("Crate 2");
break;
};
}
function exitCollectModeToReady():void{
gameData.updateCamera();
step = enterCollectReady;
}
function updateAirObstacles():void{
var _local1:int;
_local1 = obstacleGroup.particles.length;
if (_local1 < 1){
if (gullLoop != null){
sndMod.addChannelToFadeOut(gullLoop, 2000);
gullLoop = null;
};
isBirdsActive = false;
return;
};
while (_local1--) {
obstacleGroup.particles[_local1].updateMove();
};
}
function spawnCrate(_arg1:Number, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int):void{
var _local6:Crate;
_local6 = crateFactory.getInstance();
_local6.initSpawn(_arg1, _arg2, _arg3, _arg4, _arg5);
tokenGroup.addParticle(_local6);
}
function updateSuperShoot():void{
var _local1:Number;
_local1 = 0;
if (getFramesDelay(frTik++)){
killSuperShoot();
return;
};
switch (superShootState){
case 1:
if (paddleSpout.getY() >= spoutHeight){
_local1 = (paddleSpout.getY() + -10);
} else {
_local1 = spoutHeight;
superShootState++;
};
break;
case 2:
_local1 = (paddleSpout.getY() + 20);
superShootState++;
break;
case 3:
if (paddleSpout.getY() >= spoutHeight){
_local1 = (paddleSpout.getY() + -4);
} else {
_local1 = spoutHeight;
superShootState--;
};
break;
};
paddleSpout.setPosition(paddleCenter, _local1);
}
function playInstructions():void{
var _local1:*;
var _local2:*;
instructScreen.animateSprite();
_local1 = pad.getMousePosX();
_local2 = pad.getMousePosY();
switch (instructionType){
case 1:
if (((pad.getMouseJustPressed()) && (rollOver))){
instructScreen.startAnimating(20, 26, false);
step = exitInstructions;
return;
};
if ((((((((((_local1 >= 440)) && ((_local1 <= 580)))) && ((_local2 >= 240)))) && ((_local2 <= 370)))) && ((rollOver == false)))){
rollOver = true;
gameData.playSoundByEvent(SoundData.BTN_PLAY_OVER);
playButton.gotoAndPlay(20);
} else {
if ((((((((_local1 <= 440)) || ((_local1 >= 580)))) || ((_local2 <= 240)))) || ((((_local2 >= 370)) && ((rollOver == true)))))){
rollOver = false;
playButton.gotoAndStop(1);
};
};
break;
case 2:
if (((pad.getMouseJustPressed()) && (rollOver))){
instructScreen.startAnimating(40, 47, false);
step = exitInstructions;
return;
};
if ((((((((((_local1 >= 378)) && ((_local1 <= 520)))) && ((_local2 >= 328)))) && ((_local2 <= 375)))) && ((rollOver == false)))){
rollOver = true;
gameData.playSoundByEvent(SoundData.BTN_SCRIBBLE_OVER);
btnAnimate.gotoAndPlay(20);
} else {
if ((((((((_local1 <= 378)) || ((_local1 >= 520)))) || ((_local2 <= 328)))) || ((((_local2 >= 375)) && ((rollOver == true)))))){
rollOver = false;
btnAnimate.gotoAndStop(1);
};
};
break;
};
}
function spendExitDelayFail():void{
hero_c.update();
dockScrollAmount = (dockScrollAmount * 0.95);
if (dockScrollAmount < 1){
dockScrollAmount = 0;
updateDockMove();
step = exitSpendMode;
return;
};
updateDockMove();
}
function startCollectModeToSpend(_arg1:Event=null):void{
getReadyToSpend = true;
}
function startInstructions():void{
var _local1:MovieClip;
var _local2:MovieClip;
switch (instructionType){
case 1:
instructScreen = new SpriteEntity(_gameContext, "scrn_Instruct", gameData.getGameLayer(GameData.STAGE));
_local1 = (instructScreen.getMovieClip().getChildByName("container") as MovieClip);
playButton = (_local1.getChildByName("btnPlay") as MovieClip);
playButton.buttonMode = true;
playButton.useHandCursor = true;
instructScreen.startAnimating(26, 20, false);
step = playInstructions;
break;
case 2:
instructScreen = new SpriteEntity(_gameContext, "scrn_BonusInstructions", gameData.getGameLayer(GameData.STAGE));
_local2 = (instructScreen.getMovieClip().getChildByName("container") as MovieClip);
playButton = (_local2.getChildByName("btnPlay") as MovieClip);
playButton.buttonMode = true;
playButton.useHandCursor = true;
btnAnimate = (_local2.getChildByName("btnAnimation") as MovieClip);
btnAnimate.gotoAndStop(1);
instructScreen.startAnimating(1, 20, false);
step = playInstructions;
break;
};
gameData.playSoundByEvent(SoundData.SCREEN_TRANSITION);
}
public function getHeroByNumber(_arg1:int):HeroCollect_SP{
return (((_arg1)==1) ? hero_a : hero_b);
}
function resetDockMove():void{
dockScroll.x = 0;
dockFull.scrollRect = dockScroll;
}
override public function Exit(_arg1:GameEntry):void{
trace(("@ <-- EXIT " + this));
trace("");
}
function playGameOver():void{
totalScoreText.text = String(gameData._score);
if (gameOverScreen.animateSprite() == 1){
APEngine.removeAllForce();
APEngine.removeGroup(world);
APEngine.removeGroup(boundry);
APEngine.removeGroup(tokenGroup);
APEngine.removeGroup(crateGroup);
APEngine.removeGroup(obstacleGroup);
APEngine.removeGroup(paddleConstraint);
APEngine.removeGroup(meterGroup);
APEngine.removeGroup(meterConstraint);
gameData.clearGameContainers();
step = exitToGameOver;
};
}
function exitToGameOver():void{
_gameContext.getGameManager().setNextState(G_GameOver);
}
function spendExitDelay():void{
hero_c.update();
dockScrollAmount = (dockScrollAmount * 0.95);
if (dockScrollAmount < 1){
dockScrollAmount = 0;
updateDockMove();
step = exitSpendMode;
return;
};
updateDockMove();
}
function spawnToken(_arg1:Number, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int):void{
var _local6:Token;
_local6 = tokenFactory.getInstance();
_local6.initSpawn(_arg1, _arg2, _arg3, _arg4, _arg5);
tokenGroup.addParticle(_local6);
}
function getFramesDelay(_arg1:int):Boolean{
return (((_arg1)>=frCnt) ? true : false);
}
function playCollectModeToSpend():void{
var _local1:int;
paddleMove(300);
updateTokens();
if (isBirdsActive){
updateAirObstacles();
};
if (isContraptionActive){
updateContraption();
};
checkpoint.updateState();
gameData.updateHUD();
_local1 = dock.animateSprite();
if (_local1 == 1){
paddle.visible = false;
paddle.animator.moveToFrame(133);
dock.startAnimating(20, 47, false, 16);
step = waitForDock;
};
}
public function enterPlaySpendMode():void{
resetDockMove();
dock.moveToFrame(1);
dockFull.visible = true;
gameData.setHudMode(1);
gameData._numBonusTrys = 10;
gameData._clkSuccess = 0;
numSpent = 0;
idleTiks = 0;
dockScrollAmount = 8;
hero_c.start();
hero_c.setVisibility(true);
meterTarget.reset();
meterTarget.visible = true;
meterNeedle.visible = true;
meterNeedle.start();
sndMod.playMusic(SoundData.getSoundName(SoundData.BONUS_WHARF_LOOP), 0);
if (gameData._showInstructions){
gameData._showInstructions = false;
};
step = playSpendMode;
}
function enterCollectModeFromSpend():void{
gameData._currLevel++;
gameData._scoreLevel = 0;
gameData._time = 0;
gameData._tokens = 0;
setProgression();
collectTimer.start();
paddle.visible = true;
spawnerOff = false;
getReadyToSpend = false;
sndMod.playMusic(SoundData.getSoundName(SoundData.MAIN_MUSIC_LOOP), 0);
if (OceanLoop == null){
OceanLoop = sndMod.startLoopFade(SoundData.getSoundName(SoundData.MAIN_OCEAN_LOOP), 5000);
};
step = enterCollectReady;
}
function waitForDock():void{
var _local1:int;
checkpoint.updateState();
if (isBirdsActive){
updateAirObstacles();
};
if (isContraptionActive){
updateContraption();
};
if (dock.getCurrentFrame() == 33){
gameData.playSoundByEvent(SoundData.MAIN_BUBBIE_SHOT);
gameData.playSoundByEvent(SoundData.HERO_LAUNCH_TO_DOCK);
};
_local1 = dock.animateSprite();
if (_local1 == 1){
step = exitCollectModeToSpend;
};
}
function killSuperShoot():void{
paddle.playAnimation(Paddle.ANIM_SWIMN_SLOW);
isSuperShootActive = false;
isPlayingSuperLoop = false;
superShootState = 0;
velMult = 0.15;
paddleSpout.setPosition(-200, 0);
}
function enterCollectModeToGameOver():void{
var _local1:MovieClip;
gameData.updateCamera();
updateTokenSpawner();
updateTokens();
gameData.updateHUD();
paddleMove(_gameContext.mouseX);
hero_a.updateState();
hero_b.updateState();
checkpoint.updateState();
if (isBirdsActive){
updateAirObstacles();
};
if (isContraptionActive){
updateContraption();
};
if (isSuperShootActive){
updateSuperShoot();
};
if (getFramesDelay(frTik++)){
if (OceanLoop != null){
sndMod.addChannelToFadeOut(OceanLoop, 1000);
OceanLoop = null;
};
if (gullLoop != null){
sndMod.addChannelToFadeOut(gullLoop, 1000);
gullLoop = null;
};
isBirdsActive = false;
if (isContraptionActive){
oContraption.killSound();
};
gameOverScreen = ui.showScreen("scrn_Over", gameData.getGameLayer(GameData.STAGE));
_local1 = (gameOverScreen.getMovieClip().getChildByName("container") as MovieClip);
totalScoreText = (_local1.getChildByName("_scoreTotal") as TextField);
trace(("totalScoreText: " + totalScoreText));
gameData._score = (gameData._score + gameData._scoreLevel);
gameData.playSoundByEvent(SoundData.SCREEN_TRANSITION);
gameOverScreen.startAnimating(1, 20, false);
step = playGameOver;
};
}
function playSpendMode():void{
var _local1:Boolean;
if (gameData.getGameMode() == GameData.GAME_PAUSED){
return;
};
if (gameData._showInstructions){
gameData.setGameMode(GameData.GAME_PAUSED);
instructionType = 2;
step = startInstructions;
return;
};
hero_c.update();
updateDockMove();
if (gameData._numBonusTrys <= 0){
gameData.setMaxBonus();
gameData.updateHUD();
meterNeedle.stop();
step = spendExitDelay;
return;
};
if (((((pad.getMouseJustPressed()) && (meterNeedle.canClick))) && ((pad.getMousePosY() < 360)))){
idleTiks = 0;
numSpent++;
_local1 = meterNeedle.registerClick();
if (_local1){
hero_c.playSuccess();
meterNeedle.addSpeed();
gameData._numBonusTrys--;
gameData._clkSuccess++;
if (gameData._clkSuccess == 1){
gameData.setBonusVisible();
};
dockScrollAmount = (dockScrollAmount + 2);
gameData.playSoundByEvent(SoundData.BONUS_TIMER_GOOD_CLICK);
} else {
gameData.playSoundByEvent(SoundData.BONUS_TIMER_BAD_CLICK);
hero_c.playFail();
frCnt = 90;
frTik = 0;
meterNeedle.stop();
step = spendExitDelayFail;
return;
};
} else {
idleTiks++;
};
if ((idleTiks % 120) == 0){
meterTarget.reduceTargetArea();
meterNeedle.reduceClickZone();
};
gameData.updateHUD();
}
function initSpendMode():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
dockFull = (new spr_dockFull() as Sprite);
dockFull.visible = false;
board.addChild(dockFull);
dockScroll = new Rectangle(0, 0, 600, 400);
dockFull.scrollRect = dockScroll;
meterConstraint = new Group();
APEngine.addGroup(meterConstraint);
_local1 = 300;
_local2 = 350;
_local3 = 20;
_local4 = 20;
_local5 = 30;
_local6 = 30;
_local7 = 230;
_local8 = new RectangleParticle((_local1 - (_local7 / 2)), _local2, _local5, (_local3 + (_local6 * 2)), 0, true, 100, 0.5, 0);
_local8.setStyle(0, 0, 0, 0xFFFFFF, 0);
_local8.name = "LeftWall";
meterConstraint.addParticle(_local8);
_local9 = new RectangleParticle((_local1 + (_local7 / 2)), _local2, _local5, (_local3 + (_local6 * 2)), 0, true, 100, 0.5, 0);
_local9.setStyle(0, 0, 0, 0xFFFFFF, 0);
_local9.name = "RightWall";
meterConstraint.addParticle(_local9);
_local10 = new RectangleParticle(_local1, (_local2 - ((_local3 / 2) + (_local6 / 2))), (_local7 + _local5), _local6, 0, true, 100, 0.0001, 0);
_local10.setStyle(0, 0, 0, 0xFFFFFF, 0);
meterConstraint.addParticle(_local10);
_local11 = new RectangleParticle(_local1, (_local2 + ((_local3 / 2) + (_local6 / 2))), (_local7 + _local5), _local6, 0, true, 100, 0.0001, 0);
_local11.setStyle(0, 0, 0, 0xFFFFFF, 0);
meterConstraint.addParticle(_local11);
meterGroup = new Group(true);
meterGroup.addCollidable(meterConstraint);
APEngine.addGroup(meterGroup);
meterTarget = new MeterTarget(_gameContext, _local1, _local2, 160, _local3, 0, true, 10, 1E-5, 0);
meterTarget.visible = false;
meterGroup.addParticle(meterTarget);
meterNeedle = new MeterNeedle(_gameContext, _local1, _local2, _local3, _local4, 0, false, 10, 0.5, 0);
meterNeedle.visible = false;
meterGroup.addParticle(meterNeedle);
hero_c = new HeroSpend(_gameContext, "flapjack_sprite2", gameData.getGameLayer(GameData.BOARD));
hero_c.setVisibility(false);
}
function playCollectModeToReady():void{
gameData.updateCamera();
if (isBirdsActive){
updateAirObstacles();
};
if (isContraptionActive){
updateContraption();
};
gameData.updateHUD();
if (paddle.animator.animateSprite() == 1){
step = exitCollectModeToReady;
};
}
function enterCollectReady():void{
var _local1:SpriteEntity;
var _local2:MovieClip;
var _local3:TextField;
gameData.updateCamera();
if (isBirdsActive){
updateAirObstacles();
};
gameData.resetCheckpointMarker();
gameData._tokenCombo = -1;
_local1 = new Spark(_gameContext, "userMessage", gameData.getGameLayer(GameData.BOARD), 300, 150, 1, 60, 0);
_local2 = _local1.getMovieClip();
_local3 = _local2._ready.numLevels;
_local3.text = String(("Level " + gameData._currLevel));
frTik = 0;
frCnt = 60;
gameData.playSoundByEvent(SoundData.MAIN_LEVEL_START);
step = playCollectReady;
}
function spawnPattern():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:int;
_local1 = curPattern.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = curPattern[_local2][2];
_local4 = (_local2 * 10);
switch (_local3){
case -1:
spawnBubble(_local4, curPattern[_local2][0], curPattern[_local2][1], SoundData.MAIN_HERO_CAPTURE);
break;
case 1:
_local3 = (((spawnCountThisLevel++ % 10))==0) ? 2 : 1;
_local5 = ((_local3)==2) ? SoundData.MAIN_HERO_COLLECT_BIG_TOKEN : SoundData.MAIN_HERO_COLLECT_TOKEN;
spawnToken(_local4, _local3, curPattern[_local2][0], curPattern[_local2][1], _local5);
break;
case 4:
spawnCrate(_local4, _local3, curPattern[_local2][0], curPattern[_local2][1], SoundData.MAIN_HERO_COLLIDE_CRATE);
break;
};
_local2++;
};
}
function enterGameStart():void{
gameData.setHudMode(0);
paddle.visible = true;
spawnerOff = false;
setProgression();
gameData._time = 0;
collectTimer.start();
sndMod.playMusic(SoundData.getSoundName(SoundData.MAIN_MUSIC_LOOP), 0);
OceanLoop = sndMod.startLoopFade(SoundData.getSoundName(SoundData.MAIN_OCEAN_LOOP), 5000);
step = playGameStart;
}
function testCrateSpawn():void{
spawnCrate(0, 4, 300, 150, SoundData.MAIN_TOKEN_SPAWN);
}
function getNewPattern():Array{
var _local1:int;
var _local2:int;
var _local3:Array;
var _local4:int;
_local1 = PM_PRNG.nextIntRange(0, 99);
_local2 = curPatternPool[_local1];
_local3 = patternBuckets[_local2];
_local4 = PM_PRNG.nextIntRange(_local3[0], _local3[1]);
return (patterns[_local4]);
}
function updateTokens():void{
var _local1:int;
var _local2:*;
var _local3:Number;
var _local4:Number;
numActiveTokens = 0;
_local1 = tokenGroup.particles.length;
while (_local1--) {
_local2 = tokenGroup.particles[_local1];
if (_local2.isActive){
_local2.animator.animateSprite();
_local3 = (_local2.px - tokenSpeed);
_local4 = (_local2.startX - tokenDuration);
if ((((_local3 <= -25)) || ((_local3 <= _local4)))){
tokenGroup.removeParticle(_local2);
_local2.selfDestruct();
gameData._tokenCombo = -1;
if (gameData.getChainBroken() == false){
gameData.setChainBroken();
};
} else {
_local2.px = _local3;
};
if (_local2._type != 3){
numActiveTokens++;
};
};
};
}
function exitBonusStory():void{
if (scrBonusInstruct.animateSprite() == 1){
scrBonusInstruct.removeSprite();
scrBonusInstruct = null;
step = enterPlaySpendMode;
};
}
function exitInstructions():void{
if (instructScreen.animateSprite() == 1){
instructScreen.removeSprite();
playButton = null;
btnAnimate = null;
instructScreen = null;
gameData._showInstructions = false;
gameData.setGameMode(GameData.GAME_PLAY);
step = ((instructionType)==1) ? playCollectMode : playSpendMode;
};
}
function spawnBubble(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int):void{
var _local5:Token;
_local5 = tokenFactory.getInstance();
_local5.initSpawn(_arg1, 3, _arg2, _arg3, _arg4);
tokenGroup.addParticle(_local5);
}
function playCollectReady():void{
gameData.updateCamera();
if (isBirdsActive){
updateAirObstacles();
};
if (getFramesDelay(frTik++)){
frTik = 0;
paddle.playAnimation(Paddle.ANIM_DIVE_UP);
step = exitCollectReady;
};
}
function enterCollectModeToSpend():void{
collectTimer.stop();
collectTimer.reset();
isInPlay = false;
endCollectMode = true;
destroyTokens();
updateTokens();
dock.startAnimating(1, 19, false, 16);
if (OceanLoop != null){
sndMod.addChannelToFadeOut(OceanLoop, 1000);
OceanLoop = null;
};
if (isBirdsActive){
updateAirObstacles();
};
if (isContraptionActive){
updateContraption();
};
checkpoint.updateState();
gameData.updateHUD();
gameData.playSoundByEvent(SoundData.MAIN_LEVEL_END);
step = playCollectModeToSpend;
}
}
}//package Game.GameStates
Section 42
//G_StoryMain (Game.GameStates.G_StoryMain)
package Game.GameStates {
import Base.*;
import flash.events.*;
import flash.display.*;
import UI.*;
import Game.*;
public class G_StoryMain extends GameState {
var playButton:UIButton;
var step:Function;
var state:int;
var transEnd:Boolean;
var _gameContext:GameEntry;
var uiMgr:UIManager;
var btnAnimate:MovieClip;
var screen:SpriteEntity;
var goExit:Boolean;// = false
var gameData:GameData;
public function G_StoryMain(){
goExit = false;
super();
}
public function handleTransitionEnd(_arg1:Event):void{
}
public function waitForTransition():void{
if (transEnd){
};
}
override public function Entry(_arg1:GameEntry):void{
var _local2:MovieClip;
trace(("@ --> ENTER " + this));
_gameContext = _arg1;
uiMgr = _arg1.getUIManager();
gameData = _arg1.getGameData();
screen = uiMgr.showScreen("scrn_MainStory", gameData.getGameLayer(GameData.STAGE));
_local2 = (screen.getMovieClip().getChildByName("container") as MovieClip);
playButton = uiMgr.addButton(_local2, "btnPlay", 1);
btnAnimate = (_local2.getChildByName("btnAnimation") as MovieClip);
state = 1;
step = new Function();
step = waitForUserInput;
}
public function waitForUserInput():void{
var _local1:int;
if (goExit){
if (screen.animateSprite() == 1){
_gameContext.getGameManager().setNextState(G_Instructions);
return;
};
return;
};
_local1 = uiMgr.getUIReturnVal();
switch (_local1){
case 1:
goExit = true;
gameData.playSoundByEvent(SoundData.SCREEN_TRANSITION);
screen.startAnimating(20, 38, false);
break;
};
switch (state){
case 1:
if (playButton.rollOn){
gameData.playSoundByEvent(SoundData.BTN_SCRIBBLE_OVER);
btnAnimate.gotoAndPlay(20);
state++;
};
break;
case 2:
if (playButton.rollOff){
btnAnimate.gotoAndStop(1);
state--;
};
break;
};
}
public function addScreenBelowCurrentScreen():void{
}
override public function Update(_arg1:GameEntry):void{
step();
}
public function startTransition():void{
step = waitForTransition;
}
override public function Exit(_arg1:GameEntry):void{
trace("@ <-- EXIT G_STORYMAIN");
}
}
}//package Game.GameStates
Section 43
//G_TitleCard (Game.GameStates.G_TitleCard)
package Game.GameStates {
import Base.*;
import flash.display.*;
import UI.*;
import Game.*;
public class G_TitleCard extends GameState {
var testButton:UIButton;
var goExit:Boolean;// = false
var uiMgr:UIManager;
var screen:SpriteEntity;
var gameData:GameData;
public function G_TitleCard(){
goExit = false;
super();
}
override public function Entry(_arg1:GameEntry):void{
var _local2:MovieClip;
var _local3:UIButton;
trace("@ --> ENTER G_TITLECARD");
uiMgr = _arg1.getUIManager();
gameData = _arg1.getGameData();
screen = uiMgr.showScreen("scrn_TitleCard", gameData.getGameLayer(GameData.STAGE));
_local2 = (screen.getMovieClip().getChildByName("titleContainer") as MovieClip);
_local3 = uiMgr.addButton(_local2, "btnPlay", 1);
_local3.addButtonAnimation(UIButton.STATE_OUT, 1, 1);
_local3.addButtonAnimation(UIButton.STATE_OVER, 20, 34);
_local3.addButtonAnimation(UIButton.STATE_DOWN, 34, 36);
_local3.addButtonSounds(UIButton.STATE_OVER, SoundData.BTN_PLAY_OVER);
gameData.getSoundModule().playMusic(SoundData.getSoundName(SoundData.BONUS_WHARF_LOOP), 0);
}
override public function Update(_arg1:GameEntry):void{
var _local2:int;
if (goExit){
if (screen.animateSprite() == 1){
_arg1.getGameManager().setNextState(G_StoryMain);
return;
};
return;
};
_local2 = uiMgr.getUIReturnVal();
switch (_local2){
case 1:
goExit = true;
_arg1.getGameData()._tracker.loadTracker();
gameData.playSoundByEvent(SoundData.SCREEN_TRANSITION);
screen.startAnimating(20, 27, false);
break;
};
}
override public function Exit(_arg1:GameEntry):void{
trace("@ <-- EXIT G_TITLECARD");
}
}
}//package Game.GameStates
Section 44
//AirObstacle (Game.AirObstacle)
package Game {
import Base.*;
import flash.display.*;
import org.cove.ape.*;
public class AirObstacle extends RectangleParticle {
var isHit:Boolean;// = false
var isNewPoint:Boolean;// = true
var myGroup:Group;
var coastTimer:int;// = 0
var soundID:int;
var coastCounter:int;// = 0
var mc:MovieClip;
private var _gameContext:GameEntry;
var moveMult:Number;// = 0.06
var startHitAnimation:Boolean;// = false
private var gameData:GameData;
var myFactory:AbstractFactory;
var isAcquiredY:Boolean;// = true
var isActive:Boolean;
var isCoasting:Boolean;// = false
private var sndMod:SoundModule;
var targetY:Number;// = 0
public function AirObstacle(_arg1:GameEntry, _arg2:Number=-50, _arg3:Number=0, _arg4:Number=25, _arg5:Number=20, _arg6:Number=0, _arg7:Boolean=true, _arg8:Number=1, _arg9:Number=0.3, _arg10:Number=0){
isAcquiredY = true;
isNewPoint = true;
targetY = 0;
coastTimer = 0;
coastCounter = 0;
isCoasting = false;
moveMult = 0.06;
isHit = false;
startHitAnimation = false;
super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
sndMod = gameData.getSoundModule();
solid = true;
alwaysRepaint = true;
mc = new sprite_seagul();
mc.gotoAndStop(1);
setDisplay(mc);
isActive = false;
}
public function recycleFactoryObject():void{
myFactory.returnInstance(this);
myGroup.removeParticle(this);
}
public function updateMove():void{
var _local1:Number;
var _local2:Number;
var _local3:*;
if (isHit){
if (mc.currentFrame == 32){
isHit = false;
mc.gotoAndPlay(1);
};
};
if (mc.currentFrame == 18){
coastCounter++;
if (coastCounter >= coastTimer){
if (isCoasting){
mc.gotoAndPlay(1);
isCoasting = false;
coastCounter = 0;
coastTimer = PM_PRNG.nextIntRange(2, 8);
} else {
isCoasting = true;
mc.gotoAndStop(17);
coastCounter = 0;
coastTimer = PM_PRNG.nextIntRange(30, 60);
};
} else {
mc.gotoAndPlay(1);
};
};
if (isNewPoint){
_local2 = (targetY - py);
_local3 = Math.abs(_local2);
_local2 = (_local2 * moveMult);
py = (py + _local2);
if (_local3 <= 2){
isNewPoint = false;
};
} else {
targetY = PM_PRNG.nextDoubleRange((targetY - 25), (targetY + 25));
isNewPoint = true;
};
_local1 = (px + 4);
if (_local1 >= 700){
recycleFactoryObject();
} else {
px = _local1;
};
}
override public function toString():String{
return ("AirObstacle()");
}
public function spawn(_arg1:Number, _arg2:Number, _arg3:int):void{
var _local4:Number;
soundID = _arg3;
px = _arg1;
py = _arg2;
targetY = _arg2;
coastTimer = PM_PRNG.nextIntRange(2, 5);
_local4 = (((Math.random() * 17) >> 0) + 1);
mc.gotoAndPlay(_local4);
}
public function playHit():void{
if (isHit){
return;
};
isHit = true;
targetY = (targetY - 50);
isNewPoint = true;
mc.gotoAndPlay(19);
gameData.playSoundByEvent(SoundData.MAIN_HERO_COLLIDE_GULL);
}
public function initFactoryObject(_arg1:AbstractFactory, _arg2:Group):void{
myGroup = _arg2;
myFactory = _arg1;
}
}
}//package Game
Section 45
//Checkpoint (Game.Checkpoint)
package Game {
import Base.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.utils.*;
import org.cove.ape.*;
public class Checkpoint extends RectangleParticle {
var isNewPoint:Boolean;// = true
var heroToRescue;
var rescueQue:Array;
var isRescueStarted:Boolean;// = false
var mc:MovieClip;
public var state:int;// = 0
var rescueTimer:Timer;
var isRecoveryStarted:Boolean;// = false
var _gameContext:GameEntry;
var moveMult:Number;// = 0.03
var isRescueComplete:Boolean;// = false
var gameData:GameData;
var isAcquiredY:Boolean;// = true
var sndMod:SoundModule;
var animator:SpriteAnimator;
var negSwitch:int;// = 1
var bouyLoop:SoundChannel;
var targetY:Number;// = 370
public static const START_RESCUE:int = 1;
public static const WAIT_FOR_RESCUE:int = 5;
public static const IDLE:int = 0;
public static const END_RESCUE:int = 4;
public static const ENTER_RECOVERY:int = 3;
public static const PLAY_RESCUE:int = 2;
public function Checkpoint(_arg1:GameEntry, _arg2:Number=0, _arg3:Number=0, _arg4:Number=10, _arg5:Number=10, _arg6:Number=0, _arg7:Boolean=true, _arg8:Number=1, _arg9:Number=0.3, _arg10:Number=0){
isRescueStarted = false;
isRescueComplete = false;
isRecoveryStarted = false;
isAcquiredY = true;
isNewPoint = true;
targetY = 370;
moveMult = 0.03;
negSwitch = 1;
rescueQue = [];
state = 0;
super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
sndMod = gameData.getSoundModule();
solid = false;
alwaysRepaint = true;
mc = new sprite_bouy();
mc.gotoAndStop(1);
setDisplay(mc);
animator = new SpriteAnimator(_gameContext, mc);
addEventListener(CollisionEvent.COLLIDE, handleCollision, false, 1, true);
rescueTimer = new Timer(10000, 1);
rescueTimer.addEventListener(TimerEvent.TIMER, startRescue, false, 1, true);
}
public function updateState():void{
var _local1:int;
switch (state){
case IDLE:
if (px != 750){
px = 750;
};
if (py != 370){
py = 370;
};
if (rescueQue.length > 0){
startRescueTimer();
state = WAIT_FOR_RESCUE;
};
break;
case WAIT_FOR_RESCUE:
if (isRescueStarted){
state = START_RESCUE;
};
break;
case START_RESCUE:
_local1 = ((heroToRescue.type)==1) ? 37 : 73;
bouyLoop = sndMod.startLoopFade(SoundData.getSoundName(SoundData.MAIN_BOUY_LOOP), 2000);
animator.startAnimating(_local1, (_local1 + 35), true);
heroToRescue.setIsRescued();
state = PLAY_RESCUE;
break;
case PLAY_RESCUE:
animator.animateSprite();
move();
if (isRecoveryStarted){
state = ENTER_RECOVERY;
};
break;
case ENTER_RECOVERY:
gameData.playSoundByEvent(SoundData.HERO_RECOVERED);
animator.startAnimating(1, 36, true);
heroToRescue.setIsRecovered();
gameData.setOnboardIndicator(heroToRescue.type, true);
gameData.hideHudCheckpoint();
heroToRescue = null;
state = END_RESCUE;
break;
case END_RESCUE:
animator.animateSprite();
move();
if (px <= -100){
isRescueComplete = true;
isRescueStarted = false;
isRecoveryStarted = false;
if (bouyLoop != null){
sndMod.addChannelToFadeOut(bouyLoop, 3000);
bouyLoop = null;
};
state = IDLE;
};
break;
};
}
public function reset():void{
rescueTimer.stop();
heroToRescue = null;
rescueQue = [];
mc.gotoAndPlay(1);
isRescueComplete = true;
isRescueStarted = false;
isRecoveryStarted = false;
if (bouyLoop != null){
sndMod.addChannelToFadeOut(bouyLoop, 1000);
bouyLoop = null;
};
state = IDLE;
}
override public function toString():String{
return ("Checkpoint()");
}
public function startRescue(_arg1:TimerEvent):void{
if (isRescueStarted){
return;
};
isRescueStarted = true;
}
public function addRescue(_arg1):void{
rescueQue.push(_arg1);
}
public function startRescueTimer():void{
var _local1:Number;
heroToRescue = rescueQue.pop();
rescueTimer.reset();
rescueTimer.start();
_local1 = ((gameData._time * 1.25) + 20);
if (_local1 > 135){
_local1 = 135;
};
gameData.setCheckpoint(_local1, heroToRescue.type);
gameData.playSoundByEvent(SoundData.MAIN_HERO_LOST_AT_SEA);
}
function move():void{
var _local1:Number;
var _local2:*;
px = (px - 2);
}
public function handleCollision(_arg1:CollisionEvent):void{
switch (getQualifiedClassName(_arg1.collidingItem)){
case "Game::Paddle":
if (isRecoveryStarted){
return;
};
isRecoveryStarted = true;
break;
};
}
}
}//package Game
Section 46
//Confinement (Game.Confinement)
package Game {
import Base.*;
import org.cove.ape.*;
public class Confinement extends Composite {
var t:ConfineWall;
var pHW:Number;
var yWid:Number;
var yPos:Number;
private var _gameContext:GameEntry;
public var _type:int;
var c1:CircleParticle;
var c2:CircleParticle;
var xWid:Number;
private var gameData:GameData;
var xhWid:Number;
var yhWid:Number;
var xPos:Number;
private var sndMod:SoundModule;
var b:ConfineWall;
var pW:Number;
var l:ConfineWall;
var r:ConfineWall;
public function Confinement(_arg1:GameEntry, _arg2:Number=200, _arg3:Number=50, _arg4:Number=100, _arg5:Number=150, _arg6:Number=10){
_gameContext = _arg1;
gameData = _gameContext.getGameData();
sndMod = gameData.getSoundModule();
xPos = _arg2;
yPos = _arg3;
xWid = _arg4;
yWid = _arg5;
xhWid = (xWid / 2);
yhWid = (yWid / 2);
pW = _arg6;
pHW = (pW / 2);
createBox();
}
public function setPosition(_arg1:Number, _arg2:Number):void{
xPos = _arg1;
yPos = _arg2;
t.px = xPos;
t.py = (yPos - (yhWid + pHW));
b.px = xPos;
b.py = (yPos + (yhWid + pHW));
l.px = (xPos - (xhWid + pHW));
l.py = yPos;
r.px = (xPos + (xhWid + pHW));
r.py = yPos;
}
function createBox():void{
t = new ConfineWall(xPos, (yPos - (yhWid + pHW)), (xWid + (pW * 2)), pW);
t.elasticity = 1E-5;
addParticle(t);
b = new ConfineWall(xPos, (yPos + (yhWid + pHW)), (xWid + (pW * 2)), pW);
b.elasticity = 0.7;
addParticle(b);
l = new ConfineWall((xPos - (xhWid + pHW)), yPos, pW, (yWid + (pW * 2)));
l.elasticity = 1E-5;
addParticle(l);
r = new ConfineWall((xPos + (xhWid + pHW)), yPos, pW, (yWid + (pW * 2)));
r.elasticity = 1E-5;
addParticle(r);
fixed = true;
}
public function getX():Number{
return (xPos);
}
public function getY():Number{
return (yPos);
}
public function move(_arg1:Number, _arg2:Number):void{
xPos = (xPos + _arg1);
yPos = (yPos + _arg2);
t.px = xPos;
t.py = (yPos - (yhWid + pHW));
b.px = xPos;
b.py = (yPos + (yhWid + pHW));
l.px = (xPos - (xhWid + pHW));
l.py = yPos;
r.px = (xPos + (xhWid + pHW));
r.py = yPos;
}
public function toString():String{
return ("Confinement()");
}
}
}//package Game
Section 47
//ConfineWall (Game.ConfineWall)
package Game {
import org.cove.ape.*;
public class ConfineWall extends RectangleParticle {
public function ConfineWall(_arg1:Number=0, _arg2:Number=0, _arg3:Number=45, _arg4:Number=30, _arg5:Number=0, _arg6:Boolean=true, _arg7:Number=1, _arg8:Number=0.3, _arg9:Number=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
}
override public function toString():String{
return ("ConfineWall()");
}
}
}//package Game
Section 48
//Contraption (Game.Contraption)
package Game {
import Base.*;
import flash.display.*;
import flash.media.*;
import org.cove.ape.*;
public class Contraption extends RectangleParticle {
var blimpLoop:SoundChannel;
var isHit:Boolean;// = false
var isNewPoint:Boolean;// = true
var soundID:int;
var mc:MovieClip;
private var _gameContext:GameEntry;
var moveMult:Number;// = 0.06
var startHitAnimation:Boolean;// = false
private var gameData:GameData;
var isAcquiredY:Boolean;// = true
public var isActive:Boolean;
private var sndMod:SoundModule;
var targetY:Number;// = 0
public function Contraption(_arg1:GameEntry, _arg2:Number=-50, _arg3:Number=0, _arg4:Number=25, _arg5:Number=20, _arg6:Number=0, _arg7:Boolean=true, _arg8:Number=1, _arg9:Number=0.3, _arg10:Number=0){
isAcquiredY = true;
isNewPoint = true;
targetY = 0;
moveMult = 0.06;
isHit = false;
startHitAnimation = false;
super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
sndMod = gameData.getSoundModule();
solid = true;
alwaysRepaint = true;
mc = new flyingShip();
mc.gotoAndStop(1);
setDisplay(mc);
isActive = false;
}
public function updateMove():void{
var _local1:Number;
var _local2:Number;
var _local3:*;
if (isHit){
if (mc.currentFrame == 27){
isHit = false;
mc.gotoAndPlay(1);
};
};
if (mc.currentFrame == 15){
mc.gotoAndPlay(1);
};
if (isNewPoint){
_local2 = (targetY - py);
_local3 = Math.abs(_local2);
_local2 = (_local2 * moveMult);
py = (py + _local2);
if (_local3 <= 2){
isNewPoint = false;
};
} else {
targetY = PM_PRNG.nextDoubleRange((targetY - 25), (targetY + 25));
isNewPoint = true;
};
_local1 = (px + 4);
if (_local1 >= 700){
if (blimpLoop != null){
sndMod.addChannelToFadeOut(blimpLoop, 3000);
blimpLoop = null;
};
px = -200;
isActive = false;
} else {
px = _local1;
};
}
public function killSound():void{
if (blimpLoop != null){
sndMod.addChannelToFadeOut(blimpLoop, 3000);
blimpLoop = null;
};
}
override public function toString():String{
return ("AirObstacle()");
}
public function spawn(_arg1:Number, _arg2:Number):void{
if (isActive){
return;
};
isActive = true;
px = _arg1;
py = (targetY = _arg2);
blimpLoop = sndMod.startLoopFade(SoundData.getSoundName(SoundData.MAIN_BLIMP_LOOP), 2000);
mc.gotoAndPlay(1);
}
public function playHit():void{
if (isHit){
return;
};
isHit = true;
targetY = (targetY - 50);
isNewPoint = true;
mc.gotoAndPlay(19);
gameData.playSoundByEvent(SoundData.MAIN_HERO_COLLIDE_BLIMP);
}
}
}//package Game
Section 49
//Crate (Game.Crate)
package Game {
import Base.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import org.cove.ape.*;
import Effects.*;
import Game.AIStates.*;
public class Crate extends CircleParticle {
public var _isHit:Boolean;// = false
public var _type:int;
var myGroup:Group;
public var startX:Number;// = 0
var spawnY:Number;
var spawnX:Number;
var soundID:int;
var mc:MovieClip;
var spawnTimer:Timer;
var _gameContext:GameEntry;
var gameData:GameData;
var myFactory:AbstractFactory;
public var isActive:Boolean;// = false
var sndMod:SoundModule;
public var animator:SpriteAnimator;
public function Crate(_arg1:GameEntry, _arg2:Number=-100, _arg3:Number=-100, _arg4:Number=15, _arg5:Boolean=true, _arg6:Number=1, _arg7:Number=0.1, _arg8:Number=0){
isActive = false;
_isHit = false;
startX = 0;
super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
sndMod = gameData.getSoundModule();
alwaysRepaint = true;
mc = new coin_container();
mc.gotoAndStop(1);
setDisplay(mc);
animator = new SpriteAnimator(_gameContext, mc);
}
public function selfDestruct():void{
gameData.playSoundByEvent(SoundData.MAIN_TOKEN_DESPAWN);
new Spark(_gameContext, "coin_container", gameData.getGameLayer(GameData.BOARD), px, py, 60, 72, 0);
recycleFactoryObject();
}
public function isHit():void{
if (_isHit){
return;
};
gameData.playSoundByEvent(soundID);
gameData.getGameState().spawnCrateTokens(px, py);
_isHit = true;
new Spark(_gameContext, "coin_container", gameData.getGameLayer(GameData.BOARD), px, py, 20, 24, 0);
recycleFactoryObject();
}
public function recycleFactoryObject():void{
isActive = false;
px = -200;
py = -200;
myFactory.returnInstance(this);
}
public function startLoop(_arg1:AnimationEvent):void{
animator.startAnimating(1, 1, true);
animator.removeEventListener(AnimationEvent.COMPLETE, this.startLoop);
}
public function initSpawn(_arg1:Number, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int):void{
_type = _arg2;
spawnX = _arg3;
spawnY = _arg4;
soundID = _arg5;
if (_arg1 > 0){
spawnTimer = new Timer(_arg1, 1);
spawnTimer.addEventListener(TimerEvent.TIMER_COMPLETE, spawn, false, 0, true);
spawnTimer.start();
} else {
spawn();
};
}
override public function toString():String{
return ("Crate()");
}
public function spawn(_arg1:TimerEvent=null):void{
isActive = true;
_isHit = false;
px = spawnX;
py = spawnY;
startX = spawnX;
gameData.playSoundByEvent(SoundData.MAIN_TOKEN_SPAWN);
if (_arg1 != null){
spawnTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, spawn);
spawnTimer = null;
};
animator.startAnimating(40, 50, false);
animator.addEventListener(AnimationEvent.COMPLETE, this.startLoop, false, 0, true);
}
public function initFactoryObject(_arg1:AbstractFactory, _arg2:Group):void{
myGroup = _arg2;
myFactory = _arg1;
}
}
}//package Game
Section 50
//GameData (Game.GameData)
package Game {
import Base.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import Tracker.*;
import flash.net.*;
import Game.AIStates.*;
public class GameData {
var txtScore:TextField;
var chainBroken:Boolean;// = false
public var _lives:Number;
public var _tokensTotal:Number;
public var _overlay:Sprite;
public var _gameMode:Number;
private var _controls;
public var _gameReplay:Boolean;
private var shakeCounter:Number;// = 4
public var _isLevelLoaded:Boolean;
var spendMode:MovieClip;
public var _clkSuccess:int;// = 0
var txtNumTrys:TextField;
var progress:MovieClip;
var txtTokenCount:TextField;
public var _hud:SpriteEntity;
public var _clkFail:int;// = 0
public var _isShaking:Boolean;
public var _reset:Boolean;// = false
var onBoardKnuck:MovieClip;
var _btnMute:MovieClip;
public var _numCombos:Number;// = 0
var onBoardFlap:MovieClip;
public var _health:Number;
var txtLife:MovieClip;
public var _score:Number;
public var _isLevelComplete:Boolean;
private var cameraShakeX;
public var _soundModule:SoundModule;
private var _gameContext:GameEntry;
private var cameraShakeY;
public var _showInstructions:Boolean;// = false
public var _world:Sprite;
var combos:TextField;
private var shakeDir:Number;// = -1
public var _scoreLevel:Number;
public var _time:Number;// = 0
public var _tokenCombo:Number;
public var _tokens:Number;
public var gameState:GameState;
var chain:MovieClip;
var progressMarker:MovieClip;
public var _background:Sprite;
public var _numBonusTrys:Number;
private var shakeIntensity:Number;
var txtNumBonus:TextField;
public var _meterSpeed:Number;// = 1
public var _maxLevel:Number;
var checkpointMarker:MovieClip;
public var _board:Sprite;
var collectMode:MovieClip;
public var _scrollRect:Rectangle;
public var _currLevel:Number;
var _btnInstruct:MovieClip;
public var _tracker:GameTrack_AS3;
private var shakeTime:Number;// = 4
public var _hudMode:int;// = 0
var txtLevelScore:TextField;
public static var WORLD:int = 1;
public static var MARG_RIGHT:Number = 3300;
public static var YMAX = 400;
public static var BOARD:int = 2;
public static var XMIN = 0;
public static var GAME_PAUSED:Number = 0;
public static var STAGE:int = 0;
public static var GAME_PLAY:Number = 1;
public static var XMAX = 600;
public static var OVERLAY:int = 3;
public static var MARG_BOT:Number = 490;
public static var BACKGROUND:int = 4;
public static var GAME_EDIT:Number = 2;
public static var YMIN = 0;
public static var MARG_LEFT:Number = 300;
public static var MARG_TOP:Number = 420;
public function GameData(_arg1:GameEntry){
var _local2:int;
_controls = [{keyAction:"MoveUp", keyID:38}, {keyAction:"MoveDown", keyID:40}, {keyAction:"MoveLeft", keyID:37}, {keyAction:"MoveRight", keyID:39}, {keyAction:"X", keyID:88}, {keyAction:"Z", keyID:90}, {keyAction:"Jump", keyID:32}, {keyAction:"SkipLevel", keyID:76}, {keyAction:"one", keyID:49}, {keyAction:"two", keyID:50}, {keyAction:"three", keyID:51}, {keyAction:"four", keyID:52}];
_meterSpeed = 1;
_clkSuccess = 0;
_clkFail = 0;
_hudMode = 0;
_reset = false;
_numCombos = 0;
_time = 0;
chainBroken = false;
_showInstructions = false;
shakeTime = 4;
shakeCounter = 4;
shakeDir = -1;
super();
_gameContext = _arg1;
_gameContext.getPadManager().setKeyControls(_controls);
_tracker = new GameTrack_AS3(_gameContext);
_soundModule = new SoundModule();
_local2 = 0;
while (_local2 < SoundData.soundEventList.length) {
_soundModule.loadSound(SoundData.soundEventList[_local2].linkageName);
_local2++;
};
_currLevel = 1;
Init();
}
public function getGameState(){
return (gameState);
}
public function configBackground():void{
_background = new sky();
_background.x = (_background.y = 0);
_world.addChildAt(_background, 0);
_scrollRect = new Rectangle(0, 0, 600, 400);
_background.scrollRect = _scrollRect;
}
function toggleInstructions(_arg1:Event):void{
_showInstructions = true;
}
public function setChainStarted():void{
chainBroken = false;
combos.text = "";
chain.gotoAndStop(1);
}
public function setZeroBonus():void{
spendMode.visible = false;
}
public function getSoundModule():SoundModule{
return (_soundModule);
}
public function getGameMode():Number{
return (_gameMode);
}
public function configureHUD():void{
var _local1:MovieClip;
_btnMute = (_hud.getMovieClip().getChildByName("btnMute") as MovieClip);
_btnMute.buttonMode = true;
_btnMute.useHandCursor = true;
_btnMute.gotoAndStop(1);
_btnMute.addEventListener(MouseEvent.CLICK, toggleMusicMute, false, 0, true);
_btnInstruct = (_hud.getMovieClip().getChildByName("btnInstruct") as MovieClip);
_btnInstruct.buttonMode = true;
_btnInstruct.useHandCursor = true;
_btnInstruct.addEventListener(MouseEvent.CLICK, toggleInstructions, false, 0, true);
txtScore = (_hud.getMovieClip().getChildByName("txtScore") as TextField);
txtScore.text = String(_score);
spendMode = (_hud.getMovieClip().getChildByName("_spendModemc") as MovieClip);
spendMode.gotoAndStop(1);
spendMode.visible = false;
txtNumBonus = (spendMode.getChildByName("txtNumSuccess") as TextField);
txtNumBonus.text = "0";
collectMode = (_hud.getMovieClip().getChildByName("_collectMode") as MovieClip);
collectMode.visible = false;
_local1 = (collectMode.getChildByName("headIcons") as MovieClip);
onBoardFlap = (_local1.getChildByName("flap") as MovieClip);
onBoardFlap.gotoAndStop(1);
onBoardKnuck = (_local1.getChildByName("knuck") as MovieClip);
onBoardKnuck.gotoAndStop(1);
progress = (collectMode.getChildByName("levelIndicator") as MovieClip);
progressMarker = (progress.getChildByName("_heroMarker") as MovieClip);
checkpointMarker = (progress.getChildByName("_checkpointMarker") as MovieClip);
checkpointMarker.visible = false;
chain = (collectMode.getChildByName("combo") as MovieClip);
combos = (chain.getChildByName("numCombos") as TextField);
combos.text = "";
chain.gotoAndStop(1);
}
public function Init():void{
PM_PRNG.seed = Math.floor(((Math.random() * 20) + 1));
_gameMode = 1;
setGamePaused(0);
_gameReplay = false;
_health = 0;
_lives = 1;
_score = 0;
_scoreLevel = 0;
_tokens = 0;
_tokensTotal = 0;
_tokenCombo = -1;
_numBonusTrys = 0;
_maxLevel = 0;
_isLevelLoaded = false;
_isLevelComplete = false;
}
public function playSound(_arg1:Number):void{
var _local2:Number;
var _local3:*;
_local3 = 0;
while (_local3 < SoundData.soundEventList.length) {
if (SoundData.soundEventList[_local3].eventName == _arg1){
_local2 = ((SoundData.soundEventList[_local3].loop)==true) ? 9999 : 0;
_soundModule.playSound(SoundData.soundEventList[_local3].linkageName, SoundData.soundEventList[_local3].volume, SoundData.soundEventList[_local3].pan, SoundData.soundEventList[_local3].offset, _local2, SoundData.soundEventList[_local3].force);
return;
};
_local3++;
};
}
public function setGameMode(_arg1:Number):void{
_gameMode = _arg1;
}
public function setChainBroken():void{
chainBroken = true;
combos.text = "";
chain.gotoAndStop(2);
}
public function updateCamera():void{
var _local1:Number;
_local1 = (_scrollRect.x + 0.25);
_scrollRect.x = ((_local1)>=0x0707) ? 0 : _local1;
_background.scrollRect = _scrollRect;
}
public function clearGameContainers():void{
if (((!((_board == null))) && ((_board.numChildren > 0)))){
clearBoard();
};
if (_background != null){
removeBackground();
};
if (_world != null){
_gameContext._stage.removeChild(_world);
};
}
public function getHealth():Number{
return (_health);
}
public function resetHUD():void{
_scoreLevel = 0;
txtScore.text = String(0);
_tokenCombo = 0;
combos.text = "";
chain.gotoAndStop(1);
progressMarker.x = 0;
checkpointMarker.visible = false;
onBoardFlap.gotoAndStop(1);
onBoardKnuck.gotoAndStop(1);
spendMode.gotoAndStop(1);
txtNumBonus.text = "";
}
public function getLives():Number{
return (_lives);
}
public function setHealth(_arg1:Number){
_health = _arg1;
}
public function resetCheckpointMarker():void{
checkpointMarker.x = 240;
checkpointMarker.visible = false;
onBoardFlap.gotoAndStop(1);
onBoardKnuck.gotoAndStop(1);
}
public function aShuffle(_arg1:Array, _arg2:Number=0, _arg3:Number=0):Array{
var _local4:Number;
var _local5:Number;
var _local6:*;
if (_arg3 == 0){
_arg3 = (_arg1.length - 1);
};
_local4 = _arg3;
while (_local4 > _arg2) {
_local5 = (Math.floor((Math.random() * _arg3)) + _arg2);
_local6 = _arg1[_local4];
_arg1[_local4] = _arg1[_local5];
_arg1[_local5] = _local6;
_local4--;
};
return (_arg1);
}
public function toString():String{
return ("GameData()");
}
public function updateHUD():void{
var _local1:Number;
txtScore.text = String(_scoreLevel);
if (_tokenCombo > 0){
combos.text = String(_tokenCombo);
} else {
combos.text = "";
};
_local1 = (_time * 1.25);
progressMarker.x = _local1;
if (_local1 > checkpointMarker.x){
hideHudCheckpoint();
};
if (spendMode.currentFrame == 1){
txtNumBonus.text = String(_clkSuccess);
};
}
public function setHudMode(_arg1:int):void{
_hudMode = _arg1;
switch (_hudMode){
case 0:
collectMode.visible = true;
spendMode.visible = false;
spendMode.y = 420;
break;
case 1:
_clkFail = 0;
_clkSuccess = 0;
collectMode.visible = false;
spendMode.gotoAndStop(1);
spendMode.y = 275;
break;
};
}
public function setGameState(_arg1:GameState):void{
gameState = _arg1;
}
public function setCheckpoint(_arg1:Number, _arg2):void{
checkpointMarker.x = _arg1;
checkpointMarker.gotoAndStop(_arg2);
checkpointMarker.visible = true;
}
public function resetHealth():void{
_health = 1;
}
public function clearBoard():void{
var _local1:int;
_local1 = _board.numChildren;
while (_local1--) {
_board.removeChildAt(_local1);
};
}
public function setMaxBonus():void{
spendMode.gotoAndStop(2);
}
public function handleCameraShake():void{
var _local1:*;
var _local2:Number;
var _local3:Matrix;
if (_isShaking == false){
return;
};
_local1 = _world;
shakeCounter++;
_local2 = 0;
if (shakeCounter < shakeTime){
_local2 = ((Math.random() * 2) + 2);
shakeDir = (shakeDir * -1);
cameraShakeY = (_local2 * shakeDir);
_local3 = _local1.transform.matrix;
_local3.translate(0, cameraShakeY);
_local1.transform.matrix = _local3;
} else {
cameraShakeY = 0;
cameraShakeX = 0;
_isShaking = false;
_local3 = _local1.transform.matrix;
_local3.identity();
_local1.transform.matrix = _local3;
};
}
function clearSpendCounts(_arg1:Event=null):void{
_tokens = 0;
_clkSuccess = 0;
_clkFail = 0;
_reset = true;
}
public function configGameLayers():void{
var _local1:*;
_local1 = new Rectangle(0, 0, 600, 400);
_world = new Sprite();
_world.x = 0;
_world.y = 0;
_gameContext._stage.addChildAt(_world, 0);
_board = new Sprite();
_board.x = 0;
_board.y = 0;
_world.scrollRect = _local1;
_world.addChild(_board);
}
public function adjustLives(_arg1:Number){
_lives = (_lives + _arg1);
}
public function getGamePaused():Number{
return (GAME_PAUSED);
}
public function getChainBroken():Boolean{
return (chainBroken);
}
public function setGamePaused(_arg1:Number):void{
GAME_PAUSED = _arg1;
}
function clearTokenCount(_arg1:Event=null):void{
_tokens = 0;
_reset = true;
}
public function setLives(_arg1:Number){
_lives = _arg1;
}
public function playSoundByEvent(_arg1:Number):void{
playSound(_arg1);
}
public function getGameLayer(_arg1:Number):DisplayObjectContainer{
switch (_arg1){
case STAGE:
return (_gameContext._stage);
case WORLD:
return (_world);
case BOARD:
return ((_board as Sprite));
case OVERLAY:
return (_overlay);
case BACKGROUND:
return (_background);
default:
return (_gameContext._stage);
};
}
public function adjustHealth(_arg1:Number){
_health = (_health + _arg1);
}
public function hideHudCheckpoint():void{
checkpointMarker.visible = false;
}
public function resetLevelNum():void{
_currLevel = 1;
}
public function addOverlayContainer():void{
_overlay = new Sprite();
_world.addChild(_overlay);
}
public function removeHUD():void{
_btnMute.removeEventListener(MouseEvent.CLICK, toggleMusicMute);
_btnInstruct.removeEventListener(MouseEvent.CLICK, toggleInstructions);
_hud.removeSprite();
_hud = null;
}
public function setBonusVisible():void{
spendMode.visible = true;
}
public function removeBackground():void{
_world.removeChild(_background);
_background = null;
}
public function showHUD():void{
_hud = new SpriteEntity(_gameContext, "gameHud", getGameLayer(GameData.WORLD));
}
public function getBgrndPosX():Number{
return (_scrollRect.x);
}
public function shakeCamera(_arg1:Number):void{
shakeIntensity = _arg1;
_isShaking = true;
if (_arg1 == 1){
shakeTime = 10;
};
if (_arg1 == 2){
shakeTime = 20;
};
shakeCounter = 0;
}
public function setOnboardIndicator(_arg1:Number, _arg2:Boolean):void{
var _local3:int;
var _local4:MovieClip;
_local3 = ((_arg2)==true) ? 1 : 2;
_local4 = ((_arg1)==1) ? onBoardFlap : onBoardKnuck;
_local4.gotoAndStop(_local3);
}
function toggleMusicMute(_arg1:Event=null):void{
var _local2:Boolean;
var _local3:int;
_local2 = ((_soundModule.getMusicMute())==true) ? false : true;
_soundModule.setMusicMute(_local2);
_local3 = ((_soundModule.getMusicMute())==true) ? 2 : 1;
_btnMute.gotoAndStop(_local3);
}
}
}//package Game
Section 51
//GameManager (Game.GameManager)
package Game {
import Base.*;
import Game.GameStates.*;
public class GameManager {
private var _currentGameState;
private var _followingGameState;
private var _nextGameState;
private var _gameContext:GameEntry;
public function GameManager(_arg1:GameEntry){
trace("|----@ GAME MANAGER @----|");
_gameContext = _arg1;
_currentGameState = null;
setNextState(G_TitleCard);
}
public function setNextState(_arg1){
_nextGameState = new (_arg1);
}
public function getFollowingGameState(){
return (_followingGameState);
}
public function setFollowingGameState(_arg1){
_followingGameState = _arg1;
}
public function Update(){
if (_nextGameState.isTransitioning()){
return;
};
if (_currentGameState != _nextGameState){
_currentGameState = _nextGameState;
_currentGameState.Entry(_gameContext);
} else {
if (_currentGameState == _nextGameState){
_currentGameState.Update(_gameContext);
if (_currentGameState != _nextGameState){
_currentGameState.Exit(_gameContext);
_currentGameState = null;
};
};
};
}
}
}//package Game
Section 52
//Ground (Game.Ground)
package Game {
import Base.*;
import org.cove.ape.*;
public class Ground extends RectangleParticle {
private var gameData:GameData;
private var _gameContext:GameEntry;
public function Ground(_arg1:GameEntry, _arg2:Number=0, _arg3:Number=0, _arg4:Number=10, _arg5:Number=10, _arg6:Number=0, _arg7:Boolean=true, _arg8:Number=1, _arg9:Number=0.3, _arg10:Number=0){
super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
}
override public function toString():String{
return ("Ground()");
}
}
}//package Game
Section 53
//HeroCollect_SP (Game.HeroCollect_SP)
package Game {
import Base.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import org.cove.ape.*;
import Effects.*;
import Game.AIStates.*;
public class HeroCollect_SP extends SpringConstraint {
public var isRecovered:Boolean;
var tokenConfine:Confinement;
var torsPart:AbstractParticle;
public var isHome:Boolean;
public var type:int;
public var isInZone:Boolean;
var xDist;// = 0
public var isOnWave:Boolean;
public var isInWater:Boolean;
var paddle:PaddleCatch;
var scrollSpeed:Number;
public var isOnGround:Boolean;
public var state:int;// = 0
var confineStart:Number;
var mc:MovieClip;
private var _gameContext:GameEntry;
private var gameData:GameData;
public var isDisabled:Boolean;
private var sndMod:SoundModule;
public var animator:SpriteAnimator;
var confineDuration:Number;// = 150
public var isConfined:Boolean;
var headPart:AbstractParticle;
public var isOnBouy:Boolean;
var catchY:Number;// = 0
public static const PLAY_RECOVERY:int = 14;
public static const ENTER_RECOVERY:int = 13;
public static const RIDING_ON_BOUY:int = 12;
public static const ENTER_RESCUE:int = 9;
public static const IN_AIR:int = 2;
public static const COLLECTING_TOKEN:int = 3;
public static const IDLE:int = 0;
public static const WAITING_FOR_BOUY:int = 11;
public static const IS_HOME:int = 15;
public static const IS_CONFINED:int = 4;
public static const IS_LANDING:int = 5;
public static const ENTER_WAIT_FOR_RESCUE:int = 7;
public static const PLAY_WAIT_FOR_RESCUE:int = 8;
public static const LAUNCH:int = 1;
public static const SPLASH_DOWN:int = 6;
public static const PLAY_RESCUE:int = 10;
public function HeroCollect_SP(_arg1:GameEntry, _arg2:int, _arg3:Confinement, _arg4:AbstractParticle, _arg5:AbstractParticle, _arg6:Number=1, _arg7:Boolean=false, _arg8:Number=20, _arg9:Number=1, _arg10:Boolean=true){
catchY = 0;
confineDuration = 150;
xDist = 0;
state = 0;
super(_arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
sndMod = gameData.getSoundModule();
tokenConfine = _arg3;
headPart = _arg4;
headPart.setStyle(0, 0, 0, 0xFFFFFF, 0);
torsPart = _arg5;
torsPart.setStyle(0, 0, 0, 0xFFFFFF, 0);
type = _arg2;
mc = ((_arg2)==1) ? (new sprite_flapjack() as MovieClip) : (new sprite_knuckels() as MovieClip);
mc.gotoAndStop(1);
setDisplay(mc);
animator = new SpriteAnimator(_gameContext, mc);
isHome = true;
isDisabled = false;
isOnBouy = false;
isRecovered = false;
isConfined = false;
isInZone = false;
isOnWave = false;
isInWater = false;
isOnGround = false;
scrollSpeed = gameData.getGameState().tokenSpeed;
headPart.addEventListener(CollisionEvent.COLLIDE, handleCollision, false, 1, true);
}
public function startRagLoop(_arg1:Event):void{
animator.startAnimating(6, 13, true, 16);
animator.removeEventListener(AnimationEvent.COMPLETE, this.startRagLoop);
}
function setPartsCollidable(_arg1:Boolean):void{
headPart.collidable = _arg1;
torsPart.collidable = _arg1;
}
function setFixed(_arg1:Boolean):void{
headPart.fixed = _arg1;
torsPart.fixed = _arg1;
}
public function setIsRecovered():void{
isRecovered = true;
}
public function startCaptureLoop(_arg1:Event):void{
animator.removeEventListener(AnimationEvent.COMPLETE, this.startCaptureLoop);
if (isConfined){
animator.startAnimating(160, 179, true);
};
}
public function updateState():int{
var _local1:Number;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
switch (state){
case IDLE:
if (((!((headPart.px == 300))) && (!((headPart.py == 500))))){
headPart.position = new Vector(300, 500);
torsPart.position = new Vector(300, 515);
};
break;
case LAUNCH:
if (isOnWave){
state = SPLASH_DOWN;
};
if (isInZone){
state = IS_LANDING;
};
if (isConfined){
state = IS_CONFINED;
};
if (animator.animateSprite() == 1){
animator.startAnimating(6, 13, true, 16);
state = IN_AIR;
};
xDist = (xDist + 1.5);
break;
case IN_AIR:
animator.animateSprite();
if (isOnWave){
state = SPLASH_DOWN;
};
if (isInZone){
state = IS_LANDING;
};
if (isConfined){
state = IS_CONFINED;
};
xDist = (xDist + 1.5);
break;
case IS_CONFINED:
if (!isConfined){
state = IN_AIR;
};
animator.animateSprite();
_local1 = (confineStart - confineDuration);
if (_local1 <= tokenConfine.getX()){
tokenConfine.move(-(scrollSpeed), 0);
} else {
animator.startAnimating(180, 186, false);
animator.addEventListener(AnimationEvent.COMPLETE, this.startRagLoop, false, 0, true);
gameData.playSoundByEvent(SoundData.MAIN_HERO_CAPTURE_RELEASE);
breakOut();
};
break;
case IS_LANDING:
_local2 = (paddle.px - headPart.px);
_local3 = (paddle.py - headPart.py);
_local4 = Math.atan2(_local3, _local2);
_local5 = (10 * Math.cos(_local4));
_local6 = (10 * Math.sin(_local4));
headPart.velocity = new Vector(_local5, _local6);
if (isHome){
state = IS_HOME;
};
break;
case IS_HOME:
headPart.px = paddle.px;
headPart.py = paddle.py;
isOnGround = false;
isConfined = false;
isDisabled = false;
headPart.velocity = new Vector(0, 0);
mc.visible = false;
state = IDLE;
break;
case SPLASH_DOWN:
isInWater = true;
isDisabled = true;
isRecovered = false;
new Spark(_gameContext, "spr_splash", gameData.getGameLayer(GameData.BOARD), headPart.px, headPart.py, 1, 10, 0);
gameData.playSoundByEvent(SoundData.MAIN_HERO_COLLIDE_WATER);
gameData.setOnboardIndicator(type, false);
state = WAITING_FOR_BOUY;
break;
case WAITING_FOR_BOUY:
if (isOnBouy){
isInWater = false;
state = RIDING_ON_BOUY;
};
break;
case RIDING_ON_BOUY:
if (isRecovered){
state = ENTER_RECOVERY;
};
break;
case ENTER_RECOVERY:
state = PLAY_RECOVERY;
break;
case PLAY_RECOVERY:
isOnBouy = false;
isDisabled = false;
isHome = true;
state = IDLE;
break;
};
return (state);
}
public function setIsRescued():void{
isOnBouy = true;
}
public function reset():void{
isHome = true;
isDisabled = false;
isOnBouy = false;
isRecovered = false;
isInZone = false;
isOnWave = false;
isInWater = false;
isOnGround = false;
isConfined = false;
headPart.velocity = new Vector(0, 0);
state = IDLE;
updateState();
}
override public function toString():String{
return ((("Hero(" + type) + ")"));
}
public function launch(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
_arg2 = (_arg2 - 10);
xDist = 0;
headPart.position = new Vector(_arg1, _arg2);
torsPart.position = new Vector((_arg1 + 1), (_arg2 + 15));
headPart.velocity = new Vector(_arg3, _arg4);
isHome = false;
isInZone = false;
isOnWave = false;
isOnGround = false;
animator.startAnimating(1, 5, false, 16);
mc.visible = true;
state = LAUNCH;
}
public function getY():Number{
return (headPart.py);
}
public function breakOut():void{
tokenConfine.setPosition(-200, 0);
isConfined = false;
}
public function handleCollision(_arg1:CollisionEvent):void{
var _local2:Token;
var _local3:Contraption;
var _local4:int;
var _local5:HeroCollect_SP;
var _local6:Wave;
var _local7:int;
var _local8:AirObstacle;
var _local9:Crate;
var _local10:RectangleParticle;
var _local11:Paddle;
switch (getQualifiedClassName(_arg1.collidingItem)){
case "Game::Paddle":
if (((isInZone) && (!(isHome)))){
_local11 = (_arg1.collidingItem as Paddle);
_local11.playAnimation(Paddle.ANIM_CATCH);
gameData.getGameState().setIsCatching();
gameData.playSoundByEvent(SoundData.MAIN_BUBBIE_CATCH);
isHome = true;
return;
};
if (isHome){
return;
};
gameData.playSoundByEvent(SoundData.MAIN_HERO_COLLIDE_BUBBIE);
break;
case "Game::PaddleCatch":
if ((((((headPart.velocity.y < 0)) || (isInZone))) || (isHome))){
return;
};
paddle = (_arg1.collidingItem as PaddleCatch);
isInZone = true;
break;
case "Game::Token":
_local2 = (_arg1.collidingItem as Token);
if (_local2._type < 3){
_local2.collect();
} else {
if (isConfined){
return;
};
tokenConfine.setPosition(_local2.px, _local2.py);
confineStart = _local2.px;
_local2.contain();
gameData.playSoundByEvent(SoundData.MAIN_HERO_CAPTURE);
animator.startAnimating(140, 144, false);
animator.addEventListener(AnimationEvent.COMPLETE, this.startCaptureLoop, false, 0, true);
isDisabled = true;
isConfined = true;
};
break;
case "Game::Contraption":
_local3 = (_arg1.collidingItem as Contraption);
if (isConfined){
breakOut();
};
_local3.playHit();
break;
case "Game::ConfineWall":
if (isConfined){
return;
};
_local4 = ((type)==2) ? 1 : 2;
_local5 = gameData.getGameState().getHeroByNumber(_local4);
_local5.breakOut();
break;
case "Game::Wave":
if (((isOnWave) || (isHome))){
return;
};
_local6 = (_arg1.collidingItem as Wave);
_local7 = _local6._waveType;
if (_local7 == 1){
isOnWave = true;
};
break;
case "Game::AirObstacle":
_local8 = (_arg1.collidingItem as AirObstacle);
if (isConfined){
breakOut();
};
_local8.playHit();
break;
case "Game::Crate":
_local9 = (_arg1.collidingItem as Crate);
_local9.isHit();
break;
case "Game::Ground":
if (isOnGround == true){
return;
};
isOnGround = true;
break;
case "org.cove.ape::RectangleParticle":
_local10 = (_arg1.collidingItem as RectangleParticle);
if (_local10.px <= -35){
if (isConfined){
breakOut();
} else {
gameData.playSoundByEvent(SoundData.MAIN_HERO_COLLIDE_SCREEN);
};
};
if (_local10.px >= 635){
gameData.playSoundByEvent(SoundData.MAIN_HERO_COLLIDE_SCREEN);
};
break;
};
}
}
}//package Game
Section 54
//HeroSpend (Game.HeroSpend)
package Game {
import Base.*;
import flash.events.*;
import flash.display.*;
import flash.media.*;
public class HeroSpend extends SpriteEntity {
var HIT_UPDATE:int;// = 7
var slideLoop:SoundChannel;
var SLIDE_UPDATE:int;// = 3
var bf:int;// = 1
var JUMP_ENTER:int;// = 4
var START_UPDATE:int;// = 1
var START_ENTER:int;// = 0
var anims:Array;
var SLIDE_ENTER:int;// = 2
var state:int;// = 0
private var _gameContext:GameEntry;
var sbrush:MovieClip;
private var gameData:GameData;
private var sndMod:SoundModule;
var HIT_ENTER:int;// = 6
var JUMP_UPDATE:int;// = 5
public function HeroSpend(_arg1:GameEntry, _arg2:String, _arg3:DisplayObjectContainer){
state = 0;
START_ENTER = 0;
START_UPDATE = 1;
SLIDE_ENTER = 2;
SLIDE_UPDATE = 3;
JUMP_ENTER = 4;
JUMP_UPDATE = 5;
HIT_ENTER = 6;
HIT_UPDATE = 7;
anims = [[1, 26, false], [1, 1, true], [27, 40, true], [1, 1, true], [53, 77, false], [1, 1, true], [90, 110, false]];
bf = 1;
super(_arg1, _arg2, _arg3);
setPosition(225, 300);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
sndMod = gameData.getSoundModule();
sbrush = getMovieClip().brush;
sbrush.gotoAndStop(1);
}
public function playSuccess():void{
gameData.playSoundByEvent(23);
state = JUMP_ENTER;
}
public function playFail():void{
gameData.playSoundByEvent(8);
state = HIT_ENTER;
}
public function toString():String{
return ("HeroSpend()");
}
public function start():void{
bf = 1;
state = START_ENTER;
}
public function update():void{
var _local1:int;
_local1 = animateSprite();
switch (state){
case START_ENTER:
startAnimating(anims[state][0], anims[state][1], anims[state][2]);
state = START_UPDATE;
break;
case START_UPDATE:
if (getCurrentFrame() == 14){
gameData.playSoundByEvent(SoundData.HERO_LAND_ON_BRUSH);
};
if (_local1 == 1){
slideLoop = sndMod.playSound(SoundData.getSoundName(SoundData.BONUS_HERO_SLIDE_LOOP), 1, 0, 0, 9999);
state = SLIDE_ENTER;
};
break;
case SLIDE_ENTER:
startAnimating(anims[state][0], anims[state][1], anims[state][2]);
state = SLIDE_UPDATE;
break;
case SLIDE_UPDATE:
break;
case JUMP_ENTER:
startAnimating(anims[state][0], anims[state][1], anims[state][2]);
gameData.playSoundByEvent(SoundData.BONUS_HERO_JUMP);
state = JUMP_UPDATE;
break;
case JUMP_UPDATE:
if (_local1 == 1){
state = SLIDE_ENTER;
};
break;
case HIT_ENTER:
startAnimating(anims[state][0], anims[state][1], anims[state][2]);
sndMod.stopSound(slideLoop);
slideLoop = null;
sbrush.gotoAndStop(25);
gameData.playSoundByEvent(SoundData.BONUS_HERO_FALL_DOWN);
state = HIT_UPDATE;
return;
case HIT_UPDATE:
return;
};
bf++;
if (bf == 16){
bf = 1;
};
sbrush.gotoAndStop(bf);
}
}
}//package Game
Section 55
//MeterNeedle (Game.MeterNeedle)
package Game {
import Base.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import org.cove.ape.*;
public class MeterNeedle extends RectangleParticle {
var clickDisplay:MovieClip;
var clickZone:Number;// = 40
var inZone:Boolean;
var mc:MovieClip;
public var canClick:Boolean;
private var _gameContext:GameEntry;
private var gameData:GameData;
var board:Sprite;
public function MeterNeedle(_arg1:GameEntry, _arg2:Number=0, _arg3:Number=0, _arg4:Number=10, _arg5:Number=10, _arg6:Number=0, _arg7:Boolean=true, _arg8:Number=1, _arg9:Number=0.3, _arg10:Number=0){
clickZone = 40;
super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
inZone = false;
addEventListener(CollisionEvent.COLLIDE, handleCollision, false, 1, true);
velocity = new Vector(0, 0);
mc = (new needle() as MovieClip);
setDisplay(mc);
alwaysRepaint = true;
canClick = true;
clickDisplay = new beat();
clickDisplay.gotoAndStop(1);
clickDisplay.y = (py + 10);
clickDisplay.x = 300;
board = (gameData.getGameLayer(GameData.BOARD) as Sprite);
}
public function stop():void{
removeClick();
velocity = new Vector(0, 0);
}
function handleReset(_arg1:MouseEvent):void{
var _local2:int;
canClick = true;
gameData._reset = true;
_local2 = ((velocity.x)<0) ? -1 : 1;
gameData._meterSpeed = 3;
velocity = new Vector((3 * _local2), 0);
}
public function addSpeed():void{
var _local1:Number;
var _local2:int;
var _local3:Number;
_local1 = Math.abs(velocity.x);
_local2 = ((velocity.x)<0) ? -1 : 1;
if (_local1 < 30){
_local3 = (_local1 + 2);
gameData._meterSpeed = _local3;
velocity = new Vector((_local3 * _local2), 0);
};
}
public function start():void{
velocity = new Vector(3, 0);
clickZone = 40;
removeClick();
canClick = true;
inZone = false;
}
function removeClick():void{
if (board.contains(clickDisplay)){
board.removeChild(clickDisplay);
};
}
override public function toString():String{
return ("MeterNeedle()");
}
public function reduceClickZone():void{
if (clickZone <= 20){
return;
};
clickZone = (clickZone - 2);
}
public function registerClick():Boolean{
trace(("inZone: " + inZone));
if (inZone){
clickDisplay.gotoAndStop(1);
clickDisplay.x = px;
board.addChild(clickDisplay);
canClick = false;
return (true);
};
clickDisplay.gotoAndStop(3);
clickDisplay.x = px;
board.addChild(clickDisplay);
return (false);
}
public function handleCollision(_arg1:CollisionEvent):void{
var _local2:int;
var _local3:*;
var _local4:Number;
var _local5:Number;
if (_arg1.collidingItem.name == "LeftWall"){
removeClick();
gameData.playSoundByEvent(SoundData.BONUS_TIMER_TICK);
return;
};
if (_arg1.collidingItem.name == "RightWall"){
removeClick();
gameData.playSoundByEvent(SoundData.BONUS_TIMER_TICK);
return;
};
if ((getQualifiedClassName(_arg1.collidingItem) == "Game::MeterTarget")){
_local2 = ((velocity.x)<1) ? -1 : 1;
_local3 = (_arg1.collidingItem as MeterTarget);
_local4 = (_local3.px - (clickZone / 2));
_local5 = (_local3.px + (clickZone / 2));
if ((((px >= _local4)) && ((px <= _local5)))){
inZone = true;
trace("inZone = true");
} else {
inZone = false;
canClick = true;
trace("inZone = false");
};
};
}
}
}//package Game
Section 56
//MeterTarget (Game.MeterTarget)
package Game {
import Base.*;
import flash.display.*;
import org.cove.ape.*;
public class MeterTarget extends RectangleParticle {
var defaultWidth:Number;
public var mc:MovieClip;
private var _gameContext:GameEntry;
private var gameData:GameData;
public function MeterTarget(_arg1:GameEntry, _arg2:Number=0, _arg3:Number=0, _arg4:Number=10, _arg5:Number=10, _arg6:Number=0, _arg7:Boolean=true, _arg8:Number=1, _arg9:Number=0.3, _arg10:Number=0){
super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
solid = false;
defaultWidth = 40;
alwaysRepaint = true;
mc = (new spr_meterTarget() as MovieClip);
setDisplay(mc);
}
public function reset():void{
width = defaultWidth;
mc._targetArea.width = defaultWidth;
}
override public function toString():String{
return ("MeterTarget()");
}
public function reduceTargetArea():void{
if (mc.width <= 20){
return;
};
mc._targetArea.width = (mc._targetArea.width - 2);
}
}
}//package Game
Section 57
//Paddle (Game.Paddle)
package Game {
import Base.*;
import flash.display.*;
import org.cove.ape.*;
public class Paddle extends CircleParticle {
public var animations:Array;
var mc:MovieClip;
private var _gameContext:GameEntry;
private var gameData:GameData;
private var sndMod:SoundModule;
public var animator:SpriteAnimator;
public static const ANIM_IDLE:int = 0;
public static const ANIM_SWIM_FAST:int = 6;
public static const ANIM_DIVE_UP:int = 8;
public static const ANIM_SWIMN_SLOW:int = 5;
public static const ANIM_CATCH:int = 2;
public static const ANIM_SHOOT:int = 1;
public static const ANIM_SUPERSHOOT:int = 3;
public static const ANIM_SUPERLOOP:int = 4;
public static const ANIM_DIVE_DOWN:int = 7;
public function Paddle(_arg1:GameEntry, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean=false, _arg6:Number=1, _arg7:Number=0.3, _arg8:Number=0){
animations = [[1, 1, false], [20, 32, false], [39, 43, false], [60, 68, false], [68, 72, true], [80, 80, false], [100, 100, false], [120, 133, false], [140, 143, false]];
super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
sndMod = gameData.getSoundModule();
mc = new sprite_bubbie();
mc.gotoAndStop(133);
setDisplay(mc);
animator = new SpriteAnimator(_gameContext, mc);
}
override public function toString():String{
return ("Paddle()");
}
public function playAnimation(_arg1:int):void{
animator.startAnimating(animations[_arg1][0], animations[_arg1][1], animations[_arg1][2]);
}
}
}//package Game
Section 58
//PaddleCatch (Game.PaddleCatch)
package Game {
import Base.*;
import org.cove.ape.*;
public class PaddleCatch extends CircleParticle {
private var sndMod:SoundModule;
private var _gameContext:GameEntry;
private var gameData:GameData;
public function PaddleCatch(_arg1:GameEntry, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean=false, _arg6:Number=1, _arg7:Number=0.3, _arg8:Number=0){
super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
sndMod = gameData.getSoundModule();
solid = false;
}
override public function toString():String{
return ("PaddleCatch()");
}
}
}//package Game
Section 59
//SoundData (Game.SoundData)
package Game {
public class SoundData {
public static var BONUS_TIMER_GOOD_CLICK:Number = 27;
public static var MAIN_HERO_COLLIDE_BLIMP:Number = 9;
public static var MAIN_HERO_COLLIDE_CRATE:Number = 10;
public static var MAIN_BUBBIE_SHOT:Number = 3;
public static var HERO_LAND_ON_BRUSH:Number = 37;
public static var MAIN_HERO_COLLIDE_SCREEN:Number = 8;
public static var MAIN_HERO_COLLECT_BIG_TOKEN:Number = 18;
public static var MAIN_HERO_COLLIDE_GULL:Number = 14;
public static var MAIN_TOKEN_DESPAWN:Number = 22;
public static var SCREEN_TRANSITION:Number = 24;
public static var MAIN_BUBBIE_PWR_SHOT:Number = 4;
public static var BONUS_HERO_JUMP:Number = 30;
public static var MAIN_LEVEL_START:Number = 0;
public static var MAIN_BUBBIE_SPRINT:Number = 5;
public static var MAIN_HERO_COLLECT_TOKEN:Number = 17;
public static var MAIN_HERO_LOST_AT_SEA:Number = 16;
public static var MAIN_HERO_CAPTURE:Number = 19;
public static var BONUS_HERO_FALL_DOWN:Number = 31;
public static var MAIN_OCEAN_LOOP:Number = 2;
public static var soundEventList:Array = [{eventName:MAIN_LEVEL_START, linkageName:"mainLevelStart", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_MUSIC_LOOP, linkageName:"mainMusicLoop", volume:80, pan:0, offset:0, loop:true, force:false}, {eventName:MAIN_OCEAN_LOOP, linkageName:"mainOceanLoop", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_BUBBIE_SHOT, linkageName:"mainBubbieShot", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:MAIN_BUBBIE_PWR_SHOT, linkageName:"mainBubbiePwrShot", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_BUBBIE_SPRINT, linkageName:"mainBubbieSprint", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_BUBBIE_CATCH, linkageName:"mainBubbieCatch", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:MAIN_HERO_COLLIDE_BUBBIE, linkageName:"mainHeroCollideBubbie", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_HERO_COLLIDE_SCREEN, linkageName:"mainHeroCollideScreen", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_HERO_COLLIDE_BLIMP, linkageName:"mainHeroCollideBlimp", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_HERO_COLLIDE_CRATE, linkageName:"mainHeroCollideBarrel", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:MAIN_BLIMP_LOOP, linkageName:"mainBlimpLoop", volume:100, pan:0, offset:0, loop:true, force:false}, {eventName:MAIN_BOUY_LOOP, linkageName:"mainBouyLoop", volume:100, pan:0, offset:0, loop:true, force:false}, {eventName:MAIN_GULLS_LOOP, linkageName:"mainGullsLoop", volume:100, pan:0, offset:0, loop:true, force:false}, {eventName:MAIN_HERO_COLLIDE_GULL, linkageName:"mainHeroCollideGull", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_HERO_COLLIDE_WATER, linkageName:"mainHeroCollideWater", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_HERO_LOST_AT_SEA, linkageName:"mainHeroLostAtSea", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_HERO_COLLECT_TOKEN, linkageName:"mainHeroCollectToken", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:MAIN_HERO_COLLECT_BIG_TOKEN, linkageName:"mainHeroCollectBigToken", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:MAIN_HERO_CAPTURE, linkageName:"mainHeroCapture", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_HERO_CAPTURE_RELEASE, linkageName:"mainHeroCaptureRelease", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:MAIN_TOKEN_SPAWN, linkageName:"mainTokenSpawn", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:MAIN_TOKEN_DESPAWN, linkageName:"mainTokenDespawn", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:MAIN_LEVEL_END, linkageName:"mainLevelEnd", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:SCREEN_TRANSITION, linkageName:"screenTransition", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:BONUS_WHARF_LOOP, linkageName:"bonusWharfLoop", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:BONUS_TIMER_TICK, linkageName:"bonusTimerTick", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:BONUS_TIMER_GOOD_CLICK, linkageName:"bonusTimerGoodClick", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:BONUS_TIMER_BAD_CLICK, linkageName:"bonusTimerBadClick", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:BONUS_HERO_SLIDE_LOOP, linkageName:"bonusHeroSlideLoop", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:BONUS_HERO_JUMP, linkageName:"bonusHeroJump", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:BONUS_HERO_FALL_DOWN, linkageName:"bonusHeroFallDown", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:BTN_SCRIBBLE_OVER, linkageName:"buttonScribbleOver", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:BONUS_SCORE_CALC, linkageName:"bonusScoreCalc", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:BTN_PLAY_OVER, linkageName:"btnPlayOver", volume:100, pan:0, offset:0, loop:false, force:true}, {eventName:HERO_RECOVERED, linkageName:"heroRecovered", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:HERO_LAUNCH_TO_DOCK, linkageName:"heroLaunchToDock", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:HERO_LAND_ON_BRUSH, linkageName:"heroLandOnBrush", volume:100, pan:0, offset:0, loop:false, force:false}, {eventName:BTN_PRESERVER_OVER, linkageName:"btnLifePreserver", volume:100, pan:0, offset:0, loop:false, force:true}];
public static var BONUS_TIMER_TICK:Number = 26;
public static var BONUS_TIMER_BAD_CLICK:Number = 28;
public static var BTN_PLAY_OVER:Number = 34;
public static var BTN_SCRIBBLE_OVER:Number = 32;
public static var MAIN_GULLS_LOOP:Number = 13;
public static var BONUS_HERO_SLIDE_LOOP:Number = 29;
public static var HERO_LAUNCH_TO_DOCK:Number = 36;
public static var MAIN_BUBBIE_CATCH:Number = 6;
public static var MAIN_HERO_COLLIDE_WATER:Number = 15;
public static var MAIN_LEVEL_END:Number = 23;
public static var BTN_PRESERVER_OVER:Number = 38;
public static var MAIN_MUSIC_LOOP:Number = 1;
public static var HERO_RECOVERED:Number = 35;
public static var MAIN_BLIMP_LOOP:Number = 11;
public static var MAIN_BOUY_LOOP:Number = 12;
public static var MAIN_TOKEN_SPAWN:Number = 21;
public static var MAIN_HERO_COLLIDE_BUBBIE:Number = 7;
public static var BONUS_SCORE_CALC:Number = 33;
public static var MAIN_HERO_CAPTURE_RELEASE:Number = 20;
public static var BONUS_WHARF_LOOP:Number = 25;
public static function getSoundName(_arg1:Number):String{
var _local2:Number;
_local2 = soundEventList.length;
while (_local2--) {
if (soundEventList[_local2].eventName == _arg1){
return (soundEventList[_local2].linkageName);
};
};
return (null);
}
public static function setSoundStartPosition(_arg1:Number, _arg2:Number):void{
var _local3:Number;
_local3 = soundEventList.length;
while (_local3--) {
if (soundEventList[_local3].eventName == _arg1){
soundEventList[_local3].offset = _arg2;
return;
};
};
}
}
}//package Game
Section 60
//Token (Game.Token)
package Game {
import Base.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import org.cove.ape.*;
import flash.text.*;
import Effects.*;
import Game.AIStates.*;
public class Token extends CircleParticle {
public var _type:int;
var myGroup:Group;
public var startX:Number;// = 0
var spawnY:Number;
var spawnX:Number;
var soundID:int;
var mc:MovieClip;
var spawnTimer:Timer;
var _gameContext:GameEntry;
var gameData:GameData;
var myFactory:AbstractFactory;
public var isActive:Boolean;
var sndMod:SoundModule;
public var animator:SpriteAnimator;
var tokenValue:Number;
public function Token(_arg1:GameEntry, _arg2:Number=-100, _arg3:Number=-100, _arg4:Number=10, _arg5:Boolean=true, _arg6:Number=1, _arg7:Number=0.3, _arg8:Number=0){
startX = 0;
super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
sndMod = gameData.getSoundModule();
solid = false;
alwaysRepaint = true;
mc = new spr_coin();
mc.gotoAndStop(1);
setDisplay(mc);
animator = new SpriteAnimator(_gameContext, mc);
isActive = false;
}
public function selfDestruct():void{
new Spark(_gameContext, "spr_coin", gameData.getGameLayer(GameData.BOARD), px, py, 13, 1, 0);
gameData.playSoundByEvent(SoundData.MAIN_TOKEN_DESPAWN);
recycleFactoryObject();
}
public function recycleFactoryObject():void{
isActive = false;
mc.gotoAndStop(5);
px = -100;
py = -100;
myFactory.returnInstance(this);
}
public function startLoop(_arg1:AnimationEvent):void{
if (_type == 1){
animator.startAnimating(20, 37, true);
};
if (_type == 2){
animator.startAnimating(100, 117, true);
};
if (_type == 3){
animator.startAnimating(75, 75, true);
};
animator.removeEventListener(AnimationEvent.COMPLETE, this.startLoop);
}
public function collect():void{
var _local1:Number;
var _local2:*;
var _local3:*;
var _local4:SpriteEntity;
var _local5:TextField;
myGroup.removeParticle(this);
gameData.playSoundByEvent(soundID);
if (gameData.getChainBroken()){
gameData.setChainStarted();
};
gameData._tokens++;
gameData._tokenCombo++;
_local1 = (tokenValue + (tokenValue * (gameData._tokenCombo * 0.05)));
_local1 = Math.round(_local1);
if (_type == 1){
_local2 = 40;
_local3 = 55;
};
if (_type == 2){
_local2 = 120;
_local3 = 134;
};
new Spark(_gameContext, "spr_coin", gameData.getGameLayer(GameData.BOARD), px, py, _local2, _local3, 0);
_local4 = new Spark(_gameContext, "ScoreBox", gameData.getGameLayer(GameData.BOARD), px, py, 1, 30, 0);
_local5 = (_local4.getMovieClip().box.tally as TextField);
_local5.text = ("+" + String(_local1));
gameData._scoreLevel = (gameData._scoreLevel + _local1);
recycleFactoryObject();
}
public function initSpawn(_arg1:Number, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int):void{
_type = _arg2;
spawnX = _arg3;
spawnY = _arg4;
soundID = _arg5;
tokenValue = ((_type)==1) ? 100 : 500;
if (_arg1 > 0){
spawnTimer = new Timer(_arg1, 1);
spawnTimer.addEventListener(TimerEvent.TIMER_COMPLETE, spawn, false, 0, true);
spawnTimer.start();
} else {
spawn();
};
}
override public function toString():String{
return ("Token()");
}
public function spawn(_arg1:TimerEvent=null):void{
isActive = true;
px = spawnX;
py = spawnY;
startX = spawnX;
gameData.playSoundByEvent(SoundData.MAIN_TOKEN_SPAWN);
if (((!((_arg1 == null))) && (!((spawnTimer == null))))){
spawnTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, spawn);
spawnTimer = null;
};
if (_type == 1){
animator.startAnimating(1, 12, false);
};
if (_type == 2){
animator.startAnimating(80, 91, false);
};
if (_type == 3){
animator.startAnimating(60, 75, false);
};
animator.addEventListener(AnimationEvent.COMPLETE, this.startLoop, false, 0, true);
}
public function initFactoryObject(_arg1:AbstractFactory, _arg2:Group):void{
myGroup = _arg2;
myFactory = _arg1;
}
public function contain():void{
myGroup.removeParticle(this);
recycleFactoryObject();
}
}
}//package Game
Section 61
//Wave (Game.Wave)
package Game {
import Base.*;
import flash.display.*;
import org.cove.ape.*;
public class Wave extends RectangleParticle {
public var _waveType:int;
var mc:MovieClip;
private var _gameContext:GameEntry;
private var gameData:GameData;
public function Wave(_arg1:GameEntry, _arg2:int, _arg3:Number=0, _arg4:Number=0, _arg5:Number=45, _arg6:Number=30, _arg7:Number=0, _arg8:Boolean=true, _arg9:Number=1, _arg10:Number=0.3, _arg11:Number=0){
super(_arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11);
_gameContext = _arg1;
gameData = _gameContext.getGameData();
solid = false;
alwaysRepaint = true;
_waveType = _arg2;
switch (_arg2){
case 1:
mc = new wave_1();
break;
case 2:
mc = new wave_2();
break;
case 3:
mc = new wave_3();
break;
};
mc.gotoAndPlay(1);
setDisplay(mc);
}
override public function toString():String{
return ("Wave()");
}
}
}//package Game
Section 62
//AbstractCollection (org.cove.ape.AbstractCollection)
package org.cove.ape {
import flash.display.*;
import flash.utils.*;
public class AbstractCollection {
private var _sprite:Sprite;
private var _isParented:Boolean;
private var _particles:Array;
private var _constraints:Array;
public function AbstractCollection(){
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 getAll():Array{
return (particles.concat(constraints));
}
function checkCollisionsVsCollection(_arg1:AbstractCollection):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:AbstractParticle;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:AbstractParticle;
var _local10:SpringConstraint;
var _local11:SpringConstraint;
var _local12:int;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local5 = _particles[_local3];
if ((((_local5 == null)) || (!(_local5.collidable)))){
} else {
_local6 = _arg1.particles.length;
_local7 = 0;
while (_local7 < _local6) {
_local9 = _arg1.particles[_local7];
if (((!((_local9 == null))) && (_local9.collidable))){
CollisionDetector.test(_local5, _local9);
};
_local7++;
};
_local8 = _arg1.constraints.length;
_local7 = 0;
while (_local7 < _local8) {
_local10 = _arg1.constraints[_local7];
if (((((!((_local10 == null))) && (_local10.collidable))) && (!(_local10.isConnectedTo(_local5))))){
_local10.scp.updatePosition();
CollisionDetector.test(_local5, _local10.scp);
};
_local7++;
};
};
_local3++;
};
_local4 = _constraints.length;
_local3 = 0;
while (_local3 < _local4) {
_local11 = _constraints[_local3];
if ((((_local11 == null)) || (!(_local11.collidable)))){
} else {
_local6 = _arg1.particles.length;
_local12 = 0;
while (_local12 < _local6) {
_local9 = _arg1.particles[_local12];
if (((((!((_local9 == null))) && (_local9.collidable))) && (!(_local11.isConnectedTo(_local9))))){
_local11.scp.updatePosition();
CollisionDetector.test(_local9, _local11.scp);
};
_local12++;
};
};
_local3++;
};
}
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 _local1:int;
var _local2:int;
var _local3:AbstractParticle;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:AbstractParticle;
var _local8:SpringConstraint;
_local1 = _particles.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _particles[_local2];
if ((((_local3 == null)) || (!(_local3.collidable)))){
} else {
_local4 = (_local2 + 1);
while (_local4 < _local1) {
_local7 = _particles[_local4];
if (((!((_local7 == null))) && (_local7.collidable))){
CollisionDetector.test(_local3, _local7);
};
_local4++;
};
_local5 = _constraints.length;
_local6 = 0;
while (_local6 < _local5) {
_local8 = _constraints[_local6];
if (((((!((_local8 == null))) && (_local8.collidable))) && (!(_local8.isConnectedTo(_local3))))){
_local8.scp.updatePosition();
CollisionDetector.test(_local3, _local8.scp);
};
_local6++;
};
};
_local2++;
};
}
public function addParticle(_arg1:AbstractParticle):void{
particles.push(_arg1);
if (isParented){
_arg1.init();
};
}
public function removeConstraint(_arg1:AbstractConstraint):void{
var _local2:int;
_local2 = constraints.indexOf(_arg1);
if (_local2 == -1){
return;
};
constraints.splice(_local2, 1);
_arg1.cleanup();
}
function get isParented():Boolean{
return (_isParented);
}
public function init():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].init();
_local1++;
};
_local1 = 0;
while (_local1 < constraints.length) {
constraints[_local1].init();
_local1++;
};
}
function satisfyConstraints():void{
var _local1:int;
var _local2:int;
var _local3:AbstractConstraint;
_local1 = _constraints.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _constraints[_local2];
_local3.resolve();
_local2++;
};
}
public function paint():void{
var _local1:AbstractParticle;
var _local2:int;
var _local3:int;
var _local4:SpringConstraint;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local1 = _particles[_local3];
if (((!(_local1.fixed)) || (_local1.alwaysRepaint))){
_local1.paint();
};
_local3++;
};
_local2 = _constraints.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _constraints[_local3];
if (((!(_local4.fixed)) || (_local4.alwaysRepaint))){
_local4.paint();
};
_local3++;
};
}
public function addConstraint(_arg1:AbstractConstraint):void{
constraints.push(_arg1);
if (isParented){
_arg1.init();
};
}
function set isParented(_arg1:Boolean):void{
_isParented = _arg1;
}
public function removeParticle(_arg1:AbstractParticle):void{
var _local2:int;
_local2 = particles.indexOf(_arg1);
if (_local2 == -1){
return;
};
particles.splice(_local2, 1);
_arg1.cleanup();
}
public function cleanup():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].cleanup();
_local1++;
};
_local1 = 0;
while (_local1 < constraints.length) {
constraints[_local1].cleanup();
_local1++;
};
}
public function get particles():Array{
return (_particles);
}
function integrate(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:AbstractParticle;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _particles[_local3];
_local4.update(_arg1);
_local3++;
};
}
public function get constraints():Array{
return (_constraints);
}
}
}//package org.cove.ape
Section 63
//AbstractConstraint (org.cove.ape.AbstractConstraint)
package org.cove.ape {
import flash.utils.*;
public class AbstractConstraint extends AbstractItem {
private var _stiffness:Number;
public function AbstractConstraint(_arg1:Number){
if (getQualifiedClassName(this) == "org.cove.ape::AbstractConstraint"){
throw (new ArgumentError("AbstractConstraint can't be instantiated directly"));
};
this.stiffness = _arg1;
setStyle();
}
public function get stiffness():Number{
return (_stiffness);
}
public function resolve():void{
}
public function set stiffness(_arg1:Number):void{
_stiffness = _arg1;
}
}
}//package org.cove.ape
Section 64
//AbstractItem (org.cove.ape.AbstractItem)
package org.cove.ape {
import flash.events.*;
import flash.display.*;
public class AbstractItem extends EventDispatcher {
public var name:String;// = ""
var displayObjectOffset:Vector;
var fillColor:uint;
var displayObject:DisplayObject;
var fillAlpha:Number;
private var _solid:Boolean;
private var _visible:Boolean;
var displayObjectRotation:Number;
var lineColor:uint;
var lineAlpha:Number;
var lineThickness:Number;
private var _sprite:Sprite;
private var _alwaysRepaint:Boolean;
public function AbstractItem(){
name = "";
super();
_solid = true;
_visible = true;
_alwaysRepaint = false;
}
public function setFill(_arg1:uint=0xFFFFFF, _arg2:Number=1):void{
fillColor = _arg1;
fillAlpha = _arg2;
}
public function init():void{
}
public function cleanup():void{
var _local1:int;
sprite.graphics.clear();
_local1 = 0;
while (_local1 < sprite.numChildren) {
sprite.removeChildAt(_local1);
_local1++;
};
}
public function get solid():Boolean{
return (_solid);
}
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 set solid(_arg1:Boolean):void{
_solid = _arg1;
}
public function paint():void{
}
public function set visible(_arg1:Boolean):void{
_visible = _arg1;
sprite.visible = _arg1;
}
public function setStyle(_arg1:Number=0, _arg2:uint=0, _arg3:Number=1, _arg4:uint=0xFFFFFF, _arg5:Number=1):void{
setLine(_arg1, _arg2, _arg3);
setFill(_arg4, _arg5);
}
public function get visible():Boolean{
return (_visible);
}
public function setLine(_arg1:Number=0, _arg2:uint=0, _arg3:Number=1):void{
lineThickness = _arg1;
lineColor = _arg2;
lineAlpha = _arg3;
}
final public function set alwaysRepaint(_arg1:Boolean):void{
_alwaysRepaint = _arg1;
}
final public function get alwaysRepaint():Boolean{
return (_alwaysRepaint);
}
}
}//package org.cove.ape
Section 65
//AbstractParticle (org.cove.ape.AbstractParticle)
package org.cove.ape {
import flash.display.*;
import flash.utils.*;
public class AbstractParticle extends AbstractItem {
private var forceList:Array;
var curr:Vector;
var prev:Vector;
private var collision:Collision;
private var _invMass:Number;
private var _friction:Number;
private var firstCollision:Boolean;
private var _multisample:int;
var samp:Vector;
private var _center:Vector;
private var _fixed:Boolean;
private var _collidable:Boolean;
private var _kfr:Number;
var interval:Interval;
private var _mass:Number;
private var temp:Vector;
private var forces:Vector;
public function AbstractParticle(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Number, _arg5:Number, _arg6:Number){
if (getQualifiedClassName(this) == "org.cove.ape::AbstractParticle"){
throw (new ArgumentError("AbstractParticle can't be instantiated directly"));
};
interval = new Interval(0, 0);
curr = new Vector(_arg1, _arg2);
prev = new Vector(_arg1, _arg2);
samp = new Vector();
temp = new Vector();
fixed = _arg3;
forces = new Vector();
forceList = new Array();
collision = new Collision(new Vector(), new Vector());
collidable = true;
firstCollision = false;
this.mass = _arg4;
this.elasticity = _arg5;
this.friction = _arg6;
setStyle();
_center = new Vector();
_multisample = 0;
}
public function get px():Number{
return (curr.x);
}
public function get py():Number{
return (curr.y);
}
public function set py(_arg1:Number):void{
curr.y = _arg1;
prev.y = _arg1;
}
function getComponents(_arg1:Vector):Collision{
var _local2:Vector;
var _local3:Number;
_local2 = velocity;
_local3 = _arg1.dot(_local2);
collision.vn = _arg1.mult(_local3);
collision.vt = _local2.minus(collision.vn);
return (collision);
}
public function set px(_arg1:Number):void{
curr.x = _arg1;
prev.x = _arg1;
}
public function setDisplay(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
displayObject = _arg1;
displayObjectRotation = _arg4;
displayObjectOffset = new Vector(_arg2, _arg3);
}
public function get multisample():int{
return (_multisample);
}
public function get position():Vector{
return (new Vector(curr.x, curr.y));
}
public function set multisample(_arg1:int):void{
_multisample = _arg1;
}
public function get center():Vector{
_center.setTo(px, py);
return (_center);
}
public function set position(_arg1:Vector):void{
curr.copy(_arg1);
prev.copy(_arg1);
}
function testParticleEvents(_arg1:AbstractParticle):void{
if (hasEventListener(CollisionEvent.COLLIDE)){
dispatchEvent(new CollisionEvent(CollisionEvent.COLLIDE, false, false, _arg1));
};
if (((hasEventListener(CollisionEvent.FIRST_COLLIDE)) && (!(firstCollision)))){
firstCollision = true;
dispatchEvent(new CollisionEvent(CollisionEvent.FIRST_COLLIDE, false, false, _arg1));
};
}
public function set elasticity(_arg1:Number):void{
_kfr = _arg1;
}
public function get fixed():Boolean{
return (_fixed);
}
function get invMass():Number{
return ((fixed) ? 0 : _invMass);
}
public function resetFirstCollision():void{
firstCollision = false;
}
function initDisplay():void{
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
sprite.addChild(displayObject);
}
private function clearForces():void{
forceList.length = 0;
forces.setTo(0, 0);
}
function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
testParticleEvents(_arg6);
if (((((fixed) || (!(solid)))) || (!(_arg6.solid)))){
return;
};
curr.copy(samp);
curr.plusEquals(_arg1);
velocity = _arg2;
}
public function get elasticity():Number{
return (_kfr);
}
public function set velocity(_arg1:Vector):void{
prev = curr.minus(_arg1);
}
public function set collidable(_arg1:Boolean):void{
_collidable = _arg1;
}
public function update(_arg1:Number):void{
var _local2:Vector;
if (fixed){
return;
};
accumulateForces();
temp.copy(curr);
_local2 = velocity.plus(forces.multEquals(_arg1));
curr.plusEquals(_local2.multEquals(APEngine.damping));
prev.copy(temp);
clearForces();
}
public function addForce(_arg1:IForce):void{
forceList.push(_arg1);
}
public function get velocity():Vector{
return (curr.minus(prev));
}
public function get collidable():Boolean{
return (_collidable);
}
public function set mass(_arg1:Number):void{
if (_arg1 <= 0){
throw (new ArgumentError("mass may not be set <= 0"));
};
_mass = _arg1;
_invMass = (1 / _mass);
}
public function set fixed(_arg1:Boolean):void{
_fixed = _arg1;
}
private function accumulateForces():void{
var _local1:IForce;
var _local2:int;
var _local3:int;
var _local4:Array;
_local2 = forceList.length;
_local3 = 0;
while (_local3 < _local2) {
_local1 = forceList[_local3];
forces.plusEquals(_local1.getValue(_invMass));
_local3++;
};
_local4 = APEngine.forces;
_local2 = _local4.length;
_local3 = 0;
while (_local3 < _local2) {
_local1 = _local4[_local3];
forces.plusEquals(_local1.getValue(_invMass));
_local3++;
};
}
public function get mass():Number{
return (_mass);
}
public function get friction():Number{
return (_friction);
}
public function set friction(_arg1:Number):void{
if ((((_arg1 < 0)) || ((_arg1 > 1)))){
throw (new ArgumentError("Legal friction must be >= 0 and <=1"));
};
_friction = _arg1;
}
}
}//package org.cove.ape
Section 66
//APEngine (org.cove.ape.APEngine)
package org.cove.ape {
import flash.display.*;
public final class APEngine {
private static var _damping:Number;
private static var _container:DisplayObjectContainer;
private static var _constraintCollisionCycles:int;
private static var groups:Array;
static var forces:Array;
private static var _constraintCycles:int;
private static var timeStep:Number;
private static var numGroups:int;
public static function get container():DisplayObjectContainer{
return (_container);
}
public static function get constraintCollisionCycles():int{
return (_constraintCollisionCycles);
}
public static function removeForce(_arg1:IForce):void{
var _local2:int;
_local2 = forces.indexOf(_arg1);
if (_local2 == -1){
return;
};
forces.splice(_local2, 1);
}
public static function set damping(_arg1:Number):void{
_damping = _arg1;
}
public static function step():void{
var _local1:int;
var _local2:int;
integrate();
_local1 = 0;
while (_local1 < _constraintCycles) {
satisfyConstraints();
_local1++;
};
_local2 = 0;
while (_local2 < _constraintCollisionCycles) {
satisfyConstraints();
checkCollisions();
_local2++;
};
}
public static function get constraintCycles():int{
return (_constraintCycles);
}
public static function set constraintCollisionCycles(_arg1:int):void{
_constraintCollisionCycles = _arg1;
}
public static function init(_arg1:Number=0.25):void{
timeStep = (_arg1 * _arg1);
numGroups = 0;
groups = new Array();
forces = new Array();
_damping = 1;
_constraintCycles = 1;
_constraintCollisionCycles = 1;
}
public static function addForce(_arg1:IForce):void{
forces.push(_arg1);
}
public static function get damping():Number{
return (_damping);
}
public static function set constraintCycles(_arg1:int):void{
_constraintCycles = _arg1;
}
public static function addGroup(_arg1:Group):void{
groups.push(_arg1);
_arg1.isParented = true;
numGroups++;
_arg1.init();
}
public static function set container(_arg1:DisplayObjectContainer):void{
_container = _arg1;
}
public static function paint():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.paint();
_local1++;
};
}
public static function removeGroup(_arg1:Group):void{
var _local2:int;
_local2 = groups.indexOf(_arg1);
if (_local2 == -1){
return;
};
groups.splice(_local2, 1);
_arg1.isParented = false;
numGroups--;
_arg1.cleanup();
}
private static function satisfyConstraints():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.satisfyConstraints();
_local1++;
};
}
public static function removeAllForce():void{
forces = new Array();
}
private static function checkCollisions():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.checkCollisions();
_local1++;
};
}
private static function integrate():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.integrate(timeStep);
_local1++;
};
}
}
}//package org.cove.ape
Section 67
//CircleParticle (org.cove.ape.CircleParticle)
package org.cove.ape {
public class CircleParticle extends AbstractParticle {
private var _radius:Number;
public function CircleParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=0.3, _arg7:Number=0){
super(_arg1, _arg2, _arg4, _arg5, _arg6, _arg7);
_radius = _arg3;
}
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 get radius():Number{
return (_radius);
}
function getIntervalY():Interval{
interval.min = (samp.y - _radius);
interval.max = (samp.y + _radius);
return (interval);
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
_local2 = samp.dot(_arg1);
interval.min = (_local2 - _radius);
interval.max = (_local2 + _radius);
return (interval);
}
public function set radius(_arg1:Number):void{
_radius = _arg1;
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
}
function getIntervalX():Interval{
interval.min = (samp.x - _radius);
interval.max = (samp.x + _radius);
return (interval);
}
}
}//package org.cove.ape
Section 68
//Collision (org.cove.ape.Collision)
package org.cove.ape {
import org.cove.ape.*;
final class Collision {
var vn:Vector;
var vt:Vector;
function Collision(_arg1:Vector, _arg2:Vector){
this.vn = _arg1;
this.vt = _arg2;
}
}
}//package org.cove.ape
Section 69
//CollisionDetector (org.cove.ape.CollisionDetector)
package org.cove.ape {
import org.cove.ape.*;
final class CollisionDetector {
private static var collNormal:Vector;
private static var cpa:AbstractParticle;
private static var cpb:AbstractParticle;
private static var collDepth:Number;
private static function testIntervals(_arg1:Interval, _arg2:Interval):Number{
var _local3:Number;
var _local4:Number;
if (_arg1.max < _arg2.min){
return (0);
};
if (_arg2.max < _arg1.min){
return (0);
};
_local3 = (_arg2.max - _arg1.min);
_local4 = (_arg2.min - _arg1.max);
return (((Math.abs(_local3))<Math.abs(_local4)) ? _local3 : _local4);
}
private static function testOBBvsOBB(_arg1:RectangleParticle, _arg2:RectangleParticle):Boolean{
var _local3:int;
var _local4:Vector;
var _local5:Number;
var _local6:Vector;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Boolean;
collDepth = Number.POSITIVE_INFINITY;
_local3 = 0;
while (_local3 < 2) {
_local4 = _arg1.axes[_local3];
_local5 = testIntervals(_arg1.getProjection(_local4), _arg2.getProjection(_local4));
if (_local5 == 0){
return (false);
};
_local6 = _arg2.axes[_local3];
_local7 = testIntervals(_arg1.getProjection(_local6), _arg2.getProjection(_local6));
if (_local7 == 0){
return (false);
};
_local8 = Math.abs(_local5);
_local9 = Math.abs(_local7);
if ((((_local8 < Math.abs(collDepth))) || ((_local9 < Math.abs(collDepth))))){
_local10 = (_local8 < _local9);
collNormal = (_local10) ? _local4 : _local6;
collDepth = (_local10) ? _local5 : _local7;
};
_local3++;
};
cpa = _arg1;
cpb = _arg2;
return (true);
}
private static function testTypes(_arg1:AbstractParticle, _arg2:AbstractParticle):Boolean{
if ((((_arg1 is RectangleParticle)) && ((_arg2 is RectangleParticle)))){
return (testOBBvsOBB((_arg1 as RectangleParticle), (_arg2 as RectangleParticle)));
};
if ((((_arg1 is CircleParticle)) && ((_arg2 is CircleParticle)))){
return (testCirclevsCircle((_arg1 as CircleParticle), (_arg2 as CircleParticle)));
};
if ((((_arg1 is RectangleParticle)) && ((_arg2 is CircleParticle)))){
return (testOBBvsCircle((_arg1 as RectangleParticle), (_arg2 as CircleParticle)));
};
if ((((_arg1 is CircleParticle)) && ((_arg2 is RectangleParticle)))){
return (testOBBvsCircle((_arg2 as RectangleParticle), (_arg1 as CircleParticle)));
};
return (false);
}
private static function sampVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
if (normVsNorm(_arg1, _arg2)){
return;
};
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
if (testTypes(_arg1, _arg2)){
CollisionResolver.resolve(cpa, cpb, collNormal, collDepth);
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
private static function testCirclevsCircle(_arg1:CircleParticle, _arg2:CircleParticle):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = testIntervals(_arg1.getIntervalX(), _arg2.getIntervalX());
if (_local3 == 0){
return (false);
};
_local4 = testIntervals(_arg1.getIntervalY(), _arg2.getIntervalY());
if (_local4 == 0){
return (false);
};
collNormal = _arg1.samp.minus(_arg2.samp);
_local5 = collNormal.magnitude();
collDepth = ((_arg1.radius + _arg2.radius) - _local5);
if (collDepth > 0){
collNormal.divEquals(_local5);
cpa = _arg1;
cpb = _arg2;
return (true);
};
return (false);
}
static function test(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
if (((_arg1.fixed) && (_arg2.fixed))){
return;
};
if ((((_arg1.multisample == 0)) && ((_arg2.multisample == 0)))){
normVsNorm(_arg1, _arg2);
} else {
if ((((_arg1.multisample > 0)) && ((_arg2.multisample == 0)))){
sampVsNorm(_arg1, _arg2);
} else {
if ((((_arg2.multisample > 0)) && ((_arg1.multisample == 0)))){
sampVsNorm(_arg2, _arg1);
} else {
if (_arg1.multisample == _arg2.multisample){
sampVsSamp(_arg1, _arg2);
} else {
normVsNorm(_arg1, _arg2);
};
};
};
};
}
private static function testOBBvsCircle(_arg1:RectangleParticle, _arg2:CircleParticle):Boolean{
var _local3:Array;
var _local4:int;
var _local5:Number;
var _local6:Vector;
var _local7:Number;
var _local8:Vector;
var _local9:Number;
collDepth = Number.POSITIVE_INFINITY;
_local3 = new Array(2);
_local4 = 0;
while (_local4 < 2) {
_local6 = _arg1.axes[_local4];
_local7 = testIntervals(_arg1.getProjection(_local6), _arg2.getProjection(_local6));
if (_local7 == 0){
return (false);
};
if (Math.abs(_local7) < Math.abs(collDepth)){
collNormal = _local6;
collDepth = _local7;
};
_local3[_local4] = _local7;
_local4++;
};
_local5 = _arg2.radius;
if ((((Math.abs(_local3[0]) < _local5)) && ((Math.abs(_local3[1]) < _local5)))){
_local8 = closestVertexOnOBB(_arg2.samp, _arg1);
collNormal = _local8.minus(_arg2.samp);
_local9 = collNormal.magnitude();
collDepth = (_local5 - _local9);
if (collDepth > 0){
collNormal.divEquals(_local9);
} else {
return (false);
};
};
cpa = _arg1;
cpb = _arg2;
return (true);
}
private static function closestVertexOnOBB(_arg1:Vector, _arg2:RectangleParticle):Vector{
var _local3:Vector;
var _local4:Vector;
var _local5:int;
var _local6:Number;
_local3 = _arg1.minus(_arg2.samp);
_local4 = new Vector(_arg2.samp.x, _arg2.samp.y);
_local5 = 0;
while (_local5 < 2) {
_local6 = _local3.dot(_arg2.axes[_local5]);
if (_local6 >= 0){
_local6 = _arg2.extents[_local5];
} else {
if (_local6 < 0){
_local6 = -(_arg2.extents[_local5]);
};
};
_local4.plusEquals(_arg2.axes[_local5].mult(_local6));
_local5++;
};
return (_local4);
}
private static function normVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):Boolean{
_arg1.samp.copy(_arg1.curr);
_arg2.samp.copy(_arg2.curr);
if (testTypes(_arg1, _arg2)){
CollisionResolver.resolve(cpa, cpb, collNormal, collDepth);
return (true);
};
return (false);
}
private static function sampVsSamp(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
if (normVsNorm(_arg1, _arg2)){
return;
};
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
_arg2.samp.setTo((_arg2.prev.x + (_local4 * (_arg2.curr.x - _arg2.prev.x))), (_arg2.prev.y + (_local4 * (_arg2.curr.y - _arg2.prev.y))));
if (testTypes(_arg1, _arg2)){
CollisionResolver.resolve(cpa, cpb, collNormal, collDepth);
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
}
}//package org.cove.ape
Section 70
//CollisionEvent (org.cove.ape.CollisionEvent)
package org.cove.ape {
import flash.events.*;
public class CollisionEvent extends Event {
private var _collidingItem:AbstractItem;
public static const COLLIDE:String = "collide";
public static const FIRST_COLLIDE:String = "firstCollide";
public function CollisionEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:AbstractItem=null){
super(_arg1, _arg2, _arg3);
_collidingItem = _arg4;
}
public function get collidingItem():AbstractItem{
var _local1:SpringConstraintParticle;
if ((_collidingItem is SpringConstraintParticle)){
_local1 = (_collidingItem as SpringConstraintParticle);
return (_local1.parent);
};
return (_collidingItem);
}
}
}//package org.cove.ape
Section 71
//CollisionResolver (org.cove.ape.CollisionResolver)
package org.cove.ape {
import org.cove.ape.*;
final class CollisionResolver {
static function resolve(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:Vector, _arg4:Number):void{
var _local5:Vector;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Collision;
var _local10:Collision;
var _local11:Vector;
var _local12:Vector;
var _local13:Vector;
var _local14:Vector;
_local5 = _arg3.mult(_arg4);
_local6 = (_arg1.elasticity + _arg2.elasticity);
_local7 = (_arg1.invMass + _arg2.invMass);
_local8 = MathUtil.clamp((1 - (_arg1.friction + _arg2.friction)), 0, 1);
_local9 = _arg1.getComponents(_arg3);
_local10 = _arg2.getComponents(_arg3);
_local11 = _local10.vn.mult(((_local6 + 1) * _arg1.invMass)).plus(_local9.vn.mult((_arg2.invMass - (_local6 * _arg1.invMass)))).divEquals(_local7);
_local12 = _local9.vn.mult(((_local6 + 1) * _arg2.invMass)).plus(_local10.vn.mult((_arg1.invMass - (_local6 * _arg2.invMass)))).divEquals(_local7);
_local9.vt.multEquals(_local8);
_local10.vt.multEquals(_local8);
_local13 = _local5.mult((_arg1.invMass / _local7));
_local14 = _local5.mult((-(_arg2.invMass) / _local7));
_local11.plusEquals(_local9.vt);
_local12.plusEquals(_local10.vt);
_arg1.resolveCollision(_local13, _local11, _arg3, _arg4, -1, _arg2);
_arg2.resolveCollision(_local14, _local12, _arg3, _arg4, 1, _arg1);
}
}
}//package org.cove.ape
Section 72
//Composite (org.cove.ape.Composite)
package org.cove.ape {
public class Composite extends AbstractCollection {
private var delta:Vector;
public function Composite(){
delta = new Vector();
}
private function getRelativeAngle(_arg1:Vector, _arg2:Vector):Number{
delta.setTo((_arg2.x - _arg1.x), (_arg2.y - _arg1.y));
return (Math.atan2(delta.y, delta.x));
}
public function rotateByRadian(_arg1:Number, _arg2:Vector):void{
var _local3:AbstractParticle;
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:Number;
var _local8:Number;
_local4 = particles;
_local5 = _local4.length;
_local6 = 0;
while (_local6 < _local5) {
_local3 = _local4[_local6];
_local7 = _local3.center.distance(_arg2);
_local8 = (getRelativeAngle(_arg2, _local3.center) + _arg1);
_local3.px = ((Math.cos(_local8) * _local7) + _arg2.x);
_local3.py = ((Math.sin(_local8) * _local7) + _arg2.y);
_local6++;
};
}
public function rotateByAngle(_arg1:Number, _arg2:Vector):void{
var _local3:Number;
_local3 = (_arg1 * MathUtil.PI_OVER_ONE_EIGHTY);
rotateByRadian(_local3, _arg2);
}
public function set fixed(_arg1:Boolean):void{
var _local2:int;
_local2 = 0;
while (_local2 < particles.length) {
particles[_local2].fixed = _arg1;
_local2++;
};
}
public function get fixed():Boolean{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
if (!particles[_local1].fixed){
return (false);
};
_local1++;
};
return (true);
}
}
}//package org.cove.ape
Section 73
//Group (org.cove.ape.Group)
package org.cove.ape {
public class Group extends AbstractCollection {
private var _collideInternal:Boolean;
private var _composites:Array;
private var _collisionList:Array;
public function Group(_arg1:Boolean=false){
_composites = new Array();
_collisionList = new Array();
this.collideInternal = _arg1;
}
function checkCollisions():void{
var _local1:int;
var _local2:int;
var _local3:Group;
if (collideInternal){
checkCollisionGroupInternal();
};
_local1 = collisionList.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = collisionList[_local2];
if (_local3 == null){
} else {
checkCollisionVsGroup(_local3);
};
_local2++;
};
}
public function get composites():Array{
return (_composites);
}
override public function init():void{
var _local1:int;
super.init();
_local1 = 0;
while (_local1 < composites.length) {
composites[_local1].init();
_local1++;
};
}
public function removeCollidable(_arg1:Group):void{
var _local2:int;
_local2 = collisionList.indexOf(_arg1);
if (_local2 == -1){
return;
};
collisionList.splice(_local2, 1);
}
private function checkCollisionVsGroup(_arg1:Group):void{
var _local2:Composite;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Composite;
var _local7:int;
checkCollisionsVsCollection(_arg1);
_local3 = _composites.length;
_local4 = _arg1.composites.length;
_local5 = 0;
while (_local5 < _local3) {
_local6 = _composites[_local5];
if (_local6 == null){
} else {
_local6.checkCollisionsVsCollection(_arg1);
_local7 = 0;
while (_local7 < _local4) {
_local2 = _arg1.composites[_local7];
if (_local2 == null){
} else {
_local6.checkCollisionsVsCollection(_local2);
};
_local7++;
};
};
_local5++;
};
_local7 = 0;
while (_local7 < _local4) {
_local2 = _arg1.composites[_local7];
if (_local2 == null){
} else {
checkCollisionsVsCollection(_local2);
};
_local7++;
};
}
override function satisfyConstraints():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
super.satisfyConstraints();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.satisfyConstraints();
_local2++;
};
}
public function get collideInternal():Boolean{
return (_collideInternal);
}
public function addCollidableList(_arg1:Array):void{
var _local2:int;
var _local3:Group;
_local2 = 0;
while (_local2 < _arg1.length) {
_local3 = _arg1[_local2];
collisionList.push(_local3);
_local2++;
};
}
public function removeComposite(_arg1:Composite):void{
var _local2:int;
_local2 = composites.indexOf(_arg1);
if (_local2 == -1){
return;
};
composites.splice(_local2, 1);
_arg1.isParented = false;
_arg1.cleanup();
}
override public function cleanup():void{
var _local1:int;
super.cleanup();
_local1 = 0;
while (_local1 < composites.length) {
composites[_local1].cleanup();
_local1++;
};
}
override public function paint():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
super.paint();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.paint();
_local2++;
};
}
public function addCollidable(_arg1:Group):void{
collisionList.push(_arg1);
}
override public function getAll():Array{
return (particles.concat(constraints).concat(composites));
}
public function get collisionList():Array{
return (_collisionList);
}
override function integrate(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:Composite;
super.integrate(_arg1);
_local2 = _composites.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _composites[_local3];
_local4.integrate(_arg1);
_local3++;
};
}
public function addComposite(_arg1:Composite):void{
composites.push(_arg1);
_arg1.isParented = true;
if (isParented){
_arg1.init();
};
}
private function checkCollisionGroupInternal():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
var _local4:int;
var _local5:Composite;
checkInternalCollisions();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
if (_local3 == null){
} else {
_local3.checkCollisionsVsCollection(this);
_local4 = (_local2 + 1);
while (_local4 < _local1) {
_local5 = _composites[_local4];
if (_local5 != null){
_local3.checkCollisionsVsCollection(_local5);
};
_local4++;
};
};
_local2++;
};
}
public function set collideInternal(_arg1:Boolean):void{
_collideInternal = _arg1;
}
}
}//package org.cove.ape
Section 74
//IForce (org.cove.ape.IForce)
package org.cove.ape {
public interface IForce {
function getValue(_arg1:Number):Vector;
}
}//package org.cove.ape
Section 75
//Interval (org.cove.ape.Interval)
package org.cove.ape {
final class Interval {
var min:Number;
var max:Number;
function Interval(_arg1:Number, _arg2:Number){
this.min = _arg1;
this.max = _arg2;
}
function toString():String{
return (((min + " : ") + max));
}
}
}//package org.cove.ape
Section 76
//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;
static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 < _arg2){
return (_arg2);
};
if (_arg1 > _arg3){
return (_arg3);
};
return (_arg1);
}
static function sign(_arg1:Number):int{
if (_arg1 < 0){
return (-1);
};
return (1);
}
}
}//package org.cove.ape
Section 77
//RectangleParticle (org.cove.ape.RectangleParticle)
package org.cove.ape {
public class RectangleParticle extends AbstractParticle {
private var _axes:Array;
private var _extents:Array;
private var _radian:Number;
public function RectangleParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Boolean=false, _arg7:Number=1, _arg8:Number=0.3, _arg9:Number=0){
super(_arg1, _arg2, _arg6, _arg7, _arg8, _arg9);
_extents = new Array((_arg3 / 2), (_arg4 / 2));
_axes = new Array(new Vector(0, 0), new Vector(0, 0));
radian = _arg5;
}
override public function init():void{
var _local1:Number;
var _local2:Number;
cleanup();
if (displayObject != null){
initDisplay();
} else {
_local1 = (extents[0] * 2);
_local2 = (extents[1] * 2);
sprite.graphics.clear();
sprite.graphics.lineStyle(lineThickness, lineColor, lineAlpha);
sprite.graphics.beginFill(fillColor, fillAlpha);
sprite.graphics.drawRect((-(_local1) / 2), (-(_local2) / 2), _local1, _local2);
sprite.graphics.endFill();
};
paint();
}
public function set width(_arg1:Number):void{
_extents[0] = (_arg1 / 2);
}
function get extents():Array{
return (_extents);
}
function get axes():Array{
return (_axes);
}
public function get height():Number{
return ((_extents[1] * 2));
}
private function setAxes(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.sin(_arg1);
_local3 = Math.cos(_arg1);
axes[0].x = _local3;
axes[0].y = _local2;
axes[1].x = -(_local2);
axes[1].y = _local3;
}
public function get radian():Number{
return (_radian);
}
public function set angle(_arg1:Number):void{
radian = (_arg1 * MathUtil.PI_OVER_ONE_EIGHTY);
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
var _local3:Number;
_local2 = ((extents[0] * Math.abs(_arg1.dot(axes[0]))) + (extents[1] * Math.abs(_arg1.dot(axes[1]))));
_local3 = samp.dot(_arg1);
interval.min = (_local3 - _local2);
interval.max = (_local3 + _local2);
return (interval);
}
public function set height(_arg1:Number):void{
_extents[1] = (_arg1 / 2);
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
public function set radian(_arg1:Number):void{
_radian = _arg1;
setAxes(_arg1);
}
override public function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
sprite.rotation = angle;
}
public function get width():Number{
return ((_extents[0] * 2));
}
}
}//package org.cove.ape
Section 78
//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(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:Number=0.5, _arg4:Boolean=false, _arg5:Number=1, _arg6:Number=1, _arg7:Boolean=false){
super(_arg3);
this.p1 = _arg1;
this.p2 = _arg2;
checkParticlesLocation();
_restLength = currLength;
setCollidable(_arg4, _arg5, _arg6, _arg7);
}
public function get fixed():Boolean{
return (((p1.fixed) && (p2.fixed)));
}
public function set rectScale(_arg1:Number):void{
if (scp == null){
return;
};
scp.rectScale = _arg1;
}
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 isConnectedTo(_arg1:AbstractParticle):Boolean{
return ((((_arg1 == p1)) || ((_arg1 == p2))));
}
public function setDisplay(_arg1:DisplayObject, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
if (collidable){
scp.setDisplay(_arg1, _arg2, _arg3, _arg4);
} else {
displayObject = _arg1;
displayObjectRotation = _arg4;
displayObjectOffset = new Vector(_arg2, _arg3);
};
}
function get scp():SpringConstraintParticle{
return (_scp);
}
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);
};
}
public function get radian():Number{
var _local1:Vector;
_local1 = delta;
return (Math.atan2(_local1.y, _local1.x));
}
public function get rectHeight():Number{
return (scp.rectHeight);
}
public function set restLength(_arg1:Number):void{
if (_arg1 <= 0){
throw (new ArgumentError("restLength must be greater than 0"));
};
_restLength = _arg1;
}
public function get currLength():Number{
return (p1.curr.distance(p2.curr));
}
public function get fixedEndLimit():Number{
return (scp.fixedEndLimit);
}
function get delta():Vector{
return (p1.curr.minus(p2.curr));
}
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(_arg1:Number):void{
if (scp == null){
return;
};
scp.rectHeight = _arg1;
}
public function setCollidable(_arg1:Boolean, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
_collidable = _arg1;
_scp = null;
if (_collidable){
_scp = new SpringConstraintParticle(p1, p2, this, _arg2, _arg3, _arg4);
};
}
override public function paint():void{
var _local1:Vector;
if (collidable){
scp.paint();
} else {
if (displayObject != null){
_local1 = center;
sprite.x = _local1.x;
sprite.y = _local1.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);
};
};
}
public function get rectScale():Number{
return (scp.rectScale);
}
public function get restLength():Number{
return (_restLength);
}
override public function resolve():void{
var _local1:Number;
var _local2:Number;
var _local3:Vector;
if (((p1.fixed) && (p2.fixed))){
return;
};
_local1 = currLength;
_local2 = ((_local1 - restLength) / (_local1 * (p1.invMass + p2.invMass)));
_local3 = delta.mult((_local2 * stiffness));
p1.curr.minusEquals(_local3.mult(p1.invMass));
p2.curr.plusEquals(_local3.mult(p2.invMass));
}
public function get collidable():Boolean{
return (_collidable);
}
public function set fixedEndLimit(_arg1:Number):void{
if (scp == null){
return;
};
scp.fixedEndLimit = _arg1;
}
}
}//package org.cove.ape
Section 79
//SpringConstraintParticle (org.cove.ape.SpringConstraintParticle)
package org.cove.ape {
import flash.display.*;
import org.cove.ape.*;
class SpringConstraintParticle extends RectangleParticle {
private var _fixedEndLimit:Number;
private var rca:Vector;
private var rcb:Vector;
private var _rectScale:Number;
private var s:Number;
var parent:SpringConstraint;
private var scaleToLength:Boolean;
private var p1:AbstractParticle;
private var p2:AbstractParticle;
private var lambda:Vector;
private var avgVelocity:Vector;
private var _rectHeight:Number;
function SpringConstraintParticle(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:SpringConstraint, _arg4:Number, _arg5:Number, _arg6:Boolean){
super(0, 0, 0, 0, 0, false);
this.p1 = _arg1;
this.p2 = _arg2;
lambda = new Vector(0, 0);
avgVelocity = new Vector(0, 0);
parent = _arg3;
this.rectScale = _arg5;
this.rectHeight = _arg4;
this.scaleToLength = _arg6;
fixedEndLimit = 0;
rca = new Vector();
rcb = new Vector();
}
private function setCorners(_arg1:RectangleParticle, _arg2:int):void{
var _local3:Number;
var _local4:Number;
var _local5:Array;
var _local6:Array;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local3 = _arg1.curr.x;
_local4 = _arg1.curr.y;
_local5 = _arg1.axes;
_local6 = _arg1.extents;
_local7 = (_local5[0].x * _local6[0]);
_local8 = (_local5[0].y * _local6[0]);
_local9 = (_local5[1].x * _local6[1]);
_local10 = (_local5[1].y * _local6[1]);
_local11 = (_local7 - _local9);
_local12 = (_local8 - _local10);
_local13 = (_local7 + _local9);
_local14 = (_local8 + _local10);
if (_arg2 == 0){
rca.x = (_local3 - _local13);
rca.y = (_local4 - _local14);
rcb.x = (_local3 + _local11);
rcb.y = (_local4 + _local12);
} else {
if (_arg2 == 1){
rca.x = (_local3 + _local11);
rca.y = (_local4 + _local12);
rcb.x = (_local3 + _local13);
rcb.y = (_local4 + _local14);
} else {
if (_arg2 == 2){
rca.x = (_local3 + _local13);
rca.y = (_local4 + _local14);
rcb.x = (_local3 - _local11);
rcb.y = (_local4 - _local12);
} else {
if (_arg2 == 3){
rca.x = (_local3 - _local11);
rca.y = (_local4 - _local12);
rcb.x = (_local3 - _local13);
rcb.y = (_local4 - _local14);
};
};
};
};
}
override public function init():void{
var _local1:Sprite;
var _local2:Number;
var _local3:Number;
if (displayObject != null){
initDisplay();
} else {
_local1 = new Sprite();
parent.sprite.addChild(_local1);
_local1.name = "inner";
_local2 = (parent.currLength * rectScale);
_local3 = rectHeight;
_local1.graphics.clear();
_local1.graphics.lineStyle(parent.lineThickness, parent.lineColor, parent.lineAlpha);
_local1.graphics.beginFill(parent.fillColor, parent.fillAlpha);
_local1.graphics.drawRect((-(_local2) / 2), (-(_local3) / 2), _local2, _local3);
_local1.graphics.endFill();
};
paint();
}
function updatePosition():void{
var _local1:Vector;
_local1 = parent.center;
curr.setTo(_local1.x, _local1.y);
width = (scaleToLength) ? (parent.currLength * rectScale) : (parent.restLength * rectScale);
height = rectHeight;
radian = parent.radian;
}
private function closestPtSegmentSegment():Number{
var _local1:Vector;
var _local2:Vector;
var _local3:Vector;
var _local4:Vector;
var _local5:Vector;
var _local6:Vector;
var _local7:Vector;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Vector;
var _local16:Vector;
var _local17:Vector;
_local1 = p1.curr;
_local2 = p2.curr;
_local3 = rca;
_local4 = rcb;
_local5 = _local2.minus(_local1);
_local6 = _local4.minus(_local3);
_local7 = _local1.minus(_local3);
_local9 = _local5.dot(_local5);
_local10 = _local6.dot(_local6);
_local11 = _local6.dot(_local7);
_local12 = _local5.dot(_local7);
_local13 = _local5.dot(_local6);
_local14 = ((_local9 * _local10) - (_local13 * _local13));
if (_local14 != 0){
s = MathUtil.clamp((((_local13 * _local11) - (_local12 * _local10)) / _local14), 0, 1);
} else {
s = 0.5;
};
_local8 = (((_local13 * s) + _local11) / _local10);
if (_local8 < 0){
_local8 = 0;
s = MathUtil.clamp((-(_local12) / _local9), 0, 1);
} else {
if (_local8 > 0){
_local8 = 1;
s = MathUtil.clamp(((_local13 - _local12) / _local9), 0, 1);
};
};
_local15 = _local1.plus(_local5.mult(s));
_local16 = _local3.plus(_local6.mult(_local8));
_local17 = _local15.minus(_local16);
return (_local15.minus(_local16).dot(_local17));
}
function get rectHeight():Number{
return (_rectHeight);
}
override public function get mass():Number{
return (((p1.mass + p2.mass) / 2));
}
function get fixedEndLimit():Number{
return (_fixedEndLimit);
}
private function closestParamPoint(_arg1:Vector):Number{
var _local2:Vector;
var _local3:Number;
_local2 = p2.curr.minus(p1.curr);
_local3 = (_local2.dot(_arg1.minus(p1.curr)) / _local2.dot(_local2));
return (MathUtil.clamp(_local3, 0, 1));
}
override public function paint():void{
var _local1:Vector;
var _local2:Sprite;
_local1 = parent.center;
_local2 = parent.sprite;
if (scaleToLength){
_local2.getChildByName("inner").width = (parent.currLength * rectScale);
} else {
if (displayObject != null){
_local2.getChildByName("inner").width = (parent.restLength * rectScale);
};
};
_local2.x = _local1.x;
_local2.y = _local1.y;
_local2.rotation = parent.angle;
}
function set rectHeight(_arg1:Number):void{
_rectHeight = _arg1;
}
private function getContactPointParam(_arg1:AbstractParticle):Number{
var _local2:Number;
var _local3:Number;
var _local4:Array;
var _local5:Number;
var _local6:int;
var _local7:Number;
if ((_arg1 is CircleParticle)){
_local2 = closestParamPoint(_arg1.curr);
} else {
if ((_arg1 is RectangleParticle)){
_local4 = new Array(4);
_local5 = Number.POSITIVE_INFINITY;
_local6 = 0;
while (_local6 < 4) {
setCorners((_arg1 as RectangleParticle), _local6);
_local7 = closestPtSegmentSegment();
if (_local7 < _local5){
_local5 = _local7;
_local3 = _local6;
_local4[_local6] = s;
};
_local6++;
};
_local2 = _local4[_local3];
};
};
return (_local2);
}
function set fixedEndLimit(_arg1:Number):void{
_fixedEndLimit = _arg1;
}
override public function get fixed():Boolean{
return (parent.fixed);
}
override function get invMass():Number{
if (((p1.fixed) && (p2.fixed))){
return (0);
};
return ((1 / ((p1.mass + p2.mass) / 2)));
}
override function initDisplay():void{
var _local1:Sprite;
displayObject.x = displayObjectOffset.x;
displayObject.y = displayObjectOffset.y;
displayObject.rotation = displayObjectRotation;
_local1 = new Sprite();
_local1.name = "inner";
_local1.addChild(displayObject);
parent.sprite.addChild(_local1);
}
function set rectScale(_arg1:Number):void{
_rectScale = _arg1;
}
override function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:AbstractParticle;
testParticleEvents(_arg6);
if (((fixed) || (!(_arg6.solid)))){
return;
};
_local7 = getContactPointParam(_arg6);
_local8 = (1 - _local7);
_local9 = _local7;
if (p1.fixed){
if (_local9 <= fixedEndLimit){
return;
};
lambda.setTo((_arg1.x / _local9), (_arg1.y / _local9));
p2.curr.plusEquals(lambda);
p2.velocity = _arg2;
} else {
if (p2.fixed){
if (_local8 <= fixedEndLimit){
return;
};
lambda.setTo((_arg1.x / _local8), (_arg1.y / _local8));
p1.curr.plusEquals(lambda);
p1.velocity = _arg2;
} else {
_local10 = ((_local8 * _local8) + (_local9 * _local9));
if (_local10 == 0){
return;
};
lambda.setTo((_arg1.x / _local10), (_arg1.y / _local10));
p1.curr.plusEquals(lambda.mult(_local8));
p2.curr.plusEquals(lambda.mult(_local9));
if (_local7 == 0.5){
p1.velocity = _arg2;
p2.velocity = _arg2;
} else {
_local11 = ((_local7)<0.5) ? p1 : p2;
_local11.velocity = _arg2;
};
};
};
}
override public function get elasticity():Number{
return (((p1.elasticity + p2.elasticity) / 2));
}
function get rectScale():Number{
return (_rectScale);
}
override public function get velocity():Vector{
var _local1:Vector;
var _local2:Vector;
_local1 = p1.velocity;
_local2 = p2.velocity;
avgVelocity.setTo(((_local1.x + _local2.x) / 2), ((_local1.y + _local2.y) / 2));
return (avgVelocity);
}
override public function get friction():Number{
return (((p1.friction + p2.friction) / 2));
}
}
}//package org.cove.ape
Section 80
//Vector (org.cove.ape.Vector)
package org.cove.ape {
public class Vector {
public var x:Number;
public var y:Number;
public function Vector(_arg1:Number=0, _arg2:Number=0){
x = _arg1;
y = _arg2;
}
public function cross(_arg1:Vector):Number{
return (((x * _arg1.y) - (y * _arg1.x)));
}
public function magnitude():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function divEquals(_arg1:Number):Vector{
if (_arg1 == 0){
_arg1 = 0.0001;
};
x = (x / _arg1);
y = (y / _arg1);
return (this);
}
public function times(_arg1:Vector):Vector{
return (new Vector((x * _arg1.x), (y * _arg1.y)));
}
public function plusEquals(_arg1:Vector):Vector{
x = (x + _arg1.x);
y = (y + _arg1.y);
return (this);
}
public function dot(_arg1:Vector):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
public function normalizeEquals():Vector{
var _local1:Number;
_local1 = magnitude();
if (_local1 == 0){
_local1 = 0.0001;
};
return (multEquals((1 / _local1)));
}
public function normalize():Vector{
var _local1:Number;
_local1 = magnitude();
if (_local1 == 0){
_local1 = 0.0001;
};
return (mult((1 / _local1)));
}
public function copy(_arg1:Vector):void{
x = _arg1.x;
y = _arg1.y;
}
public function minusEquals(_arg1:Vector):Vector{
x = (x - _arg1.x);
y = (y - _arg1.y);
return (this);
}
public function minus(_arg1:Vector):Vector{
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function plus(_arg1:Vector):Vector{
return (new Vector((x + _arg1.x), (y + _arg1.y)));
}
public function toString():String{
return (((x + " : ") + y));
}
public function distance(_arg1:Vector):Number{
var _local2:Vector;
_local2 = this.minus(_arg1);
return (_local2.magnitude());
}
public function setTo(_arg1:Number, _arg2:Number):void{
x = _arg1;
y = _arg2;
}
public function multEquals(_arg1:Number):Vector{
x = (x * _arg1);
y = (y * _arg1);
return (this);
}
public function mult(_arg1:Number):Vector{
return (new Vector((x * _arg1), (y * _arg1)));
}
}
}//package org.cove.ape
Section 81
//VectorForce (org.cove.ape.VectorForce)
package org.cove.ape {
public class VectorForce implements IForce {
private var fvx:Number;
private var fvy:Number;
private var value:Vector;
private var scaleMass:Boolean;
public function VectorForce(_arg1:Boolean, _arg2:Number, _arg3:Number){
fvx = _arg2;
fvy = _arg3;
scaleMass = _arg1;
value = new Vector(_arg2, _arg3);
}
public function set vx(_arg1:Number):void{
fvx = _arg1;
value.x = _arg1;
}
public function set vy(_arg1:Number):void{
fvy = _arg1;
value.y = _arg1;
}
public function set useMass(_arg1:Boolean):void{
scaleMass = _arg1;
}
public function getValue(_arg1:Number):Vector{
if (scaleMass){
value.setTo((fvx * _arg1), (fvy * _arg1));
};
return (value);
}
}
}//package org.cove.ape
Section 82
//PadManager (Pad.PadManager)
package Pad {
import Base.*;
import flash.events.*;
public class PadManager {
private var _tapBufferMax:Number;
private var _handleMouseRelease:Boolean;
private var _keysDown:Object;
private var _lastKeyPressed:Number;
private var _padData:Array;
private var _gameContext:GameEntry;
private var _handleMousePress:Boolean;
private var _keyTarget:Object;
private var keyStage;
private var _lastKeyReleaseTime:Number;
private var _tapBufferMin:Number;
private var _mouseData:Object;
private var _keyTargeting:Boolean;
public function PadManager(_arg1:GameEntry){
trace("|----@ PAD MANAGER @----|");
_gameContext = _arg1;
keyStage = _gameContext._stage;
_keysDown = new Object();
_padData = new Array();
_lastKeyPressed = 0;
_lastKeyReleaseTime = 0;
_keyTargeting = false;
_mouseData = new Object();
_mouseData.mouseJustPressed = false;
_mouseData.mouseStillPressed = false;
_mouseData.mouseReleased = false;
_mouseData.mouseTimePressed = 0;
_mouseData.mousePressedPosX = 0;
_mouseData.mousePressedPosY = 0;
_mouseData.mousePosX = 0;
_mouseData.mousePosY = 0;
_handleMousePress = false;
_handleMouseRelease = false;
Init();
}
public function getKeyDoubleTapped(_arg1):Boolean{
var _local2:*;
_local2 = 0;
while (_local2 < _padData.length) {
if ((((_padData[_local2].keyAction == _arg1)) && (_padData[_local2].doubleTapped))){
return (true);
};
_local2++;
};
return (false);
}
public function Update():void{
var _local1:int;
if (_mouseData.mouseReleased){
_mouseData.mouseReleased = false;
};
if (_handleMouseRelease){
_handleMouseRelease = false;
_mouseData.mouseJustPressed = false;
_mouseData.mouseStillPressed = false;
_mouseData.mouseReleased = true;
} else {
if (_mouseData.mouseJustPressed){
_mouseData.mouseJustPressed = false;
_mouseData.mouseReleased = false;
_mouseData.mouseStillPressed = true;
};
if (_mouseData.mouseStillPressed){
_mouseData.mouseTimePressed = (_mouseData.mouseTimePressed + _gameContext.getDT());
};
};
if (_handleMousePress){
_handleMousePress = false;
_mouseData.mouseJustPressed = true;
_mouseData.mousePressedPosX = keyStage.mouseX;
_mouseData.mousePressedPosY = keyStage.mouseY;
_mouseData.mouseReleased = false;
_mouseData.mouseStillPressed = false;
_mouseData.mouseTimePressed = 0;
};
_mouseData.mousePosX = keyStage.mouseX;
_mouseData.mousePosY = keyStage.mouseY;
_local1 = 0;
while (_local1 < _padData.length) {
if (isDown(_padData[_local1].keyID)){
if (((!(_padData[_local1].keyPressed)) && (!(_padData[_local1].keyStillPressed)))){
if (_padData[_local1].keyID == _lastKeyPressed){
if ((_gameContext.getTimeManager().getCurTime() - _lastKeyReleaseTime) < 0.18){
_padData[_local1].doubleTapped = true;
};
};
_padData[_local1].keyPressed = true;
_padData[_local1].keyStillPressed = false;
_padData[_local1].keyReleased = false;
_padData[_local1].timePressed = 0;
} else {
if (((_padData[_local1].keyPressed) || (_padData[_local1].keyStillPressed))){
_padData[_local1].keyPressed = false;
_padData[_local1].keyStillPressed = true;
_padData[_local1].keyReleased = false;
_padData[_local1].timePressed = (_padData[_local1].timePressed + _gameContext.getDT());
};
};
} else {
if (((_padData[_local1].keyStillPressed) || (_padData[_local1].keyPressed))){
_padData[_local1].keyPressed = false;
_padData[_local1].keyStillPressed = false;
_padData[_local1].keyReleased = true;
_padData[_local1].doubleTapped = false;
_lastKeyPressed = _padData[_local1].keyID;
_lastKeyReleaseTime = _gameContext.getTimeManager().getCurTime();
};
};
_local1++;
};
}
private function mouseUpHandler(_arg1:MouseEvent):void{
_handleMouseRelease = true;
}
private function doubleClickHandler(_arg1:MouseEvent):void{
}
public function getKeyActionHeld(_arg1):Boolean{
var _local2:*;
_local2 = 0;
while (_local2 < _padData.length) {
if ((((_padData[_local2].keyAction == _arg1)) && (_padData[_local2].keyStillPressed))){
return (true);
};
_local2++;
};
return (false);
}
public function getMousePosX():Number{
return (_mouseData.mousePosX);
}
public function getMousePosY():Number{
return (_mouseData.mousePosY);
}
private function mouseOutHandler(_arg1:MouseEvent):void{
}
private function clickHandler(_arg1:MouseEvent):void{
}
public function resetListener():void{
keyStage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
keyStage.removeEventListener(KeyboardEvent.KEY_UP, keyReleased);
keyStage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
keyStage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
}
public function getMouseTimePressed():Number{
return (_mouseData.mouseTimePressed);
}
public function getPadData():Array{
return (_padData);
}
public function getKeyJustPressed(_arg1:Number){
return (_padData[_arg1].keyPressed);
}
public function getMouseJustPressed():Boolean{
return (_mouseData.mouseJustPressed);
}
public function getKeyStillPressed(_arg1:Number){
return (_padData[_arg1].keyStillPressed);
}
public function getCurrentKeyActionUp():String{
var _local1:*;
_local1 = 0;
while (_local1 < _padData.length) {
if (_padData[_local1].keyReleased){
return (_padData[_local1].keyAction);
};
_local1++;
};
return ("");
}
public function Init():void{
keyStage.addEventListener(MouseEvent.CLICK, clickHandler);
keyStage.addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler);
keyStage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
keyStage.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
keyStage.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
keyStage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
keyStage.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler);
keyStage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
keyStage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
}
private function mouseWheelHandler(_arg1:MouseEvent):void{
}
private function keyReleased(_arg1:KeyboardEvent):void{
delete _keysDown[_arg1.keyCode];
}
public function getCurrentKeyActionHeld():String{
var _local1:*;
_local1 = 0;
while (_local1 < _padData.length) {
if (_padData[_local1].keyStillPressed){
return (_padData[_local1].keyAction);
};
_local1++;
};
return ("");
}
private function keyPressed(_arg1:KeyboardEvent):void{
_keysDown[_arg1.keyCode] = true;
}
public function getMouseReleased():Boolean{
return (_mouseData.mouseReleased);
}
public function getTimeKeyActionHeld():Number{
var _local1:*;
_local1 = 0;
while (_local1 < _padData.length) {
if (_padData[_local1].keyStillPressed){
return (_padData[_local1].timePressed);
};
_local1++;
};
return (0);
}
public function getMousePressedPosX():Number{
return (_mouseData.mousePressedPosX);
}
public function getMousePressedPosY():Number{
return (_mouseData.mousePressedPosY);
}
private function mouseMoveHandler(_arg1:MouseEvent):void{
}
private function mouseDownHandler(_arg1:MouseEvent):void{
_handleMousePress = true;
}
public function getMouseStillPressed():Boolean{
return (_mouseData.mouseStillPressed);
}
private function isDown(_arg1:uint):Boolean{
return (Boolean(_keysDown[_arg1]));
}
public function getPadDataLength():Number{
return (_padData.length);
}
public function getCurrentKeyAction():String{
var _local1:*;
_local1 = 0;
while (_local1 < _padData.length) {
if (_padData[_local1].keyPressed){
return (_padData[_local1].keyAction);
};
_local1++;
};
return ("");
}
public function setKeyControls(_arg1:Array):void{
var _local2:Number;
_local2 = 0;
while (_local2 < _arg1.length) {
_padData.push({keyID:_arg1[_local2].keyID, keyAction:_arg1[_local2].keyAction, keyPressed:false, keyReleased:false, keyStillPressed:false, timePressed:0, doubleTapped:false});
_local2++;
};
}
public function deconstruct():void{
_keysDown = new Object();
_mouseData = new Object();
keyStage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
keyStage.removeEventListener(KeyboardEvent.KEY_UP, keyReleased);
keyStage.removeEventListener(MouseEvent.CLICK, clickHandler);
keyStage.removeEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler);
keyStage.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
keyStage.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
keyStage.removeEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
keyStage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
keyStage.removeEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler);
}
private function mouseOverHandler(_arg1:MouseEvent):void{
}
public function toString():String{
return ("PadManager()");
}
}
}//package Pad
Section 83
//GameTrack_AS3 (Tracker.GameTrack_AS3)
package Tracker {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class GameTrack_AS3 {
private var container:DisplayObjectContainer;
private var trkConnection:LocalConnection;
public function GameTrack_AS3(_arg1:DisplayObjectContainer){
container = _arg1;
trkConnection = new LocalConnection();
}
public function sendEventReplay(){
trackNewEvent("replay");
}
public function sendEventCustom(_arg1:String){
trackNewEvent(("cust_" + _arg1));
}
private function trackNewEvent(_arg1:String){
trkConnection.send("trkConnection", "sendTracking", _arg1);
}
public function sendEventWin(){
trackNewEvent("win");
}
private function trkLoadComplete(_arg1:Event):void{
trace(("completeHandler: " + _arg1));
}
public function sendEventLose(){
trackNewEvent("lose");
}
public function loadTracker():void{
var _local1:URLRequest;
var _local2:Loader;
_local1 = new URLRequest("tracker.swf");
_local2 = new Loader();
configureListeners(_local2.contentLoaderInfo);
trace(("loading tracker..." + _local1));
_local2.load(_local1);
container.addChild(_local2);
}
private function configureListeners(_arg1:IEventDispatcher):void{
_arg1.addEventListener(Event.COMPLETE, trkLoadComplete);
}
}
}//package Tracker
Section 84
//UIButton (UI.UIButton)
package UI {
import Base.*;
import flash.display.*;
public class UIButton extends SpriteEntity {
public var normFrame:int;// = 1
public var sfxUp:int;// = -1
public var animOutEnd:int;// = 1
public var animOverEnd:int;// = 2
public var sfxOver:int;// = -1
public var animGreyEnd:int;// = 1
public var animUpStart:int;// = 3
public var rollOn:Boolean;
public var animDownEnd:int;// = 3
public var sfxOut:int;// = -1
public var hasSound:Boolean;// = false
public var iName:String;// = ""
public var animGreyStart:int;// = 1
public var animUpEnd:int;// = 3
public var rollOff:Boolean;
public var sfxDown:int;// = -1
public var greyFrame:int;// = 4
public var animOverStart:int;// = 2
public var animDownStart:int;// = 3
public var downFrame:int;// = 3
public var animOutStart:int;// = 1
public var isAnimated:Boolean;// = false
public var overFrame:int;// = 2
public static const STATE_OUT:int = 1;
public static const STATE_UP:int = 4;
public static const STATE_OVER:int = 2;
public static const STATE_DOWN:int = 3;
public function UIButton(_arg1:GameEntry, _arg2:String, _arg3:DisplayObjectContainer, _arg4:int){
iName = "";
isAnimated = false;
hasSound = false;
normFrame = 1;
overFrame = 2;
downFrame = 3;
greyFrame = 4;
animOutStart = 1;
animOutEnd = 1;
animOverStart = 2;
animOverEnd = 2;
animDownStart = 3;
animDownEnd = 3;
animUpStart = 3;
animUpEnd = 3;
animGreyStart = 1;
animGreyEnd = 1;
sfxOut = -1;
sfxOver = -1;
sfxDown = -1;
sfxUp = -1;
super(_arg1, _arg2, _arg3);
iName = _arg2;
setSelectable(_arg4);
}
public function mouseRollOn():void{
rollOn = true;
rollOff = false;
}
public function mouseRollOff():void{
rollOn = false;
rollOff = true;
}
public function addButtonSounds(_arg1:int, _arg2:int):void{
hasSound = true;
switch (_arg1){
case STATE_OUT:
sfxOut = _arg2;
break;
case STATE_OVER:
sfxOver = _arg2;
break;
case STATE_DOWN:
sfxDown = _arg2;
break;
case STATE_UP:
sfxUp = _arg2;
break;
};
}
public function toString():String{
return (iName);
}
public function addButtonAnimation(_arg1:int, _arg2:int, _arg3:int):void{
isAnimated = true;
switch (_arg1){
case STATE_OUT:
animOutStart = _arg2;
animOutEnd = _arg3;
break;
case STATE_OVER:
animOverStart = _arg2;
animOverEnd = _arg3;
break;
case STATE_DOWN:
animDownStart = _arg2;
animDownEnd = _arg3;
break;
case STATE_UP:
animUpStart = _arg2;
animUpEnd = _arg3;
break;
};
}
}
}//package UI
Section 85
//UIManager (UI.UIManager)
package UI {
import Base.*;
import flash.display.*;
import Pad.*;
public class UIManager {
private var _screens:Array;
private var _screen:SpriteEntity;
private var bArray:Array;
private var _gameContext:GameEntry;
private var b:UIButton;
private var _padMgr:PadManager;
private var _uiReturnVal:int;
private var n:int;
public function UIManager(_arg1:GameEntry){
trace("|----@ UI MANAGER @----|");
_gameContext = _arg1;
_padMgr = _arg1.getPadManager();
_screen = null;
_screens = new Array();
n = 0;
b = null;
bArray = [];
}
public function addButton(_arg1:DisplayObjectContainer, _arg2:String, _arg3:int):UIButton{
var _local4:UIButton;
_local4 = new UIButton(_gameContext, _arg2, _arg1, _arg3);
bArray.push(_local4);
return (_local4);
}
public function showScreen(_arg1:String, _arg2:DisplayObjectContainer, _arg3:int=0, _arg4:int=0, _arg5:int=-1, _arg6:Boolean=true):SpriteEntity{
var _local7:SpriteEntity;
if (_arg6){
removeScreen();
_screen = new SpriteEntity(_gameContext, _arg1, _arg2, _arg3, _arg4, true, _arg5);
return (_screen);
};
_local7 = new SpriteEntity(_gameContext, _arg1, _arg2, _arg3, _arg4, true, _arg5);
_screens.push(_local7);
return (_local7);
}
public function getUIReturnVal():int{
return (_uiReturnVal);
}
public function getScreens():Array{
return (_screens);
}
public function removeScreen():void{
n = bArray.length;
while (n--) {
b = bArray[n];
b.removeSprite();
b = null;
};
bArray = [];
if (_screen != null){
_screen.removeSprite();
_screen = null;
};
}
public function Update():void{
_uiReturnVal = -1;
if (_screen != null){
n = bArray.length;
while (n--) {
b = bArray[n];
if (b == null){
} else {
if (b.isMouseOver()){
if (_padMgr.getMouseJustPressed()){
_uiReturnVal = b.getReturnVal();
};
};
if (b.isMouseRollOff()){
b.mouseRollOff();
b.startAnimating(b.animOutStart, b.animOutEnd);
if (b.sfxOut != -1){
_gameContext.getGameData().playSoundByEvent(b.sfxOut);
};
};
if (b.isMouseRollOn()){
b.mouseRollOn();
b.startAnimating(b.animOverStart, b.animOverEnd);
if (b.sfxOver != -1){
_gameContext.getGameData().playSoundByEvent(b.sfxOver);
};
};
if (b.isAnimating()){
b.animateSprite();
};
};
};
};
}
public function addScreen(_arg1:String, _arg2:DisplayObjectContainer, _arg3:int=0, _arg4:int=0, _arg5:int=-1, _arg6:Boolean=true):void{
}
public function promoteScreenToFocus():void{
}
public function getScreen():SpriteEntity{
return (_screen);
}
public function setUIReturnVal(_arg1:int):void{
_uiReturnVal = _arg1;
}
}
}//package UI
Section 86
//beat (beat)
package {
import flash.display.*;
public dynamic class beat extends MovieClip {
public function beat(){
addFrameScript(1, frame2, 3, frame4);
}
function frame4(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 87
//bonusHeroFallDown (bonusHeroFallDown)
package {
import flash.media.*;
public dynamic class bonusHeroFallDown extends Sound {
}
}//package
Section 88
//bonusHeroJump (bonusHeroJump)
package {
import flash.media.*;
public dynamic class bonusHeroJump extends Sound {
}
}//package
Section 89
//bonusHeroSlideLoop (bonusHeroSlideLoop)
package {
import flash.media.*;
public dynamic class bonusHeroSlideLoop extends Sound {
}
}//package
Section 90
//bonusScoreCalc (bonusScoreCalc)
package {
import flash.media.*;
public dynamic class bonusScoreCalc extends Sound {
}
}//package
Section 91
//bonusTimerBadClick (bonusTimerBadClick)
package {
import flash.media.*;
public dynamic class bonusTimerBadClick extends Sound {
}
}//package
Section 92
//bonusTimerGoodClick (bonusTimerGoodClick)
package {
import flash.media.*;
public dynamic class bonusTimerGoodClick extends Sound {
}
}//package
Section 93
//bonusTimerTick (bonusTimerTick)
package {
import flash.media.*;
public dynamic class bonusTimerTick extends Sound {
}
}//package
Section 94
//bonusWharfLoop (bonusWharfLoop)
package {
import flash.media.*;
public dynamic class bonusWharfLoop extends Sound {
}
}//package
Section 95
//btn_Reset (btn_Reset)
package {
import flash.display.*;
public dynamic class btn_Reset extends MovieClip {
}
}//package
Section 96
//btnLifePreserver (btnLifePreserver)
package {
import flash.media.*;
public dynamic class btnLifePreserver extends Sound {
}
}//package
Section 97
//btnPlayOver (btnPlayOver)
package {
import flash.media.*;
public dynamic class btnPlayOver extends Sound {
}
}//package
Section 98
//buttonScribbleOver (buttonScribbleOver)
package {
import flash.media.*;
public dynamic class buttonScribbleOver extends Sound {
}
}//package
Section 99
//coin_container (coin_container)
package {
import flash.display.*;
public dynamic class coin_container extends MovieClip {
}
}//package
Section 100
//endLevelSign (endLevelSign)
package {
import flash.display.*;
public dynamic class endLevelSign extends MovieClip {
}
}//package
Section 101
//flapjack_sprite2 (flapjack_sprite2)
package {
import flash.display.*;
public dynamic class flapjack_sprite2 extends MovieClip {
public var brush:MovieClip;
}
}//package
Section 102
//flyingShip (flyingShip)
package {
import flash.display.*;
public dynamic class flyingShip extends MovieClip {
}
}//package
Section 103
//gameHud (gameHud)
package {
import flash.display.*;
import flash.text.*;
public dynamic class gameHud extends MovieClip {
public var txtScore:TextField;
public var _collectMode:MovieClip;
public var btnMute:MovieClip;
public var _spendMode:MovieClip;
public var btnInstruct:MovieClip;
public var _spendModemc:MovieClip;
}
}//package
Section 104
//heroLandOnBrush (heroLandOnBrush)
package {
import flash.media.*;
public dynamic class heroLandOnBrush extends Sound {
}
}//package
Section 105
//heroLaunchToDock (heroLaunchToDock)
package {
import flash.media.*;
public dynamic class heroLaunchToDock extends Sound {
}
}//package
Section 106
//heroRecovered (heroRecovered)
package {
import flash.media.*;
public dynamic class heroRecovered extends Sound {
}
}//package
Section 107
//mainBlimpLoop (mainBlimpLoop)
package {
import flash.media.*;
public dynamic class mainBlimpLoop extends Sound {
}
}//package
Section 108
//mainBouyLoop (mainBouyLoop)
package {
import flash.media.*;
public dynamic class mainBouyLoop extends Sound {
}
}//package
Section 109
//mainBubbieCatch (mainBubbieCatch)
package {
import flash.media.*;
public dynamic class mainBubbieCatch extends Sound {
}
}//package
Section 110
//mainBubbiePwrShot (mainBubbiePwrShot)
package {
import flash.media.*;
public dynamic class mainBubbiePwrShot extends Sound {
}
}//package
Section 111
//mainBubbieShot (mainBubbieShot)
package {
import flash.media.*;
public dynamic class mainBubbieShot extends Sound {
}
}//package
Section 112
//mainBubbieSprint (mainBubbieSprint)
package {
import flash.media.*;
public dynamic class mainBubbieSprint extends Sound {
}
}//package
Section 113
//mainGullsLoop (mainGullsLoop)
package {
import flash.media.*;
public dynamic class mainGullsLoop extends Sound {
}
}//package
Section 114
//mainHeroCapture (mainHeroCapture)
package {
import flash.media.*;
public dynamic class mainHeroCapture extends Sound {
}
}//package
Section 115
//mainHeroCaptureRelease (mainHeroCaptureRelease)
package {
import flash.media.*;
public dynamic class mainHeroCaptureRelease extends Sound {
}
}//package
Section 116
//mainHeroCollectBigToken (mainHeroCollectBigToken)
package {
import flash.media.*;
public dynamic class mainHeroCollectBigToken extends Sound {
}
}//package
Section 117
//mainHeroCollectToken (mainHeroCollectToken)
package {
import flash.media.*;
public dynamic class mainHeroCollectToken extends Sound {
}
}//package
Section 118
//mainHeroCollideBarrel (mainHeroCollideBarrel)
package {
import flash.media.*;
public dynamic class mainHeroCollideBarrel extends Sound {
}
}//package
Section 119
//mainHeroCollideBlimp (mainHeroCollideBlimp)
package {
import flash.media.*;
public dynamic class mainHeroCollideBlimp extends Sound {
}
}//package
Section 120
//mainHeroCollideBubbie (mainHeroCollideBubbie)
package {
import flash.media.*;
public dynamic class mainHeroCollideBubbie extends Sound {
}
}//package
Section 121
//mainHeroCollideGull (mainHeroCollideGull)
package {
import flash.media.*;
public dynamic class mainHeroCollideGull extends Sound {
}
}//package
Section 122
//mainHeroCollideScreen (mainHeroCollideScreen)
package {
import flash.media.*;
public dynamic class mainHeroCollideScreen extends Sound {
}
}//package
Section 123
//mainHeroCollideWater (mainHeroCollideWater)
package {
import flash.media.*;
public dynamic class mainHeroCollideWater extends Sound {
}
}//package
Section 124
//mainHeroLostAtSea (mainHeroLostAtSea)
package {
import flash.media.*;
public dynamic class mainHeroLostAtSea extends Sound {
}
}//package
Section 125
//mainLevelEnd (mainLevelEnd)
package {
import flash.media.*;
public dynamic class mainLevelEnd extends Sound {
}
}//package
Section 126
//mainLevelStart (mainLevelStart)
package {
import flash.media.*;
public dynamic class mainLevelStart extends Sound {
}
}//package
Section 127
//mainMusicLoop (mainMusicLoop)
package {
import flash.media.*;
public dynamic class mainMusicLoop extends Sound {
}
}//package
Section 128
//mainOceanLoop (mainOceanLoop)
package {
import flash.media.*;
public dynamic class mainOceanLoop extends Sound {
}
}//package
Section 129
//mainTokenDespawn (mainTokenDespawn)
package {
import flash.media.*;
public dynamic class mainTokenDespawn extends Sound {
}
}//package
Section 130
//mainTokenSpawn (mainTokenSpawn)
package {
import flash.media.*;
public dynamic class mainTokenSpawn extends Sound {
}
}//package
Section 131
//needle (needle)
package {
import flash.display.*;
public dynamic class needle extends MovieClip {
}
}//package
Section 132
//pickupStar (pickupStar)
package {
import flash.display.*;
public dynamic class pickupStar extends MovieClip {
}
}//package
Section 133
//ScoreBox (ScoreBox)
package {
import flash.display.*;
public dynamic class ScoreBox extends MovieClip {
public var box:MovieClip;
public function ScoreBox(){
addFrameScript(30, frame31);
}
function frame31(){
gotoAndStop(1);
}
}
}//package
Section 134
//screenTransition (screenTransition)
package {
import flash.media.*;
public dynamic class screenTransition extends Sound {
}
}//package
Section 135
//scrn_BonusInstructions (scrn_BonusInstructions)
package {
import flash.display.*;
public dynamic class scrn_BonusInstructions extends MovieClip {
public var container:MovieClip;
}
}//package
Section 136
//scrn_End_Level (scrn_End_Level)
package {
import flash.display.*;
public dynamic class scrn_End_Level extends MovieClip {
public var _comp:MovieClip;
}
}//package
Section 137
//scrn_Instruct (scrn_Instruct)
package {
import flash.display.*;
public dynamic class scrn_Instruct extends MovieClip {
public var container:MovieClip;
public function scrn_Instruct(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 138
//scrn_MainStory (scrn_MainStory)
package {
import flash.display.*;
public dynamic class scrn_MainStory extends MovieClip {
public var container:MovieClip;
public function scrn_MainStory(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 139
//scrn_Over (scrn_Over)
package {
import flash.display.*;
public dynamic class scrn_Over extends MovieClip {
public var container:MovieClip;
}
}//package
Section 140
//scrn_TitleCard (scrn_TitleCard)
package {
import flash.display.*;
public dynamic class scrn_TitleCard extends MovieClip {
public var titleContainer:MovieClip;
}
}//package
Section 141
//sky (sky)
package {
import flash.display.*;
public dynamic class sky extends MovieClip {
}
}//package
Section 142
//spr_coin (spr_coin)
package {
import flash.display.*;
public dynamic class spr_coin extends MovieClip {
public function spr_coin(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 143
//spr_dock (spr_dock)
package {
import flash.display.*;
public dynamic class spr_dock extends MovieClip {
}
}//package
Section 144
//spr_dockFull (spr_dockFull)
package {
import flash.display.*;
public dynamic class spr_dockFull extends MovieClip {
}
}//package
Section 145
//spr_meterTarget (spr_meterTarget)
package {
import flash.display.*;
public dynamic class spr_meterTarget extends MovieClip {
public var _targetArea:MovieClip;
}
}//package
Section 146
//spr_splash (spr_splash)
package {
import flash.display.*;
public dynamic class spr_splash extends MovieClip {
}
}//package
Section 147
//sprite_bouy (sprite_bouy)
package {
import flash.display.*;
public dynamic class sprite_bouy extends MovieClip {
}
}//package
Section 148
//sprite_bubbie (sprite_bubbie)
package {
import flash.display.*;
public dynamic class sprite_bubbie extends MovieClip {
}
}//package
Section 149
//sprite_flapjack (sprite_flapjack)
package {
import flash.display.*;
public dynamic class sprite_flapjack extends MovieClip {
public function sprite_flapjack(){
addFrameScript(38, frame39);
}
function frame39(){
stop();
}
}
}//package
Section 150
//sprite_knuckels (sprite_knuckels)
package {
import flash.display.*;
public dynamic class sprite_knuckels extends MovieClip {
public function sprite_knuckels(){
addFrameScript(38, frame39);
}
function frame39(){
stop();
}
}
}//package
Section 151
//sprite_seagul (sprite_seagul)
package {
import flash.display.*;
public dynamic class sprite_seagul extends MovieClip {
}
}//package
Section 152
//userMessage (userMessage)
package {
import flash.display.*;
public dynamic class userMessage extends MovieClip {
public var _ready:MovieClip;
}
}//package
Section 153
//wave_1 (wave_1)
package {
import flash.display.*;
public dynamic class wave_1 extends MovieClip {
}
}//package
Section 154
//wave_2 (wave_2)
package {
import flash.display.*;
public dynamic class wave_2 extends MovieClip {
}
}//package
Section 155
//wave_3 (wave_3)
package {
import flash.display.*;
public dynamic class wave_3 extends MovieClip {
}
}//package