Section 1
//KeyPoll (bigroom.input.KeyPoll)
package bigroom.input {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class KeyPoll {
private var states:ByteArray;
public var press:Boolean;// = false
public var click:Boolean;// = false
public var onscreen:Boolean;// = true
public var hasclicked:Boolean;// = false
private var dispObj:DisplayObject;
public function KeyPoll(obj:DisplayObject){
super();
states = new ByteArray();
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
dispObj = obj;
dispObj.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener, false, 0, true);
dispObj.addEventListener(KeyboardEvent.KEY_UP, keyUpListener, false, 0, true);
dispObj.addEventListener(Event.ACTIVATE, activateListener, false, 0, true);
dispObj.addEventListener(Event.DEACTIVATE, deactivateListener, false, 0, true);
dispObj.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownListener);
dispObj.addEventListener(MouseEvent.MOUSE_UP, mouseUpListener);
dispObj.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
dispObj.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
}
public function mouseOutHandler(e:MouseEvent):void{
onscreen = false;
}
public function isUp(keyCode:uint):Boolean{
return (((states[(keyCode >>> 3)] & (1 << (keyCode & 7))) == 0));
}
private function activateListener(ev:Event):void{
var i:int;
while (i < 8) {
states[i] = 0;
i++;
};
}
public function isDown(keyCode:uint):Boolean{
return (!(((states[(keyCode >>> 3)] & (1 << (keyCode & 7))) == 0)));
}
private function keyUpListener(ev:KeyboardEvent):void{
states[(ev.keyCode >>> 3)] = (states[(ev.keyCode >>> 3)] & ~((1 << (ev.keyCode & 7))));
}
private function deactivateListener(ev:Event):void{
var i:int;
while (i < 8) {
states[i] = 0;
i++;
};
}
public function mouseOverHandler(e:MouseEvent):void{
onscreen = true;
}
public function mouseUpListener(e:MouseEvent):void{
press = false;
click = false;
hasclicked = false;
}
public function mouseDownListener(e:MouseEvent):void{
press = true;
click = true;
hasclicked = true;
}
private function keyDownListener(ev:KeyboardEvent):void{
states[(ev.keyCode >>> 3)] = (states[(ev.keyCode >>> 3)] | (1 << (ev.keyCode & 7)));
}
}
}//package bigroom.input
Section 2
//KongregateEvent (com.kongregate.as3.client.events.KongregateEvent)
package com.kongregate.as3.client.events {
import flash.events.*;
public class KongregateEvent extends Event {
public static const COMPLETE:String = "component_api_available";
public function KongregateEvent(_arg1:String){
super(_arg1);
}
}
}//package com.kongregate.as3.client.events
Section 3
//AbstractShadowService (com.kongregate.as3.client.services.AbstractShadowService)
package com.kongregate.as3.client.services {
import flash.events.*;
public class AbstractShadowService extends EventDispatcher {
protected function alert(_arg1:String, _arg2:String, _arg3="", _arg4:String=""):void{
trace(((((((("Kongregate API: " + _arg1) + ".") + _arg2) + "(") + _arg3) + ") ") + _arg4));
}
}
}//package com.kongregate.as3.client.services
Section 4
//HighScoreServiceShadow (com.kongregate.as3.client.services.HighScoreServiceShadow)
package com.kongregate.as3.client.services {
public class HighScoreServiceShadow extends AbstractShadowService implements IHighScoreServices {
private var mode:String;
public function HighScoreServiceShadow(){
mode = "";
}
public function submit(_arg1:Number, _arg2:String=null):void{
alert("IHighScoreServices", "submit", arguments);
}
public function connect():Boolean{
alert("IKongregateServices", "connect");
return (true);
}
public function requestList(_arg1:Function):void{
alert("IHighScoreServices", "requestList", "", (("[Mode: " + mode) + "]"));
_arg1({success:false});
}
public function setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
}
}//package com.kongregate.as3.client.services
Section 5
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function setMode(_arg1:String):void;
function submit(_arg1:Number, _arg2:String=null):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 6
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function getPlayerInfo(_arg1:Function):void;
function connect(_arg1:Number=-1):Boolean;
}
}//package com.kongregate.as3.client.services
Section 7
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function submitArray(_arg1:Array):void;
function submit(_arg1:String, _arg2:Number):void;
}
}//package com.kongregate.as3.client.services
Section 8
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 9
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function connect(_arg1:Number=-1):Boolean{
alert("IKongregateServices", "connect", arguments);
return (true);
}
public function getPlayerInfo(_arg1:Function):void{
alert("IKongregateServices", "getPlayerInfo");
_arg1(new Object());
}
}
}//package com.kongregate.as3.client.services
Section 10
//StatServiceShadow (com.kongregate.as3.client.services.StatServiceShadow)
package com.kongregate.as3.client.services {
public class StatServiceShadow extends AbstractShadowService implements IStatServices {
public function submitArray(_arg1:Array):void{
alert("IStatServices", "submitArray", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 11
//UserServiceShadow (com.kongregate.as3.client.services.UserServiceShadow)
package com.kongregate.as3.client.services {
public class UserServiceShadow extends AbstractShadowService implements IUserServices {
public function getName():String{
alert("UserService", "getName");
return ("Guest");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMode:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 12
//IAPIBootstrap (com.kongregate.as3.client.IAPIBootstrap)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
public interface IAPIBootstrap {
function init(_arg1:Event=null, _arg2:Stage=null):void;
function hideLog():void;
function showLog(_arg1:int=0):void;
}
}//package com.kongregate.as3.client
Section 13
//KongregateAPI (com.kongregate.as3.client.KongregateAPI)
package com.kongregate.as3.client {
import flash.events.*;
import com.kongregate.as3.client.services.*;
import flash.display.*;
import flash.system.*;
import com.kongregate.as3.client.events.*;
import flash.net.*;
import flash.utils.*;
import flash.errors.*;
public class KongregateAPI extends Sprite {
private const VERSION:Number = 1;
private var loader:Loader;
private var loadedDomain:ApplicationDomain;
private static const CLASS_USER:String = "com.kongregate.as3.client.services.UserServices";
private static const CLASS_STATS:String = "com.kongregate.as3.client.services.StatServices";
private static const CLASS_SERVICES:String = "com.kongregate.as3.client.services.KongregateServices";
private static const CLASS_SCORES:String = "com.kongregate.as3.client.services.HighScoreServices";
private static const DEBUG_API_URL:String = "//Linuxpc/kongregate/public/flash/API_AS3.swf";
private static var _connected:Boolean;
private static var kUser:IUserServices;
private static var _loaded:Boolean;
private static var kServices:IKongregateServices;
private static var kScores:IHighScoreServices;
private static var mInstance:KongregateAPI;
private static var kStats:IStatServices;
private static var kAPI:IAPIBootstrap;
public function KongregateAPI(){
if (mInstance != null){
throw (new Error("Warning: KongregateAPI has been added to stage more than once or accessed improperly. Use getInstance() or a stage reference to access."));
};
mInstance = this;
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get loaded():Boolean{
return (_loaded);
}
public function get connected():Boolean{
return (_connected);
}
private function alertConnected(_arg1:TimerEvent=null):void{
var _local2:KongregateEvent;
var _local3:Boolean;
_local2 = new KongregateEvent(KongregateEvent.COMPLETE);
_local3 = this.dispatchEvent(_local2);
}
private function init(_arg1:Event):void{
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
_loaded = false;
_connected = false;
_local2 = LoaderInfo(root.loaderInfo).parameters;
_local3 = _local2.api_path;
if (_local3 == null){
trace("Alert: Kongregate API could not be loaded, due to local testing. API will load when the game is uploaded.");
createShadowServices();
return;
};
Security.allowDomain("*.kongregate.com");
Security.allowDomain("kongregatetrunk.com");
_local4 = new URLRequest(_local3);
_local5 = new LoaderContext(false);
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(_local4, _local5);
}
public function get api():IAPIBootstrap{
return (kAPI);
}
private function loadComplete(_arg1:Event):void{
getServices();
}
public function get scores():IHighScoreServices{
return (kScores);
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
throw (new IOError(("API file not found. " + _arg1)));
}
public function get services():IKongregateServices{
return (kServices);
}
public function get stats():IStatServices{
return (kStats);
}
private function createShadowServices():void{
var _local1:Timer;
trace(">>> Kongregate Shadow Services instantiated for local development..");
kServices = new KongregateServiceShadow();
kScores = new HighScoreServiceShadow();
kStats = new StatServiceShadow();
kUser = new UserServiceShadow();
_local1 = new Timer(200, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, alertConnected);
_local1.start();
_connected = true;
}
public function get user():IUserServices{
return (kUser);
}
private function getServices():void{
var _local1:ApplicationDomain;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = ApplicationDomain.currentDomain;
kAPI = IAPIBootstrap(loader.getChildAt(0));
this.addChild(loader);
_local2 = _local1.getDefinition(CLASS_SERVICES);
trace(_local2);
kServices = _local2.getInstance();
_local3 = _local1.getDefinition(CLASS_SCORES);
kScores = _local3.getInstance();
_local4 = _local1.getDefinition(CLASS_STATS);
kStats = _local4.getInstance();
_local5 = _local1.getDefinition(CLASS_USER);
kUser = _local5.getInstance();
kServices.connect(VERSION);
_loaded = true;
_connected = true;
alertConnected();
}
public static function getInstance():KongregateAPI{
if (!mInstance){
throw (new IllegalOperationError("You must add the Kongregate API component to the stage before attempting to access it."));
};
return (mInstance);
}
}
}//package com.kongregate.as3.client
Section 14
//LivePreviewParent (fl.livepreview.LivePreviewParent)
package fl.livepreview {
import flash.display.*;
import flash.utils.*;
import flash.external.*;
public class LivePreviewParent extends MovieClip {
public var myInstance:DisplayObject;
public function LivePreviewParent(){
super();
try {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
myInstance = getChildAt(0);
onResize(stage.width, stage.height);
if (ExternalInterface.available){
ExternalInterface.addCallback("onResize", onResize);
ExternalInterface.addCallback("onUpdate", onUpdate);
};
} catch(e) {
};
}
private function updateCollection(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Class;
var _local5:Object;
var _local6:int;
var _local7:Object;
var _local8:Object;
var _local9:*;
_local3 = Class(getDefinitionByName(_arg1.collectionClass));
_local4 = Class(getDefinitionByName(_arg1.collectionItemClass));
_local5 = new (_local3);
_local6 = 0;
while (_local6 < _arg1.collectionArray.length) {
_local7 = new (_local4);
_local8 = _arg1.collectionArray[_local6];
for (_local9 in _local8) {
_local7[_local9] = _local8[_local9];
};
_local5.addItem(_local7);
_local6++;
};
myInstance[_arg2] = (_local5 as _local3);
}
public function onResize(_arg1:Number, _arg2:Number):void{
var setSizeFn:Function;
var width = _arg1;
var height = _arg2;
setSizeFn = null;
try {
setSizeFn = myInstance["setSize"];
} catch(e:Error) {
setSizeFn = null;
};
if (setSizeFn != null){
setSizeFn(width, height);
} else {
myInstance.width = width;
myInstance.height = height;
};
}
public function onUpdate(... _args):void{
var i:int;
var name:String;
var value:*;
var updateArray = _args;
i = 0;
while ((i + 1) < updateArray.length) {
try {
name = String(updateArray[i]);
value = updateArray[(i + 1)];
if ((((typeof(value) == "object")) && (value.__treatAsCollectionSpecialSauce__))){
updateCollection(value, name);
} else {
myInstance[name] = value;
};
} catch(e:Error) {
};
i = (i + 2);
};
}
}
}//package fl.livepreview
Section 15
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.system.*;
import flash.net.*;
import flash.utils.*;
public class MochiAd {
public function MochiAd(){
super();
}
public static function getVersion():String{
return ("3.0 as3");
}
public static function showClickAwayAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
var sendHostProgress:Boolean;
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
finished = true;
chk.started = getTimer();
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (this.root == null){
finished = true;
};
if (finished){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(server:String):String{
var hostname:String = server.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (hostname);
};
Security.allowDomain("*");
Security.allowDomain(hostname);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(hostname);
return (hostname);
}
public static function unload(clip:Object):Boolean{
if (((clip.clip) && (clip.clip._mochiad))){
clip = clip.clip;
};
if (clip.origFrameRate != undefined){
clip.stage.frameRate = clip.origFrameRate;
};
if (!clip._mochiad){
return (false);
};
if (clip._mochiad._containerLCName != undefined){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
};
if (clip._mochiad.onUnload){
clip._mochiad.onUnload();
};
delete clip._mochiad_loaded;
delete clip._mochiad;
return (true);
}
public static function showInterLevelAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var p:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = (msec - 250);
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (finished){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(options:Object, defaults:Object):Object{
var k:String;
var pairs:Array;
var i:Number;
var kv:Array;
var optcopy:Object = {};
for (k in defaults) {
optcopy[k] = defaults[k];
};
if (options){
for (k in options) {
optcopy[k] = options[k];
};
};
if (optcopy.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
options = optcopy.clip.loaderInfo.parameters.mochiad_options;
if (options){
pairs = options.split("&");
i = 0;
while (i < pairs.length) {
kv = pairs[i].split("=");
optcopy[unescape(kv[0])] = unescape(kv[1]);
i++;
};
};
if (optcopy.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (optcopy);
}
public static function _cleanup(mc:Object):void{
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = mc;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
lc.client = null;
lc.close();
//unresolved jump
var _slot1 = e;
};
setTimeout(f, 0);
};
var idx:Number = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(options:Object):MovieClip{
var clip:Object;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = options;
var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
//unresolved jump
var _slot1 = e;
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
var depth:Number = options.depth;
delete options.depth;
var mc:MovieClip = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
var lv:URLVariables = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (ev:Object):void{
ev.target.removeEventListener(ev.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (io:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(base:Object, methodName:String, argsArray:Array):Object{
var nameArray:Array = methodName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
if (typeof(base[nameArray[i]]) == "function"){
return (base[nameArray[i]].apply(base, argsArray));
};
return (undefined);
}
public static function createEmptyMovieClip(parent:Object, name:String, depth:Number):MovieClip{
var mc:MovieClip = new MovieClip();
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
parent[name] = mc;
mc["_name"] = name;
return (mc);
}
public static function _getRes(options:Object, clip:Object):Array{
var xy:Array;
var b:Object = clip.getBounds(clip.root);
var w:Number = 0;
var h:Number = 0;
if (typeof(options.res) != "undefined"){
xy = options.res.split("x");
w = parseFloat(xy[0]);
h = parseFloat(xy[1]);
} else {
w = (b.xMax - b.xMin);
h = (b.yMax - b.yMin);
};
if ((((w == 0)) || ((h == 0)))){
w = clip.stage.stageWidth;
h = clip.stage.stageHeight;
};
return ([w, h]);
}
public static function adShowing(mc:Object):void{
mc.origFrameRate = mc.stage.frameRate;
mc.stage.frameRate = 30;
}
public static function getValue(base:Object, objectName:String):Object{
var nameArray:Array = objectName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
return (base[nameArray[i]]);
}
public static function rpc(clip:Object, callbackID:Number, arg:Object):void{
var _local4:Object;
var _local5:Object;
switch (arg.id){
case "setValue":
MochiAd.setValue(clip, arg.objectName, arg.value);
break;
case "getValue":
_local4 = MochiAd.getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + arg.id));
};
}
public static function setValue(base:Object, objectName:String, value:Object):void{
var nameArray:Array = objectName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return;
};
base = base[nameArray[i]];
i++;
};
base[nameArray[i]] = value;
}
public static function showPreGameAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var complete:Boolean;
var unloaded:Boolean;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (percent:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
var fn:Function = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var p:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
var f:Function = function (ev:Event):void{
ev.target.removeEventListener(ev.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = msec;
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s:String):Object{
trace(("[MOCHIAD rpcTestFn] " + s));
return (s);
};
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (lc_name:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
var _clip:Object = this.parent.parent.root;
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
var clip_total:Number = _clip.loaderInfo.bytesTotal;
var clip_loaded:Number = _clip.loaderInfo.bytesLoaded;
if (complete){
clip_loaded = Math.max(1, clip_loaded);
clip_total = clip_loaded;
};
var clip_pcnt:Number = ((100 * clip_loaded) / clip_total);
var ad_pcnt:Number = ((100 * elapsed) / chk.ad_msec);
var _inside:Object = this._mochiad_bar._inside;
var pcnt:Number = Math.min(100, Math.min(((clip_pcnt) || (0)), ad_pcnt));
pcnt = Math.max(this.last_pcnt, pcnt);
this.last_pcnt = pcnt;
_inside.scaleX = (pcnt * 0.01);
options.ad_progress(pcnt);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:clip_pcnt});
if (clip_pcnt == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((elapsed > chk.ad_timeout)) && ((clip_pcnt == 100)))){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (((complete) && (finished))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(options);
}
public static function showTimedAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(options);
}
public static function doOnEnterFrame(mc:MovieClip):void{
var mc = mc;
var f:Function = function (ev:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
ev.target.removeEventListener(ev.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package mochi.as3
Section 16
//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.2.0.3794";
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 17
//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.2.0.3794";
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 18
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 19
//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 20
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get isDocument():Boolean;
function set repeaters(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function initializeRepeaterArrays(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 21
//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 22
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.2.0.3794";
public function SoundAsset(){
super();
}
}
}//package mx.core
Section 23
//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.2.0.3794";
private static var counter:int = 0;
public function NameUtil(){
super();
}
public static function displayObjectToString(displayObject:DisplayObject):String{
var result:String;
var o:DisplayObject;
var s:String;
var indices:Array;
var displayObject = displayObject;
o = 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;
};
//unresolved jump
var _slot1 = e;
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 24
//dwgraphicsclass (dwgraphicsclass)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
public class dwgraphicsclass extends Sprite {
public var temptile:BitmapData;
public var images:Array;
public var backgrounds:Array;
public var alphamult:uint;
public var bfontpos:int;
public var tiles:Array;
public var bfontmask:Array;
public var bg_rect:Rectangle;
public var screenbuffer:BitmapData;
public var bfont:Array;
public var bfont_rect:Rectangle;
public var updatebackground:Boolean;
public var cur:int;
public var bfontlen:Array;
public var bfontmask_rect:Rectangle;
public var stemp:String;
public var images_rect:Rectangle;
public var buffer:BitmapData;
public var temp:int;
public var tiles_rect:Rectangle;
public var temp3:int;
public var temp2:int;
public var backbuffer:BitmapData;
public var screen:Bitmap;
public var ct:ColorTransform;
public var tl:Point;
public function dwgraphicsclass(){
backgrounds = new Array();
images = new Array();
tiles = new Array();
bfont = new Array();
bfontmask = new Array();
bfontlen = new Array();
super();
}
public function makebfont():void{
var maprow:Array;
var i:Number;
var t:BitmapData;
var temprect:Rectangle;
var j:Number = 0;
while (j < 16) {
i = 0;
while (i < 16) {
t = new BitmapData(8, 8, true, 0);
temprect = new Rectangle((i * 8), (j * 8), 8, 8);
t.copyPixels(buffer, temprect, tl);
bfont.push(t);
i++;
};
j++;
};
i = 0;
while (i < 0x0100) {
bfontlen.push(6);
i++;
};
var tstring:String = "4,3,5,7,6,7,6,3,4,4,7,7,3,5,2,5,6,5,6,6,6,6,6,6,6,6,2,3,5,5,5,6,7,6,6,6,6,5,5,6,6,3,6,6,5,7,7,6,6,6,6,6,5,6,7,7,7,7,5,4,5,4,5,6,4,6,6,6,6,5,5,6,6,3,6,6,5,7,7,6,6,6,6,6,5,6,7,7,7,7,5,5,3,5,6,4";
maprow = new Array();
maprow = tstring.split(",");
var k:int;
while (k < 96) {
bfontlen[(k + 32)] = int(maprow[k]);
k++;
};
}
public function drawentities(obj:entityclass, help:helpclass):void{
var j:int;
var k:int;
var i:int;
while (i < obj.nentity) {
if (obj.entities[i].size == 1){
j = 0;
while (j < 2) {
k = 0;
while (k < 2) {
backbuffer.copyPixels(tiles[((obj.entities[i].drawframe + j) + (k * 20))], tiles_rect, new Point((obj.entities[i].xp + (j * 16)), (obj.entities[i].yp + (k * 16))));
k++;
};
j++;
};
} else {
if (obj.entities[i].size == 2){
j = 0;
while (j < 4) {
k = 0;
while (k < 5) {
backbuffer.copyPixels(tiles[((obj.entities[i].drawframe + j) + (k * 20))], tiles_rect, new Point((obj.entities[i].xp + (j * 16)), (obj.entities[i].yp + (k * 16))));
k++;
};
j++;
};
} else {
if (!obj.entities[i].invis){
if (obj.entities[i].type == 28){
backbuffer.copyPixels(tiles[obj.entities[i].drawframe], tiles_rect, new Point(obj.entities[i].xp, (obj.entities[i].yp + (2 * help.sine[int(help.slowsine)]))));
} else {
backbuffer.copyPixels(tiles[obj.entities[i].drawframe], tiles_rect, new Point(obj.entities[i].xp, obj.entities[i].yp));
};
};
};
};
i++;
};
}
public function bprint(x:int, y:int, t:String, r:int, g:int, b:int, cen:Boolean=false):void{
printmask(x, y, t, cen);
print(x, y, t, r, g, b, cen);
}
public function bprinttemptile(x:int, y:int, t:String, r:int, g:int, b:int, cen:Boolean=false):void{
printmasktemptile(x, y, t, cen);
printtemptile(x, y, t, r, g, b, cen);
}
public function addbackground():void{
var t:BitmapData = new BitmapData(160, 144, true, 0);
t.copyPixels(buffer, bg_rect, tl);
backgrounds.push(t);
}
public function init():void{
updatebackground = true;
tiles_rect = new Rectangle(0, 0, 16, 16);
bfont_rect = new Rectangle(0, 0, 8, 8);
bfontmask_rect = new Rectangle(0, 0, 9, 9);
bg_rect = new Rectangle(0, 0, 160, 144);
tl = new Point(0, 0);
ct = new ColorTransform(0, 0, 0, 1, 0xFF, 0xFF, 0xFF, 1);
backbuffer = new BitmapData(160, 144, false, 0);
screenbuffer = new BitmapData(160, 144, false, 0);
temptile = new BitmapData(16, 16, false, 0);
screen = new Bitmap(screenbuffer);
screen.width = 640;
screen.height = 576;
addChild(screen);
}
public function len(t:String):int{
bfontpos = 0;
var i:int;
while (i < t.length) {
cur = t.charCodeAt(i);
bfontpos = (bfontpos + bfontlen[cur]);
i++;
};
return (bfontpos);
}
public function render():void{
screenbuffer.lock();
screenbuffer.copyPixels(backbuffer, backbuffer.rect, tl, null, null, false);
screenbuffer.unlock();
backbuffer.lock();
backbuffer.fillRect(backbuffer.rect, 0);
backbuffer.unlock();
}
public function drawimage(t:int, xp:int, yp:int, cent:Boolean=false):void{
if (cent){
backbuffer.copyPixels(images[t], new Rectangle(0, 0, images[t].width, images[t].height), new Point((80 - int((images[t].width / 2))), yp));
} else {
backbuffer.copyPixels(images[t], new Rectangle(0, 0, images[t].width, images[t].height), new Point(xp, yp));
};
}
public function printmask(x:int, y:int, t:String, cen:Boolean=false):void{
if (cen){
x = (80 - (len(t) / 2));
};
bfontpos = 0;
var i:int;
while (i < t.length) {
cur = t.charCodeAt(i);
backbuffer.copyPixels(bfontmask[cur], bfont_rect, new Point(((x + bfontpos) - 1), y));
bfontpos = (bfontpos + bfontlen[cur]);
i++;
};
}
public function screenshake():void{
screenbuffer.lock();
screenbuffer.copyPixels(backbuffer, backbuffer.rect, tl, null, null, false);
screenbuffer.copyPixels(backbuffer, backbuffer.rect, new Point(((Math.random() * 5) - 3), ((Math.random() * 5) - 3)), null, null, false);
screenbuffer.unlock();
backbuffer.lock();
backbuffer.fillRect(backbuffer.rect, 0);
backbuffer.unlock();
}
public function printmasktemptile(x:int, y:int, t:String, cen:Boolean=false):void{
if (cen){
x = (80 - (len(t) / 2));
};
bfontpos = 0;
var i:int;
while (i < t.length) {
cur = t.charCodeAt(i);
temptile.copyPixels(bfontmask[cur], bfont_rect, new Point(((x + bfontpos) - 1), y));
bfontpos = (bfontpos + bfontlen[cur]);
i++;
};
}
public function flashlight():void{
backbuffer.fillRect(backbuffer.rect, 9383213);
}
public function RGB(red:Number, green:Number, blue:Number):Number{
return (((blue | (green << 8)) | (red << 16)));
}
public function printtemptile(x:int, y:int, t:String, r:int, g:int, b:int, cen:Boolean=false):void{
if (r < 0){
r = 0;
};
if (g < 0){
g = 0;
};
if (b < 0){
b = 0;
};
if (r > 0xFF){
r = 0xFF;
};
if (g > 0xFF){
g = 0xFF;
};
if (b > 0xFF){
b = 0xFF;
};
ct.color = RGB(r, g, b);
if (cen){
x = (80 - (len(t) / 2));
};
bfontpos = 0;
var i:int;
while (i < t.length) {
cur = t.charCodeAt(i);
bfont[cur].colorTransform(bfont_rect, ct);
temptile.copyPixels(bfont[cur], bfont_rect, new Point((x + bfontpos), y));
bfontpos = (bfontpos + bfontlen[cur]);
i++;
};
}
public function print(x:int, y:int, t:String, r:int, g:int, b:int, cen:Boolean=false):void{
if (r < 0){
r = 0;
};
if (g < 0){
g = 0;
};
if (b < 0){
b = 0;
};
if (r > 0xFF){
r = 0xFF;
};
if (g > 0xFF){
g = 0xFF;
};
if (b > 0xFF){
b = 0xFF;
};
ct.color = RGB(r, g, b);
if (cen){
x = (80 - (len(t) / 2));
};
bfontpos = 0;
var i:int;
while (i < t.length) {
cur = t.charCodeAt(i);
bfont[cur].colorTransform(bfont_rect, ct);
backbuffer.copyPixels(bfont[cur], bfont_rect, new Point((x + bfontpos), y));
bfontpos = (bfontpos + bfontlen[cur]);
i++;
};
}
public function drawbuffertile(x:int, y:int, t:int):void{
buffer.copyPixels(tiles[t], tiles_rect, new Point(x, y));
}
public function maketilearray():void{
var i:Number;
var t:BitmapData;
var temprect:Rectangle;
var j:Number = 0;
while (j < 15) {
i = 0;
while (i < 20) {
t = new BitmapData(16, 16, true, 0);
temprect = new Rectangle((i * 16), (j * 16), 16, 16);
t.copyPixels(buffer, temprect, tl);
tiles.push(t);
i++;
};
j++;
};
}
public function addimage():void{
var t:BitmapData = new BitmapData(buffer.width, buffer.height, true, 0);
t.copyPixels(buffer, new Rectangle(0, 0, buffer.width, buffer.height), tl);
images.push(t);
}
public function makebfontmask():void{
var i:Number;
var t:BitmapData;
var temprect:Rectangle;
var j:Number = 0;
while (j < 16) {
i = 0;
while (i < 16) {
t = new BitmapData(9, 9, true, 0);
temprect = new Rectangle((i * 9), (j * 9), 9, 9);
t.copyPixels(buffer, temprect, tl);
bfontmask.push(t);
i++;
};
j++;
};
}
public function drawbackground(t:int):void{
backbuffer.copyPixels(backgrounds[t], bg_rect, tl);
}
public function drawbossmeter(game:gameclass):void{
if (game.hpposition > ((game.currenthp * 120) / game.totalhp)){
game.hpposition = (game.hpposition - 2);
};
if (game.hpposition < ((game.currenthp * 120) / game.totalhp)){
game.hpposition = ((game.currenthp * 120) / game.totalhp);
};
backbuffer.fillRect(new Rectangle(19, 130, 122, 8), 1114884);
backbuffer.fillRect(new Rectangle(20, 131, game.hpposition, 6), 9383213);
}
public function drawtile(x:int, y:int, t:int):void{
backbuffer.copyPixels(tiles[t], tiles_rect, new Point(x, y));
}
}
}//package
Section 25
//entityclass (entityclass)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
public class entityclass extends Sprite {
public var flags:Array;
public var restartcounter:int;
public var temph:int;
public var tempw:int;
public var tempx:int;
public var tempy:int;
public var restartmode:int;
public var temprect:Rectangle;
public var norestartsound:Boolean;
public var entities:Array;
public var onladder:Boolean;
public var nentity:int;
public var temp:int;
public var temp2:int;
public var removeentity:Boolean;
public var restartroom:Boolean;
public var activetrigger:int;
public function entityclass(){
entities = new Array();
flags = new Array();
super();
}
public function updateentities(i:int, help:helpclass, game:gameclass, music:musicclass):Boolean{
var qaz:int;
var wsx:int;
var ti:int;
var tj:int;
var wi:int;
var qqaz:int;
var qwsx:int;
removeentity = false;
if (entities[i].statedelay <= 0){
switch (entities[i].type){
case 0:
if (entities[i].state == 1){
entities[i].state = 2;
qaz = 0;
while (qaz < 2) {
wsx = 0;
while (wsx < 10) {
createentity(((entities[i].xp + 8) + qaz), ((entities[i].yp + 3) + wsx), 30);
wsx++;
};
qaz++;
};
} else {
if (entities[i].state == 2){
entities[i].life--;
if (entities[i].life <= 8){
entities[i].invis = true;
};
entities[i].vx = 0;
entities[i].vy = 0;
};
};
break;
case 1:
if (entities[i].state == 0){
if (entities[i].xp < -30){
entities[i].state = 1;
};
if (entities[i].xp > 190){
entities[i].state = 1;
};
if (entities[i].yp < -30){
entities[i].state = 1;
};
if (entities[i].yp > 174){
entities[i].state = 1;
};
} else {
if (entities[i].state == 1){
removeentity = true;
if (entities[i].vx <= 0){
createentity((entities[i].xp + 1), entities[i].yp, 16, 3, (-(Math.random()) * 2));
} else {
createentity((entities[i].xp + 1), entities[i].yp, 16, -3, (-(Math.random()) * 2));
};
};
};
break;
case 2:
if (entities[i].state == 0){
temp = getplayer();
entities[i].vx = 0;
entities[i].vy = 0;
if ((entities[i].xp + 1) < (entities[temp].xp + 2)){
entities[i].vx = 1;
};
if ((entities[i].xp - 1) > (entities[temp].xp + 2)){
entities[i].vx = -1;
};
if ((entities[i].yp + 1) < (entities[temp].yp + 5)){
entities[i].vy = 1;
};
if ((entities[i].yp - 1) > (entities[temp].yp + 5)){
entities[i].vy = -1;
};
} else {
if (entities[i].state == 1){
game.incenemycount();
flags[entities[i].flag] = 2;
music.playef(5, 50);
createentity(entities[i].xp, entities[i].yp, 3, entities[i].bulletvel, -5);
removeentity = true;
};
};
break;
case 4:
if (entities[i].state == 0){
entities[i].life--;
if (entities[i].life <= 0){
entities[i].state = 1;
};
} else {
if (entities[i].state == 1){
if (entities[i].yp > 30){
if (Math.random() < 0.5){
createentity(entities[i].xp, (entities[i].yp + 5), 5, (Math.random() + 1), -4);
} else {
createentity(entities[i].xp, (entities[i].yp + 5), 5, (-(Math.random()) - 1), -4);
};
};
removeentity = true;
};
};
break;
case 5:
if (entities[i].state == 0){
entities[i].life--;
if (entities[i].life <= 0){
entities[i].state = 2;
};
} else {
if (entities[i].state == 1){
if (!entities[i].bounce){
entities[i].state = 0;
entities[i].life = (entities[i].life - 8);
if (entities[i].life <= 0){
removeentity = true;
};
entities[i].ay = -2;
entities[i].jumping = true;
entities[i].jumpframe = 2;
entities[i].bounce = true;
entities[i].onwall = 0;
} else {
removeentity = true;
};
} else {
if (entities[i].state == 2){
removeentity = true;
};
};
};
break;
case 6:
if (entities[i].state == 1){
temp = getplayer();
entities[i].vx = (entities[i].vx * 0.95);
if (((entities[temp].onground) && (entities[i].onground))){
if ((entities[i].xp + 1) < (entities[temp].xp + 2)){
entities[i].vx = 4;
};
if ((entities[i].xp - 1) > (entities[temp].xp + 2)){
entities[i].vx = -4;
};
entities[i].dir = 1;
if (entities[i].vx > 0){
entities[i].dir = 0;
};
};
entities[i].onxwall = 2;
} else {
if (entities[i].state == 2){
entities[i].vx = 0;
entities[i].state = 1;
entities[i].onxwall = 0;
} else {
if (entities[i].state == 3){
entities[i].hp--;
if (entities[i].hp <= 0){
game.incenemycount();
flags[entities[i].flag] = 2;
music.playef(5, 50);
createentity(entities[i].xp, entities[i].yp, 7, entities[i].bulletvel, -5);
removeentity = true;
} else {
entities[i].vx = entities[i].bulletvel;
entities[i].vy = -5;
entities[i].state = 1;
};
};
};
};
break;
case 9:
if (entities[i].state == 0){
temp = getplayer();
if (Math.abs((entities[i].xp - entities[temp].xp)) < 50){
entities[i].state = 1;
entities[i].tile = 94;
entities[i].drawframe = 94;
entities[i].gravity = true;
};
} else {
if (entities[i].state == 1){
} else {
if (entities[i].state == 2){
temp = getplayer();
entities[i].onywall = 0;
entities[i].onwall = 0;
entities[i].state = 3;
entities[i].tile = 89;
if ((entities[i].xp + 1) < (entities[temp].xp + 2)){
entities[i].state = 4;
};
if ((entities[i].xp - 1) > (entities[temp].xp + 2)){
entities[i].state = 3;
};
} else {
if (entities[i].state == 3){
entities[i].onxwall = 4;
entities[i].vx = -2;
entities[i].dir = 1;
if (entities[i].xp < 0){
entities[i].state = 4;
};
} else {
if (entities[i].state == 4){
entities[i].onxwall = 3;
entities[i].vx = 2;
entities[i].dir = 0;
if (entities[i].xp > 145){
entities[i].state = 3;
};
} else {
if (entities[i].state == 10){
game.incenemycount();
flags[entities[i].flag] = 2;
music.playef(5, 50);
createentity(entities[i].xp, entities[i].yp, 10, entities[i].bulletvel, -5);
removeentity = true;
};
};
};
};
};
};
break;
case 11:
if (entities[i].state == 0){
temp = getplayer();
if (Math.abs((entities[i].xp - entities[temp].xp)) < 25){
entities[i].state = 1;
entities[i].gravity = true;
};
} else {
if (entities[i].state == 1){
entities[i].yp++;
} else {
if (entities[i].state == 2){
createentity((entities[i].xp + 2), (entities[i].yp + 13), 5, Math.random(), -8);
createentity((entities[i].xp + 2), (entities[i].yp + 13), 5, -(Math.random()), -8);
createentity((entities[i].xp + 2), (entities[i].yp + 13), 5, (Math.random() + 1), -6);
createentity((entities[i].xp + 2), (entities[i].yp + 13), 5, (-(Math.random()) - 1), -6);
music.playef(7, 50);
removeentity = true;
};
};
};
break;
case 12:
if (entities[i].state == 0){
temp = getplayer();
if (Math.abs((entities[i].xp - entities[temp].xp)) < 100){
if (Math.abs((entities[i].yp - entities[temp].yp)) < 50){
entities[i].onywall = 2;
};
};
} else {
if (entities[i].state == 2){
entities[i].onywall = 0;
entities[i].vx = (entities[i].vx * 0.4);
entities[i].state = 3;
entities[i].statedelay = 6;
} else {
if (entities[i].state == 3){
entities[i].onywall = 2;
entities[i].state = 1;
entities[i].ay = (-4 - (Math.random() * 5));
entities[i].jumping = true;
entities[i].jumpframe = (7 + (Math.random() * 6));
temp = getplayer();
if ((entities[i].xp + 1) < (entities[temp].xp + 2)){
entities[i].vx = 2;
};
if ((entities[i].xp - 1) > (entities[temp].xp + 2)){
entities[i].vx = -2;
};
} else {
if (entities[i].state == 10){
entities[i].hp--;
if (entities[i].hp <= 0){
game.incenemycount();
music.playef(14);
flags[entities[i].flag] = 2;
if (entities[i].vx <= 0){
createentity(entities[i].xp, entities[i].yp, 13, entities[i].bulletvel, -5);
};
if (entities[i].vx > 0){
createentity(entities[i].xp, entities[i].yp, 14, entities[i].bulletvel, -5);
};
removeentity = true;
} else {
music.playef(5);
entities[i].vx = entities[i].bulletvel;
entities[i].vy = -1;
entities[i].state = 1;
entities[i].onywall = 2;
};
};
};
};
};
break;
case 15:
if (entities[i].state == 0){
if (entities[i].xp < -10){
removeentity = true;
};
if (entities[i].xp > 170){
removeentity = true;
};
if (entities[i].yp < -10){
removeentity = true;
};
if (entities[i].yp > 154){
removeentity = true;
};
if (entities[i].vx < -0.5){
if ((((Math.random() < 0.9)) && ((nentity < 40)))){
createentity((entities[i].xp + 4), (entities[i].yp + 1), 16, Math.random(), -(Math.random()));
};
if (Math.random() < 0.9){
createentity((entities[i].xp + 4), (entities[i].yp + 4), 16, Math.random(), -(Math.random()));
};
} else {
if (entities[i].vx > 0.5){
if ((((Math.random() < 0.9)) && ((nentity < 40)))){
createentity((entities[i].xp - 2), (entities[i].yp + 1), 16, Math.random(), -(Math.random()));
};
if (Math.random() < 0.9){
createentity((entities[i].xp - 2), (entities[i].yp + 4), 16, Math.random(), -(Math.random()));
};
} else {
if ((((Math.random() < 0.9)) && ((nentity < 40)))){
createentity((entities[i].xp + 2), (entities[i].yp + 1), 16, (0.5 - Math.random()), -(Math.random()));
};
if (Math.random() < 0.9){
createentity((entities[i].xp + 3), (entities[i].yp + 1), 16, (0.5 - Math.random()), -(Math.random()));
};
};
};
} else {
if (entities[i].state == 1){
removeentity = true;
};
};
break;
case 17:
if (entities[i].state == 0){
if (!entities[i].roar){
music.playef(11);
entities[i].roar = true;
};
temp = getplayer();
entities[i].onbullet = 10;
entities[i].state = 1;
entities[i].vx = 0;
if ((entities[i].xp + 1) < (entities[temp].xp + 2)){
entities[i].state = 2;
};
if ((entities[i].xp - 1) > (entities[temp].xp + 2)){
entities[i].state = 1;
};
entities[i].statedelay = 10;
} else {
if (entities[i].state == 1){
entities[i].onxwall = 2;
entities[i].vx = -1;
entities[i].dir = 1;
if (entities[i].xp < 0){
entities[i].state = 2;
};
temp = getplayer();
if (Math.abs((entities[i].yp - entities[temp].yp)) < 30){
entities[i].charge--;
if (entities[i].charge <= 0){
entities[i].state = 3;
};
};
} else {
if (entities[i].state == 2){
entities[i].onxwall = 1;
entities[i].vx = 1;
entities[i].dir = 0;
if (entities[i].xp > 135){
entities[i].state = 1;
};
temp = getplayer();
if (Math.abs((entities[i].yp - entities[temp].yp)) < 30){
entities[i].charge--;
if (entities[i].charge <= 0){
entities[i].state = 3;
};
};
} else {
if (entities[i].state == 3){
entities[i].charge = 40;
entities[i].state = 4;
entities[i].vx = 0;
temp = getplayer();
if ((entities[i].xp + 1) < (entities[temp].xp + 2)){
entities[i].dir = 0;
};
if ((entities[i].xp - 1) > (entities[temp].xp + 2)){
entities[i].dir = 1;
};
} else {
if (entities[i].state == 4){
entities[i].state = 0;
entities[i].statedelay = 5;
if (entities[i].dir == 1){
createentity((entities[i].xp - 5), (entities[i].yp + 14), 15, -4, (0.5 - Math.random()));
};
if (entities[i].dir == 0){
createentity((entities[i].xp + 5), (entities[i].yp + 14), 15, 4, (0.5 - Math.random()));
};
music.playef(8);
} else {
if (entities[i].state == 10){
entities[i].hp--;
if (entities[i].hp <= 0){
game.incenemycount();
flags[entities[i].flag] = 2;
music.playef(13);
music.playef(8);
createentity(entities[i].xp, (entities[i].yp + 14), 15, -2, -1);
createentity(entities[i].xp, (entities[i].yp + 14), 15, -1, -2);
createentity(entities[i].xp, (entities[i].yp + 14), 15, 0, -2.4);
createentity(entities[i].xp, (entities[i].yp + 14), 15, 2, -1);
createentity(entities[i].xp, (entities[i].yp + 14), 15, 1, -2);
removeentity = true;
game.screenshake = 10;
} else {
music.playef(14);
entities[i].vx = 0;
entities[i].state = 3;
createentity(((entities[i].xp + 6) + (Math.random() * 24)), ((entities[i].yp + 6) + (Math.random() * 16)), 29);
createentity(((entities[i].xp + 6) + (Math.random() * 24)), ((entities[i].yp + 6) + (Math.random() * 16)), 29);
createentity(((entities[i].xp + 6) + (Math.random() * 24)), ((entities[i].yp + 6) + (Math.random() * 16)), 29);
createentity(((entities[i].xp + 6) + (Math.random() * 24)), ((entities[i].yp + 6) + (Math.random() * 16)), 29);
createentity(((entities[i].xp + 6) + (Math.random() * 24)), ((entities[i].yp + 6) + (Math.random() * 16)), 29);
createentity(((entities[i].xp + 6) + (Math.random() * 24)), ((entities[i].yp + 6) + (Math.random() * 16)), 29);
createentity(((entities[i].xp + 6) + (Math.random() * 24)), ((entities[i].yp + 6) + (Math.random() * 16)), 29);
createentity(((entities[i].xp + 6) + (Math.random() * 24)), ((entities[i].yp + 6) + (Math.random() * 16)), 29);
createentity(((entities[i].xp + 6) + (Math.random() * 24)), ((entities[i].yp + 6) + (Math.random() * 16)), 29);
createentity(((entities[i].xp + 6) + (Math.random() * 24)), ((entities[i].yp + 6) + (Math.random() * 16)), 29);
createentity(((entities[i].xp + 6) + (Math.random() * 24)), ((entities[i].yp + 6) + (Math.random() * 16)), 29);
};
};
};
};
};
};
};
break;
case 19:
if (entities[i].state == 0){
entities[i].state = 1;
} else {
if (entities[i].state == 1){
entities[i].onywall = 2;
entities[i].vy = 4;
if (entities[i].yp > 128){
entities[i].state = 2;
};
} else {
if (entities[i].state == 2){
entities[i].onywall = 1;
entities[i].vy = -4;
if (entities[i].yp <= 0){
entities[i].state = 1;
};
} else {
if (entities[i].state == 3){
removeentity = true;
};
};
};
};
break;
case 20:
if (entities[i].state == 0){
entities[i].state = 1;
} else {
if (entities[i].state == 1){
entities[i].onxwall = 2;
entities[i].vx = 4;
if (entities[i].xp > 144){
entities[i].state = 2;
};
} else {
if (entities[i].state == 2){
entities[i].onxwall = 1;
entities[i].vx = -4;
if (entities[i].xp <= 0){
entities[i].state = 1;
};
} else {
if (entities[i].state == 3){
removeentity = true;
};
};
};
};
break;
case 21:
if (entities[i].state == 0){
entities[i].state = 1;
} else {
if (entities[i].state == 1){
entities[i].onxwall = 2;
entities[i].onywall = 0;
entities[i].vx = 3;
entities[i].vy = 0;
if (entities[i].xp > 151){
entities[i].state = 2;
};
} else {
if (entities[i].state == 2){
entities[i].onxwall = 0;
entities[i].onywall = 3;
entities[i].vx = 0;
entities[i].vy = 3;
if (entities[i].yp > 135){
entities[i].state = 3;
};
} else {
if (entities[i].state == 3){
entities[i].onxwall = 4;
entities[i].onywall = 0;
entities[i].vx = -3;
entities[i].vy = 0;
if (entities[i].xp <= 0){
entities[i].state = 4;
};
} else {
if (entities[i].state == 4){
entities[i].onxwall = 0;
entities[i].onywall = 1;
entities[i].vx = 0;
entities[i].vy = -3;
if (entities[i].yp <= 0){
entities[i].state = 1;
};
} else {
if (entities[i].state == 10){
removeentity = true;
};
};
};
};
};
};
break;
case 22:
if (entities[i].state == 0){
entities[i].framedelay++;
if (entities[i].framedelay > 90){
entities[i].state = 1;
};
} else {
if (entities[i].state == 1){
createentity((entities[i].xp + 2), (entities[i].yp - 4), 18, 0, 0);
music.playef(8);
entities[i].state = 0;
entities[i].framedelay = 0;
};
};
break;
case 23:
if (entities[i].state == 0){
game.removeblockat(help, entities[i].xp, entities[i].yp);
game.createblock(entities[i].xp, entities[i].yp, entities[i].cw, entities[i].ch);
entities[i].state = 1;
entities[i].invis = false;
entities[i].tile = 33;
entities[i].drawframe = 33;
} else {
if (entities[i].state == 1){
entities[i].framedelay++;
if (entities[i].framedelay > 60){
entities[i].state = 2;
};
} else {
if (entities[i].state == 2){
entities[i].state = 3;
entities[i].statedelay = 5;
entities[i].tile = 34;
entities[i].drawframe = 34;
} else {
if (entities[i].state == 3){
entities[i].state = 4;
entities[i].statedelay = 5;
entities[i].tile = 35;
entities[i].drawframe = 35;
} else {
if (entities[i].state == 4){
entities[i].framedelay = 0;
entities[i].state = 5;
entities[i].statedelay = 5;
entities[i].tile = 36;
entities[i].drawframe = 36;
} else {
if (entities[i].state == 5){
entities[i].invis = true;
game.removeblockat(help, entities[i].xp, entities[i].yp);
entities[i].framedelay++;
if (entities[i].framedelay > 45){
entities[i].state = 6;
};
} else {
if (entities[i].state == 6){
game.createblock(entities[i].xp, entities[i].yp, entities[i].cw, entities[i].ch);
entities[i].invis = false;
entities[i].framedelay = 0;
entities[i].tile = 36;
entities[i].drawframe = 36;
entities[i].state = 7;
entities[i].statedelay = 5;
} else {
if (entities[i].state == 7){
entities[i].state = 8;
entities[i].statedelay = 5;
entities[i].tile = 35;
entities[i].drawframe = 35;
} else {
if (entities[i].state == 8){
entities[i].state = 0;
entities[i].statedelay = 5;
entities[i].tile = 34;
entities[i].drawframe = 34;
};
};
};
};
};
};
};
};
};
break;
case 24:
if (entities[i].state == 0){
game.createblock(entities[i].xp, (entities[i].yp + 1), entities[i].cw, entities[i].ch);
entities[i].state = 1;
} else {
if (entities[i].state == 1){
} else {
if (entities[i].state == 2){
entities[i].onplayer = 0;
music.playef(9);
entities[i].state = 3;
entities[i].statedelay = 5;
entities[i].tile = 53;
entities[i].drawframe = 53;
createentity(((entities[i].xp + 4) + (Math.random() * 4)), (entities[i].yp + 4), 5, 0, (1 + (Math.random() * 2)));
createentity(((entities[i].xp + 8) + (Math.random() * 4)), (entities[i].yp + 4), 5, 0, (1 + (Math.random() * 2)));
} else {
if (entities[i].state == 3){
entities[i].onplayer = 0;
entities[i].state = 4;
entities[i].statedelay = 5;
entities[i].tile = 54;
entities[i].drawframe = 54;
createentity((entities[i].xp + (Math.random() * 4)), (entities[i].yp + 4), 5, 0, (1 + (Math.random() * 2)));
createentity(((entities[i].xp + 12) + (Math.random() * 4)), (entities[i].yp + 4), 5, 0, (1 + (Math.random() * 2)));
} else {
if (entities[i].state == 4){
entities[i].state = 5;
entities[i].statedelay = 5;
entities[i].tile = 55;
entities[i].drawframe = 55;
createentity(((entities[i].xp + 4) + (Math.random() * 4)), (entities[i].yp + 5), 5, 0, (1 + (Math.random() * 2)));
createentity(((entities[i].xp + 8) + (Math.random() * 4)), (entities[i].yp + 5), 5, 0, (1 + (Math.random() * 2)));
} else {
if (entities[i].state == 5){
entities[i].framedelay = 0;
entities[i].state = 6;
entities[i].statedelay = 5;
entities[i].tile = 56;
entities[i].drawframe = 56;
createentity((entities[i].xp + (Math.random() * 4)), (entities[i].yp + 5), 5, 0, (1 + (Math.random() * 2)));
createentity(((entities[i].xp + 12) + (Math.random() * 4)), (entities[i].yp + 5), 5, 0, (1 + (Math.random() * 2)));
} else {
if (entities[i].state == 6){
game.removeblockat(help, entities[i].xp, (entities[i].yp + 1));
removeentity = true;
createentity((entities[i].xp + (Math.random() * 4)), (entities[i].yp + 4), 5, 0, (1 + (Math.random() * 2)));
createentity(((entities[i].xp + 4) + (Math.random() * 4)), (entities[i].yp + 4), 5, 0, (1 + (Math.random() * 2)));
createentity(((entities[i].xp + 8) + (Math.random() * 4)), (entities[i].yp + 4), 5, 0, (1 + (Math.random() * 2)));
createentity(((entities[i].xp + 12) + (Math.random() * 4)), (entities[i].yp + 4), 5, 0, (1 + (Math.random() * 2)));
};
};
};
};
};
};
};
break;
case 26:
if (entities[i].state == 0){
entities[i].harmdelay = 0;
entities[i].onbullet = 10;
if (entities[i].onground){
entities[i].vx = (entities[i].vx * 0.2);
};
if (entities[i].hp == 3){
entities[i].attackdelay--;
entities[i].onywall = 0;
if (entities[i].attackdelay <= 0){
entities[i].onywall = 3;
entities[i].attackdelay = 25;
};
} else {
if (entities[i].hp == 2){
entities[i].attackdelay--;
entities[i].onywall = 0;
if (entities[i].attackdelay <= 0){
entities[i].onywall = 4;
entities[i].attackdelay = 20;
};
} else {
temp = getplayer();
if (((entities[i].onground) && ((entities[i].attackdelay <= 6)))){
if ((entities[i].xp - entities[temp].xp) > 0){
entities[i].dir = 1;
} else {
entities[i].dir = 0;
};
};
entities[i].attackdelay--;
entities[i].onywall = 0;
if (entities[i].attackdelay <= 0){
entities[i].onywall = 4;
entities[i].attackdelay = 30;
};
};
};
} else {
if (entities[i].state == 1){
if ((((entities[i].vx < -1)) && ((entities[i].xp < 10)))){
entities[i].vx = -(entities[i].vx);
entities[i].dir = 0;
};
if ((((entities[i].vx > 1)) && ((entities[i].xp > 135)))){
entities[i].vx = -(entities[i].vx);
entities[i].dir = 1;
};
} else {
if (entities[i].state == 2){
entities[i].onywall = 0;
entities[i].state = 0;
} else {
if (entities[i].state == 3){
if ((Math.random() * 100) > 50){
if ((Math.random() * 100) > 80){
music.playef(10);
} else {
music.playef(21);
};
};
entities[i].onywall = 2;
entities[i].state = 1;
entities[i].ay = -6;
entities[i].jumping = true;
entities[i].jumpframe = 8;
temp = getplayer();
if ((entities[i].xp + 1) < (entities[temp].xp + 2)){
entities[i].vx = 2;
};
if ((entities[i].xp - 1) > (entities[temp].xp + 2)){
entities[i].vx = -2;
};
entities[i].dir = 0;
if (entities[i].vx < 0){
entities[i].dir = 1;
};
} else {
if (entities[i].state == 4){
if ((Math.random() * 100) > 50){
if ((Math.random() * 100) > 80){
music.playef(10);
} else {
music.playef(21);
};
};
entities[i].onywall = 2;
entities[i].state = 1;
entities[i].ay = -6;
if (entities[i].hp == 1){
entities[i].ay = -2;
};
entities[i].jumping = true;
entities[i].jumpframe = 8;
temp = getplayer();
if ((entities[i].xp + 1) < (entities[temp].xp + 2)){
entities[i].vx = 3;
};
if ((entities[i].xp - 1) > (entities[temp].xp + 2)){
entities[i].vx = -3;
};
if (entities[i].hp == 1){
if ((entities[i].xp + 1) < (entities[temp].xp + 2)){
entities[i].vx = 4;
};
if ((entities[i].xp - 1) > (entities[temp].xp + 2)){
entities[i].vx = -4;
};
};
entities[i].dir = 0;
if (entities[i].vx < 0){
entities[i].dir = 1;
};
} else {
if (entities[i].state == 8){
entities[i].onbullet = 0;
entities[i].harmdelay--;
if (entities[i].onground){
entities[i].vx = (entities[i].vx * 0.2);
};
entities[i].oxp = entities[i].xp;
entities[i].oyp = entities[i].yp;
entities[i].xp = ((entities[i].oxp + (Math.random() * 2)) - 1);
entities[i].yp = (entities[i].oyp - Math.random());
if (entities[i].harmdelay == 80){
music.playef(13);
game.flashlight = 4;
};
if (entities[i].harmdelay == 40){
music.playef(13);
game.flashlight = 4;
};
if (entities[i].harmdelay == 20){
music.playef(13);
game.flashlight = 4;
};
if (entities[i].harmdelay == 2){
music.playef(13);
game.flashlight = 4;
};
createentity(((entities[i].xp + 2) + (Math.random() * 10)), ((entities[i].yp + 6) + (Math.random() * 3)), 29);
createentity(((entities[i].xp + 2) + (Math.random() * 10)), ((entities[i].yp + 6) + (Math.random() * 3)), 29);
if (entities[i].harmdelay <= 0){
flags[entities[i].flag] = 2;
ti = 0;
while (ti < 6) {
tj = 0;
while (tj < 4) {
createentity(((entities[i].xp + 2) + (ti * 2)), ((entities[i].yp + 2) + (tj * 3)), 29);
tj++;
};
ti++;
};
game.flashlight = 4;
game.state = 12;
removeentity = true;
music.playef(14);
};
} else {
if (entities[i].state == 9){
entities[i].onbullet = 0;
entities[i].harmdelay--;
if (entities[i].onground){
entities[i].vx = (entities[i].vx * 0.2);
};
entities[i].oxp = entities[i].xp;
entities[i].oyp = entities[i].yp;
entities[i].xp = ((entities[i].oxp + (Math.random() * 2)) - 1);
entities[i].yp = (entities[i].oyp - Math.random());
createentity(((entities[i].xp + 2) + (Math.random() * 10)), ((entities[i].yp + 6) + (Math.random() * 3)), 29);
if (entities[i].harmdelay <= 0){
entities[i].state = 0;
entities[i].harmdelay = 0;
entities[i].attackdelay = 15;
temp = getplayer();
if (entities[i].onground){
if ((entities[i].xp - entities[temp].xp) > 0){
entities[i].dir = 1;
} else {
entities[i].dir = 0;
};
};
};
} else {
if (entities[i].state == 10){
if ((((((entities[i].dir == 1)) && ((entities[i].bulletvel < 0)))) || ((((entities[i].dir == 0)) && ((entities[i].bulletvel > 0)))))){
entities[i].harmdelay = 45;
entities[i].hp--;
game.currenthp--;
game.flashlight = 4;
game.screenshake = 45;
if (entities[i].hp <= 0){
game.incenemycount();
music.playef(12);
entities[i].vx = entities[i].bulletvel;
entities[i].vy = -1;
entities[i].state = 8;
entities[i].onywall = 0;
entities[i].harmdelay = 120;
game.screenshake = 120;
music.fadeout();
entities[i].harmful = false;
} else {
if (entities[i].hp == 2){
music.playef(11);
} else {
music.playef(11);
};
entities[i].vx = entities[i].bulletvel;
entities[i].vy = -1;
entities[i].state = 9;
entities[i].onywall = 0;
};
} else {
music.playef(22);
entities[i].state = 0;
};
};
};
};
};
};
};
};
};
break;
case 27:
if (entities[i].state == 0){
music.play(2);
if (!entities[i].roar){
music.playef(16);
entities[i].roar = true;
};
entities[i].xp = 90;
entities[i].yp = 30;
if (entities[i].framedelay <= 0){
entities[i].tile = 180;
};
entities[i].harmdelay = 0;
entities[i].onbullet = 100;
if (entities[i].hp >= 5){
entities[i].attackdelay--;
if (entities[i].attackdelay <= 0){
entities[i].attackdelay = 60;
temp = (Math.random() * 40);
if (temp < 10){
entities[i].state = 1;
} else {
temp = (temp - 10);
if (temp < 10){
entities[i].state = 3;
} else {
temp = (temp - 10);
if (temp < 10){
entities[i].state = 5;
} else {
entities[i].state = 6;
};
};
};
};
} else {
if (entities[i].hp == 4){
entities[i].attackdelay--;
if (entities[i].attackdelay <= 0){
entities[i].attackdelay = 55;
temp = (Math.random() * 40);
if (temp < 10){
entities[i].state = 2;
} else {
temp = (temp - 10);
if (temp < 10){
entities[i].state = 3;
} else {
temp = (temp - 10);
if (temp < 10){
entities[i].state = 6;
} else {
entities[i].state = 5;
};
};
};
};
} else {
if (entities[i].hp == 3){
entities[i].attackdelay--;
if (entities[i].attackdelay <= 0){
entities[i].attackdelay = 50;
temp = (Math.random() * 40);
if (temp < 10){
entities[i].state = 7;
} else {
temp = (temp - 10);
if (temp < 10){
entities[i].state = 8;
} else {
temp = (temp - 10);
if (temp < 10){
entities[i].state = 3;
} else {
entities[i].state = 2;
};
};
};
};
} else {
if (entities[i].hp == 2){
entities[i].attackdelay--;
if (entities[i].attackdelay <= 0){
entities[i].attackdelay = 50;
temp = (Math.random() * 40);
if (temp < 10){
entities[i].state = 9;
} else {
temp = (temp - 10);
if (temp < 10){
entities[i].state = 10;
} else {
temp = (temp - 10);
if (temp < 10){
entities[i].state = 11;
} else {
entities[i].state = 4;
};
};
};
};
} else {
if (entities[i].hp == 1){
entities[i].attackdelay--;
if (entities[i].attackdelay <= 0){
entities[i].attackdelay = 50;
temp = (Math.random() * 40);
if (temp < 10){
entities[i].state = 1;
} else {
temp = (temp - 10);
if (temp < 10){
entities[i].state = 2;
} else {
temp = (temp - 10);
if (temp < 10){
entities[i].state = 12;
} else {
entities[i].state = 10;
};
};
};
};
};
};
};
};
};
} else {
if (entities[i].state == 1){
entities[i].tile = (180 + 8);
entities[i].framedelay = 15;
entities[i].state = 0;
temp = (Math.random() * 40);
if (temp < 10){
createentity(25, 0, 11);
} else {
temp = (temp - 10);
if (temp < 10){
createentity(42, 0, 11);
} else {
temp = (temp - 10);
if (temp < 10){
createentity(65, 0, 11);
} else {
createentity(90, 0, 11);
};
};
};
} else {
if (entities[i].state == 2){
entities[i].tile = (180 + 4);
entities[i].framedelay = 15;
entities[i].state = 0;
temp = (Math.random() * 30);
if (temp < 10){
createentity(60, -10, 9);
} else {
temp = (temp - 10);
if (temp < 10){
createentity(60, -10, 9);
} else {
createentity(60, -10, 9);
};
};
} else {
if (entities[i].state == 3){
entities[i].tile = (180 + 4);
entities[i].framedelay = 15;
entities[i].state = 0;
temp = (Math.random() * 20);
if (temp < 10){
createentity(128, 30, 2);
} else {
createentity(138, 60, 2);
};
} else {
if (entities[i].state == 4){
entities[i].tile = (180 + 4);
entities[i].framedelay = 15;
entities[i].state = 0;
createentity(70, -10, 9);
createentity(80, -20, 9);
createentity(90, -10, 9);
} else {
if (entities[i].state == 5){
if (entities[i].framedelay < 5){
entities[i].tile = (180 + 12);
entities[i].framedelay = 15;
entities[i].state = 0;
createentity(105, 80, 15, -3, 0);
music.playef(8);
};
} else {
if (entities[i].state == 6){
if (entities[i].framedelay < 5){
entities[i].tile = (180 + 8);
entities[i].framedelay = 15;
entities[i].state = 0;
createentity(95, 60, 15, -3, 0);
music.playef(8);
};
} else {
if (entities[i].state == 7){
entities[i].tile = (180 + 12);
entities[i].framedelay = 15;
entities[i].state = 6;
entities[i].statedelay = 10;
createentity(105, 80, 15, -3, 0);
music.playef(8);
} else {
if (entities[i].state == 8){
entities[i].tile = (180 + 8);
entities[i].framedelay = 15;
entities[i].state = 5;
entities[i].statedelay = 10;
createentity(95, 60, 15, -3, 0);
music.playef(8);
} else {
if (entities[i].state == 9){
if (entities[i].framedelay < 5){
entities[i].tile = (180 + 4);
entities[i].framedelay = 15;
entities[i].state = 0;
createentity(95, 40, 15, -2, 0);
createentity(95, 40, 15, -2, 1);
createentity(95, 40, 15, -1.6, 1.6);
createentity(95, 40, 15, -1, 2);
createentity(95, 40, 15, 0, 2);
music.playef(8);
};
} else {
if (entities[i].state == 10){
if (entities[i].framedelay < 5){
entities[i].tile = (180 + 8);
entities[i].framedelay = 15;
entities[i].state = 0;
createentity(93, 60, 15, 0, -2);
createentity(93, 60, 15, -1.6, -1.6);
createentity(93, 60, 15, -2, 0);
createentity(93, 60, 15, -1.6, 1.6);
createentity(93, 60, 15, 0, 2);
music.playef(8);
};
} else {
if (entities[i].state == 11){
if (entities[i].framedelay < 5){
entities[i].tile = (180 + 12);
entities[i].framedelay = 15;
entities[i].state = 0;
createentity(105, 80, 15, 0, -2);
createentity(105, 80, 15, -1, -2);
createentity(105, 80, 15, -1.6, -1.6);
createentity(105, 80, 15, -2, -1);
createentity(105, 80, 15, -2, 0);
music.playef(8);
};
} else {
if (entities[i].state == 12){
if (entities[i].framedelay < 5){
entities[i].tile = (180 + 4);
entities[i].framedelay = 15;
entities[i].state = 11;
createentity(95, 40, 15, -2, 0);
createentity(95, 40, 15, -2, 1);
createentity(95, 40, 15, -1.6, 1.6);
createentity(95, 40, 15, -1, 2);
createentity(95, 40, 15, 0, 2);
music.playef(8);
};
} else {
if (entities[i].state == 80){
entities[i].onbullet = 0;
entities[i].harmdelay--;
entities[i].xp = ((90 + (Math.random() * 8)) - 4);
entities[i].yp = (30 - (Math.random() * 4));
if (entities[i].harmdelay == 80){
music.playef(13);
game.flashlight = 4;
};
if (entities[i].harmdelay == 40){
music.playef(13);
game.flashlight = 4;
};
if (entities[i].harmdelay == 20){
music.playef(13);
game.flashlight = 4;
};
if (entities[i].harmdelay == 2){
music.playef(13);
game.flashlight = 45;
};
createentity(((entities[i].xp + 28) + (Math.random() * 30)), ((entities[i].yp + 36) + (Math.random() * 3)), 29);
createentity(((entities[i].xp + 28) + (Math.random() * 30)), ((entities[i].yp + 36) + (Math.random() * 3)), 29);
if (entities[i].harmdelay <= 0){
game.flashlight = 10;
game.bg = 59;
game.state = 13;
removeentity = true;
music.playef(14);
};
} else {
if (entities[i].state == 90){
entities[i].onbullet = 0;
entities[i].harmdelay--;
entities[i].xp = ((90 + Math.random()) - 0.5);
entities[i].yp = (30 - Math.random());
createentity(((entities[i].xp + 28) + (Math.random() * 30)), ((entities[i].yp + 36) + (Math.random() * 3)), 29);
if (entities[i].harmdelay <= 0){
entities[i].state = 0;
entities[i].harmdelay = 0;
entities[i].attackdelay = 0;
};
} else {
if (entities[i].state == 100){
entities[i].tile = (180 + 16);
entities[i].framedelay = 45;
entities[i].harmdelay = 45;
entities[i].hp--;
game.currenthp--;
game.flashlight = 4;
game.screenshake = 45;
if (entities[i].hp <= 0){
music.fadeout();
music.playef(18);
entities[i].state = 80;
entities[i].harmdelay = 120;
entities[i].framedelay = 120;
game.createblock(100, -10, 5, 110);
game.screenshake = 120;
while (wi < nentity) {
if (entities[wi].type == 9){
entities[wi].state = 10;
} else {
if (entities[wi].type == 2){
entities[wi].state = 1;
};
};
wi++;
};
} else {
music.playef(17);
entities[i].state = 90;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
break;
case 28:
if (entities[i].state == 0){
if (game.eurydicemode){
temp = getplayer();
entities[i].vx = (entities[i].vx * 0.75);
if (entities[i].xp > (entities[temp].xp + 20)){
entities[i].vx = -2;
};
if (entities[i].xp < (entities[temp].xp + 12)){
entities[i].vx = 2;
};
entities[i].vy = (entities[i].vy * 0.75);
if (entities[i].yp > (entities[temp].yp - 4)){
entities[i].vy = -2;
};
if (entities[i].yp < (entities[temp].yp - 12)){
entities[i].vy = 2;
};
};
} else {
if (entities[i].state == 1){
music.playef(19);
entities[i].state = 2;
qqaz = 0;
while (qqaz < 2) {
qwsx = 0;
while (qwsx < 10) {
createentity(((entities[i].xp + 8) + qqaz), ((entities[i].yp + 3) + qwsx), 30);
qwsx++;
};
qqaz++;
};
} else {
if (entities[i].state == 2){
entities[i].drawframe = 19;
entities[i].life--;
if (entities[i].life <= 8){
entities[i].invis = true;
};
entities[i].vx = 0;
entities[i].vy = 0;
};
};
};
break;
case 29:
if (entities[i].state == 0){
entities[i].yp = (entities[i].yp - 3);
entities[i].xp = (entities[i].xp + ((Math.random() * 6) - 3));
entities[i].life--;
if (entities[i].life <= 0){
entities[i].state = 1;
};
} else {
if (entities[i].state == 1){
removeentity = true;
};
};
break;
case 30:
if (entities[i].state == 0){
entities[i].yp = (entities[i].yp - 1);
entities[i].xp = (entities[i].xp + ((Math.random() * 4) - 1));
entities[i].life--;
if (entities[i].life <= 0){
entities[i].state = 1;
};
} else {
if (entities[i].state == 1){
removeentity = true;
};
};
break;
};
} else {
entities[i].statedelay--;
if (entities[i].statedelay < 0){
entities[i].statedelay = 0;
};
};
if (removeentity){
help.removeObject(entities[i], entities);
nentity--;
return (false);
};
return (true);
}
public function init():void{
var t:int;
restartroom = false;
norestartsound = false;
nentity = 0;
var i:Number = 0;
while (i < 300) {
t = 0;
flags.push(t);
i++;
};
}
public function gettype(t:int):Boolean{
var i:int;
i = 0;
while (i < nentity) {
if (entities[i].type == t){
return (true);
};
i++;
};
return (false);
}
public function resetflags():void{
var i:Number = 0;
while (i < 300) {
if (flags[i] == 2){
flags[i] = 0;
};
i++;
};
}
public function changeflag(t:int, s:int):void{
flags[t] = s;
}
public function removeentitytype(help:helpclass, t:int):void{
var i:int;
while (i < nentity) {
if (entities[i].type == t){
removeanentity(help, i);
i--;
};
i++;
};
}
public function animateentities(i:int, help:helpclass, game:gameclass):void{
if (entities[i].statedelay <= 0){
switch (entities[i].type){
case 0:
entities[i].framedelay--;
if (entities[i].dir == 1){
entities[i].drawframe = 0;
} else {
entities[i].drawframe = 20;
};
if ((((((((((((game.shotdelay > 0)) && ((entities[i].pickupmode == 0)))) && (entities[i].onground))) && ((entities[i].vx == 0)))) && (!(onladder)))) && ((entities[i].bigfallframe == 0)))){
if (game.isshooting){
if (entities[i].dir == 1){
entities[i].drawframe = 37;
} else {
entities[i].drawframe = 38;
};
};
};
if (entities[i].pickupmode == 0){
if (((!((entities[i].vx == 0))) && (entities[i].onground))){
if (entities[i].framedelay <= 0){
entities[i].framedelay = 2;
entities[i].walkingframe++;
if (entities[i].walkingframe > 8){
entities[i].walkingframe = 0;
};
};
entities[i].drawframe = (entities[i].drawframe + (entities[i].walkingframe + 1));
};
if (!entities[i].onground){
if (entities[i].jumping){
entities[i].drawframe = (entities[i].drawframe + 1);
} else {
entities[i].drawframe = (entities[i].drawframe + 2);
};
} else {
if (onladder){
if (entities[i].dir == 1){
entities[i].drawframe = 12;
} else {
entities[i].drawframe = 32;
};
} else {
if (entities[i].bigfallframe > 0){
if (entities[i].bigfallframe == 4){
entities[i].bigfallframe = 3;
entities[i].bigfallframedelay = 2;
};
entities[i].bigfallframedelay--;
if (entities[i].bigfallframedelay <= 0){
entities[i].bigfallframedelay = 3;
entities[i].bigfallframe--;
};
if (entities[i].bigfallframe > 0){
if (entities[i].dir == 1){
if (entities[i].bigfallframe == 3){
entities[i].drawframe = 10;
};
if (entities[i].bigfallframe == 2){
entities[i].drawframe = 11;
};
if (entities[i].bigfallframe == 1){
entities[i].drawframe = 10;
};
} else {
if (entities[i].bigfallframe == 3){
entities[i].drawframe = 30;
};
if (entities[i].bigfallframe == 2){
entities[i].drawframe = 31;
};
if (entities[i].bigfallframe == 1){
entities[i].drawframe = 30;
};
};
};
};
};
};
} else {
if (entities[i].pickupmode == 1){
if (entities[i].framedelay <= 0){
entities[i].framedelay = 2;
entities[i].pickupframe++;
if (entities[i].pickupframe > 2){
entities[i].pickupframe = 2;
entities[i].pickupmode = 2;
};
};
entities[i].drawframe = (14 + entities[i].pickupframe);
} else {
if (entities[i].pickupmode == 2){
if (entities[i].framedelay <= 0){
entities[i].framedelay = 2;
entities[i].pickupframe--;
if (entities[i].pickupframe < 0){
entities[i].pickupframe = 0;
entities[i].pickupmode = 0;
};
};
entities[i].drawframe = (14 + entities[i].pickupframe);
};
};
};
break;
case 2:
entities[i].framedelay--;
entities[i].drawframe = entities[i].tile;
if (entities[i].framedelay <= 0){
entities[i].framedelay = 2;
entities[i].walkingframe++;
if (entities[i].walkingframe > 3){
entities[i].walkingframe = 0;
};
};
entities[i].drawframe = (entities[i].drawframe + entities[i].walkingframe);
break;
case 6:
entities[i].framedelay--;
if (entities[i].dir == 1){
entities[i].drawframe = entities[i].tile;
} else {
entities[i].drawframe = (entities[i].tile + 4);
};
if (entities[i].framedelay <= 0){
entities[i].framedelay = 2;
entities[i].walkingframe++;
if (entities[i].walkingframe > 3){
entities[i].walkingframe = 0;
};
};
if (Math.abs(entities[i].vx) > 1){
entities[i].drawframe = (entities[i].drawframe + entities[i].walkingframe);
};
break;
case 9:
if (entities[i].tile == 89){
entities[i].framedelay--;
if (entities[i].framedelay <= 0){
entities[i].framedelay = 2;
entities[i].walkingframe++;
if (entities[i].walkingframe > 3){
entities[i].walkingframe = 0;
};
};
if (Math.abs(entities[i].vx) > 1){
entities[i].drawframe = (89 + entities[i].walkingframe);
} else {
entities[i].drawframe = 89;
};
};
break;
case 12:
if (entities[i].state == 0){
entities[i].drawframe = entities[i].tile;
} else {
if (entities[i].onground){
entities[i].drawframe = (entities[i].tile + 1);
} else {
entities[i].drawframe = (entities[i].tile + 2);
};
};
break;
case 17:
entities[i].framedelay--;
if (entities[i].dir == 1){
entities[i].drawframe = entities[i].tile;
} else {
entities[i].drawframe = (entities[i].tile + 40);
};
if (entities[i].framedelay <= 0){
entities[i].framedelay = 2;
entities[i].walkingframe++;
if (entities[i].walkingframe > 6){
entities[i].walkingframe = 0;
};
};
if (Math.abs(entities[i].vx) >= 1){
entities[i].drawframe = (entities[i].drawframe + (2 + (entities[i].walkingframe * 2)));
};
break;
case 19:
case 20:
entities[i].framedelay--;
entities[i].drawframe = entities[i].tile;
if (entities[i].framedelay <= 0){
entities[i].framedelay = 1;
entities[i].walkingframe++;
if (entities[i].walkingframe > 1){
entities[i].walkingframe = 0;
};
};
entities[i].drawframe = (entities[i].drawframe + entities[i].walkingframe);
break;
case 25:
entities[i].framedelay--;
entities[i].drawframe = entities[i].tile;
if (entities[i].framedelay <= 0){
entities[i].framedelay = 15;
entities[i].walkingframe++;
if (entities[i].walkingframe > 1){
entities[i].walkingframe = 0;
};
};
entities[i].drawframe = (entities[i].drawframe + entities[i].walkingframe);
break;
case 26:
entities[i].framedelay--;
if (entities[i].dir == 1){
entities[i].drawframe = entities[i].tile;
} else {
entities[i].drawframe = (entities[i].tile + 4);
};
if (entities[i].harmdelay > 0){
entities[i].drawframe = (entities[i].drawframe + 3);
} else {
if (!entities[i].onground){
if (entities[i].vy < 0){
entities[i].drawframe = (entities[i].drawframe + 2);
} else {
entities[i].drawframe = (entities[i].drawframe + 1);
};
};
};
if (Math.abs(entities[i].vx) > 1){
entities[i].drawframe = (entities[i].drawframe + entities[i].walkingframe);
};
break;
case 27:
entities[i].framedelay--;
if (entities[i].framedelay <= 0){
entities[i].framedelay = 0;
};
entities[i].drawframe = entities[i].tile;
break;
default:
entities[i].drawframe = entities[i].tile;
break;
};
} else {
entities[i].statedelay--;
if (entities[i].statedelay < 0){
entities[i].statedelay = 0;
};
};
}
public function checkladder(game:gameclass):Boolean{
var i:int;
var j:int;
i = 0;
while (i < nentity) {
if (entities[i].type == 0){
tempx = (entities[i].xp + entities[i].cx);
tempy = (entities[i].yp + entities[i].cy);
tempw = entities[i].cw;
temph = entities[i].ch;
temprect = new Rectangle(tempx, tempy, tempw, temph);
j = 0;
while (j < game.nblocks) {
if (game.blocks[j].type == 2){
if (game.blocks[j].rect.intersects(temprect)){
return (true);
};
};
j++;
};
};
i++;
};
return (false);
}
public function checktrigger(game:gameclass):Boolean{
var i:int;
var j:int;
i = 0;
while (i < nentity) {
if (entities[i].type == 0){
tempx = (entities[i].xp + entities[i].cx);
tempy = (entities[i].yp + entities[i].cy);
tempw = entities[i].cw;
temph = entities[i].ch;
temprect = new Rectangle(tempx, tempy, tempw, temph);
j = 0;
while (j < game.nblocks) {
if (game.blocks[j].type == 1){
if (game.blocks[j].rect.intersects(temprect)){
activetrigger = game.blocks[j].trigger;
return (true);
};
};
j++;
};
};
i++;
};
return (false);
}
public function getplayer():int{
var i:int;
i = 0;
while (i < nentity) {
if (entities[i].type == 0){
return (i);
};
i++;
};
return (-1);
}
public function testwallsx(game:gameclass, t:int, tx:int, ty:int):Boolean{
var i:int;
tempx = (tx + entities[t].cx);
tempy = (ty + entities[t].cy);
tempw = entities[t].cw;
temph = entities[t].ch;
temprect = new Rectangle(tempx, tempy, tempw, temph);
if (checkwall(game)){
if (entities[t].vx > 1){
entities[t].vx--;
entities[t].newxp = (entities[t].xp + entities[t].vx);
return (testwallsx(game, t, entities[t].newxp, entities[t].yp));
};
if (entities[t].vx < -1){
entities[t].vx++;
entities[t].newxp = (entities[t].xp + entities[t].vx);
return (testwallsx(game, t, entities[t].newxp, entities[t].yp));
};
entities[t].vx = 0;
return (false);
};
return (true);
}
public function testwallsy(game:gameclass, t:int, tx:int, ty:int):Boolean{
var i:int;
tempx = (tx + entities[t].cx);
tempy = (ty + entities[t].cy);
tempw = entities[t].cw;
temph = entities[t].ch;
temprect = new Rectangle(tempx, tempy, tempw, temph);
if (checkwall(game)){
if (entities[t].vy > 1){
entities[t].vy--;
entities[t].newyp = (entities[t].yp + entities[t].vy);
return (testwallsy(game, t, entities[t].xp, entities[t].newyp));
};
if (entities[t].vy < -1){
entities[t].vy++;
entities[t].newyp = (entities[t].yp + entities[t].vy);
return (testwallsy(game, t, entities[t].xp, entities[t].newyp));
};
entities[t].vy = 0;
return (false);
};
return (true);
}
public function confirmflags():void{
var i:Number = 0;
while (i < 300) {
if (flags[i] == 2){
flags[i] = 1;
};
i++;
};
}
public function checkwall(game:gameclass):Boolean{
var i:int;
i = 0;
while (i < game.nblocks) {
if (game.blocks[i].type == 0){
if (game.blocks[i].rect.intersects(temprect)){
return (true);
};
};
i++;
};
return (false);
}
public function removeanentity(help:helpclass, t:int):void{
help.removeObject(entities[t], entities);
nentity--;
}
public function removeallentities(help:helpclass):void{
while (nentity > 0) {
removeanentity(help, 0);
};
}
public function createentity(xp:Number, yp:Number, t:int, vx:Number=0, vy:Number=0, para:int=0):void{
var entity:Object;
if ((((((((para == 0)) || ((flags[para] == 0)))) || ((t == 23)))) || ((t == 22)))){
entity = new Object();
switch (t){
case 0:
entity.type = 0;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onbullet = 0;
entity.onground = false;
entity.jumping = false;
entity.jumpframe = 0;
entity.gravity = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 6;
entity.cy = 0;
entity.cw = 5;
entity.ch = 16;
entity.vx = 0;
entity.vy = 0;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 0;
entity.life = 15;
entity.framedelay = 0;
entity.drawframe = 0;
entity.walkingframe = 0;
entity.dir = 0;
entity.bigfallframe = 0;
entity.bigfallframedelay = 0;
entity.bigfallcounter = 0;
entity.pickupmode = 0;
entity.pickupframe = 0;
break;
case 1:
entity.type = 1;
entity.size = 0;
entity.onwall = 1;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onbullet = 0;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.vx = vx;
entity.vy = vy;
entity.cx = 0;
entity.cy = 0;
entity.cw = 6;
entity.ch = 3;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 40;
entity.drawframe = 40;
break;
case 2:
entity.type = 2;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = true;
entity.onbullet = 1;
entity.harmful = true;
entity.flag = para;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 2;
entity.cy = 0;
entity.cw = 7;
entity.ch = 5;
entity.vx = 0;
entity.vy = 0;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 60;
entity.bulletvel = 0;
entity.framedelay = 0;
entity.drawframe = 60;
entity.walkingframe = 0;
break;
case 3:
entity.type = 3;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onground = false;
entity.gravity = true;
entity.xgravity = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 0;
entity.cy = 0;
entity.cw = 11;
entity.ch = 5;
entity.vx = vx;
entity.vy = vy;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 64;
entity.framedelay = 0;
entity.drawframe = 64;
entity.walkingframe = 0;
break;
case 4:
entity.type = 4;
entity.size = 0;
entity.onwall = 1;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onbullet = 0;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.vx = vx;
entity.vy = vy;
entity.cx = 0;
entity.cy = 0;
entity.cw = 2;
entity.ch = 6;
entity.state = 0;
entity.statedelay = 0;
entity.life = 20;
entity.tile = 42;
entity.drawframe = 42;
break;
case 5:
entity.type = 5;
entity.size = 0;
entity.onwall = 1;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onground = false;
entity.gravity = true;
entity.xgravity = false;
entity.jumping = false;
entity.jumpframe = 0;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 0;
entity.cy = 0;
entity.cw = 1;
entity.ch = 1;
entity.vx = vx;
entity.vy = vy;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 41;
entity.framedelay = 0;
entity.drawframe = 41;
entity.life = 20;
break;
case 6:
entity.type = 6;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 2;
entity.onywall = 0;
entity.onentity = true;
entity.onbullet = 3;
entity.harmful = true;
entity.flag = para;
entity.hp = 3;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 5;
entity.cy = 5;
entity.cw = 9;
entity.ch = 11;
entity.gravity = true;
entity.vx = 0;
entity.vy = 0;
entity.state = 1;
entity.statedelay = 0;
entity.tile = 80;
entity.bulletvel = 0;
entity.framedelay = 0;
entity.drawframe = 80;
entity.walkingframe = 0;
break;
case 7:
entity.type = 3;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onground = false;
entity.gravity = true;
entity.xgravity = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 0;
entity.cy = 0;
entity.cw = 16;
entity.ch = 16;
entity.vx = vx;
entity.vy = vy;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 88;
entity.framedelay = 0;
entity.drawframe = 88;
entity.walkingframe = 0;
break;
case 8:
entity.type = 8;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onground = false;
entity.gravity = true;
entity.xgravity = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 0;
entity.cy = 0;
entity.cw = 5;
entity.ch = 4;
entity.vx = vx;
entity.vy = vy;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 43;
entity.framedelay = 0;
entity.drawframe = 43;
entity.walkingframe = 0;
break;
case 9:
entity.type = 9;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 2;
entity.onentity = true;
entity.onbullet = 10;
entity.harmful = true;
entity.flag = para;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 2;
entity.cy = 0;
entity.cw = 12;
entity.ch = 8;
entity.vx = 0;
entity.vy = 0;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 93;
entity.bulletvel = 0;
entity.framedelay = 0;
entity.drawframe = 93;
entity.walkingframe = 0;
break;
case 10:
entity.type = 3;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onground = false;
entity.gravity = true;
entity.xgravity = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 0;
entity.cy = 0;
entity.cw = 12;
entity.ch = 6;
entity.vx = vx;
entity.vy = vy;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 95;
entity.framedelay = 0;
entity.drawframe = 95;
entity.walkingframe = 0;
break;
case 11:
entity.type = 11;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 2;
entity.harmful = true;
entity.flag = para;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 0;
entity.cy = 0;
entity.cw = 5;
entity.ch = 16;
entity.vx = 0;
entity.vy = 0;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 65;
entity.bulletvel = 0;
entity.framedelay = 0;
entity.drawframe = 65;
entity.walkingframe = 0;
break;
case 12:
entity.type = 12;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = true;
entity.onbullet = 10;
entity.harmful = true;
entity.flag = para;
entity.hp = 3;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 1;
entity.cy = 3;
entity.cw = 6;
entity.ch = 13;
entity.gravity = true;
entity.vx = 0;
entity.vy = 0;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 66;
entity.bulletvel = 0;
entity.framedelay = 0;
entity.drawframe = 66;
entity.walkingframe = 0;
break;
case 13:
entity.type = 3;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onground = false;
entity.gravity = true;
entity.xgravity = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 0;
entity.cy = 0;
entity.cw = 16;
entity.ch = 16;
entity.vx = vx;
entity.vy = vy;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 69;
entity.framedelay = 0;
entity.drawframe = 69;
entity.walkingframe = 0;
break;
case 14:
entity.type = 3;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onground = false;
entity.gravity = true;
entity.xgravity = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 0;
entity.cy = 0;
entity.cw = 16;
entity.ch = 16;
entity.vx = vx;
entity.vy = vy;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 70;
entity.framedelay = 0;
entity.drawframe = 70;
entity.walkingframe = 0;
break;
case 15:
entity.type = 15;
entity.size = 0;
entity.onwall = 1;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onbullet = 0;
entity.harmful = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.vx = vx;
entity.vy = vy;
entity.cx = 1;
entity.cy = 1;
entity.cw = 4;
entity.ch = 4;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 44;
entity.drawframe = 44;
break;
case 16:
entity.type = 5;
entity.size = 0;
entity.onwall = 1;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onground = false;
entity.gravity = true;
entity.xgravity = false;
entity.jumping = false;
entity.jumpframe = 0;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 0;
entity.cy = 0;
entity.cw = 1;
entity.ch = 1;
entity.vx = vx;
entity.vy = vy;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 50;
entity.framedelay = 0;
entity.drawframe = 50;
entity.life = 4;
break;
case 17:
entity.type = 17;
entity.size = 1;
entity.onwall = 0;
entity.onxwall = 1;
entity.onywall = 0;
entity.onentity = true;
entity.onbullet = 10;
entity.harmful = true;
entity.flag = para;
entity.hp = 4;
entity.onground = false;
entity.gravity = true;
entity.xgravity = false;
entity.jumping = false;
entity.jumpframe = 0;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 10;
entity.cy = 0;
entity.cw = 12;
entity.ch = 32;
entity.vx = 0;
entity.vy = 0;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 100;
entity.charge = 40;
entity.bulletvel = 0;
entity.roar = false;
entity.framedelay = 0;
entity.drawframe = 100;
entity.walkingframe = 0;
break;
case 18:
entity.type = 15;
entity.size = 0;
entity.onwall = 1;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onbullet = 0;
entity.harmful = true;
entity.gravity = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.vx = vx;
entity.vy = -6;
entity.ay = -16;
entity.jumping = true;
entity.jumpframe = 24;
entity.cx = 1;
entity.cy = 1;
entity.cw = 4;
entity.ch = 4;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 44;
entity.drawframe = 44;
break;
case 19:
entity.type = 19;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 2;
entity.onentity = false;
entity.onbullet = 0;
entity.harmful = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.vx = vx;
entity.vy = vy;
entity.cx = 1;
entity.cy = 0;
entity.cw = 2;
entity.ch = 16;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 47;
entity.drawframe = 47;
entity.framedelay = 0;
entity.walkingframe = 0;
break;
case 20:
entity.type = 20;
entity.size = 0;
entity.onwall = 0;
entity.onywall = 0;
entity.onxwall = 2;
entity.onentity = false;
entity.onbullet = 0;
entity.harmful = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.vx = vx;
entity.vy = vy;
entity.cx = 0;
entity.cy = 0;
entity.cw = 16;
entity.ch = 4;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 45;
entity.drawframe = 45;
entity.framedelay = 0;
entity.walkingframe = 0;
break;
case 21:
entity.type = 21;
entity.size = 0;
entity.onwall = 0;
entity.onywall = 0;
entity.onxwall = 0;
entity.onentity = false;
entity.onbullet = 0;
entity.harmful = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.vx = 0;
entity.vy = vy;
entity.cx = 0;
entity.cy = 0;
entity.cw = 9;
entity.ch = 9;
entity.state = vx;
entity.statedelay = 0;
entity.tile = 49;
entity.drawframe = 49;
entity.framedelay = 0;
entity.walkingframe = 0;
break;
case 22:
entity.type = 22;
entity.size = 0;
entity.onwall = 0;
entity.onywall = 0;
entity.onxwall = 0;
entity.onentity = false;
entity.onbullet = 0;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.vx = vx;
entity.vy = vy;
entity.cx = 0;
entity.cy = 0;
entity.cw = 8;
entity.ch = 3;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 51;
entity.drawframe = 51;
entity.framedelay = para;
entity.walkingframe = 0;
break;
case 23:
entity.type = 23;
entity.size = 0;
entity.onwall = 0;
entity.onywall = 0;
entity.onxwall = 0;
entity.onentity = false;
entity.onbullet = 0;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.vx = vx;
entity.vy = vy;
entity.cx = 0;
entity.cy = 0;
entity.cw = 16;
entity.ch = 4;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 33;
entity.drawframe = 33;
entity.framedelay = para;
entity.walkingframe = 0;
break;
case 24:
entity.type = 24;
entity.size = 0;
entity.onwall = 0;
entity.onywall = 0;
entity.onxwall = 0;
entity.onentity = false;
entity.onbullet = 0;
entity.onplayer = 2;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.vx = vx;
entity.vy = vy;
entity.cx = 0;
entity.cy = 0;
entity.cw = 16;
entity.ch = 5;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 53;
entity.drawframe = 53;
entity.framedelay = 0;
entity.walkingframe = 0;
break;
case 25:
entity.type = 25;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onbullet = 0;
entity.harmful = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.vx = 0;
entity.vy = 0;
entity.cx = 1;
entity.cy = 0;
entity.cw = 2;
entity.ch = 16;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 47;
entity.drawframe = 47;
entity.framedelay = 0;
entity.walkingframe = vx;
break;
case 26:
entity.type = 26;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = true;
entity.onbullet = 10;
entity.harmful = true;
entity.hp = 3;
entity.oxp = 0;
entity.oyp = 0;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 4;
entity.cy = 5;
entity.cw = 12;
entity.ch = 11;
entity.gravity = true;
entity.vx = 0;
entity.vy = 0;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 71;
entity.bulletvel = 0;
entity.framedelay = 0;
entity.drawframe = 71;
entity.walkingframe = 0;
entity.attackdelay = 0;
entity.harmdelay = 0;
break;
case 27:
entity.type = 27;
entity.size = 2;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = true;
entity.onbullet = 100;
entity.harmful = true;
entity.flag = para;
entity.hp = 5;
entity.onground = false;
entity.gravity = true;
entity.xgravity = false;
entity.jumping = false;
entity.jumpframe = 0;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 32;
entity.cy = 0;
entity.cw = 16;
entity.ch = 80;
entity.vx = 0;
entity.vy = 0;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 180;
entity.charge = 40;
entity.bulletvel = 0;
entity.roar = false;
entity.framedelay = 0;
entity.drawframe = 180;
entity.walkingframe = 0;
entity.attackdelay = 30;
entity.harmdelay = 0;
break;
case 28:
entity.type = 28;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = true;
entity.onbullet = 0;
entity.harmful = false;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 4;
entity.cy = 2;
entity.cw = 8;
entity.ch = 14;
entity.vx = 0;
entity.vy = 0;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 18;
entity.bulletvel = 0;
entity.life = 15;
entity.framedelay = 0;
entity.drawframe = 18;
entity.walkingframe = 0;
break;
case 29:
entity.type = 29;
entity.size = 0;
entity.onwall = 1;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onground = false;
entity.gravity = false;
entity.xgravity = false;
entity.jumping = false;
entity.jumpframe = 0;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 0;
entity.cy = 0;
entity.cw = 1;
entity.ch = 1;
entity.vx = vx;
entity.vy = vy;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 50;
entity.life = 40;
entity.framedelay = 0;
entity.drawframe = 50;
break;
case 30:
entity.type = 30;
entity.size = 0;
entity.onwall = 1;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onground = false;
entity.gravity = false;
entity.xgravity = false;
entity.jumping = false;
entity.jumpframe = 0;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 0;
entity.cy = 0;
entity.cw = 1;
entity.ch = 1;
entity.vx = vx;
entity.vy = vy;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 50;
entity.life = 40;
entity.framedelay = 0;
entity.drawframe = 50;
break;
case 31:
entity.type = 31;
entity.size = 0;
entity.onwall = 0;
entity.onxwall = 0;
entity.onywall = 0;
entity.onentity = false;
entity.onbullet = 0;
entity.onground = false;
entity.jumping = false;
entity.jumpframe = 0;
entity.gravity = true;
entity.ax = 0;
entity.ay = 0;
entity.xp = xp;
entity.yp = yp;
entity.cx = 6;
entity.cy = 0;
entity.cw = 5;
entity.ch = 16;
entity.vx = 0;
entity.vy = 0;
entity.state = 0;
entity.statedelay = 0;
entity.tile = 20;
entity.life = 15;
entity.framedelay = 0;
entity.drawframe = 20;
entity.walkingframe = 0;
entity.dir = 0;
entity.bigfallframe = 0;
entity.bigfallframedelay = 0;
entity.bigfallcounter = 0;
entity.pickupmode = 0;
entity.pickupframe = 0;
break;
};
entities.push(entity);
nentity++;
};
}
public function applyfriction(t:int, xrate:Number, yrate:Number):void{
if (entities[t].xgravity){
if (Math.abs(entities[t].vx) <= xrate){
entities[t].vx = 0;
};
};
if (Math.abs(entities[t].vy) <= yrate){
entities[t].vy = 0;
};
if (entities[t].xgravity){
if (entities[t].vx > 0){
entities[t].vx = (entities[t].vx - xrate);
};
};
if (entities[t].xgravity){
if (entities[t].vx < 0){
entities[t].vx = (entities[t].vx + xrate);
};
};
if (entities[t].vy > 0){
entities[t].vy = (entities[t].vy - yrate);
};
if (entities[t].vy < 0){
entities[t].vy = (entities[t].vy + yrate);
};
if (entities[t].vy > 4){
entities[t].vy = 4;
};
if (entities[t].vy < -3){
entities[t].vy = -3;
};
if (entities[t].vx > 3){
entities[t].vx = 3;
};
if (entities[t].vx < -3){
entities[t].vx = -3;
};
}
public function entitycollidefloor(game:gameclass, t:int):Boolean{
tempx = (entities[t].xp + entities[t].cx);
tempy = ((entities[t].yp + entities[t].cy) + 1);
tempw = entities[t].cw;
temph = entities[t].ch;
temprect = new Rectangle(tempx, tempy, tempw, temph);
if (checkwall(game)){
return (true);
};
return (false);
}
public function geteurydice():int{
var i:int;
i = 0;
while (i < nentity) {
if (entities[i].type == 28){
return (i);
};
i++;
};
return (-1);
}
public function checkdamage(game:gameclass):Boolean{
var i:int;
var j:int;
i = 0;
while (i < nentity) {
if (entities[i].type == 0){
tempx = (entities[i].xp + entities[i].cx);
tempy = (entities[i].yp + entities[i].cy);
tempw = entities[i].cw;
temph = entities[i].ch;
temprect = new Rectangle(tempx, tempy, tempw, temph);
j = 0;
while (j < game.nblocks) {
if (game.blocks[j].type == 3){
if (game.blocks[j].rect.intersects(temprect)){
return (true);
};
};
j++;
};
};
i++;
};
return (false);
}
public function entitycollide(a:int, b:int):Boolean{
tempx = (entities[a].xp + entities[a].cx);
tempy = (entities[a].yp + entities[a].cy);
tempw = entities[a].cw;
temph = entities[a].ch;
temprect = new Rectangle(tempx, tempy, tempw, temph);
tempx = (entities[b].xp + entities[b].cx);
tempy = (entities[b].yp + entities[b].cy);
tempw = entities[b].cw;
temph = entities[b].ch;
if (temprect.intersects(new Rectangle(tempx, tempy, tempw, temph))){
return (true);
};
return (false);
}
}
}//package
Section 26
//gameclass (gameclass)
package {
import flash.events.*;
import com.kongregate.as3.client.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
import com.kongregate.as3.client.*;
public class gameclass extends Sprite {
public var restorehighlighted:Boolean;
public var inmenu:Boolean;
public var startspecial:Boolean;
public var screenshake:int;
public var kongversion:Boolean;
public var teststring:String;
public var showcreditline:int;
public var flashlight:int;
public var visithighlighted:Boolean;
public var hpposition:int;
public var paused:Boolean;
public var savepoint:int;
public var startroom:int;
public var currenthp:int;
public var bg:int;
public var door_right:int;
public var totalhp:int;
public var startx:int;
public var starty:int;
public var globalsound:int;
public var hasgun:Boolean;
public var jumpheld:Boolean;
public var raindelay:int;
public var muted:Boolean;
public var nblocks:int;
public var debugmode:Boolean;
public var showtitle:int;
public var showimage:int;
public var newgamehighlighted:Boolean;
public var currentimage:int;
public var hascontrol:Boolean;
public var blocks:Array;
public var enemycount:int;
public var mutebutton:int;
public var offlinehighlighted:Boolean;
public var state:int;
public var statedelay:int;
public var door_down:int;
public var rain:Boolean;
public var isshooting:Boolean;
public var toggledeath:Boolean;
public var test:Boolean;
public var lastx:int;
public var lasty:int;
public var mx:int;
public var my:int;
public var ongroundlasttime:Boolean;
public var eurydicemode:Boolean;
public var entdir:int;
public var showblocks:Boolean;
public var shotdelay:int;
public var door_up:int;
public var currentroom:int;
public var gamecookie:SharedObject;
public var showmenu:int;
public var infocus:Boolean;
public var kongapi:KongregateAPI;
public var entvx:int;
public var enty:int;
public var standaloneversion:Boolean;
public var entx:int;
public var entvy:int;
public var door_left:int;
public var onkongregate:Boolean;
public function gameclass(obj:entityclass, help:helpclass, music:musicclass):void{
blocks = new Array();
super();
gamecookie = SharedObject.getLocal("dwdontlookback");
kongversion = true;
if (kongversion){
kongapi = KongregateAPI.getInstance();
};
if (gamecookie.data.counter == undefined){
gamecookie.data.counter = 0;
} else {
savepoint = gamecookie.data.counter;
};
infocus = true;
paused = false;
muted = false;
globalsound = 1;
mutebutton = 0;
addEventListener(Event.DEACTIVATE, windowNotActive);
addEventListener(Event.ACTIVATE, windowActive);
showtitle = 0;
showcreditline = 0;
showmenu = 0;
lastx = 0;
lasty = 0;
test = false;
teststring = "Test=TRUE";
jumpheld = false;
shotdelay = 0;
hasgun = false;
hascontrol = true;
rain = true;
raindelay = 0;
showblocks = false;
nblocks = 0;
currentroom = 0;
gotoroom(0, obj, help, music);
state = 1;
statedelay = 0;
updatestate(obj, help, music);
}
public function setsavepoint(t:int):void{
savepoint = t;
gamecookie.data.counter = savepoint;
if (kongversion){
kongapi.stats.submit("progress", t);
};
}
public function resetenemycount():void{
enemycount = 0;
}
public function createblock(xp:int, yp:int, w:int, h:int):void{
var block:Object = new Object();
block.type = 0;
block.xp = xp;
block.yp = yp;
block.w = w;
block.h = h;
block.rect = new Rectangle(xp, yp, w, h);
blocks.push(block);
nblocks++;
}
public function windowActive(e:Event):void{
infocus = true;
}
public function createladder(xp:int, yp:int, w:int, h:int):void{
var block:Object = new Object();
block.type = 2;
block.xp = xp;
block.yp = yp;
block.w = w;
block.h = h;
block.rect = new Rectangle(xp, yp, w, h);
blocks.push(block);
nblocks++;
}
public function createtrigger(xp:int, yp:int, w:int, h:int, t:int):void{
var block:Object = new Object();
block.type = 1;
block.xp = xp;
block.yp = yp;
block.w = w;
block.h = h;
block.rect = new Rectangle(xp, yp, w, h);
block.trigger = t;
blocks.push(block);
nblocks++;
}
public function removeallblocks(help:helpclass):void{
while (nblocks > 0) {
removeblock(help, 0);
};
}
public function updatestate(obj:entityclass, help:helpclass, music:musicclass):void{
var vci:Number;
statedelay--;
if (statedelay <= 0){
statedelay = 0;
};
if (statedelay <= 0){
switch (state){
case 0:
break;
case 1:
state = 17;
statedelay = 10;
resetenemycount();
startspecial = false;
currentroom = 0;
entx = 30;
enty = 94;
obj.createentity(entx, enty, 0);
obj.entities[obj.getplayer()].onground = true;
obj.entities[obj.getplayer()].dir = 0;
obj.entities[obj.getplayer()].drawframe = 20;
inmenu = true;
hascontrol = false;
break;
case 2:
state = 0;
removetrigger(help, 2);
rain = false;
break;
case 3:
state = 0;
removetrigger(help, 3);
rain = true;
break;
case 4:
if (obj.flags[3] == 1){
removetrigger(help, 4);
state = 0;
} else {
state = 5;
statedelay = 6;
music.stopstep();
removetrigger(help, 4);
hascontrol = false;
};
break;
case 5:
help.globaltemp = obj.getplayer();
if (obj.entities[help.globaltemp].onground){
state = 6;
statedelay = 4;
obj.entities[help.globaltemp].pickupmode = 1;
obj.entities[help.globaltemp].pickupframe = 0;
};
break;
case 6:
state = 7;
statedelay = 4;
showimage = 150;
currentimage = 0;
obj.changeflag(3, 1);
obj.removeentitytype(help, 8);
break;
case 7:
state = 0;
hascontrol = true;
hasgun = true;
break;
case 8:
if (showimage > 20){
showimage = 20;
};
removetrigger(help, 8);
state = 0;
break;
case 9:
if (obj.flags[4] == 0){
obj.changeflag(4, 1);
showimage = 150;
currentimage = 2;
};
removetrigger(help, 9);
state = 0;
break;
case 10:
removetrigger(help, 10);
if (obj.flags[26] == 0){
state = 11;
hascontrol = false;
currenthp = 3;
totalhp = 3;
hpposition = 120;
music.play(2);
} else {
state = 0;
};
break;
case 11:
help.globaltemp = obj.getplayer();
if (obj.entities[help.globaltemp].onground){
obj.createentity(165, 94, 26);
obj.createentity(5, 108, 25);
obj.createentity(5, 93, 25, 1);
obj.createentity(5, 78, 25);
obj.createentity(5, 63, 25, 1);
obj.createentity(150, 108, 25);
obj.createentity(150, 93, 25, 1);
obj.createentity(150, 78, 25);
obj.createentity(150, 63, 25, 1);
hascontrol = true;
state = 0;
};
break;
case 12:
obj.removeentitytype(help, 25);
obj.changeflag(26, 1);
state = 0;
currenthp = 0;
totalhp = 0;
hpposition = 0;
if (kongversion){
kongapi.stats.submit("defeated_cerberus", 1);
};
break;
case 13:
obj.removeentitytype(help, 23);
totalhp = 0;
currenthp = 0;
removeblockat(help, 40, 90);
removeblockat(help, 20, 70);
removeblockat(help, 100, -10);
state = 0;
if (kongversion){
kongapi.stats.submit("defeated_hades", 1);
};
break;
case 14:
hascontrol = false;
help.globaltemp = obj.getplayer();
obj.entities[help.globaltemp].vx = 2;
obj.entities[help.globaltemp].dir = 1;
if (currentroom == 52){
if (obj.entities[help.globaltemp].xp >= 80){
music.playef(20);
state = 15;
statedelay = 10;
obj.entities[help.globaltemp].vx = 0;
};
};
if (((!((obj.entities[help.globaltemp].vx == 0))) && (obj.entities[help.globaltemp].onground))){
music.playstep(music.steptype);
} else {
music.stopstep();
};
break;
case 15:
eurydicemode = true;
state = 16;
statedelay = 60;
break;
case 16:
help.globaltemp = obj.getplayer();
obj.entities[help.globaltemp].vx = -2;
obj.entities[help.globaltemp].dir = 0;
if (currentroom == 53){
obj.entities[help.globaltemp].vx = 0;
hascontrol = true;
state = 0;
};
if (((!((obj.entities[help.globaltemp].vx == 0))) && (obj.entities[help.globaltemp].onground))){
music.playstep(music.steptype);
} else {
music.stopstep();
};
break;
case 17:
state = 18;
showcreditline = 5;
break;
case 18:
showcreditline--;
if (showcreditline == 1){
state = 19;
};
break;
case 19:
state = 20;
statedelay = 80;
break;
case 20:
showcreditline++;
if (showcreditline >= 5){
state = 21;
statedelay = 60;
showcreditline = 0;
};
break;
case 21:
state = 22;
showtitle = 5;
break;
case 22:
showtitle--;
if (showtitle == 1){
state = 23;
};
break;
case 23:
showmenu = 1;
state = 0;
break;
case 24:
showtitle++;
if (showtitle >= 5){
state = 25;
};
break;
case 25:
showtitle = 0;
state = 26;
statedelay = 20;
break;
case 26:
newgamehighlighted = false;
inmenu = false;
hascontrol = true;
state = 27;
statedelay = 15;
setsavepoint(0);
break;
case 27:
showimage = 160;
currentimage = 1;
state = 0;
break;
case 28:
hascontrol = false;
help.globaltemp = obj.getplayer();
obj.entities[help.globaltemp].vx = -2;
obj.entities[help.globaltemp].dir = 0;
if (currentroom == 86){
if (obj.entities[help.globaltemp].xp <= 90){
state = 29;
statedelay = 90;
obj.entities[help.globaltemp].vx = 0;
};
};
if (((!((obj.entities[help.globaltemp].vx == 0))) && (obj.entities[help.globaltemp].onground))){
music.playstep(music.steptype);
} else {
music.stopstep();
};
break;
case 29:
obj.entities[obj.geteurydice()].state = 1;
obj.entities[obj.getplayer()].state = 1;
state = 30;
statedelay = 75;
break;
case 30:
if (kongversion){
kongapi.stats.submit("gamecomplete", 1);
};
state = 31;
statedelay = 1;
startspecial = false;
currentroom = 0;
entx = 30;
enty = 94;
obj.removeentitytype(help, 0);
obj.createentity(entx, enty, 0);
obj.entities[obj.getplayer()].onground = true;
obj.entities[obj.getplayer()].dir = 0;
obj.entities[obj.getplayer()].drawframe = 20;
inmenu = true;
hascontrol = false;
break;
case 31:
vci = 0;
while (vci < 300) {
obj.flags[vci] = 0;
vci++;
};
currentroom = 0;
bg = 8;
door_right = 5;
toggledeath = false;
flashlight = 0;
screenshake = 0;
eurydicemode = false;
rain = true;
hasgun = false;
createtrigger(130, 0, 10, 150, 8);
state = 17;
statedelay = 10;
obj.removeentitytype(help, 31);
break;
case 32:
removetrigger(help, 32);
if (obj.flags[250] == 0){
music.play(0);
state = 0;
obj.changeflag(250, 1);
} else {
state = 0;
};
break;
case 33:
showtitle++;
if (showtitle >= 5){
state = 34;
};
break;
case 34:
showtitle = 0;
state = 35;
statedelay = 20;
break;
case 35:
state = 0;
hascontrol = true;
hasgun = true;
rain = false;
restorehighlighted = false;
inmenu = false;
eurydicemode = false;
obj.restartroom = true;
obj.restartmode = 0;
obj.restartcounter = 0;
obj.norestartsound = true;
entdir = 1;
if (savepoint >= 1){
obj.flags[1] = 1;
obj.flags[2] = 1;
obj.flags[3] = 1;
obj.flags[4] = 1;
obj.flags[250] = 1;
};
if (savepoint >= 2){
obj.flags[13] = 1;
obj.flags[14] = 1;
obj.flags[15] = 1;
};
if (savepoint >= 5){
obj.flags[26] = 1;
};
if (savepoint >= 6){
obj.flags[48] = 1;
obj.flags[49] = 1;
};
if (savepoint >= 7){
obj.flags[50] = 1;
obj.flags[51] = 1;
};
if (savepoint == 1){
music.changeamb(1);
music.steptype = 1;
currentroom = 8;
entx = 2;
enty = 109;
} else {
if (savepoint == 2){
music.changeamb(1);
music.steptype = 1;
currentroom = 16;
entx = 2;
enty = 106;
} else {
if (savepoint == 3){
currentroom = 27;
entx = 2;
enty = 94;
music.changeamb(2);
music.steptype = 1;
} else {
if (savepoint == 4){
currentroom = 37;
entx = 2;
enty = 94;
music.changeamb(1);
music.steptype = 1;
} else {
if (savepoint == 5){
currentroom = 39;
entx = 2;
enty = 94;
music.changeamb(1);
music.steptype = 1;
} else {
if (savepoint == 6){
currentroom = 45;
entx = 2;
enty = 74;
music.changeamb(1);
music.steptype = 1;
} else {
if (savepoint == 7){
currentroom = 47;
entx = 2;
enty = 57;
music.changeamb(1);
music.steptype = 1;
} else {
if (savepoint == 8){
currentroom = 49;
entx = 2;
enty = 94;
music.changeamb(3);
music.steptype = 1;
} else {
if (savepoint == 9){
currentroom = 64;
entx = 150;
enty = 94;
entdir = 0;
music.changeamb(1);
music.steptype = 1;
music.play(3);
eurydicemode = true;
} else {
if (savepoint == 10){
currentroom = 69;
entx = 150;
enty = 94;
entdir = 0;
music.changeamb(1);
music.steptype = 1;
music.play(3);
eurydicemode = true;
} else {
if (savepoint == 11){
currentroom = 75;
entx = 150;
enty = 94;
entdir = 0;
music.changeamb(1);
music.steptype = 1;
music.play(3);
eurydicemode = true;
};
};
};
};
};
};
};
};
};
};
};
break;
};
};
}
public function createdamage(xp:int, yp:int, w:int, h:int):void{
var block:Object = new Object();
block.type = 3;
block.xp = xp;
block.yp = yp;
block.w = w;
block.h = h;
block.rect = new Rectangle(xp, yp, w, h);
blocks.push(block);
nblocks++;
}
public function removeblockat(help:helpclass, x:int, y:int):void{
var i:int;
while (i < nblocks) {
if ((((blocks[i].xp == x)) && ((blocks[i].yp == y)))){
removeblock(help, i);
};
i++;
};
}
public function removeblock(help:helpclass, t:int):void{
help.removeObject(blocks[t], blocks);
nblocks--;
}
public function windowNotActive(e:Event):void{
infocus = false;
}
public function removetrigger(help:helpclass, t:int):void{
var i:int;
while (i < nblocks) {
if (blocks[i].type == 1){
if (blocks[i].trigger == t){
removeblock(help, i);
};
};
i++;
};
}
public function gotoroom(t:int, obj:entityclass, help:helpclass, music:musicclass):void{
if ((((t == currentroom)) || ((((t == startroom)) && ((startspecial == true)))))){
obj.resetflags();
} else {
obj.confirmflags();
};
removeallblocks(help);
obj.removeallentities(help);
door_up = -2;
door_down = -2;
door_right = -2;
door_left = -2;
currentroom = t;
switch (t){
case 0:
bg = 8;
door_right = 5;
toggledeath = false;
flashlight = 0;
screenshake = 0;
eurydicemode = false;
createblock(-10, 110, 180, 100);
createtrigger(130, 0, 10, 150, 8);
break;
case 1:
bg = 2;
door_right = 2;
door_left = 7;
createblock(-10, 125, 180, 100);
obj.createentity(90, 109, 6, 0, 0, 1);
createtrigger(-10, 110, 180, 100, 32);
break;
case 2:
bg = 5;
door_right = 3;
door_left = 1;
createblock(-10, 125, 180, 100);
createtrigger(70, 0, 20, 160, 4);
obj.createentity(75, 121, 8, 0, 0, 3);
break;
case 3:
bg = 3;
door_right = 4;
door_left = 2;
createdamage(-10, 130, 180, 100);
createblock(-10, 125, 65, 100);
createblock(130, 125, 40, 100);
createblock(73, 119, 12, 4);
createblock(101, 112, 12, 4);
break;
case 4:
music.changeamb(0);
music.steptype = 0;
bg = 4;
door_right = 8;
door_left = 3;
rain = true;
createblock(-10, 125, 180, 100);
createblock(72, -2, 200, 10);
obj.createentity(165, 50, 2, 0, 0, 2);
break;
case 5:
bg = 6;
door_left = 0;
door_right = 6;
createblock(-10, 110, 180, 100);
createblock(90, 88, 90, 90);
createtrigger(10, 0, 10, 150, 9);
createtrigger(130, 0, 10, 150, 8);
break;
case 6:
bg = 0;
door_left = 5;
door_down = 7;
createblock(-10, 88, 80, 100);
break;
case 7:
bg = 1;
door_up = 6;
door_right = 1;
createblock(0, 0, 28, 128);
createblock(0, -2, 70, 10);
createblock(-10, 125, 180, 100);
createtrigger(-10, 110, 180, 100, 32);
break;
case 8:
music.changeamb(1);
music.steptype = 1;
bg = 9;
door_left = 4;
door_right = 9;
rain = false;
createblock(-10, 125, 180, 100);
obj.createentity(50, 18, 11);
obj.createentity(100, 15, 11);
obj.createentity(70, 58, 2, 0, 0, 5);
if (savepoint < 1){
setsavepoint(1);
};
break;
case 9:
bg = 10;
door_left = 8;
door_right = 10;
createblock(-10, 125, 180, 100);
obj.createentity(10, 14, 11);
obj.createentity(130, 42, 11);
obj.createentity(110, 35, 9, 0, 0, 6);
break;
case 10:
bg = 11;
door_left = 9;
door_right = 11;
createblock(-10, 125, 180, 100);
createblock(-10, -10, 180, 15);
createblock(132, 36, 60, 150);
createladder(117, 17, 2, 85);
obj.createentity(15, 32, 2, 0, 0, 9);
obj.createentity(140, 6, 9, 0, 0, 7);
obj.createentity(40, 6, 9, 0, 0, 12);
break;
case 11:
bg = 12;
door_left = 10;
door_down = 12;
createblock(-10, 36, 105, 13);
createblock(-10, -10, 180, 15);
createblock(111, 0, 9, 22);
createblock(138, 0, 30, 150);
createblock(78, 87, 90, 70);
createblock(0, 88, 48, 100);
createblock(-10, 36, 35, 100);
obj.createentity(122, 8, 9, 0, 0, 11);
break;
case 12:
bg = 13;
door_right = 13;
createblock(-10, 122, 180, 100);
createblock(0, 0, 15, 160);
createblock(102, -1, 80, 66);
createblock(146, 100, 40, 30);
obj.createentity(150, 84, 6, 0, 0, 13);
obj.createentity(30, 65, 2, 0, 0, 14);
obj.createentity(165, 80, 2, 0, 0, 15);
break;
case 13:
bg = 14;
door_left = 12;
door_right = 14;
createblock(-20, 100, 200, 80);
createblock(-20, 0, 200, 44);
createblock(-20, -1, 30, 66);
obj.createentity(50, 55, 19);
obj.createentity(85, 75, 19);
obj.createentity(120, 55, 19);
startspecial = true;
startx = 2;
starty = 84;
startroom = 13;
break;
case 14:
bg = 15;
door_left = 13;
door_right = 15;
music.fadeout();
createblock(-20, 100, 75, 80);
createblock(-20, 0, 200, 44);
createblock(-10, 122, 180, 100);
obj.createentity(30, 55, 19);
obj.createentity(40, 60, 19);
startspecial = false;
break;
case 15:
bg = 16;
door_left = 14;
door_right = 16;
createblock(-10, 122, 180, 100);
break;
case 16:
bg = 17;
door_left = 15;
door_down = 17;
createblock(-10, 122, 40, 100);
if (savepoint < 2){
setsavepoint(2);
};
break;
case 17:
music.changeamb(1);
music.steptype = 1;
music.play(1);
bg = 18;
door_down = 18;
createblock(-10, -50, 15, 300);
createblock(155, -50, 15, 300);
break;
case 18:
music.changeamb(-1);
music.steptype = 2;
bg = 7;
door_down = 20;
createblock(-10, -50, 15, 300);
createblock(155, -50, 15, 300);
break;
case 20:
bg = 7;
door_down = 21;
createblock(-10, -50, 15, 300);
createblock(155, -50, 15, 300);
break;
case 21:
bg = 7;
door_right = 22;
createblock(-10, -50, 15, 300);
createblock(155, -10, 15, 60);
createblock(-10, 125, 180, 100);
break;
case 22:
bg = 7;
door_left = 21;
door_right = 23;
createblock(-10, -10, 15, 60);
createblock(-100, 125, 280, 100);
obj.createentity(-60, 106, 6, 0, 0, 16);
obj.createentity(170, 106, 6, 0, 0, 22);
break;
case 23:
bg = 7;
door_left = 22;
door_right = 25;
createblock(-10, 125, 180, 100);
createblock(100, 110, 100, 100);
obj.createentity(30, -80, 9, 0, 0, 18);
obj.createentity(65, -60, 9, 0, 0, 19);
obj.createentity(100, -40, 9, 0, 0, 20);
obj.createentity(135, -20, 9, 0, 0, 21);
break;
case 24:
bg = 7;
door_left = 23;
door_right = 25;
createblock(-10, -10, 180, 15);
createblock(-10, 110, 180, 100);
createblock(130, 90, 25, 5);
createblock(90, 70, 25, 5);
createblock(50, 50, 25, 5);
createblock(50, 0, 5, 50);
createblock(130, 50, 25, 5);
createblock(90, 30, 40, 5);
createblock(130, 30, 5, 25);
createblock(155, 50, 20, 100);
obj.createentity(20, 50, 20);
obj.createentity(20, 70, 20);
obj.createentity(20, 90, 20);
obj.createentity(20, 6, 11);
obj.createentity(60, 6, 11);
obj.createentity(100, 6, 11);
break;
case 25:
bg = 7;
door_left = 23;
door_right = 26;
createblock(-10, -10, 180, 15);
createblock(-10, 110, 180, 100);
createblock(20, 95, 15, 51);
createblock(30, 5, 50, 30);
createblock(30, 80, 50, 40);
createblock(110, 5, 60, 30);
createblock(110, 80, 60, 40);
obj.createentity(80, 5, 21);
obj.createentity(100, 100, 21);
obj.createentity(50, 40, 19);
obj.createentity(80, 30, 20);
obj.createentity(80, 90, 20);
break;
case 26:
music.changeamb(-1);
music.steptype = 2;
bg = 7;
door_left = 25;
door_right = 27;
createblock(-10, -10, 180, 15);
createblock(-10, 110, 180, 100);
createblock(-10, 80, 50, 40);
break;
case 27:
music.changeamb(2);
music.steptype = 1;
bg = 19;
door_left = 26;
door_right = 28;
createblock(-10, 110, 180, 100);
startspecial = false;
if (savepoint < 3){
setsavepoint(3);
};
break;
case 28:
bg = 20;
door_left = 27;
door_right = 29;
createblock(-10, 110, 93, 100);
createdamage(-10, 125, 180, 100);
obj.createentity(110, 110, 22, 0, 0, 80);
obj.createentity(140, 105, 22, 0, 0, 80);
obj.createentity(60, 88, 24);
obj.createentity(90, 75, 24);
obj.createentity(120, 75, 24);
obj.createentity(150, 75, 24);
createblock(150, 76, 16, 4);
startspecial = true;
startx = 40;
starty = 94;
startroom = 28;
break;
case 29:
bg = 21;
door_left = 28;
door_right = 30;
createdamage(-10, 125, 180, 100);
obj.createentity(0, 75, 24);
obj.createentity(16, 75, 24);
obj.createentity(32, 75, 24);
obj.createentity(48, 75, 24);
obj.createentity(70, 105, 22, 0, 0, 65);
obj.createentity(82, 105, 22, 0, 0, 55);
obj.createentity(94, 105, 22, 0, 0, 45);
obj.createentity(106, 75, 24);
obj.createentity(122, 75, 24);
obj.createentity(138, 75, 24);
obj.createentity(154, 75, 24);
createblock(0, 76, 16, 4);
createblock(138, 76, 16, 4);
createblock(154, 76, 16, 4);
break;
case 30:
bg = 22;
door_left = 29;
door_right = 31;
createdamage(-10, 125, 180, 100);
obj.createentity(0, 75, 24);
obj.createentity(80, 50, 23, 0, 0, 40);
obj.createentity(20, 95, 22, 0, 0, 80);
obj.createentity(70, 95, 22, 0, 0, 20);
obj.createentity(100, 95, 22, 0, 0, 20);
createblock(0, 76, 16, 4);
createblock(42, 64, 16, 4);
createblock(122, 42, 40, 6);
startspecial = true;
startx = 45;
starty = 48;
startroom = 30;
break;
case 31:
bg = 23;
door_left = 30;
door_right = 32;
createdamage(-10, 125, 180, 100);
createblock(-10, 42, 74, 6);
createblock(107, 70, 16, 6);
createblock(155, 63, 16, 6);
createdamage(130, 100, 25, 7);
createblock(130, 107, 25, 6);
obj.createentity(80, 95, 22, 0, 0, 89);
obj.createentity(128, 95, 22, 0, 0, 80);
obj.createentity(140, 95, 22, 0, 0, 60);
obj.createentity(128, 95, 22, 0, 0, 35);
obj.createentity(140, 95, 22, 0, 0, 15);
obj.createentity(170, 40, 2, 0, 0, 24);
startspecial = true;
startx = 110;
starty = 54;
startroom = 31;
break;
case 32:
bg = 24;
door_left = 31;
door_right = 33;
createdamage(-10, 125, 180, 100);
createblock(-10, 63, 26, 6);
obj.createentity(40, 50, 23, 0, 0, -15);
obj.createentity(80, 40, 23, 0, 0, -13);
obj.createentity(120, 30, 23, 0, 0, -11);
obj.createentity(136, 30, 23, 0, 0, -11);
obj.createentity(152, 30, 23, 0, 0, -11);
startspecial = true;
startx = 2;
starty = 47;
startroom = 32;
break;
case 33:
bg = 21;
door_left = 32;
door_right = 34;
createdamage(-10, 125, 180, 100);
obj.createentity(0, 60, 24);
obj.createentity(16, 60, 24);
obj.createentity(32, 60, 24);
obj.createentity(48, 60, 24);
obj.createentity(64, 60, 24);
obj.createentity(20, 80, 23, 0, 0, 10);
obj.createentity(36, 80, 23, 0, 0, 15);
obj.createentity(52, 80, 23, 0, 0, 20);
obj.createentity(68, 80, 23, 0, 0, 25);
obj.createentity(84, 80, 23, 0, 0, 30);
obj.createentity(100, 80, 23, 0, 0, 35);
obj.createentity(116, 80, 23, 0, 0, 45);
obj.createentity(132, 80, 23, 0, 0, 50);
obj.createentity(148, 80, 23, 0, 0, 55);
break;
case 34:
bg = 21;
door_left = 33;
door_right = 35;
createdamage(-10, 125, 180, 100);
obj.createentity(-12, 80, 23, 0, 0, 45);
obj.createentity(4, 80, 23, 0, 0, 45);
obj.createentity(20, 80, 23, 0, 0, 35);
obj.createentity(36, 80, 23, 0, 0, 35);
obj.createentity(52, 80, 23, 0, 0, 25);
obj.createentity(68, 80, 23, 0, 0, 25);
obj.createentity(84, 80, 23, 0, 0, 15);
obj.createentity(100, 80, 23, 0, 0, 15);
obj.createentity(116, 79, 24);
obj.createentity(132, 79, 24);
obj.createentity(148, 79, 24);
break;
case 35:
bg = 25;
door_left = 34;
door_right = 36;
createdamage(-10, 125, 180, 100);
createblock(0, 80, 16, 4);
obj.createentity(0, 79, 24);
createblock(30, 82, 23, 8);
createblock(82, 76, 24, 8);
createblock(128, 87, 22, 8);
obj.createentity(56, 95, 22, 0, 0, 80);
obj.createentity(68, 95, 22, 0, 0, 60);
obj.createentity(56, 95, 22, 0, 0, 20);
obj.createentity(68, 95, 22, 0, 0, 40);
obj.createentity(112, 105, 22, 0, 0, 80);
obj.createentity(112, 105, 22, 0, 0, 50);
obj.createentity(112, 105, 22, 0, 0, 20);
startspecial = true;
startx = 40;
starty = 66;
startroom = 35;
break;
case 36:
music.changeamb(2);
bg = 26;
door_left = 35;
door_right = 37;
createdamage(-10, 125, 180, 100);
createblock(145, 110, 93, 100);
obj.createentity(10, 85, 24);
obj.createentity(55, 85, 24);
obj.createentity(100, 85, 24);
break;
case 37:
music.changeamb(1);
bg = 27;
door_left = 36;
door_right = 38;
createblock(-10, 110, 200, 100);
startspecial = false;
if (savepoint < 4){
setsavepoint(4);
};
break;
case 38:
bg = 28;
door_left = 37;
door_right = 39;
createblock(-100, 110, 400, 100);
createtrigger(20, -10, 40, 200, 10);
currenthp = 0;
totalhp = 0;
hpposition = 0;
startspecial = true;
startx = 20;
starty = 94;
startroom = 38;
break;
case 39:
bg = 29;
door_left = 38;
door_right = 40;
createblock(-100, 110, 400, 100);
obj.createentity(120, 94, 12, 0, 0, 30);
obj.createentity(165, 60, 2, 0, 0, 33);
startspecial = false;
if (obj.flags[251] == 0){
obj.changeflag(251, 1);
music.play(0);
};
if (savepoint < 5){
setsavepoint(5);
};
break;
case 40:
bg = 30;
door_left = 39;
door_right = 41;
createblock(-100, 110, 400, 100);
obj.createentity(120, 94, 12, 0, 0, 31);
obj.createentity(80, 94, 12, 0, 0, 32);
obj.createentity(-40, 94, 12, 0, 0, 34);
break;
case 41:
bg = 31;
door_left = 40;
door_right = 42;
createblock(-100, 110, 154, 100);
createblock(125, 110, 400, 100);
createdamage(-10, 125, 200, 100);
obj.createentity(64, 95, 23, 0, 0, 45);
obj.createentity(80, 95, 23, 0, 0, 30);
obj.createentity(96, 95, 23, 0, 0, 15);
obj.createentity(165, 40, 2, 0, 0, 35);
obj.createentity(195, 10, 2, 0, 0, 36);
obj.createentity(225, -20, 2, 0, 0, 37);
obj.createentity(0xFF, -50, 2, 0, 0, 38);
obj.createentity(285, -80, 2, 0, 0, 39);
obj.createentity(315, -110, 2, 0, 0, 40);
obj.createentity(-50, 40, 2, 0, 0, 41);
obj.createentity(-80, 10, 2, 0, 0, 42);
obj.createentity(-110, -20, 2, 0, 0, 43);
obj.createentity(-140, -50, 2, 0, 0, 44);
obj.createentity(-170, -80, 2, 0, 0, 45);
obj.createentity(-200, -110, 2, 0, 0, 46);
break;
case 42:
bg = 32;
door_left = 41;
door_right = 43;
createblock(-10, 110, 200, 100);
obj.createentity(130, 78, 17, 0, 0, 47);
startspecial = false;
break;
case 43:
bg = 33;
door_left = 42;
door_down = 44;
createblock(-10, 110, 55, 100);
startspecial = true;
startx = 5;
starty = 94;
startroom = 43;
break;
case 44:
bg = 34;
door_right = 45;
createblock(-10, -50, 55, 60);
createblock(-10, -50, 40, 200);
createblock(-10, 90, 200, 200);
obj.createentity(130, 74, 6, 0, 0, 48);
obj.createentity(50, 74, 12, 0, 0, 49);
break;
case 45:
bg = 37;
door_left = 44;
door_right = 46;
createblock(136, 40, 200, 200);
createblock(-10, 90, 200, 200);
obj.createentity(80, 80, 23, 0, 0, 50);
obj.createentity(50, 60, 23, 0, 0, 10);
obj.createentity(20, 40, 23, 0, 0, 30);
obj.createentity(65, 20, 24);
obj.createentity(49, 20, 24);
obj.createentity(100, 20, 23, 0, 0, 40);
obj.flags[48] = 1;
obj.flags[49] = 1;
startspecial = true;
startx = 5;
starty = 74;
startroom = 45;
if (savepoint < 6){
setsavepoint(6);
};
music.fadeout();
break;
case 46:
bg = 35;
door_left = 45;
door_right = 47;
createblock(-10, 110, 80, 200);
createblock(-10, 120, 200, 200);
createblock(-10, 40, 28, 200);
createblock(124, 73, 60, 200);
createblock(124, 67, 5, 200);
createladder(116, 58, 3, 30);
obj.createentity(25, 95, 23);
obj.createentity(40, 80, 23);
obj.createentity(55, 65, 23);
obj.createentity(71, 65, 23);
obj.createentity(90, 88, 17, 0, 0, 50);
obj.createentity(150, 41, 17, 0, 0, 51);
startspecial = false;
break;
case 47:
bg = 36;
door_left = 46;
door_down = 48;
createblock(-10, 73, 30, 200);
createblock(50, -10, 7, 200);
startspecial = true;
startx = 5;
starty = 57;
startroom = 47;
currenthp = 0;
totalhp = 0;
if (savepoint < 7){
setsavepoint(7);
};
if (kongversion){
kongapi.stats.submit("minchallenge", enemycount);
};
break;
case 48:
music.changeamb(1);
bg = 38;
door_right = 49;
createblock(-10, 110, 200, 200);
createblock(-10, -50, 22, 300);
createblock(50, -50, 7, 65);
createblock(157, -50, 7, 125);
obj.createentity(90, 30, 27, 0, 0, 52);
currenthp = 5;
totalhp = 5;
hpposition = 120;
obj.createentity(40, 90, 23, 0, 0, 60);
obj.createentity(20, 70, 23, 0, 0, 0);
break;
case 49:
music.changeamb(3);
bg = 39;
door_left = -1;
door_right = 50;
createblock(-10, -50, 13, 125);
createblock(-10, 110, 200, 200);
startspecial = false;
if (savepoint < 8){
setsavepoint(8);
};
break;
case 50:
bg = 40;
door_left = -1;
door_right = 51;
createblock(-10, 110, 200, 200);
break;
case 51:
bg = 41;
door_left = -1;
door_right = 52;
createblock(-10, 110, 200, 200);
hasgun = true;
eurydicemode = false;
createtrigger(140, -10, 200, 200, 14);
break;
case 52:
bg = 42;
door_left = 53;
createblock(-10, 110, 200, 200);
createblock(105, -30, 200, 200);
obj.createentity(115, 85, 28);
hasgun = false;
break;
case 53:
bg = 41;
door_left = 54;
door_right = -1;
createblock(-10, 110, 200, 200);
hasgun = true;
break;
case 54:
bg = 40;
door_left = 55;
door_right = -1;
createblock(-10, 110, 200, 200);
break;
case 55:
music.changeamb(3);
bg = 39;
door_left = 56;
door_right = -1;
createblock(-10, -50, 13, 125);
createblock(-10, 110, 200, 200);
break;
case 56:
music.changeamb(1);
bg = 43;
door_right = -1;
door_up = 57;
createblock(-10, 110, 200, 200);
createblock(-10, -50, 22, 300);
createblock(50, -50, 20, 65);
createblock(157, -50, 7, 125);
createladder(99, -10, 3, 90);
break;
case 57:
music.play(3);
bg = 44;
door_down = -1;
door_up = 58;
createblock(50, -50, 20, 265);
createladder(99, -10, 3, 190);
break;
case 58:
bg = 45;
door_down = -1;
door_up = 59;
createblock(-10, 120, 80, 265);
createblock(-10, -10, 30, 265);
createladder(43, -10, 3, 102);
createladder(99, 50, 3, 190);
break;
case 59:
bg = 46;
door_down = -1;
door_left = 60;
createblock(-10, 110, 42, 10);
createblock(-10, 110, 30, 100);
createladder(43, 70, 3, 190);
break;
case 60:
bg = 47;
door_right = -1;
door_left = 93;
createblock(-10, 110, 200, 100);
break;
case 61:
bg = 47;
door_right = -1;
door_left = 87;
createblock(-10, 110, 200, 100);
obj.createentity(20, 108, 22, 0, 0, 60);
obj.createentity(30, 108, 22, 0, 0, 70);
obj.createentity(40, 108, 22, 0, 0, 80);
obj.createentity(50, 108, 22, 0, 0, 0);
obj.createentity(60, 108, 22, 0, 0, 10);
obj.createentity(70, 108, 22, 0, 0, 20);
obj.createentity(80, 108, 22, 0, 0, 30);
obj.createentity(90, 108, 22, 0, 0, 40);
obj.createentity(100, 108, 22, 0, 0, 50);
obj.createentity(110, 108, 22, 0, 0, 60);
obj.createentity(120, 108, 22, 0, 0, 70);
obj.createentity(130, 108, 22, 0, 0, 80);
break;
case 62:
bg = 48;
door_right = -1;
door_left = 63;
createblock(-10, 110, 200, 100);
createblock(30, 80, 13, 100);
createblock(118, 17, 11, 24);
createblock(30, 95, 98, 100);
createblock(30, 0, 100, 26);
obj.createentity(44, 28, 21, 1);
obj.createentity(105, 29, 21, 2);
obj.createentity(105, 80, 21, 3);
obj.createentity(44, 80, 21, 4);
break;
case 63:
bg = 47;
door_right = -1;
door_left = 88;
createblock(-10, 110, 200, 100);
obj.createentity(10, 100, 20);
obj.createentity(30, 50, 19);
obj.createentity(80, 50, 19);
obj.createentity(130, 50, 19);
break;
case 64:
bg = 49;
door_right = -1;
door_up = 65;
createblock(-10, 110, 200, 265);
createblock(-10, -10, 32, 265);
createladder(43, -10, 5, 95);
if (savepoint < 9){
setsavepoint(9);
};
break;
case 65:
bg = 46;
door_down = -1;
door_left = 89;
createblock(-10, 110, 42, 10);
createblock(-10, 110, 30, 100);
createladder(43, 70, 5, 190);
break;
case 66:
bg = 47;
door_right = -1;
door_left = 90;
createblock(-10, 110, 200, 100);
obj.createentity(0, 10, 11);
obj.createentity(10, 10, 11);
obj.createentity(20, 10, 11);
obj.createentity(30, 10, 11);
obj.createentity(40, 10, 11);
obj.createentity(50, 10, 11);
obj.createentity(60, 10, 11);
obj.createentity(70, 10, 11);
obj.createentity(80, 10, 11);
obj.createentity(90, 10, 11);
obj.createentity(100, 10, 11);
obj.createentity(110, 10, 11);
obj.createentity(120, 10, 11);
obj.createentity(130, 10, 11);
obj.createentity(140, 10, 11);
obj.createentity(150, 10, 11);
obj.createentity(160, 10, 11);
break;
case 67:
bg = 47;
door_right = -1;
door_left = 68;
createblock(-10, 110, 200, 100);
obj.createentity(35, 108, 22, 0, 0, 80);
obj.createentity(45, 108, 22, 0, 0, 0);
obj.createentity(55, 108, 22, 0, 0, 10);
obj.createentity(65, 108, 22, 0, 0, 20);
obj.createentity(85, 108, 22, 0, 0, 80);
obj.createentity(95, 108, 22, 0, 0, 0);
obj.createentity(105, 108, 22, 0, 0, 10);
obj.createentity(115, 108, 22, 0, 0, 20);
obj.createentity(35, 108, 22, 0, 0, 35);
obj.createentity(45, 108, 22, 0, 0, 45);
obj.createentity(55, 108, 22, 0, 0, 55);
obj.createentity(65, 108, 22, 0, 0, 65);
obj.createentity(85, 108, 22, 0, 0, 35);
obj.createentity(95, 108, 22, 0, 0, 45);
obj.createentity(105, 108, 22, 0, 0, 55);
obj.createentity(115, 108, 22, 0, 0, 65);
break;
case 68:
bg = 50;
door_right = -1;
door_left = 69;
createblock(-10, 110, 200, 100);
createblock(34, 95, 86, 60);
createblock(34, 0, 86, 28);
obj.createentity(40, 30, 19);
obj.createentity(50, 35, 19);
obj.createentity(60, 40, 19);
obj.createentity(90, 50, 19);
obj.createentity(100, 55, 19);
obj.createentity(110, 60, 19);
break;
case 69:
bg = 49;
door_right = -1;
door_up = 70;
createblock(-10, 110, 200, 265);
createblock(-10, -10, 32, 265);
createladder(43, -10, 5, 95);
if (savepoint < 10){
setsavepoint(10);
};
break;
case 70:
bg = 46;
door_down = -1;
door_left = 91;
createblock(-10, 110, 42, 10);
createblock(-10, 110, 30, 100);
createladder(43, 70, 5, 190);
toggledeath = false;
break;
case 71:
bg = 53;
door_right = -1;
door_left = 72;
createblock(-10, 110, 200, 100);
createblock(19, -10, 121, 55);
createblock(19, 98, 16, 60);
createblock(19, -10, 16, 60);
createblock(125, -10, 16, 60);
createblock(125, 98, 16, 60);
obj.createentity(35, 101, 21, 4);
obj.createentity(54, 101, 21, 3);
obj.createentity(73, 101, 21, 3);
obj.createentity(93, 101, 21, 3);
obj.createentity(116, 101, 21, 3);
obj.createentity(35, 45, 21, 1);
obj.createentity(54, 45, 21, 1);
obj.createentity(73, 45, 21, 1);
obj.createentity(93, 45, 21, 1);
obj.createentity(116, 45, 21, 2);
obj.createentity(19, 50, 23);
obj.createentity(19, 54, 23);
obj.createentity(19, 58, 23);
obj.createentity(19, 62, 23);
obj.createentity(19, 66, 23);
obj.createentity(19, 70, 23);
obj.createentity(19, 74, 23);
obj.createentity(19, 78, 23);
obj.createentity(19, 82, 23);
obj.createentity(19, 86, 23);
obj.createentity(19, 90, 23);
obj.createentity(19, 94, 23);
toggledeath = true;
break;
case 72:
bg = 52;
door_right = -1;
door_left = 73;
createblock(-10, 110, 200, 100);
createblock(112, 40, 20, 100);
createblock(13, 9, 24, 68);
createladder(135, 23, 6, 60);
createblock(-10, -10, 200, 25);
obj.createentity(56, 40, 20);
obj.createentity(66, 55, 20);
obj.createentity(76, 70, 20);
toggledeath = false;
break;
case 73:
bg = 54;
door_right = -1;
door_left = 92;
createblock(-10, -10, 200, 25);
createblock(-10, 110, 200, 100);
createblock(15, 40, 5, 100);
createblock(15, 40, 30, 5);
createblock(15, 63, 10, 5);
createblock(40, 40, 5, 10);
createblock(40, 80, 5, 100);
createblock(140, 0, 5, 90);
createblock(115, 85, 30, 5);
createblock(135, 63, 10, 5);
createblock(115, 0, 5, 50);
createblock(115, 80, 5, 10);
obj.createentity(20, 45, 21);
obj.createentity(131, 76, 21);
createblock(80, 35, 10, 5);
createblock(100, 45, 10, 5);
createladder(105, 55, 5, 28);
createladder(80, 45, 5, 28);
createladder(55, 25, 5, 38);
break;
case 74:
bg = 51;
door_right = -1;
door_left = 75;
createblock(-10, -10, 200, 25);
createblock(144, 110, 80, 100);
createblock(-10, 110, 34, 100);
createdamage(-10, 120, 200, 100);
createladder(132, 22, 5, 70);
createladder(29, 22, 5, 70);
obj.createentity(64, 85, 23);
obj.createentity(80, 85, 23);
break;
case 75:
bg = 55;
door_right = -1;
door_left = 76;
createblock(-10, 110, 200, 100);
if (savepoint < 11){
setsavepoint(11);
};
break;
case 76:
bg = 56;
door_right = -1;
door_down = 77;
createblock(120, 110, 200, 100);
createblock(80, 122, 200, 100);
createblock(0, 0, 40, 200);
break;
case 77:
bg = 10;
door_right = -1;
door_left = 78;
createblock(-10, 125, 180, 100);
obj.createentity(10, 14, 11);
obj.createentity(130, 42, 11);
break;
case 78:
music.changeamb(1);
music.steptype = 1;
bg = 9;
door_left = 79;
door_right = -1;
rain = false;
createblock(-10, 125, 180, 100);
obj.createentity(50, 18, 11);
obj.createentity(100, 15, 11);
break;
case 79:
music.fadeout();
music.changeamb(0);
music.steptype = 0;
bg = 4;
door_right = -1;
door_left = 80;
rain = true;
createblock(-10, 125, 180, 100);
createblock(72, -2, 200, 10);
break;
case 80:
bg = 3;
door_right = -1;
door_left = 81;
createdamage(-10, 130, 180, 100);
createblock(-10, 125, 60, 100);
createblock(130, 125, 40, 100);
createblock(73, 119, 12, 4);
createblock(102, 112, 10, 4);
break;
case 81:
bg = 5;
door_right = -1;
door_left = 82;
createblock(-10, 125, 180, 100);
break;
case 82:
bg = 2;
door_right = -1;
door_left = 83;
createblock(-10, 125, 180, 100);
break;
case 83:
bg = 57;
door_up = 84;
door_right = 1;
createblock(0, 0, 28, 128);
createblock(0, -2, 70, 10);
createblock(-10, 125, 180, 100);
createladder(72, -10, 5, 110);
break;
case 84:
bg = 58;
door_left = 85;
door_down = -1;
door_right = -1;
createblock(-10, 88, 80, 100);
createladder(72, 75, 5, 110);
break;
case 85:
bg = 6;
door_left = 86;
door_right = -1;
createtrigger(-10, -10, 60, 200, 28);
createblock(-10, 110, 180, 100);
createblock(90, 88, 90, 90);
break;
case 86:
bg = 8;
door_right = -1;
createblock(-10, 110, 180, 100);
obj.createentity(30, 94, 31);
setsavepoint(0);
break;
case 87:
bg = 47;
door_right = -1;
door_left = 62;
createblock(-10, 110, 200, 100);
break;
case 88:
bg = 47;
door_right = -1;
door_left = 64;
createblock(-10, 110, 200, 100);
break;
case 89:
bg = 47;
door_right = -1;
door_left = 66;
createblock(-10, 110, 200, 100);
break;
case 90:
bg = 47;
door_right = -1;
door_left = 67;
createblock(-10, 110, 200, 100);
break;
case 91:
bg = 47;
door_right = -1;
door_left = 71;
createblock(-10, 110, 200, 100);
break;
case 92:
bg = 47;
door_right = -1;
door_left = 74;
createblock(-10, 110, 200, 100);
break;
case 93:
bg = 60;
door_right = -1;
door_left = 61;
createblock(-10, 110, 200, 100);
createblock(10, -10, 10, 100);
createblock(40, 30, 70, 10);
createblock(40, 30, 40, 30);
createblock(140, -10, 10, 100);
createblock(110, 80, 30, 10);
createblock(100, 90, 50, 4);
createblock(10, -10, 140, 15);
createladder(125, 10, 3, 50);
obj.createentity(40, 60, 19);
obj.createentity(57, 60, 19);
obj.createentity(75, 60, 19);
break;
};
}
public function updaterain(obj:entityclass):void{
raindelay--;
if (raindelay <= 0){
raindelay = 0;
};
if (((rain) && ((raindelay <= 0)))){
raindelay = 2;
obj.createentity((Math.random() * 200), (-5 - (Math.random() * 5)), 4, -3, 8);
};
}
public function incenemycount():void{
if (currentroom != 48){
enemycount++;
};
}
public function kongapitest(e:KongregateEvent):void{
trace("Services available; kongapitest() called.");
}
}
}//package
Section 27
//helpclass (helpclass)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
public class helpclass extends Sprite {
public var glowdir:int;
public var globaltemp3:int;
public var glow:int;
public var slowsine:int;
public var sine:Array;
public var globaltemp:int;
public var cosine:Array;
public var globaltemp2:int;
public function helpclass(){
super();
}
public function removeObject(obj:Object, arr:Array):void{
var i:String;
for (i in arr) {
if (arr[i] == obj){
arr.splice(i, 1);
break;
};
};
}
public function init():void{
sine = new Array();
cosine = new Array();
var i:int;
while (i < 64) {
sine[i] = Math.sin(((i * 6.283) / 64));
cosine[i] = Math.cos(((i * 6.283) / 64));
i++;
};
glow = 0;
glowdir = 0;
slowsine = 0;
}
public function updateglow():void{
slowsine++;
if (slowsine >= 64){
slowsine = 0;
};
if (glowdir == 0){
glow = (glow + 2);
if (glow >= 62){
glowdir = 1;
};
} else {
glow = (glow - 2);
if (glow < 2){
glowdir = 0;
};
};
}
}
}//package
Section 28
//KONG_30FPS (KONG_30FPS)
package {
import flash.display.*;
public dynamic class KONG_30FPS extends MovieClip {
}
}//package
Section 29
//Main (Main)
package {
import bigroom.input.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.ui.*;
public class Main extends Sprite {
public const GAMEMODE:int = 0;
private var im_opt_offline1:Class;
public var dwgfx:dwgraphicsclass;
public var pj:uint;
public var game:gameclass;
private var ef_0:Class;
private var ef_1:Class;
private var ef_2:Class;
private var ef_3:Class;
private var ef_4:Class;
private var amb_3:Class;
private var ef_6:Class;
private var ef_7:Class;
private var ef_8:Class;
private var ef_9:Class;
private var ef_5:Class;
public var music:musicclass;
private var im_opt_newgame2:Class;
private var im_opt_newgame1:Class;
public var clickedlogo:Boolean;
private var im_title1:Class;
private var im_title2:Class;
public var key:KeyPoll;
public var pixel2:uint;
private var ef_10:Class;
private var ef_11:Class;
private var ef_12:Class;
private var im_website:Class;
private var ef_14:Class;
private var ef_16:Class;
private var ef_17:Class;
private var ef_18:Class;
public var pixel:uint;
private var ef_13:Class;
private var ef_15:Class;
private var ef_19:Class;
private var music_1:Class;
private var music_2:Class;
private var music_3:Class;
private var im_background_0:Class;
private var im_background_1:Class;
private var im_background_2:Class;
private var im_background_3:Class;
public var slogo:MovieClip;
private var im_background_5:Class;
private var im_background_6:Class;
private var im_background_7:Class;
private var im_background_8:Class;
private var im_background_9:Class;
private var im_background_4:Class;
private var music_4:Class;
private var im_opt_restore2:Class;
private var ef_22:Class;
private var im_opt_restore1:Class;
private var im_tiles:Class;
private var im_sponsorwebsite:Class;
private var ef_21:Class;
private var im_bfontmask:Class;
private var im_creditline1:Class;
private var im_creditline2:Class;
private var im_presszorup:Class;
private var ef_20:Class;
private var im_bfont:Class;
private var im_opt_visitsite2:Class;
private var footsteps_1:Class;
private var im_opt_visitsite1:Class;
private var im_pressxorspace:Class;
private var im_background_10:Class;
private var im_background_11:Class;
public var obj:entityclass;
private var im_background_13:Class;
private var im_background_14:Class;
private var im_background_15:Class;
private var im_background_16:Class;
private var im_background_17:Class;
private var im_background_18:Class;
private var im_background_19:Class;
private var footsteps_2:Class;
private var im_sponsorwebsite2:Class;
private var im_background_12:Class;
private var footsteps_3:Class;
private var im_background_20:Class;
private var im_pressarrowkeys:Class;
private var im_background_22:Class;
private var im_background_23:Class;
private var im_background_25:Class;
private var im_background_26:Class;
private var im_background_27:Class;
private var im_background_21:Class;
private var im_background_29:Class;
private var im_background_24:Class;
private var im_background_28:Class;
private var im_opt_fullscreen1:Class;
private var im_opt_fullscreen2:Class;
private var im_background_30:Class;
private var im_background_32:Class;
private var im_background_34:Class;
private var im_background_36:Class;
private var im_background_38:Class;
private var im_background_33:Class;
private var im_background_35:Class;
public var help:helpclass;
private var im_background_37:Class;
private var im_background_31:Class;
private var im_background_40:Class;
private var im_background_41:Class;
private var im_background_43:Class;
private var im_background_45:Class;
private var im_background_46:Class;
private var im_background_47:Class;
private var im_background_48:Class;
private var im_background_49:Class;
private var im_background_44:Class;
private var im_background_39:Class;
private var im_background_42:Class;
private var im_background_50:Class;
private var im_background_51:Class;
private var im_background_52:Class;
private var im_background_53:Class;
private var im_background_54:Class;
private var im_background_55:Class;
private var im_background_56:Class;
private var im_background_58:Class;
private var im_background_59:Class;
private var im_background_57:Class;
private var im_background_60:Class;
private var im_sponscreditline1:Class;
private var im_sponscreditline2:Class;
public var logoposition:Matrix;
public var gamestate:int;
private var amb_1:Class;
private var amb_2:Class;
private var amb_4:Class;
public var pi:uint;
private var im_opt_offline2:Class;
public function Main():void{
dwgfx = new dwgraphicsclass();
music = new musicclass();
help = new helpclass();
obj = new entityclass();
im_title1 = Main_im_title1;
im_title2 = Main_im_title2;
im_creditline1 = Main_im_creditline1;
im_creditline2 = Main_im_creditline2;
im_sponscreditline1 = Main_im_sponscreditline1;
im_sponscreditline2 = Main_im_sponscreditline2;
im_opt_newgame1 = Main_im_opt_newgame1;
im_opt_newgame2 = Main_im_opt_newgame2;
im_opt_offline1 = Main_im_opt_offline1;
im_opt_offline2 = Main_im_opt_offline2;
im_opt_visitsite1 = Main_im_opt_visitsite1;
im_opt_visitsite2 = Main_im_opt_visitsite2;
im_opt_fullscreen1 = Main_im_opt_fullscreen1;
im_opt_fullscreen2 = Main_im_opt_fullscreen2;
im_website = Main_im_website;
im_sponsorwebsite = Main_im_sponsorwebsite;
im_sponsorwebsite2 = Main_im_sponsorwebsite2;
im_opt_restore1 = Main_im_opt_restore1;
im_opt_restore2 = Main_im_opt_restore2;
im_tiles = Main_im_tiles;
im_bfont = Main_im_bfont;
im_bfontmask = Main_im_bfontmask;
im_pressxorspace = Main_im_pressxorspace;
im_pressarrowkeys = Main_im_pressarrowkeys;
im_presszorup = Main_im_presszorup;
im_background_0 = Main_im_background_0;
im_background_1 = Main_im_background_1;
im_background_2 = Main_im_background_2;
im_background_3 = Main_im_background_3;
im_background_4 = Main_im_background_4;
im_background_5 = Main_im_background_5;
im_background_6 = Main_im_background_6;
im_background_7 = Main_im_background_7;
im_background_8 = Main_im_background_8;
im_background_9 = Main_im_background_9;
im_background_10 = Main_im_background_10;
im_background_11 = Main_im_background_11;
im_background_12 = Main_im_background_12;
im_background_13 = Main_im_background_13;
im_background_14 = Main_im_background_14;
im_background_15 = Main_im_background_15;
im_background_16 = Main_im_background_16;
im_background_17 = Main_im_background_17;
im_background_18 = Main_im_background_18;
im_background_19 = Main_im_background_19;
im_background_20 = Main_im_background_20;
im_background_21 = Main_im_background_21;
im_background_22 = Main_im_background_22;
im_background_23 = Main_im_background_23;
im_background_24 = Main_im_background_24;
im_background_25 = Main_im_background_25;
im_background_26 = Main_im_background_26;
im_background_27 = Main_im_background_27;
im_background_28 = Main_im_background_28;
im_background_29 = Main_im_background_29;
im_background_30 = Main_im_background_30;
im_background_31 = Main_im_background_31;
im_background_32 = Main_im_background_32;
im_background_33 = Main_im_background_33;
im_background_34 = Main_im_background_34;
im_background_35 = Main_im_background_35;
im_background_36 = Main_im_background_36;
im_background_37 = Main_im_background_37;
im_background_38 = Main_im_background_38;
im_background_39 = Main_im_background_39;
im_background_40 = Main_im_background_40;
im_background_41 = Main_im_background_41;
im_background_42 = Main_im_background_42;
im_background_43 = Main_im_background_43;
im_background_44 = Main_im_background_44;
im_background_45 = Main_im_background_45;
im_background_46 = Main_im_background_46;
im_background_47 = Main_im_background_47;
im_background_48 = Main_im_background_48;
im_background_49 = Main_im_background_49;
im_background_50 = Main_im_background_50;
im_background_51 = Main_im_background_51;
im_background_52 = Main_im_background_52;
im_background_53 = Main_im_background_53;
im_background_54 = Main_im_background_54;
im_background_55 = Main_im_background_55;
im_background_56 = Main_im_background_56;
im_background_57 = Main_im_background_57;
im_background_58 = Main_im_background_58;
im_background_59 = Main_im_background_59;
im_background_60 = Main_im_background_60;
music_1 = Main_music_1;
music_2 = Main_music_2;
music_3 = Main_music_3;
music_4 = Main_music_4;
amb_1 = Main_amb_1;
amb_2 = Main_amb_2;
amb_3 = Main_amb_3;
amb_4 = Main_amb_4;
footsteps_1 = Main_footsteps_1;
footsteps_2 = Main_footsteps_2;
footsteps_3 = Main_footsteps_3;
ef_0 = Main_ef_0;
ef_1 = Main_ef_1;
ef_2 = Main_ef_2;
ef_3 = Main_ef_3;
ef_4 = Main_ef_4;
ef_5 = Main_ef_5;
ef_6 = Main_ef_6;
ef_7 = Main_ef_7;
ef_8 = Main_ef_8;
ef_9 = Main_ef_9;
ef_10 = Main_ef_10;
ef_11 = Main_ef_11;
ef_12 = Main_ef_12;
ef_13 = Main_ef_13;
ef_14 = Main_ef_14;
ef_15 = Main_ef_15;
ef_16 = Main_ef_16;
ef_17 = Main_ef_17;
ef_18 = Main_ef_18;
ef_19 = Main_ef_19;
ef_20 = Main_ef_20;
ef_21 = Main_ef_21;
ef_22 = Main_ef_22;
super();
if (stage){
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, gameinit);
};
}
private function gameinit(e:Event=null):void{
var tempbmp:Bitmap;
var rc_menu:ContextMenu;
var credit:ContextMenuItem;
var credit2:ContextMenuItem;
removeEventListener(Event.ADDED_TO_STAGE, gameinit);
if (sitelock()){
rc_menu = new ContextMenu();
credit = new ContextMenuItem("Visit distractionware.com");
credit2 = new ContextMenuItem("Visit kongregate.com");
credit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_distractionware);
credit2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_sponsor);
credit2.separatorBefore = false;
rc_menu.hideBuiltInItems();
rc_menu.customItems.push(credit);
rc_menu.customItems.push(credit2);
this.contextMenu = rc_menu;
gamestate = GAMEMODE;
obj.init();
help.init();
key = new KeyPoll(stage);
SoundMixer.soundTransform = new SoundTransform(1);
music.currentamb = -1;
music.currentsong = -1;
music.musicfade = 0;
music.step1playing = false;
music.step2playing = false;
music.stepchanlen = 0;
music.initefchannels();
music.currentefchan = 0;
music.musicchan.push(new music_1());
music.musicchan.push(new music_2());
music.musicchan.push(new music_3());
music.musicchan.push(new music_4());
music.ambchan.push(new amb_1());
music.ambchan.push(new amb_2());
music.ambchan.push(new amb_3());
music.ambchan.push(new amb_4());
music.stepchan.push(new footsteps_1());
music.stepchan.push(new footsteps_2());
music.stepchan.push(new footsteps_3());
music.efchan.push(new ef_0());
music.efchan.push(new ef_1());
music.efchan.push(new ef_2());
music.efchan.push(new ef_3());
music.efchan.push(new ef_4());
music.efchan.push(new ef_5());
music.efchan.push(new ef_6());
music.efchan.push(new ef_7());
music.efchan.push(new ef_8());
music.efchan.push(new ef_9());
music.efchan.push(new ef_10());
music.efchan.push(new ef_11());
music.efchan.push(new ef_12());
music.efchan.push(new ef_13());
music.efchan.push(new ef_14());
music.efchan.push(new ef_15());
music.efchan.push(new ef_16());
music.efchan.push(new ef_17());
music.efchan.push(new ef_18());
music.efchan.push(new ef_19());
music.efchan.push(new ef_20());
music.efchan.push(new ef_21());
music.efchan.push(new ef_22());
game = new gameclass(obj, help, music);
game.standaloneversion = false;
dwgfx.init();
tempbmp = new im_tiles();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.maketilearray();
tempbmp = new im_bfont();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.makebfont();
tempbmp = new im_bfontmask();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.makebfontmask();
tempbmp = new im_pressxorspace();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_pressarrowkeys();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_presszorup();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_title1();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_title2();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_creditline1();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_creditline2();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_opt_newgame1();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_opt_newgame2();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_opt_offline1();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_opt_offline2();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_opt_visitsite1();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_opt_visitsite2();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_opt_fullscreen1();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_opt_fullscreen2();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_website();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_opt_restore1();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_opt_restore2();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_sponsorwebsite();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_sponscreditline1();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_sponscreditline2();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_sponsorwebsite2();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_background_0();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_1();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_2();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_3();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_4();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_5();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_6();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_7();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_8();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_9();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_10();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_11();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_12();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_13();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_14();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_15();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_16();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_17();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_18();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_19();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_20();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_21();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_22();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_23();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_24();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_25();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_26();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_27();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_28();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_29();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_30();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_31();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_32();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_33();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_34();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_35();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_36();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_37();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_38();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_39();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_40();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_41();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_42();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_43();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_44();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_45();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_46();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_47();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_48();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_49();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_50();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_51();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_52();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_53();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_54();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_55();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_56();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_57();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_58();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_59();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
tempbmp = new im_background_60();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addbackground();
dwgfx.buffer = new BitmapData(160, 144, false, 0);
sponsorinit();
} else {
dwgfx.init();
addChild(dwgfx);
tempbmp = new im_bfont();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.makebfont();
tempbmp = new im_bfontmask();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.makebfontmask();
dwgfx.buffer = new BitmapData(160, 144, false, 0);
addEventListener(Event.ENTER_FRAME, lockedloop);
};
}
public function gamerender(key:KeyPoll, dwgfx:dwgraphicsclass, game:gameclass, obj:entityclass, help:helpclass):void{
var i:int;
dwgfx.backbuffer.lock();
dwgfx.drawbackground(game.bg);
if (game.showblocks){
i = 0;
while (i < game.nblocks) {
if (game.blocks[i].type == 0){
dwgfx.backbuffer.fillRect(game.blocks[i].rect, 0xAAAAAA);
} else {
if (game.blocks[i].type == 1){
dwgfx.backbuffer.fillRect(game.blocks[i].rect, 170);
} else {
if (game.blocks[i].type == 2){
dwgfx.backbuffer.fillRect(game.blocks[i].rect, 0xAA00);
} else {
if (game.blocks[i].type == 3){
dwgfx.backbuffer.fillRect(game.blocks[i].rect, 0xFF0000);
};
};
};
};
i++;
};
};
dwgfx.drawentities(obj, help);
if (game.totalhp > 0){
dwgfx.drawbossmeter(game);
};
if (((obj.restartroom) && ((obj.restartmode > -1)))){
dwgfx.backbuffer.fillRect(new Rectangle(0, 0, 160, (8 * obj.restartcounter)), 1114884);
dwgfx.backbuffer.fillRect(new Rectangle(0, (144 - (8 * obj.restartcounter)), 160, 180), 1114884);
dwgfx.backbuffer.fillRect(new Rectangle(0, 0, (9 * obj.restartcounter), 144), 1114884);
dwgfx.backbuffer.fillRect(new Rectangle((160 - (9 * obj.restartcounter)), 0, 190, 144), 1114884);
};
if (game.showimage > 0){
game.showimage--;
if (game.showimage > 130){
dwgfx.drawimage(game.currentimage, 0, (140 - game.showimage), true);
} else {
if (game.showimage < 20){
dwgfx.drawimage(game.currentimage, 0, (game.showimage - 10), true);
} else {
dwgfx.drawimage(game.currentimage, 0, 10, true);
};
};
};
if (game.showcreditline > 1){
if (game.kongversion){
dwgfx.drawimage(20, 0, 8, true);
} else {
dwgfx.drawimage(6, 0, 16, true);
};
} else {
if (game.showcreditline == 1){
if (game.kongversion){
dwgfx.drawimage(19, 0, 8, true);
} else {
dwgfx.drawimage(5, 0, 16, true);
};
};
};
if (game.showtitle > 1){
dwgfx.drawimage(4, 0, 8, true);
} else {
if (game.showtitle == 1){
dwgfx.drawimage(3, 0, 8, true);
};
};
if (game.showmenu > 0){
if (game.standaloneversion){
if (game.savepoint > 0){
if (game.newgamehighlighted){
dwgfx.drawimage(7, 0, 32, true);
} else {
dwgfx.drawimage(8, 0, 32, true);
};
if (game.restorehighlighted){
dwgfx.drawimage(16, 0, 42, true);
} else {
dwgfx.drawimage(17, 0, 42, true);
};
if (game.visithighlighted){
dwgfx.drawimage(11, 0, 52, true);
} else {
dwgfx.drawimage(12, 0, 52, true);
};
} else {
if (game.newgamehighlighted){
dwgfx.drawimage(7, 0, 37, true);
} else {
dwgfx.drawimage(8, 0, 37, true);
};
if (game.visithighlighted){
dwgfx.drawimage(11, 0, 47, true);
} else {
dwgfx.drawimage(12, 0, 47, true);
};
};
dwgfx.drawimage(13, 0, 128, true);
dwgfx.drawimage(15, 0, 136, true);
} else {
if (game.savepoint > 0){
if (game.newgamehighlighted){
dwgfx.drawimage(7, 0, 28, true);
} else {
dwgfx.drawimage(8, 0, 28, true);
};
if (game.restorehighlighted){
dwgfx.drawimage(16, 0, 37, true);
} else {
dwgfx.drawimage(17, 0, 37, true);
};
if (game.offlinehighlighted){
dwgfx.drawimage(9, 0, 46, true);
} else {
dwgfx.drawimage(10, 0, 46, true);
};
if (game.visithighlighted){
dwgfx.drawimage(11, 0, 55, true);
} else {
dwgfx.drawimage(12, 0, 55, true);
};
} else {
if (game.newgamehighlighted){
dwgfx.drawimage(7, 0, 32, true);
} else {
dwgfx.drawimage(8, 0, 32, true);
};
if (game.offlinehighlighted){
dwgfx.drawimage(9, 0, 42, true);
} else {
dwgfx.drawimage(10, 0, 42, true);
};
if (game.visithighlighted){
dwgfx.drawimage(11, 0, 52, true);
} else {
dwgfx.drawimage(12, 0, 52, true);
};
};
if (game.kongversion){
if (game.my > 134){
dwgfx.drawimage(21, 0, 135, true);
} else {
dwgfx.drawimage(18, 0, 135, true);
};
} else {
dwgfx.drawimage(15, 0, 136, true);
};
};
};
if (game.standaloneversion){
if (game.savepoint > 0){
if (game.newgamehighlighted){
dwgfx.drawimage(7, 0, 32, true);
};
if (game.restorehighlighted){
dwgfx.drawimage(16, 0, 42, true);
};
if (game.visithighlighted){
dwgfx.drawimage(11, 0, 52, true);
};
} else {
if (game.newgamehighlighted){
dwgfx.drawimage(7, 0, 37, true);
};
if (game.visithighlighted){
dwgfx.drawimage(11, 0, 47, true);
};
};
} else {
if (game.savepoint > 0){
if (game.newgamehighlighted){
dwgfx.drawimage(7, 0, 28, true);
};
if (game.restorehighlighted){
dwgfx.drawimage(16, 0, 37, true);
};
if (game.offlinehighlighted){
dwgfx.drawimage(9, 0, 46, true);
};
if (game.visithighlighted){
dwgfx.drawimage(11, 0, 55, true);
};
} else {
if (game.newgamehighlighted){
dwgfx.drawimage(7, 0, 32, true);
};
if (game.offlinehighlighted){
dwgfx.drawimage(9, 0, 42, true);
};
if (game.visithighlighted){
dwgfx.drawimage(11, 0, 52, true);
};
};
};
if (game.test){
dwgfx.print(2, 2, game.teststring, 0xFF, 0xFF, 0xFF);
};
if (game.debugmode){
dwgfx.backbuffer.fillRect(new Rectangle(game.lastx, game.lasty, (int((mouseX / 4)) - game.lastx), (int((mouseY / 4)) - game.lasty)), 0x999999);
dwgfx.print(2, 134, ((((((String(game.lastx) + ",") + String(game.lasty)) + ": ") + String((int((mouseX / 4)) - game.lastx))) + ",") + String((int((mouseY / 4)) - game.lasty))), 0xFF, 0xFF, 0xFF);
};
if (game.flashlight > 0){
game.flashlight--;
dwgfx.flashlight();
};
if (game.screenshake > 0){
game.screenshake--;
dwgfx.screenshake();
dwgfx.backbuffer.unlock();
} else {
dwgfx.render();
dwgfx.backbuffer.unlock();
};
}
public function visit_sponsor_logo():void{
var sponsor_link:URLRequest = new URLRequest("http://www.kongregate.com/?gamereferral=dontlookback");
navigateToURL(sponsor_link, "_blank");
}
public function visit_sponsor(e:Event):void{
var sponsor_link:URLRequest = new URLRequest("http://www.kongregate.com/?gamereferral=dontlookback");
navigateToURL(sponsor_link, "_blank");
}
public function gamelogic(key:KeyPoll, dwgfx:dwgraphicsclass, game:gameclass, obj:entityclass, help:helpclass, music:musicclass):void{
var zi:int;
var i:int;
var j:int;
var qwei:int;
music.processmusic();
music.processamb();
music.processstep();
help.updateglow();
if (((obj.checkdamage(game)) && (!(obj.restartroom)))){
obj.restartroom = true;
obj.restartmode = 0;
obj.restartcounter = 0;
};
if (obj.restartroom){
if (obj.restartmode == -1){
zi = 0;
while (zi < obj.nentity) {
if ((((obj.entities[zi].type == 28)) || ((obj.entities[zi].type == 30)))){
obj.updateentities(zi, help, game, music);
obj.entities[zi].newxp = (obj.entities[zi].xp + obj.entities[zi].vx);
obj.entities[zi].newyp = (obj.entities[zi].yp + obj.entities[zi].vy);
obj.entities[zi].xp = obj.entities[zi].newxp;
obj.entities[zi].yp = obj.entities[zi].newyp;
};
zi++;
};
obj.restartcounter++;
if (obj.restartcounter == 30){
obj.restartcounter = 0;
obj.restartmode = 0;
};
} else {
if (obj.restartmode == 0){
game.screenshake = 0;
if (obj.restartcounter == 0){
if (obj.norestartsound == false){
music.playef(6, 200);
};
obj.norestartsound = false;
};
obj.restartcounter++;
if (obj.restartcounter == 10){
obj.restartmode = 1;
};
} else {
if (obj.restartmode == 1){
obj.restartcounter++;
if (obj.restartcounter == 12){
obj.restartmode = 2;
obj.restartcounter = 10;
if (game.startspecial){
help.globaltemp = obj.getplayer();
help.globaltemp2 = obj.entities[help.globaltemp].dir;
game.gotoroom(game.startroom, obj, help, music);
obj.createentity(game.startx, game.starty, 0);
if (game.eurydicemode){
obj.createentity((game.entx + 18), game.enty, 28);
};
help.globaltemp = obj.getplayer();
obj.entities[help.globaltemp].dir = help.globaltemp2;
} else {
game.gotoroom(game.currentroom, obj, help, music);
obj.createentity(game.entx, game.enty, 0);
if (game.eurydicemode){
obj.createentity((game.entx + 18), game.enty, 28);
};
help.globaltemp = obj.getplayer();
obj.entities[help.globaltemp].vx = game.entvx;
obj.entities[help.globaltemp].vy = game.entvy;
obj.entities[help.globaltemp].dir = game.entdir;
};
};
} else {
if (obj.restartmode == 2){
obj.restartcounter--;
if (obj.restartcounter == 0){
obj.restartmode = 0;
obj.restartroom = false;
game.shotdelay = 10;
};
};
};
};
};
} else {
game.updaterain(obj);
game.updatestate(obj, help, music);
obj.onladder = false;
if (obj.checkladder(game)){
obj.onladder = true;
};
i = 0;
while (i < obj.nentity) {
obj.entities[i].vx = (obj.entities[i].vx + obj.entities[i].ax);
obj.entities[i].vy = (obj.entities[i].vy + obj.entities[i].ay);
obj.entities[i].ax = 0;
if (obj.entities[i].jumping){
if (obj.entities[i].ay < 0){
obj.entities[i].ay++;
};
if (obj.entities[i].ay > -1){
obj.entities[i].ay = 0;
};
obj.entities[i].jumpframe--;
if (obj.entities[i].jumpframe <= 0){
obj.entities[i].jumping = false;
};
} else {
if (obj.onladder){
if (obj.entities[i].type == 0){
obj.entities[i].vy = (obj.entities[i].vy / 2);
obj.entities[i].bigfallcounter = 0;
obj.entities[i].onground = true;
obj.entities[i].ay = 0;
obj.entities[i].jumpframe = 0;
obj.entities[i].jumping = false;
} else {
if (obj.entities[i].gravity){
obj.entities[i].ay = 1;
};
};
} else {
if (obj.entities[i].gravity){
obj.entities[i].ay = 1;
};
};
};
if (obj.entities[i].gravity){
obj.applyfriction(i, 0.15, 0.5);
};
obj.entities[i].newxp = (obj.entities[i].xp + obj.entities[i].vx);
obj.entities[i].newyp = (obj.entities[i].yp + obj.entities[i].vy);
if ((((obj.entities[i].type == 0)) && ((game.currentroom == 0)))){
if (obj.entities[i].newxp < 30){
obj.entities[i].newxp = 30;
obj.entities[i].vx = 0;
};
};
if (obj.entities[i].type != 28){
if (obj.testwallsx(game, i, obj.entities[i].newxp, obj.entities[i].yp)){
obj.entities[i].xp = obj.entities[i].newxp;
} else {
if (obj.entities[i].onwall > 0){
obj.entities[i].state = obj.entities[i].onwall;
};
if (obj.entities[i].onxwall > 0){
obj.entities[i].state = obj.entities[i].onxwall;
};
};
if (obj.testwallsy(game, i, obj.entities[i].xp, obj.entities[i].newyp)){
obj.entities[i].yp = obj.entities[i].newyp;
} else {
if (obj.entities[i].onwall > 0){
obj.entities[i].state = obj.entities[i].onwall;
};
if (obj.entities[i].onywall > 0){
obj.entities[i].state = obj.entities[i].onywall;
};
obj.entities[i].jumpframe = 0;
};
if (!obj.testwallsx(game, i, obj.entities[i].xp, obj.entities[i].yp)){
if (((((((((((((((((((((!((obj.entities[i].type == 1))) && (!((obj.entities[i].type == 23))))) && (!((obj.entities[i].type == 24))))) && (!((obj.entities[i].type == 25))))) && (!((obj.entities[i].type == 2))))) && (!((obj.entities[i].type == 16))))) && (!((obj.entities[i].type == 15))))) && (!((obj.entities[i].type == 22))))) && (!((obj.entities[i].type == 17))))) && (!((obj.entities[i].type == 14))))) && (!((obj.entities[i].type == 14))))){
if (game.toggledeath){
obj.restartroom = true;
obj.restartmode = 0;
obj.restartcounter = 0;
} else {
obj.entities[i].yp = (obj.entities[i].yp - 3);
};
};
};
obj.animateentities(i, help, game);
j = (i + 1);
while (j < obj.nentity) {
if (i != j){
if (obj.entities[i].onentity){
if (obj.entitycollide(i, j)){
if ((((obj.entities[i].type == 1)) && ((obj.entities[i].state == 0)))){
if (obj.entities[j].onbullet > 0){
if (obj.entities[j].type == 27){
if (obj.entities[i].yp < 52){
obj.entities[j].state = obj.entities[j].onbullet;
} else {
music.playef(22);
};
obj.entities[j].bulletvel = obj.entities[i].vx;
obj.entities[i].state = 1;
} else {
obj.entities[j].state = obj.entities[j].onbullet;
obj.entities[j].bulletvel = obj.entities[i].vx;
obj.entities[i].state = 1;
};
} else {
obj.entities[i].state = 1;
};
};
if ((((obj.entities[j].type == 1)) && ((obj.entities[j].state == 0)))){
if (obj.entities[i].onbullet > 0){
if (obj.entities[i].type == 27){
if (obj.entities[j].yp < 52){
obj.entities[i].state = obj.entities[i].onbullet;
};
obj.entities[i].bulletvel = obj.entities[j].vx;
obj.entities[j].state = 1;
} else {
obj.entities[i].state = obj.entities[i].onbullet;
obj.entities[i].bulletvel = obj.entities[j].vx;
obj.entities[j].state = 1;
};
} else {
obj.entities[j].state = 1;
};
};
};
};
if ((((obj.entities[i].type == 0)) || ((obj.entities[j].type == 0)))){
if (((obj.entities[j].harmful) || (obj.entities[i].harmful))){
if (obj.entitycollide(i, j)){
if ((((obj.entities[i].size == 0)) && ((obj.entities[j].size == 0)))){
if (dwgfx.tiles[obj.entities[i].drawframe].hitTest(new Point(obj.entities[i].xp, obj.entities[i].yp), 1, dwgfx.tiles[obj.entities[j].drawframe], new Point(obj.entities[j].xp, obj.entities[j].yp), 1) == true){
obj.restartroom = true;
obj.restartmode = 0;
obj.restartcounter = 0;
};
} else {
obj.restartroom = true;
obj.restartmode = 0;
obj.restartcounter = 0;
};
};
};
if ((((obj.entities[j].onplayer > 0)) || ((obj.entities[i].onplayer > 0)))){
if (obj.entitycollide(i, j)){
if (obj.entities[i].onplayer > 0){
obj.entities[i].state = obj.entities[i].onplayer;
};
if (obj.entities[j].onplayer > 0){
obj.entities[j].state = obj.entities[j].onplayer;
};
};
};
};
};
j++;
};
} else {
obj.entities[i].xp = obj.entities[i].newxp;
obj.entities[i].yp = obj.entities[i].newyp;
};
if (obj.entitycollidefloor(game, i)){
obj.entities[i].bigfallcounter = 0;
obj.entities[i].onground = true;
if (obj.entities[i].bigfallframe == -1){
obj.entities[i].bigfallframe = 3;
if (obj.entities[i].type == 0){
music.playef(music.steptype);
};
};
if (((game.ongroundlasttime) && ((obj.entities[i].type == 0)))){
game.ongroundlasttime = false;
music.playef(music.steptype);
};
} else {
if (!obj.onladder){
if (obj.entities[i].type == 0){
game.ongroundlasttime = true;
};
obj.entities[i].onground = false;
obj.entities[i].bigfallcounter++;
if (obj.entities[i].bigfallcounter > 25){
obj.entities[i].bigfallframe = -1;
};
};
};
i++;
};
obj.activetrigger = -1;
if (obj.checktrigger(game)){
game.state = obj.activetrigger;
};
if (!obj.restartroom){
qwei = 0;
while (qwei < obj.nentity) {
if (!obj.updateentities(qwei, help, game, music)){
qwei--;
};
qwei++;
};
help.globaltemp = obj.getplayer();
if ((((obj.entities[help.globaltemp].xp < -7)) && ((game.door_left >= -1)))){
if (game.door_left == -1){
if (!obj.restartroom){
obj.restartroom = true;
obj.restartmode = 0;
obj.restartcounter = 0;
};
} else {
game.enty = obj.entities[help.globaltemp].yp;
game.entdir = obj.entities[help.globaltemp].dir;
game.entvx = obj.entities[help.globaltemp].vx;
game.entvy = obj.entities[help.globaltemp].vy;
help.globaltemp2 = obj.entities[help.globaltemp].bigfallcounter;
game.gotoroom(game.door_left, obj, help, music);
game.entx = 152;
obj.createentity(game.entx, game.enty, 0);
if (game.eurydicemode){
obj.createentity((game.entx + 18), game.enty, 28);
};
help.globaltemp = obj.getplayer();
obj.entities[help.globaltemp].dir = game.entdir;
obj.entities[help.globaltemp].bigfallcounter = help.globaltemp2;
obj.restartroom = false;
};
} else {
if ((((obj.entities[help.globaltemp].xp > 153)) && ((game.door_right >= -1)))){
if (game.door_right == -1){
if (!obj.restartroom){
obj.restartroom = true;
obj.restartmode = 0;
obj.restartcounter = 0;
};
} else {
game.enty = obj.entities[help.globaltemp].yp;
game.entdir = obj.entities[help.globaltemp].dir;
game.entvx = obj.entities[help.globaltemp].vx;
game.entvy = obj.entities[help.globaltemp].vy;
help.globaltemp2 = obj.entities[help.globaltemp].bigfallcounter;
game.gotoroom(game.door_right, obj, help, music);
game.entx = -6;
obj.createentity(game.entx, game.enty, 0);
if (game.eurydicemode){
obj.createentity((game.entx + 18), game.enty, 28);
};
help.globaltemp = obj.getplayer();
obj.entities[help.globaltemp].dir = game.entdir;
obj.entities[help.globaltemp].bigfallcounter = help.globaltemp2;
obj.restartroom = false;
};
} else {
if ((((obj.entities[help.globaltemp].yp < -4)) && ((game.door_up >= -1)))){
if (game.door_up == -1){
if (!obj.restartroom){
obj.restartroom = true;
obj.restartmode = 0;
obj.restartcounter = 0;
};
} else {
game.entx = obj.entities[help.globaltemp].xp;
game.entdir = obj.entities[help.globaltemp].dir;
game.entvx = obj.entities[help.globaltemp].vx;
game.entvy = obj.entities[help.globaltemp].vy;
help.globaltemp2 = obj.entities[help.globaltemp].bigfallcounter;
game.gotoroom(game.door_up, obj, help, music);
game.enty = 137;
obj.createentity(game.entx, game.enty, 0);
if (game.eurydicemode){
obj.createentity((game.entx + 18), game.enty, 28);
};
help.globaltemp = obj.getplayer();
obj.entities[help.globaltemp].vy = game.entvy;
obj.entities[help.globaltemp].dir = game.entdir;
obj.entities[help.globaltemp].bigfallcounter = help.globaltemp2;
obj.restartroom = false;
};
} else {
if ((((obj.entities[help.globaltemp].yp > 138)) && ((game.door_down >= -1)))){
if (game.door_down == -1){
if (!obj.restartroom){
obj.restartroom = true;
obj.restartmode = 0;
obj.restartcounter = 0;
};
} else {
game.entx = obj.entities[help.globaltemp].xp;
game.entdir = obj.entities[help.globaltemp].dir;
game.entvx = obj.entities[help.globaltemp].vx;
game.entvy = obj.entities[help.globaltemp].vy;
help.globaltemp2 = obj.entities[help.globaltemp].bigfallcounter;
game.gotoroom(game.door_down, obj, help, music);
game.enty = -3;
obj.createentity(game.entx, game.enty, 0);
if (game.eurydicemode){
obj.createentity((game.entx + 18), game.enty, 28);
};
help.globaltemp = obj.getplayer();
obj.entities[help.globaltemp].vy = game.entvy;
obj.entities[help.globaltemp].dir = game.entdir;
obj.entities[help.globaltemp].bigfallcounter = help.globaltemp2;
obj.restartroom = false;
};
};
};
};
};
};
};
}
public function lockedloop(e:Event):void{
dwgfx.backbuffer.lock();
dwgfx.bprint(5, 57, "Sorry! This game can", 0xFF, 177, 181, true);
dwgfx.bprint(5, 67, "only by played on", 0xFF, 177, 181, true);
dwgfx.bprint(5, 77, "www.distractionware.com", 0xFF, 177, 181, true);
dwgfx.render();
dwgfx.backbuffer.unlock();
help.updateglow();
}
public function sponsorloop(e:Event):void{
var pixel:uint;
var pixel2:uint;
dwgfx.backbuffer.lock();
dwgfx.backbuffer.fillRect(new Rectangle(0, 0, 160, 144), 1114884);
dwgfx.backbuffer.draw(slogo, logoposition);
dwgfx.backbuffer.fillRect(new Rectangle(0, 131, 160, 25), 1114884);
dwgfx.backbuffer.fillRect(new Rectangle(0, 0, 25, 131), 1114884);
dwgfx.backbuffer.fillRect(new Rectangle(133, 0, 27, 131), 1114884);
dwgfx.backbuffer.fillRect(new Rectangle(25, 0, 108, 14), 1114884);
pj = 14;
while (pj < 131) {
pi = 25;
while (pi < 133) {
pixel = dwgfx.backbuffer.getPixel(pi, pj);
pixel = ((pixel >> 16) & 0xFF);
if (pixel < 90){
pixel2 = 1114884;
} else {
if (pixel < 154){
pixel2 = 4522758;
} else {
if (pixel < 240){
pixel2 = 9383213;
} else {
pixel2 = 15832473;
};
};
};
dwgfx.backbuffer.setPixel(pi, pj, pixel2);
pi++;
};
pj++;
};
dwgfx.render();
dwgfx.backbuffer.unlock();
if (slogo.currentFrame == slogo.totalFrames){
slogo.stop();
slogo.removeEventListener(MouseEvent.CLICK, visit_sponsor);
removeEventListener(Event.ENTER_FRAME, sponsorloop);
addChild(dwgfx);
music.changeamb(0);
music.steptype = 0;
addEventListener(Event.ENTER_FRAME, mainloop);
};
if (((key.hasclicked) && (!(clickedlogo)))){
clickedlogo = true;
visit_sponsor_logo();
};
if (key.hasclicked){
key.click = false;
};
}
public function sitelock():Boolean{
var currUrl:String = stage.loaderInfo.url.toLowerCase();
if ((((currUrl.indexOf("distractionware.com") <= 0)) && ((currUrl.indexOf("flashgamelicense.com") <= 0)))){
return (true);
};
return (true);
}
public function gameinput(key:KeyPoll, dwgfx:dwgraphicsclass, game:gameclass, obj:entityclass, help:helpclass, music:musicclass):void{
var vci:Number;
var distractionware_link:URLRequest;
var offline_link:URLRequest;
var site_link:URLRequest;
var mysite_link:URLRequest;
var t:int;
game.mx = (mouseX / 4);
game.my = (mouseY / 4);
if (game.showmenu > 0){
game.newgamehighlighted = false;
game.offlinehighlighted = false;
game.visithighlighted = false;
game.restorehighlighted = false;
if (game.standaloneversion){
if (game.savepoint > 0){
if ((((game.my >= 31)) && ((game.my <= 37)))){
game.newgamehighlighted = true;
};
if ((((game.my >= 41)) && ((game.my <= 47)))){
game.restorehighlighted = true;
};
if ((((game.my >= 51)) && ((game.my <= 57)))){
game.visithighlighted = true;
};
} else {
if ((((game.my >= 36)) && ((game.my <= 42)))){
game.newgamehighlighted = true;
};
if ((((game.my >= 46)) && ((game.my <= 52)))){
game.visithighlighted = true;
};
};
} else {
if (game.savepoint > 0){
if ((((game.my >= 27)) && ((game.my <= 33)))){
game.newgamehighlighted = true;
};
if ((((game.my >= 37)) && ((game.my <= 42)))){
game.restorehighlighted = true;
};
if ((((game.my >= 45)) && ((game.my <= 51)))){
game.offlinehighlighted = true;
};
if ((((game.my >= 54)) && ((game.my <= 60)))){
game.visithighlighted = true;
};
} else {
if ((((game.my >= 31)) && ((game.my <= 37)))){
game.newgamehighlighted = true;
};
if ((((game.my >= 41)) && ((game.my <= 47)))){
game.offlinehighlighted = true;
};
if ((((game.my >= 51)) && ((game.my <= 57)))){
game.visithighlighted = true;
};
};
};
if (key.click){
if (game.newgamehighlighted){
vci = 0;
while (vci < 300) {
obj.flags[vci] = 0;
vci++;
};
game.toggledeath = false;
game.flashlight = 0;
game.screenshake = 0;
game.eurydicemode = false;
game.rain = true;
game.hasgun = false;
game.createtrigger(130, 0, 10, 150, 8);
game.offlinehighlighted = false;
game.visithighlighted = false;
game.restorehighlighted = false;
game.state = 24;
game.showmenu = 0;
};
if (game.restorehighlighted){
game.offlinehighlighted = false;
game.visithighlighted = false;
game.newgamehighlighted = false;
game.state = 33;
game.showmenu = 0;
};
if (game.visithighlighted){
distractionware_link = new URLRequest("http://www.distractionware.com");
navigateToURL(distractionware_link, "_blank");
};
if (game.offlinehighlighted){
offline_link = new URLRequest("http://www.distractionware.com/games/flash/dontlookback/offline/");
navigateToURL(offline_link, "_blank");
};
if (game.showmenu > 0){
if ((((game.my >= 134)) && ((game.my <= 142)))){
if (game.kongversion){
site_link = new URLRequest("http://www.kongregate.com/?gamereferral=dontlookback");
navigateToURL(site_link, "_blank");
} else {
mysite_link = new URLRequest("http://www.distractionware.com");
navigateToURL(mysite_link, "_blank");
};
};
};
};
};
var i:int;
while (i < obj.nentity) {
if (obj.entities[i].type == 0){
if (obj.entities[i].bigfallframe <= 0){
if (game.hascontrol){
if (((key.isDown(Keyboard.LEFT)) || (key.isDown(65)))){
music.playstep(music.steptype);
obj.entities[i].vx = -2;
obj.entities[i].dir = 0;
} else {
if (((key.isDown(Keyboard.RIGHT)) || (key.isDown(68)))){
if (((game.eurydicemode) && (!(obj.restartroom)))){
if (obj.entities[i].onground){
music.playstep(music.steptype);
};
obj.restartroom = true;
obj.restartmode = -1;
obj.restartcounter = 0;
obj.entities[i].dir = 1;
obj.entities[obj.geteurydice()].state = 1;
obj.animateentities(i, help, game);
} else {
if (obj.entities[i].onground){
music.playstep(music.steptype);
};
obj.entities[i].vx = 2;
obj.entities[i].dir = 1;
};
} else {
obj.entities[i].vx = 0;
music.stopstep();
};
};
if (!obj.entities[i].onground){
music.stopstep();
};
if (obj.restartroom){
music.stopstep();
};
if (obj.onladder){
game.jumpheld = false;
if (((((key.isDown(Keyboard.UP)) || (key.isDown(90)))) || (key.isDown(87)))){
if (((obj.entities[i].onground) && (!(obj.entities[i].jumping)))){
obj.entities[i].ay = -2;
obj.entities[i].jumping = true;
obj.entities[i].jumpframe = 2;
};
} else {
if (((key.isDown(Keyboard.DOWN)) || (key.isDown(83)))){
obj.entities[i].vy = 4;
};
};
} else {
if (((((key.isUp(Keyboard.UP)) && (key.isUp(90)))) && (key.isUp(87)))){
game.jumpheld = false;
};
if (((((((key.isDown(Keyboard.UP)) || (key.isDown(90)))) || (key.isDown(87)))) && (!(game.jumpheld)))){
game.jumpheld = true;
if (((obj.entities[i].onground) && (!(obj.entities[i].jumping)))){
obj.entities[i].ay = -5;
obj.entities[i].jumping = true;
obj.entities[i].jumpframe = 10;
};
};
};
if (((key.isDown(Keyboard.SPACE)) || (key.isDown(88)))){
game.isshooting = true;
} else {
game.isshooting = false;
};
if (((game.hasgun) && (!(obj.restartroom)))){
game.shotdelay--;
if (game.shotdelay <= 0){
game.shotdelay = 0;
};
if (((((key.isDown(Keyboard.SPACE)) || (key.isDown(88)))) && ((game.shotdelay <= 0)))){
music.playef(4);
game.shotdelay = 12;
t = obj.getplayer();
if (t > -1){
if (obj.entities[t].dir == 0){
obj.createentity((obj.entities[t].xp + 6), (obj.entities[t].yp + 6), 1, (-7 + obj.entities[t].vx), 0);
};
if (obj.entities[t].dir == 1){
obj.createentity((obj.entities[t].xp + 4), (obj.entities[t].yp + 6), 1, (7 + obj.entities[t].vx), 0);
};
};
};
};
} else {
obj.entities[i].vx = 0;
};
} else {
obj.entities[i].vx = (obj.entities[i].vx / 2);
};
};
i++;
};
}
private function sponsorinit():void{
slogo = new KONG_30FPS();
slogo.addEventListener(MouseEvent.CLICK, visit_sponsor);
addChild(dwgfx);
logoposition = new Matrix();
logoposition.scale(0.65, 0.65);
logoposition.translate(84, 87);
clickedlogo = false;
addEventListener(Event.ENTER_FRAME, sponsorloop);
}
public function visit_distractionware(e:Event):void{
var distractionware_link:URLRequest = new URLRequest("http://www.distractionware.com");
navigateToURL(distractionware_link, "_blank");
}
public function getsite():String{
var currUrl:String = stage.loaderInfo.url.toLowerCase();
return (currUrl);
}
public function mainloop(e:Event):void{
if (((game.paused) || (!(game.infocus)))){
if (game.globalsound > 0){
game.globalsound = 0;
SoundMixer.soundTransform = new SoundTransform(0);
};
dwgfx.backbuffer.lock();
dwgfx.backbuffer.fillRect(new Rectangle(0, 0, 160, 144), 1114884);
dwgfx.bprint(5, 60, "[Game paused]", 253, 196, 195, true);
dwgfx.bprint(5, 70, "Click to resume", 253, 196, 195, true);
dwgfx.bprint(5, 134, "[Press M to Mute in game]", 253, 196, 195, true);
dwgfx.render();
dwgfx.backbuffer.unlock();
music.processmusic();
music.processamb();
music.processstep();
} else {
gamerender(key, dwgfx, game, obj, help);
gameinput(key, dwgfx, game, obj, help, music);
gamelogic(key, dwgfx, game, obj, help, music);
if (((key.isDown(77)) && ((game.mutebutton <= 0)))){
game.mutebutton = 8;
if (game.muted){
game.muted = false;
} else {
game.muted = true;
};
};
if (game.mutebutton > 0){
game.mutebutton--;
};
if (game.muted){
if (game.globalsound == 1){
game.globalsound = 0;
SoundMixer.soundTransform = new SoundTransform(0);
};
};
if (((!(game.muted)) && ((game.globalsound == 0)))){
game.globalsound = 1;
SoundMixer.soundTransform = new SoundTransform(1);
};
};
if (key.hasclicked){
key.click = false;
};
}
}
}//package
Section 30
//Main_amb_1 (Main_amb_1)
package {
import mx.core.*;
public class Main_amb_1 extends SoundAsset {
}
}//package
Section 31
//Main_amb_2 (Main_amb_2)
package {
import mx.core.*;
public class Main_amb_2 extends SoundAsset {
}
}//package
Section 32
//Main_amb_3 (Main_amb_3)
package {
import mx.core.*;
public class Main_amb_3 extends SoundAsset {
}
}//package
Section 33
//Main_amb_4 (Main_amb_4)
package {
import mx.core.*;
public class Main_amb_4 extends SoundAsset {
}
}//package
Section 34
//Main_ef_0 (Main_ef_0)
package {
import mx.core.*;
public class Main_ef_0 extends SoundAsset {
}
}//package
Section 35
//Main_ef_1 (Main_ef_1)
package {
import mx.core.*;
public class Main_ef_1 extends SoundAsset {
}
}//package
Section 36
//Main_ef_10 (Main_ef_10)
package {
import mx.core.*;
public class Main_ef_10 extends SoundAsset {
}
}//package
Section 37
//Main_ef_11 (Main_ef_11)
package {
import mx.core.*;
public class Main_ef_11 extends SoundAsset {
}
}//package
Section 38
//Main_ef_12 (Main_ef_12)
package {
import mx.core.*;
public class Main_ef_12 extends SoundAsset {
}
}//package
Section 39
//Main_ef_13 (Main_ef_13)
package {
import mx.core.*;
public class Main_ef_13 extends SoundAsset {
}
}//package
Section 40
//Main_ef_14 (Main_ef_14)
package {
import mx.core.*;
public class Main_ef_14 extends SoundAsset {
}
}//package
Section 41
//Main_ef_15 (Main_ef_15)
package {
import mx.core.*;
public class Main_ef_15 extends SoundAsset {
}
}//package
Section 42
//Main_ef_16 (Main_ef_16)
package {
import mx.core.*;
public class Main_ef_16 extends SoundAsset {
}
}//package
Section 43
//Main_ef_17 (Main_ef_17)
package {
import mx.core.*;
public class Main_ef_17 extends SoundAsset {
}
}//package
Section 44
//Main_ef_18 (Main_ef_18)
package {
import mx.core.*;
public class Main_ef_18 extends SoundAsset {
}
}//package
Section 45
//Main_ef_19 (Main_ef_19)
package {
import mx.core.*;
public class Main_ef_19 extends SoundAsset {
}
}//package
Section 46
//Main_ef_2 (Main_ef_2)
package {
import mx.core.*;
public class Main_ef_2 extends SoundAsset {
}
}//package
Section 47
//Main_ef_20 (Main_ef_20)
package {
import mx.core.*;
public class Main_ef_20 extends SoundAsset {
}
}//package
Section 48
//Main_ef_21 (Main_ef_21)
package {
import mx.core.*;
public class Main_ef_21 extends SoundAsset {
}
}//package
Section 49
//Main_ef_22 (Main_ef_22)
package {
import mx.core.*;
public class Main_ef_22 extends SoundAsset {
}
}//package
Section 50
//Main_ef_3 (Main_ef_3)
package {
import mx.core.*;
public class Main_ef_3 extends SoundAsset {
}
}//package
Section 51
//Main_ef_4 (Main_ef_4)
package {
import mx.core.*;
public class Main_ef_4 extends SoundAsset {
}
}//package
Section 52
//Main_ef_5 (Main_ef_5)
package {
import mx.core.*;
public class Main_ef_5 extends SoundAsset {
}
}//package
Section 53
//Main_ef_6 (Main_ef_6)
package {
import mx.core.*;
public class Main_ef_6 extends SoundAsset {
}
}//package
Section 54
//Main_ef_7 (Main_ef_7)
package {
import mx.core.*;
public class Main_ef_7 extends SoundAsset {
}
}//package
Section 55
//Main_ef_8 (Main_ef_8)
package {
import mx.core.*;
public class Main_ef_8 extends SoundAsset {
}
}//package
Section 56
//Main_ef_9 (Main_ef_9)
package {
import mx.core.*;
public class Main_ef_9 extends SoundAsset {
}
}//package
Section 57
//Main_footsteps_1 (Main_footsteps_1)
package {
import mx.core.*;
public class Main_footsteps_1 extends SoundAsset {
}
}//package
Section 58
//Main_footsteps_2 (Main_footsteps_2)
package {
import mx.core.*;
public class Main_footsteps_2 extends SoundAsset {
}
}//package
Section 59
//Main_footsteps_3 (Main_footsteps_3)
package {
import mx.core.*;
public class Main_footsteps_3 extends SoundAsset {
}
}//package
Section 60
//Main_im_background_0 (Main_im_background_0)
package {
import mx.core.*;
public class Main_im_background_0 extends BitmapAsset {
}
}//package
Section 61
//Main_im_background_1 (Main_im_background_1)
package {
import mx.core.*;
public class Main_im_background_1 extends BitmapAsset {
}
}//package
Section 62
//Main_im_background_10 (Main_im_background_10)
package {
import mx.core.*;
public class Main_im_background_10 extends BitmapAsset {
}
}//package
Section 63
//Main_im_background_11 (Main_im_background_11)
package {
import mx.core.*;
public class Main_im_background_11 extends BitmapAsset {
}
}//package
Section 64
//Main_im_background_12 (Main_im_background_12)
package {
import mx.core.*;
public class Main_im_background_12 extends BitmapAsset {
}
}//package
Section 65
//Main_im_background_13 (Main_im_background_13)
package {
import mx.core.*;
public class Main_im_background_13 extends BitmapAsset {
}
}//package
Section 66
//Main_im_background_14 (Main_im_background_14)
package {
import mx.core.*;
public class Main_im_background_14 extends BitmapAsset {
}
}//package
Section 67
//Main_im_background_15 (Main_im_background_15)
package {
import mx.core.*;
public class Main_im_background_15 extends BitmapAsset {
}
}//package
Section 68
//Main_im_background_16 (Main_im_background_16)
package {
import mx.core.*;
public class Main_im_background_16 extends BitmapAsset {
}
}//package
Section 69
//Main_im_background_17 (Main_im_background_17)
package {
import mx.core.*;
public class Main_im_background_17 extends BitmapAsset {
}
}//package
Section 70
//Main_im_background_18 (Main_im_background_18)
package {
import mx.core.*;
public class Main_im_background_18 extends BitmapAsset {
}
}//package
Section 71
//Main_im_background_19 (Main_im_background_19)
package {
import mx.core.*;
public class Main_im_background_19 extends BitmapAsset {
}
}//package
Section 72
//Main_im_background_2 (Main_im_background_2)
package {
import mx.core.*;
public class Main_im_background_2 extends BitmapAsset {
}
}//package
Section 73
//Main_im_background_20 (Main_im_background_20)
package {
import mx.core.*;
public class Main_im_background_20 extends BitmapAsset {
}
}//package
Section 74
//Main_im_background_21 (Main_im_background_21)
package {
import mx.core.*;
public class Main_im_background_21 extends BitmapAsset {
}
}//package
Section 75
//Main_im_background_22 (Main_im_background_22)
package {
import mx.core.*;
public class Main_im_background_22 extends BitmapAsset {
}
}//package
Section 76
//Main_im_background_23 (Main_im_background_23)
package {
import mx.core.*;
public class Main_im_background_23 extends BitmapAsset {
}
}//package
Section 77
//Main_im_background_24 (Main_im_background_24)
package {
import mx.core.*;
public class Main_im_background_24 extends BitmapAsset {
}
}//package
Section 78
//Main_im_background_25 (Main_im_background_25)
package {
import mx.core.*;
public class Main_im_background_25 extends BitmapAsset {
}
}//package
Section 79
//Main_im_background_26 (Main_im_background_26)
package {
import mx.core.*;
public class Main_im_background_26 extends BitmapAsset {
}
}//package
Section 80
//Main_im_background_27 (Main_im_background_27)
package {
import mx.core.*;
public class Main_im_background_27 extends BitmapAsset {
}
}//package
Section 81
//Main_im_background_28 (Main_im_background_28)
package {
import mx.core.*;
public class Main_im_background_28 extends BitmapAsset {
}
}//package
Section 82
//Main_im_background_29 (Main_im_background_29)
package {
import mx.core.*;
public class Main_im_background_29 extends BitmapAsset {
}
}//package
Section 83
//Main_im_background_3 (Main_im_background_3)
package {
import mx.core.*;
public class Main_im_background_3 extends BitmapAsset {
}
}//package
Section 84
//Main_im_background_30 (Main_im_background_30)
package {
import mx.core.*;
public class Main_im_background_30 extends BitmapAsset {
}
}//package
Section 85
//Main_im_background_31 (Main_im_background_31)
package {
import mx.core.*;
public class Main_im_background_31 extends BitmapAsset {
}
}//package
Section 86
//Main_im_background_32 (Main_im_background_32)
package {
import mx.core.*;
public class Main_im_background_32 extends BitmapAsset {
}
}//package
Section 87
//Main_im_background_33 (Main_im_background_33)
package {
import mx.core.*;
public class Main_im_background_33 extends BitmapAsset {
}
}//package
Section 88
//Main_im_background_34 (Main_im_background_34)
package {
import mx.core.*;
public class Main_im_background_34 extends BitmapAsset {
}
}//package
Section 89
//Main_im_background_35 (Main_im_background_35)
package {
import mx.core.*;
public class Main_im_background_35 extends BitmapAsset {
}
}//package
Section 90
//Main_im_background_36 (Main_im_background_36)
package {
import mx.core.*;
public class Main_im_background_36 extends BitmapAsset {
}
}//package
Section 91
//Main_im_background_37 (Main_im_background_37)
package {
import mx.core.*;
public class Main_im_background_37 extends BitmapAsset {
}
}//package
Section 92
//Main_im_background_38 (Main_im_background_38)
package {
import mx.core.*;
public class Main_im_background_38 extends BitmapAsset {
}
}//package
Section 93
//Main_im_background_39 (Main_im_background_39)
package {
import mx.core.*;
public class Main_im_background_39 extends BitmapAsset {
}
}//package
Section 94
//Main_im_background_4 (Main_im_background_4)
package {
import mx.core.*;
public class Main_im_background_4 extends BitmapAsset {
}
}//package
Section 95
//Main_im_background_40 (Main_im_background_40)
package {
import mx.core.*;
public class Main_im_background_40 extends BitmapAsset {
}
}//package
Section 96
//Main_im_background_41 (Main_im_background_41)
package {
import mx.core.*;
public class Main_im_background_41 extends BitmapAsset {
}
}//package
Section 97
//Main_im_background_42 (Main_im_background_42)
package {
import mx.core.*;
public class Main_im_background_42 extends BitmapAsset {
}
}//package
Section 98
//Main_im_background_43 (Main_im_background_43)
package {
import mx.core.*;
public class Main_im_background_43 extends BitmapAsset {
}
}//package
Section 99
//Main_im_background_44 (Main_im_background_44)
package {
import mx.core.*;
public class Main_im_background_44 extends BitmapAsset {
}
}//package
Section 100
//Main_im_background_45 (Main_im_background_45)
package {
import mx.core.*;
public class Main_im_background_45 extends BitmapAsset {
}
}//package
Section 101
//Main_im_background_46 (Main_im_background_46)
package {
import mx.core.*;
public class Main_im_background_46 extends BitmapAsset {
}
}//package
Section 102
//Main_im_background_47 (Main_im_background_47)
package {
import mx.core.*;
public class Main_im_background_47 extends BitmapAsset {
}
}//package
Section 103
//Main_im_background_48 (Main_im_background_48)
package {
import mx.core.*;
public class Main_im_background_48 extends BitmapAsset {
}
}//package
Section 104
//Main_im_background_49 (Main_im_background_49)
package {
import mx.core.*;
public class Main_im_background_49 extends BitmapAsset {
}
}//package
Section 105
//Main_im_background_5 (Main_im_background_5)
package {
import mx.core.*;
public class Main_im_background_5 extends BitmapAsset {
}
}//package
Section 106
//Main_im_background_50 (Main_im_background_50)
package {
import mx.core.*;
public class Main_im_background_50 extends BitmapAsset {
}
}//package
Section 107
//Main_im_background_51 (Main_im_background_51)
package {
import mx.core.*;
public class Main_im_background_51 extends BitmapAsset {
}
}//package
Section 108
//Main_im_background_52 (Main_im_background_52)
package {
import mx.core.*;
public class Main_im_background_52 extends BitmapAsset {
}
}//package
Section 109
//Main_im_background_53 (Main_im_background_53)
package {
import mx.core.*;
public class Main_im_background_53 extends BitmapAsset {
}
}//package
Section 110
//Main_im_background_54 (Main_im_background_54)
package {
import mx.core.*;
public class Main_im_background_54 extends BitmapAsset {
}
}//package
Section 111
//Main_im_background_55 (Main_im_background_55)
package {
import mx.core.*;
public class Main_im_background_55 extends BitmapAsset {
}
}//package
Section 112
//Main_im_background_56 (Main_im_background_56)
package {
import mx.core.*;
public class Main_im_background_56 extends BitmapAsset {
}
}//package
Section 113
//Main_im_background_57 (Main_im_background_57)
package {
import mx.core.*;
public class Main_im_background_57 extends BitmapAsset {
}
}//package
Section 114
//Main_im_background_58 (Main_im_background_58)
package {
import mx.core.*;
public class Main_im_background_58 extends BitmapAsset {
}
}//package
Section 115
//Main_im_background_59 (Main_im_background_59)
package {
import mx.core.*;
public class Main_im_background_59 extends BitmapAsset {
}
}//package
Section 116
//Main_im_background_6 (Main_im_background_6)
package {
import mx.core.*;
public class Main_im_background_6 extends BitmapAsset {
}
}//package
Section 117
//Main_im_background_60 (Main_im_background_60)
package {
import mx.core.*;
public class Main_im_background_60 extends BitmapAsset {
}
}//package
Section 118
//Main_im_background_7 (Main_im_background_7)
package {
import mx.core.*;
public class Main_im_background_7 extends BitmapAsset {
}
}//package
Section 119
//Main_im_background_8 (Main_im_background_8)
package {
import mx.core.*;
public class Main_im_background_8 extends BitmapAsset {
}
}//package
Section 120
//Main_im_background_9 (Main_im_background_9)
package {
import mx.core.*;
public class Main_im_background_9 extends BitmapAsset {
}
}//package
Section 121
//Main_im_bfont (Main_im_bfont)
package {
import mx.core.*;
public class Main_im_bfont extends BitmapAsset {
}
}//package
Section 122
//Main_im_bfontmask (Main_im_bfontmask)
package {
import mx.core.*;
public class Main_im_bfontmask extends BitmapAsset {
}
}//package
Section 123
//Main_im_creditline1 (Main_im_creditline1)
package {
import mx.core.*;
public class Main_im_creditline1 extends BitmapAsset {
}
}//package
Section 124
//Main_im_creditline2 (Main_im_creditline2)
package {
import mx.core.*;
public class Main_im_creditline2 extends BitmapAsset {
}
}//package
Section 125
//Main_im_opt_fullscreen1 (Main_im_opt_fullscreen1)
package {
import mx.core.*;
public class Main_im_opt_fullscreen1 extends BitmapAsset {
}
}//package
Section 126
//Main_im_opt_fullscreen2 (Main_im_opt_fullscreen2)
package {
import mx.core.*;
public class Main_im_opt_fullscreen2 extends BitmapAsset {
}
}//package
Section 127
//Main_im_opt_newgame1 (Main_im_opt_newgame1)
package {
import mx.core.*;
public class Main_im_opt_newgame1 extends BitmapAsset {
}
}//package
Section 128
//Main_im_opt_newgame2 (Main_im_opt_newgame2)
package {
import mx.core.*;
public class Main_im_opt_newgame2 extends BitmapAsset {
}
}//package
Section 129
//Main_im_opt_offline1 (Main_im_opt_offline1)
package {
import mx.core.*;
public class Main_im_opt_offline1 extends BitmapAsset {
}
}//package
Section 130
//Main_im_opt_offline2 (Main_im_opt_offline2)
package {
import mx.core.*;
public class Main_im_opt_offline2 extends BitmapAsset {
}
}//package
Section 131
//Main_im_opt_restore1 (Main_im_opt_restore1)
package {
import mx.core.*;
public class Main_im_opt_restore1 extends BitmapAsset {
}
}//package
Section 132
//Main_im_opt_restore2 (Main_im_opt_restore2)
package {
import mx.core.*;
public class Main_im_opt_restore2 extends BitmapAsset {
}
}//package
Section 133
//Main_im_opt_visitsite1 (Main_im_opt_visitsite1)
package {
import mx.core.*;
public class Main_im_opt_visitsite1 extends BitmapAsset {
}
}//package
Section 134
//Main_im_opt_visitsite2 (Main_im_opt_visitsite2)
package {
import mx.core.*;
public class Main_im_opt_visitsite2 extends BitmapAsset {
}
}//package
Section 135
//Main_im_pressarrowkeys (Main_im_pressarrowkeys)
package {
import mx.core.*;
public class Main_im_pressarrowkeys extends BitmapAsset {
}
}//package
Section 136
//Main_im_pressxorspace (Main_im_pressxorspace)
package {
import mx.core.*;
public class Main_im_pressxorspace extends BitmapAsset {
}
}//package
Section 137
//Main_im_presszorup (Main_im_presszorup)
package {
import mx.core.*;
public class Main_im_presszorup extends BitmapAsset {
}
}//package
Section 138
//Main_im_sponscreditline1 (Main_im_sponscreditline1)
package {
import mx.core.*;
public class Main_im_sponscreditline1 extends BitmapAsset {
}
}//package
Section 139
//Main_im_sponscreditline2 (Main_im_sponscreditline2)
package {
import mx.core.*;
public class Main_im_sponscreditline2 extends BitmapAsset {
}
}//package
Section 140
//Main_im_sponsorwebsite (Main_im_sponsorwebsite)
package {
import mx.core.*;
public class Main_im_sponsorwebsite extends BitmapAsset {
}
}//package
Section 141
//Main_im_sponsorwebsite2 (Main_im_sponsorwebsite2)
package {
import mx.core.*;
public class Main_im_sponsorwebsite2 extends BitmapAsset {
}
}//package
Section 142
//Main_im_tiles (Main_im_tiles)
package {
import mx.core.*;
public class Main_im_tiles extends BitmapAsset {
}
}//package
Section 143
//Main_im_title1 (Main_im_title1)
package {
import mx.core.*;
public class Main_im_title1 extends BitmapAsset {
}
}//package
Section 144
//Main_im_title2 (Main_im_title2)
package {
import mx.core.*;
public class Main_im_title2 extends BitmapAsset {
}
}//package
Section 145
//Main_im_website (Main_im_website)
package {
import mx.core.*;
public class Main_im_website extends BitmapAsset {
}
}//package
Section 146
//Main_music_1 (Main_music_1)
package {
import mx.core.*;
public class Main_music_1 extends SoundAsset {
}
}//package
Section 147
//Main_music_2 (Main_music_2)
package {
import mx.core.*;
public class Main_music_2 extends SoundAsset {
}
}//package
Section 148
//Main_music_3 (Main_music_3)
package {
import mx.core.*;
public class Main_music_3 extends SoundAsset {
}
}//package
Section 149
//Main_music_4 (Main_music_4)
package {
import mx.core.*;
public class Main_music_4 extends SoundAsset {
}
}//package
Section 150
//musicclass (musicclass)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
public class musicclass extends Sprite {
public var stepstopother:int;
public var ambchan:Array;
public var ambchanlen:int;
public var currentsong:int;
public var step2playing:Boolean;
public var ambchannel:SoundChannel;
public var musicfadein:int;
public var currentstepchan:int;
public var currentamb:int;
public var currentmusicchan:int;
public var stepchan:Array;
public var musicfade:int;
public var step1playing:Boolean;
public var currentefchan:int;
public var steptype:int;
public var ambchancur:int;
public var playingsteps:Boolean;
public var musicchannel:SoundChannel;
public var amb2active:Boolean;
public var musicchannel2:SoundChannel;
public var ambchannel2:SoundChannel;
public var stepchannel:SoundChannel;
public var musicstopother:int;
public var currentstep:int;
public var musicchanlen:int;
public var stopother:int;
public var stepchanlen:int;
public var efchannel:Array;
public var stepchannel2:SoundChannel;
public var stepchancur:int;
public var musicchancur:int;
public var currentambchan:int;
public var efchan:Array;
public var musicchan:Array;
public function musicclass(){
ambchan = new Array();
musicchan = new Array();
stepchan = new Array();
efchannel = new Array();
efchan = new Array();
super();
}
public function playstep(t:int):void{
if (currentstep != t){
if (currentstep != -1){
stepchanlen = 0;
stepchancur = stepchanlen;
currentstepchan = 0;
stepstopother = 0;
if (step1playing){
stepchannel.stop();
};
if (step2playing){
stepchannel2.stop();
};
};
if (t != -1){
if (t == 0){
stepchanlen = 64;
};
if (t == 1){
stepchanlen = 52;
};
if (t == 2){
stepchanlen = 52;
};
stepchancur = stepchanlen;
currentstepchan = 0;
currentstep = t;
stepchannel = stepchan[currentstep].play();
step1playing = true;
step2playing = false;
} else {
currentstep = -1;
};
};
}
public function initefchannels():void{
var i:int;
while (i < 16) {
efchannel.push(new SoundChannel());
i++;
};
}
public function changeamb(t:int):void{
if (currentamb != t){
if (currentamb != -1){
ambchanlen = 0;
ambchancur = ambchanlen;
currentambchan = 0;
stopother = 0;
ambchannel.stop();
if (amb2active){
ambchannel2.stop();
};
};
if (t != -1){
if (t == 0){
ambchanlen = 285;
};
if (t == 1){
ambchanlen = 360;
};
if (t == 2){
ambchanlen = 120;
};
if (t == 3){
ambchanlen = 480;
};
ambchancur = ambchanlen;
currentambchan = 0;
currentamb = t;
ambchannel = ambchan[currentamb].play();
} else {
currentamb = -1;
};
};
}
public function processmusicfade():void{
musicfade--;
if (musicfade > 0){
if (currentmusicchan == 0){
musicchannel.soundTransform = new SoundTransform((musicfade / 60));
};
if (currentmusicchan == 1){
musicchannel2.soundTransform = new SoundTransform((musicfade / 60));
};
} else {
if (currentmusicchan == 0){
musicchannel.stop();
};
if (currentmusicchan == 1){
musicchannel2.stop();
};
currentsong = -1;
};
}
public function processmusic():void{
if (musicfade > 0){
processmusicfade();
};
if (musicfadein > 0){
processmusicfadein();
};
musicstopother--;
if (musicstopother == 1){
musicstopother = 0;
if (currentmusicchan == 0){
musicchannel2.stop();
};
if (currentmusicchan == 1){
musicchannel.stop();
};
};
if (musicstopother < 0){
musicstopother = 0;
};
musicchancur--;
if ((((((musicchancur <= 0)) && ((currentsong > -1)))) && ((musicchanlen > 0)))){
musicchancur = musicchanlen;
if (currentmusicchan == 0){
musicchannel2 = musicchan[currentsong].play();
musicstopother = 3;
currentmusicchan = 1;
} else {
musicchannel = musicchan[currentsong].play();
musicstopother = 3;
currentmusicchan = 0;
};
};
}
public function play(t:int):void{
if (currentsong != t){
if (currentsong != -1){
musicchanlen = 0;
musicchancur = musicchanlen;
currentmusicchan = 0;
musicstopother = 0;
musicchannel.stop();
musicchannel2.stop();
};
if (t != -1){
musicchanlen = -1;
if (t == 2){
musicchanlen = 1231;
};
if (t == 3){
musicchanlen = 3280;
};
musicchancur = musicchanlen;
currentmusicchan = 0;
currentsong = t;
if (currentsong == 3){
musicfadein = 61;
musicchannel = musicchan[currentsong].play(0, 0, new SoundTransform(0));
} else {
musicchannel = musicchan[currentsong].play();
};
if (musicchanlen < 0){
musicchannel.addEventListener(Event.SOUND_COMPLETE, stopmusic);
};
} else {
currentsong = -1;
};
};
}
public function processmusicfadein():void{
musicfadein--;
if (musicfadein > 0){
musicchannel.soundTransform = new SoundTransform(((60 - musicfadein) / 60));
} else {
musicchannel.soundTransform = new SoundTransform(1);
};
}
public function processstep():void{
stepstopother--;
if (stepstopother == 1){
stepstopother = 0;
if (currentstepchan == 0){
stepchannel2.stop();
step2playing = false;
};
if (currentstepchan == 1){
stepchannel.stop();
step1playing = false;
};
};
if (stepstopother < 0){
stepstopother = 0;
};
stepchancur--;
if ((((((stepchancur <= 0)) && ((currentstep > -1)))) && ((stepchanlen > 0)))){
stepchancur = stepchanlen;
if (currentstepchan == 0){
stepchannel2 = stepchan[currentstep].play();
step2playing = true;
stepstopother = 3;
currentstepchan = 1;
} else {
stepchannel = stepchan[currentstep].play();
step1playing = true;
stepstopother = 3;
currentstepchan = 0;
};
};
}
public function fadeout():void{
if ((((currentsong == 2)) || ((currentsong == 3)))){
if (musicfade == 0){
musicchannel.removeEventListener(Event.SOUND_COMPLETE, stopmusic);
musicfade = 61;
};
} else {
if (currentsong == 0){
if (musicfade == 0){
musicfade = 61;
};
};
};
}
public function stopstep():void{
if (step1playing){
stepchannel.stop();
step1playing = false;
};
if (step2playing){
stepchannel2.stop();
step2playing = false;
};
currentstep = -1;
}
public function playef(t:int, offset:int=0):void{
efchannel[currentefchan] = efchan[t].play(offset);
currentefchan++;
if (currentefchan > 15){
currentefchan = (currentefchan - 16);
};
}
public function loopamb1(e:Event):void{
ambchannel.removeEventListener(Event.SOUND_COMPLETE, loopamb1);
ambchannel = ambchan[currentamb].play(0, 0, new SoundTransform(0.5));
ambchannel.addEventListener(Event.SOUND_COMPLETE, loopamb1);
}
public function loopamb2(e:Event):void{
ambchannel.removeEventListener(Event.SOUND_COMPLETE, loopamb2);
ambchannel2 = ambchan[currentamb].play(0, 0, new SoundTransform(0.5));
ambchannel2.addEventListener(Event.SOUND_COMPLETE, loopamb2);
}
public function stopmusic(e:Event):void{
musicchannel.removeEventListener(Event.SOUND_COMPLETE, stopmusic);
musicchannel.stop();
currentsong = -1;
}
public function processamb():void{
stopother--;
if (stopother == 1){
stopother = 0;
if (currentambchan == 0){
ambchannel2.stop();
};
if (currentambchan == 1){
ambchannel.stop();
};
};
if (stopother < 0){
stopother = 0;
};
ambchancur--;
if ((((ambchancur <= 0)) && ((currentamb > -1)))){
ambchancur = ambchanlen;
if (currentambchan == 0){
amb2active = true;
ambchannel2 = ambchan[currentamb].play();
stopother = 3;
if (currentamb == 3){
stopother = 20;
};
currentambchan = 1;
} else {
ambchannel = ambchan[currentamb].play();
stopother = 3;
if (currentamb == 3){
stopother = 20;
};
currentambchan = 0;
};
};
}
}
}//package
Section 151
//Preloader (Preloader)
package {
import flash.events.*;
import com.kongregate.as3.client.*;
import flash.display.*;
import mochi.as3.*;
import flash.ui.*;
import flash.net.*;
import flash.utils.*;
public dynamic class Preloader extends MovieClip {
private var im_loading:Class;
public var showctp:Boolean;
public var startgame:Boolean;
public var adson:Boolean;
public var loading:Bitmap;
public function Preloader(){
im_loading = Preloader_im_loading;
super();
if (checksite()){
adson = false;
} else {
adson = true;
};
var kongregate:KongregateAPI = new KongregateAPI();
this.addChild(kongregate);
if (adson){
MochiAd.showPreGameAd({clip:root, id:"3da6e9186ed03b91", res:"640x576", background:1114884, color:9383213, outline:4522758, no_bg:false});
};
var rc_menu:ContextMenu = new ContextMenu();
var credit:ContextMenuItem = new ContextMenuItem("Visit distractionware.com");
var credit2:ContextMenuItem = new ContextMenuItem("Visit kongregate.com");
credit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_distractionware);
credit2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_sponsor);
credit2.separatorBefore = false;
rc_menu.hideBuiltInItems();
rc_menu.customItems.push(credit);
rc_menu.customItems.push(credit2);
this.contextMenu = rc_menu;
addEventListener(Event.ENTER_FRAME, checkFrame);
if (!adson){
loading = new im_loading();
loading.x = (320 - (loading.width / 2));
loading.y = 316;
addChild(loading);
};
showctp = false;
startgame = false;
}
private function checkFrame(e:Event):void{
var w:int;
var p:Number = (this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal);
if (!adson){
graphics.clear();
graphics.beginFill(1114884);
graphics.drawRect(0, 0, 640, 576);
graphics.endFill();
graphics.beginFill(15832473);
graphics.drawRect(120, 279, 400, 18);
graphics.endFill();
};
if (p < 1){
if (!adson){
graphics.beginFill(1114884);
w = int(Math.round((p * 391)));
graphics.drawRect((125 + w), 283, (391 - w), 10);
graphics.endFill();
};
} else {
if (!showctp){
showctp = true;
startgame = true;
};
};
if (currentFrame == totalFrames){
if (startgame){
startup();
};
};
}
public function visit_sponsor(e:Event):void{
var sponsor_link:URLRequest = new URLRequest("http://www.kongregate.com/?gamereferral=dontlookback");
navigateToURL(sponsor_link, "_blank");
}
public function visit_distractionware(e:Event):void{
var distractionware_link:URLRequest = new URLRequest("http://www.distractionware.com");
navigateToURL(distractionware_link, "_blank");
}
public function checksite():Boolean{
var currUrl:String = stage.loaderInfo.url.toLowerCase();
if ((((((((((((((currUrl.indexOf("distractionware.com") <= 0)) && ((currUrl.indexOf("flashgamelicense.com") <= 0)))) && ((currUrl.indexOf("kongregate.com") <= 0)))) && ((currUrl.indexOf("ungrounded.net") <= 0)))) && ((currUrl.indexOf("uploads.undergrounded.net") <= 0)))) && ((currUrl.indexOf("newgrounds.com") <= 0)))) && ((currUrl.indexOf("chat.kongregate.com") <= 0)))){
return (false);
};
return (true);
}
private function startup():void{
removeEventListener(Event.ENTER_FRAME, checkFrame);
var mainClass:Class = (getDefinitionByName("Main") as Class);
addChild((new (mainClass) as DisplayObject));
}
}
}//package
Section 152
//Preloader_im_loading (Preloader_im_loading)
package {
import mx.core.*;
public class Preloader_im_loading extends BitmapAsset {
}
}//package