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(_arg1:DisplayObject){
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 = _arg1;
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(_arg1:MouseEvent):void{
onscreen = false;
}
public function isUp(_arg1:uint):Boolean{
return (((states[(_arg1 >>> 3)] & (1 << (_arg1 & 7))) == 0));
}
private function activateListener(_arg1:Event):void{
var _local2:int;
while (_local2 < 8) {
states[_local2] = 0;
_local2++;
};
}
public function isDown(_arg1:uint):Boolean{
return (!(((states[(_arg1 >>> 3)] & (1 << (_arg1 & 7))) == 0)));
}
private function keyUpListener(_arg1:KeyboardEvent):void{
states[(_arg1.keyCode >>> 3)] = (states[(_arg1.keyCode >>> 3)] & ~((1 << (_arg1.keyCode & 7))));
}
private function deactivateListener(_arg1:Event):void{
var _local2:int;
while (_local2 < 8) {
states[_local2] = 0;
_local2++;
};
}
public function mouseOverHandler(_arg1:MouseEvent):void{
onscreen = true;
}
public function mouseUpListener(_arg1:MouseEvent):void{
press = false;
click = false;
hasclicked = false;
}
public function mouseDownListener(_arg1:MouseEvent):void{
press = true;
click = true;
hasclicked = true;
}
private function keyDownListener(_arg1:KeyboardEvent):void{
states[(_arg1.keyCode >>> 3)] = (states[(_arg1.keyCode >>> 3)] | (1 << (_arg1.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
//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(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
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(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 15
//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(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 16
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 17
//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(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1: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(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 18
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 19
//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 20
//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";
}
}//package mx.core
Section 21
//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 static function displayObjectToString(_arg1:DisplayObject):String{
var result:String;
var o:DisplayObject;
var s:String;
var indices:Array;
var displayObject = _arg1;
try {
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;
};
} catch(e:SecurityError) {
};
return (result);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 22
//blockclass (blockclass)
package {
import flash.display.*;
import flash.geom.*;
public class blockclass extends Sprite {
public var hp:int;
public var rect:Rectangle;
public var active:Boolean;
public var yp:int;
public var xp:int;
public var wp:int;
public var type:int;
public var trigger:int;
public function blockclass():void{
clear();
}
public function clear():void{
active = false;
type = 0;
trigger = 0;
xp = 0;
yp = 0;
wp = 0;
hp = 0;
rect = new Rectangle();
rect.x = xp;
rect.y = yp;
rect.width = wp;
rect.height = hp;
}
public function rectset(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
rect.x = _arg1;
rect.y = _arg2;
rect.width = _arg3;
rect.height = _arg4;
}
}
}//package
Section 23
//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 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 updatebackground:Boolean;
public var bfont_rect:Rectangle;
public var madrect:Rectangle;
public var cur:int;
public var bfontlen:Array;
public var bfontmask_rect:Rectangle;
public var madpoint:Point;
public var images_rect:Rectangle;
public var stemp:String;
public var buffer:BitmapData;
public var temp:int;
public var temp3:int;
public var tiles_rect:Rectangle;
public var backbuffer:BitmapData;
public var screen:Bitmap;
public var temp2:int;
public var ct:ColorTransform;
public var images:Array;
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 _local2:Array;
var _local5:Number;
var _local6:BitmapData;
var _local7:Rectangle;
var _local1:Number = 0;
while (_local1 < 16) {
_local5 = 0;
while (_local5 < 16) {
_local6 = new BitmapData(8, 8, true, 0);
_local7 = new Rectangle((_local5 * 8), (_local1 * 8), 8, 8);
_local6.copyPixels(buffer, _local7, tl);
bfont.push(_local6);
_local5++;
};
_local1++;
};
_local5 = 0;
while (_local5 < 0x0100) {
bfontlen.push(6);
_local5++;
};
var _local3 = "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";
_local2 = new Array();
_local2 = _local3.split(",");
var _local4:int;
while (_local4 < 96) {
bfontlen[(_local4 + 32)] = int((_local2[_local4] - 2));
_local4++;
};
adjustfont(69);
adjustfont(70);
adjustfont(73);
adjustfont(76);
adjustfont(77);
adjustfont(84);
adjustfont(86, -1);
adjustfont(87);
adjustfont(90);
adjustfont("x".charCodeAt(0), -1);
adjustfont("y".charCodeAt(0), -1);
adjustsfont(" ".charCodeAt(0));
adjustsfont("1".charCodeAt(0));
adjustsfont("4".charCodeAt(0));
adjustsfont("!".charCodeAt(0), 2);
adjustsfont(":".charCodeAt(0), 2);
adjustsfont("[".charCodeAt(0));
adjustsfont("%".charCodeAt(0), -1);
adjustsfont(".".charCodeAt(0), 2);
adjustsfont(",".charCodeAt(0), 2);
adjustsfont("-".charCodeAt(0));
}
public function drawentities(_arg1:gameclass, _arg2:entityclass, _arg3:helpclass):void{
var _local4:int;
var _local5:int;
var _local6:int = (_arg2.nentity - 1);
while (_local6 >= 0) {
if (_arg2.entities[_local6].size == 1){
if (_arg2.entities[_local6].active){
drawrectparticle(_arg1, _arg2, _arg3, _local6);
};
} else {
if (_arg2.entities[_local6].size == 2){
_local4 = 0;
while (_local4 < 4) {
_local5 = 0;
while (_local5 < 5) {
backbuffer.copyPixels(tiles[((_arg2.entities[_local6].drawframe + _local4) + (_local5 * 20))], tiles_rect, new Point((_arg2.entities[_local6].xp + (_local4 * 16)), (_arg2.entities[_local6].yp + (_local5 * 16))));
_local5++;
};
_local4++;
};
} else {
if (((!(_arg2.entities[_local6].invis)) && (_arg2.entities[_local6].active))){
madpoint.x = _arg2.entities[_local6].xp;
madpoint.y = _arg2.entities[_local6].yp;
if (_arg1.bullettimemode){
backbuffer.copyPixels(tiles[(_arg2.entities[_local6].drawframe + 40)], tiles_rect, madpoint);
} else {
if (_arg2.entities[_local6].drawframe == 1){
if (_arg1.bullettime < 150){
backbuffer.copyPixels(tiles[10], tiles_rect, madpoint);
} else {
backbuffer.copyPixels(tiles[_arg2.entities[_local6].drawframe], tiles_rect, madpoint);
};
} else {
backbuffer.copyPixels(tiles[_arg2.entities[_local6].drawframe], tiles_rect, madpoint);
};
};
};
};
};
_local6--;
};
}
public function bprint(_arg1:int, _arg2:int, _arg3:String, _arg4:int, _arg5:int, _arg6:int, _arg7:Boolean=false):void{
printmask(_arg1, _arg2, _arg3, _arg7);
print(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
}
public function bprinttemptile(_arg1:int, _arg2:int, _arg3:String, _arg4:int, _arg5:int, _arg6:int, _arg7:Boolean=false):void{
printmasktemptile(_arg1, _arg2, _arg3, _arg7);
printtemptile(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
}
public function addbackground():void{
var _local1:BitmapData = new BitmapData(160, 144, true, 0);
_local1.copyPixels(buffer, bg_rect, tl);
backgrounds.push(_local1);
}
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, 120);
tl = new Point(0, 0);
ct = new ColorTransform(0, 0, 0, 1, 0xFF, 0xFF, 0xFF, 1);
madpoint = new Point();
madrect = new Rectangle();
backbuffer = new BitmapData(160, 120, false, 0);
screenbuffer = new BitmapData(160, 120, false, 0);
temptile = new BitmapData(16, 16, false, 0);
screen = new Bitmap(screenbuffer);
screen.width = 640;
screen.height = 480;
addChild(screen);
}
public function adjustsfont(_arg1:int, _arg2:int=1):void{
bfontlen[_arg1] = (bfontlen[_arg1] + _arg2);
}
public function len(_arg1:String):int{
bfontpos = 0;
var _local2:int;
while (_local2 < _arg1.length) {
cur = _arg1.charCodeAt(_local2);
bfontpos = (bfontpos + bfontlen[cur]);
_local2++;
};
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(_arg1:int, _arg2:int, _arg3:int, _arg4:Boolean=false):void{
if (_arg4){
backbuffer.copyPixels(images[_arg1], new Rectangle(0, 0, images[_arg1].width, images[_arg1].height), new Point((80 - int((images[_arg1].width / 2))), _arg3));
} else {
backbuffer.copyPixels(images[_arg1], new Rectangle(0, 0, images[_arg1].width, images[_arg1].height), new Point(_arg2, _arg3));
};
}
public function printmask(_arg1:int, _arg2:int, _arg3:String, _arg4:Boolean=false):void{
if (_arg4){
_arg1 = (160 - (len(_arg3) / 2));
};
bfontpos = 0;
var _local5:int;
while (_local5 < _arg3.length) {
cur = _arg3.charCodeAt(_local5);
backbuffer.copyPixels(bfontmask[cur], bfont_rect, new Point(((_arg1 + bfontpos) - 1), _arg2));
bfontpos = (bfontpos + bfontlen[cur]);
_local5++;
};
}
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(_arg1:int, _arg2:int, _arg3:String, _arg4:Boolean=false):void{
if (_arg4){
_arg1 = (80 - (len(_arg3) / 2));
};
bfontpos = 0;
var _local5:int;
while (_local5 < _arg3.length) {
cur = _arg3.charCodeAt(_local5);
temptile.copyPixels(bfontmask[cur], bfont_rect, new Point(((_arg1 + bfontpos) - 1), _arg2));
bfontpos = (bfontpos + bfontlen[cur]);
_local5++;
};
}
public function flashlight():void{
backbuffer.fillRect(backbuffer.rect, 9383213);
}
public function RGB(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (((_arg3 | (_arg2 << 8)) | (_arg1 << 16)));
}
public function drawrectparticle(_arg1:gameclass, _arg2:entityclass, _arg3:helpclass, _arg4:int):void{
madrect.x = _arg2.entities[_arg4].xp;
madrect.y = _arg2.entities[_arg4].yp;
madrect.width = _arg2.entities[_arg4].cw;
madrect.height = 1;
backbuffer.fillRect(madrect, _arg2.entities[_arg4].life);
madrect.x = _arg2.entities[_arg4].xp;
madrect.y = _arg2.entities[_arg4].yp;
madrect.width = 1;
madrect.height = _arg2.entities[_arg4].ch;
backbuffer.fillRect(madrect, _arg2.entities[_arg4].life);
madrect.x = ((_arg2.entities[_arg4].xp + _arg2.entities[_arg4].cw) - 1);
madrect.y = _arg2.entities[_arg4].yp;
madrect.width = 1;
madrect.height = _arg2.entities[_arg4].ch;
backbuffer.fillRect(madrect, _arg2.entities[_arg4].life);
madrect.x = _arg2.entities[_arg4].xp;
madrect.y = ((_arg2.entities[_arg4].yp + _arg2.entities[_arg4].ch) - 1);
madrect.width = _arg2.entities[_arg4].cw;
madrect.height = 1;
backbuffer.fillRect(madrect, _arg2.entities[_arg4].life);
}
public function printtemptile(_arg1:int, _arg2:int, _arg3:String, _arg4:int, _arg5:int, _arg6:int, _arg7:Boolean=false):void{
if (_arg4 < 0){
_arg4 = 0;
};
if (_arg5 < 0){
_arg5 = 0;
};
if (_arg6 < 0){
_arg6 = 0;
};
if (_arg4 > 0xFF){
_arg4 = 0xFF;
};
if (_arg5 > 0xFF){
_arg5 = 0xFF;
};
if (_arg6 > 0xFF){
_arg6 = 0xFF;
};
ct.color = RGB(_arg4, _arg5, _arg6);
if (_arg7){
_arg1 = (80 - (len(_arg3) / 2));
};
bfontpos = 0;
var _local8:int;
while (_local8 < _arg3.length) {
cur = _arg3.charCodeAt(_local8);
bfont[cur].colorTransform(bfont_rect, ct);
temptile.copyPixels(bfont[cur], bfont_rect, new Point((_arg1 + bfontpos), _arg2));
bfontpos = (bfontpos + bfontlen[cur]);
_local8++;
};
}
public function drawbuffertile(_arg1:int, _arg2:int, _arg3:int):void{
buffer.copyPixels(tiles[_arg3], tiles_rect, new Point(_arg1, _arg2));
}
public function print(_arg1:int, _arg2:int, _arg3:String, _arg4:int, _arg5:int, _arg6:int, _arg7:Boolean=false):void{
if (_arg4 < 0){
_arg4 = 0;
};
if (_arg5 < 0){
_arg5 = 0;
};
if (_arg6 < 0){
_arg6 = 0;
};
if (_arg4 > 0xFF){
_arg4 = 0xFF;
};
if (_arg5 > 0xFF){
_arg5 = 0xFF;
};
if (_arg6 > 0xFF){
_arg6 = 0xFF;
};
ct.color = RGB(_arg4, _arg5, _arg6);
if (_arg7){
_arg1 = (80 - (len(_arg3) / 2));
};
bfontpos = 0;
var _local8:int;
while (_local8 < _arg3.length) {
cur = _arg3.charCodeAt(_local8);
bfont[cur].colorTransform(bfont_rect, ct);
backbuffer.copyPixels(bfont[cur], bfont_rect, new Point((_arg1 + bfontpos), _arg2));
bfontpos = (bfontpos + bfontlen[cur]);
_local8++;
};
}
public function maketilearray():void{
var _local2:Number;
var _local3:BitmapData;
var _local4:Rectangle;
var _local1:Number = 0;
while (_local1 < 15) {
_local2 = 0;
while (_local2 < 20) {
_local3 = new BitmapData(16, 16, true, 0);
_local4 = new Rectangle((_local2 * 16), (_local1 * 16), 16, 16);
_local3.copyPixels(buffer, _local4, tl);
tiles.push(_local3);
_local2++;
};
_local1++;
};
}
public function addimage():void{
var _local1:BitmapData = new BitmapData(buffer.width, buffer.height, true, 0);
_local1.copyPixels(buffer, new Rectangle(0, 0, buffer.width, buffer.height), tl);
images.push(_local1);
}
public function adjustfont(_arg1:int, _arg2:int=1):void{
bfontlen[_arg1] = (bfontlen[_arg1] + _arg2);
bfontlen[(_arg1 + 32)] = (bfontlen[(_arg1 + 32)] + _arg2);
}
public function makebfontmask():void{
var _local2:Number;
var _local3:BitmapData;
var _local4:Rectangle;
var _local1:Number = 0;
while (_local1 < 16) {
_local2 = 0;
while (_local2 < 16) {
_local3 = new BitmapData(9, 9, true, 0);
_local4 = new Rectangle((_local2 * 9), (_local1 * 9), 9, 9);
_local3.copyPixels(buffer, _local4, tl);
bfontmask.push(_local3);
_local2++;
};
_local1++;
};
}
public function drawtile(_arg1:int, _arg2:int, _arg3:int):void{
backbuffer.copyPixels(tiles[_arg3], tiles_rect, new Point(_arg1, _arg2));
}
public function drawbackground(_arg1:int):void{
backbuffer.copyPixels(backgrounds[_arg1], bg_rect, tl);
}
public function rprint(_arg1:int, _arg2:int, _arg3:String, _arg4:int, _arg5:int, _arg6:int, _arg7:Boolean=false):void{
if (_arg4 < 0){
_arg4 = 0;
};
if (_arg5 < 0){
_arg5 = 0;
};
if (_arg6 < 0){
_arg6 = 0;
};
if (_arg4 > 0xFF){
_arg4 = 0xFF;
};
if (_arg5 > 0xFF){
_arg5 = 0xFF;
};
if (_arg6 > 0xFF){
_arg6 = 0xFF;
};
ct.color = RGB(_arg4, _arg5, _arg6);
_arg1 = (158 - len(_arg3));
bfontpos = 0;
var _local8:int;
while (_local8 < _arg3.length) {
cur = _arg3.charCodeAt(_local8);
bfont[cur].colorTransform(bfont_rect, ct);
backbuffer.copyPixels(bfont[cur], bfont_rect, new Point((_arg1 + bfontpos), _arg2));
bfontpos = (bfontpos + bfontlen[cur]);
_local8++;
};
}
}
}//package
Section 24
//entclass (entclass)
package {
import flash.display.*;
public class entclass extends Sprite {
public var size:int;
public var rule:int;
public var active:Boolean;
public var onentity:int;
public var jumpframe:int;
public var harmful:Boolean;
public var state:int;
public var statedelay:int;
public var walkingframe:int;
public var jumping:Boolean;
public var yp:Number;
public var newxp:Number;
public var jumppara:int;
public var dir:int;
public var onground:Boolean;
public var onwall:int;
public var tile:int;
public var ax:Number;
public var ay:Number;
public var type:int;
public var framedelay:int;
public var newyp:Number;
public var drawframe:int;
public var vx:Number;
public var onxwall:int;
public var onywall:int;
public var vy:Number;
public var gravity:Boolean;
public var invis:Boolean;
public var ch:int;
public var cw:int;
public var cx:int;
public var cy:int;
public var life:int;
public var xp:Number;
public function entclass():void{
clear();
}
public function clear():void{
active = false;
invis = false;
type = 0;
size = 0;
tile = 0;
rule = 0;
state = 0;
statedelay = 0;
life = 0;
xp = 0;
yp = 0;
ax = 0;
ay = 0;
vx = 0;
vy = 0;
cw = 0;
ch = 0;
cx = 0;
cy = 0;
newxp = 0;
newyp = 0;
onentity = 0;
harmful = false;
framedelay = 0;
drawframe = 0;
walkingframe = 0;
dir = 0;
jumppara = 0;
}
}
}//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 temprect2:Rectangle;
public var nblocks:int;
public var blocks:Array;
public var temph:int;
public var tempw:int;
public var tempx:int;
public var tempy:int;
public var temprect:Rectangle;
public var entities:Array;
public var nentity:int;
public var temp:int;
public var temp2:int;
public var i:int;
public var j:int;
public var z:int;
public static var TRIGGER:Number = 1;
public static var BLOCK:Number = 0;
public static var DAMAGE:Number = 2;
public function entityclass(){
entities = new Array();
blocks = new Array();
super();
}
public function removeblock(_arg1:int):void{
blocks[_arg1].clear();
i = (nblocks - 1);
while ((((i >= 0)) && (!(blocks[i].active)))) {
nblocks--;
i--;
};
}
public function updateentities(_arg1:int, _arg2:helpclass, _arg3:gameclass, _arg4:musicclass):Boolean{
if (entities[_arg1].active){
if (entities[_arg1].statedelay <= 0){
switch (entities[_arg1].type){
case 0:
if (entities[_arg1].state == 0){
};
break;
case 1:
if (entities[_arg1].state == 0){
if (entities[_arg1].xp > 160){
entities[_arg1].active = false;
};
};
break;
case 2:
if (entities[_arg1].state == 0){
if (entities[_arg1].xp < -20){
entities[_arg1].active = false;
};
} else {
if (entities[_arg1].state == 1){
if (nentity > 80){
j = 0;
while (j < 4) {
createentity(entities[_arg1].xp, entities[_arg1].yp, 20, (_arg2.cosine[((j * 16) + 4)] * 4), (_arg2.sine[((j * 16) + 4)] * 4));
j++;
};
} else {
j = 0;
while (j < 16) {
createentity(entities[_arg1].xp, entities[_arg1].yp, 20, (_arg2.cosine[(j * 4)] * 4), (_arg2.sine[(j * 4)] * 4));
j++;
};
};
droppickup((entities[_arg1].xp + 3), (entities[_arg1].yp + 3));
entities[_arg1].active = false;
_arg3.score = (_arg3.score + 500);
_arg4.playef(2, 20);
};
};
break;
case 3:
if (entities[_arg1].jumpframe > 0){
entities[_arg1].jumpframe--;
};
if (entities[_arg1].jumpframe == 0){
createentity((entities[_arg1].xp - 3), (entities[_arg1].yp + 3), 10, -3, -1);
createentity((entities[_arg1].xp - 3), (entities[_arg1].yp + 3), 10, -3, 1);
createentity((entities[_arg1].xp - 3), (entities[_arg1].yp + 3), 10, -3, 0);
entities[_arg1].jumpframe = 30;
};
if (entities[_arg1].state == 0){
if (entities[_arg1].walkingframe > 0){
entities[_arg1].walkingframe--;
};
if (entities[_arg1].xp < -20){
entities[_arg1].active = false;
};
} else {
if (entities[_arg1].state == 1){
entities[_arg1].life--;
entities[_arg1].state = 0;
entities[_arg1].walkingframe = 2;
if (entities[_arg1].life <= 0){
entities[_arg1].state = 2;
};
if (entities[_arg1].xp < -20){
entities[_arg1].active = false;
};
} else {
if (entities[_arg1].state == 2){
if (nentity > 80){
j = 0;
while (j < 4) {
createentity(entities[_arg1].xp, entities[_arg1].yp, 21, (_arg2.cosine[((j * 16) + 4)] * 4), (_arg2.sine[((j * 16) + 4)] * 4));
j++;
};
} else {
j = 0;
while (j < 16) {
createentity(entities[_arg1].xp, entities[_arg1].yp, 21, (_arg2.cosine[(j * 4)] * 4), (_arg2.sine[(j * 4)] * 4));
j++;
};
};
droppickup((entities[_arg1].xp + 1), (entities[_arg1].yp + 4));
entities[_arg1].active = false;
_arg3.score = (_arg3.score + 1000);
_arg4.playef(3, 20);
};
};
};
break;
case 4:
if (entities[_arg1].jumpframe > 0){
entities[_arg1].jumpframe--;
};
if (entities[_arg1].jumpframe == 0){
createentity((entities[_arg1].xp + 4), (entities[_arg1].yp - 3), 10, -3, -3);
createentity((entities[_arg1].xp + 4), (entities[_arg1].yp + 12), 10, -3, 3);
entities[_arg1].jumpframe = 15;
};
if (entities[_arg1].state == 0){
if (entities[_arg1].xp < -20){
entities[_arg1].active = false;
};
} else {
if (entities[_arg1].state == 1){
if (nentity > 80){
j = 0;
while (j < 4) {
createentity(entities[_arg1].xp, entities[_arg1].yp, 22, (_arg2.cosine[((j * 16) + 4)] * 4), (_arg2.sine[((j * 16) + 4)] * 4));
j++;
};
} else {
j = 0;
while (j < 16) {
createentity(entities[_arg1].xp, entities[_arg1].yp, 22, (_arg2.cosine[(j * 4)] * 4), (_arg2.sine[(j * 4)] * 4));
j++;
};
};
droppickup((entities[_arg1].xp + 4), (entities[_arg1].yp + 4));
entities[_arg1].active = false;
_arg3.score = (_arg3.score + 1000);
_arg4.playef(2, 20);
};
};
break;
case 5:
if (entities[_arg1].yp > 55){
entities[_arg1].vy = (entities[_arg1].vy - 0.5);
} else {
entities[_arg1].vy = (entities[_arg1].vy + 0.5);
};
if (entities[_arg1].state == 0){
if (entities[_arg1].walkingframe > 0){
entities[_arg1].walkingframe--;
};
if (entities[_arg1].xp < -20){
entities[_arg1].active = false;
};
} else {
if (entities[_arg1].state == 1){
entities[_arg1].life--;
entities[_arg1].state = 0;
entities[_arg1].walkingframe = 2;
if (entities[_arg1].life <= 0){
entities[_arg1].state = 2;
};
if (entities[_arg1].xp < -20){
entities[_arg1].active = false;
};
} else {
if (entities[_arg1].state == 2){
if (nentity > 80){
j = 0;
while (j < 4) {
createentity(entities[_arg1].xp, entities[_arg1].yp, 23, (_arg2.cosine[((j * 16) + 4)] * 4), (_arg2.sine[((j * 16) + 4)] * 4));
j++;
};
} else {
j = 0;
while (j < 16) {
createentity(entities[_arg1].xp, entities[_arg1].yp, 23, (_arg2.cosine[(j * 4)] * 4), (_arg2.sine[(j * 4)] * 4));
j++;
};
};
droppickup((entities[_arg1].xp + 4), (entities[_arg1].yp + 4));
entities[_arg1].active = false;
_arg3.score = (_arg3.score + 2000);
_arg4.playef(3, 20);
};
};
};
break;
case 6:
if (entities[_arg1].xp < 20){
entities[_arg1].walkingframe = 2;
};
if (entities[_arg1].xp < 10){
j = 0;
while (j < 16) {
createentity((entities[_arg1].xp + 2), (entities[_arg1].yp + 2), 10, (_arg2.cosine[(j * 4)] * 3), (_arg2.sine[(j * 4)] * 3));
j++;
};
entities[_arg1].active = false;
_arg4.playef(3, 20);
};
if (entities[_arg1].state == 0){
if (entities[_arg1].walkingframe > 0){
entities[_arg1].walkingframe--;
};
if (entities[_arg1].xp < -20){
entities[_arg1].active = false;
};
} else {
if (entities[_arg1].state == 1){
entities[_arg1].life--;
entities[_arg1].state = 0;
entities[_arg1].walkingframe = 2;
if (entities[_arg1].life <= 0){
entities[_arg1].state = 2;
};
if (entities[_arg1].xp < -20){
entities[_arg1].active = false;
};
} else {
if (entities[_arg1].state == 2){
j = 0;
while (j < 16) {
createentity((entities[_arg1].xp + 2), (entities[_arg1].yp + 2), 10, (_arg2.cosine[(j * 4)] * 3), (_arg2.sine[(j * 4)] * 3));
j++;
};
droppickup(entities[_arg1].xp, (entities[_arg1].yp + 2));
entities[_arg1].active = false;
_arg3.score = (_arg3.score + 2000);
_arg4.playef(3, 20);
};
};
};
break;
case 10:
if (entities[_arg1].state == 0){
if (entities[_arg1].xp < -10){
entities[_arg1].active = false;
};
if (entities[_arg1].xp > 200){
entities[_arg1].active = false;
};
if (entities[_arg1].yp < -10){
entities[_arg1].active = false;
};
if (entities[_arg1].yp > 130){
entities[_arg1].active = false;
};
};
break;
case 11:
entities[_arg1].life--;
if (entities[_arg1].life < 20){
entities[_arg1].walkingframe = (entities[_arg1].walkingframe - 2);
};
if (entities[_arg1].life < 0){
entities[_arg1].active = false;
};
entities[_arg1].vx = (entities[_arg1].vx - 0.1);
if (entities[_arg1].vx <= -2){
entities[_arg1].vx = -2;
};
break;
case 20:
if (entities[_arg1].state == 0){
entities[_arg1].life--;
if (entities[_arg1].life < 0){
entities[_arg1].active = false;
};
};
break;
case 21:
if (entities[_arg1].state == 0){
entities[_arg1].xp = (entities[_arg1].xp - 1);
entities[_arg1].yp = (entities[_arg1].yp - 1);
entities[_arg1].cw = (entities[_arg1].cw + 2);
entities[_arg1].ch = (entities[_arg1].ch + 2);
if (entities[_arg1].cw > 20){
entities[_arg1].active = false;
};
};
break;
case 22:
if (entities[_arg1].state == 0){
entities[_arg1].xp = (entities[_arg1].xp - 1);
entities[_arg1].yp = (entities[_arg1].yp - 1);
entities[_arg1].cw = (entities[_arg1].cw + 2);
entities[_arg1].ch = (entities[_arg1].ch + 2);
if (entities[_arg1].cw > 10){
entities[_arg1].active = false;
};
};
break;
case 23:
if (entities[_arg1].state == 0){
entities[_arg1].xp = (entities[_arg1].xp - 4);
entities[_arg1].yp = (entities[_arg1].yp - 4);
entities[_arg1].cw = (entities[_arg1].cw + 8);
entities[_arg1].ch = (entities[_arg1].ch + 8);
if (entities[_arg1].cw > 360){
entities[_arg1].active = false;
};
};
break;
case 24:
if (entities[_arg1].state == 0){
entities[_arg1].xp = (entities[_arg1].xp - 4);
entities[_arg1].yp = (entities[_arg1].yp - 4);
entities[_arg1].cw = (entities[_arg1].cw + 8);
entities[_arg1].ch = (entities[_arg1].ch + 8);
if (entities[_arg1].cw > 360){
entities[_arg1].active = false;
};
};
break;
};
} else {
entities[_arg1].statedelay--;
if (entities[_arg1].statedelay < 0){
entities[_arg1].statedelay = 0;
};
};
};
return (true);
}
public function init():void{
var _local2:entclass;
var _local3:blockclass;
nentity = 0;
nblocks = 0;
temprect = new Rectangle();
temprect2 = new Rectangle();
var _local1:Number = 0;
while (_local1 < 500) {
_local2 = new entclass();
entities.push(_local2);
_local3 = new blockclass();
blocks.push(_local3);
_local1++;
};
}
public function createblock(_arg1:int, _arg2:int=0, _arg3:int=0, _arg4:int=0, _arg5:int=0, _arg6:int=0):void{
if (nblocks == 0){
z = 0;
nblocks++;
} else {
i = 0;
z = -1;
while (i < nblocks) {
if (!blocks[i].active){
z = i;
i = nblocks;
};
i++;
};
if (z == -1){
z = nblocks;
nblocks++;
};
};
blocks[z].clear();
blocks[z].active = true;
switch (_arg1){
case BLOCK:
blocks[z].type = BLOCK;
blocks[z].xp = _arg2;
blocks[z].yp = _arg3;
blocks[z].wp = _arg4;
blocks[z].hp = _arg5;
blocks[z].rectset(_arg2, _arg3, _arg4, _arg5);
nblocks++;
break;
case TRIGGER:
blocks[z].type = TRIGGER;
blocks[z].x = _arg2;
blocks[z].y = _arg3;
blocks[z].w = _arg4;
blocks[z].h = _arg5;
blocks[z].rectset(_arg2, _arg3, _arg4, _arg5);
blocks[z].trigger = _arg6;
nblocks++;
break;
case DAMAGE:
blocks[z].type = DAMAGE;
blocks[z].x = _arg2;
blocks[z].y = _arg3;
blocks[z].w = _arg4;
blocks[z].h = _arg5;
blocks[z].rectset(_arg2, _arg3, _arg4, _arg5);
nblocks++;
break;
};
}
public function bighit(_arg1:int, _arg2:int, _arg3:int):Boolean{
tempx = (entities[_arg1].xp + entities[_arg1].cx);
tempy = (entities[_arg1].yp + entities[_arg1].cy);
tempw = entities[_arg1].cw;
temph = entities[_arg1].ch;
rectset(tempx, tempy, tempw, temph);
tempx = (_arg2 - 1);
tempy = (_arg3 - 1);
tempw = 11;
temph = 11;
rect2set(tempx, tempy, tempw, temph);
if (temprect.intersects(temprect2)){
return (true);
};
return (false);
}
public function gettype(_arg1:int):Boolean{
var _local2:int;
while (_local2 < nentity) {
if (entities[_local2].type == _arg1){
return (true);
};
_local2++;
};
return (false);
}
public function entitycollide(_arg1:int, _arg2:int):Boolean{
tempx = (entities[_arg1].xp + entities[_arg1].cx);
tempy = (entities[_arg1].yp + entities[_arg1].cy);
tempw = entities[_arg1].cw;
temph = entities[_arg1].ch;
rectset(tempx, tempy, tempw, temph);
tempx = (entities[_arg2].xp + entities[_arg2].cx);
tempy = (entities[_arg2].yp + entities[_arg2].cy);
tempw = entities[_arg2].cw;
temph = entities[_arg2].ch;
rect2set(tempx, tempy, tempw, temph);
if (temprect.intersects(temprect2)){
return (true);
};
return (false);
}
public function animateentities(_arg1:int, _arg2:helpclass):void{
if (entities[_arg1].active){
if (entities[_arg1].statedelay <= 0){
switch (entities[_arg1].type){
case 3:
if (entities[_arg1].walkingframe > 0){
entities[_arg1].drawframe = 8;
} else {
entities[_arg1].drawframe = entities[_arg1].tile;
};
break;
case 5:
if (entities[_arg1].walkingframe > 0){
entities[_arg1].drawframe = 9;
} else {
entities[_arg1].drawframe = entities[_arg1].tile;
};
break;
case 6:
if (entities[_arg1].walkingframe > 0){
entities[_arg1].drawframe = 7;
} else {
entities[_arg1].drawframe = entities[_arg1].tile;
};
break;
case 11:
if (entities[_arg1].walkingframe == 0){
entities[_arg1].dir = ((entities[_arg1].dir + 1) % 2);
entities[_arg1].walkingframe = 5;
} else {
entities[_arg1].walkingframe--;
};
entities[_arg1].drawframe = (entities[_arg1].tile + entities[_arg1].dir);
break;
default:
entities[_arg1].drawframe = entities[_arg1].tile;
break;
};
} else {
entities[_arg1].statedelay--;
if (entities[_arg1].statedelay < 0){
entities[_arg1].statedelay = 0;
};
};
};
}
public function droppickup(_arg1:int, _arg2:int):void{
if ((Math.random() * 100) > 92){
createentity(_arg1, _arg2, 11);
};
}
public function checktrigger():int{
i = 0;
while (i < nentity) {
if (entities[i].rule == 0){
tempx = (entities[i].xp + entities[i].cx);
tempy = (entities[i].yp + entities[i].cy);
tempw = entities[i].cw;
temph = entities[i].ch;
rectset(tempx, tempy, tempw, temph);
j = 0;
while (j < nblocks) {
if (blocks[j].type == TRIGGER){
if (blocks[j].rect.intersects(temprect)){
return (blocks[j].trigger);
};
};
j++;
};
};
i++;
};
return (-1);
}
public function onepixelhit(_arg1:int, _arg2:int, _arg3:int):Boolean{
tempx = (entities[_arg1].xp + entities[_arg1].cx);
tempy = (entities[_arg1].yp + entities[_arg1].cy);
tempw = entities[_arg1].cw;
temph = entities[_arg1].ch;
rectset(tempx, tempy, tempw, temph);
tempx = _arg2;
tempy = (_arg3 + 1);
tempw = 2;
temph = 1;
rect2set(tempx, tempy, tempw, temph);
if (temprect.intersects(temprect2)){
return (true);
};
return (false);
}
public function removetrigger(_arg1:int):void{
i = 0;
while (i < nblocks) {
if (blocks[i].type == TRIGGER){
if (blocks[i].trigger == _arg1){
removeblock(i);
};
};
i++;
};
}
public function getplayer():int{
var _local1:int;
while (_local1 < nentity) {
if (entities[_local1].type == 0){
return (_local1);
};
_local1++;
};
return (-1);
}
public function testwallsx(_arg1:int, _arg2:int, _arg3:int):Boolean{
tempx = (_arg2 + entities[_arg1].cx);
tempy = (_arg3 + entities[_arg1].cy);
tempw = entities[_arg1].cw;
temph = entities[_arg1].ch;
rectset(tempx, tempy, tempw, temph);
if (checkwall()){
if (entities[_arg1].vx > 1){
entities[_arg1].vx--;
entities[_arg1].newxp = int((entities[_arg1].xp + entities[_arg1].vx));
return (testwallsx(_arg1, entities[_arg1].newxp, entities[_arg1].yp));
};
if (entities[_arg1].vx < -1){
entities[_arg1].vx++;
entities[_arg1].newxp = int((entities[_arg1].xp + entities[_arg1].vx));
return (testwallsx(_arg1, entities[_arg1].newxp, entities[_arg1].yp));
};
entities[_arg1].vx = 0;
return (false);
};
return (true);
}
public function testwallsy(_arg1:int, _arg2:int, _arg3:int):Boolean{
tempx = (_arg2 + entities[_arg1].cx);
tempy = (_arg3 + entities[_arg1].cy);
tempw = entities[_arg1].cw;
temph = entities[_arg1].ch;
rectset(tempx, tempy, tempw, temph);
if (checkwall()){
if (entities[_arg1].vy > 1){
entities[_arg1].vy--;
entities[_arg1].newyp = int((entities[_arg1].yp + entities[_arg1].vy));
return (testwallsy(_arg1, entities[_arg1].xp, entities[_arg1].newyp));
};
if (entities[_arg1].vy < -1){
entities[_arg1].vy++;
entities[_arg1].newyp = int((entities[_arg1].yp + entities[_arg1].vy));
return (testwallsy(_arg1, entities[_arg1].xp, entities[_arg1].newyp));
};
entities[_arg1].vy = 0;
return (false);
};
return (true);
}
public function checkwall():Boolean{
i = 0;
while (i < nblocks) {
if (blocks[i].type == BLOCK){
if (blocks[i].rect.intersects(temprect)){
return (true);
};
};
i++;
};
return (false);
}
public function rect2set(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
temprect2.x = _arg1;
temprect2.y = _arg2;
temprect2.width = _arg3;
temprect2.height = _arg4;
}
public function createentity(_arg1:Number, _arg2:Number, _arg3:int, _arg4:Number=0, _arg5:Number=0, _arg6:int=0):void{
if (nentity == 0){
z = 0;
nentity++;
} else {
i = 0;
z = -1;
while (i < nentity) {
if (!entities[i].active){
z = i;
i = nentity;
};
i++;
};
if (z == -1){
z = nentity;
nentity++;
};
};
if (_arg1 > 160){
_arg1 = (_arg1 + 25);
};
entities[z].clear();
entities[z].active = true;
entities[z].type = _arg3;
switch (_arg3){
case 0:
entities[z].rule = 0;
entities[z].tile = 1;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].cx = 2;
entities[z].cy = 5;
entities[z].cw = 8;
entities[z].ch = 2;
break;
case 1:
entities[z].rule = 1;
entities[z].tile = 20;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = _arg4;
entities[z].cx = 2;
entities[z].cy = 2;
entities[z].cw = 4;
entities[z].ch = 1;
break;
case 2:
entities[z].rule = 2;
entities[z].tile = 4;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = -4;
entities[z].cx = 1;
entities[z].cy = 1;
entities[z].cw = 10;
entities[z].ch = 10;
entities[z].onentity = 1;
entities[z].harmful = true;
break;
case 3:
entities[z].rule = 2;
entities[z].tile = 2;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = -2;
entities[z].jumpframe = 0;
entities[z].cx = 1;
entities[z].cy = 1;
entities[z].cw = 10;
entities[z].ch = 12;
entities[z].life = 2;
entities[z].onentity = 1;
entities[z].harmful = true;
break;
case 4:
entities[z].rule = 2;
entities[z].tile = 3;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = -3;
if (entities[z].yp > 55){
entities[z].vy = -1;
} else {
entities[z].vy = 1;
};
entities[z].jumpframe = 0;
entities[z].cx = 1;
entities[z].cy = 1;
entities[z].cw = 12;
entities[z].ch = 14;
entities[z].onentity = 1;
entities[z].harmful = true;
break;
case 5:
entities[z].rule = 2;
entities[z].tile = 5;
entities[z].xp = _arg1;
if ((((_arg2 > 40)) && ((_arg2 < 60)))){
_arg2 = 40;
};
if ((((_arg2 > 60)) && ((_arg2 < 80)))){
_arg2 = 80;
};
entities[z].yp = _arg2;
entities[z].vx = -3;
entities[z].cx = 1;
entities[z].cy = 1;
entities[z].cw = 16;
entities[z].ch = 14;
entities[z].life = 3;
entities[z].onentity = 1;
entities[z].harmful = true;
break;
case 6:
entities[z].rule = 2;
entities[z].tile = 6;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = -2;
entities[z].jumppara = 8;
entities[z].jumpframe = 0;
entities[z].cx = 1;
entities[z].cy = 1;
entities[z].cw = 16;
entities[z].ch = 14;
entities[z].life = 2;
entities[z].onentity = 1;
entities[z].harmful = true;
break;
case 10:
entities[z].rule = 3;
entities[z].tile = 21;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = _arg4;
entities[z].vy = _arg5;
entities[z].cx = 1;
entities[z].cy = 1;
entities[z].cw = 4;
entities[z].ch = 4;
entities[z].harmful = true;
break;
case 11:
entities[z].rule = 5;
entities[z].tile = 27;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = _arg4;
entities[z].vy = _arg5;
entities[z].cx = 0;
entities[z].cy = 0;
entities[z].cw = 4;
entities[z].ch = 4;
entities[z].dir = 0;
entities[z].life = 210;
entities[z].vx = 2;
entities[z].harmful = true;
break;
case 12:
entities[z].type = 1;
entities[z].rule = 1;
entities[z].tile = 29;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = _arg4;
entities[z].vy = _arg5;
entities[z].cx = 0;
entities[z].cy = 0;
entities[z].cw = 4;
entities[z].ch = 8;
break;
case 13:
entities[z].type = 1;
entities[z].rule = 1;
entities[z].tile = 30;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = _arg4;
entities[z].vy = _arg5;
entities[z].cx = 0;
entities[z].cy = 0;
entities[z].cw = 4;
entities[z].ch = 4;
break;
case 14:
entities[z].type = 1;
entities[z].rule = 1;
entities[z].tile = 31;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = _arg4;
entities[z].vy = _arg5;
entities[z].cx = 0;
entities[z].cy = 0;
entities[z].cw = 4;
entities[z].ch = 4;
break;
case 20:
entities[z].rule = 4;
entities[z].tile = 22;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = _arg4;
entities[z].vy = _arg5;
entities[z].life = 12;
break;
case 21:
entities[z].type = 20;
entities[z].rule = 4;
entities[z].tile = 26;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = _arg4;
entities[z].vy = _arg5;
entities[z].life = 12;
break;
case 22:
entities[z].type = 20;
entities[z].rule = 4;
entities[z].tile = 23;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = _arg4;
entities[z].vy = _arg5;
entities[z].life = 12;
break;
case 23:
entities[z].type = 20;
entities[z].rule = 4;
entities[z].tile = 25;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = _arg4;
entities[z].vy = _arg5;
entities[z].life = 12;
break;
case 24:
entities[z].type = 20;
entities[z].rule = 4;
entities[z].tile = 24;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].vx = _arg4;
entities[z].vy = _arg5;
entities[z].life = 12;
break;
case 25:
entities[z].type = 21;
entities[z].rule = 4;
entities[z].size = 1;
entities[z].tile = 0;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].cw = _arg4;
entities[z].ch = _arg5;
switch (int((Math.random() * 6))){
case 0:
entities[z].life = 1175057;
break;
case 1:
entities[z].life = 2289186;
break;
case 2:
entities[z].life = 1170705;
break;
case 3:
entities[z].life = 2284834;
break;
case 4:
entities[z].life = 1166353;
break;
case 5:
entities[z].life = 2280482;
break;
default:
entities[z].life = 1175057;
break;
};
break;
case 26:
entities[z].type = 22;
entities[z].rule = 4;
entities[z].size = 1;
entities[z].tile = 0;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].cw = _arg4;
entities[z].ch = _arg5;
switch (int((Math.random() * 6))){
case 0:
entities[z].life = 15658513;
break;
case 1:
entities[z].life = 15658530;
break;
case 2:
entities[z].life = 14540049;
break;
case 3:
entities[z].life = 14540066;
break;
case 4:
entities[z].life = 13421585;
break;
case 5:
entities[z].life = 13421602;
break;
default:
entities[z].life = 15658513;
break;
};
break;
case 27:
entities[z].type = 23;
entities[z].rule = 4;
entities[z].size = 1;
entities[z].tile = 0;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].cw = _arg4;
entities[z].ch = _arg5;
switch (int((Math.random() * 6))){
case 0:
entities[z].life = 4521796;
break;
case 1:
entities[z].life = 5635925;
break;
case 2:
entities[z].life = 4517444;
break;
case 3:
entities[z].life = 5631573;
break;
case 4:
entities[z].life = 4521796;
break;
case 5:
entities[z].life = 5635925;
break;
default:
entities[z].life = 5631573;
break;
};
break;
case 28:
entities[z].type = 24;
entities[z].rule = 4;
entities[z].size = 1;
entities[z].tile = 0;
entities[z].xp = _arg1;
entities[z].yp = _arg2;
entities[z].cw = _arg4;
entities[z].ch = _arg5;
switch (int((Math.random() * 6))){
case 0:
entities[z].life = 0x111111;
break;
case 1:
entities[z].life = 1122850;
break;
case 2:
entities[z].life = 0x111111;
break;
case 3:
entities[z].life = 1122850;
break;
case 4:
entities[z].life = 0x111111;
break;
case 5:
entities[z].life = 1122850;
break;
default:
entities[z].life = 1122850;
break;
};
break;
};
}
public function removeallblocks():void{
i = 0;
while (i < nblocks) {
blocks[i].clear();
i++;
};
nblocks = 0;
}
public function applyfriction(_arg1:int, _arg2:Number, _arg3:Number):void{
if (Math.abs(entities[_arg1].vy) <= _arg3){
entities[_arg1].vy = 0;
};
if (entities[_arg1].vy > 0){
entities[_arg1].vy = (entities[_arg1].vy - _arg3);
};
if (entities[_arg1].vy < 0){
entities[_arg1].vy = (entities[_arg1].vy + _arg3);
};
if (entities[_arg1].vy > 4){
entities[_arg1].vy = 4;
};
if (entities[_arg1].vy < -3){
entities[_arg1].vy = -3;
};
if (entities[_arg1].vx > 3){
entities[_arg1].vx = 3;
};
if (entities[_arg1].vx < -3){
entities[_arg1].vx = -3;
};
}
public function entitycollidefloor(_arg1:int):Boolean{
tempx = (entities[_arg1].xp + entities[_arg1].cx);
tempy = ((entities[_arg1].yp + entities[_arg1].cy) + 1);
tempw = entities[_arg1].cw;
temph = entities[_arg1].ch;
rectset(tempx, tempy, tempw, temph);
if (checkwall()){
return (true);
};
return (false);
}
public function checkdamage():Boolean{
i = 0;
while (i < nentity) {
if (entities[i].rule == 0){
tempx = (entities[i].xp + entities[i].cx);
tempy = (entities[i].yp + entities[i].cy);
tempw = entities[i].cw;
temph = entities[i].ch;
rectset(tempx, tempy, tempw, temph);
j = 0;
while (j < nblocks) {
if (blocks[j].type == DAMAGE){
if (blocks[j].rect.intersects(temprect)){
return (true);
};
};
j++;
};
};
i++;
};
return (false);
}
public function removeblockat(_arg1:int, _arg2:int):void{
i = 0;
while (i < nblocks) {
if ((((blocks[i].x == _arg1)) && ((blocks[i].y == _arg2)))){
removeblock(i);
};
i++;
};
}
public function rectset(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
temprect.x = _arg1;
temprect.y = _arg2;
temprect.width = _arg3;
temprect.height = _arg4;
}
}
}//package
Section 26
//gameclass (gameclass)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
import com.kongregate.as3.client.*;
public class gameclass extends Sprite {
public var hascontrol:Boolean;
public var menudelay:int;
public var bullettimeframe:int;
public var actionheld:Boolean;
public var state:int;
public var statedelay:int;
public var dx:int;
public var dy:int;
public var muted:Boolean;
public var test:Boolean;
public var screenshake:int;
public var teststring:String;
public var score:int;
public var my:int;
public var menuscreen:int;
public var paused:Boolean;
public var mx:int;
public var bttimer:int;
public var meddelay:int;
public var mutebutton:int;
public var backgroundrect:Array;
public var easydelay:int;
public var shootdelay:int;
public var scrollspeed:int;
public var visitsite:Boolean;
public var globalsound:int;
public var time:int;
public var bullettime:int;
public var infocus:Boolean;
public var gamecookie:SharedObject;
public var playedrechargesound:Boolean;
public var gamestate:int;
public var jumpheld:Boolean;
public var i:int;
public var scorerecord:int;
public var playedtimerecordsound:Boolean;
public var timerecord:int;
public var bullettimemode:Boolean;
public var btstatedelay:int;
public var kongapi:KongregateAPI;
public var playedscorerecordsound:Boolean;
public var harddelay:int;
public var deathseq:int;
public var powershot:int;
public static var GAMEMODE:Number = 0;
public function gameclass(_arg1:entityclass, _arg2:helpclass, _arg3:musicclass):void{
var _local4:Rectangle;
super();
gamecookie = SharedObject.getLocal("dwbullettime");
infocus = true;
paused = false;
muted = false;
globalsound = 1;
addEventListener(Event.DEACTIVATE, windowNotActive);
addEventListener(Event.ACTIVATE, windowActive);
gamestate = GAMEMODE;
hascontrol = true;
jumpheld = false;
shootdelay = 0;
bttimer = 0;
bullettimemode = false;
bullettime = 100;
bullettimeframe = 0;
easydelay = 20;
meddelay = 22;
harddelay = 12;
scrollspeed = 8;
playedrechargesound = true;
menuscreen = 0;
menudelay = 150;
deathseq = -1;
dx = 0;
dy = 0;
visitsite = false;
btstatedelay = 0;
playedscorerecordsound = false;
playedtimerecordsound = false;
if (scorerecord == 0){
playedscorerecordsound = true;
};
if (timerecord == 0){
playedtimerecordsound = true;
};
backgroundrect = new Array();
i = 0;
while (i < 60) {
_local4 = new Rectangle();
backgroundrect.push(_local4);
i++;
};
i = 0;
while (i < 10) {
backgroundrect[i].x = (i * 32);
backgroundrect[i].y = 0;
backgroundrect[i].width = 32;
backgroundrect[i].height = (30 + (6 * int((Math.random() * 5))));
backgroundrect[(i + 10)].x = (i * 32);
backgroundrect[(i + 10)].width = 32;
backgroundrect[(i + 10)].height = (30 + (6 * int((Math.random() * 5))));
backgroundrect[(i + 10)].y = (120 - backgroundrect[(i + 10)].height);
i++;
};
i = 0;
while (i < 20) {
backgroundrect[(i + 20)].x = (i * 16);
backgroundrect[(i + 20)].y = 0;
backgroundrect[(i + 20)].width = 16;
backgroundrect[(i + 20)].height = (15 + (3 * int((Math.random() * 5))));
backgroundrect[(i + 40)].x = (i * 16);
backgroundrect[(i + 40)].width = 16;
backgroundrect[(i + 40)].height = (15 + (3 * int((Math.random() * 5))));
backgroundrect[(i + 40)].y = (120 - backgroundrect[(i + 40)].height);
i++;
};
if (gamecookie.data.hscore == undefined){
gamecookie.data.hscore = 0;
scorerecord = 0;
} else {
scorerecord = gamecookie.data.hscore;
};
if (gamecookie.data.htime == undefined){
gamecookie.data.htime = 0;
timerecord = 0;
} else {
timerecord = gamecookie.data.htime;
};
score = scorerecord;
time = timerecord;
kongapi = KongregateAPI.getInstance();
savescore();
test = false;
state = 1;
statedelay = 0;
updatestate(_arg1, _arg2, _arg3);
}
public function windowActive(_arg1:Event):void{
infocus = true;
}
public function intrank():int{
if (timerecord >= 5400){
return (14);
};
if (timerecord >= 3600){
return (13);
};
if (timerecord >= 3000){
return (12);
};
if (timerecord >= 2700){
return (11);
};
if (timerecord >= 2400){
return (10);
};
if (timerecord >= 2100){
return (9);
};
if (timerecord >= 1800){
return (8);
};
if (timerecord >= 1500){
return (7);
};
if (timerecord >= 1200){
return (6);
};
if (timerecord >= 900){
return (5);
};
if (timerecord >= 600){
return (4);
};
if (timerecord >= 450){
return (3);
};
if (timerecord >= 300){
return (2);
};
if (timerecord >= 150){
return (1);
};
if (timerecord >= 0){
return (0);
};
return (0);
}
public function windowNotActive(_arg1:Event):void{
infocus = false;
}
public function nextscorerank():String{
if (timerecord >= 5400){
return ("-1");
};
if (timerecord >= 3600){
return ("180");
};
if (timerecord >= 2700){
return ("120");
};
if (timerecord >= 2400){
return ("90");
};
if (timerecord >= 2100){
return ("80");
};
if (timerecord >= 1800){
return ("70");
};
if (timerecord >= 1500){
return ("60");
};
if (timerecord >= 1200){
return ("50");
};
if (timerecord >= 900){
return ("40");
};
if (timerecord >= 600){
return ("30");
};
if (timerecord >= 450){
return ("20");
};
if (timerecord >= 300){
return ("15");
};
if (timerecord >= 150){
return ("10");
};
if (timerecord >= 0){
return ("5");
};
return ("0");
}
public function savescore():void{
gamecookie.data.hscore = scorerecord;
gamecookie.data.htime = timerecord;
gamecookie.flush();
kongapi.stats.submit("time", timerecord);
kongapi.stats.submit("rank", intrank());
if (score > 0){
kongapi.stats.submit("myscores", score);
};
kongapi.scores.submit(score);
}
public function scorerank():String{
if (timerecord >= 5400){
return ("Martha");
};
if (timerecord >= 3600){
return ("God");
};
if (timerecord >= 3000){
return ("Demigod");
};
if (timerecord >= 2700){
return ("Legend");
};
if (timerecord >= 2400){
return ("Hero");
};
if (timerecord >= 2100){
return ("Marshal");
};
if (timerecord >= 1800){
return ("Commodore");
};
if (timerecord >= 1500){
return ("Commander");
};
if (timerecord >= 1200){
return ("Ace");
};
if (timerecord >= 900){
return ("Leader");
};
if (timerecord >= 600){
return ("Captain");
};
if (timerecord >= 450){
return ("Pilot");
};
if (timerecord >= 300){
return ("Co-Pilot");
};
if (timerecord >= 150){
return ("Cadet");
};
if (timerecord >= 0){
return ("Rookie");
};
return ("Martha");
}
public function currentscorerank():String{
if (time >= 5400){
return ("[Martha]");
};
if (time >= 3600){
return ("[God]");
};
if (time >= 3000){
return ("[Demigod]");
};
if (time >= 2700){
return ("[Legend]");
};
if (time >= 2400){
return ("[Hero]");
};
if (time >= 2100){
return ("[Marshal]");
};
if (time >= 1800){
return ("[Commodore]");
};
if (time >= 1500){
return ("[Commander]");
};
if (time >= 1200){
return ("[Ace]");
};
if (time >= 900){
return ("[Leader]");
};
if (time >= 600){
return ("[Captain]");
};
if (time >= 450){
return ("[Pilot]");
};
if (time >= 300){
return ("[Co-Pilot]");
};
if (time >= 150){
return ("[Cadet]");
};
if (time >= 0){
return ("[Rookie]");
};
return ("[Martha]");
}
public function updatestate(_arg1:entityclass, _arg2:helpclass, _arg3:musicclass):void{
if (bullettimemode){
i = 0;
while (i < 10) {
backgroundrect[i].x = (backgroundrect[i].x - (scrollspeed / 2));
if (backgroundrect[i].x < -32){
backgroundrect[i].x = (backgroundrect[i].x + 320);
};
backgroundrect[(i + 10)].x = (backgroundrect[(i + 10)].x - (scrollspeed / 2));
if (backgroundrect[(i + 10)].x < -32){
backgroundrect[(i + 10)].x = (backgroundrect[(i + 10)].x + 320);
};
i++;
};
i = 0;
while (i < 20) {
backgroundrect[(i + 20)].x = (backgroundrect[(i + 20)].x - ((scrollspeed / 2) + 2));
if (backgroundrect[(i + 20)].x < -16){
backgroundrect[(i + 20)].x = (backgroundrect[(i + 20)].x + 320);
};
backgroundrect[(i + 40)].x = (backgroundrect[(i + 40)].x - ((scrollspeed / 2) + 2));
if (backgroundrect[(i + 40)].x < -16){
backgroundrect[(i + 40)].x = (backgroundrect[(i + 40)].x + 320);
};
i++;
};
} else {
i = 0;
while (i < 10) {
backgroundrect[i].x = (backgroundrect[i].x - scrollspeed);
if (backgroundrect[i].x < -32){
backgroundrect[i].x = (backgroundrect[i].x + 320);
};
backgroundrect[(i + 10)].x = (backgroundrect[(i + 10)].x - scrollspeed);
if (backgroundrect[(i + 10)].x < -32){
backgroundrect[(i + 10)].x = (backgroundrect[(i + 10)].x + 320);
};
i++;
};
i = 0;
while (i < 20) {
backgroundrect[(i + 20)].x = (backgroundrect[(i + 20)].x - (scrollspeed + 4));
if (backgroundrect[(i + 20)].x < -16){
backgroundrect[(i + 20)].x = (backgroundrect[(i + 20)].x + 320);
};
backgroundrect[(i + 40)].x = (backgroundrect[(i + 40)].x - (scrollspeed + 4));
if (backgroundrect[(i + 40)].x < -16){
backgroundrect[(i + 40)].x = (backgroundrect[(i + 40)].x + 320);
};
i++;
};
};
if (bullettimemode){
btstatedelay--;
if (btstatedelay <= 0){
btstatedelay = 2;
statedelay--;
if (statedelay <= 0){
statedelay = 0;
};
};
} else {
statedelay--;
if (statedelay <= 0){
statedelay = 0;
};
};
if (statedelay <= 0){
switch (state){
case 0:
if (time < 300){
state = (10 + (Math.random() * 20));
if ((((state < 10)) || ((state > 20)))){
state = 20;
};
} else {
if ((((time >= 300)) && ((time < 2100)))){
state = (20 + (Math.random() * 30));
if ((((state < 20)) || ((state > 38)))){
state = 38;
};
if (state == 34){
if ((Math.random() * 100) > 80){
state = 0;
} else {
state = 34;
};
};
} else {
state = 38;
};
};
if (deathseq >= 0){
state = 0;
};
if (deathseq == -1){
i = _arg1.getplayer();
if ((((_arg1.entities[i].xp > 140)) && ((((_arg1.entities[i].yp < 20)) || ((_arg1.entities[i].yp > 90)))))){
if ((Math.random() * 100) > 75){
if ((Math.random() * 100) > 25){
state = 36;
} else {
state = 34;
};
};
} else {
if ((((_arg1.entities[i].yp < 20)) || ((_arg1.entities[i].yp > 90)))){
if ((Math.random() * 100) > 90){
state = 34;
};
};
};
};
break;
case 9:
_arg1.createentity(165, (10 + (Math.random() * 85)), (2 + (Math.random() * 5)));
state = 0;
statedelay = 10;
break;
case 10:
i = 0;
while (i < 5) {
_arg1.createentity((165 + (i * 12)), (10 + (Math.random() * 85)), 2);
i++;
};
state = 0;
statedelay = easydelay;
break;
case 11:
i = 0;
while (i < 4) {
_arg1.createentity(165, (12 + (i * 12)), 2);
_arg1.createentity(176, (18 + (i * 12)), 2);
i++;
};
state = 0;
statedelay = (easydelay + 7);
break;
case 12:
i = 0;
while (i < 4) {
_arg1.createentity(165, (98 - (i * 12)), 2);
_arg1.createentity(176, (92 - (i * 12)), 2);
i++;
};
state = 0;
statedelay = (easydelay + 7);
break;
case 13:
i = 0;
while (i < 4) {
_arg1.createentity(165, (98 - (i * 24)), 2);
_arg1.createentity(176, (18 + (i * 24)), 2);
i++;
};
state = 0;
statedelay = (easydelay + 7);
break;
case 14:
_arg1.createentity(165, (10 + (Math.random() * 85)), 3);
state = 0;
statedelay = easydelay;
break;
case 15:
_arg1.createentity(165, 30, 3);
_arg1.createentity(175, 40, 3);
state = 0;
statedelay = (easydelay + 7);
break;
case 16:
_arg1.createentity(165, 90, 3);
_arg1.createentity(175, 80, 3);
state = 0;
statedelay = (easydelay + 7);
break;
case 17:
_arg1.createentity(165, 20, 4);
state = 0;
statedelay = easydelay;
break;
case 18:
_arg1.createentity(165, 90, 4);
state = 0;
statedelay = easydelay;
break;
case 19:
_arg1.createentity(185, 20, 4);
_arg1.createentity(165, 90, 4);
state = 0;
statedelay = (easydelay + 7);
break;
case 20:
_arg1.createentity(165, (8 + (Math.random() * 85)), (2 + (Math.random() * 5)));
state = 0;
statedelay = 10;
break;
case 21:
_arg1.createentity(165, 75, 6);
_arg1.createentity(165, 55, 6);
_arg1.createentity(165, 35, 6);
state = 0;
statedelay = (meddelay + 35);
break;
case 22:
_arg1.createentity(185, 35, 3);
_arg1.createentity(165, 55, 3);
_arg1.createentity(185, 75, 3);
state = 0;
statedelay = (meddelay + 5);
break;
case 23:
_arg1.createentity(165, 15, 3);
_arg1.createentity(165, 95, 3);
state = 0;
statedelay = (meddelay + 5);
break;
case 24:
_arg1.createentity(185, 35, 3);
_arg1.createentity(165, 55, 3);
_arg1.createentity(185, 75, 3);
state = 0;
statedelay = (meddelay + 7);
break;
case 25:
_arg1.createentity(165, 15, 3);
_arg1.createentity(165, 95, 3);
state = 0;
statedelay = (meddelay + 7);
break;
case 26:
_arg1.createentity(165, 15, 5);
_arg1.createentity(185, 20, 5);
_arg1.createentity(205, 25, 5);
_arg1.createentity(225, 30, 5);
_arg1.createentity(245, 35, 5);
state = 0;
statedelay = (meddelay + 30);
break;
case 27:
_arg1.createentity(165, 20, 5);
_arg1.createentity(185, 90, 5);
_arg1.createentity(205, 20, 5);
_arg1.createentity(225, 90, 5);
_arg1.createentity(245, 20, 5);
state = 0;
statedelay = (meddelay + 30);
break;
case 28:
_arg1.createentity(165, 92, 5);
_arg1.createentity(185, 92, 5);
_arg1.createentity(205, 92, 5);
state = 0;
statedelay = (meddelay + 30);
break;
case 29:
_arg1.createentity(165, 90, 4);
_arg1.createentity(185, 85, 4);
_arg1.createentity(205, 80, 4);
_arg1.createentity(225, 75, 4);
_arg1.createentity(245, 70, 4);
state = 0;
statedelay = (meddelay + 35);
break;
case 30:
_arg1.createentity(165, 15, 4);
_arg1.createentity(185, 20, 4);
_arg1.createentity(205, 25, 4);
_arg1.createentity(225, 30, 4);
_arg1.createentity(245, 35, 4);
state = 0;
statedelay = (meddelay + 35);
break;
case 31:
_arg1.createentity(165, 15, 6);
_arg1.createentity(185, 55, 6);
_arg1.createentity(205, 95, 6);
state = 0;
statedelay = (meddelay + 35);
break;
case 32:
_arg1.createentity(165, 95, 6);
_arg1.createentity(185, 55, 6);
_arg1.createentity(205, 15, 6);
state = 0;
statedelay = (meddelay + 35);
break;
case 33:
i = 0;
while (i < 8) {
_arg1.createentity((165 + (i * 20)), (32 - (i * 12)), 4);
i++;
};
state = 0;
statedelay = (meddelay + 40);
break;
case 34:
_arg1.createentity(165, 12, 6);
_arg1.createentity(165, 99, 6);
if ((Math.random() * 100) > 75){
_arg1.createentity(185, 12, 6);
_arg1.createentity(185, 99, 6);
};
state = 0;
statedelay = (meddelay + 35);
break;
case 35:
_arg1.createentity(165, 12, 6);
_arg1.createentity(165, 99, 6);
state = 0;
statedelay = (meddelay + 35);
break;
case 36:
_arg1.createentity(180, 8, 5);
_arg1.createentity(180, 103, 5);
state = 0;
statedelay = (meddelay + 35);
break;
case 37:
i = 0;
while (i < 5) {
_arg1.createentity(165, (12 + (i * 21)), 2);
_arg1.createentity(195, (12 + (i * 21)), 2);
_arg1.createentity(225, (12 + (i * 21)), 2);
_arg1.createentity(0xFF, (12 + (i * 21)), 2);
i++;
};
i = 0;
while (i < 4) {
_arg1.createentity(180, (22 + (i * 21)), 2);
_arg1.createentity(210, (22 + (i * 21)), 2);
_arg1.createentity(240, (22 + (i * 21)), 2);
_arg1.createentity(270, (22 + (i * 21)), 2);
i++;
};
state = 0;
statedelay = (meddelay + 35);
break;
case 38:
_arg1.createentity(165, (10 + (Math.random() * 40)), (2 + (Math.random() * 5)));
_arg1.createentity(165, (95 - (Math.random() * 40)), (2 + (Math.random() * 5)));
state = 0;
statedelay = harddelay;
break;
};
};
}
public function clearscore():void{
gamecookie.data.hscore = 0;
gamecookie.data.htime = 0;
gamecookie.flush();
}
}
}//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 glow:int;
public var slowsine:int;
public var sine:Array;
public var globaltemp2:int;
public var globaltemp3:int;
public var glowdir:int;
public var splitseconds:Array;
public var globaltemp:int;
public var cosine:Array;
public function tdstring(_arg1:int):String{
if (_arg1 < 10){
return (("0" + String(_arg1)));
};
if (_arg1 < 100){
return (String(_arg1));
};
return (String((_arg1 % 100)));
}
public function init():void{
var _local2:Number;
var _local3:Number;
sine = new Array();
cosine = new Array();
splitseconds = new Array();
var _local1:int;
while (_local1 < 64) {
_local2 = new Number();
sine.push(_local2);
cosine.push(_local2);
sine[_local1] = Math.sin(((_local1 * 6.283) / 64));
cosine[_local1] = Math.cos(((_local1 * 6.283) / 64));
_local1++;
};
_local1 = 0;
while (_local1 < 30) {
_local3 = new Number();
splitseconds.push(_local3);
splitseconds[_local1] = int(((100 * _local1) / 30));
_local1++;
};
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;
};
};
}
public function removeObject(_arg1:Object, _arg2:Array):void{
var _local3:String;
for (_local3 in _arg2) {
if (_arg2[_local3] == _arg1){
_arg2.splice(_local3, 1);
break;
};
};
}
public function sseconds(_arg1:int):int{
return (splitseconds[(_arg1 % 30)]);
}
public function seconds(_arg1:int):int{
return (((_arg1 - (_arg1 % 30)) / 30));
}
}
}//package
Section 28
//Main (Main)
package {
import bigroom.input.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.ui.*;
public class Main extends Sprite {
public var dwgfx:dwgraphicsclass;
public var bottombar:Rectangle;
private var ef_0:Class;
public var GAMEMODE:int;// = 0
private var ef_4:Class;
private var ef_5:Class;
private var ef_7:Class;
private var ef_1:Class;
private var ef_2:Class;
private var ef_3:Class;
public var FOCUS2MODE:int;// = 3
public var pixel:uint;
private var im_pic0:Class;
private var im_pic1:Class;
private var im_pic2:Class;
public var slogo:MovieClip;
private var ef_6:Class;
private var ef_8:Class;
public var music:musicclass;
public var topbar:Rectangle;
private var im_tiles:Class;
public var help:helpclass;
private var im_bfontmask:Class;
private var ef_9:Class;
public var backbar:Rectangle;
public var logoposition:Matrix;
private var im_bfont:Class;
public var TITLEMODE:int;// = 1
private var music_2:Class;
public var gamestate:int;
public var FOCUSMODE:int;// = 2
public var key:KeyPoll;
public var i:int;
public var j:int;
private var music_1:Class;
public var pixel2:uint;
public var game:gameclass;
public var obj:entityclass;
public var pi:uint;
public var pj:uint;
public static var TRIGGER:Number = 1;
public static var BLOCK:Number = 0;
public static var DAMAGE:Number = 2;
public function Main():void{
dwgfx = new dwgraphicsclass();
music = new musicclass();
help = new helpclass();
obj = new entityclass();
im_tiles = Main_im_tiles;
im_bfont = Main_im_bfont;
im_bfontmask = Main_im_bfontmask;
im_pic0 = Main_im_pic0;
im_pic1 = Main_im_pic1;
im_pic2 = Main_im_pic2;
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;
music_1 = Main_music_1;
music_2 = Main_music_2;
super();
if (stage){
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, gameinit);
};
}
public function titleinput(_arg1:KeyPoll, _arg2:dwgraphicsclass, _arg3:gameclass, _arg4:entityclass, _arg5:helpclass, _arg6:musicclass):void{
var _local7:URLRequest;
_arg3.mx = (mouseX / 4);
_arg3.my = (mouseY / 4);
_arg3.visitsite = false;
if ((((_arg3.my >= 95)) && ((_arg3.my <= 105)))){
_arg3.visitsite = true;
};
if (_arg1.click){
if (_arg3.visitsite){
_local7 = new URLRequest("http://www.distractionware.com");
navigateToURL(_local7, "_blank");
};
};
if (_arg1.isDown(80)){
_arg3.clearscore();
};
if (_arg3.actionheld){
if (((!(_arg1.isDown(90))) && (!(_arg1.isDown(32))))){
_arg3.actionheld = false;
};
} else {
if (((_arg1.isDown(90)) || (_arg1.isDown(32)))){
_arg3.actionheld = true;
gamestate = GAMEMODE;
_arg4.nentity = 0;
_arg4.createentity(20, 54, 0);
_arg3.state = 0;
_arg3.statedelay = 0;
_arg3.powershot = 0;
_arg3.deathseq = -1;
_arg3.score = 0;
_arg3.time = 0;
_arg3.bullettimemode = false;
_arg3.bullettime = 150;
_arg3.bullettimeframe = 0;
_arg3.playedrechargesound = true;
_arg3.playedscorerecordsound = false;
_arg3.playedtimerecordsound = false;
if (_arg3.scorerecord == 0){
_arg3.playedscorerecordsound = true;
};
if (_arg3.timerecord == 0){
_arg3.playedtimerecordsound = true;
};
_arg6.play(1);
};
};
}
private function gameinit(_arg1:Event=null):void{
var _local2:Bitmap;
var _local3:ContextMenu;
var _local4:ContextMenuItem;
removeEventListener(Event.ADDED_TO_STAGE, gameinit);
if (sitelock()){
_local3 = new ContextMenu();
_local4 = new ContextMenuItem("Visit distractionware.com");
_local4.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_distractionware);
_local3.hideBuiltInItems();
_local3.customItems.push(_local4);
this.contextMenu = _local3;
gamestate = FOCUSMODE;
obj.init();
help.init();
key = new KeyPoll(stage);
SoundMixer.soundTransform = new SoundTransform(1);
music.currentsong = -1;
music.musicfade = 0;
music.initefchannels();
music.currentefchan = 0;
music.numplays = 0;
music.musicchan.push(new music_1());
music.musicchan.push(new music_2());
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());
game = new gameclass(obj, help, music);
topbar = new Rectangle(0, 0, 160, 12);
bottombar = new Rectangle(0, 108, 160, 12);
backbar = new Rectangle(0, 12, 160, 96);
dwgfx.init();
_local2 = new im_tiles();
dwgfx.buffer = _local2.bitmapData;
dwgfx.maketilearray();
_local2 = new im_bfont();
dwgfx.buffer = _local2.bitmapData;
dwgfx.makebfont();
_local2 = new im_bfontmask();
dwgfx.buffer = _local2.bitmapData;
dwgfx.makebfontmask();
_local2 = new im_pic0();
dwgfx.buffer = _local2.bitmapData;
dwgfx.addimage();
_local2 = new im_pic1();
dwgfx.buffer = _local2.bitmapData;
dwgfx.addimage();
_local2 = new im_pic2();
dwgfx.buffer = _local2.bitmapData;
dwgfx.addimage();
dwgfx.buffer = new BitmapData(320, 240, false, 0);
addChild(dwgfx);
stage.quality = StageQuality.LOW;
addEventListener(Event.ENTER_FRAME, mainloop);
} else {
dwgfx.init();
addChild(dwgfx);
_local2 = new im_bfont();
dwgfx.buffer = _local2.bitmapData;
dwgfx.makebfont();
_local2 = new im_bfontmask();
dwgfx.buffer = _local2.bitmapData;
dwgfx.makebfontmask();
dwgfx.buffer = new BitmapData(320, 240, false, 0);
addEventListener(Event.ENTER_FRAME, lockedloop);
};
}
public function titlelogic(_arg1:KeyPoll, _arg2:dwgraphicsclass, _arg3:gameclass, _arg4:entityclass, _arg5:helpclass, _arg6:musicclass):void{
_arg6.processmusic();
_arg5.updateglow();
}
public function gamerender(_arg1:KeyPoll, _arg2:dwgraphicsclass, _arg3:gameclass, _arg4:entityclass, _arg5:helpclass):void{
i = 0;
while (i < _arg4.nentity) {
_arg4.animateentities(i, _arg5);
i++;
};
_arg2.backbuffer.lock();
if (_arg3.bullettimemode){
_arg2.backbuffer.fillRect(backbar, 2250018);
i = 0;
while (i < 10) {
if ((((_arg3.backgroundrect[i].x > -32)) && ((_arg3.backgroundrect[i].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[i], 3368499);
};
if ((((_arg3.backgroundrect[(i + 10)].x > -32)) && ((_arg3.backgroundrect[(i + 10)].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[(i + 10)], 3368499);
};
i++;
};
i = 0;
while (i < 20) {
if ((((_arg3.backgroundrect[(i + 20)].x > -16)) && ((_arg3.backgroundrect[(i + 40)].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[(i + 20)], 4486980);
};
if ((((_arg3.backgroundrect[(i + 40)].x > -16)) && ((_arg3.backgroundrect[(i + 40)].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[(i + 40)], 4486980);
};
i++;
};
} else {
_arg2.backbuffer.fillRect(backbar, 3359795);
i = 0;
while (i < 10) {
if ((((_arg3.backgroundrect[i].x > -32)) && ((_arg3.backgroundrect[i].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[i], 4478276);
};
if ((((_arg3.backgroundrect[(i + 10)].x > -32)) && ((_arg3.backgroundrect[(i + 10)].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[(i + 10)], 4478276);
};
i++;
};
i = 0;
while (i < 20) {
if ((((_arg3.backgroundrect[(i + 20)].x > -16)) && ((_arg3.backgroundrect[(i + 40)].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[(i + 20)], 5596757);
};
if ((((_arg3.backgroundrect[(i + 40)].x > -16)) && ((_arg3.backgroundrect[(i + 40)].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[(i + 40)], 5596757);
};
i++;
};
};
_arg2.drawentities(_arg3, _arg4, _arg5);
_arg2.backbuffer.fillRect(topbar, 0);
_arg2.backbuffer.fillRect(bottombar, 0);
if ((((_arg3.score >= _arg3.scorerecord)) && (!(_arg3.bullettimemode)))){
if (((!(_arg3.playedscorerecordsound)) && (!(_arg3.playedtimerecordsound)))){
_arg3.playedscorerecordsound = true;
music.playef(9, 20);
};
_arg3.scorerecord = _arg3.score;
_arg2.print(2, 2, "New Record!", 0xFF, 0xFF, 0xFF, false);
_arg2.rprint(5, 2, String(_arg3.score), (0xFF - _arg5.glow), 0xFF, (0xFF - _arg5.glow), false);
} else {
_arg2.print(2, 2, "Score:", 16, 0xFF, 16, false);
_arg2.rprint(5, 2, String(_arg3.score), 16, (0xFF - _arg5.glow), 16, false);
};
if (_arg3.time >= _arg3.timerecord){
if (((!(_arg3.playedtimerecordsound)) && (!(_arg3.playedtimerecordsound)))){
_arg3.playedtimerecordsound = true;
music.playef(9, 20);
};
_arg3.timerecord = _arg3.time;
_arg2.print(95, 109, "Record!", 0xFF, 0xFF, 0xFF, false);
_arg2.rprint(5, 109, ((String(_arg5.seconds(_arg3.time)) + ".") + _arg5.tdstring(_arg5.sseconds(_arg3.time))), (0xFF - _arg5.glow), (0xFF - _arg5.glow), 0xFF, false);
} else {
_arg2.print(95, 109, "Time:", 164, 164, 164, false);
_arg2.rprint(5, 109, ((String(_arg5.seconds(_arg3.time)) + ".") + _arg5.tdstring(_arg5.sseconds(_arg3.time))), 164, 164, (196 - _arg5.glow), false);
};
if (_arg3.bullettime >= 150){
_arg2.print(5, 109, "[Ready]", (0xFF - (_arg5.glow * 2)), 0xFF, 0xFF, false);
} else {
if (_arg3.bullettimemode){
_arg2.print(5, 109, (("[Charge: " + String(int(((_arg3.bullettime * 100) / 150)))) + "%]"), 16, (0xFF - (_arg5.glow * 2)), 16, false);
} else {
_arg2.print(5, 109, (("[Charge: " + String(int(((_arg3.bullettime * 100) / 150)))) + "%]"), (0xFF - (_arg5.glow * 2)), 16, 16, false);
};
};
if (_arg3.test){
_arg2.print(5, 5, _arg3.teststring, 16, 0xFF, 16, false);
};
_arg2.render();
_arg2.backbuffer.unlock();
}
public function sitelock():Boolean{
var _local1:String = stage.loaderInfo.url.toLowerCase();
if ((((_local1.indexOf("kongregate.com") <= 0)) && ((_local1.indexOf("ungrounded.net") <= 0)))){
return (false);
};
return (true);
}
public function gameinput(_arg1:KeyPoll, _arg2:dwgraphicsclass, _arg3:gameclass, _arg4:entityclass, _arg5:helpclass, _arg6:musicclass):void{
_arg3.mx = (mouseX / 4);
_arg3.my = (mouseY / 4);
i = 0;
while (i < _arg4.nentity) {
if (_arg4.entities[i].rule == 0){
if (_arg3.hascontrol){
if (((((_arg1.isDown(Keyboard.LEFT)) || (_arg1.isDown(65)))) && ((_arg4.entities[i].xp > 1)))){
_arg4.entities[i].vx = -3;
} else {
if (((((_arg1.isDown(Keyboard.RIGHT)) || (_arg1.isDown(68)))) && ((_arg4.entities[i].xp < 149)))){
_arg4.entities[i].vx = 3;
} else {
_arg4.entities[i].vx = 0;
};
};
if (((((_arg1.isDown(Keyboard.UP)) || (_arg1.isDown(87)))) && ((_arg4.entities[i].yp > 13)))){
_arg4.entities[i].vy = -3;
} else {
if (((((_arg1.isDown(Keyboard.DOWN)) || (_arg1.isDown(83)))) && ((_arg4.entities[i].yp < 100)))){
_arg4.entities[i].vy = 3;
} else {
_arg4.entities[i].vy = 0;
};
};
if (_arg3.shootdelay <= 0){
if (_arg3.powershot > 0){
_arg4.createentity(_arg4.entities[i].xp, (_arg4.entities[i].yp + 1), 12, 10);
_arg4.createentity((_arg4.entities[i].xp - 1), ((_arg4.entities[i].yp + 1) - 3), 13, 10, -1);
_arg4.createentity((_arg4.entities[i].xp - 1), ((_arg4.entities[i].yp + 1) + 7), 14, 10, 1);
_arg6.playef(1, 25);
_arg3.powershot--;
} else {
_arg4.createentity(_arg4.entities[i].xp, (_arg4.entities[i].yp + 2), 1, 9);
_arg6.playef(0, 25);
};
_arg3.shootdelay = 2;
} else {
_arg3.shootdelay--;
};
if (_arg3.actionheld){
if (((!(_arg1.isDown(90))) && (!(_arg1.isDown(32))))){
_arg3.actionheld = false;
};
} else {
if (((((_arg1.isDown(90)) || (_arg1.isDown(32)))) && ((_arg3.bullettimemode == true)))){
_arg3.bullettime = (_arg3.bullettime - 2);
_arg3.score = (_arg3.score - 150);
if (_arg3.score < 0){
_arg3.score = 0;
};
if (_arg3.bullettime > 10){
if ((_arg3.bullettime % 28) < 2){
_arg6.playef(7, 20);
};
};
if (_arg3.bullettime <= 0){
_arg6.playef(6, 20);
_arg3.bullettime = 0;
_arg3.bullettimemode = false;
_arg3.bullettimeframe = 0;
};
} else {
if (((((_arg1.isDown(90)) || (_arg1.isDown(32)))) && ((_arg3.bullettimemode == false)))){
if (_arg3.bullettime >= 150){
_arg3.bullettimemode = true;
_arg3.playedrechargesound = false;
_arg3.bullettime = 149;
} else {
_arg3.bullettimeframe--;
if (_arg3.bullettimeframe <= 0){
_arg3.bullettime++;
_arg3.bullettimeframe = 2;
} else {
_arg3.bullettimeframe--;
};
};
} else {
_arg3.bullettimemode = false;
_arg3.bullettimeframe--;
if (_arg3.bullettimeframe <= 0){
_arg3.bullettime++;
_arg3.bullettimeframe = 2;
};
};
};
if (_arg3.bullettime >= 150){
_arg3.bullettime = 150;
if (!_arg3.playedrechargesound){
_arg3.playedrechargesound = true;
_arg6.playef(5, 20);
_arg4.createentity((_arg4.entities[i].xp + 4), (_arg4.entities[i].yp + 3), 27);
};
};
};
};
};
i++;
};
}
public function visit_sponsor_logo():void{
var _local1:URLRequest = new URLRequest("http://www.kongregate.com/?gamereferral=dontlookback");
navigateToURL(_local1, "_blank");
}
public function visit_sponsor(_arg1:Event):void{
var _local2:URLRequest = new URLRequest("http://www.kongregate.com/?gamereferral=dontlookback");
navigateToURL(_local2, "_blank");
}
public function lockedloop(_arg1:Event):void{
dwgfx.backbuffer.lock();
dwgfx.bprint(5, 50, "Sorry! This game can only by played on", (196 - help.glow), (0xFF - help.glow), (196 - help.glow), true);
dwgfx.bprint(5, 60, "Kongregate or Newgrounds!", (196 - help.glow), (0xFF - help.glow), (196 - help.glow), true);
dwgfx.render();
dwgfx.backbuffer.unlock();
help.updateglow();
}
public function gamelogic(_arg1:KeyPoll, _arg2:dwgraphicsclass, _arg3:gameclass, _arg4:entityclass, _arg5:helpclass, _arg6:musicclass):void{
_arg6.processmusic();
_arg5.updateglow();
if (_arg3.deathseq == -1){
if (_arg3.bullettimemode){
_arg3.bttimer--;
if (_arg3.bttimer <= 0){
_arg3.time++;
_arg3.bttimer = 2;
};
} else {
_arg3.time++;
};
};
if (_arg3.deathseq == -1){
if (!_arg3.bullettimemode){
if (_arg3.bullettime >= 150){
if ((_arg5.slowsine % 4) == 0){
i = _arg4.getplayer();
_arg4.createentity((_arg4.entities[i].xp + 4), (_arg4.entities[i].yp + 3), 25);
};
} else {
if ((_arg5.slowsine % 4) == 0){
i = _arg4.getplayer();
_arg4.createentity((_arg4.entities[i].xp + 4), (_arg4.entities[i].yp + 3), 26);
};
};
} else {
if ((_arg5.slowsine % 6) == 0){
i = _arg4.getplayer();
_arg4.createentity((_arg4.entities[i].xp + 4), (_arg4.entities[i].yp + 3), 27);
};
};
} else {
_arg3.deathseq--;
if (_arg3.deathseq <= 0){
gamestate = TITLEMODE;
_arg3.deathseq = 0;
_arg6.play(0);
_arg3.menuscreen = 1;
_arg3.menudelay = 150;
_arg3.actionheld = true;
_arg3.savescore();
};
if (_arg3.deathseq > 30){
if ((_arg5.slowsine % 8) == 0){
_arg6.playef(1, 20);
_arg4.createentity((_arg3.dx + 4), (_arg3.dy + 3), 28);
};
};
};
_arg3.updatestate(_arg4, _arg5, _arg6);
i = 0;
while (i < _arg4.nentity) {
if (_arg4.entities[i].active){
_arg4.updateentities(i, _arg5, _arg3, _arg6);
_arg4.entities[i].vx = (_arg4.entities[i].vx + _arg4.entities[i].ax);
_arg4.entities[i].vy = (_arg4.entities[i].vy + _arg4.entities[i].ay);
_arg4.entities[i].ax = 0;
if (((_arg3.bullettimemode) && ((_arg4.entities[i].rule >= 2)))){
_arg4.entities[i].newxp = (_arg4.entities[i].xp + (_arg4.entities[i].vx / 2));
_arg4.entities[i].newyp = (_arg4.entities[i].yp + (_arg4.entities[i].vy / 2));
} else {
_arg4.entities[i].newxp = (_arg4.entities[i].xp + _arg4.entities[i].vx);
_arg4.entities[i].newyp = (_arg4.entities[i].yp + _arg4.entities[i].vy);
};
_arg4.entities[i].xp = _arg4.entities[i].newxp;
_arg4.entities[i].yp = _arg4.entities[i].newyp;
};
i++;
};
i = 0;
while (i < _arg4.nentity) {
if (_arg4.entities[i].active){
j = 0;
while (j < _arg4.nentity) {
if (((((_arg4.entities[j].active) && (!((_arg4.entities[j].rule == 4))))) && (_arg4.entities[j].harmful))){
if ((((_arg4.entities[i].rule == 1)) && ((_arg4.entities[j].rule == 2)))){
if (_arg4.entitycollide(i, j)){
_arg4.entities[j].state = _arg4.entities[j].onentity;
_arg4.entities[j].statedelay = 0;
_arg4.entities[i].active = false;
};
};
if ((((_arg4.entities[i].rule == 0)) && ((_arg4.entities[j].rule == 5)))){
if (_arg4.bighit(j, _arg4.entities[i].xp, _arg4.entities[i].yp)){
_arg4.entities[j].active = false;
_arg3.powershot = 30;
_arg3.score = (_arg3.score + 2500);
_arg6.playef(4, 20);
};
};
if ((((_arg4.entities[i].rule == 0)) && ((((_arg4.entities[j].rule == 2)) || ((_arg4.entities[j].rule == 3)))))){
if (_arg4.onepixelhit(j, (_arg4.entities[i].xp + 2), (_arg4.entities[i].yp + 2))){
_arg4.entities[j].state = _arg4.entities[j].onentity;
_arg4.entities[j].statedelay = 0;
_arg3.dx = _arg4.entities[i].xp;
_arg3.dy = _arg4.entities[i].yp;
_arg4.entities[i].active = false;
_arg3.deathseq = 60;
_arg6.playef(8, 20);
_arg6.fadeout();
};
};
};
j++;
};
};
i++;
};
i = (_arg4.nentity - 1);
while ((((i >= 0)) && (!(_arg4.entities[i].active)))) {
_arg4.nentity--;
i--;
};
}
public function visit_distractionware(_arg1:Event):void{
var _local2:URLRequest = new URLRequest("http://www.distractionware.com");
navigateToURL(_local2, "_blank");
}
public function mainloop(_arg1:Event):void{
if (!game.infocus){
if (game.globalsound > 0){
game.globalsound = 0;
SoundMixer.soundTransform = new SoundTransform(0);
};
music.processmusic();
dwgfx.backbuffer.lock();
dwgfx.bprint(5, 50, "Game paused", (196 - help.glow), (0xFF - help.glow), (196 - help.glow), true);
dwgfx.bprint(5, 60, "[click to resume]", (196 - help.glow), (0xFF - help.glow), (196 - help.glow), true);
dwgfx.bprint(5, 110, "Press M to mute in game", (164 - help.glow), (196 - help.glow), (164 - help.glow), true);
dwgfx.render();
dwgfx.backbuffer.unlock();
help.updateglow();
} else {
switch (gamestate){
case FOCUSMODE:
dwgfx.backbuffer.lock();
dwgfx.bprint(5, 55, "[Click to start]", (196 - help.glow), (0xFF - help.glow), (196 - help.glow), true);
dwgfx.render();
dwgfx.backbuffer.unlock();
help.updateglow();
if (key.click){
music.play(0);
gamestate = TITLEMODE;
};
break;
case TITLEMODE:
titlerender(key, dwgfx, game, obj, help);
titleinput(key, dwgfx, game, obj, help, music);
titlelogic(key, dwgfx, game, obj, help, music);
break;
case GAMEMODE:
gamerender(key, dwgfx, game, obj, help);
gameinput(key, dwgfx, game, obj, help, music);
gamelogic(key, dwgfx, game, obj, help, music);
break;
};
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;
};
}
public function titlerender(_arg1:KeyPoll, _arg2:dwgraphicsclass, _arg3:gameclass, _arg4:entityclass, _arg5:helpclass):void{
i = 0;
while (i < 10) {
_arg3.backgroundrect[i].x = (_arg3.backgroundrect[i].x - (_arg3.scrollspeed / 4));
if (_arg3.backgroundrect[i].x < -32){
_arg3.backgroundrect[i].x = (_arg3.backgroundrect[i].x + 320);
};
_arg3.backgroundrect[(i + 10)].x = (_arg3.backgroundrect[(i + 10)].x - (_arg3.scrollspeed / 4));
if (_arg3.backgroundrect[(i + 10)].x < -32){
_arg3.backgroundrect[(i + 10)].x = (_arg3.backgroundrect[(i + 10)].x + 320);
};
i++;
};
i = 0;
while (i < 20) {
_arg3.backgroundrect[(i + 20)].x = (_arg3.backgroundrect[(i + 20)].x - ((_arg3.scrollspeed / 4) + 1));
if (_arg3.backgroundrect[(i + 20)].x < -16){
_arg3.backgroundrect[(i + 20)].x = (_arg3.backgroundrect[(i + 20)].x + 320);
};
_arg3.backgroundrect[(i + 40)].x = (_arg3.backgroundrect[(i + 40)].x - ((_arg3.scrollspeed / 4) + 1));
if (_arg3.backgroundrect[(i + 40)].x < -16){
_arg3.backgroundrect[(i + 40)].x = (_arg3.backgroundrect[(i + 40)].x + 320);
};
i++;
};
_arg2.backbuffer.lock();
_arg2.backbuffer.fillRect(backbar, 0x3C3C3C);
i = 0;
while (i < 10) {
if ((((_arg3.backgroundrect[i].x > -32)) && ((_arg3.backgroundrect[i].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[i], 0x4D4D4D);
};
if ((((_arg3.backgroundrect[(i + 10)].x > -32)) && ((_arg3.backgroundrect[(i + 10)].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[(i + 10)], 0x4D4D4D);
};
i++;
};
i = 0;
while (i < 20) {
if ((((_arg3.backgroundrect[(i + 20)].x > -16)) && ((_arg3.backgroundrect[(i + 40)].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[(i + 20)], 0x5E5E5E);
};
if ((((_arg3.backgroundrect[(i + 40)].x > -16)) && ((_arg3.backgroundrect[(i + 40)].x < 160)))){
_arg2.backbuffer.fillRect(_arg3.backgroundrect[(i + 40)], 0x5E5E5E);
};
i++;
};
_arg2.drawimage(0, 0, 15, true);
if (_arg3.visitsite){
_arg2.drawimage(2, 0, 100, true);
} else {
_arg2.drawimage(1, 0, 100, true);
};
switch (_arg3.menuscreen){
case 0:
_arg2.print(-1, 55, "Arrows or WASD to move", 16, (0xFF - _arg5.glow), 16, true);
_arg2.print(-1, 65, "Hold Z or Space for Bullet time", 16, (0xFF - _arg5.glow), 16, true);
_arg2.print(80, 82, ("Highscore: " + String(_arg3.scorerecord)), (0xFF - _arg5.glow), (0xFF - _arg5.glow), (0xFF - _arg5.glow), true);
break;
case 1:
_arg2.print(10, 47, "Last pilot survived for ", 16, (0xFF - _arg5.glow), 16, false);
_arg2.print(101, 47, (((String(_arg5.seconds(_arg3.time)) + ".") + _arg5.tdstring(_arg5.sseconds(_arg3.time))) + " seconds"), (0xFF - _arg5.glow), (0xFF - _arg5.glow), (0xFF - _arg5.glow), false);
_arg2.print(10, 57, "Best time is ", 16, (0xFF - _arg5.glow), 16, false);
_arg2.print(101, 57, (((String(_arg5.seconds(_arg3.timerecord)) + ".") + _arg5.tdstring(_arg5.sseconds(_arg3.timerecord))) + " seconds"), (0xFF - _arg5.glow), (0xFF - _arg5.glow), (0xFF - _arg5.glow), false);
_arg2.print(-1, 71, ("Rank: " + _arg3.scorerank()), 196, (0xFF - (_arg5.glow * 2)), 196, true);
if (_arg3.timerecord < 5400){
_arg2.print(36, 87, "Next Rank at ", 16, (0xFF - _arg5.glow), 16, false);
_arg2.print(87, 87, (_arg3.nextscorerank() + " seconds"), (0xFF - _arg5.glow), (0xFF - _arg5.glow), (0xFF - _arg5.glow));
} else {
_arg2.print(36, 87, "Congratulations!", 16, (0xFF - _arg5.glow), 16, true);
};
break;
};
_arg3.menudelay--;
if (_arg3.menudelay <= 0){
_arg3.menudelay = 150;
_arg3.menuscreen = ((_arg3.menuscreen + 1) % 2);
};
_arg2.backbuffer.fillRect(topbar, 0);
_arg2.backbuffer.fillRect(bottombar, 0);
if (_arg3.test){
_arg2.print(5, 5, _arg3.teststring, 16, 0xFF, 16, false);
};
_arg2.render();
_arg2.backbuffer.unlock();
}
}
}//package
Section 29
//Main_ef_0 (Main_ef_0)
package {
import mx.core.*;
public class Main_ef_0 extends SoundAsset {
}
}//package
Section 30
//Main_ef_1 (Main_ef_1)
package {
import mx.core.*;
public class Main_ef_1 extends SoundAsset {
}
}//package
Section 31
//Main_ef_2 (Main_ef_2)
package {
import mx.core.*;
public class Main_ef_2 extends SoundAsset {
}
}//package
Section 32
//Main_ef_3 (Main_ef_3)
package {
import mx.core.*;
public class Main_ef_3 extends SoundAsset {
}
}//package
Section 33
//Main_ef_4 (Main_ef_4)
package {
import mx.core.*;
public class Main_ef_4 extends SoundAsset {
}
}//package
Section 34
//Main_ef_5 (Main_ef_5)
package {
import mx.core.*;
public class Main_ef_5 extends SoundAsset {
}
}//package
Section 35
//Main_ef_6 (Main_ef_6)
package {
import mx.core.*;
public class Main_ef_6 extends SoundAsset {
}
}//package
Section 36
//Main_ef_7 (Main_ef_7)
package {
import mx.core.*;
public class Main_ef_7 extends SoundAsset {
}
}//package
Section 37
//Main_ef_8 (Main_ef_8)
package {
import mx.core.*;
public class Main_ef_8 extends SoundAsset {
}
}//package
Section 38
//Main_ef_9 (Main_ef_9)
package {
import mx.core.*;
public class Main_ef_9 extends SoundAsset {
}
}//package
Section 39
//Main_im_bfont (Main_im_bfont)
package {
import mx.core.*;
public class Main_im_bfont extends BitmapAsset {
}
}//package
Section 40
//Main_im_bfontmask (Main_im_bfontmask)
package {
import mx.core.*;
public class Main_im_bfontmask extends BitmapAsset {
}
}//package
Section 41
//Main_im_pic0 (Main_im_pic0)
package {
import mx.core.*;
public class Main_im_pic0 extends BitmapAsset {
}
}//package
Section 42
//Main_im_pic1 (Main_im_pic1)
package {
import mx.core.*;
public class Main_im_pic1 extends BitmapAsset {
}
}//package
Section 43
//Main_im_pic2 (Main_im_pic2)
package {
import mx.core.*;
public class Main_im_pic2 extends BitmapAsset {
}
}//package
Section 44
//Main_im_tiles (Main_im_tiles)
package {
import mx.core.*;
public class Main_im_tiles extends BitmapAsset {
}
}//package
Section 45
//Main_music_1 (Main_music_1)
package {
import mx.core.*;
public class Main_music_1 extends SoundAsset {
}
}//package
Section 46
//Main_music_2 (Main_music_2)
package {
import mx.core.*;
public class Main_music_2 extends SoundAsset {
}
}//package
Section 47
//musicclass (musicclass)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
public class musicclass extends Sprite {
public var musicchannel:SoundChannel;
public var musicstopother:int;
public var musicfadein:int;
public var currentsong:int;
public var efchannel:Array;
public var currentmusicchan:int;
public var musicchancur:int;
public var currentefchan:int;
public var musicfade:int;
public var efchan:Array;
public var musicchan:Array;
public var numplays:int;
public var musicchannel2:SoundChannel;
public var musicchanlen:int;
public function musicclass(){
musicchan = new Array();
efchannel = new Array();
efchan = new Array();
super();
}
public function loopmusic(_arg1:Event):void{
musicchannel.removeEventListener(Event.SOUND_COMPLETE, loopmusic);
if (currentsong > -1){
musicchannel = musicchan[currentsong].play();
musicchannel.addEventListener(Event.SOUND_COMPLETE, loopmusic);
};
}
public function processmusicfadein():void{
musicfadein--;
if (musicfadein > 0){
musicchannel.soundTransform = new SoundTransform(((60 - musicfadein) / 60));
} else {
musicchannel.soundTransform = new SoundTransform(1);
};
}
public function initefchannels():void{
var _local1:int;
while (_local1 < 16) {
efchannel.push(new SoundChannel());
_local1++;
};
}
public function playef(_arg1:int, _arg2:int=0):void{
efchannel[currentefchan] = efchan[_arg1].play(_arg2);
currentefchan++;
if (currentefchan > 15){
currentefchan = (currentefchan - 16);
};
}
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 fadeout():void{
if ((((currentsong == 1)) || ((currentsong == 3)))){
if (musicfade == 0){
musicchannel.removeEventListener(Event.SOUND_COMPLETE, stopmusic);
musicfade = 31;
};
} else {
if (currentsong == 0){
if (musicfade == 0){
musicfade = 31;
};
};
};
}
public function processmusicfade():void{
musicfade--;
if (musicfade > 0){
if (currentmusicchan == 0){
musicchannel.soundTransform = new SoundTransform((musicfade / 30));
};
if (currentmusicchan == 1){
musicchannel2.soundTransform = new SoundTransform((musicfade / 30));
};
} else {
if (currentmusicchan == 0){
musicchannel.stop();
};
if (currentmusicchan == 1){
musicchannel2.stop();
};
currentsong = -1;
};
}
public function stopmusic(_arg1:Event):void{
musicchannel.removeEventListener(Event.SOUND_COMPLETE, stopmusic);
musicchannel.stop();
currentsong = -1;
}
public function play(_arg1:int):void{
if (currentsong != _arg1){
if (currentsong != -1){
currentmusicchan = 0;
musicchannel.stop();
musicchannel.removeEventListener(Event.SOUND_COMPLETE, loopmusic);
};
if (_arg1 != -1){
currentsong = _arg1;
if (currentsong == 1){
musicfadein = 30;
if (numplays == 0){
musicchannel = musicchan[currentsong].play(0);
} else {
switch (int((Math.random() * 3))){
case 0:
musicchannel = musicchan[currentsong].play(0);
break;
case 1:
musicchannel = musicchan[currentsong].play(27477);
break;
case 2:
musicchannel = musicchan[currentsong].play(70410);
break;
default:
musicchannel = musicchan[currentsong].play(0);
break;
};
};
numplays++;
} else {
musicchannel = musicchan[currentsong].play(0);
};
musicchannel.addEventListener(Event.SOUND_COMPLETE, loopmusic);
} else {
currentsong = -1;
};
};
}
}
}//package
Section 48
//Preloader (Preloader)
package {
import flash.events.*;
import com.kongregate.as3.client.*;
import flash.display.*;
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;
};
adson = false;
var _local1:KongregateAPI = new KongregateAPI();
this.addChild(_local1);
var _local2:ContextMenu = new ContextMenu();
var _local3:ContextMenuItem = new ContextMenuItem("Visit distractionware.com");
_local3.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_distractionware);
_local2.hideBuiltInItems();
_local2.customItems.push(_local3);
this.contextMenu = _local2;
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(_arg1:Event):void{
var _local3:int;
var _local2:Number = (this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal);
if (!adson){
graphics.clear();
graphics.beginFill(0);
graphics.drawRect(0, 0, 640, 480);
graphics.endFill();
graphics.beginFill(4521796);
graphics.drawRect(120, 279, 400, 18);
graphics.endFill();
};
if (_local2 < 1){
if (!adson){
graphics.beginFill(0);
_local3 = int(Math.round((_local2 * 391)));
graphics.drawRect((125 + _local3), 283, (391 - _local3), 10);
graphics.endFill();
};
} else {
if (!showctp){
showctp = true;
startgame = true;
};
};
if (currentFrame == totalFrames){
if (startgame){
startup();
};
};
}
public function visit_sponsor(_arg1:Event):void{
var _local2:URLRequest = new URLRequest("http://www.kongregate.com/?gamereferral=dontlookback");
navigateToURL(_local2, "_blank");
}
public function visit_distractionware(_arg1:Event):void{
var _local2:URLRequest = new URLRequest("http://www.distractionware.com");
navigateToURL(_local2, "_blank");
}
public function checksite():Boolean{
var _local1:String = stage.loaderInfo.url.toLowerCase();
if ((((((((_local1.indexOf("distractionware.com") <= 0)) && ((_local1.indexOf("flashgamelicense.com") <= 0)))) && ((_local1.indexOf("kongregate.com") <= 0)))) && ((_local1.indexOf("chat.kongregate.com") <= 0)))){
return (false);
};
return (true);
}
private function startup():void{
removeEventListener(Event.ENTER_FRAME, checkFrame);
var _local1:Class = (getDefinitionByName("Main") as Class);
addChild((new (_local1) as DisplayObject));
}
}
}//package
Section 49
//Preloader_im_loading (Preloader_im_loading)
package {
import mx.core.*;
public class Preloader_im_loading extends BitmapAsset {
}
}//package