Section 1
//explosionxx_29 (breakable_objects_fla.explosionxx_29)
package breakable_objects_fla {
import flash.display.*;
public dynamic class explosionxx_29 extends MovieClip {
public function explosionxx_29(){
addFrameScript(10, frame11);
}
function frame11(){
stop();
}
}
}//package breakable_objects_fla
Section 2
//mc_burst_2 (breakable_objects_fla.mc_burst_2)
package breakable_objects_fla {
import flash.display.*;
public dynamic class mc_burst_2 extends MovieClip {
public function mc_burst_2(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package breakable_objects_fla
Section 3
//Symbol3_21 (breakable_objects_fla.Symbol3_21)
package breakable_objects_fla {
import flash.display.*;
public dynamic class Symbol3_21 extends MovieClip {
public function Symbol3_21(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package breakable_objects_fla
Section 4
//MD5 (com.adobe.crypto.MD5)
package com.adobe.crypto {
import com.adobe.utils.*;
public class MD5 {
public function MD5(){
super();
}
private static function ff(a:int, b:int, c:int, d:int, x:int, s:int, t:int):int{
return (transform(f, a, b, c, d, x, s, t));
}
private static function createBlocks(s:String):Array{
var blocks:Array = new Array();
var len:int = (s.length * 8);
var mask = 0xFF;
var i:int;
while (i < len) {
blocks[(i >> 5)] = (blocks[(i >> 5)] | ((s.charCodeAt((i / 8)) & mask) << (i % 32)));
i = (i + 8);
};
blocks[(len >> 5)] = (blocks[(len >> 5)] | (128 << (len % 32)));
blocks[((((len + 64) >>> 9) << 4) + 14)] = len;
return (blocks);
}
private static function ii(a:int, b:int, c:int, d:int, x:int, s:int, t:int):int{
return (transform(i, a, b, c, d, x, s, t));
}
private static function f(x:int, y:int, z:int):int{
return (((x & y) | (~(x) & z)));
}
private static function g(x:int, y:int, z:int):int{
return (((x & z) | (y & ~(z))));
}
private static function h(x:int, y:int, z:int):int{
return (((x ^ y) ^ z));
}
private static function i(x:int, y:int, z:int):int{
return ((y ^ (x | ~(z))));
}
private static function transform(func:Function, a:int, b:int, c:int, d:int, x:int, s:int, t:int):int{
var tmp:int = (((a + int(func(b, c, d))) + x) + t);
return ((IntUtil.rol(tmp, s) + b));
}
private static function hh(a:int, b:int, c:int, d:int, x:int, s:int, t:int):int{
return (transform(h, a, b, c, d, x, s, t));
}
public static function hash(s:String):String{
var aa:int;
var bb:int;
var cc:int;
var dd:int;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
var x:Array = createBlocks(s);
var len:int = x.length;
var i:int;
while (i < len) {
aa = a;
bb = b;
cc = c;
dd = d;
a = ff(a, b, c, d, x[(i + 0)], 7, -680876936);
d = ff(d, a, b, c, x[(i + 1)], 12, -389564586);
c = ff(c, d, a, b, x[(i + 2)], 17, 606105819);
b = ff(b, c, d, a, x[(i + 3)], 22, -1044525330);
a = ff(a, b, c, d, x[(i + 4)], 7, -176418897);
d = ff(d, a, b, c, x[(i + 5)], 12, 1200080426);
c = ff(c, d, a, b, x[(i + 6)], 17, -1473231341);
b = ff(b, c, d, a, x[(i + 7)], 22, -45705983);
a = ff(a, b, c, d, x[(i + 8)], 7, 1770035416);
d = ff(d, a, b, c, x[(i + 9)], 12, -1958414417);
c = ff(c, d, a, b, x[(i + 10)], 17, -42063);
b = ff(b, c, d, a, x[(i + 11)], 22, -1990404162);
a = ff(a, b, c, d, x[(i + 12)], 7, 1804603682);
d = ff(d, a, b, c, x[(i + 13)], 12, -40341101);
c = ff(c, d, a, b, x[(i + 14)], 17, -1502002290);
b = ff(b, c, d, a, x[(i + 15)], 22, 1236535329);
a = gg(a, b, c, d, x[(i + 1)], 5, -165796510);
d = gg(d, a, b, c, x[(i + 6)], 9, -1069501632);
c = gg(c, d, a, b, x[(i + 11)], 14, 643717713);
b = gg(b, c, d, a, x[(i + 0)], 20, -373897302);
a = gg(a, b, c, d, x[(i + 5)], 5, -701558691);
d = gg(d, a, b, c, x[(i + 10)], 9, 38016083);
c = gg(c, d, a, b, x[(i + 15)], 14, -660478335);
b = gg(b, c, d, a, x[(i + 4)], 20, -405537848);
a = gg(a, b, c, d, x[(i + 9)], 5, 568446438);
d = gg(d, a, b, c, x[(i + 14)], 9, -1019803690);
c = gg(c, d, a, b, x[(i + 3)], 14, -187363961);
b = gg(b, c, d, a, x[(i + 8)], 20, 1163531501);
a = gg(a, b, c, d, x[(i + 13)], 5, -1444681467);
d = gg(d, a, b, c, x[(i + 2)], 9, -51403784);
c = gg(c, d, a, b, x[(i + 7)], 14, 1735328473);
b = gg(b, c, d, a, x[(i + 12)], 20, -1926607734);
a = hh(a, b, c, d, x[(i + 5)], 4, -378558);
d = hh(d, a, b, c, x[(i + 8)], 11, -2022574463);
c = hh(c, d, a, b, x[(i + 11)], 16, 1839030562);
b = hh(b, c, d, a, x[(i + 14)], 23, -35309556);
a = hh(a, b, c, d, x[(i + 1)], 4, -1530992060);
d = hh(d, a, b, c, x[(i + 4)], 11, 1272893353);
c = hh(c, d, a, b, x[(i + 7)], 16, -155497632);
b = hh(b, c, d, a, x[(i + 10)], 23, -1094730640);
a = hh(a, b, c, d, x[(i + 13)], 4, 681279174);
d = hh(d, a, b, c, x[(i + 0)], 11, -358537222);
c = hh(c, d, a, b, x[(i + 3)], 16, -722521979);
b = hh(b, c, d, a, x[(i + 6)], 23, 76029189);
a = hh(a, b, c, d, x[(i + 9)], 4, -640364487);
d = hh(d, a, b, c, x[(i + 12)], 11, -421815835);
c = hh(c, d, a, b, x[(i + 15)], 16, 530742520);
b = hh(b, c, d, a, x[(i + 2)], 23, -995338651);
a = ii(a, b, c, d, x[(i + 0)], 6, -198630844);
d = ii(d, a, b, c, x[(i + 7)], 10, 1126891415);
c = ii(c, d, a, b, x[(i + 14)], 15, -1416354905);
b = ii(b, c, d, a, x[(i + 5)], 21, -57434055);
a = ii(a, b, c, d, x[(i + 12)], 6, 1700485571);
d = ii(d, a, b, c, x[(i + 3)], 10, -1894986606);
c = ii(c, d, a, b, x[(i + 10)], 15, -1051523);
b = ii(b, c, d, a, x[(i + 1)], 21, -2054922799);
a = ii(a, b, c, d, x[(i + 8)], 6, 1873313359);
d = ii(d, a, b, c, x[(i + 15)], 10, -30611744);
c = ii(c, d, a, b, x[(i + 6)], 15, -1560198380);
b = ii(b, c, d, a, x[(i + 13)], 21, 1309151649);
a = ii(a, b, c, d, x[(i + 4)], 6, -145523070);
d = ii(d, a, b, c, x[(i + 11)], 10, -1120210379);
c = ii(c, d, a, b, x[(i + 2)], 15, 718787259);
b = ii(b, c, d, a, x[(i + 9)], 21, -343485551);
a = (a + aa);
b = (b + bb);
c = (c + cc);
d = (d + dd);
i = (i + 16);
};
return ((((IntUtil.toHex(a) + IntUtil.toHex(b)) + IntUtil.toHex(c)) + IntUtil.toHex(d)));
}
private static function gg(a:int, b:int, c:int, d:int, x:int, s:int, t:int):int{
return (transform(g, a, b, c, d, x, s, t));
}
}
}//package com.adobe.crypto
Section 5
//IntUtil (com.adobe.utils.IntUtil)
package com.adobe.utils {
public class IntUtil {
private static var hexChars:String = "0123456789abcdef";
public function IntUtil(){
super();
}
public static function toHex(n:int, bigEndian:Boolean=false):String{
var i:int;
var x:int;
var s:String = "";
if (bigEndian){
i = 0;
while (i < 4) {
s = (s + (hexChars.charAt(((n >> (((3 - i) * 8) + 4)) & 15)) + hexChars.charAt(((n >> ((3 - i) * 8)) & 15))));
i++;
};
} else {
x = 0;
while (x < 4) {
s = (s + (hexChars.charAt(((n >> ((x * 8) + 4)) & 15)) + hexChars.charAt(((n >> (x * 8)) & 15))));
x++;
};
};
return (s);
}
public static function ror(x:int, n:int):uint{
var nn:int = (32 - n);
return (((x << nn) | (x >>> (32 - nn))));
}
public static function rol(x:int, n:int):int{
return (((x << n) | (x >>> (32 - n))));
}
}
}//package com.adobe.utils
Section 6
//ClickHandler (com.adultswim.Preroll.ClickHandler)
package com.adultswim.Preroll {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class ClickHandler extends Sprite {
private var stream:Object;
private var stageHeight:Number;
private var oStage:Object;
private var strDomain:String;
private var gameName:String;
private var mcLogo:Object;
private var blackBg:Object;
private var stageWidth:Number;
private var mcPlay:Object;
private var oRoot:Object;
private var gameMethod:Function;
private var video:Object;
public function ClickHandler(){
mcPlay = GlobalVarContainer.vars.mcPlay;
mcLogo = GlobalVarContainer.vars.mcLogo;
oStage = GlobalVarContainer.vars.stage;
oRoot = GlobalVarContainer.vars.root;
stageWidth = GlobalVarContainer.vars.stageWidth;
stageHeight = GlobalVarContainer.vars.stageHeight;
stream = GlobalVarContainer.vars.stream;
video = GlobalVarContainer.vars.video;
blackBg = GlobalVarContainer.vars.blackBg;
gameName = GlobalVarContainer.vars.gameName;
strDomain = GlobalVarContainer.vars.strDomain;
gameMethod = GlobalVarContainer.vars.gameMethod;
super();
trace("ClickHandler initiated");
oStage.addEventListener(MouseEvent.CLICK, clickHandler);
}
private function clickHandler(event:MouseEvent):void{
switch (true){
case mcPlay.hitTestPoint(oStage.mouseX, oStage.mouseY, true):
trace("mcPlay", this, this["parent"]);
oStage.removeChild(mcPlay);
oStage.removeChild(mcLogo);
oStage.removeChild(video);
oStage.removeChild(blackBg);
oStage.removeEventListener(MouseEvent.CLICK, clickHandler);
gameMethod();
break;
case mcLogo.hitTestPoint(oStage.mouseX, oStage.mouseY, true):
goToURL(true);
trace("mcLogo");
break;
default:
goToURL(GlobalVarContainer.vars.bReady);
trace("clickHandler activated");
break;
};
GlobalVarContainer.vars.stream.resume();
}
private function goToURL(bPrerollEnd:Boolean=false):void{
var strURI:String = "http://games.adultswim.com";
var strPrerollState:String = "";
switch (bPrerollEnd){
case true:
strPrerollState = "_end";
break;
default:
break;
};
var variables:URLVariables = new URLVariables();
variables.cid = ((((("GAME_Ext_" + gameName) + "_") + strDomain) + "_preroll") + strPrerollState);
trace("variables.cid", variables.cid);
var request:URLRequest = new URLRequest(strURI);
request.data = variables;
navigateToURL(request, "_blank");
}
}
}//package com.adultswim.Preroll
Section 7
//GetVars (com.adultswim.Preroll.GetVars)
package com.adultswim.Preroll {
import flash.display.*;
import flash.net.*;
public class GetVars extends Sprite {
private var oRoot:Object;
private var my_lc:LocalConnection;
public function GetVars(){
oRoot = GlobalVarContainer.vars.root;
my_lc = new LocalConnection();
super();
trace("~~~~", oRoot, GlobalVarContainer.vars.strBase);
switch (oRoot.loaderInfo.parameters.strBase){
case undefined:
case null:
case "":
GlobalVarContainer.vars.strBase = (("http://i.cdn.turner.com/adultswim/games/hs/" + GlobalVarContainer.vars.gameName) + "/");
break;
default:
GlobalVarContainer.vars.strBase = oRoot.loaderInfo.parameters.strBase;
//unresolved jump
var _slot1 = e;
break;
};
switch (oRoot.loaderInfo.parameters.strDomain){
case undefined:
case null:
case "":
GlobalVarContainer.vars.strDomain = my_lc.domain;
break;
default:
GlobalVarContainer.vars.strDomain = oRoot.loaderInfo.parameters.strDomain;
//unresolved jump
var _slot1 = e;
break;
};
}
}
}//package com.adultswim.Preroll
Section 8
//GlobalVarContainer (com.adultswim.Preroll.GlobalVarContainer)
package com.adultswim.Preroll {
public class GlobalVarContainer {
public static var vars:Object = [];
public function GlobalVarContainer(){
super();
}
}
}//package com.adultswim.Preroll
Section 9
//Navigation (com.adultswim.Preroll.Navigation)
package com.adultswim.Preroll {
import flash.events.*;
import flash.display.*;
public class Navigation extends Sprite {
private var stream:Object;
private var mcLogo:Object;
private var stageHeight:Number;
private var stageWidth:Number;
private var oStage:Object;
private var mcPlay:Object;
public function Navigation(){
mcPlay = GlobalVarContainer.vars.mcPlay;
mcLogo = GlobalVarContainer.vars.mcLogo;
oStage = GlobalVarContainer.vars.stage;
stageWidth = GlobalVarContainer.vars.stageWidth;
stageHeight = GlobalVarContainer.vars.stageHeight;
stream = GlobalVarContainer.vars.stream;
super();
trace("Navigation initiated");
mcPlay.x = ((stageWidth / 2) - (mcPlay.width / 2));
mcLogo.x = ((stageWidth / 2) - (mcLogo.width / 2));
mcPlay.y = ((stageHeight / 2) - (mcPlay.height / 2));
mcLogo.y = (mcPlay.y - 70);
mcPlay.buttonMode = true;
mcLogo.buttonMode = true;
oStage.addChild(mcPlay);
oStage.addChild(mcLogo);
mcPlay.addEventListener(MouseEvent.MOUSE_OVER, mouseover);
mcPlay.addEventListener(MouseEvent.MOUSE_OUT, mouseout);
mcLogo.addEventListener(MouseEvent.MOUSE_OVER, mouseover);
mcLogo.addEventListener(MouseEvent.MOUSE_OUT, mouseout);
}
private function mouseout(event:MouseEvent):void{
event.target.gotoAndPlay(1);
}
private function mouseover(event:MouseEvent):void{
event.target.gotoAndPlay(2);
}
}
}//package com.adultswim.Preroll
Section 10
//NetStreamer (com.adultswim.Preroll.NetStreamer)
package com.adultswim.Preroll {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.media.*;
public class NetStreamer extends Sprite {
public var nav:Navigation;
private var stageHeight:Number;
private var stream:NetStream;
private var stageWidth:Number;
private var connection:NetConnection;
private var oStage:Object;
private var oVideo:Object;
private var videoURL:String;
private var flvWidth:Number;
private var flvHeight:Number;
public function NetStreamer(){
flvHeight = GlobalVarContainer.vars.flvHeight;
flvWidth = GlobalVarContainer.vars.flvWidth;
oStage = GlobalVarContainer.vars.stage;
stageHeight = GlobalVarContainer.vars.stageHeight;
stageWidth = GlobalVarContainer.vars.stageWidth;
videoURL = GlobalVarContainer.vars.flvPath;
super();
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
connection.connect(null);
}
private function securityErrorHandler(event:SecurityErrorEvent):void{
trace(("securityErrorHandler: " + event));
}
private function connectStream():void{
stream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
stream.client = new CustomClient();
var blackBg:Sprite = new Sprite();
blackBg.graphics.beginFill(0);
blackBg.graphics.drawRect(0, 0, stageWidth, stageHeight);
oStage.addChild(blackBg);
GlobalVarContainer.vars.blackBg = blackBg;
var video:Video = new Video();
GlobalVarContainer.vars.video = video;
trace(((("!!!!!!!! width: " + flvWidth) + " : ") + flvHeight));
video.x = ((stageWidth - flvWidth) / 2);
video.y = ((stageHeight - flvHeight) / 2);
video.width = flvWidth;
video.height = flvHeight;
video.attachNetStream(stream);
stream.play(videoURL);
GlobalVarContainer.vars.stream = stream;
oStage.addChild(video);
var mc:MovieClip = new MovieClip();
}
private function netStatusHandler(event:NetStatusEvent):void{
switch (event.info.code){
case "NetConnection.Connect.Success":
connectStream();
break;
case "NetStream.Play.StreamNotFound":
trace(("Stream not found: " + videoURL));
break;
case "NetStream.Play.Stop":
trace("All Stop, Aye");
GlobalVarContainer.vars.bReady = true;
nav = new Navigation();
break;
default:
break;
};
}
}
}//package com.adultswim.Preroll
class CustomClient {
private function CustomClient(){
super();
}
public function onCuePoint(info:Object):void{
trace(((((("cuepoint: time=" + info.time) + " name=") + info.name) + " type=") + info.type));
}
public function onXMPData(infoObject:Object):void{
}
public function onMetaData(info:Object):void{
trace(((((((("metadata: duration=" + info.duration) + " width=") + info.width) + " height=") + info.height) + " framerate=") + info.framerate));
}
}
Section 11
//Preroller (com.adultswim.Preroll.Preroller)
package com.adultswim.Preroll {
import flash.display.*;
import flash.net.*;
public class Preroller extends Sprite {
private var clickHandler:ClickHandler;
private var myVid:NetStreamer;
private var oStage:Object;
private var oRoot:Object;
private var my_lc:LocalConnection;
private var getVars:GetVars;
public function Preroller(){
my_lc = new LocalConnection();
super();
trace("!@", my_lc.domain);
switch (stage){
case null:
case undefined:
case "":
oStage = GlobalVarContainer.vars.stage;
trace("@@@@stage is null. Now set to object: ", oStage);
break;
default:
oStage = stage;
trace("@@@@stage is available!");
break;
};
switch (root){
case null:
case undefined:
case "":
oRoot = GlobalVarContainer.vars.root;
trace("####root is null. Now set to object: ", oStage);
break;
default:
oRoot = root;
trace("####root is available!");
break;
};
trace("$$$$jumbotron", oStage, oRoot, "::", GlobalVarContainer.vars.root);
getVars = new GetVars();
myVid = new NetStreamer();
clickHandler = new ClickHandler();
}
}
}//package com.adultswim.Preroll
Section 12
//Main (com.adultswim.Main)
package com.adultswim {
import flash.events.*;
import flash.display.*;
import prerollAssets.*;
import com.adultswim.Preroll.*;
public class Main extends Sprite {
private var logo:mc_preroll_logo;
private var Preroller:Preroller;
private var oStage:Object;
private var oRoot:Object;
private var re:RegExp;
private var play:mc_preroll_play;
public function Main():void{
re = new RegExp("http://i.cdn.turner.com/adultswim/games/game/tools/swf/wsg-(\\d+)x(\\d+).flv", "i");
logo = new mc_preroll_logo();
play = new mc_preroll_play();
super();
switch (this.stage){
case null:
oStage = GlobalVarContainer.vars.stage;
trace("@@@@stage is null. Now set to object: ", oStage);
break;
default:
oStage = stage;
GlobalVarContainer.vars.stage = oStage;
trace("@@@@stage is available!");
break;
};
switch (this.root){
case null:
oRoot = GlobalVarContainer.vars.root;
trace("####root is null. Now set to object: ", oRoot);
break;
default:
oRoot = root;
GlobalVarContainer.vars.root = oRoot;
trace("####root is available!");
break;
};
trace("MAIN0");
if (oStage){
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, init);
};
}
private function init(e:Event=null):void{
trace("INIT0");
removeEventListener(Event.ADDED_TO_STAGE, init);
GlobalVarContainer.vars.flvPath = "http://i.cdn.turner.com/adultswim/games/game/tools/swf/wsg-700x500.flv";
GlobalVarContainer.vars.flvWidth = parseInt(GlobalVarContainer.vars.flvPath.replace(re, "$1"));
GlobalVarContainer.vars.flvHeight = parseInt(GlobalVarContainer.vars.flvPath.replace(re, "$2"));
GlobalVarContainer.vars.stageWidth = oStage.stageWidth;
GlobalVarContainer.vars.stageHeight = oStage.stageHeight;
GlobalVarContainer.vars.mcLogo = logo;
GlobalVarContainer.vars.mcPlay = play;
Preroller = new Preroller();
}
}
}//package com.adultswim
Section 13
//IValidData (com.liquable.data.IValidData)
package com.liquable.data {
public interface IValidData {
function isValid():Boolean;
}
}//package com.liquable.data
Section 14
//AStar (com.liquable.game.astar.AStar)
package com.liquable.game.astar {
import com.liquable.game.geom.*;
public class AStar {
private var pDirections:Array;
private var pMap:IAStarMap;
private static const sOrthogonalDirections:Array = [new PointInt(1, 0), new PointInt(-1, 0), new PointInt(0, 1), new PointInt(0, -1)];
private static const sDiagonalDirections:Array = [new PointInt(1, 1), new PointInt(1, -1), new PointInt(-1, 1), new PointInt(-1, -1)];
public static const IMPASSABLE_COST:Number = 1.79769313486232E308;
public function AStar(map:IAStarMap, enableDiagonal:Boolean){
super();
pMap = map;
if (enableDiagonal){
pDirections = sDiagonalDirections.concat(sOrthogonalDirections);
} else {
pDirections = sOrthogonalDirections;
};
}
public function getMap():IAStarMap{
return (pMap);
}
public function findPath(moveObject, inSrcX:int, inSrcY:int, inDstX:int, inDstY:int, maxTries:int):Array{
var node:AStarNode;
var direction:PointInt;
var min:Number;
var cost:Number;
var newX:int;
var newY:int;
var pt:PointInt;
var outPath:Array = new Array();
var openList:Object = new Object();
var openSize:int;
var closedList:Object = new Object();
var currNode:AStarNode = new AStarNode(null, inSrcX, inSrcY);
var foundPath:Boolean;
closedList[currNode.id] = currNode;
var isInBlock:int = pMap.getPassCost(moveObject, inSrcX, inSrcY, inDstX, inDstY);
if (isInBlock == IMPASSABLE_COST){
return (outPath);
};
var bestNode:AStarNode;
while (!(foundPath)) {
if (maxTries > 0){
--maxTries;
if (maxTries == 0){
break;
};
};
if (openSize > 0){
if (bestNode){
if (openList.hasOwnProperty(bestNode.id)){
currNode = openList[bestNode.id];
};
};
if (currNode == null){
min = IMPASSABLE_COST;
for each (node in openList) {
cost = node.fCost;
if (cost < min){
min = cost;
currNode = node;
};
};
};
bestNode = currNode;
closedList[currNode.id] = currNode;
delete openList[currNode.id];
openSize--;
};
if (currNode == null){
break;
};
for each (direction in pDirections) {
newX = (currNode.x + direction.x);
newY = (currNode.y + direction.y);
cost = pMap.getPassCost(moveObject, currNode.x, currNode.y, newX, newY);
if (cost == IMPASSABLE_COST){
} else {
if (((!((direction.x == 0))) && (!((direction.y == 0))))){
//unresolved if
} else {
node = new AStarNode(currNode, newX, newY);
if (pMap.getReachedDestination(moveObject, node.x, node.y, inDstX, inDstY)){
currNode = node;
foundPath = true;
break;
};
if (closedList.hasOwnProperty(node.id)){
} else {
node.gCost = (currNode.gCost + cost);
node.fCost = (node.gCost + pMap.getFCost(moveObject, node.x, node.y, inDstX, inDstY));
if (!openList.hasOwnProperty(node.id)){
openList[node.id] = node;
openSize++;
} else {
if (node.gCost < openList[node.id].gCost){
openList[node.id] = node;
} else {
node = null;
};
};
if (node){
if ((((bestNode == null)) || ((node.fCost < bestNode.fCost)))){
bestNode = node;
};
};
};
};
};
};
if (!foundPath){
currNode = null;
};
};
if (foundPath){
node = currNode;
while (node.parent) {
pt = new PointInt(node.x, node.y);
outPath.unshift(pt);
node = node.parent;
};
};
return (outPath);
}
}
}//package com.liquable.game.astar
Section 15
//AStarNode (com.liquable.game.astar.AStarNode)
package com.liquable.game.astar {
import com.liquable.game.geom.*;
class AStarNode extends PointInt {
public var fCost:Number;
public var gCost:Number;
private var pParent:AStarNode;
private var pID:String;
function AStarNode(parent:AStarNode, inx:int, iny:int){
super(inx, iny);
pID = toString();
pParent = parent;
gCost = (fCost = 0);
}
public function get id():String{
return (pID);
}
public function get parent():AStarNode{
return (pParent);
}
}
}//package com.liquable.game.astar
Section 16
//IAStarMap (com.liquable.game.astar.IAStarMap)
package com.liquable.game.astar {
public interface IAStarMap {
function getReachedDestination(_arg1, _arg2:int, _arg3:int, _arg4:int, _arg5:int):Boolean;
function getPassCost(_arg1, _arg2:int, _arg3:int, _arg4:int, _arg5:int):Number;
function getFCost(_arg1, _arg2:int, _arg3:int, _arg4:int, _arg5:int):Number;
}
}//package com.liquable.game.astar
Section 17
//GameCamera (com.liquable.game.camera.GameCamera)
package com.liquable.game.camera {
import flash.display.*;
import com.liquable.utils.*;
import flash.geom.*;
public class GameCamera implements ICameraObject {
private var pGameRoot:Sprite;
private var pFollowSpeed:Number;// = 0.5
private var pWidthHalf:Number;
private var pHeightHalf:Number;
private var pRectNeedUpdate:Boolean;
private var pFocusShift:Point;
private var pFocusObject:ICameraObject;
private var pGameArea:Rectangle;
private var pWidth:Number;
private var pHeight:Number;
private var pPosition:Point;
private var pZoomScale:Number;// = 1
private var pCameraArea:Rectangle;
private var pRect:Rectangle;
private var pFollowSpeedMax:Number;// = 1.79769313486232E308
public function GameCamera(inWidth:Number, inHeight:Number){
super();
pPosition = new Point();
pFocusShift = new Point();
pWidth = inWidth;
pHeight = inHeight;
pWidthHalf = (inWidth / 2);
pHeightHalf = (inHeight / 2);
pRect = new Rectangle(0, 0, pWidth, pHeight);
pRectNeedUpdate = true;
}
public function set y(iny:Number):void{
pPosition.y = iny;
}
public function get left():Number{
return (rect.left);
}
public function getGameArea():Rectangle{
return (pGameArea);
}
public function setFocus(obj:ICameraObject, shiftx:Number=0, shifty:Number=0):void{
pFocusObject = obj;
pFocusShift.x = shiftx;
pFocusShift.y = shifty;
}
public function get right():Number{
return (rect.right);
}
public function setGameArea(minX:Number, minY:Number, inWidth:Number, inHeight:Number):void{
pGameArea = new Rectangle(minX, minY, inWidth, inHeight);
updateCameraArea();
}
public function getFocus():ICameraObject{
return (pFocusObject);
}
public function get height():Number{
return (pHeight);
}
public function getScreenPosition(objX:Number, objY:Number):Point{
return (new Point((objX + pGameRoot.x), (objY + pGameRoot.y)));
}
public function set zoom(scale:Number):void{
pZoomScale = scale;
updateCameraArea();
setGameRoot(pGameRoot);
}
public function getGamePosition(screenX:Number, screenY:Number):Point{
return (new Point((screenX - pGameRoot.x), (screenY - pGameRoot.y)));
}
public function get bottom():Number{
return (rect.bottom);
}
public function get width():Number{
return (pWidth);
}
public function getCameraArea():Rectangle{
return (pCameraArea);
}
public function update():void{
if (pFocusObject){
pPosition.x = MathUtil.numberFollowTarget(pPosition.x, (pFocusObject.x + pFocusShift.x), pFollowSpeed, 1, pFollowSpeedMax);
pPosition.y = MathUtil.numberFollowTarget(pPosition.y, (pFocusObject.y + pFocusShift.y), pFollowSpeed, 1, pFollowSpeedMax);
};
pPosition.x = Math.max(pCameraArea.left, Math.min(pCameraArea.right, pPosition.x));
pPosition.y = Math.max(pCameraArea.top, Math.min(pCameraArea.bottom, pPosition.y));
pGameRoot.x = Math.round((pWidthHalf - (pPosition.x * pZoomScale)));
pGameRoot.y = Math.round((pHeightHalf - (pPosition.y * pZoomScale)));
pRectNeedUpdate = true;
}
public function get zoom():Number{
return (pZoomScale);
}
public function setFollowSpeed(speed:Number):void{
pFollowSpeed = speed;
}
public function get top():Number{
return (rect.top);
}
public function getFollowSpeed():Number{
return (pFollowSpeed);
}
public function get rect():Rectangle{
if (pRectNeedUpdate){
pRect.x = (pPosition.x - pWidthHalf);
pRect.y = (pPosition.y - pHeightHalf);
pRectNeedUpdate = false;
};
return (pRect);
}
public function getGameRoot():Sprite{
return (pGameRoot);
}
public function getFollowSpeedMax():Number{
return (pFollowSpeedMax);
}
public function setFollowSpeedMax(speed:Number):void{
pFollowSpeedMax = speed;
}
public function setGameRoot(root:Sprite):void{
pGameRoot = root;
if (pGameRoot){
pGameRoot.scaleX = (pGameRoot.scaleY = pZoomScale);
};
}
public function set x(inx:Number):void{
pPosition.x = inx;
}
public function get x():Number{
return (pPosition.x);
}
public function get y():Number{
return (pPosition.y);
}
private function updateCameraArea():void{
pCameraArea = new Rectangle((pGameArea.x + (pWidthHalf / pZoomScale)), (pGameArea.y + (pHeightHalf / pZoomScale)), (pGameArea.width - (pWidth / pZoomScale)), (pGameArea.height - (pHeight / pZoomScale)));
}
}
}//package com.liquable.game.camera
Section 18
//ICameraObject (com.liquable.game.camera.ICameraObject)
package com.liquable.game.camera {
public interface ICameraObject {
function get x():Number;
function get y():Number;
}
}//package com.liquable.game.camera
Section 19
//DebugConsole (com.liquable.game.debug.DebugConsole)
package com.liquable.game.debug {
import flash.display.*;
import flash.text.*;
public class DebugConsole extends Sprite {
private var consoleField:TextField;
public function DebugConsole(width:Number, height:Number){
super();
setDimension(width, height);
}
public function setDimension(width:Number, height:Number):void{
this.graphics.clear();
this.graphics.beginFill(0, 0.5);
this.graphics.drawRect(0, 0, width, height);
if (consoleField == null){
consoleField = new TextField();
consoleField.textColor = 0xFFFFFF;
consoleField.selectable = false;
consoleField.wordWrap = true;
consoleField.multiline = true;
this.addChild(consoleField);
};
consoleField.width = this.width;
consoleField.height = this.height;
}
public function println(value:String):void{
consoleField.text = ((value + "\n") + consoleField.text).substr(0, 1000);
}
}
}//package com.liquable.game.debug
Section 20
//DebugFpsMeter (com.liquable.game.debug.DebugFpsMeter)
package com.liquable.game.debug {
import com.liquable.game.*;
import flash.events.*;
import flash.utils.*;
public class DebugFpsMeter implements DebugItem {
private var pApplication:GameApplication;
private var pTimer:int;
private var pFrames:int;
private var pFps:Number;
private var pFramesToCount:int;// = 15
public function DebugFpsMeter(app:GameApplication){
super();
pApplication = app;
start();
}
public function start():DebugFpsMeter{
pTimer = getTimer();
pFrames = 0;
pApplication.addUpdateFunction(update);
return (this);
}
public function stop():DebugFpsMeter{
pApplication.removeUpdateFunction(update);
return (this);
}
public function setFramesToCount(frames:int):void{
pFramesToCount = frames;
}
private function update(e:Event):void{
var timer:int;
if (++pFrames == pFramesToCount){
timer = getTimer();
pFps = ((pFrames / (timer - pTimer)) * 1000);
pTimer = timer;
pFrames = 0;
};
}
public function toDebugString():String{
var stageFps:String = "invalid";
if (pApplication.getStage()){
stageFps = ("" + pApplication.getStage().frameRate);
};
return (((("" + Math.round(pFps)) + "/") + stageFps));
}
}
}//package com.liquable.game.debug
Section 21
//DebugItem (com.liquable.game.debug.DebugItem)
package com.liquable.game.debug {
public interface DebugItem {
function toDebugString():String;
}
}//package com.liquable.game.debug
Section 22
//DebugItemRenderer (com.liquable.game.debug.DebugItemRenderer)
package com.liquable.game.debug {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class DebugItemRenderer extends Sprite {
private var debugItem:DebugItem;
private var _title:String;
private var textField:TextField;
public function DebugItemRenderer(title:String, debugItem:DebugItem){
super();
_title = title;
this.debugItem = debugItem;
textField = new TextField();
textField.background = true;
textField.backgroundColor = 0;
textField.textColor = 0xFFFFFF;
textField.autoSize = TextFieldAutoSize.LEFT;
textField.selectable = false;
this.addChild(textField);
}
public function update(e:Event):void{
textField.text = (_title + getDebugString(debugItem));
}
public function terminate():void{
debugItem = null;
}
public function get title():String{
return (_title);
}
private static function getDebugString(debugItem:DebugItem):String{
var str:String;
var debugItem = debugItem;
str = (": " + debugItem.toDebugString());
//unresolved jump
var _slot1 = e;
str = ": invalid";
return (str);
}
}
}//package com.liquable.game.debug
Section 23
//DebugPanel (com.liquable.game.debug.DebugPanel)
package com.liquable.game.debug {
import com.liquable.game.*;
import flash.events.*;
import flash.display.*;
public class DebugPanel extends Sprite {
private var pApplication:GameApplication;
private var debugItemRenderers:Array;
private var debugConsole:DebugConsole;
public function DebugPanel(app:GameApplication){
super();
pApplication = app;
this.mouseEnabled = false;
this.mouseChildren = false;
debugItemRenderers = new Array();
this.visible = true;
}
public function getDebugConsole():DebugConsole{
var renderer:DebugItemRenderer;
if (debugConsole == null){
debugConsole = new DebugConsole(300, 200);
this.addChild(debugConsole);
for each (renderer in debugItemRenderers) {
renderer.x = (debugConsole.x + debugConsole.width);
};
};
return (debugConsole);
}
public function addDebugItem(uniqueTitle:String, debugItem:DebugItem):void{
var itemRenderer:DebugItemRenderer;
var emptyIndex = -1;
var index:int;
while (index < debugItemRenderers.length) {
itemRenderer = debugItemRenderers[index];
if (itemRenderer == null){
if (emptyIndex == -1){
emptyIndex = index;
};
} else {
if (itemRenderer.title == uniqueTitle){
return;
};
};
index++;
};
itemRenderer = new DebugItemRenderer(uniqueTitle, debugItem);
itemRenderer.y = (index * 18);
if (debugConsole){
itemRenderer.x = (debugConsole.x + debugConsole.width);
};
this.addChild(itemRenderer);
debugItemRenderers[((emptyIndex == -1)) ? debugItemRenderers.length : emptyIndex] = itemRenderer;
}
public function update(e:Event):void{
var renderer:DebugItemRenderer;
for each (renderer in this.debugItemRenderers) {
if (renderer){
renderer.update(e);
};
};
}
override public function set visible(value:Boolean):void{
super.visible = value;
if (this.visible){
pApplication.addUpdateFunction(update);
} else {
pApplication.removeUpdateFunction(update);
};
}
}
}//package com.liquable.game.debug
Section 24
//DebugTagValueWatcher (com.liquable.game.debug.DebugTagValueWatcher)
package com.liquable.game.debug {
import com.liquable.utils.*;
public class DebugTagValueWatcher implements DebugItem {
private var pValue:Object;
private static var _sConstructorLock:Boolean = true;
private static var _sWatcherPool:Object;
public function DebugTagValueWatcher(){
super();
DesignContract.preCondition((_sConstructorLock == false), "Please use the static function getById() to get an instance.");
}
public function toDebugString():String{
return (pValue.toString());
}
public function setValue(value:Object):DebugTagValueWatcher{
pValue = value;
return (this);
}
public static function getById(id:String):DebugTagValueWatcher{
if (_sWatcherPool == null){
_sWatcherPool = new Object();
};
if (!_sWatcherPool.hasOwnProperty(id)){
_sConstructorLock = false;
_sWatcherPool[id] = new (DebugTagValueWatcher);
_sConstructorLock = true;
};
return (_sWatcherPool[id]);
}
}
}//package com.liquable.game.debug
Section 25
//GameApplicationUpdateErrorEvent (com.liquable.game.events.GameApplicationUpdateErrorEvent)
package com.liquable.game.events {
import flash.events.*;
public class GameApplicationUpdateErrorEvent extends ErrorEvent {
private var pStackTrace:String;
public static const GAME_APPLICATION_UPDATE_ERROR:String = "gameApplicationUpdateError";
public function GameApplicationUpdateErrorEvent(type:String, text:String, stackTrace:String, bubbles:Boolean=false, cancelable:Boolean=false){
super(type, bubbles, cancelable, text);
pStackTrace = stackTrace;
}
public function get stackTrace():String{
return (pStackTrace);
}
override public function clone():Event{
return (new GameApplicationUpdateErrorEvent(type, text, pStackTrace, bubbles, cancelable));
}
}
}//package com.liquable.game.events
Section 26
//GameApplicationUpdateEvent (com.liquable.game.events.GameApplicationUpdateEvent)
package com.liquable.game.events {
import flash.events.*;
public class GameApplicationUpdateEvent extends Event {
private var pNeedUpdate:Boolean;
private var pTime:int;
public static const GAME_APPLICATION_UPDATE:String = "gameApplicationUpdate";
public function GameApplicationUpdateEvent(type:String, time:int, needUpdate:Boolean, bubbles:Boolean=false, cancelable:Boolean=false){
super(type, bubbles, cancelable);
pNeedUpdate = needUpdate;
}
public function get time():int{
return (pTime);
}
public function reset(_time:int, _needUpdate:Boolean):void{
pTime = _time;
pNeedUpdate = _needUpdate;
}
override public function clone():Event{
return (new GameApplicationUpdateEvent(type, time, needUpdate, bubbles, cancelable));
}
public function get needUpdate():Boolean{
return (pNeedUpdate);
}
}
}//package com.liquable.game.events
Section 27
//ColorAdapter (com.liquable.game.geom.ColorAdapter)
package com.liquable.game.geom {
public class ColorAdapter {
private var pColorValue:uint;
private var pAlpha:Number;
public function ColorAdapter(color:uint=0, alpha:Number=1){
super();
setColor(color);
this.alpha = alpha;
}
private function saveGetByte(value:int):int{
return (Math.min(0xFF, Math.max(0, value)));
}
public function set red(value:int):void{
pColorValue = ((pColorValue & 0xFFFF) | (getByte(value) << 16));
}
public function set green(value:int):void{
pColorValue = ((pColorValue & 0xFF00FF) | (getByte(value) << 8));
}
public function mixColor(color:ColorAdapter, percent:Number):void{
mix(color.red, color.green, color.blue, percent);
}
public function setColor(color:uint):void{
pColorValue = color;
}
public function addColor(color:ColorAdapter):void{
add(color.red, color.green, color.blue);
}
public function get color():uint{
return (pColorValue);
}
public function setRGB(red:int, green:int, blue:int):void{
pColorValue = (((getByte(red) << 16) | (getByte(green) << 8)) | getByte(blue));
}
public function toMatrixForFilter(percent:Number):Array{
percent = Math.max(0, Math.min(1, percent));
var rPercent:Number = (1 - percent);
var matrix:Array = new Array();
matrix = matrix.concat([rPercent, 0, 0, 0, Math.round((red * percent))]);
matrix = matrix.concat([0, rPercent, 0, 0, Math.round((green * percent))]);
matrix = matrix.concat([0, 0, rPercent, 0, Math.round((blue * percent))]);
matrix = matrix.concat([0, 0, 0, pAlpha, 0]);
return (matrix);
}
public function get alpha():Number{
return (pAlpha);
}
public function add(red:int, green:int, blue:int):void{
setRGB(saveGetByte((this.red + red)), saveGetByte((this.green + green)), saveGetByte((this.blue + blue)));
}
public function get red():int{
return (getByte((pColorValue >> 16)));
}
public function duplicate():ColorAdapter{
return (new ColorAdapter(pColorValue));
}
private function saveScaleByte(value:int, scale:Number):int{
return (saveGetByte(Math.round((value * scale))));
}
public function scale(redScale:Number, greenScale:Number, blueScale:Number):void{
setRGB(saveScaleByte(red, redScale), saveScaleByte(green, greenScale), saveScaleByte(blue, blueScale));
}
public function get blue():int{
return (getByte(pColorValue));
}
public function get green():int{
return (getByte((pColorValue >> 8)));
}
public function set alpha(value:Number):void{
pAlpha = Math.max(0, Math.min(1, value));
}
private function getByte(value:int):int{
return ((value & 0xFF));
}
public function mix(red:int, green:int, blue:int, percent:Number):void{
var invertPercent:Number = (1 - percent);
setRGB((saveScaleByte(this.red, invertPercent) + saveScaleByte(red, percent)), (saveScaleByte(this.green, invertPercent) + saveScaleByte(green, percent)), (saveScaleByte(this.blue, invertPercent) + saveScaleByte(blue, percent)));
}
}
}//package com.liquable.game.geom
Section 28
//PointInt (com.liquable.game.geom.PointInt)
package com.liquable.game.geom {
public class PointInt {
public var x:int;
public var y:int;
public function PointInt(inx:int=0, iny:int=0){
super();
x = inx;
y = iny;
}
public function getPerpendicularDistance(p:PointInt):int{
return ((Math.abs((p.x - x)) + Math.abs((p.y - y))));
}
public function clonePointInt():PointInt{
return (new PointInt(x, y));
}
public function toString():String{
return (makeString(x, y));
}
public function equals(p:PointInt):Boolean{
if ((((((p == null)) || (!((p.x == x))))) || (!((p.y == y))))){
return (false);
};
return (true);
}
public static function fromString(param:String):PointInt{
var params:Array = param.split(",");
if (params.length == 2){
return (new PointInt(parseInt(params[0]), parseInt(params[1])));
};
return (null);
}
public static function makeString(inx:int, iny:int):String{
return (((("" + inx) + ",") + iny));
}
}
}//package com.liquable.game.geom
Section 29
//IPostData (com.liquable.game.postoffice.IPostData)
package com.liquable.game.postoffice {
public interface IPostData {
function get data_type():String;
}
}//package com.liquable.game.postoffice
Section 30
//PostClient (com.liquable.game.postoffice.PostClient)
package com.liquable.game.postoffice {
import com.liquable.game.*;
public class PostClient {
private var pReceivePostFunction:Function;
private var pPostOffice:PostOffice;
private var pPostId:String;
public function PostClient(manager){
super();
if ((manager is PostOffice)){
pPostOffice = PostOffice(manager);
} else {
if ((manager is GameApplication)){
pPostOffice = GameApplication(manager).getPostOffice();
} else {
throw (new Error("new PostClient(manager:Object): manager has to be either PostOffice or GameApplication"));
};
};
}
public function unsubscribe(inTopic:String):void{
pPostOffice.removeClient(inTopic, this);
}
public function destroy():void{
pPostOffice.removeClient(null, this);
pPostOffice = null;
pReceivePostFunction = null;
}
function receivePost(post:PostPackage):void{
if (((post.isValid()) && (!((pReceivePostFunction == null))))){
pReceivePostFunction(post);
};
}
public function subscribe(inTopic:String):void{
pPostOffice.addClient(inTopic, this);
}
public function getPostId():String{
return (pPostId);
}
public function getPostOffice():PostOffice{
return (pPostOffice);
}
public function setReceivePostFunction(func:Function):void{
pReceivePostFunction = func;
}
public function setPostId(postId:String):void{
pPostId = postId;
subscribe(pPostId);
}
public function sendMessage(inTopic:String, inData:IPostData, inDelay:int=0, receiverList:Array=null):void{
pPostOffice.sendMessage(pPostId, inTopic, inData, inDelay, receiverList);
}
}
}//package com.liquable.game.postoffice
Section 31
//PostOffice (com.liquable.game.postoffice.PostOffice)
package com.liquable.game.postoffice {
import com.liquable.game.*;
import flash.events.*;
import com.liquable.utils.*;
import flash.utils.*;
public final class PostOffice {
private var pApplication:GameApplication;
private var pTopicClients:Object;
private var pTimer:int;
private var pActive:Boolean;
private var pTimeUnitType:int;
private var pDelayedPackages:Array;
public static const TIME_UNIT_FRAME:int = TIME_UNIT_TYPE.nextIndex();
public static const TIME_UNIT_MILLISECONDS:int = TIME_UNIT_TYPE.nextIndex();
private static var TIME_UNIT_TYPE:Enum = new Enum();
public function PostOffice(app:GameApplication, time_unit_type:int){
super();
pApplication = app;
pTimeUnitType = time_unit_type;
reset();
}
public function terminate():void{
var clients:Array;
var client:PostClient;
stop();
for each (clients in pTopicClients) {
for each (client in clients) {
client.destroy();
};
};
pDelayedPackages = null;
pTopicClients = null;
}
public function start():void{
if (!pActive){
pActive = true;
pApplication.addUpdateFunction(update);
};
}
private function sendPostPackageToClients(post:PostPackage, clients:Array):void{
var i:int;
while (i < clients.length) {
clients[i].receivePost(post);
i++;
};
}
public function addClient(inTopic:String, inClient:PostClient):void{
DesignContract.preCondition(!((inClient == null)), "Bad Parameter Receiver is either invalid or does not exist");
var clients:Array = getTopicClients(inTopic);
DesignContract.preCondition(!((clients == null)), ("Tried to Add a receiver to a topic that does not exist!" + inTopic));
ArrayUtil.addArrayUniqueElement(clients, inClient);
}
private function sendPostPackage(post:PostPackage):void{
DesignContract.preCondition(!((post == null)), "Tried to send a null PostPackage!");
var clients:Array = getTopicClients(post.mTopic);
if (clients == null){
clients = new Array();
} else {
clients = clients.concat();
};
if (post.mReceiverList){
clients = ArrayUtil.arrayMerge(clients, post.mReceiverList);
};
sendPostPackageToClients(post, clients);
}
public function sendMessage(senderId:String, inTopic:String, inData:IPostData, inDelay:int=0, receiverList:Array=null):void{
if (!pActive){
return;
};
var post:PostPackage = new PostPackage(senderId, inTopic, inData, receiverList);
if (inDelay > 0){
post.mTimeToSend = (pTimer + inDelay);
pDelayedPackages.push(post);
pDelayedPackages.sortOn("timeToSend", Array.NUMERIC);
} else {
sendPostPackage(post);
};
}
public function removeClient(inTopic:String, inClient:PostClient):void{
var topic:String;
var clients:Array;
DesignContract.preCondition(!((inClient == null)), "Bad Parameter Receiver is either invalid or does not exist");
if (inTopic == null){
for (topic in pTopicClients) {
removeClient(topic, inClient);
};
} else {
clients = getTopicClients(inTopic);
DesignContract.preCondition(!((clients == null)), ("Tried to Remove a receiver from a topic that does not exist!" + inTopic));
ArrayUtil.removeArrayElement(clients, inClient);
if (clients.length == 0){
delete pTopicClients[inTopic];
};
};
}
public function reset():void{
pTopicClients = new Object();
pDelayedPackages = new Array();
pTimer = ((pTimeUnitType == TIME_UNIT_FRAME)) ? 0 : getTimer();
}
public function removeDelayedMessage(senderId:String, inTopic:String):void{
var post:PostPackage;
var i:int;
while (i < pDelayedPackages.length) {
post = pDelayedPackages[i];
if ((((post.mSenderId == senderId)) && ((post.mTopic == inTopic)))){
post.setInvalid();
};
i++;
};
}
public function stop():void{
if (pActive){
pActive = false;
pApplication.removeUpdateFunction(update);
};
}
private function update(e:Event):void{
var post:PostPackage;
if (pActive){
if (pTimeUnitType == TIME_UNIT_FRAME){
pTimer++;
} else {
pTimer = getTimer();
};
while (pDelayedPackages.length > 0) {
post = pDelayedPackages[0];
if (post.mTimeToSend > pTimer){
break;
};
pDelayedPackages.shift();
sendPostPackage(post);
};
};
}
private function getTopicClients(inTopic:String):Array{
DesignContract.preCondition(!((inTopic == null)), "Tried to get a null/undefined topic!");
var clients:Array = pTopicClients[inTopic];
if (clients == null){
clients = new Array();
pTopicClients[inTopic] = clients;
};
return (clients);
}
}
}//package com.liquable.game.postoffice
Section 32
//PostPackage (com.liquable.game.postoffice.PostPackage)
package com.liquable.game.postoffice {
import com.liquable.data.*;
public class PostPackage implements IValidData {
var mTopic:String;
var mSenderId:String;
var mData:IPostData;
var mReceiverList:Array;
var mTimeToSend:int;// = 0
public function PostPackage(inSenderId:String, inTopic:String, inData:IPostData, receiverList:Array){
super();
mSenderId = inSenderId;
mTopic = inTopic;
mData = inData;
mReceiverList = receiverList;
}
public function get data():IPostData{
return (mData);
}
public function get topic():String{
return (mTopic);
}
public function get timeToSend():int{
return (mTimeToSend);
}
public function isValid():Boolean{
return (!((mTimeToSend == -1)));
}
public function setInvalid():void{
mTimeToSend = -1;
}
public function set data(value:IPostData):void{
mData = value;
}
public function get senderId():String{
return (mSenderId);
}
}
}//package com.liquable.game.postoffice
Section 33
//PostStateClient (com.liquable.game.postoffice.PostStateClient)
package com.liquable.game.postoffice {
import com.liquable.statemachine.*;
public class PostStateClient extends StateMachine {
private var pPostClient:PostClient;
public function PostStateClient(manager){
super();
pPostClient = new PostClient(manager);
pPostClient.setReceivePostFunction(this.process);
}
public function getPostId():String{
return (pPostClient.getPostId());
}
public function unsubscribe(inTopic:String):void{
pPostClient.unsubscribe(inTopic);
}
public function subscribe(inTopic:String):void{
pPostClient.subscribe(inTopic);
}
override public function destroy():void{
super.destroy();
pPostClient.destroy();
pPostClient = null;
}
public function setPostId(postId:String):void{
pPostClient.setPostId(postId);
}
public function sendMessage(inTopic:String, inData:IPostData, inDelay:int=0, receiverList:Array=null):void{
pPostClient.sendMessage(inTopic, inData, inDelay, receiverList);
}
}
}//package com.liquable.game.postoffice
Section 34
//MapTileEvent (com.liquable.game.tiledmap.events.MapTileEvent)
package com.liquable.game.tiledmap.events {
import flash.events.*;
import com.liquable.game.tiledmap.*;
public class MapTileEvent extends Event {
private var pIsOnGround:Boolean;
private var pTileRenderer:IMapTileRenderer;
private var pMapRenderer:MapRenderer;
public static const TILE_MOUSE_OUT:String = "tileMouseOut";
public static const TILE_MOUSE_UP:String = "tileMouseUp";
public static const TILE_MOUSE_DOWN:String = "tileMouseDown";
public static const TILE_MOUSE_OVER:String = "tileMouseOver";
public function MapTileEvent(type:String, mapRenderer:MapRenderer, tileRenderer:IMapTileRenderer, isOnGround:Boolean, bubbles:Boolean=false, cancelable:Boolean=false){
super(type, bubbles, cancelable);
pMapRenderer = mapRenderer;
pTileRenderer = tileRenderer;
pIsOnGround = isOnGround;
}
public function isTileOnGround():Boolean{
return (pIsOnGround);
}
public function get mapRenderer():MapRenderer{
return (pMapRenderer);
}
public function get tileRenderer():IMapTileRenderer{
return (pTileRenderer);
}
override public function clone():Event{
return (new MapTileEvent(type, mapRenderer, tileRenderer, isTileOnGround(), bubbles, cancelable));
}
}
}//package com.liquable.game.tiledmap.events
Section 35
//MapResourceEvent (com.liquable.game.tiledmap.resources.events.MapResourceEvent)
package com.liquable.game.tiledmap.resources.events {
import flash.events.*;
import com.liquable.game.tiledmap.resources.*;
public class MapResourceEvent extends Event {
public static const LOAD_COMPLETE:String = "loadComplete";
public function MapResourceEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false){
super(type, bubbles, cancelable);
}
public function get mapResource():MapResource{
return ((target as MapResource));
}
override public function clone():Event{
return (new MapResourceEvent(type, bubbles, cancelable));
}
}
}//package com.liquable.game.tiledmap.resources.events
Section 36
//MapResourceTileChangedEvent (com.liquable.game.tiledmap.resources.events.MapResourceTileChangedEvent)
package com.liquable.game.tiledmap.resources.events {
import flash.events.*;
public class MapResourceTileChangedEvent extends MapResourceEvent {
private var pCoordY:int;
private var pCoordX:int;
public static const TILE_CHANGED:String = "tileChanged";
public function MapResourceTileChangedEvent(type:String, coordX:int, coordY:int, bubbles:Boolean=false, cancelable:Boolean=false){
super(type, bubbles, cancelable);
pCoordX = coordX;
pCoordY = coordY;
}
public function get coordX():int{
return (pCoordX);
}
public function get coordY():int{
return (pCoordY);
}
override public function clone():Event{
return (new MapResourceTileChangedEvent(type, coordX, coordY, bubbles, cancelable));
}
}
}//package com.liquable.game.tiledmap.resources.events
Section 37
//LayerResource (com.liquable.game.tiledmap.resources.LayerResource)
package com.liquable.game.tiledmap.resources {
import com.liquable.utils.*;
import com.liquable.game.geom.*;
public class LayerResource {
private var pMapResource:MapResource;
private var pType:int;
private var pTileResourceMap:Object;
public static const TYPE_STATIC:int = TYPES.nextIndex();
public static const TYPE_GAME_STAGE:int = TYPES.nextIndex();
private static var TYPES:Enum = new Enum();
public function LayerResource(mapResource:MapResource){
super();
pMapResource = mapResource;
}
public function isEmpty():Boolean{
var d:*;
for each (d in pTileResourceMap) {
return (false);
};
return (true);
}
public function getTileResource(i:int, j:int):TileResource{
var id:String = PointInt.makeString(i, j);
return (pTileResourceMap[id]);
}
public function exportZipData():Object{
var coordStr:String;
var tileResource:TileResource;
var data:Object = new Object();
data.type = pType;
var tiles:Object = new Object();
for (coordStr in pTileResourceMap) {
tileResource = pTileResourceMap[coordStr];
tiles[coordStr] = tileResource.exportZipData();
};
data.tiles = tiles;
return (data);
}
public function get type():int{
return (pType);
}
public function loadFromZipData(data:Object):void{
var coordStr:String;
var coord:PointInt;
var tileResource:TileResource;
var tiles:Object = new Object();
for (coordStr in data.tiles) {
coord = PointInt.fromString(coordStr);
tileResource = new TileResource(pMapResource, coord.x, coord.y);
tileResource.loadFromZipData(data.tiles[coordStr]);
tiles[coordStr] = tileResource;
};
initialize(data.type, tiles);
}
public function initialize(type:int, tileResourceMap:Object):void{
pType = type;
pTileResourceMap = tileResourceMap;
}
}
}//package com.liquable.game.tiledmap.resources
Section 38
//MapResource (com.liquable.game.tiledmap.resources.MapResource)
package com.liquable.game.tiledmap.resources {
import flash.events.*;
import com.liquable.utils.*;
import com.liquable.game.tiledmap.resources.events.*;
import com.liquable.game.geom.*;
import flash.geom.*;
import flash.xml.*;
import flash.net.*;
public class MapResource extends EventDispatcher {
protected var pTileHeight:int;
protected var pTilePropertiesMap:Object;
private var pMapHeight:Number;
protected var pTileWidth:int;
protected var pRowCounts:int;
protected var pColumnCounts:int;
protected var pImageResourceFilenames:Object;
private var pAssetsRootPath:String;
private var pZipData:Object;
private var pMapWidth:Number;
protected var pLayerResources:Array;
public function MapResource(assetsRootPath:String){
super();
pAssetsRootPath = assetsRootPath;
}
public function loadFromXMLDocument(xmlDocument:XMLDocument):void{
xmlDocument.ignoreWhite = true;
analyzeXmlDoc(xmlDocument);
pZipData = exportZipData();
tiledImageLoadComplete(null);
}
public function setTileProperties(columnIndex:int, rowIndex:int, keyValueMap:Object):void{
var key:String;
var properties:Object = getTileProperties(columnIndex, rowIndex);
if (properties){
for (key in keyValueMap) {
properties[key] = keyValueMap[key];
};
};
}
private function analyzeLayerNode(node:XMLNode):void{
var tileNode:XMLNode;
var point:PointInt;
var tileResource:TileResource;
var tiles:Object = new Object();
var tileNodes:Array = node.childNodes;
var j:int;
while (j < tileNodes.length) {
tileNode = tileNodes[j];
point = new PointInt(int(tileNode.attributes.hIndex), int(tileNode.attributes.vIndex));
tileResource = new TileResource(this, point.x, point.y);
tileResource.setImage(tileNode.attributes.resource, int(tileNode.attributes.imageId));
tiles[point.toString()] = tileResource;
j++;
};
var layerResource:LayerResource = new LayerResource(this);
layerResource.initialize(node.attributes.type, tiles);
pLayerResources.push(layerResource);
}
protected function analyzeXmlDoc(xmlDocument:XMLDocument):void{
var mainNode:XMLNode = xmlDocument.firstChild;
pTileWidth = int(mainNode.attributes.tileWidth);
pTileHeight = int(mainNode.attributes.tileHeight);
analyzeResourceNodes(mainNode.childNodes, pTileWidth, pTileHeight);
analyzeLevelNodes(mainNode.childNodes);
}
public function getTileIndex(i:int, j:int):int{
if (isValidLoc(i, j)){
return ((i + (j * columnCounts)));
};
return (-1);
}
public function getTileLocFromPosition(x:Number, y:Number):PointInt{
return (new PointInt(Math.floor((x / pTileWidth)), Math.floor((y / pTileHeight))));
}
protected function loadTiledImage(id:String, filename:String, tileWidth:int, tileHeight:int):void{
var imageResource:TiledImageResource;
if (TiledImageResource.getResource(filename) == null){
imageResource = new TiledImageResource(pAssetsRootPath, filename, tileWidth, tileHeight);
imageResource.addEventListener(TiledImageResource.LOAD_COMPLETE, tiledImageLoadComplete);
imageResource.addEventListener(TiledImageResource.LOAD_IOERROR, tiledImageLoadIOError);
};
pImageResourceFilenames[id] = filename;
}
public function set assetsRootPath(value:String):void{
pAssetsRootPath = value;
}
public function exportZipData():Object{
var id:String;
var layers:Array;
var layerResource:LayerResource;
var tiles:Object;
var coordStr:String;
var propertyMap:Object;
var properties:Object;
var key:String;
var data:Object = new Object();
data.tileW = pTileWidth;
data.tileH = pTileHeight;
data.cols = pColumnCounts;
data.rows = pRowCounts;
var rsrcs:Object = new Object();
for (id in pImageResourceFilenames) {
rsrcs[id] = pImageResourceFilenames[id];
};
data.rsrcs = rsrcs;
layers = new Array();
for each (layerResource in pLayerResources) {
layers.push(layerResource.exportZipData());
};
data.layers = layers;
tiles = new Object();
for (coordStr in pTilePropertiesMap) {
propertyMap = pTilePropertiesMap[coordStr];
properties = new Object();
for (key in propertyMap) {
properties[key] = propertyMap[key];
};
tiles[coordStr] = properties;
};
data.tiles = tiles;
return (data);
}
public function getTileProperty(columnIndex:int, rowIndex:int, key:String):Object{
var properties:Object = getTileProperties(columnIndex, rowIndex);
return ((properties) ? properties[key] : null);
}
public function setTileImage(layerIndex:int, coordX:int, coordY:int, resourceId:String, imageId:int):void{
var layerResource:LayerResource;
var tileResource:TileResource;
if ((((layerIndex >= 0)) && ((layerIndex < pLayerResources.length)))){
layerResource = pLayerResources[layerIndex];
tileResource = layerResource.getTileResource(coordX, coordY);
if (tileResource){
tileResource.setImage(resourceId, imageId);
dispatchEvent(new MapResourceTileChangedEvent(MapResourceTileChangedEvent.TILE_CHANGED, coordX, coordY));
};
};
}
private function tiledImageLoadIOError(event:Event):void{
throw (new Error("MapResource.tiledImageLoadIOError() : file does not exist!!"));
}
public function getTileLocByIndex(index:int):PointInt{
var loc:PointInt = new PointInt();
loc.x = (index % columnCounts);
loc.y = Math.floor((index / columnCounts));
return (loc);
}
public function loadFromZipData(data:Object):void{
var id:String;
var layer:Object;
var coordStr:String;
var layerResource:LayerResource;
var propertyMap:Object;
var properties:Object;
var key:String;
pZipData = data;
pTileWidth = data.tileW;
pTileHeight = data.tileH;
pColumnCounts = data.cols;
pRowCounts = data.rows;
pImageResourceFilenames = new Object();
for (id in data.rsrcs) {
pImageResourceFilenames[id] = data.rsrcs[id];
loadTiledImage(id, pImageResourceFilenames[id], pTileWidth, pTileHeight);
};
pLayerResources = new Array();
for each (layer in data.layers) {
layerResource = new LayerResource(this);
layerResource.loadFromZipData(layer);
pLayerResources.push(layerResource);
};
pTilePropertiesMap = new Object();
for (coordStr in data.tiles) {
propertyMap = data.tiles[coordStr];
properties = new Object();
for (key in propertyMap) {
properties[key] = propertyMap[key];
};
pTilePropertiesMap[coordStr] = properties;
};
tiledImageLoadComplete(null);
}
public function getResourceIds():Array{
return (ArrayUtil.convertMapKeysToArray(pImageResourceFilenames));
}
public function setTileProperty(columnIndex:int, rowIndex:int, key:String, value:String):void{
var properties:Object = getTileProperties(columnIndex, rowIndex);
if (properties){
properties[key] = value;
};
}
public function get height():Number{
return (pMapHeight);
}
public function getLayer(layerIndex:int):LayerResource{
return (pLayerResources[layerIndex]);
}
public function getResourceFilename(id:String):String{
return (pImageResourceFilenames[id]);
}
public function getTileLocsByProperty(key:String, value:String):Array{
var locs:Array;
var locString:String;
var properties:Object;
if (pTilePropertiesMap){
locs = new Array();
for (locString in pTilePropertiesMap) {
properties = pTilePropertiesMap[locString];
if (((properties.hasOwnProperty(key)) && ((((properties[key] == value)) || ((value == null)))))){
locs.push(PointInt.fromString(locString));
};
};
};
return (locs);
}
public function get tileWidth():int{
return (pTileWidth);
}
public function get columnCounts():int{
return (pColumnCounts);
}
private function analyzeTilesNode(node:XMLNode):void{
var node1:XMLNode;
var propertyNodes:Array;
var p:Object;
var node2:XMLNode;
pTilePropertiesMap = new Object();
var tileNodes:Array = node.childNodes;
for each (node1 in tileNodes) {
propertyNodes = node1.childNodes;
p = new Object();
for each (node2 in propertyNodes) {
p[node2.attributes.name] = node2.attributes.value;
};
pTilePropertiesMap[PointInt.makeString(node1.attributes.hIndex, node1.attributes.vIndex)] = p;
};
}
public function get rowCounts():int{
return (pRowCounts);
}
private function analyzeLevelNode(node:XMLNode):void{
var node1:XMLNode;
var node2:XMLNode;
var nodes:Array = node.childNodes;
for each (node1 in nodes) {
if (node1.nodeName == "layer"){
analyzeLayerNode(node1);
};
};
for each (node2 in nodes) {
if (node2.nodeName == "tiles"){
analyzeTilesNode(node2);
};
};
}
public function get layers():Array{
return (pLayerResources);
}
private function onLoadComplete(event:Event):void{
loadFromXML(new XML(event.target.data));
}
public function get width():Number{
return (pMapWidth);
}
public function loadFromXML(xml:XML):void{
var xmlDocument:XMLDocument = new XMLDocument();
xmlDocument.ignoreWhite = true;
xmlDocument.parseXML(xml);
loadFromXMLDocument(xmlDocument);
}
public function loadFromFile(fileUrl:String):void{
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoadComplete);
loader.load(new URLRequest(fileUrl));
}
public function reset():void{
if (pZipData){
loadFromZipData(pZipData);
};
}
public function get assetsRootPath():String{
return (pAssetsRootPath);
}
private function analyzeResourceNodes(nodes:Array, tileWidth:int, tileHeight:int):void{
var node:XMLNode;
if (pImageResourceFilenames == null){
pImageResourceFilenames = new Object();
};
var i:int;
while (i < nodes.length) {
node = nodes[i];
if (node.nodeName == "resource"){
loadTiledImage(node.attributes.id, node.attributes.filename, tileWidth, tileHeight);
};
i++;
};
}
public function getTileCenterPosition(i:int, j:int):Point{
if (isValidLoc(i, j)){
return (new Point((pTileWidth * (i + 0.5)), (pTileHeight * (j + 0.5))));
};
return (null);
}
protected function tiledImageLoadComplete(event:Event):void{
if (TiledImageResource.isAllLoaded()){
pMapWidth = (pTileWidth * pColumnCounts);
pMapHeight = (pTileHeight * pRowCounts);
dispatchEvent(new MapResourceEvent(MapResourceEvent.LOAD_COMPLETE));
};
}
public function getTilePosition(i:int, j:int):Point{
if (isValidLoc(i, j)){
return (new Point((pTileWidth * i), (pTileHeight * j)));
};
return (null);
}
public function isValidLoc(i:int, j:int):Boolean{
return ((((((((i >= 0)) && ((i < pColumnCounts)))) && ((j >= 0)))) && ((j < pRowCounts))));
}
public function get tileHeight():int{
return (pTileHeight);
}
public function getTileProperties(columnIndex:int, rowIndex:int):Object{
return ((pTilePropertiesMap) ? pTilePropertiesMap[PointInt.makeString(columnIndex, rowIndex)] : null);
}
private function analyzeLevelNodes(nodes:Array):void{
var node:XMLNode;
if (pLayerResources == null){
pLayerResources = new Array();
};
var i:int;
while (i < nodes.length) {
node = nodes[i];
if (node.nodeName == "level"){
pColumnCounts = int(node.attributes.hTiles);
pRowCounts = int(node.attributes.vTiles);
analyzeLevelNode(node);
return;
};
i++;
};
}
}
}//package com.liquable.game.tiledmap.resources
Section 39
//TiledImageResource (com.liquable.game.tiledmap.resources.TiledImageResource)
package com.liquable.game.tiledmap.resources {
import flash.events.*;
import flash.display.*;
import com.liquable.utils.*;
import flash.geom.*;
public class TiledImageResource extends EventDispatcher {
private var pTileHeight:int;
private var pTileWidth:int;
private var pBitmapDatas:Array;
private var pLoaded:Boolean;
public static var LOAD_COMPLETE:String = "loadComplete";
private static var sTiledImageMap:Object = new Object();
public static var LOAD_IOERROR:String = "loadIOError";
public function TiledImageResource(assetsPath:String, filename:String, tileWidth:int, tileHeight:int){
pBitmapDatas = new Array();
super();
DesignContract.preCondition((getResource(filename) == null), "");
sTiledImageMap[filename] = this;
pTileWidth = tileWidth;
pTileHeight = tileHeight;
pLoaded = false;
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
loadBitmap(EmbedManager.singleton.getTileset(filename));
}
private function analyzeBitmap(image:Bitmap):void{
var hi:int;
var bitmapdata:BitmapData;
var hTiles:int = Math.floor((image.width / pTileWidth));
var vTiles:int = Math.floor((image.height / pTileHeight));
var vi:int;
while (vi < vTiles) {
hi = 0;
while (hi < hTiles) {
bitmapdata = new BitmapData(pTileWidth, pTileHeight, true, 0);
bitmapdata.copyPixels(image.bitmapData, new Rectangle((hi * pTileWidth), (vi * pTileHeight), pTileWidth, pTileHeight), new Point(0, 0));
pBitmapDatas.push(bitmapdata);
hi++;
};
vi++;
};
}
private function onIOError(event:IOErrorEvent):void{
dispatchEvent(new Event(LOAD_IOERROR));
}
public function isLoaded():Boolean{
return (pLoaded);
}
public function getTiledImage(id:int):BitmapData{
return (pBitmapDatas[id]);
}
private function loadBitmap(bitmap:Bitmap):void{
analyzeBitmap(bitmap);
pLoaded = true;
dispatchEvent(new Event(LOAD_COMPLETE));
}
private function onLoadComplete(event:Event):void{
loadBitmap(Bitmap(Loader(event.target.loader).content));
}
public static function getResource(path:String):TiledImageResource{
return (sTiledImageMap[path]);
}
public static function isAllLoaded():Boolean{
var rsrc:TiledImageResource;
for each (rsrc in sTiledImageMap) {
if (!rsrc.isLoaded()){
return (false);
};
};
return (true);
}
}
}//package com.liquable.game.tiledmap.resources
Section 40
//TileResource (com.liquable.game.tiledmap.resources.TileResource)
package com.liquable.game.tiledmap.resources {
import flash.display.*;
import com.liquable.utils.*;
import com.liquable.game.geom.*;
public class TileResource extends PointInt {
private var pImageId:int;
private var pResourceId:String;
private var pBitmapData:BitmapData;
private var pMapResource:MapResource;
public function TileResource(mapResource:MapResource, coordX:int, coordY:int){
super(coordX, coordY);
pMapResource = mapResource;
}
public function setImage(resourceId:String, imageId:int):void{
pResourceId = resourceId;
pImageId = imageId;
pBitmapData = null;
}
public function get id():String{
return (toString());
}
public function get bitmapData():BitmapData{
if ((((pBitmapData == null)) && (!((pImageId == -1))))){
pBitmapData = TiledImageResource.getResource(pMapResource.getResourceFilename(pResourceId)).getTiledImage(pImageId);
DesignContract.preCondition(!((pBitmapData == null)), ("bitmapData is null , id = " + pImageId));
};
return (pBitmapData);
}
public function exportZipData():Object{
var data:Object = new Object();
data.r = pResourceId;
data.i = pImageId;
return (data);
}
public function loadFromZipData(data:Object):void{
setImage(data.r, data.i);
}
}
}//package com.liquable.game.tiledmap.resources
Section 41
//IMapTileRenderer (com.liquable.game.tiledmap.IMapTileRenderer)
package com.liquable.game.tiledmap {
import flash.display.*;
public interface IMapTileRenderer {
function get displayObject():DisplayObject;
function getMapTile():MapTile;
function beginBitmapDataFill():void;
function endBitmapDataFill():void;
function setMapTile(M:\WebDev\Flex Builder 3\zombie_hooker_nightmare\src\main\flex;com\liquable\game\tiledmap;IMapTileRenderer.as:MapTile):void;
function destroy():void;
function drawBitmapData(_arg1:int, _arg2:BitmapData):void;
}
}//package com.liquable.game.tiledmap
Section 42
//MapLayerRenderer (com.liquable.game.tiledmap.MapLayerRenderer)
package com.liquable.game.tiledmap {
import flash.events.*;
import flash.display.*;
import com.liquable.game.camera.*;
import flash.geom.*;
import com.liquable.game.tiledmap.resources.*;
import com.liquable.game.tiledmap.*;
import com.liquable.game.tiledmap.events.*;
class MapLayerRenderer extends Sprite {
private var pBitmapArray:Array;
private var pIsOnGround:Boolean;
private var pLayerResources:Array;
private var pMapRenderer:MapRenderer;
private var pTileRenderers:Array;
function MapLayerRenderer(mapRenderer:MapRenderer, isOnGround:Boolean){
super();
pMapRenderer = mapRenderer;
pLayerResources = new Array();
pIsOnGround = isOnGround;
}
public function setBitmapVisible(i:int, j:int, vis:Boolean):void{
var bitmap:Bitmap = pBitmapArray[i][j];
if (vis){
if (bitmap.parent == null){
addChild(bitmap);
};
} else {
if (bitmap.parent){
bitmap.parent.removeChild(bitmap);
};
};
}
public function buildTileRenderers(columns:int, rows:int, tileRendererClass:Class):void{
var map:TiledMap;
var mapResource:MapResource;
var i:int;
var renderers:Array;
var j:int;
var tileRenderer:IMapTileRenderer;
var displayObject:DisplayObject;
if (pLayerResources.length){
pTileRenderers = new Array();
map = pMapRenderer.getMap();
mapResource = pMapRenderer.getMap().getMapResource();
i = 0;
while (i < columns) {
renderers = new Array();
pTileRenderers.push(renderers);
j = 0;
while (j < rows) {
tileRenderer = new (tileRendererClass);
displayObject = tileRenderer.displayObject;
displayObject.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
displayObject.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
displayObject.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
displayObject.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
addChild(tileRenderer.displayObject);
renderers.push(tileRenderer);
setupTileRenderer(map, mapResource, i, j, i, j);
j++;
};
i++;
};
};
}
public function containsResources():Boolean{
return (!((pLayerResources.length == 0)));
}
public function destroy():void{
var rowArray:Array;
var bitmap:Bitmap;
var rowRenderers:Array;
var tileRenderer:IMapTileRenderer;
if (pBitmapArray){
for each (rowArray in pBitmapArray) {
for each (bitmap in rowArray) {
bitmap.bitmapData.dispose();
bitmap.bitmapData = null;
};
};
pBitmapArray = null;
};
if (pTileRenderers){
for each (rowRenderers in pTileRenderers) {
for each (tileRenderer in rowRenderers) {
tileRenderer.destroy();
};
};
pTileRenderers = null;
};
pMapRenderer = null;
pLayerResources = null;
while (numChildren) {
removeChildAt(0);
};
}
public function getTileRenderers():Array{
return (pTileRenderers);
}
private function onMouseDown(event:MouseEvent):void{
dispatchMapTileEvent(MapTileEvent.TILE_MOUSE_DOWN, event);
}
private function onMouseUp(event:MouseEvent):void{
dispatchMapTileEvent(MapTileEvent.TILE_MOUSE_UP, event);
}
public function updateTileResourceOnBitmap(mapResource:MapResource, coordX:int, coordY:int):void{
var bitmap:Bitmap;
var layerReousce:LayerResource;
var tileResource:TileResource;
var srcData:BitmapData;
var posX:Number = (coordX * mapResource.tileWidth);
var posY:Number = (coordY * mapResource.tileHeight);
var segI:int;
var segJ:int;
var i:int;
while (i < pBitmapArray.length) {
bitmap = pBitmapArray[i][0];
if ((bitmap.x + bitmap.width) > posX){
segI = i;
break;
};
i++;
};
var j:int;
while (j < pBitmapArray[0].length) {
bitmap = pBitmapArray[0][j];
if ((bitmap.y + bitmap.height) > posY){
segJ = j;
break;
};
j++;
};
bitmap = pBitmapArray[segI][segJ];
var startCol:int = Math.round((bitmap.x / mapResource.tileWidth));
var startRow:int = Math.round((bitmap.y / mapResource.tileHeight));
var srcRec:Rectangle = new Rectangle(0, 0, mapResource.tileWidth, mapResource.tileHeight);
var dstRec:Rectangle = new Rectangle(((coordX - startCol) * mapResource.tileWidth), ((coordY - startRow) * mapResource.tileHeight), srcRec.width, srcRec.height);
var dstPoint:Point = new Point(dstRec.x, dstRec.y);
var bmpData:BitmapData = bitmap.bitmapData;
bmpData.lock();
bmpData.fillRect(dstRec, 0);
for each (layerReousce in pLayerResources) {
tileResource = layerReousce.getTileResource(coordX, coordY);
if (tileResource){
srcData = tileResource.bitmapData;
if (srcData){
bmpData.copyPixels(srcData, srcRec, dstPoint, null, null, true);
};
};
};
bmpData.unlock(dstRec);
}
public function buildBitmaps(camera:GameCamera):void{
var mapResource:MapResource;
var rowArray:Array;
var endCol:int;
var startRow:int;
var endRow:int;
var bmpWidth:Number;
var bmpHeight:Number;
var bmpData:BitmapData;
var bitmap:Bitmap;
var j:int;
var map:TiledMap = pMapRenderer.getMap();
mapResource = pMapRenderer.getMap().getMapResource();
var colsPerSeg:int = Math.ceil(((camera.width / mapResource.tileWidth) * 0.5));
var rowsPerSeg:int = Math.ceil(((camera.height / mapResource.tileHeight) * 0.5));
pBitmapArray = new Array();
var startCol:int;
while (startCol < mapResource.columnCounts) {
rowArray = new Array();
pBitmapArray.push(rowArray);
endCol = Math.min(mapResource.columnCounts, (startCol + colsPerSeg));
startRow = 0;
while (startRow < mapResource.rowCounts) {
endRow = Math.min(mapResource.rowCounts, (startRow + rowsPerSeg));
bmpWidth = ((endCol - startCol) * mapResource.tileWidth);
bmpHeight = ((endRow - startRow) * mapResource.tileHeight);
bmpData = new BitmapData(bmpWidth, bmpHeight);
bitmap = new Bitmap(bmpData);
bitmap.x = (startCol * mapResource.tileWidth);
bitmap.y = (startRow * mapResource.tileHeight);
rowArray.push(bitmap);
if (endRow == mapResource.rowCounts){
break;
};
startRow = (startRow + rowsPerSeg);
};
if (endCol == mapResource.columnCounts){
break;
};
startCol = (startCol + colsPerSeg);
};
var i:int;
while (i < mapResource.columnCounts) {
j = 0;
while (j < mapResource.rowCounts) {
updateTileResourceOnBitmap(mapResource, i, j);
j++;
};
i++;
};
}
public function addLayerResource(layerResource:LayerResource):void{
pLayerResources.push(layerResource);
}
private function onMouseOut(event:MouseEvent):void{
dispatchMapTileEvent(MapTileEvent.TILE_MOUSE_OUT, event);
}
private function dispatchMapTileEvent(type:String, event:MouseEvent):void{
if (pMapRenderer){
pMapRenderer.dispatchEvent(new MapTileEvent(type, pMapRenderer, (event.currentTarget as IMapTileRenderer), pIsOnGround));
};
}
function setupTileRenderer(map:TiledMap, mapResource:MapResource, i:int, j:int, tileI:int, tileJ:int, forceUpdate:Boolean=false):void{
var tile:MapTile;
var layerIndex:int;
var layerReousce:LayerResource;
var bitmapdata:BitmapData;
var tileResource:TileResource;
var renderer:IMapTileRenderer = pTileRenderers[i][j];
if (renderer){
tile = map.getTile(tileI, tileJ);
renderer.displayObject.x = (i * mapResource.tileWidth);
renderer.displayObject.y = (j * mapResource.tileHeight);
renderer.displayObject.visible = true;
if (((forceUpdate) || (!((tile == renderer.getMapTile()))))){
renderer.setMapTile(tile);
renderer.beginBitmapDataFill();
layerIndex = 0;
for each (layerReousce in pLayerResources) {
bitmapdata = null;
tileResource = layerReousce.getTileResource(tileI, tileJ);
if (tileResource){
bitmapdata = tileResource.bitmapData;
};
renderer.drawBitmapData(layerIndex, bitmapdata);
layerIndex++;
};
renderer.endBitmapDataFill();
};
};
}
function hideTileRenderer(i:int, j:int):void{
var renderer:IMapTileRenderer = pTileRenderers[i][j];
if (renderer){
renderer.displayObject.visible = false;
};
}
public function getBitmapArray():Array{
return (pBitmapArray);
}
private function onMouseOver(event:MouseEvent):void{
dispatchMapTileEvent(MapTileEvent.TILE_MOUSE_OVER, event);
}
}
}//package com.liquable.game.tiledmap
Section 43
//MapRenderer (com.liquable.game.tiledmap.MapRenderer)
package com.liquable.game.tiledmap {
import flash.display.*;
import com.liquable.utils.*;
import com.liquable.game.tiledmap.resources.events.*;
import com.liquable.game.camera.*;
import flash.geom.*;
import com.liquable.game.tiledmap.resources.*;
public class MapRenderer extends Sprite {
protected var pScreenColumns:int;
protected var pMap:TiledMap;
protected var pCurrentLeftLoc:int;
private var pTileRendererClass:Class;
private var pGameStage:Sprite;
protected var pGroundLayerRenderer:MapLayerRenderer;
protected var pSkyLayerRenderer:MapLayerRenderer;
protected var pCurrentTopLoc:int;
protected var pScreenRows:int;
public function MapRenderer(map:TiledMap, tileRendererClass:Class=null){
super();
pMap = map;
pTileRendererClass = tileRendererClass;
if (pTileRendererClass == null){
pTileRendererClass = MapTileRenderer;
};
}
private function getTileRenderer(renderers:Array, tileI:int, tileJ:int):IMapTileRenderer{
var coords:Point;
if (renderers){
coords = getRendererInternalCoords(tileI, tileJ);
if (coords){
return (renderers[coords.x][coords.y]);
};
};
return (null);
}
private function getRendererInternalCoords(tileI:int, tileJ:int):Point{
var j:int;
var i:int = (tileI - pCurrentLeftLoc);
if ((((i >= 0)) && ((i < pScreenColumns)))){
j = (tileJ - pCurrentTopLoc);
if ((((j >= 0)) && ((j < pScreenRows)))){
return (new Point(i, j));
};
};
return (null);
}
private function onTileResourceChanged(event:MapResourceTileChangedEvent):void{
var coords:Point;
var coodsNeedTested:Boolean;
if (pGroundLayerRenderer.getTileRenderers()){
coords = getRendererInternalCoords(event.coordX, event.coordY);
if (coords){
pGroundLayerRenderer.setupTileRenderer(pMap, pMap.getMapResource(), coords.x, coords.y, event.coordX, event.coordY, true);
} else {
coodsNeedTested = false;
};
} else {
pGroundLayerRenderer.updateTileResourceOnBitmap(pMap.getMapResource(), event.coordX, event.coordY);
};
if (pSkyLayerRenderer.getTileRenderers()){
if ((((coords == null)) && (coodsNeedTested))){
coords = getRendererInternalCoords(event.coordX, event.coordY);
};
if (coords){
pSkyLayerRenderer.setupTileRenderer(pMap, pMap.getMapResource(), coords.x, coords.y, event.coordX, event.coordY, true);
};
} else {
pSkyLayerRenderer.updateTileResourceOnBitmap(pMap.getMapResource(), event.coordX, event.coordY);
};
}
public function getGroundTileRenderer(tileI:int, tileJ:int):IMapTileRenderer{
return (getTileRenderer(pGroundLayerRenderer.getTileRenderers(), tileI, tileJ));
}
public function update(camera:GameCamera, loopTiles:Boolean=false):void{
updateTileRenderers(camera, loopTiles);
updateLayerBitmaps(camera, loopTiles);
}
public function getMap():TiledMap{
return (pMap);
}
public function getSkyTileRenderer(tileI:int, tileJ:int):IMapTileRenderer{
return (getTileRenderer(pSkyLayerRenderer.getTileRenderers(), tileI, tileJ));
}
public function getGameStage():Sprite{
return (pGameStage);
}
private function updateTileRenderers(camera:GameCamera, loopTiles:Boolean):void{
var mapResource:MapResource;
var baseRenderers:Array;
var layerX:Number;
var layerY:Number;
var renderer:IMapTileRenderer;
var tile:MapTile;
var diffLocX:int;
var diffLocY:int;
var istart:int;
var iend:int;
var jstart:int;
var jend:int;
var i:int;
var dstI:int;
var j:int;
var dstJ:int;
var tileI:int;
var tileJ:int;
var groundTileRenderers:Array = pGroundLayerRenderer.getTileRenderers();
var skyTileRenderers:Array = pSkyLayerRenderer.getTileRenderers();
if (((groundTileRenderers) || (skyTileRenderers))){
mapResource = pMap.getMapResource();
baseRenderers = (groundTileRenderers) ? groundTileRenderers : skyTileRenderers;
pCurrentLeftLoc = Math.floor((camera.left / mapResource.tileWidth));
pCurrentTopLoc = Math.floor((camera.top / mapResource.tileHeight));
layerX = Math.round(((pCurrentLeftLoc * mapResource.tileWidth) - camera.left));
layerY = Math.round(((pCurrentTopLoc * mapResource.tileHeight) - camera.top));
if (groundTileRenderers){
pGroundLayerRenderer.x = layerX;
pGroundLayerRenderer.y = layerY;
};
if (skyTileRenderers){
pSkyLayerRenderer.x = layerX;
pSkyLayerRenderer.y = layerY;
};
renderer = baseRenderers[0][0];
tile = renderer.getMapTile();
diffLocX = (pCurrentLeftLoc - tile.x);
diffLocY = (pCurrentTopLoc - tile.y);
if (((diffLocX) || (diffLocY))){
istart = diffLocX;
iend = (istart + pScreenColumns);
jstart = diffLocY;
jend = (jstart + pScreenRows);
i = istart;
while (i < iend) {
if ((((i >= 0)) && ((i < pScreenColumns)))){
dstI = (i - diffLocX);
if ((((dstI >= 0)) && ((dstI < pScreenColumns)))){
if (diffLocX){
if (groundTileRenderers){
ArrayUtil.swapElements(groundTileRenderers, i, dstI);
};
if (skyTileRenderers){
ArrayUtil.swapElements(skyTileRenderers, i, dstI);
};
};
if (diffLocY){
j = jstart;
while (j < jend) {
dstJ = (j - diffLocY);
if ((((((((j >= 0)) && ((j < pScreenRows)))) && ((dstJ >= 0)))) && ((dstJ < pScreenRows)))){
if (groundTileRenderers){
ArrayUtil.swapElements(groundTileRenderers[dstI], j, dstJ);
};
if (skyTileRenderers){
ArrayUtil.swapElements(skyTileRenderers[dstI], j, dstJ);
};
};
j++;
};
};
};
};
i++;
};
i = 0;
for (;i < pScreenColumns;i++) {
tileI = (i + pCurrentLeftLoc);
if (loopTiles){
while (tileI < 0) {
tileI = (tileI + mapResource.columnCounts);
};
while (tileI >= mapResource.columnCounts) {
tileI = (tileI - mapResource.columnCounts);
};
} else {
if ((((tileI < 0)) || ((tileI >= mapResource.columnCounts)))){
j = 0;
while (j < pScreenRows) {
if (groundTileRenderers){
pGroundLayerRenderer.hideTileRenderer(i, j);
};
if (skyTileRenderers){
pSkyLayerRenderer.hideTileRenderer(i, j);
};
j++;
};
continue;
};
};
j = 0;
for (;j < pScreenRows;j++) {
tileJ = (j + pCurrentTopLoc);
if (loopTiles){
while (tileJ < 0) {
tileJ = (tileJ + mapResource.rowCounts);
};
while (tileJ >= mapResource.rowCounts) {
tileJ = (tileJ - mapResource.rowCounts);
};
} else {
if ((((tileJ < 0)) || ((tileJ >= mapResource.rowCounts)))){
if (groundTileRenderers){
pGroundLayerRenderer.hideTileRenderer(i, j);
};
if (skyTileRenderers){
pSkyLayerRenderer.hideTileRenderer(i, j);
};
continue;
};
};
if (groundTileRenderers){
pGroundLayerRenderer.setupTileRenderer(pMap, mapResource, i, j, tileI, tileJ);
};
if (skyTileRenderers){
pSkyLayerRenderer.setupTileRenderer(pMap, mapResource, i, j, tileI, tileJ);
};
};
};
};
};
}
public function destroy():void{
pMap.getMapResource().removeEventListener(MapResourceTileChangedEvent.TILE_CHANGED, onTileResourceChanged);
pGroundLayerRenderer.destroy();
pGroundLayerRenderer = null;
pSkyLayerRenderer.destroy();
pSkyLayerRenderer = null;
pGameStage = null;
pMap = null;
pTileRendererClass = null;
while (numChildren) {
removeChildAt(0);
};
if (parent){
parent.removeChild(this);
};
}
private function updateLayerBitmaps(camera:GameCamera, loopTiles:Boolean):void{
var bitmap:Bitmap;
var mapResource:MapResource;
var baseBitmaps:Array;
var baseBitmap:Bitmap;
var visibleColStart:int;
var visibleColEnd:int;
var visibleRowStart:int;
var visibleRowEnd:int;
var i:int;
var rowArray:Array;
var iVisible:Boolean;
var j:int;
var segVisible:Boolean;
var groundBitmaps:Array = pGroundLayerRenderer.getBitmapArray();
var skyBitmaps:Array = pSkyLayerRenderer.getBitmapArray();
if (((groundBitmaps) || (skyBitmaps))){
mapResource = pMap.getMapResource();
baseBitmaps = (groundBitmaps) ? groundBitmaps : skyBitmaps;
if (groundBitmaps){
pGroundLayerRenderer.x = -(camera.left);
pGroundLayerRenderer.y = -(camera.top);
};
if (skyBitmaps){
pSkyLayerRenderer.x = -(camera.left);
pSkyLayerRenderer.y = -(camera.top);
};
if (loopTiles){
} else {
baseBitmap = baseBitmaps[0][0];
visibleColStart = Math.floor((camera.left / baseBitmap.width));
visibleColEnd = Math.floor((camera.right / baseBitmap.width));
visibleRowStart = Math.floor((camera.top / baseBitmap.height));
visibleRowEnd = Math.floor((camera.bottom / baseBitmap.height));
i = 0;
while (i < baseBitmaps.length) {
rowArray = baseBitmaps[i];
iVisible = (((i >= visibleColStart)) && ((i <= visibleColEnd)));
j = 0;
while (j < rowArray.length) {
baseBitmap = rowArray[j];
segVisible = iVisible;
if (segVisible){
if ((((j < visibleRowStart)) || ((j > visibleRowEnd)))){
segVisible = false;
};
};
if (groundBitmaps){
pGroundLayerRenderer.setBitmapVisible(i, j, segVisible);
};
if (skyBitmaps){
pSkyLayerRenderer.setBitmapVisible(i, j, segVisible);
};
j++;
};
i++;
};
};
};
}
public function build(camera:GameCamera, useTileRendererOnGround:Boolean, useTileRendererOnSky:Boolean):void{
var layerResource:LayerResource;
var layerRenderer:MapLayerRenderer;
var ground:Boolean;
var mapResource:MapResource = pMap.getMapResource();
pCurrentLeftLoc = (pCurrentTopLoc = 0);
pScreenColumns = (Math.floor((camera.width / mapResource.tileWidth)) + 2);
pScreenRows = (Math.floor((camera.height / mapResource.tileHeight)) + 2);
pGroundLayerRenderer = new MapLayerRenderer(this, true);
pSkyLayerRenderer = new MapLayerRenderer(this, false);
pGameStage = new Sprite();
for each (layerResource in pMap.getMapResource().layers) {
if (layerResource.type == LayerResource.TYPE_STATIC){
layerRenderer = (ground) ? pGroundLayerRenderer : pSkyLayerRenderer;
if (!layerResource.isEmpty()){
layerRenderer.addLayerResource(layerResource);
};
} else {
ground = false;
};
};
if (useTileRendererOnGround){
pGroundLayerRenderer.buildTileRenderers(pScreenColumns, pScreenRows, pTileRendererClass);
} else {
pGroundLayerRenderer.buildBitmaps(camera);
};
if (useTileRendererOnSky){
pSkyLayerRenderer.buildTileRenderers(pScreenColumns, pScreenRows, pTileRendererClass);
} else {
pSkyLayerRenderer.buildBitmaps(camera);
};
addChild(pGroundLayerRenderer);
addChild(pGameStage);
if (pSkyLayerRenderer.containsResources()){
addChild(pSkyLayerRenderer);
};
pMap.getMapResource().addEventListener(MapResourceTileChangedEvent.TILE_CHANGED, onTileResourceChanged);
}
}
}//package com.liquable.game.tiledmap
Section 44
//MapTile (com.liquable.game.tiledmap.MapTile)
package com.liquable.game.tiledmap {
import com.liquable.game.geom.*;
public class MapTile extends PointInt {
private var pId:String;
public function MapTile(i:int, j:int){
super(i, j);
pId = toString();
}
public function getId():String{
return (pId);
}
}
}//package com.liquable.game.tiledmap
Section 45
//MapTileRenderer (com.liquable.game.tiledmap.MapTileRenderer)
package com.liquable.game.tiledmap {
import flash.display.*;
public class MapTileRenderer extends Sprite implements IMapTileRenderer {
private var pHighestLayerIndex:int;// = 0
private var pTile:MapTile;
public function MapTileRenderer(){
super();
}
public function beginBitmapDataFill():void{
pHighestLayerIndex = -1;
}
public function destroy():void{
pTile = null;
while (numChildren) {
removeChildAt(0);
};
}
public function setMapTile(tile:MapTile):void{
pTile = tile;
}
public function get displayObject():DisplayObject{
return (this);
}
public function getMapTile():MapTile{
return (pTile);
}
public function endBitmapDataFill():void{
var i:int;
if (pHighestLayerIndex == -1){
visible = false;
} else {
i = (pHighestLayerIndex + 1);
while (i < numChildren) {
getChildAt(i).visible = false;
i++;
};
visible = true;
};
}
public function drawBitmapData(layerIndex:int, bitmapData:BitmapData):void{
var bitmap:Bitmap;
if (layerIndex < numChildren){
bitmap = (getChildAt(layerIndex) as Bitmap);
if (bitmapData){
if (bitmap.bitmapData != bitmapData){
bitmap.bitmapData = bitmapData;
};
bitmap.visible = true;
} else {
bitmap.visible = false;
};
} else {
if (bitmapData){
bitmap = new Bitmap(bitmapData);
addChild(bitmap);
};
};
if (bitmapData){
pHighestLayerIndex = Math.max(layerIndex, pHighestLayerIndex);
};
}
}
}//package com.liquable.game.tiledmap
Section 46
//TiledMap (com.liquable.game.tiledmap.TiledMap)
package com.liquable.game.tiledmap {
import com.liquable.game.tiledmap.resources.*;
import com.liquable.game.astar.*;
public class TiledMap implements IAStarMap {
private var pTiles:Array;
private var pMapResource:MapResource;
public function TiledMap(mapResource:MapResource){
var i:int;
var tile:MapTile;
super();
pMapResource = mapResource;
pTiles = new Array();
var j:int;
while (j < pMapResource.rowCounts) {
i = 0;
while (i < pMapResource.columnCounts) {
tile = new MapTile(i, j);
pTiles.push(tile);
i++;
};
j++;
};
}
public function getMapResource():MapResource{
return (pMapResource);
}
public function getTile(i:int, j:int):MapTile{
var index:int = pMapResource.getTileIndex(i, j);
if (index == -1){
return (null);
};
return (pTiles[index]);
}
public function getPassCost(moveObject, srcX:int, srcY:int, dstX:int, dstY:int):Number{
if ((((srcX == dstX)) || ((srcY == dstY)))){
return (1);
};
return (Math.SQRT2);
}
public function getTiles():Array{
return (pTiles);
}
public function getReachedDestination(moveObject, srcX:int, srcY:int, dstX:int, dstY:int):Boolean{
return ((((srcX == dstX)) && ((srcY == dstY))));
}
public function getFCost(moveObject, srcX:int, srcY:int, dstX:int, dstY:int):Number{
return (((Math.abs((srcX - dstX)) + Math.abs((srcY - dstY))) * 10));
}
}
}//package com.liquable.game.tiledmap
Section 47
//UIController (com.liquable.game.ui.UIController)
package com.liquable.game.ui {
import com.liquable.game.*;
import flash.events.*;
import flash.display.*;
import com.liquable.game.postoffice.*;
public class UIController {
private var pApplication:GameApplication;
private var pControls:Object;
private var pDelayFrames:int;
private var pKeyMap:Object;
private var pPostOffice:PostOffice;
protected var pReceiverID:String;
private var pMessageQueue:Array;// = null
private var pDelayFrame:int;
public static const KEY_DOWN:String = "keyDown";
public static const MOUSE_MOVE:String = "mouseMove";
public static const POST_NAME:String = "CONTROLLER";
public static const MOUSE_UP:String = "mouseUp";
public static const KEY_UP:String = "keyUp";
public static const MOUSE_DOWN:String = "mouseDown";
public function UIController(receiverID:String, app:GameApplication, postOffice:PostOffice=null){
pControls = new Object();
super();
pApplication = app;
pReceiverID = receiverID;
pPostOffice = ((postOffice)!=null) ? postOffice : pApplication.getPostOffice();
pControls[MOUSE_MOVE] = {stage:null, func:mouse_move};
pControls[MOUSE_DOWN] = {stage:null, func:mouse_down};
pControls[MOUSE_UP] = {stage:null, func:mouse_up};
pControls[KEY_DOWN] = {stage:null, func:key_down};
pControls[KEY_UP] = {stage:null, func:key_up};
pKeyMap = new Object();
}
public function stop():void{
pApplication.removeUpdateFunction(update);
pMessageQueue = null;
}
protected function update(e:Event):void{
var delay:int;
var msg:UIData;
if (pDelayFrame < pDelayFrames){
pDelayFrame++;
} else {
delay = 0;
if (pMessageQueue){
for each (msg in pMessageQueue) {
if (msg != null){
pPostOffice.sendMessage(null, pReceiverID, msg, delay);
delay = Math.min(pDelayFrames, (delay + 1));
};
};
pMessageQueue = new Array();
};
pDelayFrame = 0;
};
}
protected function key_up(e:KeyboardEvent):void{
var msg:UIData;
if (pMessageQueue){
msg = new UIData(UIController.KEY_UP);
msg.keyCode = e.keyCode;
key_updn_insert(msg, e.keyCode);
};
pKeyMap[e.keyCode] = false;
}
protected function mouse_down(e:MouseEvent):void{
var msg:UIData;
if (pMessageQueue){
msg = new UIData(UIController.MOUSE_DOWN);
msg.localX = e.localX;
msg.localY = e.localY;
msg.stageX = e.stageX;
msg.stageY = e.stageY;
mouse_updn_insert(msg);
};
}
public function resetKey(keyCode:int):void{
pKeyMap[keyCode] = false;
}
private function mouse_updn_insert(msg:UIData):void{
var m:UIData;
var j:int;
var i:int;
while (i < pMessageQueue.length) {
m = pMessageQueue[i];
if (((!((m == null))) && ((m.type == msg.type)))){
pMessageQueue[i] = null;
j = (i + 1);
while (j < pMessageQueue.length) {
if (((!((m == null))) && ((((m.type == UIController.MOUSE_DOWN)) || ((m.type == UIController.MOUSE_UP)))))){
pMessageQueue[j] = null;
};
j++;
};
break;
};
i++;
};
pMessageQueue.push(msg);
}
private function key_updn_insert(msg:UIData, key:uint):void{
var m:UIData;
var j:int;
var i:int;
while (i < pMessageQueue.length) {
m = pMessageQueue[i];
if (((((!((m == null))) && ((m.type == msg.type)))) && ((m.keyCode == key)))){
pMessageQueue[i] = null;
j = (i + 1);
while (j < pMessageQueue.length) {
m = pMessageQueue[j];
if (((((!((m == null))) && ((((m.type == UIController.KEY_DOWN)) || ((m.type == UIController.KEY_UP)))))) && ((m.keyCode == key)))){
pMessageQueue[j] = null;
};
j++;
};
break;
};
i++;
};
pMessageQueue.push(msg);
}
public function getControlStage(type:String):DisplayObjectContainer{
var obj:Object = pControls[type];
if (obj != null){
return (obj.stage);
};
return (null);
}
public function isKeyDown(keyCode:uint):Boolean{
return (pKeyMap[keyCode]);
}
public function terminate():void{
var type:String;
stop();
for (type in pControls) {
removeControl(type);
};
}
public function start(delayframes:int):void{
var e:MouseEvent;
pDelayFrames = delayframes;
pDelayFrame = 0;
pApplication.addUpdateFunction(update);
pMessageQueue = new Array();
var cstage:DisplayObjectContainer = getControlStage(UIController.MOUSE_MOVE);
if (cstage != null){
e = new MouseEvent(MouseEvent.MOUSE_MOVE);
e.localX = cstage.mouseX;
e.localY = cstage.mouseY;
mouse_move(e);
};
pKeyMap = new Object();
}
protected function key_down(e:KeyboardEvent):void{
var msg:UIData;
if (!pKeyMap[e.keyCode]){
if (pMessageQueue){
msg = new UIData(UIController.KEY_DOWN);
msg.keyCode = e.keyCode;
key_updn_insert(msg, e.keyCode);
};
pKeyMap[e.keyCode] = true;
};
}
protected function mouse_move(e:MouseEvent):void{
var msg:UIData;
var i:int;
var m:UIData;
if (pMessageQueue){
msg = new UIData(UIController.MOUSE_MOVE);
msg.localX = e.localX;
msg.localY = e.localY;
msg.stageX = e.stageX;
msg.stageY = e.stageY;
i = 0;
while (i < pMessageQueue.length) {
m = pMessageQueue[i];
if (((!((m == null))) && ((m.type == msg.type)))){
pMessageQueue[i] = null;
};
i++;
};
pMessageQueue.push(msg);
};
}
protected function mouse_up(e:MouseEvent):void{
var msg:UIData;
if (pMessageQueue){
msg = new UIData(UIController.MOUSE_UP);
msg.localX = e.localX;
msg.localY = e.localY;
msg.stageX = e.stageX;
msg.stageY = e.stageY;
mouse_updn_insert(msg);
};
}
public function removeControl(type:String):void{
var obj:Object = pControls[type];
if (obj != null){
if (obj.stage != null){
obj.stage.removeEventListener(type, obj.func);
obj.stage = null;
};
};
}
public function addControl(inStage:DisplayObject, type:String):void{
var obj:Object = pControls[type];
if (obj != null){
inStage.addEventListener(type, obj.func);
obj.stage = inStage;
};
}
}
}//package com.liquable.game.ui
Section 48
//UIData (com.liquable.game.ui.UIData)
package com.liquable.game.ui {
import com.liquable.game.postoffice.*;
public class UIData implements IPostData {
public var stageY:Number;
private var pType:String;
public var keyCode:uint;
public var localX:Number;
public var localY:Number;
public var stageX:Number;
public static const DATA_TYPE:String = "UIData";
public function UIData(inType:String){
super();
pType = inType;
}
public function get type():String{
return (pType);
}
public function get data_type():String{
return (DATA_TYPE);
}
}
}//package com.liquable.game.ui
Section 49
//GameApplication (com.liquable.game.GameApplication)
package com.liquable.game {
import flash.events.*;
import com.liquable.media.*;
import com.liquable.game.debug.*;
import com.liquable.game.events.*;
import flash.display.*;
import com.liquable.game.postoffice.*;
import com.liquable.utils.*;
import flash.utils.*;
public class GameApplication extends EventDispatcher {
private var pDebugPanel:DebugPanel;
private var pPostOffice:PostOffice;
private var pTargetFps:int;
private var pNextUpdateTime:int;// = 0
private var pPostClient:PostClient;
private var pIsRunning:Boolean;
private var pMilliSpf:int;
private var pSoundManager:SoundManager;
private var pAutoAdjustFramerate:Boolean;
private var pUpdateEvent:GameApplicationUpdateEvent;
private var pUpdateFunctions:Array;
private var pFramesToCount:int;// = 30
private var pGameHeight:Number;
private var pTempUpdateFunctions:Array;
private var pOriginFps:int;
private var pCurrentTime:int;
private var pRealFps:int;
private var pFrameCounter:int;
private var pGameWidth:Number;
private var pAutoAdjustQuality:Boolean;
private var pRoot:Sprite;
public function GameApplication(root:Sprite, width:int, height:int, debug:Boolean){
super();
pOriginFps = -1;
pIsRunning = false;
pRoot = root;
pGameWidth = width;
pGameHeight = height;
pPostOffice = new PostOffice(this, PostOffice.TIME_UNIT_FRAME);
pPostClient = new PostClient(pPostOffice);
pPostClient.setReceivePostFunction(onReceivedPost);
pSoundManager = new SoundManager(this);
pUpdateFunctions = new Array();
pTempUpdateFunctions = new Array();
if (debug){
pDebugPanel = new DebugPanel(this);
};
}
public function getStageFps():Number{
return (pRoot.stage.frameRate);
}
public function stop():void{
pPostOffice.stop();
if (pIsRunning){
pRoot.removeEventListener(Event.ENTER_FRAME, onGltEnterFrame);
pIsRunning = false;
};
if (pRoot.stage){
pRoot.stage.frameRate = pOriginFps;
};
}
public function setBackgroundColor(inColor:uint):void{
pRoot.graphics.clear();
pRoot.graphics.beginFill(inColor);
pRoot.graphics.drawRect(0, 0, pGameWidth, pGameHeight);
pRoot.graphics.endFill();
}
public function getSoundManager():SoundManager{
return (pSoundManager);
}
public function stopAutoAdjustQuality(quality:String):void{
pAutoAdjustQuality = false;
if (quality){
if (pRoot){
pRoot.stage.quality = quality;
};
};
}
private function onReceivedPost(post:PostPackage):void{
var data:DelayFunctionPostData;
if (post.data.data_type == DelayFunctionPostData.DATA_TYPE){
data = DelayFunctionPostData(post.data);
data.process();
};
}
public function debugPrintln(line:String):void{
if (pDebugPanel != null){
pDebugPanel.getDebugConsole().println(line);
};
}
public function debugConsoleSize(width:Number, height:Number):void{
if (pDebugPanel != null){
pDebugPanel.getDebugConsole().setDimension(width, height);
};
}
public function getRealFps():int{
return (pRealFps);
}
public function get gameHeight():Number{
return (pGameHeight);
}
public function startAutoAdjustQuality():void{
pAutoAdjustQuality = true;
}
public function getStage():Stage{
return (pRoot.stage);
}
public function addUpdateFunction(func:Function):void{
ArrayUtil.addArrayUniqueElement(pUpdateFunctions, func);
}
public function addDelayFunction(func:Function, parameter:Object, delay:int):void{
var post:DelayFunctionPostData = new DelayFunctionPostData(func, parameter);
pPostClient.sendMessage(pPostClient.getPostId(), post, delay);
}
public function terminate():void{
stop();
pPostOffice.terminate();
pPostOffice = null;
pSoundManager = null;
pRoot = null;
pUpdateFunctions = null;
pTempUpdateFunctions = null;
}
public function removeUpdateFunction(func:Function):void{
ArrayUtil.removeArrayElement(pUpdateFunctions, func);
ArrayUtil.removeArrayElement(pTempUpdateFunctions, func);
}
public function getRoot():Sprite{
return (pRoot);
}
public function getTargetFps():int{
return (pTargetFps);
}
private function onGltEnterFrame(e:Event):void{
var dfps:int;
var dFlashFps:int;
var func:Function;
var timer:int = getTimer();
if (pRoot.stage){
if (pOriginFps < 0){
pOriginFps = pRoot.stage.frameRate;
pRoot.stage.frameRate = pTargetFps;
} else {
if (++pFrameCounter == pFramesToCount){
if (pCurrentTime != -1){
pRealFps = Math.round(((pFramesToCount / (timer - pCurrentTime)) * 1000));
dfps = (pTargetFps - pRealFps);
if (pAutoAdjustFramerate){
if (dfps > 0){
pRoot.stage.frameRate = Math.min(39, (pRoot.stage.frameRate + Math.min(30, Math.ceil((dfps * 0.7)))));
} else {
if (dfps < -10){
pRoot.stage.frameRate = Math.max(pTargetFps, (pRoot.stage.frameRate + Math.max(-50, Math.floor((dfps * 0.8)))));
} else {
if (dfps < -1){
pRoot.stage.frameRate = Math.max(pTargetFps, (pRoot.stage.frameRate - 1));
};
};
};
};
if (pAutoAdjustQuality){
if (pAutoAdjustFramerate){
dFlashFps = (pRoot.stage.frameRate - pTargetFps);
switch (pRoot.stage.quality){
case StageQuality.MEDIUM:
if (dFlashFps > 30){
if (dfps > 0){
pRoot.stage.quality = StageQuality.LOW;
};
} else {
if (dFlashFps < 8){
if (dfps < 0){
pRoot.stage.quality = StageQuality.HIGH;
};
};
};
break;
case StageQuality.LOW:
if (dFlashFps < 12){
if (dfps < 0){
pRoot.stage.quality = StageQuality.MEDIUM;
};
};
break;
case StageQuality.HIGH:
if ((((dFlashFps > 22)) && ((dfps > 0)))){
pRoot.stage.quality = StageQuality.MEDIUM;
};
break;
default:
pRoot.stage.quality = StageQuality.HIGH;
break;
};
} else {
switch (pRoot.stage.quality){
case StageQuality.MEDIUM:
if (dfps > 7){
pRoot.stage.quality = StageQuality.LOW;
} else {
if (dfps < 3){
pRoot.stage.quality = StageQuality.HIGH;
};
};
break;
case StageQuality.LOW:
if (dfps < 3){
pRoot.stage.quality = StageQuality.MEDIUM;
};
break;
case StageQuality.HIGH:
if (dfps > 7){
pRoot.stage.quality = StageQuality.MEDIUM;
};
break;
default:
pRoot.stage.quality = StageQuality.HIGH;
break;
};
};
};
};
pCurrentTime = timer;
pFrameCounter = 0;
};
};
};
if (pUpdateEvent == null){
pUpdateEvent = new GameApplicationUpdateEvent(GameApplicationUpdateEvent.GAME_APPLICATION_UPDATE, timer, (timer > pNextUpdateTime));
} else {
pUpdateEvent.reset(timer, (timer > pNextUpdateTime));
};
pTempUpdateFunctions = pUpdateFunctions.slice(0);
if (hasEventListener(GameApplicationUpdateErrorEvent.GAME_APPLICATION_UPDATE_ERROR)){
appUpdater(this, pUpdateEvent, pTempUpdateFunctions);
} else {
while (pTempUpdateFunctions.length) {
func = pTempUpdateFunctions.shift();
func(pUpdateEvent);
};
};
pNextUpdateTime = (pNextUpdateTime + pMilliSpf);
}
public function debugWatchItem(uniqueTitle:String, debugItem:DebugItem):void{
if (pDebugPanel != null){
pDebugPanel.addDebugItem(uniqueTitle, debugItem);
};
}
public function get gameWidth():Number{
return (pGameWidth);
}
public function setDebugPanelRoot(debugRoot:DisplayObjectContainer):void{
if (pDebugPanel){
if (pDebugPanel.parent){
pDebugPanel.parent.removeChild(pDebugPanel);
};
debugRoot.addChild(pDebugPanel);
};
}
public function getPostOffice():PostOffice{
return (pPostOffice);
}
public function start(fps:int, autoAdjustFramerate:Boolean=true, autoAdjustQuality:Boolean=false):void{
DesignContract.preCondition(!((pRoot == null)), "GameApplication is not initialized yet.");
pPostClient.setPostId("GameApplication");
pFramesToCount = (Math.max(12, fps) * 5);
pNextUpdateTime = (pCurrentTime = -1);
pRealFps = (pTargetFps = fps);
pMilliSpf = Math.floor((1000 / pTargetFps));
pFrameCounter = 0;
pAutoAdjustFramerate = autoAdjustFramerate;
pAutoAdjustQuality = autoAdjustQuality;
if (!pIsRunning){
pRoot.addEventListener(Event.ENTER_FRAME, onGltEnterFrame, false, 10);
pIsRunning = true;
};
pPostOffice.start();
}
public function hasUpdateFunction(func:Function):Boolean{
return (!((pUpdateFunctions.indexOf(func) == -1)));
}
private static function appUpdater(app:GameApplication, e:GameApplicationUpdateEvent, updateFunctions:Array):void{
var func:Function;
var errorEvent:GameApplicationUpdateErrorEvent;
var app = app;
var e = e;
var updateFunctions = updateFunctions;
while (updateFunctions.length) {
while (updateFunctions.length) {
func = updateFunctions.shift();
func(e);
};
continue;
var _slot1 = e;
errorEvent = new GameApplicationUpdateErrorEvent(GameApplicationUpdateErrorEvent.GAME_APPLICATION_UPDATE_ERROR, _slot1.message, _slot1.getStackTrace(), false, false);
app.dispatchEvent(errorEvent);
};
}
}
}//package com.liquable.game
import com.liquable.game.postoffice.*;
class DelayFunctionPostData implements IPostData {
private var pFunction:Function;
private var pParameter:Object;
public static const DATA_TYPE:String = "DelayFunctionPostData";
private function DelayFunctionPostData(func:Function, parameter:Object){
super();
pFunction = func;
pParameter = parameter;
}
public function get data_type():String{
return (DATA_TYPE);
}
public function process():void{
pFunction(pParameter);
}
}
Section 50
//SoundController (com.liquable.media.SoundController)
package com.liquable.media {
import flash.events.*;
import flash.media.*;
public class SoundController {
private var pChannel:SoundChannel;
private var pPan:Number;
private var pFadingFromVolume:Number;
private var pManager:SoundManager;
private var pPlaying:Boolean;
private var pFadingTotalframes:int;
private var pOnFadeComplete:Function;
private var pFadingToVolume:Number;
private var pVolume:Number;
private var pFadingCurrentframe:int;
public function SoundController(manager:SoundManager, channel:SoundChannel){
super();
pManager = manager;
pChannel = channel;
pVolume = 1;
pPan = 0;
if (pChannel){
pPlaying = true;
pChannel.addEventListener(Event.SOUND_COMPLETE, onComplete);
} else {
pPlaying = false;
};
}
public function stop():void{
if (pChannel){
stopFading();
pChannel.removeEventListener(Event.SOUND_COMPLETE, onComplete);
pChannel.stop();
pChannel = null;
};
pPlaying = false;
}
public function getVolume():Number{
return (pVolume);
}
public function fadeInAndOut(toVolume:Number, inDuration:int, stayDuration:int, outDuration:int):void{
var toVolume = toVolume;
var inDuration = inDuration;
var stayDuration = stayDuration;
var outDuration = outDuration;
fade(0, toVolume, inDuration, function (snd:SoundController):void{
pManager.getApplication().addDelayFunction(fadeOut, outDuration, stayDuration);
});
}
public function fadeIn(toVolume:Number, duration:int):void{
fade(0, toVolume, duration, null);
}
public function stopFading():void{
pManager.getApplication().removeUpdateFunction(fade_update);
pOnFadeComplete = null;
}
public function setPan(pan:Number):void{
var transform:SoundTransform;
pPan = pan;
if (pChannel){
transform = pChannel.soundTransform;
transform.pan = pPan;
pChannel.soundTransform = transform;
};
}
public function setVolume(vol:Number):void{
var transform:SoundTransform;
pVolume = vol;
if (pChannel){
transform = pChannel.soundTransform;
transform.volume = pVolume;
pChannel.soundTransform = transform;
};
}
public function getPan():Number{
return (pPan);
}
public function isPlaying():Boolean{
return (pPlaying);
}
private function fade_update(e:Event):void{
var scale:Number;
var onFadeComplete:Function;
pFadingCurrentframe++;
if (pFadingCurrentframe < pFadingTotalframes){
scale = (pFadingCurrentframe / pFadingTotalframes);
setVolume((pFadingFromVolume + ((pFadingToVolume - pFadingFromVolume) * scale)));
} else {
setVolume(pFadingToVolume);
onFadeComplete = pOnFadeComplete;
stopFading();
if (onFadeComplete != null){
onFadeComplete(this);
};
};
}
public function getSoundChannel():SoundChannel{
return (pChannel);
}
public function fadeOut(duration:int):void{
var duration = duration;
fade(getVolume(), 0, duration, function (snd:SoundController):void{
stop();
});
}
public function fade(fromVolume:Number, toVolume:Number, duration:int, onFadeComplete:Function=null):void{
pFadingFromVolume = fromVolume;
pFadingToVolume = toVolume;
pFadingCurrentframe = 0;
pFadingTotalframes = duration;
pOnFadeComplete = onFadeComplete;
setVolume(pFadingFromVolume);
pManager.getApplication().addUpdateFunction(fade_update);
}
private function onComplete(e:Event):void{
stop();
}
}
}//package com.liquable.media
Section 51
//SoundManager (com.liquable.media.SoundManager)
package com.liquable.media {
import com.liquable.game.*;
import flash.media.*;
import com.liquable.utils.*;
import flash.utils.*;
public class SoundManager {
private var pApplication:GameApplication;
private var pSoundLib:Dictionary;
public function SoundManager(app:GameApplication){
super();
pApplication = app;
pSoundLib = new Dictionary();
}
public function getGlobalVolume():Number{
return (SoundMixer.soundTransform.volume);
}
public function getGlobalPan():Number{
return (SoundMixer.soundTransform.pan);
}
public function setGlobalPan(pan:Number):void{
SoundMixer.soundTransform = new SoundTransform(getGlobalVolume(), pan);
}
private function getSound(soundClass:Class):Sound{
var snd:Sound = pSoundLib[soundClass];
if (snd == null){
snd = new (soundClass);
pSoundLib[soundClass] = snd;
};
return (snd);
}
public function getApplication():GameApplication{
return (pApplication);
}
public function playSound(soundClass:Class, loop:Boolean, startTime:Number=0):SoundController{
var snd:Sound = getSound(soundClass);
DesignContract.preCondition((startTime < snd.length), (((("startTime is greater than the sound length: play(" + startTime) + " / ") + snd.length) + ")"));
var channel:SoundChannel = snd.play(startTime, (loop) ? int.MAX_VALUE : 0);
var controller:SoundController = new SoundController(this, channel);
return (controller);
}
public function setGlobalVolume(volume:Number):void{
SoundMixer.soundTransform = new SoundTransform(volume, getGlobalPan());
}
}
}//package com.liquable.media
Section 52
//State (com.liquable.statemachine.State)
package com.liquable.statemachine {
class State {
var mProcessFunc:Function;
var mEnterFunc:Function;
var mExitFunc:Function;
function State(enter:Function, process:Function, exit:Function){
super();
mEnterFunc = enter;
mProcessFunc = process;
mExitFunc = exit;
}
}
}//package com.liquable.statemachine
Section 53
//StateMachine (com.liquable.statemachine.StateMachine)
package com.liquable.statemachine {
import com.liquable.utils.*;
import com.liquable.data.*;
public class StateMachine {
private var pDebug:Boolean;// = false
private var pPreProcessFunction:Function;
private var pPostProcessFunction:Function;
private var pStateName:String;
protected var pStateHash:Object;
private var pCurrState:State;
private var pData:MapData;
private static const INVALID_STATE_NAME:String = "-invalid+";
public function StateMachine(){
super();
pStateHash = new Object();
}
public function destroy():void{
setState(null);
pData = null;
pStateHash = null;
pPostProcessFunction = (pPreProcessFunction = null);
}
public function setPreProcessFunction(func:Function):void{
pPreProcessFunction = func;
}
public function setState(inState:String):void{
if (pDebug){
trace(("set state: " + inState));
};
var prevState:State = pCurrState;
var prevStateName:String = pStateName;
pCurrState = null;
pStateName = INVALID_STATE_NAME;
if (((!((prevState == null))) && (!((prevState.mExitFunc == null))))){
prevState.mExitFunc(inState);
};
if (pStateName == INVALID_STATE_NAME){
pStateName = inState;
if (inState != null){
pCurrState = pStateHash[inState];
DesignContract.preCondition(!((pCurrState == null)), (("StateMachine : " + inState) + " has not been inited as a state"));
};
if (((pCurrState) && (!((pCurrState.mEnterFunc == null))))){
pCurrState.mEnterFunc(prevStateName);
};
};
}
public function setDebug(debug:Boolean):void{
pDebug = debug;
}
public function getStateName():String{
return (pStateName);
}
protected function getState():State{
return (pCurrState);
}
public function initState(name:String, enter:Function, process:Function, exit:Function):void{
pStateHash[name] = new State(enter, process, exit);
}
public function isInState(state:String):Boolean{
return ((pStateName == state));
}
public function setPostProcessFunction(func:Function):void{
pPostProcessFunction = func;
}
public function get data():MapData{
if (pData == null){
pData = new MapData();
};
return (pData);
}
public function process(data:IValidData):void{
if (data.isValid()){
if (pPreProcessFunction != null){
pPreProcessFunction(data);
};
if (((((data.isValid()) && (!((pCurrState == null))))) && (!((pCurrState.mProcessFunc == null))))){
pCurrState.mProcessFunc(data);
};
if (((!((pPostProcessFunction == null))) && (data.isValid()))){
pPostProcessFunction(data);
};
};
}
}
}//package com.liquable.statemachine
Section 54
//ArrayUtil (com.liquable.utils.ArrayUtil)
package com.liquable.utils {
public class ArrayUtil {
public function ArrayUtil(){
super();
}
public static function createUniformArray(value, length:uint):Array{
var array:Array = new Array(length);
var i:int;
while (i < array.length) {
array[i] = value;
i++;
};
return (array);
}
public static function arrayIntersect(array1:Array, array2:Array):Array{
var el:Object;
var array:Array = array1.slice();
for each (el in array2) {
if (array.indexOf(el) == -1){
ArrayUtil.removeArrayElement(array, el);
};
};
return (array);
}
public static function removeArrayElement(array:Array, element:Object):Boolean{
var index:int = array.indexOf(element);
if (index < 0){
return (false);
};
array.splice(index, 1);
return (true);
}
public static function convertMapValuesByKeyToArray(map:Object, key:Object):Array{
var value:Object;
var array:Array = new Array();
for each (value in map) {
array.push(value[key]);
};
return (array);
}
public static function swapElements(array:Array, index1:int, index2:int):void{
var el:* = array[index1];
array[index1] = array[index2];
array[index2] = el;
}
public static function convertMapValuesToArray(map:Object):Array{
var value:Object;
var array:Array = new Array();
for each (value in map) {
array.push(value);
};
return (array);
}
public static function convertMapKeysToArray(map:Object):Array{
var key:Object;
var array:Array = new Array();
for (key in map) {
array.push(key);
};
return (array);
}
public static function addArrayUniqueElement(array:Array, element:Object):Boolean{
if (array.indexOf(element) < 0){
array.push(element);
return (true);
};
return (false);
}
public static function getArrayRandomElement(array:Array, removeTheElement:Boolean){
var randomIndex:int;
var element:*;
if (((array) && (array.length))){
randomIndex = IntUtil.random((array.length - 1));
element = array[randomIndex];
if (removeTheElement){
array.splice(randomIndex, 1);
};
return (element);
};
return (null);
}
public static function findIndexOfFirstMatchedProperty(array:Array, propertyName:String, value:Object, start:int=0):int{
var el:Object;
var i:int = start;
while (i < array.length) {
el = array[i];
if (((el.hasOwnProperty(propertyName)) && ((el[propertyName] == value)))){
return (i);
};
i++;
};
return (-1);
}
public static function makeUniqueArray(array:Array):Array{
var uniqueArray:Array = new Array();
return (arrayMerge(uniqueArray, array));
}
public static function arrayMerge(array1:Array, array2:Array):Array{
var el:Object;
var array:Array = array1.slice();
for each (el in array2) {
if (array.indexOf(el) == -1){
array.push(el);
};
};
return (array);
}
}
}//package com.liquable.utils
Section 55
//DesignContract (com.liquable.utils.DesignContract)
package com.liquable.utils {
public final class DesignContract {
public function DesignContract(){
super();
}
public static function invariant(condition:Boolean, message:String=null):Boolean{
return (postCondition(condition, message));
}
public static function postCondition(condition:Boolean, message:String=null):Boolean{
if (!condition){
throw (new ArgumentError(message));
};
return (true);
}
public static function preCondition(condition:Boolean, message:String=null):void{
if (!condition){
throw (new ArgumentError(message));
};
}
}
}//package com.liquable.utils
Section 56
//Enum (com.liquable.utils.Enum)
package com.liquable.utils {
public class Enum {
private var pNumEnums:int;
public function Enum(base:int=0){
super();
pNumEnums = base;
}
public function get NUM_ENUMS():int{
return (pNumEnums);
}
public function nextIndex():int{
return (pNumEnums++);
}
}
}//package com.liquable.utils
Section 57
//IntUtil (com.liquable.utils.IntUtil)
package com.liquable.utils {
public class IntUtil {
public function IntUtil(){
super();
}
public static function formatAddComma(value:int):String{
var str:String;
if (value == 0){
return ("0");
};
var finalStr:String = "";
while (value > 0) {
str = String((value % 1000));
value = Math.floor((value / 1000));
if (value > 0){
while (str.length < 3) {
str = ("0" + str);
};
str = ("," + str);
};
finalStr = (str + finalStr);
};
return (finalStr);
}
public static function random(max:int):int{
return (Math.floor((Math.random() * (max + 1))));
}
public static function randomBetween(min:int, max:int):int{
if (min < max){
return ((min + Math.floor((Math.random() * ((max - min) + 1)))));
};
if (min > max){
return (randomBetween(max, min));
};
return (min);
}
}
}//package com.liquable.utils
Section 58
//MapData (com.liquable.utils.MapData)
package com.liquable.utils {
public class MapData {
private var pData:Object;
public function MapData(data:Object=null){
pData = new Object();
super();
importData(data);
}
public function removeKey(key:String):void{
delete pData[key];
}
public function getString(key:String):String{
var value:Object = getValue(key);
if (value != null){
return (String(value));
};
return (null);
}
public function clear():void{
pData = new Object();
}
public function setValue(key:String, value):void{
pData[key] = value;
}
public function getBoolean(key:String):Boolean{
return (Boolean(getValue(key)));
}
public function importData(data:Object):void{
var key:String;
if (data != null){
if ((data is MapData)){
data = MapData(data).exportData();
};
for (key in data) {
pData[key] = data[key];
};
};
}
public function getInt(key:String):int{
return (int(getValue(key)));
}
public function getValue(key:String){
if (pData.hasOwnProperty(key)){
return (pData[key]);
};
return (null);
}
public function exportData():Object{
var key:String;
var d:Object;
var output:Object = new Object();
for (key in pData) {
d = pData[key];
if ((d is MapData)){
d = (d as MapData).exportData();
};
output[key] = d;
};
return (output);
}
public function getNumber(key:String):Number{
return (Number(getValue(key)));
}
}
}//package com.liquable.utils
Section 59
//MathUtil (com.liquable.utils.MathUtil)
package com.liquable.utils {
public class MathUtil {
public static const HALF_PI:Number = 1.5707963267949;
public static const TWO_PI:Number = 6.28318530717959;
private static const _PI_DIVIDED_BY_180:Number = 0.0174532925199433;
private static const _180_DIVIDED_BY_PI:Number = 57.2957795130823;
public function MathUtil(){
super();
}
public static function degrees2radians(inDegrees:Number):Number{
return ((inDegrees * _PI_DIVIDED_BY_180));
}
public static function degreesFollowTarget(degrees:Number, target:Number, sp:Number, minDegrees:Number=1, maxDegrees:Number=1.79769313486232E308):Number{
var dr:Number = (target - degrees);
while (dr > 180) {
dr = (dr - 360);
};
while (dr < -180) {
dr = (dr + 360);
};
return (numberFollowTarget((target - dr), target, sp, minDegrees, maxDegrees));
}
public static function numberFollowTarget(num:Number, target:Number, sp:Number, minDistance:Number, maxDistance:Number=1.79769313486232E308):Number{
var movex:Number;
var absMovex:Number;
var dx:Number = (target - num);
if (Math.abs(dx) > minDistance){
movex = (dx * sp);
absMovex = Math.abs(movex);
if (absMovex < minDistance){
movex = ((movex > 0)) ? minDistance : -(minDistance);
} else {
if (absMovex > maxDistance){
movex = ((movex > 0)) ? maxDistance : -(maxDistance);
};
};
return ((num + movex));
};
return (target);
}
public static function radians2degrees(inRadians:Number):Number{
return ((inRadians * _180_DIVIDED_BY_PI));
}
public static function makePreciseFloat(floatNumber:Number, numPrecise:int=3):Number{
var scale:Number = 1;
var i:int;
while (i < numPrecise) {
scale = (scale * 10);
i++;
};
return ((Math.floor((floatNumber * scale)) / scale));
}
public static function radiansFollowTarget(radians:Number, target:Number, sp:Number, minRadians:Number=0.01, maxRadians:Number=1.79769313486232E308):Number{
var dr:Number = (target - radians);
while (dr > Math.PI) {
dr = (dr - TWO_PI);
};
while (dr < -(Math.PI)) {
dr = (dr + TWO_PI);
};
return (numberFollowTarget((target - dr), target, sp, minRadians, maxRadians));
}
public static function formatTimer(time:int):String{
var minutes:int = Math.floor(((time / 1000) / 60));
var seconds:int = Math.floor(((time - ((minutes * 60) * 1000)) / 1000));
var msecs:int = Math.floor(((time % 1000) / 10));
var mstr:String = ("" + minutes);
while (mstr.length < 2) {
mstr = ("0" + mstr);
};
var sstr:String = ("" + seconds);
while (sstr.length < 2) {
sstr = ("0" + sstr);
};
var msstr:String = ("" + msecs);
while (msstr.length < 2) {
msstr = ("0" + msstr);
};
return (((((mstr + ":") + sstr) + ":") + msstr));
}
}
}//package com.liquable.utils
Section 60
//VisualSprite (com.liquable.visualstack.VisualSprite)
package com.liquable.visualstack {
import flash.display.*;
import com.liquable.utils.*;
public class VisualSprite extends Sprite {
private var pData:MapData;
public function VisualSprite(){
pData = new MapData();
super();
}
public function onHide():void{
}
protected function get data():MapData{
return (pData);
}
public function setBackgroundColor(inColor:uint):void{
graphics.clear();
graphics.beginFill(inColor);
graphics.drawRect(0, 0, getStack().stageWidth, getStack().stageHeight);
graphics.endFill();
}
protected function processDone():void{
var stack:VisualStack = getStack();
if (stack){
stack.childProcessDone(this);
};
}
public function onPush():void{
}
public function getStack():VisualStack{
return (VisualStack(this.parent));
}
public function onReveal(data:MapData):void{
}
public function onPop():MapData{
return (pData);
}
}
}//package com.liquable.visualstack
Section 61
//VisualStack (com.liquable.visualstack.VisualStack)
package com.liquable.visualstack {
import flash.display.*;
import com.liquable.utils.*;
public class VisualStack extends Sprite {
private var pEmptyCallback:Function;// = null
private var pWidth:Number;
private var pHeight:Number;
public function VisualStack(w:Number, h:Number){
super();
pWidth = w;
pHeight = h;
}
public function push(inItem:VisualSprite):int{
if (this.numChildren){
getTopItem().onHide();
};
this.addChild(inItem);
inItem.onPush();
return (this.numChildren);
}
public function get stageHeight():Number{
return (pHeight);
}
public function get stageWidth():Number{
return (pWidth);
}
public function setEmptyCallback(callback:Function):void{
pEmptyCallback = callback;
}
public function pop():VisualSprite{
DesignContract.preCondition((this.numChildren > 0), "there must always be at least one item in the stack to use pop");
this.stage.focus = this.stage;
var item:VisualSprite = VisualSprite(this.removeChildAt((this.numChildren - 1)));
var data:MapData = item.onPop();
if (this.numChildren){
getTopItem().onReveal(data);
} else {
if (pEmptyCallback != null){
pEmptyCallback(data);
};
};
return (item);
}
public function getTopItem():VisualSprite{
if (this.numChildren){
return (VisualSprite(this.getChildAt((this.numChildren - 1))));
};
return (null);
}
public function childProcessDone(child:VisualSprite):void{
if (DesignContract.postCondition((child == getTopItem()), "child Done not on the top of the stack.")){
pop();
};
}
public function setBackgroundColor(bgcolor:uint):void{
this.graphics.clear();
this.graphics.beginFill(bgcolor);
this.graphics.drawRect(0, 0, pWidth, pHeight);
this.graphics.endFill();
}
}
}//package com.liquable.visualstack
Section 62
//messaging_combo_mc_3 (combos_fla.messaging_combo_mc_3)
package combos_fla {
import flash.display.*;
import flash.text.*;
public dynamic class messaging_combo_mc_3 extends MovieClip {
public var combosText:TextField;
}
}//package combos_fla
Section 63
//Symbol1_2 (combos_fla.Symbol1_2)
package combos_fla {
import flash.display.*;
public dynamic class Symbol1_2 extends MovieClip {
public var combosText:MovieClip;
}
}//package combos_fla
Section 64
//MC_ButtonSoundWiggleOver_12 (HUD01_fla.MC_ButtonSoundWiggleOver_12)
package HUD01_fla {
import flash.display.*;
public dynamic class MC_ButtonSoundWiggleOver_12 extends MovieClip {
public function MC_ButtonSoundWiggleOver_12(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package HUD01_fla
Section 65
//MC_HealthBarExample_5 (HUD01_fla.MC_HealthBarExample_5)
package HUD01_fla {
import flash.display.*;
public dynamic class MC_HealthBarExample_5 extends MovieClip {
public var bar:MovieClip;
}
}//package HUD01_fla
Section 66
//MC_HelpWiggleOver_10 (HUD01_fla.MC_HelpWiggleOver_10)
package HUD01_fla {
import flash.display.*;
public dynamic class MC_HelpWiggleOver_10 extends MovieClip {
public function MC_HelpWiggleOver_10(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package HUD01_fla
Section 67
//mc_msg_dayx_16 (HUD01_fla.mc_msg_dayx_16)
package HUD01_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class mc_msg_dayx_16 extends MovieClip {
public var labelText:TextField;
public var rootClip:MovieClip;
public function mc_msg_dayx_16(){
addFrameScript(0, frame1);
}
function frame1(){
rootClip = (parent as MovieClip);
if (((rootClip) && (rootClip.nights))){
this.labelText.text = (("" + rootClip.nights) + ":");
};
}
}
}//package HUD01_fla
Section 68
//MC_SoundToggleWiggleOver_14 (HUD01_fla.MC_SoundToggleWiggleOver_14)
package HUD01_fla {
import flash.display.*;
public dynamic class MC_SoundToggleWiggleOver_14 extends MovieClip {
public function MC_SoundToggleWiggleOver_14(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package HUD01_fla
Section 69
//messaging_combo_mc_19 (HUD01_fla.messaging_combo_mc_19)
package HUD01_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class messaging_combo_mc_19 extends MovieClip {
public var labelText:TextField;
public var rootClip:MovieClip;
public function messaging_combo_mc_19(){
addFrameScript(0, frame1);
}
function frame1(){
rootClip = (parent as MovieClip);
if (rootClip){
this.labelText.text = rootClip.money;
};
}
}
}//package HUD01_fla
Section 70
//messaging_top_mc_17 (HUD01_fla.messaging_top_mc_17)
package HUD01_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class messaging_top_mc_17 extends MovieClip {
public var moneyText:TextField;
public var rootClip:MovieClip;
public var tricksText:TextField;
public function messaging_top_mc_17(){
addFrameScript(0, frame1);
}
function frame1(){
rootClip = (parent as MovieClip);
this.tricksText.text = ("" + rootClip.tricks);
this.moneyText.text = ("" + rootClip.money);
if (rootClip.tricks > 1){
gotoAndStop(1);
} else {
gotoAndStop(2);
};
}
}
}//package HUD01_fla
Section 71
//no_weapon_3 (HUD01_fla.no_weapon_3)
package HUD01_fla {
import flash.display.*;
public dynamic class no_weapon_3 extends MovieClip {
public function no_weapon_3(){
addFrameScript(12, frame13);
}
function frame13(){
stop();
}
}
}//package HUD01_fla
Section 72
//blood1_15 (lib_decomposedZombie_fla.blood1_15)
package lib_decomposedZombie_fla {
import flash.display.*;
public dynamic class blood1_15 extends MovieClip {
public function blood1_15(){
addFrameScript(8, frame9);
}
function frame9(){
stop();
}
}
}//package lib_decomposedZombie_fla
Section 73
//blood2_16 (lib_decomposedZombie_fla.blood2_16)
package lib_decomposedZombie_fla {
import flash.display.*;
public dynamic class blood2_16 extends MovieClip {
public function blood2_16(){
addFrameScript(7, frame8);
}
function frame8(){
stop();
}
}
}//package lib_decomposedZombie_fla
Section 74
//MC_FireDecompDie_26 (lib_decomposedZombie_fla.MC_FireDecompDie_26)
package lib_decomposedZombie_fla {
import flash.display.*;
public dynamic class MC_FireDecompDie_26 extends MovieClip {
public function MC_FireDecompDie_26(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package lib_decomposedZombie_fla
Section 75
//partanimated2_13 (lib_decomposedZombie_fla.partanimated2_13)
package lib_decomposedZombie_fla {
import flash.display.*;
public dynamic class partanimated2_13 extends MovieClip {
public function partanimated2_13(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package lib_decomposedZombie_fla
Section 76
//partanimated3_14 (lib_decomposedZombie_fla.partanimated3_14)
package lib_decomposedZombie_fla {
import flash.display.*;
public dynamic class partanimated3_14 extends MovieClip {
public function partanimated3_14(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package lib_decomposedZombie_fla
Section 77
//partanimated5_12 (lib_decomposedZombie_fla.partanimated5_12)
package lib_decomposedZombie_fla {
import flash.display.*;
public dynamic class partanimated5_12 extends MovieClip {
public function partanimated5_12(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package lib_decomposedZombie_fla
Section 78
//blood1_19 (lib_genericZombie_fla.blood1_19)
package lib_genericZombie_fla {
import flash.display.*;
public dynamic class blood1_19 extends MovieClip {
public function blood1_19(){
addFrameScript(8, frame9);
}
function frame9(){
stop();
}
}
}//package lib_genericZombie_fla
Section 79
//blood2_20 (lib_genericZombie_fla.blood2_20)
package lib_genericZombie_fla {
import flash.display.*;
public dynamic class blood2_20 extends MovieClip {
public function blood2_20(){
addFrameScript(7, frame8);
}
function frame8(){
stop();
}
}
}//package lib_genericZombie_fla
Section 80
//blood4_29 (lib_genericZombie_fla.blood4_29)
package lib_genericZombie_fla {
import flash.display.*;
public dynamic class blood4_29 extends MovieClip {
public function blood4_29(){
addFrameScript(5, frame6);
}
function frame6(){
stop();
}
}
}//package lib_genericZombie_fla
Section 81
//MC_FlattenedBigBlood_31 (lib_genericZombie_fla.MC_FlattenedBigBlood_31)
package lib_genericZombie_fla {
import flash.display.*;
public dynamic class MC_FlattenedBigBlood_31 extends MovieClip {
public function MC_FlattenedBigBlood_31(){
addFrameScript(8, frame9);
}
function frame9(){
stop();
}
}
}//package lib_genericZombie_fla
Section 82
//anidefeated_37 (lib_lola_fla.anidefeated_37)
package lib_lola_fla {
import flash.display.*;
public dynamic class anidefeated_37 extends MovieClip {
public function anidefeated_37(){
addFrameScript(18, frame19);
}
function frame19(){
stop();
}
}
}//package lib_lola_fla
Section 83
//aniswing_22 (lib_lola_fla.aniswing_22)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class aniswing_22 extends MovieClip {
public function aniswing_22(){
addFrameScript(6, frame7);
}
function frame7(){
(parent as MovieClip).isSwing = true;
}
}
}//package lib_lola_fla
Section 84
//MC_LolaCane_31 (lib_lola_fla.MC_LolaCane_31)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_LolaCane_31 extends MovieClip {
public function MC_LolaCane_31(){
addFrameScript(6, frame7);
}
function frame7(){
(parent as MovieClip).isSwing = true;
}
}
}//package lib_lola_fla
Section 85
//MC_LolaFkameThrowerFireWalk_6 (lib_lola_fla.MC_LolaFkameThrowerFireWalk_6)
package lib_lola_fla {
import flash.display.*;
public dynamic class MC_LolaFkameThrowerFireWalk_6 extends MovieClip {
public var weapon:MovieClip;
public function MC_LolaFkameThrowerFireWalk_6(){
addFrameScript(0, frame1);
}
function frame1(){
weapon.stop();
}
}
}//package lib_lola_fla
Section 86
//MC_LolaFlameThrowerFireStatic_4 (lib_lola_fla.MC_LolaFlameThrowerFireStatic_4)
package lib_lola_fla {
import flash.display.*;
public dynamic class MC_LolaFlameThrowerFireStatic_4 extends MovieClip {
public var weapon:MovieClip;
public function MC_LolaFlameThrowerFireStatic_4(){
addFrameScript(0, frame1);
}
function frame1(){
weapon.stop();
}
}
}//package lib_lola_fla
Section 87
//MC_LolaFryingPan_28 (lib_lola_fla.MC_LolaFryingPan_28)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_LolaFryingPan_28 extends MovieClip {
public function MC_LolaFryingPan_28(){
addFrameScript(6, frame7);
}
function frame7(){
(parent as MovieClip).isSwing = true;
}
}
}//package lib_lola_fla
Section 88
//MC_LolaGolfClub_30 (lib_lola_fla.MC_LolaGolfClub_30)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_LolaGolfClub_30 extends MovieClip {
public function MC_LolaGolfClub_30(){
addFrameScript(6, frame7);
}
function frame7(){
(parent as MovieClip).isSwing = true;
}
}
}//package lib_lola_fla
Section 89
//MC_LolaLegWeapon_29 (lib_lola_fla.MC_LolaLegWeapon_29)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_LolaLegWeapon_29 extends MovieClip {
public function MC_LolaLegWeapon_29(){
addFrameScript(6, frame7);
}
function frame7(){
(parent as MovieClip).isSwing = true;
}
}
}//package lib_lola_fla
Section 90
//MC_LolaShotgunFireStand_46 (lib_lola_fla.MC_LolaShotgunFireStand_46)
package lib_lola_fla {
import flash.display.*;
public dynamic class MC_LolaShotgunFireStand_46 extends MovieClip {
public var gun:MovieClip;
public function MC_LolaShotgunFireStand_46(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
gun.gotoAndStop(1);
}
function frame2(){
gun.gotoAndPlay(2);
}
}
}//package lib_lola_fla
Section 91
//MC_LolaShotgunFireWalk_53 (lib_lola_fla.MC_LolaShotgunFireWalk_53)
package lib_lola_fla {
import flash.display.*;
public dynamic class MC_LolaShotgunFireWalk_53 extends MovieClip {
public var gun:MovieClip;
public function MC_LolaShotgunFireWalk_53(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
gun.gotoAndStop(1);
}
function frame2(){
gun.gotoAndPlay(2);
}
}
}//package lib_lola_fla
Section 92
//MC_LolaShovel_27 (lib_lola_fla.MC_LolaShovel_27)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_LolaShovel_27 extends MovieClip {
public function MC_LolaShovel_27(){
addFrameScript(6, frame7);
}
function frame7(){
(parent as MovieClip).isSwing = true;
}
}
}//package lib_lola_fla
Section 93
//MC_LolaSword_26 (lib_lola_fla.MC_LolaSword_26)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_LolaSword_26 extends MovieClip {
public function MC_LolaSword_26(){
addFrameScript(6, frame7);
}
function frame7(){
(parent as MovieClip).isSwing = true;
}
}
}//package lib_lola_fla
Section 94
//MC_LolaTireIron_32 (lib_lola_fla.MC_LolaTireIron_32)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_LolaTireIron_32 extends MovieClip {
public function MC_LolaTireIron_32(){
addFrameScript(6, frame7);
}
function frame7(){
(parent as MovieClip).isSwing = true;
}
}
}//package lib_lola_fla
Section 95
//MC_LolaWalkAttackMelee_63 (lib_lola_fla.MC_LolaWalkAttackMelee_63)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_LolaWalkAttackMelee_63 extends MovieClip {
public var body:MovieClip;
public function MC_LolaWalkAttackMelee_63(){
addFrameScript(0, frame1, 1, frame2, 4, frame5);
}
function frame1(){
body.gotoAndStop(1);
}
function frame5(){
(parent as MovieClip).isSwing = true;
}
function frame2(){
body.gotoAndPlay(2);
}
}
}//package lib_lola_fla
Section 96
//MC_Swipe_24 (lib_lola_fla.MC_Swipe_24)
package lib_lola_fla {
import flash.display.*;
public dynamic class MC_Swipe_24 extends MovieClip {
public function MC_Swipe_24(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package lib_lola_fla
Section 97
//MC_WalkCane_67 (lib_lola_fla.MC_WalkCane_67)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_WalkCane_67 extends MovieClip {
public var body:MovieClip;
public function MC_WalkCane_67(){
addFrameScript(0, frame1, 1, frame2, 4, frame5);
}
function frame1(){
body.gotoAndStop(1);
}
function frame5(){
(parent as MovieClip).isSwing = true;
}
function frame2(){
body.gotoAndPlay(2);
}
}
}//package lib_lola_fla
Section 98
//MC_WalkFryingPan_61 (lib_lola_fla.MC_WalkFryingPan_61)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_WalkFryingPan_61 extends MovieClip {
public var body:MovieClip;
public function MC_WalkFryingPan_61(){
addFrameScript(0, frame1, 1, frame2, 4, frame5);
}
function frame1(){
body.gotoAndStop(1);
}
function frame5(){
(parent as MovieClip).isSwing = true;
}
function frame2(){
body.gotoAndPlay(2);
}
}
}//package lib_lola_fla
Section 99
//MC_WalkGolfClub_65 (lib_lola_fla.MC_WalkGolfClub_65)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_WalkGolfClub_65 extends MovieClip {
public var body:MovieClip;
public function MC_WalkGolfClub_65(){
addFrameScript(0, frame1, 1, frame2, 4, frame5);
}
function frame1(){
body.gotoAndStop(1);
}
function frame5(){
(parent as MovieClip).isSwing = true;
}
function frame2(){
body.gotoAndPlay(2);
}
}
}//package lib_lola_fla
Section 100
//MC_WalkShovel_69 (lib_lola_fla.MC_WalkShovel_69)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_WalkShovel_69 extends MovieClip {
public var body:MovieClip;
public function MC_WalkShovel_69(){
addFrameScript(0, frame1, 1, frame2, 5, frame6);
}
function frame6(){
(parent as MovieClip).isSwing = true;
}
function frame1(){
body.gotoAndStop(1);
}
function frame2(){
body.gotoAndPlay(2);
}
}
}//package lib_lola_fla
Section 101
//MC_WalkSword_75 (lib_lola_fla.MC_WalkSword_75)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_WalkSword_75 extends MovieClip {
public var body:MovieClip;
public function MC_WalkSword_75(){
addFrameScript(0, frame1, 1, frame2, 6, frame7);
}
function frame7(){
(parent as MovieClip).isSwing = true;
}
function frame1(){
body.gotoAndStop(1);
}
function frame2(){
body.gotoAndPlay(2);
}
}
}//package lib_lola_fla
Section 102
//MC_WalkTireIron_71 (lib_lola_fla.MC_WalkTireIron_71)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_WalkTireIron_71 extends MovieClip {
public var body:MovieClip;
public function MC_WalkTireIron_71(){
addFrameScript(0, frame1, 1, frame2, 5, frame6);
}
function frame6(){
(parent as MovieClip).isSwing = true;
}
function frame1(){
body.gotoAndStop(1);
}
function frame2(){
body.gotoAndPlay(2);
}
}
}//package lib_lola_fla
Section 103
//MC_WalkZombieLeg_73 (lib_lola_fla.MC_WalkZombieLeg_73)
package lib_lola_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_WalkZombieLeg_73 extends MovieClip {
public var body:MovieClip;
public function MC_WalkZombieLeg_73(){
addFrameScript(0, frame1, 1, frame2, 6, frame7);
}
function frame7(){
(parent as MovieClip).isSwing = true;
}
function frame1(){
body.gotoAndStop(1);
}
function frame2(){
body.gotoAndPlay(2);
}
}
}//package lib_lola_fla
Section 104
//static_16 (lib_lola_fla.static_16)
package lib_lola_fla {
import flash.display.*;
public dynamic class static_16 extends MovieClip {
public var mc:MovieClip;
}
}//package lib_lola_fla
Section 105
//staticWidthFlameThrowershoot_9 (lib_lola_fla.staticWidthFlameThrowershoot_9)
package lib_lola_fla {
import flash.display.*;
public dynamic class staticWidthFlameThrowershoot_9 extends MovieClip {
public var fire:MovieClip;
public var mc:MovieClip;
}
}//package lib_lola_fla
Section 106
//walk_12 (lib_lola_fla.walk_12)
package lib_lola_fla {
import flash.display.*;
public dynamic class walk_12 extends MovieClip {
public var mc:MovieClip;
}
}//package lib_lola_fla
Section 107
//walkWidthFlameThrowershoot_11 (lib_lola_fla.walkWidthFlameThrowershoot_11)
package lib_lola_fla {
import flash.display.*;
public dynamic class walkWidthFlameThrowershoot_11 extends MovieClip {
public var fire:MovieClip;
public var mc:MovieClip;
}
}//package lib_lola_fla
Section 108
//blood1_17 (lib_purple_decomposedZombie_fla.blood1_17)
package lib_purple_decomposedZombie_fla {
import flash.display.*;
public dynamic class blood1_17 extends MovieClip {
public function blood1_17(){
addFrameScript(8, frame9);
}
function frame9(){
stop();
}
}
}//package lib_purple_decomposedZombie_fla
Section 109
//blood2_18 (lib_purple_decomposedZombie_fla.blood2_18)
package lib_purple_decomposedZombie_fla {
import flash.display.*;
public dynamic class blood2_18 extends MovieClip {
public function blood2_18(){
addFrameScript(7, frame8);
}
function frame8(){
stop();
}
}
}//package lib_purple_decomposedZombie_fla
Section 110
//dismember_test2_12 (lib_purple_decomposedZombie_fla.dismember_test2_12)
package lib_purple_decomposedZombie_fla {
import flash.display.*;
public dynamic class dismember_test2_12 extends MovieClip {
public function dismember_test2_12(){
addFrameScript(27, frame28);
}
function frame28(){
stop();
}
}
}//package lib_purple_decomposedZombie_fla
Section 111
//dismemberextremexx_13 (lib_purple_decomposedZombie_fla.dismemberextremexx_13)
package lib_purple_decomposedZombie_fla {
import flash.display.*;
public dynamic class dismemberextremexx_13 extends MovieClip {
public function dismemberextremexx_13(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package lib_purple_decomposedZombie_fla
Section 112
//MC_FireDecompDie_28 (lib_purple_decomposedZombie_fla.MC_FireDecompDie_28)
package lib_purple_decomposedZombie_fla {
import flash.display.*;
public dynamic class MC_FireDecompDie_28 extends MovieClip {
public function MC_FireDecompDie_28(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
stop();
}
}
}//package lib_purple_decomposedZombie_fla
Section 113
//MC_FlamingDecompThrow_25 (lib_purple_decomposedZombie_fla.MC_FlamingDecompThrow_25)
package lib_purple_decomposedZombie_fla {
import flash.display.*;
public dynamic class MC_FlamingDecompThrow_25 extends MovieClip {
public var cHitArea:MovieClip;
}
}//package lib_purple_decomposedZombie_fla
Section 114
//partanimated2_15 (lib_purple_decomposedZombie_fla.partanimated2_15)
package lib_purple_decomposedZombie_fla {
import flash.display.*;
public dynamic class partanimated2_15 extends MovieClip {
public function partanimated2_15(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package lib_purple_decomposedZombie_fla
Section 115
//partanimated3_16 (lib_purple_decomposedZombie_fla.partanimated3_16)
package lib_purple_decomposedZombie_fla {
import flash.display.*;
public dynamic class partanimated3_16 extends MovieClip {
public function partanimated3_16(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package lib_purple_decomposedZombie_fla
Section 116
//partanimated5_14 (lib_purple_decomposedZombie_fla.partanimated5_14)
package lib_purple_decomposedZombie_fla {
import flash.display.*;
public dynamic class partanimated5_14 extends MovieClip {
public function partanimated5_14(){
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package lib_purple_decomposedZombie_fla
Section 117
//zom2_throw_6 (lib_purple_decomposedZombie_fla.zom2_throw_6)
package lib_purple_decomposedZombie_fla {
import flash.display.*;
public dynamic class zom2_throw_6 extends MovieClip {
public var cHitArea:MovieClip;
}
}//package lib_purple_decomposedZombie_fla
Section 118
//I3_7 (lib_thrownWeapon_fla.I3_7)
package lib_thrownWeapon_fla {
import flash.display.*;
public dynamic class I3_7 extends MovieClip {
public var I3:MovieClip;
}
}//package lib_thrownWeapon_fla
Section 119
//smoke_21 (lib_thrownWeapon_fla.smoke_21)
package lib_thrownWeapon_fla {
import flash.display.*;
public dynamic class smoke_21 extends MovieClip {
public function smoke_21(){
addFrameScript(5, frame6);
}
function frame6(){
stop();
}
}
}//package lib_thrownWeapon_fla
Section 120
//messaging_fetch_5 (lib_trailer_fla.messaging_fetch_5)
package lib_trailer_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class messaging_fetch_5 extends MovieClip {
public var textField:TextField;
public function messaging_fetch_5(){
addFrameScript(1, frame2);
}
function frame2(){
textField.text = (parent.parent as MovieClip).fetchMoreJohns;
}
}
}//package lib_trailer_fla
Section 121
//trailerClip_2 (lib_trailer_fla.trailerClip_2)
package lib_trailer_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class trailerClip_2 extends MovieClip {
public var libtrailer:MovieClip;
public var r:MovieClip;
public var mc:MovieClip;
public function trailerClip_2(){
addFrameScript(45, frame46, 48, frame49, 80, frame81, 93, frame94, 160, frame161, 185, frame186, 186, frame187);
}
function frame81(){
gotoAndStop("static");
}
function frame161(){
libtrailer = (parent as MovieClip);
if (libtrailer.levelComplete == "yes"){
gotoAndPlay((currentFrame - 30));
};
}
function frame94(){
stop();
}
function frame187(){
stop();
}
function frame186(){
stop();
}
function frame46(){
gotoAndStop("static");
}
function frame49(){
r = (parent as MovieClip);
mc.gotoAndStop(((r.fetchMoreJohns == 1)) ? 1 : 2);
}
}
}//package lib_trailer_fla
Section 122
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "3.0.0.0";
public function BitmapAsset(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
super(bitmapData, pixelSnapping, smoothing);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(newWidth:Number, newHeight:Number):void{
width = newWidth;
height = newHeight;
}
public function move(x:Number, y:Number):void{
this.x = x;
this.y = y;
}
}
}//package mx.core
Section 123
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
public function ByteArrayAsset(){
super();
}
}
}//package mx.core
Section 124
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexBitmap(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
var bitmapData = bitmapData;
var pixelSnapping = pixelSnapping;
var smoothing = smoothing;
super(bitmapData, pixelSnapping, smoothing);
name = NameUtil.createUniqueName(this);
//unresolved jump
var _slot1 = e;
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 125
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 126
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(void:Point):Point;
function get name():String;
function set width(flash.display:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(flash.display:String):void;
function set scaleX(flash.display:Number):void;
function set scaleY(flash.display:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(flash.display:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(void:Point):Point;
function get height():Number;
function set blendMode(flash.display:String):void;
function get parent():DisplayObjectContainer;
function getBounds(String:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(flash.display:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(flash.display:Number):void;
function set accessibilityProperties(flash.display:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(flash.display:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(flash.display:Number):void;
function set mask(flash.display:DisplayObject):void;
function getRect(String:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(flash.display:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(mx.core:IFlexDisplayObject/mx.core:IFlexDisplayObject:stage/get:DisplayObject):Boolean;
function set opaqueBackground(flash.display:Object):void;
function set visible(flash.display:Boolean):void;
function get mask():DisplayObject;
function set x(flash.display:Number):void;
function set y(flash.display:Number):void;
function get transform():Transform;
function set filters(flash.display:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(flash.display:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 127
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get isDocument():Boolean;
function set repeaters(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function initializeRepeaterArrays(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 128
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 129
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static var counter:int = 0;
public function NameUtil(){
super();
}
public static function displayObjectToString(displayObject:DisplayObject):String{
var result:String;
var s:String;
var indices:Array;
var o:DisplayObject = displayObject;
while (o != null) {
if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){
break;
};
s = o.name;
if ((o is IRepeaterClient)){
indices = IRepeaterClient(o).instanceIndices;
if (indices){
s = (s + (("[" + indices.join("][")) + "]"));
};
};
result = ((result == null)) ? s : ((s + ".") + result);
o = o.parent;
};
return (result);
}
public static function createUniqueName(object:Object):String{
if (!object){
return (null);
};
var name:String = getQualifiedClassName(object);
var index:int = name.indexOf("::");
if (index != -1){
name = name.substr((index + 2));
};
var charCode:int = name.charCodeAt((name.length - 1));
if ((((charCode >= 48)) && ((charCode <= 57)))){
name = (name + "_");
};
return ((name + counter++));
}
}
}//package mx.utils
Section 130
//mc_preroll_logo (prerollAssets.mc_preroll_logo)
package prerollAssets {
import flash.display.*;
public dynamic class mc_preroll_logo extends MovieClip {
public function mc_preroll_logo(){
addFrameScript(0, this.frame1, 1, this.frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package prerollAssets
Section 131
//mc_preroll_play (prerollAssets.mc_preroll_play)
package prerollAssets {
import flash.display.*;
public dynamic class mc_preroll_play extends MovieClip {
public function mc_preroll_play(){
addFrameScript(0, this.frame1, 1, this.frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package prerollAssets
Section 132
//button_moregmes_cvr_mc_14 (screens_fla.button_moregmes_cvr_mc_14)
package screens_fla {
import flash.display.*;
public dynamic class button_moregmes_cvr_mc_14 extends MovieClip {
public function button_moregmes_cvr_mc_14(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package screens_fla
Section 133
//highscores_mc_26 (screens_fla.highscores_mc_26)
package screens_fla {
import flash.display.*;
public dynamic class highscores_mc_26 extends MovieClip {
public function highscores_mc_26(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package screens_fla
Section 134
//MC_ButtonSoundWiggleOver_7 (screens_fla.MC_ButtonSoundWiggleOver_7)
package screens_fla {
import flash.display.*;
public dynamic class MC_ButtonSoundWiggleOver_7 extends MovieClip {
public function MC_ButtonSoundWiggleOver_7(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package screens_fla
Section 135
//MC_ControlsEp1_30 (screens_fla.MC_ControlsEp1_30)
package screens_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_ControlsEp1_30 extends MovieClip {
public var buttonMoreGames:SimpleButton;
public var myroot:MovieClip;
public var buttonClose:SimpleButton;
public function MC_ControlsEp1_30(){
addFrameScript(0, frame1);
}
function frame1(){
myroot = (this.parent as MovieClip);
gotoAndStop(myroot.episodeFrame);
}
}
}//package screens_fla
Section 136
//MC_Ep1ButtonWiggleOver_11 (screens_fla.MC_Ep1ButtonWiggleOver_11)
package screens_fla {
import flash.display.*;
public dynamic class MC_Ep1ButtonWiggleOver_11 extends MovieClip {
public function MC_Ep1ButtonWiggleOver_11(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package screens_fla
Section 137
//MC_Ep2ButtonWiggleOver_9 (screens_fla.MC_Ep2ButtonWiggleOver_9)
package screens_fla {
import flash.display.*;
public dynamic class MC_Ep2ButtonWiggleOver_9 extends MovieClip {
public function MC_Ep2ButtonWiggleOver_9(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package screens_fla
Section 138
//MC_OverWiggle_20 (screens_fla.MC_OverWiggle_20)
package screens_fla {
import flash.display.*;
public dynamic class MC_OverWiggle_20 extends MovieClip {
public function MC_OverWiggle_20(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package screens_fla
Section 139
//MC_OverWigglePA_21 (screens_fla.MC_OverWigglePA_21)
package screens_fla {
import flash.display.*;
public dynamic class MC_OverWigglePA_21 extends MovieClip {
public function MC_OverWigglePA_21(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package screens_fla
Section 140
//MC_OverWigglePlay_32 (screens_fla.MC_OverWigglePlay_32)
package screens_fla {
import flash.display.*;
public dynamic class MC_OverWigglePlay_32 extends MovieClip {
public function MC_OverWigglePlay_32(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package screens_fla
Section 141
//MC_ScreenGameOver_19 (screens_fla.MC_ScreenGameOver_19)
package screens_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class MC_ScreenGameOver_19 extends MovieClip {
public var buttonHighscores:SimpleButton;
public var cliproot:MovieClip;
public var buttonMoreGames:SimpleButton;
public var scoreField:TextField;
public var buttonPlayAgain:SimpleButton;
public var buttonSubmitScore:SimpleButton;
public function MC_ScreenGameOver_19(){
addFrameScript(0, frame1);
}
function frame1(){
cliproot = (this.parent as MovieClip);
scoreField.text = cliproot.scoreText;
}
}
}//package screens_fla
Section 142
//MC_SoundToggleWiggleOver_16 (screens_fla.MC_SoundToggleWiggleOver_16)
package screens_fla {
import flash.display.*;
public dynamic class MC_SoundToggleWiggleOver_16 extends MovieClip {
public function MC_SoundToggleWiggleOver_16(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
}
}
}//package screens_fla
Section 143
//moregames_mc_34 (screens_fla.moregames_mc_34)
package screens_fla {
import flash.display.*;
public dynamic class moregames_mc_34 extends MovieClip {
public function moregames_mc_34(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package screens_fla
Section 144
//moregames2_mc_28 (screens_fla.moregames2_mc_28)
package screens_fla {
import flash.display.*;
public dynamic class moregames2_mc_28 extends MovieClip {
public function moregames2_mc_28(){
addFrameScript(6, frame7);
}
function frame7(){
stop();
}
}
}//package screens_fla
Section 145
//AbstractAiRole (AbstractAiRole)
package {
import flash.events.*;
import com.liquable.game.postoffice.*;
import com.liquable.utils.*;
import com.liquable.game.geom.*;
import flash.geom.*;
public class AbstractAiRole extends AbstractRole {
private var pRange:int;
protected var pAIStateMachine:PostStateClient;
protected var pMoney:int;
protected var pReactionDelayTime:int;
public static const STATUS_AI_STATIC:String = "ai_static";
public static const STATUS_AI_THINK:String = "ai_think";
public function AbstractAiRole(roleType:String, locX:int, locY:int, hp:int, speed:Number, range:int, reactionDelayTime:int, money:int){
super(roleType, locX, locY, hp, speed);
pReactionDelayTime = reactionDelayTime;
pRange = range;
pMoney = money;
}
protected function ai_think_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(ai_think_update);
}
override protected function static_enter(prevState:String):void{
super.static_enter(prevState);
setAIState(STATUS_AI_STATIC);
}
override protected function setFrameLabel(label:String):void{
if (isInFlaming()){
label = (label + "Flaming");
};
super.setFrameLabel(label);
}
override public function goHit(flaming:Boolean, damage:int, weaponType:String, attacker:AbstractRole):void{
super.goHit(flaming, damage, weaponType, attacker);
var blood:Blood = new Blood(this, ((weaponType == PropertyLoader.ITEM_BULLET)) ? 3 : -1);
}
protected function getRoleInRange():AbstractRole{
var john:John;
var d:Number;
var role:AbstractRole;
var distance:Number = Number.MAX_VALUE;
var lola:Lola = Game.instance.getLola();
if (((isInRange(lola)) && (lola.isAlive()))){
role = lola;
distance = Point.distance(position, role.position);
};
for each (john in Game.instance.getJohns()) {
if ((((((((((john.pursuedRole == null)) && (isInRange(john)))) && (john.isAlive()))) && (!(john.isInState(STATUS_HIT))))) && (Game.instance.isInCamera(john)))){
d = Point.distance(position, john.position);
if (d < distance){
distance = d;
role = john;
};
};
};
return (role);
}
protected function getRandomLoc(range:int):PointInt{
var randomLocX:int;
var randomLocY:int;
var loc:PointInt;
var randomLoc:PointInt;
var i:int;
while (i < 5) {
randomLocX = IntUtil.randomBetween(Math.max(0, (currentTileLoc.x - range)), Math.min((Game.instance.mapColumnCounts - 1), (currentTileLoc.x + range)));
randomLocY = IntUtil.randomBetween(Math.max(0, (currentTileLoc.y - range)), Math.min((Game.instance.mapRowCounts - 1), (currentTileLoc.y + range)));
loc = new PointInt(randomLocX, randomLocY);
if (((Game.instance.canWalk(loc.x, loc.y)) && (!(loc.equals(currentTileLoc))))){
randomLoc = loc;
break;
};
i++;
};
return (randomLoc);
}
override public function initialize():void{
pAIStateMachine = new PostStateClient(zombie_hooker_nightmare.application);
pAIStateMachine.setDebug(false);
pAIStateMachine.initState(STATUS_AI_STATIC, ai_static_enter, null, ai_static_exit);
pAIStateMachine.initState(STATUS_AI_THINK, ai_think_enter, null, ai_think_exit);
setAIState(STATUS_AI_STATIC);
super.initialize();
}
public function idle():void{
pStateMachine.setState(STATUS_STATIC);
}
protected function isInRange(role:AbstractRole):Boolean{
var halfColumns:Number = (Game.instance.mapColumnCounts / 2);
var halfRows:Number = (Game.instance.mapRowCounts / 2);
var dx:int = Math.abs((role.currentTileLoc.x - currentTileLoc.x));
var dy:int = Math.abs((role.currentTileLoc.y - currentTileLoc.y));
if (dx > halfColumns){
dx = (Game.instance.mapColumnCounts - dx);
};
if (dy > halfRows){
dy = (Game.instance.mapRowCounts - dy);
};
return ((((dx <= getRange())) && ((dy <= getRange()))));
}
protected function isStateAllowedToThink():Boolean{
return (((((((!(pStateMachine.isInState(STATUS_HIT))) && (!(pStateMachine.isInState(STATUS_DIE))))) && (!(pStateMachine.isInState(STATUS_ATTACK))))) && (!(Game.instance.isPausing()))));
}
protected function getRange():int{
return (pRange);
}
override public function terminate():void{
pAIStateMachine.destroy();
pAIStateMachine = null;
super.terminate();
}
protected function ai_static_update(e:Event):void{
var timer:int = (pAIStateMachine.data.getInt("timer") + 1);
pAIStateMachine.data.setValue("timer", timer);
if (timer > pAIStateMachine.data.getInt("thinkDelayTime")){
setAIState(STATUS_AI_THINK);
};
}
protected function setAIState(state:String):void{
if (!pAIStateMachine.isInState(state)){
pAIStateMachine.setState(state);
};
}
override protected function hit_enter(prevState:String):void{
super.hit_enter(prevState);
setAIState(STATUS_AI_STATIC);
}
protected function ai_think_enter(prevState:String):void{
zombie_hooker_nightmare.application.addUpdateFunction(ai_think_update);
}
protected function ai_static_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(ai_static_update);
}
protected function ai_think_update(e:Event):void{
throw (new Error("AbstractAiRole.ai_think_update : invocation error!"));
}
protected function ai_static_enter(prevState:String):void{
zombie_hooker_nightmare.application.addUpdateFunction(ai_static_update);
pAIStateMachine.data.setValue("thinkDelayTime", (pReactionDelayTime + IntUtil.random((pReactionDelayTime * 0.5))));
pAIStateMachine.data.setValue("timer", 0);
}
}
}//package
Section 146
//AbstractCombo (AbstractCombo)
package {
import flash.events.*;
import flash.display.*;
public class AbstractCombo extends Sprite {
protected var pMovieClip:MovieClip;
protected var pMessage:String;
protected var pInited:Boolean;
public function AbstractCombo(x:Number, y:Number, c:Class){
super();
pMovieClip = new (c);
addChild(pMovieClip);
this.x = x;
this.y = y;
pInited = false;
zombie_hooker_nightmare.application.addUpdateFunction(update);
}
public function terminate():void{
zombie_hooker_nightmare.application.removeUpdateFunction(update);
if (parent){
parent.removeChild(this);
};
}
public function update(e:Event):void{
if (!pInited){
if (((((pMovieClip.combosText) && (pMovieClip.combosText.combosText))) && (pMovieClip.combosText.combosText.combosText))){
pMovieClip.combosText.combosText.combosText.text = pMessage;
pInited = true;
};
};
if (((pInited) && ((pMovieClip.combosText.currentFrame == pMovieClip.combosText.totalFrames)))){
terminate();
};
}
}
}//package
Section 147
//AbstractEffect (AbstractEffect)
package {
import flash.events.*;
import flash.display.*;
public class AbstractEffect extends Sprite {
protected var pMovieClip:MovieClip;
public function AbstractEffect(x:Number, y:Number, c:Class){
super();
pMovieClip = new (c);
addChild(pMovieClip);
this.x = x;
this.y = y;
zombie_hooker_nightmare.application.addUpdateFunction(update);
}
public function terminate():void{
zombie_hooker_nightmare.application.removeUpdateFunction(update);
pMovieClip = null;
if (parent){
parent.removeChild(this);
};
}
public function update(e:Event):void{
if (pMovieClip.currentFrame == pMovieClip.totalFrames){
terminate();
};
}
}
}//package
Section 148
//AbstractRole (AbstractRole)
package {
import flash.events.*;
import flash.display.*;
import com.liquable.game.postoffice.*;
import com.liquable.utils.*;
import com.liquable.game.geom.*;
import flash.geom.*;
import com.liquable.game.astar.*;
import com.liquable.statemachine.*;
public class AbstractRole extends MovableObject {
protected var pFlamingMachine:StateMachine;
private var pLocToGo:PointInt;
private var pPursuedRole:AbstractRole;
private var pHp:int;
private var pFoundPathTarget:PointInt;
private var pFoundPath:Array;
protected var pFindPathLimit:int;
private var pNextPursuedPosition:Point;
private var pCounts:int;// = 0
protected static const STATUS_GO_TO_LOC:String = "go_to_loc";
protected static const STATUS_FLAMING_FALSE:String = "flamingFalse";
public static const STATUS_IN_TRAILER:String = "inTrailer";
protected static const STATUS_HIT:String = "hit";
protected static const STATUS_FLAMING_TRUE:String = "flamingTrue";
protected static const STATUS_PURSUE_ROLE:String = "pursue_role";
protected static const STATUS_ATTACK:String = "attack";
protected static const STATUS_DIE:String = "die";
protected static const STATUS_STATIC:String = "static";
public static const STATUS_SERVICED:String = "serviced";
protected static const STATUS_WALK:String = "walk";
public function AbstractRole(objType:String, locX:int, locY:int, hp:int, speed:Number){
super(objType, locX, locY, speed);
pFindPathLimit = 20;
setHp(hp);
}
public function getHp():int{
return (pHp);
}
public function setHp(hp:int):void{
pHp = Math.max(hp, 0);
}
public function goHit(flaming:Boolean, damage:int, weaponType:String, attacker:AbstractRole):void{
if (flaming){
setOnFire();
};
setState(STATUS_HIT);
setHp((getHp() - damage));
}
override public function initialize():void{
super.initialize();
pStateMachine.initState(STATUS_STATIC, static_enter, static_process, static_exit);
pStateMachine.initState(STATUS_GO_TO_LOC, goToLoc_enter, null, goToLoc_exit);
pStateMachine.initState(STATUS_HIT, hit_enter, null, hit_exit);
pStateMachine.initState(STATUS_DIE, die_enter, null, die_exit);
setState(STATUS_STATIC);
pFlamingMachine = new StateMachine();
pFlamingMachine.initState(STATUS_FLAMING_FALSE, flamingFalse_enter, null, null);
pFlamingMachine.initState(STATUS_FLAMING_TRUE, flamingTrue_enter, null, flamingTrue_exit);
pFlamingMachine.setState(STATUS_FLAMING_FALSE);
}
protected function goToLoc_update(e:Event):void{
var doPursue:Boolean;
var finalShift:Point;
if (currentTileLoc.equals(targetLoc)){
nextPursuedPosition = getNextTargetPosition(targetLoc.x, targetLoc.y);
doPursue = false;
if (nextPursuedPosition){
finalShift = pStateMachine.data.getValue("finalShift");
if (finalShift){
nextPursuedPosition = nextPursuedPosition.add(finalShift);
};
if ((((Math.abs((nextPursuedPosition.x - position.x)) < 1)) && ((Math.abs((nextPursuedPosition.y - position.y)) < 1)))){
doPursue = true;
pursueTarget(nextPursuedPosition.x, nextPursuedPosition.y);
};
};
if (!doPursue){
setState(STATUS_STATIC);
};
} else {
if ((((nextPursuedPosition == null)) || (nextPursuedPosition.equals(position)))){
nextPursuedPosition = getNextTargetPosition(targetLoc.x, targetLoc.y);
};
if (nextPursuedPosition){
pursueTarget(nextPursuedPosition.x, nextPursuedPosition.y);
} else {
setState(STATUS_STATIC);
};
};
}
public function isRunningTo(inx:Number):Boolean{
return (false);
}
protected function static_process(post:PostPackage):void{
}
protected function getNextTargetPosition(targetLocX:int, targetLocY:int):Point{
var nextLoc:PointInt;
var pointInt:PointInt;
if (((((pFoundPathTarget) && ((pFoundPathTarget.x == targetLocX)))) && ((pFoundPathTarget.y == targetLocY)))){
while (pFoundPath.length) {
nextLoc = pFoundPath[0];
nextLoc = Game.instance.convertToLegalLoc(nextLoc.x, nextLoc.y);
if (nextLoc.equals(currentTileLoc)){
pFoundPath.shift();
} else {
return (Game.instance.getTileCenterPosition(nextLoc.x, nextLoc.y));
};
};
};
var paths:Array = findPath(targetLocX, targetLocY);
if (paths){
pFoundPath = paths;
pFoundPathTarget = new PointInt(targetLocX, targetLocY);
pointInt = Game.instance.convertToLegalLoc(paths[0].x, paths[0].y);
return (Game.instance.getTileCenterPosition(pointInt.x, pointInt.y));
};
pFoundPath = null;
pFoundPathTarget = null;
return (null);
}
public function get pursuedRole():AbstractRole{
return (pPursuedRole);
}
protected function hit_enter(prevState:String):void{
var slideX:Number;
targetLoc = null;
pursuedRole = null;
nextPursuedPosition = null;
var lola:Lola = Game.instance.getLola();
if (lola.knockback > 0){
pStateMachine.data.setValue("slideSpeed", (Game.instance.tileWidth / 2));
pStateMachine.data.setValue("knockbackFrames", lola.knockback);
slideX = getFinalSlideXByDirection(lola.getFaceDirection());
pStateMachine.data.setValue("finalSlidePosition", slideX);
trace(((((lola.getFaceDirection() + " : ") + x) + ", ") + slideX));
} else {
pStateMachine.data.setValue("knockbackFrames", 0);
};
setFrameLabel(STATUS_HIT);
zombie_hooker_nightmare.application.addUpdateFunction(hit_update);
}
protected function static_update(e:Event):void{
}
public function setOnFire():void{
}
public function isInFlaming():Boolean{
return (((pFlamingMachine) && (pFlamingMachine.isInState(STATUS_FLAMING_TRUE))));
}
public function isAlive():Boolean{
return ((getHp() > 0));
}
private function flamingTrue_enter(prevState:String):void{
pStateMachine.setState(STATUS_STATIC);
zombie_hooker_nightmare.application.addUpdateFunction(flamingTrue_update);
pFlamingMachine.data.setValue("timer", 0);
pFlamingMachine.data.setValue("framesPerHit", Game.instance.getWeaponConfigure("fire").framesPerHit);
pFlamingMachine.data.setValue("damage", Game.instance.getWeaponConfigure("fire").damage);
Game.instance.playFlamingSound();
}
protected function pursueTarget(targetX:Number, targetY:Number):void{
var velocity:Point = moveToTarget(targetX, targetY, pSpeed);
if (position.x != targetX){
pMovieClip.scaleX = ((velocity.x > 0)) ? DIR_RIGHT : DIR_LEFT;
};
}
public function set pursuedRole(role:AbstractRole):void{
pPursuedRole = role;
}
protected function flamingTrue_update(e:Event):void{
var damage:int;
var timer:int = pFlamingMachine.data.getInt("timer");
var framesPerHit:int = pFlamingMachine.data.getInt("framesPerHit");
if (timer > framesPerHit){
damage = pFlamingMachine.data.getInt("damage");
setHp((getHp() - damage));
if (getHp() <= 0){
setState(STATUS_DIE);
} else {
setState(STATUS_HIT);
pStateMachine.data.setValue("slideSpeed", 0);
pStateMachine.data.setValue("knockbackFrames", 3);
};
timer = 0;
};
pFlamingMachine.data.setValue("timer", (timer + 1));
}
protected function static_enter(prevState:String):void{
setFrameLabel(STATUS_STATIC);
zombie_hooker_nightmare.application.addUpdateFunction(static_update);
}
protected function set nextPursuedPosition(p:Point):void{
pNextPursuedPosition = p;
}
protected function hit_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(hit_update);
}
private function static_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(static_update);
}
private function getFinalSlideXByDirection(direction:int):Number{
DesignContract.preCondition((((direction == 1)) || ((direction == -1))));
var tileCount:int;
var locX:int = currentTileLoc.x;
var totalTiles:int = (zombie_hooker_nightmare.application.gameWidth / Game.instance.tileWidth);
while (tileCount < 5) {
locX = (locX + direction);
if (((!(Game.instance.canWalk(locX, currentTileLoc.y))) || ((tileCount >= totalTiles)))){
break;
} else {
tileCount++;
};
};
return ((x + ((tileCount * Game.instance.tileWidth) * direction)));
}
private function moveToTarget(targetX:Number, targetY:Number, pursuedSpeed:Number):Point{
var velocity:Point = new Point((targetX - position.x), (targetY - position.y));
if (velocity.x > (Game.instance.getMap().getMapResource().width / 2)){
velocity.x = (velocity.x - Game.instance.getMap().getMapResource().width);
} else {
if (velocity.x < (-(Game.instance.getMap().getMapResource().width) / 2)){
velocity.x = (velocity.x + Game.instance.getMap().getMapResource().width);
};
};
if (velocity.y > (Game.instance.getMap().getMapResource().height / 2)){
velocity.y = (velocity.y - Game.instance.getMap().getMapResource().height);
} else {
if (velocity.y < (-(Game.instance.getMap().getMapResource().height) / 2)){
velocity.y = (velocity.y + Game.instance.getMap().getMapResource().height);
};
};
if (velocity.length < 1){
setPosition(targetX, targetY);
} else {
pursuedSpeed = Math.min(velocity.length, pursuedSpeed);
velocity.normalize(pursuedSpeed);
setPosition((position.x + velocity.x), (position.y + velocity.y));
};
return (velocity);
}
public function set targetLoc(loc:PointInt):void{
pLocToGo = loc;
}
private function flamingTrue_exit(nextState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(flamingTrue_update);
}
protected function goToLoc_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(goToLoc_update);
targetLoc = null;
nextPursuedPosition = null;
}
override public function terminate():void{
pFlamingMachine.destroy();
pFlamingMachine = null;
pLocToGo = null;
pPursuedRole = null;
pNextPursuedPosition = null;
super.terminate();
}
protected function get nextPursuedPosition():Point{
return (pNextPursuedPosition);
}
protected function goToLoc_enter(prevState:String):void{
setFrameLabel(STATUS_WALK);
zombie_hooker_nightmare.application.addUpdateFunction(goToLoc_update);
var finalShift:Point = new Point(((Math.random() - 0.5) * 20), ((Math.random() - 0.5) * 20));
pStateMachine.data.setValue("finalShift", finalShift);
}
protected function die_enter(prevState:String):void{
pFlamingMachine.setState(STATUS_FLAMING_FALSE);
targetLoc = null;
pursuedRole = null;
nextPursuedPosition = null;
setFrameLabel(STATUS_DIE);
zombie_hooker_nightmare.application.addUpdateFunction(die_update);
}
private function flamingFalse_enter(prevState:String):void{
Game.instance.stopFlamingSound(true);
}
public function get targetLoc():PointInt{
return (pLocToGo);
}
public function getFaceDirection():int{
return (pMovieClip.scaleX);
}
protected function hit_update(e:Event):Boolean{
var s:Number;
var knockbackFrames:int = pStateMachine.data.getInt("knockbackFrames");
if (knockbackFrames > 0){
s = pStateMachine.data.getNumber("slideSpeed");
moveToTarget(pStateMachine.data.getNumber("finalSlidePosition"), position.y, s);
pStateMachine.data.setValue("slideSpeed", (s * 0.6));
pStateMachine.data.setValue("knockbackFrames", (knockbackFrames - 1));
return (false);
};
return (true);
}
protected function die_update(e:Event):void{
var shadowClip:MovieClip = pMovieClip.shadowClip;
if (((shadowClip) && (shadowClip.visible))){
shadowClip.alpha = (shadowClip.alpha - 0.15);
if (shadowClip.alpha <= 0){
shadowClip.visible = false;
};
};
}
protected function die_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(die_update);
}
protected function findPath(targetLocX:int, targetLocY:int):Array{
var paths:Array;
var astar:AStar = new AStar(Game.instance.getMap(), true);
paths = astar.findPath(this, currentTileLoc.x, currentTileLoc.y, targetLocX, targetLocY, pFindPathLimit);
return ((((paths) && ((paths.length > 0)))) ? paths : null);
}
}
}//package
Section 149
//AnkleBiterZombie (AnkleBiterZombie)
package {
import flash.events.*;
import flash.display.*;
public class AnkleBiterZombie extends GenericHookerZombie {
public function AnkleBiterZombie(roleType:String, locX:int, locY:int){
super(roleType, locX, locY);
pTryKeepDistance = 0;
}
override protected function attack_update(e:Event):void{
var distance:Number;
var role:AbstractRole;
if (pMovieClip.mc.currentFrame == pMovieClip.mc.totalFrames){
Game.instance.removeRole(this);
} else {
if (pMovieClip.mc.currentFrame == 7){
pMovieClip.shadowClip.visible = false;
distance = (Game.instance.tileWidth * 2.5);
for each (role in Game.instance.getRoles()) {
if (((role.isAlive()) && (isTouched(role, distance, 42)))){
pursuedRole.goHit(false, pDamage, null, this);
};
};
};
};
}
override protected function attack_enter(prevState:String):void{
setFrameLabel(STATUS_ATTACK);
zombie_hooker_nightmare.application.addUpdateFunction(attack_update);
setHp(0);
playSound(zombie_explode);
}
override public function goHit(flaming:Boolean, damage:int, weaponType:String, attacker:AbstractRole):void{
setState(STATUS_ATTACK);
}
override protected function createMovieClip():MovieClip{
return (new lib_ankle_biter_zombie());
}
}
}//package
Section 150
//BlackMask (BlackMask)
package {
import flash.events.*;
import flash.display.*;
public class BlackMask extends Shape {
private var pDuration:int;
private var pStartAlpha:Number;
private var pTimer:int;
private var pEndAlpha:Number;
private var pCallback:Function;
public static var INSTANCE:BlackMask = new (BlackMask);
;
public function BlackMask(){
super();
graphics.beginFill(0, 1);
graphics.drawRect(0, 0, zombie_hooker_nightmare.application.gameWidth, zombie_hooker_nightmare.application.gameHeight);
graphics.endFill();
}
public function start(startAlpha:Number, endAlpha:Number, duration:int, callback:Function):void{
zombie_hooker_nightmare.application.addUpdateFunction(update);
alpha = startAlpha;
pTimer = 0;
pDuration = duration;
pStartAlpha = alpha;
pEndAlpha = endAlpha;
pCallback = callback;
attachOnParent();
}
public function stop(endAlpha:Number):void{
zombie_hooker_nightmare.application.removeUpdateFunction(update);
if (endAlpha > 0){
attachOnParent();
alpha = endAlpha;
} else {
if (parent){
parent.removeChild(this);
};
};
if (pCallback != null){
pCallback();
pCallback = null;
};
}
private function attachOnParent():void{
if (parent == null){
zombie_hooker_nightmare.instance.addChild(this);
};
}
private function update(e:Event):void{
var percent:Number;
pTimer++;
if (pTimer < pDuration){
percent = (pTimer / pDuration);
alpha = (pStartAlpha + ((pEndAlpha - pStartAlpha) * percent));
} else {
stop(pEndAlpha);
};
}
}
}//package
Section 151
//Blood (Blood)
package {
import flash.events.*;
import flash.display.*;
import com.liquable.utils.*;
public class Blood extends Sprite {
private var pMovieClip:MovieClip;
private var pTimer:int;
public function Blood(role:AbstractRole, bloodType:int=-1){
super();
if (bloodType == -1){
bloodType = IntUtil.random(2);
};
switch (bloodType){
case 1:
pMovieClip = new lib_blood_1();
break;
case 2:
pMovieClip = new lib_blood_2();
break;
case 3:
pMovieClip = new lib_blood_3();
break;
default:
pMovieClip = new lib_blood_0();
break;
};
addChild(pMovieClip);
pMovieClip.y = -30;
pMovieClip.scaleX = role.getFaceDirection();
role.addChild(pMovieClip);
zombie_hooker_nightmare.application.addUpdateFunction(update);
pTimer = 0;
}
private function update(e:Event):void{
if (++pTimer > 10){
destroy();
};
}
public function destroy():void{
zombie_hooker_nightmare.application.removeUpdateFunction(update);
pMovieClip = null;
if (parent){
parent.removeChild(this);
};
while (numChildren) {
removeChildAt(0);
};
}
}
}//package
Section 152
//blood2 (blood2)
package {
import flash.media.*;
public dynamic class blood2 extends Sound {
}
}//package
Section 153
//blood3 (blood3)
package {
import flash.media.*;
public dynamic class blood3 extends Sound {
}
}//package
Section 154
//Brain (Brain)
package {
import com.liquable.visualstack.*;
import com.liquable.utils.*;
public final class Brain extends VisualSprite {
private static var sInstance:Brain;
public function Brain(){
super();
}
override public function onPush():void{
super.onPush();
cover_screen();
}
private function cover_screen():void{
getStack().push(new ScreenCover());
}
override public function onReveal(msg:MapData):void{
switch (msg.getInt("msg")){
case Message.TYPE_SCREEN_COVER:
cover_screen();
break;
case Message.TYPE_SCREEN_GAME:
getStack().push(new Game(msg.getString("level"), msg.getInt("nights")));
break;
};
}
public static function get instance():Brain{
if (sInstance == null){
sInstance = new (Brain);
};
return (sInstance);
}
}
}//package
Section 155
//BreakableObject (BreakableObject)
package {
import flash.events.*;
import flash.display.*;
import com.liquable.utils.*;
import com.liquable.game.geom.*;
import flash.geom.*;
public class BreakableObject extends MapObject {
private var pContents:String;
private var pIsBroken:Boolean;
private var pOccupiedTiles:Array;
private static var sObjectClips:Object;
public function BreakableObject(type:String, locX:int, locY:int, contents:String){
super(type, locX, locY);
pContents = contents;
if (sObjectClips == null){
sObjectClips = new Object();
sObjectClips["mc_forest_propanetank"] = mc_forest_propanetank;
sObjectClips["mc_forest_grave1"] = mc_forest_grave1;
sObjectClips["mc_forest_rock1"] = mc_forest_rock1;
sObjectClips["mc_forest_rock2"] = mc_forest_rock2;
sObjectClips["mc_forest_stump1"] = mc_forest_stump1;
sObjectClips["mc_forest_tree1"] = mc_forest_tree1;
sObjectClips["mc_forest_tree2"] = mc_forest_tree2;
sObjectClips["mc_gy_coffin"] = mc_gy_coffin;
sObjectClips["mc_gy_coffin2"] = mc_gy_coffin2;
sObjectClips["mc_gy_grave1"] = mc_gy_grave1;
sObjectClips["mc_gy_grave2"] = mc_gy_grave2;
sObjectClips["mc_gy_grave3"] = mc_gy_grave3;
sObjectClips["mc_gy_grave4"] = mc_gy_grave4;
sObjectClips["mc_gy_grave5"] = mc_gy_grave5;
sObjectClips["mc_gy_grave6"] = mc_gy_grave6;
sObjectClips["mc_gy_grave7"] = mc_gy_grave7;
sObjectClips["mc_gy_grave8"] = mc_gy_grave8;
sObjectClips["mc_gy_grave9"] = mc_gy_grave9;
sObjectClips["mc_gy_pillar1"] = mc_gy_pillar1;
sObjectClips["mc_gy_pillar2"] = mc_gy_pillar2;
sObjectClips["mc_gy_pillar3"] = mc_gy_pillar3;
sObjectClips["mc_gy_rock1"] = mc_gy_rock1;
sObjectClips["mc_gy_rock2"] = mc_gy_rock2;
sObjectClips["mc_gy_stump1"] = mc_gy_stump1;
sObjectClips["mc_gy_stump2"] = mc_gy_stump2;
sObjectClips["mc_gy_tree1"] = mc_gy_tree1;
};
}
override public function terminate():void{
zombie_hooker_nightmare.application.removeUpdateFunction(checkGenerateItemTiming);
pOccupiedTiles = null;
pMovieClip = null;
while (numChildren) {
removeChildAt(0);
};
if (parent){
parent.removeChild(this);
};
super.terminate();
}
override protected function createMovieClip():MovieClip{
return (new (sObjectClips[type]));
}
private function generateItem():void{
var loc:PointInt;
var weapon:Weapon;
if (pOccupiedTiles){
loc = ArrayUtil.getArrayRandomElement(pOccupiedTiles, false);
if (loc){
trace(("tset000 : " + pContents));
weapon = new Weapon(pContents, loc.x, loc.y);
Game.instance.addWeapon(weapon);
};
};
}
override public function initialize():void{
var j:int;
var tileLoc:PointInt;
var index:int;
var tempLoc:PointInt;
super.initialize();
pIsBroken = false;
pOccupiedTiles = new Array();
var pos:Point = Game.instance.getTilePosition(currentTileLoc.x, currentTileLoc.y);
var numCols:int = Math.round((pMovieClip.width / Game.instance.tileWidth));
var numRows:int = Math.round((pMovieClip.height / Game.instance.tileHeight));
var canwalksArray:Array = Game.instance.getCanWalkLocsArray();
var i:int;
while (i < numCols) {
j = 0;
while (j < numRows) {
tileLoc = new PointInt((currentTileLoc.x + i), (currentTileLoc.y + j));
if (!Game.instance.canWalk(tileLoc.x, tileLoc.y)){
Game.instance.getMap().setCanWalk(tileLoc.x, tileLoc.y, true);
};
if (Game.instance.canWalk(tileLoc.x, tileLoc.y)){
pOccupiedTiles.push(tileLoc);
index = 0;
while (index < canwalksArray.length) {
tempLoc = canwalksArray[index];
if (tempLoc.equals(tileLoc)){
canwalksArray.splice(index, 1);
break;
};
index++;
};
Game.instance.getMap().setCanWalk(tileLoc.x, tileLoc.y, false);
};
j++;
};
i++;
};
pMovieClip.x = ((pMovieClip.width / 2) - (Game.instance.tileWidth / 2));
pMovieClip.y = (pMovieClip.height - (Game.instance.tileHeight / 2));
}
private function damageRoles(game:Game):void{
var role:AbstractRole;
if (game == Game.instance){
for each (role in game.getRoles()) {
if (((((role.isAlive()) && ((Math.abs((currentTileLoc.x - role.currentTileLoc.x)) < 2)))) && ((Math.abs((currentTileLoc.y - role.currentTileLoc.y)) < 2)))){
role.goHit(true, 5, type, null);
};
};
};
}
private function checkGenerateItemTiming(e:Event):void{
if (pMovieClip.currentFrame == pMovieClip.totalFrames){
generateItem();
zombie_hooker_nightmare.application.removeUpdateFunction(checkGenerateItemTiming);
};
}
public function setBroken():void{
var loc:PointInt;
pIsBroken = true;
if (parent){
parent.setChildIndex(this, (parent.numChildren - 1));
};
pMovieClip.gotoAndPlay(2);
var canwalksArray:Array = Game.instance.getCanWalkLocsArray();
for each (loc in pOccupiedTiles) {
canwalksArray.push(loc);
Game.instance.getMap().setCanWalk(loc.x, loc.y, true);
};
if (pContents != PropertyLoader.ITEM_NONE){
zombie_hooker_nightmare.application.addUpdateFunction(checkGenerateItemTiming);
};
if (type == "mc_forest_propanetank"){
playSound(zombie_explode);
zombie_hooker_nightmare.application.addDelayFunction(damageRoles, Game.instance, 5);
} else {
playSound(object_broken);
};
}
public function isBroken():Boolean{
return (pIsBroken);
}
}
}//package
Section 156
//cash_pickup (cash_pickup)
package {
import flash.media.*;
public dynamic class cash_pickup extends Sound {
}
}//package
Section 157
//CheatController (CheatController)
package {
import flash.events.*;
import flash.display.*;
public class CheatController {
private var pLolaWeaponTypes:Array;
private var pActive:Boolean;
private var pStage:Stage;
public function CheatController(stage:Stage){
super();
pStage = stage;
pLolaWeaponTypes = new Array();
pLolaWeaponTypes.push(PropertyLoader.ITEM_BONE);
pLolaWeaponTypes.push(PropertyLoader.ITEM_CHAINSAW);
pLolaWeaponTypes.push(PropertyLoader.ITEM_FLAME_THROWER);
pLolaWeaponTypes.push(PropertyLoader.ITEM_UZI);
pLolaWeaponTypes.push(PropertyLoader.ITEM_SHOOTGUN);
pLolaWeaponTypes.push(PropertyLoader.ITEM_CANE);
pLolaWeaponTypes.push(PropertyLoader.ITEM_SHOVEL);
pLolaWeaponTypes.push(PropertyLoader.ITEM_ZOMBIE_LEG);
pLolaWeaponTypes.push(PropertyLoader.ITEM_SWARD);
pLolaWeaponTypes.push(PropertyLoader.ITEM_GOLF_CLUB);
pLolaWeaponTypes.push(PropertyLoader.ITEM_PAN);
pLolaWeaponTypes.push(PropertyLoader.ITEM_TIRE_IRON);
pLolaWeaponTypes.push(PropertyLoader.ITEM_STILLETTO);
pLolaWeaponTypes.push(PropertyLoader.ITEM_SKULL);
pLolaWeaponTypes.push(PropertyLoader.ITEM_HORNED_SKULL);
pLolaWeaponTypes.push(PropertyLoader.ITEM_MOLOTOV);
pLolaWeaponTypes.push(PropertyLoader.ITEM_FLAMING_SKULL);
}
public function stop():void{
pStage.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
pActive = false;
}
private function checkCheatCode(keyCode:uint):void{
switch (keyCode){
case 97:
case 49:
Game.instance.getLola().invincible = ((Game.instance.getLola().invincible == 0)) ? -1 : 0;
break;
case 98:
case 50:
Game.instance.levelComplete();
break;
case 99:
case 51:
equipNextWeapon();
break;
};
}
public function start():void{
pStage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
pActive = false;
}
private function onKeyUp(e:KeyboardEvent):void{
switch (e.keyCode){
case 56:
case 106:
pActive = true;
break;
default:
if (pActive){
checkCheatCode(e.keyCode);
pActive = false;
};
break;
};
}
private function equipNextWeapon():void{
var lola:Lola = Game.instance.getLola();
var currWeaponIndex:int = (lola.currentWeapon) ? pLolaWeaponTypes.indexOf(lola.currentWeapon.type) : -1;
var nextWeaponIndex:int = ((currWeaponIndex == -1)) ? 0 : ((currWeaponIndex + 1) % pLolaWeaponTypes.length);
lola.cheatEquipWeapon(pLolaWeaponTypes[nextWeaponIndex]);
}
}
}//package
Section 158
//ComboSmall (ComboSmall)
package {
public class ComboSmall extends AbstractCombo {
public function ComboSmall(x:Number, y:Number, text:String){
super(x, y, lib_comboTextSmall);
pMessage = text;
}
}
}//package
Section 159
//Configure (Configure)
package {
public class Configure {
private var pProperties:Object;
public function Configure(obj:Object){
super();
pProperties = obj;
}
public function get money():int{
return (parseInt(pProperties.money));
}
public function get screenShake():Boolean{
return ((pProperties.screenShake == "true"));
}
public function get comboTime():Number{
return (parseFloat(pProperties.comboTime));
}
public function getZombieHp(zombieType:String):int{
return (parseInt(pProperties[(zombieType + "Hp")]));
}
public function get deleteDelayTime():int{
return (parseInt(pProperties.deleteDelayTime));
}
public function get speed():Number{
return (parseFloat(pProperties.speed));
}
public function get hp():int{
return (parseInt(pProperties.hp));
}
public function get hitMultiple():Boolean{
return ((pProperties.hitMultiple == "true"));
}
public function get levelXml():String{
return (pProperties.levelXml);
}
public function get pickWeaponFactor():int{
return (parseInt(pProperties.pickWeaponFactor));
}
public function get killFactor():int{
return (parseInt(pProperties.killFactor));
}
public function get combo():int{
return (parseInt(pProperties.combo));
}
public function get count():int{
return (parseInt(pProperties.count));
}
public function get nextLevel():String{
return (pProperties.nextLevel);
}
public function get score():int{
return (parseInt(pProperties.score));
}
public function get low():int{
return (parseInt(pProperties.low));
}
public function get punchDamage():int{
return (parseInt(pProperties.punchDamage));
}
public function get amount():int{
return (parseInt(pProperties.amount));
}
public function get respawnInterval():int{
if (pProperties.respawnInterval){
return (parseInt(pProperties.respawnInterval));
};
return (3);
}
public function get framesPerHit():int{
return (parseInt(pProperties.framesPerHit));
}
public function get tricks():int{
return (parseInt(pProperties.tricks));
}
public function get hitDistance():int{
return (parseInt(pProperties.hitDistance));
}
public function get totalZombies():int{
return (parseInt(pProperties.totalZombies));
}
public function get threshold():int{
return (parseInt(pProperties.threshold));
}
public function get punchKnockback():int{
return (parseInt(pProperties.punchKnockback));
}
public function get damage():int{
return (parseInt(pProperties.damage));
}
public function get flaming():Boolean{
return ((pProperties.flaming == "true"));
}
public function getZombieWeight(zombieType:String):int{
var key = (zombieType + "Weight");
if (pProperties.hasOwnProperty(key)){
return (parseInt(pProperties[key]));
};
return (0);
}
public function get distance():Number{
return (parseFloat(pProperties.distance));
}
public function get moneyFactor():int{
return (parseInt(pProperties.moneyFactor));
}
public function get johnFactor():int{
return (parseInt(pProperties.johnFactor));
}
public function get knockback():int{
return (parseInt(pProperties.knockback));
}
public function get timeFactor():int{
return (parseInt(pProperties.timeFactor));
}
public function get range():int{
return (parseInt(pProperties.range));
}
}
}//package
Section 160
//Dashboard (Dashboard)
package {
import flash.events.*;
import com.liquable.media.*;
import com.liquable.game.events.*;
import flash.display.*;
import com.liquable.utils.*;
import com.liquable.game.geom.*;
import flash.geom.*;
import flash.filters.*;
public class Dashboard extends Sprite {
private var pGoalTricks:int;
private var pHiding:Boolean;
private var pMovieClip:MovieClip;
private var pBottomClip:MovieClip;
private var pMoney:int;
private var pTrickColorTimer:Number;
private var pBottomButtons:Object;
private var pCurrentTricks:int;
private var pHpbarPercent:Number;
private var pTrickColor:ColorAdapter;
private var pNights:int;
private var pHudHeight:Number;// = 90
private var pShowStartMessage:Boolean;
private var pMessageClip:MovieClip;
private var pCurrentHidePercent:Number;
public function Dashboard(nights:int, goalTricks:int){
super();
pMoney = 0;
pHpbarPercent = 1;
pMovieClip = new MC_HUDBaseWithStuff();
addChild(pMovieClip);
pBottomClip = new GR_HUDButtonsTogether();
pBottomClip.initButtons = onInitBottomClipButtons;
addChild(pBottomClip);
pMessageClip = new lib_hud_messages();
pMessageClip.nights = nights;
addChild(pMessageClip);
pMessageClip.y = 250;
pMessageClip.x = (728 / 2);
updateMoney(0);
pCurrentHidePercent = 0;
pShowStartMessage = true;
pNights = nights;
pGoalTricks = goalTricks;
pCurrentTricks = 0;
addEventListener(Event.ENTER_FRAME, initUpdate);
addEventListener(Event.ENTER_FRAME, hpbarUpdate);
}
public function showEndMessage():void{
pMessageClip.gotoAndPlay("end");
}
private function removeRedColorFilter():void{
var filterArray:Array;
if (pMovieClip.itemText.filters.length > 1){
filterArray = pMovieClip.itemText.filters;
filterArray.pop();
pMovieClip.itemText.filters = filterArray;
};
}
public function getMoney():int{
return (pMoney);
}
private function onInitBottomClipButtons():void{
pBottomClip.buttonHelp.addEventListener(MouseEvent.CLICK, onButtonHelp, false, 0, true);
pBottomClip.buttonSoundOn.addEventListener(MouseEvent.CLICK, onButtonSound, false, 0, true);
pBottomClip.buttonSoundOff.addEventListener(MouseEvent.CLICK, onButtonSound, false, 0, true);
pBottomClip.buttonHelp.addEventListener(MouseEvent.ROLL_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
pBottomClip.buttonSoundOn.addEventListener(MouseEvent.ROLL_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
pBottomClip.buttonSoundOff.addEventListener(MouseEvent.ROLL_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
pBottomButtons = new Object();
pBottomButtons["buttonHelp"] = pBottomClip.buttonHelp;
pBottomButtons["buttonSoundOn"] = pBottomClip.buttonSoundOn;
pBottomButtons["buttonSoundOff"] = pBottomClip.buttonSoundOff;
updateMuteButtonState();
}
private function updateMuteButtonState():void{
var sm:SoundManager = zombie_hooker_nightmare.application.getSoundManager();
var volume:Number = sm.getGlobalVolume();
pBottomButtons.buttonSoundOn.visible = (volume == 1);
pBottomButtons.buttonSoundOff.visible = (volume == 0);
}
public function updateHpBar(percentage:Number):void{
pHpbarPercent = percentage;
}
private function onButtonSound(e:MouseEvent):void{
zombie_hooker_nightmare.mouse_down();
var sm:SoundManager = zombie_hooker_nightmare.application.getSoundManager();
var volume:Number = ((sm.getGlobalVolume() == 0)) ? 1 : 0;
sm.setGlobalVolume(volume);
updateMuteButtonState();
}
private function getRedFilters():ColorMatrixFilter{
var matrix:Array = new Array();
matrix = matrix.concat([1, 0, 0, 0, 0]);
matrix = matrix.concat([0, 0, 0, 0, 0]);
matrix = matrix.concat([0, 0, 0, 0, 0]);
matrix = matrix.concat([0, 0, 0, 1, 0]);
var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);
return (filter);
}
private function updateTricks():void{
pMovieClip.tricksText.text = (((pCurrentTricks + "/") + pGoalTricks) + " tricks");
if (pCurrentTricks >= pGoalTricks){
zombie_hooker_nightmare.application.addUpdateFunction(updateTricksAnimation);
};
}
public function set currentTricks(value:int):void{
pCurrentTricks = value;
updateTricks();
}
private function hpbarUpdate(e:Event):void{
var hpbar:MovieClip = pMovieClip.hpBar;
var thebar:MovieClip = hpbar.bar;
if (thebar.scaleX != pHpbarPercent){
thebar.scaleX = MathUtil.numberFollowTarget(thebar.scaleX, pHpbarPercent, 0.1, 0.015);
if (hpbar.filters.length == 0){
hpbar.filters = [new ColorMatrixFilter(new ColorAdapter(0xFFFFFF).toMatrixForFilter(0.18))];
};
} else {
if (hpbar.filters.length > 0){
hpbar.filters = null;
};
};
}
private function displayUpdate(e:Event):void{
var dPercent:Number = 0.1;
if (pHiding){
pCurrentHidePercent = (pCurrentHidePercent + dPercent);
if (pCurrentHidePercent > 1){
pCurrentHidePercent = 1;
zombie_hooker_nightmare.application.removeUpdateFunction(displayUpdate);
};
} else {
if (pBottomButtons){
pCurrentHidePercent = (pCurrentHidePercent - dPercent);
if (pCurrentHidePercent < 0){
pCurrentHidePercent = 0;
zombie_hooker_nightmare.application.removeUpdateFunction(displayUpdate);
if (pShowStartMessage){
pMessageClip.gotoAndPlay("start");
pShowStartMessage = false;
};
};
};
};
setVisiblePercent(pCurrentHidePercent);
}
public function hide(immediate:Boolean=false):void{
var button:SimpleButton;
var p:Point;
if (immediate){
visible = false;
} else {
for each (button in pBottomButtons) {
if (button.parent == pBottomClip){
p = button.localToGlobal(new Point());
button.x = p.x;
button.y = p.y;
button.parent.removeChild(button);
zombie_hooker_nightmare.instance.addChild(button);
} else {
if (button.parent){
button.parent.setChildIndex(button, (button.parent.numChildren - 1));
};
};
};
};
pHiding = true;
zombie_hooker_nightmare.application.addUpdateFunction(displayUpdate);
}
public function showMoneyMessage(tricks:int, money:int):void{
pMessageClip.tricks = tricks;
pMessageClip.money = ("$" + IntUtil.formatAddComma(money));
pMessageClip.gotoAndPlay("money");
}
public function getHelpButton():SimpleButton{
if (pBottomButtons){
return (pBottomButtons.buttonHelp);
};
return (pBottomClip.buttonHelp);
}
private function onButtonHelp(e:MouseEvent):void{
zombie_hooker_nightmare.mouse_down();
if (Game.instance.isPausing()){
Game.instance.hideHelp();
} else {
Game.instance.showHelp();
hide();
};
}
public function get currentTricks():int{
return (pCurrentTricks);
}
private function updateTricksAnimation(e:GameApplicationUpdateEvent):void{
if (pTrickColor == null){
pTrickColorTimer = (Math.PI * 1.5);
pTrickColor = new ColorAdapter(0xFFFFFF);
pMovieClip.mcFullMsg.play();
} else {
pTrickColorTimer = (pTrickColorTimer + 0.5);
};
var percent:Number = ((Math.sin(pTrickColorTimer) + 1) / 2);
var filter:ColorMatrixFilter = new ColorMatrixFilter(pTrickColor.toMatrixForFilter(percent));
pMovieClip.tricksText.filters = [filter];
pMovieClip.nightsText.filters = [filter];
}
public function terminate():void{
var button:SimpleButton;
removeEventListener(Event.ENTER_FRAME, hpbarUpdate);
removeEventListener(Event.ENTER_FRAME, initUpdate);
zombie_hooker_nightmare.application.removeUpdateFunction(updateTricksAnimation);
if (pBottomButtons){
for each (button in pBottomButtons) {
if (button.parent){
button.parent.removeChild(button);
};
};
pBottomButtons = null;
};
if (parent){
parent.removeChild(this);
};
pMovieClip = null;
pTrickColor = null;
while (numChildren) {
removeChildAt(0);
};
}
public function get goalTricks():int{
return (pGoalTricks);
}
private function setVisiblePercent(percent:Number):void{
pMovieClip.y = (-(pHudHeight) * percent);
pBottomClip.y = (440 + (pHudHeight * percent));
}
public function updateMoney(addValue:int):void{
pMoney = (pMoney + addValue);
pMovieClip.moneyText.text = pMoney.toString();
Game.instance.getRankScoreManager().addMoneyScore(addValue);
}
public function attachHelpButton():void{
var helpButton:SimpleButton;
var p:Point;
if (pBottomButtons){
helpButton = pBottomButtons.buttonHelp;
if (helpButton){
delete pBottomButtons.buttonHelp;
p = pBottomClip.globalToLocal(new Point(helpButton.x, helpButton.y));
if (helpButton.parent){
helpButton.parent.removeChild(helpButton);
};
pBottomClip.addChild(helpButton);
helpButton.x = (p.x + pBottomClip.x);
helpButton.y = (p.y + pBottomClip.y);
};
};
}
private function initUpdate(e:Event):void{
var lola:Lola;
var weapon:Weapon;
if (((pMovieClip.nightsText) && (pMovieClip.tricksText))){
lola = Game.instance.getLola();
weapon = lola.currentWeapon;
if (weapon){
updateItem(weapon.type, weapon.amount);
updateItemAmount(weapon.type, weapon.amount);
} else {
updateItem(null, 0);
};
pMovieClip.nightsText.text = (("night " + pNights) + " goal");
updateTricks();
removeEventListener(Event.ENTER_FRAME, initUpdate);
pMovieClip.mcFullMsg.gotoAndStop(1);
};
}
public function updateItemAmount(type:String, currentAmount:int):void{
var filterArray:Array;
if (type){
pMovieClip.itemText.text = ((currentAmount.toString() + "/") + Game.instance.getWeaponConfigure(type).amount.toString());
if (currentAmount <= Game.instance.getWeaponConfigure(type).low){
if (pMovieClip.itemText.filters.length == 1){
filterArray = pMovieClip.itemText.filters;
filterArray.push(getRedFilters());
pMovieClip.itemText.filters = filterArray;
};
};
} else {
pMovieClip.itemText.text = "0/0";
removeRedColorFilter();
};
}
public function updateItem(type:String, currentAmount:int):void{
if (type){
pMovieClip.items.gotoAndStop(type);
pMovieClip.itemText.visible = true;
pMovieClip.itemText.text = ((currentAmount.toString() + "/") + Game.instance.getWeaponConfigure(type).amount.toString());
} else {
pMovieClip.items.gotoAndStop("hand");
pMovieClip.itemText.visible = false;
};
removeRedColorFilter();
}
public function show():void{
visible = true;
pHiding = false;
zombie_hooker_nightmare.application.addUpdateFunction(displayUpdate);
}
}
}//package
Section 161
//DecomposedZombie (DecomposedZombie)
package {
import flash.display.*;
public class DecomposedZombie extends GenericHookerZombie {
protected static const STATUS_DISMEMBER:String = "dismember";
protected static const STATUS_REBUILD:String = "rebuild";
public function DecomposedZombie(roleType:String, locX:int, locY:int){
super(roleType, locX, locY);
}
override protected function die_enter(prevState:String):void{
targetLoc = null;
pursuedRole = null;
nextPursuedPosition = null;
setFrameLabel(STATUS_DISMEMBER);
zombie_hooker_nightmare.application.addUpdateFunction(die_update);
checkKilledCombos();
}
override protected function attack_enter(prevState:String):void{
super.attack_enter(prevState);
playSound(zombie_throw);
}
override protected function createMovieClip():MovieClip{
return (new lib_decomposed_zombie());
}
}
}//package
Section 162
//door (door)
package {
import flash.media.*;
public dynamic class door extends Sound {
}
}//package
Section 163
//EmbedManager (EmbedManager)
package {
import flash.display.*;
import flash.xml.*;
import flash.utils.*;
public class EmbedManager {
private var property_2_1:Class;
private var property_2_3:Class;
private var property_2_4:Class;
private var ZHN_2_1:Class;
private var ZHN_2_2:Class;
private var ZHN_2_3:Class;
private var ZHN_2_5:Class;
private var ZHN_2_7:Class;
private var ZHN_2_9:Class;
private var ZHN_2_4:Class;
private var ZHN_2_6:Class;
private var property_1_10:Class;
private var property_2_5:Class;
private var property_2_6:Class;
private var ZHN_2_8:Class;
private var property_2_2:Class;
private var property_2_7:Class;
private var tileset_1:Class;
private var tileset_2:Class;
private var property_1_1:Class;
private var property_1_2:Class;
private var property_1_3:Class;
private var property_1_4:Class;
private var property_1_5:Class;
private var property_1_6:Class;
private var property_1_7:Class;
private var property_1_8:Class;
private var property_1_9:Class;
private var ZHN_1_1:Class;
private var ZHN_1_2:Class;
private var ZHN_1_3:Class;
private var ZHN_1_4:Class;
private var ZHN_1_5:Class;
private var ZHN_1_6:Class;
private var ZHN_1_7:Class;
private var ZHN_1_8:Class;
private var ZHN_1_9:Class;
private var property_2_8:Class;
private var property_2_9:Class;
private var property_2_10:Class;
private var _configXML:Class;
private static var _singleton:EmbedManager;
public function EmbedManager(){
var xmlDo:XMLDocument;
_configXML = EmbedManager__configXML;
ZHN_1_1 = EmbedManager_ZHN_1_1;
ZHN_1_2 = EmbedManager_ZHN_1_2;
ZHN_1_3 = EmbedManager_ZHN_1_3;
ZHN_1_4 = EmbedManager_ZHN_1_4;
ZHN_1_5 = EmbedManager_ZHN_1_5;
ZHN_1_6 = EmbedManager_ZHN_1_6;
ZHN_1_7 = EmbedManager_ZHN_1_7;
ZHN_1_8 = EmbedManager_ZHN_1_8;
ZHN_1_9 = EmbedManager_ZHN_1_9;
property_1_1 = EmbedManager_property_1_1;
property_1_2 = EmbedManager_property_1_2;
property_1_3 = EmbedManager_property_1_3;
property_1_4 = EmbedManager_property_1_4;
property_1_5 = EmbedManager_property_1_5;
property_1_6 = EmbedManager_property_1_6;
property_1_7 = EmbedManager_property_1_7;
property_1_8 = EmbedManager_property_1_8;
property_1_9 = EmbedManager_property_1_9;
property_1_10 = EmbedManager_property_1_10;
ZHN_2_1 = EmbedManager_ZHN_2_1;
ZHN_2_2 = EmbedManager_ZHN_2_2;
ZHN_2_3 = EmbedManager_ZHN_2_3;
ZHN_2_4 = EmbedManager_ZHN_2_4;
ZHN_2_5 = EmbedManager_ZHN_2_5;
ZHN_2_6 = EmbedManager_ZHN_2_6;
ZHN_2_7 = EmbedManager_ZHN_2_7;
ZHN_2_8 = EmbedManager_ZHN_2_8;
ZHN_2_9 = EmbedManager_ZHN_2_9;
property_2_1 = EmbedManager_property_2_1;
property_2_2 = EmbedManager_property_2_2;
property_2_3 = EmbedManager_property_2_3;
property_2_4 = EmbedManager_property_2_4;
property_2_5 = EmbedManager_property_2_5;
property_2_6 = EmbedManager_property_2_6;
property_2_7 = EmbedManager_property_2_7;
property_2_8 = EmbedManager_property_2_8;
property_2_9 = EmbedManager_property_2_9;
property_2_10 = EmbedManager_property_2_10;
tileset_1 = EmbedManager_tileset_1;
tileset_2 = EmbedManager_tileset_2;
super();
}
private function getXMLDocument(xmlClass:Class):XMLDocument{
var ba:ByteArray = (new (xmlClass) as ByteArray);
var xmlDoc:XMLDocument = new XMLDocument();
xmlDoc.ignoreWhite = true;
xmlDoc.parseXML(ba.readUTFBytes(ba.length));
return (xmlDoc);
}
public function getConfig():XMLDocument{
return (getXMLDocument(_configXML));
}
public function getTileset(tileset:String):Bitmap{
if (tileset == "tileset_1.png"){
return (new tileset_1());
};
return (new tileset_2());
}
public function getPropertyXml(episode:String, night:int):XMLDocument{
var xmlClass:Class = this[((("property_" + episode) + "_") + night)];
return (getXMLDocument(xmlClass));
}
public function getLevelXml(episode:String, night:int):XMLDocument{
var xmlClass:Class = this[((("ZHN_" + episode) + "_") + night)];
return (getXMLDocument(xmlClass));
}
public static function get singleton():EmbedManager{
if (_singleton == null){
_singleton = new (EmbedManager);
};
return (_singleton);
}
}
}//package
Section 164
//EmbedManager__configXML (EmbedManager__configXML)
package {
import mx.core.*;
public class EmbedManager__configXML extends ByteArrayAsset {
}
}//package
Section 165
//EmbedManager_property_1_1 (EmbedManager_property_1_1)
package {
import mx.core.*;
public class EmbedManager_property_1_1 extends ByteArrayAsset {
}
}//package
Section 166
//EmbedManager_property_1_10 (EmbedManager_property_1_10)
package {
import mx.core.*;
public class EmbedManager_property_1_10 extends ByteArrayAsset {
}
}//package
Section 167
//EmbedManager_property_1_2 (EmbedManager_property_1_2)
package {
import mx.core.*;
public class EmbedManager_property_1_2 extends ByteArrayAsset {
}
}//package
Section 168
//EmbedManager_property_1_3 (EmbedManager_property_1_3)
package {
import mx.core.*;
public class EmbedManager_property_1_3 extends ByteArrayAsset {
}
}//package
Section 169
//EmbedManager_property_1_4 (EmbedManager_property_1_4)
package {
import mx.core.*;
public class EmbedManager_property_1_4 extends ByteArrayAsset {
}
}//package
Section 170
//EmbedManager_property_1_5 (EmbedManager_property_1_5)
package {
import mx.core.*;
public class EmbedManager_property_1_5 extends ByteArrayAsset {
}
}//package
Section 171
//EmbedManager_property_1_6 (EmbedManager_property_1_6)
package {
import mx.core.*;
public class EmbedManager_property_1_6 extends ByteArrayAsset {
}
}//package
Section 172
//EmbedManager_property_1_7 (EmbedManager_property_1_7)
package {
import mx.core.*;
public class EmbedManager_property_1_7 extends ByteArrayAsset {
}
}//package
Section 173
//EmbedManager_property_1_8 (EmbedManager_property_1_8)
package {
import mx.core.*;
public class EmbedManager_property_1_8 extends ByteArrayAsset {
}
}//package
Section 174
//EmbedManager_property_1_9 (EmbedManager_property_1_9)
package {
import mx.core.*;
public class EmbedManager_property_1_9 extends ByteArrayAsset {
}
}//package
Section 175
//EmbedManager_property_2_1 (EmbedManager_property_2_1)
package {
import mx.core.*;
public class EmbedManager_property_2_1 extends ByteArrayAsset {
}
}//package
Section 176
//EmbedManager_property_2_10 (EmbedManager_property_2_10)
package {
import mx.core.*;
public class EmbedManager_property_2_10 extends ByteArrayAsset {
}
}//package
Section 177
//EmbedManager_property_2_2 (EmbedManager_property_2_2)
package {
import mx.core.*;
public class EmbedManager_property_2_2 extends ByteArrayAsset {
}
}//package
Section 178
//EmbedManager_property_2_3 (EmbedManager_property_2_3)
package {
import mx.core.*;
public class EmbedManager_property_2_3 extends ByteArrayAsset {
}
}//package
Section 179
//EmbedManager_property_2_4 (EmbedManager_property_2_4)
package {
import mx.core.*;
public class EmbedManager_property_2_4 extends ByteArrayAsset {
}
}//package
Section 180
//EmbedManager_property_2_5 (EmbedManager_property_2_5)
package {
import mx.core.*;
public class EmbedManager_property_2_5 extends ByteArrayAsset {
}
}//package
Section 181
//EmbedManager_property_2_6 (EmbedManager_property_2_6)
package {
import mx.core.*;
public class EmbedManager_property_2_6 extends ByteArrayAsset {
}
}//package
Section 182
//EmbedManager_property_2_7 (EmbedManager_property_2_7)
package {
import mx.core.*;
public class EmbedManager_property_2_7 extends ByteArrayAsset {
}
}//package
Section 183
//EmbedManager_property_2_8 (EmbedManager_property_2_8)
package {
import mx.core.*;
public class EmbedManager_property_2_8 extends ByteArrayAsset {
}
}//package
Section 184
//EmbedManager_property_2_9 (EmbedManager_property_2_9)
package {
import mx.core.*;
public class EmbedManager_property_2_9 extends ByteArrayAsset {
}
}//package
Section 185
//EmbedManager_tileset_1 (EmbedManager_tileset_1)
package {
import mx.core.*;
public class EmbedManager_tileset_1 extends BitmapAsset {
}
}//package
Section 186
//EmbedManager_tileset_2 (EmbedManager_tileset_2)
package {
import mx.core.*;
public class EmbedManager_tileset_2 extends BitmapAsset {
}
}//package
Section 187
//EmbedManager_ZHN_1_1 (EmbedManager_ZHN_1_1)
package {
import mx.core.*;
public class EmbedManager_ZHN_1_1 extends ByteArrayAsset {
}
}//package
Section 188
//EmbedManager_ZHN_1_2 (EmbedManager_ZHN_1_2)
package {
import mx.core.*;
public class EmbedManager_ZHN_1_2 extends ByteArrayAsset {
}
}//package
Section 189
//EmbedManager_ZHN_1_3 (EmbedManager_ZHN_1_3)
package {
import mx.core.*;
public class EmbedManager_ZHN_1_3 extends ByteArrayAsset {
}
}//package
Section 190
//EmbedManager_ZHN_1_4 (EmbedManager_ZHN_1_4)
package {
import mx.core.*;
public class EmbedManager_ZHN_1_4 extends ByteArrayAsset {
}
}//package
Section 191
//EmbedManager_ZHN_1_5 (EmbedManager_ZHN_1_5)
package {
import mx.core.*;
public class EmbedManager_ZHN_1_5 extends ByteArrayAsset {
}
}//package
Section 192
//EmbedManager_ZHN_1_6 (EmbedManager_ZHN_1_6)
package {
import mx.core.*;
public class EmbedManager_ZHN_1_6 extends ByteArrayAsset {
}
}//package
Section 193
//EmbedManager_ZHN_1_7 (EmbedManager_ZHN_1_7)
package {
import mx.core.*;
public class EmbedManager_ZHN_1_7 extends ByteArrayAsset {
}
}//package
Section 194
//EmbedManager_ZHN_1_8 (EmbedManager_ZHN_1_8)
package {
import mx.core.*;
public class EmbedManager_ZHN_1_8 extends ByteArrayAsset {
}
}//package
Section 195
//EmbedManager_ZHN_1_9 (EmbedManager_ZHN_1_9)
package {
import mx.core.*;
public class EmbedManager_ZHN_1_9 extends ByteArrayAsset {
}
}//package
Section 196
//EmbedManager_ZHN_2_1 (EmbedManager_ZHN_2_1)
package {
import mx.core.*;
public class EmbedManager_ZHN_2_1 extends ByteArrayAsset {
}
}//package
Section 197
//EmbedManager_ZHN_2_2 (EmbedManager_ZHN_2_2)
package {
import mx.core.*;
public class EmbedManager_ZHN_2_2 extends ByteArrayAsset {
}
}//package
Section 198
//EmbedManager_ZHN_2_3 (EmbedManager_ZHN_2_3)
package {
import mx.core.*;
public class EmbedManager_ZHN_2_3 extends ByteArrayAsset {
}
}//package
Section 199
//EmbedManager_ZHN_2_4 (EmbedManager_ZHN_2_4)
package {
import mx.core.*;
public class EmbedManager_ZHN_2_4 extends ByteArrayAsset {
}
}//package
Section 200
//EmbedManager_ZHN_2_5 (EmbedManager_ZHN_2_5)
package {
import mx.core.*;
public class EmbedManager_ZHN_2_5 extends ByteArrayAsset {
}
}//package
Section 201
//EmbedManager_ZHN_2_6 (EmbedManager_ZHN_2_6)
package {
import mx.core.*;
public class EmbedManager_ZHN_2_6 extends ByteArrayAsset {
}
}//package
Section 202
//EmbedManager_ZHN_2_7 (EmbedManager_ZHN_2_7)
package {
import mx.core.*;
public class EmbedManager_ZHN_2_7 extends ByteArrayAsset {
}
}//package
Section 203
//EmbedManager_ZHN_2_8 (EmbedManager_ZHN_2_8)
package {
import mx.core.*;
public class EmbedManager_ZHN_2_8 extends ByteArrayAsset {
}
}//package
Section 204
//EmbedManager_ZHN_2_9 (EmbedManager_ZHN_2_9)
package {
import mx.core.*;
public class EmbedManager_ZHN_2_9 extends ByteArrayAsset {
}
}//package
Section 205
//ExplodeEffect (ExplodeEffect)
package {
public class ExplodeEffect extends AbstractEffect {
public function ExplodeEffect(x:Number, y:Number){
super(x, y, lib_explode);
}
}
}//package
Section 206
//FatZombie (FatZombie)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class FatZombie extends GenericHookerZombie {
public function FatZombie(roleType:String, locX:int, locY:int){
super(roleType, locX, locY);
}
override protected function attack_update(e:Event):void{
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
setState(STATUS_STATIC);
} else {
if (pMovieClip.mc.currentFrame == 10){
Game.instance.addWeapon(new ThrownWeapon(PropertyLoader.ITEM_FAT_ZOMBIE_HEAD, this, null, (x + (pMovieClip.throwPoint.x * pMovieClip.scaleX)), (y + pMovieClip.throwPoint.y), new Point(((x < pursuedRole.x)) ? DIR_RIGHT : DIR_LEFT, 0)));
} else {
if (pMovieClip.mc.currentFrame == 8){
playSound(zombie_throw);
};
};
};
}
override protected function attack_enter(prevState:String):void{
pMovieClip.scaleX = ((x < pursuedRole.x)) ? DIR_RIGHT : DIR_LEFT;
setFrameLabel(STATUS_ATTACK);
zombie_hooker_nightmare.application.addUpdateFunction(attack_update);
}
override protected function createMovieClip():MovieClip{
return (new lib_fat_zombie());
}
override protected function ai_think_update(e:Event):void{
if (isStateAllowedToThink()){
if (((((pursuedRole) && (isTouched(pursuedRole, 200)))) && (pursuedRole.isAlive()))){
setState(STATUS_ATTACK);
} else {
super.ai_think_update(e);
};
};
}
}
}//package
Section 207
//fire (fire)
package {
import flash.media.*;
public dynamic class fire extends Sound {
}
}//package
Section 208
//FireSpitterZombie (FireSpitterZombie)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class FireSpitterZombie extends FatZombie {
public function FireSpitterZombie(roleType:String, locX:int, locY:int){
super(roleType, locX, locY);
}
override protected function attack_update(e:Event):void{
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
setState(STATUS_STATIC);
} else {
if (pMovieClip.mc.currentFrame == 10){
Game.instance.addWeapon(new ThrownWeapon(PropertyLoader.ITEM_FIREBALL, this, null, (x + (pMovieClip.throwPoint.x * pMovieClip.scaleX)), (y + pMovieClip.throwPoint.y), new Point(((x < pursuedRole.x)) ? DIR_RIGHT : DIR_LEFT, 0)));
} else {
if (pMovieClip.mc.currentFrame == 8){
playSound(zombie_throw);
};
};
};
}
override protected function createMovieClip():MovieClip{
return (new lib_fireSpitter_zombie());
}
}
}//package
Section 209
//flamethrower3 (flamethrower3)
package {
import flash.media.*;
public dynamic class flamethrower3 extends Sound {
}
}//package
Section 210
//Game (Game)
package {
import flash.events.*;
import com.liquable.media.*;
import flash.display.*;
import com.liquable.visualstack.*;
import com.liquable.utils.*;
import com.liquable.game.tiledmap.resources.events.*;
import com.liquable.game.geom.*;
import com.liquable.game.camera.*;
import flash.geom.*;
import com.liquable.game.tiledmap.*;
public class Game extends VisualSprite {
private var pMapResource:ZHNMapResource;
private var pDashboard:Dashboard;
private var pThrownWeaponRoot:Sprite;
private var pIsPausing:Boolean;
private var pSpecialEffectRoot:Sprite;
private var pScuttleSoundController:SoundController;
private var pRebornTimer:int;
private var pLoadingClip:MovieClip;
private var pGameSoundController:SoundController;
private var pRoles:Object;
private var pJohns:Object;
private var pWeapons:Object;
private var pFlamingSoundController:SoundController;
private var pCheatController:CheatController;
private var pEpisode:String;
private var pGameOver:Boolean;
private var pRespawnInterval:int;
private var pGameMap:GameMap;
private var pGameRoot:Sprite;
private var pBreakableObjects:Array;
private var pRankScoreManager:RankScoreManager;
private var pGameStage:Sprite;
private var pTrailer:Trailer;
private var pMapObjects:Object;
private var pMapRenderer:MapRenderer;
private var pTimeCount:int;
private var pCamera:ZhnGameCamera;
private var pZombies:Object;
private var pDebug:Boolean;
private var pControlPanelInited:Boolean;// = false
private var pLola:Lola;
private var pPropertyLoader:PropertyLoader;
private var pBreakableObjectRoot:Sprite;
private var pMoreJohnNeeds:int;
private var pNights:int;
private var pCanWalkLocs:Array;
private static var sFirstPlay:Boolean = true;
private static var sNeedPlayIntroSound:Boolean = true;
private static var sInstance:Game;
private static var pLastNightMoney:int = 0;
public function Game(episode:String, nights:int){
super();
pDebug = false;
if (pDebug){
episode = "2";
nights = 2;
};
sInstance = this;
pEpisode = episode;
pNights = nights;
pIsPausing = false;
pRoles = new Object();
pJohns = new Object();
pZombies = new Object();
pWeapons = new Object();
pMapObjects = new Object();
BlackMask.INSTANCE.stop(1);
pTimeCount = 0;
pRebornTimer = 0;
pGameOver = false;
pRespawnInterval = 3;
if (nights <= 1){
Lola.LAST_WEAPON_TYPE = null;
};
}
public function addExplode(explode:AbstractEffect):void{
if (!pSpecialEffectRoot.contains(explode)){
pSpecialEffectRoot.addChild(explode);
};
}
public function generateRoleOutOfScreen(roleType:String):AbstractRole{
var randomLoc:PointInt;
var role:AbstractRole;
var canWalkLocs:Array = getCanWalkLocsCopy();
while (canWalkLocs.length > 0) {
randomLoc = ArrayUtil.getArrayRandomElement(canWalkLocs, true);
if (((((canWalk(randomLoc.x, randomLoc.y)) && (!(getRolesOnLoc(randomLoc.x, randomLoc.y))))) && (!(isTileInCamera(randomLoc.x, randomLoc.y))))){
if (((!(getTrailer().isOnInvitingLoc(randomLoc.x, randomLoc.y))) && (!(randomLoc.equals(getTrailer().currentTileLoc))))){
role = RoleFactory.createRole(roleType, randomLoc.x, randomLoc.y);
addRole(role);
return (role);
};
};
};
return (null);
}
public function getRoles():Object{
return (pRoles);
}
private function addJohns(johnCounts:int):void{
var loc:PointInt;
var canWalkLocs:Array = getCanWalkLocsCopy();
var i:int;
while (i < johnCounts) {
if (canWalkLocs.length == 0){
return;
};
loc = ArrayUtil.getArrayRandomElement(canWalkLocs, true);
if (canWalk(loc.x, loc.y)){
addRole(RoleFactory.createRole(PropertyLoader.ROLE_JOHN, loc.x, loc.y));
} else {
i--;
};
i++;
};
}
public function isInCamera(obj:MapObject):Boolean{
var scrPosOfObj:Point = getScreenPosition(obj.position.x, obj.position.y);
return (((isScreenHLineInCamera((scrPosOfObj.x - (obj.width / 2)), obj.width)) && (isScreenVLineInCamera((scrPosOfObj.y - obj.height), obj.height))));
}
public function getMapObjects():Object{
return (pMapObjects);
}
public function swapObjects(obj1:MapObject, obj2:MapObject):void{
pGameRoot.swapChildren(obj1, obj2);
}
public function getJohns():Object{
return (pJohns);
}
public function playFlamingSound():void{
if (((!(pFlamingSoundController)) && (!(pGameOver)))){
pFlamingSoundController = zombie_hooker_nightmare.application.getSoundManager().playSound(fire, true);
};
}
public function removeRole(role:AbstractRole):void{
if (pRoles.hasOwnProperty(role.id)){
pGameRoot.removeChild(role);
delete pMapObjects[role.id];
delete pRoles[role.id];
if (role.type == PropertyLoader.ROLE_JOHN){
delete pJohns[role.id];
} else {
if (role.type == PropertyLoader.ROLE_LOLA){
pLola = null;
} else {
delete pZombies[role.id];
};
};
role.terminate();
};
}
public function getCamera():ZhnGameCamera{
return (pCamera);
}
public function getRolesOnLoc(locX:int, locY:int):Object{
var roles:Object;
var role:AbstractRole;
for each (role in pRoles) {
if ((((role.currentTileLoc.x == locX)) && ((role.currentTileLoc.y == locY)))){
if (roles == null){
roles = new Object();
roles[role.id] = role;
};
};
};
return (roles);
}
public function addWeapon(weapon:MovableObject):void{
DesignContract.preCondition((((weapon is Weapon)) || ((weapon is ThrownWeapon))));
if (!pWeapons.hasOwnProperty(weapon.id)){
pGameRoot.addChild(weapon);
pMapObjects[weapon.id] = weapon;
pWeapons[weapon.id] = weapon;
weapon.initialize();
};
}
public function getMap():GameMap{
return (pGameMap);
}
public function isGameOver():Boolean{
return (pGameOver);
}
private function addZombies(zombieType:String, zombieCount:int):void{
var i:int;
while (i < zombieCount) {
generateRoleOutOfScreen(zombieType);
i++;
};
}
private function onPropertyLoadComplete(event:Event):void{
pPropertyLoader.removeEventListener(PropertyLoader.LOAD_COMPLETE, onPropertyLoadComplete);
var maxNight:int = GameConfig.instance.getMapMaxNight(pEpisode);
var mapNight = 1;
if (maxNight > 1){
mapNight = (((pNights - 1) % maxNight) + 1);
};
pMapResource = new ZHNMapResource(zombie_hooker_nightmare.getStrBase());
pMapResource.addEventListener(MapResourceEvent.LOAD_COMPLETE, onMapLoadComplete);
pMapResource.loadFromXMLDocument(EmbedManager.singleton.getLevelXml(pEpisode, mapNight));
}
public function stopMusic():void{
if (pGameSoundController){
pGameSoundController.fadeOut(30);
pGameSoundController = null;
};
}
public function getRandomLocOutOfScreen():PointInt{
var randomLoc:PointInt;
var canWalkLocs:Array = getCanWalkLocsCopy();
while (canWalkLocs.length > 0) {
randomLoc = ArrayUtil.getArrayRandomElement(canWalkLocs, true);
if (((canWalk(randomLoc.x, randomLoc.y)) && (!(isTileInCamera(randomLoc.x, randomLoc.y))))){
return (randomLoc);
};
};
return (null);
}
private function onLevelCompleteBlackout():void{
data.setValue("level", pEpisode);
data.setValue("nights", (pNights + 1));
data.setValue("msg", Message.TYPE_SCREEN_GAME);
processDone();
}
public function playMusic():void{
var music:Class;
if ((((pGameSoundController == null)) || (!(pGameSoundController.isPlaying())))){
music = ((pEpisode)=="1") ? ZHN_episode1 : ZHN_episode2;
pGameSoundController = zombie_hooker_nightmare.application.getSoundManager().playSound(music, true);
pGameSoundController.fadeIn(0.8, 10);
};
}
public function stopScuttleSound(checkFirst:Boolean):void{
var zombie:GenericHookerZombie;
if (pScuttleSoundController){
if (checkFirst){
for each (zombie in getZombies()) {
if (zombie.type == PropertyLoader.ROLE_ANKLE_BITER_ZOMBIE){
if (zombie.isInWalk()){
return;
};
};
};
};
pScuttleSoundController.stop();
pScuttleSoundController = null;
};
}
public function updateCamera():void{
var role:AbstractRole;
var weapon:MovableObject;
var breakableObject:BreakableObject;
pLola.updateRealPosition();
pCamera.update();
for each (role in pRoles) {
if (role.type != PropertyLoader.ROLE_LOLA){
role.updateRealPosition();
};
};
for each (weapon in pWeapons) {
weapon.updateRealPosition();
};
for each (breakableObject in pBreakableObjects) {
breakableObject.updateRealPosition();
};
pTrailer.updateRealPosition();
pMapRenderer.update(pCamera, true);
}
public function getRoleConfigure(roleType:String):Configure{
return (pPropertyLoader.getRoleProperty(roleType));
}
public function playScuttleSound():void{
if (((!(pScuttleSoundController)) && (!(pGameOver)))){
pScuttleSoundController = zombie_hooker_nightmare.application.getSoundManager().playSound(zombie_scuttle, true);
};
}
public function addCombo(combo:AbstractCombo):void{
if (!pSpecialEffectRoot.contains(combo)){
pSpecialEffectRoot.addChild(combo);
};
}
private function onInitGameOverPanel(buttonSubmitScore:SimpleButton, buttonPlayAgain:SimpleButton, buttonHighscores:SimpleButton, buttonMoreGames:SimpleButton):void{
buttonSubmitScore.addEventListener(MouseEvent.CLICK, onButtonSubmitScore, false, 0, true);
buttonPlayAgain.addEventListener(MouseEvent.CLICK, onButtonPlayAgain, false, 0, true);
buttonHighscores.addEventListener(MouseEvent.CLICK, zombie_hooker_nightmare.linkLeaderboard, false, 0, true);
buttonMoreGames.addEventListener(MouseEvent.CLICK, zombie_hooker_nightmare.linkMoreGames, false, 0, true);
buttonSubmitScore.addEventListener(MouseEvent.MOUSE_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
buttonPlayAgain.addEventListener(MouseEvent.MOUSE_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
buttonHighscores.addEventListener(MouseEvent.MOUSE_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
buttonMoreGames.addEventListener(MouseEvent.MOUSE_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
}
public function setPausing(value:Boolean):void{
var zombie:GenericHookerZombie;
var john:John;
pIsPausing = value;
if (pIsPausing){
for each (zombie in pZombies) {
if (zombie.isAlive()){
zombie.idle();
};
};
for each (john in pJohns) {
if (john.isAlive()){
john.idle();
};
};
if (pLola){
pLola.goStatic(pLola.position.x, pLola.position.y);
};
};
}
public function getRankConfigure():Configure{
return (getRankConfigureByRank(getRankScoreManager().getRank()));
}
public function getTilePosition(columnIndex:int, rowIndex:int):Point{
return (pMapResource.getTilePosition(columnIndex, rowIndex));
}
public function convertToLegalLoc(locX:int, locY:int):PointInt{
if (locX < 0){
locX = (locX + mapColumnCounts);
} else {
if (locX >= mapColumnCounts){
locX = (locX - mapColumnCounts);
};
};
if (locY < 0){
locY = (locY + mapRowCounts);
} else {
if (locY >= mapRowCounts){
locY = (locY - mapRowCounts);
};
};
return (new PointInt(locX, locY));
}
public function getBreakableObjects():Array{
return (pBreakableObjects);
}
public function getMaxRank():int{
return (pPropertyLoader.getMaxRank());
}
public function get tileHeight():int{
return (pMapResource.tileHeight);
}
public function getZombieCounts():int{
var z:AbstractRole;
var i:int;
for each (z in pZombies) {
i++;
};
return (i);
}
public function onButtonCloseOfControlPanel(e:MouseEvent):void{
var thePanel:MovieClip;
if (pControlPanelInited){
zombie_hooker_nightmare.mouse_down();
thePanel = (zombie_hooker_nightmare.instance.getChildByName("helpPanel") as MovieClip);
if (thePanel){
thePanel.mouseChildren = (thePanel.mouseEnabled = false);
thePanel.play();
};
if (pDashboard){
BlackMask.INSTANCE.start(0.5, 0, 12, null);
pDashboard.show();
};
pControlPanelInited = false;
};
}
public function setCamerFocus(obj:ICameraObject):void{
pCamera.setFocus(obj);
}
public function getTileLocFromPosition(x:Number, y:Number):PointInt{
return (pMapResource.getTileLocFromPosition(x, y));
}
private function onGameOverPanelOver(thePanel:MovieClip):void{
if (thePanel.parent){
thePanel.parent.removeChild(thePanel);
};
if (GameConfig.instance.episode2Lock){
data.setValue("level", pEpisode);
data.setValue("nights", 1);
data.setValue("msg", Message.TYPE_SCREEN_GAME);
} else {
BlackMask.INSTANCE.start(1, 0, 10, null);
data.setValue("msg", Message.TYPE_SCREEN_COVER);
};
processDone();
}
public function get dashboard():Dashboard{
return (pDashboard);
}
public function getRankScoreManager():RankScoreManager{
return (pRankScoreManager);
}
override public function onPush():void{
pLoadingClip = new lib_loader_loop();
pLoadingClip.x = (728 / 2);
pLoadingClip.y = (500 / 2);
zombie_hooker_nightmare.instance.addChild(pLoadingClip);
pCheatController = new CheatController(stage);
zombie_hooker_nightmare.instance.setAdultswimVisible(true);
pPropertyLoader = new PropertyLoader();
pPropertyLoader.addEventListener(PropertyLoader.LOAD_COMPLETE, onPropertyLoadComplete);
var propertyNight:int = Math.min(pNights, GameConfig.instance.getPropertyMaxNight(pEpisode));
pPropertyLoader.loadFromXml(EmbedManager.singleton.getPropertyXml(pEpisode, propertyNight));
}
public function getObjectIndex(obj:MapObject):int{
return (pGameRoot.getChildIndex(obj));
}
private function initialize():void{
var loc:Object;
var john:John;
var j:int;
var breakableObject:BreakableObject;
pRankScoreManager = new RankScoreManager();
pCamera = new ZhnGameCamera();
pCamera.setGameArea(((-(pCamera.width) / 2) - 100), ((-(pCamera.height) / 2) - 100), ((mapWidth + pCamera.width) + 200), ((mapHeight + pCamera.height) + 200));
pCamera.setFollowSpeed(1);
pGameMap = new GameMap(pMapResource);
pMapRenderer = new MapRenderer(pGameMap);
pMapRenderer.build(pCamera, true, true);
pCamera.setGameRoot(pMapRenderer.getGameStage());
addChild(pMapRenderer);
pGameStage = pMapRenderer.getGameStage();
pBreakableObjectRoot = new Sprite();
pGameStage.addChild(pBreakableObjectRoot);
pGameRoot = new Sprite();
pGameStage.addChild(pGameRoot);
pSpecialEffectRoot = new Sprite();
pGameStage.addChild(pSpecialEffectRoot);
pThrownWeaponRoot = new Sprite();
pGameStage.addChild(pThrownWeaponRoot);
pDashboard = new Dashboard(pNights, pPropertyLoader.getGoalProperties().tricks);
pDashboard.x = -1;
pDashboard.y = -1;
addChild(pDashboard);
if (pNights > 1){
pDashboard.updateMoney(pLastNightMoney);
};
pCanWalkLocs = new Array();
var i:int;
while (i < mapColumnCounts) {
j = 0;
while (j < mapRowCounts) {
if (canWalk(i, j)){
pCanWalkLocs.push(new PointInt(i, j));
};
j++;
};
i++;
};
pBreakableObjects = new Array();
var locs:Array = pMapResource.getObjectLocs();
for each (loc in locs) {
breakableObject = new BreakableObject(loc.oType, loc.x, loc.y, loc.contents);
breakableObject.initialize();
pBreakableObjectRoot.addChild(breakableObject);
pBreakableObjects.push(breakableObject);
};
pDashboard.hide(true);
if ((((pNights == 1)) && (sFirstPlay))){
sFirstPlay = false;
BlackMask.INSTANCE.start(1, 0, 5, showHelp);
} else {
pDashboard.show();
BlackMask.INSTANCE.start(1, 0, 30, null);
zombie_hooker_nightmare.instance.stopBackgroundSound();
playMusic();
};
initializeGameElements();
var numJohns:int;
for each (john in pJohns) {
numJohns++;
};
pMoreJohnNeeds = (dashboard.goalTricks - numJohns);
if (GameConfig.instance.cheats){
pCheatController.start();
};
}
public function getWeapons():Object{
return (pWeapons);
}
private function onButtonPlayAgain(e:MouseEvent):void{
zombie_hooker_nightmare.mouse_down();
var button:SimpleButton = (e.target as SimpleButton);
var thePanel:MovieClip = (button.parent.parent as MovieClip);
if (thePanel){
thePanel.mouseChildren = (thePanel.mouseEnabled = false);
thePanel.play();
};
BlackMask.INSTANCE.start(0.5, 1, 6, null);
}
public function getRankConfigureByRank(r:int):Configure{
return (pPropertyLoader.getRankProperty(r));
}
public function isPausing():Boolean{
return (pIsPausing);
}
public function hideHelp():void{
pControlPanelInited = false;
zombie_hooker_nightmare.instance.stopBackgroundSound();
playMusic();
var clip:DisplayObject = zombie_hooker_nightmare.instance.getChildByName("helpPanel");
if (clip){
if (clip.parent){
clip.parent.removeChild(clip);
};
BlackMask.INSTANCE.start(BlackMask.INSTANCE.alpha, 0, 12, null);
};
pDashboard.show();
stage.focus = stage;
setPausing(false);
if (pGameSoundController){
pGameSoundController.setVolume(0.8);
};
}
public function getScreenPosition(objX:Number, objY:Number):Point{
return (pCamera.getScreenPosition(objX, objY));
}
public function getLola():Lola{
return (pLola);
}
public function getGamePosition(screenX:Number, screenY:Number):Point{
return (pCamera.getGamePosition(screenX, screenY));
}
public function addRole(role:AbstractRole):void{
if (!pRoles.hasOwnProperty(role.id)){
pGameRoot.addChild(role);
pRoles[role.id] = role;
pMapObjects[role.id] = role;
role.initialize();
if (role.type == PropertyLoader.ROLE_JOHN){
pJohns[role.id] = role;
} else {
if (role.type == PropertyLoader.ROLE_LOLA){
pLola = (role as Lola);
} else {
pZombies[role.id] = role;
};
};
};
}
public function get tileWidth():int{
return (pMapResource.tileWidth);
}
private function initializeGameElements():void{
var type:String;
var locs:Array;
var loc:Object;
var trailer:Object = pMapResource.getTrailerLoc();
pTrailer = new Trailer(PropertyLoader.OBJ_TRAILER, trailer.x, trailer.y);
pTrailer.initialize();
pGameRoot.addChild(pTrailer);
pMapObjects[pTrailer.id] = pTrailer;
var obj:Object = pMapResource.getLolaLoc();
addRole(RoleFactory.createRole(PropertyLoader.ROLE_LOLA, obj.x, obj.y));
if (pDebug){
} else {
obj = pMapResource.getRoleLocs();
for (type in obj) {
locs = obj[type];
for each (loc in locs) {
addRole(RoleFactory.createRole(type, loc.x, loc.y));
};
};
};
obj = pMapResource.getWeaponLocs();
for (type in obj) {
locs = obj[type];
for each (loc in locs) {
addWeapon(new Weapon(type, loc.x, loc.y));
};
};
addEventListener(Event.ENTER_FRAME, update);
}
public function getCanWalkLocsArray():Array{
return (pCanWalkLocs);
}
public function get mapColumnCounts():int{
return (pMapResource.columnCounts);
}
private function isScreenVLineInCamera(top:Number, length:Number):Boolean{
if (((((top + length) > 0)) && ((top < zombie_hooker_nightmare.application.gameHeight)))){
return (true);
};
var newTop:Number = (top - mapHeight);
if (((((newTop + length) > 0)) && ((newTop < zombie_hooker_nightmare.application.gameHeight)))){
return (true);
};
newTop = (top + mapHeight);
if (((((newTop + length) > 0)) && ((newTop < zombie_hooker_nightmare.application.gameHeight)))){
return (true);
};
return (false);
}
private function isScreenHLineInCamera(left:Number, length:Number):Boolean{
if (((((left + length) > 0)) && ((left < zombie_hooker_nightmare.application.gameWidth)))){
return (true);
};
var newLeft:Number = (left - mapWidth);
if (((((newLeft + length) > 0)) && ((newLeft < zombie_hooker_nightmare.application.gameWidth)))){
return (true);
};
newLeft = (left + mapWidth);
if (((((newLeft + length) > 0)) && ((newLeft < zombie_hooker_nightmare.application.gameWidth)))){
return (true);
};
return (false);
}
public function removeWeapon(weapon:MovableObject):void{
DesignContract.preCondition((((weapon is Weapon)) || ((weapon is ThrownWeapon))));
if (pWeapons.hasOwnProperty(weapon.id)){
pGameRoot.removeChild(weapon);
delete pMapObjects[weapon.id];
delete pWeapons[weapon.id];
weapon.terminate();
};
}
private function onButtonSubmitScore(e:MouseEvent):void{
zombie_hooker_nightmare.mouse_down();
var button:SimpleButton = (e.target as SimpleButton);
var thePanel:MovieClip = (button.parent.parent as MovieClip);
if (thePanel){
thePanel.mouseChildren = (thePanel.mouseEnabled = false);
};
hi_score.submit(zombie_hooker_nightmare.sGameId, pDashboard.getMoney());
}
public function isTileInCamera(locX:int, locY:int):Boolean{
var loc:PointInt = convertToLegalLoc(locX, locY);
var pos:Point = getTilePosition(loc.x, loc.y);
var scrPosOfTile:Point = getScreenPosition(pos.x, pos.y);
return (((isScreenHLineInCamera((scrPosOfTile.x - tileWidth), (tileWidth * 3))) && (isScreenVLineInCamera((scrPosOfTile.y - (tileHeight * 2)), (tileHeight * 3)))));
}
public function get mapHeight():int{
return (pMapResource.height);
}
public function get mapRowCounts():int{
return (pMapResource.rowCounts);
}
public function get mapWidth():int{
return (pMapResource.width);
}
private function update(event:Event):void{
updateCamera();
trace("lola loc: ", getLola().currentTileLoc.x, getLola().currentTileLoc.y);
trace("camera: ", pCamera.x, pCamera.y);
if (((((!(isPausing())) && (pLola))) && ((pLola.getHp() > 0)))){
pTimeCount++;
if (pTimeCount == 1000){
getRankScoreManager().addTimeScore();
pTimeCount = 0;
};
pRebornTimer++;
if (pRebornTimer > pRespawnInterval){
pRebornTimer = 0;
pRespawnInterval = getRankConfigure().respawnInterval;
if (!pDebug){
generateRandomZombie();
};
};
if (pMoreJohnNeeds > 0){
pMoreJohnNeeds--;
generateRoleOutOfScreen(PropertyLoader.ROLE_JOHN);
};
};
}
public function canWalk(locX:int, locY:int):Boolean{
var loc:PointInt = convertToLegalLoc(locX, locY);
return (pGameMap.canWalk(loc.x, loc.y));
}
public function getZombies():Object{
return (pZombies);
}
private function onPanelOver(thePanel:MovieClip):void{
hideHelp();
if (sNeedPlayIntroSound){
sNeedPlayIntroSound = false;
zombie_hooker_nightmare.application.getSoundManager().playSound(zhn_bonnie_2_faster, false);
};
}
private function onMapLoadComplete(event:MapResourceEvent):void{
if (pLoadingClip){
if (pLoadingClip.parent){
pLoadingClip.parent.removeChild(pLoadingClip);
};
pLoadingClip = null;
};
pMapResource.removeEventListener(MapResourceEvent.LOAD_COMPLETE, onMapLoadComplete);
initialize();
}
public function showHelp():void{
pControlPanelInited = false;
setPausing(true);
BlackMask.INSTANCE.start(0, 0.5, 12, null);
var clip:MovieClip = new lib_control_panel();
clip.name = "helpPanel";
clip.initPanel = onInitControlPanel;
clip.panelOver = onPanelOver;
clip.episodeFrame = pEpisode;
clip.x = (728 / 2);
clip.y = (500 / 2);
zombie_hooker_nightmare.instance.addChild(clip);
if (pGameSoundController){
pGameSoundController.setVolume(0.2);
};
}
public function generateWeaponOutOfScreen(weaponType:String):Weapon{
var randomLoc:PointInt;
var locOccupied:Boolean;
var m:MovableObject;
var w:Weapon;
var weapon:Weapon;
var canWalkLocs:Array = getCanWalkLocsCopy();
while (canWalkLocs.length > 0) {
randomLoc = ArrayUtil.getArrayRandomElement(canWalkLocs, true);
if (((((canWalk(randomLoc.x, randomLoc.y)) && (!(getRolesOnLoc(randomLoc.x, randomLoc.y))))) && (!(isTileInCamera(randomLoc.x, randomLoc.y))))){
if (((!(getTrailer().isOnInvitingLoc(randomLoc.x, randomLoc.y))) && (!(getTrailer().currentTileLoc.equals(randomLoc))))){
locOccupied = false;
for each (m in pWeapons) {
if ((m is Weapon)){
w = (m as Weapon);
if (((w.isInState(Weapon.STATUS_BOB)) && (w.currentTileLoc.equals(randomLoc)))){
locOccupied = true;
break;
};
};
};
if (!locOccupied){
weapon = new Weapon(weaponType, randomLoc.x, randomLoc.y);
addWeapon(weapon);
return (weapon);
};
};
};
};
return (null);
}
public function stopFlamingSound(checkFirst:Boolean):void{
var zombie:GenericHookerZombie;
if (pFlamingSoundController){
if (checkFirst){
for each (zombie in getZombies()) {
if (zombie.isInFlaming()){
return;
};
};
};
pFlamingSoundController.stop();
pFlamingSoundController = null;
};
}
public function getTileCenterPosition(columnIndex:int, rowIndex:int):Point{
return (pMapResource.getTileCenterPosition(columnIndex, rowIndex));
}
public function levelComplete():void{
BlackMask.INSTANCE.start(0, 1, 30, onLevelCompleteBlackout);
stopMusic();
}
private function onInitControlPanel(buttonClose:SimpleButton, buttonMoreGames:SimpleButton):void{
pControlPanelInited = true;
buttonClose.addEventListener(MouseEvent.CLICK, onButtonCloseOfControlPanel, false, 0, true);
buttonClose.addEventListener(MouseEvent.ROLL_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
buttonMoreGames.addEventListener(MouseEvent.CLICK, zombie_hooker_nightmare.linkMoreGames, false, 0, true);
buttonMoreGames.addEventListener(MouseEvent.ROLL_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
}
public function gameOver():void{
pGameOver = true;
stopFlamingSound(false);
stopScuttleSound(false);
BlackMask.INSTANCE.start(0, 0.5, 6, null);
var clip:MovieClip = new lib_gameover_panel();
clip.initPanel = onInitGameOverPanel;
clip.panelOver = onGameOverPanelOver;
clip.scoreText = ("$" + IntUtil.formatAddComma(pDashboard.getMoney()));
clip.x = (728 / 2);
clip.y = (500 / 2);
zombie_hooker_nightmare.instance.addChild(clip);
pDashboard.attachHelpButton();
pDashboard.hide();
stopMusic();
zombie_hooker_nightmare.instance.playBackgroundSound();
}
public function getFactorConfig():Configure{
return (pPropertyLoader.getFactorProperty());
}
public function getCanWalkLocsCopy():Array{
return (pCanWalkLocs.slice());
}
public function getWeaponConfigure(weaponType:String):Configure{
return (pPropertyLoader.getWeaponProperty(weaponType));
}
private function generateRandomZombie():Boolean{
var z:GenericHookerZombie;
var types:Array;
var type:String;
var totalWeights:int;
var needTypes:Array;
var needs:int;
var totalZombieNeed:int = getRankConfigure().totalZombies;
var currentTotal:int;
var counts:Object = new Object();
for each (z in pZombies) {
if (!counts.hasOwnProperty(z.type)){
counts[z.type] = 0;
};
var _local12 = counts;
var _local13 = z.type;
var _local14 = (_local12[_local13] + 1);
_local12[_local13] = _local14;
currentTotal++;
};
types = [PropertyLoader.ROLE_GENERIC_HOOKER_ZOMBIE, PropertyLoader.ROLE_ANKLE_BITER_ZOMBIE, PropertyLoader.ROLE_DECOMPOSED_ZOMBIE, PropertyLoader.ROLE_FAT_ZOMBIE, PropertyLoader.ROLE_FIRE_SPITTER_ZOMBIE, PropertyLoader.ROLE_PURPLE_DECOMPOSED_ZOMBIE];
if (currentTotal < (totalZombieNeed + types.length)){
totalWeights = 0;
for each (type in types) {
totalWeights = (totalWeights + getRankConfigure().getZombieWeight(type));
if (!counts.hasOwnProperty(type)){
counts[type] = 0;
};
};
needTypes = new Array();
for each (type in types) {
needs = (Math.round(((getRankConfigure().getZombieWeight(type) / totalWeights) * totalZombieNeed)) - counts[type]);
if (needs > 0){
needTypes.push(type);
};
};
if (needTypes.length){
generateRoleOutOfScreen(ArrayUtil.getArrayRandomElement(needTypes, false));
return (true);
};
};
return (false);
}
override public function onPop():MapData{
var role:AbstractRole;
var weapon:MovableObject;
var obj:MapObject;
var breakableObject:BreakableObject;
zombie_hooker_nightmare.instance.setAdultswimVisible(false);
removeEventListener(Event.ENTER_FRAME, update);
while (numChildren) {
removeChildAt(0);
};
if (pMapRenderer){
pMapRenderer.destroy();
pMapRenderer = null;
};
pTrailer.terminate();
pTrailer = null;
pRankScoreManager.terminate();
pPropertyLoader.terminate();
stopFlamingSound(false);
stopScuttleSound(false);
if (pCheatController){
pCheatController.stop();
pCheatController = null;
};
if (pBreakableObjects){
for each (breakableObject in pBreakableObjects) {
breakableObject.terminate();
};
pBreakableObjects = null;
};
for each (role in pRoles) {
removeRole(role);
};
pRoles = null;
pLola = null;
pZombies = null;
pJohns = null;
for each (weapon in pWeapons) {
removeWeapon(weapon);
};
pWeapons = null;
for each (obj in pMapObjects) {
obj.terminate();
};
pMapObjects = null;
while (pGameRoot.numChildren) {
pGameRoot.removeChildAt(0);
};
pGameRoot = null;
while (pSpecialEffectRoot.numChildren) {
pSpecialEffectRoot.removeChildAt(0);
};
pSpecialEffectRoot = null;
while (pThrownWeaponRoot.numChildren) {
pThrownWeaponRoot.removeChildAt(0);
};
pThrownWeaponRoot = null;
while (pGameStage.numChildren) {
pGameStage.removeChildAt(0);
};
pGameStage = null;
if (pDashboard){
pLastNightMoney = pDashboard.getMoney();
pDashboard.terminate();
pDashboard = null;
};
pGameMap = null;
pMapResource = null;
pCamera = null;
sInstance = null;
stopMusic();
return (super.onPop());
}
public function getTrailer():Trailer{
return (pTrailer);
}
public static function get instance():Game{
return (sInstance);
}
}
}//package
Section 211
//GameConfig (GameConfig)
package {
import flash.events.*;
import flash.xml.*;
import flash.net.*;
public class GameConfig extends URLLoader {
private var pEp2PropertyMaxNight:int;
private var pDebugPanel:Boolean;
private var pEp2MapMaxNight:int;
private var pHitLolaByTouch:Boolean;
private var pCheats:Boolean;
private var pCallback:Function;
private var pEp1MapMaxNight:int;
private var pHitJohnByTouch:Boolean;
private var pEpisode2Lock:Boolean;
private var pEp1PropertyMaxNight:int;
public static var instance:GameConfig;
public function GameConfig(url:String, callback:Function){
var request:URLRequest;
instance = this;
pEpisode2Lock = true;
pCallback = callback;
if (url){
addEventListener(Event.COMPLETE, onLoaded);
request = new URLRequest(url);
};
super(request);
}
private function onLoaded(e:Event):void{
importXml(new XMLDocument(this.data));
}
public function getPropertyMaxNight(episode:String):int{
if (episode == "1"){
return (pEp1PropertyMaxNight);
};
return (pEp2PropertyMaxNight);
}
public function importXml(xml:XMLDocument):void{
var node:XMLNode;
var subnode:XMLNode;
xml.ignoreWhite = true;
for each (node in xml.childNodes) {
if (node.nodeName == "config"){
for each (subnode in node.childNodes) {
switch (subnode.nodeName){
case "game":
analyticsGameNode(subnode);
break;
};
};
};
};
pCallback();
}
public function get cheats():Boolean{
return (pCheats);
}
public function get hitJohnByTouch():Boolean{
return (pHitJohnByTouch);
}
public function get episode2Lock():Boolean{
return (pEpisode2Lock);
}
public function get debugPanel():Boolean{
return (pDebugPanel);
}
private function analyticsGameNode(node:XMLNode):void{
pEpisode2Lock = (node.attributes.episode2Lock == "true");
pCheats = (node.attributes.cheats == "true");
pHitJohnByTouch = (node.attributes.hitJohnByTouch == "true");
pHitLolaByTouch = (node.attributes.hitLolaByTouch == "true");
pDebugPanel = (node.attributes.debugPanel == "true");
pEp1PropertyMaxNight = parseInt(node.attributes.ep1PropertyMaxNight);
pEp1MapMaxNight = parseInt(node.attributes.ep1MapMaxNight);
pEp2PropertyMaxNight = parseInt(node.attributes.ep2PropertyMaxNight);
pEp2MapMaxNight = parseInt(node.attributes.ep2MapMaxNight);
}
public function getMapMaxNight(episode:String):int{
if (episode == "1"){
return (pEp1MapMaxNight);
};
return (pEp2MapMaxNight);
}
public function get hitLolaByTouch():Boolean{
return (pHitLolaByTouch);
}
}
}//package
Section 212
//GameMap (GameMap)
package {
import com.liquable.game.tiledmap.resources.*;
import com.liquable.game.tiledmap.*;
import com.liquable.game.astar.*;
public class GameMap extends TiledMap {
public function GameMap(mapResource:MapResource){
super(mapResource);
}
public function canWalk(columnIndex:int, rowIndex:int):Boolean{
if (columnIndex < 0){
columnIndex = (columnIndex + getMapResource().columnCounts);
} else {
if (columnIndex >= getMapResource().columnCounts){
columnIndex = (columnIndex - getMapResource().columnCounts);
};
};
if (rowIndex < 0){
rowIndex = (rowIndex + getMapResource().rowCounts);
} else {
if (rowIndex >= getMapResource().rowCounts){
rowIndex = (rowIndex - getMapResource().rowCounts);
};
};
var properties:Object = getMapResource().getTileProperties(columnIndex, rowIndex);
return ((((!((properties == null))) && ((properties.canWalk == "1")))) ? true : false);
}
override public function getPassCost(moveObject, srcX:int, srcY:int, dstX:int, dstY:int):Number{
if (canWalk(dstX, dstY)){
return (super.getPassCost(moveObject, srcX, srcY, dstX, dstY));
};
return (AStar.IMPASSABLE_COST);
}
public function setCanWalk(columnIndex:int, rowIndex:int, canwalk:Boolean):void{
var properties:Object = getMapResource().getTileProperties(columnIndex, rowIndex);
if (properties){
properties.canWalk = (canwalk) ? "1" : "0";
};
}
override public function getReachedDestination(moveObject, srcX:int, srcY:int, dstX:int, dstY:int):Boolean{
if (srcX >= Game.instance.mapColumnCounts){
srcX = (srcX - Game.instance.mapColumnCounts);
} else {
if (srcX < 0){
srcX = (srcX + Game.instance.mapColumnCounts);
};
};
if (srcY >= Game.instance.mapRowCounts){
srcY = (srcY - Game.instance.mapRowCounts);
} else {
if (srcY < 0){
srcY = (srcY + Game.instance.mapRowCounts);
};
};
return (super.getReachedDestination(moveObject, srcX, srcY, dstX, dstY));
}
override public function getFCost(moveObject, srcX:int, srcY:int, dstX:int, dstY:int):Number{
var halfColumns:Number = (Game.instance.mapColumnCounts / 2);
var halfRows:Number = (Game.instance.mapRowCounts / 2);
var dx:Number = Math.abs((srcX - dstX));
var dy:Number = Math.abs((srcY - dstY));
while (dx >= Game.instance.mapColumnCounts) {
dx = (dx - Game.instance.mapColumnCounts);
};
while (dy >= Game.instance.mapRowCounts) {
dy = (dy - Game.instance.mapRowCounts);
};
if (dx > halfColumns){
dx = (Game.instance.mapColumnCounts - dx);
};
if (dy > halfRows){
dy = (Game.instance.mapRowCounts - dy);
};
return (super.getFCost(moveObject, 0, 0, dx, dy));
}
}
}//package
Section 213
//GamePreloader (GamePreloader)
package {
import flash.events.*;
import flash.display.*;
import com.adultswim.*;
import com.adultswim.Preroll.*;
import flash.net.*;
import flash.utils.*;
public class GamePreloader extends MovieClip {
private var pButtonAdultswim:SimpleButton;
private var pLoaderScreen:MovieClip;
public function GamePreloader(){
super();
stop();
GlobalVarContainer.vars.stage = stage;
GlobalVarContainer.vars.root = root;
GlobalVarContainer.vars.gameName = "ZHN";
GlobalVarContainer.vars.gameMethod = GamePreloaderFunction;
trace(GlobalVarContainer.vars.stage, stage);
new Main();
}
private function onButtonAdultswim(e:MouseEvent):void{
navigateToURL(new URLRequest((("http://games.adultswim.com?cid=GAME_Ext_ZHN_" + getStrDomain()) + "_game_more")), "_blank");
}
public function getRootParameters():Object{
if (((((root) && (root.loaderInfo))) && (root.loaderInfo.parameters))){
return (root.loaderInfo.parameters);
};
return ({});
}
private function onEnterFrame(e:Event):void{
var targetFrame:int;
if (pButtonAdultswim == null){
if (pLoaderScreen.buttonAdultswim){
pButtonAdultswim = pLoaderScreen.buttonAdultswim;
pButtonAdultswim.addEventListener(MouseEvent.CLICK, onButtonAdultswim, false, 0, true);
};
};
var percentLoaded:Number = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal);
var completeFrame = 11;
if (percentLoaded == 1){
if (pLoaderScreen.currentFrame == pLoaderScreen.totalFrames){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
removeChild(pLoaderScreen);
pLoaderScreen = null;
nextFrame();
init();
} else {
if (pLoaderScreen.currentFrame <= completeFrame){
pLoaderScreen.gotoAndPlay((completeFrame + 1));
};
};
} else {
targetFrame = Math.min(completeFrame, (Math.floor((completeFrame * percentLoaded)) + 1));
pLoaderScreen.gotoAndStop(targetFrame);
};
}
public function getStrDomain():String{
return (getRootParameters()["strDomain"]);
}
private function init():void{
var app:Object;
var mainClass:Class = Class(getDefinitionByName("zombie_hooker_nightmare"));
if (mainClass){
app = new (mainClass);
addChild((app as DisplayObject));
};
}
private function GamePreloaderFunction(){
addEventListener(Event.ENTER_FRAME, onEnterFrame);
pLoaderScreen = new lib_preloader();
pLoaderScreen.stop();
pLoaderScreen.x = (728 / 2);
pLoaderScreen.y = (500 / 2);
addChild(pLoaderScreen);
}
}
}//package
Section 214
//GenericHookerZombie (GenericHookerZombie)
package {
import flash.events.*;
import flash.display.*;
import com.liquable.utils.*;
import com.liquable.game.geom.*;
import flash.geom.*;
import flash.utils.*;
public class GenericHookerZombie extends AbstractAiRole {
private var pTimeToDelete:int;
protected var pHitDistance:Number;// = 50
protected var pTryKeepDistance:Number;// = 25
protected var pDamage:int;
public function GenericHookerZombie(roleType:String, locX:int, locY:int){
var roleConfigure:Configure = Game.instance.getRoleConfigure(roleType);
var rankConfigure:Configure = Game.instance.getRankConfigure();
super(roleType, locX, locY, rankConfigure.getZombieHp(roleType), roleConfigure.speed, roleConfigure.range, 20, roleConfigure.money);
pDamage = roleConfigure.damage;
pHitDistance = Game.instance.getRoleConfigure(type).hitDistance;
}
private function deleteDelayUpdate(e:Event):void{
var locs:Array;
var lola:Lola;
var halfScreenLocsX:int;
var halfScreenLocsY:int;
var diffX:int;
var diffY:int;
var loc:PointInt;
var point:Point;
var currentTime:int = getTimer();
if (currentTime > pTimeToDelete){
if (!Game.instance.isInCamera(this)){
locs = Game.instance.getCanWalkLocsCopy();
lola = Game.instance.getLola();
halfScreenLocsX = (((zombie_hooker_nightmare.application.gameWidth / Game.instance.tileWidth) / 2) + 1);
halfScreenLocsY = (((zombie_hooker_nightmare.application.gameHeight / Game.instance.tileHeight) / 2) + 1);
diffX = Math.abs((currentTileLoc.x - lola.currentTileLoc.x));
diffY = Math.abs((currentTileLoc.y - lola.currentTileLoc.y));
while (locs.length > 0) {
loc = ArrayUtil.getArrayRandomElement(locs, true);
if (((((((((Game.instance.canWalk(loc.x, loc.y)) && ((diffX > halfScreenLocsX)))) && ((diffX <= (halfScreenLocsX + 2))))) && ((diffY > halfScreenLocsY)))) && ((diffY <= (halfScreenLocsY + 2))))){
point = Game.instance.getTileCenterPosition(loc.x, loc.y);
setPosition(point.x, point.y);
updateRealPosition();
setState(STATUS_STATIC);
break;
};
};
};
pTimeToDelete = (currentTime + (Game.instance.getRoleConfigure(type).deleteDelayTime * 1000));
};
}
override protected function createMovieClip():MovieClip{
return (new lib_generic_hooker_zombie());
}
protected function pursueRole_enter(prevState:String):void{
setFrameLabel(STATUS_WALK);
zombie_hooker_nightmare.application.addUpdateFunction(pursueRole_update);
}
override protected function static_enter(prevState:String):void{
targetLoc = null;
pursuedRole = null;
nextPursuedPosition = null;
super.static_enter(prevState);
}
protected function attack_exit(nextState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(attack_update);
}
override protected function isInRange(role:AbstractRole):Boolean{
var lola:Lola;
if ((role is Lola)){
lola = (role as Lola);
if (lola.isInTrailer()){
return (false);
};
};
return (super.isInRange(role));
}
override public function initialize():void{
super.initialize();
pStateMachine.setDebug(true);
pStateMachine.initState(STATUS_PURSUE_ROLE, pursueRole_enter, null, pursueRole_exit);
pStateMachine.initState(STATUS_ATTACK, attack_enter, null, attack_exit);
pTimeToDelete = (getTimer() + (Game.instance.getRoleConfigure(type).deleteDelayTime * 1000));
zombie_hooker_nightmare.application.addUpdateFunction(deleteDelayUpdate);
}
protected function pursueRole_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(pursueRole_update);
}
private function setRandomLocOutOfScreen():Boolean{
var randomLoc:PointInt = Game.instance.getRandomLocOutOfScreen();
if (randomLoc){
targetLoc = randomLoc;
return (true);
};
return (false);
}
public function isInWalk():Boolean{
return (((pStateMachine.isInState(STATUS_GO_TO_LOC)) || (pStateMachine.isInState(STATUS_PURSUE_ROLE))));
}
override protected function die_enter(prevState:String):void{
super.die_enter(prevState);
checkKilledCombos();
}
protected function attack_update(e:Event):void{
var dy:Number;
var dx:Number;
if (((pursuedRole) && (!(pursuedRole.isAlive())))){
setState(STATUS_STATIC);
return;
};
if (pMovieClip.mc){
if (pMovieClip.mc.currentFrame == pMovieClip.mc.totalFrames){
setState(STATUS_STATIC);
} else {
if (!pStateMachine.data.getBoolean("didHit")){
if (pMovieClip.mc.currentFrame >= 6){
dy = (pursuedRole.y - y);
dx = (pursuedRole.x - x);
if ((((((Math.abs(dy) < 10)) && (((pMovieClip.scaleX * dx) >= 0)))) && ((Math.abs(dx) < Math.max(20, pHitDistance))))){
pursuedRole.goHit(false, pDamage, null, this);
pStateMachine.data.setValue("didHit", true);
};
};
};
};
};
}
override public function terminate():void{
zombie_hooker_nightmare.application.removeUpdateFunction(deleteDelayUpdate);
super.terminate();
}
override protected function die_update(e:Event):void{
var lola:Lola;
var combo:int;
var comboStart:int;
var chance:Number;
var weapon:Weapon;
super.die_update(e);
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
lola = Game.instance.getLola();
combo = lola.getKilledCombos();
comboStart = 5;
if (combo >= comboStart){
chance = Math.min(0.75, ((combo - comboStart) / 10));
if (Math.random() < chance){
weapon = new Weapon(PropertyLoader.ITEM_CASH, currentTileLoc.x, currentTileLoc.y);
Game.instance.addWeapon(weapon);
};
};
Game.instance.dashboard.updateMoney(pMoney);
Game.instance.removeRole(this);
};
}
protected function checkKilledCombos():void{
var lola:Lola = Game.instance.getLola();
lola.doKilledComboTest();
var combos:int = lola.getKilledCombos();
if (((((combos % Game.instance.getFactorConfig().combo) == 0)) && (!((combos == 0))))){
Game.instance.addCombo(new ComboSmall(x, ((y - height) - 5), combos.toString()));
};
}
override protected function ai_think_update(e:Event):void{
var role:AbstractRole;
var dx:Number;
var doAttack:Boolean;
var loc:PointInt;
var i:int;
var randomLoc:PointInt;
extendFlaming();
if (isStateAllowedToThink()){
role = getRoleInRange();
if (role){
dx = (x - role.x);
if ((((Math.abs((role.y - y)) < 10)) && ((Math.abs(dx) < (role.isRunningTo(x)) ? (pHitDistance + 80) : pHitDistance)))){
doAttack = false;
if ((((Math.abs(dx) > pTryKeepDistance)) || ((Math.random() < 0.2)))){
doAttack = true;
} else {
loc = null;
if (dx > 0){
i = 2;
while (i > 0) {
loc = new PointInt((role.currentTileLoc.x + i), role.currentTileLoc.y);
if (Game.instance.canWalk(loc.x, loc.y)){
break;
} else {
loc = null;
};
i--;
};
};
if (loc == null){
i = 2;
while (i > 0) {
loc = new PointInt((role.currentTileLoc.x - i), role.currentTileLoc.y);
if (Game.instance.canWalk(loc.x, loc.y)){
break;
} else {
loc = null;
};
i--;
};
};
if (loc == null){
loc = getRandomLoc(3);
};
if (loc){
targetLoc = loc;
pursuedRole = null;
nextPursuedPosition = null;
setState(STATUS_GO_TO_LOC);
} else {
doAttack = true;
};
};
if (doAttack){
targetLoc = null;
pursuedRole = role;
nextPursuedPosition = null;
pMovieClip.scaleX = ((dx > 0)) ? -1 : 1;
setState(STATUS_ATTACK);
};
} else {
if (!pursuedRole){
targetLoc = null;
pursuedRole = role;
nextPursuedPosition = null;
setState(STATUS_PURSUE_ROLE);
};
};
} else {
if (pStateMachine.isInState(STATUS_STATIC)){
if (!targetLoc){
randomLoc = getRandomLoc(7);
if (randomLoc){
targetLoc = randomLoc;
pursuedRole = null;
nextPursuedPosition = null;
setState(STATUS_GO_TO_LOC);
} else {
setAIState(STATUS_AI_STATIC);
};
};
};
};
};
}
override protected function hit_update(e:Event):Boolean{
if (((super.hit_update(e)) && ((pMovieClip.mc.currentFrame == pMovieClip.mc.totalFrames)))){
if (isAlive()){
setState(STATUS_STATIC);
pAIStateMachine.data.setValue("timer", ((pReactionDelayTime - 5) - IntUtil.random(10)));
} else {
Game.instance.getRankScoreManager().addZombieScore(type);
setState(STATUS_DIE);
};
return (true);
//unresolved jump
};
return (false);
}
private function extendFlaming():void{
var zombie:GenericHookerZombie;
if (((isInFlaming()) && (Game.instance.isInCamera(this)))){
for each (zombie in Game.instance.getZombies()) {
if (((zombie.isAlive()) && (!(zombie.isInFlaming())))){
if (((zombie.hitTestRect.hitTestObject(hitTestRect)) && ((Math.abs((zombie.y - y)) < Game.instance.tileHeight)))){
zombie.setOnFire();
};
};
};
};
}
override public function setOnFire():void{
if (((!(pStateMachine.isInState(STATUS_DIE))) && (!(isInFlaming())))){
pFlamingMachine.setState(STATUS_FLAMING_TRUE);
};
}
protected function attack_enter(prevState:String):void{
setFrameLabel(STATUS_ATTACK);
zombie_hooker_nightmare.application.addUpdateFunction(attack_update);
pStateMachine.data.setValue("didHit", false);
}
protected function pursueRole_update(e:Event):void{
var dx:Number;
var dy:Number;
var shiftcut:Point;
var loc:PointInt;
if ((((((pursuedRole == null)) || (!(pursuedRole.isAlive())))) || (!(Game.instance.isInCamera(pursuedRole))))){
setState(STATUS_STATIC);
return;
};
if (pursuedRole.type == PropertyLoader.ROLE_LOLA){
if (Lola(pursuedRole).isInTrailer()){
if (setRandomLocOutOfScreen()){
setState(STATUS_GO_TO_LOC);
return;
};
};
} else {
if (pursuedRole.type == PropertyLoader.ROLE_JOHN){
if (John(pursuedRole).isInTrailer()){
if (setRandomLocOutOfScreen()){
setState(STATUS_GO_TO_LOC);
return;
};
};
};
};
if (!isInRange(pursuedRole)){
setState(STATUS_STATIC);
} else {
if (isTouched(pursuedRole, (pursuedRole.isRunningTo(x)) ? (pHitDistance + 80) : pHitDistance)){
setState(STATUS_ATTACK);
} else {
dx = (x - pursuedRole.x);
dy = (y - pursuedRole.y);
if ((((Math.abs((y - pursuedRole.y)) < 40)) && ((Math.abs((x - pursuedRole.x)) < Math.max(16, pHitDistance))))){
shiftcut = new Point(position.x, pursuedRole.position.y);
loc = Game.instance.getTileLocFromPosition(shiftcut.x, shiftcut.y);
if (Game.instance.getMap().canWalk(loc.x, loc.y)){
nextPursuedPosition = shiftcut;
};
};
if ((((nextPursuedPosition == null)) || (nextPursuedPosition.equals(position)))){
nextPursuedPosition = getNextTargetPosition(pursuedRole.currentTileLoc.x, pursuedRole.currentTileLoc.y);
};
if (nextPursuedPosition){
pursueTarget(nextPursuedPosition.x, nextPursuedPosition.y);
} else {
setState(STATUS_STATIC);
};
};
};
}
}
}//package
Section 215
//GR_HUDButtonsTogether (GR_HUDButtonsTogether)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class GR_HUDButtonsTogether extends MovieClip {
public var buttonSoundOff:SimpleButton;
public var buttonHelp:SimpleButton;
public var buttonSoundOn:SimpleButton;
public function GR_HUDButtonsTogether(){
addFrameScript(0, frame1);
}
function frame1(){
this.initButtons();
}
}
}//package
Section 216
//hi_score (hi_score)
package {
import flash.net.*;
import com.adobe.crypto.*;
import flash.external.*;
public class hi_score {
public function hi_score(){
super();
}
public static function submit(gameID:String, score:Number):String{
var strURI:String;
var nGameId:String;
var nScore:Number;
var nTime:Number;
var strTime:String;
var strN1:String;
var strN2:String;
var n1:Number;
var n2:Number;
var nAlgo:Number;
var strToPass:String;
var encrypted_data:String;
var submission_data:String;
var variables:URLVariables;
var request:URLRequest;
var gameID = gameID;
var score = score;
strURI = ExternalInterface.call("getLittleServer");
nGameId = gameID;
nScore = score;
nTime = ExternalInterface.call("getSrvrTime");
strTime = nTime.toString();
strN1 = strTime.substr(-3, 3);
strN2 = strTime.substr(-4, 3);
n1 = parseInt(strN1);
n2 = parseInt(strN2);
nAlgo = (((n1 * n2) * nScore) + nScore);
strToPass = ((((((nGameId + ",") + nScore) + ",") + nTime) + ",") + nAlgo);
encrypted_data = MD5.hash(strToPass);
submission_data = ((((((("score=" + nScore) + "|gameId=") + nGameId) + "|timestamp=") + nTime) + "|key=") + encrypted_data);
variables = new URLVariables();
variables.attr1 = submission_data;
request = new URLRequest(strURI);
request.data = variables;
navigateToURL(request, "_self");
return (submission_data);
//unresolved jump
var _slot1 = e;
return (null);
}
}
}//package
Section 217
//interface_button_press (interface_button_press)
package {
import flash.media.*;
public dynamic class interface_button_press extends Sound {
}
}//package
Section 218
//interface_button_rollover (interface_button_rollover)
package {
import flash.media.*;
public dynamic class interface_button_rollover extends Sound {
}
}//package
Section 219
//John (John)
package {
import flash.events.*;
import flash.display.*;
import com.liquable.utils.*;
import com.liquable.game.geom.*;
import flash.geom.*;
public class John extends AbstractAiRole {
private var pLocId:int;
private static const STATUS_WALK_TRICKED:String = "walkTricked";
private static const STATUS_DIE_TRICKED:String = "dieTricked";
private static const STATUS_HIT_TRICKED:String = "hitTricked";
private static const STATUS_STATIC_TRICKED:String = "staticTricked";
public function John(roleType:String, locX:int, locY:int){
var configure:Configure = Game.instance.getRoleConfigure(roleType);
super(roleType, locX, locY, configure.hp, configure.speed, configure.range, 5, configure.money);
pLocId = -1;
pFindPathLimit = 500;
}
public function isInTrailer():Boolean{
return (pStateMachine.isInState(STATUS_IN_TRAILER));
}
public function getLocId():int{
return (pLocId);
}
public function goInTrailer():void{
setState(STATUS_IN_TRAILER);
}
override protected function static_enter(prevState:String):void{
if (isTricked){
setFrameLabel(STATUS_STATIC_TRICKED);
} else {
setFrameLabel(STATUS_STATIC);
};
zombie_hooker_nightmare.application.addUpdateFunction(static_update);
setAIState(STATUS_AI_STATIC);
pStateMachine.data.setValue("timer", 0);
pStateMachine.data.setValue("duration", 0);
}
override public function set pursuedRole(role:AbstractRole):void{
DesignContract.preCondition((((role is Lola)) || (!(role))));
super.pursuedRole = role;
}
override protected function goToLoc_update(e:Event):void{
if (getLocId() == -1){
if (pursuedRole){
Lola(pursuedRole).lostJohn(this);
pursuedRole = null;
};
setState(STATUS_STATIC);
} else {
targetLoc = Lola(pursuedRole).getAvailable9GridsLocAt(getLocId());
if (!Game.instance.canWalk(targetLoc.x, targetLoc.y)){
setLocId(Lola(pursuedRole).getAvailable9GridsLocId());
targetLoc = Lola(pursuedRole).getAvailable9GridsLocAt(getLocId());
};
super.goToLoc_update(e);
};
}
override public function initialize():void{
super.initialize();
pStateMachine.initState(STATUS_IN_TRAILER, inTrailer_enter, null, inTrailer_exit);
}
override public function goHit(flaming:Boolean, damage:int, weaponType:String, attacker:AbstractRole):void{
if ((((pursuedRole == null)) || (GameConfig.instance.hitJohnByTouch))){
super.goHit(flaming, damage, weaponType, attacker);
};
}
override protected function createMovieClip():MovieClip{
return (new lib_john());
}
override protected function die_enter(prevState:String):void{
pFlamingMachine.setState(STATUS_FLAMING_FALSE);
targetLoc = null;
pursuedRole = null;
nextPursuedPosition = null;
if (isTricked){
setFrameLabel(STATUS_DIE_TRICKED);
} else {
setFrameLabel(STATUS_DIE);
};
zombie_hooker_nightmare.application.addUpdateFunction(die_update);
if (Math.random() < 0.5){
playSound(john_hit0);
} else {
playSound(john_hit1);
};
}
private function inTrailer_update(e:Event):void{
var trailer:Trailer;
if (currentTileLoc.equals(targetLoc)){
trailer = Game.instance.getTrailer();
trailer.addJohn();
Lola(pursuedRole).lostJohn(this);
Game.instance.removeRole(this);
} else {
if ((((nextPursuedPosition == null)) || (nextPursuedPosition.equals(position)))){
nextPursuedPosition = getNextTargetPosition(targetLoc.x, targetLoc.y);
};
if (nextPursuedPosition){
pursueTarget(nextPursuedPosition.x, nextPursuedPosition.y);
} else {
Lola(pursuedRole).lostJohn(this);
setState(STATUS_STATIC);
};
};
}
override protected function goToLoc_enter(prevState:String):void{
if (isTricked){
setFrameLabel(STATUS_WALK_TRICKED);
} else {
setFrameLabel(STATUS_WALK);
};
zombie_hooker_nightmare.application.addUpdateFunction(goToLoc_update);
}
override protected function goToLoc_exit(prevState:String):void{
super.goToLoc_exit(prevState);
pStateMachine.data.setValue("SoundController", null);
}
override protected function getNextTargetPosition(targetLocX:int, targetLocY:int):Point{
var p:Point = super.getNextTargetPosition(targetLocX, targetLocY);
if (p == null){
if (pursuedRole != null){
Lola(pursuedRole).lostJohn(this);
};
};
return (p);
}
override public function get pursuedRole():AbstractRole{
DesignContract.preCondition((((super.pursuedRole is Lola)) || (!(super.pursuedRole))));
return (super.pursuedRole);
}
override protected function isStateAllowedToThink():Boolean{
return (((!(pStateMachine.isInState(STATUS_IN_TRAILER))) && (super.isStateAllowedToThink())));
}
private function inTrailer_enter(prevState:String):void{
targetLoc = null;
nextPursuedPosition = null;
DesignContract.preCondition((pursuedRole == Game.instance.getLola()), "John is not following lola and is entering the trailer");
setHp(0);
var trailer:Trailer = Game.instance.getTrailer();
targetLoc = trailer.currentTileLoc;
setFrameLabel(STATUS_WALK_TRICKED);
zombie_hooker_nightmare.application.addUpdateFunction(inTrailer_update);
}
override protected function die_update(e:Event):void{
super.die_update(e);
if (pMovieClip.mc.currentFrame >= 27){
Game.instance.removeRole(this);
Game.instance.generateRoleOutOfScreen(type);
};
}
override protected function hit_enter(prevState:String):void{
targetLoc = null;
nextPursuedPosition = null;
if (pursuedRole){
Lola(pursuedRole).lostJohn(this);
};
setHp(0);
if (isTricked){
setFrameLabel(STATUS_HIT_TRICKED);
} else {
setFrameLabel(STATUS_HIT);
};
zombie_hooker_nightmare.application.addUpdateFunction(hit_update);
if (Math.random() < 0.5){
playSound(john_hit0);
} else {
playSound(john_hit1);
};
}
override protected function ai_think_update(e:Event):void{
var z:AbstractAiRole;
var lola:Lola;
var targetLoc:PointInt;
if (((GameConfig.instance.hitJohnByTouch) && (isStateAllowedToThink()))){
if (Game.instance.isInCamera(this)){
for each (z in Game.instance.getZombies()) {
if (Game.instance.isInCamera(z)){
if (z.isTouched(this)){
goHit(false, Game.instance.getRoleConfigure(z.type).damage, null, z);
return;
};
};
};
};
};
if (isStateAllowedToThink()){
if (pursuedRole){
lola = (pursuedRole as Lola);
if (lola.isInTrailer()){
goInTrailer();
} else {
if (getLocId() == -1){
setLocId(lola.getAvailable9GridsLocId());
};
targetLoc = lola.getAvailable9GridsLocAt(getLocId());
if (!targetLoc.equals(currentTileLoc)){
setState(STATUS_GO_TO_LOC);
};
};
};
};
}
public function get isTricked():Boolean{
return (!((pursuedRole == null)));
}
override protected function hit_update(e:Event):Boolean{
if (((super.hit_update(e)) && ((pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames)))){
setState(STATUS_DIE);
return (true);
};
return (false);
}
private function inTrailer_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(inTrailer_update);
}
public function setLocId(id:int):void{
pLocId = id;
}
override protected function static_update(e:Event):void{
var timer:int = (pStateMachine.data.getInt("timer") + 1);
var duration:int = pStateMachine.data.getInt("duration");
if (timer > duration){
timer = 0;
pStateMachine.data.setValue("duration", IntUtil.randomBetween(20, 150));
pMovieClip.scaleX = ((Math.random() > 0.5)) ? 1 : -1;
};
pStateMachine.data.setValue("timer", timer);
}
public function touchTestWithLola(lola:Lola):Boolean{
return ((((Math.abs((lola.x - x)) < 40)) && ((Math.abs((lola.y - y)) < 20))));
}
}
}//package
Section 220
//john_hit0 (john_hit0)
package {
import flash.media.*;
public dynamic class john_hit0 extends Sound {
}
}//package
Section 221
//john_hit1 (john_hit1)
package {
import flash.media.*;
public dynamic class john_hit1 extends Sound {
}
}//package
Section 222
//john_pickup (john_pickup)
package {
import flash.media.*;
public dynamic class john_pickup extends Sound {
}
}//package
Section 223
//lib_ankle_biter_zombie (lib_ankle_biter_zombie)
package {
import flash.display.*;
public dynamic class lib_ankle_biter_zombie extends MovieClip {
public var hitTestRect:MovieClip;
public var shadowClip:MovieClip;
public var mc:MovieClip;
public function lib_ankle_biter_zombie(){
addFrameScript(0, frame1);
}
function frame1(){
hitTestRect.visible = false;
}
}
}//package
Section 224
//lib_blood_0 (lib_blood_0)
package {
import flash.display.*;
public dynamic class lib_blood_0 extends MovieClip {
}
}//package
Section 225
//lib_blood_1 (lib_blood_1)
package {
import flash.display.*;
public dynamic class lib_blood_1 extends MovieClip {
}
}//package
Section 226
//lib_blood_2 (lib_blood_2)
package {
import flash.display.*;
public dynamic class lib_blood_2 extends MovieClip {
}
}//package
Section 227
//lib_blood_3 (lib_blood_3)
package {
import flash.display.*;
public dynamic class lib_blood_3 extends MovieClip {
}
}//package
Section 228
//lib_button_adultswim (lib_button_adultswim)
package {
import flash.display.*;
public dynamic class lib_button_adultswim extends SimpleButton {
}
}//package
Section 229
//lib_comboTextSmall (lib_comboTextSmall)
package {
import flash.display.*;
public dynamic class lib_comboTextSmall extends MovieClip {
public var combosText:MovieClip;
}
}//package
Section 230
//lib_control_panel (lib_control_panel)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class lib_control_panel extends MovieClip {
public var thePanel:MovieClip;
public function lib_control_panel(){
addFrameScript(7, frame8, 14, frame15);
}
function frame15(){
this.panelOver(this);
}
function frame8(){
stop();
this.initPanel(this.thePanel.buttonClose, this.thePanel.buttonMoreGames);
}
}
}//package
Section 231
//lib_deathKiss (lib_deathKiss)
package {
import flash.display.*;
public dynamic class lib_deathKiss extends MovieClip {
public var hitTestRect:MovieClip;
public function lib_deathKiss(){
addFrameScript(11, frame12);
}
function frame12(){
stop();
}
}
}//package
Section 232
//lib_decomposed_zombie (lib_decomposed_zombie)
package {
import flash.display.*;
public dynamic class lib_decomposed_zombie extends MovieClip {
public var attackTestRect:MovieClip;
public var hitTestRect:MovieClip;
public var shadowClip:MovieClip;
public var mc:MovieClip;
public function lib_decomposed_zombie(){
addFrameScript(0, frame1);
}
function frame1(){
attackTestRect.visible = false;
hitTestRect.visible = false;
}
}
}//package
Section 233
//lib_explode (lib_explode)
package {
import flash.display.*;
public dynamic class lib_explode extends MovieClip {
public function lib_explode(){
addFrameScript(10, frame11);
}
function frame11(){
stop();
}
}
}//package
Section 234
//lib_fat_zombie (lib_fat_zombie)
package {
import flash.display.*;
public dynamic class lib_fat_zombie extends MovieClip {
public var hitTestRect:MovieClip;
public var throwPoint:MovieClip;
public var shadowClip:MovieClip;
public var mc:MovieClip;
public function lib_fat_zombie(){
addFrameScript(0, frame1);
}
function frame1(){
hitTestRect.visible = false;
throwPoint.visible = false;
}
}
}//package
Section 235
//lib_fireSpitter_zombie (lib_fireSpitter_zombie)
package {
import flash.display.*;
public dynamic class lib_fireSpitter_zombie extends MovieClip {
public var hitTestRect:MovieClip;
public var throwPoint:MovieClip;
public var shadowClip:MovieClip;
public var mc:MovieClip;
public function lib_fireSpitter_zombie(){
addFrameScript(0, frame1);
}
function frame1(){
hitTestRect.visible = false;
throwPoint.visible = false;
}
}
}//package
Section 236
//lib_gameover_panel (lib_gameover_panel)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class lib_gameover_panel extends MovieClip {
public var thePanel:MovieClip;
public function lib_gameover_panel(){
addFrameScript(7, frame8, 14, frame15);
}
function frame15(){
this.panelOver(this);
}
function frame8(){
stop();
this.initPanel(thePanel.buttonSubmitScore, thePanel.buttonPlayAgain, thePanel.buttonHighscores, thePanel.buttonMoreGames);
}
}
}//package
Section 237
//lib_generic_hooker_zombie (lib_generic_hooker_zombie)
package {
import flash.display.*;
public dynamic class lib_generic_hooker_zombie extends MovieClip {
public var attackTestRect:MovieClip;
public var hitTestRect:MovieClip;
public var shadowClip:MovieClip;
public var mc:MovieClip;
public function lib_generic_hooker_zombie(){
addFrameScript(0, frame1);
}
function frame1(){
hitTestRect.visible = false;
attackTestRect.visible = false;
}
}
}//package
Section 238
//lib_hud_messages (lib_hud_messages)
package {
import flash.display.*;
public dynamic class lib_hud_messages extends MovieClip {
public var aa:MovieClip;
public function lib_hud_messages(){
addFrameScript(0, frame1, 5, frame6, 52, frame53, 99, frame100);
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame100(){
stop();
}
function frame53(){
stop();
}
}
}//package
Section 239
//lib_john (lib_john)
package {
import flash.display.*;
public dynamic class lib_john extends MovieClip {
public var hitTestRect:MovieClip;
public var shadowClip:MovieClip;
public var mc:MovieClip;
public function lib_john(){
addFrameScript(0, frame1);
}
function frame1(){
hitTestRect.visible = false;
}
}
}//package
Section 240
//lib_loader_loop (lib_loader_loop)
package {
import flash.display.*;
public dynamic class lib_loader_loop extends MovieClip {
}
}//package
Section 241
//lib_lola (lib_lola)
package {
import flash.display.*;
public dynamic class lib_lola extends MovieClip {
public var mc_caneSwing:MovieClip;
public var mc_walkWithShootgunShoot:MovieClip;
public var mc_zombieLegSwingWalk:MovieClip;
public var mc_golfClubSwingWalk:MovieClip;
public var mc_swordSwingWalk:MovieClip;
public var mc_walkWithFlameThrower:MovieClip;
public var mc_staticWithShootgunShoot:MovieClip;
public var hitTestRect:MovieClip;
public var throwPoint:MovieClip;
public var mc_die:MovieClip;
public var mc_butthitting:MovieClip;
public var mc_staticWithShootgun:MovieClip;
public var mc_tease:MovieClip;
public var mc_staticWithUzi:MovieClip;
public var mc_walkWithUzi:MovieClip;
public var mc_boneSwingWalk:MovieClip;
public var mc_staticWithFlameThrower:MovieClip;
public var swingTestRect:MovieClip;
public var mc_golfClubSwing:MovieClip;
public var mc_walkWithFlameThrowerShoot:MovieClip;
public var mc_walk:MovieClip;
public var punchTestRect:MovieClip;
public var mc_panSwing:MovieClip;
public var mc_shovelSwing:MovieClip;
public var mc_walkWithUziShoot:MovieClip;
public var mc_throw:MovieClip;
public var mc_service:MovieClip;
public var mc_tireIronSwingWalk:MovieClip;
public var mc_boneSwing:MovieClip;
public var mc_static:MovieClip;
public var mc_punch:MovieClip;
public var shootgunPoint:MovieClip;
public var mc_kick:MovieClip;
public var mc_hit:MovieClip;
public var mc_swordSwing:MovieClip;
public var mc_staticWithFlameThrowerShoot:MovieClip;
public var mc_walkWithShootgun:MovieClip;
public var uziPoint:MovieClip;
public var mc_zombieLegSwing:MovieClip;
public var mc_tireIronSwing:MovieClip;
public var mc_panSwingWalk:MovieClip;
public var mc_staticWithUziShoot:MovieClip;
public var mc_shovelSwingWalk:MovieClip;
public var mc_caneSwingWalk:MovieClip;
public var isSwing:Boolean;
public function lib_lola(){
addFrameScript(0, frame1);
}
function frame1(){
punchTestRect.visible = false;
hitTestRect.visible = false;
swingTestRect.visible = false;
throwPoint.visible = false;
shootgunPoint.visible = false;
uziPoint.visible = false;
isSwing = false;
stop();
}
}
}//package
Section 242
//lib_money_popup (lib_money_popup)
package {
import flash.display.*;
public dynamic class lib_money_popup extends MovieClip {
public function lib_money_popup(){
addFrameScript(32, frame33);
}
function frame33(){
stop();
if (parent){
parent.removeChild(this);
};
}
}
}//package
Section 243
//lib_preloader (lib_preloader)
package {
import flash.display.*;
public dynamic class lib_preloader extends MovieClip {
public var buttonAdultswim:SimpleButton;
}
}//package
Section 244
//lib_purple_decomposed_zombie (lib_purple_decomposed_zombie)
package {
import flash.display.*;
public dynamic class lib_purple_decomposed_zombie extends MovieClip {
public var attackTestRect:MovieClip;
public var hitTestRect:MovieClip;
public var shadowClip:MovieClip;
public var mc:MovieClip;
public function lib_purple_decomposed_zombie(){
addFrameScript(0, frame1);
}
function frame1(){
attackTestRect.visible = false;
hitTestRect.visible = false;
}
}
}//package
Section 245
//lib_screen_cover (lib_screen_cover)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.xml.*;
import flash.filters.*;
import flash.accessibility.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
public dynamic class lib_screen_cover extends MovieClip {
public var comingSoonClip:MovieClip;
public var buttonSoundOff:SimpleButton;
public var buttonAdultswim:SimpleButton;
public var buttonMoreGames:SimpleButton;
public var clipButtonOver:MovieClip;
public var buttonSoundOn:SimpleButton;
public var buttonEpisode1:SimpleButton;
public var buttonEpisode2:SimpleButton;
public function lib_screen_cover(){
addFrameScript(1, frame2, 10, frame11, 19, frame20, 20, frame21);
}
function frame21(){
stop();
}
function frame20(){
this.screenOver();
}
function frame2(){
this.initScreen(this.buttonEpisode1, this.buttonEpisode2, this.comingSoonClip, this.buttonMoreGames);
}
function frame11(){
stop();
this.onScreenReady(this.buttonEpisode1, this.buttonEpisode2, this.comingSoonClip, this.buttonMoreGames);
}
}
}//package
Section 246
//lib_thrownWeapon (lib_thrownWeapon)
package {
import flash.display.*;
public dynamic class lib_thrownWeapon extends MovieClip {
public var hitTestRect:MovieClip;
public var mc:MovieClip;
}
}//package
Section 247
//lib_trailer (lib_trailer)
package {
import flash.display.*;
public dynamic class lib_trailer extends MovieClip {
public var mc:MovieClip;
}
}//package
Section 248
//lib_weaponBob (lib_weaponBob)
package {
import flash.display.*;
public dynamic class lib_weaponBob extends MovieClip {
public var mc:MovieClip;
}
}//package
Section 249
//lib_weaponPop (lib_weaponPop)
package {
import flash.display.*;
public dynamic class lib_weaponPop extends MovieClip {
public var mc:MovieClip;
}
}//package
Section 250
//Lola (Lola)
package {
import flash.events.*;
import com.liquable.media.*;
import com.liquable.game.debug.*;
import flash.display.*;
import com.liquable.game.postoffice.*;
import com.liquable.utils.*;
import com.liquable.game.geom.*;
import flash.geom.*;
import com.liquable.game.ui.*;
import flash.utils.*;
import flash.ui.*;
public class Lola extends AbstractRole {
private var pFlameThrowerSound:SoundController;
private var pMaxHp:int;
private var pAvailableLocs:Array;
private var pKilledCombos:int;
private var pController:UIController;
private var pTrickRange:int;
private var pFrisbee:ThrownWeapon;
private var pTrickedJohns:Array;
private var pCurrentWeapon:Weapon;
private var pUziSound:SoundController;
private var pPunchDamage:int;
private var pInvincible:int;
private var pPunchDistance:int;
private var pPunchKnockback:int;
private var pPreviousKilledTime:int;
private var pFeetStateMachine:PostStateClient;
public static const STATUS_PUNCH:String = "punch";
public static const STATUS_STATIC_WITH_SHOOTGUN_SHOOT:String = "staticWithShootgunShoot";
public static const STATUS_WALK_WITH_FLAME_THROWER_SHOOT:String = "walkWithFlameThrowerShoot";
public static const STATUS_SERVICE:String = "service";
public static const STATUS_STATIC_WITH_FLAME_THROWER_SHOOT:String = "staticWithFlameThrowerShoot";
public static const STATUS_STATIC_WITH_SHOOTGUN:String = "staticWithShootgun";
public static const STATUS_WALK_WITH_FLAME_THROWER:String = "walkWithFlameThrower";
public static const STATUS_SWING:String = "swing";
public static const STATUS_STATIC_WITH_FLAME_THROWER:String = "staticWithFlameThrower";
public static const STATUS_WALK_WITH_SHOOTGUN_SHOOT:String = "walkWithShootgunShoot";
public static const STATUS_EXIT_TRAILER:String = "exitTrailer";
public static const STATUS_WALK_WITH_SHOOTGUN:String = "walkWithShootgun";
public static const STATUS_BUTTHITTING:String = "butthitting";
public static const STATUS_HIT:String = "hit";
private static const KEY_X:int = 88;
public static const STATUS_STATIC_WITH_UZI_SHOOT:String = "staticWithUziShoot";
public static const STATUS_WALK_WITH_UZI_SHOOT:String = "walkWithUziShoot";
public static const STATUS_TEASE:String = "tease";
public static const STATUS_STATIC_WITH_UZI:String = "staticWithUzi";
public static const STATUS_SWING_WALK:String = "swingWalk";
public static const STATUS_THROW:String = "throw";
public static const STATUS_WALK_WITH_UZI:String = "walkWithUzi";
public static const STATUS_DEFEATED:String = "defeated";
public static var LAST_WEAPON_TYPE:String;
public static var LAST_WEAPON_AMOUNT:int;
public function Lola(roleType:String, locX:int, locY:int){
var configure:Configure = Game.instance.getRoleConfigure(roleType);
pMaxHp = configure.hp;
pPunchDistance = configure.hitDistance;
super(roleType, locX, locY, configure.hp, configure.speed);
pPunchDamage = configure.punchDamage;
pPunchKnockback = configure.punchKnockback;
pTrickRange = 6;
pKilledCombos = 0;
pPreviousKilledTime = int.MAX_VALUE;
pInvincible = 0;
}
override protected function adjustLayer(event:Event):void{
var obj:MapObject;
var zombie:GenericHookerZombie;
for each (obj in Game.instance.getMapObjects()) {
if (Game.instance.isInCamera(obj)){
if (Game.instance.getObjectIndex(obj) > Game.instance.getObjectIndex(this)){
if (obj.depth < depth){
Game.instance.swapObjects(this, obj);
};
};
if (((((((isAlive()) && (GameConfig.instance.hitLolaByTouch))) && (!(pStateMachine.isInState(STATUS_HIT))))) && ((obj is GenericHookerZombie)))){
zombie = (obj as GenericHookerZombie);
if (((zombie.isAlive()) && (zombie.isTouched(this)))){
goHit(false, Game.instance.getRoleConfigure(zombie.type).damage, null, zombie);
};
};
};
};
if (invincible > 0){
invincible--;
};
}
private function killedTimeCount_update(e:Event):void{
var comboValue:int;
var killeds:int;
var m:int;
var currentTime:int = getTimer();
if ((currentTime - pPreviousKilledTime) > (Game.instance.getRoleConfigure(type).comboTime * 1000)){
comboValue = Game.instance.getFactorConfig().combo;
killeds = (int((pKilledCombos / comboValue)) * comboValue);
if (killeds >= comboValue){
m = (killeds * 1000);
};
pKilledCombos = 0;
pPreviousKilledTime = int.MAX_VALUE;
zombie_hooker_nightmare.application.removeUpdateFunction(killedTimeCount_update);
};
}
override protected function createMovieClip():MovieClip{
return (new lib_lola());
}
private function roleMoveProcess(vx:Number, vy:Number):void{
var xOrigin:Object;
var trailer:Trailer;
var game:Game = Game.instance;
setPosition((position.x + vx), (position.y + vy));
var center:Point = game.getTileCenterPosition(currentTileLoc.x, currentTileLoc.y);
if ((((vy > 0)) && (!(game.canWalk(currentTileLoc.x, currentTileLoc.y))))){
setPosition(position.x, (game.getTilePosition(currentTileLoc.x, currentTileLoc.y).y - 1));
center = game.getTileCenterPosition(currentTileLoc.x, currentTileLoc.y);
};
var adjusted:Boolean;
var bottomSpace:Number = (game.tileHeight - 3);
if (vx > 0){
if (position.x > center.x){
if (game.canWalk((currentTileLoc.x + 1), currentTileLoc.y)){
if (position.y > center.y){
} else {
if (position.y < center.y){
if (!game.canWalk((currentTileLoc.x + 1), (currentTileLoc.y - 1))){
xOrigin = position.x;
position.x = center.x;
adjusted = true;
};
};
};
} else {
position.x = center.x;
adjusted = true;
};
};
} else {
if (vx < 0){
if (position.x < center.x){
if (game.canWalk((currentTileLoc.x - 1), currentTileLoc.y)){
if (position.y > center.y){
} else {
if (position.y < center.y){
if (!game.canWalk((currentTileLoc.x - 1), (currentTileLoc.y - 1))){
xOrigin = position.x;
position.x = center.x;
adjusted = true;
};
};
};
} else {
position.x = center.x;
adjusted = true;
};
};
};
};
if (vy > 0){
} else {
if (vy < 0){
if (position.y < center.y){
if (game.canWalk(currentTileLoc.x, (currentTileLoc.y - 1))){
if (position.x > center.x){
if (!game.canWalk((currentTileLoc.x + 1), (currentTileLoc.y - 1))){
trailer = Game.instance.getTrailer();
if ((((trailer.currentTileLoc.x == currentTileLoc.x)) && ((trailer.currentTileLoc.y == (currentTileLoc.y - 1))))){
position.x = MathUtil.numberFollowTarget(position.x, center.x, 0.5, 1);
} else {
position.y = center.y;
};
adjusted = true;
};
} else {
if (position.x < center.x){
if (!game.canWalk((currentTileLoc.x - 1), (currentTileLoc.y - 1))){
trailer = Game.instance.getTrailer();
if ((((trailer.currentTileLoc.x == currentTileLoc.x)) && ((trailer.currentTileLoc.y == (currentTileLoc.y - 1))))){
position.x = MathUtil.numberFollowTarget(position.x, center.x, 0.5, 1);
} else {
position.y = center.y;
};
adjusted = true;
};
};
};
} else {
position.y = center.y;
adjusted = true;
if (xOrigin){
position.x = (xOrigin as Number);
};
};
};
};
};
if (adjusted){
setPosition(position.x, position.y);
};
updateRealPosition();
}
private function walkWithFlameThrowerShoot_enter(prevState:String):void{
setFrameLabel(STATUS_WALK_WITH_FLAME_THROWER_SHOOT);
pMovieClip.mc_walkWithFlameThrowerShoot.fire.gotoAndPlay(1);
zombie_hooker_nightmare.application.addUpdateFunction(walkWithFlameThrowerShoot_update);
playFlameThrowerSound();
}
override public function setHp(hp:int):void{
super.setHp(hp);
Game.instance.dashboard.updateHpBar((hp / pMaxHp));
}
private function exitTrailer_update(e:Event):void{
var timer:int = (pStateMachine.data.getInt("timer") + 1);
pStateMachine.data.setValue("timer", timer);
pMovieClip.y = MathUtil.numberFollowTarget(pMovieClip.y, 0, 0.1, 1, 2);
if (pMovieClip.y == 0){
setState(STATUS_STATIC);
setFeetState(STATUS_STATIC);
};
}
private function feetRun_enter(prevState:String):void{
zombie_hooker_nightmare.application.addUpdateFunction(feetRun_update);
}
private function pickingWeaponProcess():void{
var w:MovableObject;
for each (w in Game.instance.getWeapons()) {
if ((((Math.abs((currentTileLoc.x - w.currentTileLoc.x)) < 2)) && ((Math.abs((currentTileLoc.y - w.currentTileLoc.y)) < 2)))){
if ((((((w is Weapon)) && (w.isTouched(this, 30)))) && (w.isInState(Weapon.STATUS_BOB)))){
if (w.type == PropertyLoader.ITEM_CASH){
Game.instance.dashboard.updateMoney(Game.instance.getWeaponConfigure(w.type).money);
} else {
if (currentWeapon){
delayGenerateWeapon(currentWeapon.type);
currentWeapon = null;
};
currentWeapon = (w as Weapon);
Game.instance.getRankScoreManager().addWeaponScore();
LAST_WEAPON_TYPE = currentWeapon.type;
LAST_WEAPON_AMOUNT = currentWeapon.amount;
pController.resetKey(Keyboard.SPACE);
};
(w as Weapon).goPop();
break;
};
};
};
}
private function doShootgunShoot():void{
var i:int;
while (i < 5) {
Game.instance.addWeapon(new ThrownWeapon(PropertyLoader.ITEM_BULLET, this, currentWeapon, (x + (pMovieClip.shootgunPoint.x * pMovieClip.scaleX)), (y + pMovieClip.shootgunPoint.y), new Point(pMovieClip.scaleX, (-0.07 + (0.035 * i)))));
i++;
};
}
private function calculateKnockbackX():Number{
var currnetPosition:Point;
var preferredX:Number = Game.instance.getWeaponConfigure(PropertyLoader.ITEM_SHOOTGUN).knockback;
if (!Game.instance.canWalk((currentTileLoc.x - pMovieClip.scaleX), currentTileLoc.y)){
currnetPosition = Game.instance.getTileCenterPosition(currentTileLoc.x, currentTileLoc.y);
if (pMovieClip.scaleX == DIR_RIGHT){
if (position.x <= currnetPosition.x){
preferredX = 0;
} else {
preferredX = Math.min(preferredX, (position.x - currnetPosition.x));
};
} else {
if (position.x >= currnetPosition.x){
preferredX = 0;
} else {
preferredX = Math.min(preferredX, (currnetPosition.x - position.x));
};
};
};
return ((-(pMovieClip.scaleX) * preferredX));
}
public function get invincible():int{
return (pInvincible);
}
private function walkWithShootgunShoot_update(e:Event):void{
if (!pFeetStateMachine.isInState(STATUS_WALK)){
setState(STATUS_STATIC);
} else {
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
setState(STATUS_STATIC);
} else {
if (pMovieClip.mc.currentFrame == 1){
roleMoveProcess(calculateKnockbackX(), 0);
updateRealPosition();
doShootgunShoot();
Game.instance.getCamera().shakeCamera();
currentWeapon.playSoundOfUsing();
if (!checkWeaponAmount()){
setState(STATUS_STATIC);
};
};
};
};
}
private function swingWalk_update(e:Event):void{
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
checkWeaponAmount();
setState(STATUS_STATIC);
} else {
if (pMovieClip.isSwing){
if (weaponPunchTest()){
currentWeapon.playSoundOfImpact();
if (Game.instance.getWeaponConfigure(currentWeapon.type).screenShake){
Game.instance.getCamera().shakeCamera();
};
} else {
currentWeapon.playSoundOfUsing();
};
pMovieClip.isSwing = false;
};
};
}
private function touchJohnProcess():void{
var john:John;
for each (john in Game.instance.getJohns()) {
if (((Game.instance.isInCamera(john)) && (john.isAlive()))){
if (john.touchTestWithLola(this)){
john.pursuedRole = this;
takeJohn(john);
};
};
};
}
private function feetRun_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(feetRun_update);
pFeetStateMachine.data.setValue("SoundController", null);
}
private function staticWithUziShoot_enter(prevState:String):void{
setFrameLabel(STATUS_STATIC_WITH_UZI_SHOOT);
pStateMachine.data.setValue("fireDelayTime", int.MIN_VALUE);
zombie_hooker_nightmare.application.addUpdateFunction(staticWithUziShoot_update);
playUziSound();
}
private function swing_update(e:Event):void{
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
checkWeaponAmount();
setState(STATUS_STATIC);
} else {
if (pMovieClip.isSwing){
if (weaponPunchTest()){
currentWeapon.playSoundOfImpact();
if (Game.instance.getWeaponConfigure(currentWeapon.type).screenShake){
Game.instance.getCamera().shakeCamera();
};
} else {
currentWeapon.playSoundOfUsing();
};
pMovieClip.isSwing = false;
};
};
}
private function weaponPunchTest():Boolean{
var role:AbstractRole;
var dirDiff:Number;
var diff:Number;
var isHitSomething:Boolean;
var configure:Configure = Game.instance.getWeaponConfigure(currentWeapon.type);
var hitMultiple:Boolean = configure.hitMultiple;
var hitDistance:int = configure.hitDistance;
var distance:Number = Number.MAX_VALUE;
var hitRole:AbstractRole;
for each (role in Game.instance.getRoles()) {
if ((((role.type == PropertyLoader.ROLE_JOHN)) && (John(role).isTricked))){
} else {
if (((((role.isAlive()) && ((Math.abs((role.y - y)) < 40)))) && (!((role.type == PropertyLoader.ROLE_LOLA))))){
dirDiff = (role.x - x);
diff = Math.abs(dirDiff);
if (((((dirDiff * pMovieClip.scaleX) >= 0)) && ((diff < hitDistance)))){
if (hitMultiple){
hitRole = role;
hitRole.goHit(false, damage, currentWeapon.type, this);
isHitSomething = true;
} else {
if (diff < distance){
distance = diff;
hitRole = role;
};
};
};
};
};
};
if (((!(hitMultiple)) && (hitRole))){
hitRole.goHit(false, damage, currentWeapon.type, this);
isHitSomething = true;
};
var hitArea:DisplayObject = pMovieClip.swingTestRect;
if (hitArea){
isHitSomething = ((hitBreakableObjectTest(hitArea)) || (isHitSomething));
};
return (isHitSomething);
}
private function stopUziSound():void{
if (pUziSound){
pUziSound.fadeOut(6);
pUziSound = null;
};
}
private function butthitting_exit(prevState:String):void{
updateKeyboardState();
zombie_hooker_nightmare.application.removeUpdateFunction(butthitting_update);
}
private function takeJohn(john:John):void{
if (pTrickedJohns.indexOf(john) == -1){
playSound(john_pickup);
pTrickedJohns.push(john);
};
}
public function goExitTrailer(locX:int, locY:int):void{
var point:Point;
if (!pStateMachine.isInState(STATUS_EXIT_TRAILER)){
point = Game.instance.getTileCenterPosition(locX, locY);
setPosition(point.x, point.y);
updateRealPosition();
setState(STATUS_EXIT_TRAILER);
};
}
public function doKilledComboTest():void{
pKilledCombos++;
pPreviousKilledTime = getTimer();
zombie_hooker_nightmare.application.addUpdateFunction(killedTimeCount_update);
}
private function staticWithFlameThrowerShoot_exit(prevState:String):void{
if (((currentWeapon) && ((currentWeapon.type == PropertyLoader.ITEM_FLAME_THROWER)))){
checkWeaponAmount();
};
pMovieClip.mc_staticWithFlameThrowerShoot.fire.gotoAndStop(1);
updateKeyboardState();
zombie_hooker_nightmare.application.removeUpdateFunction(staticWithFlameThrowerShoot_update);
stopFlameThrowerSound();
}
override protected function hit_enter(prevState:String):void{
setFrameLabel(STATUS_HIT);
setFeetState(STATUS_HIT);
zombie_hooker_nightmare.application.addUpdateFunction(hit_update);
playSound(lola_hit);
}
private function walkWithUziShoot_update(e:Event):void{
var currentTime:int;
var throwWeapon:ThrownWeapon;
if (((!(pFeetStateMachine.isInState(STATUS_WALK))) || (!(pController.isKeyDown(Keyboard.SPACE))))){
setState(STATUS_STATIC);
} else {
currentTime = getTimer();
if (currentTime >= pStateMachine.data.getInt("fireDelayTime")){
throwWeapon = new ThrownWeapon(PropertyLoader.ITEM_BULLET, this, currentWeapon, (x + (pMovieClip.uziPoint.x * pMovieClip.scaleX)), (y + pMovieClip.uziPoint.y), new Point(pMovieClip.scaleX, 0));
Game.instance.addWeapon(throwWeapon);
pStateMachine.data.setValue("fireDelayTime", (currentTime + 200));
currentWeapon.playSoundOfUsing();
if (!checkWeaponAmount()){
setState(STATUS_STATIC);
};
};
};
}
private function throw_enter(prevState:String):void{
setFrameLabel(STATUS_THROW);
setFeetState(STATUS_THROW);
zombie_hooker_nightmare.application.addUpdateFunction(throw_update);
}
public function setFeetState(state:String):void{
if (!pFeetStateMachine.isInState(state)){
pFeetStateMachine.setState(state);
};
}
private function throw_update(e:Event):void{
var throwWeapon:ThrownWeapon;
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
setState(STATUS_STATIC);
} else {
if (pMovieClip.mc.currentFrame == 7){
throwWeapon = new ThrownWeapon(currentWeapon.type, this, currentWeapon, (x + (pMovieClip.throwPoint.x * pMovieClip.scaleX)), (y + pMovieClip.throwPoint.y), new Point(pMovieClip.scaleX, 0));
if (currentWeapon.type == PropertyLoader.ITEM_CHAINSAW){
pFrisbee = throwWeapon;
};
currentWeapon.playSoundOfUsing();
Game.instance.addWeapon(throwWeapon);
if (((!(checkWeaponAmount())) || (((currentWeapon) && ((currentWeapon.type == PropertyLoader.ITEM_CHAINSAW)))))){
setState(STATUS_STATIC);
};
};
};
}
private function staticWithShootgunShoot_enter(prevState:String):void{
setFrameLabel(STATUS_STATIC_WITH_SHOOTGUN_SHOOT);
setFeetState(STATUS_STATIC_WITH_SHOOTGUN_SHOOT);
zombie_hooker_nightmare.application.addUpdateFunction(staticWithShootgunShoot_update);
}
public function isInTrailer():Boolean{
return (pStateMachine.isInState(STATUS_IN_TRAILER));
}
private function flameThrowerHitTest():Boolean{
var role:AbstractRole;
var dirDiff:Number;
var diff:Number;
var isHitSomething:Boolean;
var configure:Configure = Game.instance.getWeaponConfigure(currentWeapon.type);
var isFlaming:Boolean = configure.flaming;
var hitMultiple:Boolean = configure.hitMultiple;
var hitDistance:int = configure.hitDistance;
var distance:Number = Number.MAX_VALUE;
var hitRole:AbstractRole;
for each (role in Game.instance.getRoles()) {
if ((((role.type == PropertyLoader.ROLE_JOHN)) && (John(role).isTricked))){
} else {
if (((((((role.isAlive()) && (!(role.isInFlaming())))) && ((Math.abs((role.y - y)) < 40)))) && (!((role.type == PropertyLoader.ROLE_LOLA))))){
dirDiff = (role.x - x);
diff = Math.abs(dirDiff);
if (((((dirDiff * pMovieClip.scaleX) >= 0)) && ((diff < hitDistance)))){
if (hitMultiple){
hitRole = role;
if (!hitRole.isInFlaming()){
Game.instance.addExplode(new ExplodeEffect(hitRole.x, (hitRole.y - 60)));
};
hitRole.goHit(isFlaming, damage, currentWeapon.type, this);
isHitSomething = true;
} else {
if (diff < distance){
distance = diff;
hitRole = role;
};
};
};
};
};
};
if (((!(hitMultiple)) && (hitRole))){
hitRole.goHit(isFlaming, damage, currentWeapon.type, this);
isHitSomething = true;
};
return (isHitSomething);
}
override protected function hit_exit(prevState:String):void{
invincible = 5;
updateKeyboardState();
super.hit_exit(prevState);
}
private function staticWithFlameThrowerShoot_enter(prevState:String):void{
setFrameLabel(STATUS_STATIC_WITH_FLAME_THROWER_SHOOT);
zombie_hooker_nightmare.application.addUpdateFunction(staticWithFlameThrowerShoot_update);
pMovieClip.mc_staticWithFlameThrowerShoot.fire.gotoAndPlay(1);
playFlameThrowerSound();
}
public function goInTrailer():void{
setState(STATUS_IN_TRAILER);
}
private function exitTrailer_enter(prevState:String):void{
setFeetState(STATUS_IN_TRAILER);
Game.instance.getCamera().setFollowSpeed(0);
setWalkAnimFrame();
pStateMachine.data.setValue("timer", 0);
zombie_hooker_nightmare.application.addUpdateFunction(exitTrailer_update);
pMovieClip.y = -(Game.instance.tileHeight);
}
public function lostJohn(john:John):void{
if (pTrickedJohns.indexOf(john) != -1){
john.pursuedRole = null;
pTrickedJohns.splice(pTrickedJohns.indexOf(john), 1);
};
}
override public function updateRealPosition():void{
x = position.x;
y = position.y;
}
private function feetRun_update(e:Event):void{
roleMoveProcess(pVelocity.x, pVelocity.y);
pickingWeaponProcess();
touchJohnProcess();
}
private function staticWithShootgunShoot_exit(prevState:String):void{
updateKeyboardState();
zombie_hooker_nightmare.application.removeUpdateFunction(staticWithShootgunShoot_update);
}
private function doFlameThrowerShoot():void{
if (currentWeapon.amount > 0){
if (pFeetStateMachine.isInState(STATUS_WALK)){
setState(STATUS_WALK_WITH_FLAME_THROWER_SHOOT);
} else {
setState(STATUS_STATIC_WITH_FLAME_THROWER_SHOOT);
};
};
}
public function set invincible(value:int):void{
pInvincible = value;
}
private function swing_enter(prevState:String):void{
pMovieClip.isSwing = false;
setFrameLabel((currentWeapon.type + "Swing"));
setFeetState(STATUS_SWING);
zombie_hooker_nightmare.application.addUpdateFunction(swing_update);
}
override protected function die_enter(prevState:String):void{
pFlamingMachine.setState(STATUS_FLAMING_FALSE);
setFrameLabel(STATUS_DIE);
setFeetState(STATUS_DIE);
zombie_hooker_nightmare.application.addUpdateFunction(die_update);
playSound(lola_dead);
}
private function delayGenerateWeapon(weaponType:String):void{
zombie_hooker_nightmare.application.addDelayFunction(generateWeapon, {weaponType:weaponType, game:Game.instance}, 600);
}
private function playUziSound():void{
if (pUziSound == null){
pUziSound = zombie_hooker_nightmare.application.getSoundManager().playSound(uzi4, true);
};
}
override public function terminate():void{
zombie_hooker_nightmare.application.removeUpdateFunction(killedTimeCount_update);
pController.terminate();
pController = null;
pFeetStateMachine.destroy();
pFeetStateMachine = null;
if (currentWeapon){
currentWeapon = null;
};
pTrickedJohns = null;
super.terminate();
}
private function isAbleToAttack():Boolean{
return (pStateMachine.isInState(STATUS_STATIC));
}
override protected function die_update(e:Event):void{
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
if (currentWeapon){
currentWeapon = null;
};
setFeetState(null);
if (!Game.instance.isPausing()){
setState(null);
Game.instance.gameOver();
};
};
}
private function walkWithShootgunShoot_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(walkWithShootgunShoot_update);
}
public function get damage():int{
return ((currentWeapon) ? currentWeapon.damage : pPunchDamage);
}
private function feetRun_process(post:PostPackage):void{
processUIData((post.data as UIData));
}
private function swingWalk_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(swingWalk_update);
}
private function staticWithUziShoot_update(e:Event):void{
var currentTime:int;
var throwWeapon:ThrownWeapon;
if (((!(pFeetStateMachine.isInState(STATUS_STATIC))) || (!(pController.isKeyDown(Keyboard.SPACE))))){
setState(STATUS_STATIC);
} else {
currentTime = getTimer();
if (currentTime >= pStateMachine.data.getInt("fireDelayTime")){
throwWeapon = new ThrownWeapon(PropertyLoader.ITEM_BULLET, this, currentWeapon, (x + (pMovieClip.uziPoint.x * pMovieClip.scaleX)), (y + pMovieClip.uziPoint.y), new Point(pMovieClip.scaleX, 0));
Game.instance.addWeapon(throwWeapon);
pStateMachine.data.setValue("fireDelayTime", (currentTime + 200));
if (!checkWeaponAmount()){
setState(STATUS_STATIC);
};
};
};
}
public function goStatic(x:Number, y:Number):void{
setPosition(x, y);
setFeetState(STATUS_STATIC);
}
private function inTrailer_exit(prevState:String):void{
visible = true;
updateKeyboardState();
zombie_hooker_nightmare.application.removeUpdateFunction(inTrailer_update);
}
private function swingWalk_enter(prevState:String):void{
pMovieClip.isSwing = false;
setFrameLabel((currentWeapon.type + "SwingWalk"));
zombie_hooker_nightmare.application.addUpdateFunction(swingWalk_update);
}
override protected function die_exit(prevState:String):void{
super.die_exit(prevState);
}
override protected function setMovieClipFrameLabel(mc:MovieClip, label:String):void{
var i:int;
var child:DisplayObject;
DesignContract.preCondition(!((mc == null)));
var mainMc:MovieClip = mc[("mc_" + label)];
if (mc.mc != mainMc){
mc.mc = mainMc;
i = 0;
while (i < mc.numChildren) {
child = mc.getChildAt(i);
if ((child is MovieClip)){
if (child == mainMc){
if (child.name != "mc_walkWithUziShoot"){
mainMc.gotoAndPlay(1);
};
child.visible = true;
} else {
if (child.name != "mc_walkWithUziShoot"){
(child as MovieClip).gotoAndStop(1);
};
child.visible = false;
};
};
i++;
};
};
}
private function isJohnInLoc(locId:int):Boolean{
var john:John;
for each (john in pTrickedJohns) {
if (john.getLocId() == locId){
return (true);
};
};
return (false);
}
private function punch_enter(prevState:String):void{
var skill:String = ((Math.random() < 0.7)) ? STATUS_PUNCH : "kick";
if (skill == "kick"){
pStateMachine.data.setValue("skill", "kick");
} else {
pStateMachine.data.setValue("skill", "fist");
};
setFrameLabel(skill);
setFeetState(STATUS_PUNCH);
zombie_hooker_nightmare.application.addUpdateFunction(punch_update);
}
private function walkWithShootgunShoot_enter(prevState:String):void{
setFrameLabel(STATUS_WALK_WITH_SHOOTGUN_SHOOT);
zombie_hooker_nightmare.application.addUpdateFunction(walkWithShootgunShoot_update);
}
override public function goHit(flaming:Boolean, damage:int, weaponType:String, attacker:AbstractRole):void{
if (((((pStateMachine.isInState(STATUS_IN_TRAILER)) || (pStateMachine.isInState(STATUS_EXIT_TRAILER)))) || (pStateMachine.isInState(STATUS_HIT)))){
return;
};
if (pInvincible){
return;
};
super.goHit(flaming, damage, weaponType, attacker);
}
private function processUIData(data:UIData):void{
switch (data.type){
case UIController.KEY_DOWN:
case UIController.KEY_UP:
if (!Game.instance.isPausing()){
updateKeyboardState();
};
break;
};
}
private function punch_exit(prevState:String):void{
updateKeyboardState();
zombie_hooker_nightmare.application.removeUpdateFunction(punch_update);
}
override public function initialize():void{
var weapon:Weapon;
super.initialize();
Game.instance.setCamerFocus(this);
pTrickedJohns = new Array();
pAvailableLocs = new Array();
pAvailableLocs.push(new PointInt(-1, -1));
pAvailableLocs.push(new PointInt(0, -1));
pAvailableLocs.push(new PointInt(1, -1));
pAvailableLocs.push(new PointInt(1, 0));
pAvailableLocs.push(new PointInt(1, 1));
pAvailableLocs.push(new PointInt(0, 1));
pAvailableLocs.push(new PointInt(-1, 1));
pAvailableLocs.push(new PointInt(-1, 0));
pAvailableLocs.push(new PointInt(-1, -2));
pAvailableLocs.push(new PointInt(0, -2));
pAvailableLocs.push(new PointInt(1, -2));
pAvailableLocs.push(new PointInt(2, -2));
pAvailableLocs.push(new PointInt(2, -1));
pAvailableLocs.push(new PointInt(2, 0));
pAvailableLocs.push(new PointInt(2, 1));
pAvailableLocs.push(new PointInt(2, 2));
pAvailableLocs.push(new PointInt(1, 2));
pAvailableLocs.push(new PointInt(0, 2));
pAvailableLocs.push(new PointInt(-1, 2));
pAvailableLocs.push(new PointInt(-2, 2));
pAvailableLocs.push(new PointInt(-2, 1));
pAvailableLocs.push(new PointInt(-2, 0));
pAvailableLocs.push(new PointInt(-2, -1));
pAvailableLocs.push(new PointInt(-2, -2));
pAvailableLocs.push(new PointInt(-2, -3));
pAvailableLocs.push(new PointInt(-1, -3));
pAvailableLocs.push(new PointInt(0, -3));
pAvailableLocs.push(new PointInt(1, -3));
pAvailableLocs.push(new PointInt(2, -3));
pAvailableLocs.push(new PointInt(3, -3));
pAvailableLocs.push(new PointInt(3, -2));
pAvailableLocs.push(new PointInt(3, -1));
pAvailableLocs.push(new PointInt(3, 0));
pAvailableLocs.push(new PointInt(3, 1));
pAvailableLocs.push(new PointInt(3, 2));
pAvailableLocs.push(new PointInt(3, 3));
pAvailableLocs.push(new PointInt(2, 3));
pAvailableLocs.push(new PointInt(1, 3));
pAvailableLocs.push(new PointInt(0, 3));
pAvailableLocs.push(new PointInt(-1, 3));
pAvailableLocs.push(new PointInt(-2, 3));
pAvailableLocs.push(new PointInt(-3, 3));
pAvailableLocs.push(new PointInt(-3, 2));
pAvailableLocs.push(new PointInt(-3, 1));
pAvailableLocs.push(new PointInt(-3, 0));
pAvailableLocs.push(new PointInt(-3, -1));
pAvailableLocs.push(new PointInt(-3, -2));
pAvailableLocs.push(new PointInt(-3, -3));
pController = new UIController(id.toString(), zombie_hooker_nightmare.application);
pController.addControl(Game.instance.stage, UIController.KEY_DOWN);
pController.addControl(Game.instance.stage, UIController.KEY_UP);
pController.addControl(Game.instance, UIController.MOUSE_MOVE);
pController.addControl(Game.instance, UIController.MOUSE_DOWN);
pController.start(0);
pStateMachine.initState("init", init_enter, null, init_exit);
pStateMachine.initState(STATUS_PUNCH, punch_enter, null, punch_exit);
pStateMachine.initState(STATUS_SWING, swing_enter, null, swing_exit);
pStateMachine.initState(STATUS_SWING_WALK, swingWalk_enter, null, swingWalk_exit);
pStateMachine.initState(STATUS_THROW, throw_enter, null, throw_exit);
pStateMachine.initState(STATUS_BUTTHITTING, butthitting_enter, null, butthitting_exit);
pStateMachine.initState(STATUS_IN_TRAILER, inTrailer_enter, null, inTrailer_exit);
pStateMachine.initState(STATUS_STATIC_WITH_UZI_SHOOT, staticWithUziShoot_enter, null, staticWithUziShoot_exit);
pStateMachine.initState(STATUS_WALK_WITH_UZI_SHOOT, walkWithUziShoot_enter, null, walkWithUziShoot_exit);
pStateMachine.initState(STATUS_STATIC_WITH_FLAME_THROWER_SHOOT, staticWithFlameThrowerShoot_enter, null, staticWithFlameThrowerShoot_exit);
pStateMachine.initState(STATUS_WALK_WITH_FLAME_THROWER_SHOOT, walkWithFlameThrowerShoot_enter, null, walkWithFlameThrowerShoot_exit);
pStateMachine.initState(STATUS_STATIC_WITH_SHOOTGUN_SHOOT, staticWithShootgunShoot_enter, null, staticWithShootgunShoot_exit);
pStateMachine.initState(STATUS_WALK_WITH_SHOOTGUN_SHOOT, walkWithShootgunShoot_enter, null, walkWithShootgunShoot_exit);
pStateMachine.initState(STATUS_EXIT_TRAILER, exitTrailer_enter, null, exitTrailer_exit);
setState("init");
pFeetStateMachine = new PostStateClient(zombie_hooker_nightmare.application);
pFeetStateMachine.setPostId(id.toString());
pFeetStateMachine.initState(STATUS_STATIC, feetStatic_enter, feetStatic_process, feetStatic_exit);
pFeetStateMachine.initState(STATUS_WALK, feetRun_enter, feetRun_process, feetRun_exit);
pFeetStateMachine.initState(STATUS_PUNCH, null, null, null);
pFeetStateMachine.initState(STATUS_SWING, null, null, null);
pFeetStateMachine.initState(STATUS_THROW, null, null, null);
pFeetStateMachine.initState(STATUS_BUTTHITTING, null, null, null);
pFeetStateMachine.initState(STATUS_IN_TRAILER, null, null, null);
pFeetStateMachine.initState(STATUS_DIE, null, null, null);
pFeetStateMachine.initState(STATUS_HIT, null, null, null);
pFeetStateMachine.initState(STATUS_STATIC_WITH_SHOOTGUN_SHOOT, null, null, null);
setFeetState(STATUS_STATIC);
pStateMachine.setDebug(true);
pFeetStateMachine.setDebug(true);
if (LAST_WEAPON_TYPE){
weapon = new Weapon(LAST_WEAPON_TYPE, currentTileLoc.x, currentTileLoc.y);
Game.instance.addWeapon(weapon);
weapon.goPop();
currentWeapon = weapon;
};
}
private function feetStatic_enter(prevState:String):void{
updateRealPosition();
zombie_hooker_nightmare.application.addUpdateFunction(feetStatic_update);
}
override public function isRunningTo(inx:Number):Boolean{
if (pFeetStateMachine.isInState(STATUS_WALK)){
return (((getFaceDirection() * (inx - x)) >= 0));
};
return (false);
}
public function cheatEquipWeapon(weaponType:String):void{
var weapon:Weapon = new Weapon(weaponType, currentTileLoc.x, currentTileLoc.y);
Game.instance.addWeapon(weapon);
weapon.goPop();
currentWeapon = weapon;
}
private function butthitting_update(e:Event):void{
var john:John;
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
for each (john in Game.instance.getJohns()) {
if (((((john.isAlive()) && (Game.instance.isInCamera(john)))) && (isInTrickDistance(john)))){
john.pursuedRole = this;
takeJohn(john);
};
};
setState(STATUS_STATIC);
};
}
override protected function static_process(post:PostPackage):void{
var uidata:UIData = (post.data as UIData);
if (Game.instance.isPausing()){
if ((((uidata.type == UIController.KEY_DOWN)) && ((uidata.keyCode == Keyboard.SPACE)))){
Game.instance.onButtonCloseOfControlPanel(null);
};
return;
};
if (uidata.type == UIController.KEY_DOWN){
switch (uidata.keyCode){
case Keyboard.SPACE:
if (isAbleToAttack()){
if (currentWeapon){
if (currentWeapon.type == PropertyLoader.ITEM_UZI){
doUziShoot();
} else {
if (currentWeapon.type == PropertyLoader.ITEM_SHOOTGUN){
if (pFeetStateMachine.isInState(STATUS_WALK)){
setState(STATUS_WALK_WITH_SHOOTGUN_SHOOT);
} else {
setState(STATUS_STATIC_WITH_SHOOTGUN_SHOOT);
};
} else {
if (currentWeapon.type == PropertyLoader.ITEM_FLAME_THROWER){
doFlameThrowerShoot();
} else {
if (currentWeapon.isThrowable){
if (((((!((currentWeapon.type == PropertyLoader.ITEM_CHAINSAW))) || ((pFrisbee == null)))) || (!(pFrisbee.isInState(ThrownWeapon.STATUS_FRISBEE))))){
setState(STATUS_THROW);
};
} else {
if (pFeetStateMachine.isInState(STATUS_WALK)){
setState(STATUS_SWING_WALK);
} else {
setState(STATUS_SWING);
};
};
};
};
};
} else {
setState(STATUS_PUNCH);
};
};
break;
case KEY_X:
setState(STATUS_BUTTHITTING);
break;
};
};
}
private function updateKeyboardState():void{
var dx:int;
var dy:int;
if (pController){
dx = 0;
dy = 0;
if (pController.isKeyDown(Keyboard.RIGHT)){
dx++;
};
if (pController.isKeyDown(Keyboard.LEFT)){
dx--;
};
if (pController.isKeyDown(Keyboard.UP)){
dy--;
};
if (pController.isKeyDown(Keyboard.DOWN)){
dy++;
};
if (((dx) || (dy))){
if (dx){
pMovieClip.scaleX = ((dx > 0)) ? DIR_RIGHT : DIR_LEFT;
};
goWalk(Math.round(position.x), Math.round(position.y), dx, dy);
} else {
goStatic(Math.round(position.x), Math.round(position.y));
};
};
}
private function hitBreakableObjectTest(hitArea:DisplayObject):Boolean{
var obj:BreakableObject;
var breakableObject:BreakableObject;
var diff:Number;
var distance:Number = Number.MAX_VALUE;
for each (breakableObject in Game.instance.getBreakableObjects()) {
if (((!(breakableObject.isBroken())) && (breakableObject.hitTestObject(hitArea)))){
diff = Math.abs((breakableObject.x - x));
if (diff < distance){
distance = diff;
obj = breakableObject;
};
};
};
if (obj){
obj.setBroken();
return (true);
};
return (false);
}
private function inTrailer_enter(prevState:String):void{
visible = false;
setFeetState(STATUS_IN_TRAILER);
zombie_hooker_nightmare.application.addUpdateFunction(inTrailer_update);
}
override public function setPosition(x:Number, y:Number):void{
super.setPosition(x, y);
zombie_hooker_nightmare.application.debugWatchItem("loc", DebugTagValueWatcher.getById("lolaloc").setValue((("(" + currentTileLoc) + ")")));
}
private function feetStatic_update(e:Event):void{
pickingWeaponProcess();
touchJohnProcess();
}
public function getAvailable9GridsLocId():int{
var loc:PointInt;
var lastAvailIndex:int;
var i:int;
while (i < pAvailableLocs.length) {
loc = pAvailableLocs[i];
if (Game.instance.canWalk((currentTileLoc.x + loc.x), (currentTileLoc.y + loc.y))){
if (!isJohnInLoc(i)){
return (i);
};
lastAvailIndex = i;
};
i++;
};
return (lastAvailIndex);
}
public function get trickedJohns():Array{
return (pTrickedJohns);
}
private function walkWithFlameThrowerShoot_update(e:Event):void{
if (((!(pFeetStateMachine.isInState(STATUS_WALK))) || (!(pController.isKeyDown(Keyboard.SPACE))))){
setState(STATUS_STATIC);
} else {
flameThrowerHitTest();
if (pMovieClip.mc.fire.currentFrame == pMovieClip.mc.fire.totalFrames){
if (!checkWeaponAmount()){
setState(STATUS_STATIC);
};
};
};
}
private function isInTrickDistance(john:John):Boolean{
var halfColumns:Number = (Game.instance.mapColumnCounts / 2);
var halfRows:Number = (Game.instance.mapRowCounts / 2);
var dx:int = Math.abs((john.currentTileLoc.x - currentTileLoc.x));
var dy:int = Math.abs((john.currentTileLoc.y - currentTileLoc.y));
if (dx > halfColumns){
dx = (Game.instance.mapColumnCounts - dx);
};
if (dy > halfRows){
dy = (Game.instance.mapRowCounts - dy);
};
return ((((dx <= pTrickRange)) && ((dy <= pTrickRange))));
}
override protected function static_update(e:Event):void{
if (pFeetStateMachine.isInState(STATUS_WALK)){
setWalkAnimFrame();
} else {
if (currentWeapon){
if (currentWeapon.type == PropertyLoader.ITEM_SHOOTGUN){
setFrameLabel(STATUS_STATIC_WITH_SHOOTGUN);
} else {
if (currentWeapon.type == PropertyLoader.ITEM_UZI){
setFrameLabel(STATUS_STATIC_WITH_UZI);
} else {
if (currentWeapon.type == PropertyLoader.ITEM_FLAME_THROWER){
setFrameLabel(STATUS_STATIC_WITH_FLAME_THROWER);
} else {
setFrameLabel(STATUS_STATIC);
};
};
};
} else {
setFrameLabel(STATUS_STATIC);
};
};
if (currentWeapon){
if (pController.isKeyDown(Keyboard.SPACE)){
if (currentWeapon.type == PropertyLoader.ITEM_UZI){
doUziShoot();
} else {
if (currentWeapon.type == PropertyLoader.ITEM_FLAME_THROWER){
doFlameThrowerShoot();
};
};
};
};
}
public function get knockback():int{
return ((currentWeapon) ? currentWeapon.knockback : pPunchKnockback);
}
private function stopFlameThrowerSound():void{
if (pFlameThrowerSound){
pFlameThrowerSound.fadeOut(6);
pFlameThrowerSound = null;
};
}
private function staticWithShootgunShoot_update(e:Event):void{
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
setState(STATUS_STATIC);
} else {
if (pMovieClip.mc.currentFrame == 2){
roleMoveProcess(calculateKnockbackX(), 0);
updateRealPosition();
doShootgunShoot();
Game.instance.getCamera().shakeCamera();
currentWeapon.playSoundOfUsing();
if (!checkWeaponAmount()){
setState(STATUS_STATIC);
};
};
};
}
private function swing_exit(prevState:String):void{
updateKeyboardState();
zombie_hooker_nightmare.application.removeUpdateFunction(swing_update);
}
private function feetStatic_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(feetStatic_update);
}
private function playFlameThrowerSound():void{
if (pFlameThrowerSound == null){
pFlameThrowerSound = zombie_hooker_nightmare.application.getSoundManager().playSound(flamethrower3, true);
};
}
private function walkWithUziShoot_enter(prevState:String):void{
setFrameLabel(STATUS_WALK_WITH_UZI_SHOOT);
pStateMachine.data.setValue("fireDelayTime", int.MIN_VALUE);
zombie_hooker_nightmare.application.addUpdateFunction(walkWithUziShoot_update);
playUziSound();
}
private function doUziShoot():void{
if (currentWeapon.amount > 0){
if (pFeetStateMachine.isInState(STATUS_WALK)){
setState(STATUS_WALK_WITH_UZI_SHOOT);
} else {
setState(STATUS_STATIC_WITH_UZI_SHOOT);
};
};
}
override protected function static_enter(prevState:String):void{
zombie_hooker_nightmare.application.addUpdateFunction(static_update);
}
private function checkWeaponAmount():Boolean{
currentWeapon.decreaseAmount();
if (currentWeapon.amount == 0){
delayGenerateWeapon(currentWeapon.type);
Game.instance.removeWeapon(currentWeapon);
currentWeapon = null;
LAST_WEAPON_TYPE = null;
return (false);
};
LAST_WEAPON_AMOUNT = currentWeapon.amount;
return (true);
}
public function getAvailable9GridsLocAt(index:int):PointInt{
return (Game.instance.convertToLegalLoc((currentTileLoc.x + pAvailableLocs[index].x), (currentTileLoc.y + pAvailableLocs[index].y)));
}
private function walkWithFlameThrowerShoot_exit(prevState:String):void{
if (((currentWeapon) && ((currentWeapon.type == PropertyLoader.ITEM_FLAME_THROWER)))){
checkWeaponAmount();
};
pMovieClip.mc_walkWithFlameThrowerShoot.fire.gotoAndStop(1);
zombie_hooker_nightmare.application.removeUpdateFunction(walkWithFlameThrowerShoot_update);
stopFlameThrowerSound();
}
private function staticWithUziShoot_exit(prevState:String):void{
stopUziSound();
updateKeyboardState();
zombie_hooker_nightmare.application.removeUpdateFunction(staticWithUziShoot_update);
}
private function walkWithUziShoot_exit(prevState:String):void{
stopUziSound();
zombie_hooker_nightmare.application.removeUpdateFunction(walkWithUziShoot_update);
}
private function throw_exit(prevState:String):void{
updateKeyboardState();
zombie_hooker_nightmare.application.removeUpdateFunction(throw_update);
}
private function init_update(e:Event):void{
setState(STATUS_STATIC);
}
private function inTrailer_update(e:Event):void{
}
private function staticWithFlameThrowerShoot_update(e:Event):void{
if (((!(pFeetStateMachine.isInState(STATUS_STATIC))) || (!(pController.isKeyDown(Keyboard.SPACE))))){
setState(STATUS_STATIC);
} else {
flameThrowerHitTest();
if (pMovieClip.mc.fire.currentFrame == pMovieClip.mc.fire.totalFrames){
if (!checkWeaponAmount()){
setState(STATUS_STATIC);
};
};
};
}
private function punchTest():Boolean{
var role:AbstractRole;
var dirDiff:Number;
var diff:Number;
var isHitSomething:Boolean;
var distance:Number = Number.MAX_VALUE;
var hitRole:AbstractRole;
for each (role in Game.instance.getRoles()) {
if ((((role.type == PropertyLoader.ROLE_JOHN)) && (John(role).isTricked))){
} else {
if (((((((role.isAlive()) && ((Math.abs((role.y - y)) < 40)))) && (Game.instance.isInCamera(role)))) && (!((role.type == PropertyLoader.ROLE_LOLA))))){
dirDiff = (role.x - x);
diff = Math.abs(dirDiff);
if (((((dirDiff * pMovieClip.scaleX) >= 0)) && ((diff < pPunchDistance)))){
if (diff < distance){
distance = diff;
hitRole = role;
};
};
};
};
};
if (hitRole){
hitRole.goHit(false, damage, null, this);
isHitSomething = true;
};
var hitArea:DisplayObject = pMovieClip.punchTestRect;
if (hitArea){
isHitSomething = ((hitBreakableObjectTest(hitArea)) || (isHitSomething));
};
return (isHitSomething);
}
private function butthitting_enter(prevState:String):void{
setFeetState(STATUS_BUTTHITTING);
setFrameLabel(STATUS_BUTTHITTING);
zombie_hooker_nightmare.application.addUpdateFunction(butthitting_update);
updateRealPosition();
playSound(lola_seduce);
}
private function exitTrailer_exit(nextState:String):void{
pMovieClip.y = 0;
zombie_hooker_nightmare.application.removeUpdateFunction(exitTrailer_update);
}
private function setWalkAnimFrame():void{
if (currentWeapon){
if (currentWeapon.type == PropertyLoader.ITEM_SHOOTGUN){
setFrameLabel(STATUS_WALK_WITH_SHOOTGUN);
} else {
if (currentWeapon.type == PropertyLoader.ITEM_UZI){
setFrameLabel(STATUS_WALK_WITH_UZI);
} else {
if (currentWeapon.type == PropertyLoader.ITEM_FLAME_THROWER){
setFrameLabel(STATUS_WALK_WITH_FLAME_THROWER);
} else {
setFrameLabel(STATUS_WALK);
};
};
};
} else {
setFrameLabel(STATUS_WALK);
};
}
public function set currentWeapon(weapon:Weapon):void{
if (weapon){
Game.instance.dashboard.updateItem(weapon.type, weapon.amount);
} else {
Game.instance.dashboard.updateItem(null, 0);
Game.instance.removeWeapon(pCurrentWeapon);
};
pCurrentWeapon = weapon;
}
private function feetStatic_process(post:PostPackage):void{
processUIData((post.data as UIData));
}
private function init_exit(nextState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(init_update);
}
private function init_enter(prevState:String):void{
zombie_hooker_nightmare.application.addUpdateFunction(init_update);
}
private function generateWeapon(param:Object):void{
var game:Game = param.game;
if (game == Game.instance){
game.generateWeaponOutOfScreen(param.weaponType);
};
}
private function goWalk(x:Number, y:Number, dx:Number, dy:Number):void{
setPosition(x, y);
setFeetState(STATUS_WALK);
pVelocity = new Point(dx, dy);
pVelocity.normalize(pSpeed);
}
override protected function hit_update(e:Event):Boolean{
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
if (isAlive()){
setState(STATUS_STATIC);
} else {
setState(STATUS_DIE);
};
return (true);
//unresolved jump
};
return (false);
}
public function getKilledCombos():int{
return (pKilledCombos);
}
private function punch_update(e:Event):void{
if (pMovieClip.mc.currentFrame >= pMovieClip.mc.totalFrames){
setState(STATUS_STATIC);
} else {
if (pMovieClip.mc.currentFrame == 5){
if (punchTest()){
if (pStateMachine.data.getString("skill") == "kick"){
playSound(weapon_kick);
} else {
playSound(weapon_slap);
};
};
} else {
if (pMovieClip.mc.currentFrame == 4){
if (pStateMachine.data.getString("skill") == "kick"){
playSound(lola_throw_heavy);
} else {
playSound(lola_throw_light);
};
};
};
};
}
public function get currentWeapon():Weapon{
return (pCurrentWeapon);
}
}
}//package
Section 251
//lola_dead (lola_dead)
package {
import flash.media.*;
public dynamic class lola_dead extends Sound {
}
}//package
Section 252
//lola_hit (lola_hit)
package {
import flash.media.*;
public dynamic class lola_hit extends Sound {
}
}//package
Section 253
//lola_seduce (lola_seduce)
package {
import flash.media.*;
public dynamic class lola_seduce extends Sound {
}
}//package
Section 254
//lola_throw_heavy (lola_throw_heavy)
package {
import flash.media.*;
public dynamic class lola_throw_heavy extends Sound {
}
}//package
Section 255
//lola_throw_light (lola_throw_light)
package {
import flash.media.*;
public dynamic class lola_throw_light extends Sound {
}
}//package
Section 256
//MapObject (MapObject)
package {
import com.liquable.media.*;
import flash.display.*;
import com.liquable.utils.*;
import com.liquable.game.geom.*;
import com.liquable.game.camera.*;
import flash.geom.*;
public class MapObject extends Sprite implements ICameraObject {
private var pPosition:Point;
protected var pCurrentTileLoc:PointInt;
private var pType:String;
protected var pMovieClip:MovieClip;
private var pId:int;
protected static const DIR_LEFT:int = -1;
protected static const DIR_RIGHT:int = 1;
private static const idEnum:Enum = new Enum();
public function MapObject(objType:String, locX:int, locY:int){
pPosition = new Point();
super();
pType = objType;
var p:Point = Game.instance.getTileCenterPosition(locX, locY);
setPosition(p.x, p.y);
pId = idEnum.nextIndex();
}
public function get currentTileLoc():PointInt{
return (pCurrentTileLoc);
}
public function get depth():Number{
return (y);
}
protected function createMovieClip():MovieClip{
throw (new Error("MapObject.createMovieClip : invocation error!"));
}
protected function setMovieClipFrameLabel(mc:MovieClip, label:String):void{
DesignContract.preCondition(!((mc == null)));
if (label != mc.currentLabel){
mc.gotoAndStop(label);
};
}
public function get hitTestRect():MovieClip{
return ((pMovieClip.hitTestRect) ? pMovieClip.hitTestRect : pMovieClip);
}
public function isTouched(role:MapObject, disance:int=20, dy:Number=10):Boolean{
return ((((Math.abs((role.x - x)) < Math.max(16, disance))) && ((Math.abs((role.y - y)) < dy))));
}
protected function setFrameLabel(label:String):void{
setMovieClipFrameLabel(pMovieClip, label);
}
public function initialize():void{
pMovieClip = createMovieClip();
pMovieClip.stop();
addChild(pMovieClip);
updateRealPosition();
}
public function terminate():void{
while (numChildren > 0) {
removeChildAt(0);
};
if (parent){
parent.removeChild(this);
};
pPosition = null;
pMovieClip = null;
pCurrentTileLoc = null;
}
public function get id():int{
return (pId);
}
public function updateRealPosition():void{
var camera:GameCamera = Game.instance.getCamera();
var halfScreenWidth:Number = (zombie_hooker_nightmare.application.gameWidth / 2);
if ((((camera.x < halfScreenWidth)) && (((pPosition.x + width) > (Game.instance.mapWidth - (halfScreenWidth - camera.x)))))){
x = (pPosition.x - Game.instance.mapWidth);
} else {
if ((((camera.x > (Game.instance.mapWidth - halfScreenWidth))) && (((pPosition.x - width) < (camera.x - (Game.instance.mapWidth - halfScreenWidth)))))){
x = (pPosition.x + Game.instance.mapWidth);
} else {
x = pPosition.x;
};
};
var halfScreenHeight:Number = (zombie_hooker_nightmare.application.gameHeight / 2);
if ((((camera.y < halfScreenHeight)) && (((pPosition.y + height) > (Game.instance.mapHeight - (halfScreenHeight - camera.y)))))){
y = (pPosition.y - Game.instance.mapHeight);
} else {
if ((((camera.y > (Game.instance.mapHeight - halfScreenHeight))) && (((pPosition.y - height) < (camera.y - (Game.instance.mapHeight - halfScreenHeight)))))){
y = (pPosition.y + Game.instance.mapHeight);
} else {
y = pPosition.y;
};
};
}
public function get position():Point{
return (pPosition);
}
public function setPosition(x:Number, y:Number):void{
if (x >= Game.instance.mapWidth){
x = (x - Game.instance.mapWidth);
} else {
if (x < 0){
x = (x + Game.instance.mapWidth);
};
};
if (y >= Game.instance.mapHeight){
y = (y - Game.instance.mapHeight);
} else {
if (y < 0){
y = (y + Game.instance.mapHeight);
};
};
pPosition.x = x;
pPosition.y = y;
pCurrentTileLoc = Game.instance.getTileLocFromPosition(pPosition.x, pPosition.y);
}
public function get type():String{
return (pType);
}
protected function playSound(soundClass:Class, isLoop:Boolean=false, volume:Number=1):SoundController{
var sc:SoundController = zombie_hooker_nightmare.application.getSoundManager().playSound(soundClass, isLoop);
if (Game.instance.isGameOver()){
volume = 0;
};
sc.setVolume(volume);
return (sc);
}
}
}//package
Section 257
//mc_forest_grave1 (mc_forest_grave1)
package {
import flash.display.*;
public dynamic class mc_forest_grave1 extends MovieClip {
public function mc_forest_grave1(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 258
//mc_forest_propanetank (mc_forest_propanetank)
package {
import flash.display.*;
public dynamic class mc_forest_propanetank extends MovieClip {
public function mc_forest_propanetank(){
addFrameScript(0, frame1, 19, frame20);
}
function frame1(){
stop();
}
function frame20(){
stop();
}
}
}//package
Section 259
//mc_forest_rock1 (mc_forest_rock1)
package {
import flash.display.*;
public dynamic class mc_forest_rock1 extends MovieClip {
public function mc_forest_rock1(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 260
//mc_forest_rock2 (mc_forest_rock2)
package {
import flash.display.*;
public dynamic class mc_forest_rock2 extends MovieClip {
public function mc_forest_rock2(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 261
//mc_forest_stump1 (mc_forest_stump1)
package {
import flash.display.*;
public dynamic class mc_forest_stump1 extends MovieClip {
public function mc_forest_stump1(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 262
//mc_forest_tree1 (mc_forest_tree1)
package {
import flash.display.*;
public dynamic class mc_forest_tree1 extends MovieClip {
public function mc_forest_tree1(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 263
//mc_forest_tree2 (mc_forest_tree2)
package {
import flash.display.*;
public dynamic class mc_forest_tree2 extends MovieClip {
public function mc_forest_tree2(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 264
//mc_gy_coffin (mc_gy_coffin)
package {
import flash.display.*;
public dynamic class mc_gy_coffin extends MovieClip {
public function mc_gy_coffin(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 265
//mc_gy_coffin2 (mc_gy_coffin2)
package {
import flash.display.*;
public dynamic class mc_gy_coffin2 extends MovieClip {
public function mc_gy_coffin2(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 266
//mc_gy_grave1 (mc_gy_grave1)
package {
import flash.display.*;
public dynamic class mc_gy_grave1 extends MovieClip {
public function mc_gy_grave1(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 267
//mc_gy_grave2 (mc_gy_grave2)
package {
import flash.display.*;
public dynamic class mc_gy_grave2 extends MovieClip {
public function mc_gy_grave2(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 268
//mc_gy_grave3 (mc_gy_grave3)
package {
import flash.display.*;
public dynamic class mc_gy_grave3 extends MovieClip {
public function mc_gy_grave3(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 269
//mc_gy_grave4 (mc_gy_grave4)
package {
import flash.display.*;
public dynamic class mc_gy_grave4 extends MovieClip {
public function mc_gy_grave4(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 270
//mc_gy_grave5 (mc_gy_grave5)
package {
import flash.display.*;
public dynamic class mc_gy_grave5 extends MovieClip {
public function mc_gy_grave5(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 271
//mc_gy_grave6 (mc_gy_grave6)
package {
import flash.display.*;
public dynamic class mc_gy_grave6 extends MovieClip {
public function mc_gy_grave6(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 272
//mc_gy_grave7 (mc_gy_grave7)
package {
import flash.display.*;
public dynamic class mc_gy_grave7 extends MovieClip {
public function mc_gy_grave7(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 273
//mc_gy_grave8 (mc_gy_grave8)
package {
import flash.display.*;
public dynamic class mc_gy_grave8 extends MovieClip {
public function mc_gy_grave8(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 274
//mc_gy_grave9 (mc_gy_grave9)
package {
import flash.display.*;
public dynamic class mc_gy_grave9 extends MovieClip {
public function mc_gy_grave9(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 275
//mc_gy_pillar1 (mc_gy_pillar1)
package {
import flash.display.*;
public dynamic class mc_gy_pillar1 extends MovieClip {
public function mc_gy_pillar1(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 276
//mc_gy_pillar2 (mc_gy_pillar2)
package {
import flash.display.*;
public dynamic class mc_gy_pillar2 extends MovieClip {
public function mc_gy_pillar2(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 277
//mc_gy_pillar3 (mc_gy_pillar3)
package {
import flash.display.*;
public dynamic class mc_gy_pillar3 extends MovieClip {
public function mc_gy_pillar3(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 278
//mc_gy_rock1 (mc_gy_rock1)
package {
import flash.display.*;
public dynamic class mc_gy_rock1 extends MovieClip {
public function mc_gy_rock1(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 279
//mc_gy_rock2 (mc_gy_rock2)
package {
import flash.display.*;
public dynamic class mc_gy_rock2 extends MovieClip {
public function mc_gy_rock2(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 280
//mc_gy_stump1 (mc_gy_stump1)
package {
import flash.display.*;
public dynamic class mc_gy_stump1 extends MovieClip {
public function mc_gy_stump1(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 281
//mc_gy_stump2 (mc_gy_stump2)
package {
import flash.display.*;
public dynamic class mc_gy_stump2 extends MovieClip {
public function mc_gy_stump2(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 282
//mc_gy_tree1 (mc_gy_tree1)
package {
import flash.display.*;
public dynamic class mc_gy_tree1 extends MovieClip {
public function mc_gy_tree1(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package
Section 283
//MC_HUDBaseWithStuff (MC_HUDBaseWithStuff)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MC_HUDBaseWithStuff extends MovieClip {
public var mcFullMsg:MovieClip;
public var moneyText:TextField;
public var hpBar:MovieClip;
public var nightsText:TextField;
public var tricksText:TextField;
public var items:MovieClip;
public var itemText:TextField;
}
}//package
Section 284
//Message (Message)
package {
import com.liquable.game.postoffice.*;
import com.liquable.utils.*;
public class Message implements IPostData {
private var pType:int;
private var pData:MapData;
public static const TYPE_SCREEN_GAME:int = TYPES.nextIndex();
public static const PLAYER_IDLE:int = TYPES.nextIndex();
public static const WEAPON_PICKED:int = TYPES.nextIndex();
public static const WEAPON_STILL:int = TYPES.nextIndex();
public static const TYPE_SCREEN_COVER:int = TYPES.nextIndex();
public static const WEAPON_THROWN:int = TYPES.nextIndex();
public static const PLAYER_MOVE:int = TYPES.nextIndex();
public static const DATA_TYPE:String = "Message";
private static var TYPES:Enum = new Enum();
public function Message(msgType:int){
super();
pType = msgType;
pData = new MapData();
}
public function get data():MapData{
return (pData);
}
public function get type():int{
return (pType);
}
public function set data(value:MapData):void{
pData = value;
}
public function get data_type():String{
return (DATA_TYPE);
}
}
}//package
Section 285
//metal_hit_2 (metal_hit_2)
package {
import flash.media.*;
public dynamic class metal_hit_2 extends Sound {
}
}//package
Section 286
//molotov_smash (molotov_smash)
package {
import flash.media.*;
public dynamic class molotov_smash extends Sound {
}
}//package
Section 287
//MovableObject (MovableObject)
package {
import flash.events.*;
import com.liquable.game.postoffice.*;
import flash.geom.*;
public class MovableObject extends MapObject {
protected var pStateMachine:PostStateClient;
protected var pSpeed:Number;
protected var pVelocity:Point;
public function MovableObject(objType:String, locX:int, locY:int, speed:Number){
super(objType, locX, locY);
pSpeed = speed;
}
override public function initialize():void{
super.initialize();
if (pVelocity == null){
pVelocity = new Point();
};
pStateMachine = new PostStateClient(zombie_hooker_nightmare.application);
pStateMachine.setPostId(id.toString());
pStateMachine.setDebug(false);
zombie_hooker_nightmare.application.addUpdateFunction(adjustLayer);
}
override public function terminate():void{
zombie_hooker_nightmare.application.removeUpdateFunction(adjustLayer);
if (pStateMachine){
pStateMachine.destroy();
pStateMachine = null;
};
pVelocity = null;
super.terminate();
}
public function isInState(state:String):Boolean{
return (((pStateMachine) && (pStateMachine.isInState(state))));
}
protected function adjustLayer(event:Event):void{
var obj:MapObject;
if (Game.instance.isInCamera(this)){
for each (obj in Game.instance.getMapObjects()) {
if (((Game.instance.isInCamera(obj)) && ((Game.instance.getObjectIndex(obj) > Game.instance.getObjectIndex(this))))){
if (obj.depth < depth){
Game.instance.swapObjects(this, obj);
};
};
};
};
}
protected function setState(state:String):void{
if (!pStateMachine.isInState(state)){
pStateMachine.setState(state);
};
}
}
}//package
Section 288
//object_broken (object_broken)
package {
import flash.media.*;
public dynamic class object_broken extends Sound {
}
}//package
Section 289
//PropertyLoader (PropertyLoader)
package {
import flash.events.*;
import flash.xml.*;
import flash.net.*;
public class PropertyLoader extends EventDispatcher {
private var pProperties:Object;
private var pFactors:Object;
private var pGoalProperties:Object;
public static const ROLE_SIAMESE_ZOMBIE:String = "siameseZombie";
public static const ITEM_ZOMBIE_LEG:String = "zombieLeg";
public static const ITEM_FIREBALL:String = "fireBall";
public static const ROLE_GENERIC_HOOKER_MOMMY_ZOMBIE:String = "genericHookerMommyZombie";
public static const ITEM_SKULL:String = "skull";
public static const ITEM_TIRE_IRON:String = "tireIron";
public static const ROLE_FAT_ZOMBIE:String = "fatZombie";
public static const ITEM_FLAME_THROWER:String = "flameThrower";
public static const ROLE_ANKLE_BITER_ZOMBIE:String = "ankleBiterZombie";
public static const ITEM_ANY:String = "any";
public static const ITEM_SWARD:String = "sword";
public static const ROLE_GENERIC_HOOKER_ZOMBIE:String = "genericHookerZombie";
public static const ITEM_UZI:String = "uzi";
public static const OBJ_TRAILER:String = "trailer";
private static const sTags:Array = ["role", "weapon", "rank"];
public static const ROLE_JOHN:String = "john";
public static const ITEM_BULLET:String = "bullet";
public static const ROLE_GENERIC_HOOKER_FLOATER_ZOMBIE:String = "genericHookerFloaterZombie";
public static const ITEM_CHAINSAW:String = "chainsaw";
public static const ROLE_PURPLE_DECOMPOSED_ZOMBIE:String = "purpleDecomposedZombie";
public static const ITEM_CANE:String = "cane";
public static const ITEM_FLAMING_SKULL:String = "flamingSkull";
public static const ITEM_GOLF_CLUB:String = "golfClub";
public static const ROLE_DECOMPOSED_ZOMBIE:String = "decomposedZombie";
public static const ROLE_FIRE_SPITTER_ZOMBIE:String = "fireSpitterZombie";
public static const ITEM_STILLETTO:String = "stiletto";
public static const ITEM_SHOVEL:String = "shovel";
public static const ITEM_PAN:String = "pan";
public static const ITEM_HORNED_SKULL:String = "hornedSkull";
public static const ITEM_MOLOTOV:String = "molotov";
public static const ITEM_CASH:String = "cash";
public static const ROLE_LOLA:String = "lola";
public static const ITEM_FAT_ZOMBIE_HEAD:String = "fatZombieHead";
public static const ROLE_GNOMES_ZOMBIE:String = "gnomesZombie";
public static const ITEM_NONE:String = "none";
public static const ITEM_SHOOTGUN:String = "shootgun";
public static const ITEM_DEATH_KISS:String = "deathKiss";
public static const ITEM_BONE:String = "bone";
public static const LOAD_COMPLETE:String = "loadComplete";
private static var sWeaponTypes:Array;
public function PropertyLoader(){
var tag:String;
super();
pProperties = new Object();
for each (tag in sTags) {
pProperties[tag] = new Object();
};
pFactors = new Object();
sWeaponTypes = new Array();
sWeaponTypes.push(PropertyLoader.ITEM_BONE);
sWeaponTypes.push(PropertyLoader.ITEM_CANE);
sWeaponTypes.push(PropertyLoader.ITEM_CHAINSAW);
sWeaponTypes.push(PropertyLoader.ITEM_FLAMING_SKULL);
sWeaponTypes.push(PropertyLoader.ITEM_GOLF_CLUB);
sWeaponTypes.push(PropertyLoader.ITEM_HORNED_SKULL);
sWeaponTypes.push(PropertyLoader.ITEM_MOLOTOV);
sWeaponTypes.push(PropertyLoader.ITEM_PAN);
sWeaponTypes.push(PropertyLoader.ITEM_SHOOTGUN);
sWeaponTypes.push(PropertyLoader.ITEM_SHOVEL);
sWeaponTypes.push(PropertyLoader.ITEM_SKULL);
sWeaponTypes.push(PropertyLoader.ITEM_STILLETTO);
sWeaponTypes.push(PropertyLoader.ITEM_SWARD);
sWeaponTypes.push(PropertyLoader.ITEM_TIRE_IRON);
sWeaponTypes.push(PropertyLoader.ITEM_UZI);
sWeaponTypes.push(PropertyLoader.ITEM_FLAME_THROWER);
sWeaponTypes.push(PropertyLoader.ITEM_ZOMBIE_LEG);
sWeaponTypes.push(PropertyLoader.ITEM_CASH);
}
public function getRoleProperty(roleType:String):Configure{
return (new Configure(pProperties["role"][roleType]));
}
public function loadFromXml(xmlDocument:XMLDocument):void{
analyzeXmlDoc(xmlDocument);
dispatchEvent(new Event(LOAD_COMPLETE));
}
public function terminate():void{
sWeaponTypes = null;
pProperties = null;
pFactors = null;
}
public function getMaxRank():int{
var obj:Object;
var rank:int;
for each (obj in pProperties["rank"]) {
rank = Math.max(rank, parseInt(obj.name));
};
return (rank);
}
public function loadFromFile(fileUrl:String):void{
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoadComplete);
loader.load(new URLRequest(fileUrl));
}
private function analyzeXmlDoc(xmlDocument:XMLDocument):void{
var node:XMLNode;
var str:String;
var tag:String;
var mainNode:XMLNode = xmlDocument.firstChild;
for each (node in mainNode.childNodes) {
switch (node.nodeName){
case "rankCategory":
pFactors = node.attributes;
break;
case "goalCategory":
pGoalProperties = node.attributes;
break;
};
str = "Category";
tag = node.nodeName.substr(0, (node.nodeName.length - str.length));
analyzeCategoryNodes(node.childNodes, tag);
};
}
public function getWeaponProperty(weaponType:String):Configure{
return (new Configure(pProperties["weapon"][weaponType]));
}
public function getRankProperty(rank:int):Configure{
rank = Math.min(rank, objectMemberCount(pProperties["rank"]));
return (new Configure(pProperties["rank"][rank.toString()]));
}
public function getFactorProperty():Configure{
return (new Configure(pFactors));
}
public function getGoalProperties():Configure{
return (new Configure(pGoalProperties));
}
private function objectMemberCount(obj:Object):int{
var o:Object;
var count:int;
for each (o in obj) {
count++;
};
return (count);
}
private function onLoadComplete(event:Event):void{
var xmlDocument:XMLDocument = new XMLDocument();
xmlDocument.ignoreWhite = true;
xmlDocument.parseXML(new XML(event.target.data));
loadFromXml(xmlDocument);
}
private function analyzeCategoryNodes(nodes:Array, tag:String):void{
var node:XMLNode;
for each (node in nodes) {
if (node.nodeName == tag){
pProperties[tag][node.attributes.name] = node.attributes;
};
};
}
public static function get types():Array{
return (sWeaponTypes);
}
}
}//package
Section 290
//PurpleDecomposedZombie (PurpleDecomposedZombie)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class PurpleDecomposedZombie extends DecomposedZombie {
public function PurpleDecomposedZombie(roleType:String, locX:int, locY:int){
super(roleType, locX, locY);
}
override public function initialize():void{
super.initialize();
pStateMachine.initState(STATUS_REBUILD, rebuild_enter, null, rebuild_exit);
}
private function rebuild_exit(nextState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(rebuild_update);
}
override protected function createMovieClip():MovieClip{
return (new lib_purple_decomposed_zombie());
}
override protected function isStateAllowedToThink():Boolean{
return (((super.isStateAllowedToThink()) && (!(pStateMachine.isInState(STATUS_REBUILD)))));
}
override protected function die_update(e:Event):void{
if (getTimer() > pStateMachine.data.getInt("endTime")){
if (isInFlaming()){
Game.instance.removeRole(this);
} else {
setState(STATUS_REBUILD);
};
};
}
override protected function die_enter(prevState:String):void{
targetLoc = null;
pursuedRole = null;
nextPursuedPosition = null;
setFrameLabel(STATUS_DISMEMBER);
pStateMachine.data.setValue("endTime", (getTimer() + 5000));
zombie_hooker_nightmare.application.addUpdateFunction(die_update);
if (isInFlaming()){
checkKilledCombos();
};
}
private function rebuild_enter(prevState:String):void{
setFrameLabel(STATUS_REBUILD);
zombie_hooker_nightmare.application.addUpdateFunction(rebuild_update);
playSound(skeleton_bone_rattles);
}
private function rebuild_update(e:Event):void{
if (pMovieClip.mc.currentFrame == pMovieClip.mc.totalFrames){
setHp(Game.instance.getRankConfigure().getZombieHp(this.type));
setState(STATUS_STATIC);
};
}
}
}//package
Section 291
//RankScoreManager (RankScoreManager)
package {
import com.liquable.game.debug.*;
public class RankScoreManager {
private var pRankScore:int;
private var pRank:int;
public function RankScoreManager(){
super();
pRank = 0;
pRankScore = 0;
}
public function terminate():void{
}
public function getRank():int{
return (pRank);
}
public function addTimeScore():void{
addRankScore(Game.instance.getFactorConfig().timeFactor);
}
private function addRankScore(addValue:int):void{
pRankScore = (pRankScore + addValue);
var i:int = Game.instance.getMaxRank();
while (i > pRank) {
if (pRankScore > Game.instance.getRankConfigureByRank(i).threshold){
pRank = i;
break;
};
i--;
};
zombie_hooker_nightmare.application.debugWatchItem("rank", DebugTagValueWatcher.getById("rank").setValue(((pRank.toString() + ", score : ") + pRankScore)));
}
public function addJohnScore():void{
addRankScore(Game.instance.getFactorConfig().johnFactor);
}
public function addZombieScore(zombieType:String):void{
addRankScore((Game.instance.getRoleConfigure(zombieType).score * Game.instance.getFactorConfig().killFactor));
}
public function getRankScore():int{
return (pRankScore);
}
public function addWeaponScore():void{
addRankScore(Game.instance.getFactorConfig().pickWeaponFactor);
}
public function addMoneyScore(cash:int):void{
addRankScore((Math.ceil((cash / 100)) * Game.instance.getFactorConfig().moneyFactor));
}
}
}//package
Section 292
//RoleFactory (RoleFactory)
package {
public final class RoleFactory {
public function RoleFactory(){
super();
}
public static function createRole(roleType:String, locX:int, locY:int):AbstractRole{
switch (roleType){
case PropertyLoader.ROLE_LOLA:
return (new Lola(roleType, locX, locY));
case PropertyLoader.ROLE_JOHN:
return (new John(roleType, locX, locY));
case PropertyLoader.ROLE_GENERIC_HOOKER_ZOMBIE:
return (new GenericHookerZombie(roleType, locX, locY));
case PropertyLoader.ROLE_ANKLE_BITER_ZOMBIE:
return (new AnkleBiterZombie(roleType, locX, locY));
case PropertyLoader.ROLE_FAT_ZOMBIE:
return (new FatZombie(roleType, locX, locY));
case PropertyLoader.ROLE_DECOMPOSED_ZOMBIE:
return (new DecomposedZombie(roleType, locX, locY));
case PropertyLoader.ROLE_PURPLE_DECOMPOSED_ZOMBIE:
return (new PurpleDecomposedZombie(roleType, locX, locY));
case PropertyLoader.ROLE_FIRE_SPITTER_ZOMBIE:
return (new FireSpitterZombie(roleType, locX, locY));
default:
throw (new Error("RoleFactory.createRole : roleType error!"));
};
}
}
}//package
Section 293
//ScreenCover (ScreenCover)
package {
import flash.events.*;
import com.liquable.media.*;
import flash.display.*;
import com.liquable.visualstack.*;
import com.liquable.utils.*;
public class ScreenCover extends VisualSprite {
private var pMovieClip:MovieClip;
public function ScreenCover(){
super();
}
private function selecteLevel(level:int):void{
zombie_hooker_nightmare.mouse_down();
data.setValue("level", level.toString());
data.setValue("nights", 1);
data.setValue("msg", Message.TYPE_SCREEN_GAME);
pMovieClip.play();
pMovieClip.mouseChildren = (pMovieClip.mouseEnabled = false);
}
private function onConfigLoaded():void{
pMovieClip.play();
if (GameConfig.instance.debugPanel){
zombie_hooker_nightmare.application.setDebugPanelRoot(zombie_hooker_nightmare.instance);
};
}
private function onButtonEpisode1(event:MouseEvent):void{
selecteLevel(1);
}
private function onButtonEpisode2(event:MouseEvent):void{
selecteLevel(2);
}
private function onInitScreen(buttonEpisode1:SimpleButton, buttonEpisode2:SimpleButton, comingSoonClip:MovieClip, buttonMoreGames:SimpleButton):void{
if (GameConfig.instance.episode2Lock){
if (buttonEpisode2){
buttonEpisode2.visible = false;
};
} else {
if (comingSoonClip){
comingSoonClip.visible = false;
};
};
updateMuteButtonState();
}
override public function onPop():MapData{
removeChild(pMovieClip);
pMovieClip = null;
return (super.onPop());
}
private function onScreenReady(buttonEpisode1:SimpleButton, buttonEpisode2:SimpleButton, comingSoonClip:MovieClip, buttonMoreGames:SimpleButton):void{
if (buttonEpisode1){
buttonEpisode1.addEventListener(MouseEvent.CLICK, onButtonEpisode1, false, 0, true);
buttonEpisode1.addEventListener(MouseEvent.MOUSE_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
};
if (GameConfig.instance.episode2Lock){
} else {
if (buttonEpisode2){
buttonEpisode2.addEventListener(MouseEvent.CLICK, onButtonEpisode2, false, 0, true);
buttonEpisode2.addEventListener(MouseEvent.MOUSE_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
};
};
if (buttonMoreGames){
buttonMoreGames.addEventListener(MouseEvent.CLICK, onButtonMoreGames, false, 0, true);
buttonMoreGames.addEventListener(MouseEvent.MOUSE_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
};
var buttonAdultswim:SimpleButton = pMovieClip.buttonAdultswim;
if (buttonAdultswim){
buttonAdultswim.addEventListener(MouseEvent.CLICK, onButtonMoreGames, false, 0, true);
buttonAdultswim.addEventListener(MouseEvent.MOUSE_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
};
pMovieClip.buttonSoundOn.addEventListener(MouseEvent.CLICK, onButtonSound, false, 0, true);
pMovieClip.buttonSoundOff.addEventListener(MouseEvent.CLICK, onButtonSound, false, 0, true);
pMovieClip.buttonSoundOn.addEventListener(MouseEvent.ROLL_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
pMovieClip.buttonSoundOff.addEventListener(MouseEvent.ROLL_OVER, zombie_hooker_nightmare.mouse_over, false, 0, true);
updateMuteButtonState();
}
override public function onPush():void{
var config:GameConfig;
super.onPush();
pMovieClip = new lib_screen_cover();
pMovieClip.stop();
pMovieClip.initScreen = onInitScreen;
pMovieClip.screenOver = onScreenOver;
pMovieClip.onScreenReady = onScreenReady;
pMovieClip.x = (728 / 2);
pMovieClip.y = (500 / 2);
addChild(pMovieClip);
if (GameConfig.instance == null){
config = new GameConfig(null, onConfigLoaded);
config.importXml(EmbedManager.singleton.getConfig());
} else {
onConfigLoaded();
};
}
private function onButtonMoreGames(event:MouseEvent):void{
zombie_hooker_nightmare.linkMoreGames();
}
private function updateMuteButtonState():void{
var sm:SoundManager = zombie_hooker_nightmare.application.getSoundManager();
var volume:Number = sm.getGlobalVolume();
pMovieClip.buttonSoundOn.visible = (volume == 1);
pMovieClip.buttonSoundOff.visible = (volume == 0);
}
private function onButtonSound(e:MouseEvent):void{
zombie_hooker_nightmare.mouse_down();
var sm:SoundManager = zombie_hooker_nightmare.application.getSoundManager();
var volume:Number = ((sm.getGlobalVolume() == 0)) ? 1 : 0;
sm.setGlobalVolume(volume);
updateMuteButtonState();
}
private function onScreenOver():void{
processDone();
}
}
}//package
Section 294
//shotgun_fire (shotgun_fire)
package {
import flash.media.*;
public dynamic class shotgun_fire extends Sound {
}
}//package
Section 295
//skeleton_bone_rattles (skeleton_bone_rattles)
package {
import flash.media.*;
public dynamic class skeleton_bone_rattles extends Sound {
}
}//package
Section 296
//thrown_weapon (thrown_weapon)
package {
import flash.media.*;
public dynamic class thrown_weapon extends Sound {
}
}//package
Section 297
//ThrownWeapon (ThrownWeapon)
package {
import flash.events.*;
import com.liquable.media.*;
import flash.display.*;
import com.liquable.game.geom.*;
import flash.geom.*;
public class ThrownWeapon extends MovableObject {
private var pDistance:Number;
private var pDepthY:Number;
private var pChainsawSound:SoundController;
private var pHitable:Boolean;
private var pOwnerWeapon:Weapon;
private var pFlaming:Boolean;
private var pOwner:AbstractRole;
private var pKnockback:int;
private var pTimer:int;
private var pHitMultiple:Boolean;
private var pDamage:int;
public static var STATUS_ARC:String = "arc";
public static var STATUS_MOVE:String = "move";
public static var STATUS_FRISBEE:String = "frisbee";
public function ThrownWeapon(weaponType:String, owner:AbstractRole, ownerWeapon:Weapon, startX:Number, startY:Number, velocity:Point){
var configure:Configure;
pHitable = true;
pDepthY = 100;
var loc:PointInt = Game.instance.getTileLocFromPosition(startX, startY);
if (loc.x >= Game.instance.mapColumnCounts){
loc.x = (loc.x - Game.instance.mapColumnCounts);
} else {
if (loc.x < 0){
loc.x = (loc.x + Game.instance.mapColumnCounts);
};
};
if (loc.y >= Game.instance.mapRowCounts){
loc.y = (loc.y - Game.instance.mapRowCounts);
} else {
if (loc.y < 0){
loc.y = (loc.y + Game.instance.mapRowCounts);
};
};
if (weaponType == PropertyLoader.ITEM_BULLET){
configure = Game.instance.getWeaponConfigure(Lola(owner).currentWeapon.type);
} else {
configure = Game.instance.getWeaponConfigure(weaponType);
};
var theSpeed:Number = configure.speed;
if (((ownerWeapon) && ((ownerWeapon.type == PropertyLoader.ITEM_SHOOTGUN)))){
theSpeed = (theSpeed + ((Math.random() - 0.5) * 5));
};
super(weaponType, loc.x, loc.y, theSpeed);
setPosition(startX, startY);
updateRealPosition();
pOwner = owner;
pOwnerWeapon = ownerWeapon;
pDamage = configure.damage;
pKnockback = configure.knockback;
pFlaming = configure.flaming;
pHitMultiple = configure.hitMultiple;
pDistance = configure.distance;
pVelocity = new Point(velocity.x, velocity.y);
pVelocity.normalize(pSpeed);
scaleX = ((velocity.x)>=0) ? 1 : -1;
}
override public function get depth():Number{
return ((y + pDepthY));
}
override protected function createMovieClip():MovieClip{
return (new lib_thrownWeapon());
}
private function move_update(e:Event):void{
setPosition((position.x + pVelocity.x), (position.y + pVelocity.y));
updateRealPosition();
pTimer++;
if (hitCheck()){
if (pOwnerWeapon){
pOwnerWeapon.playSoundOfImpact();
};
} else {
if (pStateMachine){
if (type == PropertyLoader.ITEM_FIREBALL){
if (pTimer > 140){
alpha = (alpha - 0.1);
if (alpha <= 0){
Game.instance.removeWeapon(this);
};
};
} else {
if (pOwnerWeapon.type == PropertyLoader.ITEM_SHOOTGUN){
if (Math.abs((pStateMachine.data.getNumber("startX") - x)) > 200){
alpha = (alpha - 0.5);
trace(("alpha = " + alpha));
if (alpha <= 0){
Game.instance.removeWeapon(this);
};
};
};
};
};
};
}
override public function initialize():void{
super.initialize();
pStateMachine.initState(STATUS_MOVE, move_enter, null, move_exit);
pStateMachine.initState(STATUS_ARC, arc_enter, null, arc_exit);
pStateMachine.initState(STATUS_FRISBEE, frisbee_enter, null, frisbee_exit);
if (type == PropertyLoader.ITEM_FAT_ZOMBIE_HEAD){
setFrameLabel(PropertyLoader.ITEM_FLAMING_SKULL);
} else {
setFrameLabel(type);
};
if (type == PropertyLoader.ITEM_STILLETTO){
setState(STATUS_MOVE);
} else {
if (type == PropertyLoader.ITEM_CHAINSAW){
setState(STATUS_FRISBEE);
} else {
if (pDistance > 0){
pStateMachine.data.setValue("distance", pDistance);
setState(STATUS_ARC);
} else {
setState(STATUS_MOVE);
};
};
};
}
private function playChainsawSound():void{
if (pChainsawSound == null){
pChainsawSound = zombie_hooker_nightmare.application.getSoundManager().playSound(weapon_chainsaw1, true);
};
}
private function stopChainsawSound():void{
if (pChainsawSound){
pChainsawSound.fadeOut(6);
pChainsawSound = null;
};
}
private function arc_exit(nextState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(arc_update);
}
private function move_exit(prevState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(move_update);
}
private function frisbee_update(e:Event):void{
var timer:int = (pStateMachine.data.getInt("timer") + 1);
pStateMachine.data.setValue("timer", timer);
var tracker:Point = pStateMachine.data.getValue("tracker");
var trackerVelocity:Point = pStateMachine.data.getValue("trackerVelocity");
var trackerAcc:Point = pStateMachine.data.getValue("trackerAcc");
var backing:Boolean = pStateMachine.data.getBoolean("backing");
var pos:Point = pStateMachine.data.getValue("pos");
tracker.x = (tracker.x + trackerVelocity.x);
tracker.y = (tracker.y + trackerVelocity.y);
var force:Point = tracker.subtract(pos);
force.normalize(3.3);
var oldVx:Number = pVelocity.x;
pVelocity = pVelocity.add(force);
if ((oldVx * pVelocity.x) <= 0){
pStateMachine.data.setValue("backing", true);
};
pos.x = (pos.x + pVelocity.x);
pos.y = (pos.y + pVelocity.y);
var duration = 30;
var percent:Number = (timer / duration);
percent = (Math.max(0, (percent - 0.5)) * 2);
percent = (percent * percent);
var rpercent:Number = (1 - percent);
var mapw:Number = Game.instance.getMap().getMapResource().width;
var maph:Number = Game.instance.getMap().getMapResource().height;
var op:Point = new Point(pOwner.x, pOwner.y);
if (op.x > (pos.x + (mapw / 2))){
op.x = (op.x - mapw);
} else {
if (op.x < (pos.x - (mapw / 2))){
op.x = (op.x + mapw);
};
};
if (op.y > (pos.y + (maph / 2))){
op.y = (op.y - maph);
} else {
if (op.x < (pos.y - (maph / 2))){
op.y = (op.y + maph);
};
};
pos.x = ((pos.x * rpercent) + (op.x * percent));
pos.y = ((pos.y * rpercent) + ((op.y - 75) * percent));
trace(pos.x);
setPosition(pos.x, pos.y);
updateRealPosition();
if (timer > (duration - 3)){
alpha = (alpha * 0.5);
if (timer > (duration - 1)){
Game.instance.removeWeapon(this);
};
} else {
trackerVelocity.x = (trackerVelocity.x + trackerAcc.x);
trackerVelocity.y = (trackerVelocity.y + trackerAcc.y);
trackerAcc.y = (trackerAcc.y - 0.08);
if (((hitCheck(false)) && (pOwnerWeapon))){
pOwnerWeapon.playSoundOfImpact();
};
};
}
override public function terminate():void{
super.terminate();
pOwner = null;
}
private function frisbee_enter(prevState:String):void{
zombie_hooker_nightmare.application.addUpdateFunction(frisbee_update);
pDepthY = 300;
pVelocity.x = (((pVelocity.x > 0)) ? pSpeed : -(pSpeed) * 1.6);
pVelocity.y = (-(pSpeed) * 1.2);
var mapw:Number = Game.instance.getMap().getMapResource().width;
var maph:Number = Game.instance.getMap().getMapResource().height;
var ownerPos:Point = pOwner.position.clone();
var pos:Point = position.clone();
if ((pos.x - ownerPos.x) > (mapw / 2)){
pos.x = (pos.x - mapw);
} else {
if ((pos.x - ownerPos.x) < (-(mapw) / 2)){
pos.x = (pos.x + mapw);
};
};
if ((pos.y - ownerPos.y) > (maph / 2)){
pos.y = (pos.y - maph);
} else {
if ((pos.y - ownerPos.y) < (-(maph) / 2)){
pos.y = (pos.y + maph);
};
};
pStateMachine.data.setValue("timer", 0);
pStateMachine.data.setValue("tracker", ownerPos);
pStateMachine.data.setValue("trackerVelocity", new Point(pVelocity.x, 0.5));
pStateMachine.data.setValue("trackerAcc", new Point((-(pVelocity.x) * 0.07), 0));
pStateMachine.data.setValue("backing", false);
pStateMachine.data.setValue("pos", pos);
if (type == PropertyLoader.ITEM_CHAINSAW){
playChainsawSound();
};
}
private function frisbee_exit(nextState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(frisbee_update);
stopChainsawSound();
}
private function arc_enter(prevState:String):void{
pDepthY = 200;
var startHeight:Number = 75;
var gravity:Number = 1;
var directionX:Number = ((pVelocity.x > 0)) ? 1 : -1;
var distance:Number = pStateMachine.data.getNumber("distance");
var targetPoint:Point = new Point((position.x + (directionX * distance)), (position.y + startHeight));
var timeNeeded:Number = (distance / pSpeed);
var startVy:Number = ((startHeight - ((gravity * timeNeeded) * timeNeeded)) / timeNeeded);
pStateMachine.data.setValue("timer", 0);
pStateMachine.data.setValue("timeNeeded", timeNeeded);
pStateMachine.data.setValue("startVelocity", new Point((directionX * pSpeed), startVy));
pStateMachine.data.setValue("startPosition", position.clone());
pStateMachine.data.setValue("gravity", gravity);
zombie_hooker_nightmare.application.addUpdateFunction(arc_update);
}
private function arc_update(e:Event):void{
var timer:int = pStateMachine.data.getInt("timer");
pStateMachine.data.setValue("timer", (timer + 1));
var timeNeeded:int = pStateMachine.data.getInt("timeNeeded");
var startPosition:Point = pStateMachine.data.getValue("startPosition");
var startVelocity:Point = pStateMachine.data.getValue("startVelocity");
var gravity:Number = pStateMachine.data.getInt("gravity");
if (timer > timeNeeded){
if (type == PropertyLoader.ITEM_MOLOTOV){
Game.instance.removeWeapon(this);
if (pOwnerWeapon){
pOwnerWeapon.playSoundOfImpact();
};
Game.instance.addExplode(new ExplodeEffect(x, y));
} else {
if (timer > (timeNeeded + 5)){
Game.instance.removeWeapon(this);
} else {
alpha = (alpha * 0.7);
startVelocity.x = (startVelocity.x * 0.7);
startVelocity.y = (startVelocity.y + gravity);
setPosition((position.x + startVelocity.x), (position.y + startVelocity.y));
};
};
} else {
setPosition((startPosition.x + (startVelocity.x * timer)), ((startPosition.y + (startVelocity.y * timer)) + ((gravity * timer) * timer)));
updateRealPosition();
if (((hitCheck()) && (pOwnerWeapon))){
pOwnerWeapon.playSoundOfImpact();
};
};
}
private function move_enter(prevState:String):void{
zombie_hooker_nightmare.application.addUpdateFunction(move_update);
pTimer = 0;
pStateMachine.data.setValue("startX", x);
}
private function hitCheck(checkInCamera:Boolean=true):Boolean{
var role:AbstractRole;
var rand:Number;
var sndClass:Class;
var breakableObject:BreakableObject;
var isHitSomething:Boolean;
if (Game.instance.isInCamera(this)){
for each (role in Game.instance.getRoles()) {
if (((((!((role == pOwner))) && (role.isAlive()))) && (role.hitTestRect.hitTestObject(this)))){
if (pOwner.type == PropertyLoader.ROLE_LOLA){
if (Game.instance.isInCamera(role)){
if ((((role.type == PropertyLoader.ROLE_JOHN)) && (John(role).isTricked))){
//unresolved jump
} else {
if (this.type == PropertyLoader.ITEM_BULLET){
rand = Math.random();
sndClass = blood3;
if (rand < 0.5){
sndClass = blood2;
};
playSound(sndClass);
};
role.goHit(pFlaming, pDamage, type, pOwner);
isHitSomething = true;
if (!pHitMultiple){
Game.instance.removeWeapon(this);
};
if (pFlaming){
Game.instance.addExplode(new ExplodeEffect(x, y));
};
};
};
} else {
if (pHitable){
if ((((((role.type == PropertyLoader.ROLE_LOLA)) && (!((role as Lola).isInTrailer())))) || ((((role.type == PropertyLoader.ROLE_JOHN)) && (!((role as John).isTricked)))))){
role.goHit(pFlaming, pDamage, type, pOwner);
isHitSomething = true;
if (!pHitMultiple){
pHitable = false;
if (type != PropertyLoader.ITEM_FIREBALL){
Game.instance.removeWeapon(this);
};
};
if (pFlaming){
Game.instance.addExplode(new ExplodeEffect(x, y));
};
};
};
};
};
};
if (((((pStateMachine) && ((pOwner.type == PropertyLoader.ROLE_LOLA)))) && ((type == PropertyLoader.ITEM_BULLET)))){
for each (breakableObject in Game.instance.getBreakableObjects()) {
if (((!(breakableObject.isBroken())) && (breakableObject.hitTestObject(this)))){
breakableObject.setBroken();
if (!pHitMultiple){
Game.instance.removeWeapon(this);
};
};
};
};
} else {
if (checkInCamera){
Game.instance.removeWeapon(this);
};
};
return (isHitSomething);
}
}
}//package
Section 298
//Trailer (Trailer)
package {
import flash.events.*;
import flash.display.*;
import com.liquable.game.geom.*;
public class Trailer extends MovableObject {
private var sUnWalkableLocs:Array;
private var pJohnComboTimer:int;
private var pJohnCombo:int;
private var pJohnCounts:int;
private static const STATUS_ALL_IN_PARTY:String = "all in party";
private static const STATUS_PARTY_OVER:String = "party over";
private static const STATUS_STATIC:String = "static";
public function Trailer(objType:String, locationX:int, locationY:int){
super(objType, locationX, locationY, 0);
pJohnCombo = 0;
pJohnComboTimer = 0;
}
override public function terminate():void{
zombie_hooker_nightmare.application.removeUpdateFunction(update);
sUnWalkableLocs = null;
super.terminate();
}
private function partyOver_exit(nextStatus:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(partyOver_update);
}
private function static_enter(prevStatus:String):void{
pMovieClip.mc.gotoAndStop(1);
pJohnCombo = 0;
pJohnComboTimer = 0;
}
private function allInParty_update(e:Event):void{
var helpButton:SimpleButton;
var vol:Number;
var timer:int = (pStateMachine.data.getInt("timer") + 1);
pStateMachine.data.setValue("timer", timer);
var timeToAddMoney:Boolean;
var johnCounts:int = pJohnCounts;
if (timer < 0){
helpButton = Game.instance.dashboard.getHelpButton();
if (helpButton){
helpButton.enabled = false;
helpButton.y = (helpButton.y + 3);
};
if (timer == -16){
zombie_hooker_nightmare.application.getSoundManager().playSound(trailer_sexy, false);
};
} else {
if (timer == 0){
pMovieClip.mc.gotoAndPlay("all in party");
} else {
if (timer < 19){
if ((timer % 9) == 1){
zombie_hooker_nightmare.application.getSoundManager().playSound(trailer_bounce, false);
};
} else {
if (timer < 38){
if ((timer % 6) == 1){
zombie_hooker_nightmare.application.getSoundManager().playSound(trailer_bounce, false);
};
} else {
vol = (1 - ((timer - 38) / (140 - 38)));
if (vol > 0){
if ((timer % 4) == 1){
zombie_hooker_nightmare.application.getSoundManager().playSound(trailer_bounce, false).setVolume(vol);
};
};
};
};
};
};
if (pMovieClip.levelComplete == "yes"){
if (timer == 20){
timeToAddMoney = true;
} else {
if (timer == 80){
Game.instance.dashboard.showEndMessage();
} else {
if (timer == 140){
Game.instance.levelComplete();
pMovieClip.mc.gotoAndPlay("partyEnd");
};
};
};
} else {
if (pMovieClip.mc.currentFrame == pMovieClip.mc.totalFrames){
timeToAddMoney = true;
setState(STATUS_PARTY_OVER);
};
};
if (timeToAddMoney){
};
}
override protected function setFrameLabel(label:String):void{
setMovieClipFrameLabel(pMovieClip.mc, label);
}
public function addJohn():void{
pJohnCounts++;
if (pJohnComboTimer < 30){
pJohnCombo++;
} else {
pJohnCombo = 1;
};
pJohnComboTimer = 0;
Game.instance.dashboard.currentTricks = pJohnCounts;
var moneyEach:int = Game.instance.getRoleConfigure(PropertyLoader.ROLE_JOHN).money;
var moneyToAdd:int = (pJohnCombo * moneyEach);
Game.instance.dashboard.updateMoney(moneyToAdd);
playSound(cash_pickup);
var popup:MovieClip = new lib_money_popup();
popup.money = ("$" + moneyToAdd);
addChild(popup);
}
private function partyOver_update(e:Event):void{
var loal:Lola = Game.instance.getLola();
loal.goExitTrailer(currentTileLoc.x, (currentTileLoc.y + 1));
setState(STATUS_STATIC);
}
private function static_exit(nextStatus:String):void{
}
override public function initialize():void{
var i:int;
var j:int;
var index:int;
var tempLoc:PointInt;
super.initialize();
var tileLoc:PointInt = new PointInt();
var canwalksArray:Array = Game.instance.getCanWalkLocsArray();
sUnWalkableLocs = new Array();
i = -2;
while (i <= 2) {
tileLoc.x = (currentTileLoc.x + i);
j = 0;
while (j <= 3) {
if (((!((i == 0))) || (!((j == 0))))){
tileLoc.y = (currentTileLoc.y - j);
Game.instance.getMap().setCanWalk(tileLoc.x, tileLoc.y, false);
sUnWalkableLocs.push(new PointInt(tileLoc.x, tileLoc.y));
index = 0;
while (index < canwalksArray.length) {
tempLoc = canwalksArray[index];
if (tempLoc.equals(tileLoc)){
canwalksArray.splice(index, 1);
break;
};
index++;
};
};
j++;
};
i++;
};
pJohnCounts = 0;
pStateMachine.initState(STATUS_STATIC, static_enter, null, static_exit);
pStateMachine.initState(STATUS_ALL_IN_PARTY, allInParty_enter, null, allInParty_exit);
pStateMachine.initState(STATUS_PARTY_OVER, partyOver_enter, null, partyOver_exit);
setState(STATUS_STATIC);
zombie_hooker_nightmare.application.addUpdateFunction(update);
}
public function isOnInvitingLoc(locx:int, locy:int):Boolean{
var dy:int;
var dx:int = (locx - currentTileLoc.x);
if (Math.abs(dx) < 3){
dy = (locy - currentTileLoc.y);
if ((((dy > 0)) && ((dy < 3)))){
return (true);
};
};
return (false);
}
private function partyOver_enter(prevStatus:String):void{
setFrameLabel(STATUS_PARTY_OVER);
var i:int;
while (i < pJohnCounts) {
Game.instance.getRankScoreManager().addJohnScore();
i++;
};
pJohnCounts = 0;
zombie_hooker_nightmare.application.addUpdateFunction(partyOver_update);
}
private function update(e:Event):void{
var john:John;
var diff:int;
var lola:Lola = Game.instance.getLola();
pJohnComboTimer++;
if (((Game.instance.isInCamera(this)) && (!(pStateMachine.isInState(STATUS_ALL_IN_PARTY))))){
if (lola.isInTrailer()){
if ((((lola.trickedJohns.length == 0)) && ((pJohnCounts > 0)))){
setState(STATUS_ALL_IN_PARTY);
};
} else {
if (lola.currentTileLoc.equals(currentTileLoc)){
if ((((pJohnCounts > 0)) || ((lola.trickedJohns.length > 0)))){
diff = ((Game.instance.dashboard.goalTricks - pJohnCounts) - lola.trickedJohns.length);
pMovieClip.fetchMoreJohns = diff;
if (diff > 0){
pMovieClip.mc.gotoAndPlay("fetchMoreJohns");
lola.goExitTrailer(currentTileLoc.x, (currentTileLoc.y + 1));
for each (john in lola.trickedJohns) {
john.goInTrailer();
};
} else {
lola.goInTrailer();
};
} else {
if (pMovieClip.mc.currentLabel != "closed"){
pMovieClip.mc.gotoAndPlay("closed");
lola.goExitTrailer(currentTileLoc.x, (currentTileLoc.y + 1));
playSound(door);
};
};
} else {
for each (john in lola.trickedJohns) {
if (((!(john.isInTrailer())) && (isOnInvitingLoc(john.currentTileLoc.x, john.currentTileLoc.y)))){
john.goInTrailer();
};
};
};
};
};
}
private function allInParty_enter(prevStatus:String):void{
pMovieClip.mc.gotoAndPlay("entering trailer");
playSound(door);
zombie_hooker_nightmare.application.addUpdateFunction(allInParty_update);
pStateMachine.data.setValue("timer", 0);
Game.instance.hideHelp();
if (Game.instance.dashboard.currentTricks >= Game.instance.dashboard.goalTricks){
pMovieClip.levelComplete = "yes";
pStateMachine.data.setValue("timer", -20);
} else {
pMovieClip.levelComplete = null;
};
}
override protected function createMovieClip():MovieClip{
return (new lib_trailer());
}
private function allInParty_exit(nextStatus:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(allInParty_update);
}
}
}//package
Section 299
//trailer_bounce (trailer_bounce)
package {
import flash.media.*;
public dynamic class trailer_bounce extends Sound {
}
}//package
Section 300
//trailer_sexy (trailer_sexy)
package {
import flash.media.*;
public dynamic class trailer_sexy extends Sound {
}
}//package
Section 301
//uzi4 (uzi4)
package {
import flash.media.*;
public dynamic class uzi4 extends Sound {
}
}//package
Section 302
//Weapon (Weapon)
package {
import flash.events.*;
import flash.display.*;
import com.liquable.utils.*;
public class Weapon extends MovableObject {
private var pWeaponBobClip:MovieClip;
private var pSoundOfImpact:Class;
private var pIsThrowable:Boolean;
private var pAmount:int;// = -1
private var pKnockback:int;
private var pSoundOfUsing:Class;
private var pWeaponPopClip:MovieClip;
private var pDamage:int;
public static const STATUS_BOB:String = "bob";
public static const STATUS_POP:String = "pop";
public function Weapon(weaponType:String, locX:int=0, locY:int=0, speed:Number=0){
var wType:String = ((weaponType)==PropertyLoader.ITEM_ANY) ? ArrayUtil.getArrayRandomElement(PropertyLoader.types, false) : weaponType;
var configure:Configure = Game.instance.getWeaponConfigure(wType);
super(wType, locX, locY, speed);
pDamage = configure.damage;
pKnockback = configure.knockback;
pIsThrowable = true;
pAmount = configure.amount;
}
override protected function createMovieClip():MovieClip{
var weaponClip:MovieClip = new MovieClip();
pWeaponBobClip = new lib_weaponBob();
pWeaponPopClip = new lib_weaponPop();
weaponClip.addChild(pWeaponBobClip);
weaponClip.addChild(pWeaponPopClip);
switch (type){
case PropertyLoader.ITEM_CASH:
pSoundOfUsing = null;
pSoundOfImpact = null;
pIsThrowable = false;
break;
case PropertyLoader.ITEM_BONE:
pSoundOfUsing = lola_throw_light;
pSoundOfImpact = weapon_bone;
pIsThrowable = false;
break;
case PropertyLoader.ITEM_ZOMBIE_LEG:
pSoundOfUsing = lola_throw_heavy;
pSoundOfImpact = zombie_part_hit;
pIsThrowable = false;
break;
case PropertyLoader.ITEM_SWARD:
pSoundOfUsing = lola_throw_light;
pSoundOfImpact = weapon_sharp;
pIsThrowable = false;
break;
case PropertyLoader.ITEM_GOLF_CLUB:
pSoundOfUsing = lola_throw_heavy;
pSoundOfImpact = weapon_golfclub;
pIsThrowable = false;
break;
case PropertyLoader.ITEM_SHOVEL:
pSoundOfUsing = lola_throw_heavy;
pSoundOfImpact = weapon_shovel;
pIsThrowable = false;
break;
case PropertyLoader.ITEM_PAN:
pSoundOfUsing = lola_throw_light;
pSoundOfImpact = metal_hit_2;
pIsThrowable = false;
break;
case PropertyLoader.ITEM_TIRE_IRON:
pSoundOfUsing = lola_throw_heavy;
pSoundOfImpact = weapon_shovel;
pIsThrowable = false;
break;
case PropertyLoader.ITEM_CANE:
pSoundOfUsing = lola_throw_heavy;
pSoundOfImpact = weapon_kick;
pIsThrowable = false;
break;
case PropertyLoader.ITEM_FLAME_THROWER:
pSoundOfUsing = null;
pSoundOfImpact = null;
pIsThrowable = false;
break;
case PropertyLoader.ITEM_UZI:
pSoundOfUsing = null;
pSoundOfImpact = null;
pIsThrowable = true;
break;
case PropertyLoader.ITEM_SHOOTGUN:
pSoundOfUsing = shotgun_fire;
pSoundOfImpact = null;
pIsThrowable = true;
break;
case PropertyLoader.ITEM_STILLETTO:
pSoundOfUsing = lola_throw_light;
pSoundOfImpact = weapon_sharp;
pIsThrowable = true;
break;
case PropertyLoader.ITEM_FLAMING_SKULL:
pSoundOfUsing = lola_throw_light;
pSoundOfImpact = thrown_weapon;
pIsThrowable = true;
break;
case PropertyLoader.ITEM_HORNED_SKULL:
pSoundOfUsing = lola_throw_heavy;
pSoundOfImpact = thrown_weapon;
pIsThrowable = true;
break;
case PropertyLoader.ITEM_SKULL:
pSoundOfUsing = thrown_weapon;
pSoundOfImpact = thrown_weapon;
pIsThrowable = true;
break;
case PropertyLoader.ITEM_MOLOTOV:
pSoundOfUsing = lola_throw_light;
pSoundOfImpact = molotov_smash;
pIsThrowable = true;
break;
case PropertyLoader.ITEM_CHAINSAW:
pSoundOfUsing = null;
pSoundOfImpact = null;
pIsThrowable = true;
break;
default:
throw (new Error("AbstractWeapon.createMovieClip : type error!!"));
};
return (weaponClip);
}
public function goPop():void{
setState(STATUS_POP);
}
private function bob_enter(prevState:String):void{
pWeaponBobClip.gotoAndStop(type);
pWeaponBobClip.visible = true;
pWeaponPopClip.visible = false;
}
private function pop_exit(nextState:String):void{
zombie_hooker_nightmare.application.removeUpdateFunction(pop_update);
}
override public function initialize():void{
super.initialize();
pStateMachine.initState(STATUS_BOB, bob_enter, null, null);
pStateMachine.initState(STATUS_POP, pop_enter, null, pop_exit);
setState(STATUS_BOB);
}
public function get amount():int{
return (pAmount);
}
public function setAmount(amount:int):void{
pAmount = amount;
}
public function decreaseAmount():void{
pAmount = Math.max(--pAmount, 0);
Game.instance.dashboard.updateItemAmount(type, pAmount);
}
public function playSoundOfImpact():void{
if (pSoundOfImpact){
playSound(pSoundOfImpact);
};
}
override public function terminate():void{
pWeaponBobClip = null;
pWeaponPopClip = null;
super.terminate();
}
public function get damage():int{
return (pDamage);
}
private function pop_enter(prevState:String):void{
pWeaponPopClip.gotoAndStop(type);
pWeaponBobClip.visible = false;
pWeaponPopClip.visible = true;
zombie_hooker_nightmare.application.addUpdateFunction(pop_update);
if (type == PropertyLoader.ITEM_CASH){
playSound(cash_pickup).setVolume(0.5);
} else {
playSound(interface_button_press);
};
}
public function get isThrowable():Boolean{
return (pIsThrowable);
}
private function pop_update(e:Event):void{
if (((((pWeaponPopClip) && (pWeaponPopClip.mc))) && ((pWeaponPopClip.mc.currentFrame >= pWeaponPopClip.mc.totalFrames)))){
Game.instance.removeWeapon(this);
};
}
public function playSoundOfUsing():void{
if (pSoundOfUsing){
playSound(pSoundOfUsing);
};
}
public function get knockback():int{
return (pKnockback);
}
}
}//package
Section 303
//weapon_bone (weapon_bone)
package {
import flash.media.*;
public dynamic class weapon_bone extends Sound {
}
}//package
Section 304
//weapon_chainsaw1 (weapon_chainsaw1)
package {
import flash.media.*;
public dynamic class weapon_chainsaw1 extends Sound {
}
}//package
Section 305
//weapon_golfclub (weapon_golfclub)
package {
import flash.media.*;
public dynamic class weapon_golfclub extends Sound {
}
}//package
Section 306
//weapon_kick (weapon_kick)
package {
import flash.media.*;
public dynamic class weapon_kick extends Sound {
}
}//package
Section 307
//weapon_sharp (weapon_sharp)
package {
import flash.media.*;
public dynamic class weapon_sharp extends Sound {
}
}//package
Section 308
//weapon_shovel (weapon_shovel)
package {
import flash.media.*;
public dynamic class weapon_shovel extends Sound {
}
}//package
Section 309
//weapon_slap (weapon_slap)
package {
import flash.media.*;
public dynamic class weapon_slap extends Sound {
}
}//package
Section 310
//zhn_bonnie_2_faster (zhn_bonnie_2_faster)
package {
import flash.media.*;
public dynamic class zhn_bonnie_2_faster extends Sound {
}
}//package
Section 311
//ZHN_episode1 (ZHN_episode1)
package {
import flash.media.*;
public dynamic class ZHN_episode1 extends Sound {
}
}//package
Section 312
//ZHN_episode2 (ZHN_episode2)
package {
import flash.media.*;
public dynamic class ZHN_episode2 extends Sound {
}
}//package
Section 313
//ZHN_intro_808_looped (ZHN_intro_808_looped)
package {
import flash.media.*;
public dynamic class ZHN_intro_808_looped extends Sound {
}
}//package
Section 314
//ZhnGameCamera (ZhnGameCamera)
package {
import com.liquable.game.camera.*;
import flash.geom.*;
public class ZhnGameCamera extends GameCamera {
private var pShakeFrames:int;
private static const sShakePoint:Array = [new Point(0, 0), new Point(1, -1), new Point(-1, 1), new Point(1, 1), new Point(-1, -1)];
public function ZhnGameCamera(){
super(zombie_hooker_nightmare.application.gameWidth, zombie_hooker_nightmare.application.gameHeight);
pShakeFrames = 0;
}
override public function update():void{
if (pShakeFrames){
pShakeFrames--;
setFocus(getFocus(), sShakePoint[pShakeFrames].x, sShakePoint[pShakeFrames].y);
};
if (getFollowSpeed() < 1){
setFollowSpeed(Math.min(1, (getFollowSpeed() + 0.05)));
};
super.update();
}
public function shakeCamera():void{
pShakeFrames = sShakePoint.length;
}
override public function setFocus(obj:ICameraObject, shiftx:Number=0, shifty:Number=0):void{
super.setFocus(obj, shiftx, (shifty - 30));
}
}
}//package
Section 315
//ZHNMapResource (ZHNMapResource)
package {
import com.liquable.game.geom.*;
import flash.xml.*;
import com.liquable.game.tiledmap.resources.*;
public class ZHNMapResource extends MapResource {
private var pWeaponLocs:Object;
private var pObjects:Array;
private var pSet:String;
private var pLolaLoc:Object;
private var pRoleLocs:Object;
private var pTrailerLoc:Object;
private var pObjectLocs:Array;
private static const TILE_HEIGHT:int = 40;
private static const TILE_WIDTH:int = 40;
public function ZHNMapResource(assetsRootPath:String){
super(assetsRootPath);
pTileWidth = TILE_WIDTH;
pTileHeight = TILE_HEIGHT;
}
private function analyzeLevelNode(levelNode:XMLNode):void{
pColumnCounts = parseInt(levelNode.attributes.width);
pRowCounts = parseInt(levelNode.attributes.height);
pSet = levelNode.attributes.set;
}
public function getTrailerLoc():Object{
return (pTrailerLoc);
}
override protected function analyzeXmlDoc(xmlDocument:XMLDocument):void{
var node:XMLNode;
if (pImageResourceFilenames == null){
pImageResourceFilenames = new Object();
};
var childNodes:Array = xmlDocument.firstChild.childNodes;
for each (node in childNodes) {
analyzeNode(node);
};
loadTiledImage("0", pSet, TILE_WIDTH, TILE_HEIGHT);
}
public function getObjectLocs():Array{
return (pObjectLocs);
}
public function getRoleLocsByType(roleType:String):Array{
return (pRoleLocs[roleType]);
}
private function analyzeRoleNode(roleNode:XMLNode):void{
var node:XMLNode;
var nodes:Array = roleNode.childNodes;
if (!pRoleLocs){
pRoleLocs = new Object();
};
for each (node in nodes) {
if (!pRoleLocs.hasOwnProperty(node.nodeName)){
pRoleLocs[node.nodeName] = new Array();
};
pRoleLocs[node.nodeName].push(node.attributes);
};
}
private function analyzeObjectNode(objectNode:XMLNode):void{
if (!pObjectLocs){
pObjectLocs = new Array();
};
pObjectLocs.push(objectNode.attributes);
}
private function analyzeGroundNode(groundNode:XMLNode):void{
var p:PointInt;
var tileResource:TileResource;
if (pLayerResources == null){
pLayerResources = new Array();
};
var idArray:Array = convertStringToArray(groundNode.attributes.tiles, ",");
var tiles:Object = new Object();
var i:int;
while (i < idArray.length) {
p = new PointInt((i % pColumnCounts), (i / pColumnCounts));
tileResource = new TileResource(this, p.x, p.y);
tileResource.setImage("0", parseInt(idArray[i]));
tiles[p.toString()] = tileResource;
i++;
};
var layerResource:LayerResource = new LayerResource(this);
layerResource.initialize(0, tiles);
pLayerResources.push(layerResource);
}
private function convertStringToArray(string:String, separater:String):Array{
var s:String;
var strArray:Array = new Array();
var str:String = string.substring(0, (string.length - 2));
while (((str) && ((str.length > 0)))) {
s = str.substring(0, str.indexOf(separater));
strArray.push(s);
str = str.substring((s.length + 1), str.length);
};
return (strArray);
}
public function getObjectLocsByType(objType:String):Array{
var obj:Object;
var array:Array = new Array();
for each (obj in pObjectLocs) {
if (obj.oType == objType){
array.push(obj);
};
};
return (array);
}
public function getWeaponLocs():Object{
return (pWeaponLocs);
}
private function analyzeWeaponNode(weaponNode:XMLNode):void{
var node:XMLNode;
var nodes:Array = weaponNode.childNodes;
if (!pWeaponLocs){
pWeaponLocs = new Object();
};
for each (node in nodes) {
if (!pWeaponLocs.hasOwnProperty(node.nodeName)){
pWeaponLocs[node.nodeName] = new Array();
};
pWeaponLocs[node.nodeName].push(node.attributes);
};
}
public function getSet():String{
return (pSet);
}
private function analyzeNode(node:XMLNode):void{
switch (node.nodeName){
case "level":
analyzeLevelNode(node);
break;
case "ground":
analyzeGroundNode(node);
break;
case "canWalk":
analyzeCanWalkNode(node);
break;
case "object":
analyzeObjectNode(node);
break;
case "trailer":
pTrailerLoc = node.attributes;
break;
case "lola":
pLolaLoc = node.attributes;
break;
case "weapon":
analyzeWeaponNode(node);
break;
case "role":
analyzeRoleNode(node);
break;
};
}
private function analyzeCanWalkNode(canWalkNode:XMLNode):void{
var loc:PointInt;
var p:Object;
pTilePropertiesMap = new Object();
var properties:Array = convertStringToArray(canWalkNode.attributes.tiles, ",");
var i:int;
while (i < properties.length) {
loc = new PointInt((i % pColumnCounts), (i / pColumnCounts));
p = new Object();
p["canWalk"] = properties[i];
pTilePropertiesMap[loc.toString()] = p;
i++;
};
}
public function getLolaLoc():Object{
return (pLolaLoc);
}
public function getWeaponLocsByType(weaponType:String):Array{
return (pWeaponLocs[weaponType]);
}
public function getRoleLocs():Object{
return (pRoleLocs);
}
}
}//package
Section 316
//zombie_explode (zombie_explode)
package {
import flash.media.*;
public dynamic class zombie_explode extends Sound {
}
}//package
Section 317
//zombie_hooker_nightmare (zombie_hooker_nightmare)
package {
import com.liquable.game.*;
import flash.events.*;
import com.liquable.media.*;
import com.liquable.game.debug.*;
import flash.display.*;
import com.liquable.visualstack.*;
import flash.net.*;
public class zombie_hooker_nightmare extends Sprite {
private var pButtonAdultswim:SimpleButton;
private var pBackgroundSound:SoundController;
private var pLocalConnection:LocalConnection;
public static const sGameId:String = "1855";
public static const sGameName:String = "ZHN";
private static var sInstance:zombie_hooker_nightmare;
private static var sApplication:GameApplication;
public function zombie_hooker_nightmare(){
super();
addEventListener(Event.ENTER_FRAME, init_update);
sInstance = this;
tabChildren = (tabEnabled = false);
pLocalConnection = new LocalConnection();
initialize();
}
public function setAdultswimVisible(vis:Boolean):void{
pButtonAdultswim.visible = vis;
}
public function stopBackgroundSound():void{
if (pBackgroundSound){
pBackgroundSound.stop();
pBackgroundSound = null;
};
}
private function init_update(e:Event):void{
if (stage){
removeEventListener(Event.ENTER_FRAME, init_update);
stage.stageFocusRect = false;
};
}
public function playBackgroundSound():void{
if (pBackgroundSound == null){
pBackgroundSound = application.getSoundManager().playSound(ZHN_intro_808_looped, true);
};
}
private function initialize():void{
sApplication = new GameApplication(this, 728, 500, true);
sApplication.start(30, true, false);
application.debugWatchItem("update fps", new DebugFpsMeter(application));
application.debugWatchItem("ver", DebugTagValueWatcher.getById("ver").setValue("1.2.3"));
application.debugWatchItem("rank", DebugTagValueWatcher.getById("rank").setValue("1"));
var vs:VisualStack = new VisualStack(sApplication.gameWidth, sApplication.gameHeight);
vs.setBackgroundColor(0);
addChildAt(vs, 0);
vs.push(Brain.instance);
playBackgroundSound();
pButtonAdultswim = new lib_button_adultswim();
pButtonAdultswim.visible = false;
pButtonAdultswim.x = 10;
pButtonAdultswim.y = 460;
addChild(pButtonAdultswim);
pButtonAdultswim.addEventListener(MouseEvent.MOUSE_OVER, mouse_over);
pButtonAdultswim.addEventListener(MouseEvent.CLICK, linkMoreGames);
trace(getStrDomain());
}
public static function linkLeaderboard(e:Event=null):void{
mouse_down();
navigateToURL(new URLRequest((((((("http://highscores.adultswim.com/highscores/index.jsp?game=" + sGameId) + "&cid=GAME_Ext_") + sGameName) + "_") + getStrDomain()) + "_endScreen_hs")), "_blank");
}
public static function getStrDomain():String{
return (instance.pLocalConnection.domain);
}
public static function getRootParameters():Object{
if (((((instance.root) && (instance.root.loaderInfo))) && (instance.root.loaderInfo.parameters))){
return (instance.root.loaderInfo.parameters);
};
return ({});
}
public static function getStrBase():String{
var strBase:String = getRootParameters()["strBase"];
return ((strBase) ? strBase : "");
}
public static function mouse_over(event:MouseEvent=null):void{
sApplication.getSoundManager().playSound(interface_button_rollover, false);
}
public static function linkMoreGames(e:Event=null):void{
mouse_down();
navigateToURL(new URLRequest((((("http://games.adultswim.com?cid=GAME_Ext_" + sGameName) + "_") + getStrDomain()) + "_game_more")), "_blank");
}
public static function get instance():zombie_hooker_nightmare{
return (sInstance);
}
public static function get application():GameApplication{
return (sApplication);
}
public static function mouse_down(event:MouseEvent=null):void{
sApplication.getSoundManager().playSound(interface_button_press, false);
}
}
}//package
Section 318
//zombie_part_hit (zombie_part_hit)
package {
import flash.media.*;
public dynamic class zombie_part_hit extends Sound {
}
}//package
Section 319
//zombie_scuttle (zombie_scuttle)
package {
import flash.media.*;
public dynamic class zombie_scuttle extends Sound {
}
}//package
Section 320
//zombie_throw (zombie_throw)
package {
import flash.media.*;
public dynamic class zombie_throw extends Sound {
}
}//package