Section 1
//GameEngine (com.plus64.core.GameEngine)
package com.plus64.core {
import com.plus64.model.*;
import flash.events.*;
import flash.display.*;
import com.plus64.gameState.*;
import flash.net.*;
import flash.utils.*;
public class GameEngine extends Sprite {
private var __singlePlayer:IState;
private var __assetStack:AssetStack;
private var __lastTime:Date;
private var __timer:Timer;
private var __currentState:IState;
private var __startScreen:IState;
private var __scoreScreen:IState;
private var __delta:Number;// = 0
public function GameEngine(){
__delta = 0;
__lastTime = new Date();
super();
init();
}
private function __onData(_arg1:LoadProgressEvent){
this.loadBar.scaleX = (_arg1.getPercent() / 100);
}
public function init(){
__assetStack = AssetStack.getInstance();
__assetStack.dispatcher.addEventListener(Event.COMPLETE, __start);
__assetStack.dispatcher.addEventListener("data", __onData);
this.__link.addEventListener(MouseEvent.MOUSE_DOWN, __mouseDownHandler);
Sprite(this.__link).buttonMode = true;
Sprite(this.__link).useHandCursor = true;
}
private function __mouseDownHandler(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.zombiepoop.com");
navigateToURL(_local2);
}
private function __start(_arg1:Event){
__startScreen = new StartScreen();
__singlePlayer = new SinglePlayer();
__scoreScreen = new HighScores();
__currentState = __startScreen;
addChild(__currentState);
addEventListener(Event.ENTER_FRAME, __update);
}
private function __update(_arg1:Event){
var _local2:Date;
_local2 = new Date();
if (__lastTime){
__delta = ((_local2.getTime() / 1000) - (__lastTime.getTime() / 1000));
};
__lastTime = _local2;
__currentState.run(__delta);
}
public function switchState(_arg1:String):void{
removeChild(__currentState);
switch (_arg1){
case "start":
__currentState = __startScreen;
break;
case "singlePlayer":
if (__singlePlayer){
__singlePlayer = null;
};
__singlePlayer = new SinglePlayer();
__currentState = __singlePlayer;
break;
case "high":
__currentState = __scoreScreen;
break;
};
addChild(__currentState);
}
}
}//package com.plus64.core
Section 2
//HighScores (com.plus64.gameState.HighScores)
package com.plus64.gameState {
import com.plus64.model.*;
import flash.events.*;
import flash.display.*;
import com.plus64.sceneGraph.*;
import flash.net.*;
import mochi.*;
import com.plus64.core.*;
public class HighScores extends Sprite implements IState {
private var responder:Responder;
private var pressed:Boolean;// = false
private var __BASENODE:INode;
private var gateway:String;// = "http://www.zombiepoop.com/amfphp/gateway.php"
private var connection:NetConnection;
public function HighScores(){
var _local1:Class;
pressed = false;
gateway = "http://www.zombiepoop.com/amfphp/gateway.php";
super();
_local1 = AssetStack.getInstance().getClass("scores");
__BASENODE = new (_local1);
MovieClip(__BASENODE).addEventListener("stateChange", __stateChangeHandler);
addChild(__BASENODE);
addEventListener(Event.ADDED_TO_STAGE, __updateScore);
responder = new Responder(onResult, onFault);
connection = new NetConnection();
connection.connect(gateway);
connection.addEventListener(NetStatusEvent.NET_STATUS, netHandler);
connection.addEventListener("connected", refreshHighScoreList, false, 0, true);
_local1(__BASENODE).submitScore.addEventListener(MouseEvent.MOUSE_DOWN, mouseListener);
}
private function __stateChangeHandler(_arg1:Event){
GameEngine(parent).switchState("start");
}
public function sendData(_arg1:MouseEvent):void{
var _local2:*;
Scores(__BASENODE).outputMessage("Sending Data to AMFPHP\n");
_local2 = "ass";
}
private function __updateScore(_arg1:Event){
Scores(__BASENODE).setScore();
pressed = false;
refreshHighScoreList();
}
private function mochiError(_arg1:Object){
}
private function onFault(_arg1:Object):void{
}
private function mouseListener(_arg1:MouseEvent){
var _local2:Object;
if (!pressed){
pressed = true;
_local2 = new Object();
_local2.name = Scores(__BASENODE).name_input.text;
_local2.email = Scores(__BASENODE).email_input.text;
_local2.score = Scores(__BASENODE).getScore();
connection.call("Scores.SubmitScores", responder, _local2.name, _local2.email, _local2.score);
MochiServices.connect("db041235b116d8d7", __BASENODE, mochiError);
MochiScores.setBoardID("8dfce4b9eb0758b5");
MochiScores.submit(_local2.score, _local2.name, this, mochiSuccess);
Scores(__BASENODE).name_input.text = "";
Scores(__BASENODE).email_input.text = "";
};
}
public function run(_arg1:Number):void{
__BASENODE.update(_arg1, new Object());
__BASENODE.render(_arg1);
}
private function refreshHighScoreList():void{
var _local1:*;
_local1 = "ass";
connection.call("Scores.GetScores", responder, _local1);
}
private function mochiSuccess(_arg1:Object){
}
private function onResult(_arg1:Object):void{
var _local2:Number;
var _local3:Object;
if (_arg1 != null){
Scores(__BASENODE).high_name.text = "";
Scores(__BASENODE).high_score.text = "";
_local2 = 0;
while (_local2 < _arg1.length) {
_local3 = _arg1[_local2];
Scores(__BASENODE).high_name.text = (Scores(__BASENODE).high_name.text + (_local3.name + "\n"));
Scores(__BASENODE).high_score.text = (Scores(__BASENODE).high_score.text + (_local3.score + "\n"));
_local2++;
};
} else {
refreshHighScoreList();
};
}
private function netHandler(_arg1:NetStatusEvent):void{
}
}
}//package com.plus64.gameState
Section 3
//IState (com.plus64.gameState.IState)
package com.plus64.gameState {
public interface IState {
function run(_arg1:Number):void;
}
}//package com.plus64.gameState
Section 4
//SinglePlayer (com.plus64.gameState.SinglePlayer)
package com.plus64.gameState {
import flash.events.*;
import flash.display.*;
import com.plus64.sceneGraph.*;
import com.plus64.core.*;
public class SinglePlayer extends Sprite implements IState {
private var __BASENODE:INode;
public function SinglePlayer(){
__BASENODE = new ZombiePoo();
MovieClip(__BASENODE).addEventListener("stateChange", __stateChangeHandler);
addChild(__BASENODE);
}
private function __stateChangeHandler(_arg1:Event){
GameEngine(parent).switchState("high");
}
public function run(_arg1:Number):void{
__BASENODE.update(_arg1, new Object());
__BASENODE.render(_arg1);
}
}
}//package com.plus64.gameState
Section 5
//StartScreen (com.plus64.gameState.StartScreen)
package com.plus64.gameState {
import com.plus64.model.*;
import flash.events.*;
import flash.display.*;
import com.plus64.sceneGraph.*;
import flash.net.*;
import com.plus64.core.*;
public class StartScreen extends Sprite implements IState {
private var responder:Responder;
private var __BASENODE:INode;
private var gateway:String;// = "http://www.zombiepoop.com/amfphp/gateway.php"
private var connection:NetConnection;
public function StartScreen(){
var _local1:Class;
gateway = "http://www.zombiepoop.com/amfphp/gateway.php";
super();
_local1 = AssetStack.getInstance().getClass("intro");
__BASENODE = new (_local1);
MovieClip(__BASENODE).addEventListener("stateChange", __stateChangeHandler);
addChild(__BASENODE);
connection = new NetConnection();
connection.connect(gateway);
responder = new Responder(onResult, onFault);
connection.call("Track.GetCounter", responder);
}
private function __stateChangeHandler(_arg1:Event){
GameEngine(parent).switchState("singlePlayer");
connection.call("Track.AddCounter", responder);
}
private function onFault(_arg1:Object):void{
}
public function run(_arg1:Number):void{
__BASENODE.update(_arg1, new Object());
__BASENODE.render(_arg1);
}
private function onResult(_arg1:Object):void{
if (_arg1 != null){
Intro(__BASENODE).updateCounter(_arg1);
};
}
}
}//package com.plus64.gameState
Section 6
//AssetStack (com.plus64.model.AssetStack)
package com.plus64.model {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
import flash.errors.*;
public class AssetStack {
private var __URLLoader:URLLoader;
private var __loadQueue:Array;
private var __dispatcher:EventDispatcher;
private var advertisingURL:String;
private var __loader:Loader;
private var __adloader:Loader;
private static var __instance:AssetStack;
public function AssetStack(_arg1:Function=null):void{
var _local2:URLRequest;
super();
if (_arg1 != AssetStack.getInstance){
throw (new Error("Good one tit burger your trying to construct a singleton"));
};
if (AssetStack.__instance != null){
throw (new Error("Already instanced fuck hole"));
};
__loader = new Loader();
__loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadAssets);
__loader.contentLoaderInfo.addEventListener("progress", __updateProgress);
__adloader = new Loader();
__adloader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadAssets);
__loadQueue = new Array();
__dispatcher = new EventDispatcher();
_local2 = new URLRequest("http://www.zombiepoop.com/assets/AssetLibrary.xml");
__URLLoader = new URLLoader();
__URLLoader.addEventListener(Event.COMPLETE, onConfigurationLoad);
__URLLoader.load(_local2);
}
public function getAdContent():DisplayObject{
return ((__adloader.contentLoaderInfo.content as DisplayObject));
}
private function __updateProgress(_arg1:Event){
var _local2:Number;
_local2 = ((__loader.contentLoaderInfo.bytesLoaded / __loader.contentLoaderInfo.bytesTotal) * 100);
__dispatcher.dispatchEvent(new LoadProgressEvent("data", _local2));
}
private function loadAssets(_arg1:Event){
var _local2:Object;
var _local3:URLRequest;
var _local4:LoaderContext;
_local2 = __loadQueue.shift();
if (_local2 != null){
_local3 = new URLRequest(_local2.URI);
_local4 = new LoaderContext();
_local4.applicationDomain = ApplicationDomain.currentDomain;
_local4.securityDomain = SecurityDomain.currentDomain;
__loader.load(_local3, _local4);
} else {
__dispatcher.dispatchEvent(new Event(Event.COMPLETE));
};
}
public function getClass(_arg1:String):Class{
var className = _arg1;
try {
return ((__loader.contentLoaderInfo.applicationDomain.getDefinition(className) as Class));
} catch(e:Error) {
throw (new IllegalOperationError((className + " definition not found")));
};
return (null);
}
public function get dispatcher():EventDispatcher{
return (__dispatcher);
}
private function onConfigurationLoad(_arg1:Event){
var _local2:XML;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
_local2 = new XML(__URLLoader.data);
_local3 = _local2.advertisingImage[0][0];
advertisingURL = _local2.advertisingURL[0][0];
_local4 = new URLRequest(_local3);
__adloader.load(_local4, _local5);
_local5 = new LoaderContext();
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
__loadQueue.push({URI:"http://www.zombiepoop.com/assets/ZombiePoo/lib.swf"});
}
public static function getInstance():AssetStack{
if (AssetStack.__instance == null){
AssetStack.__instance = new AssetStack(arguments.callee);
};
return (AssetStack.__instance);
}
}
}//package com.plus64.model
Section 7
//GameplayManager (com.plus64.model.GameplayManager)
package com.plus64.model {
import flash.events.*;
import flash.display.*;
import com.plus64.sceneGraph.*;
public class GameplayManager extends EventDispatcher {
private var ShitStack:Array;
private var __gimpX:Number;
private var BulletStack:Array;
private var __cart:INode;
public var score:Number;// = 0
private var ShitExplosion:Class;
private var Bullet:Class;
private var Gimp:Class;
private var Zombie1:Class;
private var Zombie2:Class;
private var Zombie3:Class;
private var Zombie4:Class;
public var gimpTouchingZombie:Boolean;// = false
private var AssplodedZombie1:Class;
private var AssplodedZombie2:Class;
private var AssplodedZombie3:Class;
private var AssplodedZombie4:Class;
private var __invalidatedGimp:Boolean;// = false
public var isMashing:Boolean;// = false
private var __cartX:Number;
private var Shit:Class;
private var __gimp:INode;
private var ZombieStack:Array;
private var Cart:Class;
private var __cartDirection:Number;// = 1
private var __invalidatedCart:Boolean;// = false
private var AssplodedZombieStack:Array;
private var __canMash:Boolean;// = false
private static var __instance:GameplayManager;
public function GameplayManager(_arg1:Function=null):void{
ZombieStack = new Array();
AssplodedZombieStack = new Array();
ShitStack = new Array();
BulletStack = new Array();
__invalidatedCart = false;
__invalidatedGimp = false;
__canMash = false;
gimpTouchingZombie = false;
isMashing = false;
score = 0;
__cartDirection = 1;
super();
if (_arg1 != GameplayManager.getInstance){
throw (new Error("Good one tit burger your trying to construct a singleton"));
};
if (GameplayManager.__instance != null){
throw (new Error("Already instanced fuck hole"));
};
Zombie1 = AssetStack.getInstance().getClass("zombie1");
Zombie2 = AssetStack.getInstance().getClass("zombie2");
Zombie3 = AssetStack.getInstance().getClass("zombie3");
Zombie4 = AssetStack.getInstance().getClass("zombie4");
AssplodedZombie1 = AssetStack.getInstance().getClass("assplodedZombie1");
AssplodedZombie2 = AssetStack.getInstance().getClass("assplodedZombie2");
AssplodedZombie3 = AssetStack.getInstance().getClass("assplodedZombie3");
AssplodedZombie4 = AssetStack.getInstance().getClass("assplodedZombie4");
Bullet = AssetStack.getInstance().getClass("bullet");
Shit = AssetStack.getInstance().getClass("shit");
ShitExplosion = AssetStack.getInstance().getClass("type1TurdExplosion");
Cart = AssetStack.getInstance().getClass("cart");
Gimp = AssetStack.getInstance().getClass("gimp");
}
public function getCartDirection():Number{
return (__cartDirection);
}
public function addBullet():Object{
var _local1:INode;
_local1 = INode(new Bullet());
BulletStack.push(_local1);
dispatchEvent(new NodeEvent("addBullet", _local1));
return (_local1);
}
public function addZombieShit():Object{
var _local1:INode;
_local1 = INode(new Shit());
ShitStack.push(_local1);
return (_local1);
}
public function set invalidatedCart(_arg1:Boolean){
var _local2:INode;
var _local3:INode;
__invalidatedCart = _arg1;
for each (_local2 in AssplodedZombieStack) {
AssplodedZombie(_local2).changeTarget("gimp");
};
for each (_local3 in ZombieStack) {
Zombie(_local3).setGoalX(__gimpX, true);
};
}
public function addAssplodedZombie(_arg1:Number):Object{
var _local2:INode;
_local2 = INode(new (this[("AssplodedZombie" + _arg1)]));
AssplodedZombieStack.push(_local2);
return (_local2);
}
public function getTarget():String{
if (__invalidatedGimp){
return ("cart");
};
if (__invalidatedCart){
return ("gimp");
};
return (null);
}
public function addZombie():Object{
var _local1:Number;
var _local2:INode;
var _local3:Number;
_local1 = (Math.floor((Math.random() * (5 - 1))) + 1);
_local2 = INode(new (this[("Zombie" + _local1)]));
Zombie(_local2).setType(_local1);
ZombieStack.push(_local2);
_local3 = Math.random();
Zombie(_local2).setDirection(((_local3)<0.5) ? 1 : -1);
if (__invalidatedCart){
Zombie(_local2).setGoalX(__gimpX);
} else {
Zombie(_local2).setGoalX(__cartX);
};
DisplayObject(_local2).y = 85;
return (_local2);
}
public function checkCollisions():void{
var _local1:Number;
var _local2:INode;
var _local3:Number;
var _local4:INode;
var _local5:INode;
var _local6:Number;
var _local7:INode;
var _local8:Number;
var _local9:INode;
_local1 = 0;
for each (_local2 in BulletStack) {
_local6 = 0;
for each (_local7 in ZombieStack) {
if (DisplayObject(_local2).hitTestObject(DisplayObject(_local7))){
Zombie(_local7).destroy();
ZombieStack.splice(_local6, 1);
_local2.destroy();
BulletStack.splice(_local1, 1);
break;
};
_local6++;
};
_local1++;
};
_local3 = 0;
for each (_local4 in ShitStack) {
if (!__invalidatedCart){
if (DisplayObject(Cart(__cart).cartHitArea).hitTestObject(DisplayObject(_local4))){
Shit(_local4).setSuccess(true);
Shit(_local4).shitVictim = "cart";
_local4.destroy();
};
};
if (!__invalidatedGimp){
if (DisplayObject(Gimp(__gimp).gimpHitArea).hitTestObject(DisplayObject(_local4))){
Shit(_local4).setSuccess(true);
Shit(_local4).shitVictim = "gimp";
_local4.destroy();
};
};
if (DisplayObject(_local4).y > 430){
_local4.destroy();
};
_local3++;
};
if (isMashing){
_local8 = 0;
gimpTouchingZombie = false;
for each (_local9 in AssplodedZombieStack) {
if (DisplayObject(_local9).hitTestObject(DisplayObject(__gimp))){
gimpTouchingZombie = true;
_local9.destroy();
AssplodedZombieStack.splice(_local8, 1);
_local8--;
isMashing = false;
break;
};
_local8++;
};
};
for each (_local5 in AssplodedZombieStack) {
if (_local5 != null){
if (DisplayObject(_local5).hitTestObject(DisplayObject(Gimp(__gimp).gimpHitArea))){
__canMash = true;
} else {
__canMash = false;
};
if (((((!((AssplodedZombie(_local5).zombieMC.zombieHitArea == null))) && (!((DisplayObject(Cart(__cart).cartHitArea) == null))))) && (!((DisplayObject(Gimp(__gimp).gimpHitArea) == null))))){
if (!__invalidatedCart){
if (DisplayObject(AssplodedZombie(_local5).zombieMC.zombieHitArea).hitTestObject(DisplayObject(Cart(__cart).cartHitArea))){
AssplodedZombie(_local5).setEating(true, "cart");
} else {
AssplodedZombie(_local5).setEating(false, null);
};
} else {
if (!__invalidatedGimp){
if (DisplayObject(AssplodedZombie(_local5).zombieMC.zombieHitArea).hitTestObject(DisplayObject(Gimp(__gimp).gimpHitArea))){
AssplodedZombie(_local5).setEating(true, "gimp");
} else {
AssplodedZombie(_local5).setEating(false, null);
};
} else {
AssplodedZombie(_local5).setEating(false, null);
};
};
};
};
};
}
public function updateGimpPosition(_arg1:Number){
var _local2:INode;
__gimpX = _arg1;
for each (_local2 in ZombieStack) {
if (__invalidatedCart){
Zombie(_local2).setGoalX(__gimpX);
};
};
}
public function addGimp():Object{
__gimp = INode(new Gimp());
return (__gimp);
}
public function getGimpPosition():Number{
return (__gimpX);
}
public function destroy():void{
var _local1:INode;
var _local2:INode;
var _local3:INode;
var _local4:INode;
gimpTouchingZombie = false;
isMashing = false;
score = 0;
__invalidatedCart = false;
__invalidatedGimp = false;
__cartDirection = 1;
for each (_local1 in ZombieStack) {
if (_local1 != null){
_local1.destroy();
};
};
ZombieStack = new Array();
for each (_local2 in AssplodedZombieStack) {
if (_local2 != null){
_local2.destroy();
};
};
AssplodedZombieStack = new Array();
for each (_local3 in ShitStack) {
if (_local3 != null){
_local3.destroy();
};
};
ShitStack = new Array();
for each (_local4 in BulletStack) {
if (_local4 != null){
_local4.destroy();
};
};
BulletStack = new Array();
}
public function addCart():Object{
__cart = INode(new Cart());
return (__cart);
}
public function set invalidatedGimp(_arg1:Boolean){
var _local2:INode;
var _local3:INode;
__invalidatedGimp = _arg1;
for each (_local2 in AssplodedZombieStack) {
AssplodedZombie(_local2).changeTarget("cart");
};
for each (_local3 in ZombieStack) {
Zombie(_local3).setGoalX(__cartX, true);
};
}
public function getCartPosition():Number{
if (__invalidatedCart){
return (__gimpX);
};
return (__cartX);
}
public function popZombieFromStack():Zombie{
var _local1:Zombie;
_local1 = ZombieStack.pop();
return (_local1);
}
public function canMash():Boolean{
var _local1:INode;
for each (_local1 in AssplodedZombieStack) {
if (DisplayObject(_local1).hitTestObject(DisplayObject(Gimp(__gimp).gimpHitArea))){
return (true);
};
};
return (false);
}
public function updateCartPosition(_arg1:Number){
var _local2:INode;
__cartX = _arg1;
for each (_local2 in ZombieStack) {
if (__invalidatedCart){
Zombie(_local2).setGoalX(__gimpX);
} else {
Zombie(_local2).setGoalX(_arg1);
};
};
}
public function setCartDirection(_arg1:Number):void{
__cartDirection = _arg1;
}
public static function getInstance():GameplayManager{
if (GameplayManager.__instance == null){
GameplayManager.__instance = new GameplayManager(arguments.callee);
};
return (GameplayManager.__instance);
}
}
}//package com.plus64.model
Section 8
//LoadProgressEvent (com.plus64.model.LoadProgressEvent)
package com.plus64.model {
import flash.events.*;
public class LoadProgressEvent extends Event {
private var __percent:Number;
public function LoadProgressEvent(_arg1:String, _arg2:Number, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
__percent = _arg2;
}
public function getPercent():Number{
return (__percent);
}
}
}//package com.plus64.model
Section 9
//BudgetPhysicsEngine (com.plus64.physics.BudgetPhysicsEngine)
package com.plus64.physics {
import flash.geom.*;
public class BudgetPhysicsEngine {
public const RESTITUTION:Number = 0.6;
public const FLOOR:Number = 440;
public const GRAVITY:Number = 0.1;
public const FRICTION:Number = 0.09;
public const DAMPNER:Number = 1;
private static var __instance:BudgetPhysicsEngine;
public function BudgetPhysicsEngine(_arg1:Function=null):void{
if (_arg1 != BudgetPhysicsEngine.getInstance){
throw (new Error("Good one tit burger your trying to construct a singleton"));
};
if (BudgetPhysicsEngine.__instance != null){
throw (new Error("Already instanced fuck hole"));
};
}
public function applyGravity(_arg1:Point, _arg2:Point, _arg3:Number, _arg4:Number, _arg5:Number=0.6, _arg6:Number=440){
if (Math.abs((_arg2.y - (_arg6 - _arg3))) > 5){
_arg1.y = (_arg1.y + (GRAVITY / _arg4));
};
if (_arg2.y > (_arg6 - _arg3)){
_arg2.y = (_arg6 - _arg3);
_arg1.y = (_arg1.y * -(_arg5));
_arg1.y = (_arg1.y + DAMPNER);
};
}
public function applyFriction(_arg1:Number):Number{
if (_arg1 > 0){
_arg1 = (_arg1 - FRICTION);
} else {
_arg1 = 0;
};
return (_arg1);
}
public static function getInstance():BudgetPhysicsEngine{
if (BudgetPhysicsEngine.__instance == null){
BudgetPhysicsEngine.__instance = new BudgetPhysicsEngine(arguments.callee);
};
return (BudgetPhysicsEngine.__instance);
}
}
}//package com.plus64.physics
Section 10
//AbstractNode (com.plus64.sceneGraph.AbstractNode)
package com.plus64.sceneGraph {
import flash.display.*;
import com.plus64.sceneGraph.*;
class AbstractNode extends MovieClip implements INode {
public function destroy():void{
}
public function render(_arg1:Number):void{
var _local2:Number;
var _local3:INode;
_local2 = 1;
while (_local2 < numChildren) {
if ((getChildAt(_local2) is INode)){
_local3 = (getChildAt(_local2) as INode);
_local3.render(_arg1);
};
_local2++;
};
}
public function update(_arg1:Number, _arg2:Object):void{
var _local3:Number;
var _local4:INode;
_local3 = 1;
while (_local3 < numChildren) {
if ((getChildAt(_local3) is INode)){
_local4 = (getChildAt(_local3) as INode);
_local4.update(_arg1, _arg2);
};
_local3++;
};
}
}
}//package com.plus64.sceneGraph
Section 11
//AssplodedZombie (com.plus64.sceneGraph.AssplodedZombie)
package com.plus64.sceneGraph {
import com.plus64.model.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class AssplodedZombie extends AbstractNode {
private const WANDERFACTOR:Number = 20;
private const MAXVEL:Number = 10;
private const MAXROTATIONALVEL:Number = 10;
private var __isEating:Boolean;// = false
private var __magnitude:Number;// = 100
private var RVelocity:Number;
private var __enabled:Boolean;// = true
public var victim:String;// = "cart"
private var __direction:Number;
private var timedEat:Boolean;// = false
private var location:Point;
private var __goalX:Number;
private var __newGoalX:Number;
private var __gameplayManager:GameplayManager;
private var __ready:Boolean;// = false
private var velocity:Point;
private var rate:Number;// = 2
public function AssplodedZombie(){
rate = 2;
location = new Point(0, 0);
velocity = new Point(0, 0);
RVelocity = genRandInRange(1, MAXROTATIONALVEL);
__magnitude = 100;
__ready = false;
__isEating = false;
victim = "cart";
timedEat = false;
__enabled = true;
super();
addEventListener(Event.ADDED_TO_STAGE, __init);
}
override public function destroy():void{
__enabled = false;
dispatchEvent(new Event("destroy"));
removeEventListener("init", __onReady);
removeEventListener(Event.ADDED_TO_STAGE, __init);
}
private function __init(_arg1:Event){
var _local2:String;
addEventListener("init", __onReady);
location = new Point(x, y);
__gameplayManager = GameplayManager.getInstance();
_local2 = __gameplayManager.getTarget();
if (_local2 != null){
victim = _local2;
};
}
private function __onReady(_arg1:Event){
__ready = true;
}
public function setDirection(_arg1:Number){
if (_arg1 > 0){
scaleX = -1;
} else {
scaleX = 1;
};
__direction = _arg1;
velocity.x = (velocity.x * _arg1);
}
public function changeTarget(_arg1:String){
__isEating = false;
MovieClip(this.zombieMC).gotoAndPlay("crawlStart");
victim = _arg1;
if (victim == "cart"){
__goalX = __gameplayManager.getCartPosition();
};
if (victim == "gimp"){
__goalX = __gameplayManager.getGimpPosition();
};
}
override public function render(_arg1:Number):void{
x = location.x;
y = location.y;
super.render(_arg1);
}
public function setEating(_arg1:Boolean, _arg2:String){
if (_arg1 != __isEating){
if (_arg1){
this.zombieMC.gotoAndPlay(60);
} else {
this.zombieMC.gotoAndPlay("crawlStart");
};
__isEating = _arg1;
};
}
private function applyChange(_arg1:Number){
var _local2:Number;
_local2 = 0.01;
if (location.y < 370){
velocity.y = (velocity.y + (_local2 / _arg1));
location.y = (location.y + velocity.y);
};
if (location.y > 370){
location.y = 370;
MovieClip(this.zombieMC).gotoAndPlay("crawlStart");
};
}
override public function update(_arg1:Number, _arg2:Object):void{
var _local3:Number;
super.update(_arg1, _arg2);
if (__enabled){
_local3 = (__magnitude * (_arg1 / 1000));
if (!__ready){
applyChange(_local3);
};
if (victim == "cart"){
__goalX = __gameplayManager.getCartPosition();
};
if (victim == "gimp"){
__goalX = __gameplayManager.getGimpPosition();
};
if (__goalX > (location.x + rate)){
__direction = 1;
};
if (__goalX < (location.x - rate)){
__direction = -1;
};
if (!__isEating){
scaleX = -(__direction);
location.x = (location.x + (rate * __direction));
};
};
}
private function genRandInRange(_arg1:Number, _arg2:Number){
return ((Math.floor((Math.random() * (_arg2 - _arg1))) + _arg1));
}
private function doEat(_arg1:TimerEvent){
this.zombieMC.gotoAndPlay(60);
timedEat = false;
__isEating = false;
}
}
}//package com.plus64.sceneGraph
Section 12
//Bullet (com.plus64.sceneGraph.Bullet)
package com.plus64.sceneGraph {
import flash.events.*;
import flash.geom.*;
public class Bullet extends AbstractNode {
private var __angle:Number;// = 0
private var __magnitude:Number;// = 200
private var __deltaX:Number;
private var __deltaY:Number;
public var location:Point;
private var __runOnce:Boolean;
public var velocity:Point;
public function Bullet(){
__angle = 0;
__magnitude = 200;
velocity = new Point();
location = new Point();
super();
addEventListener(Event.ADDED_TO_STAGE, __init);
}
override public function destroy():void{
removeEventListener(Event.ADDED_TO_STAGE, __init);
}
public function setup(_arg1:Number, _arg2:Number, _arg3:Point):void{
__angle = (_arg1 + 90);
__magnitude = 1200;
location.x = Number(_arg3.x);
location.y = Number(_arg3.y);
}
override public function render(_arg1:Number):void{
x = location.x;
y = location.y;
super.render(_arg1);
}
override public function update(_arg1:Number, _arg2:Object):void{
var _local3:Number;
super.update(_arg1, _arg2);
if (!__runOnce){
_local3 = (__magnitude * (_arg1 / 1000));
velocity.y = ((_local3 * Math.cos(((__angle * Math.PI) / 180))) * __magnitude);
velocity.x = ((_local3 * Math.sin(((__angle * Math.PI) / 180))) * __magnitude);
__runOnce = true;
};
velocity.y = (velocity.y + -0.1);
location.y = (location.y - velocity.y);
location.x = (location.x + velocity.x);
if ((((location.y < -550)) || ((location.y > 400)))){
destroy();
dispatchEvent(new Event("destroy"));
};
}
private function __init(_arg1:Event):void{
x = 1000;
y = 1000;
}
}
}//package com.plus64.sceneGraph
Section 13
//Cart (com.plus64.sceneGraph.Cart)
package com.plus64.sceneGraph {
import com.plus64.model.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class Cart extends AbstractNode {
private const MAXPOWER:Number = 600;
private const ACCELERATION:Number = 0.5;
private const MAXSPEED:Number = 8;
public const ass:Number = 1;
private const MAXBARRELROT:Number = 50;
private const MAXBULLETS:Number = 1000;
private const MASKSCALEFACTOR:Number = 0.75;
private const SCALEFACTOR:Number = 0.375;
private var __power:Number;// = 0
private var __leg:MovieClip;
private var __flinching:Boolean;// = false
private var isFiring:Boolean;// = false
private var __rotation:Number;// = -60
private var __enabled:Boolean;// = true
private var __attached:Boolean;// = false
private var __barrel:INode;
private var __h:Number;// = 0
private var __direction:Number;// = 1
public var attached:Boolean;// = false
public var location:Point;
public var canMove:Boolean;// = true
private var __runOnce:Boolean;// = false
private var __bullets:Number;// = 0
public var velocity:Point;
private var Barrel:Class;
public function Cart(){
__runOnce = false;
__h = 0;
__rotation = -60;
__power = 0;
__bullets = 0;
attached = false;
__enabled = true;
__flinching = false;
__attached = false;
__direction = 1;
canMove = true;
isFiring = false;
super();
addEventListener(Event.ADDED_TO_STAGE, __init);
this.addEventListener("flinchEnd", __endFlinch);
}
override public function destroy():void{
removeEventListener(Event.ADDED_TO_STAGE, __init);
removeEventListener("flinchEnd", __endFlinch);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseListener);
}
private function __endFlinch(_arg1:Event):void{
__flinching = false;
}
private function __getAngleBetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
_local7 = Math.atan2(_local6, _local5);
return (((_local7 * 180) / Math.PI));
}
public function flinch():void{
if (__enabled){
this.cartAnimation.gotoAndPlay("hurt");
__flinching = true;
};
}
public function attach():void{
__attached = true;
}
public function kill():void{
__enabled = false;
this.cartAnimation.gotoAndPlay("death");
}
private function mouseListener(_arg1:MouseEvent){
if (__enabled){
__rotation = __getAngleBetweenPoints(x, y, _arg1.stageX, _arg1.stageY);
__power = (y - _arg1.stageY);
calculateBounds();
};
}
override public function render(_arg1:Number):void{
if (__enabled){
x = location.x;
super.render(_arg1);
};
}
private function __removeBullet(_arg1:Event){
var _local2:Bullet;
_local2 = Bullet(_arg1.target);
_local2.removeEventListener("destroy", __removeBullet);
__bullets--;
}
private function calculateBounds():void{
if (__direction > 0){
if ((((((__rotation >= -78)) && ((__rotation >= -(MAXBARRELROT))))) && ((__rotation < 78)))){
__rotation = -(MAXBARRELROT);
};
if (__rotation < -78){
__rotation = -78;
};
} else {
if ((((__rotation < -102)) && ((__rotation <= (-180 + MAXBARRELROT))))){
__rotation = (-180 + MAXBARRELROT);
};
if (__rotation > -102){
__rotation = -102;
};
};
}
override public function update(_arg1:Number, _arg2:Object):void{
var _local3:*;
var _local4:Number;
var _local5:Number;
var _local6:Point;
super.update(_arg1, _arg2);
if (__enabled){
if (__rotation < 0){
Barrel(__barrel).setRotation(__rotation);
};
if (_arg2.mouseDown){
if (__bullets < MAXBULLETS){
if (!isFiring){
this.cartAnimation.gotoAndPlay("fire");
this.__leg.gotoAndPlay("fire");
this.gunMask.gotoAndPlay(1);
};
Barrel(__barrel).fire();
this.gunMask.play();
_local3 = GameplayManager.getInstance().addBullet();
_local4 = (__h * Math.sin((((__rotation + 90) * Math.PI) / 180)));
_local5 = -((__h * Math.cos((((__rotation + 90) * Math.PI) / 180))));
_local6 = new Point((x + _local4), (y + _local5));
localToGlobal(_local6);
_local6.y = (_local6.y + 20);
if (__direction > 0){
_local6.x = (_local6.x + (20 * __direction));
} else {
_local6.x = (_local6.x + (50 * __direction));
};
Bullet(_local3).setup(__rotation, __power, _local6);
__bullets++;
Bullet(_local3).addEventListener("destroy", __removeBullet);
} else {
Barrel(__barrel).ceaseFire();
};
} else {
Barrel(__barrel).ceaseFire();
};
if (((_arg2.keyPressedLeft) && (__attached))){
if (Math.abs(velocity.x) < MAXSPEED){
velocity.x = (velocity.x - ACCELERATION);
};
} else {
if ((((velocity.x <= 0)) && (canMove))){
velocity.x = (velocity.x + ACCELERATION);
};
};
if (((_arg2.keyPressedRight) && (__attached))){
if (Math.abs(velocity.x) < MAXSPEED){
velocity.x = (velocity.x + ACCELERATION);
};
} else {
if (velocity.x > 0){
velocity.x = (velocity.x - ACCELERATION);
};
};
if (canMove){
location.x = (location.x + velocity.x);
location.y = (location.y + velocity.y);
};
GameplayManager.getInstance().updateCartPosition(location.x);
};
}
public function detach():void{
__attached = false;
}
public function switchDirection(_arg1:Number):void{
if (__enabled){
this.cartAnimation.scaleX = (SCALEFACTOR * _arg1);
this.gunMask.scaleX = (MASKSCALEFACTOR * _arg1);
__leg.scaleX = (SCALEFACTOR * _arg1);
if (_arg1 > 0){
MovieClip(__barrel).x = 50;
this.gunMask.x = 100;
} else {
MovieClip(__barrel).x = -30;
this.gunMask.x = -80;
};
__direction = _arg1;
GameplayManager.getInstance().setCartDirection(__direction);
calculateBounds();
};
}
private function __init(_arg1:Event){
var _local2:Class;
if (!__runOnce){
Barrel = AssetStack.getInstance().getClass("Barrel");
__barrel = INode(new Barrel());
DisplayObject(__barrel).y = 30;
DisplayObject(__barrel).x = 50;
DisplayObject(__barrel).scaleX = 0.5;
DisplayObject(__barrel).scaleY = 0.5;
addChild(DisplayObject(__barrel));
DisplayObject(__barrel).mask = this.gunMask;
__h = (DisplayObject(__barrel).width - 50);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseListener);
_local2 = AssetStack.getInstance().getClass("CartLeg");
__leg = new (_local2);
DisplayObject(__leg).y = -18;
DisplayObject(__leg).x = 10;
DisplayObject(__leg).scaleX = 0.375;
DisplayObject(__leg).scaleY = 0.375;
addChild(__leg);
__runOnce = true;
};
location = new Point(x, y);
velocity = new Point(0, 0);
}
}
}//package com.plus64.sceneGraph
Section 14
//Gimp (com.plus64.sceneGraph.Gimp)
package com.plus64.sceneGraph {
import com.plus64.model.*;
import flash.events.*;
import com.plus64.physics.*;
import flash.geom.*;
public class Gimp extends AbstractNode {
private const MAXSPEED:Number = 8;
private const ACCELERATION:Number = 0.5;
private const JUMPHEIGHT:Number = 20;
private const SCALEFACTOR:Number = 0.4;
private var __isIdle:Boolean;// = true
private var __flinching:Boolean;// = false
private var __cartDirection:String;// = "facingRight"
private var __enabled:Boolean;// = true
private var __keyDownLeft:Boolean;// = false
private var __attached:Boolean;// = false
private var __mashing:Boolean;// = false
private var __direction:Number;// = 1
private var __motionKilled:Boolean;// = false
public var location:Point;
public var cartKilled:Boolean;// = false
private var __keyDownRight:Boolean;// = false
public var velocity:Point;
public function Gimp(){
__enabled = true;
cartKilled = false;
__attached = false;
__cartDirection = "facingRight";
__flinching = false;
__direction = 1;
__keyDownRight = false;
__keyDownLeft = false;
__isIdle = true;
__mashing = false;
__motionKilled = false;
super();
addEventListener(Event.ADDED_TO_STAGE, __init);
}
override public function destroy():void{
removeEventListener(Event.ADDED_TO_STAGE, __init);
removeEventListener("mashOver", __endMash);
removeEventListener("activeMashingStart", __startActiveMash);
removeEventListener("activeMashingEnd", __endActiveMash);
removeEventListener("flinchEnd", __endFlinch);
}
private function __endFlinch(_arg1:Event):void{
__flinching = false;
}
public function flinch():void{
if (__enabled){
this.gimpAnimation.gotoAndPlay("flinch");
__flinching = true;
__mashing = false;
};
}
private function __startActiveMash(_arg1:Event){
GameplayManager.getInstance().isMashing = true;
if (GameplayManager.getInstance().gimpTouchingZombie){
dispatchEvent(new Event("gimpMashedZombie", true));
};
}
public function attach(_arg1:Number):void{
if (((__enabled) && (!(cartKilled)))){
__direction = GameplayManager.getInstance().getCartDirection();
this.gimpAnimation.gotoAndPlay("idle");
__mashing = false;
__attached = true;
velocity.x = 0;
if (__direction > 0){
location.x = (_arg1 - 50);
} else {
location.x = (_arg1 + 50);
};
if (__keyDownLeft){
this.gimpAnimation.scaleX = (SCALEFACTOR * __direction);
if (GameplayManager.getInstance().getCartDirection() == 1){
this.gimpAnimation.gotoAndPlay("pull");
} else {
this.gimpAnimation.gotoAndPlay("push");
};
};
if (__keyDownRight){
this.gimpAnimation.scaleX = (SCALEFACTOR * __direction);
if (GameplayManager.getInstance().getCartDirection() == 1){
this.gimpAnimation.gotoAndPlay("push");
} else {
this.gimpAnimation.gotoAndPlay("pull");
};
};
};
}
public function kill():void{
__enabled = false;
detach();
this.gimpAnimation.gotoAndPlay("death");
}
public function get mashing():Boolean{
return (__mashing);
}
public function tweakGimpLoc(_arg1:Number){
location.x = _arg1;
}
private function __endActiveMash(_arg1:Event){
GameplayManager.getInstance().isMashing = false;
}
override public function render(_arg1:Number):void{
if (__enabled){
x = location.x;
y = location.y;
};
super.render(_arg1);
}
private function __endMash(_arg1:Event){
__mashing = false;
this.gimpAnimation.gotoAndPlay("idle");
}
override public function update(_arg1:Number, _arg2:Object):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Boolean;
var _local8:Boolean;
super.update(_arg1, _arg2);
if (__enabled){
if (((_arg2.keyPressedLeft) && (!(__mashing)))){
if (!__keyDownLeft){
if (!__attached){
this.gimpAnimation.gotoAndPlay(1);
__direction = -1;
} else {
if (GameplayManager.getInstance().getCartDirection() == 1){
this.gimpAnimation.gotoAndPlay("pull");
} else {
this.gimpAnimation.gotoAndPlay("push");
};
};
__keyDownLeft = true;
__isIdle = false;
this.gimpAnimation.scaleX = (SCALEFACTOR * __direction);
};
if (Math.abs(velocity.x) < MAXSPEED){
velocity.x = (velocity.x - ACCELERATION);
};
} else {
if (velocity.x <= 0){
velocity.x = (velocity.x + ACCELERATION);
};
__keyDownLeft = false;
};
if (((_arg2.keyPressedRight) && (!(__mashing)))){
if (!__keyDownRight){
if (!__attached){
this.gimpAnimation.gotoAndPlay(1);
__direction = 1;
} else {
if (GameplayManager.getInstance().getCartDirection() == 1){
this.gimpAnimation.gotoAndPlay("push");
} else {
this.gimpAnimation.gotoAndPlay("pull");
};
};
__keyDownRight = true;
__isIdle = false;
this.gimpAnimation.scaleX = (SCALEFACTOR * __direction);
};
if (Math.abs(velocity.x) < MAXSPEED){
velocity.x = (velocity.x + ACCELERATION);
};
} else {
if (velocity.x > 0){
velocity.x = (velocity.x - ACCELERATION);
};
__keyDownRight = false;
};
if (((((!(_arg2.keyPressedRight)) && (!(_arg2.keyPressedLeft)))) && (!(__mashing)))){
__keyDownRight = false;
__keyDownLeft = false;
if (!__isIdle){
__isIdle = true;
this.gimpAnimation.gotoAndPlay("idle");
};
};
if (((((_arg2.keyPressedE) && (!(__attached)))) && (!(__mashing)))){
if (GameplayManager.getInstance().canMash()){
__mashing = true;
this.gimpAnimation.gotoAndPlay("mash");
};
};
if (velocity.y <= 1){
velocity.y = 0;
};
BudgetPhysicsEngine.getInstance().applyGravity(velocity, location, 1, _arg1);
_local3 = GameplayManager.getInstance().getCartDirection();
_local4 = 60;
_local5 = 600;
_local6 = 100;
_local7 = false;
_local8 = false;
if (x < 40){
_local7 = true;
};
if (x > 620){
_local8 = true;
};
if (__attached){
if (_local3 == 1){
if (x < _local4){
_local7 = true;
};
};
if (_local3 == -1){
if (x < (_local4 + _local6)){
_local7 = true;
};
};
if (_local3 == -1){
if (x > _local5){
_local8 = true;
};
};
if (_local3 == 1){
if (x > (_local5 - _local6)){
_local8 = true;
};
};
};
if ((((((velocity.x < 0)) && (_local7))) || ((((velocity.x > 0)) && (_local8))))){
__motionKilled = true;
dispatchEvent(new Event("killCartMotion", true));
velocity.x = 0;
} else {
if (((__motionKilled) && (((((_arg2.keyPressedRight) && (!(_local8)))) || (((_arg2.keyPressedLeft) && (!(_local7)))))))){
__motionKilled = false;
dispatchEvent(new Event("resumeCartMotion", true));
};
};
location.x = (location.x + velocity.x);
location.y = (location.y + velocity.y);
GameplayManager.getInstance().updateGimpPosition(location.x);
if (cartKilled){
};
};
}
public function detach():void{
__attached = false;
this.gimpAnimation.gotoAndPlay("idle");
__keyDownLeft = false;
__keyDownRight = false;
__isIdle = true;
}
public function switchDirection(_arg1:Number):void{
var _local2:Number;
this.gimpAnimation.scaleX = (SCALEFACTOR * _arg1);
__direction = _arg1;
_local2 = (GameplayManager.getInstance().getCartPosition() + (40 * -(_arg1)));
location.x = _local2;
__keyDownLeft = false;
__keyDownRight = false;
__isIdle = true;
}
private function __init(_arg1:Event){
velocity = new Point(-10, 0);
location = new Point(x, y);
this.gimpAnimation.gotoAndPlay("idle");
this.addEventListener("mashOver", __endMash);
this.addEventListener("activeMashingStart", __startActiveMash);
this.addEventListener("activeMashingEnd", __endActiveMash);
this.addEventListener("flinchEnd", __endFlinch);
}
}
}//package com.plus64.sceneGraph
Section 15
//INode (com.plus64.sceneGraph.INode)
package com.plus64.sceneGraph {
public interface INode {
function render(_arg1:Number):void;
function update(_arg1:Number, _arg2:Object):void;
function destroy():void;
}
}//package com.plus64.sceneGraph
Section 16
//Intro (com.plus64.sceneGraph.Intro)
package com.plus64.sceneGraph {
import flash.events.*;
import flash.display.*;
import flash.system.*;
public class Intro extends AbstractNode {
public function Intro(){
addEventListener(Event.ADDED_TO_STAGE, __init);
}
override public function destroy():void{
removeEventListener(Event.ADDED_TO_STAGE, __init);
}
public function updateCounter(_arg1:Object){
this.totalPlays.text = String(_arg1);
}
private function __startHandler(_arg1:MouseEvent){
dispatchEvent(new Event("stateChange", true));
}
override public function render(_arg1:Number):void{
super.render(_arg1);
}
override public function update(_arg1:Number, _arg2:Object):void{
super.update(_arg1, _arg2);
}
private function __init(_arg1:Event){
MovieClip(this.startButton).addEventListener(MouseEvent.CLICK, __startHandler);
}
}
}//package com.plus64.sceneGraph
Section 17
//NodeEvent (com.plus64.sceneGraph.NodeEvent)
package com.plus64.sceneGraph {
import flash.events.*;
public class NodeEvent extends Event {
private var __node:INode;
public function NodeEvent(_arg1:String, _arg2:INode, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
__node = _arg2;
}
public function getNode():INode{
return (__node);
}
}
}//package com.plus64.sceneGraph
Section 18
//Scores (com.plus64.sceneGraph.Scores)
package com.plus64.sceneGraph {
import com.plus64.model.*;
import flash.events.*;
import flash.display.*;
public class Scores extends AbstractNode {
public function Scores(){
addEventListener(Event.ADDED_TO_STAGE, __init);
}
override public function destroy():void{
removeEventListener(Event.ADDED_TO_STAGE, __init);
}
public function getScore():Number{
return (((GameplayManager.getInstance().score as Number) * 125));
}
public function setScore():void{
this.output.text = ("You scored " + ((GameplayManager.getInstance().score as Number) * 125));
}
private function __clickHandler(_arg1:MouseEvent){
dispatchEvent(new Event("stateChange", true));
}
override public function render(_arg1:Number):void{
super.render(_arg1);
}
override public function update(_arg1:Number, _arg2:Object):void{
super.update(_arg1, _arg2);
}
public function outputMessage(_arg1:String){
}
private function __init(_arg1:Event){
MovieClip(this.startAgain).addEventListener(MouseEvent.CLICK, __clickHandler);
}
}
}//package com.plus64.sceneGraph
Section 19
//Shit (com.plus64.sceneGraph.Shit)
package com.plus64.sceneGraph {
import flash.events.*;
import flash.geom.*;
public class Shit extends AbstractNode {
private var __success:Boolean;// = false
public var location:Point;
public var velocity:Point;
public var shitVictim:String;// = null
public function Shit(){
__success = false;
shitVictim = null;
super();
addEventListener(Event.ADDED_TO_STAGE, __init);
}
override public function destroy():void{
removeEventListener(Event.ADDED_TO_STAGE, __init);
dispatchEvent(new Event("shitExplodes"));
}
public function setSuccess(_arg1:Boolean):void{
__success = _arg1;
}
public function setup(_arg1:Number, _arg2:Number){
location = new Point(_arg1, _arg2);
}
override public function render(_arg1:Number):void{
x = location.x;
y = location.y;
super.render(_arg1);
}
override public function update(_arg1:Number, _arg2:Object):void{
super.update(_arg1, _arg2);
velocity.y = (velocity.y + 0.2);
location.y = (location.y + velocity.y);
}
public function getSuccess():Boolean{
return (__success);
}
private function __init(_arg1:Event){
var _local2:Number;
velocity = new Point(0, 0);
_local2 = ((Math.random())<0.5) ? 1 : 2;
this.gotoAndStop(_local2);
}
}
}//package com.plus64.sceneGraph
Section 20
//Zombie (com.plus64.sceneGraph.Zombie)
package com.plus64.sceneGraph {
import com.plus64.model.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class Zombie extends AbstractNode {
private const WANDERFACTOR:Number = 60;
private var __hadALogTimeout:Boolean;// = false
private var __type:Number;
private var pooLocation:Point;
private var __isTakingALog:Boolean;// = false
public var direction:Number;// = 0
private var __dead:Boolean;// = false
private var pooVector:Point;
private var location:Point;
private var __isPacing:Boolean;// = false
private var __goalX:Number;
private var __newGoalX:Number;
private var velocity:Point;
private var rate:Number;// = 0
public function Zombie(){
rate = 0;
location = new Point(0, 0);
velocity = new Point(0, 0);
pooLocation = new Point();
pooVector = new Point();
__isTakingALog = false;
__hadALogTimeout = false;
__isPacing = false;
direction = 0;
__dead = false;
super();
addEventListener(Event.ADDED_TO_STAGE, __init);
addEventListener("shitTaken", __shitDoneHandler);
addEventListener("squeezePoo", __squeezePooHandler);
}
override public function destroy():void{
var _local1:Class;
var _local2:INode;
__dead = true;
_local1 = AssetStack.getInstance().getClass("bloodSpray");
_local2 = new (_local1);
addChild(DisplayObject(_local2));
removeEventListener("shitTaken", __shitDoneHandler);
removeEventListener("squeezePoo", __squeezePooHandler);
dispatchEvent(new Event("destroy"));
removeEventListener(Event.ADDED_TO_STAGE, __init);
}
private function initiatePooSequence():void{
if (!__isTakingALog){
__isTakingALog = true;
__hadALogTimeout = true;
velocity.x = 0;
this.zombieMC.gotoAndPlay("shit");
};
}
private function initiatePaceSequence():void{
__isPacing = true;
__newGoalX = (__goalX + (WANDERFACTOR * direction));
}
public function setDirection(_arg1:Number){
direction = _arg1;
if (_arg1 > 0){
x = (0 - width);
scaleX = -1;
} else {
x = (800 + width);
scaleX = 1;
};
}
public function setGoalX(_arg1:Number, _arg2:Boolean=false){
if (_arg1 != __goalX){
__isPacing = false;
};
if (_arg2){
__newGoalX = _arg1;
};
__goalX = _arg1;
}
private function setNewGoalX():void{
__newGoalX = (__goalX + (WANDERFACTOR * direction));
}
private function __shitDoneHandler(_arg1:Event){
var _local2:Timer;
_local2 = new Timer(3000, 1);
_local2.addEventListener(TimerEvent.TIMER_COMPLETE, clearLogTimeout, false, 0, true);
_local2.start();
this.zombieMC.gotoAndPlay(1);
__isTakingALog = false;
}
override public function render(_arg1:Number):void{
x = location.x;
super.render(_arg1);
}
private function clearPooSequence():void{
__isTakingALog = false;
}
public function getType():Number{
return (__type);
}
private function clearLogTimeout(_arg1:TimerEvent){
__hadALogTimeout = false;
}
override public function update(_arg1:Number, _arg2:Object):void{
super.update(_arg1, _arg2);
if (!__dead){
if (!__isPacing){
if ((((((location.x <= __goalX)) && ((direction == -1)))) || ((((location.x >= __goalX)) && ((direction == 1)))))){
initiatePooSequence();
initiatePaceSequence();
} else {
velocity.x = (rate * direction);
};
if (__goalX > (location.x + rate)){
direction = 1;
};
if (__goalX < (location.x - rate)){
direction = -1;
};
} else {
if ((((Math.abs((location.x - __goalX)) <= 10)) && (!(__hadALogTimeout)))){
initiatePooSequence();
};
velocity.x = (rate * direction);
if (__newGoalX > (location.x + rate)){
direction = 1;
setNewGoalX();
};
if (__newGoalX < (location.x - rate)){
direction = -1;
setNewGoalX();
};
};
scaleX = -(direction);
if (__isTakingALog){
velocity.x = 0;
};
location.x = (location.x + velocity.x);
};
}
private function __squeezePooHandler(_arg1:Event){
dispatchEvent(new Event("takeAShit"));
}
public function setType(_arg1:Number){
__type = _arg1;
}
private function __init(_arg1:Event){
rate = (Math.floor((Math.random() * (5 - 1))) + 1);
location.x = x;
location.y = y;
}
}
}//package com.plus64.sceneGraph
Section 21
//ZombiePoo (com.plus64.sceneGraph.ZombiePoo)
package com.plus64.sceneGraph {
import com.plus64.model.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class ZombiePoo extends AbstractNode {
private const zombieIncreaseThreshold = 10;
private const crawlerIncreaseThreshold = 10;
private var keyPressedSpace:Boolean;// = false
private var keyPressedDown:Boolean;// = false
private var __updateDataPacket:Object;
private var __cartDirection:Number;// = 1
private var MINZOMBIES:Number;// = 3
private var __attachGateTimer:Timer;
private var score:Number;// = 0
private var keyPressedUp:Boolean;// = false
private var crawlerLevel:Number;// = 1
private var JUMPINT:Number;// = 10000
private var mouseDown:Boolean;// = false
private var __gimpIsDead:Boolean;// = false
private var zombieLevel:Number;// = 1
private var __cart:INode;
private var __jumpInterval:Timer;
private var keyPressedRight:Boolean;// = false
private var __stage:INode;
private var MAXZOMBIES:Number;// = 15
private var __zombies:Number;// = 0
private var playerInc:int;// = 0
private var __scoreBoard:INode;
private var __cartSpin:INode;
private var keyPressedLeft:Boolean;// = false
private var __attached:Boolean;// = false
private var ScoreBoard:Class;
private var CartSpin:Class;
private var ShitExp:Class;
private var isShaking:Boolean;// = false
private var __cartIsDead:Boolean;// = false
private var shakeSwitch:Number;// = 1
private var __spinning:Boolean;// = false
private var keyPressedE:Boolean;// = false
private var __gimp:INode;
private var CRAWLERMAXINT:Number;// = 10
public function ZombiePoo(){
keyPressedRight = false;
keyPressedLeft = false;
keyPressedUp = false;
keyPressedDown = false;
keyPressedSpace = false;
keyPressedE = false;
mouseDown = false;
playerInc = 0;
__zombies = 0;
MINZOMBIES = 3;
MAXZOMBIES = 15;
CRAWLERMAXINT = 10;
zombieLevel = 1;
crawlerLevel = 1;
score = 0;
__cartIsDead = false;
__gimpIsDead = false;
__spinning = false;
__cartDirection = 1;
__attached = false;
JUMPINT = 10000;
isShaking = false;
shakeSwitch = 1;
super();
addEventListener(Event.ADDED_TO_STAGE, __init);
CartSpin = AssetStack.getInstance().getClass("cartSpin");
ShitExp = AssetStack.getInstance().getClass("type1TurdExplosion");
ScoreBoard = AssetStack.getInstance().getClass("scoreBoard");
}
private function makeZombieJump(_arg1:TimerEvent){
var _local2:Zombie;
var _local3:Number;
_local2 = GameplayManager.getInstance().popZombieFromStack();
if (_local2 != null){
_local2.removeEventListener("destroy", __removeZombie);
__addCrawlingZombie(_local2);
_local3 = (Math.floor((Math.random() * (JUMPINT - 2000))) + 2000);
__jumpInterval = new Timer(_local3, 1);
__jumpInterval.addEventListener(TimerEvent.TIMER_COMPLETE, makeZombieJump, false, 0, true);
__jumpInterval.start();
JUMPINT = (JUMPINT - 500);
if (JUMPINT < 2000){
JUMPINT = 2000;
};
};
}
private function __quitHandler(_arg1:Event){
destroy();
dispatchEvent(new Event("stateChange", true));
}
private function keyUpListener(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 68:
keyPressedRight = false;
break;
case 65:
keyPressedLeft = false;
break;
case 87:
keyPressedUp = false;
break;
case 83:
keyPressedDown = false;
break;
case 32:
keyPressedSpace = false;
break;
case 69:
keyPressedE = false;
break;
};
}
private function __zombieMashHandler(_arg1:Event){
}
private function __fireHandler(_arg1:NodeEvent){
var _local2:INode;
var _local3:Timer;
_local2 = _arg1.getNode();
Bullet(_local2).addEventListener("destroy", __removeBullet);
addChild(_local2);
if (!isShaking){
isShaking = true;
_local3 = new Timer(30, 10);
_local3.addEventListener(TimerEvent.TIMER, __shake, false, 0, true);
_local3.addEventListener(TimerEvent.TIMER_COMPLETE, __shakeEnd, false, 0, true);
_local3.start();
};
}
private function deathTimeout(_arg1:TimerEvent){
destroy();
dispatchEvent(new Event("stateChange", true));
}
private function checkScore(){
score++;
if (score > (zombieLevel * zombieIncreaseThreshold)){
zombieLevel++;
MINZOMBIES++;
if (MINZOMBIES >= MAXZOMBIES){
MINZOMBIES = MAXZOMBIES;
};
};
if (score > (crawlerLevel * crawlerIncreaseThreshold)){
crawlerLevel++;
if (CRAWLERMAXINT > 3){
CRAWLERMAXINT++;
};
};
GameplayManager.getInstance().score = score;
}
private function getKeys(){
__updateDataPacket.keyPressedRight = keyPressedRight;
__updateDataPacket.keyPressedLeft = keyPressedLeft;
__updateDataPacket.keyPressedUp = keyPressedUp;
__updateDataPacket.keyPressedSpace = keyPressedSpace;
__updateDataPacket.keyPressedE = keyPressedE;
}
private function mouseListener(_arg1:MouseEvent){
mouseDown = true;
}
private function __removeBullet(_arg1:Event){
var _local2:Bullet;
var _local3:Number;
_local2 = Bullet(_arg1.target);
_local2.removeEventListener("destroy", __removeBullet);
_local3 = getChildIndex(_local2);
if (_local3 != -1){
removeChildAt(_local3);
};
}
override public function update(_arg1:Number, _arg2:Object):void{
var _local3:INode;
getKeys();
getMouse();
super.update(_arg1, __updateDataPacket);
if (__zombies < MINZOMBIES){
_local3 = GameplayManager.getInstance().addZombie();
addChild(_local3);
__zombies++;
Zombie(_local3).addEventListener("destroy", __removeZombie);
Zombie(_local3).addEventListener("takeAShit", __makeZombieShit);
};
GameplayManager.getInstance().checkCollisions();
if (((!(__cartIsDead)) && (!(__gimpIsDead)))){
if (((((keyPressedSpace) && (MovieClip(__gimp).gimpHitArea.hitTestObject(MovieClip(__cart).cartAnimation.cartHandle)))) && ((__attachGateTimer == null)))){
__attachGateTimer = new Timer(1000, 1);
__attachGateTimer.addEventListener(TimerEvent.TIMER, __breakAttachGateTimer);
__attachGateTimer.start();
if (!__attached){
Cart(__cart).attach();
Gimp(__gimp).attach((MovieClip(__cart).x as Number));
__attached = true;
} else {
Cart(__cart).detach();
Gimp(__gimp).detach();
__attached = false;
};
};
if (((((keyPressedE) && (!(__spinning)))) && (__attached))){
__spinning = true;
MovieClip(__gimp).visible = false;
MovieClip(__cart).visible = false;
MovieClip(__cartSpin).visible = true;
MovieClip(__cartSpin).animation.gotoAndPlay(1);
__cartDirection = (__cartDirection * -1);
Cart(__cart).switchDirection(__cartDirection);
Gimp(__gimp).switchDirection(__cartDirection);
};
CartSpin(__cartSpin).move(MovieClip(__cart).x, __cartDirection);
};
}
private function __resumeCartMotionHandler(_arg1:Event){
Cart(__cart).canMove = true;
}
private function getMouse(){
__updateDataPacket.mouseDown = mouseDown;
if (mouseDown){
mouseDown = false;
};
}
private function __init(_arg1:Event){
var _local2:Class;
var _local3:Class;
__updateDataPacket = new Object();
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpListener);
stage.addEventListener(MouseEvent.CLICK, mouseListener);
_local2 = AssetStack.getInstance().getClass("gameStage");
__stage = INode(new (_local2));
DisplayObject(__stage).x = 0;
DisplayObject(__stage).y = 0;
addChild(__stage);
MovieClip(__stage).addEventListener("quit", __quitHandler);
_local3 = AssetStack.getInstance().getClass("scoreBoard");
__scoreBoard = INode(new (_local3));
addChild(__scoreBoard);
MovieClip(__scoreBoard).addEventListener("killCart", __killCartHandler);
MovieClip(__scoreBoard).addEventListener("killGimp", __killGimpHandler);
this.__gimp = GameplayManager.getInstance().addGimp();
DisplayObject(__gimp).y = 310;
DisplayObject(__gimp).x = 320;
addChild(__gimp);
__cart = GameplayManager.getInstance().addCart();
DisplayObject(__cart).x = 380;
DisplayObject(__cart).y = 380;
addChild(__cart);
__cartSpin = INode(new CartSpin());
DisplayObject(__cartSpin).x = 380;
DisplayObject(__cartSpin).y = 380;
MovieClip(MovieClip(__cartSpin).animation).addEventListener("completez", __spinDoneHandler);
addChild(__cartSpin);
GameplayManager.getInstance().addEventListener("addBullet", __fireHandler);
GameplayManager.getInstance().addEventListener("shitExplodes", __explodeShitHandler);
MovieClip(__gimp).addEventListener("killCartMotion", __killCartMotionHandler);
MovieClip(__gimp).addEventListener("resumeCartMotion", __resumeCartMotionHandler);
}
private function __removeExplosion(_arg1:Event){
var _local2:DisplayObject;
var _local3:Number;
_local2 = _arg1.target;
_local2.removeEventListener(Event.COMPLETE, __removeExplosion);
_local3 = getChildIndex(_local2);
if (_local2 != null){
removeChild(_local2);
};
}
private function __shake(_arg1:TimerEvent):void{
shakeSwitch = (shakeSwitch * -1);
MovieClip(this).x = (MovieClip(this).x + (2 * shakeSwitch));
MovieClip(this).y = (MovieClip(this).y + (2 * shakeSwitch));
}
private function __removeDeadZombie(_arg1:Event){
var _local2:Zombie;
_local2 = Zombie(_arg1.target.parent);
_local2.removeEventListener("dead", __removeDeadZombie);
if (_local2 != null){
removeChild(_local2);
};
__zombies--;
}
private function __explodeShitHandler(_arg1:Event){
var _local2:INode;
var _local3:Number;
_local2 = INode(_arg1.target);
Shit(_local2).removeEventListener("shitExplodes", __explodeShitHandler);
_local3 = getChildIndex(_local2);
if (Shit(_local2).getSuccess()){
if (Shit(_local2).shitVictim == "cart"){
Cart(__cart).flinch();
ScoreBoard(__scoreBoard).addCartScore();
};
if (Shit(_local2).shitVictim == "gimp"){
Gimp(__gimp).flinch();
ScoreBoard(__scoreBoard).addGimpScore();
};
};
if (_local2 != null){
removeChild(_local2);
};
}
private function __biteHandler(_arg1:Event){
var _local2:String;
_local2 = AssplodedZombie(_arg1.target.parent).victim;
if ((((_local2 == "cart")) && (!(__cartIsDead)))){
Cart(__cart).flinch();
ScoreBoard(__scoreBoard).addCartScore();
} else {
if ((((_local2 == "gimp")) && (!(__gimpIsDead)))){
if (!Gimp(__gimp).mashing){
Gimp(__gimp).flinch();
ScoreBoard(__scoreBoard).addGimpScore();
};
};
};
}
private function __breakAttachGateTimer(_arg1:TimerEvent){
__attachGateTimer = null;
}
private function __killGimpHandler(_arg1:Event){
var _local2:Timer;
Gimp(__gimp).kill();
Cart(__cart).detach();
__gimpIsDead = true;
__attached = false;
GameplayManager.getInstance().invalidatedGimp = true;
if (((__cartIsDead) && (__gimpIsDead))){
_local2 = new Timer(5000, 1);
_local2.addEventListener(TimerEvent.TIMER_COMPLETE, deathTimeout, false, 0, true);
_local2.start();
};
}
private function __removeAssplodedZombie(_arg1:Event){
var _local2:AssplodedZombie;
var _local3:DisplayObject;
_local2 = AssplodedZombie(_arg1.target);
_local2.removeEventListener("destroy", __removeAssplodedZombie);
_local2.removeEventListener("bite", __biteHandler);
__zombieMashHandler(null);
if (_local2 != null){
_local3 = removeChild(_local2);
};
__zombies--;
MovieClip(_local2).zombieMC.gotoAndPlay(0);
ScoreBoard(__scoreBoard).addZombieScore();
checkScore();
if (__cartIsDead){
makeZombieJump(null);
};
}
private function keyDownListener(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 68:
keyPressedRight = true;
break;
case 65:
keyPressedLeft = true;
break;
case 87:
keyPressedUp = true;
break;
case 83:
keyPressedDown = true;
break;
case 32:
keyPressedSpace = true;
break;
case 69:
keyPressedE = true;
break;
};
}
private function __addCrawlingZombie(_arg1:Zombie){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:AssplodedZombie;
_local2 = _arg1.x;
_local3 = _arg1.y;
_local4 = Zombie(_arg1).direction;
_local5 = GameplayManager.getInstance().addAssplodedZombie(Zombie(_arg1).getType());
_local5.x = _local2;
_local5.y = _local3;
AssplodedZombie(_local5).addEventListener("bite", __biteHandler);
AssplodedZombie(_local5).setDirection(_local4);
addChild(_local5);
AssplodedZombie(_local5).addEventListener("destroy", __removeAssplodedZombie);
if (_arg1 != null){
removeChild(_arg1);
};
}
override public function render(_arg1:Number):void{
super.render(_arg1);
}
private function __removeZombie(_arg1:Event){
var _local2:Zombie;
var _local3:Number;
_local2 = Zombie(_arg1.target);
_local2.removeEventListener("destroy", __removeZombie);
_local3 = (Math.floor((Math.random() * (CRAWLERMAXINT - 1))) + 1);
if (_local3 == Math.round((CRAWLERMAXINT / 2))){
__addCrawlingZombie(_local2);
} else {
_local2.addEventListener("dead", __removeDeadZombie);
MovieClip(_local2).zombieMC.gotoAndPlay(80);
ScoreBoard(__scoreBoard).addZombieScore();
checkScore();
};
}
private function __killCartMotionHandler(_arg1:Event){
Cart(__cart).canMove = false;
Cart(__cart).velocity.x = 0;
}
private function __shakeEnd(_arg1:TimerEvent){
isShaking = false;
}
private function __killCartHandler(_arg1:Event){
var _local2:Timer;
var _local3:Timer;
Cart(__cart).kill();
Gimp(__gimp).cartKilled = true;
Gimp(__gimp).detach();
__cartIsDead = true;
__attached = false;
GameplayManager.getInstance().invalidatedCart = true;
if (((__cartIsDead) && (__gimpIsDead))){
_local3 = new Timer(5000, 1);
_local3.addEventListener(TimerEvent.TIMER_COMPLETE, deathTimeout, false, 0, true);
_local3.start();
};
_local2 = new Timer(5000, 1);
_local2.addEventListener(TimerEvent.TIMER_COMPLETE, makeZombieJump, false, 0, true);
_local2.start();
}
private function __spinDoneHandler(_arg1:Event){
CartSpin(__cartSpin).move(MovieClip(__cart).x, __cartDirection);
MovieClip(__gimp).visible = true;
MovieClip(__cart).visible = true;
MovieClip(__cartSpin).visible = false;
__spinning = false;
}
private function __makeZombieShit(_arg1:Event){
var _local2:Zombie;
var _local3:INode;
_local2 = Zombie(_arg1.target);
_local3 = GameplayManager.getInstance().addZombieShit();
Shit(_local3).setup((_local2.x - 4), (_local2.y + 28));
Shit(_local3).addEventListener("shitExplodes", __explodeShitHandler);
addChild(_local3);
}
override public function destroy():void{
GameplayManager.getInstance().destroy();
if (__jumpInterval){
__jumpInterval.stop();
};
__zombies = 0;
zombieLevel = 1;
crawlerLevel = 1;
score = 0;
MINZOMBIES = 30;
CRAWLERMAXINT = 2;
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownListener);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyUpListener);
stage.removeEventListener(MouseEvent.CLICK, mouseListener);
MovieClip(__scoreBoard).removeEventListener("killCart", __killCartHandler);
MovieClip(__scoreBoard).removeEventListener("killGimp", __killGimpHandler);
MovieClip(__stage).removeEventListener("quit", __quitHandler);
MovieClip(MovieClip(__cartSpin).animation).removeEventListener("completez", __spinDoneHandler);
GameplayManager.getInstance().removeEventListener("addBullet", __fireHandler);
GameplayManager.getInstance().removeEventListener("shitExplodes", __explodeShitHandler);
MovieClip(__gimp).removeEventListener("killCartMotion", __killCartMotionHandler);
MovieClip(__gimp).removeEventListener("resumeCartMotion", __resumeCartMotionHandler);
if (__gimp){
removeChild(__gimp);
};
if (__cart){
removeChild(__cart);
};
if (__cartSpin){
removeChild(__cartSpin);
};
if (__scoreBoard){
removeChild(__scoreBoard);
};
if (__stage){
removeChild(__stage);
};
}
}
}//package com.plus64.sceneGraph
Section 22
//MainTimeline (index_fla.MainTimeline)
package index_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.errors.*;
import flash.text.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.media.*;
import flash.ui.*;
public dynamic class MainTimeline extends MovieClip {
public var ad:MovieClip;
public var myOptions:Object;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
myOptions = {id:"db041235b116d8d7", res:"700x460", clip:this.ad, ad_finished:function ():void{
gotoAndStop(2);
}};
MochiAd.showPreGameAd(myOptions);
}
function frame2(){
stop();
Security.allowDomain("*");
}
}
}//package index_fla
Section 23
//startupShit_4 (index_fla.startupShit_4)
package index_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.errors.*;
import flash.text.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.media.*;
import flash.ui.*;
public dynamic class startupShit_4 extends MovieClip {
public function startupShit_4(){
addFrameScript(139, frame140);
}
function frame140(){
stop();
}
}
}//package index_fla
Section 24
//ZombiePoo_2 (index_fla.ZombiePoo_2)
package index_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
import flash.errors.*;
import flash.text.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.media.*;
import flash.ui.*;
public dynamic class ZombiePoo_2 extends MovieClip {
public function ZombiePoo_2(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package index_fla
Section 25
//MochiScores (mochi.MochiScores)
package mochi {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
//unresolved jump
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
//unresolved jump
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
//unresolved jump
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi
Section 26
//MochiServices (mochi.MochiServices)
package mochi {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function getVersion():String{
return ("1.31");
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
_rcvChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
return (_local2);
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()});
_rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
//unresolved jump
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
_rcvChannel.connect(_rcvChannelName);
_connecting = false;
_connected = true;
_listenChannel.close();
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
_rcvChannelName = _arg1;
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
MochiServices.allowDomains(_gatewayURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_gatewayURL);
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain("*", "localhost");
_rcvChannel.allowInsecureDomain("*", "localhost");
_rcvChannel.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
_connecting = true;
init(id, clip);
};
//unresolved jump
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 27
//Engine (Engine)
package {
import com.plus64.core.*;
public dynamic class Engine extends GameEngine {
}
}//package
Section 28
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.3");
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.parent._mochiad_ctr_failed){
options.ad_failed();
_local3 = true;
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("5cc6f7dfb67f2f08341c831480f7c2a7".length == 0){
options.ad_started();
options.ad_finished();
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
options.ad_failed();
_local4 = true;
};
};
};
if (this.parent._mochiad_ctr_failed){
options.ad_failed();
_local4 = true;
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package