Section 1
//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.4.1.10084";
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 2
//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.4.1.10084";
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 3
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 4
//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 5
//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 6
//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 7
//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.4.1.10084";
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 8
//RayCaster (raycaster.RayCaster)
package raycaster {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class RayCaster extends Sprite {
public const totalTextures:int = 9;
public const texHeight:int = 64;
public const texWidth:int = 64;
public var posX:Number;// = 5
public var posY:Number;// = 5.5
private var freshBuffer:Array;
public var mapHeight:int;// = 10
private var bmpSprite:Bitmap;
public var oldTime:int;// = 0
private var screenHeight:int;// = 0
private var screenWidth:int;// = 0
private var buffer:Array;
private var textures:Array;
public var mapWidth:int;// = 10
public var running:Boolean;// = false
private var imgClear:BitmapData;
private var map:Array;
public var time:int;// = 0
private var tex0:Class;
private var tex1:Class;
public var dirX:Number;// = -1
public var dirY:Number;// = 0
private var tex4:Class;
private var tex5:Class;
private var tex6:Class;
private var tex7:Class;
private var tex8:Class;
private var tex2:Class;
private var tex3:Class;
private var imgBuffer:BitmapData;
public var planeX:Number;// = 0
public var planeY:Number;// = 0.66
public function RayCaster(_arg1:int=0, _arg2:int=0){
var _local4:Array;
var _local5:int;
tex0 = RayCaster_tex0;
tex1 = RayCaster_tex1;
tex2 = RayCaster_tex2;
tex3 = RayCaster_tex3;
tex4 = RayCaster_tex4;
tex5 = RayCaster_tex5;
tex6 = RayCaster_tex6;
tex7 = RayCaster_tex7;
tex8 = RayCaster_tex8;
buffer = new Array();
map = new Array();
imgBuffer = new BitmapData(400, 300, false, 0xFFFFFF);
imgClear = new BitmapData(400, 300, false, 0xFFFFFF);
bmpSprite = new Bitmap(imgClear);
freshBuffer = new Array();
textures = new Array();
super();
if ((((_arg1 == 0)) && ((_arg2 == 0)))){
_arg1 = 400;
_arg2 = 300;
};
this.width = 400;
this.height = 300;
this.screenWidth = 400;
this.screenHeight = 300;
setupMap();
loadTextures();
var _local3:int;
while (_local3 < this.screenWidth) {
_local4 = new Array();
_local5 = 0;
while (_local5 < this.screenHeight) {
_local4.push(new uint(0));
_local5++;
};
buffer[_local3] = _local4;
_local3++;
};
this.addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}
public function loadMap(_arg1:Array, _arg2:int, _arg3:int):void{
this.map = _arg1;
this.mapHeight = _arg2;
this.mapWidth = _arg3;
}
public function setupMap():void{
var _local1:Array = new Array();
_local1[0] = [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 6, 4, 4, 6, 4, 6, 4, 4, 4, 6, 4];
_local1[1] = [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4];
_local1[2] = [8, 0, 3, 3, 0, 0, 0, 0, 0, 8, 8, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6];
_local1[3] = [8, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6];
_local1[4] = [8, 0, 3, 3, 0, 0, 0, 0, 0, 8, 8, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4];
_local1[5] = [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 4, 0, 0, 0, 0, 0, 6, 6, 6, 0, 6, 4, 6];
_local1[6] = [8, 8, 8, 8, 0, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 6, 0, 0, 0, 0, 0, 6];
_local1[7] = [7, 7, 7, 7, 0, 7, 7, 7, 7, 0, 8, 0, 8, 0, 8, 0, 8, 4, 0, 4, 0, 6, 0, 6];
_local1[8] = [7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 0, 8, 0, 8, 0, 8, 8, 6, 0, 0, 0, 0, 0, 6];
_local1[9] = [7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 6, 0, 0, 0, 0, 0, 4];
_local1[10] = [7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 6, 0, 6, 0, 6, 0, 6];
_local1[11] = [7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 0, 8, 0, 8, 0, 8, 8, 6, 4, 6, 0, 6, 6, 6];
_local1[12] = [7, 7, 7, 7, 0, 7, 7, 7, 7, 8, 8, 4, 0, 6, 8, 4, 8, 3, 3, 3, 0, 3, 3, 3];
_local1[13] = [2, 2, 2, 2, 0, 2, 2, 2, 2, 4, 6, 4, 0, 0, 6, 0, 6, 3, 0, 0, 0, 0, 0, 3];
_local1[14] = [2, 2, 0, 0, 0, 0, 0, 2, 2, 4, 0, 0, 0, 0, 0, 0, 4, 3, 0, 0, 0, 0, 0, 3];
_local1[15] = [2, 0, 0, 0, 0, 0, 0, 0, 2, 4, 0, 0, 0, 0, 0, 0, 4, 3, 0, 0, 0, 0, 0, 3];
_local1[16] = [1, 0, 0, 0, 0, 0, 0, 0, 1, 4, 4, 4, 4, 4, 6, 0, 6, 3, 3, 0, 0, 0, 3, 3];
_local1[17] = [2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 1, 2, 2, 2, 6, 6, 0, 0, 5, 0, 5, 0, 5];
_local1[18] = [2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, 0, 5, 0, 5, 0, 0, 0, 5, 5];
_local1[19] = [2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 5, 0, 5, 0, 5, 0, 5, 0, 5];
_local1[20] = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5];
_local1[21] = [2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 5, 0, 5, 0, 5, 0, 5, 0, 5];
_local1[22] = [2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, 0, 5, 0, 5, 0, 0, 0, 5, 5];
_local1[23] = [2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5];
this.map = _local1;
}
public function keyDown(_arg1:uint):Boolean{
if (Key.isDown(_arg1)){
return (true);
};
return (false);
}
public function drawBuffer():void{
var _local2:int;
imgBuffer = imgClear.clone();
var _local1:int;
while (_local1 < this.screenWidth) {
_local2 = 0;
while (_local2 < this.screenHeight) {
imgBuffer.setPixel(_local1, _local2, buffer[_local1][_local2]);
_local2++;
};
_local1++;
};
bmpSprite.bitmapData = imgBuffer.clone();
}
public function addedToStage(_arg1:Event):void{
trace("added to stage!");
bmpSprite.height = 300;
bmpSprite.width = 400;
this.stage.addChild(bmpSprite);
Key.initialize(this.stage);
this.running = true;
}
public function loadTextures():void{
textures.push(new tex0().bitmapData);
textures.push(new tex1().bitmapData);
textures.push(new tex2().bitmapData);
textures.push(new tex3().bitmapData);
textures.push(new tex4().bitmapData);
textures.push(new tex5().bitmapData);
textures.push(new tex6().bitmapData);
textures.push(new tex7().bitmapData);
textures.push(new tex8().bitmapData);
}
public function game():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:int;
var _local12:int;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:int;
var _local21:int;
var _local22:int;
var _local23:int;
var _local24:int;
var _local25:int;
var _local26:int;
var _local27:int;
var _local28:Number;
var _local29:int;
var _local30:int;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:int;
var _local37:int;
var _local38:BitmapData;
var _local39:uint;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:int;
var _local44:int;
var _local45:BitmapData;
var _local46:BitmapData;
var _local47:uint;
var _local48:uint;
var _local49:Number;
var _local50:Number;
var _local51:Number;
var _local52:Number;
if (running){
_local1 = 0;
while (_local1 < screenWidth) {
_local6 = (((2 * _local1) / screenWidth) - 1);
_local7 = posX;
_local8 = posY;
_local9 = (dirX + (planeX * _local6));
_local10 = (dirY + (planeY * _local6));
_local11 = new int(_local7);
_local12 = new int(_local8);
_local15 = Math.sqrt((1 + ((_local10 * _local10) / (_local9 * _local9))));
_local16 = Math.sqrt((1 + ((_local9 * _local9) / (_local10 * _local10))));
_local20 = 0;
if (_local9 < 0){
_local18 = -1;
_local13 = ((_local7 - _local11) * _local15);
} else {
_local18 = 1;
_local13 = (((_local11 + 1) - _local7) * _local15);
};
if (_local10 < 0){
_local19 = -1;
_local14 = ((_local8 - _local12) * _local16);
} else {
_local19 = 1;
_local14 = (((_local12 + 1) - _local8) * _local16);
};
while (_local20 == 0) {
if (_local13 < _local14){
_local13 = (_local13 + _local15);
_local11 = (_local11 + _local18);
_local21 = 0;
} else {
_local14 = (_local14 + _local16);
_local12 = (_local12 + _local19);
_local21 = 1;
};
if (map[_local11][_local12] > 0){
_local20 = 1;
};
};
_local22 = this.screenHeight;
_local23 = this.screenWidth;
if (_local21 == 0){
_local17 = Math.abs((((_local11 - _local7) + ((1 - _local18) / 2)) / _local9));
} else {
_local17 = Math.abs((((_local12 - _local8) + ((1 - _local19) / 2)) / _local10));
};
_local24 = Math.abs(int((_local22 / _local17)));
_local25 = ((-(_local24) / 2) + (_local22 / 2));
if (_local25 < 0){
_local25 = 0;
};
_local26 = ((_local24 / 2) + (_local22 / 2));
if (_local26 >= _local22){
_local26 = (_local22 - 1);
};
_local27 = (map[_local11][_local12] - 1);
if (_local21 == 1){
_local28 = (_local7 + ((((_local12 - _local8) + ((1 - _local19) / 2)) / _local10) * _local9));
} else {
_local28 = (_local8 + ((((_local11 - _local7) + ((1 - _local18) / 2)) / _local9) * _local10));
};
_local28 = (_local28 - Math.floor(_local28));
_local29 = new int((_local28 * texWidth));
if ((((_local21 == 0)) && ((_local9 > 0)))){
_local29 = ((texWidth - _local29) - 1);
};
if ((((_local21 == 1)) && ((_local10 < 0)))){
_local29 = ((texWidth - _local29) - 1);
};
_local30 = _local25;
while (_local30 < _local26) {
_local36 = (((_local30 * 0x0100) - (_local22 * 128)) + (_local24 * 128));
_local37 = (((_local36 * texHeight) / _local24) / 0x0100);
_local38 = (textures[_local27] as BitmapData);
_local39 = _local38.getPixel(_local29, _local37);
if (_local21 == 1){
_local39 = ((_local39 >> 1) & 0x7F7F7F);
};
buffer[_local1][_local30] = _local39;
_local30++;
};
if ((((_local21 == 0)) && ((_local9 > 0)))){
_local31 = _local11;
_local32 = (_local12 + _local28);
} else {
if ((((_local21 == 0)) && ((_local9 < 0)))){
_local31 = (_local11 + 1);
_local32 = (_local12 + _local28);
} else {
if ((((_local21 == 1)) && ((_local10 > 0)))){
_local31 = (_local11 + _local28);
_local32 = _local12;
} else {
_local31 = (_local11 + _local28);
_local32 = (_local12 + 1);
};
};
};
_local33 = _local17;
_local34 = 0;
if (_local26 < 0){
_local26 = _local22;
};
_local30 = (_local26 + 1);
while (_local30 < _local22) {
_local35 = (_local22 / ((2 * _local30) - _local22));
_local40 = ((_local35 - _local34) / (_local33 - _local34));
_local41 = ((_local40 * _local31) + ((1 - _local40) * posX));
_local42 = ((_local40 * _local32) + ((1 - _local40) * posY));
_local43 = (new int((_local41 * texWidth)) % texWidth);
_local44 = (new int((_local42 * texHeight)) % texHeight);
_local45 = (textures[7] as BitmapData);
_local46 = (textures[8] as BitmapData);
_local47 = _local45.getPixel(_local43, _local44);
_local48 = _local46.getPixel(_local43, _local44);
buffer[_local1][_local30] = ((_local47 >> 1) & 0x7F7F7F);
buffer[_local1][(_local22 - _local30)] = _local48;
_local30++;
};
_local1++;
};
drawBuffer();
_local1 = 0;
while (_local1 < _local23) {
_local30 = 0;
while (_local30 < _local22) {
buffer[_local1][_local30] = 0;
_local30++;
};
_local1++;
};
oldTime = time;
time = getTimer();
_local2 = ((time - oldTime) / 1000);
_local3 = 0;
if (keyDown(16)){
_local3 = 0.5;
};
_local4 = (_local2 * 3.5);
_local5 = (_local2 * 2);
_local4 = (_local4 + _local3);
if (keyDown(38)){
if (map[new int((posX + (dirX * _local4)))][new int(posY)] == false){
posX = (posX + (dirX * _local4));
};
if (map[new int(posX)][new int((posY + (dirY * _local4)))] == false){
posY = (posY + (dirY * _local4));
};
};
if (keyDown(40)){
if (map[new int((posX - (dirX * _local4)))][new int(posY)] == false){
posX = (posX - (dirX * _local4));
};
if (map[new int(posX)][new int((posY - (dirY * _local4)))] == false){
posY = (posY - (dirY * _local4));
};
};
if (keyDown(39)){
_local49 = dirX;
dirX = ((dirX * Math.cos(-(_local5))) - (dirY * Math.sin(-(_local5))));
dirY = ((_local49 * Math.sin(-(_local5))) + (dirY * Math.cos(-(_local5))));
_local50 = planeX;
planeX = ((planeX * Math.cos(-(_local5))) - (planeY * Math.sin(-(_local5))));
planeY = ((_local50 * Math.sin(-(_local5))) + (planeY * Math.cos(-(_local5))));
};
if (keyDown(37)){
_local51 = dirX;
dirX = ((dirX * Math.cos(_local5)) - (dirY * Math.sin(_local5)));
dirY = ((_local51 * Math.sin(_local5)) + (dirY * Math.cos(_local5)));
_local52 = planeX;
planeX = ((planeX * Math.cos(_local5)) - (planeY * Math.sin(_local5)));
planeY = ((_local52 * Math.sin(_local5)) + (planeY * Math.cos(_local5)));
};
};
}
}
}//package raycaster
Section 9
//RayCaster_tex0 (raycaster.RayCaster_tex0)
package raycaster {
import mx.core.*;
public class RayCaster_tex0 extends BitmapAsset {
}
}//package raycaster
Section 10
//RayCaster_tex1 (raycaster.RayCaster_tex1)
package raycaster {
import mx.core.*;
public class RayCaster_tex1 extends BitmapAsset {
}
}//package raycaster
Section 11
//RayCaster_tex2 (raycaster.RayCaster_tex2)
package raycaster {
import mx.core.*;
public class RayCaster_tex2 extends BitmapAsset {
}
}//package raycaster
Section 12
//RayCaster_tex3 (raycaster.RayCaster_tex3)
package raycaster {
import mx.core.*;
public class RayCaster_tex3 extends BitmapAsset {
}
}//package raycaster
Section 13
//RayCaster_tex4 (raycaster.RayCaster_tex4)
package raycaster {
import mx.core.*;
public class RayCaster_tex4 extends BitmapAsset {
}
}//package raycaster
Section 14
//RayCaster_tex5 (raycaster.RayCaster_tex5)
package raycaster {
import mx.core.*;
public class RayCaster_tex5 extends BitmapAsset {
}
}//package raycaster
Section 15
//RayCaster_tex6 (raycaster.RayCaster_tex6)
package raycaster {
import mx.core.*;
public class RayCaster_tex6 extends BitmapAsset {
}
}//package raycaster
Section 16
//RayCaster_tex7 (raycaster.RayCaster_tex7)
package raycaster {
import mx.core.*;
public class RayCaster_tex7 extends BitmapAsset {
}
}//package raycaster
Section 17
//RayCaster_tex8 (raycaster.RayCaster_tex8)
package raycaster {
import mx.core.*;
public class RayCaster_tex8 extends BitmapAsset {
}
}//package raycaster
Section 18
//Key (Key)
package {
import flash.events.*;
import flash.display.*;
public class Key {
private static var initialized:Boolean = false;
private static var keysDown:Object = new Object();
public static function initialize(_arg1:Stage):void{
if (!initialized){
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
_arg1.addEventListener(Event.DEACTIVATE, clearKeys);
initialized = true;
};
}
private static function clearKeys(_arg1:Event):void{
keysDown = new Object();
}
public static function isDown(_arg1:uint):Boolean{
if (!initialized){
throw (new Error("Key class has yet been initialized."));
};
return (Boolean((_arg1 in keysDown)));
}
private static function keyPressed(_arg1:KeyboardEvent):void{
keysDown[_arg1.keyCode] = true;
}
private static function keyReleased(_arg1:KeyboardEvent):void{
if ((_arg1.keyCode in keysDown)){
delete keysDown[_arg1.keyCode];
};
}
}
}//package
Section 19
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import raycaster.*;
import flash.text.*;
public class Main extends Sprite {
private var t:Timer;
private var caster:RayCaster;
public function Main(){
var _local1:TextField = new TextField();
_local1.text = "TEST";
stage.addChild(_local1);
caster = new RayCaster();
stage.addChild(caster);
trace("Caster added!");
myMap();
t = new Timer(1);
t.addEventListener(TimerEvent.TIMER, this.ready);
t.start();
}
public function myMap():void{
var _local6:int;
var _local1 = 20;
var _local2 = 20;
var _local3 = 100;
var _local4:Array = new Array();
_local4[0] = new Array();
_local4[0][0] = 5;
_local4[0][1] = 5;
_local4[0][2] = 5;
_local4[0][3] = 5;
_local4[0][4] = 5;
_local4[0][5] = 5;
_local4[0][6] = 5;
_local4[0][7] = 5;
_local4[0][8] = 5;
_local4[0][9] = 5;
_local4[0][10] = 5;
_local4[0][11] = 5;
_local4[0][12] = 5;
_local4[0][13] = 5;
_local4[0][14] = 5;
_local4[0][15] = 5;
_local4[0][16] = 5;
_local4[0][17] = 5;
_local4[0][18] = 5;
_local4[0][19] = 5;
_local4[1] = new Array();
_local4[1][0] = 5;
_local4[1][1] = -1;
_local4[1][2] = -1;
_local4[1][3] = -1;
_local4[1][4] = -1;
_local4[1][5] = -1;
_local4[1][6] = -1;
_local4[1][7] = -1;
_local4[1][8] = -1;
_local4[1][9] = -1;
_local4[1][10] = -1;
_local4[1][11] = -1;
_local4[1][12] = -1;
_local4[1][13] = -1;
_local4[1][14] = -1;
_local4[1][15] = -1;
_local4[1][16] = -1;
_local4[1][17] = -1;
_local4[1][18] = -1;
_local4[1][19] = 5;
_local4[2] = new Array();
_local4[2][0] = 5;
_local4[2][1] = -1;
_local4[2][2] = -1;
_local4[2][3] = -1;
_local4[2][4] = -1;
_local4[2][5] = -1;
_local4[2][6] = -1;
_local4[2][7] = -1;
_local4[2][8] = -1;
_local4[2][9] = -1;
_local4[2][10] = -1;
_local4[2][11] = -1;
_local4[2][12] = 1;
_local4[2][13] = 1;
_local4[2][14] = 1;
_local4[2][15] = 1;
_local4[2][16] = -1;
_local4[2][17] = -1;
_local4[2][18] = -1;
_local4[2][19] = 5;
_local4[3] = new Array();
_local4[3][0] = 5;
_local4[3][1] = 1;
_local4[3][2] = 1;
_local4[3][3] = 1;
_local4[3][4] = 1;
_local4[3][5] = 1;
_local4[3][6] = 1;
_local4[3][7] = 1;
_local4[3][8] = 1;
_local4[3][9] = 1;
_local4[3][10] = 1;
_local4[3][11] = -1;
_local4[3][12] = 1;
_local4[3][13] = -1;
_local4[3][14] = -1;
_local4[3][15] = -1;
_local4[3][16] = -1;
_local4[3][17] = -1;
_local4[3][18] = -1;
_local4[3][19] = 5;
_local4[4] = new Array();
_local4[4][0] = -1;
_local4[4][1] = 1;
_local4[4][2] = -1;
_local4[4][3] = -1;
_local4[4][4] = -1;
_local4[4][5] = -1;
_local4[4][6] = -1;
_local4[4][7] = -1;
_local4[4][8] = -1;
_local4[4][9] = -1;
_local4[4][10] = -1;
_local4[4][11] = -1;
_local4[4][12] = 1;
_local4[4][13] = 1;
_local4[4][14] = 1;
_local4[4][15] = 1;
_local4[4][16] = 1;
_local4[4][17] = 1;
_local4[4][18] = 1;
_local4[4][19] = 1;
_local4[5] = new Array();
_local4[5][0] = -1;
_local4[5][1] = 1;
_local4[5][2] = -1;
_local4[5][3] = -1;
_local4[5][4] = -1;
_local4[5][5] = -1;
_local4[5][6] = -1;
_local4[5][7] = -1;
_local4[5][8] = -1;
_local4[5][9] = -1;
_local4[5][10] = -1;
_local4[5][11] = -1;
_local4[5][12] = 1;
_local4[5][13] = -1;
_local4[5][14] = -1;
_local4[5][15] = -1;
_local4[5][16] = -1;
_local4[5][17] = -1;
_local4[5][18] = -1;
_local4[5][19] = 5;
_local4[6] = new Array();
_local4[6][0] = -1;
_local4[6][1] = 1;
_local4[6][2] = -1;
_local4[6][3] = -1;
_local4[6][4] = -1;
_local4[6][5] = -1;
_local4[6][6] = -1;
_local4[6][7] = -1;
_local4[6][8] = -1;
_local4[6][9] = -1;
_local4[6][10] = -1;
_local4[6][11] = -1;
_local4[6][12] = 1;
_local4[6][13] = -1;
_local4[6][14] = -1;
_local4[6][15] = -1;
_local4[6][16] = -1;
_local4[6][17] = -1;
_local4[6][18] = -1;
_local4[6][19] = 5;
_local4[7] = new Array();
_local4[7][0] = -1;
_local4[7][1] = 1;
_local4[7][2] = -1;
_local4[7][3] = -1;
_local4[7][4] = -1;
_local4[7][5] = -1;
_local4[7][6] = -1;
_local4[7][7] = -1;
_local4[7][8] = -1;
_local4[7][9] = -1;
_local4[7][10] = -1;
_local4[7][11] = -1;
_local4[7][12] = 1;
_local4[7][13] = -1;
_local4[7][14] = -1;
_local4[7][15] = 9;
_local4[7][16] = -1;
_local4[7][17] = -1;
_local4[7][18] = -1;
_local4[7][19] = 5;
_local4[8] = new Array();
_local4[8][0] = -1;
_local4[8][1] = 1;
_local4[8][2] = -1;
_local4[8][3] = -1;
_local4[8][4] = -1;
_local4[8][5] = -1;
_local4[8][6] = -1;
_local4[8][7] = -1;
_local4[8][8] = -1;
_local4[8][9] = -1;
_local4[8][10] = -1;
_local4[8][11] = -1;
_local4[8][12] = 1;
_local4[8][13] = 9;
_local4[8][14] = 9;
_local4[8][15] = 9;
_local4[8][16] = -1;
_local4[8][17] = -1;
_local4[8][18] = -1;
_local4[8][19] = 5;
_local4[9] = new Array();
_local4[9][0] = -1;
_local4[9][1] = 1;
_local4[9][2] = -1;
_local4[9][3] = -1;
_local4[9][4] = -1;
_local4[9][5] = -1;
_local4[9][6] = -1;
_local4[9][7] = -1;
_local4[9][8] = -1;
_local4[9][9] = -1;
_local4[9][10] = -1;
_local4[9][11] = -1;
_local4[9][12] = -1;
_local4[9][13] = -1;
_local4[9][14] = -1;
_local4[9][15] = -1;
_local4[9][16] = -1;
_local4[9][17] = -1;
_local4[9][18] = -1;
_local4[9][19] = 5;
_local4[10] = new Array();
_local4[10][0] = -1;
_local4[10][1] = 1;
_local4[10][2] = -1;
_local4[10][3] = -1;
_local4[10][4] = -1;
_local4[10][5] = -1;
_local4[10][6] = -1;
_local4[10][7] = -1;
_local4[10][8] = -1;
_local4[10][9] = -1;
_local4[10][10] = -1;
_local4[10][11] = -1;
_local4[10][12] = -1;
_local4[10][13] = -1;
_local4[10][14] = -1;
_local4[10][15] = -1;
_local4[10][16] = -1;
_local4[10][17] = -1;
_local4[10][18] = -1;
_local4[10][19] = 5;
_local4[11] = new Array();
_local4[11][0] = -1;
_local4[11][1] = 1;
_local4[11][2] = 9;
_local4[11][3] = 9;
_local4[11][4] = 9;
_local4[11][5] = 9;
_local4[11][6] = 9;
_local4[11][7] = 9;
_local4[11][8] = 9;
_local4[11][9] = 9;
_local4[11][10] = 9;
_local4[11][11] = -1;
_local4[11][12] = -1;
_local4[11][13] = -1;
_local4[11][14] = -1;
_local4[11][15] = -1;
_local4[11][16] = 5;
_local4[11][17] = 5;
_local4[11][18] = -1;
_local4[11][19] = 5;
_local4[12] = new Array();
_local4[12][0] = 5;
_local4[12][1] = 1;
_local4[12][2] = -1;
_local4[12][3] = -1;
_local4[12][4] = -1;
_local4[12][5] = -1;
_local4[12][6] = -1;
_local4[12][7] = -1;
_local4[12][8] = -1;
_local4[12][9] = -1;
_local4[12][10] = 9;
_local4[12][11] = -1;
_local4[12][12] = -1;
_local4[12][13] = -1;
_local4[12][14] = -1;
_local4[12][15] = -1;
_local4[12][16] = 5;
_local4[12][17] = -1;
_local4[12][18] = -1;
_local4[12][19] = 5;
_local4[13] = new Array();
_local4[13][0] = 5;
_local4[13][1] = -1;
_local4[13][2] = -1;
_local4[13][3] = -1;
_local4[13][4] = -1;
_local4[13][5] = -1;
_local4[13][6] = -1;
_local4[13][7] = -1;
_local4[13][8] = -1;
_local4[13][9] = -1;
_local4[13][10] = 9;
_local4[13][11] = -1;
_local4[13][12] = -1;
_local4[13][13] = -1;
_local4[13][14] = -1;
_local4[13][15] = -1;
_local4[13][16] = 5;
_local4[13][17] = -1;
_local4[13][18] = -1;
_local4[13][19] = 5;
_local4[14] = new Array();
_local4[14][0] = 5;
_local4[14][1] = -1;
_local4[14][2] = -1;
_local4[14][3] = -1;
_local4[14][4] = 9;
_local4[14][5] = -1;
_local4[14][6] = -1;
_local4[14][7] = -1;
_local4[14][8] = -1;
_local4[14][9] = -1;
_local4[14][10] = 9;
_local4[14][11] = -1;
_local4[14][12] = -1;
_local4[14][13] = -1;
_local4[14][14] = -1;
_local4[14][15] = -1;
_local4[14][16] = 5;
_local4[14][17] = -1;
_local4[14][18] = -1;
_local4[14][19] = 5;
_local4[15] = new Array();
_local4[15][0] = 5;
_local4[15][1] = -1;
_local4[15][2] = -1;
_local4[15][3] = -1;
_local4[15][4] = 9;
_local4[15][5] = 9;
_local4[15][6] = 9;
_local4[15][7] = 9;
_local4[15][8] = 9;
_local4[15][9] = 9;
_local4[15][10] = 9;
_local4[15][11] = -1;
_local4[15][12] = -1;
_local4[15][13] = -1;
_local4[15][14] = -1;
_local4[15][15] = -1;
_local4[15][16] = 5;
_local4[15][17] = -1;
_local4[15][18] = -1;
_local4[15][19] = 5;
_local4[16] = new Array();
_local4[16][0] = 5;
_local4[16][1] = -1;
_local4[16][2] = -1;
_local4[16][3] = -1;
_local4[16][4] = -1;
_local4[16][5] = -1;
_local4[16][6] = -1;
_local4[16][7] = -1;
_local4[16][8] = -1;
_local4[16][9] = -1;
_local4[16][10] = -1;
_local4[16][11] = -1;
_local4[16][12] = -1;
_local4[16][13] = -1;
_local4[16][14] = -1;
_local4[16][15] = -1;
_local4[16][16] = 5;
_local4[16][17] = -1;
_local4[16][18] = -1;
_local4[16][19] = 5;
_local4[17] = new Array();
_local4[17][0] = 5;
_local4[17][1] = 5;
_local4[17][2] = 5;
_local4[17][3] = 5;
_local4[17][4] = 5;
_local4[17][5] = 5;
_local4[17][6] = 5;
_local4[17][7] = 5;
_local4[17][8] = 5;
_local4[17][9] = 5;
_local4[17][10] = 5;
_local4[17][11] = 5;
_local4[17][12] = 5;
_local4[17][13] = 5;
_local4[17][14] = 5;
_local4[17][15] = 5;
_local4[17][16] = 5;
_local4[17][17] = -1;
_local4[17][18] = -1;
_local4[17][19] = 5;
_local4[18] = new Array();
_local4[18][0] = 5;
_local4[18][1] = -1;
_local4[18][2] = -1;
_local4[18][3] = -1;
_local4[18][4] = -1;
_local4[18][5] = -1;
_local4[18][6] = -1;
_local4[18][7] = -1;
_local4[18][8] = -1;
_local4[18][9] = -1;
_local4[18][10] = -1;
_local4[18][11] = -1;
_local4[18][12] = -1;
_local4[18][13] = -1;
_local4[18][14] = -1;
_local4[18][15] = -1;
_local4[18][16] = -1;
_local4[18][17] = -1;
_local4[18][18] = -1;
_local4[18][19] = 5;
_local4[19] = new Array();
_local4[19][0] = 5;
_local4[19][1] = 5;
_local4[19][2] = 5;
_local4[19][3] = 5;
_local4[19][4] = 5;
_local4[19][5] = 5;
_local4[19][6] = 5;
_local4[19][7] = 5;
_local4[19][8] = 5;
_local4[19][9] = 5;
_local4[19][10] = 5;
_local4[19][11] = 5;
_local4[19][12] = 5;
_local4[19][13] = 5;
_local4[19][14] = 5;
_local4[19][15] = 5;
_local4[19][16] = 5;
_local4[19][17] = 5;
_local4[19][18] = 5;
_local4[19][19] = 5;
var _local5:int;
while (_local5 < _local1) {
_local6 = 0;
while (_local6 < _local2) {
if (_local4[_local5][_local6] == -1){
_local4[_local5][_local6] = 0;
};
if (_local4[_local5][_local6] == 9){
_local4[_local5][_local6] = 2;
};
if (_local4[_local5][_local6] == 1){
_local4[_local5][_local6] = 7;
};
if (_local4[_local5][_local6] == 5){
_local4[_local5][_local6] = 4;
};
_local6++;
};
_local5++;
};
caster.loadMap(_local4, _local2, _local1);
}
public function render(_arg1:Event):void{
caster.game();
}
public function ready(_arg1:Event):void{
t.stop();
addEventListener(Event.ENTER_FRAME, render);
}
}
}//package