Section 1
//EditorPlayer (editor.EditorPlayer)
package editor {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
import tiles.*;
import map.*;
import flash.text.*;
import gui.*;
import math.*;
import in_fla.*;
import flash.ui.*;
public class EditorPlayer extends Player {
private var updatePosition:Boolean;
private var upZ:Boolean;
private var mapData:MapData;
private var clearing:Boolean;
private var drawBrush:Boolean;
public var startPosition:Point3D;
private var lastPosition:Point3D;
private var downZ:Boolean;
public function EditorPlayer(_arg1:Point3D, _arg2:MapData, _arg3:Game){
mapData = _arg2;
super(_arg1, _arg3);
initEditorPlayer();
}
override public function destroy():void{
}
private function drawTile():void{
var _local1:EditTileEvent;
_local1 = new EditTileEvent(EditTileEvent.ADD_TILE);
_local1.tileValue = UIRoot.getTileModel();
_local1.position = position;
dispatchEvent(_local1);
drawBrush = true;
}
override protected function moving():void{
moveX = 0;
moveY = 0;
moveZ = 0;
if (left){
left = false;
moveX = -(Tile.SIZE);
} else {
if (right){
right = false;
moveX = Tile.SIZE;
} else {
if (up){
up = false;
moveY = -(Tile.SIZE);
} else {
if (down){
down = false;
moveY = Tile.SIZE;
} else {
if (downZ){
downZ = false;
moveZ = -(Tile.SIZE);
} else {
if (upZ){
upZ = false;
moveZ = Tile.SIZE;
};
};
};
};
};
};
if (updatePosition){
if (clearing){
clear();
} else {
if (drawBrush){
drawTile();
};
};
};
}
private function clear():void{
var _local1:MapObject;
var _local2:Boolean;
var _local3:EditTileEvent;
_local1 = Game.getTileByCoordinates(position);
_local2 = false;
if (_local1){
if ((_local1 as Lamp)){
_local2 = true;
};
} else {
return;
};
_local3 = new EditTileEvent(EditTileEvent.REMOVE_TILE_DATA);
_local3.tileValue = null;
_local3.position = position;
dispatchEvent(_local3);
if (_local2){
game.restart();
} else {
_local3 = new EditTileEvent(EditTileEvent.REMOVE_TILE);
_local3.tileValue = null;
_local3.position = position;
dispatchEvent(_local3);
clearing = true;
};
}
override public function update():void{
var _local1:Point3D;
var _local2:Point3D;
var _local3:Point;
moving();
_local1 = pix3dPosition.clone3d();
if (gravityType == MapVisual.VIEW_NORMAL){
_local1.x = (_local1.x + moveX);
_local1.y = (_local1.y + moveY);
_local1.z = (_local1.z + moveZ);
} else {
if (gravityType == MapVisual.VIEW_RIGHT){
_local1.z = (_local1.z + moveX);
_local1.x = (_local1.x + moveY);
_local1.y = (_local1.y + moveZ);
} else {
if (gravityType == MapVisual.VIEW_LEFT){
_local1.y = (_local1.y + moveX);
_local1.z = (_local1.z + moveY);
_local1.x = (_local1.x + moveZ);
};
};
};
_local2 = new Point3D(Math.round((_local1.x / Tile.SIZE)), Math.round((_local1.y / Tile.SIZE)), Math.round((_local1.z / Tile.SIZE)));
if (mapData.getValidate(_local2)){
position = _local2;
dispatchEvent(new MapObjectEvent(MapObjectEvent.UPDATE_POSITION));
pix3dPosition = _local1;
_local3 = MathUtils.toMap(pix3dPosition);
x = _local3.x;
y = _local3.y;
if ((((lastPosition == null)) || (!(lastPosition.compare(pix3dPosition))))){
lastPosition = pix3dPosition.clone3d();
updatePosition = true;
} else {
updatePosition = false;
};
posText.text = _local2.toString();
};
}
override protected function onEndAction(_arg1:KeyboardEvent):void{
super.onEndAction(_arg1);
if (_arg1.keyCode == Keyboard.SHIFT){
clearing = false;
};
if (_arg1.keyCode == Keyboard.SPACE){
drawBrush = false;
};
}
private function initEditorPlayer():void{
var _local1:Sprite;
posText = new TextField();
posText.mouseEnabled = (posText.selectable = false);
posText.multiline = (posText.wordWrap = true);
posText.width = 300;
posText.height = 300;
posText.textColor = 0xFFFFFF;
posText.filters = [new GlowFilter(0, 2, 3, 3, 3)];
posText.y = -70;
posText.x = -50;
posText.text = pix3dPosition.toString();
addChild(posText);
_local1 = new Sprite();
MathUtils.drawTile(_local1.graphics, new Point3D());
_local1.x = -12;
_local1.y = 0;
_local1.filters = [new GlowFilter(0xFFFFFF, 2, 4, 4, 3)];
addChild(_local1);
}
override protected function onAction(_arg1:KeyboardEvent):void{
var _local2:EditTileEvent;
var _local3:Boolean;
if (Main.PAUSE){
return;
};
if (_arg1.keyCode == 65){
left = true;
};
if (_arg1.keyCode == 68){
right = true;
};
if (_arg1.keyCode == 87){
up = true;
};
if (_arg1.keyCode == 83){
down = true;
};
if (_arg1.keyCode == 38){
upZ = true;
};
if (_arg1.keyCode == 40){
downZ = true;
};
if (_arg1.keyCode == Keyboard.SHIFT){
clear();
};
_local3 = false;
if (_arg1.keyCode == 90){
_local3 = true;
_local2 = new EditTileEvent(EditTileEvent.EDIT_TILE, true);
_local2.tileValue = new WallsData(3, 3, 3, 1, 2);
_local2.position = position;
dispatchEvent(_local2);
if (((startPosition) && (!(startPosition.compare(position))))){
_local2 = new EditTileEvent(EditTileEvent.REMOVE_TILE, true);
_local2.position = startPosition;
dispatchEvent(_local2);
startPosition = null;
};
startPosition = _local2.position;
};
if (_arg1.keyCode == 88){
_local3 = true;
_local2 = new EditTileEvent(EditTileEvent.EDIT_TILE, true);
_local2.tileValue = new WallsData(1, 4, 5, 0, 3);
_local2.position = position;
dispatchEvent(_local2);
};
if (_arg1.keyCode == 66){
_local3 = true;
_local2 = new EditTileEvent(EditTileEvent.EDIT_TILE, true);
_local2.tileValue = new WallsData(0, 0, 0, 1, 4);
_local2.position = position;
dispatchEvent(_local2);
};
if (_arg1.keyCode == 76){
_local3 = true;
_local2 = new EditTileEvent(EditTileEvent.EDIT_TILE, true);
_local2.tileValue = new WallsData(0, 0, 0, 1, 5);
_local2.position = position;
dispatchEvent(_local2);
};
if (_arg1.keyCode == 78){
_local3 = true;
_local2 = new EditTileEvent(EditTileEvent.EDIT_TILE, true);
_local2.tileValue = UIRoot.getTileModel(6);
_local2.position = position;
dispatchEvent(_local2);
};
if (_local3){
game.restart();
};
if (_arg1.keyCode == Keyboard.SPACE){
drawTile();
};
if (_arg1.keyCode == Keyboard.END){
Main.EDITOR = false;
game.restart();
};
if (_arg1.keyCode == Keyboard.RIGHT){
if (gravityType == MapVisual.VIEW_LEFT){
gravityType = MapVisual.VIEW_NORMAL;
Game.setView(gravityType);
return;
};
if (gravityType == MapVisual.VIEW_RIGHT){
gravityType = MapVisual.VIEW_LEFT;
Game.setView(gravityType);
return;
};
if (gravityType == MapVisual.VIEW_NORMAL){
gravityType = MapVisual.VIEW_RIGHT;
Game.setView(gravityType);
return;
};
};
if (_arg1.keyCode == Keyboard.LEFT){
if (gravityType == MapVisual.VIEW_LEFT){
gravityType = MapVisual.VIEW_RIGHT;
Game.setView(gravityType);
return;
};
if (gravityType == MapVisual.VIEW_RIGHT){
gravityType = MapVisual.VIEW_NORMAL;
Game.setView(gravityType);
return;
};
if (gravityType == MapVisual.VIEW_NORMAL){
gravityType = MapVisual.VIEW_LEFT;
Game.setView(gravityType);
return;
};
};
}
}
}//package editor
Section 2
//EditTileEvent (editor.EditTileEvent)
package editor {
import flash.events.*;
import tiles.*;
public class EditTileEvent extends Event {
public var position:Point3D;
public var tileValue:WallsData;
public static const REMOVE_TILE_DATA:String = "remove_tile_data";
public static const EDIT_TILE:String = "edit_tile";
public static const REMOVE_TILE:String = "remove_tile";
public static const ADD_TILE:String = "add_tile";
public function EditTileEvent(_arg1:String, _arg2:Boolean=true, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function clone():Event{
var _local1:EditTileEvent;
_local1 = new EditTileEvent(type, bubbles, cancelable);
_local1.tileValue = tileValue;
_local1.position = position;
return (_local1);
}
}
}//package editor
Section 3
//BumpFilter (filters.BumpFilter)
package filters {
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class BumpFilter {
public static function getBumpLightPoint(_arg1:BitmapData, _arg2:Point, _arg3:Number=1, _arg4:int=10):BitmapData{
var _local5:Number;
var _local6:Number;
var _local7:BitmapData;
var _local8:int;
var _local9:Number;
var _local10:Number;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local5 = _arg1.width;
_local6 = _arg1.height;
_local7 = _arg1;
_local8 = _arg4;
_local9 = ((_local8 / 2) * _arg3);
_local10 = _local9;
_local11 = 0;
while (_local11 < (_local8 * _local8)) {
_local12 = int((_local11 / _local8));
_local13 = (_local11 % _local8);
_local14 = ((((_arg2.x - (_local13 * (_local5 / _local8))) / (_local5 / _local8)) - 0.5) / 5);
_local15 = ((((_arg2.y - (_local12 * (_local6 / _local8))) / (_local6 / _local8)) - 0.5) / 5);
_local16 = 1;
_local17 = dist(new Point(0, 0), new Point(_local14, _local15));
_local14 = (_local14 * ((_local9 - Math.min(_local17, _local9)) / _local10));
_local15 = (_local15 * ((_local9 - Math.min(_local17, _local9)) / _local10));
_local16 = (_local16 * ((_local9 - Math.min(_local17, _local9)) / _local10));
_local7.applyFilter(_arg1, new Rectangle((_local13 * int((_local5 / _local8))), (_local12 * int((_local6 / _local8))), int((_local5 / _local8)), int((_local6 / _local8))), new Point((_local13 * int((_local5 / _local8))), (_local12 * int((_local6 / _local8)))), new ColorMatrixFilter(getBumpMatrix(_local14, _local15, _local16)));
_local11++;
};
return (_local7);
}
public static function getBumpFilter(_arg1:Number, _arg2:Number, _arg3:Number):ColorMatrixFilter{
return (new ColorMatrixFilter(getBumpMatrix(_arg1, _arg2, _arg3)));
}
private static function getBumpMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Array{
var _local4:Array;
_local4 = new Array();
_local4[0] = (2 * _arg1);
_local4[1] = (2 * _arg2);
_local4[2] = (2 * _arg3);
_local4[3] = 0;
_local4[4] = (-256 * ((_arg1 + _arg2) + _arg3));
_local4[5] = _local4[0];
_local4[6] = _local4[1];
_local4[7] = _local4[2];
_local4[8] = _local4[3];
_local4[9] = _local4[4];
_local4[10] = _local4[0];
_local4[11] = _local4[1];
_local4[12] = _local4[2];
_local4[13] = _local4[3];
_local4[14] = _local4[4];
_local4[15] = 0;
_local4[16] = 0;
_local4[17] = 0;
_local4[18] = 1;
_local4[19] = 0;
return (_local4);
}
private static function dist(_arg1:Point, _arg2:Point):Number{
return (Math.sqrt(Number((Math.pow((_arg2.x - _arg1.x), 2) + Math.pow((_arg2.y - _arg1.y), 2)))));
}
}
}//package filters
Section 4
//ModalTootor (gui.tootor.ModalTootor)
package gui.tootor {
import flash.events.*;
import flash.display.*;
import gui.*;
import ui.*;
public class ModalTootor extends StageSprite {
protected var container:Sprite;
protected var modalSprite:ModalSprite;
override protected function onResize(_arg1:Event=null):void{
container.x = ((stage.stageWidth / 2) - (container.width / 2));
container.y = ((stage.stageHeight / 2) - (container.height / 2));
}
}
}//package gui.tootor
Section 5
//Tootor1 (gui.tootor.Tootor1)
package gui.tootor {
import flash.display.*;
import flash.text.*;
import gui.*;
import temp.*;
public class Tootor1 extends ModalTootor {
public var targetLabel:TextField;
public var startDescription:TextField;
public var controllLabel:TextField;
public var targetDescription:TextField;
public var controllDescription:TextField;
public function Tootor1(){
container = new Sprite();
while (numChildren != 0) {
container.addChild(getChildAt(0));
};
modalSprite = new ModalSprite();
modalSprite.alpha = 0.35;
addChild(modalSprite);
addChild(container);
targetLabel.text = Localization.INSTANCE.getValue(Localization.label_target);
controllLabel.text = Localization.INSTANCE.getValue(Localization.label_control);
targetDescription.text = Localization.INSTANCE.getValue(Localization.target_1);
controllDescription.text = Localization.INSTANCE.getValue(Localization.control_1);
startDescription.text = Localization.INSTANCE.getValue(Localization.control_4);
}
}
}//package gui.tootor
Section 6
//Tootor2 (gui.tootor.Tootor2)
package gui.tootor {
import flash.display.*;
import flash.text.*;
import gui.*;
import temp.*;
public class Tootor2 extends ModalTootor {
public var description:Tootor2Description;
public var startDescription:TextField;
public var controllLabel:TextField;
public function Tootor2(){
container = new Sprite();
while (numChildren != 0) {
container.addChild(getChildAt(0));
};
modalSprite = new ModalSprite();
modalSprite.alpha = 0.35;
addChild(modalSprite);
addChild(container);
controllLabel.text = Localization.INSTANCE.getValue(Localization.label_control);
startDescription.text = Localization.INSTANCE.getValue(Localization.control_4);
}
}
}//package gui.tootor
Section 7
//Tootor2Description (gui.tootor.Tootor2Description)
package gui.tootor {
import flash.display.*;
import flash.text.*;
import temp.*;
public class Tootor2Description extends Sprite {
public var rightDescription:TextField;
public var leftDescription:TextField;
public function Tootor2Description(){
rightDescription.text = Localization.INSTANCE.getValue(Localization.control_2);
leftDescription.text = Localization.INSTANCE.getValue(Localization.control_3);
}
}
}//package gui.tootor
Section 8
//Tootor3 (gui.tootor.Tootor3)
package gui.tootor {
import flash.display.*;
import flash.text.*;
import gui.*;
import temp.*;
public class Tootor3 extends ModalTootor {
public var targetLabel:TextField;
public var startDescription:TextField;
public var targetDescription:TextField;
public function Tootor3(){
container = new Sprite();
while (numChildren != 0) {
container.addChild(getChildAt(0));
};
modalSprite = new ModalSprite();
modalSprite.alpha = 0.35;
addChild(modalSprite);
addChild(container);
targetLabel.text = Localization.INSTANCE.getValue(Localization.label_target);
targetDescription.text = Localization.INSTANCE.getValue(Localization.target_2);
startDescription.text = Localization.INSTANCE.getValue(Localization.control_4);
}
}
}//package gui.tootor
Section 9
//TootorStartGame (gui.tootor.TootorStartGame)
package gui.tootor {
import flash.display.*;
import flash.text.*;
import gui.*;
import temp.*;
public class TootorStartGame extends ModalTootor {
public var startDescription:TextField;
public function TootorStartGame(){
container = new Sprite();
while (numChildren != 0) {
container.addChild(getChildAt(0));
};
modalSprite = new ModalSprite();
modalSprite.alpha = 0.35;
addChild(modalSprite);
addChild(container);
startDescription.text = Localization.INSTANCE.getValue(Localization.control_4);
}
}
}//package gui.tootor
Section 10
//Alert (gui.Alert)
package gui {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import ui.*;
public class Alert extends Sprite {
private var contentContainer:UISprite;
private var description:String;
private var otherContent:Array;
private var alertText:TextField;
private var modalSprite:ModalSprite;
private var stageObject:Stage;
public function Alert(_arg1:Stage, _arg2:String, _arg3:Array){
modalSprite = new ModalSprite();
stageObject = _arg1;
description = _arg2;
otherContent = _arg3;
initInstance();
}
private function onResize(_arg1:Event=null):void{
contentContainer.x = int(((modalSprite.width / 2) - (contentContainer.width / 2)));
contentContainer.y = int(((modalSprite.height / 2) - (contentContainer.height / 2)));
}
private function drawContent():void{
var _local1:uint;
alertText = new TextField();
alertText.background = true;
alertText.selectable = false;
alertText.backgroundColor = 11176072;
alertText.autoSize = TextFieldAutoSize.LEFT;
alertText.height = 25;
alertText.width = 125;
alertText.wordWrap = (alertText.multiline = true);
alertText.text = description;
contentContainer.addChild(alertText);
_local1 = 0;
while (_local1 < otherContent.length) {
if ((otherContent[_local1] is DisplayObject)){
contentContainer.addChild(otherContent[_local1]);
};
_local1++;
};
onResize();
}
private function initInstance():void{
contentContainer = new UISprite(UISprite.BORDER, true);
addChild(modalSprite);
addChild(contentContainer);
drawContent();
modalSprite.addEventListener(Event.RESIZE, onResize);
}
public function destroy():void{
stageObject.removeEventListener(Event.RESIZE, onResize);
alertText.text = "";
alertText = null;
stageObject = null;
removeChild(modalSprite);
removeChild(contentContainer);
}
}
}//package gui
Section 11
//DragItem (gui.DragItem)
package gui {
import flash.events.*;
import flash.display.*;
import tiles.*;
public class DragItem extends Sprite {
public var index:int;
private var wallTexture:BitmapData;
public function DragItem(_arg1:int){
var _local2:Bitmap;
super();
index = _arg1;
wallTexture = WallsData.getWall(WallsData.TEXTURE[index]);
if (wallTexture){
_local2 = new Bitmap(wallTexture);
_local2.x = (_local2.x - 25);
_local2.y = (_local2.y - 25);
addChild(_local2);
} else {
graphics.beginFill(0xFF0000);
graphics.drawCircle(0, 0, 30);
destroy();
};
startDrag(true);
addEventListener(Event.ADDED_TO_STAGE, onAdd);
addEventListener(Event.REMOVED_FROM_STAGE, onRemove);
addEventListener(Event.MOUSE_LEAVE, onRemove);
}
private function onRemove(_arg1:Event):void{
destroy();
}
private function onAdd(_arg1:Event):void{
stage.addEventListener(MouseEvent.MOUSE_UP, onDrop);
if (parent){
x = parent.mouseX;
y = parent.mouseY;
};
}
private function onDrop(_arg1:MouseEvent):void{
var _local2:DropEvent;
_local2 = new DropEvent();
_local2.itemType = index;
dispatchEvent(_local2);
destroy();
}
public function destroy():void{
removeEventListener(Event.ADDED_TO_STAGE, onAdd);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemove);
removeEventListener(Event.MOUSE_LEAVE, onRemove);
removeEventListener(MouseEvent.MOUSE_UP, onDrop);
if (parent){
parent.removeChild(this);
};
}
}
}//package gui
Section 12
//DropEvent (gui.DropEvent)
package gui {
import flash.events.*;
public class DropEvent extends Event {
public var itemType:int;
public static const ITEM_DROP:String = "item_drop";
public function DropEvent(_arg1:String="item_drop", _arg2:Boolean=true, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
}
}//package gui
Section 13
//HUD (gui.HUD)
package gui {
import flash.events.*;
import flash.display.*;
import in_fla.*;
public class HUD extends Sprite {
private static var bonusHud:BonusHUD;
private static var _mapName:String;
public function HUD(){
initInstance();
}
private function onRemove(_arg1:Event):void{
stage.removeEventListener(Event.RESIZE, onResize);
}
private function onAdd(_arg1:Event):void{
stage.addEventListener(Event.RESIZE, onResize);
onResize();
}
private function onResize(_arg1:Event=null):void{
if (stage == null){
return;
};
if (bonusHud){
bonusHud.x = Math.round(((stage.stageWidth / 2) - (bonusHud.width / 2)));
bonusHud.y = 0;
};
}
private function initBonusValue():void{
bonusHud = new BonusHUD();
addChild(bonusHud);
onResize();
}
private function initInstance():void{
mouseChildren = false;
mouseEnabled = false;
addEventListener(Event.ADDED_TO_STAGE, onAdd);
addEventListener(Event.REMOVED_FROM_STAGE, onRemove);
initBonusValue();
}
public static function set mapName(_arg1:String):void{
_mapName = _arg1;
bonusHud.setMapName(_mapName);
}
public static function updateBonus(_arg1:int, _arg2:int):void{
bonusHud.setHave(_arg1);
bonusHud.setMax(_arg2);
}
public static function updateGameTimer(_arg1:int):void{
bonusHud.setGameTime(_arg1);
}
public static function get mapName():String{
return (_mapName);
}
}
}//package gui
Section 14
//IKeyAction (gui.IKeyAction)
package gui {
public interface IKeyAction {
function act():void;
}
}//package gui
Section 15
//LoadLevel (gui.LoadLevel)
package gui {
import flash.events.*;
public class LoadLevel extends WalkerLoader {
override protected function onRemoved(_arg1:Event):void{
stage.removeEventListener(Event.RESIZE, onResize);
}
public function setBarValue(_arg1:int):void{
bar.gotoAndStop(_arg1);
}
}
}//package gui
Section 16
//ModalSprite (gui.ModalSprite)
package gui {
import flash.events.*;
import flash.display.*;
public class ModalSprite extends Sprite {
public function ModalSprite(){
addEventListener(Event.ADDED_TO_STAGE, onAddToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemoveFromStage);
}
private function onRemoveFromStage(_arg1:Event):void{
UIRoot.BLOCK = false;
removeEventListener(Event.ADDED_TO_STAGE, onAddToStage);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemoveFromStage);
stage.removeEventListener(Event.RESIZE, onResize);
}
protected function onResize(_arg1:Event=null):void{
drawModalSprite();
}
private function onAddToStage(_arg1:Event):void{
UIRoot.BLOCK = true;
removeEventListener(Event.ADDED_TO_STAGE, onAddToStage);
stage.addEventListener(Event.RESIZE, onResize);
onResize();
}
private function drawModalSprite():void{
graphics.clear();
graphics.beginFill(0, 0.5);
graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
graphics.endFill();
dispatchEvent(new Event(Event.RESIZE));
}
}
}//package gui
Section 17
//Preloader (gui.Preloader)
package gui {
import flash.events.*;
import flash.display.*;
import temp.*;
public class Preloader extends WalkerLoader {
private var starContainer:Sprite;
private var all_starts:Array;
private var START_COUNT:Number;// = 600
public function Preloader(){
START_COUNT = 600;
starContainer = new Sprite();
addChildAt(starContainer, 0);
super();
}
private function onMove():void{
var _local1:Number;
var _local2:Star;
_local1 = 0;
while (_local1 < START_COUNT) {
_local2 = all_starts[_local1];
_local2.move();
_local1++;
};
}
public function initPreloader():void{
var _local1:Number;
all_starts = new Array();
_local1 = 0;
while (_local1 < START_COUNT) {
all_starts.push(starContainer.addChild(new Star(((Math.random() * 360) - 180), (Math.random() * Star.MAX_LENGTH))));
_local1++;
};
starContainer.x = (240 / 2);
starContainer.y = (30 / 2);
addEventListener(Event.ENTER_FRAME, Update);
}
override public function onAddToStage(_arg1:Event):void{
initPreloader();
super.onAddToStage(_arg1);
}
public function Update(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:String;
var _local5:Number;
_local2 = stage.loaderInfo.bytesLoaded;
_local3 = stage.loaderInfo.bytesTotal;
_local4 = "";
_local5 = 0;
if (_local3 > 0){
_local5 = Math.floor(((_local2 / _local3) * 100));
_local4 = (((((_local5 + "% (") + Math.round((_local2 / 0x0400))) + "kb / ") + Math.round((_local3 / 0x0400))) + "kb)");
};
loaderLabel.text = ("Loading... " + _local4);
bar.gotoAndStop((_local5 + 1));
if ((((_local2 == _local3)) || ((_local3 == 0)))){
removeEventListener(Event.ENTER_FRAME, Update);
dispatchEvent(new Event(Event.COMPLETE, true));
};
onMove();
}
override public function destroy():void{
var _local1:Number;
_local1 = 0;
while (_local1 < START_COUNT) {
starContainer.removeChild(all_starts[_local1]);
_local1++;
};
removeEventListener(Event.ENTER_FRAME, Update);
super.destroy();
}
}
}//package gui
Section 18
//TexturePalette (gui.TexturePalette)
package gui {
import flash.events.*;
import flash.display.*;
import tiles.*;
public class TexturePalette extends Sprite {
private var allTextures:Array;
private var elements:Array;
private static const ITEM_SIZE:int = 19;
public function TexturePalette(){
elements = new Array();
super();
allTextures = WallsData.TEXTURE;
drawAlltexture();
}
private function drawTextureContoll(_arg1:MouseEvent):void{
var _local2:TextureItem;
_local2 = (_arg1.target as TextureItem);
if (TextureItem){
_local2.index;
addChild(new DragItem(_local2.index));
};
}
private function getTextureItem(_arg1:int):Sprite{
var _local2:TextureItem;
var _local3:BitmapData;
var _local4:Bitmap;
_local2 = new TextureItem(_arg1);
_local3 = WallsData.getWall(allTextures[_arg1]);
if (_local3){
_local4 = new Bitmap(_local3);
_local4.height = ITEM_SIZE;
_local4.width = ITEM_SIZE;
_local2.addChild(_local4);
};
_local2.graphics.beginFill(0x668800);
_local2.graphics.drawRect(0, 0, ITEM_SIZE, ITEM_SIZE);
return (_local2);
}
private function drawAlltexture():void{
var _local1:uint;
var _local2:Sprite;
_local1 = 0;
while (_local1 < (allTextures.length - 1)) {
_local2 = getTextureItem((_local1 + 1));
_local2.x = ((_local1 % 5) * (ITEM_SIZE + 1));
_local2.y = (int((_local1 / 5)) * (ITEM_SIZE + 1));
addChild(_local2);
_local2.addEventListener(MouseEvent.MOUSE_DOWN, drawTextureContoll);
elements.push(_local2);
_local1++;
};
}
public function destroy():void{
var _local1:uint;
var _local2:Sprite;
_local1 = 0;
while (_local1 < (elements.length - 1)) {
_local2 = elements[_local1];
_local2.removeEventListener(MouseEvent.MOUSE_DOWN, drawTextureContoll);
removeChild(_local2);
_local1++;
};
}
}
}//package gui
import flash.display.*;
class TextureItem extends Sprite {
public var index:int;
private function TextureItem(_arg1:int){
index = _arg1;
}
}
Section 19
//UIRoot (gui.UIRoot)
package gui {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
import tiles.*;
import flash.net.*;
import flash.text.*;
import temp.*;
import in_fla.*;
import in_fla.sound.*;
import gui.tootor.*;
import ui.*;
import flash.system.*;
import flash.ui.*;
public class UIRoot extends Sprite {
private var mapName:String;
private var _currentButton:Number;
private var helpText:TextField;
private var inputText:WalkerInput;
private var startAlert:StageSprite;
private var creator:Creator;
private var editorInterfase:Boolean;// = false
private var nameTextFileld:TextField;
private var alertContainer:Alert;
private var allButtons:Array;
private var musicWidget:MusicWidget;
private var waitStarting:Boolean;
private var openGameMenu:CustomButton;
private var texturePalette:TexturePalette;
private var lastText:String;
private var loadLevelBar:LoadLevel;
private var startGameMenu:StartMenu;
private var tileExemplar:Tile;
private var mapData:MapData;
private var selectButton:WalkerButton;
private var main:Main;
private var sponsorLogo:SponsorLogo;
private var game:Game;
private static const DEFAULT_HELP_TEXT:String = "";
public static var BLOCK:Boolean = false;
private static var topTexture:uint = 1;
public static var gameStarting:Boolean = false;
private static var pass:uint = 0;
public static var customLevel:Boolean = false;
private static var leftTexture:uint = 2;
public static var LIGHT:Boolean = true;
private static var EDITOR_HELP_TEXT:String = "W, A, S, D, UP, DOWN — MOVING
ENTER — TEST MAP
EDITOR:
Z — START POINT
X — FINISH DOOR
C — COPY TILE
B — ADD STAR
L — ADD LIGHT
SPACE — SET TILE
SHIFT — REMOVE TILE
N — SET CRUSHED TILE";
public static var editor:Boolean = false;
private static var rightTexture:uint = 2;
public function UIRoot(_arg1:MapData, _arg2:Game, _arg3:Main){
editorInterfase = false;
super();
main = _arg3;
EDITOR_HELP_TEXT = Localization.INSTANCE.getValue(Localization.editor_control);
game = _arg2;
mapData = _arg1;
sponsorLogo = new SponsorLogo();
initUI();
loadLevelBar = new LoadLevel();
addEventListener(Event.ADDED_TO_STAGE, onAddToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
private function nextButton():void{
if ((currentButton + 1) >= allButtons.length){
currentButton = 0;
} else {
currentButton++;
};
}
public function get currentButton():int{
return (_currentButton);
}
public function set currentButton(_arg1:int):void{
var _local2:WalkerButton;
_local2 = (allButtons[_arg1] as WalkerButton);
if (_local2){
if (selectButton){
selectButton.deselect();
};
selectButton = _local2;
selectButton.select();
} else {
return;
};
_currentButton = _arg1;
}
private function toggleLight():void{
LIGHT = !(LIGHT);
trace(("LIGHT:" + LIGHT));
game.restart();
}
private function getMap():void{
var _local1:String;
if (Main.EDITOR){
mapData.updateCurrentMap();
};
mapData.clear();
_local1 = mapData.getMap(mapName);
mapData.setMap(_local1);
System.setClipboard(addEnterSymbols(_local1));
game.restart();
createAlert(Localization.INSTANCE.getValue(Localization.map_copy));
}
private function editorExit():void{
gameStarting = false;
Main.EDITOR = false;
editor = false;
editorInterfase = false;
tileExemplar.topWall.removeEventListener(MouseEvent.CLICK, editTop);
tileExemplar.leftWall.removeEventListener(MouseEvent.CLICK, editLeft);
tileExemplar.rightWall.removeEventListener(MouseEvent.CLICK, editRight);
texturePalette.destroy();
UserInterface.INSTANCE.clear();
initStartGame();
Main.PAUSE = true;
Game.startingTimer = false;
Game.clear();
}
private function editRight(_arg1:MouseEvent):void{
if (_arg1.ctrlKey){
rightTexture--;
if (rightTexture < 1){
rightTexture = (WallsData.TEXTURE.length - 1);
};
} else {
rightTexture++;
if (rightTexture >= WallsData.TEXTURE.length){
rightTexture = 1;
};
};
tileExemplar.setWall(getTileModel());
}
public function initStartGame():void{
var _local1:WalkerButton;
Main.PAUSE = true;
if (stage){
stage.quality = StageQuality.HIGH;
};
Game.startingTimer = false;
if (((openGameMenu) && (contains(openGameMenu)))){
removeChild(openGameMenu);
};
if (startGameMenu){
startGameMenu.clear();
} else {
startGameMenu = new StartMenu();
};
LIGHT = true;
if (gameStarting){
startGameMenu.addChild(new WalkerButton(backToGame, Localization.INSTANCE.getValue(Localization.return_in_game)));
} else {
HUD.mapName = Main.hudMenuText;
MusicController.INSTANCE.play(MusicController.MUSIC_2_MENU);
};
addChild(sponsorLogo);
startGameMenu.addChild(new WalkerButton(startGame, Localization.INSTANCE.getValue(Localization.start_game)));
startGameMenu.addChild(new WalkerButton(startEditor, Localization.INSTANCE.getValue(Localization.start_editor)));
startGameMenu.addChild(new WalkerButton(setMap, Localization.INSTANCE.getValue(Localization.start_custom_level)));
startGameMenu.addChild(new WalkerButton(showScores, Localization.INSTANCE.getValue(Localization.top_scores)));
_local1 = new WalkerButton(showMoreGames, Localization.INSTANCE.getValue(Localization.more_games));
_local1.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 100);
startGameMenu.addChild(_local1);
startGameMenu.addChild(new WalkerButton(showCreators, Localization.INSTANCE.getValue(Localization.creator)));
startGameMenu.show();
helpText.text = DEFAULT_HELP_TEXT;
addChild(startGameMenu);
allButtons = startGameMenu.getButtons();
currentButton = 0;
onResize();
}
private function closeAlert():void{
lastText = "";
Main.PAUSE = false;
alertContainer.destroy();
removeChild(alertContainer);
stage.focus = stage;
}
private function openEditor():void{
game.restart();
editor = true;
Main.EDITOR = true;
game.startEditor();
if (contains(loadLevelBar)){
removeChild(loadLevelBar);
};
if (startGameMenu){
startGameMenu.visible = false;
};
}
private function selectButtonAct():void{
if (((selectButton) && (!(BLOCK)))){
selectButton.act();
};
}
public function startEditor(_arg1:Boolean=false):void{
gameStarting = true;
if (!editorInterfase){
editorInterfase = true;
hideGameMenu();
initEditorIterfase();
};
if (((openGameMenu) && (contains(openGameMenu)))){
removeChild(openGameMenu);
};
if (Main.EDITOR){
testMap();
} else {
openEditor();
};
if (_arg1){
newMap();
};
}
private function createInputText(_arg1:String=""):TextField{
var _local2:TextField;
_local2 = new TextField();
_local2.border = true;
_local2.background = true;
_local2.backgroundColor = 0xAAAAAA;
_local2.height = 22;
_local2.type = TextFieldType.INPUT;
if (_arg1){
_local2.text = _arg1;
};
stage.focus = _local2;
return (_local2);
}
private function loadMap():void{
try {
mapData.setMap(inputText.getText());
} catch(e:Error) {
return;
};
gameStarting = true;
Main.EDITOR = false;
customLevel = true;
game.restart();
hideGameMenu();
menuButton();
}
private function onAddToStage(_arg1:Event):void{
stage.addEventListener(KeyboardEvent.KEY_DOWN, onAction);
stage.addEventListener(KeyboardEvent.KEY_UP, onEndAction);
stage.addEventListener(Event.RESIZE, onResize);
onResize();
}
private function iniListener():void{
game.addEventListener(GameEvent.LOAD_LEVEL, onStartLoad);
game.addEventListener(GameEvent.UPDATE_LOAD_LEVEL, onUpdateAlert);
game.addEventListener(GameEvent.START_GAME, onInitStartAlert);
}
private function onUpdateAlert(_arg1:GameEvent):void{
loadLevelBar.setBarValue(_arg1.loadLevelPercent);
}
private function backToGame():void{
Main.PAUSE = false;
startGameMenu.hide();
menuButton();
}
private function editTop(_arg1:MouseEvent):void{
if (_arg1.ctrlKey){
topTexture--;
if (topTexture < 1){
topTexture = (WallsData.TEXTURE.length - 1);
};
} else {
topTexture++;
if (topTexture >= WallsData.TEXTURE.length){
topTexture = 1;
};
};
tileExemplar.setWall(getTileModel());
}
private function onRemovedFromStage(_arg1:Event):void{
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onAction);
stage.removeEventListener(KeyboardEvent.KEY_UP, onEndAction);
}
private function onAction(_arg1:KeyboardEvent):void{
if (!Main.PAUSE){
if (_arg1.keyCode == Keyboard.ENTER){
if (Main.EDITOR){
testMap();
} else {
if (waitStarting){
waitStarting = false;
game.startGame();
removeChild(startAlert);
} else {
game.restart();
};
};
};
if (_arg1.keyCode == 67){
copyTile();
};
if (Main.CHEATS){
if (_arg1.keyCode == Keyboard.END){
startEditor();
};
if (_arg1.keyCode == Keyboard.PAGE_UP){
mapData.nextMap();
game.initShadow();
game.restart();
};
if (_arg1.keyCode == Keyboard.PAGE_DOWN){
mapData.prevMap();
game.initShadow();
game.restart();
};
};
if (!Main.EDITOR){
if (_arg1.keyCode == Keyboard.SPACE){
initStartGame();
};
};
} else {
if (!BLOCK){
if (!Main.EDITOR){
if (_arg1.keyCode == Keyboard.SPACE){
selectButtonAct();
};
};
if (_arg1.keyCode == Keyboard.UP){
prevButton();
};
if (_arg1.keyCode == Keyboard.DOWN){
nextButton();
};
if (_arg1.keyCode == Keyboard.ENTER){
selectButtonAct();
};
};
};
}
private function onInitStartAlert(_arg1:GameEvent):void{
var _local2:int;
if (contains(loadLevelBar)){
removeChild(loadLevelBar);
};
if (!waitStarting){
_local2 = mapData.getLevel();
if (_local2 == 0){
startAlert = new Tootor1();
} else {
if (_local2 == 1){
startAlert = new Tootor2();
} else {
if (_local2 == 2){
startAlert = new Tootor3();
} else {
startAlert = new TootorStartGame();
};
};
};
addChild(startAlert);
waitStarting = true;
};
}
private function initEditorIterfase():void{
var _local1:UISprite;
var _local2:UISprite;
var _local3:Sprite;
addChild(UserInterface.INSTANCE);
_local1 = new UISprite();
_local1.addChild(new CustomButton(openEditor, Localization.INSTANCE.getValue(Localization.to_editor)));
_local1.addChild(new CustomButton(newMap, Localization.INSTANCE.getValue(Localization.new_map)));
_local1.addChild(new CustomButton(setMapName, Localization.INSTANCE.getValue(Localization.get_map_code)));
_local1.addChild(new CustomButton(testMap, Localization.INSTANCE.getValue(Localization.test_map)));
_local1.addChild(new CustomButton(toggleLight, Localization.INSTANCE.getValue(Localization.test_light)));
_local1.addChild(new CustomButton(editorExit, Localization.INSTANCE.getValue(Localization.editor_exit)));
UserInterface.INSTANCE.setUIElement(_local1, Localization.INSTANCE.getValue(Localization.tab_editor));
_local2 = new UISprite();
_local3 = new Sprite();
_local3.graphics.beginFill(0xAAAAAA);
_local3.graphics.drawRect(0, 0, 100, 105);
_local3.scaleX = (_local3.scaleY = 1.2);
_local2.addChild(_local3);
tileExemplar = new EditorTile(new Point3D(), getTileModel());
tileExemplar.x = 54;
tileExemplar.y = 53;
tileExemplar.topWall.addEventListener(MouseEvent.CLICK, editTop);
tileExemplar.leftWall.addEventListener(MouseEvent.CLICK, editLeft);
tileExemplar.rightWall.addEventListener(MouseEvent.CLICK, editRight);
_local3.addChild(tileExemplar);
texturePalette = new TexturePalette();
texturePalette.y = 110;
texturePalette.addEventListener(DropEvent.ITEM_DROP, onDropItem);
_local3.addChild(texturePalette);
UserInterface.INSTANCE.setUIElement(_local2, Localization.INSTANCE.getValue(Localization.tab_tile));
helpText.text = EDITOR_HELP_TEXT;
}
private function closeAlertSetName():void{
mapName = validate(nameTextFileld.text);
closeAlert();
getMap();
}
private function addEnterSymbols(_arg1:String):String{
var _local2:String;
var _local3:int;
var _local4:int;
_local3 = 25;
_local2 = _arg1.substr(0, Math.min(_local3, _arg1.length));
_local4 = _local3;
while (_local4 < _arg1.length) {
_local2 = (_local2 + ("\n" + _arg1.substr(_local4, Math.min(_local3, (_arg1.length - _local4)))));
_local4 = (_local4 + _local3);
};
return (_local2);
}
private function validate(_arg1:String):String{
var _local2:Number;
var _local3:String;
_local2 = 0;
while (_local2 < _arg1.length) {
_local3 = _arg1.substr(_local2, 1);
if ((((_local3 == "!")) || ((_local3 == "|")))){
_arg1 = ((_arg1.substr(0, _local2) + " ") + _arg1.substr((_local2 + 1), (_arg1.length - (_local2 + 1))));
};
_local2++;
};
return (_arg1);
}
private function editLeft(_arg1:MouseEvent):void{
if (_arg1.ctrlKey){
leftTexture--;
if (leftTexture < 1){
leftTexture = (WallsData.TEXTURE.length - 1);
};
} else {
leftTexture++;
if (leftTexture >= WallsData.TEXTURE.length){
leftTexture = 1;
};
};
tileExemplar.setWall(getTileModel());
}
private function initHelpText():void{
helpText = new TextField();
helpText.x = 2;
helpText.y = 2;
helpText.height = 350;
helpText.width = 250;
helpText.textColor = 0xAAAAAA;
helpText.wordWrap = (helpText.multiline = true);
helpText.selectable = false;
helpText.mouseEnabled = false;
helpText.text = DEFAULT_HELP_TEXT;
helpText.filters = [new GlowFilter(0, 1, 3, 3, 2)];
addChild(helpText);
}
private function prevButton():void{
if ((currentButton - 1) < 0){
currentButton = (allButtons.length - 1);
} else {
currentButton--;
};
}
private function onStartLoad(_arg1:GameEvent):void{
if (!Main.EDITOR){
addChild(loadLevelBar);
};
}
private function setMapName():void{
createNameAlert(Localization.INSTANCE.getValue(Localization.enter_map_name));
}
private function testMap():void{
if (Main.EDITOR){
mapData.updateCurrentMap();
Main.EDITOR = false;
};
editor = true;
game.restart();
}
private function menuButton():void{
if (openGameMenu == null){
openGameMenu = new WalkerButton(initStartGame, Localization.INSTANCE.getValue(Localization.menu));
};
addChild(openGameMenu);
onResize();
}
private function onResize(_arg1:Event=null):void{
if (stage){
if (startGameMenu){
startGameMenu.x = ((stage.stageWidth / 2) - (startGameMenu.width / 2));
startGameMenu.y = ((stage.stageHeight / 2) - (startGameMenu.height / 2));
};
if (alertContainer){
alertContainer.x = ((stage.stageWidth / 2) - (alertContainer.width / 2));
alertContainer.y = ((stage.stageHeight / 2) - (alertContainer.height / 2));
};
if (openGameMenu){
openGameMenu.x = ((stage.stageWidth / 2) - (openGameMenu.width / 2));
openGameMenu.y = (stage.stageHeight - openGameMenu.height);
};
if (helpText){
helpText.y = 25;
};
if (musicWidget){
musicWidget.x = 3;
musicWidget.y = (stage.stageHeight - 55);
};
if (contains(sponsorLogo)){
sponsorLogo.x = (stage.stageWidth - sponsorLogo.width);
sponsorLogo.y = (stage.stageHeight - sponsorLogo.height);
};
};
}
private function startGame():void{
gameStarting = true;
UserInterface.INSTANCE.clear();
editorInterfase = false;
editor = false;
Main.EDITOR = false;
customLevel = false;
mapData.newGame();
game.restart();
Game.clearGame();
Main.PAUSE = false;
hideGameMenu();
menuButton();
}
private function showScores():void{
Main.PAUSE = true;
main.showScores();
}
private function setMap():void{
startGameMenu.clear();
startGameMenu.visible = true;
inputText = new WalkerInput(Localization.INSTANCE.getValue(Localization.enter_map_code), true);
startGameMenu.addChild(inputText);
startGameMenu.addChild(new WalkerButton(loadMap, Localization.INSTANCE.getValue(Localization.load_code_level)));
startGameMenu.addChild(new WalkerButton(initStartGame, Localization.INSTANCE.getValue(Localization.back)));
allButtons = startGameMenu.getButtons();
currentButton = 0;
onResize();
}
private function newMap():void{
mapData.currentMapName = "New map";
mapData.newMap(15, 15, 15);
game.startEditor();
}
private function onDropItem(_arg1:DropEvent):void{
var _local2:int;
var _local3:Point;
var _local4:Point;
_local2 = _arg1.itemType;
_local3 = new Point(mouseX, mouseY);
_local4 = this.localToGlobal(_local3);
if (tileExemplar.topWall.hitTestPoint(_local4.x, _local4.y, true)){
topTexture = _local2;
};
if (tileExemplar.leftWall.hitTestPoint(_local4.x, _local4.y, true)){
leftTexture = _local2;
};
if (tileExemplar.rightWall.hitTestPoint(_local4.x, _local4.y, true)){
rightTexture = _local2;
};
tileExemplar.setWall(getTileModel());
}
private function initUI():void{
iniListener();
initHelpText();
initStartGame();
initSoundControll();
}
private function initSoundControll():void{
musicWidget = new MusicWidget();
musicWidget.alpha = 0.8;
addChild(musicWidget);
}
private function copyTile():void{
var _local1:Point3D;
var _local2:WallsData;
_local1 = Game.getEditorTilePosition();
if (_local1 == null){
return;
};
_local2 = MapData.getValue(_local1);
if (_local2){
topTexture = WallsData.TEXTURE.indexOf(_local2.topWall);
leftTexture = WallsData.TEXTURE.indexOf(_local2.leftWall);
rightTexture = WallsData.TEXTURE.indexOf(_local2.rightWall);
tileExemplar.setWall(getTileModel());
};
}
private function createAlert(_arg1:String):void{
Main.PAUSE = true;
Game.startingTimer = false;
alertContainer = new Alert(stage, _arg1, [new CustomButton(closeAlert, Localization.INSTANCE.getValue(Localization.ok))]);
addChild(alertContainer);
onResize();
}
private function onEndAction(_arg1:KeyboardEvent):void{
}
private function hideGameMenu():void{
startGameMenu.x = 0;
startGameMenu.y = 0;
startGameMenu.hide();
}
public function createStartGame():void{
createAlert(Localization.INSTANCE.getValue(Localization.start_game));
}
private function showCreators():void{
startGameMenu.clear();
startGameMenu.visible = true;
if (creator == null){
creator = new Creator();
};
startGameMenu.addChild(creator);
startGameMenu.addChild(new WalkerButton(initStartGame, Localization.INSTANCE.getValue(Localization.back)));
allButtons = startGameMenu.getButtons();
currentButton = 0;
}
private function showMoreGames():void{
var url:String;
var request:URLRequest;
url = SponsorLogo.SPONSOR_URL;
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
};
}
private function createNameAlert(_arg1:String):void{
Main.PAUSE = true;
Game.startingTimer = false;
nameTextFileld = createInputText(mapData.currentMapName);
alertContainer = new Alert(stage, _arg1, [nameTextFileld, new CustomButton(closeAlertSetName, Localization.INSTANCE.getValue(Localization.ok))]);
addChild(alertContainer);
onResize();
}
public static function getEditingLevel():Boolean{
return (((editor) || (customLevel)));
}
public static function getTileModel(_arg1:uint=1):WallsData{
return (new WallsData(topTexture, leftTexture, rightTexture, pass, _arg1));
}
}
}//package gui
Section 20
//WalkerButton (gui.WalkerButton)
package gui {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
import flash.text.*;
import ui.*;
public class WalkerButton extends CustomButton implements IKeyAction {
public var left:Sprite;
public var right:Sprite;
protected var buttonContainer:Sprite;
public var center:Sprite;
public var buttonLabel:TextField;
protected static const DOWN:String = "down";
protected static const OVER:String = "over";
protected static const OUT:String = "out";
public function WalkerButton(_arg1:Function, _arg2:String=null){
buttonContainer = new Sprite();
addChild(buttonContainer);
super(_arg1, _arg2);
initInstance();
}
protected function stateOver():void{
buttonContainer.filters = [new BevelFilter(5, 45, 0xFFFFFF, 1, 0xFF0000, 1, 19, 19, 0.8, 2), new GlowFilter(0xFFFFFF, 1, 9, 9, 0.3, 1, true), new DropShadowFilter(3, 45, 0, 1, 3, 3, 0.2, 1)];
onResize();
}
public function select():void{
buttonContainer.transform.colorTransform = new ColorTransform(0.7, 1, 0.7);
}
override protected function setName(_arg1:String):void{
buttonLabel.text = _arg1;
buttonLabel.autoSize = TextFieldAutoSize.LEFT;
onResize();
}
protected function setState(_arg1:String):void{
switch (_arg1){
case OVER:
stateOver();
break;
case OUT:
stateOut();
break;
case DOWN:
stateDown();
break;
default:
stateOut();
};
}
override protected function drawBtn(_arg1:uint=0x999999, _arg2:uint=0):void{
}
protected function onResize(_arg1:Event=null):void{
left.x = 0;
center.x = left.width;
center.width = Math.max((((buttonLabel.textWidth + 5) - (left.width + right.width)) + 25), 0);
right.x = (center.x + center.width);
}
override protected function rollOut(_arg1:Event=null):void{
setState(OUT);
}
public function act():void{
if (action != null){
action();
};
}
public function deselect():void{
buttonContainer.transform.colorTransform = new ColorTransform();
}
protected function initInstance():void{
buttonContainer.addChild(center);
buttonContainer.addChild(right);
buttonContainer.addChild(left);
addChild(buttonLabel);
}
override protected function rollDown(_arg1:MouseEvent):void{
setState(DOWN);
}
protected function stateDown():void{
buttonContainer.filters = [new BevelFilter(5, 45, 0x990000, 1, 0xFFFFFF, 1, 19, 19, 0.8, 2), new GlowFilter(0xFFFFFF, 1, 9, 9, 0.3, 1, true), new DropShadowFilter(3, 45, 0, 1, 3, 3, 0.2, 1)];
onResize();
}
override protected function rollOver(_arg1:MouseEvent):void{
setState(OVER);
}
protected function stateOut():void{
buttonContainer.filters = [new BevelFilter(5, 45, 0xFFFFFF, 1, 0xFF, 1, 19, 19, 0.8, 2), new GlowFilter(0xFFFFFF, 1, 9, 9, 0.3, 1, true), new DropShadowFilter(3, 45, 0, 1, 3, 3, 0.2, 1)];
onResize();
}
}
}//package gui
Section 21
//WalkerInput (gui.WalkerInput)
package gui {
import flash.events.*;
import flash.display.*;
import flash.filters.*;
import flash.text.*;
public class WalkerInput extends WalkerButton {
private var defaultText:String;// = "Input text"
private var clearToSelect:Boolean;// = false
public function WalkerInput(_arg1:String=null, _arg2:Boolean=false){
defaultText = "Input text";
clearToSelect = false;
defaultText = _arg1;
clearToSelect = _arg2;
buttonContainer = new Sprite();
addChild(buttonContainer);
super(null, _arg1);
initInstance();
}
override protected function stateOver():void{
buttonContainer.filters = [new DropShadowFilter(3, 45, 0, 1, 5, 5, 1, 2, true), new GlowFilter(0xFFFFFF, 1, 9, 9, 0.3, 1, true), new DropShadowFilter(3, 45, 0, 1, 3, 3, 0.2, 1)];
}
override protected function setName(_arg1:String):void{
buttonLabel.autoSize = TextFieldAutoSize.NONE;
buttonLabel.text = _arg1;
buttonLabel.width = 200;
buttonLabel.type = TextFieldType.INPUT;
buttonLabel.selectable = true;
onResize();
buttonLabel.addEventListener(FocusEvent.FOCUS_OUT, onEditInput);
}
override protected function onResize(_arg1:Event=null):void{
left.x = 0;
center.x = left.width;
center.width = Math.max((((buttonLabel.width + 5) - (left.width + right.width)) + 15), 0);
right.x = (center.x + center.width);
}
override protected function drawBtn(_arg1:uint=0x999999, _arg2:uint=0):void{
}
override protected function rollOut(_arg1:Event=null):void{
setState(OUT);
}
override public function act():void{
stage.focus = buttonLabel;
if (clearToSelect){
buttonLabel.text = "";
};
super.act();
}
public function getText():String{
return (buttonLabel.text);
}
private function onEditInput(_arg1:FocusEvent=null):void{
setState(OUT);
if (((clearToSelect) && ((buttonLabel.text == "")))){
buttonLabel.text = defaultText;
};
}
override protected function initInstance():void{
super.initInstance();
mouseChildren = true;
buttonMode = false;
}
override protected function rollDown(_arg1:MouseEvent):void{
setState(DOWN);
}
override protected function stateDown():void{
if (clearToSelect){
buttonLabel.text = "";
};
stateOver();
}
override protected function rollOver(_arg1:MouseEvent):void{
setState(OVER);
}
override protected function stateOut():void{
buttonContainer.filters = [new DropShadowFilter(3, 45, 0, 1, 4, 4, 0.6, 2, true), new GlowFilter(0xFFFFFF, 1, 9, 9, 0.3, 1, true), new DropShadowFilter(3, 45, 0, 1, 3, 3, 0.2, 1)];
}
}
}//package gui
Section 22
//WalkerLoader (gui.WalkerLoader)
package gui {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class WalkerLoader extends Sprite {
public var bar:MovieClip;
public var loaderLabel:TextField;
public function WalkerLoader(){
loaderLabel = new TextField();
loaderLabel.width = 400;
loaderLabel.text = "";
loaderLabel.selectable = false;
loaderLabel.autoSize = TextFieldAutoSize.LEFT;
bar.stop();
addEventListener(Event.ADDED_TO_STAGE, onAddToStage);
}
protected function onResize(_arg1:Event=null):void{
x = ((stage.stageWidth / 2) - (240 / 2));
y = ((stage.stageHeight / 2) - (30 / 2));
}
protected function onRemoved(_arg1:Event):void{
destroy();
}
public function onAddToStage(_arg1:Event):void{
stage.addEventListener(Event.RESIZE, onResize);
onResize();
addEventListener(Event.REMOVED_FROM_STAGE, onRemoved);
}
public function destroy():void{
stage.removeEventListener(Event.RESIZE, onResize);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemoved);
removeEventListener(Event.ADDED_TO_STAGE, onAddToStage);
}
}
}//package gui
Section 23
//Music1 (in_fla.sound.Music1)
package in_fla.sound {
import flash.media.*;
import flash.net.*;
public class Music1 extends Sound {
public function Music1(_arg1:URLRequest=null, _arg2:SoundLoaderContext=null){
super(_arg1, _arg2);
}
}
}//package in_fla.sound
Section 24
//Music2Menu (in_fla.sound.Music2Menu)
package in_fla.sound {
import flash.media.*;
import flash.net.*;
public class Music2Menu extends Sound {
public function Music2Menu(_arg1:URLRequest=null, _arg2:SoundLoaderContext=null){
super(_arg1, _arg2);
}
}
}//package in_fla.sound
Section 25
//Music3 (in_fla.sound.Music3)
package in_fla.sound {
import flash.media.*;
import flash.net.*;
public class Music3 extends Sound {
public function Music3(_arg1:URLRequest=null, _arg2:SoundLoaderContext=null){
super(_arg1, _arg2);
}
}
}//package in_fla.sound
Section 26
//Music4 (in_fla.sound.Music4)
package in_fla.sound {
import flash.media.*;
import flash.net.*;
public class Music4 extends Sound {
public function Music4(_arg1:URLRequest=null, _arg2:SoundLoaderContext=null){
super(_arg1, _arg2);
}
}
}//package in_fla.sound
Section 27
//MusicWidget (in_fla.sound.MusicWidget)
package in_fla.sound {
import flash.events.*;
import flash.display.*;
import temp.*;
public class MusicWidget extends MovieClip {
private var volume:Boolean;
public function MusicWidget(){
initInstance();
}
public function destroy():void{
removeEventListener(MouseEvent.CLICK, onToggleVolume);
}
private function onToggleVolume(_arg1:MouseEvent):void{
if (volume){
gotoAndStop(2);
volume = false;
MusicController.INSTANCE.VOLUME = 0;
} else {
gotoAndStop(1);
volume = true;
MusicController.INSTANCE.VOLUME = MusicController.DEFAULT_VOLUME;
};
}
private function initInstance():void{
volume = true;
stop();
addEventListener(MouseEvent.CLICK, onToggleVolume);
}
}
}//package in_fla.sound
Section 28
//BackGround (in_fla.BackGround)
package in_fla {
import flash.display.*;
import temp.*;
public class BackGround extends MovieClip {
private var all_starts:Array;
private static const START_COUNT:Number = 70;
public function BackGround(){
var _local1:Number;
super();
all_starts = new Array();
_local1 = 0;
while (_local1 < START_COUNT) {
all_starts.push(addChild(new Star(((Math.random() * 360) - 180), (Math.random() * Star.MAX_LENGTH))));
_local1++;
};
}
public function onMove(_arg1:Number, _arg2:Number):void{
var _local3:Number;
var _local4:Star;
if (stage){
x = ((stage.stageWidth / 2) + (_arg1 / 8));
y = ((stage.stageHeight / 2) + (_arg2 / 8));
};
_local3 = 0;
while (_local3 < START_COUNT) {
_local4 = all_starts[_local3];
_local4.move();
_local3++;
};
}
}
}//package in_fla
Section 29
//Bonus1 (in_fla.Bonus1)
package in_fla {
import tiles.*;
import map.*;
import editor.*;
public class Bonus1 extends MapObject {
private var walls:WallsData;
public function Bonus1(_arg1:Point3D, _arg2:WallsData){
walls = _arg2;
super(_arg1);
walls.addEventListener(TileEvent.DESTROY, onDestroy);
}
private function onDestroy(_arg1:TileEvent):void{
var _local2:EditTileEvent;
_local2 = new EditTileEvent(EditTileEvent.REMOVE_TILE);
_local2.position = position;
dispatchEvent(_local2);
if (parent){
parent.removeChild(this);
};
destroy();
}
override public function destroy():void{
walls.removeEventListener(TileEvent.DESTROY, onDestroy);
super.destroy();
}
}
}//package in_fla
Section 30
//BonusHUD (in_fla.BonusHUD)
package in_fla {
import flash.display.*;
import flash.text.*;
public class BonusHUD extends Sprite {
public var mapName:TextField;
public var count:TextField;
private var maxValue:int;// = 0
public var time:TextField;
private var haveValue:int;// = 0
public function BonusHUD(){
maxValue = 0;
haveValue = 0;
super();
if (count){
updateText();
};
}
public function setMapName(_arg1:String):void{
mapName.text = _arg1;
}
public function setGameTime(_arg1:int):void{
var _local2:String;
var _local3:String;
var _local4:String;
_local2 = String((_arg1 - (int((_arg1 / 1000)) * 1000))).substr(0, 2);
_local3 = String(int(((_arg1 / 1000) / 60)));
if (_local3.length < 2){
_local3 = ("0" + _local3);
};
_local4 = String(int(((_arg1 / 1000) % 60)));
if (_local4.length < 2){
_local4 = ("0" + _local4);
};
if (_local2.length < 2){
_local2 = ("0" + _local2);
};
time.text = ((((_local3 + ":") + _local4) + ":") + _local2);
}
private function updateText():void{
count.text = ((haveValue + "/") + maxValue);
}
public function setMax(_arg1:int):void{
maxValue = _arg1;
updateText();
}
public function setHave(_arg1:int):void{
haveValue = _arg1;
updateText();
}
}
}//package in_fla
Section 31
//Creator (in_fla.Creator)
package in_fla {
import flash.display.*;
public class Creator extends Sprite {
}
}//package in_fla
Section 32
//CrushedTileAnimation (in_fla.CrushedTileAnimation)
package in_fla {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class CrushedTileAnimation extends Sprite {
public var picture:MovieClip;
private var timeAnimation:Timer;
private var frame:int;// = 1
public var animationMask:MovieClip;
public var picturebg:MovieClip;
public function CrushedTileAnimation(){
var _local1:int;
frame = 1;
super();
animationMask.gotoAndStop(frame);
_local1 = int((Math.random() * picture.totalFrames));
picture.gotoAndStop(_local1);
picturebg.gotoAndStop(_local1);
timeAnimation = new Timer(100);
timeAnimation.addEventListener(TimerEvent.TIMER, onAnimationMove);
}
private function stopAll():void{
if (timeAnimation){
timeAnimation.stop();
timeAnimation.removeEventListener(TimerEvent.TIMER, onAnimationMove);
timeAnimation = null;
};
}
public function start():void{
timeAnimation.start();
}
private function onAnimationMove(_arg1:TimerEvent):void{
if (frame == animationMask.totalFrames){
stopAll();
};
frame++;
animationMask.gotoAndStop(frame);
}
public function destroy():void{
stopAll();
}
}
}//package in_fla
Section 33
//Demo (in_fla.Demo)
package in_fla {
import flash.display.*;
public class Demo extends Sprite {
public function Demo(){
mouseChildren = (mouseEnabled = false);
}
}
}//package in_fla
Section 34
//HelpMarker (in_fla.HelpMarker)
package in_fla {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class HelpMarker extends MovieClip {
private var timer:Timer;
private var marker:Boolean;// = false
public function HelpMarker(){
marker = false;
super();
stop();
timer = new Timer(800);
timer.start();
timer.addEventListener(TimerEvent.TIMER, draw);
}
public function destroy():void{
stop();
marker = false;
if (timer){
timer.removeEventListener(TimerEvent.TIMER, death);
timer.removeEventListener(TimerEvent.TIMER, draw);
timer.stop();
timer = null;
};
if (parent){
parent.removeChild(this);
};
}
private function draw(_arg1:TimerEvent):void{
marker = true;
timer.stop();
timer.removeEventListener(TimerEvent.TIMER, draw);
alpha = 1;
play();
}
private function death(_arg1:TimerEvent):void{
if (alpha > 0){
alpha = (alpha - 0.1);
} else {
alpha = 0;
timer.stop();
destroy();
};
}
public function removeMarker():void{
if (marker){
timer = new Timer(30);
timer.start();
timer.addEventListener(TimerEvent.TIMER, death);
} else {
timer.stop();
destroy();
};
}
}
}//package in_fla
Section 35
//Lamp (in_fla.Lamp)
package in_fla {
import tiles.*;
import map.*;
public class Lamp extends MapObject {
public function Lamp(_arg1:Point3D, _arg2:WallsData=null){
super(_arg1);
objectType = TYPE_LAMP;
}
}
}//package in_fla
Section 36
//PlayerStarting (in_fla.PlayerStarting)
package in_fla {
import tiles.*;
import map.*;
public class PlayerStarting extends MapObject {
private var walls:WallsData;
public function PlayerStarting(_arg1:Point3D, _arg2:WallsData){
walls = _arg2;
super(_arg1);
}
override public function destroy():void{
super.destroy();
}
}
}//package in_fla
Section 37
//SponsorLogo (in_fla.SponsorLogo)
package in_fla {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class SponsorLogo extends Sprite {
public static const SPONSOR_URL:String = "http://www.newgrounds.com/game/";
public function SponsorLogo(){
buttonMode = true;
addEventListener(MouseEvent.CLICK, onSponsor);
}
private function onSponsor(_arg1:MouseEvent):void{
var request:URLRequest;
var event = _arg1;
Main.CHEATS = true;
request = new URLRequest(SPONSOR_URL);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
};
}
}
}//package in_fla
Section 38
//SponsorMovie (in_fla.SponsorMovie)
package in_fla {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class SponsorMovie extends MovieClip {
public var bannerBut:MovieClip;
public function SponsorMovie(){
bannerBut.buttonMode = true;
bannerBut.addEventListener(MouseEvent.CLICK, onGo);
}
private function onGo(_arg1:MouseEvent):void{
var url:String;
var request:URLRequest;
var event = _arg1;
url = SponsorLogo.SPONSOR_URL;
request = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
};
}
}
}//package in_fla
Section 39
//StartMenu (in_fla.StartMenu)
package in_fla {
import flash.events.*;
import flash.display.*;
import gui.*;
import ui.*;
public class StartMenu extends Sprite {
public var startLogo:MovieClip;
public var menu:UISprite;
private var showValue:Boolean;// = false
private var allButtons:Array;
public var menuContainer:Sprite;
public function StartMenu(){
showValue = false;
allButtons = new Array();
super();
menu = new UISprite(UISprite.BORDER, true);
menuContainer.addChild(menu);
onResize();
}
override public function addChild(_arg1:DisplayObject):DisplayObject{
menu.addChild(_arg1);
onResize();
dispatchEvent(new Event(Event.RESIZE));
if ((_arg1 as IKeyAction)){
allButtons.push(_arg1);
};
return (_arg1);
}
public function hide():void{
showValue = false;
visible = false;
}
public function getButtons():Array{
return (allButtons);
}
public function clear():void{
menu.clear();
allButtons = new Array();
visible = true;
}
private function onResize(_arg1:Event=null):void{
menuContainer.x = ((width / 2) - (menuContainer.width / 2));
}
public function show():void{
if (!showValue){
startLogo.gotoAndPlay(1);
showValue = true;
};
visible = true;
}
}
}//package in_fla
Section 40
//TileTilingData1 (in_fla.TileTilingData1)
package in_fla {
import flash.display.*;
public class TileTilingData1 extends BitmapData {
public function TileTilingData1(_arg1:int, _arg2:int, _arg3:Boolean=true, _arg4:uint=4294967295){
super(_arg1, _arg2, _arg3, _arg4);
}
}
}//package in_fla
Section 41
//TileTilingData2 (in_fla.TileTilingData2)
package in_fla {
import flash.display.*;
public class TileTilingData2 extends BitmapData {
public function TileTilingData2(_arg1:int, _arg2:int, _arg3:Boolean=true, _arg4:uint=4294967295){
super(_arg1, _arg2, _arg3, _arg4);
}
}
}//package in_fla
Section 42
//TileTilingData3 (in_fla.TileTilingData3)
package in_fla {
import flash.display.*;
public class TileTilingData3 extends BitmapData {
public function TileTilingData3(_arg1:int, _arg2:int, _arg3:Boolean=true, _arg4:uint=4294967295){
super(_arg1, _arg2, _arg3, _arg4);
}
}
}//package in_fla
Section 43
//LevelFinished (map.LevelFinished)
package map {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class LevelFinished extends Shape {
private var animationTimer:Timer;
private var step:Number;// = 0
private var callBack:Function;
private static var SCREEN_SIZE:Number = 800;
public function LevelFinished(){
step = 0;
super();
animationTimer = new Timer(50);
animationTimer.addEventListener(TimerEvent.TIMER, onUpdate);
graphics.clear();
}
private function onUpdate(_arg1:TimerEvent):void{
SCREEN_SIZE = Math.max(stage.stageWidth, stage.stageHeight);
step = (step + (((SCREEN_SIZE - step) / 5) + 2));
draw();
if (step >= SCREEN_SIZE){
animationTimer.stop();
graphics.clear();
callBack();
};
}
private function draw():void{
graphics.clear();
graphics.beginFill(0);
graphics.drawCircle(0, 0, (SCREEN_SIZE - step));
graphics.drawRect((SCREEN_SIZE / -2), (SCREEN_SIZE / -2), SCREEN_SIZE, SCREEN_SIZE);
graphics.endFill();
}
public function start(_arg1:Function):void{
callBack = _arg1;
step = 0;
animationTimer.start();
}
}
}//package map
Section 44
//MapEvent (map.MapEvent)
package map {
import flash.events.*;
public class MapEvent extends Event {
public var rotating:Boolean;
public static var ROTATING:String = "rotating";
public function MapEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function clone():Event{
var _local1:MapEvent;
_local1 = new MapEvent(type, bubbles, cancelable);
_local1.rotating = rotating;
return (_local1);
}
}
}//package map
Section 45
//MapObject (map.MapObject)
package map {
import flash.display.*;
import flash.geom.*;
import tiles.*;
import math.*;
public class MapObject extends MovieClip {
protected var position:Point3D;
private var _objectType:String;// = ""
public static const TYPE_PLAYER:String = "player";
public static const TYPE_DOOR_EXIT:String = "door_exit";
public static const TYPE_TILE:String = "tile";
public static const TYPE_CRUSHED_TILE:String = "crushed_tile";
public static const TYPE_BONUS:String = "bonus1";
public static const TYPE_LAMP:String = "light";
public function MapObject(_arg1:Point3D){
_objectType = "";
super();
position = _arg1;
move(MathUtils.toMap(position));
}
public function destroy():void{
position = null;
}
public function get objectType():String{
return (_objectType);
}
public function set objectType(_arg1:String):void{
_objectType = _arg1;
}
public function getPosition():Point3D{
return (position);
}
public function updateDraw():void{
}
public function updateInformation():void{
}
protected function move(_arg1:Point):void{
x = Math.round((_arg1.x * (Tile.SIZE * Game.SCALE)));
y = Math.round((_arg1.y * (Tile.SIZE * Game.SCALE)));
}
public function setHide():void{
}
public function show(_arg1:Number=0):void{
}
}
}//package map
Section 46
//MapObjectEvent (map.MapObjectEvent)
package map {
import flash.events.*;
public class MapObjectEvent extends Event {
public static const UPDATE_POSITION:String = "update_position";
public function MapObjectEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function clone():Event{
var _local1:MapEvent;
_local1 = new MapEvent(type, bubbles, cancelable);
return (_local1);
}
}
}//package map
Section 47
//MapVisual (map.MapVisual)
package map {
import flash.display.*;
import flash.geom.*;
import tiles.*;
import editor.*;
import math.*;
public class MapVisual extends Sprite {
private var space:Sprite;
private var rightWall:Tile;
private var roatateSpeeed:Number;// = 0
private var mapData:MapData;
private var rotating:Boolean;// = false
private var hideTiles:Array;
private var levelCurtain:LevelFinished;
private var leftWall:Tile;
private var viewType:String;
private var tempSpace:Sprite;
private var rotationValue:Number;
private var player:Player;
public static const VIEW_LEFT:String = "left";
public static const VIEW_NORMAL:String = "normal";
public static const VIEW_RIGHT:String = "right";
private static var POINT_3D:Point3D = new Point3D();
public function MapVisual(_arg1:MapData){
rotating = false;
roatateSpeeed = 0;
super();
mouseChildren = false;
mouseEnabled = false;
mapData = _arg1;
tempSpace = new Sprite();
super.addChild(tempSpace);
space = new Sprite();
super.addChild(space);
setView(VIEW_NORMAL);
levelCurtain = new LevelFinished();
super.addChild(levelCurtain);
}
override public function addChild(_arg1:DisplayObject):DisplayObject{
var _local2:int;
var _local3:MapObject;
var _local4:MapObject;
var _local5:Point3D;
var _local6:Point3D;
if (_arg1 == null){
trace("ADD NULL IN MAP:", new Error().getStackTrace());
return (null);
};
_local2 = 0;
_local3 = (_arg1 as MapObject);
if (_local3){
_local3.addEventListener(EditTileEvent.REMOVE_TILE, onDeleteTile);
_local3.addEventListener(EditTileEvent.REMOVE_TILE_DATA, onRemoveTileData);
_local5 = _local3.getPosition();
_local2 = 0;
while (_local2 < space.numChildren) {
_local4 = (space.getChildAt(_local2) as MapObject);
if (_local4){
_local6 = _local4.getPosition();
if (((_local6.x + _local6.y) + _local6.z) == ((_local5.x + _local5.y) + _local5.z)){
} else {
if ((((((_local6.x >= _local5.x)) && ((_local6.y >= _local5.y)))) && ((_local6.z >= _local5.z)))){
if (space.contains(_local3)){
if (_local2 >= space.getChildIndex(_local3)){
_local2--;
};
};
break;
};
};
};
_local2++;
};
};
return (space.addChildAt(_arg1, _local2));
}
private function onAddTile(_arg1:EditTileEvent):void{
var _local2:Tile;
dispatchEvent(_arg1);
_arg1.stopPropagation();
_local2 = (Game.getTileByCoordinates(_arg1.position) as Tile);
if (_local2){
_local2.setWall(_arg1.tileValue);
} else {
_local2 = new Tile(_arg1.position, _arg1.tileValue, Game.getLightValue());
Game.setTileByCoordinates(_arg1.position, _local2);
};
if (!space.contains(_local2)){
addChild(_local2);
};
_local2.updateDraw();
updateAllNeighbors(_arg1.position);
}
private function hideTile(_arg1:Point3D):void{
var _local2:Tile;
_local2 = (Game.getTileByCoordinates(_arg1) as Tile);
if (_local2){
_local2.hide();
hideTiles.push(_local2);
};
}
public function setPlayer(_arg1:Player):void{
player = _arg1;
addChild(player);
player.addEventListener(MapObjectEvent.UPDATE_POSITION, onUpdateChilderen);
player.addEventListener(EditTileEvent.EDIT_TILE, onUpdateTilePosition);
player.addEventListener(EditTileEvent.ADD_TILE, onAddTile);
}
public function setView(_arg1:String, _arg2:Boolean=false):void{
switch (_arg1){
case VIEW_NORMAL:
rotationValue = 0;
break;
case VIEW_RIGHT:
rotationValue = 134.5;
break;
case VIEW_LEFT:
rotationValue = -108.1;
break;
};
if (_arg2){
space.rotation = rotationValue;
tempSpace.rotation = rotationValue;
};
viewType = _arg1;
helpLight();
}
private function onDeleteTile(_arg1:EditTileEvent):void{
var _local2:MapObject;
_local2 = (Game.getTileByCoordinates(_arg1.position) as MapObject);
Game.removeTileByCoordinates(_arg1.position);
if (_local2){
_local2.removeEventListener(EditTileEvent.REMOVE_TILE, onRemoveTileData);
if (space.contains(_local2)){
space.removeChild(_local2);
};
};
}
private function startHideTileTest():void{
var _local1:Point3D;
var _local2:Tile;
if (hideTiles){
while (hideTiles.length != 0) {
_local2 = hideTiles.shift();
if (_local2){
_local2.show();
};
};
};
hideTiles = new Array();
_local1 = player.getPosition().clone3d();
_local1.z++;
hideTile(_local1);
_local1 = player.getPosition().clone3d();
_local1.y++;
hideTile(_local1);
_local1 = player.getPosition().clone3d();
_local1.x++;
hideTile(_local1);
_local1 = player.getPosition().clone3d();
_local1.x++;
_local1.y++;
hideTile(_local1);
_local1 = player.getPosition().clone3d();
_local1.z++;
_local1.y++;
hideTile(_local1);
_local1 = player.getPosition().clone3d();
_local1.z++;
_local1.x++;
hideTile(_local1);
_local1 = player.getPosition().clone3d();
_local1.z++;
_local1.y++;
_local1.x++;
hideTile(_local1);
_local1 = player.getPosition().clone3d();
_local1.z++;
_local1.y = (_local1.y + 2);
_local1.x++;
hideTile(_local1);
_local1 = player.getPosition().clone3d();
_local1.z++;
_local1.y = (_local1.y + 2);
hideTile(_local1);
_local1 = player.getPosition().clone3d();
_local1.z++;
_local1.y = (_local1.y + 2);
_local1.x = (_local1.x + 2);
hideTile(_local1);
}
public function getRotation():Number{
return (space.rotation);
}
public function clear():void{
var _local1:MapObject;
tempSpace.graphics.clear();
hideTiles = null;
while (space.numChildren > 0) {
_local1 = (space.getChildAt(0) as MapObject);
if (_local1){
_local1.destroy();
_local1.removeEventListener(EditTileEvent.REMOVE_TILE_DATA, onRemoveTileData);
_local1.removeEventListener(EditTileEvent.REMOVE_TILE, onDeleteTile);
};
space.removeChildAt(0);
};
tempSpace.graphics.clear();
if (player){
player.removeEventListener(MapObjectEvent.UPDATE_POSITION, onUpdateChilderen);
player.removeEventListener(EditTileEvent.ADD_TILE, onAddTile);
player.removeEventListener(EditTileEvent.EDIT_TILE, onUpdateTilePosition);
player = null;
};
if (!Main.EDITOR){
setView(VIEW_NORMAL, true);
};
}
private function updateNeighborhood(_arg1:Point3D):void{
var _local2:Tile;
if (!Main.EDITOR){
return;
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue((_arg1.x - 1), _arg1.y, _arg1.z)) as Tile);
if (_local2){
_local2.updateDraw();
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue((_arg1.x + 1), _arg1.y, _arg1.z)) as Tile);
if (_local2){
_local2.updateDraw();
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue(_arg1.x, (_arg1.y + 1), _arg1.z)) as Tile);
if (_local2){
_local2.updateDraw();
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue(_arg1.x, (_arg1.y - 1), _arg1.z)) as Tile);
if (_local2){
_local2.updateDraw();
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue(_arg1.x, _arg1.y, (_arg1.z + 1))) as Tile);
if (_local2){
_local2.updateDraw();
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue(_arg1.x, _arg1.y, (_arg1.z - 1))) as Tile);
if (_local2){
_local2.updateDraw();
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue(_arg1.x, _arg1.y, (_arg1.z - 2))) as Tile);
if (_local2){
_local2.updateDraw();
};
}
private function helpLight():void{
var _local1:String;
var _local2:String;
if ((((player == null)) || ((player.getPosition() == null)))){
return;
};
if (rightWall){
rightWall.removeHelpMarker();
};
if (leftWall){
leftWall.removeHelpMarker();
};
_local1 = "";
_local2 = "";
if (viewType == VIEW_NORMAL){
_local1 = WallsData.WALL_RIGHT;
_local2 = WallsData.WALL_LEFT;
leftWall = findWallX(player.getPosition().clone3d());
rightWall = findWallY(player.getPosition().clone3d());
} else {
if (viewType == VIEW_RIGHT){
_local1 = WallsData.WALL_TOP;
_local2 = WallsData.WALL_RIGHT;
leftWall = findWallZ(player.getPosition().clone3d());
rightWall = findWallX(player.getPosition().clone3d());
} else {
if (viewType == VIEW_LEFT){
_local1 = WallsData.WALL_LEFT;
_local2 = WallsData.WALL_TOP;
leftWall = findWallY(player.getPosition().clone3d());
rightWall = findWallZ(player.getPosition().clone3d());
};
};
};
if (rightWall){
rightWall.addHelpMarker(_local2);
};
if (leftWall){
leftWall.addHelpMarker(_local1);
};
}
private function onUpdateChilderen(_arg1:MapObjectEvent):void{
var _local2:MapObject;
_local2 = (_arg1.target as MapObject);
addChild(_local2);
if (_local2.objectType == MapObject.TYPE_PLAYER){
startHideTileTest();
helpLight();
};
if (Main.EDITOR){
drawTileShadow(_local2.getPosition());
};
}
private function updateAllNeighbors(_arg1:Point3D):void{
var _local2:Tile;
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue((_arg1.x - 1), _arg1.y, _arg1.z)) as Tile);
if (_local2){
_local2.updateDraw();
} else {
updateNeighborhood(POINT_3D.clone3d());
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue(_arg1.x, (_arg1.y - 1), _arg1.z)) as Tile);
if (_local2){
_local2.updateDraw();
} else {
updateNeighborhood(POINT_3D.clone3d());
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue(_arg1.x, _arg1.y, (_arg1.z - 1))) as Tile);
if (_local2){
_local2.updateDraw();
} else {
updateNeighborhood(POINT_3D.clone3d());
};
if (!Main.EDITOR){
return;
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue(_arg1.x, (_arg1.y + 1), _arg1.z)) as Tile);
if (_local2){
_local2.updateDraw();
} else {
updateNeighborhood(POINT_3D.clone3d());
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue((_arg1.x + 1), _arg1.y, _arg1.z)) as Tile);
if (_local2){
_local2.updateDraw();
} else {
updateNeighborhood(POINT_3D.clone3d());
};
_local2 = (Game.getTileByCoordinates(POINT_3D.setValue(_arg1.x, _arg1.y, (_arg1.z + 1))) as Tile);
if (_local2){
_local2.updateDraw();
} else {
updateNeighborhood(POINT_3D.clone3d());
};
}
private function findWallX(_arg1:Point3D):Tile{
var _local2:Tile;
var _local3:uint;
_local2 = null;
_local3 = 0;
while (_local3 < 15) {
_arg1.x--;
_local2 = (Game.getTileByCoordinates(_arg1) as Tile);
if (_local2){
break;
};
_local3++;
};
return (_local2);
}
private function findWallY(_arg1:Point3D):Tile{
var _local2:Tile;
var _local3:uint;
_local2 = null;
_local3 = 0;
while (_local3 < 15) {
_arg1.y--;
_local2 = (Game.getTileByCoordinates(_arg1) as Tile);
if (_local2){
break;
};
_local3++;
};
return (_local2);
}
private function findWallZ(_arg1:Point3D):Tile{
var _local2:Tile;
var _local3:uint;
_local2 = null;
_local3 = 0;
while (_local3 < 15) {
_arg1.z--;
_local2 = (Game.getTileByCoordinates(_arg1) as Tile);
if (_local2){
break;
};
_local3++;
};
return (_local2);
}
private function onUpdateTilePosition(_arg1:EditTileEvent):void{
updateAllNeighbors(_arg1.position);
}
private function updateCam():void{
var _local1:Point;
var _local2:Rectangle;
if (((Game.startingGamingProcess) && (!((player == null))))){
_local1 = globalToLocal(player.localToGlobal(new Point()));
_local1.x = Math.floor(_local1.x);
_local1.y = Math.floor(_local1.y);
scaleX = (scaleY = 1.25);
x = Math.floor(((stage.stageWidth / 2) - (_local1.x * scaleX)));
y = Math.floor(((stage.stageHeight / 2) - (_local1.y * scaleY)));
} else {
scaleX = (scaleY = 1);
_local2 = this.getBounds(space);
if (_local2.width == 0){
_local2.x = 0;
};
if (_local2.height == 0){
_local2.y = 0;
};
x = (x + Math.round((((((stage.stageWidth / 2) - (_local2.width / 2)) - _local2.x) - x) / 5)));
y = (y + Math.round((((((stage.stageHeight / 2) - (_local2.height / 2)) - _local2.y) - y) / 5)));
if (width > height){
width = (width + Math.round(((stage.stageWidth - (width * 2)) / 10)));
scaleY = scaleX;
} else {
height = (height + Math.round(((stage.stageHeight - (height * 2)) / 10)));
scaleX = scaleY;
};
};
}
public function drawLevelSize():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Point;
_local1 = mapData.xLength();
_local2 = mapData.yLength();
_local3 = mapData.zLength();
_local4 = -10;
_local5 = 5;
_local6 = 0;
tempSpace.graphics.lineStyle(2, 0xFF0000);
_local7 = MathUtils.toMap(POINT_3D.setValue(_local4, _local5, _local6));
tempSpace.graphics.moveTo(_local7.x, _local7.y);
_local7 = MathUtils.toMap(POINT_3D.setValue(((Tile.SIZE * _local1) + _local4), _local5, _local6));
tempSpace.graphics.lineTo(_local7.x, _local7.y);
tempSpace.graphics.lineStyle(2, 0xFF00);
_local7 = MathUtils.toMap(POINT_3D.setValue(_local4, _local5, _local6));
tempSpace.graphics.moveTo(_local7.x, _local7.y);
_local7 = MathUtils.toMap(POINT_3D.setValue(_local4, ((Tile.SIZE * _local2) + _local5), _local6));
tempSpace.graphics.lineTo(_local7.x, _local7.y);
tempSpace.graphics.lineStyle(2, 0xFF);
_local7 = MathUtils.toMap(POINT_3D.setValue(_local4, _local5, _local6));
tempSpace.graphics.moveTo(_local7.x, _local7.y);
_local7 = MathUtils.toMap(POINT_3D.setValue(_local4, _local5, ((Tile.SIZE * _local3) + _local6)));
tempSpace.graphics.lineTo(_local7.x, _local7.y);
}
public function update():void{
var _local1:Number;
var _local2:Number;
var _local3:Boolean;
var _local4:MapEvent;
_local1 = space.rotation;
if (_local1 < 0){
_local1 = (_local1 + 360);
};
if (rotationValue < 0){
rotationValue = (rotationValue + 360);
};
_local2 = (rotationValue - _local1);
_local3 = true;
if (_local2 > 180){
_local2 = (_local2 - 360);
} else {
if (_local2 < -180){
_local2 = (_local2 + 360);
};
};
if (roatateSpeeed == 0){
roatateSpeeed = (_local2 / 10);
};
if (Math.abs((_local2 / 3.5)) > 0.1){
space.rotation = (space.rotation + (_local2 / 3.5));
tempSpace.rotation = (tempSpace.rotation + (_local2 / 3.5));
} else {
_local3 = false;
roatateSpeeed = 0;
space.rotation = rotationValue;
tempSpace.rotation = rotationValue;
};
updateCam();
if (rotating != _local3){
rotating = _local3;
if (Main.DEBUG >= 2){
trace(("rotating last value:" + rotating), viewType);
};
_local4 = new MapEvent(MapEvent.ROTATING);
_local4.rotating = rotating;
dispatchEvent(_local4);
if (rotating){
stage.quality = StageQuality.LOW;
} else {
stage.quality = StageQuality.HIGH;
};
};
}
public function drawTileShadow(_arg1:Point3D):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Point;
_local2 = _arg1.x;
_local3 = _arg1.y;
_local4 = _arg1.z;
_local5 = -10;
_local6 = 5;
_local7 = 0;
tempSpace.graphics.clear();
tempSpace.graphics.lineStyle(1, 0xAAAAAA);
tempSpace.graphics.beginFill(0xFFFFFF, 0.2);
_local8 = MathUtils.toMap(POINT_3D.setValue(((Tile.SIZE * _local2) + _local5), _local6, ((Tile.SIZE * _local4) + _local7)));
tempSpace.graphics.moveTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(((Tile.SIZE * (_local2 + 1)) + _local5), _local6, ((Tile.SIZE * _local4) + _local7)));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(((Tile.SIZE * (_local2 + 1)) + _local5), _local6, ((Tile.SIZE * (_local4 + 1)) + _local7)));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(((Tile.SIZE * _local2) + _local5), _local6, ((Tile.SIZE * (_local4 + 1)) + _local7)));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(((Tile.SIZE * _local2) + _local5), _local6, ((Tile.SIZE * _local4) + _local7)));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
tempSpace.graphics.endFill();
tempSpace.graphics.lineStyle(1, 0xAAAAAA);
tempSpace.graphics.beginFill(0xFFFFFF, 0.2);
_local8 = MathUtils.toMap(POINT_3D.setValue(_local5, ((Tile.SIZE * _local3) + _local6), ((Tile.SIZE * _local4) + _local7)));
tempSpace.graphics.moveTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(_local5, ((Tile.SIZE * (_local3 + 1)) + _local6), ((Tile.SIZE * _local4) + _local7)));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(_local5, ((Tile.SIZE * (_local3 + 1)) + _local6), ((Tile.SIZE * (_local4 + 1)) + _local7)));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(_local5, ((Tile.SIZE * _local3) + _local6), ((Tile.SIZE * (_local4 + 1)) + _local7)));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(_local5, ((Tile.SIZE * _local3) + _local6), ((Tile.SIZE * _local4) + _local7)));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
tempSpace.graphics.endFill();
tempSpace.graphics.lineStyle(1, 0xAAAAAA);
tempSpace.graphics.beginFill(0xFFFFFF, 0.2);
_local8 = MathUtils.toMap(POINT_3D.setValue(((Tile.SIZE * _local2) + _local5), ((Tile.SIZE * _local3) + _local6), _local7));
tempSpace.graphics.moveTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(((Tile.SIZE * _local2) + _local5), ((Tile.SIZE * (_local3 + 1)) + _local6), _local7));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(((Tile.SIZE * (_local2 + 1)) + _local5), ((Tile.SIZE * (_local3 + 1)) + _local6), _local7));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(((Tile.SIZE * (_local2 + 1)) + _local5), ((Tile.SIZE * _local3) + _local6), _local7));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
_local8 = MathUtils.toMap(POINT_3D.setValue(((Tile.SIZE * _local2) + _local5), ((Tile.SIZE * _local3) + _local6), _local7));
tempSpace.graphics.lineTo(_local8.x, _local8.y);
tempSpace.graphics.endFill();
drawLevelSize();
}
public function startEndLevelAnimation(_arg1:Function):void{
var _local2:Point;
if (((player) && (player.parent))){
super.addChild(levelCurtain);
_local2 = levelCurtain.parent.globalToLocal(player.parent.localToGlobal(new Point(player.x, player.y)));
levelCurtain.x = _local2.x;
levelCurtain.y = (_local2.y - 25);
levelCurtain.start(_arg1);
};
}
private function onRemoveTileData(_arg1:EditTileEvent):void{
var _local2:MapObject;
_local2 = (Game.getTileByCoordinates(_arg1.position) as MapObject);
if (_local2){
dispatchEvent(_arg1);
_local2.removeEventListener(EditTileEvent.REMOVE_TILE_DATA, onRemoveTileData);
if (space.contains(_local2)){
updateAllNeighbors(_local2.getPosition());
};
};
}
public function destroy():void{
clear();
}
}
}//package map
Section 48
//MathUtils (math.MathUtils)
package math {
import flash.display.*;
import flash.geom.*;
import tiles.*;
public class MathUtils {
public static function toMap(_arg1:Point3D):Point{
var _local2:Point;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = new Point();
_local3 = ((30 * Math.PI) / 180);
_local4 = Math.cos(_local3);
_local5 = Math.sin(_local3);
_local2.x = (_local4 * _arg1.x);
_local2.y = ((_local5 * _arg1.x) / 1.758);
_local3 = ((120 * Math.PI) / 180);
_local4 = Math.cos(_local3);
_local5 = Math.sin(_local3);
_local2.x = (_local2.x + (_local4 * _arg1.y));
_local2.y = (_local2.y + ((_local5 * _arg1.y) / 1.758));
_local3 = ((-90 * Math.PI) / 180);
_local4 = Math.cos(_local3);
_local5 = Math.sin(_local3);
_local2.x = (_local2.x + (_local4 * _arg1.z));
_local2.y = (_local2.y + ((_local5 * _arg1.z) / 1.22));
return (_local2);
}
public static function drawTile(_arg1:Graphics, _arg2:Point3D):void{
var _local3:Point;
_arg1.lineStyle(2, 0xFF0000);
_local3 = toMap(_arg2);
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(Tile.SIZE, 0, 0));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(2, 0xFF00);
_local3 = toMap(new Point3D());
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(0, Tile.SIZE, 0));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(2, 0xFF);
_local3 = toMap(new Point3D());
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(0, 0, Tile.SIZE));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(1, 0);
_local3 = toMap(new Point3D(0, Tile.SIZE, 0));
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(0, Tile.SIZE, Tile.SIZE));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(1, 0);
_local3 = toMap(new Point3D(0, 0, Tile.SIZE));
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(0, Tile.SIZE, Tile.SIZE));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(1, 0);
_local3 = toMap(new Point3D(0, Tile.SIZE, 0));
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(0, Tile.SIZE, Tile.SIZE));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(1, 0);
_local3 = toMap(new Point3D(Tile.SIZE, 0, Tile.SIZE));
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(Tile.SIZE, Tile.SIZE, Tile.SIZE));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(1, 0);
_local3 = toMap(new Point3D(Tile.SIZE, Tile.SIZE, 0));
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(Tile.SIZE, Tile.SIZE, Tile.SIZE));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(1, 0);
_local3 = toMap(new Point3D(0, Tile.SIZE, Tile.SIZE));
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(Tile.SIZE, Tile.SIZE, Tile.SIZE));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(1, 0);
_local3 = toMap(new Point3D(0, Tile.SIZE, 0));
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(Tile.SIZE, Tile.SIZE, 0));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(1, 0);
_local3 = toMap(new Point3D(Tile.SIZE, Tile.SIZE, 0));
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(Tile.SIZE, 0, 0));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(1, 0);
_local3 = toMap(new Point3D(Tile.SIZE, 0, 0));
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(Tile.SIZE, 0, Tile.SIZE));
_arg1.lineTo(_local3.x, _local3.y);
_arg1.lineStyle(1, 0);
_local3 = toMap(new Point3D(Tile.SIZE, 0, Tile.SIZE));
_arg1.moveTo(_local3.x, _local3.y);
_local3 = toMap(new Point3D(0, 0, Tile.SIZE));
_arg1.lineTo(_local3.x, _local3.y);
}
}
}//package math
Section 49
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("3.0 as3");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (_local2);
};
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package mochi.as3
Section 50
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function reencode():void{
var _local1:uint;
_local1 = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String;
_local1 = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function get value():Number{
return (Number(this.toString()));
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String;
_local3 = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 51
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi.as3
Section 52
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__ms_";
private static var _servicesURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
public static var netup:Boolean = true;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local3:Array;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:MovieClip;
var _local8:LocalConnection;
var _local9:String;
var _local10:ByteArray;
var _local11:ByteArray;
var _local12:uint;
var _local13:uint;
var _local14:Loader;
_local3 = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
_local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
_local6 = [0, 64, 0, 0, 0];
_local7 = new MovieClip();
_local8 = new LocalConnection();
_local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().getTime()));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
_local10 = new ByteArray();
_local11 = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
_local12 = ((_local3.length + _local11.length) + 4);
_local13 = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
vars = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
var _local2:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
_local2 = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.0");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
public static function get id():String{
return (_id);
}
private static function urlOptions(_arg1:Object):Object{
var _local2:Object;
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
_local2 = {};
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_listenChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
trace("connected!");
_connecting = false;
_connected = true;
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var vars:URLVariables;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(clip).servicesURL != undefined){
_servicesURL = urlOptions(clip).servicesURL;
};
MochiServices.allowDomains(_servicesURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor((Math.random() * 99999))));
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_servicesURL);
vars = new URLVariables();
vars.listenLC = _listenChannelName;
vars.mochiad_options = clip.loaderInfo.parameters.mochiad_options;
if (widget){
vars.widget = true;
};
req.data = vars;
listen();
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function get clip():Object{
return (_container);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 53
//FinishContainer (mochi.FinishContainer)
package mochi {
import gui.*;
public class FinishContainer extends ModalSprite {
public function startFinish(_arg1:Function):void{
_arg1();
}
}
}//package mochi
Section 54
//MochiBanner (mochi.MochiBanner)
package mochi {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public dynamic class MochiBanner extends MovieClip {
public function MochiBanner(_arg1:Rectangle){
mouseEnabled = false;
drawScreenSize(_arg1);
addEventListener(Event.ADDED_TO_STAGE, addBannerConta);
addEventListener(Event.REMOVED_FROM_STAGE, removedBannerConta);
}
private function removedBannerConta(_arg1:Event):void{
stage.removeEventListener(Event.RESIZE, onResize);
removeEventListener(Event.RESIZE, onResize);
}
override public function addChild(_arg1:DisplayObject):DisplayObject{
super.addChild(_arg1);
onResize();
return (_arg1);
}
private function addBannerConta(_arg1:Event):void{
addEventListener(Event.RESIZE, onResize);
stage.addEventListener(Event.RESIZE, onResize);
onResize();
}
public function onResize(_arg1:Event=null):void{
if (stage){
x = int(((stage.stageWidth / 2) - (width / 2)));
y = int(((stage.stageHeight / 2) - (height / 2)));
};
}
public function drawScreenSize(_arg1:Rectangle):void{
graphics.clear();
graphics.lineStyle(1, 0xFF0000, 0);
graphics.drawRect(_arg1.x, _arg1.y, _arg1.width, _arg1.height);
onResize();
}
}
}//package mochi
Section 55
//ScoresContainer (mochi.ScoresContainer)
package mochi {
import flash.geom.*;
import mochi.as3.*;
public dynamic class ScoresContainer extends MochiBanner {
private var playerName:String;
public var score:MochiDigits;
private var main:Main;
public function ScoresContainer(_arg1:Rectangle, _arg2:Main){
main = _arg2;
super(_arg1);
}
override public function stop():void{
trace("STOP!");
main.openScore();
super.stop();
}
override public function play():void{
trace("PLAY!");
main.closeScore();
super.play();
}
public function initScores():void{
MochiScores.setBoardID(Main.LEADERBOARD_ID);
playerName = "";
score = new MochiDigits();
}
}
}//package mochi
Section 56
//EventLocalization (temp.EventLocalization)
package temp {
import flash.events.*;
public class EventLocalization extends Event {
public static var UPDATE:String = "update_localization";
public function EventLocalization(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
}
}//package temp
Section 57
//Localization (temp.Localization)
package temp {
import flash.events.*;
import flash.system.*;
public class Localization extends EventDispatcher {
private var currentLocalization:Object;
public static var SUBJECT_EDITOR:String = "editor";
public static var target_1:String = "target_1";
public static var target_2:String = "target_2";
public static var editor_control:String = "editor_control";
public static var enter_map_name:String = "enter_map_name";
public static var tab_tile:String = "tab_tile";
public static var SUBJECT_GAME_MENU:String = "game_menu";
public static var INSTANCE:Localization = new (Localization);
;
public static var label_control:String = "label_control";
public static var LOCALIZATION:Object = new Object();
public static var test_light:String = "test_light";
public static var load_code_level:String = "load_code_level";
public static var creator:String = "creator";
public static var start_game:String = "start_game";
public static var to_editor:String = "to_editor";
public static var test_map:String = "test_map";
public static var LOCAL_RU:String = "data/ru.xml";
public static var get_map_code:String = "get_map_code";
public static var label_target:String = "label_target";
public static var new_map:String = "new_map";
public static var editor_exit:String = "editor_exit";
public static var return_in_game:String = "return_in_game";
public static var default_name:String = "default_name";
public static var LOCAL_ENG:String = "data/en.xml";
public static var top_scores:String = "top_scores";
public static var SUBJECT_GAME_TOOTOR:String = "game_tootor";
public static var control_1:String = "control_1";
public static var control_2:String = "control_2";
public static var control_3:String = "control_3";
public static var more_games:String = "more_games";
public static var control_4:String = "control_4";
public static var ok:String = "ok";
public static var menu:String = "menu";
public static var LEVEL:String = "level_";
public static var back:String = "back";
public static var start_editor:String = "start_editor";
public static var tab_editor:String = "tab_editor";
public static var start_custom_level:String = "start_custom_level";
public static var enter_map_code:String = "enter_map_code";
public static var map_copy:String = "map_copy";
public function Localization(){
if (INSTANCE != null){
throw (new Error("This class is singletone"));
};
trace("*** INIT_LOCALIZATION ***");
LOCALIZATION[LOCAL_RU] = <localization auther="NOVUS" language="RUS">
<!--
Правила:
Использовать сочитание символов "\n" для переноса.
Для написания кавычек в нутри текста использовать символ "'" (оденарная кавычка).
Названия атребутов НЕ переводить (значение до "=") и оставлять пробел в конце каждой строки!
Также HE переводить название тэгов (слова начинающиеся с "<...").
Игровое меню :
-->
<game_menu start_game="НАЧАТЬ ИГРУ" start_editor="ЗАГРУЗИТЬ РЕДАКТОР" start_custom_level="ЗАГРУЗИТЬ КОД УРОВНЯ" return_in_game="ВЕРНУТЬСЯ В ИГРУ" top_scores="ЛУЧШИЕ РЕЗУЛЬТАТЫ" more_games="БОЛЬШЕ ИГР" creator="СОЗДАТЕЛЬ" back="ВЕРНУТЬСЯ В МЕНЮ" menu="МЕНЮ" load_code_level="ЗАГРУЗИТЬ УРОВЕНЬ" enter_map_code="КОД УРОВНЯ"/>
<!--
Меню редактора:
-->
<editor editor_control="Управление:
W, A, S, D, UP, DOWN — Движение
ENTER — Тест карты
Z — Старт игрока
X — Выход с уровня
C — COPY TILE
B — Добавить звезду
L — Добавить свет
L — Сломанный тайл
SPACE — Поставить тайл
SHIFT — Удалить тайл" tab_editor="Редактор" tab_tile="Тайлик" to_editor="Перейти в редактор" new_map="Новая карта" get_map_code="Получить код карты" test_map="Тест уровня" test_light="Свет" editor_exit="Выйти из редактора" enter_map_name="Введите название карты:" default_name="Новая карта" ok="ОК" map_copy="Карта скопирована в буфер обмена!"/>
<!--
Обучение:
-->
<game_tootor label_target="Задачи:" label_control="Управление:" target_1="Найти выход с уровня!" target_2="Чтобы открыть дверь, нужно собрать все зведы!" control_1="W — Движение верх
A — Движение влево
S — Движение вниз
D — Движение вправо" control_2="СТРЕЛКА ВПРАВО - Поворачивает карту по часовой стрелке" control_3="СТРЕЛКА ВЛЕВО - Поворачивает карту против часовой стрелки" control_4="Для начала уровня нажмите 'ENTER'"/>
<!--
Уровни:
-->
<game_levels level_1="Что за ...?" level_2="Бег по стенам" level_3="Камни на дороге" level_4="Путаница" level_5="Каменные ленты" level_6="Влево, вправо... устал" level_7="Прыжок в траву" level_8="Баррикада" level_9="Долгий путь домой" level_10="Город мозга" level_11="Мегаполис" level_12="Лес" level_13="Движение вверх" level_14="Высокий старт" level_15="В поисках звезд" level_16="Замок" level_17="Два пути" level_18="Руины" level_19="Негорбатая гора" level_20="Финал" level_21="Очень секретное место" level_22="Мистические пути" level_23="Тюрьма из стен"/>
</localization>
;
LOCALIZATION[LOCAL_ENG] = <localization auther="Knell" language="ENG">
<!--
Rules:
Use symbol combination "\n" for line break
If you want to put quotes in text use symbol "'" (single quote)
Do not translate attribute's names (before "=") you must also space at the end of each string
Do not translate tag's names (words after "<...")
Game menu:
-->
<game_menu start_game="START GAME" start_editor="LOAD EDITOR" start_custom_level="ENTER LEVEL ID" back="BACK TO MENU" menu="MENU" return_in_game="BACK TO GAME" top_scores="TOP SCORES" more_games="MORE GAMES" creator="CREATOR" load_code_level="LOAD LEVEL" enter_map_code="LEVEL ID"/>
<!--
Editor menu:
-->
<editor editor_control="CONTROLS:
W, A, S, D, UP, DOWN — move buttons
ENTER — Test map
Z — Start point
X — Level exit
C — Copy tile
B — Add star
L — Add light
N — Crushed tile
SPACE — Set tile
SHIFT — Remove tile" tab_editor="Editor" tab_tile="Tile" to_editor="Back to editor" new_map="New map" get_map_code="Get map id" test_map="Test map" test_light="Light" editor_exit="Exit" enter_map_name="Enter map name:" default_name="New map" ok="Оk" map_copy="Map was buffered!"/>
<!--
Tutorial:
-->
<game_tootor label_target="Tasks:" label_control="Controls:" target_1="Find the door to escape!" target_2="To open the door you must collect all stars!" control_1="W — Moove upward
A — Moove left
S — Moove downward
D — Moove right" control_2="RIGHT ARROW - Turn map clockwise" control_3="LEFT ARROW - Turn map counterclockwise" control_4="To start game press 'ENTER'"/>
<!--
Levels:
-->
<game_levels level_1="What a f...?" level_2="Running walls" level_3="Bricks on your road" level_4="Street mash" level_5="Stone stripes" level_6="Left, right... tired" level_7="Jump to the grass" level_8="Barricade" level_9="Long way home" level_10="Brain city" level_11="Megapolis" level_12="Wood" level_13="Mooving up" level_14="High start" level_15="Starseeker" level_16="Castle" level_17="Two ways" level_18="Ruines" level_19="No-Brokeback Mountain" level_20="Final" level_21="Very secret place" level_22="Mistic roads" level_23="Wallprison"/>
</localization>
;
if (Capabilities.language == "ru"){
setLanguage(LOCAL_RU);
} else {
setLanguage(LOCAL_ENG);
};
}
public function getValue(_arg1:String):String{
if (currentLocalization[_arg1]){
return (currentLocalization[_arg1]);
};
return ("");
}
private function parsLocalization(_arg1:XML):void{
var _local2:XML;
var _local3:uint;
var _local4:String;
var _local5:String;
currentLocalization = new Object();
for each (_local2 in _arg1.children()) {
_local3 = 0;
while (_local3 < _local2.attributes().length()) {
_local4 = String(_local2.attributes()[_local3].name());
_local5 = String(_local2.attributes()[_local3]);
currentLocalization[_local4] = _local5;
_local3++;
};
};
}
public function setLanguage(_arg1:String):void{
var _local2:XML;
if (LOCALIZATION[_arg1] != null){
_local2 = LOCALIZATION[_arg1];
parsLocalization(_local2);
dispatchEvent(new EventLocalization(EventLocalization.UPDATE));
};
}
}
}//package temp
Section 58
//MusicController (temp.MusicController)
package temp {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import in_fla.sound.*;
public class MusicController {
private var oldChenal:SoundChannel;
private var sndTransform:SoundTransform;
private var noFastTimer:Timer;
private var allTracks:Array;
private var upVolume:Timer;
private var currentChenal:SoundChannel;
private var playingId:String;// = ""
private var nextMusic:Boolean;// = true
public static const DEFAULT_VOLUME:Number = 0.5;
private static var _VOLUME:Number = 0.5;
public static var MUSIC_2_MENU:String = "music2menu";
public static var INSTANCE:MusicController = new (MusicController);
;
public static var MUSIC_1:String = "music1";
public static var MUSIC_3:String = "music3";
public static var MUSIC_4:String = "music4";
public function MusicController(){
playingId = "";
nextMusic = true;
super();
if (INSTANCE != null){
throw (new Error("This class is singletone"));
};
trace("*** INIT_MUSIC_CONTROLLER ***");
allTracks = new Array();
sndTransform = new SoundTransform(0, 0);
noFastTimer = new Timer(10000);
noFastTimer.addEventListener(TimerEvent.TIMER, onNextMusicReady);
upVolume = new Timer(50);
upVolume.addEventListener(TimerEvent.TIMER, onUpVolume);
}
private function onUpVolume(_arg1:TimerEvent):void{
if (oldChenal){
sndTransform.volume = oldChenal.soundTransform.volume;
if (sndTransform.volume > 0){
sndTransform.volume = (sndTransform.volume - 0.03);
} else {
sndTransform.volume = 0;
};
oldChenal.soundTransform = sndTransform;
};
sndTransform.volume = currentChenal.soundTransform.volume;
sndTransform.volume = (sndTransform.volume + 0.02);
if (sndTransform.volume >= VOLUME){
sndTransform.volume = VOLUME;
upVolume.stop();
};
currentChenal.soundTransform = sndTransform;
}
private function onNextMusicReady(_arg1:TimerEvent):void{
noFastTimer.stop();
nextMusic = true;
}
public function get VOLUME():Number{
return (_VOLUME);
}
private function stopOldChenal():void{
oldChenal.stop();
oldChenal = null;
}
private function playerGo(_arg1:Sound):void{
if (currentChenal != null){
if (oldChenal != null){
stopOldChenal();
};
oldChenal = currentChenal;
};
currentChenal = _arg1.play(0, 999999, new SoundTransform(0, 0));
upVolume.start();
}
public function play(_arg1:String):void{
if (allTracks.length == 0){
allTracks.push(new Music1());
allTracks.push(new Music2Menu());
allTracks.push(new Music3());
allTracks.push(new Music4());
};
if (_arg1 == MUSIC_2_MENU){
nextMusic = true;
};
if (((!(nextMusic)) || ((playingId == _arg1)))){
return;
};
noFastTimer.start();
nextMusic = false;
switch (_arg1){
case MUSIC_1:
playerGo(allTracks[0]);
break;
case MUSIC_2_MENU:
nextMusic = true;
playerGo(allTracks[1]);
break;
case MUSIC_3:
playerGo(allTracks[2]);
break;
case MUSIC_4:
playerGo(allTracks[3]);
break;
default:
return;
};
playingId = _arg1;
}
public function set VOLUME(_arg1:Number):void{
sndTransform.volume = _arg1;
currentChenal.soundTransform = sndTransform;
_VOLUME = _arg1;
}
public static function getVolume():Number{
return (_VOLUME);
}
}
}//package temp
Section 59
//SoundController (temp.SoundController)
package temp {
import flash.media.*;
import flash.utils.*;
public class SoundController {
private static const START_CRUSH:Array = ["StartCrush1", "StartCrush2", "StartCrush3"];
private static const STEPS:Array = ["Step1", "Step2", "Step3"];
private static const STAR_SOUND:Array = ["StarSound"];
private static const CRUSHED_TILE:Array = ["CrushedTile1", "CrushedTile2"];
public static var SOUND_VOLUME:Number = 0.75;
private static var soundInstances:Object = new Object();
public function SoundController(_arg1:String){
var soundTransform:SoundTransform;
var itemClass:Object;
var sound:Sound;
var soundClass = _arg1;
super();
if (soundInstances[soundClass] == null){
try {
itemClass = getDefinitionByName(soundClass);
} catch(e:Error) {
itemClass = null;
};
if (((itemClass) && ((itemClass is Class)))){
sound = (new (itemClass) as Sound);
};
soundInstances[soundClass] = sound;
} else {
sound = (soundInstances[soundClass] as Sound);
};
soundTransform = new SoundTransform(SOUND_VOLUME, 0);
sound.play(0, 0, soundTransform);
}
public static function stap():void{
new SoundController(STEPS[int((STEPS.length * Math.random()))]);
}
public static function star():void{
new SoundController(STAR_SOUND[int((STAR_SOUND.length * Math.random()))]);
}
public static function сrushTile():void{
new SoundController(CRUSHED_TILE[int((CRUSHED_TILE.length * Math.random()))]);
}
public static function startCrush():void{
new SoundController(START_CRUSH[int((START_CRUSH.length * Math.random()))]);
}
}
}//package temp
Section 60
//SponsorAnimation (temp.SponsorAnimation)
package temp {
import flash.events.*;
import flash.display.*;
import in_fla.*;
public class SponsorAnimation extends Sprite {
private var sponsorMovie:SponsorMovie;
public function SponsorAnimation(){
addEventListener(Event.ADDED_TO_STAGE, onAddAnimation);
}
private function onDestroy(_arg1:Event=null):void{
if (stage){
stage.removeEventListener(Event.RESIZE, onResize);
};
if (sponsorMovie){
sponsorMovie.stop();
if (contains(sponsorMovie)){
removeChild(sponsorMovie);
};
};
removeEventListener(Event.REMOVED_FROM_STAGE, onDestroy);
}
private function onAddAnimation(_arg1:Event):void{
initInstance();
removeEventListener(Event.ADDED_TO_STAGE, onAddAnimation);
addEventListener(Event.REMOVED_FROM_STAGE, onDestroy);
stage.addEventListener(Event.RESIZE, onResize);
}
private function onEndMove(_arg1:Event):void{
dispatchEvent(new Event(Event.COMPLETE));
startCrush();
}
private function onResize(_arg1:Event=null):void{
if (sponsorMovie){
sponsorMovie.x = ((stage.stageWidth / 2) - (sponsorMovie.width / 2));
sponsorMovie.y = ((stage.stageHeight / 2) - (sponsorMovie.height / 2));
};
}
private function startCrush():void{
onDestroy();
}
private function initInstance():void{
sponsorMovie = new SponsorMovie();
sponsorMovie.addEventListener("remove_animation", onEndMove);
addChild(sponsorMovie);
onResize();
}
}
}//package temp
Section 61
//Star (temp.Star)
package temp {
import flash.display.*;
public class Star extends Shape {
private var dir:Number;// = 0
private var position:Number;
private var randomSpeed:Number;
public static const MAX_LENGTH:Number = 500;
public function Star(_arg1:Number, _arg2:Number){
dir = 0;
super();
dir = _arg1;
position = _arg2;
randomSpeed = ((Math.random() * 5) + 1);
moveTo();
graphics.beginFill(0xFFFFFF);
graphics.drawRect(0, 0, 1, 1);
graphics.endFill();
}
private function moveTo():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = ((dir * Math.PI) / 180);
_local2 = Math.cos(_local1);
_local3 = Math.sin(_local1);
x = (_local2 * position);
y = (_local3 * position);
}
public function move():void{
position = (position + (((position / 1500) + 0.1) * randomSpeed));
scaleX = (scaleY = (position / (MAX_LENGTH / 3)));
if (position > MAX_LENGTH){
position = 0;
scaleX = (scaleY = 0);
};
moveTo();
}
}
}//package temp
Section 62
//CrushedTile (tiles.CrushedTile)
package tiles {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import editor.*;
import temp.*;
import flash.utils.*;
import in_fla.*;
public class CrushedTile extends Tile {
private var crusheStarted:Boolean;// = false
private var leftAnimation:CrushedTileAnimation;
private var allParticle:Array;
private var animationTile:Timer;
private var lifeTimer:Timer;
private var topAnimation:CrushedTileAnimation;
private var countDetals:int;// = 0
private var remover:Boolean;// = false
private var rightAnimation:CrushedTileAnimation;
private static const COUNT_PARTICLE:uint = 20;
public function CrushedTile(_arg1:Point3D, _arg2:WallsData, _arg3:Array=null){
crusheStarted = false;
countDetals = 0;
remover = false;
setCrushAttributes();
super(_arg1, _arg2, _arg3);
lifeTimer = new Timer(1000);
lifeTimer.addEventListener(TimerEvent.TIMER, onCrush);
animationTile = new Timer(30);
animationTile.addEventListener(TimerEvent.TIMER, onAction);
}
override public function destroy():void{
var _local1:TileParticle;
crusheStarted = true;
if (lifeTimer){
lifeTimer.stop();
lifeTimer.removeEventListener(TimerEvent.TIMER, onCrush);
lifeTimer = null;
};
if (animationTile){
animationTile.stop();
animationTile.removeEventListener(TimerEvent.TIMER, onAction);
animationTile = null;
};
if (allParticle){
while (allParticle.length) {
_local1 = allParticle.shift();
_local1.removeEventListener(Event.REMOVED, onRemoved);
_local1.destroy();
this.removeChild(_local1);
};
};
topAnimation.destroy();
leftAnimation.destroy();
rightAnimation.destroy();
super.destroy();
}
private function onAction(_arg1:TimerEvent):void{
if (remover){
updateDestroy();
} else {
scaleX = (1 + (Math.random() / 35));
scaleY = (1 + (Math.random() / 40));
};
}
private function onCrush(_arg1:TimerEvent):void{
var _local2:EditTileEvent;
_local2 = new EditTileEvent(EditTileEvent.REMOVE_TILE_DATA, true);
_local2.position = position;
dispatchEvent(_local2);
lifeTimer.stop();
initCrushTile();
}
override protected function cashe(_arg1:TileWall):void{
if (!remover){
if (_arg1 == topWall){
topWall.addChild(topAnimation);
};
if (_arg1 == leftWall){
leftWall.addChild(leftAnimation);
};
if (_arg1 == rightWall){
rightWall.addChild(rightAnimation);
};
};
super.cashe(_arg1);
}
public function startCrush():void{
if (!crusheStarted){
crusheStarted = true;
lifeTimer.start();
animationTile.start();
topWall.addChild(topAnimation);
rightWall.addChild(rightAnimation);
leftWall.addChild(leftAnimation);
topAnimation.start();
leftAnimation.start();
rightAnimation.start();
SoundController.startCrush();
};
}
private function setCrushAttributes():void{
topAnimation = new CrushedTileAnimation();
rightAnimation = new CrushedTileAnimation();
leftAnimation = new CrushedTileAnimation();
}
private function clearTile():void{
while (this.numChildren) {
this.removeChild(this.getChildAt(0));
};
}
private function onRemoved(_arg1:Event):void{
countDetals--;
if (countDetals == 0){
remover = false;
onKill();
};
}
private function initCrushTile():void{
var _local1:Rectangle;
var _local2:BitmapData;
var _local3:Matrix;
var _local4:uint;
var _local5:uint;
var _local6:Point3D;
var _local7:TileParticle;
remover = true;
drawAllFace = true;
updateDraw();
SoundController.сrushTile();
_local1 = this.getBounds(null);
_local2 = new BitmapData(Math.min(250, (_local1.width + (TileParticle.RANDOMIZE * 2))), Math.min(250, (_local1.height + (TileParticle.RANDOMIZE * 2))), true, 0);
_local3 = new Matrix();
_local3.translate(-(_local1.x), -(_local1.y));
_local2.draw(this, _local3);
clearTile();
allParticle = new Array();
_local4 = 10;
while (_local4 < _local1.height) {
_local5 = 10;
while (_local5 < _local1.width) {
_local3 = new Matrix();
_local3.translate(-(_local5), -(_local4));
_local6 = position.clone3d();
position.clone3d().z = (_local6.z + ((((position.z * Tile.SIZE) + 1) + (((_local1.height - _local4) / _local1.height) * Tile.SIZE)) - 10));
_local7 = new TileParticle(_local2, _local3, _local6);
_local7.x = (_local5 + _local1.x);
_local7.y = (_local4 + _local1.y);
_local7.addEventListener(Event.REMOVED, onRemoved);
this.addChild(_local7);
allParticle.push(_local7);
countDetals++;
_local5 = (_local5 + COUNT_PARTICLE);
};
_local4 = (_local4 + COUNT_PARTICLE);
};
}
private function onKill():void{
var _local1:EditTileEvent;
_local1 = new EditTileEvent(EditTileEvent.REMOVE_TILE, false);
_local1.position = position;
dispatchEvent(_local1);
destroy();
}
public function updateDestroy():void{
var _local1:uint;
var _local2:TileParticle;
_local1 = 0;
while (_local1 < allParticle.length) {
_local2 = allParticle[_local1];
_local2.update();
_local1++;
};
}
}
}//package tiles
Section 63
//EditorTile (tiles.EditorTile)
package tiles {
public class EditorTile extends Tile {
public function EditorTile(_arg1:Point3D, _arg2:WallsData=null){
super(_arg1, _arg2);
}
override public function setWall(_arg1:WallsData):void{
super.setWall(_arg1);
rightWall.setWall();
leftWall.setWall();
topWall.setWall();
}
override protected function initTile(_arg1:WallsData):void{
setWall(_arg1);
}
}
}//package tiles
Section 64
//LightData (tiles.LightData)
package tiles {
public class LightData {
public var position:Point3D;
public var strenght:Number;
public function LightData(_arg1:Point3D, _arg2:Number=3){
position = _arg1;
strenght = _arg2;
}
public function get y():Number{
return (position.y);
}
public function set x(_arg1:Number):void{
position.x = _arg1;
}
public function set z(_arg1:Number):void{
position.z = _arg1;
}
public function get x():Number{
return (position.x);
}
public function get z():Number{
return (position.z);
}
public function set y(_arg1:Number):void{
position.y = _arg1;
}
}
}//package tiles
Section 65
//Tile (tiles.Tile)
package tiles {
import flash.events.*;
import flash.display.*;
import flash.filters.*;
import map.*;
import flash.text.*;
import flash.utils.*;
import math.*;
public class Tile extends MapObject {
private var timerHelpMarker:Timer;
public var rightWall:TileWall;
private var timer:Timer;
private var hlpText:TextField;
public var leftWall:TileWall;
private var showSpeed:Number;
protected var drawAllFace:Boolean;// = false
private var mapVisual:MapVisual;
public var topWall:TileWall;
private var lightData:Array;
private static const DEFAULT_SHOW_SPEED:Number = 0.2;
public static var SIZE:Number = 60;
public function Tile(_arg1:Point3D, _arg2:WallsData, _arg3:Array=null){
drawAllFace = false;
lightData = _arg3;
super(_arg1);
initTile(_arg2);
}
private function upDateCache(_arg1:MapEvent):void{
cacheAsBitmap = !(_arg1.rotating);
}
private function shadow():void{
}
private function onHideAct(_arg1:TimerEvent):void{
if (timer){
if (alpha > 0.4){
alpha = (alpha - 0.04);
} else {
alpha = 0.4;
timer.stop();
};
};
}
public function setWall(_arg1:WallsData):void{
if (_arg1 == null){
_arg1 = new WallsData();
};
topWall.setWallData(_arg1.topWall, Game.getShadowTransform(WallsData.WALL_TOP));
rightWall.setWallData(_arg1.rightWall, Game.getShadowTransform(WallsData.WALL_RIGHT));
leftWall.setWallData(_arg1.leftWall, Game.getShadowTransform(WallsData.WALL_LEFT));
}
protected function wallTestRight():void{
var _local1:WallsData;
var _local2:Array;
_local1 = MapData.getValue(new Point3D((position.x + 1), position.y, position.z));
if (((((!(drawAllFace)) && (!((_local1 == null))))) && ((_local1.pass == false)))){
rightWall.visible = false;
} else {
rightWall.setWall();
_local2 = new Array();
_local2.push(MapData.getValue(new Point3D(position.x, (position.y - 1), position.z)));
_local2.push(MapData.getValue(new Point3D(position.x, position.y, (position.z - 1))));
_local2.push(MapData.getValue(new Point3D(position.x, (position.y + 1), position.z)));
_local2.push(MapData.getValue(new Point3D(position.x, position.y, (position.z + 1))));
rightWall.setTilingData(_local2, WallsData.WALL_RIGHT);
_local2 = new Array();
_local2.push(MapData.getValuePass(new Point3D(position.x, (position.y - 1), position.z)));
_local2.push(MapData.getValuePass(new Point3D(position.x, position.y, (position.z - 1))));
_local2.push(MapData.getValuePass(new Point3D(position.x, (position.y + 1), position.z)));
_local2.push(MapData.getValuePass(new Point3D(position.x, position.y, (position.z + 1))));
rightWall.setLightData(_local2);
_local2 = new Array();
_local2.push(MapData.getValuePass(new Point3D((position.x + 1), (position.y - 1), position.z)));
_local2.push(MapData.getValuePass(new Point3D((position.x + 1), position.y, (position.z - 1))));
_local2.push(MapData.getValuePass(new Point3D((position.x + 1), (position.y + 1), position.z)));
_local2.push(MapData.getValuePass(new Point3D((position.x + 1), position.y, (position.z + 1))));
_local2.push(MapData.getValuePass(new Point3D((position.x + 1), position.y, (position.z + 1))));
_local2.push(MapData.getValuePass(new Point3D((position.x + 1), position.y, (position.z + 2))));
rightWall.setShadowData(_local2);
if (lightData){
rightWall.setLight(getLight(WallsData.WALL_RIGHT, lightData));
};
cashe(rightWall);
};
}
protected function wallTestTop():void{
var _local1:WallsData;
var _local2:Array;
_local1 = MapData.getValue(new Point3D(position.x, position.y, (position.z + 1)));
if (((((!(drawAllFace)) && (!((_local1 == null))))) && ((_local1.pass == false)))){
topWall.visible = false;
} else {
topWall.setWall();
_local2 = new Array();
_local2.push(MapData.getValue(new Point3D((position.x + 1), position.y, position.z)));
_local2.push(MapData.getValue(new Point3D(position.x, (position.y + 1), position.z)));
_local2.push(MapData.getValue(new Point3D((position.x - 1), position.y, position.z)));
_local2.push(MapData.getValue(new Point3D(position.x, (position.y - 1), position.z)));
topWall.setTilingData(_local2, WallsData.WALL_TOP);
_local2 = new Array();
_local2.push(MapData.getValuePass(new Point3D((position.x + 1), position.y, position.z)));
_local2.push(MapData.getValuePass(new Point3D(position.x, (position.y + 1), position.z)));
_local2.push(MapData.getValuePass(new Point3D((position.x - 1), position.y, position.z)));
_local2.push(MapData.getValuePass(new Point3D(position.x, (position.y - 1), position.z)));
topWall.setLightData(_local2);
_local2 = new Array();
_local2.push(MapData.getValuePass(new Point3D((position.x + 1), position.y, (position.z + 1))));
_local2.push(MapData.getValuePass(new Point3D(position.x, (position.y + 1), (position.z + 1))));
_local2.push(MapData.getValuePass(new Point3D((position.x - 1), position.y, (position.z + 1))));
_local2.push(MapData.getValuePass(new Point3D(position.x, (position.y - 1), (position.z + 1))));
_local2.push(MapData.getValuePass(new Point3D(position.x, position.y, (position.z + 2))));
_local2.push(MapData.getValuePass(new Point3D(position.x, position.y, (position.z + 3))));
topWall.setShadowData(_local2);
if (lightData){
topWall.setLight(getLight(WallsData.WALL_TOP, lightData));
};
cashe(topWall);
};
}
private function debug():void{
if (Main.DEBUG >= 4){
alpha = 0.4;
} else {
if (Main.DEBUG >= 3){
hlpText = new TextField();
hlpText.text = ((((position.x + " ") + position.y) + " ") + position.z);
hlpText.x = (-(SIZE) / 3);
hlpText.y = (-(SIZE) / 2);
hlpText.selectable = false;
hlpText.mouseEnabled = false;
hlpText.filters = [new GlowFilter(0xFFFFFF, 1, 2, 2, 4, 1)];
addChild(hlpText);
};
};
}
public function drawPass(_arg1:Sprite):void{
if (topWall.visible){
topWall.drawPass(_arg1);
};
}
private function onShowAct(_arg1:TimerEvent):void{
if (alpha < 1){
alpha = (alpha + showSpeed);
} else {
alpha = 1;
timer.stop();
};
}
public function removeHelpMarker():void{
rightWall.removeMarker();
leftWall.removeMarker();
topWall.removeMarker();
}
protected function cashe(_arg1:TileWall):void{
_arg1.cashe();
}
private function getLight(_arg1:String, _arg2:Array):Array{
var _local3:Array;
var _local4:uint;
var _local5:LightData;
var _local6:Number;
var _local7:Point3D;
var _local8:Point3D;
_local3 = new Array();
if (_arg2){
_local4 = 0;
while (_local4 < _arg2.length) {
_local5 = _arg2[_local4];
_local6 = _local5.strenght;
if (!validateLight(_local5, ((_local6 / 2) + 1))){
} else {
_local7 = _local5.position;
_local8 = new Point3D();
switch (_arg1){
case WallsData.WALL_TOP:
_local8.x = (((_local7.x - position.x) * Tile.SIZE) + (Tile.SIZE / 2));
_local8.y = (((_local7.y - position.y) * Tile.SIZE) + (Tile.SIZE / 2));
_local8.z = (((_local7.z - position.z) * Tile.SIZE) - (Tile.SIZE / 2));
break;
case WallsData.WALL_LEFT:
_local8.x = (((_local7.x - position.x) * Tile.SIZE) + (Tile.SIZE / 2));
_local8.y = ((_local7.z - position.z) * -(Tile.SIZE));
_local8.z = (((_local7.y - position.y) * Tile.SIZE) - (Tile.SIZE / 2));
break;
case WallsData.WALL_RIGHT:
_local8.x = ((_local7.y - position.y) * -(Tile.SIZE));
_local8.y = ((_local7.z - position.z) * -(Tile.SIZE));
_local8.z = (((_local7.x - position.x) * Tile.SIZE) - (Tile.SIZE / 2));
break;
};
if (_local8.z < 0){
} else {
_local3.push(new LightData(_local8, _local6));
};
};
_local4++;
};
};
return (_local3);
}
private function validateLight(_arg1:LightData, _arg2:Number):Boolean{
return ((((((Math.abs((_arg1.y - position.y)) <= _arg2)) && ((Math.abs((_arg1.x - position.x)) <= _arg2)))) && ((Math.abs((_arg1.z - position.z)) <= _arg2))));
}
override public function updateDraw():void{
visible = true;
topWall.visible = true;
leftWall.visible = true;
rightWall.visible = true;
wallTestTop();
wallTestRight();
wallTestLeft();
visibleTileTest();
}
public function addHelpMarker(_arg1:String):void{
if (_arg1 == WallsData.WALL_LEFT){
leftWall.setMarker();
} else {
if (_arg1 == WallsData.WALL_RIGHT){
rightWall.setMarker();
} else {
if (_arg1 == WallsData.WALL_TOP){
topWall.setMarker();
};
};
};
}
public function hide():void{
timer.start();
timer.removeEventListener(TimerEvent.TIMER, onShowAct);
timer.addEventListener(TimerEvent.TIMER, onHideAct);
}
override public function updateInformation():void{
if (Main.DEBUG >= 3){
hlpText.text = ((((((position.x + " ") + position.y) + " ") + position.z) + "\n") + parent.getChildIndex(this));
};
}
protected function wallTestLeft():void{
var _local1:WallsData;
var _local2:Array;
_local1 = MapData.getValue(new Point3D(position.x, (position.y + 1), position.z));
if (((((!(drawAllFace)) && (!((_local1 == null))))) && ((_local1.pass == false)))){
leftWall.visible = false;
} else {
leftWall.setWall();
_local2 = new Array();
_local2.push(MapData.getValue(new Point3D((position.x + 1), position.y, position.z)));
_local2.push(MapData.getValue(new Point3D(position.x, position.y, (position.z - 1))));
_local2.push(MapData.getValue(new Point3D((position.x - 1), position.y, position.z)));
_local2.push(MapData.getValue(new Point3D(position.x, position.y, (position.z + 1))));
leftWall.setTilingData(_local2, WallsData.WALL_LEFT);
_local2 = new Array();
_local2.push(MapData.getValuePass(new Point3D((position.x + 1), position.y, position.z)));
_local2.push(MapData.getValuePass(new Point3D(position.x, position.y, (position.z - 1))));
_local2.push(MapData.getValuePass(new Point3D((position.x - 1), position.y, position.z)));
_local2.push(MapData.getValuePass(new Point3D(position.x, position.y, (position.z + 1))));
leftWall.setLightData(_local2);
_local2 = new Array();
_local2.push(MapData.getValuePass(new Point3D((position.x + 1), (position.y + 1), position.z)));
_local2.push(MapData.getValuePass(new Point3D(position.x, (position.y + 1), (position.z - 1))));
_local2.push(MapData.getValuePass(new Point3D((position.x - 1), (position.y + 1), position.z)));
_local2.push(MapData.getValuePass(new Point3D(position.x, (position.y + 1), (position.z + 1))));
_local2.push(MapData.getValuePass(new Point3D(position.x, (position.y + 1), (position.z + 1))));
_local2.push(MapData.getValuePass(new Point3D(position.x, (position.y + 1), (position.z + 2))));
leftWall.setShadowData(_local2);
if (lightData){
leftWall.setLight(getLight(WallsData.WALL_LEFT, lightData));
};
cashe(leftWall);
};
}
override public function setHide():void{
alpha = 0;
}
protected function initTile(_arg1:WallsData):void{
timer = new Timer(50);
timerHelpMarker = new Timer(2000);
if (Main.DEBUG >= 5){
MathUtils.drawTile(graphics, new Point3D());
topWall.alpha = 0.4;
leftWall.alpha = 0.4;
rightWall.alpha = 0.4;
return;
};
setWall(_arg1);
updateDraw();
debug();
if (visible){
shadow();
mapVisual = Game.getMapVisual();
mapVisual.addEventListener(MapEvent.ROTATING, upDateCache);
cacheAsBitmap = true;
};
}
private function visibleTileTest():void{
if (((((leftWall) && (rightWall))) && (topWall))){
if (((((!(rightWall.visible)) && (!(leftWall.visible)))) && (!(topWall.visible)))){
visible = false;
return;
};
};
}
override public function destroy():void{
if (mapVisual){
mapVisual.removeEventListener(MapEvent.ROTATING, upDateCache);
mapVisual = null;
};
if (timer){
timer.stop();
timer.removeEventListener(TimerEvent.TIMER, onHideAct);
timer.removeEventListener(TimerEvent.TIMER, onShowAct);
timer = null;
};
}
override public function show(_arg1:Number=0):void{
if (timer){
if (_arg1 == 0){
showSpeed = DEFAULT_SHOW_SPEED;
} else {
showSpeed = _arg1;
};
timer.start();
timer.removeEventListener(TimerEvent.TIMER, onHideAct);
timer.addEventListener(TimerEvent.TIMER, onShowAct);
};
}
}
}//package tiles
Section 66
//TileEvent (tiles.TileEvent)
package tiles {
import flash.events.*;
public class TileEvent extends Event {
public static var DESTROY:String = "destroy";
public function TileEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
}
}//package tiles
Section 67
//TileParticle (tiles.TileParticle)
package tiles {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import math.*;
public class TileParticle extends Shape {
private var speedY:Number;// = 0
private var position:Point3D;
private var rotationSpeed:Number;
private var positionInMap:Point3D;
private var speed:Point3D;
private var gravity:Number;// = 0.07
private var removed:Boolean;// = false
private var pictureMatrix:Matrix;
private var speedX:Number;// = 0
private var speedZ:Number;// = 0
public static const RANDOMIZE:int = 5;
public function TileParticle(_arg1:BitmapData, _arg2:Matrix=null, _arg3:Point3D=null){
speedZ = 0;
speedX = 0;
speedY = 0;
gravity = 0.07;
removed = false;
super();
pictureMatrix = _arg2;
position = _arg3;
pictureMatrix.translate(0, 0);
graphics.beginBitmapFill(_arg1, pictureMatrix, false);
graphics.moveTo((-10 + random()), (-10 + random()));
graphics.lineTo((0 + random()), (-13 + random()));
graphics.lineTo((10 + random()), (-10 + random()));
graphics.lineTo((13 + random()), (0 + random()));
graphics.lineTo((10 + random()), (10 + random()));
graphics.lineTo((0 + random()), (13 + random()));
graphics.lineTo((-10 + random()), (10 + random()));
graphics.lineTo((-13 + random()), (0 + random()));
graphics.lineTo((-10 + random()), (-10 + random()));
graphics.endFill();
rotationSpeed = ((0.5 - Math.random()) * 10);
speedY = ((0.5 - Math.random()) * 2);
speedX = ((0.5 - Math.random()) * 2);
speedZ = (5 - (Math.random() * 3));
alpha = (alpha + ((Math.random() * 2) + 1.5));
speed = new Point3D();
positionInMap = _arg3.clone3d();
}
public function destroy():void{
removed = true;
}
private function random():Number{
return (((Math.random() * RANDOMIZE) - (RANDOMIZE / 2)));
}
public function update():void{
var _local1:WallsData;
var _local2:Point;
if (!removed){
alpha = (alpha - 0.1);
if ((((scaleX > 0)) && ((alpha > 0)))){
positionInMap.z = int((position.z / Tile.SIZE));
_local1 = MapData.getValue(positionInMap);
if ((((_local1 == null)) || (_local1.pass))){
rotation = (rotation + rotationSpeed);
speedY = (speedY * gravity);
speedZ = (speedZ + gravity);
position.z = (position.z - speedZ);
position.x = (position.x + (speedX / 4));
position.y = (position.y + (speedY / 4));
speed.x = speedX;
speed.y = speedY;
speed.z = -(speedZ);
_local2 = MathUtils.toMap(speed);
y = (y + _local2.y);
x = (x + _local2.x);
};
} else {
removed = true;
dispatchEvent(new Event(Event.REMOVED));
alpha = 0;
scaleY = (scaleX = (scaleX - 0));
return;
};
};
}
}
}//package tiles
Section 68
//TileWall (tiles.TileWall)
package tiles {
import flash.display.*;
import flash.geom.*;
import map.*;
import filters.*;
import in_fla.*;
public class TileWall extends MovieClip {
private var lightLenght:Number;
private var shadowColorTransform:ColorTransform;
private var wallBitmap:Bitmap;
private var wallData:BitmapData;
private var wallTextureType:String;
private var helpMarker:HelpMarker;
public function setShadowData(_arg1:Array):void{
var _local2:DisplayObject;
var _local3:Shape;
if (Main.EDITOR){
return;
};
stop();
gotoAndStop(_arg1.join(""));
if (_arg1[0] == 1){
_local2 = new WallShadow();
_local2.rotation = 180;
_local2.x = _local2.height;
_local2.y = _local2.height;
_local2.alpha = 0.6;
_local2.blendMode = BlendMode.SUBTRACT;
addChild(_local2);
};
if (_arg1[1] == 1){
_local2 = new WallShadow();
_local2.rotation = -90;
_local2.y = _local2.width;
_local2.alpha = 0.6;
_local2.blendMode = BlendMode.SUBTRACT;
addChild(_local2);
};
if (_arg1[2] == 1){
_local2 = new WallShadow();
_local2.alpha = 0.6;
_local2.blendMode = BlendMode.SUBTRACT;
addChild(_local2);
};
if (_arg1[3] == 1){
_local2 = new WallShadow();
_local2.rotation = 90;
_local2.x = _local2.width;
_local2.alpha = 0.6;
_local2.blendMode = BlendMode.SUBTRACT;
addChild(_local2);
};
if (_arg1[4] == 1){
_local3 = new Shape();
_local3.graphics.beginFill(0, 0.15);
_local3.graphics.drawRect(0, 0, 50, 50);
_local3.graphics.endFill();
addChild(_local3);
};
if (_arg1[5] == 1){
_local3 = new Shape();
_local3.graphics.beginFill(0, 0.08);
_local3.graphics.drawRect(0, 0, 50, 50);
_local3.graphics.endFill();
addChild(_local3);
};
}
public function setWallData(_arg1:String, _arg2:ColorTransform=null):void{
shadowColorTransform = _arg2;
if (shadowColorTransform == null){
shadowColorTransform = new ColorTransform();
};
wallTextureType = _arg1;
}
private function validate(_arg1:WallsData):Boolean{
if (_arg1 == null){
return (false);
};
if ((((_arg1.type == MapObject.TYPE_TILE)) || ((_arg1.type == MapObject.TYPE_CRUSHED_TILE)))){
return (true);
};
return (false);
}
public function setMarker():void{
if (helpMarker){
helpMarker.removeMarker();
};
helpMarker = new HelpMarker();
addChild(helpMarker);
}
public function setTilingData(_arg1:Array, _arg2:String):void{
var _local3:int;
var _local4:Bitmap;
var _local5:WallsData;
var _local6:String;
var _local7:Bitmap;
var _local8:Matrix;
_local3 = WallsData.getTilengTexture(wallTextureType);
if (_local3 != -1){
_local5 = _arg1[0];
if (validate(_local5)){
_local6 = _local5.getWallTexture(_arg2);
if (WallsData.getTilengTexture(_local6) < _local3){
_local4 = new Bitmap(getTileingPic(1));
_local8 = new Matrix();
_local8.rotate((180 * (Math.PI / 180)));
_local8.translate(_local4.width, _local4.height);
_local7 = getTileBitmap(_local4, _local8, _local6);
addChild(_local7);
};
};
_local5 = _arg1[1];
if (validate(_local5)){
_local6 = _local5.getWallTexture(_arg2);
if (WallsData.getTilengTexture(_local6) < _local3){
_local4 = new Bitmap(getTileingPic(2));
_local8 = new Matrix();
_local8.rotate((-90 * (Math.PI / 180)));
_local8.translate(0, _local4.width);
_local7 = getTileBitmap(_local4, _local8, _local6);
addChild(_local7);
};
};
_local5 = _arg1[2];
if (validate(_local5)){
_local6 = _local5.getWallTexture(_arg2);
if (WallsData.getTilengTexture(_local6) < _local3){
_local4 = new Bitmap(getTileingPic(3));
_local8 = new Matrix();
_local7 = getTileBitmap(_local4, _local8, _local6);
addChild(_local7);
};
};
_local5 = _arg1[3];
if (validate(_local5)){
_local6 = _local5.getWallTexture(_arg2);
if (WallsData.getTilengTexture(_local6) < _local3){
_local4 = new Bitmap(getTileingPic(4));
_local8 = new Matrix();
_local8.rotate((90 * (Math.PI / 180)));
_local8.translate(_local4.width, 0);
_local7 = getTileBitmap(_local4, _local8, _local6);
addChild(_local7);
};
};
};
}
public function setWall():void{
var _local1:BitmapData;
var _local2:Sprite;
var _local3:Bitmap;
clear();
if ((((wallTextureType == "0")) || ((wallTextureType == null)))){
_local2 = new Sprite();
_local2.graphics.beginFill(0x666666);
_local2.graphics.drawRect(0, 0, 50, 50);
addChild(_local2);
return;
};
_local1 = WallsData.getWall(wallTextureType);
if (_local1){
_local3 = new Bitmap(_local1);
addChild(_local3);
};
}
public function drawPass(_arg1:Sprite):void{
var _local2:Point;
var _local3:Shape;
var _local4:Matrix;
_local2 = wallBitmap.globalToLocal(_arg1.localToGlobal(new Point(0, 0)));
_local3 = new Shape();
_local3.graphics.beginFill(0x666666, 1);
_local3.graphics.drawCircle(0, 0, 2);
_local4 = new Matrix();
_local4.translate(int(_local2.x), int(_local2.y));
wallData.draw(_local3, _local4);
}
private function getTileingPic(_arg1:int):BitmapData{
var _local2:int;
var _local3:Tile;
var _local4:Point3D;
_local2 = 1;
_local3 = (parent as Tile);
if (_local3){
_local4 = _local3.getPosition();
_local2 = (Math.abs(((((((_local4.x + (_local4.y * 3)) + (_local4.z * 5)) + wallTextureType.length) + Math.floor(x)) + Math.floor(y)) + _arg1)) % 3);
};
if (_local2 == 1){
return (new TileTilingData3(50, 50));
};
if (_local2 == 2){
return (new TileTilingData2(50, 50));
};
return (new TileTilingData1(50, 50));
}
private function getTileBitmap(_arg1:Bitmap, _arg2:Matrix, _arg3:String):Bitmap{
var _local4:BitmapData;
var _local5:BitmapData;
if ((((_arg3 == "0")) || ((_arg3 == null)))){
return (new Bitmap(new BitmapData(50, 50, false, 0xFF0000)));
};
_local4 = WallsData.getWall(_arg3);
if (_local4){
_local5 = new BitmapData(50, 50, true);
_local5.draw(_local4);
_local5.draw(_arg1, _arg2, null, BlendMode.ALPHA);
};
return (new Bitmap(_local5));
}
private function clear():void{
while (numChildren != 0) {
removeChildAt(0);
};
}
public function setLightData(_arg1:Array):void{
var _local2:WallShadow;
stop();
gotoAndStop(_arg1.join(""));
if (_arg1[0] == 0){
_local2 = new WallShadow();
_local2.rotation = 180;
_local2.x = _local2.height;
_local2.y = _local2.height;
_local2.blendMode = BlendMode.OVERLAY;
addChild(_local2);
};
if (_arg1[1] == 0){
_local2 = new WallShadow();
_local2.rotation = -90;
_local2.y = _local2.width;
_local2.blendMode = BlendMode.OVERLAY;
addChild(_local2);
};
if (_arg1[2] == 0){
_local2 = new WallShadow();
_local2.blendMode = BlendMode.OVERLAY;
addChild(_local2);
};
if (_arg1[3] == 0){
_local2 = new WallShadow();
_local2.rotation = 90;
_local2.x = _local2.width;
_local2.blendMode = BlendMode.OVERLAY;
addChild(_local2);
};
}
public function setLight(_arg1:Array):void{
var _local2:Bitmap;
var _local3:int;
var _local4:LightData;
var _local5:Number;
var _local6:BitmapData;
var _local7:BitmapData;
_local2 = new Bitmap(new BitmapData(50, 50, false, 0));
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1[_local3];
lightLenght = (_local4.strenght * Tile.SIZE);
_local5 = (1.3 - (_local4.z / (Tile.SIZE * _local4.strenght)));
_local4.z = Math.min(_local5, Math.max((_local4.z / 10), 0));
_local7 = WallsData.getWall((wallTextureType + "Normal"));
if (_local7){
_local6 = BumpFilter.getBumpLightPoint(_local7, new Point(_local4.x, _local4.y), _local4.z, 10);
} else {
_local6 = BumpFilter.getBumpLightPoint(new BitmapData(50, 50, false, 8947967), new Point(_local4.x, _local4.y), _local4.z, 10);
};
_local2.bitmapData.draw(new Bitmap(_local6), null, new ColorTransform(_local5, _local5, _local5), BlendMode.ADD);
_local3++;
};
_local2.blendMode = BlendMode.MULTIPLY;
if (Game.light){
_local2.alpha = 0.5;
} else {
_local2.alpha = 0;
};
addChild(_local2);
}
public function removeMarker():void{
if (helpMarker){
helpMarker.removeMarker();
};
helpMarker = null;
}
public function cashe():void{
var _local1:Rectangle;
var _local2:Matrix;
if (Main.EDITOR){
return;
};
_local1 = getBounds(this);
wallData = new BitmapData(Math.round(_local1.width), Math.round(_local1.height), true, 0);
_local2 = new Matrix();
wallData.draw(this, _local2, shadowColorTransform);
wallBitmap = new Bitmap(wallData);
clear();
addChild(wallBitmap);
}
}
}//package tiles
Section 69
//WallsData (tiles.WallsData)
package tiles {
import flash.events.*;
import flash.display.*;
import map.*;
import flash.utils.*;
public class WallsData extends EventDispatcher {
public var pass:Boolean;
public var rightWall:String;
public var leftWall:String;
public var type:String;
public var topWall:String;
public static const WALL_TOP:String = "top";
public static const SAND:String = "Sand";
public static const STONE:String = "Stone";
public static const WALL_RIGHT:String = "right";
public static const GRASS:String = "Grass";
public static const TYPES:Array = [0, MapObject.TYPE_TILE, MapObject.TYPE_PLAYER, MapObject.TYPE_DOOR_EXIT, MapObject.TYPE_BONUS, MapObject.TYPE_LAMP, MapObject.TYPE_CRUSHED_TILE];
public static const WALL_LEFT:String = "left";
public static const MAP_CHAR_DELATA:uint = 35;
public static const DOOR_RIGHT:String = "DoorRight";
public static const TEXTURE_TILING:Array = ["Texture1", SAND, GRASS, "Ground1", "Ground2", "Ground3"];
public static const DOOR_LEFT:String = "DoorLeft";
public static const TEXTURE:Array = [0, SAND, STONE, GRASS, DOOR_LEFT, DOOR_RIGHT, "BorderOldWall1", "Floor1", "Ground1", "Ground2", "Stone2", "StoneWall2", "Wall1", "Wall2", "Wall3", "Wall4", "Floor2", "Brick1", "Wood1", "Texture1", "Ground3", "Ornament1", "OldWall1", "OldWall2", "OldWall3"];
public function WallsData(_arg1:uint=1, _arg2:uint=2, _arg3:uint=2, _arg4:uint=0, _arg5:uint=1){
type = MapObject.TYPE_TILE;
super();
topWall = getValue(TEXTURE, _arg1);
leftWall = getValue(TEXTURE, _arg2);
rightWall = getValue(TEXTURE, _arg3);
pass = (_arg4 == 1);
type = getValue(TYPES, _arg5);
}
private function getValue(_arg1:Array, _arg2:int):String{
return (_arg1[(_arg2 % _arg1.length)]);
}
public function destroy():void{
dispatchEvent(new TileEvent(TileEvent.DESTROY));
}
public function getWallTexture(_arg1:String):String{
switch (_arg1){
case WALL_RIGHT:
return (rightWall);
case WALL_LEFT:
return (leftWall);
default:
return (topWall);
};
}
public function getWallData():String{
return (((((((((("" + String.fromCharCode((MAP_CHAR_DELATA + TEXTURE.indexOf(topWall)))) + "") + String.fromCharCode((MAP_CHAR_DELATA + TEXTURE.indexOf(leftWall)))) + "") + String.fromCharCode((MAP_CHAR_DELATA + TEXTURE.indexOf(rightWall)))) + "") + Number(pass)) + "") + String.fromCharCode((MAP_CHAR_DELATA + TYPES.indexOf(type)))));
}
override public function toString():String{
return ((((((("WallData(top:" + topWall) + ", left:") + leftWall) + ", right:") + rightWall) + ")"));
}
public static function getWall(_arg1:String):BitmapData{
var itemClass:Object;
var pic:BitmapData;
var bitmapDataName = _arg1;
try {
itemClass = getDefinitionByName(bitmapDataName);
} catch(e:Error) {
itemClass = null;
};
if (((((itemClass) && ((itemClass is Class)))) && ((getQualifiedSuperclassName(itemClass) == "flash.display::BitmapData")))){
pic = (new itemClass(50, 50) as BitmapData);
};
return (pic);
}
public static function getTilengTexture(_arg1:String):int{
return (TEXTURE_TILING.indexOf(_arg1));
}
}
}//package tiles
Section 70
//CustomButton (ui.CustomButton)
package ui {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class CustomButton extends Sprite {
protected var action:Function;
private var enabled:Boolean;// = true
private var textField:TextField;
private var buttonName:String;
protected static const MIN_WIDTH:Number = 20;
private static const MIN_HEIGHT:Number = 20;
public function CustomButton(_arg1:Function, _arg2:String=null){
enabled = true;
super();
action = _arg1;
mouseChildren = false;
buttonMode = true;
if (_arg2){
setName(_arg2);
};
addEventListener(MouseEvent.CLICK, click);
addEventListener(MouseEvent.ROLL_OUT, rollOut);
addEventListener(MouseEvent.ROLL_OVER, rollOver);
addEventListener(MouseEvent.MOUSE_DOWN, rollDown);
addEventListener(Event.ADDED_TO_STAGE, onAddToStage);
rollOut();
}
protected function setName(_arg1:String):void{
buttonName = _arg1;
textField = new TextField();
textField.text = buttonName;
textField.selectable = false;
textField.autoSize = TextFieldAutoSize.LEFT;
addChild(textField);
drawBtn();
}
private function onRemovedFramStage(_arg1:Event):void{
stage.removeEventListener(Event.MOUSE_LEAVE, rollOut);
stage.removeEventListener(MouseEvent.MOUSE_UP, rollOut);
}
protected function drawBtn(_arg1:uint=0x999999, _arg2:uint=0):void{
graphics.clear();
graphics.beginFill(_arg1, 0.7);
if (textField){
textField.textColor = _arg2;
graphics.drawRect(0, 0, Math.max((textField.textWidth + 5), MIN_WIDTH), Math.max(textField.textHeight, MIN_HEIGHT));
} else {
graphics.drawRect(0, 0, MIN_WIDTH, MIN_HEIGHT);
};
graphics.endFill();
}
public function enable():void{
enabled = true;
buttonMode = (mouseEnabled = true);
addEventListener(MouseEvent.CLICK, click);
addEventListener(MouseEvent.ROLL_OUT, rollOut);
addEventListener(MouseEvent.ROLL_OVER, rollOver);
addEventListener(MouseEvent.MOUSE_DOWN, rollDown);
if (stage){
stage.addEventListener(Event.MOUSE_LEAVE, rollOut);
stage.addEventListener(MouseEvent.MOUSE_UP, rollOut);
};
rollOut();
}
protected function rollOut(_arg1:Event=null):void{
drawBtn(0x999999);
}
private function click(_arg1:MouseEvent):void{
if (action != null){
action();
};
}
private function onAddToStage(_arg1:Event):void{
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFramStage);
if (enabled){
stage.addEventListener(Event.MOUSE_LEAVE, rollOut);
};
}
protected function rollDown(_arg1:MouseEvent):void{
drawBtn(16768477, 0x660000);
this.addEventListener(MouseEvent.MOUSE_UP, rollOver);
}
public function getDescription():String{
return (buttonName);
}
public function disable():void{
enabled = false;
buttonMode = (mouseEnabled = false);
removeEventListener(MouseEvent.CLICK, click);
removeEventListener(MouseEvent.ROLL_OUT, rollOut);
removeEventListener(MouseEvent.ROLL_OVER, rollOver);
removeEventListener(MouseEvent.MOUSE_DOWN, rollDown);
this.removeEventListener(MouseEvent.MOUSE_UP, rollOver);
if (stage){
stage.removeEventListener(Event.MOUSE_LEAVE, rollOut);
stage.removeEventListener(MouseEvent.MOUSE_UP, rollOut);
};
drawBtn(10040115, 0xFFFFFF);
}
protected function rollOver(_arg1:MouseEvent):void{
this.removeEventListener(MouseEvent.MOUSE_UP, rollOver);
drawBtn(16751018, 0);
}
public function destroy():void{
enable();
graphics.clear();
while (numChildren != 0) {
removeChildAt(0);
};
}
}
}//package ui
Section 71
//StageSprite (ui.StageSprite)
package ui {
import flash.events.*;
import flash.display.*;
public class StageSprite extends Sprite {
public function StageSprite(){
addEventListener(Event.ADDED_TO_STAGE, onAddToStage);
}
protected function onResize(_arg1:Event=null):void{
x = ((stage.stageWidth / 2) - (width / 2));
y = ((stage.stageHeight / 2) - (height / 2));
}
protected function onRemoved(_arg1:Event):void{
destroy();
}
public function onAddToStage(_arg1:Event):void{
stage.addEventListener(Event.RESIZE, onResize);
onResize();
addEventListener(Event.REMOVED_FROM_STAGE, onRemoved);
}
public function destroy():void{
stage.focus = stage;
stage.removeEventListener(Event.RESIZE, onResize);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemoved);
}
}
}//package ui
Section 72
//UISprite (ui.UISprite)
package ui {
import flash.events.*;
import flash.display.*;
public class UISprite extends Sprite {
public var border:Number;// = 2
private var alignCenter:Boolean;// = false
public static const BORDER:Number = 2;
public function UISprite(_arg1:Number=2, _arg2:Boolean=false):void{
border = BORDER;
alignCenter = false;
super();
setBorder(_arg1);
alignCenter = _arg2;
}
override public function addChild(_arg1:DisplayObject):DisplayObject{
_arg1.y = (this.height + border);
super.addChild(_arg1);
graphics.clear();
graphics.lineStyle(0.1, 0xFF0000, 0);
graphics.drawRect(0, 0, width, height);
if (alignCenter){
alignCenterAction();
};
return (_arg1);
}
public function setBorder(_arg1:Number):void{
border = _arg1;
}
public function clear():void{
while (numChildren != 0) {
removeChildAt(0);
};
graphics.clear();
if (stage){
stage.focus = stage;
};
}
private function alignCenterAction():void{
var _local1:Number;
var _local2:DisplayObject;
var _local3:int;
_local1 = 0;
_local2 = getChildAt(_local3);
_local3 = 0;
while (_local3 < numChildren) {
_local2 = getChildAt(_local3);
_local1 = Math.max(_local2.width, _local1);
_local3++;
};
_local3 = 0;
while (_local3 < numChildren) {
_local2 = getChildAt(_local3);
_local2.x = ((_local1 - _local2.width) / 2);
_local3++;
};
dispatchEvent(new Event(Event.RESIZE));
}
}
}//package ui
Section 73
//UserInterface (ui.UserInterface)
package ui {
import flash.events.*;
import flash.display.*;
public class UserInterface extends Sprite {
private var leftContorll:Sprite;
private var uiInterfases:Object;
private var rightContorll:Sprite;
private var buttons:Object;
private var noContainers:Boolean;// = true
private var currentUi:Object;
private var noDrawInterfases:Array;
public static const RIGHT:String = "right";
public static const LEFT:String = "left";
private static const BORDER:Number = 5;
public static var INSTANCE:UserInterface = new (UserInterface);
;
public function UserInterface(){
uiInterfases = new Object();
currentUi = new Object();
buttons = new Object();
noDrawInterfases = new Array();
noContainers = true;
super();
if (INSTANCE){
trace("Error UserInterface is singletone!");
};
addEventListener(Event.ADDED_TO_STAGE, onAdd);
addEventListener(Event.REMOVED_FROM_STAGE, onDestroy);
}
private function updatePosition(_arg1:String):void{
var _local2:UIElement;
switch (_arg1){
case LEFT:
for each (_local2 in uiInterfases[_arg1]) {
_local2.content.x = int(((stage.stageWidth - _local2.content.width) - BORDER));
_local2.content.y = int((stage.stageHeight / 3));
};
break;
case RIGHT:
for each (_local2 in uiInterfases[_arg1]) {
_local2.content.x = int(BORDER);
_local2.content.y = int((stage.stageHeight / 3));
};
break;
};
}
public function openTool(_arg1:String, _arg2:String):void{
currentUi[_arg1] = _arg2;
updateControll(_arg1);
}
private function onDestroy(_arg1:Event):void{
clear();
}
private function addUi(_arg1:UIElement):void{
updatePosition(_arg1.location);
addChild(_arg1.content);
}
private function updateBunnonContainer(_arg1:String):void{
switch (_arg1){
case LEFT:
leftContorll.x = ((stage.stageWidth - leftContorll.width) - BORDER);
leftContorll.y = ((int((stage.stageHeight / 3)) - 20) - BORDER);
case RIGHT:
rightContorll.x = BORDER;
rightContorll.y = ((int((stage.stageHeight / 3)) - 20) - BORDER);
};
}
private function onAdd(_arg1:Event):void{
var _local2:Object;
if (noContainers){
createUIContainers();
};
while (noDrawInterfases.length != 0) {
_local2 = noDrawInterfases.pop();
setUIElement(_local2["view"], _local2["name"], _local2["loc"]);
};
stage.addEventListener(Event.RESIZE, onResize);
}
public function clear():void{
if (stage){
stage.removeEventListener(Event.RESIZE, onResize);
};
while (numChildren) {
removeChildAt(0);
};
uiInterfases = new Object();
noDrawInterfases = new Array();
currentUi = new Object();
buttons = new Object();
leftContorll = null;
rightContorll = null;
noContainers = true;
}
private function onResize(_arg1:Event=null):void{
updatePosition(LEFT);
updatePosition(RIGHT);
updateBunnonContainer(LEFT);
updateBunnonContainer(RIGHT);
}
private function updateControll(_arg1:String):void{
var _local2:UIElement;
var _local3:int;
var _local4:CustomButton;
if (noContainers){
createUIContainers();
};
for each (_local2 in uiInterfases[_arg1]) {
if (buttons[_arg1] == null){
buttons[_arg1] = new Object();
};
if (buttons[_arg1][_local2.name] == null){
_local4 = new CustomButton(_local2.act, _local2.name);
leftContorll.addChild(_local4);
buttons[_arg1][_local2.name] = _local4;
};
_local4 = buttons[_arg1][_local2.name];
if (_local2.name == currentUi[_arg1]){
_local2.content.visible = true;
_local4.disable();
} else {
_local4.enable();
_local2.content.visible = false;
};
};
_local3 = 0;
for each (_local4 in buttons[_arg1]) {
_local4.x = _local3;
_local3 = (_local3 + (_local4.width + BORDER));
};
updateBunnonContainer(_arg1);
}
private function removeUIbyName(_arg1:String, _arg2:String):void{
removeChild(uiInterfases[_arg1][_arg2]);
delete uiInterfases[_arg1][_arg2];
}
public function setUIElement(_arg1:DisplayObject, _arg2:String, _arg3:String="left"):void{
var _local4:UIElement;
_local4 = new UIElement(_arg1, _arg2, _arg3);
_local4.addEventListener(Event.SELECT, onSelectElement);
if (stage){
if (uiInterfases[_arg3] == null){
uiInterfases[_arg3] = new Object();
};
if (uiInterfases[_arg3][_arg2] != null){
removeUIbyName(_arg3, _arg2);
};
uiInterfases[_arg3][_arg2] = _local4;
addUi(_local4);
currentUi[_arg3] = _arg2;
updateControll(_arg3);
} else {
noDrawInterfases.push({view:_arg1, name:_arg2, loc:_arg3});
};
}
private function onSelectElement(_arg1:Event):void{
var _local2:UIElement;
_local2 = (_arg1.target as UIElement);
openTool(_local2.location, _local2.name);
}
private function createUIContainers():void{
leftContorll = new Sprite();
rightContorll = new Sprite();
addChild(leftContorll);
addChild(rightContorll);
noContainers = false;
}
}
}//package ui
import flash.events.*;
import flash.display.*;
class UIElement extends EventDispatcher {
public var name:String;
public var location:String;
public var content:DisplayObject;
private function UIElement(_arg1:DisplayObject, _arg2:String, _arg3:String){
content = _arg1;
name = _arg2;
location = _arg3;
}
public function act():void{
dispatchEvent(new Event(Event.SELECT));
}
}
Section 74
//HexConverter (utils.HexConverter)
package utils {
import flash.utils.*;
public class HexConverter {
public static function convertToHex(_arg1:String):String{
var _local2:ByteArray;
var _local3:String;
var _local4:String;
_local2 = new ByteArray();
_local2.writeUTFBytes(_arg1);
_local2.compress();
_local2.position = 0;
_local4 = "";
while (_local2.position < _local2.length) {
_local3 = _local2.readUnsignedByte().toString(16);
_local4 = (_local4 + ((_local3.length < 2)) ? ("0" + _local3) : _local3);
};
return (_local4);
}
public static function convertFromHex(_arg1:String):String{
var _local2:ByteArray;
var _local3:uint;
_local2 = new ByteArray();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.writeByte(parseInt(_arg1.substr(_local3, 2), 16));
_local3 = (_local3 + 2);
};
_local2.uncompress();
return (_local2.readUTFBytes(_local2.length));
}
}
}//package utils
Section 75
//left_move_down_18 (WallWalkerNG_fla.left_move_down_18)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class left_move_down_18 extends MovieClip {
public function left_move_down_18(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 76
//left_move_left_16 (WallWalkerNG_fla.left_move_left_16)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class left_move_left_16 extends MovieClip {
public function left_move_left_16(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 77
//left_move_right_19 (WallWalkerNG_fla.left_move_right_19)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class left_move_right_19 extends MovieClip {
public function left_move_right_19(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 78
//left_move_up_17 (WallWalkerNG_fla.left_move_up_17)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class left_move_up_17 extends MovieClip {
public function left_move_up_17(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 79
//loading_the_1 (WallWalkerNG_fla.loading_the_1)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class loading_the_1 extends MovieClip {
public function loading_the_1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 80
//musicLoaded_52 (WallWalkerNG_fla.musicLoaded_52)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class musicLoaded_52 extends MovieClip {
public function musicLoaded_52(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 81
//normal_fly_down_14 (WallWalkerNG_fla.normal_fly_down_14)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class normal_fly_down_14 extends MovieClip {
public function normal_fly_down_14(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 82
//normal_fly_right_15 (WallWalkerNG_fla.normal_fly_right_15)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class normal_fly_right_15 extends MovieClip {
public function normal_fly_right_15(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 83
//normal_fly_up_13 (WallWalkerNG_fla.normal_fly_up_13)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class normal_fly_up_13 extends MovieClip {
public function normal_fly_up_13(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 84
//normal_move_down_11 (WallWalkerNG_fla.normal_move_down_11)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class normal_move_down_11 extends MovieClip {
public function normal_move_down_11(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 85
//normal_move_left_9 (WallWalkerNG_fla.normal_move_left_9)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class normal_move_left_9 extends MovieClip {
public function normal_move_left_9(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 86
//normal_move_right_12 (WallWalkerNG_fla.normal_move_right_12)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class normal_move_right_12 extends MovieClip {
public function normal_move_right_12(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 87
//normal_move_up_10 (WallWalkerNG_fla.normal_move_up_10)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class normal_move_up_10 extends MovieClip {
public function normal_move_up_10(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 88
//normal_standing_down_7 (WallWalkerNG_fla.normal_standing_down_7)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class normal_standing_down_7 extends MovieClip {
public function normal_standing_down_7(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 89
//normal_standing_left_5 (WallWalkerNG_fla.normal_standing_left_5)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class normal_standing_left_5 extends MovieClip {
public function normal_standing_left_5(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 90
//normal_standing_right_8 (WallWalkerNG_fla.normal_standing_right_8)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class normal_standing_right_8 extends MovieClip {
public function normal_standing_right_8(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 91
//normal_standing_up_6 (WallWalkerNG_fla.normal_standing_up_6)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class normal_standing_up_6 extends MovieClip {
public function normal_standing_up_6(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 92
//ray_anim_62 (WallWalkerNG_fla.ray_anim_62)
package WallWalkerNG_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class ray_anim_62 extends MovieClip {
public var timer;
public var lastTimer:Number;
public var framePausa:int;
public function ray_anim_62(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
framePausa = 50;
timer = new Timer((framePausa / 2));
lastTimer = 0;
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
}
public function onTimer(_arg1:TimerEvent):void{
if ((getTimer() - lastTimer) > framePausa){
frameMove();
lastTimer = getTimer();
};
}
public function frameMove():void{
nextFrame();
if (currentFrame == totalFrames){
gotoAndStop(1);
};
}
}
}//package WallWalkerNG_fla
Section 93
//right_move_down_22 (WallWalkerNG_fla.right_move_down_22)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class right_move_down_22 extends MovieClip {
public function right_move_down_22(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 94
//right_move_left_20 (WallWalkerNG_fla.right_move_left_20)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class right_move_left_20 extends MovieClip {
public function right_move_left_20(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 95
//right_move_right_23 (WallWalkerNG_fla.right_move_right_23)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class right_move_right_23 extends MovieClip {
public function right_move_right_23(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 96
//right_move_up_21 (WallWalkerNG_fla.right_move_up_21)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class right_move_up_21 extends MovieClip {
public function right_move_up_21(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package WallWalkerNG_fla
Section 97
//startLogo_25 (WallWalkerNG_fla.startLogo_25)
package WallWalkerNG_fla {
import flash.display.*;
public dynamic class startLogo_25 extends MovieClip {
public function startLogo_25(){
addFrameScript(14, frame15);
}
function frame15(){
stop();
}
}
}//package WallWalkerNG_fla
Section 98
//TileNG_60 (WallWalkerNG_fla.TileNG_60)
package WallWalkerNG_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class TileNG_60 extends MovieClip {
public var rightWall:MovieClip;
public var timer;
public var leftWall:MovieClip;
public var lastTimer:Number;
public var framePausa:int;
public var topWall:MovieClip;
public function TileNG_60(){
addFrameScript(0, frame1, 147, frame148);
}
function frame1(){
stop();
framePausa = 20;
timer = new Timer((framePausa / 2));
lastTimer = 0;
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
}
public function onTimer(_arg1:TimerEvent):void{
if ((getTimer() - lastTimer) > framePausa){
frameMove();
lastTimer = getTimer();
};
}
public function frameMove():void{
nextFrame();
if (currentFrame == totalFrames){
gotoAndStop(1);
};
}
function frame148(){
stop();
trace("STOP");
timer.stop();
timer.removeEventListener(TimerEvent.TIMER, onTimer);
timer = null;
dispatchEvent(new Event("remove_animation", true));
}
}
}//package WallWalkerNG_fla
Section 99
//WallNG_61 (WallWalkerNG_fla.WallNG_61)
package WallWalkerNG_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class WallNG_61 extends MovieClip {
public var timer;
public var lastTimer:Number;
public var framePausa:int;
public function WallNG_61(){
addFrameScript(0, frame1);
}
function frame1(){
gotoAndStop(30);
framePausa = 20;
timer = new Timer((framePausa / 2));
lastTimer = 0;
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
}
public function onTimer(_arg1:TimerEvent):void{
if ((getTimer() - lastTimer) > framePausa){
frameMove();
lastTimer = getTimer();
};
}
public function frameMove():void{
nextFrame();
if (currentFrame == totalFrames){
gotoAndStop(30);
};
}
}
}//package WallWalkerNG_fla
Section 100
//DebugWidget (view_tests.DebugWidget)
package view_tests {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
public class DebugWidget extends TextField {
private var lastFrameTime:int;
private var widgetStage:Stage;
private var fpsTimer:Timer;
private var minFps:String;
private var fpsText2:String;
private var miniFpsValue:int;// = 300
private var fpsText:String;// = ""
private var frameCounter:Number;
private var fps:Boolean;
private static const BORDER:int = 2;
public function DebugWidget(_arg1:Stage, _arg2:Boolean=true){
fpsText = "";
miniFpsValue = 300;
super();
fps = _arg2;
widgetStage = _arg1;
widgetStage.addEventListener(Event.RESIZE, onResize);
draw();
initInstance();
}
private function draw():void{
width = 100;
height = 50;
onResize();
background = true;
backgroundColor = 0xFFFFFF;
border = true;
borderColor = 0x666666;
selectable = false;
autoSize = TextFieldAutoSize.RIGHT;
wordWrap = (multiline = true);
}
private function updateText():void{
var _local1:String;
_local1 = ((((("debug:\r" + fpsText) + "\r") + fpsText2) + "\r") + minFps);
text = _local1;
}
private function onShow(_arg1:TimerEvent):void{
fpsText = ("fps: " + frameCounter);
frameCounter = 0;
}
private function onResize(_arg1:Event=null):void{
x = ((widgetStage.stageWidth - width) - BORDER);
y = BORDER;
}
private function onFrame(_arg1:Event):void{
var _local2:int;
var _local3:int;
frameCounter++;
_local2 = (getTimer() - lastFrameTime);
lastFrameTime = getTimer();
_local3 = Math.round((1000 / _local2));
fpsText2 = ("fps2: " + _local3);
testInMinimal(_local3);
updateText();
}
private function initInstance():void{
if (fps){
fpsTimer = new Timer(1000);
fpsTimer.addEventListener(TimerEvent.TIMER, onShow);
fpsTimer.start();
addEventListener(Event.ENTER_FRAME, onFrame);
};
}
private function testInMinimal(_arg1:int):void{
miniFpsValue++;
if (miniFpsValue > _arg1){
miniFpsValue = _arg1;
} else {
return;
};
minFps = ("minFPS: " + miniFpsValue);
}
}
}//package view_tests
Section 101
//BorderOldWall1 (BorderOldWall1)
package {
import flash.display.*;
public dynamic class BorderOldWall1 extends BitmapData {
public function BorderOldWall1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 102
//BorderOldWall1Normal (BorderOldWall1Normal)
package {
import flash.display.*;
public dynamic class BorderOldWall1Normal extends BitmapData {
public function BorderOldWall1Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 103
//Brick1 (Brick1)
package {
import flash.display.*;
public dynamic class Brick1 extends BitmapData {
public function Brick1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 104
//Brick1Normal (Brick1Normal)
package {
import flash.display.*;
public dynamic class Brick1Normal extends BitmapData {
public function Brick1Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 105
//CrushedTile1 (CrushedTile1)
package {
import flash.media.*;
public dynamic class CrushedTile1 extends Sound {
}
}//package
Section 106
//CrushedTile2 (CrushedTile2)
package {
import flash.media.*;
public dynamic class CrushedTile2 extends Sound {
}
}//package
Section 107
//DoorLeft (DoorLeft)
package {
import flash.display.*;
public dynamic class DoorLeft extends BitmapData {
public function DoorLeft(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 108
//DoorRight (DoorRight)
package {
import flash.display.*;
public dynamic class DoorRight extends BitmapData {
public function DoorRight(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 109
//Floor1 (Floor1)
package {
import flash.display.*;
public dynamic class Floor1 extends BitmapData {
public function Floor1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 110
//Floor1Normal (Floor1Normal)
package {
import flash.display.*;
public dynamic class Floor1Normal extends BitmapData {
public function Floor1Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 111
//Floor2 (Floor2)
package {
import flash.display.*;
public dynamic class Floor2 extends BitmapData {
public function Floor2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 112
//Floor2Normal (Floor2Normal)
package {
import flash.display.*;
public dynamic class Floor2Normal extends BitmapData {
public function Floor2Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 113
//Game (Game)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import tiles.*;
import map.*;
import editor.*;
import gui.*;
import temp.*;
import flash.utils.*;
import math.*;
import in_fla.*;
public class Game extends EventDispatcher {
private var root:Sprite;
private var waitStart:Boolean;
private static const SLOW_START:Boolean = true;
private static var bonusMax:Number = 0;
private static var space:MapVisual;
public static var shadowWall:String;
private static var world:MapData;
public static var light:Boolean = true;
private static var iteration:uint = 0;
public static var gameTime:int = 0;
public static var startingGamingProcess:Boolean = false;
private static var player:Player;
public static var shadowColor:ColorTransform;
public static var startingTimer:Boolean = false;
private static var bonusHave:Number = 0;
private static var lastTimerValue:int = 0;
public static var SCALE:Number = 1;
private static var allTiles:Object;
private static var lightData:Array;
public function Game(_arg1:Sprite){
root = _arg1;
world = new MapData();
space = new MapVisual(world);
root.addChild(space);
space.x = 150;
space.y = 250;
initShadow();
}
public function update():void{
var _local1:int;
var _local2:uint;
var _local3:uint;
var _local4:int;
var _local5:int;
var _local6:int;
if (((startingGamingProcess) && (!(Main.EDITOR)))){
if (!startingTimer){
startingTimer = true;
lastTimerValue = getTimer();
};
gameTime = (gameTime + (getTimer() - lastTimerValue));
lastTimerValue = getTimer();
HUD.updateGameTimer(gameTime);
startingTimer = true;
} else {
if (Main.EDITOR){
gameTime = 0;
};
startingTimer = false;
};
if (player){
player.update();
};
if (space){
space.update();
};
_local1 = (world.zLength() * 3);
if (((((((((!(Main.EDITOR)) && (SLOW_START))) && (!((world == null))))) && (!((space == null))))) && (world.init()))){
if (iteration < _local1){
updateLoadLevel(Math.floor(((iteration / _local1) * 100)));
_local3 = 0;
while (_local3 <= iteration) {
_local2 = (iteration - _local3);
_local6 = 0;
while (_local6 <= _local2) {
_local4 = (_local2 - _local6);
_local5 = _local3;
if ((((((_local4 < world.zLength())) && ((_local6 < world.zLength())))) && ((_local5 < world.zLength())))){
drawing(new Point3D(_local4, _local6, _local5));
};
_local6++;
};
_local3++;
};
iteration++;
} else {
if (((!(startingGamingProcess)) && (!(waitStart)))){
waitStart = true;
initStartGame();
};
};
};
}
private function initStartGame():void{
dispatchEvent(new GameEvent(GameEvent.START_GAME));
}
private function initStartLoadLevel():void{
dispatchEvent(new GameEvent(GameEvent.LOAD_LEVEL));
}
public function initShadow():void{
var _local1:Number;
_local1 = Math.random();
shadowColor = new ColorTransform((0.9 + (Math.random() / 10)), (0.8 + (Math.random() / 5)), (0.8 + (Math.random() / 5)));
if (_local1 < 0.5333){
shadowWall = WallsData.WALL_LEFT;
} else {
if (_local1 < 0.98){
shadowWall = WallsData.WALL_RIGHT;
} else {
shadowWall = WallsData.WALL_TOP;
};
};
}
public function finish():Boolean{
var _local1:Boolean;
_local1 = false;
if (!UIRoot.editor){
if (bonusHave >= bonusMax){
if (world.thisLatterLevel()){
finishGame();
} else {
startEndLevel();
};
_local1 = true;
};
};
return (_local1);
}
public function restart():void{
space.clear();
if (Main.EDITOR){
createEditorPlayer();
} else {
player = null;
world.clear();
};
start();
}
public function getSpace():MapVisual{
return (space);
}
private function createEditorPlayer():void{
var _local1:Point3D;
var _local2:Point;
if (player == null){
_local1 = new Point3D(4, 4, 2);
player = new EditorPlayer(_local1, world, this);
_local2 = MathUtils.toMap(_local1);
player.x = (_local2.x * Tile.SIZE);
player.y = (_local2.y * Tile.SIZE);
};
}
private function findLight():Array{
var _local1:Array;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:Point3D;
var _local6:WallsData;
_local1 = new Array();
light = false;
_local2 = 0;
while (_local2 < world.zLength()) {
_local3 = 0;
while (_local3 < world.yLength(_local2)) {
_local4 = 0;
while (_local4 < world.xLength(_local2, _local3)) {
_local5 = new Point3D(_local4, _local3, _local2);
_local6 = MapData.getValue(_local5);
if (_local6){
if (_local6.type == MapObject.TYPE_LAMP){
_local1.push(new LightData(_local5, 3));
light = true;
};
if (_local6.type == MapObject.TYPE_BONUS){
_local1.push(new LightData(_local5, 0.6));
};
};
_local4++;
};
_local3++;
};
_local2++;
};
return (_local1);
}
private function startDrawLevel():void{
iteration = 0;
initStartLoadLevel();
}
private function nextLevel():void{
world.nextMap();
initShadow();
restart();
}
public function drawing(_arg1:Point3D):void{
var _local2:WallsData;
var _local3:MapObject;
var _local4:EditorPlayer;
_local2 = MapData.getValue(_arg1);
if (_local2){
if (_local2.type == MapObject.TYPE_PLAYER){
if (Main.EDITOR){
_local3 = new PlayerStarting(_arg1, _local2);
_local3.alpha = 1;
_local4 = (player as EditorPlayer);
if (_local4){
_local4.startPosition = _arg1;
};
} else {
player = new Player(_arg1, this);
space.setPlayer(player);
};
} else {
if (_local2.type == MapObject.TYPE_DOOR_EXIT){
_local3 = new Tile(_arg1, _local2, lightData);
} else {
if (_local2.type == MapObject.TYPE_BONUS){
_local3 = new Bonus1(_arg1, _local2);
bonusMax++;
} else {
if (_local2.type == MapObject.TYPE_TILE){
_local3 = new Tile(_arg1, _local2, lightData);
} else {
if (_local2.type == MapObject.TYPE_CRUSHED_TILE){
_local3 = new CrushedTile(_arg1, _local2, lightData);
} else {
if (_local2.type == MapObject.TYPE_LAMP){
if (Main.EDITOR){
_local3 = new Lamp(_arg1, _local2);
};
};
};
};
};
};
};
if (_local3){
if (((SLOW_START) && (!(Main.EDITOR)))){
_local3.setHide();
_local3.show(0.5);
};
_local3.scaleX = (_local3.scaleY = SCALE);
space.addChild(_local3);
allTiles[((((_arg1.x + "_") + _arg1.y) + "_") + _arg1.z)] = _local3;
};
};
}
public function start():void{
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:Point3D;
var _local5:int;
var _local6:int;
var _local7:int;
Main.PAUSE = false;
MusicController.INSTANCE.play(getLevelMusic());
allTiles = new Object();
startingGamingProcess = false;
bonusMax = 0;
bonusHave = 0;
if (UIRoot.LIGHT){
lightData = findLight();
} else {
lightData = new Array();
light = false;
};
if (Main.EDITOR){
_local1 = 0;
while (_local1 < world.zLength()) {
_local2 = 0;
while (_local2 < world.yLength(_local1)) {
_local3 = 0;
while (_local3 < world.xLength(_local1, _local2)) {
_local4 = new Point3D(_local3, _local2, _local1);
drawing(_local4);
_local3++;
};
_local2++;
};
_local1++;
};
startGame();
space.setPlayer(player);
} else {
if (SLOW_START){
startDrawLevel();
} else {
_local1 = 0;
while (_local1 <= (world.zLength() * 3)) {
_local3 = 0;
while (_local3 <= _local1) {
_local2 = (_local1 - _local3);
_local7 = 0;
while (_local7 <= _local2) {
_local5 = (_local2 - _local7);
_local6 = _local3;
if ((((((_local5 < world.zLength())) && ((_local7 < world.zLength())))) && ((_local6 < world.zLength())))){
drawing(new Point3D(_local5, _local7, _local6));
};
_local7++;
};
_local3++;
};
_local1++;
};
startGame();
};
};
if (Main.EDITOR){
space.drawLevelSize();
};
world.setMapVisual(space);
}
private function startEndLevel():void{
space.startEndLevelAnimation(nextLevel);
Main.PAUSE = true;
}
public function startEditor():void{
Main.EDITOR = true;
space.clear();
player = null;
createEditorPlayer();
start();
}
public function newGame():void{
gameTime = 0;
HUD.updateGameTimer(gameTime);
world.newGame();
if (Main.EDITOR){
startEditor();
} else {
start();
};
}
public function startGame():void{
waitStart = false;
startingGamingProcess = true;
HUD.updateBonus(bonusHave, bonusMax);
}
private function updateLoadLevel(_arg1:int):void{
var _local2:GameEvent;
_local2 = new GameEvent(GameEvent.UPDATE_LOAD_LEVEL);
_local2.loadLevelPercent = _arg1;
dispatchEvent(_local2);
}
private function getLevelMusic():String{
var _local1:Array;
var _local2:Array;
var _local3:Array;
var _local4:Array;
var _local5:String;
var _local6:int;
if (Main.EDITOR){
return ("");
};
_local1 = [MusicController.MUSIC_1, MusicController.MUSIC_3];
_local2 = [MusicController.MUSIC_1, MusicController.MUSIC_3, MusicController.MUSIC_4];
_local3 = [MusicController.MUSIC_3, MusicController.MUSIC_4];
_local4 = [MusicController.MUSIC_3, MusicController.MUSIC_4, MusicController.MUSIC_2_MENU, MusicController.MUSIC_1];
_local5 = MusicController.MUSIC_2_MENU;
_local6 = world.getLevel();
if (_local6 == -1){
return (_local4[int((Math.random() * _local3.length))]);
};
if (_local6 < 4){
return (_local1[int((Math.random() * _local1.length))]);
};
if (_local6 < 14){
return (_local2[int((Math.random() * _local2.length))]);
};
if (_local6 < 30){
return (_local3[int((Math.random() * _local3.length))]);
};
return (_local5);
}
public function destroy():void{
clear();
root.removeChild(space);
}
private function finishGame():void{
dispatchEvent(new GameEvent(GameEvent.FINISH_GAME));
}
public static function getEditorTilePosition():Point3D{
if (Main.EDITOR){
return (player.getPosition());
};
return (null);
}
public static function getMapVisual():MapVisual{
return (space);
}
public static function haveBonus():void{
bonusHave++;
HUD.updateBonus(bonusHave, bonusMax);
SoundController.star();
}
public static function setTileByCoordinates(_arg1:Point3D, _arg2:MapObject):void{
allTiles[((((_arg1.x + "_") + _arg1.y) + "_") + _arg1.z)] = _arg2;
}
public static function clear():void{
startingGamingProcess = false;
world.clear();
space.destroy();
player = null;
}
public static function clearGame():void{
gameTime = 0;
startingTimer = false;
HUD.updateGameTimer(gameTime);
}
public static function setView(_arg1:String):void{
space.setView(_arg1);
}
public static function getMapData():MapData{
return (world);
}
public static function getLightValue():Array{
return (lightData);
}
public static function removeTileByCoordinates(_arg1:Point3D):void{
delete allTiles[((((_arg1.x + "_") + _arg1.y) + "_") + _arg1.z)];
}
public static function removeLightByCoordinates(_arg1:Point3D):void{
var _local2:uint;
var _local3:LightData;
_local2 = 0;
while (_local2 < lightData.length) {
_local3 = (lightData[_local2] as LightData);
if (_local3.position.compare(_arg1)){
lightData.splice(1, 1);
return;
};
_local2++;
};
trace("no lamp:(");
}
public static function getShadowTransform(_arg1:String):ColorTransform{
if (shadowWall == _arg1){
return (shadowColor);
};
return (null);
}
public static function getTileByCoordinates(_arg1:Point3D):MapObject{
var _local2:MapObject;
_local2 = allTiles[((((_arg1.x + "_") + _arg1.y) + "_") + _arg1.z)];
if (_local2){
return (_local2);
};
return (null);
}
}
}//package
Section 114
//GameEvent (GameEvent)
package {
import flash.events.*;
public class GameEvent extends Event {
public var loadLevelPercent:int;// = 0
public static const UPDATE_LOAD_LEVEL:String = "load_level";
public static const FINISH_GAME:String = "finish_game";
public static const LOAD_LEVEL:String = "load_level";
public static const START_GAME:String = "start_game";
public function GameEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
loadLevelPercent = 0;
super(_arg1, _arg2, _arg3);
}
}
}//package
Section 115
//Grass (Grass)
package {
import flash.display.*;
public dynamic class Grass extends BitmapData {
public function Grass(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 116
//GrassNormal (GrassNormal)
package {
import flash.display.*;
public dynamic class GrassNormal extends BitmapData {
public function GrassNormal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 117
//Ground1 (Ground1)
package {
import flash.display.*;
public dynamic class Ground1 extends BitmapData {
public function Ground1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 118
//Ground2 (Ground2)
package {
import flash.display.*;
public dynamic class Ground2 extends BitmapData {
public function Ground2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 119
//Ground3 (Ground3)
package {
import flash.display.*;
public dynamic class Ground3 extends BitmapData {
public function Ground3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 120
//Ground3Normal (Ground3Normal)
package {
import flash.display.*;
public dynamic class Ground3Normal extends BitmapData {
public function Ground3Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 121
//HeroShadow (HeroShadow)
package {
import flash.events.*;
import flash.display.*;
import flash.filters.*;
import flash.utils.*;
public class HeroShadow extends Shape {
private var _visible:Boolean;
private var visibleTimer:Timer;
private static const NORMAL_ALPHA:Number = 0.25;
public function HeroShadow(){
graphics.beginFill(0);
graphics.drawCircle(0, 0, 8);
filters = [new BlurFilter(9, 8)];
scaleY = 0.5;
alpha = NORMAL_ALPHA;
visibleTimer = new Timer(100);
visibleTimer.addEventListener(TimerEvent.TIMER, onTimerAct);
}
private function onTimerAct(_arg1:TimerEvent):void{
if (visible){
startVisible();
} else {
disableVisible();
};
}
private function startVisible():void{
if (alpha < NORMAL_ALPHA){
alpha = (alpha + 0.1);
} else {
visibleTimer.stop();
alpha = NORMAL_ALPHA;
};
}
public function destroy():void{
visibleTimer.stop();
visibleTimer.removeEventListener(TimerEvent.TIMER, onTimerAct);
visibleTimer = null;
}
override public function set visible(_arg1:Boolean):void{
visibleTimer.start();
_visible = _arg1;
}
private function disableVisible():void{
if (alpha > 0){
alpha = (alpha - 0.05);
} else {
visibleTimer.stop();
alpha = 0;
};
}
override public function get visible():Boolean{
return (_visible);
}
}
}//package
Section 122
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import map.*;
import gui.*;
import temp.*;
import flash.utils.*;
import mochi.as3.*;
import in_fla.*;
import view_tests.*;
import mochi.*;
public class Main extends MovieClip {
private var loopTimer:Timer;
private var demo:Demo;
private var sponsorBaner:SponsorAnimation;
private var playerName:String;
private var music:MusicController;
private var finishSprite:FinishContainer;
private var preloader:Preloader;
private var scoresContainer:ScoresContainer;
private var localization:Localization;
private var ui:UIRoot;
private var bgSpace:BackGround;
private var modalSprite:ModalSprite;
private var mochiContainer:MochiBanner;
private var game:Game;
private static const GAME_ID:String = "e2ce42947ad17bc5";
public static const LEADERBOARD_ID:String = "1b10945d1eee18af";
public static var CHEATS:Boolean = false;
public static var hudMenuText:String = "Welcome!";
public static var lastTime:int = 0;
public static var EDITOR:Boolean = false;
public static var DEBUG:Number = 0.2;
public static var PAUSE:Boolean = true;
private static var hud:HUD;
public function Main(){
localization = Localization.INSTANCE;
music = MusicController.INSTANCE;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
demo = new Demo();
stop();
mochiContainer = new MochiBanner(new Rectangle(0, 0, 550, 400));
addChild(mochiContainer);
if (DEBUG <= 0.4){
startSponsorBanner();
} else {
if (DEBUG >= 0.5){
startLoading();
} else {
MochiAd.showPreGameAd({clip:mochiContainer, id:GAME_ID, res:"550x400", ad_finished:startLoading});
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, checkLoaded);
};
};
addChild(demo);
}
private function initUI():void{
ui = new UIRoot(Game.getMapData(), game, this);
addChild(ui);
}
private function onTick(_arg1:TimerEvent):void{
if (!PAUSE){
game.update();
};
updateBG();
lastTime = getTimer();
}
private function initGame():void{
if (game){
game.destroy();
};
game = new Game(this);
game.addEventListener(GameEvent.FINISH_GAME, onSubmitScore);
}
public function setScores():void{
var options:Object;
trace("setScores");
if (!CHEATS){
options = {score:Game.gameTime, clip:finishSprite, onClose:closeFinishWindow};
try {
MochiScores.showLeaderboard(options);
} catch(e:Error) {
trace(("Error e:" + e));
closeFinishWindow();
};
} else {
closeFinishWindow();
};
}
public function checkLoaded(_arg1:ProgressEvent):void{
var _local2:Number;
_local2 = Math.ceil(((_arg1.bytesLoaded / _arg1.bytesTotal) * 100));
if (_local2 == 100){
};
}
private function errorScores(_arg1:String):void{
trace(("Error loading leaderboard! information:" + _arg1));
}
private function onNextStep(_arg1:Event):void{
var _local2:Boolean;
if (contains(sponsorBaner)){
removeChild(sponsorBaner);
};
_local2 = (stage.loaderInfo.url.split("newgrounds").length > 1);
if ((((DEBUG <= 0.2)) && (!(_local2)))){
MochiAd.showPreGameAd({clip:mochiContainer, id:GAME_ID, res:"550x400", ad_finished:startLoading});
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, checkLoaded);
} else {
trace("startLoading");
startLoading();
};
}
public function closeFinishWindow():void{
if (((finishSprite) && (this.contains(finishSprite)))){
removeChild(finishSprite);
};
ui.startEditor(true);
}
private function onSubmitScore(_arg1:GameEvent):void{
stage.quality = StageQuality.HIGH;
PAUSE = true;
trace("onSubmitScore");
trace(("finishSprite:" + finishSprite));
trace(("demo:" + demo));
addChild(finishSprite);
addChild(demo);
finishSprite.startFinish(setScores);
}
private function onPlayerInfoReceived(_arg1:Object):void{
playerName = "";
if (((_arg1["name"]) && (!((_arg1["name"] == undefined))))){
playerName = _arg1["name"];
hudMenuText = (("Welcome back, " + playerName) + "!");
};
updateHudText();
}
public function openScore():void{
createModalScreen();
addChild(scoresContainer);
addChild(demo);
}
private function initGameMenu():void{
initGame();
initHUD();
initUI();
initLoop();
addChild(scoresContainer);
addChild(demo);
if (((mochiContainer) && (this.contains(mochiContainer)))){
removeChild(mochiContainer);
};
}
private function startLoading():void{
preloader = new Preloader();
preloader.addEventListener(Event.COMPLETE, onStartGame);
addChild(preloader);
scoresContainer = new ScoresContainer(new Rectangle(0, 0, 470, 320), this);
addChild(scoresContainer);
finishSprite = new FinishContainer();
addChild(finishSprite);
MochiServices.connect(GAME_ID, scoresContainer);
scoresContainer.initScores();
MochiScores.getPlayerInfo(new Object(), onPlayerInfoReceived);
play();
addChild(demo);
}
private function onStartGame(_arg1:Event):void{
preloader.destroy();
gotoAndStop(3);
bgSpace = new BackGround();
addChild(bgSpace);
addChild(demo);
bgSpace.onMove(0, 0);
initGameMenu();
if (DEBUG >= 1){
addChild(new DebugWidget(stage));
} else {
if (DEBUG == 0){
addChild(mochiContainer);
addChild(demo);
};
};
}
public function showScores():void{
trace("--- >> showScores:");
trace(("LEADERBOARD_ID:" + LEADERBOARD_ID));
trace(("scoresContainer:" + scoresContainer));
trace(("errorScores:" + errorScores));
addChild(scoresContainer);
try {
MochiScores.showLeaderboard({res:"470x320", boardID:LEADERBOARD_ID, clip:scoresContainer, onClose:closeScore, onError:errorScores});
} catch(e:Error) {
trace(("Error e:" + e));
};
}
private function updateHudText():void{
if (!UIRoot.gameStarting){
HUD.mapName = hudMenuText;
};
}
public function closeScore():void{
removeChild(scoresContainer);
removeModelScreen();
}
private function startSponsorBanner():void{
sponsorBaner = new SponsorAnimation();
addChild(sponsorBaner);
sponsorBaner.addEventListener(Event.COMPLETE, onNextStep);
}
private function initLoop():void{
loopTimer = new Timer(30);
loopTimer.addEventListener(TimerEvent.TIMER, onTick);
loopTimer.start();
}
private function updateBG():void{
var _local1:MapVisual;
_local1 = game.getSpace();
if (_local1){
bgSpace.onMove(_local1.x, _local1.y);
bgSpace.rotation = _local1.getRotation();
} else {
bgSpace.onMove((stage.stageWidth / 2), (stage.stageHeight / 2));
};
}
private function initHUD():void{
hud = new HUD();
addChild(hud);
}
private function createModalScreen():void{
if (modalSprite == null){
modalSprite = new ModalSprite();
};
addChild(modalSprite);
addChild(demo);
}
private function removeModelScreen():void{
if (modalSprite){
removeChild(modalSprite);
};
}
}
}//package
Section 123
//MapData (MapData)
package {
import tiles.*;
import map.*;
import editor.*;
import gui.*;
import temp.*;
import utils.*;
public class MapData {
private var currentData:Array;
private var currentMap:int;
private var currentMapData:String;
private var _currentMapName:String;// = "New map"
private var mapVisual:MapVisual;
private static var maps:Array = ["78daf3492d4bcd5130ac3134a800a31a155555031504a168e0a5a2a909e4200888b02b440d5c584d4d0d228caa1a2e0c520de68085150d8eb6400c50d7305083db04a29594940c35140d0e35eaeaea82447580ba0c55150de2a0124776a98024c004d4742f1588d210283f04ca876939ba1bca78b06d3a00d66e2fd3", "78daf3492d4bcd5130aa3134a800a31a155555031530a168a0a3a2a909e480084503070407419823cb69c309733c72da1061576dacc247f66b810d87bb02c1051a05e6a01140a3a0d2213067aba9a919aa2a1a182a2929196a281a9443e9239310c6aaa86b18a88159e650b3a1b40e54b1170efeb106153d3da07e3d4d38a10712f782aa7bb06d3a00d8a03f35", "78daf3492d4bcd5130ae3134a800a31a155555031530a16860a8adad6da00226140dac553435a132080255015804a40a89405600e18085f50c9015281a38a06b01b1140d8eb6c09c02a6b520a20e601a1b017305763907a8653a18325e5a486e39b21f39107454d4350cd410be85590195f6872953525232d4009a045564a8a6a666a80af4c146153d3d24c3401ccc40016956071a06150c81d2c7b6434d7db06e3100528a4e8a", "78da5d50316ec3300cfc4a65d0762cd50615045eba64e95214e8d2b99bb7ce45077fa13ff0d8205fc89c18e837f2949a27468e041847f07cba23f93a7c0d9f0fbbd1f337be91ca920960d853d32c4d04c3bd54434e25004ba4ffdd4d248c0344daa6ada8a283eb58e9d0deab32dab6ad429a18990050356d9e08d50a308c60f829db57977e84daf0f9771d39dec1c93f1704581cac8d531745e13700f12f0986618170e467750f24ce045873fb4461f8e5c65755e5cbc541ed2f876c419700064bae60bb8e699b8d41f586ab8c7cd7ea35a9d7ea959fa7fcb469bcac2e758b400131a83500838135fca1cefb981c6e314feb5bc36ff7cddf49df5c8f3fff92ec7f84", "78da6d523b6ec3300cbd4a6cd08a6d0908a9218b172f5e8a023943a7764a3a1448060fb9422ed1b573e702458fd1a394a268494903184ff27b8f5ffbf1b07f5ebd3ebdbdcc84277966681a04630c82dc6e40840ab7d075083e3036d1bd2704672d8373cc05905b854e827d82c25fb8b636258c196231a7f2e0371b56183a55c872b54e4f10a870cc2933a87157e6a55c4e64811cb2b8e07aca0a1ffe31d3bd55e57da5a5dd31f4e465c6d24810361381929b281b39d912404d5dd7d4f6519ef41c02b9669b9eb398ae7ae03a2a8e915cb7687845d9a1f274f34bf4de97832d0d453a69f21a1a0a6784302a7fff709326470d1db4b941f9af4f258e31cea40c293b07ebe672b097605a0aabeffbacc545fdb9c8453d3b995013fcbe7ffc01d97a894c", "78da7d513b6ec3300cbd4a63c88e654b8ea44119bc64c9521428d03bf4933d43875ca16381de2007c80d72815ea147894893126db4058c2793eff189221f9e5f8e774f87d7b7e3c9bb77fc4eaaae9d42089b8d0483a0b5532b17159c456a8a00a0671570181450c32043632d48bd900e8ea5f3726375b6360bd70e6c10d49ca8aacaaf935e656e02d46b2ba5a90b50b793b400fa6b6c73271c00821d321731085604dd54aa9d4edeffd0f0204953b779bc5d0874570f04cd2ca26ab1a57451a67f5922d38682bf2cca2af35f966a52ddabe9a2eb27b68db35bb9477ac3d8348dafd349f1be4c740bd0cf2109219d0615c9884fb3e5a1ac5bd7e0a3d88d1574ee59494b1f29efa95176bc5eb8474a8cf901a22a96867be1db2e3a4c15df5f94f8397fdc00521e9601", "78da6d50bd4a0341107e95ecb177c9669763366020b9c6e6b0b4491db03b0281902058a4b3b010f202010b1f200822f6f107c1c277f0499c999ddd3bc5e398bfeffbe667cfd6179b4d6f71b95c6dfdc915ff5b055e1b039a8c51e02c2543320ace759e23c226541c7e088f46a05de444b59e0a87d55d8e2f8a82912ccbfc4041ed8c23f04fab669866b36195b3b62b9dfdc7513067cf151648f9f8c881644d6848172074908eaf0f7ce0948c2d4b1e56063f6bef17a496754e6d89de86642c9dc63267f96b5edc50488e734afab49f5449e273051f37ed48de28aadb4a45063721c4b05150e90eb2969ec7db341f290d8f14e86d27c1fb73521add1f4051a546d22dbc81d09b494c70f93a5e141ff25a82cfbb496a9a56c615e6f45ee85ff642fcba97e0fbf0f403df3f8185", "78da73cac94fceae3134ad00a31a154d4d031504a1a6a30325f4f4f48062aaaac8628a06ae2a2a2a062ac620a5c670f52a702e82a568e0650e17318788189a2371fc5520b4359a0ba0c2fe4a4a4a861a403dd8a5cf6c063b4d455dc3400dcd916087a3114087aba9a919a8400dd5b1b6b236d0b4b40612501133280db356074a1fda01d5af03d46fa8aa6890019538bdc908642d82408404d04f50452120bea6a2c1910ea8c0d926240d200781758124d5a12a2221c22002e18a48280d33f7fc5ca8825c145f41e90b6bc1e683642191f6687d0b00d66e5edc", "78da7551b14ec3400cfd1512394973174577a70609b2748990bab0b0b0744195baa08e3064676764e10ff80840e223f819ceefeca48d8414d9b9e767fbd9be395e1c8e8ffbd1bb677c63e6066a5b4754148e6c5d3bcadc96d83793c9dc01e1b22cc5444e09648233e703730d1bae5367aea199c3c6340d88c65a4741894038329b338e110e1ee8f56f9d7e4e9874e0af3649d1539a954d9497e7b95f456fd3bb3fc52b1e9adf969b48648b8190269ca1eb3ae1c4022684c80d1eea10f19c104b46ddbe60c960542b576a73d0ba44eb8d6f17051626aa92c45bd1a47e27f8e5acba497b1aa07a962e73d4244d838ffd6062b68e720682be00bdea10af6fddea1dca5ff305aed27534b201481ae1c276ba568fd8941ad92042965de66d28ed6494ca3bb9cad74b58afd3b495843edf657faa7340ae24e8f21ec47fbf2a4bfc482727b817f0e76d01fc7efc0172419adf", "78da7d50314ec34010fc0ab6ee2e2677b2775d24453a229a3434ae9128d3504429404a8990c20778060f481702cfe02decedeef9ec282059e39db9d1eeecde6c1ed68f57cbf5f67987f0c4dfce580b26436b039802029369dbaa1c2cb2cccf674072366660ed3fff25c82ee7195cf4df7a5f1371447255c0e7479ee67d13a5990f4109c39ca11901b9cea21a9183411cca696959277aa662c4b22c71c2816b0492912ad69c18ee22a9c84849d116707a4f82749f54e0b84a890be8e40560087da63e58ca543720232b8d53c5b37298182ba046972ef7eaf87ad1690b1516797fb6b67d25bd06a00d65c195f2efb771fc7e87dc88ef329a44f74917d718abb91ca3fbeb6f2ef148ae53b334463b6ed2c67b2d3a351c5f55f839fc0232d28da3", "78da7d52b14ec33010fd164717b7a1a9722e523364a984b264c9c2ccc2c4ce40a52efd0026062426967e04034b03037f857d3ec717372045ef62dfbbbb772fb97978dc1f0c3ed17350d8e83c475078afb576b15c150542555508e032d7ee48b0fa17a882603556cc0165b52edc2c433142ec9650c1f555b89b6badb09dd3a3f0fc490b24c0ebeee2cdd57acd504d61ae1c7252d2fb75d142966566691b6a009769a8938dee7e61fd04a48ad6fa6b7285c3871fbad9c8c953558832a7703baf249fb21af04d4a8a951f5b72b22499acb5fc53abf7b965def9185edea8e7d8c3712792ad2342598589c51158d6ceef3f82ccb5eea608ce3949f6f0f5ca73b6c9dc2e9de25730acdcf8cbc512f5a5c060074559dd4e3e1e88cfdc118369c369b41ca9636aca76638c65bb7d80de121847d6be6103812f0894ab712a39cae065bad8872deba2f8512ae924a8c558f1db39c7507e3ecfe879a1606b2b6de839de7172788f5a5877270f25f39ab04c2d9b31e95656f451b2c2ef978bdff3c8a99fe720e1f40b4ec5e069", "78da6553b14e03310cfd96abc29523ae942c37f4962e5dbadc7212ead20506b64a4c0c5d0009661859f808161696b41f466c3fe7aeaa5439f5b3fdfcece46ef7fbfb430c4ff23bd49e82bb592c82abc2c6d7351c436a46aad04bc41ca921a2d0546160b0e1ccecbbdafb92a6b5623837230fcb6e191a4e6cbafccf4d4957dd32c738c1f13f27749c95b9a39b5f87ba882c8acf10d6a56db6b3d92c5e577936f507d2f80ef8dab34a1518af323d706dc371ca7121853842c6a30ea9b4e9473d2c054dd233c21d022d6a775099de88db03ed49b50c3837a26d34a61e5bee01b6028a436426eb2445a4511cf78f2ae2b3e1dc06e2b61075fa44914d7a7c9faaec706e5136946731b9efdeab087d1e652d34aa4f5f97f23339466fa753a73f5388d6f6128f1f64afcf7223b41b118d41448e2fa8ceb7830998767e79eaada1676b201aad80a75f5f2efb7c21e91ba977f6d6f48b9818295c0bb31891389a2c1f5cb6f4a8fb9c6cecf45abec472c5400effe7c4b956", "78da75543b4f024110fe2b1e594e8e5bc85e8210b8868686c4d0d0d0d810131aa38dc6824a0b5b5b1f098d8d8fd668232660628c8009bfc89db96f1f20266466bf6fdeb37bec1e9eec6f1d1f0d939d53fe0d03254ba592122c02552d46918a02d58da5fc43f69874b8435a542a15024c0ab6c0dc662650e94a4e005b48e4f39694ce834e645ecbcab4852297cb2585404dee71f8bcb6c3449b844e18866192877b62e247344436893135ea29352f81dbd0a90da965cb31c41ef4f7150e3de8815950a351a780e90322178fd692d59a8c7819813a80c77c6caab3c136a94d493d6d90eeb2ab29c500c1ff83af67b7c14d228e6372ebf8572570995d90e90af63d126833ffc7b929fb0e26db295589f46d50b6fe8a4567851eba9131f70096f90d0ed371b15ce6edbd81f97902b3bce003095d6379669158455286fe552f6e6bd935a4bc08023abcc557c0a266855e0e6b1ac3cb903a5f4ec1827d38194fee2769b95eb0fb26fb98aa3a33daee672d910033bb4492c4762b5cdfaea1080d39a1436aebe3b49ce35a26fa3a2d6d9e259b01aa31bf1d3c02904ddfbd053d7b15db05150abf6ff30050ab4979a2b5cf546229d2341be36fc39f20f181792d933bf375befc02c9fdf6cb", "78da8d523d4fc33010fd2b3872d3467652db43962e5922a108294b6624d481b2b0213164a15b9918fb3fba331451fe16f6e5391f6ef990aa7b3ddfbb7bbee75c3fdc6fae6eee9e1ed79b56ab67fab5524a9550604a1a631467aae00edd219f54a228d20ba67287730ac461aa9920924a88c4a1ecf3c4e6fc42708a7fd5ec9c10cd720992097ba6dc20983171d865d85fd3febc4b24f7ab7b5a0d1f8e072104ad8d428ea1559665bd5b35254cade8ba0e6132ea05f21c3679bbbc4a2bcebc2559689774820b14630f8e6f6345fb88b750927423eaa7e6344dfb47eb9edeef15226434b004363fe099309f2f548c61926431c4eef9b1f57fde83b615985f2f170bf0b7019e5e7f65c571ac67b8a215fbdc83ddb553c0c3176891c3d71054d67ec8ce0f2149e8d6e3c304ae5976199cff0f6169f50dbc97b353", "78da7553bb4ec34010fc9538721eb62fc9b920a2a4a1499302376922455624376e924850a40124142468a08c4468298022150542b21d2a7e823fc1b737e7f30b29daf5eecdedccee6dcee6b3851f3456c1bcb15ccd16cbb57b7441bfb5c1e36dbfdfe7a6c17dd66a09cf1ccba298bc362a630b581563cbcc88712efc89a3e2c1809b647472dc6eb7f3b15ba11a1610da90469653e0f67a3d6e023d6684a9a913d01d043ef9ac9495d2e8bac5331956f0f1737968f032363b5dde2e640c1ec27b98454083c2b4c266b3e976521dc2770d1e5d32d156aabf277d720dc4297a1801a99598c49c99ba0cc3a509c5087cddac502705419d941adad247bb92aaa9aaa764ef5126d91c4b55d13ed5ebb6d28f371c4deafa0f5030849f90af33626131823023c30802920166df719c0c65a90d506da2a3612166c5a4aaafbaf3f004f17b1e90963e3c2a4e26395ddc98e246f489c4d896fd9629e2ad9ae08e159fcaff8f23f9d20d1556ad9a49c10ff461db3665c9936132936c302d39353225bec32d9a51bb3aa56500c1b95ac70f5d96be004eee454d4bdff672ffe48c521495f55cc46a0c1ef272514aa4d10b49117c82015d86e82dcc74a4d00087ea85be9fd40174f9d9dc45c9f2fbf9f803c45748fcdc9436b7ec7fef5eff00204b18eb", "78da8552b14ac44010fd960d9bdc8584307b97a40e481aebd407128414a6f1042dae15c142b41211c42fb0f20bee5004c1c24ff04bcc4edee4f6728210f6cdec7bb3f326bb0747cbb393e395c92ef85b29325118925654c6714c3a4d53d21c292a98119a194587c81b978c9324716b39da2e8aaacc0a142d586893308a220a39eaea3dcf3353459b67edfb56d732ce67332c9dc44daab9313631aec615bc5ff20149dfb5b4bdc44a3bc29245d6c044065194bb15551004c6874523ff6128eb366b46d4b6c05a6671dd99619670988519d3fb7ed8f7ddf5421bc1f52d040682fc3fe1fa0566cec1082e806f3756a074d4df756f6df3c8e5fdd277284015aecf26935bdd4db053035badb5c58f570e64489c588e7e9fa05cc96e673cd106e429c6f87c6276bbb88fa28428ff4bd3d9dc7b452df0eb7e542197ab27530ab0d3e0f4ef3b043fd757bf7795ac40", "78da95543d4b034110fd2b5eb8c4843bc2de91bb1ca4b149734d9a34690272cd3541d0220a692490084250500b4110fc03011b11ab7cd9a888bfc8dbb937bbcb25164298b7333b33796f6693eef0686f78787632f28253fa8c2cd1b1cb65613bae2bec288ab64e96f028213761a823f57a3dcb91c6122d2ad8995b2a95bcaa25daaa9b8c930995b1440a0c835a4d628232177e4a08a7e34bf473c78d24daea5a9a5a216779dd6c34e4a14f488648229c4246e2189a96d37a7e08212ea412cd9aae0b26cb02f316e5d8fb5551c91cbae41b89fb3c0a4b1c044140887b0fac39de813f60c53a8feebb887be8eb22ce79ab57ad1a8255cb7cf94a3531a21312b9478c8216388fa036de5e62a552f1caba32058650d385bf98f0e1de97f385b77e503c698bf9e85ba0d3fdc3e757b638d74f93c9658334f79382c700b89a17c65bc4d47c4929ef065fc883d4848ce4102afabcf808ef17bcda88bf4fccdd24be443f77d63356f60ca98b4b7489b79f3170f384a2c4eccbb78302aec6e8cc01a615c33f86bfb9e11dcd50a14a172fc8fdb852d393017e0350c32355e99f77bec9d07456636e79cb6a5417645c20e3678ac3f71b8d434b491c9438a6af4dc6e051ff65650cf438f3e9aa93a3dc428be68e9853dc4c0fdfe6fe8b07ff3ef58fa907fc9aff02ded22ccb", "78da5d533d4fc33010fd2da9dcb45132388a30c45eba7461a98458ba7461094319400886fe836e0cacb00223122b5285440704ff815fc2ddf3d94e90a23b7fbc7bf7ee723eb93ebfb8dad407b7f83699aead315a5555a58b4c77d8e479ae55a60d1f2aebdcc0b48e81a6691aad9241886bad2ed8507085e0d6129ae30a871505034a0cf56151f41988b3e5e4880753a6e7a02dcb52305047a1adf7157b821d271620da60e8ae1a8d46f534d30bf0f6595631936ab832c7c7585114e7a4e805720303294dec43a89078bcbe7823c71d36d2cacf2d16b1d583ee16fdc63ab4c5462d4110c5d7638a92726af613f2d09614a48297c808b66424709a881c60c2d6a59624e4d2f25e4da63a27446a484875e4896f04bebf57e3b154209d36f8ef4343a5cea43941b1194e99c2c890c258220f68c9d9b0f12b9f7cf724e0a0e24c2a32ac8eced741dde33f75d68f89ff1b30829c4991736809b318bb0584cfd9851113ff7127c9f7cf61d4526cff819d895f8b88ddab307c3d0c3a9ce9533c08bc1c700bef65bf5af2df2fcee2e1acc47b80dcfebcc96225fe77fbfe07c961cc39", "78da65543d8bdb4010fd2d326bf97452b12a62d8ddc68d1a3707e11a37d7a8110413b8c629ae49914092226972458a40204e190247c010ae9113433eee7e5334a3379ab50e8c473bf376e6cdd73e7e5a3fb92a1f3de3df5562db5d5114d62476bf4dd3d41a9ce62c71a8d492e72969426c9ebbe04916799659734a7fb1f99ccdec82018acaf39c002b967aa50f4480c496c02c46e6ce121f0a90cb950fff8521b40027934979d2dd86dc686c8625b65192ac76de59e343b019311dd4fa95d89ae569cfb8ddc1d17e1b930a28522524858856472b29c6f6c63bc7b7890003bcd37c494f76762985828b35106b39b307e471c1febba0e5942343bddf4a7c84c34cc0f545409f1dc1c97f76546c39e0720159c5082943a1f442dc974a1284943e154424d3ca544385e4e32b6eb41f10e2f28894cc614ca6805c3153cef20166d50fc190d708a50d950c0257c7bbbe5fa94f75b20229e510976a2559f31988c36b4468df1963e2a08c82b10c7d24c92e0c4e4b2016ae8747ca40e146a94a3acc9c73020f6ec14c292060058f959abb7c612c65a05194b9f7a88763fd19f48bd0ebdbe7502cb912fac7cebbd173463489fdf50ad136ccc7b810a590987edd64bd8410c98c00d99009a02529326a9ce72de0272783b204811221433c7f33747d2689a2864b282bb924bde2dac24323a98548d97ea62b4c0c5dacd907b09780751570d1088894a2226ccf1d571b3d48ac97d21ce0975d05b83998e8c12fec672c83446696c423d375fef91d3e0f1f43c4f05cba2ba1dfcbc7adf38cd8a04fcde87dfefd4dde2f909035ab715e8fec351cc96ed7f28060d2febe40410e6f47656bc423e49f1ff15e34c3e250de5dcaf5500338ac75b5e00c037677fdd0118571472f5f2ddb7e0bc5bf37d19036d1777b03e8fd1789229cccecc4a692cfa832eb61923ae3fd27339dead8edf07177fd1fa2789ce2", "78da7d53bd4ec330107e9644f9a9ab44b5451425f5d2a50c5db2b0b02021a64a8815860e4c483c014f80c4c21bc052a0cf457cfece764c8454ddf9eebefbf9eed2f3fdddf5ed41c907fa1db23c97592c8490599aa6aa4c64b5ec3a992d8d9b5e149b1122918a520835e6f94a2412b98bb2d8531485edb6604f2235e9a6698ca1088148eb23f05464849ef6cc682f460f4a5554ca4768c809c60b0fa597198a28950b59cc6d0d9c85e36e04785540b4b422723ada25dc0bafabbaae795c9527f20afe2de374df47eb31863091758fb2eb00b3891a28cee58694ce2004356aeacc4c130862e7cc3fbcad5381b26de179f311c6bab03532061e0e9a6d9ea3e27c6c4d47f87b68263bc4734fc5e44e1d7fb5530c7700971bd8a7470b59ade692fcb979312dfc2ddaf0e4a7b77fea08664202155ce6875bb3856ec9b6ff14f762b73ffc06f645d866705cc7ad7ebf308970dd612a80ac8f9f007cbddaceb826e097881e9ff0f879a6b66640ee2dfc11774cf0fd175f9ed182"];
private static var data2:Array;
public function MapData(){
_currentMapName = "New map";
super();
currentMap = 0;
if (Main.DEBUG >= 1){
maps.push("78da8d543f4bc35010ff2abe52d342d2f23298a54b3e815dbab814a4085902e252874eea20b8898ba2e8e05c411c54688524d646f03ba9cfbbbcf7ee5e5a21bccbfd7977bfdfdd25db7be38d74777f126e1daa67e2fbbe6c069d0e3b84dcd13e1225e410640832003970dad57521fbe8043db4ece0ec914c91e9b4d3234e37fc7eb3db35a10c94ae0fed4941c6608f2909c40bfe81d2f581ad62e684818add58e346a311b6851cffca9690239001d1b32904e64f8065c4586557ae1aac64cf35f91f265060681a03cff3c24de483336277b15fe55b2db8c45452257506d63fdcb2c4ac72b08e198e6f0854962f0c06006bb5a5875dc3cefe9150fdd68786929a95b2333e5621bfeec85ea5343c7203ff3c31357adb6a42716da5d21f601f689418509c02837cfe8fbdb0a66e493e020e7171092ff911c078bf21bb1111bdeacd0c6e2c2e68d247fed1d7ae1ecebc38af8148e5c7ccb53a81692c5f31f69ed58d565d0c00cc08f4e503269abafe63716d9f8be3952ca04c62672753cc6e69b2ea65396795abe8babead81e458fee76f33444b50");
maps.push("78dadd58cb4b545118ff571a196774e66a776ee066366e66338b66e3c68d1012b811c28d2ddc08528928124846842d26b3a22918a81162165747250b2ac1c726fa533ae7dcdf77de47c7a04d20df3de77cefe739e3edbbf33766efdc5bb815df177f0bb938ca0f0ec679017271da523b010ae5729c4f6edee4c8c9d2e828ffce0a8c38b4682ce6201082acad008904b9b8029bea4a9d00963a46a0f82d908bab9709512017371cd699a0f90116f0d5ca193a5db1d834d48683aa0215c17b9030048503df06b44f9367f2bc501002842001f2c3c33a808671304e2676c4c70a1e56766c33e67904c56114453a286b01cd7c75fcac186e091a33e9a66ce50c8ca805b3a2646b066616f1c808a04c65ee8c8c8c8055aca85820640cdf71c168d9a10ca4d20a58a6fb56b724e9384375bae1f64141023f51c14fb46e59a115b10d44f534743ba62c3fa42ddc8f7e7b9d45d2df2713bafd35d59a16202122da82554fe284f22a2024381c3220a49a80458132d69f5541a0ba532b0e558d561c197598958d5d8ce171a76fab4ec84d5ab736a9ac3133ea6a26ba73cf976d9ff9d684d5c66ca6246dc3286ad3bd2e2a21eda8840c0c0c548a8240acb46b2091680e86f8042c0ec50501683881767f1b24df9ea938d1ec6d25e688e1cd231b93e117b1a8c2dc59e35248e258b080b581d111d10881d574efa48bb064ef2516fb4f40926e213991db6ec6347800ce0abe3499c4bee8f615697c4f8ab2c06357033a5d91b12c02b5bfea960b9f21bed33ac4d0b5d3db04a2b72c6bd0ac53ba648c1bd92053b7df1490df3f87f2c7abc69fa0ec30827d1322310ae4e2e31d08375e3ed3e60b88a616a3a2226d52023fe813206d53cd3db6fa15039a0e10e33916afca200bd373901dbdc1e2e74327561e5f65d4b23afcda22d24ea23f5bdca94bb35251ccf8f4c926e30f844ce782ad422efaa8938377589c7589bb9da914f301a3a1a58e4c026d6c9c6cdbeaa7ae34502e0ee93975b66b38dc461c196168714ab13fd8b944aa3e4ea5c9326deea22fa95dd4fce1964d23d98fba2e1799d141227bcba0b958bb848bfaab23d9953b5ac82e9683327e7f7af5ffe110c3c3f57fcefc82a8d24ee8e718eb82d52b344829bd2563ceb9ac7edd6dba1fda7fc37e1da55f361d7faf5c5c1ff885954a252dc0622763ae7661aa7edc3a7f0bfe1f8bbe27247f01080205ca02941345d1cc1e2b0ac98144fa7e950427ce0c0c9d73289ac1672eff2de5f70a5572f2083e8ec9eb1998a35de8eb7df43d0412fd7f09f67f21c26540afc1f4b53fd7e7db2a9abc86a5ad45b9d3d37f9dc5f1d3c0edd22fc0a38459324f5e53f7927bbd3544ef741d8b5f4bd67d65a8a65e6dfe01149ae7d1");
maps.push("78daad53b10ac23010fd155bdaa8a59414254b972e5d44e8d27f500711c4c1a13fe1e4e2e8e4e0ec5c05fd2cd3f36ad2d34405a1dca3e4dedd7bafe9783699ae3acbc5625ec67c0d4f39ecf7b9a78ae7fb96e2f010ba06d1d05208e93f0cbb30c2608c7d62a83288229d11fcc2fd96012da4180266b5157bbfc385b14b4ec09ef8914ced8e94d62440d775e39ec313cb974fbd6e8fb3f76742c617fb12eb395d2541e0dc14df0bc40cfb1e12c18b3c24285aa240b83196c647b3ca64c17286db44505f20a9021075e6447f88cdd5d198b12a4a5bf67e75d15a69c6ea446f3d5d94e8b94bdd293247a8377c9a922ff9afebe01f615ae6c997c25f27ab51520762d1604010b75d767a68399ca2cff3013d5db6ad1e9c78ddeb97fcb6b9031aa0e162");
};
}
public function zLength():uint{
return (data2.length);
}
public function thisLatterLevel():Boolean{
return ((currentMap == (maps.length - 1)));
}
public function getValidate(_arg1:Point3D):Boolean{
return (!((((((((((((_arg1.x < 0)) || ((_arg1.x >= xLength())))) || ((_arg1.y < 0)))) || ((_arg1.y >= yLength())))) || ((_arg1.z < 0)))) || ((_arg1.z >= zLength())))));
}
public function clear():void{
if (currentMapData != null){
setMap(currentMapData);
} else {
newMap(15, 15, 15);
};
}
private function toArchive(_arg1:String):String{
var replacer:Function;
var source = _arg1;
replacer = function (_arg1:String, _arg2:String, ... _args):String{
return ((("!" + _arg2) + String.fromCharCode((39 + _arg1.length))));
};
return (HexConverter.convertToHex(source.replace(/(.)\1{3,}/g, replacer)));
}
function fromArchive(_arg1:String):String{
var replacer:Function;
var source = _arg1;
replacer = function (_arg1:String, _arg2:String, _arg3:String, ... _args):String{
var _local5:int;
var _local6:String;
_local5 = (_arg3.charCodeAt(0) - 39);
_local6 = "";
while (_local5--) {
_local6 = (_local6 + _arg2);
};
return (_local6);
};
if (source.split("|").length == 1){
source = HexConverter.convertFromHex(source);
};
return (source.replace(/!(.)(.)/g, replacer));
}
private function onRemoveTile(_arg1:EditTileEvent):void{
_arg1.tileValue = null;
onEditData(_arg1);
}
private function onEditData(_arg1:EditTileEvent):void{
var _local2:Point3D;
var _local3:WallsData;
_local2 = _arg1.position;
_local3 = _arg1.tileValue;
if (!getValidate(_local2)){
return;
};
data2[_local2.z][_local2.y][_local2.x] = _local3;
}
public function init():Boolean{
return (!((data2 == null)));
}
public function updateCurrentMap():void{
currentMapData = getMap();
}
public function newMap(_arg1:int=10, _arg2:int=10, _arg3:int=10):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
currentData = new Array();
_local4 = 0;
while (_local4 < _arg3) {
currentData[_local4] = new Array();
_local5 = 0;
while (_local5 < _arg2) {
currentData[_local4][_local5] = new Array();
_local6 = 0;
while (_local6 < _arg1) {
currentData[_local4][_local5][_local6] = null;
_local6++;
};
_local5++;
};
_local4++;
};
data2 = currentData;
currentMapData = getMap();
}
public function get currentMapName():String{
return (_currentMapName);
}
public function setMap(_arg1:String):void{
var _local2:Array;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:String;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:String;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:int;
_arg1 = fromArchive(_arg1);
_local2 = _arg1.split("|");
currentMapName = String(_local2.shift());
_local3 = _local2[0].split("x")[0];
_local4 = _local2[0].split("x")[1];
_local5 = _local2[0].split("x")[2];
_local2.shift();
_local6 = _local2.join("|");
currentData = new Array();
_local7 = 0;
while (_local7 < _local5) {
currentData[_local7] = new Array();
_local8 = 0;
while (_local8 < _local4) {
currentData[_local7][_local8] = new Array();
_local9 = 0;
while (_local9 < _local3) {
_local10 = _local6.substr(((((_local7 * (_local4 * _local3)) * 5) + ((_local8 * _local3) * 5)) + (_local9 * 5)), 5);
_local11 = (_local10.substr(0, 1).charCodeAt(0) - WallsData.MAP_CHAR_DELATA);
_local12 = (_local10.substr(1, 1).charCodeAt(0) - WallsData.MAP_CHAR_DELATA);
_local13 = (_local10.substr(2, 1).charCodeAt(0) - WallsData.MAP_CHAR_DELATA);
_local14 = int(_local10.substr(3, 1));
_local15 = (_local10.substr(4, 1).charCodeAt(0) - WallsData.MAP_CHAR_DELATA);
if (_local10 == "00000"){
currentData[_local7][_local8][_local9] = null;
} else {
currentData[_local7][_local8][_local9] = new WallsData(_local11, _local12, _local13, _local14, _local15);
};
_local9++;
};
_local8++;
};
_local7++;
};
currentMapData = _arg1;
data2 = currentData;
}
public function getMap(_arg1:String=""):String{
var _local2:uint;
var _local3:String;
var _local4:String;
var _local5:Number;
var _local6:uint;
var _local7:Number;
var _local8:uint;
var _local9:Number;
var _local10:WallsData;
_local2 = data2.length;
if (_arg1 == ""){
_local3 = currentMapName;
} else {
_local3 = _arg1;
};
_local4 = "";
_local5 = 0;
while (_local5 < _local2) {
_local6 = data2[_local5].length;
_local7 = 0;
while (_local7 < _local6) {
_local8 = data2[_local5][_local7].length;
_local9 = 0;
while (_local9 < _local8) {
_local10 = data2[_local5][_local7][_local9];
if (_local10 == null){
_local4 = (_local4 + "00000");
} else {
_local4 = (_local4 + _local10.getWallData());
};
_local9++;
};
_local7++;
};
_local5++;
};
return (toArchive(((((((((_local3 + "|") + _local8) + "x") + _local6) + "x") + _local2) + "|") + _local4)));
}
public function prevMap():void{
currentMap--;
if (currentMap < 0){
currentMap = (maps.length - 1);
};
setMap(maps[currentMap]);
}
public function set currentMapName(_arg1:String):void{
if (!UIRoot.gameStarting){
return;
};
_currentMapName = _arg1;
if (((UIRoot.customLevel) || (UIRoot.editor))){
HUD.mapName = _arg1;
} else {
HUD.mapName = Localization.INSTANCE.getValue((Localization.LEVEL + (currentMap + 1)));
if (HUD.mapName == ""){
HUD.mapName = _arg1;
};
};
}
public function nextMap():void{
currentMap++;
if (currentMap >= maps.length){
currentMap = 0;
};
setMap(maps[currentMap]);
}
public function newGame():void{
currentMap = 0;
setMap(maps[currentMap]);
}
public function setMapVisual(_arg1:MapVisual):void{
mapVisual = _arg1;
mapVisual.addEventListener(EditTileEvent.ADD_TILE, onEditData);
mapVisual.addEventListener(EditTileEvent.EDIT_TILE, onEditData);
mapVisual.addEventListener(EditTileEvent.REMOVE_TILE, onRemoveTile);
mapVisual.addEventListener(EditTileEvent.REMOVE_TILE_DATA, onRemoveTile);
}
public function getLevel():int{
var _local1:int;
_local1 = (UIRoot.getEditingLevel()) ? -1 : currentMap;
return (_local1);
}
public function xLength(_arg1:int=0, _arg2:int=0):uint{
if (((!((data2[_arg1] == undefined))) && (!((data2[_arg1][_arg2] == undefined))))){
return (data2[_arg1][_arg2].length);
};
return (0);
}
public function yLength(_arg1:int=0):uint{
if (data2[_arg1] != undefined){
return (data2[_arg1].length);
};
return (0);
}
public static function getValue(_arg1:Point3D):WallsData{
if (((((!((data2[_arg1.z] == undefined))) && (!((data2[_arg1.z][_arg1.y] == undefined))))) && (!((data2[_arg1.z][_arg1.y][_arg1.x] == undefined))))){
return (data2[_arg1.z][_arg1.y][_arg1.x]);
};
return (null);
}
public static function getValuePass(_arg1:Point3D):int{
var _local2:WallsData;
if (((((!((data2[_arg1.z] == undefined))) && (!((data2[_arg1.z][_arg1.y] == undefined))))) && (!((data2[_arg1.z][_arg1.y][_arg1.x] == undefined))))){
_local2 = data2[_arg1.z][_arg1.y][_arg1.x];
if (((((_local2) && (!((_local2.type == MapObject.TYPE_PLAYER))))) && (!(_local2.pass)))){
return (1);
};
};
return (0);
}
}
}//package
Section 124
//OldWall1 (OldWall1)
package {
import flash.display.*;
public dynamic class OldWall1 extends BitmapData {
public function OldWall1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 125
//OldWall1Normal (OldWall1Normal)
package {
import flash.display.*;
public dynamic class OldWall1Normal extends BitmapData {
public function OldWall1Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 126
//OldWall2 (OldWall2)
package {
import flash.display.*;
public dynamic class OldWall2 extends BitmapData {
public function OldWall2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 127
//OldWall2Normal (OldWall2Normal)
package {
import flash.display.*;
public dynamic class OldWall2Normal extends BitmapData {
public function OldWall2Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 128
//OldWall3 (OldWall3)
package {
import flash.display.*;
public dynamic class OldWall3 extends BitmapData {
public function OldWall3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 129
//OldWall3Normal (OldWall3Normal)
package {
import flash.display.*;
public dynamic class OldWall3Normal extends BitmapData {
public function OldWall3Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 130
//Ornament1 (Ornament1)
package {
import flash.display.*;
public dynamic class Ornament1 extends BitmapData {
public function Ornament1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 131
//Ornament1Normal (Ornament1Normal)
package {
import flash.display.*;
public dynamic class Ornament1Normal extends BitmapData {
public function Ornament1Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 132
//Player (Player)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
import tiles.*;
import map.*;
import flash.text.*;
import temp.*;
import flash.utils.*;
import math.*;
import flash.ui.*;
public class Player extends MapObject {
protected var left:Boolean;// = false
protected var right:Boolean;// = false
private var steps:Number;// = 0
private var standing:Boolean;// = false
private var frame:Number;// = 0
private var direction:String;
private var startGame:Boolean;// = false
private var state:String;
private var currentState:String;
protected var posText:TextField;
private var shadow:HeroShadow;
protected var moveX:Number;// = 0
protected var moveY:Number;// = 0
protected var moveZ:Number;// = 0
protected var gravityType:String;// = "normal"
protected var down:Boolean;// = false
protected var up:Boolean;// = false
protected var pix3dPosition:Point3D;
private var runFrame:int;// = -1
private var newState:Boolean;// = true
protected var game:Game;
private static const STATE_DIR_RIGHT:String = "right";
private static const STATE_NAME_RUN:String = "run";
private static const STATE_DIR_LEFT:String = "left";
private static const STATE_DIR_DOWN:String = "down";
private static const STATE_NAME_FLY:String = "fly";
private static const STATE_NAME_STANDING:String = "standing";
private static const GRAVITY:Number = 0.7;
private static const SPEED_PIX:Number = 200;
private static const STATE_DIR_UP:String = "up";
public function Player(_arg1:Point3D, _arg2:Game){
moveX = 0;
moveY = 0;
moveZ = 0;
right = false;
left = false;
up = false;
down = false;
gravityType = MapVisual.VIEW_NORMAL;
standing = false;
startGame = false;
frame = 0;
newState = true;
runFrame = -1;
steps = 0;
super(_arg1);
game = _arg2;
objectType = TYPE_PLAYER;
direction = STATE_DIR_DOWN;
setState(((STATE_NAME_STANDING + "_") + STATE_DIR_DOWN));
pix3dPosition = new Point3D((position.x * Tile.SIZE), (position.y * Tile.SIZE), (position.z * Tile.SIZE));
if (Main.DEBUG >= 3){
posText = new TextField();
posText.mouseEnabled = (posText.selectable = false);
posText.multiline = (posText.wordWrap = true);
posText.width = 300;
posText.height = 300;
posText.textColor = 0xFFFFFF;
posText.filters = [new GlowFilter(0, 2, 3, 3, 3)];
posText.x = 0;
posText.y = -50;
posText.text = pix3dPosition.toString();
addChild(posText);
};
shadow = new HeroShadow();
addChildAt(shadow, 0);
addEventListener(Event.ADDED_TO_STAGE, onAddToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
protected function onAction(_arg1:KeyboardEvent):void{
if (startGame){
if (_arg1.keyCode == 65){
left = true;
};
if (_arg1.keyCode == 68){
right = true;
};
if (_arg1.keyCode == 87){
up = true;
};
if (_arg1.keyCode == 83){
down = true;
};
if ((((_arg1.keyCode == Keyboard.RIGHT)) && (standing))){
if (gravityType == MapVisual.VIEW_LEFT){
gravityType = MapVisual.VIEW_NORMAL;
Game.setView(gravityType);
return;
};
if (gravityType == MapVisual.VIEW_RIGHT){
gravityType = MapVisual.VIEW_LEFT;
Game.setView(gravityType);
return;
};
if (gravityType == MapVisual.VIEW_NORMAL){
gravityType = MapVisual.VIEW_RIGHT;
Game.setView(gravityType);
return;
};
};
if ((((_arg1.keyCode == Keyboard.LEFT)) && (standing))){
if (gravityType == MapVisual.VIEW_LEFT){
gravityType = MapVisual.VIEW_RIGHT;
Game.setView(gravityType);
return;
};
if (gravityType == MapVisual.VIEW_RIGHT){
gravityType = MapVisual.VIEW_NORMAL;
Game.setView(gravityType);
return;
};
if (gravityType == MapVisual.VIEW_NORMAL){
gravityType = MapVisual.VIEW_LEFT;
Game.setView(gravityType);
return;
};
};
};
}
private function onRemovedFromStage(_arg1:Event):void{
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onAction);
stage.removeEventListener(KeyboardEvent.KEY_UP, onEndAction);
}
private function coliseumTest(_arg1:WallsData):Boolean{
var _local2:Boolean;
var _local3:Point3D;
var _local4:Point3D;
var _local5:CrushedTile;
_local2 = false;
if (((_arg1) && ((_arg1.type == MapObject.TYPE_DOOR_EXIT)))){
_local2 = game.finish();
};
if (((_arg1) && ((_arg1.type == MapObject.TYPE_BONUS)))){
Game.haveBonus();
_arg1.destroy();
};
if (((_arg1) && ((_arg1.type == MapObject.TYPE_CRUSHED_TILE)))){
_local3 = orentation(pix3dPosition.clone3d());
_local4 = new Point3D(Math.round((_local3.x / Tile.SIZE)), Math.round((_local3.y / Tile.SIZE)), Math.round((_local3.z / Tile.SIZE)));
_local5 = (Game.getTileByCoordinates(_local4) as CrushedTile);
if (_local5){
_local5.startCrush();
};
};
return (_local2);
}
private function setState(_arg1:String):void{
state = _arg1.split("_").shift();
_arg1 = ((gravityType + "_") + _arg1);
if (currentState != _arg1){
currentState = _arg1;
gotoAndStop(_arg1);
newState = true;
};
}
protected function moving():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:Number;
_local1 = 0;
_local2 = 0;
_local3 = (Main.lastTime - getTimer());
_local4 = ((_local3 / 1000) * -(SPEED_PIX));
if (left){
direction = STATE_DIR_LEFT;
_local1 = -(_local4);
} else {
if (right){
direction = STATE_DIR_RIGHT;
_local1 = _local4;
} else {
if (up){
direction = STATE_DIR_UP;
_local2 = -(_local4);
} else {
if (down){
direction = STATE_DIR_DOWN;
_local2 = _local4;
};
};
};
};
if (_local1 == 0){
moveX = (moveX + ((_local1 - moveX) / 3));
if (Math.abs(moveX) < 0.5){
moveX = 0;
};
} else {
if ((((((_local1 < 0)) && ((moveX > 0)))) || ((((_local1 > 0)) && ((moveX < 0)))))){
moveX = 0;
};
if (moveX == 0){
moveX = (_local1 / 3);
};
moveX = (moveX + ((_local1 - moveX) / 25));
if (moveY != 0){
if (moveX < 0){
moveX = -(Math.abs(moveY));
} else {
moveX = Math.abs(moveY);
};
};
moveY = 0;
};
if (_local2 == 0){
moveY = (moveY + ((_local2 - moveY) / 3));
if (Math.abs(moveY) < 0.5){
moveY = 0;
};
} else {
if ((((((_local2 < 0)) && ((moveY > 0)))) || ((((_local2 > 0)) && ((moveY < 0)))))){
moveY = 0;
};
if (moveY == 0){
moveY = (_local2 / 3);
};
moveY = (moveY + ((_local2 - moveY) / 25));
if (moveX != 0){
if (moveY < 0){
moveY = -(Math.abs(moveX));
} else {
moveY = Math.abs(moveX);
};
};
moveX = 0;
};
}
private function playAnimation():void{
var _local1:MovieClip;
var _local2:int;
var _local3:uint;
_local1 = (getChildAt(1) as MovieClip);
if (_local1){
_local2 = 1;
if (state == STATE_NAME_RUN){
_local2 = 0;
frame = (frame + (Math.abs((moveX + moveY)) / 4));
_local2 = frame;
frame = (frame - _local2);
if (newState){
if (runFrame == -1){
_local1.gotoAndStop(int((_local1.totalFrames / 4.5)));
} else {
_local1.gotoAndStop(runFrame);
};
};
runFrame = (_local1.currentFrame + _local2);
steps = (steps + (Math.abs((moveX + moveY)) / 40));
if (int(steps) == 1){
steps = 0;
SoundController.stap();
};
} else {
runFrame = -1;
};
_local3 = 0;
while (_local3 < _local2) {
if (_local1.currentFrame != _local1.totalFrames){
_local1.nextFrame();
} else {
_local1.gotoAndStop(1);
};
_local3++;
};
newState = false;
};
}
private function onAddToStage(_arg1:Event):void{
stage.addEventListener(KeyboardEvent.KEY_DOWN, onAction);
stage.addEventListener(KeyboardEvent.KEY_UP, onEndAction);
}
public function update():void{
var _local1:Point3D;
var _local2:Point3D;
var _local3:WallsData;
var _local4:Boolean;
var _local5:Point;
_local1 = orentation(pix3dPosition.clone3d());
_local2 = new Point3D(Math.round((_local1.x / Tile.SIZE)), Math.round((_local1.y / Tile.SIZE)), Math.round((_local1.z / Tile.SIZE)));
_local3 = MapData.getValue(_local2);
_local4 = true;
if (coliseumTest(_local3)){
return;
};
standing = false;
if (((_local3) && (!(_local3.pass)))){
moveZ = 0;
standing = true;
moving();
if (gravityType == MapVisual.VIEW_NORMAL){
_local1.x = (_local1.x + moveX);
_local1.y = (_local1.y + moveY);
_local1.z = pix3dPosition.z;
} else {
if (gravityType == MapVisual.VIEW_RIGHT){
_local1.z = (_local1.z + moveX);
_local1.x = (_local1.x + moveY);
_local1.y = pix3dPosition.y;
} else {
if (gravityType == MapVisual.VIEW_LEFT){
_local1.y = (_local1.y + moveX);
_local1.z = (_local1.z + moveY);
_local1.x = pix3dPosition.x;
};
};
};
_local2 = new Point3D(Math.round((_local1.x / Tile.SIZE)), Math.round((_local1.y / Tile.SIZE)), Math.round((_local1.z / Tile.SIZE)));
_local3 = MapData.getValue(_local2);
if (((_local3) && (!(_local3.pass)))){
if (gravityType == MapVisual.VIEW_NORMAL){
_local1.x = (_local1.x - moveX);
_local1.y = (_local1.y - moveY);
} else {
if (gravityType == MapVisual.VIEW_RIGHT){
_local1.z = (_local1.z - moveX);
_local1.x = (_local1.x - moveY);
} else {
if (gravityType == MapVisual.VIEW_LEFT){
_local1.y = (_local1.y - moveX);
_local1.z = (_local1.z - moveY);
};
};
};
if (((!(left)) && (!(right)))){
moveX = 0;
};
if (((!(up)) && (!(down)))){
moveY = 0;
};
};
if (coliseumTest(_local3)){
return;
};
if (pix3dPosition.compare(_local1)){
setState(((STATE_NAME_STANDING + "_") + direction));
} else {
setState(((STATE_NAME_RUN + "_") + direction));
};
shadow.visible = true;
} else {
shadow.visible = false;
moveX = 0;
moveY = 0;
if (moveZ > 9){
setState(((STATE_NAME_FLY + "_") + direction));
} else {
_local4 = false;
};
};
_local2 = new Point3D(Math.round((_local1.x / Tile.SIZE)), Math.round((_local1.y / Tile.SIZE)), Math.round((_local1.z / Tile.SIZE)));
if (!position.compare(_local2)){
position = _local2;
dispatchEvent(new MapObjectEvent(MapObjectEvent.UPDATE_POSITION));
};
moveZ = (moveZ + GRAVITY);
pix3dPosition = _local1;
_local5 = MathUtils.toMap(pix3dPosition);
x = _local5.x;
y = _local5.y;
if (Main.DEBUG >= 3){
posText.text = ((((pix3dPosition.toString() + "\n") + _local2) + "\n") + parent.getChildIndex(this));
};
if (moveZ > 45){
game.restart();
return;
};
if (((Game.startingGamingProcess) && (!(startGame)))){
startGame = true;
dispatchEvent(new MapObjectEvent(MapObjectEvent.UPDATE_POSITION));
};
if (_local4){
playAnimation();
};
}
protected function orentation(_arg1:Point3D):Point3D{
var _local2:Number;
var _local3:Number;
var _local4:Number;
if (gravityType == MapVisual.VIEW_NORMAL){
_local2 = 0;
_arg1.z = (_arg1.z - moveZ);
} else {
if (gravityType == MapVisual.VIEW_RIGHT){
_local2 = -134.5;
_arg1.y = (_arg1.y - moveZ);
} else {
if (gravityType == MapVisual.VIEW_LEFT){
_local2 = 108.1;
_arg1.x = (_arg1.x - moveZ);
};
};
};
_local3 = rotation;
if (_local3 < 0){
_local3 = (_local3 + 360);
};
if (_local2 < 0){
_local2 = (_local2 + 360);
};
_local4 = (_local2 - _local3);
if (_local4 > 180){
_local4 = (_local4 - 360);
} else {
if (_local4 < -180){
_local4 = (_local4 + 360);
};
};
rotation = (rotation + (_local4 / 5));
return (_arg1);
}
protected function onEndAction(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 65){
left = false;
};
if (_arg1.keyCode == 68){
right = false;
};
if (_arg1.keyCode == 87){
up = false;
};
if (_arg1.keyCode == 83){
down = false;
};
}
override public function destroy():void{
position = null;
pix3dPosition = null;
shadow.destroy();
removeChild(shadow);
shadow = null;
removeEventListener(Event.ADDED_TO_STAGE, onAddToStage);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
gravityType = MapVisual.VIEW_NORMAL;
Game.setView(gravityType);
if (stage){
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onAction);
stage.removeEventListener(KeyboardEvent.KEY_UP, onEndAction);
};
}
}
}//package
Section 133
//Point3D (Point3D)
package {
import flash.geom.*;
public class Point3D extends Point {
private var _z:Number;// = 0
public function Point3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
_z = 0;
super(_arg1, _arg2);
_z = _arg3;
}
public function set z(_arg1:Number):void{
_z = _arg1;
}
public function compare(_arg1:Point3D):Boolean{
return ((((((x == _arg1.x)) && ((y == _arg1.y)))) && ((z == _arg1.z))));
}
public function get z():Number{
return (_z);
}
override public function toString():String{
return ((((((("Point3D(x:" + x) + ",y:") + y) + ",z:") + z) + ")"));
}
public function clone3d():Point3D{
return (new Point3D(x, y, z));
}
public function setValue(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0):Point3D{
x = _arg1;
y = _arg2;
z = _arg3;
return (this);
}
}
}//package
Section 134
//Sand (Sand)
package {
import flash.display.*;
public dynamic class Sand extends BitmapData {
public function Sand(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 135
//SandNormal (SandNormal)
package {
import flash.display.*;
public dynamic class SandNormal extends BitmapData {
public function SandNormal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 136
//StarSound (StarSound)
package {
import flash.media.*;
public dynamic class StarSound extends Sound {
}
}//package
Section 137
//StartCrush1 (StartCrush1)
package {
import flash.media.*;
public dynamic class StartCrush1 extends Sound {
}
}//package
Section 138
//StartCrush2 (StartCrush2)
package {
import flash.media.*;
public dynamic class StartCrush2 extends Sound {
}
}//package
Section 139
//StartCrush3 (StartCrush3)
package {
import flash.media.*;
public dynamic class StartCrush3 extends Sound {
}
}//package
Section 140
//Step1 (Step1)
package {
import flash.media.*;
public dynamic class Step1 extends Sound {
}
}//package
Section 141
//Step2 (Step2)
package {
import flash.media.*;
public dynamic class Step2 extends Sound {
}
}//package
Section 142
//Step3 (Step3)
package {
import flash.media.*;
public dynamic class Step3 extends Sound {
}
}//package
Section 143
//Stone (Stone)
package {
import flash.display.*;
public dynamic class Stone extends BitmapData {
public function Stone(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 144
//Stone2 (Stone2)
package {
import flash.display.*;
public dynamic class Stone2 extends BitmapData {
public function Stone2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 145
//Stone2Normal (Stone2Normal)
package {
import flash.display.*;
public dynamic class Stone2Normal extends BitmapData {
public function Stone2Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 146
//StoneNormal (StoneNormal)
package {
import flash.display.*;
public dynamic class StoneNormal extends BitmapData {
public function StoneNormal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 147
//StoneWall2 (StoneWall2)
package {
import flash.display.*;
public dynamic class StoneWall2 extends BitmapData {
public function StoneWall2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 148
//StoneWall2Normal (StoneWall2Normal)
package {
import flash.display.*;
public dynamic class StoneWall2Normal extends BitmapData {
public function StoneWall2Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 149
//Texture1 (Texture1)
package {
import flash.display.*;
public dynamic class Texture1 extends BitmapData {
public function Texture1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 150
//Texture1Normal (Texture1Normal)
package {
import flash.display.*;
public dynamic class Texture1Normal extends BitmapData {
public function Texture1Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 151
//Wall (Wall)
package {
import tiles.*;
public dynamic class Wall extends TileWall {
}
}//package
Section 152
//Wall1 (Wall1)
package {
import flash.display.*;
public dynamic class Wall1 extends BitmapData {
public function Wall1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 153
//Wall1Normal (Wall1Normal)
package {
import flash.display.*;
public dynamic class Wall1Normal extends BitmapData {
public function Wall1Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 154
//Wall2 (Wall2)
package {
import flash.display.*;
public dynamic class Wall2 extends BitmapData {
public function Wall2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 155
//Wall2Normal (Wall2Normal)
package {
import flash.display.*;
public dynamic class Wall2Normal extends BitmapData {
public function Wall2Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 156
//Wall3 (Wall3)
package {
import flash.display.*;
public dynamic class Wall3 extends BitmapData {
public function Wall3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 157
//Wall4 (Wall4)
package {
import flash.display.*;
public dynamic class Wall4 extends BitmapData {
public function Wall4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 158
//WallShadow (WallShadow)
package {
import flash.display.*;
public dynamic class WallShadow extends MovieClip {
}
}//package
Section 159
//Wood1 (Wood1)
package {
import flash.display.*;
public dynamic class Wood1 extends BitmapData {
public function Wood1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 160
//Wood1Normal (Wood1Normal)
package {
import flash.display.*;
public dynamic class Wood1Normal extends BitmapData {
public function Wood1Normal(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package