STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229428
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2574 · P5147

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/62474114?noj=FRM62474114-1DC" width="1" height="1"></div>

xWUNG.swf

This is the info page for
Flash #47373

(Click the ID number above for more basic data on this flash file.)


ActionScript [AS3]
Section 1
//CollisionContext (com.lofiminds.gm.CollisionContext) package com.lofiminds.gm { public class CollisionContext { public var other:GameObject; } }//package com.lofiminds.gm
Section 2
//CollisionData (com.lofiminds.gm.CollisionData) package com.lofiminds.gm { import com.lofiminds.gm.*; import flash.geom.*; class CollisionData { var obbExtentY:Number; var aabbRect:Rectangle; var lastImage:GameImage; var obbAxisY:Vector; var isAABB:Boolean; var obbCenterX:Number; var obbCenterY:Number; var obbAxisX:Vector; var lastAngle:Number;// = 9999 var obbExtentX:Number; function CollisionData(){ aabbRect = new Rectangle(); obbAxisX = new Vector(); obbAxisY = new Vector(); super(); } } }//package com.lofiminds.gm
Section 3
//Collisions (com.lofiminds.gm.Collisions) package com.lofiminds.gm { import flash.utils.*; public final class Collisions { private static var cdLine:CollisionData = new CollisionData(); private static var classes:Array = new Array(); private static var gCollisionContext:CollisionContext = new CollisionContext(); private static var groupDuplicateMap:Dictionary = new Dictionary(); private static var groups:Array = new Array(); private static var obbCenterDiff:Vector = new Vector(); private static var debugCd:CollisionData; private static function SeparatedOnAxis(_arg1:CollisionData, _arg2:CollisionData, _arg3:Vector):Boolean{ var _local4:Number = Math.abs(_arg3.dot(obbCenterDiff)); return (((GetProjectedRadius(_arg1, _arg3) + GetProjectedRadius(_arg2, _arg3)) < _local4)); } static function drawCollisionBounds(_arg1:GameGraphics):void{ var _local3:Array; var _local4:int; var _local5:GameObject; var _local6:CollisionData; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; _arg1.lineStyle(2, 0xFF0000); var _local2:int; while (_local2 < classes.length) { _local3 = Instances.getAllOfClass(classes[_local2]); if (_local3 == null){ } else { _local4 = 0; while (_local4 < _local3.length) { _local5 = GameObject(_local3[_local4]); if (_local5.image == null){ } else { _local6 = _local5.collisionData; if (_local6.isAABB){ _arg1.drawRect(_local6.aabbRect); } else { _local7 = (_local6.obbAxisX.x * _local6.obbExtentX); _local8 = (_local6.obbAxisX.y * _local6.obbExtentX); _local9 = (_local6.obbAxisY.x * _local6.obbExtentY); _local10 = (_local6.obbAxisY.y * _local6.obbExtentY); _local11 = ((_local6.obbCenterX - _local7) - _local9); _local12 = ((_local6.obbCenterY - _local8) - _local10); _arg1.moveTo(_local11, _local12); _local11 = ((_local6.obbCenterX + _local7) - _local9); _local12 = ((_local6.obbCenterY + _local8) - _local10); _arg1.lineTo(_local11, _local12); _local11 = ((_local6.obbCenterX + _local7) + _local9); _local12 = ((_local6.obbCenterY + _local8) + _local10); _arg1.lineTo(_local11, _local12); _local11 = ((_local6.obbCenterX - _local7) + _local9); _local12 = ((_local6.obbCenterY - _local8) + _local10); _arg1.lineTo(_local11, _local12); _local11 = ((_local6.obbCenterX - _local7) - _local9); _local12 = ((_local6.obbCenterY - _local8) - _local10); _arg1.lineTo(_local11, _local12); }; }; _local4++; }; }; _local2++; }; } public static function line_collision(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Class):GameObject{ var _local12:GameObject; if (classes.indexOf(_arg5) == -1){ throw (new Error("must call register on class")); }; var _local6:Array = Instances.getAllOfClass(_arg5); if (_local6 == null){ return (null); }; var _local7:Number = GameUtil.point_distance(_arg1, _arg2, _arg3, _arg4); var _local8:Number = GameUtil.point_direction(_arg1, _arg2, _arg3, _arg4); _local7 = (_local7 * 0.5); cdLine.obbCenterX = (_arg1 + GameUtil.lengthdir_x(_local7, _local8)); cdLine.obbCenterY = (_arg2 + GameUtil.lengthdir_y(_local7, _local8)); cdLine.obbExtentX = _local7; cdLine.obbExtentY = 2; var _local9:Number = Math.sin((0 - _local8)); var _local10:Number = Math.cos(_local8); cdLine.obbAxisX.x = _local10; cdLine.obbAxisX.y = _local9; cdLine.obbAxisY.x = -(_local9); cdLine.obbAxisY.y = _local10; var _local11:int; while (_local11 < _local6.length) { _local12 = (_local6[_local11] as GameObject); if (_local12.image == null){ } else { if (testOBB_vs_OBB(cdLine, _local12.collisionData)){ return (_local12); }; }; _local11++; }; return (null); } static function update():void{ var _local3:CollisionData; var _local4:CollisionData; var _local5:Array; var _local6:int; var _local7:GameObject; var _local8:CollisionGroup; var _local9:Array; var _local10:int; var _local11:int; var _local12:GameObject; var _local13:Boolean; var _local1:int; while (_local1 < classes.length) { _local5 = Instances.getAllOfClass(classes[_local1]); if (_local5 == null){ } else { _local6 = 0; while (_local6 < _local5.length) { _local7 = GameObject(_local5[_local6]); if (_local7.image == null){ } else { _local7.prepareCollisionData(); }; _local6++; }; }; _local1++; }; var _local2:CollisionContext = gCollisionContext; _local1 = 0; while (_local1 < groups.length) { _local8 = (groups[_local1] as CollisionGroup); _local5 = Instances.getAllOfClass(_local8.class1); _local9 = Instances.getAllOfClass(_local8.class2); if ((((_local5 == null)) || ((_local9 == null)))){ } else { _local6 = 0; while (_local6 < _local5.length) { _local7 = GameObject(_local5[_local6]); if (_local7.image == null){ } else { _local3 = _local7.collisionData; _local10 = ((_local5)==_local9) ? (_local6 + 1) : 0; _local11 = _local10; while (_local11 < _local9.length) { _local12 = GameObject(_local9[_local11]); if (_local12.image == null){ } else { _local4 = _local12.collisionData; if (((_local3.isAABB) && (_local4.isAABB))){ _local13 = _local3.aabbRect.intersects(_local4.aabbRect); } else { _local13 = testOBB_vs_OBB(_local3, _local4); }; if (_local13){ _local2.other = _local12; _local7.onCollision(_local2); _local2.other = _local7; _local12.onCollision(_local2); break; }; }; _local11++; }; }; _local6++; }; }; _local1++; }; } private static function GetProjectedRadius(_arg1:CollisionData, _arg2:Vector):Number{ return (((_arg1.obbExtentX * Math.abs(_arg2.dot(_arg1.obbAxisX))) + (_arg1.obbExtentY * Math.abs(_arg2.dot(_arg1.obbAxisY))))); } public static function registerClass(_arg1:Class):void{ if (classes.indexOf(_arg1) == -1){ classes.push(_arg1); }; } private static function testOBB_vs_OBB(_arg1:CollisionData, _arg2:CollisionData):Boolean{ obbCenterDiff.x = (_arg1.obbCenterX - _arg2.obbCenterX); obbCenterDiff.y = (_arg1.obbCenterY - _arg2.obbCenterY); if (SeparatedOnAxis(_arg1, _arg2, _arg1.obbAxisX)){ return (false); }; if (SeparatedOnAxis(_arg1, _arg2, _arg1.obbAxisY)){ return (false); }; if (SeparatedOnAxis(_arg1, _arg2, _arg2.obbAxisX)){ return (false); }; if (SeparatedOnAxis(_arg1, _arg2, _arg2.obbAxisY)){ return (false); }; return (true); } public static function registerGroup(_arg1:Class, _arg2:Class):void{ var _local3:String = (String(_arg1) + String(_arg2)); if (groupDuplicateMap[_local3] != null){ throw (new Error(("duplicate collisiongroups: " + _local3))); }; trace(("dupkey:" + _local3)); groupDuplicateMap[_local3] = 1; registerClass(_arg1); registerClass(_arg2); var _local4:CollisionGroup = new CollisionGroup(); _local4.class1 = _arg1; _local4.class2 = _arg2; groups.push(_local4); } } }//package com.lofiminds.gm final class CollisionGroup { private var class1:Class; private var class2:Class; private function CollisionGroup(){ } }
Section 4
//GameApplication (com.lofiminds.gm.GameApplication) package com.lofiminds.gm { import flash.events.*; import flash.media.*; import flash.display.*; import flash.utils.*; public class GameApplication extends Sprite { public var fpsCount:int;// = 0 public var soundFxTransform:SoundTransform; public var showFps:Boolean;// = false public var showCollisionRects:Boolean;// = false private var fpsTime:int;// = 0 private var fpsFrames:int;// = 0 public function GameApplication(){ addEventListener(Event.ENTER_FRAME, run); addEventListener(Event.ADDED_TO_STAGE, onAddToStage); GameContext.app = this; } private function onAddToStage(_arg1:Event):void{ stage.addEventListener(KeyboardEvent.KEY_DOWN, GameInput.keyDownHandler); stage.addEventListener(KeyboardEvent.KEY_UP, GameInput.keyUpHandler); stage.addEventListener(MouseEvent.MOUSE_MOVE, GameInput.mouseMoveHandler); stage.addEventListener(MouseEvent.MOUSE_DOWN, GameInput.mouseDownHandler); stage.addEventListener(MouseEvent.MOUSE_UP, GameInput.mouseUpHandler); var _local2:GameRoom = createRoom(); addChild(_local2); _local2.init(); GameContext.room = _local2; this.onInit(); } public function playSound(_arg1:Sound):void{ _arg1.play(0, 0, this.soundFxTransform); } public function onInit():void{ } private function run(_arg1:Event):void{ Instances.updateGameObjects(); Collisions.update(); if (GameContext.room != null){ GameContext.room.repaint(); }; fpsFrames++; var _local2:int = getTimer(); if ((_local2 - fpsTime) > 1000){ fpsCount = (fpsFrames / ((_local2 - fpsTime) / 1000)); fpsFrames = 0; fpsTime = _local2; }; } public function createRoom():GameRoom{ return (new GameRoom()); } } }//package com.lofiminds.gm
Section 5
//GameContext (com.lofiminds.gm.GameContext) package com.lofiminds.gm { public final class GameContext { public static var app:GameApplication; public static var room:GameRoom; } }//package com.lofiminds.gm
Section 6
//GameGraphics (com.lofiminds.gm.GameGraphics) package com.lofiminds.gm { import flash.display.*; import flash.geom.*; public final class GameGraphics { private var bmp:BitmapData; public var hasVectorData:Boolean; private var offsetX:Number; private var offsetY:Number; private var g:Graphics; private var drawPoint:Point; private var saveX:Number; private var saveY:Number; private var drawMatrix:Matrix; public function GameGraphics(_arg1:Graphics, _arg2:BitmapData){ drawMatrix = new Matrix(); drawPoint = new Point(); super(); this.g = _arg1; this.bmp = _arg2; } final public function moveTo(_arg1:Number, _arg2:Number):void{ g.moveTo((_arg1 - offsetX), (_arg2 - offsetY)); } final public function drawRect(_arg1:Rectangle):void{ g.drawRect((_arg1.x - offsetX), (_arg1.y - offsetY), _arg1.width, _arg1.height); hasVectorData = true; } final public function clear():void{ g.clear(); hasVectorData = false; } final public function lineTo(_arg1:Number, _arg2:Number):void{ g.lineTo((_arg1 - offsetX), (_arg2 - offsetY)); hasVectorData = true; } final public function drawGameImage(_arg1:GameImage, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:ColorTransform=null, _arg7:Number=1):void{ drawPoint.x = ((_arg3 - offsetX) - _arg1.originX); drawPoint.y = ((_arg4 - offsetY) - _arg1.originY); var _local8:BitmapData = _arg1.getFrame(_arg2); if ((((((_arg5 == 0)) && ((_arg6 == null)))) && ((_arg7 == 1)))){ bmp.copyPixels(_local8, _local8.rect, drawPoint, null, null); } else { drawMatrix.identity(); drawMatrix.translate(-(_arg1.originX), -(_arg1.originY)); drawMatrix.rotate((0 - _arg5)); drawMatrix.scale(_arg7, _arg7); drawMatrix.translate(_arg1.originX, _arg1.originY); drawMatrix.translate(drawPoint.x, drawPoint.y); bmp.draw(_local8, drawMatrix, _arg6, null, null, false); }; } public function setOffset(_arg1:Number, _arg2:Number):void{ this.offsetX = _arg1; this.offsetY = _arg2; } final public function lineStyle(_arg1:Number, _arg2:uint=0, _arg3:Number=1):void{ g.lineStyle(_arg1, _arg2, _arg3); } final public function endScreenSpace():void{ offsetX = saveX; offsetY = saveY; } final public function beginScreenSpace():void{ saveX = offsetX; saveY = offsetY; offsetX = 0; offsetY = 0; } final public function drawObject(_arg1:DisplayObject, _arg2:Number, _arg3:Number):void{ _arg1.x = (_arg2 - offsetX); _arg1.y = (_arg3 - offsetX); bmp.draw(_arg1, _arg1.transform.matrix, _arg1.transform.colorTransform, null, null, false); } final public function drawCircle(_arg1:Number, _arg2:Number, _arg3:Number):void{ g.drawCircle((_arg1 - offsetX), (_arg2 - offsetY), _arg3); hasVectorData = true; } } }//package com.lofiminds.gm
Section 7
//GameImage (com.lofiminds.gm.GameImage) package com.lofiminds.gm { import flash.display.*; import flash.geom.*; public final class GameImage { public var boundsHeight:int; public var width:Number; public var boundsHalfHeight:Number; public var boundsWidth:int; private var originalBitmap:BitmapData; public var boundsHalfWidth:Number; private var frames:Array; public var height:Number; public var frameCount:int; public var originX:Number; public var originY:Number; public function GameImage(_arg1:BitmapData, _arg2:int=0, _arg3:int=0, _arg4:int=0, _arg5:int=0){ this.originalBitmap = _arg1; this.width = ((_arg2 == 0)) ? _arg1.width : _arg2; this.height = ((_arg3 == 0)) ? _arg1.height : _arg3; this.boundsWidth = ((_arg4 == 0)) ? this.width : _arg4; this.boundsHeight = ((_arg5 == 0)) ? this.height : _arg5; this.boundsHalfWidth = (boundsWidth * 0.5); this.boundsHalfHeight = (boundsHeight * 0.5); setOrigin(Math.floor((width * 0.5)), Math.floor((height * 0.5))); initFrames(); } public function colorTransform(_arg1:ColorTransform):GameImage{ var _local3:BitmapData; var _local2:int; while (_local2 < this.frameCount) { _local3 = getFrame(_local2); _local3.colorTransform(_local3.rect, _arg1); _local2++; }; return (this); } public function flipVertical():GameImage{ var _local4:BitmapData; var _local1:BitmapData = new BitmapData(this.width, this.height, true, 0xFFFFFF); var _local2:Matrix = new Matrix(); _local2.scale(1, -1); _local2.translate(0, this.height); var _local3:int; while (_local3 < this.frameCount) { _local4 = getFrame(_local3); _local1.fillRect(_local1.rect, 0xFFFFFF); _local1.draw(_local4, _local2); _local4.fillRect(_local4.rect, 0xFFFFFF); _local4.copyPixels(_local1, _local1.rect, new Point(0, 0)); _local3++; }; _local1.dispose(); return (this); } private function initFrames():void{ var _local1:Rectangle; var _local2:Point; var _local3:int; var _local4:BitmapData; if (this.width == originalBitmap.width){ frameCount = 1; } else { frameCount = (originalBitmap.width / width); frames = new Array(); _local1 = new Rectangle(0, 0, this.width, this.height); _local2 = new Point(0, 0); _local3 = 0; while (_local3 < frameCount) { _local4 = new BitmapData(this.width, this.height); _local1.x = (_local3 * this.width); _local4.copyPixels(originalBitmap, _local1, _local2); frames.push(_local4); _local3++; }; }; } public function clone():GameImage{ var _local1:BitmapData = originalBitmap.clone(); var _local2:GameImage = new GameImage(_local1, width, height, boundsWidth, boundsHeight); _local2.setOrigin(this.originX, this.originY); return (_local2); } public function setOrigin(_arg1:Number, _arg2:Number):GameImage{ originX = _arg1; originY = _arg2; return (this); } final public function getFrame(_arg1:Number):BitmapData{ if (frames == null){ return (originalBitmap); }; return (BitmapData(frames[int(_arg1)])); } } }//package com.lofiminds.gm
Section 8
//GameInput (com.lofiminds.gm.GameInput) package com.lofiminds.gm { import flash.events.*; import flash.utils.*; public final class GameInput { private static var mouseDispatchers:Dictionary = new Dictionary(); public static var mouseLeftDown:Boolean; public static var mouseX:int; private static var keyDispatchers:Dictionary = new Dictionary(); public static var MOUSE_LEFT_UP:int = 1; public static var mouseY:int; private static var keysPressed:Dictionary = new Dictionary(); public static var MOUSE_LEFT_DOWN:int = 0; public static function mouseUpHandler(_arg1:MouseEvent):void{ mouseLeftDown = false; dispatchMouse(MOUSE_LEFT_UP); } private static function dispatchMouse(_arg1:int):void{ var _local2:EventDispatcher = EventDispatcher(mouseDispatchers[_arg1]); if (_local2 != null){ _local2.dispatchEvent(new Event("mouse")); }; } public static function isKeyPressed(_arg1:uint):Boolean{ return (!((keysPressed[_arg1] == null))); } public static function keyUpHandler(_arg1:KeyboardEvent):void{ keysPressed[_arg1.keyCode] = null; } public static function removeMouseListener(_arg1:uint, _arg2:Function):void{ var _local3:EventDispatcher = EventDispatcher(mouseDispatchers[_arg1]); _local3.removeEventListener("mouse", _arg2); } public static function addMouseListener(_arg1:int, _arg2:Function):void{ var _local3:EventDispatcher = EventDispatcher(mouseDispatchers[_arg1]); if (_local3 == null){ _local3 = new EventDispatcher(); mouseDispatchers[_arg1] = _local3; }; _local3.addEventListener("mouse", _arg2, false, 0, true); } public static function removeKeyPressListener(_arg1:uint, _arg2:Function):void{ var _local3:EventDispatcher = EventDispatcher(keyDispatchers[_arg1]); _local3.removeEventListener("keypress", _arg2); } public static function keyDownHandler(_arg1:KeyboardEvent):void{ keysPressed[_arg1.keyCode] = true; var _local2:EventDispatcher = EventDispatcher(keyDispatchers[_arg1.keyCode]); if (_local2 != null){ _local2.dispatchEvent(new Event("keypress")); }; } public static function mouseDownHandler(_arg1:MouseEvent):void{ mouseLeftDown = true; dispatchMouse(MOUSE_LEFT_DOWN); } public static function mouseMoveHandler(_arg1:MouseEvent):void{ mouseX = _arg1.stageX; mouseY = _arg1.stageY; } public static function addKeyPressListener(_arg1:uint, _arg2:Function):void{ var _local3:EventDispatcher = EventDispatcher(keyDispatchers[_arg1]); if (_local3 == null){ _local3 = new EventDispatcher(); keyDispatchers[_arg1] = _local3; }; _local3.addEventListener("keypress", _arg2, false, 0, true); } } }//package com.lofiminds.gm
Section 9
//GameObject (com.lofiminds.gm.GameObject) package com.lofiminds.gm { import flash.geom.*; public class GameObject { public var hasColorTransform:Boolean;// = false public var colorTransform:ColorTransform; public var depth:int; public var gravityY:Number;// = 0 public var vspeed:Number;// = 0 public var useCustomDraw:Boolean; public var image:GameImage; public var hspeed:Number;// = 0 public var image_speed:Number;// = 0 public var image_count:Number;// = 0 public var image_index:Number;// = 0 public var image_angle:Number;// = 0 public var x:Number;// = 0 public var y:Number;// = 0 public var friction:Number;// = 0 var collisionData:CollisionData; public function GameObject(){ colorTransform = new ColorTransform(); collisionData = new CollisionData(); super(); } public function destroy():void{ } public function getClass():Class{ throw (new Error("baseclass getClass() called, must override")); } public function update():void{ var _local1:Number; if (image_speed != 0){ image_index = (image_index + image_speed); if (image_index >= image_count){ image_index = (image_index - image_count); animationEnd(); } else { if (image_index < 0){ image_index = (image_index + image_count); animationEnd(); }; }; }; x = (x + hspeed); y = (y + vspeed); vspeed = (vspeed + gravityY); if (friction != 0){ _local1 = getSpeed(); _local1 = Math.max((_local1 - friction), 0); setSpeedAndDirection(_local1, getDirection()); }; } public function onCollision(_arg1:CollisionContext):void{ } final public function getDirection():Number{ return ((0 - Math.atan2(vspeed, hspeed))); } final public function setImage(_arg1:GameImage):void{ if (image == _arg1){ return; }; image = _arg1; image_count = _arg1.frameCount; } public function set image_blend(_arg1:uint):void{ var _local2:uint = ((_arg1 >> 16) & 0xFF); var _local3:uint = ((_arg1 >> 8) & 0xFF); var _local4:uint = (_arg1 & 0xFF); colorTransform.redMultiplier = (_local2 / 0xFF); colorTransform.greenMultiplier = (_local3 / 0xFF); colorTransform.blueMultiplier = (_local4 / 0xFF); hasColorTransform = true; } final public function getSpeed():Number{ return (Math.sqrt(((hspeed * hspeed) + (vspeed * vspeed)))); } final public function setSpeedAndDirection(_arg1:Number, _arg2:Number):void{ _arg2 = (0 - _arg2); hspeed = (Math.cos(_arg2) * _arg1); vspeed = (Math.sin(_arg2) * _arg1); } public function onCustomDraw(_arg1:GameGraphics):Boolean{ return (true); } final public function motionAdd(_arg1:Number, _arg2:Number):void{ _arg1 = (0 - _arg1); hspeed = (hspeed + (Math.cos(_arg1) * _arg2)); vspeed = (vspeed + (Math.sin(_arg1) * _arg2)); } final function prepareCollisionData():void{ var _local3:Number; var _local4:Number; var _local5:Number; var _local1:CollisionData = this.collisionData; var _local2:Number = (_local1.lastAngle - image_angle); if (Math.abs(_local2) > 0.05){ _local1.lastAngle = image_angle; _local1.isAABB = (image_angle == 0); _local3 = (0 - image_angle); _local4 = Math.sin(_local3); _local5 = Math.cos(_local3); _local1.obbAxisX.x = _local5; _local1.obbAxisX.y = _local4; _local1.obbAxisY.x = -(_local4); _local1.obbAxisY.y = _local5; }; if (_local1.lastImage != this.image){ _local1.lastImage = this.image; _local1.aabbRect.width = image.boundsWidth; _local1.aabbRect.height = image.boundsHeight; _local1.obbExtentX = image.boundsHalfWidth; _local1.obbExtentY = image.boundsHalfHeight; }; if (_local1.isAABB){ _local1.aabbRect.x = (x - image.boundsHalfWidth); _local1.aabbRect.y = (y - image.boundsHalfHeight); }; _local1.obbCenterX = x; _local1.obbCenterY = y; } public function animationEnd():void{ } } }//package com.lofiminds.gm
Section 10
//GameRoom (com.lofiminds.gm.GameRoom) package com.lofiminds.gm { import flash.display.*; import flash.geom.*; import flash.text.*; import flash.utils.*; public class GameRoom extends Sprite { public var viewTopLeftX:int; public var viewTopLeftY:int; private var fpsText:TextField; private var bitmap:Bitmap; public var clearColor:uint; private var bitmapData:BitmapData; private var gameGraphics:GameGraphics; private var vectorShape:Shape; public function GameRoom(){ fpsText = new TextField(); super(); } function repaint():void{ bitmapData.lock(); bitmapData.fillRect(bitmapData.rect, this.clearColor); gameGraphics.clear(); gameGraphics.setOffset(viewTopLeftX, viewTopLeftY); drawObjects(); if (GameContext.app.showCollisionRects){ Collisions.drawCollisionBounds(gameGraphics); }; if (GameContext.app.showFps){ drawFps(); }; vectorShape.visible = gameGraphics.hasVectorData; bitmapData.unlock(); } public function init():void{ var _local1:int = this.stage.stageWidth; var _local2:int = this.stage.stageHeight; bitmapData = new BitmapData(_local1, _local2, false); bitmap = new Bitmap(bitmapData); this.addChild(bitmap); vectorShape = new Shape(); vectorShape.width = _local1; vectorShape.height = _local2; vectorShape.scaleX = 1; vectorShape.scaleY = 1; this.addChild(vectorShape); gameGraphics = new GameGraphics(vectorShape.graphics, this.bitmapData); } private function drawFps():void{ fpsText.autoSize = TextFieldAutoSize.LEFT; fpsText.text = GameContext.app.fpsCount.toString(); gameGraphics.drawObject(fpsText, 8, 8); } private function timerTest():void{ var _local1:int; var _local2:int; var _local4:ColorTransform; var _local3:Array = new Array(); _local1 = 0; while (_local1 < 10000) { _local3.push(new ColorTransform()); _local1++; }; var _local5:BitmapData = new BitmapData(64, 64); _local5.fillRect(new Rectangle(10, 10, 16, 16), 16744576); var _local6:Matrix = new Matrix(); _local6.rotate((Math.PI / 4)); _local2 = getTimer(); _local1 = 0; while (_local1 < 10000) { bitmapData.draw(_local5, _local6, null, null, null, true); _local1++; }; trace(("time smooth true: " + (getTimer() - _local2))); _local2 = getTimer(); _local1 = 0; while (_local1 < 10000) { bitmapData.draw(_local5, _local6, null, null, null, false); _local1++; }; trace(("time smooth false: " + (getTimer() - _local2))); _local2 = getTimer(); _local1 = 0; while (_local1 < 10000) { bitmapData.draw(_local5, _local6, ColorTransform(_local3[_local1]), null, null, true); _local1++; }; trace(("time smooth+ct: " + (getTimer() - _local2))); } private function drawObjects():void{ var _local1:GameObject; var _local4:Boolean; var _local6:BitmapData; var _local7:GameImage; var _local9:Array; var _local10:int; var _local11:int; var _local2:Point = new Point(0, 0); var _local3:Array = Instances.getObjectsPerDepth(); var _local5:Matrix = new Matrix(); var _local8:int; while (_local8 < _local3.length) { _local9 = (_local3[_local8] as Array); _local10 = _local9.length; _local11 = 0; while (_local11 < _local10) { _local1 = _local9[_local11]; _local7 = _local1.image; if (_local1.useCustomDraw){ _local4 = _local1.onCustomDraw(gameGraphics); } else { _local4 = true; }; if (((_local4) && (!((_local7 == null))))){ _local6 = _local7.getFrame(_local1.image_index); _local2.x = ((_local1.x - viewTopLeftX) - _local7.originX); _local2.y = ((_local1.y - viewTopLeftY) - _local7.originY); if ((((_local1.image_angle == 0)) && (!(_local1.hasColorTransform)))){ bitmapData.copyPixels(_local6, _local6.rect, _local2, null, null); } else { _local5.identity(); _local5.translate(-(_local7.originX), -(_local7.originY)); _local5.rotate((0 - _local1.image_angle)); _local5.translate(_local7.originX, _local7.originY); _local5.translate(_local2.x, _local2.y); bitmapData.draw(_local6, _local5, _local1.colorTransform, null, null, true); }; }; _local11++; }; _local8++; }; } } }//package com.lofiminds.gm
Section 11
//GameUtil (com.lofiminds.gm.GameUtil) package com.lofiminds.gm { import flash.display.*; import flash.geom.*; public class GameUtil { private static var randSeed:uint = 1; private static var hsvCt:ColorTransform = new ColorTransform(); public static function lengthdir_x(_arg1:Number, _arg2:Number):Number{ return ((Math.cos(_arg2) * _arg1)); } public static function lengthdir_y(_arg1:Number, _arg2:Number):Number{ return ((Math.sin((0 - _arg2)) * _arg1)); } public static function random():Number{ randSeed = ((((randSeed + 1) * 75) - 1) % 65537); return ((randSeed / 65537)); } public static function point_distance(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ var _local5:Number = (_arg3 - _arg1); var _local6:Number = (_arg4 - _arg2); return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6)))); } public static function setRandomSeed(_arg1:uint):void{ randSeed = _arg1; } public static function make_color_rgb(_arg1:uint, _arg2:uint, _arg3:uint):uint{ return (((((0xFF << 24) | (_arg1 << 16)) | (_arg2 << 8)) | _arg3)); } public static function setColorTransform(_arg1:uint, _arg2:ColorTransform):void{ var _local3:uint = ((_arg1 >> 16) & 0xFF); var _local4:uint = ((_arg1 >> 8) & 0xFF); var _local5:uint = (_arg1 & 0xFF); _arg2.redMultiplier = (_local3 / 0xFF); _arg2.greenMultiplier = (_local4 / 0xFF); _arg2.blueMultiplier = (_local5 / 0xFF); } public static function frac(_arg1:Number):Number{ return ((_arg1 - Math.floor(_arg1))); } public static function point_direction(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ var _local5:Number = (_arg3 - _arg1); var _local6:Number = (_arg4 - _arg2); return ((0 - Math.atan2(_local6, _local5))); } public static function randomize():void{ randSeed = (Math.random() * uint.MAX_VALUE); } public static function mergeColor(_arg1:uint, _arg2:uint, _arg3:Number=0.5):uint{ var _local7:uint; var _local8:uint; var _local4:Number = (1 - _arg3); var _local5:uint; var _local6:int; while (_local6 <= 16) { _local7 = ((_arg1 >> _local6) & 0xFF); _local8 = ((_arg2 >> _local6) & 0xFF); _local5 = (_local5 | (uint(Math.max(0, Math.min(0xFF, ((_local7 * _arg3) + (_local8 * _local4))))) << _local6)); _local6 = (_local6 + 8); }; return (_local5); } public static function displayToBitmap(_arg1:DisplayObject):BitmapData{ var _local2:BitmapData = new BitmapData(_arg1.width, _arg1.height, true, 0); _local2.draw(_arg1); return (_local2); } public static function degToRad(_arg1:Number):Number{ return ((_arg1 * 0.017453293)); } public static function sign(_arg1:Number):Number{ return (((_arg1 > 0)) ? 1 : ((_arg1 < 0)) ? -1 : 0); } public static function randomRange(_arg1:Number, _arg2:Number):Number{ return ((_arg1 + (((2 * random()) - 1) * _arg2))); } public static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{ if (_arg1 < _arg2){ return (_arg2); }; if (_arg1 > _arg3){ return (_arg3); }; return (_arg1); } public static function radToDeg(_arg1:Number):Number{ return ((_arg1 * 57.29577951)); } public static function make_color_hsv(_arg1:Number, _arg2:Number, _arg3:Number):uint{ var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:int; if (_arg2 == 0){ _local10 = _arg3; _local9 = _local10; _local8 = _local9; } else { _arg1 = (_arg1 * (1 / 60)); _local11 = Math.floor(_arg1); _local4 = (_arg1 - _local11); _local5 = (_arg3 * (1 - _arg2)); _local6 = (_arg3 * (1 - (_arg2 * _local4))); _local7 = (_arg3 * (1 - (_arg2 * (1 - _local4)))); switch (_local11){ case 0: _local8 = _arg3; _local9 = _local7; _local10 = _local5; break; case 1: _local8 = _local6; _local9 = _arg3; _local10 = _local5; break; case 2: _local8 = _local5; _local9 = _arg3; _local10 = _local7; break; case 3: _local8 = _local5; _local9 = _local6; _local10 = _arg3; break; case 4: _local8 = _local7; _local9 = _local5; _local10 = _arg3; break; default: _local8 = _arg3; _local9 = _local5; _local10 = _local6; break; }; }; hsvCt.redOffset = (_local8 * 0xFF); hsvCt.greenOffset = (_local9 * 0xFF); hsvCt.blueOffset = (_local10 * 0xFF); return (hsvCt.color); } } }//package com.lofiminds.gm
Section 12
//Instances (com.lofiminds.gm.Instances) package com.lofiminds.gm { import flash.geom.*; import flash.utils.*; public final class Instances { private static var objectsPerDepth:Array = new Array(); private static var allObjects:Array = new Array(); private static var objects:Dictionary = new Dictionary(); public static function exists(_arg1:Class):Boolean{ return (!((objects[_arg1] == null))); } public static function getObjectsPerDepth():Array{ return (objectsPerDepth); } public static function destroyAll(_arg1:Class=null):void{ var _local3:int; var _local4:int; var _local5:GameObject; if (_arg1 == null){ while (_local3 < allObjects.length) { GameObject(allObjects[_local3]).destroy(); _local3++; }; allObjects.length = 0; objects = new Dictionary(); return; }; var _local2:Array = objects[_arg1]; if (_local2 != null){ _local4 = 0; while (_local4 < _local2.length) { _local5 = GameObject(_local2[_local4]); swapRemove(allObjects, _local5); swapRemove(getDepthList(_local5.depth), _local5); _local5.destroy(); _local4++; }; _local2.length = 0; delete objects[_arg1]; }; } public static function destroy(_arg1:GameObject):void{ var _local2:Array = objects[_arg1.getClass()]; if (_local2 == null){ trace(("error 'a' is null: " + _arg1.getClass().toString())); return; }; swapRemove(_local2, _arg1); swapRemove(allObjects, _arg1); swapRemove(getDepthList(_arg1.depth), _arg1); _arg1.destroy(); if (_local2.length == 0){ delete objects[_arg1.getClass()]; }; } private static function getDepthList(_arg1:int):Array{ while (objectsPerDepth.length <= _arg1) { objectsPerDepth.push(new Array()); }; return ((objectsPerDepth[_arg1] as Array)); } public static function findAt(_arg1:Class, _arg2:Number, _arg3:Number):GameObject{ var _local8:GameObject; var _local4:Array = (objects[_arg1] as Array); if (_local4 == null){ return (null); }; var _local5:Rectangle = new Rectangle(); var _local6:Point = new Point(_arg2, _arg3); var _local7:int; while (_local7 < _local4.length) { _local8 = _local4[_local7]; _local5.x = (_local8.x - _local8.image.originX); _local5.y = (_local8.y - _local8.image.originY); _local5.width = _local8.image.boundsWidth; _local5.height = _local8.image.boundsHeight; if (_local5.containsPoint(_local6)){ return (_local8); }; _local7++; }; return (null); } private static function getAllObjects():Array{ return (allObjects); } static function getAllOfClass(_arg1:Class):Array{ return ((objects[_arg1] as Array)); } private static function swapRemove(_arg1:Array, _arg2:Object):void{ var _local4:Object; var _local3:int = _arg1.indexOf(_arg2); if ((_local3 == -1)){ trace("swapremove failed"); return; }; if (_local3 == (_arg1.length - 1)){ _arg1.pop(); } else { _local4 = _arg1.pop(); _arg1[_local3] = _local4; }; } static function updateGameObjects():void{ var _local1:GameObject; var _local2:Array = getAllObjects(); var _local3:int; while (_local3 < _local2.length) { _local1 = _local2[_local3]; _local1.update(); _local3++; }; } public static function getFirst(_arg1:Class):GameObject{ return (GameObject((objects[_arg1] as Array)[0])); } public static function create(_arg1:Class, _arg2:Number, _arg3:Number):GameObject{ var _local4:GameObject = new (_arg1); _local4.x = _arg2; _local4.y = _arg3; if (objects[_arg1] == null){ objects[_arg1] = new Array(); }; (objects[_arg1] as Array).push(_local4); allObjects.push(_local4); getDepthList(_local4.depth).push(_local4); if (_local4.image != null){ _local4.prepareCollisionData(); }; return (_local4); } } }//package com.lofiminds.gm
Section 13
//Vector (com.lofiminds.gm.Vector) package com.lofiminds.gm { public class Vector { public var x:Number; public var y:Number; public function Vector(_arg1:Number=0, _arg2:Number=0){ x = _arg1; y = _arg2; } public function cross(_arg1:Vector):Number{ return (((x * _arg1.y) - (y * _arg1.x))); } public function magnitude():Number{ return (Math.sqrt(((x * x) + (y * y)))); } public function divEquals(_arg1:Number):Vector{ if (_arg1 == 0){ _arg1 = 0.0001; }; x = (x / _arg1); y = (y / _arg1); return (this); } public function times(_arg1:Vector):Vector{ return (new Vector((x * _arg1.x), (y * _arg1.y))); } public function plusEquals(_arg1:Vector):Vector{ x = (x + _arg1.x); y = (y + _arg1.y); return (this); } public function dot(_arg1:Vector):Number{ return (((x * _arg1.x) + (y * _arg1.y))); } public function toString():String{ return (((x + " : ") + y)); } public function normalize():Vector{ var _local1:Number = magnitude(); if (_local1 == 0){ _local1 = 0.0001; }; return (mult((1 / _local1))); } public function minusEquals(_arg1:Vector):Vector{ x = (x - _arg1.x); y = (y - _arg1.y); return (this); } public function copy(_arg1:Vector):void{ x = _arg1.x; y = _arg1.y; } public function multEquals(_arg1:Number):Vector{ x = (x * _arg1); y = (y * _arg1); return (this); } public function minus(_arg1:Vector):Vector{ return (new Vector((x - _arg1.x), (y - _arg1.y))); } public function plus(_arg1:Vector):Vector{ return (new Vector((x + _arg1.x), (y + _arg1.y))); } public function distance(_arg1:Vector):Number{ var _local2:Vector = this.minus(_arg1); return (_local2.magnitude()); } public function setTo(_arg1:Number, _arg2:Number):void{ x = _arg1; y = _arg2; } public function mult(_arg1:Number):Vector{ return (new Vector((x * _arg1), (y * _arg1))); } } }//package com.lofiminds.gm
Section 14
//BgPiece (com.lofiminds.xwung.BgPiece) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; import flash.geom.*; public class BgPiece extends GameObject { var dirAdd:Number;// = 0 private var outside:Rectangle; var dir:Number;// = 0 private static var GxClass:Class = BgPiece_GxClass; private static var imageCache:Array = initImageCache(); private static var gameImage:GameImage = new GameImage(Bitmap(new GxClass()).bitmapData); public function BgPiece(){ setImage(gameImage); super(); outside = GameContext.room.getRect(null); outside.inflate(50, 50); this.image = imageCache[int((Math.random() * imageCache.length))]; } override public function getClass():Class{ return (BgPiece); } override public function update():void{ super.update(); dir = (dir + dirAdd); if (dirAdd < -0.01){ dirAdd = (dirAdd + 0.01); } else { if (dirAdd > 0.01){ dirAdd = (dirAdd - 0.01); } else { dirAdd = 0; }; }; var _local1:Number = GameUtil.degToRad(dir); this.setSpeedAndDirection(4, _local1); if (!outside.contains(x, y)){ Instances.destroy(this); }; } private static function initImageCache():Array{ var _local4:uint; var _local1:Array = new Array(10); var _local2:ColorTransform = new ColorTransform(); var _local3:int; while (_local3 < _local1.length) { _local4 = GameUtil.make_color_hsv(0, 0.47, (0.4 + (_local3 * 0.02))); GameUtil.setColorTransform(_local4, _local2); _local1[_local3] = gameImage.clone().colorTransform(_local2); _local3++; }; return (_local1); } } }//package com.lofiminds.xwung
Section 15
//BgPiece_GxClass (com.lofiminds.xwung.BgPiece_GxClass) package com.lofiminds.xwung { import mx.core.*; public class BgPiece_GxClass extends BitmapAsset { } }//package com.lofiminds.xwung
Section 16
//Blip (com.lofiminds.xwung.Blip) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; public class Blip extends GameObject { private static var GxClass:Class = Blip_GxClass; private static var images:Array = null; private static var gameImage:GameImage = new GameImage(Bitmap(new GxClass()).bitmapData, 68, 51); public function Blip(){ var _local1:int; super(); this.setImage(gameImage); depth = 1; image_speed = 0.5; if (images == null){ images = new Array(10); _local1 = 0; while (_local1 < images.length) { image_blend = GameUtil.make_color_hsv((28 + (GameUtil.random() * 42)), GameUtil.random(), 1); images[_local1] = gameImage.clone().colorTransform(this.colorTransform); _local1++; }; hasColorTransform = false; }; } override public function update():void{ super.update(); setImage(GameImage(images[int((Math.random() * 10))])); } override public function getClass():Class{ return (Blip); } override public function animationEnd():void{ super.animationEnd(); Instances.destroy(this); } } }//package com.lofiminds.xwung
Section 17
//Blip_GxClass (com.lofiminds.xwung.Blip_GxClass) package com.lofiminds.xwung { import mx.core.*; public class Blip_GxClass extends BitmapAsset { } }//package com.lofiminds.xwung
Section 18
//Bonus (com.lofiminds.xwung.Bonus) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; public class Bonus extends GameObject { private static var GxClass:Class = Bonus_GxClass; private static var gameImage:GameImage = new GameImage(Bitmap(new GxClass()).bitmapData, 32, 32, 16, 16); private static var time:int; public function Bonus(){ this.setImage(gameImage); depth = 1; image_speed = 0.2; time = 220; } override public function update():void{ super.update(); if (time-- == 0){ Instances.destroy(this); }; } override public function getClass():Class{ return (Bonus); } override public function destroy():void{ super.destroy(); Instances.create(Blip, x, y); } } }//package com.lofiminds.xwung
Section 19
//Bonus_GxClass (com.lofiminds.xwung.Bonus_GxClass) package com.lofiminds.xwung { import mx.core.*; public class Bonus_GxClass extends BitmapAsset { } }//package com.lofiminds.xwung
Section 20
//Boss (com.lofiminds.xwung.Boss) package com.lofiminds.xwung { import com.lofiminds.gm.*; public class Boss extends GameObject { private var gp:Gameplay; public function Boss(){ var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Boolean; var _local11:int; var _local12:Number; var _local13:Number; var _local14:Bosspart; var _local15:Bosspart; var _local16:Bossturret; var _local17:Bossturret; gp = Gameplay(Instances.getFirst(Gameplay)); super(); GameUtil.setRandomSeed(((gp.level + 1) * 23)); var _local1:int = Math.min((10 + ((gp.level * GameUtil.random()) * 6)), 50); var _local2:Number = (50 + (GameUtil.random() * 270)); var _local3:Number = (50 + (GameUtil.random() * 100)); this.y = -(_local3); var _local4:int; while (_local4 < _local1) { _local5 = (GameUtil.random() * _local2); _local6 = (-(_local3) + ((GameUtil.random() * _local3) * 2)); _local7 = Math.floor((GameUtil.random() * 5)); _local8 = (-90 + (GameUtil.random() * 180)); _local9 = (32 + (gp.level * 3)); if (_local9 > 70){ _local9 = 70; }; _local10 = ((20 + (GameUtil.random() * _local9)) > 50); _local11 = Math.floor((GameUtil.random() * Math.min(gp.level, Math.round((GameUtil.random() * 3))))); _local12 = (GameUtil.random() * 120); _local13 = GameUtil.degToRad(GameUtil.randomRange(0, 4)); _local14 = (Instances.create(Bosspart, (320 - _local5), (-180 + _local6)) as Bosspart); _local15 = (Instances.create(Bosspart, (320 + _local5), (-180 + _local6)) as Bosspart); _local14.childPart = _local15; _local15.parentPart = _local14; _local14.boss = this; _local14.image_index = _local7; _local14.image_angle = GameUtil.degToRad((270 + _local8)); _local15.boss = this; _local15.setImage(Bosspart.gameImageFlipped); _local15.image_index = _local7; _local15.image_angle = GameUtil.degToRad((270 - _local8)); if (_local10){ _local16 = _local14.createTurret(_local11, _local12, _local13); _local17 = _local15.createTurret(_local11, _local12, -(_local13)); _local16.childPart = _local17; _local17.parentPart = _local16; }; _local4++; }; } override public function update():void{ if (y < 200){ vspeed = 2; } else { this.friction = 0.1; }; if (((((!(Instances.exists(Bosspart))) && (!(Instances.exists(Bossturret))))) && (!(Instances.exists(Rocket))))){ Instances.destroy(this); gp.level = (gp.level + 0.02); Xwung.submitStatistic("Level", Math.round(gp.level)); }; super.update(); } override public function getClass():Class{ return (Boss); } } }//package com.lofiminds.xwung
Section 21
//Bosspart (com.lofiminds.xwung.Bosspart) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; public class Bosspart extends Bosspiece { var exploded:Boolean;// = false var boss:Boss; var childPart:Bosspart; var parentPart:Bosspart; private static var gameImage1:GameImage = new GameImage(Bitmap(new GxClass1()).bitmapData, 48, 48); static var gameImageFlipped:GameImage = gameImage1.clone().flipVertical(); private static var GxClass1:Class = Bosspart_GxClass1; public function Bosspart(){ setImage(gameImage1); useCustomDraw = true; depth = 1; energy = 8; } override public function getClass():Class{ return (Bosspart); } override public function update():void{ this.vspeed = boss.vspeed; image_blend = GameUtil.mergeColor(0xFFFFFF, GameUtil.make_color_hsv(169, 0.59, (0.39 + (Math.random() * 0.21))), hurt); if (((!((childPart == null))) && (childPart.exploded))){ childPart = null; }; if (((!((parentPart == null))) && (parentPart.exploded))){ parentPart = null; }; super.update(); } function createTurret(_arg1:int, _arg2:Number, _arg3:Number):Bossturret{ var _local4:Bossturret; _local4 = (Instances.create(Bossturret, x, y) as Bossturret); _local4.image_index = _arg1; _local4.image_angle = image_angle; _local4.reload = _arg2; _local4.boss = boss; _local4.turn = _arg3; return (_local4); } override public function destroy():void{ var _local2:Number; var _local5:GameObject; exploded = true; var _local1:Gameplay = (Instances.getFirst(Gameplay) as Gameplay); if (!_local1.isRestart){ _local1.giveScore(100, this); GameContext.app.playSound(Xwung.explodeSnd); }; var _local3:int = (_local1.isRestart) ? 2 : int((3 + (GameUtil.random() * 5))); _local2 = ((Math.random() * Math.PI) * 2); var _local4:int; while (_local4 < _local3) { _local5 = Instances.create(Explosion, x, y); _local5.setSpeedAndDirection((4 + (Math.random() * 12)), _local2); _local2 = (_local2 + ((Math.PI * 2) / _local3)); _local4++; }; super.destroy(); } override public function onCustomDraw(_arg1:GameGraphics):Boolean{ if (childPart != null){ _arg1.drawGameImage(this.image, ((image_index * 2) + 1), x, y, image_angle, colorTransform); _arg1.drawGameImage(childPart.image, ((image_index * 2) + 1), childPart.x, childPart.y, childPart.image_angle, colorTransform); _arg1.drawGameImage(this.image, (image_index * 2), x, y, image_angle, colorTransform); _arg1.drawGameImage(childPart.image, (image_index * 2), childPart.x, childPart.y, childPart.image_angle, colorTransform); } else { if (parentPart == null){ _arg1.drawGameImage(this.image, ((image_index * 2) + 1), x, y, image_angle, colorTransform); _arg1.drawGameImage(this.image, (image_index * 2), x, y, image_angle, colorTransform); }; }; return (false); } } }//package com.lofiminds.xwung
Section 22
//Bosspart_GxClass1 (com.lofiminds.xwung.Bosspart_GxClass1) package com.lofiminds.xwung { import mx.core.*; public class Bosspart_GxClass1 extends BitmapAsset { } }//package com.lofiminds.xwung
Section 23
//Bosspiece (com.lofiminds.xwung.Bosspiece) package com.lofiminds.xwung { import com.lofiminds.gm.*; public class Bosspiece extends GameObject { var energy:int;// = 0 var hurt:Number;// = 0 override public function update():void{ if (hurt > 0){ hurt = (hurt - 0.05); }; super.update(); } } }//package com.lofiminds.xwung
Section 24
//Bossturret (com.lofiminds.xwung.Bossturret) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; public class Bossturret extends Bosspiece { var exploded:Boolean;// = false var parentPart:Bossturret; var boss:Boss; var childPart:Bossturret; var reload:Number;// = 0 var turn:Number;// = 0 private static var gameImage1:GameImage = new GameImage(Bitmap(new GxClass1()).bitmapData, 32, 32).setOrigin(5, 16); private static var GxClass1:Class = Bossturret_GxClass1; public function Bossturret(){ setImage(gameImage1); useCustomDraw = true; depth = 3; energy = 8; } override public function getClass():Class{ return (Bossturret); } override public function update():void{ var _local1:GameObject; var _local2:Number; var _local3:int; if (boss != null){ this.vspeed = boss.vspeed; }; if (reload > 0){ reload = (reload - 1); } else { reload = 240; }; if (image_index == 0){ if (reload < 60){ image_angle = (image_angle + turn); }; if ((((reload < 80)) && ((GameUtil.frac((reload * 0.025)) == 0)))){ _local2 = GameUtil.degToRad(-15); _local3 = 0; while (_local3 < 5) { _local1 = Instances.create(Enemybullet, (x + GameUtil.lengthdir_x(28, (image_angle + _local2))), (y + GameUtil.lengthdir_y(28, (image_angle + _local2)))); _local1.setSpeedAndDirection(2, (image_angle + _local2)); _local2 = (_local2 + GameUtil.degToRad(7.5)); _local3++; }; }; }; if (image_index == 1){ if (reload < 90){ image_angle = (image_angle + turn); if (GameUtil.frac((reload * 0.1)) == 0){ _local1 = Instances.create(Enemybullet, (x + GameUtil.lengthdir_x(36, image_angle)), (y + GameUtil.lengthdir_y(36, image_angle))); _local1.setSpeedAndDirection(2, image_angle); _local1.image = Enemybullet.gameImage2; _local1.image_angle = image_angle; }; }; }; if (image_index == 2){ if (reload == 0){ _local2 = GameUtil.degToRad(-30); _local3 = 0; while (_local3 < 3) { _local1 = Instances.create(Rocket, (x + GameUtil.lengthdir_x(36, (image_angle + _local2))), (y + GameUtil.lengthdir_y(36, (image_angle + _local2)))); _local1.setSpeedAndDirection(3, (image_angle + _local2)); _local2 = (_local2 + GameUtil.degToRad(30)); _local3++; }; }; }; image_blend = GameUtil.mergeColor(0xFFFFFF, GameUtil.make_color_hsv(169, 0.29, (0.75 + (Math.random() * 0.21))), hurt); if (((!((childPart == null))) && (childPart.exploded))){ childPart = null; }; if (((!((parentPart == null))) && (parentPart.exploded))){ parentPart = null; }; super.update(); } override public function onCustomDraw(_arg1:GameGraphics):Boolean{ if (childPart != null){ _arg1.drawGameImage(this.image, ((image_index * 2) + 1), x, y, image_angle, colorTransform); _arg1.drawGameImage(childPart.image, ((image_index * 2) + 1), childPart.x, childPart.y, childPart.image_angle, colorTransform); _arg1.drawGameImage(this.image, (image_index * 2), x, y, image_angle, colorTransform); _arg1.drawGameImage(childPart.image, (image_index * 2), childPart.x, childPart.y, childPart.image_angle, colorTransform); } else { if (parentPart == null){ _arg1.drawGameImage(this.image, ((image_index * 2) + 1), x, y, image_angle, colorTransform); _arg1.drawGameImage(this.image, (image_index * 2), x, y, image_angle, colorTransform); }; }; return (false); } override public function destroy():void{ var _local2:Number; var _local5:GameObject; exploded = true; var _local1:Gameplay = (Instances.getFirst(Gameplay) as Gameplay); if (!_local1.isRestart){ _local1.giveScore(100, this); GameContext.app.playSound(Xwung.explodeSnd); }; var _local3:int = (_local1.isRestart) ? 2 : int((3 + (GameUtil.random() * 5))); _local2 = ((Math.random() * Math.PI) * 2); var _local4:int; while (_local4 < _local3) { _local5 = Instances.create(Explosion, x, y); _local5.setSpeedAndDirection((4 + (Math.random() * 12)), _local2); _local2 = (_local2 + ((Math.PI * 2) / _local3)); _local4++; }; super.destroy(); } } }//package com.lofiminds.xwung
Section 25
//Bossturret_GxClass1 (com.lofiminds.xwung.Bossturret_GxClass1) package com.lofiminds.xwung { import mx.core.*; public class Bossturret_GxClass1 extends BitmapAsset { } }//package com.lofiminds.xwung
Section 26
//ComboDraw (com.lofiminds.xwung.ComboDraw) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.text.*; public class ComboDraw extends GameObject { private var txt:TextField; var value:int; private var time:int; public function ComboDraw(){ txt = new TextField(); txt.defaultTextFormat = new TextFormat("Arial", 10, 0xFFFFFF); txt.autoSize = TextFieldAutoSize.LEFT; useCustomDraw = true; time = 25; depth = 3; } override public function onCustomDraw(_arg1:GameGraphics):Boolean{ txt.text = (value + " points combo bonus!"); _arg1.beginScreenSpace(); _arg1.drawObject(txt, (320 - (txt.width / 2)), 180); _arg1.endScreenSpace(); return (false); } override public function update():void{ if (time > 0){ time--; } else { if (colorTransform.alphaMultiplier > 0){ colorTransform.alphaMultiplier = (colorTransform.alphaMultiplier - 0.025); } else { Instances.destroy(this); }; }; } override public function getClass():Class{ return (_slot1); } } }//package com.lofiminds.xwung
Section 27
//Debris (com.lofiminds.xwung.Debris) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; import flash.geom.*; public class Debris extends GameObject { private var outside:Rectangle; private var isOutside:Boolean; private var life:int; private static var gameImage:GameImage = new GameImage(Bitmap(new GxClass()).bitmapData); private static var GxClass:Class = Debris_GxClass; public function Debris(){ this.setImage(gameImage); depth = 1; outside = GameContext.room.getRect(null); var _local1:Gameplay = (Instances.getFirst(Gameplay) as Gameplay); if (_local1.level < 2){ life = Math.round((10 + (_local1.level * 60))); } else { life = -1; }; } override public function destroy():void{ if (!isOutside){ Instances.create(Blip, x, y); }; super.destroy(); } override public function getClass():Class{ return (Debris); } override public function update():void{ super.update(); image_angle = (image_angle + (hspeed * 0.01)); if (life > 0){ life = (life - 1); }; if (life == 0){ Instances.destroy(this); }; if (!outside.contains(x, y)){ this.isOutside = true; Instances.destroy(this); }; } } }//package com.lofiminds.xwung
Section 28
//Debris_GxClass (com.lofiminds.xwung.Debris_GxClass) package com.lofiminds.xwung { import mx.core.*; public class Debris_GxClass extends BitmapAsset { } }//package com.lofiminds.xwung
Section 29
//Enemy1 (com.lofiminds.xwung.Enemy1) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; public class Enemy1 extends EnemyBase { private var targetX:Number; private var targetY:Number; private var turret:Bossturret; private static var gameImage1:GameImage = new GameImage(Bitmap(new GxClass1()).bitmapData, 32, 32); private static var GxClass1:Class = Enemy1_GxClass1; public function Enemy1(){ setImage(gameImage1); if ((Math.random() * 50) < 1){ image_index = 1; }; targetX = (Math.random() * 640); targetY = (Math.random() * 480); depth = 1; var _local1:Gameplay = (Instances.getFirst(Gameplay) as Gameplay); if ((((_local1.level > 2)) && ((Math.round((Math.random() * 4)) == 1)))){ turret = (Instances.create(Bossturret, x, y) as Bossturret); turret.image_index = Math.floor((Math.random() * 2)); turret.image_angle = image_angle; turret.reload = 240; }; } override public function getClass():Class{ return (Enemy1); } override public function update():void{ image_blend = GameUtil.make_color_hsv(169, 0.59, (0.78 + (Math.random() * 0.05))); var _local1:Number = GameUtil.point_direction(x, y, targetX, targetY); this.motionAdd(_local1, 0.1); var _local2:Number = GameUtil.point_distance(x, y, targetX, targetY); if (_local2 < 40){ GameUtil.setRandomSeed((this.x + (127 * this.y))); targetX = (GameUtil.random() * 640); targetY = (GameUtil.random() * 480); GameUtil.randomize(); }; var _local3:Number = getDirection(); if (getSpeed() > 1){ setSpeedAndDirection(1, _local3); }; image_angle = _local3; if (turret != null){ if (turret.exploded){ turret = null; } else { turret.x = x; turret.y = y; turret.image_angle = image_angle; }; }; super.update(); } override public function destroy():void{ if (((!((turret == null))) && (!(turret.exploded)))){ Instances.destroy(turret); }; super.destroy(); } } }//package com.lofiminds.xwung
Section 30
//Enemy1_GxClass1 (com.lofiminds.xwung.Enemy1_GxClass1) package com.lofiminds.xwung { import mx.core.*; public class Enemy1_GxClass1 extends BitmapAsset { } }//package com.lofiminds.xwung
Section 31
//Enemy2 (com.lofiminds.xwung.Enemy2) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; public class Enemy2 extends EnemyBase { private var propAngle:Number;// = 0 private var my_x:Number;// = 0 private var my_y:Number;// = 0 private static var gameImage1:GameImage = new GameImage(Bitmap(new GxClass1()).bitmapData, 48, 48, 32, 32); private static var GxClass1:Class = Enemy2_GxClass1; public function Enemy2(){ this.setImage(gameImage1); depth = 1; useCustomDraw = true; super(); } override public function getClass():Class{ return (Enemy2); } override public function onCustomDraw(_arg1:GameGraphics):Boolean{ _arg1.drawGameImage(image, 0, x, y, image_angle, this.colorTransform); _arg1.drawGameImage(image, 1, x, y, propAngle); return (false); } override public function update():void{ var _local1:GameObject; if (Instances.exists(Player)){ _local1 = Instances.getFirst(Player); my_x = _local1.x; my_y = _local1.y; } else { if (GameUtil.point_distance(x, y, my_x, my_x) < 40){ my_x = (Math.random() * 640); my_y = (Math.random() * 480); }; }; image_angle = add_rotation(GameUtil.point_direction(x, y, my_x, my_y), image_angle); this.motionAdd(image_angle, 0.1); if (this.getSpeed() > 2){ this.setSpeedAndDirection(2, this.getDirection()); }; image_blend = GameUtil.make_color_hsv(169, 0.35, (0.78 + (Math.random() * 0.15))); propAngle = (propAngle + 0.1); super.update(); } override public function destroy():void{ super.destroy(); } private function add_rotation(_arg1:Number, _arg2:Number):Number{ var _local4:Number; _arg1 = GameUtil.radToDeg(_arg1); _arg2 = GameUtil.radToDeg(_arg2); var _local3:Number = GameUtil.radToDeg(this.getDirection()); if (Math.abs((_arg1 - _local3)) > 2){ _local4 = _arg1; if ((_arg2 - _local4) > 180){ _local4 = (360 + _local4); }; if ((_local4 - _arg2) > 180){ _local4 = (_local4 - 360); }; if (_arg2 > _local4){ _arg2 = (_arg2 - 3); }; if (_arg2 < _local4){ _arg2 = (_arg2 + 3); }; }; return (GameUtil.degToRad(_arg2)); } } }//package com.lofiminds.xwung
Section 32
//Enemy2_GxClass1 (com.lofiminds.xwung.Enemy2_GxClass1) package com.lofiminds.xwung { import mx.core.*; public class Enemy2_GxClass1 extends BitmapAsset { } }//package com.lofiminds.xwung
Section 33
//Enemy3 (com.lofiminds.xwung.Enemy3) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; public class Enemy3 extends EnemyBase { private var my_x:Number;// = 0 private var my_y:Number;// = 0 private var attack:Boolean;// = false private var alarm:int;// = 240 private var lastDir:Number;// = 0 private var reload:int;// = 100 private static var gameImage1:GameImage = new GameImage(Bitmap(new GxClass1()).bitmapData, 48, 48, 44, 44); private static var GxClass1:Class = Enemy3_GxClass1; public function Enemy3(){ this.setImage(gameImage1); depth = 1; my_x = (Math.random() * 640); my_y = (Math.random() * 480); super(); } override public function getClass():Class{ return (Enemy3); } override public function update():void{ var _local1:GameObject; var _local2:Number; var _local3:int; if (alarm > 0){ if (--alarm == 0){ attack = true; }; }; if (Math.round((Math.random() * 200)) == 2){ image_speed = 0.5; }; if (this.getSpeed() > 0.1){ lastDir = this.getDirection(); }; if (!attack){ this.motionAdd(GameUtil.point_direction(x, y, my_x, my_y), 0.1); if (GameUtil.point_distance(x, y, my_x, my_y) < 40){ my_x = (Math.random() * 640); my_y = (Math.random() * 480); }; if (this.getSpeed() > 1){ this.setSpeedAndDirection(1, this.getDirection()); }; } else { if (Math.abs(this.getSpeed()) > 0.1){ this.setSpeedAndDirection((this.getSpeed() - 0.1), lastDir); } else { if (reload > 0){ reload--; } else { _local2 = 0; _local3 = 0; while (_local3 < 8) { _local1 = Instances.create(Debris, x, y); _local1.setSpeedAndDirection(5, _local2); _local1.image_angle = _local2; _local2 = (_local2 + GameUtil.degToRad(45)); _local3++; }; attack = false; reload = 100; alarm = 300; }; this.setSpeedAndDirection(0, lastDir); }; }; image_angle = lastDir; image_blend = GameUtil.make_color_hsv(169, 0.35, (0.78 + (Math.random() * 0.15))); super.update(); } override public function destroy():void{ super.destroy(); } override public function animationEnd():void{ image_speed = 0; super.animationEnd(); } } }//package com.lofiminds.xwung
Section 34
//Enemy3_GxClass1 (com.lofiminds.xwung.Enemy3_GxClass1) package com.lofiminds.xwung { import mx.core.*; public class Enemy3_GxClass1 extends BitmapAsset { } }//package com.lofiminds.xwung
Section 35
//EnemyBase (com.lofiminds.xwung.EnemyBase) package com.lofiminds.xwung { import com.lofiminds.gm.*; public class EnemyBase extends GameObject { override public function destroy():void{ var _local1:Number; var _local3:int; var _local4:int; var _local5:GameObject; var _local6:Number; var _local2:Gameplay = (Instances.getFirst(Gameplay) as Gameplay); if (!_local2.isRestart){ GameContext.app.playSound(Xwung.explodeSnd); _local2.giveScore(100, this); if (this.image_index == 1){ Instances.create(Bonus, x, y); }; _local4 = int(GameUtil.randomRange(6, 3)); _local1 = ((Math.random() * Math.PI) * 2); _local3 = 0; while (_local3 < _local4) { _local5 = Instances.create(Explosion, x, y); _local5.setSpeedAndDirection((4 + (Math.random() * 12)), _local1); _local1 = (_local1 + ((Math.PI * 2) / _local4)); _local3++; }; }; _local3 = 0; while (_local3 < (8 + int((Math.random() * 5)))) { _local5 = Instances.create(Blip, (x + GameUtil.randomRange(0, 20)), (y + GameUtil.randomRange(0, 20))); _local5.setSpeedAndDirection((Math.random() * 8), GameUtil.point_direction(x, y, _local5.x, _local5.y)); _local5.image_speed = (0.3 + (Math.random() * 0.2)); _local3++; }; _local1 = (image_angle + (Math.PI / 4)); _local3 = 0; while (_local3 < 4) { _local5 = Instances.create(Debris, (x + GameUtil.lengthdir_x(11, _local1)), (y + GameUtil.lengthdir_y(11, _local1))); _local6 = 4; if (_local2.level < 2){ _local6 = (_local2.level + 2); }; _local5.setSpeedAndDirection(_local6, _local1); _local5.image_angle = image_angle; _local1 = (_local1 + (Math.PI * 0.5)); _local3++; }; } } }//package com.lofiminds.xwung
Section 36
//Enemybullet (com.lofiminds.xwung.Enemybullet) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; import flash.geom.*; public class Enemybullet extends GameObject { private var outside:Rectangle; private static var gameImage1:GameImage = new GameImage(Bitmap(new GxClass1()).bitmapData, 8, 8); static var gameImage2:GameImage = new GameImage(Bitmap(new GxClass2()).bitmapData, 8, 3); private static var GxClass1:Class = Enemybullet_GxClass1; private static var GxClass2:Class = Enemybullet_GxClass2; public function Enemybullet(){ outside = GameContext.room.getRect(null); super(); setImage(gameImage1); depth = 2; image_speed = 0.5; } override public function update():void{ super.update(); if (!outside.contains(x, y)){ Instances.destroy(this); }; } override public function getClass():Class{ return (Enemybullet); } } }//package com.lofiminds.xwung
Section 37
//Enemybullet_GxClass1 (com.lofiminds.xwung.Enemybullet_GxClass1) package com.lofiminds.xwung { import mx.core.*; public class Enemybullet_GxClass1 extends BitmapAsset { } }//package com.lofiminds.xwung
Section 38
//Enemybullet_GxClass2 (com.lofiminds.xwung.Enemybullet_GxClass2) package com.lofiminds.xwung { import mx.core.*; public class Enemybullet_GxClass2 extends BitmapAsset { } }//package com.lofiminds.xwung
Section 39
//Explosion (com.lofiminds.xwung.Explosion) package com.lofiminds.xwung { import com.lofiminds.gm.*; public class Explosion extends GameObject { private var dirAdd:Number; private var count:Number; public function Explosion(){ depth = 1; dirAdd = GameUtil.degToRad(GameUtil.randomRange(0, 25)); count = GameUtil.randomRange(10, 5); } override public function getClass():Class{ return (Explosion); } override public function update():void{ super.update(); if (count > 0){ count = (count - 1); setSpeedAndDirection(this.getSpeed(), (getDirection() + dirAdd)); Instances.create(Blip, x, y); } else { Instances.destroy(this); }; } } }//package com.lofiminds.xwung
Section 40
//Gameplay (com.lofiminds.xwung.Gameplay) package com.lofiminds.xwung { import flash.events.*; import com.lofiminds.gm.*; import flash.display.*; import flash.text.*; import flash.utils.*; import flash.net.*; import flash.ui.*; public class Gameplay extends GameObject { private var bgUp:Boolean; private var scoreLabel:TextField; private var titleDraw:Number;// = 0 var isRestart:Boolean; private var dir1:Number;// = 0 private var combo:int; private var score:int; var level:Number;// = 0 private var scoreShake:Number;// = 0 private var bgDown:Boolean; private var dir2:Number;// = 0 var hasPowerup:Boolean; private var lofiSprite:Sprite; private var bgLeft:Boolean; private var titleAlpha:Number;// = 0 private var startSprite:Sprite; private var titleTxt1:TextField; private var comboTime:int; private var bgReload:int;// = 0 private static var titleImage:GameImage = new GameImage(Bitmap(new GxClass()).bitmapData); private static var StartGxClass:Class = Gameplay_StartGxClass; private static var GxClass:Class = Gameplay_GxClass; private static var LofiGxClass:Class = Gameplay_LofiGxClass; static var allowNewGame:Boolean = true; public function Gameplay(){ GameInput.addKeyPressListener(Keyboard.ENTER, onEnterPressed); scoreLabel = new TextField(); scoreLabel.defaultTextFormat = new TextFormat("_ScoreAndTitle", 12, 0); scoreLabel.embedFonts = true; scoreLabel.autoSize = TextFieldAutoSize.CENTER; scoreLabel.textColor = GameUtil.make_color_hsv(0, 0, 0.59); scoreLabel.text = "0 points"; depth = 3; this.useCustomDraw = true; } final function giveScore(_arg1:int, _arg2:GameObject):void{ setScore((score + _arg1)); if (scoreShake < 10){ scoreShake = 10; }; combo = (combo + 1); comboTime = 60; var _local3:NumberDraw = (Instances.create(NumberDraw, _arg2.x, _arg2.y) as NumberDraw); _local3.number = combo; } override public function update():void{ var _local1:Number; super.update(); updateBackground(); if (comboTime > 0){ comboTime--; } else { if (combo > 5){ Xwung.submitStatistic("Combo", combo); _local1 = 100; while (combo-- > 0) { if (_local1 < 10000){ _local1 = (_local1 * 1.3); } else { _local1 = (_local1 + 2500); }; }; _local1 = Math.round(((_local1 / 50) * 50)); setScore((score + _local1)); ComboDraw(Instances.create(ComboDraw, x, y)).value = _local1; scoreShake = 30; }; combo = 0; }; } private function setScore(_arg1:int):void{ score = _arg1; scoreLabel.text = (score.toString() + " points"); } private function updateBackground():void{ var _local1:BgPiece; if (GameContext.app.fpsCount < 50){ return; }; if (int((Math.random() * 120)) == 2){ bgLeft = false; }; if (int((Math.random() * 120)) == 2){ bgUp = false; }; if (int((Math.random() * 120)) == 2){ bgDown = false; }; if (int((Math.random() * 180)) == 2){ bgLeft = true; }; if (int((Math.random() * 180)) == 2){ bgUp = true; }; if (int((Math.random() * 180)) == 2){ bgDown = true; }; if (bgReload > 0){ bgReload = (bgReload - 1); } else { bgReload = 10; if (bgLeft){ makeBg(0, 180, dir1); makeBg(0, 220, dir2); makeBg(0, 260, -(dir2)); makeBg(0, 300, -(dir1)); makeBg(640, 180, -(dir1), 180); makeBg(640, 220, -(dir2), 180); makeBg(640, 260, dir2, 180); makeBg(640, 300, dir1, 180); }; makeBg(260, 0, dir1, 270); makeBg(300, 0, dir2, 270); makeBg(340, 0, -(dir2), 270); makeBg(380, 0, -(dir1), 270); if (bgDown){ makeBg(260, 480, -(dir1), 90); makeBg(300, 480, -(dir2), 90); makeBg(340, 480, dir2, 90); makeBg(380, 480, dir1, 90); dir1 = (dir1 + (-0.5 + Math.random())); dir2 = (dir2 + (-0.5 + Math.random())); dir1 = GameUtil.clamp(dir1, -5, 5); dir2 = GameUtil.clamp(dir2, -5, 5); }; }; } private function makeBg(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{ var _local5:BgPiece; _local5 = (Instances.create(BgPiece, _arg1, _arg2) as BgPiece); _local5.dirAdd = _arg3; _local5.dir = _arg4; } override public function onCustomDraw(_arg1:GameGraphics):Boolean{ if (scoreShake > 0){ scoreShake = (scoreShake - 0.5); }; _arg1.beginScreenSpace(); _arg1.drawObject(scoreLabel, ((320 - (scoreLabel.textWidth * 0.5)) + (scoreShake * GameUtil.randomRange(0, 0.3))), (16 - (scoreShake * GameUtil.randomRange(0, 0.3)))); _arg1.endScreenSpace(); drawTitleScreen(_arg1); return (false); } private function drawTitleScreen(_arg1:GameGraphics):void{ var _local2:Bitmap; var _local3:Bitmap; if (Instances.exists(Player)){ if (titleAlpha > 0){ titleAlpha = (titleAlpha - 0.02); }; } else { if (titleAlpha < 1){ titleAlpha = (titleAlpha + 0.02); }; }; if (titleAlpha <= 0.1){ return; }; if (titleTxt1 == null){ titleTxt1 = new TextField(); titleTxt1.defaultTextFormat = new TextFormat("_ScoreAndTitle", 12, 0xFF0000); titleTxt1.autoSize = TextFieldAutoSize.LEFT; titleTxt1.embedFonts = true; _local2 = Bitmap(new StartGxClass()); startSprite = new Sprite(); startSprite.x = (320 - (_local2.bitmapData.width / 2)); startSprite.y = 300; startSprite.addEventListener(MouseEvent.CLICK, onEnterPressed); startSprite.addChild(_local2); GameContext.app.addChild(startSprite); _local3 = Bitmap(new LofiGxClass()); lofiSprite = new Sprite(); lofiSprite.x = (320 - (_local3.bitmapData.width / 2)); lofiSprite.y = 420; lofiSprite.addEventListener(MouseEvent.CLICK, onLofiClicked); lofiSprite.addChild(_local3); GameContext.app.addChild(lofiSprite); }; this.colorTransform.alphaMultiplier = titleAlpha; titleTxt1.transform.colorTransform.alphaMultiplier = titleAlpha; startSprite.alpha = titleAlpha; lofiSprite.alpha = titleAlpha; if (titleDraw > 0){ titleDraw = (titleDraw - 0.01); } else { titleDraw = 5.99; }; startSprite.y = ((300 + (Math.sin((0.0025 * getTimer())) * 4)) + (Math.cos((0.0008 * getTimer())) * 6)); switch (Math.floor(titleDraw)){ case 5: titleTxt1.text = "MUSIC BY JOHN MARWIN"; break; case 4: titleTxt1.text = ("LAST SCORE: " + score); break; case 3: titleTxt1.text = "PRESS ENTER TO START"; break; case 2: titleTxt1.text = "GAME BY CACTUS"; break; case 1: titleTxt1.text = "FLASH VERSION BY VILLE"; break; case 0: titleTxt1.text = "LO-FI MINDS"; break; }; _arg1.drawObject(titleTxt1, (320 - (titleTxt1.width / 2)), 240); _arg1.drawGameImage(titleImage, 0, 320, 190, 0, this.colorTransform); } private function onEnterPressed(_arg1:Object):void{ if (!Instances.exists(Player)){ newGame(); }; } private function onLofiClicked(_arg1:Object):void{ var _local2:URLRequest = new URLRequest("http://www.lofiminds.com"); navigateToURL(_local2, "_blank"); } private function newGame():void{ if (!allowNewGame){ return; }; isRestart = true; Instances.destroyAll(Enemy1); Instances.destroyAll(Enemy2); Instances.destroyAll(Enemy3); Instances.destroyAll(Bosspart); Instances.destroyAll(Bossturret); Instances.destroyAll(Boss); Instances.destroyAll(Enemybullet); Instances.destroyAll(Rocket); Instances.destroyAll(Bonus); isRestart = false; Mouse.hide(); startSprite.visible = false; lofiSprite.visible = false; Instances.create(Player, 300, 300); Instances.create(Sledge, 300, 300); setScore(0); hasPowerup = false; } override public function destroy():void{ GameInput.removeKeyPressListener(Keyboard.ENTER, onEnterPressed); super.destroy(); } function onGameOver():void{ Xwung.submitScore(score); startSprite.visible = true; lofiSprite.visible = true; } } }//package com.lofiminds.xwung
Section 41
//Gameplay_GxClass (com.lofiminds.xwung.Gameplay_GxClass) package com.lofiminds.xwung { import mx.core.*; public class Gameplay_GxClass extends BitmapAsset { } }//package com.lofiminds.xwung
Section 42
//Gameplay_LofiGxClass (com.lofiminds.xwung.Gameplay_LofiGxClass) package com.lofiminds.xwung { import mx.core.*; public class Gameplay_LofiGxClass extends BitmapAsset { } }//package com.lofiminds.xwung
Section 43
//Gameplay_StartGxClass (com.lofiminds.xwung.Gameplay_StartGxClass) package com.lofiminds.xwung { import mx.core.*; public class Gameplay_StartGxClass extends BitmapAsset { } }//package com.lofiminds.xwung
Section 44
//Hitbox (com.lofiminds.xwung.Hitbox) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; public class Hitbox extends GameObject { private static var gameImage:GameImage = new GameImage(Bitmap(new GxClass()).bitmapData, 24, 24, 10, 6).setOrigin(12, 13); private static var GxClass:Class = Hitbox_GxClass; public function Hitbox(){ setImage(gameImage); image_speed = 0.2; depth = 3; } override public function destroy():void{ var _local1:Number; var _local3:int; var _local4:GameObject; _local1 = (image_angle + (Math.PI / 4)); _local3 = 0; while (_local3 < 4) { _local4 = Instances.create(Debris, (x + GameUtil.lengthdir_x(11, _local1)), (y + GameUtil.lengthdir_y(11, _local1))); _local4.setSpeedAndDirection(4, _local1); _local4.image_angle = image_angle; _local1 = (_local1 + (Math.PI * 0.5)); _local3++; }; var _local2:int = int(GameUtil.randomRange(6, 3)); _local1 = ((Math.random() * Math.PI) * 2); _local3 = 0; while (_local3 < _local2) { _local4 = Instances.create(Explosion, x, y); _local4.setSpeedAndDirection((4 + (Math.random() * 12)), _local1); _local1 = (_local1 + ((Math.PI * 2) / _local2)); _local3++; }; _local3 = 0; while (_local3 < (15 + int((Math.random() * 10)))) { _local4 = Instances.create(Blip, (x + GameUtil.randomRange(0, 20)), (y + GameUtil.randomRange(0, 20))); _local4.setSpeedAndDirection((Math.random() * 3), GameUtil.point_direction(x, y, _local4.x, _local4.y)); _local4.image_speed = (0.3 + (Math.random() * 0.7)); _local3++; }; } override public function getClass():Class{ return (Hitbox); } override public function onCollision(_arg1:CollisionContext):void{ Instances.destroy(this); Instances.destroy(Instances.getFirst(Player)); } } }//package com.lofiminds.xwung
Section 45
//Hitbox_GxClass (com.lofiminds.xwung.Hitbox_GxClass) package com.lofiminds.xwung { import mx.core.*; public class Hitbox_GxClass extends BitmapAsset { } }//package com.lofiminds.xwung
Section 46
//NumberDraw (com.lofiminds.xwung.NumberDraw) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.text.*; public class NumberDraw extends GameObject { var number:int; private var scale:Number; private static var images:Array = initImages(); public function NumberDraw(){ useCustomDraw = true; scale = 0.25; } override public function update():void{ if (scale < 1){ scale = (scale + 0.05); } else { if (colorTransform.alphaMultiplier > 0){ colorTransform.alphaMultiplier = (colorTransform.alphaMultiplier - 0.05); } else { Instances.destroy(this); }; }; } override public function getClass():Class{ return (_slot1); } override public function onCustomDraw(_arg1:GameGraphics):Boolean{ var _local2:GameImage; var _local3:int = (number - 1); if (_local3 >= images.length){ _local3 = (images.length - 1); }; _local2 = (images[_local3] as GameImage); _arg1.drawGameImage(_local2, 0, x, y, 0, this.colorTransform, scale); return (true); } private static function initImages():Array{ var _local1:Array = new Array(); var _local2:TextField = new TextField(); _local2.defaultTextFormat = new TextFormat("_Impact", 30, 0xFFFF00); _local2.embedFonts = true; _local2.autoSize = TextFieldAutoSize.LEFT; var _local3:int; while (_local3 < 20) { _local2.text = ((_local3 + 1).toString() + "x"); _local1.push(new GameImage(GameUtil.displayToBitmap(_local2))); _local3++; }; return (_local1); } } }//package com.lofiminds.xwung
Section 47
//Player (com.lofiminds.xwung.Player) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.media.*; import flash.display.*; import flash.geom.*; import flash.ui.*; public class Player extends GameObject { private var hitbox:GameObject; private var check:uint; private var gp:Gameplay; private var bonustime:int;// = 0 private var invincible:int; private static var GxClass:Class = Player_GxClass; private static var gameImage:GameImage = new GameImage(Bitmap(new GxClass()).bitmapData); private static var GxClass2:Class = Player_GxClass2; private static var snd1Class:Class = Player_snd1Class; private static var enemyTypes:Array = new Array(Enemy1, Enemy2, Enemy3); private static var chainImages:Array = initChainImages(); private static var chainImage:GameImage = new GameImage(Bitmap(new GxClass2()).bitmapData); static var explodePlayerSnd:Sound = Sound(new snd1Class()); public function Player(){ setImage(gameImage); useCustomDraw = true; depth = 2; invincible = 100; gp = (Instances.getFirst(Gameplay) as Gameplay); gp.level = 0.02; hitbox = Instances.create(Hitbox, x, y); } override public function update():void{ var _local1:Number; var _local2:Class; super.update(); if (int(this.x) != GameInput.mouseX){ x = ((GameInput.mouseX - 0.5) + Math.random()); }; if (int(this.y) != GameInput.mouseY){ y = ((GameInput.mouseY - 0.5) + Math.random()); }; hitbox.x = x; hitbox.y = y; if (GameUtil.frac(gp.level) > 0.0075){ GameUtil.setRandomSeed(check); check = (check + 17); if (Math.round((GameUtil.random() * (35 - (gp.level * 0.1)))) == 1){ gp.level = (gp.level + 0.02); _local1 = (GameUtil.random() * (Math.PI * 2)); _local2 = Enemy1; if (gp.level > 5){ _local2 = enemyTypes[int((Math.random() * enemyTypes.length))]; } else { if (gp.level > 4){ _local2 = enemyTypes[int((Math.random() * (enemyTypes.length - 1)))]; }; }; Instances.create(_local2, (320 + GameUtil.lengthdir_x(420, _local1)), (240 + GameUtil.lengthdir_y(420, _local1))); }; GameUtil.randomize(); }; if (GameUtil.frac(gp.level) < 0.0075){ if (!Instances.exists(Boss)){ if (((((!(Instances.exists(Enemy1))) && (!(Instances.exists(Enemy2))))) && (!(Instances.exists(Enemy3))))){ Instances.create(Boss, 320, -180); }; }; }; if (invincible > 0){ invincible--; }; if (bonustime > 0){ if (--bonustime == 0){ gp.hasPowerup = false; }; }; } override public function getClass():Class{ return (Player); } override public function onCollision(_arg1:CollisionContext):void{ if ((_arg1.other is Bonus)){ gp.hasPowerup = true; this.bonustime = 1000; Instances.destroy(_arg1.other); } else { if (invincible == 0){ Instances.destroy(this); }; }; } override public function onCustomDraw(_arg1:GameGraphics):Boolean{ if ((invincible & 8) != 0){ return (false); }; var _local2:GameObject = Instances.getFirst(Sledge); if (_local2 != null){ drawChain(_arg1, _local2.x, _local2.y); }; return (true); } override public function destroy():void{ GameContext.app.playSound(explodePlayerSnd); Instances.create(Rings, x, y); Instances.destroyAll(Sledge); Instances.destroyAll(Hitbox); gp.onGameOver(); Mouse.show(); super.destroy(); } private function drawChain(_arg1:GameGraphics, _arg2:Number, _arg3:Number):void{ var _local4:Number = GameUtil.point_direction(_arg2, _arg3, this.x, this.y); var _local5:Number = GameUtil.lengthdir_x(14, _local4); var _local6:Number = GameUtil.lengthdir_y(14, _local4); var _local7:int = int((GameUtil.point_distance(_arg2, _arg3, this.x, this.y) * (1 / 14))); var _local8:Number = 1; var _local9 = 1; while (_local9 < _local7) { _arg2 = (_arg2 + _local5); _arg3 = (_arg3 + _local6); if (gp.hasPowerup){ _local8 = ((_local9 & (1 == 1))) ? 1 : 2; }; _arg1.drawGameImage(GameImage(chainImages[int((Math.random() * chainImages.length))]), 0, _arg2, _arg3, 0, null, _local8); _local9++; }; } private static function initChainImages():Array{ var _local4:uint; var _local1:Array = new Array(10); var _local2:ColorTransform = new ColorTransform(); var _local3:int; while (_local3 < _local1.length) { _local4 = GameUtil.make_color_hsv((GameUtil.random() * 42), (1 - (GameUtil.random() * 0.39)), 1); GameUtil.setColorTransform(_local4, _local2); _local1[_local3] = chainImage.clone().colorTransform(_local2); _local3++; }; return (_local1); } } }//package com.lofiminds.xwung
Section 48
//Player_GxClass (com.lofiminds.xwung.Player_GxClass) package com.lofiminds.xwung { import mx.core.*; public class Player_GxClass extends BitmapAsset { } }//package com.lofiminds.xwung
Section 49
//Player_GxClass2 (com.lofiminds.xwung.Player_GxClass2) package com.lofiminds.xwung { import mx.core.*; public class Player_GxClass2 extends BitmapAsset { } }//package com.lofiminds.xwung
Section 50
//Player_snd1Class (com.lofiminds.xwung.Player_snd1Class) package com.lofiminds.xwung { import mx.core.*; public class Player_snd1Class extends SoundAsset { } }//package com.lofiminds.xwung
Section 51
//Rings (com.lofiminds.xwung.Rings) package com.lofiminds.xwung { import com.lofiminds.gm.*; public class Rings extends GameObject { private var r2:Number; private var r3:Number; private var limit:Number; private var r1:Number; public function Rings(){ this.useCustomDraw = true; r1 = (r2 = (r3 = 12)); limit = GameContext.room.getBounds(null).width; } override public function onCustomDraw(_arg1:GameGraphics):Boolean{ _arg1.lineStyle(1, GameUtil.make_color_hsv((28 + (Math.random() * 42)), Math.random(), Math.random())); _arg1.drawCircle(x, y, r1); _arg1.drawCircle(x, y, r2); _arg1.drawCircle(x, y, r3); return (false); } override public function update():void{ super.update(); if (r1 > limit){ Instances.destroy(this); } else { r1 = (r1 + 4); r2 = (r2 + 5); r3 = (r3 + 6); }; } override public function getClass():Class{ return (_slot1); } } }//package com.lofiminds.xwung
Section 52
//Rocket (com.lofiminds.xwung.Rocket) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; import flash.geom.*; public class Rocket extends Bosspiece { private var inside:Rectangle; private static var gameImage1:GameImage = new GameImage(Bitmap(new GxClass1()).bitmapData); private static var GxClass1:Class = Rocket_GxClass1; public function Rocket(){ inside = GameContext.room.getRect(null); super(); setImage(gameImage1); depth = 2; } override public function destroy():void{ var _local1:Number; var _local4:GameObject; var _local2:int = int((3 + (GameUtil.random() * 5))); _local1 = ((Math.random() * Math.PI) * 2); var _local3:int; while (_local3 < _local2) { _local4 = Instances.create(Explosion, x, y); _local4.setSpeedAndDirection((4 + (Math.random() * 12)), _local1); _local1 = (_local1 + ((Math.PI * 2) / _local2)); _local3++; }; super.destroy(); } override public function getClass():Class{ return (Rocket); } override public function update():void{ var _local2:GameObject; super.update(); var _local1:Boolean = Instances.exists(Player); if (_local1){ _local2 = Instances.getFirst(Player); this.motionAdd(GameUtil.point_direction(x, y, _local2.x, _local2.y), 0.05); } else { setSpeedAndDirection((getSpeed() + 0.05), getDirection()); }; if (getSpeed() > 3){ setSpeedAndDirection(3, getDirection()); }; image_angle = getDirection(); image_blend = GameUtil.make_color_hsv(169, 0.29, (0.75 + (Math.random() * 0.21))); if (Math.random() < 0.33){ Instances.create(Smoke, x, y); }; if (((!(_local1)) && (!(inside.contains(x, y))))){ Instances.destroy(this); }; } } }//package com.lofiminds.xwung
Section 53
//Rocket_GxClass1 (com.lofiminds.xwung.Rocket_GxClass1) package com.lofiminds.xwung { import mx.core.*; public class Rocket_GxClass1 extends BitmapAsset { } }//package com.lofiminds.xwung
Section 54
//Sledge (com.lofiminds.xwung.Sledge) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; public class Sledge extends GameObject { private var gp:Gameplay; private static var gameImage:GameImage = new GameImage(Bitmap(new GxClass()).bitmapData); private static var GxClass:Class = Sledge_GxClass; public function Sledge(){ setImage(gameImage); friction = 0.05; depth = 2; gp = (Instances.getFirst(Gameplay) as Gameplay); } override public function update():void{ var _local3:Number; var _local4:Bosspiece; var _local5:int; var _local6:GameObject; super.update(); var _local1:Player = (Instances.getFirst(Player) as Player); var _local2:Number = GameUtil.point_distance(x, y, _local1.x, _local1.y); if (_local2 > 12){ _local3 = ((_local2 - 12) * 0.0075); if (_local3 > 0){ this.motionAdd(GameUtil.point_direction(x, y, _local1.x, _local1.y), _local3); }; }; if (this.getSpeed() > 24){ this.setSpeedAndDirection(24, this.getDirection()); }; if (Instances.exists(Boss)){ _local4 = (Collisions.line_collision(_local1.x, _local1.y, x, y, Rocket) as Bosspiece); if (_local4 == null){ _local4 = (Collisions.line_collision(_local1.x, _local1.y, x, y, Bosspart) as Bosspiece); }; if (_local4 == null){ _local4 = (Collisions.line_collision(_local1.x, _local1.y, x, y, Bossturret) as Bosspiece); }; if (_local4 != null){ _local5 = (gp.hasPowerup) ? 100 : 1; _local4.hurt = 1; if ((_local4.energy = (_local4.energy - _local5)) < 0){ Instances.destroy(_local4); }; }; } else { _local6 = Collisions.line_collision(_local1.x, _local1.y, x, y, Enemy1); if (_local6 == null){ _local6 = Collisions.line_collision(_local1.x, _local1.y, x, y, Enemy2); }; if (_local6 == null){ _local6 = Collisions.line_collision(_local1.x, _local1.y, x, y, Enemy3); }; if (_local6 != null){ Instances.destroy(_local6); }; }; if (gp.hasPowerup){ if (Instances.exists(Boss)){ _local6 = Collisions.line_collision(_local1.x, _local1.y, x, y, Enemybullet); } else { _local6 = Collisions.line_collision(_local1.x, _local1.y, x, y, Debris); }; if (_local6 != null){ Instances.destroy(_local6); }; }; } override public function getClass():Class{ return (Sledge); } override public function onCollision(_arg1:CollisionContext):void{ var _local2:Number; if ((((_arg1.other is Bosspart)) || ((_arg1.other is Bossturret)))){ _local2 = getSpeed(); if (_local2 > 4){ setSpeedAndDirection((_local2 - 3), getDirection()); Instances.destroy(_arg1.other); }; }; } } }//package com.lofiminds.xwung
Section 55
//Sledge_GxClass (com.lofiminds.xwung.Sledge_GxClass) package com.lofiminds.xwung { import mx.core.*; public class Sledge_GxClass extends BitmapAsset { } }//package com.lofiminds.xwung
Section 56
//Smoke (com.lofiminds.xwung.Smoke) package com.lofiminds.xwung { import com.lofiminds.gm.*; import flash.display.*; public class Smoke extends GameObject { private static var gameImage1:GameImage = new GameImage(Bitmap(new GxClass1()).bitmapData, 12, 12); private static var GxClass1:Class = Smoke_GxClass1; public function Smoke(){ setImage(gameImage1); depth = 1; image_speed = (0.25 + (Math.random() * 0.5)); } override public function update():void{ super.update(); } override public function getClass():Class{ return (Smoke); } override public function animationEnd():void{ Instances.destroy(this); super.animationEnd(); } } }//package com.lofiminds.xwung
Section 57
//Smoke_GxClass1 (com.lofiminds.xwung.Smoke_GxClass1) package com.lofiminds.xwung { import mx.core.*; public class Smoke_GxClass1 extends BitmapAsset { } }//package com.lofiminds.xwung
Section 58
//Xwung (com.lofiminds.xwung.Xwung) package com.lofiminds.xwung { import flash.events.*; import com.lofiminds.gm.*; import flash.media.*; import mochi.*; public dynamic class Xwung extends GameApplication { private var music:Sound; public static var _font1:Class = Xwung__font1; public static var _font2:Class = Xwung__font2; static var explodeSnd:Sound = Sound(new snd1Class()); private static var snd1Class:Class = Xwung_snd1Class; private static var musicClass = Xwung_musicClass; public function Xwung(){ Collisions.registerGroup(Player, Enemy1); Collisions.registerGroup(Player, Enemy2); Collisions.registerGroup(Player, Enemy3); Collisions.registerGroup(Player, Debris); Collisions.registerGroup(Player, Bonus); Collisions.registerGroup(Sledge, Bosspart); Collisions.registerGroup(Sledge, Bossturret); Collisions.registerGroup(Hitbox, Enemybullet); Collisions.registerGroup(Hitbox, Bosspart); Collisions.registerGroup(Hitbox, Bossturret); Collisions.registerGroup(Hitbox, Rocket); this.showFps = true; this.soundFxTransform = new SoundTransform(0.3, 0); } private function initMusic():void{ music = Sound(new musicClass()); onMusicLoadComplete(null); } private function onMusicLoadComplete(_arg1:Event):void{ music.play(0, 9999); } override public function createRoom():GameRoom{ var _local1:GameRoom = super.createRoom(); _local1.clearColor = 4474424; return (_local1); } private function onMusicLoadError(_arg1:Event):void{ trace(("music load error: " + _arg1.toString())); } override public function onInit():void{ initMusic(); Instances.create(Gameplay, 50, 50); MochiServices.connect(Preloader._mochiads_game_id, root); } static function submitStatistic(_arg1:String, _arg2:int):void{ } static function submitScore(_arg1:int):void{ var finalscore = _arg1; Gameplay.allowNewGame = false; MochiScores.showLeaderboard({boardID:"5f48a1b3f7a83948", onClose:function ():void{ Gameplay.allowNewGame = true; }, score:finalscore}); } } }//package com.lofiminds.xwung
Section 59
//Xwung__font1 (com.lofiminds.xwung.Xwung__font1) package com.lofiminds.xwung { import mx.core.*; public class Xwung__font1 extends FontAsset { } }//package com.lofiminds.xwung
Section 60
//Xwung__font2 (com.lofiminds.xwung.Xwung__font2) package com.lofiminds.xwung { import mx.core.*; public class Xwung__font2 extends FontAsset { } }//package com.lofiminds.xwung
Section 61
//Xwung_musicClass (com.lofiminds.xwung.Xwung_musicClass) package com.lofiminds.xwung { import mx.core.*; public class Xwung_musicClass extends SoundAsset { } }//package com.lofiminds.xwung
Section 62
//Xwung_snd1Class (com.lofiminds.xwung.Xwung_snd1Class) package com.lofiminds.xwung { import mx.core.*; public class Xwung_snd1Class extends SoundAsset { } }//package com.lofiminds.xwung
Section 63
//MochiScores (mochi.MochiScores) package mochi { 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 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; }; }; }; 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; }; }; 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 _local3:Number; var _local4:Number; var _local5:Object; var _local6:Object; var _local7:String; var _local8:String; var _local2:Object = {}; 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{ 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
Section 64
//MochiServices (mochi.MochiServices) package mochi { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.net.*; import flash.system.*; public class MochiServices { private static var _container:Object; private static var _connected:Boolean = false; private static var _swfVersion:String; private static var _sendChannel:LocalConnection; private static var _rcvChannelName:String; private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf"; private static var _clip:MovieClip; private static var _loader:Loader; private static var _id:String; private static var _listenChannel:LocalConnection; private static var _timer:Timer; private static var _sendChannelName:String; private static var _startTime:Number; private static var _connecting:Boolean = false; public static var onError:Object; private static var _listenChannelName:String = "__mochiservices"; private static var _rcvChannel:LocalConnection; public static function isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } 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++; }; }; } 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); }; }; }; }; }; } 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); } public static function get id():String{ return (_id); } public static function stayOnTop():void{ _container.addEventListener(Event.ENTER_FRAME, _slot1.bringToTop, false, 0, true); if (_clip != null){ _clip.visible = true; }; } public static function getVersion():String{ return ("1.32"); } 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(); _rcvChannel.close(); } catch(error:Error) { }; }; if (_timer != null){ try { _timer.stop(); } catch(error:Error) { }; }; } public static function allowDomains(_arg1:String):String{ var _local2:String; Security.allowDomain("*"); Security.allowInsecureDomain("*"); if (_arg1.indexOf("http://") != -1){ _local2 = _arg1.split("/")[2].split(":")[0]; Security.allowDomain(_local2); Security.allowInsecureDomain(_local2); }; return (_local2); } public static function doClose():void{ _container.removeEventListener(Event.ENTER_FRAME, _slot1.bringToTop); if (_clip.parent != null){ Sprite(_clip.parent).removeChild(_clip); }; } 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 onStatus(_arg1:StatusEvent):void{ switch (_arg1.level){ case "error": _connected = false; _listenChannel.connect(_listenChannelName); break; }; } private static function initComChannels():void{ if (!_connected){ _sendChannel.addEventListener(StatusEvent.STATUS, _slot1.onStatus); _sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"}); _sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()}); _rcvChannel.addEventListener(StatusEvent.STATUS, _slot1.onStatus); _clip.onReceive = function (_arg1:Object):void{ var methodName:String; var pkg = _arg1; var cb:String = pkg.callbackID; var cblst:Object = this.client._callbacks[cb]; if (!cblst){ return; }; var method:* = cblst.callbackMethod; methodName = ""; var obj:Object = 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{ _slot1.onError("IOError"); }; _rcvChannel.connect(_rcvChannelName); trace("connected!"); _connecting = false; _connected = true; _listenChannel.close(); 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{ _slot1.comChannelName = _arg1.newChannel; }; _listenChannel.allowDomain("*", "localhost"); _listenChannel.allowInsecureDomain("*", "localhost"); _listenChannel.connect(_listenChannelName); trace("Waiting for MochiAds services to connect..."); } 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) { }; }; }; }; } public static function get clip():Object{ return (_container); } public static function set comChannelName(_arg1:String):void{ if (_arg1 != null){ if (_arg1.length > 3){ _sendChannelName = (_arg1 + "_fromgame"); _rcvChannelName = _arg1; initComChannels(); }; }; } private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{ var id = _arg1; var clip = _arg2; var clipname:String = ("_mochiservices_com_" + id); if (_clip != null){ return (_clip); }; if (!_slot1.isNetworkAvailable()){ return (null); }; _slot1.allowDomains(_gatewayURL); _clip = createEmptyMovieClip(clip, clipname, 10336, false); _loader = new Loader(); _timer = new Timer(1000, 0); _startTime = getTimer(); _timer.addEventListener(TimerEvent.TIMER, connectWait); _timer.start(); var f:Function = function (_arg1:Object):void{ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load."); _slot1.disconnect(); _slot1.onError("IOError"); }; _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f); var req:URLRequest = new URLRequest(_gatewayURL); _loader.load(req); _clip.addChild(_loader); _clip._mochiservices_com = _loader; _sendChannel = new LocalConnection(); _clip._queue = []; _rcvChannel = new LocalConnection(); _rcvChannel.allowDomain("*", "localhost"); _rcvChannel.allowInsecureDomain("*", "localhost"); _rcvChannel.client = _clip; _clip._nextcallbackID = 0; _clip._callbacks = {}; listen(); return (_clip); } public static function bringToTop(_arg1:Event):void{ var e = _arg1; if (_slot1.clip != null){ if (_slot1.childClip != null){ try { if (_slot1.clip.numChildren > 1){ _slot1.clip.setChildIndex(_slot1.childClip, (_slot1.clip.numChildren - 1)); }; } catch(errorObject:Error) { trace("Warning: Depth sort error."); _container.removeEventListener(Event.ENTER_FRAME, _slot1.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){ _slot1.onError = onError; } else { if (_slot1.onError == null){ _slot1.onError = function (_arg1:String):void{ trace(_arg1); }; }; }; } public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{ var parent = _arg1; var name = _arg2; var depth = _arg3; var doAdd = _arg4; var mc:MovieClip = 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 ((getTimer() - _startTime) > 10000){ if (!_connected){ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load."); _slot1.disconnect(); _slot1.onError("IOError"); }; _timer.stop(); }; } } }//package mochi
Section 65
//BitmapAsset (mx.core.BitmapAsset) package mx.core { import flash.display.*; public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject { mx_internal static const VERSION:String = "3.0.0.0"; public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){ super(_arg1, _arg2, _arg3); } public function get measuredWidth():Number{ if (bitmapData){ return (bitmapData.width); }; return (0); } public function get measuredHeight():Number{ if (bitmapData){ return (bitmapData.height); }; return (0); } public function setActualSize(_arg1:Number, _arg2:Number):void{ width = _arg1; height = _arg2; } public function move(_arg1:Number, _arg2:Number):void{ this.x = _arg1; this.y = _arg2; } } }//package mx.core
Section 66
//FlexBitmap (mx.core.FlexBitmap) package mx.core { import flash.display.*; import mx.utils.*; public class FlexBitmap extends Bitmap { mx_internal static const VERSION:String = "3.0.0.0"; public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){ var bitmapData = _arg1; var pixelSnapping = _arg2; var smoothing = _arg3; super(bitmapData, pixelSnapping, smoothing); try { name = NameUtil.createUniqueName(this); } catch(e:Error) { }; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 67
//FontAsset (mx.core.FontAsset) package mx.core { import flash.text.*; public class FontAsset extends Font implements IFlexAsset { mx_internal static const VERSION:String = "3.0.0.0"; } }//package mx.core
Section 68
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 69
//IFlexDisplayObject (mx.core.IFlexDisplayObject) package mx.core { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.accessibility.*; public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher { function get visible():Boolean; function get rotation():Number; function localToGlobal(_arg1:Point):Point; function get name():String; function set width(_arg1:Number):void; function get measuredHeight():Number; function get blendMode():String; function get scale9Grid():Rectangle; function set name(_arg1:String):void; function set scaleX(_arg1:Number):void; function set scaleY(_arg1:Number):void; function get measuredWidth():Number; function get accessibilityProperties():AccessibilityProperties; function set scrollRect(_arg1:Rectangle):void; function get cacheAsBitmap():Boolean; function globalToLocal(_arg1:Point):Point; function get height():Number; function set blendMode(_arg1:String):void; function get parent():DisplayObjectContainer; function getBounds(_arg1:DisplayObject):Rectangle; function get opaqueBackground():Object; function set scale9Grid(_arg1:Rectangle):void; function setActualSize(_arg1:Number, _arg2:Number):void; function set alpha(_arg1:Number):void; function set accessibilityProperties(_arg1:AccessibilityProperties):void; function get width():Number; function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean; function set cacheAsBitmap(_arg1:Boolean):void; function get scaleX():Number; function get scaleY():Number; function get scrollRect():Rectangle; function get mouseX():Number; function get mouseY():Number; function set height(_arg1:Number):void; function set mask(_arg1:DisplayObject):void; function getRect(_arg1:DisplayObject):Rectangle; function get alpha():Number; function set transform(_arg1:Transform):void; function move(_arg1:Number, _arg2:Number):void; function get loaderInfo():LoaderInfo; function get root():DisplayObject; function hitTestObject(_arg1:DisplayObject):Boolean; function set opaqueBackground(_arg1:Object):void; function set visible(_arg1:Boolean):void; function get mask():DisplayObject; function set x(_arg1:Number):void; function set y(_arg1:Number):void; function get transform():Transform; function set filters(_arg1:Array):void; function get x():Number; function get y():Number; function get filters():Array; function set rotation(_arg1:Number):void; function get stage():Stage; } }//package mx.core
Section 70
//IRepeaterClient (mx.core.IRepeaterClient) package mx.core { public interface IRepeaterClient { function get instanceIndices():Array; function set instanceIndices(_arg1:Array):void; function get isDocument():Boolean; function set repeaters(_arg1:Array):void; function initializeRepeaterArrays(_arg1:IRepeaterClient):void; function get repeaters():Array; function set repeaterIndices(_arg1:Array):void; function get repeaterIndices():Array; } }//package mx.core
Section 71
//mx_internal (mx.core.mx_internal) package mx.core { public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal"; }//package mx.core
Section 72
//SoundAsset (mx.core.SoundAsset) package mx.core { import flash.media.*; public class SoundAsset extends Sound implements IFlexAsset { mx_internal static const VERSION:String = "3.0.0.0"; } }//package mx.core
Section 73
//NameUtil (mx.utils.NameUtil) package mx.utils { import flash.display.*; import mx.core.*; import flash.utils.*; public class NameUtil { mx_internal static const VERSION:String = "3.0.0.0"; private static var counter:int = 0; public static function displayObjectToString(_arg1:DisplayObject):String{ var _local2:String; var _local4:String; var _local5:Array; var _local3:DisplayObject = _arg1; while (_local3 != null) { if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){ break; }; _local4 = _local3.name; if ((_local3 is IRepeaterClient)){ _local5 = IRepeaterClient(_local3).instanceIndices; if (_local5){ _local4 = (_local4 + (("[" + _local5.join("][")) + "]")); }; }; _local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2); _local3 = _local3.parent; }; return (_local2); } public static function createUniqueName(_arg1:Object):String{ if (!_arg1){ return (null); }; var _local2:String = getQualifiedClassName(_arg1); var _local3:int = _local2.indexOf("::"); if (_local3 != -1){ _local2 = _local2.substr((_local3 + 2)); }; var _local4:int = _local2.charCodeAt((_local2.length - 1)); if ((((_local4 >= 48)) && ((_local4 <= 57)))){ _local2 = (_local2 + "_"); }; return ((_local2 + counter++)); } } }//package mx.utils
Section 74
//MochiAd (MochiAd) package { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.system.*; import flash.net.*; public class MochiAd { public static function getVersion():String{ return ("2.5"); } public static function showClickAwayAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var chk:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{ }, ad_finished:function ():void{ }, ad_loaded:function (_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; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); options.ad_finished(); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; mc.unloadAd = function ():void{ MochiAd.unload(clip); }; mc.adLoaded = options.ad_loaded; mc.adSkipped = options.ad_skipped; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; var sendHostProgress:Boolean; mc.regContLC = function (_arg1:String):void{ mc._containerLCName = _arg1; }; chk["onEnterFrame"] = function ():void{ var _local4:Number; if (!this.parent){ delete this.onEnterFrame; return; }; var _local1:Object = this.parent._mochiad_ctr; var _local2:Number = (getTimer() - this.started); var _local3:Boolean; 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 = _arg1.split("/")[2].split(":")[0]; 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 clip:Object; var mc:MovieClip; var chk:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{ if ((this.clip is MovieClip)){ this.clip.stop(); } else { throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_finished:function ():void{ if ((this.clip is MovieClip)){ this.clip.play(); } else { throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_loaded:function (_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; var ad_msec:Number = 11000; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; var fadeout_time:Number = options.fadeout_time; delete options.fadeout_time; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); options.ad_finished(); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.ad_msec = ad_msec; chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; chk.fadeout_time = fadeout_time; chk.fadeFunction = function ():void{ if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; var _local1:Number = (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 = 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 _local4:Number; if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; var _local1:Object = this.parent._mochiad_ctr; var _local2:Number = (getTimer() - this.started); var _local3:Boolean; 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 _local4:String; var _local5:Array; var _local6:Number; var _local7:Array; var _local3:Object = {}; 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 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); }; var idx:Number = DisplayObjectContainer(mc).numChildren; while (idx > 0) { idx = (idx - 1); DisplayObjectContainer(mc).removeChildAt(idx); }; for (k in mc) { delete mc[k]; }; } public static function load(_arg1:Object):MovieClip{ var clip:Object; var k:String; var server:String; var hostname:String; var lc:LocalConnection; var name:String; var loader:Loader; var g:Function; var req:URLRequest; var v:Object; var options = _arg1; var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"}; options = MochiAd._parseOptions(options, DEFAULTS); options.swfv = 9; options.mav = MochiAd.getVersion(); clip = options.clip; if (!MochiAd._isNetworkAvailable()){ return (null); }; 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.")); }; var depth:Number = options.depth; delete options.depth; var mc:MovieClip = createEmptyMovieClip(clip, "_mochiad", depth); var wh:Array = MochiAd._getRes(options, clip); options.res = ((wh[0] + "x") + wh[1]); options.server = (options.server + options.id); delete options.id; clip._mochiad_loaded = true; if (clip.loaderInfo.loaderURL.indexOf("http") == 0){ options.as3_swf = clip.loaderInfo.loaderURL; }; var lv:URLVariables = new URLVariables(); for (k in options) { v = options[k]; if (!(v is Function)){ lv[k] = v; }; }; server = lv.server; delete lv.server; hostname = _allowDomains(server); lc = new LocalConnection(); lc.client = mc; name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_"); lc.allowDomain("*", "localhost"); lc.allowInsecureDomain("*", "localhost"); lc.connect(name); mc.lc = lc; mc.lcName = name; lv.lc = name; lv.st = getTimer(); loader = new Loader(); g = function (_arg1:Object):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); MochiAd.unload(clip); }; loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g); req = new URLRequest((server + ".swf")); req.contentType = "application/x-www-form-urlencoded"; req.method = URLRequestMethod.POST; req.data = lv; 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 = _arg2.split("."); var _local5:Number = 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 = 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 _local6:Array; var _local3:Object = _arg2.getBounds(_arg2.root); var _local4:Number = 0; var _local5:Number = 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 = _arg2.split("."); var _local4:Number = 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 = _arg2.split("."); var _local5:Number = 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 clip:Object; var mc:MovieClip; var chk:MovieClip; var complete:Boolean; var unloaded:Boolean; var sendHostProgress:Boolean; var r:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{ if ((this.clip is MovieClip)){ this.clip.stop(); } else { throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_finished:function ():void{ if ((this.clip is MovieClip)){ this.clip.play(); } else { throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_loaded:function (_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(); setTimeout(options.ad_finished, 100); return; }; clip = options.clip; var ad_msec:Number = 11000; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; var fadeout_time:Number = options.fadeout_time; delete options.fadeout_time; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); var fn:Function = function ():void{ options.ad_finished(); }; setTimeout(fn, 100); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.x = (w * -0.5); chk.y = (h * -0.5); var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4); if (options.no_progress_bar){ bar.visible = false; delete options.no_progress_bar; } else { bar.x = 10; bar.y = (h - 20); }; var bar_color:Number = options.color; delete options.color; var bar_background:Number = options.background; delete options.background; var bar_outline:Number = options.outline; delete options.outline; var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1); var backing:Object = backing_mc.graphics; backing.beginFill(bar_background); backing.moveTo(0, 0); backing.lineTo((w - 20), 0); backing.lineTo((w - 20), 10); backing.lineTo(0, 10); backing.lineTo(0, 0); backing.endFill(); var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2); var inside:Object = inside_mc.graphics; inside.beginFill(bar_color); inside.moveTo(0, 0); inside.lineTo((w - 20), 0); inside.lineTo((w - 20), 10); inside.lineTo(0, 10); inside.lineTo(0, 0); inside.endFill(); inside_mc.scaleX = 0; var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3); var outline:Object = outline_mc.graphics; outline.lineStyle(0, bar_outline, 100); outline.moveTo(0, 0); outline.lineTo((w - 20), 0); outline.lineTo((w - 20), 10); outline.lineTo(0, 10); outline.lineTo(0, 0); chk.ad_msec = ad_msec; chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; chk.last_pcnt = 0; chk.fadeout_time = fadeout_time; chk.fadeFunction = function ():void{ var _local1:Number = (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; var f:Function = 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 = 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 _local11:Number; if (((!(this.parent)) || (!(this.parent.parent)))){ delete this["onEnterFrame"]; return; }; var _local1:Object = this.parent.parent.root; var _local2:Object = this.parent._mochiad_ctr; var _local3:Number = (getTimer() - this.started); var _local4:Boolean; var _local5:Number = _local1.loaderInfo.bytesTotal; var _local6:Number = _local1.loaderInfo.bytesLoaded; if (complete){ _local6 = Math.max(1, _local6); _local5 = _local6; }; var _local7:Number = ((100 * _local6) / _local5); var _local8:Number = ((100 * _local3) / chk.ad_msec); var _local9:Object = this._mochiad_bar._inside; var _local10:Number = 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 mc = _arg1; var f:Function = 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
Section 75
//Preloader (Preloader) package { import flash.events.*; import flash.display.*; import flash.utils.*; public dynamic class Preloader extends MovieClip { private var did_load:Boolean; public static var GAME_OPTIONS:Object = {id:_mochiads_game_id, res:"640x480"}; public static var MAIN_CLASS:String = "com.lofiminds.xwung.Xwung"; public static var _mochiads_game_id:String = "cfe34489a2dad64f"; public function Preloader(){ var k:String; super(); var f:Function = function (_arg1:IOErrorEvent):void{ }; loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f); var opts:Object = {}; for (k in GAME_OPTIONS) { opts[k] = GAME_OPTIONS[k]; }; opts.ad_started = function ():void{ did_load = true; }; opts.ad_finished = function ():void{ var _local1:Class = Class(getDefinitionByName(MAIN_CLASS)); var _local2:Object = new (_local1); addChild((_local2 as DisplayObject)); if (_local2.init){ _local2.init(did_load); }; }; opts.clip = this; MochiAd.showPreGameAd(opts); } } }//package

Library Items

Symbol 1 Sound {com.lofiminds.xwung.Xwung_musicClass} [com.lofiminds.xwung.Xwung_musicClass]
Symbol 2 Sound {com.lofiminds.xwung.Xwung_snd1Class} [com.lofiminds.xwung.Xwung_snd1Class]
Symbol 3 Sound {com.lofiminds.xwung.Player_snd1Class} [com.lofiminds.xwung.Player_snd1Class]
Symbol 4 Bitmap {com.lofiminds.xwung.Rocket_GxClass1}
Symbol 5 Bitmap {com.lofiminds.xwung.Sledge_GxClass}
Symbol 6 Bitmap {com.lofiminds.xwung.Gameplay_GxClass}
Symbol 7 Bitmap {com.lofiminds.xwung.Enemy3_GxClass1}
Symbol 8 Bitmap {com.lofiminds.xwung.Player_GxClass2}
Symbol 9 Bitmap {com.lofiminds.xwung.BgPiece_GxClass}
Symbol 10 Bitmap {com.lofiminds.xwung.Player_GxClass}
Symbol 11 Bitmap {com.lofiminds.xwung.Gameplay_StartGxClass}
Symbol 12 Font {com.lofiminds.xwung.Xwung__font1}
Symbol 13 Font {com.lofiminds.xwung.Xwung__font2}
Symbol 14 Bitmap {com.lofiminds.xwung.Enemy1_GxClass1}
Symbol 15 Bitmap {com.lofiminds.xwung.Debris_GxClass}
Symbol 16 Bitmap {com.lofiminds.xwung.Enemybullet_GxClass1}
Symbol 17 Bitmap {com.lofiminds.xwung.Blip_GxClass}
Symbol 18 Bitmap {com.lofiminds.xwung.Enemybullet_GxClass2}
Symbol 19 Bitmap {com.lofiminds.xwung.Hitbox_GxClass}
Symbol 20 Bitmap {com.lofiminds.xwung.Bosspart_GxClass1}
Symbol 21 Bitmap {com.lofiminds.xwung.Gameplay_LofiGxClass}
Symbol 22 Bitmap {com.lofiminds.xwung.Bossturret_GxClass1}
Symbol 23 Bitmap {com.lofiminds.xwung.Bonus_GxClass}
Symbol 24 Bitmap {com.lofiminds.xwung.Smoke_GxClass1}
Symbol 25 Bitmap {com.lofiminds.xwung.Enemy2_GxClass1}

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1458 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..."
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds
ExportAssets (56)Timeline Frame 2Symbol 1 as "com.lofiminds.xwung.Xwung_musicClass"
ExportAssets (56)Timeline Frame 2Symbol 2 as "com.lofiminds.xwung.Xwung_snd1Class"
ExportAssets (56)Timeline Frame 2Symbol 3 as "com.lofiminds.xwung.Player_snd1Class"
SerialNumber (41)Timeline Frame 1

Labels

"Preloader"Frame 1
"com.lofiminds.xwung.Xwung"Frame 2




http://swfchan.com/10/47373/info.shtml
Created: 1/5 -2019 23:36:39 Last modified: 1/5 -2019 23:36:39 Server time: 01/11 -2024 00:37:38