Section 1
//KongregateEvent (com.kongregate.as3.client.events.KongregateEvent)
package com.kongregate.as3.client.events {
import flash.events.*;
public class KongregateEvent extends Event {
public static const COMPLETE:String = "component_api_available";
public function KongregateEvent(_arg1:String){
super(_arg1);
}
}
}//package com.kongregate.as3.client.events
Section 2
//AbstractShadowService (com.kongregate.as3.client.services.AbstractShadowService)
package com.kongregate.as3.client.services {
import flash.events.*;
public class AbstractShadowService extends EventDispatcher {
protected function alert(_arg1:String, _arg2:String, _arg3="", _arg4:String=""):void{
trace(((((((("Kongregate API: " + _arg1) + ".") + _arg2) + "(") + _arg3) + ") ") + _arg4));
}
}
}//package com.kongregate.as3.client.services
Section 3
//HighScoreServiceShadow (com.kongregate.as3.client.services.HighScoreServiceShadow)
package com.kongregate.as3.client.services {
public class HighScoreServiceShadow extends AbstractShadowService implements IHighScoreServices {
private var mode:String;
public function HighScoreServiceShadow(){
mode = "";
}
public function submit(_arg1:Number, _arg2:String=null):void{
alert("IHighScoreServices", "submit", arguments);
}
public function connect():Boolean{
alert("IKongregateServices", "connect");
return (true);
}
public function requestList(_arg1:Function):void{
alert("IHighScoreServices", "requestList", "", (("[Mode: " + mode) + "]"));
_arg1({success:false});
}
public function setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
}
}//package com.kongregate.as3.client.services
Section 4
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function setMode(_arg1:String):void;
function submit(_arg1:Number, _arg2:String=null):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 5
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function getPlayerInfo(_arg1:Function):void;
function connect(_arg1:Number=-1):Boolean;
}
}//package com.kongregate.as3.client.services
Section 6
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function submitArray(_arg1:Array):void;
function submit(_arg1:String, _arg2:Number):void;
}
}//package com.kongregate.as3.client.services
Section 7
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 8
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function connect(_arg1:Number=-1):Boolean{
alert("IKongregateServices", "connect", arguments);
return (true);
}
public function getPlayerInfo(_arg1:Function):void{
alert("IKongregateServices", "getPlayerInfo");
_arg1(new Object());
}
}
}//package com.kongregate.as3.client.services
Section 9
//StatServiceShadow (com.kongregate.as3.client.services.StatServiceShadow)
package com.kongregate.as3.client.services {
public class StatServiceShadow extends AbstractShadowService implements IStatServices {
public function submitArray(_arg1:Array):void{
alert("IStatServices", "submitArray", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 10
//UserServiceShadow (com.kongregate.as3.client.services.UserServiceShadow)
package com.kongregate.as3.client.services {
public class UserServiceShadow extends AbstractShadowService implements IUserServices {
public function getName():String{
alert("UserService", "getName");
return ("Guest");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMode:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 11
//IAPIBootstrap (com.kongregate.as3.client.IAPIBootstrap)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
public interface IAPIBootstrap {
function init(_arg1:Event=null, _arg2:Stage=null):void;
function hideLog():void;
function showLog(_arg1:int=0):void;
}
}//package com.kongregate.as3.client
Section 12
//KongregateAPI (com.kongregate.as3.client.KongregateAPI)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
import com.kongregate.as3.client.services.*;
import com.kongregate.as3.client.events.*;
import flash.system.*;
import flash.errors.*;
import flash.net.*;
import flash.utils.*;
public class KongregateAPI extends Sprite {
private const VERSION:Number = 1;
private var loader:Loader;
private var loadedDomain:ApplicationDomain;
private static const CLASS_USER:String = "com.kongregate.as3.client.services.UserServices";
private static const CLASS_STATS:String = "com.kongregate.as3.client.services.StatServices";
private static const CLASS_SERVICES:String = "com.kongregate.as3.client.services.KongregateServices";
private static const CLASS_SCORES:String = "com.kongregate.as3.client.services.HighScoreServices";
private static const DEBUG_API_URL:String = "//Linuxpc/kongregate/public/flash/API_AS3.swf";
private static var _connected:Boolean;
private static var kUser:IUserServices;
private static var _loaded:Boolean;
private static var kServices:IKongregateServices;
private static var kScores:IHighScoreServices;
private static var mInstance:KongregateAPI;
private static var kStats:IStatServices;
private static var kAPI:IAPIBootstrap;
public function KongregateAPI(){
if (mInstance != null){
throw (new Error("Warning: KongregateAPI has been added to stage more than once or accessed improperly. Use getInstance() or a stage reference to access."));
};
mInstance = this;
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get loaded():Boolean{
return (_loaded);
}
public function get connected():Boolean{
return (_connected);
}
private function alertConnected(_arg1:TimerEvent=null):void{
var _local2:KongregateEvent;
var _local3:Boolean;
_local2 = new KongregateEvent(KongregateEvent.COMPLETE);
_local3 = this.dispatchEvent(_local2);
}
private function init(_arg1:Event):void{
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
_loaded = false;
_connected = false;
_local2 = LoaderInfo(root.loaderInfo).parameters;
_local3 = _local2.api_path;
if (_local3 == null){
trace("Alert: Kongregate API could not be loaded, due to local testing. API will load when the game is uploaded.");
createShadowServices();
return;
};
Security.allowDomain("*.kongregate.com");
Security.allowDomain("kongregatetrunk.com");
_local4 = new URLRequest(_local3);
_local5 = new LoaderContext(false);
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(_local4, _local5);
}
public function get api():IAPIBootstrap{
return (kAPI);
}
private function loadComplete(_arg1:Event):void{
getServices();
}
public function get scores():IHighScoreServices{
return (kScores);
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
throw (new IOError(("API file not found. " + _arg1)));
}
public function get services():IKongregateServices{
return (kServices);
}
public function get stats():IStatServices{
return (kStats);
}
private function createShadowServices():void{
var _local1:Timer;
trace(">>> Kongregate Shadow Services instantiated for local development..");
kServices = new KongregateServiceShadow();
kScores = new HighScoreServiceShadow();
kStats = new StatServiceShadow();
kUser = new UserServiceShadow();
_local1 = new Timer(200, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, alertConnected);
_local1.start();
_connected = true;
}
public function get user():IUserServices{
return (kUser);
}
private function getServices():void{
var _local1:ApplicationDomain;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = ApplicationDomain.currentDomain;
kAPI = IAPIBootstrap(loader.getChildAt(0));
this.addChild(loader);
_local2 = _local1.getDefinition(CLASS_SERVICES);
trace(_local2);
kServices = _local2.getInstance();
_local3 = _local1.getDefinition(CLASS_SCORES);
kScores = _local3.getInstance();
_local4 = _local1.getDefinition(CLASS_STATS);
kStats = _local4.getInstance();
_local5 = _local1.getDefinition(CLASS_USER);
kUser = _local5.getInstance();
kServices.connect(VERSION);
_loaded = true;
_connected = true;
alertConnected();
}
public static function getInstance():KongregateAPI{
if (!mInstance){
throw (new IllegalOperationError("You must add the Kongregate API component to the stage before attempting to access it."));
};
return (mInstance);
}
}
}//package com.kongregate.as3.client
Section 13
//playerType_3 (Grapnel_fla.playerType_3)
package Grapnel_fla {
import flash.display.*;
public dynamic class playerType_3 extends MovieClip {
public function playerType_3(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package Grapnel_fla
Section 14
//bonusDownType (bonusDownType)
package {
import flash.display.*;
import flash.text.*;
public dynamic class bonusDownType extends MovieClip {
public var line1:TextField;
public function bonusDownType(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
stage.removeChild(this);
}
}
}//package
Section 15
//bonusType (bonusType)
package {
import flash.display.*;
import flash.text.*;
public dynamic class bonusType extends MovieClip {
public var line1:TextField;
public function bonusType(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
stage.removeChild(this);
}
}
}//package
Section 16
//caveBackType (caveBackType)
package {
import flash.display.*;
public dynamic class caveBackType extends MovieClip {
}
}//package
Section 17
//coinSoundType (coinSoundType)
package {
import flash.media.*;
public dynamic class coinSoundType extends Sound {
}
}//package
Section 18
//coinType (coinType)
package {
import flash.display.*;
public dynamic class coinType extends MovieClip {
public function coinType(){
addFrameScript(0, frame1, 29, frame30);
}
function frame1(){
stop();
}
function frame30(){
stop();
}
}
}//package
Section 19
//dustType (dustType)
package {
import flash.display.*;
public dynamic class dustType extends MovieClip {
public function dustType(){
addFrameScript(10, frame11);
}
function frame11(){
stop();
stage.removeChild(this);
}
}
}//package
Section 20
//explosionSoundType (explosionSoundType)
package {
import flash.media.*;
public dynamic class explosionSoundType extends Sound {
}
}//package
Section 21
//explosionType (explosionType)
package {
import flash.display.*;
public dynamic class explosionType extends MovieClip {
public function explosionType(){
addFrameScript(11, frame12);
}
function frame12(){
stop();
stage.removeChild(this);
}
}
}//package
Section 22
//Grapnel (Grapnel)
package {
import flash.events.*;
import flash.display.*;
import com.kongregate.as3.client.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
public class Grapnel extends MovieClip {
public var maxHang:int;
public var coins:Array;
public var splatSound:splatSoundType;
public var restartButton:startButtonType;
public var deadDist:Number;
public var startButton:startButtonType;
public var ballCount:int;
public var gravity:Number;
public var speedFlag:Boolean;
public var i:int;
public var dead:Boolean;
public var mines:Array;
public var lastY:Number;
public var maxCombo:int;
public var wrapUp:wrapUpType;
public var lastX:Number;
public var mineCount:int;
public var score:Number;
public var deadHeight:int;
public var dusted:Boolean;
public var player:MovieClip;
public var back:caveBackType;
public var rope:MovieClip;
public var hookDX:Number;// = -1
public var coinCount:int;
public var hookDY:Number;// = -1
public var explosionSound:explosionSoundType;
public var speedCount:int;
public var coinSound:coinSoundType;
public var hookDraw:Boolean;// = false
public var barnCount:int;
public var windSoundChannel:SoundChannel;
public var tutButton:tutButtonType;
public var speedTimer:int;
public var deadTime:int;
public var frame:int;
public var mX:Number;
public var combo:int;
public var hookX:Number;// = -1
public var hookMove:Boolean;// = false
public var hookY:Number;// = -1
public var mY:Number;
public var maxHeight:int;
public var hangCount:int;
public var maxSpeedy:int;
public var scoreBox:TextField;
public var kongregate:KongregateAPI;
public var gapCount:int;
public var windSound:windSoundType;
public var hookLen:Number;// = -1
public var hangTimer:int;
public var closeCount:int;
public var topSpeed:Number;
public function Grapnel(){
hookX = -1;
hookY = -1;
hookDX = -1;
hookDY = -1;
hookLen = -1;
hookDraw = false;
hookMove = false;
mines = new Array();
coins = new Array();
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
kongregate = new KongregateAPI();
addChild(kongregate);
coinSound = new coinSoundType();
explosionSound = new explosionSoundType();
splatSound = new splatSoundType();
windSound = new windSoundType();
windSoundChannel = windSound.play(0, 100000, new SoundTransform(0));
stage.focus = this;
rope = new MovieClip();
addChildAt(rope, 0);
back = new caveBackType();
addChildAt(back, 0);
stage.addEventListener(MouseEvent.MOUSE_UP, onButtonUp);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onButtonDown);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
stage.addEventListener(Event.ENTER_FRAME, onFrame);
startButton.addEventListener(MouseEvent.MOUSE_DOWN, startButtonDown);
tutButton.addEventListener(MouseEvent.MOUSE_DOWN, tutButtonDown);
scoreBox = new TextField();
scoreBox.x = 8;
scoreBox.y = 8;
scoreBox.selectable = false;
scoreBox.defaultTextFormat = new TextFormat("Courier New", 16, 0xFFFFFF, true);
stage.addChild(scoreBox);
frame = -1;
gravity = ((250 / stage.frameRate) / stage.frameRate);
}
public function killPlayer():void{
player.gotoAndStop(2);
dead = true;
hookMove = false;
hookDraw = false;
kongregate.scores.submit(Math.floor(score));
kongregate.stats.submit("topSpeed", topSpeed);
kongregate.stats.submit("timeDead", deadTime);
kongregate.stats.submit("heightDead", deadHeight);
kongregate.stats.submit("distDead", deadDist);
kongregate.stats.submit("maxHeight", maxHeight);
kongregate.stats.submit("maxHangTime", maxHang);
kongregate.stats.submit("maxSprint", maxSpeedy);
}
public function incCombo():void{
combo = (combo + 1);
if (combo > maxCombo){
maxCombo = (maxCombo + 1);
kongregate.stats.submit("maxCombo", maxCombo);
};
}
public function createText(_arg1:String):void{
var _local2:bonusType;
_local2 = new bonusType();
_local2.line1.defaultTextFormat = new TextFormat("Courier New", 14, 0xAAAAAA, true);
_local2.line1.htmlText = (("<b>" + _arg1) + "</b>");
_local2.line1.selectable = false;
_local2.x = player.x;
_local2.y = player.y;
stage.addChild(_local2);
}
public function onMove(_arg1:MouseEvent):void{
mX = _arg1.stageX;
mY = _arg1.stageY;
}
public function onButtonDown(_arg1:MouseEvent):void{
var _local2:Number;
if (((!((frame == 2))) && (!((frame == 4))))){
return;
};
if (dead){
return;
};
hookX = player.x;
hookY = player.y;
hookDX = (_arg1.stageX - player.x);
hookDY = (_arg1.stageY - player.y);
_local2 = (0.01 * Math.sqrt(((hookDX * hookDX) + (hookDY * hookDY))));
hookDX = (hookDX / _local2);
hookDY = (hookDY / _local2);
hookDraw = true;
hookMove = true;
combo = 1;
}
function frame2(){
frame = 2;
reset();
stop();
}
function frame3(){
frame = 3;
restartButton.addEventListener(MouseEvent.MOUSE_DOWN, startButtonDown);
i = 0;
while (i < mines.length) {
if (mines[i] == null){
} else {
mines[i].play();
};
i++;
};
i = 0;
while (i < coins.length) {
if (coins[i] == null){
} else {
coins[i].play();
};
i++;
};
wrapUp.scoreLine.htmlText = (("<b>Score: " + formatScore()) + "</b>");
wrapUp.coinCountLine.htmlText = (("<b>Coins caught: " + coinCount) + "</b>");
wrapUp.closeCountLine.htmlText = (("<b>Close calls: " + closeCount) + "</b>");
wrapUp.gapCountLine.htmlText = (("<b>Gaps jumped: " + gapCount) + "</b>");
wrapUp.hangCountLine.htmlText = (("<b>Times hung: " + hangCount) + "</b>");
wrapUp.ballCountLine.htmlText = (("<b>Ballistics: " + ballCount) + "</b>");
wrapUp.speedCountLine.htmlText = (("<b>Speed runs: " + speedCount) + "</b>");
wrapUp.barnCountLine.htmlText = (("<b>Barns stormed: " + barnCount) + "</b>");
wrapUp.maxComboLine.htmlText = (("<b>Max combo: " + maxCombo) + "</b>");
wrapUp.maxHangLine.htmlText = (("<b>Max hang time: " + formatTime(maxHang)) + "</b>");
wrapUp.maxHeightLine.htmlText = (("<b>Max height: " + maxHeight) + "</b>");
wrapUp.maxSpeedyLine.htmlText = (("<b>Longest sprint: " + formatTime(maxSpeedy)) + "</b>");
wrapUp.deadTimeLine.htmlText = (("<b>Time spent dead: " + formatTime(deadTime)) + "</b>");
wrapUp.deadHeightLine.htmlText = (("<b>Corpse height: " + deadHeight) + "</b>");
wrapUp.mineCountLine.htmlText = (("<b>Mines hit: " + mineCount) + "</b>");
stop();
}
function frame4(){
frame = 4;
restartButton.addEventListener(MouseEvent.MOUSE_DOWN, startButtonDown);
reset();
stop();
}
public function onButtonUp(_arg1:MouseEvent):void{
if (((!((frame == 2))) && (!((frame == 4))))){
return;
};
hookMove = false;
hookDraw = false;
speedFlag = false;
combo = 1;
}
function frame1(){
scoreBox.text = "";
frame = 1;
stop();
}
public function createBonus(_arg1:String):void{
var _local2:bonusType;
if (player.y < 10){
createBonusDown(_arg1);
return;
};
_local2 = new bonusType();
_local2.line1.htmlText = (((("<b>" + _arg1) + "\nCOMBOx") + String(combo)) + "</b>");
_local2.line1.selectable = false;
_local2.x = player.x;
_local2.y = player.y;
stage.addChild(_local2);
}
public function createMine2(_arg1:int):void{
var _local2:mineType;
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = new mineType();
_local2.x = 600;
_local2.y = (Math.random() * 400);
stage.addChildAt(_local2, 1);
_local3 = 0;
while (_local3 < mines.length) {
if (_local3 == _arg1){
} else {
if (mines[_local3] == null){
} else {
_local4 = (mines[_local3].x - _local2.x);
_local5 = (mines[_local3].y - _local2.y);
_local6 = ((_local4 * _local4) + (_local5 * _local5));
if (_local6 > 22500){
} else {
_local2.gap[_local2.gap.length] = _local3;
};
};
};
_local3++;
};
mines[_arg1] = _local2;
}
public function onFrame(_arg1:Event):void{
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:Number;
var _local12:int;
var _local13:dustType;
if (((!((frame == 2))) && (!((frame == 4))))){
return;
};
rope.graphics.clear();
if (hookDraw){
rope.graphics.beginFill(0xEEEEEE);
rope.graphics.lineStyle(1, 0xEEEEEE, 1);
rope.graphics.moveTo(player.x, player.y);
rope.graphics.lineTo(hookX, hookY);
rope.graphics.endFill();
};
_local2 = (player.x - lastX);
_local3 = (player.y - lastY);
_local4 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
_local5 = (1 - Math.pow(0.9, _local4));
windSoundChannel.soundTransform = new SoundTransform(_local5);
if (((!(dead)) && (!((frame == 4))))){
if (_local4 > topSpeed){
topSpeed = _local4;
};
if (((hookDraw) && (!(hookMove)))){
hangTimer = 0;
if (_local2 < 0){
speedFlag = true;
};
} else {
hangTimer = (hangTimer + 1);
if (hangTimer > maxHang){
maxHang = hangTimer;
};
};
if (_local4 > 9){
speedTimer = (speedTimer + 1);
if (speedTimer > maxSpeedy){
maxSpeedy = speedTimer;
};
} else {
speedTimer = 0;
};
if ((((hangTimer > 0)) && (((hangTimer % stage.frameRate) == 0)))){
createBonus("HANG TIME");
hangCount = (hangCount + 1);
kongregate.stats.submit("hangTimeCount", hangCount);
kongregate.stats.submit("totalHangTimes", 1);
score = (score + (100 * combo));
incCombo();
};
if ((((((speedTimer > 0)) && (((speedTimer % stage.frameRate) == 0)))) && (!(speedFlag)))){
createBonus("SPEEDY");
speedCount = (speedCount + 1);
kongregate.stats.submit("speedyCount", speedCount);
kongregate.stats.submit("totalSpeedys", 1);
score = (score + (100 * combo));
incCombo();
};
if ((400 - player.y) > maxHeight){
maxHeight = (400 - player.y);
};
if (((((((hookMove) || (!(hookDraw)))) && ((player.y < -30)))) && ((Math.floor((player.y / -30)) > Math.floor((lastY / -30)))))){
createBonus("BALLISTIC");
ballCount = (ballCount + 1);
kongregate.stats.submit("ballisticCount", ballCount);
kongregate.stats.submit("totalBallistics", 1);
score = (score + (100 * combo));
incCombo();
};
} else {
if (!dusted){
deadTime = (deadTime + 1);
if ((400 - player.y) > deadHeight){
deadHeight = (400 - player.y);
};
};
};
_local6 = player.x;
_local7 = player.y;
player.x = (player.x + _local2);
player.y = ((player.y + _local3) + gravity);
lastX = _local6;
lastY = _local7;
if (hookMove){
if ((hookY + hookDY) < 0){
_local8 = (-(hookY) / hookDY);
hookY = 0;
hookX = (hookX + (hookDX * _local8));
hookMove = false;
_local2 = (player.x - hookX);
_local3 = (player.y - hookY);
hookLen = ((_local2 * _local2) + (_local3 * _local3));
} else {
hookX = (hookX + hookDX);
hookY = (hookY + hookDY);
};
} else {
if (hookDraw){
_local2 = (hookX - player.x);
_local3 = (hookY - player.y);
_local9 = ((_local2 * _local2) + (_local3 * _local3));
if (_local9 > hookLen){
_local9 = Math.sqrt(_local9);
_local10 = (_local9 - Math.sqrt(hookLen));
_local9 = (_local10 / _local9);
_local2 = (_local2 * _local9);
_local3 = (_local3 * _local9);
player.x = (player.x + _local2);
player.y = (player.y + _local3);
};
_local2 = (mX - player.x);
_local3 = (mY - player.y);
_local9 = (0.125 / Math.sqrt(((_local2 * _local2) + (_local3 * _local3))));
player.x = (player.x + (_local2 * _local9));
player.y = (player.y + (_local3 * _local9));
};
};
if (frame != 4){
_local11 = (player.x - 200);
if (_local11 > 0){
player.x = (player.x - _local11);
lastX = (lastX - _local11);
hookX = (hookX - _local11);
updateMines(_local11);
createMine(_local11);
if (!dead){
score = (score + _local11);
} else {
deadDist = (deadDist + _local11);
};
scoreBox.text = String(formatScore());
} else {
updateMines(0);
};
if (player.y > 400){
if (!dusted){
windSoundChannel.soundTransform = new SoundTransform(0);
splatSound.play();
_local12 = Math.floor((Math.random() * 5));
if (_local12 == 0){
createText("Ouch");
} else {
if (_local12 == 1){
createText("Oof");
} else {
if (_local12 == 2){
createText("Uhg");
} else {
if (_local12 == 3){
createText("...");
} else {
if (_local12 == 4){
createText("Arg");
};
};
};
};
};
_local13 = new dustType();
_local13.x = player.x;
_local13.y = player.y;
stage.addChild(_local13);
dusted = true;
};
lastX = player.x;
player.y = 400;
killPlayer();
gotoAndStop(3);
};
} else {
if (player.y > 400){
player.y = 395;
};
};
}
public function formatScore():String{
var _local1:int;
var _local2:int;
var _local3:String;
var _local4:int;
_local1 = Math.floor(score);
if (_local1 == 0){
_local2 = 1;
} else {
_local2 = Math.floor((Math.log(score) / Math.LN10));
};
_local3 = "";
_local4 = 0;
while (_local4 < (8 - _local2)) {
_local3 = (_local3 + "0");
_local4++;
};
_local3 = (_local3 + String(_local1));
return (_local3);
}
public function startButtonDown(_arg1:MouseEvent):void{
var _local2:Number;
gotoAndStop(2);
hookX = 200;
hookY = 100;
hookDX = (_arg1.stageX - 200);
hookDY = (_arg1.stageY - 100);
_local2 = (0.01 * Math.sqrt(((hookDX * hookDX) + (hookDY * hookDY))));
hookDX = (hookDX / _local2);
hookDY = (hookDY / _local2);
hookDraw = true;
hookMove = true;
combo = 1;
}
public function reset():void{
var _local1:int;
player.x = 200;
player.y = 100;
player.gotoAndStop(1);
lastX = player.x;
lastY = player.y;
score = 0;
dead = false;
dusted = false;
coinCount = 0;
gapCount = 0;
barnCount = 0;
closeCount = 0;
hangCount = 0;
speedCount = 0;
ballCount = 0;
maxCombo = 0;
maxHang = 0;
maxHeight = 0;
maxSpeedy = 0;
deadTime = 0;
deadHeight = 0;
deadDist = 0;
mineCount = 0;
topSpeed = 0;
combo = 1;
hangTimer = 0;
speedTimer = 0;
speedFlag = false;
scoreBox.text = formatScore();
_local1 = 0;
while (_local1 < mines.length) {
if (mines[_local1] == null){
} else {
stage.removeChild(mines[_local1]);
mines[_local1] = null;
};
_local1++;
};
mines = new Array();
_local1 = 0;
while (_local1 < coins.length) {
if (coins[_local1] == null){
} else {
stage.removeChild(coins[_local1]);
coins[_local1] = null;
};
_local1++;
};
coins = new Array();
windSoundChannel.stop();
windSoundChannel = windSound.play(0, 100000, new SoundTransform(0));
}
public function updateMines(_arg1:Number):void{
var _local2:int;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:explosionType;
var _local7:int;
var _local8:int;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local2 = 0;
for (;_local2 < mines.length;_local2++) {
if (mines[_local2] == null){
} else {
mines[_local2].x = (mines[_local2].x - _arg1);
if (mines[_local2].x < -50){
stage.removeChild(mines[_local2]);
mines[_local2] = null;
} else {
_local3 = (player.x - mines[_local2].x);
_local4 = (player.y - mines[_local2].y);
_local5 = ((_local3 * _local3) + (_local4 * _local4));
if (_local5 < 841){
explosionSound.play();
_local6 = new explosionType();
_local6.x = mines[_local2].x;
_local6.y = mines[_local2].y;
stage.addChild(_local6);
_local5 = (50 / Math.sqrt(_local5));
player.x = (player.x + (_local3 * _local5));
player.y = (player.y + (_local4 * _local5));
stage.removeChild(mines[_local2]);
mines[_local2] = null;
killPlayer();
mineCount = (mineCount + 1);
kongregate.stats.submit("minesHit", mineCount);
continue;
} else {
if (_local5 < 2401){
if (mines[_local2].near == 0){
mines[_local2].near = 1;
};
} else {
if ((((mines[_local2].near == 1)) && (!(dead)))){
mines[_local2].near = 2;
createBonus("CLOSE CALL");
score = (score + (100 * combo));
incCombo();
closeCount = (closeCount + 1);
kongregate.stats.submit("closeCallCount", closeCount);
kongregate.stats.submit("totalCloseCalls", 1);
};
};
};
if (!dead){
_local7 = 0;
for (;_local7 < mines[_local2].gap.length;_local7++) {
_local8 = mines[_local2].gap[_local7];
if (_local8 == -1){
} else {
if (mines[_local8] == null){
} else {
_local9 = (mines[_local8].x - mines[_local2].x);
_local10 = (mines[_local8].y - mines[_local2].y);
_local11 = (lastX - player.x);
_local12 = (mines[_local2].x - player.x);
_local13 = (lastY - player.y);
_local14 = (mines[_local2].y - player.y);
_local15 = ((_local13 * _local9) - (_local11 * _local10));
if (Math.abs(_local15) < 1E-12){
} else {
_local16 = ((_local11 * _local14) - (_local13 * _local12));
_local17 = ((_local9 * _local14) - (_local10 * _local12));
if (_local15 > 0){
if ((((_local16 < 0)) || ((_local16 > _local15)))){
continue;
};
if ((((_local17 < 0)) || ((_local17 > _local15)))){
continue;
};
} else {
if ((((_local16 < _local15)) || ((_local16 > 0)))){
continue;
};
if ((((_local17 < _local15)) || ((_local17 > 0)))){
continue;
};
};
mines[_local2].gap[_local7] = -1;
createBonus("GAP JUMP");
score = (score + (100 * combo));
incCombo();
gapCount = (gapCount + 1);
kongregate.stats.submit("gapJumpCount", gapCount);
kongregate.stats.submit("totalGapJumps", 1);
};
};
};
};
if (mines[_local2].barn){
} else {
if (mines[_local2].y < 250){
} else {
if (player.y < mines[_local2].y){
} else {
if (((player.x - mines[_local2].x) * (lastX - mines[_local2].x)) > 0){
} else {
mines[_local2].barn = true;
createBonus("BARN STORM");
score = (score + (100 * combo));
incCombo();
barnCount = (barnCount + 1);
kongregate.stats.submit("barnStormCount", barnCount);
kongregate.stats.submit("totalBarnStorms", 1);
};
};
};
};
};
};
};
};
_local2 = 0;
for (;_local2 < coins.length;_local2++) {
if (coins[_local2] == null){
} else {
coins[_local2].x = (coins[_local2].x - _arg1);
if (coins[_local2].x < -50){
stage.removeChild(coins[_local2]);
coins[_local2] = null;
} else {
if (!dead){
_local3 = (player.x - coins[_local2].x);
_local4 = (player.y - coins[_local2].y);
_local5 = ((_local3 * _local3) + (_local4 * _local4));
if (_local5 < 441){
coinSound.play();
createBonus("COIN");
score = (score + (100 * combo));
incCombo();
coinCount = (coinCount + 1);
kongregate.stats.submit("coinCount", coinCount);
kongregate.stats.submit("totalCoins", 1);
stage.removeChild(coins[_local2]);
coins[_local2] = null;
continue;
};
};
};
};
};
back.x = (back.x - (_arg1 * 0.25));
if (back.x < (550 - back.width)){
back.x = (back.x + (back.width - 550));
};
}
public function formatTime(_arg1:int):String{
var _local2:int;
var _local3:int;
var _local4:String;
_local2 = ((_arg1 * 1000) / stage.frameRate);
_local3 = (_local2 / 1000);
_local2 = (_local2 % 1000);
_local4 = (String(_local3) + ".");
_local4 = (_local4 + String(Math.floor((_local2 / 100))));
return (_local4);
}
public function tutButtonDown(_arg1:MouseEvent):void{
gotoAndStop(4);
}
public function createMine(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:Boolean;
var _local7:coinType;
_local2 = (1 - Math.pow(((39 + Math.exp((-6.5E-5 * score))) * 0.025), _arg1));
_local3 = (1 - Math.pow(0.999, _arg1));
_local2 = (1 - _local2);
_local3 = (_local2 - _local3);
_local4 = Math.random();
_local6 = false;
if (_local4 > _local2){
_local5 = 0;
while (_local5 < mines.length) {
if (mines[_local5] == null){
createMine2(_local5);
_local6 = true;
break;
};
_local5++;
};
if (!_local6){
createMine2(mines.length);
};
} else {
if (_local4 > _local3){
_local7 = new coinType();
_local7.x = 600;
_local7.y = (Math.random() * 400);
stage.addChildAt(_local7, 1);
_local5 = 0;
while (_local5 < coins.length) {
if (coins[_local5] == null){
coins[_local5] = _local7;
_local6 = true;
break;
};
_local5++;
};
if (!_local6){
coins[coins.length] = _local7;
};
};
};
}
public function createBonusDown(_arg1:String):void{
var _local2:bonusDownType;
_local2 = new bonusDownType();
_local2.line1.htmlText = (((("<b>" + _arg1) + "\nCOMBOx") + String(combo)) + "</b>");
_local2.line1.selectable = false;
_local2.x = player.x;
_local2.y = 0;
stage.addChild(_local2);
}
}
}//package
Section 23
//mineType (mineType)
package {
import flash.display.*;
public class mineType extends MovieClip {
var near:int;
var barn:Boolean;
var gap:Array;
public function mineType(){
addFrameScript(0, frame1, 29, frame30);
super();
near = 0;
gap = new Array();
barn = false;
}
function frame1(){
stop();
}
function frame30(){
stop();
}
}
}//package
Section 24
//splatSoundType (splatSoundType)
package {
import flash.media.*;
public dynamic class splatSoundType extends Sound {
}
}//package
Section 25
//startButtonType (startButtonType)
package {
import flash.display.*;
public dynamic class startButtonType extends SimpleButton {
}
}//package
Section 26
//tutButtonType (tutButtonType)
package {
import flash.display.*;
public dynamic class tutButtonType extends SimpleButton {
}
}//package
Section 27
//windSoundType (windSoundType)
package {
import flash.media.*;
public dynamic class windSoundType extends Sound {
}
}//package
Section 28
//wrapUpType (wrapUpType)
package {
import flash.display.*;
import flash.text.*;
public dynamic class wrapUpType extends MovieClip {
public var coinCountLine:TextField;
public var speedCountLine:TextField;
public var maxHangLine:TextField;
public var deadHeightLine:TextField;
public var maxHeightLine:TextField;
public var hangCountLine:TextField;
public var ballCountLine:TextField;
public var gapCountLine:TextField;
public var barnCountLine:TextField;
public var mineCountLine:TextField;
public var closeCountLine:TextField;
public var scoreLine:TextField;
public var maxComboLine:TextField;
public var maxSpeedyLine:TextField;
public var deadTimeLine:TextField;
}
}//package