Section 1
//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 _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
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 2
//MochiServices (mochi.MochiServices)
package mochi {
import flash.display.*;
import flash.events.*;
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, MochiServices.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, MochiServices.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, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()});
_rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
_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{
MochiServices.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 clipname:String;
var f:Function;
var req:URLRequest;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
MochiServices.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();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = 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 (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 3
//MainTimeline (Nebulae_fla.MainTimeline)
package Nebulae_fla {
import flash.display.*;
public dynamic class MainTimeline extends MovieClip {
public var loaderBack:MovieClip;
public function MainTimeline(){
addFrameScript(0, frame1, 76, frame77);
}
function frame77(){
stop();
}
function frame1(){
MochiAd.showPreGameAd({clip:root, id:"599078d65ef4a9f2", res:"600x600"});
}
}
}//package Nebulae_fla
Section 4
//MillipedeClip_3 (Nebulae_fla.MillipedeClip_3)
package Nebulae_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class MillipedeClip_3 extends MovieClip {
public var ad3:SimpleButton;
public var ad4:SimpleButton;
public var ad1:SimpleButton;
public var ad2:SimpleButton;
public function MillipedeClip_3(){
addFrameScript(0, frame1, 139, frame140);
}
public function linktoLA(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.longanimalsgames.com"), "_blank");
}
function frame1(){
MovieClip(parent).stop();
ad1.addEventListener(MouseEvent.CLICK, linktoLA);
ad2.addEventListener(MouseEvent.CLICK, linktoLA);
ad3.addEventListener(MouseEvent.CLICK, linktoLA);
ad4.addEventListener(MouseEvent.CLICK, linktoLA);
}
function frame140(){
stop();
MovieClip(parent).play();
}
}
}//package Nebulae_fla
Section 5
//sun_1 (Nebulae_fla.sun_1)
package Nebulae_fla {
import flash.display.*;
public dynamic class sun_1 extends MovieClip {
public function sun_1(){
addFrameScript(34, frame35, 65, frame66);
}
function frame35(){
stop();
}
function frame66(){
stop();
MovieClip(parent).play();
}
}
}//package Nebulae_fla
Section 6
//Background (Background)
package {
import flash.display.*;
public dynamic class Background extends MovieClip {
}
}//package
Section 7
//Collision (Collision)
package {
public class Collision {
public static var closestInfiniteX:Number = 0;
static var enemyList:Array;
public static var IntersectionX:Number = 0;
public static var IntersectionY:Number = 0;
public static var closestX:Number = 0;
public static var closestY:Number = 0;
static var playerList:Array;
static var enemyListLen:int;
public static var closestInfiniteY:Number = 0;
static var playerListLen:int;
static var main:Main;
static var pickupList:Array;
static var pickupListLen:int;
static function InitLists():void{
var _local1:GameObj;
playerListLen = 0;
enemyListLen = 0;
pickupListLen = 0;
for each (_local1 in main.objs.objs) {
if (_local1.active){
if ((((_local1.type == GameObj.gotype_PLAYER)) || ((_local1.type == GameObj.gotype_PLAYERBIT)))){
playerList[playerListLen] = _local1;
playerListLen++;
} else {
if (_local1.type == GameObj.gotype_ENEMY){
enemyList[enemyListLen] = _local1;
enemyListLen++;
} else {
if (_local1.type == GameObj.gotype_PICKUP){
pickupList[pickupListLen] = _local1;
pickupListLen++;
};
};
};
};
};
}
public static function LineLineIntersection(_arg1:Line, _arg2:Line):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local3 = _arg1.x0;
_local4 = _arg1.y0;
_local5 = _arg1.x1;
_local6 = _arg1.y1;
_local7 = _arg2.x0;
_local8 = _arg2.y0;
_local9 = _arg2.x1;
_local10 = _arg2.y1;
_local11 = (_local5 - _local3);
_local12 = (_local9 - _local7);
_local13 = ((_local6 - _local4) / _local11);
_local14 = ((_local10 - _local8) / _local12);
_local15 = (_local4 - (_local13 * _local3));
_local16 = (_local8 - (_local14 * _local7));
_local17 = ((_local15 - _local16) / (_local14 - _local13));
_local18 = (((_local13 * (_local16 - _local15)) / (_local13 - _local14)) + _local15);
if (_arg1.boundingRect.contains(_local17, _local18)){
if (_arg2.boundingRect.contains(_local17, _local18)){
IntersectionX = _local17;
IntersectionY = _local18;
return (true);
};
};
return (false);
}
static function InitOnce(){
var _local1:GameObj;
var _local2:int;
playerList = new Array();
enemyList = new Array();
pickupList = new Array();
_local2 = 0;
while (_local2 < 1000) {
playerList.push(_local1);
enemyList.push(_local1);
pickupList.push(_local1);
_local2++;
};
}
static function PlayerPickupCollision(){
var _local1:int;
var _local2:int;
var _local3:GameObj;
var _local4:GameObj;
var _local5:Number;
_local1 = 0;
while (_local1 < playerListLen) {
_local3 = playerList[_local1];
if (_local3.active){
_local2 = 0;
while (_local2 < pickupListLen) {
_local4 = pickupList[_local2];
if (_local4.active){
_local5 = 20;
if (Utils.DistBetweenPoints(_local3.xpos, _local3.ypos, _local4.xpos, _local4.ypos) < _local5){
Game.PlayerHitPickup(_local4);
};
};
_local2++;
};
};
_local1++;
};
}
static function Dist2ToLine(_arg1:Line, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local4 = _arg1.x0;
_local5 = _arg1.y0;
_local6 = _arg1.x1;
_local7 = _arg1.y1;
ClosestPointOnLine(_local4, _local5, _local6, _local7, _arg2, _arg3);
_local8 = (closestX - _arg2);
_local9 = (closestY - _arg3);
return (((_local8 * _local8) + (_local9 * _local9)));
}
public static function Update(_arg1:Main){
main = _arg1;
InitLists();
PlayerEnemyCollision();
PlayerPickupCollision();
EnemyPlayerLineCollision();
}
public static function ClosestPointOnLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local7 = (_arg5 - _arg1);
_local8 = (_arg6 - _arg2);
_local9 = (_arg3 - _arg1);
_local10 = (_arg4 - _arg2);
_local11 = ((_local9 * _local9) + (_local10 * _local10));
_local12 = ((_local7 * _local9) + (_local8 * _local10));
_local13 = (_local12 / _local11);
closestInfiniteX = (_arg1 + (_local9 * _local13));
closestInfiniteY = (_arg2 + (_local10 * _local13));
if (_local13 < 0){
_local13 = 0;
};
if (_local13 > 1){
_local13 = 1;
};
closestX = (_arg1 + (_local9 * _local13));
closestY = (_arg2 + (_local10 * _local13));
}
static function PlayerEnemyCollision(){
var _local1:int;
var _local2:int;
var _local3:GameObj;
var _local4:GameObj;
var _local5:Number;
_local1 = 0;
while (_local1 < playerListLen) {
_local3 = playerList[_local1];
if (_local3.active){
_local2 = 0;
while (_local2 < enemyListLen) {
_local4 = enemyList[_local2];
if (_local4.active){
_local5 = 15;
if (Utils.DistBetweenPoints(_local3.xpos, _local3.ypos, _local4.xpos, _local4.ypos) < _local5){
Game.PlayerHit(_local4);
};
};
_local2++;
};
};
_local1++;
};
}
static function EnemyPlayerLineCollision(){
var _local1:int;
var _local2:int;
var _local3:GameObj;
var _local4:GameObj;
var _local5:Line;
var _local6:Array;
var _local7:Number;
var _local8:*;
_local6 = new Array();
_local1 = 0;
while (_local1 < playerListLen) {
_local3 = playerList[_local1];
if (((_local3.active) && (!((_local3 == main.goPlayer))))){
_local5 = new Line(main.goPlayer.xpos, main.goPlayer.ypos, _local3.xpos, _local3.ypos);
_local6.push(_local5);
};
_local1++;
};
_local2 = 0;
while (_local2 < enemyListLen) {
_local4 = enemyList[_local2];
if (_local4.active){
_local1 = 0;
while (_local1 < _local6.length) {
_local5 = _local6[_local1];
_local7 = Dist2ToLine(_local5, _local4.xpos, _local4.ypos);
_local8 = (10 * 10);
if (_local7 < _local8){
Game.EnemyHitLine(_local4, playerList[(_local1 + 1)]);
};
_local1++;
};
};
_local2++;
};
}
}
}//package
Section 8
//Defs (Defs)
package {
public class Defs {
public static const difficulty_MEDIUM = 1;
public static const zpos_ENEMY = 1050;
public static const gfx_bullet = 15;
public static const gfx_particle_fire = 12;
public static const zpos_BACKGROUND_OBJECT = 9000;
public static const difficulty_EASY = 0;
public static const gfx_particle_bullet = 16;
public static const zpos_OVERLAY = 500;
public static const gfx_background_shine = 13;
public static const zpos_EXIT = 1200;
public static const gfx_exit = 10;
public static const zpos_PLAYER = 1000;
public static const gfx_screenbackground = 8;
public static const gfx_enemy1 = 2;
public static const gfx_enemy2 = 3;
public static const gfx_enemy3 = 4;
public static const gfx_enemy4 = 5;
public static const fps:Number = 30;
public static const zpos_PICKUP = 1100;
public static const gfx_backgroundaa = 0;
public static const zpos_FAR = 10000;
public static const playareaX1 = 600;
public static const centreX = 300;
public static const gfx_player = 1;
public static const playareaX0 = 0;
public static const gfx_bumper = 6;
public static const centreY = 300;
public static const gfx_pickup1 = 9;
public static const gfx_gunturret = 14;
public static const zpos_BACKGROUND = 10000;
public static const gfx_chainlink = 7;
public static const difficulty_HARD = 2;
public static const playareaY0 = 0;
public static const playareaY1 = 600;
public static const gfx_background1 = 11;
}
}//package
Section 9
//DisplayObj (DisplayObj)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.geom.*;
public class DisplayObj {
var frames:Array;
public var frame:int;
public function DisplayObj(_arg1:MovieClip, _arg2:Number, _arg3:int):void{
frame = 0;
if (_arg1 != null){
CreateBitmapsFromMovieClip(_arg1, _arg2, _arg3);
};
}
public function GetHeight():Number{
return (frames[frame].bitmap.height);
}
public function GetBitmap():Bitmap{
return (frames[frame].bitmap);
}
public function RenderAt(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
frames[frame].RenderAt(_arg1, _arg2, _arg3);
}
public function SetFrame(_arg1:int){
frame = _arg1;
if (frame < 0){
frame = 0;
};
if (frame >= frames.length){
frame = (frames.length - 1);
};
}
public function CreateBitmapsFromMovieClip(_arg1:MovieClip, _arg2:Number, _arg3:int):void{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Matrix;
var _local9:Rectangle;
var _local10:Bitmap;
var _local11:BitmapData;
var _local12:Bitmap;
var _local13:BitmapData;
var _local14:int;
var _local15:*;
var _local16:Number;
var _local17:Point;
var _local18:Point;
var _local19:Point;
var _local20:Point;
var _local21:Number;
_arg2 = 1;
frames = new Array();
_arg1.gotoAndStop(0);
_local14 = 32;
_local4 = 0;
while (_local4 < _arg1.totalFrames) {
_local15 = new DisplayObjFrame();
_local15.bitmaps = new Array();
_local15.xoffsets = new Array();
_local15.yoffsets = new Array();
_local15.mat = new Matrix();
_local15.colTrans = new ColorTransform();
if (_arg3 == 1){
_local5 = 0;
while (_local5 < _local14) {
_local16 = (((Math.PI * 2) / Number(_local14)) * Number(_local5));
_local16 = -(_local16);
_local16 = (_local16 + (Math.PI / 2));
_local9 = _arg1.getBounds(null);
_local8 = new Matrix();
_local8.rotate(_local16);
_local8.translate(_local9.width, _local9.height);
_local17 = _local8.transformPoint(new Point(_local9.left, _local9.top));
_local18 = _local8.transformPoint(new Point(_local9.right, _local9.top));
_local19 = _local8.transformPoint(new Point(_local9.right, _local9.bottom));
_local20 = _local8.transformPoint(new Point(_local9.left, _local9.bottom));
if (((!((_arg1.width == 0))) && (!((_arg1.height == 0))))){
_local11 = new BitmapData((_local9.width * 2), (_local9.height * 2), true, 0);
_local11.draw(_arg1, _local8);
_local10 = new Bitmap(_local11);
_local15.bitmaps.push(_local10);
_local6 = (_local9.width / 2);
_local7 = (_local9.height / 2);
_local15.xoffsets.push(Number(-(_local9.width)));
_local15.yoffsets.push(Number(-(_local9.height)));
} else {
_local15.bitmaps.push(null);
_local15.burnedbitmaps.push(null);
_local15.xoffsets.push(0);
_local15.yoffsets.push(0);
};
_local5++;
};
} else {
_local9 = _arg1.getBounds(null);
_local8 = new Matrix();
_local6 = _local9.left;
_local7 = _local9.top;
_local8.scale(_arg2, _arg2);
_local8.translate((-(_local6) * _arg2), (-(_local7) * _arg2));
_local15.xoffsets.push(Number((_local6 * _arg2)));
_local15.yoffsets.push(Number((_local7 * _arg2)));
_local21 = (_arg2 * 2);
if (((!((_arg1.width == 0))) && (!((_arg1.height == 0))))){
_local10 = new Bitmap();
_local11 = new BitmapData((_arg1.width * _arg2), (_arg1.height * _arg2), true, 0);
_local11.draw(_arg1, _local8);
_local10.bitmapData = _local11;
_local15.bitmaps.push(_local10);
} else {
_local15.bitmaps.push(null);
};
};
frames.push(_local15);
_arg1.nextFrame();
_local4++;
};
}
public function GetWidth():Number{
return (frames[frame].bitmap.width);
}
public function CreateFont(_arg1:TextFormat):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Matrix;
var _local7:Rectangle;
var _local8:Bitmap;
var _local9:BitmapData;
var _local10:Array;
var _local11:TextField;
var _local12:*;
frames = new Array();
_local10 = new Array();
_local10.push("0");
_local10.push("1");
_local10.push("2");
_local10.push("3");
_local10.push("4");
_local10.push("5");
_local10.push("6");
_local10.push("7");
_local10.push("8");
_local10.push("9");
_local10.push("x");
_local2 = 0;
while (_local2 < _local10.length) {
_local11 = new TextField();
_local11.textColor = 4294967295;
_local11.selectable = false;
_local11.embedFonts = true;
_local11.autoSize = TextFieldAutoSize.LEFT;
_local11.x = 0;
_local11.y = 0;
_local11.text = _local10[_local2];
_local11.setTextFormat(_arg1);
_local12 = new DisplayObjFrame();
_local12.bitmaps = new Array();
_local12.xoffsets = new Array();
_local12.yoffsets = new Array();
_local12.mat = new Matrix();
_local12.colTrans = new ColorTransform();
_local7 = _local11.getBounds(null);
_local6 = new Matrix();
_local12.xoffsets.push(0);
_local12.yoffsets.push(0);
_local8 = new Bitmap();
_local9 = new BitmapData(_local7.width, _local7.height, true, 0);
_local9.draw(_local11, _local6);
_local8.bitmapData = _local9;
_local12.bitmaps.push(_local8);
frames.push(_local12);
_local2++;
};
}
public function GetMaxFrames():int{
return (frames.length);
}
public function GetXOffset():Number{
return (frames[frame].xoffset);
}
public function GetYOffset():Number{
return (frames[frame].yoffset);
}
public function GetFrame():int{
return (frame);
}
public function RenderAtRot(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean):void{
if (_arg5){
frames[frame].RenderAtRotBurned(_arg1, _arg2, _arg3, _arg4);
} else {
frames[frame].RenderAtRot(_arg1, _arg2, _arg3, _arg4);
};
}
public function GetFrameWidth(_arg1:int):Number{
return (frames[_arg1].bitmap.width);
}
public function GetScaledBitmap():Bitmap{
return (frames[frame].scaledBitmap);
}
}
}//package
import flash.display.*;
import flash.geom.*;
class DisplayObjFrame {
public var mat:Matrix;
public var bitmaps:Array;
public var xoffsets:Array;
public var burnedbitmaps:Array;
public var colTrans:ColorTransform;
public var yoffsets:Array;
private function DisplayObjFrame(){
}
public function RenderAtRotBurned(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:int;
var _local6:int;
var _local7:Bitmap;
var _local8:Number;
var _local9:Number;
_arg4 = (_arg4 - 0.01);
_local5 = bitmaps.length;
_arg4 = ((Number(_local5) / (Math.PI * 2)) * _arg4);
_local6 = _arg4;
while (_local6 < 0) {
_local6 = (_local6 + _local5);
};
while (_local6 > (_local5 - 1)) {
_local6 = (_local6 - _local5);
};
_local6 = ((_local5 - 1) - _local6);
_local7 = burnedbitmaps[_local6];
_local8 = xoffsets[_local6];
_local9 = yoffsets[_local6];
_arg1.copyPixels(_local7.bitmapData, new Rectangle(0, 0, _local7.width, _local7.height), new Point((_arg2 + _local8), (_arg3 + _local9)));
}
public function RenderAt(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
var _local4:Bitmap;
var _local5:Number;
var _local6:Number;
_local4 = bitmaps[0];
_local5 = xoffsets[0];
_local6 = yoffsets[0];
_arg1.copyPixels(_local4.bitmapData, new Rectangle(0, 0, _local4.width, _local4.height), new Point((_arg2 + _local5), (_arg3 + _local6)), null, null, true);
}
public function RenderAtAdditive(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Bitmap;
var _local6:Number;
var _local7:Number;
_local5 = bitmaps[0];
_local6 = xoffsets[0];
_local7 = yoffsets[0];
mat.identity();
mat.translate((_arg2 + _local6), (_arg3 + _local7));
colTrans.alphaMultiplier = _arg4;
if (_local5 != null){
if (_local5.bitmapData != null){
_arg1.draw(_local5.bitmapData, mat, colTrans, "add");
};
};
}
public function RenderAtAlpha(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Bitmap;
var _local6:Number;
var _local7:Number;
_local5 = bitmaps[0];
_local6 = xoffsets[0];
_local7 = yoffsets[0];
mat.identity();
mat.translate((_arg2 + _local6), (_arg3 + _local7));
colTrans.alphaMultiplier = _arg4;
if (_local5 != null){
if (_local5.bitmapData != null){
_arg1.draw(_local5.bitmapData, mat, colTrans);
};
};
}
public function RenderAtRot(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:int;
var _local6:int;
var _local7:Bitmap;
var _local8:Number;
var _local9:Number;
_arg4 = (_arg4 - 0.01);
_local5 = bitmaps.length;
_arg4 = ((Number(_local5) / (Math.PI * 2)) * _arg4);
_local6 = _arg4;
while (_local6 < 0) {
_local6 = (_local6 + _local5);
};
while (_local6 > (_local5 - 1)) {
_local6 = (_local6 - _local5);
};
_local6 = ((_local5 - 1) - _local6);
_local7 = bitmaps[_local6];
_local8 = xoffsets[_local6];
_local9 = yoffsets[_local6];
_arg1.copyPixels(_local7.bitmapData, new Rectangle(0, 0, _local7.width, _local7.height), new Point((_arg2 + _local8), (_arg3 + _local9)));
}
}
Section 10
//Enemy1 (Enemy1)
package {
import flash.display.*;
public dynamic class Enemy1 extends MovieClip {
}
}//package
Section 11
//Enemy2 (Enemy2)
package {
import flash.display.*;
public dynamic class Enemy2 extends MovieClip {
}
}//package
Section 12
//Enemy3 (Enemy3)
package {
import flash.display.*;
public dynamic class Enemy3 extends MovieClip {
}
}//package
Section 13
//Enemy4 (Enemy4)
package {
import flash.display.*;
public dynamic class Enemy4 extends MovieClip {
}
}//package
Section 14
//FireParticle (FireParticle)
package {
import flash.display.*;
public dynamic class FireParticle extends MovieClip {
}
}//package
Section 15
//Font20 (Font20)
package {
import flash.text.*;
public dynamic class Font20 extends Font {
}
}//package
Section 16
//Game (Game)
package {
import flash.geom.*;
public class Game {
public static const state_PLAY = 1;
public static const state_POST = 2;
public static const state_PRE = 0;
static var pickupGenTimerMaxDV:Number;
static var addedScoreTimer:int;
static var lastPickupType:int;
static var posList:Array;
static var pickupGenTimerMin:Number;
public static var energySuction:Number;
public static var backgroundColList:Array;
static var lastGOGenerated:GameObj;
static var levelTimeMax:Number;
public static var stateTimer:int;
static var currentHealth:Number;
static var numPickupsCollected:int;
static var pickupCounter1Adder:int;
static var energyInARow:int;
static var pickupTimer:int = 0;
static var currentEnergyMax:Number;
static var lastGOGeneratedX:Number;
static var lastGOGeneratedY:Number;
static var lineStartX:int;
static var lineStartY:int;
static var pickupCounter1:int;
static var exitIsOpen:Boolean;
static var pickupCounter1Max:int;
static var pickupGenTimerMax:Number;
static var pickupMultiplier:int;
static var starfieldList1:Array;
static var currentEnergy:Number;
static var healthAddConstant:Number = -0.001;
static var levelTime:Number;
static var addedScore:Number;
static var pickupGenTimer:Number;
static var enemyGenTimerMaxDV:Number;
static var enemyGenTimer:Number;
static var healthAddPickup:Number = 0.1;
public static var stateTimer1:int;
static var healthAddHitEnemy:Number = -0.1;
static var levelWon:Boolean;
public static var currentLevel:int;
public static var state;
static var totalPickups:int;
static var currentScore:int;
static var enemyGenTimerMin:Number;
static var enemyGenTimerMax:Number;
static var hitTimer:int = 0;
static var numPlayerBits:int = 0;
static var scorePickup:int = 100;
static var starfieldList:Array;
static var main:Main;
public static var difficulty:int = 1;
static var multiplier:int;
static var nextPickupIndex:int;
static var scoreEnergy:int = 50;
static var levelComplete:Boolean;
static var starfieldCounter:int;
public static var stateCount:int;
static function UpdateHitOverlay(){
var _local1:uint;
if (hitTimer == 0){
return;
};
hitTimer--;
if (hitTimer < 0){
hitTimer = 0;
};
main.overlayBD.lock();
_local1 = 0xFF0000;
_local1 = (_local1 | ((hitTimer << 5) << 24));
main.overlayBD.fillRect(new Rectangle(0, 0, 600, 600), _local1);
main.overlayBD.unlock();
}
public static function GenEnemyHitPlayerParticles(_arg1:GameObj){
var _local2:int;
_local2 = 0;
while (_local2 < 100) {
main.particles.Add(Particles.type_explo_hitstar, _arg1.xpos, _arg1.ypos, 0);
_local2++;
};
_local2 = 0;
while (_local2 < 100) {
main.particles.Add(Particles.type_explo1, _arg1.xpos, _arg1.ypos, 0);
_local2++;
};
}
static function RandBetweenFloat(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
static function LevelUp():void{
}
public static function CountObjects():void{
var _local1:int;
var _local2:GameObj;
_local1 = 0;
while (_local1 < main.objs.objs.length) {
_local2 = main.objs.objs[_local1];
if (_local2.active == true){
};
_local1++;
};
}
public static function UpdateGameplay():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (state == state_PLAY){
levelTime = (levelTime + main.ftime);
if (levelTime > levelTimeMax){
currentLevel++;
InfoOverlay.Add("Level Up");
SoundPlayer.Play(SoundPlayer.SOUND_LEVELUP);
levelTime = 0;
};
AddHealth(healthAddConstant);
UpdateStarfield();
UpdatePickups();
UpdateEnemies();
if (levelComplete){
};
} else {
if (state == state_POST){
stateTimer = (stateTimer + 1);
if (stateTimer >= (Defs.fps * 3)){
main.SetGameState(Main.gameState_TITLE);
};
stateTimer1++;
if (stateTimer1 >= 1){
stateTimer1 = 0;
_local1 = RandBetweenFloat(0, 600);
_local2 = RandBetweenFloat(0, 600);
_local3 = 0;
while (_local3 < 30) {
main.particles.Add(Particles.type_explo_hitstar, _local1, _local2, 0);
_local3++;
};
};
};
};
}
public static function Init(_arg1:Main){
main = _arg1;
currentScore = 0;
currentLevel = 0;
energySuction = 0;
}
public static function InitLevel():void{
var _local1:GameObj;
posList = new Array();
posList.push(new Point(-50, -20));
posList.push(new Point(30, -40));
posList.push(new Point(-10, 30));
posList.push(new Point(20, 70));
posList.push(new Point(90, 0));
posList.push(new Point(30, 20));
posList.push(new Point(-70, 60));
posList.push(new Point(10, -40));
posList.push(new Point(40, -80));
posList.push(new Point(-20, -80));
posList.push(new Point(-50, 10));
posList.push(new Point(60, -15));
posList.push(new Point(-10, 80));
numPlayerBits = 0;
currentLevel = 0;
main.goPlayer = main.objs.AddObj(GameObj.gotype_PLAYER, 300, 300, Defs.zpos_PLAYER, 0, 0);
AddPlayerBit();
backgroundColList = new Array();
backgroundColList.push(uint(34));
backgroundColList.push(uint(0x2222));
backgroundColList.push(uint(34));
backgroundColList.push(uint(0x110022));
backgroundColList.push(uint(51));
backgroundColList.push(uint(0x3333));
backgroundColList.push(uint(51));
backgroundColList.push(uint(0x440033));
backgroundColList.push(uint(0x2200));
backgroundColList.push(uint(17459));
backgroundColList.push(uint(4469538));
backgroundColList.push(uint(2250035));
backgroundColList.push(uint(0x440000));
main.overlayBD.fillRect(new Rectangle(0, 0, 600, 600), 0);
main.starfieldBD.fillRect(new Rectangle(0, 0, 600, 600), 0);
energyInARow = 0;
addedScoreTimer = 0;
addedScore = 0;
lastPickupType = -1;
pickupMultiplier = 1;
enemyGenTimer = 0;
enemyGenTimerMax = 30;
enemyGenTimerMaxDV = -0.003;
enemyGenTimerMin = 5;
pickupGenTimer = 0;
pickupGenTimerMax = 100;
pickupGenTimerMaxDV = 0;
pickupGenTimerMin = 100;
healthAddPickup = 0.1;
healthAddHitEnemy = -0.1;
healthAddConstant = -0.0005;
levelTime = 0;
levelTimeMax = (Defs.fps * 30);
pickupCounter1 = 0;
pickupCounter1Max = 3;
pickupCounter1Adder = 3;
currentEnergy = 0;
currentEnergyMax = 1000;
exitIsOpen = false;
multiplier = 1;
InitStarfield();
totalPickups = 0;
nextPickupIndex = 0;
numPickupsCollected = 0;
levelComplete = false;
levelWon = false;
currentHealth = 1;
hitTimer = 0;
pickupTimer = 0;
trace("------------------------------------");
SetState(state_PLAY);
SoundPlayer.Play(SoundPlayer.SOUND_LEVELUP);
}
public static function InitGame():void{
currentScore = 0;
currentHealth = 1;
currentLevel = 0;
}
public static function GenPickupParticles(_arg1:GameObj){
var _local2:int;
_local2 = 0;
while (_local2 < 100) {
main.particles.Add(Particles.type_explo_hitpickup, _arg1.xpos, _arg1.ypos, _arg1.subtype);
_local2++;
};
}
public static function AddHealth(_arg1:Number){
currentHealth = (currentHealth + _arg1);
if (currentHealth > 1){
currentHealth = 1;
};
if (currentHealth < 0){
currentHealth = 0;
SetState(state_POST);
InfoOverlay.AddAt(0, "GAME OVER", 0, (Defs.fps * 3));
HighScore.SubmitScore(currentScore, 0, HighScoreCallback);
};
}
static function HighScoreCallback(){
stateTimer = Defs.fps;
}
public static function GenEnemyDieParticles(_arg1:GameObj){
var _local2:int;
_local2 = 0;
while (_local2 < 50) {
main.particles.Add(Particles.type_explo_hitarm, _arg1.xpos, _arg1.ypos, _arg1.subtype);
_local2++;
};
}
static function SetState(_arg1:int):void{
state = _arg1;
if (state == state_PRE){
};
stateTimer1 = (1.2 * Defs.fps);
stateTimer = (0.5 * Defs.fps);
stateCount = 4;
if (state == state_POST){
stateTimer = -99999;
stateTimer1 = 0;
};
}
static function UpdatePickups():void{
var _local1:GameObj;
pickupGenTimer = (pickupGenTimer + main.ftime);
if (pickupGenTimer >= pickupGenTimerMax){
pickupGenTimer = 0;
_local1 = main.objs.AddObj(GameObj.gotype_PICKUP, 300, 300, Defs.zpos_PLAYER, 0, 0);
_local1.InitPickup();
};
pickupGenTimerMax = (pickupGenTimerMax + pickupGenTimerMaxDV);
if (pickupGenTimerMax < pickupGenTimerMin){
pickupGenTimerMax = pickupGenTimerMin;
};
}
static function GenScore(_arg1:GameObj, _arg2:int, _arg3:int){
var _local4:GameObj;
_local4 = main.objs.AddObj(GameObj.gotype_SCORE, _arg1.xpos, _arg1.ypos, Defs.zpos_PLAYER, 0, 0);
_local4.number = _arg2;
_local4.number1 = _arg3;
}
public static function AddScore(_arg1:int){
var _local2:*;
_local2 = _arg1;
currentScore = (currentScore + _local2);
}
public static function AddEnergy(){
currentEnergy++;
if (currentEnergy > currentEnergyMax){
currentEnergy = currentEnergyMax;
};
}
static function InitStarfield():void{
var _local1:int;
var _local2:Point;
var _local3:Point;
starfieldList = new Array();
starfieldList1 = new Array();
_local1 = 0;
while (_local1 < 50) {
_local2 = new Point(Utils.RandBetweenFloat(0, 600), Utils.RandBetweenFloat(0, 600));
starfieldList.push(_local2);
_local3 = new Point(Utils.RandBetweenFloat(-1, 1), Utils.RandBetweenFloat(2, 5));
starfieldList1.push(_local3);
_local1++;
};
}
public static function EnemyHitLine(_arg1:GameObj, _arg2:GameObj){
AddEnergy();
_arg1.active = false;
GenEnemyDieParticles(_arg1);
_arg2.controlMode = 1;
_arg2.timer1 = 10;
energyInARow++;
AddScore((scoreEnergy * energyInARow));
GenScore(_arg1, (scoreEnergy * (currentLevel + 1)), energyInARow);
SoundPlayer.Play(SoundPlayer.SOUND_PICKUP1);
}
static function UpdatePickupOverlay(){
var _local1:uint;
if (pickupTimer == 0){
return;
};
pickupTimer--;
if (pickupTimer < 0){
pickupTimer = 0;
};
main.overlayBD.lock();
_local1 = 0xFF00;
_local1 = (_local1 | ((pickupTimer << 5) << 24));
main.overlayBD.fillRect(new Rectangle(0, 0, 600, 600), _local1);
main.overlayBD.unlock();
}
static function RenderStarfield():void{
var _local1:Point;
var _local2:uint;
main.starfieldBD.lock();
for each (_local1 in starfieldList) {
if (_local1.y >= 0){
_local2 = 4294967295;
main.starfieldBD.setPixel32(_local1.x, _local1.y, _local2);
};
};
main.starfieldBD.unlock();
}
public static function InitLevelParams(){
}
public static function PlayerHit(_arg1:GameObj){
energyInARow = 0;
AddHealth(healthAddHitEnemy);
_arg1.active = false;
GenEnemyHitPlayerParticles(_arg1);
hitTimer = 8;
SoundPlayer.Play(SoundPlayer.SOUND_PICKUP2);
}
static function AddPlayerBit():Boolean{
var _local1:GameObj;
var _local2:Point;
if (numPlayerBits >= posList.length){
return (false);
};
_local1 = main.objs.AddObj(GameObj.gotype_PLAYERBIT, main.goPlayer.xpos, main.goPlayer.ypos, Defs.zpos_PLAYER, 0, 0);
_local2 = posList[numPlayerBits];
_local1.SetPlayerBit(_local2.x, _local2.y);
numPlayerBits++;
return (true);
}
static function RandBetweenInt(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = (Math.random() * ((_arg2 + 1) - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
public static function PlayerHitPickup(_arg1:GameObj){
energyInARow = 0;
GenPickupParticles(_arg1);
_arg1.active = false;
pickupTimer = 8;
AddHealth(healthAddPickup);
if (lastPickupType == _arg1.subtype){
pickupMultiplier++;
} else {
lastPickupType = _arg1.subtype;
pickupMultiplier = 1;
};
SoundPlayer.Play(SoundPlayer.SOUND_PICKUP3);
AddScore(((scorePickup * pickupMultiplier) * (currentLevel + 1)));
GenScore(_arg1, (scorePickup * (currentLevel + 1)), pickupMultiplier);
pickupCounter1++;
if (pickupCounter1 >= pickupCounter1Max){
pickupCounter1Max = (pickupCounter1Max + pickupCounter1Adder);
pickupCounter1 = 0;
if (AddPlayerBit()){
InfoOverlay.Add("Constellation Grow!");
SoundPlayer.Play(SoundPlayer.SOUND_EXTRASTAR);
};
};
}
public static function RenderPanel(){
var _local1:Rectangle;
var _local2:Number;
UpdateHitOverlay();
UpdatePickupOverlay();
_local1 = new Rectangle(0, 0, 20, 600);
main.screenBD.fillRect(_local1, 4287137928);
_local2 = (600 * currentHealth);
_local1 = new Rectangle(0, (600 - _local2), 20, _local2);
main.screenBD.fillRect(_local1, 4294901760);
}
static function UpdateEnemies():void{
var _local1:GameObj;
enemyGenTimer = (enemyGenTimer + main.ftime);
if (enemyGenTimer >= enemyGenTimerMax){
enemyGenTimer = 0;
_local1 = main.objs.AddObj(GameObj.gotype_ENEMY, 300, 300, Defs.zpos_PLAYER, 0, 0);
_local1.InitEnemy();
};
enemyGenTimerMax = (enemyGenTimerMax + enemyGenTimerMaxDV);
if (enemyGenTimerMax < enemyGenTimerMin){
enemyGenTimerMax = enemyGenTimerMin;
};
}
static function UpdateStarfield():void{
var _local1:int;
var _local2:Point;
var _local3:Point;
_local1 = 0;
while (_local1 < 50) {
_local2 = starfieldList[_local1];
_local3 = starfieldList1[_local1];
_local2.x = (_local2.x + _local3.x);
_local2.y = (_local2.y + _local3.y);
if (_local2.y > 600){
_local2.x = Utils.RandBetweenFloat(0, 600);
_local2.y = Utils.RandBetweenFloat(-20, 0);
};
_local1++;
};
}
}
}//package
Section 17
//GameObj (GameObj)
package {
import flash.display.*;
import flash.geom.*;
public class GameObj {
var graphicID:int;
var sphereCollisonActive:Boolean;
var number1:int;
var externyvel:Number;
public var xvel:Number;
var multiplierFrame:int;
public var todir:Number;
var ftime:Number;
var minFrame:int;
var spawnMinTime:Number;
var callback:Object;
var rotVel:Number;
public var speed:Number;
var yoffset:Number;
var onDeadCallback:Object;
var objectOnSwitch:Boolean;
var startx:Number;
public var ypos2:Number;
var health:Number;
var spawnMaxTime:Number;
var starty:Number;
var shootTimer:Number;
var blockID:int;
var maxFrame:int;
public var visible:Boolean;
var stunnedTimer:Number;
public var yvel:Number;
var name:String;
public var dir:Number;
public var radius:Number;
var sphereCollisionValue:Number;
var switchPosition:Boolean;
public var controlMode:int;
public var origspeed:Number;
var onPickupCallback:Object;
var burned:Boolean;
public var xpos2:Number;
var pathEndCallback;
public var xpos:Number;
var extraInfo:int;
var spawnCallback;
public var enemyType:int;
var xflip:Boolean;
public var frameVel:Number;
var numSpawnsAvailable:int;
var switchMode:int;
public var countable:Boolean;
public var xacc:Number;
var xoffset:Number;
public var active:Boolean;
public var hp:int;
public var count:int;
public var appearingTimer:Number;
var inFlamesTimer:Number;
var shootTimerMax:Number;
var inFlames:Boolean;
var flashTimer:Number;
public var type:int;
public var ypos:Number;
public var enemyMissileMode:int;
var timer:Number;
var number:int;
public var bitList:Array;
var wallCollisonActive:Boolean;
var alpha:Number;
public var yacc:Number;
var frame:Number;
public var hitTimer:Number;
public var controlIndex:int;
public var subtype:int;
var flashFlag:Boolean;
public var oldxpos:Number;
public var coordListX:Array;
public var coordListY:Array;
var timer1:Number;
public var zpos:Number;
public var toPosX:Number;
public var toPosY:Number;
var dist:Number;
var pathIndex:int;
var main:Main;
public var baseID:int;
var pathNextPoint:int;
var externxvel:Number;
var userVarNumber:Number;
public var numBits:int;
public var homingGO:GameObj;
public var pickupType:int;
public var handleRender:Boolean;
var timerMax:Number;
var shootMissileType:int;
public var oldypos:Number;
public var radius2:Number;
public var explosionType:int;
var flashTimerMax:Number;
var callbackCounter;
public var bonusType:int;
var scoreFrame:int;
static const gotype_PLAYER = 2;
static const gotype_ENEMY = 4;
static const gotype_PLAYERBIT = 3;
static const gotype_SCORE = 6;
static const gotype_PICKUP = 5;
static const gotype_BACKGROUND = 1;
public function GameObj(_arg1, _arg2, _arg3){
name = null;
xpos = _arg2;
ypos = _arg3;
zpos = 1;
startx = _arg2;
starty = _arg3;
active = false;
main = _arg1;
zpos = 0;
graphicID = 0;
frame = 0;
frameVel = 0;
controlIndex = 0;
timer = 0;
timer1 = 0;
radius = 16;
minFrame = 0;
maxFrame = 0;
handleRender = true;
shootTimer = 0;
shootTimerMax = 0;
shootMissileType = 0;
coordListX = new Array(32);
coordListY = new Array(32);
bitList = new Array(32);
numBits = 0;
countable = true;
flashTimer = 0;
flashFlag = true;
extraInfo = 0;
xflip = false;
alpha = 1;
}
public function LimitVel(_arg1:Number){
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = Math.sqrt(((xvel * xvel) + (yvel * yvel)));
_local3 = (xvel / _local2);
_local4 = (yvel / _local2);
if (_local2 > _arg1){
xvel = (_local3 * _arg1);
yvel = (_local4 * _arg1);
};
}
function RandBetween(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
public function UpdateEnemy():void{
oldxpos = xpos;
oldypos = ypos;
ypos = (ypos + yvel);
xpos = (xpos + xvel);
if (ypos > (Defs.playareaY1 + 32)){
active = false;
};
CycleAnimation();
}
function DoExternalVel():void{
var _local1:Number;
xpos = (xpos + (externxvel * ftime));
ypos = (ypos + (externyvel * ftime));
_local1 = 0.9;
externxvel = (externxvel * _local1);
externyvel = (externyvel * _local1);
}
public function InitPlayer():void{
sphereCollisionValue = 0.2;
wallCollisonActive = true;
sphereCollisonActive = true;
graphicID = GraphicObjects.gfx_player;
dir = 0;
frame = Utils.RandBetweenFloat(0, 10);
CycleAnimation();
}
public function InitEnemy():void{
xpos = Utils.RandBetweenFloat(Defs.playareaX0, Defs.playareaX1);
ypos = (Defs.playareaY0 - 32);
yvel = Utils.RandBetweenFloat(3, 4);
xvel = 0.1;
frameVel = RandBetweenRandNeg(0.2, 0.5);
subtype = Utils.RandBetweenInt(0, 3);
graphicID = (subtype + GraphicObjects.gfx_enemy1);
}
function RenderDotLine(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:int, _arg7:uint):void{
var _local8:int;
var _local9:int;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:uint;
var _local14:Number;
var _local15:uint;
_local9 = _arg6;
_local10 = ((_arg4 - _arg2) / Number(_local9));
_local11 = ((_arg5 - _arg3) / Number(_local9));
_local12 = timer;
_local8 = 0;
while (_local8 < _local9) {
_local13 = 4278190080;
_local14 = Math.sin(_local12);
_local14 = (_local14 + 1);
_local14 = (_local14 * 0.5);
_local14 = (_local14 * 127);
_local14 = (_local14 + 128);
_local15 = uint(_local14);
if (controlMode == 0){
_local13 = (_local13 | (_local15 << 0));
_local13 = (_local13 | (_local15 << 8));
} else {
_local13 = (_local13 | (_local15 << 8));
_local13 = (_local13 | (_local15 << 16));
};
_local12 = (_local12 + 0.1);
_arg2 = (_arg2 + _local10);
_arg3 = (_arg3 + _local11);
_arg1.setPixel32(int(_arg2), int(_arg3), _local13);
_arg1.setPixel32((int(_arg2) + 1), int(_arg3), _local13);
_arg1.setPixel32((int(_arg2) - 1), int(_arg3), _local13);
_arg1.setPixel32(int(_arg2), (int(_arg3) + 1), _local13);
_arg1.setPixel32(int(_arg2), (int(_arg3) - 1), _local13);
_local8++;
};
}
public function SetPlayerBit(_arg1:Number, _arg2:Number){
var _local3:*;
toPosX = (main.goPlayer.xpos + xoffset);
toPosY = (main.goPlayer.ypos + yoffset);
xoffset = _arg1;
yoffset = _arg2;
dist = Utils.DistBetweenPoints(0, 0, _arg1, _arg2);
trace(dist);
_local3 = 100;
if (dist > (_local3 - 1)){
dist = (_local3 - 1);
};
dist = (_local3 - dist);
dist = ((1 / _local3) * dist);
if (dist > 1){
dist = 1;
};
trace((" " + dist));
}
function NormalizeDir(_arg1:Number):Number{
while (_arg1 < 0) {
_arg1 = (_arg1 + (Math.PI * 2));
};
while (_arg1 > (Math.PI * 2)) {
_arg1 = (_arg1 - (Math.PI * 2));
};
return (_arg1);
}
function BounceOffWalls(){
var _local1:Number;
var _local2:Number;
_local1 = 0;
_local2 = 1000;
if (xpos > _local2){
xvel = (xvel * -1);
xpos = _local2;
};
if (xpos < _local1){
xvel = (xvel * -1);
xpos = _local1;
};
}
function HandleFlash(){
flashTimerMax = 10;
flashTimer = (flashTimer + ftime);
if (flashTimer >= flashTimerMax){
flashTimer = 0.01;
if (flashFlag == false){
flashFlag = true;
} else {
flashFlag = false;
};
};
}
public function PlayAnimation():Boolean{
var _local1:int;
_local1 = GraphicObjects.GetNumFrames(graphicID);
frame = (frame + (frameVel * ftime));
if (frame >= _local1){
frame = _local1;
return (true);
};
return (false);
}
public function SetType(_arg1:int):void{
var _local2:int;
var _local3:Number;
_local2 = 0;
_local3 = 0;
type = _arg1;
controlMode = _local2;
xvel = _local3;
frame = _local3;
frameVel = _local3;
timer = _local3;
hitTimer = _local3;
hp = 1;
handleRender = true;
visible = true;
shootTimer = _local3;
shootTimerMax = _local3;
externxvel = _local3;
externyvel = _local3;
appearingTimer = _local3;
countable = true;
flashTimer = _local3;
flashFlag = true;
extraInfo = _local2;
dir = 0;
todir = 0;
stunnedTimer = 0;
health = 1;
inFlames = false;
burned = false;
onDeadCallback = null;
onPickupCallback = null;
alpha = 1;
if (type == gotype_BACKGROUND){
frame = 0;
graphicID = GraphicObjects.gfx_background;
} else {
if (type == gotype_PLAYER){
InitPlayer();
} else {
if (type == gotype_PLAYERBIT){
InitPlayerBit();
} else {
if (type == gotype_ENEMY){
} else {
if (type == gotype_PICKUP){
} else {
if (type == gotype_SCORE){
InitScore();
};
};
};
};
};
};
}
function AddVels(){
var _local1:Number;
var _local2:*;
_local1 = 10;
_local2 = 0.1;
yvel = (yvel + ((_local2 * ftime) * ftime));
if (yvel > _local1){
yvel = _local1;
};
if (yvel < -(_local1)){
yvel = -(_local1);
};
xpos = (xpos + (xvel * ftime));
ypos = (ypos + (yvel * ftime));
}
function RenderNumber(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int):Number{
var _local5:Array;
var _local6:int;
var _local7:int;
var _local8:Boolean;
var _local9:int;
var _local10:int;
_local5 = new Array();
_local6 = _arg3;
_local7 = 0;
while (_local7 < 8) {
_local9 = (_local6 % 10);
_local5.push(_local9);
_local6 = (_local6 / 10);
_local7++;
};
_local8 = false;
_local7 = (_local5.length - 1);
while (_local7--) {
_local10 = _local5[_local7];
if ((((_local8 == false)) && (!((_local10 == 0))))){
_local8 = true;
};
if (_local8){
GraphicObjects.RenderAtAlpha(GraphicObjects.gfx_fontblack, _local10, main.screenBD, _arg1, _arg2, alpha);
GraphicObjects.RenderAtAlpha(_arg4, _local10, main.screenBD, _arg1, _arg2, alpha);
_arg1 = (_arg1 + 8);
};
(_local7 >= 0);
};
return (_arg1);
}
public function GetDirBetween(_arg1, _arg2, _arg3, _arg4):Number{
var _local5:*;
_local5 = Math.atan2((_arg4 - _arg2), (_arg3 - _arg1));
return (_local5);
}
public function CycleAnimationEx():Boolean{
var _local1:Boolean;
var _local2:*;
_local1 = false;
frame = (frame + (frameVel * ftime));
_local2 = (maxFrame - minFrame);
if (frame > maxFrame){
frame = (frame - _local2);
_local1 = true;
};
if (frame < minFrame){
frame = (frame + _local2);
_local1 = true;
};
return (_local1);
}
function IsInWorld(_arg1:Number):Boolean{
if (xpos < (0 - _arg1)){
return (false);
};
if (ypos < (0 - _arg1)){
return (false);
};
return (true);
}
function SetEdgePos():int{
var _local1:Number;
_local1 = 50;
if (RandBetween(0, 100) < 50){
ypos = RandBetween(0, 1000);
xpos = (0 - _local1);
if (RandBetween(0, 100) < 50){
xpos = (1000 + _local1);
return (1);
};
return (3);
//unresolved jump
};
xpos = RandBetween(0, 1000);
ypos = (0 - _local1);
if (RandBetween(0, 100) < 50){
ypos = (1000 + _local1);
return (2);
};
return (0);
}
public function UpdatePickup():void{
oldxpos = xpos;
oldypos = ypos;
ypos = (ypos + yvel);
xpos = (xpos + xvel);
if (ypos > (Defs.playareaY1 + 32)){
active = false;
};
timer++;
if (timer > Defs.fps){
timer = 0;
subtype++;
if (subtype > 3){
subtype = 0;
};
graphicID = (subtype + GraphicObjects.gfx_pickup1);
};
}
public function Update():void{
oldxpos = xpos;
oldypos = ypos;
ftime = main.ftime;
if (type == gotype_BACKGROUND){
ypos = (ypos + 1);
if (ypos >= 600){
ypos = 0;
};
} else {
if (type == gotype_PLAYER){
UpdatePlayer();
} else {
if (type == gotype_PLAYERBIT){
UpdatePlayerBit();
} else {
if (type == gotype_ENEMY){
UpdateEnemy();
} else {
if (type == gotype_PICKUP){
UpdatePickup();
} else {
if (type == gotype_SCORE){
UpdateScore();
};
};
};
};
};
};
}
function GetLen(_arg1, _arg2):Number{
var _local3:*;
_local3 = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
return (_local3);
}
public function InitPlayerBit():void{
graphicID = GraphicObjects.gfx_player;
timer = Utils.RandBetweenFloat(0, 100);
controlMode = 0;
frame = Utils.RandBetweenFloat(0, 10);
CycleAnimation();
}
public function RotDistTowards(_arg1:Number, _arg2:Number):Number{
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:Number;
_local3 = 3.141592658;
_local4 = (_local3 * 2);
_local5 = Math.cos(_arg1);
_local6 = Math.sin(_arg1);
_local7 = Math.cos(_arg2);
_local8 = Math.sin(_arg2);
_local9 = ((_local5 * _local8) - (_local7 * _local6));
_local9 = Math.abs(_local9);
return (_local9);
}
function UpdateScore():void{
ypos = (ypos - 1);
alpha = (alpha - 0.02);
if (alpha < 0){
alpha = 0;
active = false;
};
}
public function UpdatePlayer():void{
toPosX = MouseControl.posX;
toPosY = MouseControl.posY;
xpos = (xpos + ((toPosX - xpos) * 0.5));
ypos = (ypos + ((toPosY - ypos) * 0.5));
dir = (dir + 0.01);
main.particles.Add(Particles.type_trail, xpos, ypos, 0);
frameVel = 0.5;
CycleAnimation();
}
function InitScore():void{
timer = (Defs.fps * 1);
number = 0;
number1 = 0;
graphicID = GraphicObjects.gfx_font1;
alpha = 1;
}
public function AddImpulse(_arg1:Number, _arg2:Number, _arg3:Number){
externxvel = (externxvel + (_arg1 * _arg3));
externyvel = (externyvel + (_arg2 * _arg3));
}
public function PlayAnimationEx():Boolean{
var _local1:Boolean;
var _local2:*;
_local1 = false;
frame = (frame + (frameVel * ftime));
_local2 = (maxFrame - minFrame);
if (frame > maxFrame){
if (frame > maxFrame){
frame = maxFrame;
_local1 = true;
};
};
if (frame < minFrame){
frame = minFrame;
_local1 = true;
};
return (_local1);
}
function Anim_FromVel():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:*;
_local1 = GraphicObjects.GetNumFrames(graphicID);
_local2 = xvel;
_local3 = yvel;
_local4 = Math.atan2(_local3, _local2);
frame = ((_local1 / (Math.PI * 2)) * -(_local4));
if (frame < 0){
frame = (frame + _local1);
};
if (frame > _local1){
frame = (frame - _local1);
};
frame = (frame + (_local1 / 2));
if (frame > _local1){
frame = (frame - _local1);
};
}
function DistanceToObj(_arg1:GameObj):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = (_arg1.xpos - xpos);
_local3 = (_arg1.ypos - ypos);
_local4 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
return (_local4);
}
public function CycleAnimation():void{
var _local1:Number;
var _local2:int;
_local1 = (frameVel * ftime);
_local2 = GraphicObjects.GetNumFrames(graphicID);
frame = (frame + _local1);
if (frame >= _local2){
frame = (frame - _local2);
};
if (frame < 0){
frame = (frame + _local2);
};
}
function MakeUnitVel():Number{
var _local1:*;
var _local2:*;
var _local3:*;
_local1 = GetLen(xvel, yvel);
_local2 = (xvel / _local1);
_local3 = (yvel / _local1);
xvel = _local2;
yvel = _local3;
return (_local1);
}
public function UpdatePlayerBit():void{
var _local1:Matrix;
var _local2:Point;
_local1 = new Matrix();
_local1.rotate(main.goPlayer.dir);
_local2 = new Point(xoffset, yoffset);
_local2 = _local1.transformPoint(_local2);
toPosX = (main.goPlayer.xpos + _local2.x);
toPosY = (main.goPlayer.ypos + _local2.y);
xpos = (xpos + ((toPosX - xpos) * dist));
ypos = (ypos + ((toPosY - ypos) * dist));
main.particles.Add(Particles.type_trail, xpos, ypos, 0);
timer = (timer + 0.1);
if (controlMode == 0){
} else {
timer1--;
if (timer1 < 0){
controlMode = 0;
};
};
frameVel = 0.5;
CycleAnimation();
}
function RandBetweenRandNeg(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
if (Math.random() < 0.5){
_local3 = -(_local3);
};
return (_local3);
}
function DistanceToObj1(_arg1:GameObj, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local4 = (_arg1.xpos - _arg2);
_local5 = (_arg1.ypos - _arg3);
_local6 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
return (_local6);
}
public function Render(_arg1):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
if (visible == false){
return;
};
if (appearingTimer > 0){
return;
};
_local2 = xpos;
_local3 = ypos;
if (type == gotype_SCORE){
_local4 = (xpos - 30);
_local4 = RenderNumber(_local4, ypos, number, GraphicObjects.gfx_font1);
if (number1 != -1){
GraphicObjects.RenderAtAlpha(GraphicObjects.gfx_fontblack, 10, main.screenBD, _local4, ypos, alpha);
GraphicObjects.RenderAtAlpha(GraphicObjects.gfx_font2, 10, main.screenBD, _local4, ypos, alpha);
_local4 = (_local4 + 8);
_local4 = RenderNumber(_local4, ypos, number1, GraphicObjects.gfx_font3);
};
} else {
if (type == gotype_BACKGROUND){
} else {
GraphicObjects.RenderAt(graphicID, frame, main.screenBD, _local2, _local3);
};
};
if (type == gotype_PLAYERBIT){
RenderDotLine(main.screenBD, xpos, ypos, main.goPlayer.xpos, main.goPlayer.ypos, 50, 4294967295);
};
}
public function InitPickup():void{
xpos = Utils.RandBetweenFloat(Defs.playareaX0, Defs.playareaX1);
ypos = (Defs.playareaY0 - 32);
yvel = Utils.RandBetweenFloat(1, 2);
frameVel = 2;
subtype = Utils.RandBetweenInt(0, 3);
graphicID = (subtype + GraphicObjects.gfx_pickup1);
}
public function RotateTowards(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:Number;
var _local11:*;
_local4 = Math.PI;
_local5 = (_local4 * 2);
_local6 = Math.cos(_arg1);
_local7 = Math.sin(_arg1);
_local8 = Math.cos(_arg2);
_local9 = Math.sin(_arg2);
_local10 = ((_local8 * _local7) - (_local6 * _local9));
_local11 = _arg1;
if (_local10 < 0){
_local11 = (_local11 + _arg3);
} else {
if (_local10 > 0){
_local11 = (_local11 - _arg3);
};
};
if (_local11 > _local5){
_local11 = (_local11 - _local5);
};
if (_local11 < 0){
_local11 = (_local11 + _local5);
};
return (_local11);
}
public function GetVelFromDir(_arg1:Number){
xvel = (Math.cos(dir) * _arg1);
yvel = (Math.sin(dir) * _arg1);
}
}
}//package
Section 18
//GameObjGroup (GameObjGroup)
package {
import flash.events.*;
class GameObjGroup {
public var numobjs:int;// = 100
var m:Main;
public var zorder:Array;
public var objs:Array;
function GameObjGroup(_arg1){
var _local2:*;
numobjs = 100;
super();
m = _arg1;
objs = new Array();
zorder = new Array(100);
_local2 = 0;
while (_local2 < numobjs) {
objs.push(new GameObj(m, 0, 0));
_local2++;
};
}
public function Update():void{
var _local1:int;
_local1 = 0;
while (_local1 < objs.length) {
if (objs[_local1].active == true){
objs[_local1].Update();
};
_local1++;
};
}
public function GetZOrder():int{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:int;
_local1 = 0;
while (_local1 < numobjs) {
if (objs[_local1].active == true){
if (objs[_local1].handleRender == true){
zorder[_local3] = _local1;
_local3++;
};
};
_local1++;
};
_local4 = _local3;
_local1 = 0;
while (_local1 < (_local4 - 1)) {
_local2 = (_local1 + 1);
while (_local2 < _local4) {
_local5 = objs[zorder[_local1]].zpos;
_local6 = objs[zorder[_local2]].zpos;
if (_local6 > _local5){
_local7 = zorder[_local1];
zorder[_local1] = zorder[_local2];
zorder[_local2] = _local7;
};
_local2++;
};
_local1++;
};
return (_local4);
}
public function AddObj(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:int, _arg6:int):GameObj{
var _local7:int;
var _local8:GameObj;
_local7 = 0;
while (_local7 < numobjs) {
if (objs[_local7].active == false){
_local8 = objs[_local7];
_local8.active = true;
_local8.zpos = _arg4;
_local8.xpos = _arg2;
_local8.ypos = _arg3;
_local8.startx = _arg2;
_local8.starty = _arg3;
_local8.yvel = 0;
_local8.graphicID = _arg5;
_local8.SetType(_arg1);
_local8.extraInfo = _arg6;
return (objs[_local7]);
};
_local7++;
};
return (null);
}
public function Render():void{
var _local1:int;
var _local2:int;
_local1 = GetZOrder();
_local2 = 0;
while (_local2 < _local1) {
objs[zorder[_local2]].Render(m);
_local2++;
};
}
public function CountActiveObjects():int{
var _local1:int;
var _local2:int;
_local2 = 0;
while (_local2 < objs.length) {
if (objs[_local2].active == true){
_local1++;
};
_local2++;
};
return (_local1);
}
}
}//package
Section 19
//GameOverState (GameOverState)
package {
import flash.display.*;
import flash.events.*;
public class GameOverState {
static var main:Main;
static var titleMC:MovieClip;
static var initedScores:Boolean;
static var gameOverFlag:Boolean;
static var gameOverTimer:Number;
public function GameOverState(){
gameOverFlag = false;
gameOverTimer = 0;
initedScores = false;
}
public static function enterScoreCallback(){
main.SetGameState(Main.gameState_TITLE);
}
public static function Update(_arg1:Main):void{
}
public static function buttonDonePressed(_arg1:MouseEvent){
main.SetGameState(Main.gameState_TITLE);
}
public static function Init(_arg1:Main):void{
main = _arg1;
gameOverFlag = true;
gameOverTimer = 50;
main.InitStageNoBackground();
initedScores = false;
HighScore.SubmitScore(Game.currentScore, Game.difficulty, null);
}
}
}//package
Section 20
//GraphicObjects (GraphicObjects)
package {
import flash.display.*;
import flash.text.*;
public class GraphicObjects {
public static const gfx_fontblack = 43;
public static const gfx_player = 10;
public static const gfx_enemy1 = 20;
public static const gfx_enemy2 = 21;
public static const gfx_enemy3 = 22;
public static const gfx_enemy4 = 23;
public static const gfx_background = 0;
public static const gfx_pickup1 = 30;
public static const gfx_pickup2 = 31;
public static const gfx_pickup3 = 32;
public static const gfx_pickup4 = 33;
public static const gfx_font1 = 40;
public static const gfx_font2 = 41;
public static const gfx_font3 = 42;
static var main:Main;
static var graphicobjs:Array;
static var count:int;
static var idList:Array;
public static function GetBitmap(_arg1, _arg2):Bitmap{
var _local3:int;
_local3 = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].bitmaps[0]);
}
public static function RenderAt(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number){
var _local6:int;
_local6 = idList[_arg1];
graphicobjs[_local6].frames[_arg2].RenderAt(_arg3, _arg4, _arg5);
}
public static function Add(_arg1:int, _arg2:DisplayObj):void{
idList[_arg1] = count;
graphicobjs.push(_arg2);
count++;
}
public static function InitOnce(_arg1:Main):void{
main = _arg1;
graphicobjs = new Array();
idList = new Array(100);
count = 0;
Add(gfx_background, new DisplayObj(new Background(), 1, 0));
Add(gfx_player, new DisplayObj(new Player(), 1, 0));
Add(gfx_enemy1, new DisplayObj(new Enemy1(), 1, 0));
Add(gfx_enemy2, new DisplayObj(new Enemy2(), 1, 0));
Add(gfx_enemy3, new DisplayObj(new Enemy3(), 1, 0));
Add(gfx_enemy4, new DisplayObj(new Enemy4(), 1, 0));
Add(gfx_pickup1, new DisplayObj(new Pickup1(), 1, 0));
Add(gfx_pickup2, new DisplayObj(new Pickup2(), 1, 0));
Add(gfx_pickup3, new DisplayObj(new Pickup3(), 1, 0));
Add(gfx_pickup4, new DisplayObj(new Pickup4(), 1, 0));
AddFont(gfx_font1, main.tf_scorespr);
AddFont(gfx_font2, main.tf_scorespr1);
AddFont(gfx_font3, main.tf_scorespr2);
AddFont(gfx_fontblack, main.tf_scoresprblack);
}
public static function AddFont(_arg1:int, _arg2:TextFormat):void{
var _local3:DisplayObj;
_local3 = new DisplayObj(null, 0, 0);
_local3.CreateFont(_arg2);
idList[_arg1] = count;
graphicobjs.push(_local3);
count++;
}
public static function RenderAtAlpha(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number){
var _local7:int;
_local7 = idList[_arg1];
graphicobjs[_local7].frames[_arg2].RenderAtAlpha(_arg3, _arg4, _arg5, _arg6);
}
public static function GetNumFrames(_arg1:int):int{
var _local2:int;
_local2 = idList[_arg1];
return (graphicobjs[_local2].frames.length);
}
public static function RenderAtRot(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean){
var _local8:int;
_local8 = idList[_arg1];
if (_arg7){
graphicobjs[_local8].frames[_arg2].RenderAtRotBurned(_arg3, _arg4, _arg5, _arg6);
} else {
graphicobjs[_local8].frames[_arg2].RenderAtRot(_arg3, _arg4, _arg5, _arg6);
};
}
public static function RenderAtAdditive(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number){
var _local7:int;
_local7 = idList[_arg1];
graphicobjs[_local7].frames[_arg2].RenderAtAdditive(_arg3, _arg4, _arg5, _arg6);
}
}
}//package
Section 21
//HelpOverlay (HelpOverlay)
package {
import flash.display.*;
public class HelpOverlay {
var currentType:String;
var displayTimer:Number;
var textQueue:Array;
var overlayMC:MovieClip;
var fps:Number;
var displayedFlags:Array;
var allowHelpFlag:Boolean;
var typeQueue:Array;
var main:MovieClip;
var displayingFlag:Boolean;
public function HelpOverlay(_arg1:MovieClip, _arg2:Number){
var _local3:int;
super();
main = _arg1;
fps = _arg2;
displayingFlag = false;
displayTimer = 0;
overlayMC = null;
currentType = "";
allowHelpFlag = true;
typeQueue = new Array();
textQueue = new Array();
displayedFlags = new Array(0x0100);
_local3 = 0;
while (_local3 < 0x0100) {
displayedFlags[_local3] = 0;
_local3++;
};
}
public function DisplayOnce(_arg1:int, _arg2:String, _arg3:String){
if (_arg1 >= 0x0100){
return;
};
if (displayedFlags[_arg1] == 0){
Display(_arg3);
displayedFlags[_arg1] = 1;
};
}
public function IsBeingDisplayed():Boolean{
return (displayingFlag);
}
function AddToQueue(_arg1:String, _arg2:String){
if (allowHelpFlag == false){
return;
};
typeQueue.push(_arg1);
textQueue.push(_arg2);
}
function RemoveMovieClip(_arg1:MovieClip):void{
main.removeChild(_arg1);
}
function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
main.addChild(_arg3);
return (_arg3);
}
public function Display(_arg1:String){
if (allowHelpFlag == false){
return;
};
AddToQueue("standard", _arg1);
}
function UpdateQueue():void{
var _local1:String;
var _local2:String;
var _local3:MovieClip;
if (displayingFlag == false){
if (typeQueue.length > 0){
_local1 = typeQueue.shift();
_local2 = textQueue.shift();
displayingFlag = true;
displayTimer = (fps * 2);
currentType = _local1;
main.helpTxt.text = _local2;
main.helpTxt.setTextFormat(main.tf_large);
trace(("displaying " + _local2));
};
};
}
public function Update(_arg1:Number){
UpdateQueue();
if (displayingFlag == true){
displayTimer = (displayTimer - _arg1);
if (displayTimer <= 0){
displayingFlag = false;
displayTimer = 0;
overlayMC = null;
main.helpTxt.text = "";
main.helpTxt.setTextFormat(main.tf_large);
};
};
}
}
}//package
Section 22
//HelpScreen1 (HelpScreen1)
package {
import flash.display.*;
public dynamic class HelpScreen1 extends MovieClip {
public var bNext:SimpleButton;
}
}//package
Section 23
//HelpScreens (HelpScreens)
package {
import flash.display.*;
import flash.events.*;
public class HelpScreens {
static var currentScreenNum:int;
static var currentScreen:MovieClip;
public static var active:Boolean;
static var screens:Array;
static var main:Main;
public static function Start():void{
currentScreenNum = 0;
DisplayScreen();
active = true;
}
static function bNextPressed(_arg1:MouseEvent){
trace("pressed");
currentScreenNum++;
if (currentScreenNum >= screens.length){
Stop();
} else {
DisplayScreen();
};
}
public static function InitOnce(_arg1:Main):void{
main = _arg1;
active = false;
currentScreen = null;
screens = new Array();
screens.push(HelpScreen1);
}
static function DisplayScreen(){
var _local1:MovieClip;
if (currentScreen != null){
main.removeChild(currentScreen);
};
_local1 = new (screens[currentScreenNum]);
currentScreen = AddMovieClip(0, 0, _local1);
currentScreen.bNext.addEventListener(MouseEvent.CLICK, bNextPressed);
}
static function Stop(){
if (main != null){
main.removeChild(currentScreen);
};
currentScreen = null;
active = false;
}
static function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
main.addChild(_arg3);
return (_arg3);
}
}
}//package
Section 24
//HighScore (HighScore)
package {
import flash.display.*;
import mochi.*;
public class HighScore {
static var mochiConnectIDs:Array;
static var mochiBoardIDs:Array;
static var main:Main;
static var mochiMovieClip:MovieClip;
public static function InitOnce(_arg1:Main){
main = _arg1;
mochiConnectIDs = new Array();
mochiBoardIDs = new Array();
mochiConnectIDs.push("599078d65ef4a9f2");
mochiBoardIDs.push("2efc0712415a5f0c");
mochiMovieClip = new MovieClip();
MochiServices.connect(mochiConnectIDs[0], mochiMovieClip);
}
public static function SubmitScore(_arg1:int, _arg2:int, _arg3):void{
main.addChild(mochiMovieClip);
MochiScores.showLeaderboard({boardID:mochiBoardIDs[_arg2], score:_arg1, onClose:_arg3, onError:_arg3});
}
public static function Show(_arg1:int):void{
main.addChild(mochiMovieClip);
MochiScores.showLeaderboard({boardID:mochiBoardIDs[_arg1]});
}
}
}//package
Section 25
//InfoOverlay (InfoOverlay)
package {
import flash.text.*;
public class InfoOverlay {
static var main:Main;
static var maxItems:int;
static var list:Array;
public static function Add(_arg1:String){
var _local2:InfoOverlayItem;
_local2 = list[0];
_local2.Init(_arg1);
_local2.precount = 0;
}
public static function AddAt(_arg1:Number, _arg2:String, _arg3:int, _arg4:Number){
var _local5:InfoOverlayItem;
_local5 = list[_arg3];
_local5.Init(_arg2);
_local5.precount = (_arg1 * Defs.fps);
_local5.maxtime = (_arg4 * Defs.fps);
}
public static function Render(){
var _local1:InfoOverlayItem;
for each (_local1 in list) {
if (((_local1.active) && ((_local1.precount <= 0)))){
_local1.textField.text = _local1.text;
_local1.textField.autoSize = TextFieldAutoSize.CENTER;
_local1.textField.setTextFormat(main.tf_infooverlay);
} else {
_local1.textField.text = "";
};
};
}
public static function UpdateOncePerFrame(){
var _local1:InfoOverlayItem;
for each (_local1 in list) {
if (_local1.active){
if (_local1.precount > 0){
_local1.precount = (_local1.precount - main.ftime);
} else {
_local1.timer = (_local1.timer + main.ftime);
if (_local1.timer >= _local1.maxtime){
_local1.timer = _local1.maxtime;
_local1.active = false;
};
};
};
};
}
public static function InitForLevel(_arg1:Main){
var _local2:int;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:InfoOverlayItem;
main = _arg1;
list = new Array();
maxItems = 8;
_local3 = 300;
_local4 = 200;
_local5 = 70;
_local2 = 0;
while (_local2 < maxItems) {
_local6 = new InfoOverlayItem(main, _local3, _local4);
list.push(_local6);
_local4 = (_local4 + _local5);
_local2++;
};
}
}
}//package
import flash.display.*;
import flash.text.*;
import flash.filters.*;
class InfoOverlayItem {
public var timer:Number;
public var active:Boolean;
public var type:int;
public var text:String;
public var maxtime:Number;
public var mc:MovieClip;
public var precount:Number;
public var textField:TextField;
private function InfoOverlayItem(_arg1:Main, _arg2, _arg3){
textField = CreateTextField(_arg1.tf_infooverlay, _arg2, _arg3, "");
mc = new MovieClip();
mc.filters = new Array(new GlowFilter(0xFFFF00, 1, 25, 25, 2, 1, false));
mc.addChild(textField);
_arg1.addChild(mc);
active = false;
type = 0;
precount = 0;
}
private function CreateTextField(_arg1:TextFormat, _arg2:Number, _arg3:Number, _arg4:String):TextField{
var _local5:TextField;
_local5 = new TextField();
_local5.selectable = false;
_local5.embedFonts = true;
_local5.autoSize = TextFieldAutoSize.CENTER;
_local5.x = _arg2;
_local5.y = _arg3;
_local5.text = _arg4;
_local5.setTextFormat(_arg1);
return (_local5);
}
public function Init(_arg1:String){
type = 0;
timer = 0;
maxtime = (Defs.fps * 2);
text = _arg1;
active = true;
precount = 0;
}
}
Section 26
//KeyReader (KeyReader)
package {
import flash.display.*;
import flash.events.*;
public class KeyReader {
var keysPressed:Array;
var keysDown:Array;
static const KEY_LEFT = 37;
static const KEY_UP = 38;
static const KEY_DOWN = 40;
static const KEY_3 = 51;
static const KEY_5 = 53;
static const KEY_7 = 55;
static const KEY_1 = 49;
static const KEY_2 = 50;
static const KEY_4 = 52;
static const KEY_6 = 54;
static const KEY_8 = 56;
static const KEY_9 = 57;
static const KEY_A = 65;
static const KEY_B = 66;
static const KEY_C = 67;
static const KEY_E = 69;
static const KEY_F = 70;
static const KEY_G = 71;
static const KEY_H = 72;
static const KEY_I = 73;
static const KEY_J = 74;
static const KEY_D = 68;
static const KEY_M = 77;
static const KEY_N = 78;
static const KEY_O = 79;
static const KEY_P = 80;
static const KEY_Q = 81;
static const KEY_R = 82;
static const KEY_L = 76;
static const KEY_T = 84;
static const KEY_U = 85;
static const KEY_V = 86;
static const KEY_W = 87;
static const KEY_X = 88;
static const KEY_Y = 89;
static const KEY_K = 75;
static const KEY_0 = 58;
static const KEY_Z = 90;
static const KEY_S = 83;
static const KEY_SPACE = 32;
static const KEY_RIGHT = 39;
public function KeyReader(_arg1:Stage){
var _local2:int;
super();
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyUpListener);
_arg1.focus = _arg1;
keysDown = new Array(0x0100);
keysPressed = new Array(0x0100);
_local2 = 0;
while (_local2 < 0x0100) {
keysDown[_local2] = int(0);
keysPressed[_local2] = Boolean(false);
_local2++;
};
}
public function Down(_arg1:int):Boolean{
return (!((keysDown[_arg1] == 0)));
}
public function Pressed(_arg1:int):Boolean{
return (keysPressed[_arg1]);
}
function keyDownListener(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = _arg1.keyCode;
var _local3 = keysDown;
var _local4 = _local2;
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
}
public function UpdateOncePerFrame():void{
var _local1:int;
_local1 = 0;
while (_local1 < 0x0100) {
if (keysDown[_local1] == 1){
keysPressed[_local1] = true;
var _local2 = keysDown;
var _local3 = _local1;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
} else {
keysPressed[_local1] = false;
};
_local1++;
};
}
function keyUpListener(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = _arg1.keyCode;
keysDown[_local2] = 0;
}
}
}//package
Section 27
//LevelButton (LevelButton)
package {
import flash.display.*;
public dynamic class LevelButton extends MovieClip {
public var perfect:MovieClip;
public var silver:MovieClip;
public var gold:MovieClip;
public var bronze:MovieClip;
public var cover:MovieClip;
}
}//package
Section 28
//Levels (Levels)
package {
import flash.net.*;
public class Levels {
static var levelsComplete:Array;
static var sharedObjectSaveName = "MarbleRoll";
static var levelsLocked:Array;
static var levelsPerfect:Array;
static var SilverTimes:Array;
static var levelTimes:Array;
static var GoldTimes:Array;
static var maxLevels:int;
public static function SetBestTime(_arg1:int, _arg2:Number, _arg3:Boolean):void{
var _local4:Number;
trace(_arg2);
_local4 = levelTimes[_arg1];
if (_arg2 < _local4){
_local4 = _arg2;
};
levelTimes[_arg1] = _local4;
levelsComplete[_arg1] = true;
if (levelsPerfect[_arg1] == false){
levelsPerfect[_arg1] = _arg3;
};
if (_arg1 < (maxLevels - 1)){
levelsLocked[(_arg1 + 1)] = false;
};
}
public static function GetQualifyingString(_arg1:int):String{
return ("Unlocked");
}
public static function Load():void{
var _local1:SharedObject;
_local1 = SharedObject.getLocal(sharedObjectSaveName);
if (_local1.size != 0){
levelTimes = _local1.data.levelTimes;
levelsLocked = _local1.data.levelsLocked;
levelsPerfect = _local1.data.levelsPerfect;
levelsComplete = _local1.data.levelsComplete;
};
}
public static function IsLevelComplete(_arg1:int):Boolean{
return (levelsComplete[_arg1]);
}
public static function InitOnce():void{
maxLevels = 20;
ResetData();
}
public static function GetSilverQualifyTime(_arg1:int):Number{
var _local2:Number;
_local2 = SilverTimes[_arg1];
return (_local2);
}
public static function IsLevelPerfect(_arg1:int):Boolean{
return (levelsPerfect[_arg1]);
}
public static function IsLevelLocked(_arg1:int):Boolean{
return (levelsLocked[_arg1]);
}
public static function UnlockAll():void{
var _local1:int;
_local1 = 0;
while (_local1 < maxLevels) {
levelsLocked[_local1] = false;
_local1++;
};
}
public static function GetName(_arg1:int):String{
if (_arg1 == 0){
return ("Warp Zone");
};
if (_arg1 == 1){
return ("Solar System");
};
if (_arg1 == 2){
return ("Orbital");
};
if (_arg1 == 3){
return ("Biosphere");
};
if (_arg1 == 4){
return ("Oceania");
};
if (_arg1 == 5){
return ("Stratosphere");
};
if (_arg1 == 6){
return ("Vortex");
};
if (_arg1 == 7){
return ("Subterrestrial");
};
return ("");
}
public static function Save():void{
var _local1:SharedObject;
_local1 = SharedObject.getLocal(sharedObjectSaveName);
_local1.data.levelTimes = levelTimes;
_local1.data.levelsLocked = levelsLocked;
_local1.data.levelsPerfect = levelsPerfect;
_local1.data.levelsComplete = levelsComplete;
}
public static function GetBestTime(_arg1:int):Number{
var _local2:Number;
_local2 = levelTimes[_arg1];
return (_local2);
}
public static function GetGoldQualifyTime(_arg1:int):Number{
var _local2:Number;
_local2 = GoldTimes[_arg1];
return (_local2);
}
public static function GetLevelCupFromTime(_arg1:int, _arg2:Number):int{
var _local3:int;
if (levelsComplete[_arg1] == false){
return (0);
};
_local3 = 0;
if (_arg2 < GoldTimes[_arg1]){
return (3);
};
if (_arg2 < SilverTimes[_arg1]){
return (2);
};
return (1);
}
public static function GetLevelCup(_arg1:int):int{
var _local2:int;
var _local3:Number;
if (levelsComplete[_arg1] == false){
return (0);
};
_local2 = 0;
_local3 = levelTimes[_arg1];
if (_local3 < GoldTimes[_arg1]){
return (3);
};
if (_local3 < SilverTimes[_arg1]){
return (2);
};
return (1);
}
static function InitCupTimes():void{
SilverTimes = new Array(maxLevels);
GoldTimes = new Array(maxLevels);
SilverTimes[0] = 20;
GoldTimes[0] = 18;
SilverTimes[1] = 21;
GoldTimes[1] = 18.5;
SilverTimes[2] = 16;
GoldTimes[2] = 13;
SilverTimes[3] = 17;
GoldTimes[3] = 13;
SilverTimes[4] = 17;
GoldTimes[4] = 16;
SilverTimes[5] = 15;
GoldTimes[5] = 13;
SilverTimes[6] = 35;
GoldTimes[6] = 30;
SilverTimes[7] = 32;
GoldTimes[7] = 26;
SilverTimes[8] = 40;
GoldTimes[8] = 30;
SilverTimes[9] = 45;
GoldTimes[9] = 37;
SilverTimes[10] = 35;
GoldTimes[10] = 30;
SilverTimes[11] = 25;
GoldTimes[11] = 17;
SilverTimes[12] = 50;
GoldTimes[12] = 40;
SilverTimes[13] = 50;
GoldTimes[13] = 40;
SilverTimes[14] = 80;
GoldTimes[14] = 60;
SilverTimes[15] = 120;
GoldTimes[15] = 60;
SilverTimes[16] = 120;
GoldTimes[16] = 60;
SilverTimes[17] = 120;
GoldTimes[17] = 60;
SilverTimes[18] = 120;
GoldTimes[18] = 60;
SilverTimes[19] = 120;
GoldTimes[19] = 60;
}
public static function ResetData():void{
var _local1:int;
levelTimes = new Array(maxLevels);
levelsPerfect = new Array(maxLevels);
levelsLocked = new Array(maxLevels);
levelsComplete = new Array(maxLevels);
_local1 = 0;
while (_local1 < maxLevels) {
levelTimes[_local1] = Number(999999);
_local1++;
};
_local1 = 0;
while (_local1 < maxLevels) {
levelsLocked[_local1] = Boolean(true);
levelsPerfect[_local1] = Boolean(false);
levelsComplete[_local1] = Boolean(false);
_local1++;
};
levelsLocked[0] = false;
InitCupTimes();
}
public static function GetBestTimeInSeconds(_arg1:int):Number{
var _local2:Number;
_local2 = levelTimes[_arg1];
return (_local2);
}
}
}//package
Section 29
//LevelSelectMenu (LevelSelectMenu)
package {
import flash.display.*;
public dynamic class LevelSelectMenu extends MovieClip {
}
}//package
Section 30
//Line (Line)
package {
import flash.geom.*;
public class Line {
public var nx:Number;
public var ny:Number;
public var dir:Number;
public var dy:Number;
public var y0:Number;
public var y1:Number;
public var dx:Number;
public var normalDir:Number;
public var length:Number;
public var boundingRect:Rectangle;
public var x0:Number;
public var x1:Number;
public function Line(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
x0 = _arg1;
y0 = _arg2;
x1 = _arg3;
y1 = _arg4;
CalcNormal();
CalcBoundingRect();
}
function CalcNormal():void{
dir = Math.atan2((y1 - y0), (x1 - x0));
normalDir = (dir - (Math.PI * 0.5));
nx = Math.cos(normalDir);
ny = Math.sin(normalDir);
dx = (x1 - x0);
dy = (y1 - y0);
length = Math.sqrt(((dx * dx) + (dy * dy)));
}
function CalcBoundingRect():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = x0;
_local2 = x1;
if (_local1 > _local2){
_local1 = x1;
_local2 = x0;
};
_local3 = y0;
_local4 = y1;
if (_local3 > _local4){
_local3 = y1;
_local4 = y0;
};
boundingRect = new Rectangle(_local1, _local3, ((_local2 - _local1) + 1), ((_local4 - _local3) + 1));
}
}
}//package
Section 31
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.ui.*;
import flash.filters.*;
public class Main extends MovieClip {
public var keyReader:KeyReader;// = null
public var doAutofire:Boolean;// = false
var adClip:MovieClip;
var levelTimer:Number;
public var starfieldBD:BitmapData;
var ftime:Number;
var overlay:Overlay;// = null
var endLevMC:MovieClip;
var currentMusicID:int;// = -1
public var doMusic:Boolean;// = true
var objs:GameObjGroup;// = null
var gameTimer:Number;
public var pauseMenu:PauseMenu;// = null
public var mochiScores;
var adIDLongAnimals;// = "0067585d608ea9c9"
var lastMusicID;// = -1
public var tf_score:TextFormat;
var difficultyLevel:int;
public var overlayBD:BitmapData;
var scoretxt:TextField;
var musicSoundTransform:SoundTransform;
var particles:Particles;// = null
var levelEndTimer:Number;
var musicChannel1:SoundChannel;// = null
private var backgroundB:Bitmap;
var backgroundFrame:Number;// = 0
public var tf_scoresprblack:TextFormat;
var mochiMovieClip:MovieClip;
public var tf_small:TextFormat;
public var tf_scorespr:TextFormat;
var musicChannel:SoundChannel;// = null
public var tf_scorespr2:TextFormat;
var cheatMode:Boolean;
var debugTxt:TextField;
public var tf_large:TextFormat;
public var tf_scorespr1:TextFormat;
public var doSound:Boolean;// = true
private var screenB:Bitmap;
private var starfieldB:Bitmap;
public var helpTxt:TextField;
var adRes;// = "600x600"
var levelTimerMax:Number;
var musicSound1:Sound;
public var tf_infooverlay:TextFormat;
public var screenBD:BitmapData;
var displayDebugFlag;// = false
var gameState:int;// = 0
var musicSoundTransform1:SoundTransform;
var helpOverlay:HelpOverlay;// = null
var currentTime:Number;// = 0
var goPlayer:GameObj;// = null
public var backgroundBD:BitmapData;
var adIDRobotJam;// = "0f51714860a20438"
private var overlayB:Bitmap;
var healthTo:Number;// = 0
var musicSound:Sound;
static const gameState_HIGHSCORES = 3;
static const gameState_GAMEOVER = 2;
static const gameState_LEVEL_PLAY = 1;
public static const gravity = 0.1;
static const gameState_LEVEL_SELECT = 4;
static const gameState_TITLE = 0;
static var theRoot:MovieClip;
public static var theStage:Stage;
public function Main(){
currentTime = 0;
adIDLongAnimals = "0067585d608ea9c9";
adIDRobotJam = "0f51714860a20438";
adRes = "600x600";
musicChannel = null;
musicChannel1 = null;
gameState = gameState_TITLE;
doSound = true;
doMusic = true;
doAutofire = false;
goPlayer = null;
keyReader = null;
pauseMenu = null;
helpOverlay = null;
overlay = null;
particles = null;
objs = null;
displayDebugFlag = false;
lastMusicID = -1;
currentMusicID = -1;
healthTo = 0;
backgroundFrame = 0;
super();
theRoot = this;
theStage = this.root.stage;
SetEverythingUpOnce();
}
function RandBetween(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * ((_arg2 + 1) - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
function RunPreGameAd(){
}
function InitStageForLevel(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
addChild(backgroundB);
addChild(starfieldB);
addChild(screenB);
addChild(overlayB);
screenB.x = 0;
screenB.y = 0;
}
public function PlaySound(_arg1:int):void{
if (doSound == false){
return;
};
if (gameState != gameState_LEVEL_PLAY){
return;
};
}
public function soundOffPressed(_arg1:MouseEvent){
if (doSound == false){
return;
};
musicChannel.stop();
doSound = false;
}
function RandBetweenFloat(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
private function CreateTextField(_arg1:TextFormat, _arg2:Number, _arg3:Number, _arg4:String):TextField{
var _local5:TextField;
_local5 = new TextField();
_local5.selectable = false;
_local5.embedFonts = true;
_local5.autoSize = TextFieldAutoSize.CENTER;
_local5.x = _arg2;
_local5.y = _arg3;
_local5.text = _arg4;
_local5.setTextFormat(_arg1);
addChild(_local5);
return (_local5);
}
public function AddParticle(_arg1:Number, _arg2:Number, _arg3:int, _arg4:Number, _arg5:int){
var _local6:int;
_local6 = 0;
while (_local6 < _arg5) {
particles.Add(_arg3, _arg1, _arg2, _arg4);
_local6++;
};
}
function RunLevelComplete(){
}
function InitLevel(){
var _local1:GameObj;
var _local2:Array;
StartMusic(1);
InitStageForLevel();
InfoOverlay.InitForLevel(this);
pauseMenu.InitForLevel();
overlay.StartFadeIn(null);
scoretxt = CreateTextField(tf_score, 30, (600 - 30), "");
scoretxt.autoSize = TextFieldAutoSize.LEFT;
debugTxt = CreateTextField(tf_small, 400, 40, "");
helpTxt = CreateTextField(tf_large, 400, 120, "");
particles.Reset();
MouseControl.buttonPressed = false;
_local2 = new Array();
particles.Reset();
objs = new GameObjGroup(this);
Game.InitLevel();
Game.InitLevelParams();
}
function InitDrawScreen():void{
backgroundBD = new BitmapData(600, 600, false, 0);
backgroundB = new Bitmap(backgroundBD);
screenBD = new BitmapData(600, 600, true, 0);
screenB = new Bitmap(screenBD);
screenBD.fillRect(new Rectangle(0, 0, 600, 600), 0);
starfieldBD = new BitmapData(600, 600, true, 0);
starfieldB = new Bitmap(starfieldBD);
starfieldBD.fillRect(new Rectangle(0, 0, 600, 600), 0);
overlayBD = new BitmapData(600, 600, true, 0);
overlayB = new Bitmap(overlayBD);
overlayBD.fillRect(new Rectangle(0, 0, 600, 600), 0);
}
function InitLevelGetReady(){
}
function RemoveMovieClip(_arg1:MovieClip):void{
removeChild(_arg1);
}
function run(_arg1:Event):void{
if (keyReader != null){
keyReader.UpdateOncePerFrame();
};
InfoOverlay.UpdateOncePerFrame();
if (SiteLock.IsLocked()){
};
calcFrameTime();
overlay.Update();
switch (gameState){
case gameState_TITLE:
TitleScreenState.Update(this);
break;
case gameState_LEVEL_SELECT:
break;
case gameState_HIGHSCORES:
break;
case gameState_LEVEL_PLAY:
RunLevel();
break;
case gameState_GAMEOVER:
GameOverState.Update(this);
break;
};
MouseControl.UpdateOncePerFrame();
}
function InitStageNoBackground(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
}
function SetEverythingUpOnce():void{
trace("SetEverythingUpOnce");
SiteLock.InitOnce();
Levels.InitOnce();
addEventListener(Event.ENTER_FRAME, run);
keyReader = new KeyReader(theStage);
SoundPlayer.InitOnce(this);
pauseMenu = new PauseMenu(this);
particles = new Particles(this, 1000);
InitDrawScreen();
InitFonts();
GraphicObjects.InitOnce(this);
overlay = new Overlay(this, null, null);
helpOverlay = new HelpOverlay(this, Defs.fps);
Collision.InitOnce();
HelpScreens.InitOnce(this);
HighScore.InitOnce(this);
MochiBot.track(this, "40dd0353");
InitStage();
InitGame();
Game.Init(this);
theStage.addEventListener(MouseEvent.MOUSE_MOVE, MouseControl.MouseHandler);
theStage.addEventListener(MouseEvent.MOUSE_DOWN, MouseControl.MouseClickHandler);
theStage.addEventListener(MouseEvent.MOUSE_UP, MouseControl.MouseUpHandler);
SetGameState(gameState_TITLE);
}
public function hardPressed(_arg1:MouseEvent){
difficultyLevel = 2;
}
function InitFonts():void{
var _local1:Font;
tf_large = new TextFormat();
tf_small = new TextFormat();
tf_infooverlay = new TextFormat();
tf_score = new TextFormat();
tf_scorespr = new TextFormat();
tf_scorespr1 = new TextFormat();
tf_scorespr2 = new TextFormat();
tf_scoresprblack = new TextFormat();
_local1 = new Font20();
tf_large.font = _local1.fontName;
tf_large.size = 45;
tf_large.color = 0;
tf_small.font = _local1.fontName;
tf_small.size = 16;
tf_small.color = 4294967295;
tf_scorespr.font = _local1.fontName;
tf_scorespr.size = 18;
tf_scorespr.color = 4294901760;
tf_scorespr1.font = _local1.fontName;
tf_scorespr1.size = 18;
tf_scorespr1.color = 4294967295;
tf_scorespr2.font = _local1.fontName;
tf_scorespr2.size = 18;
tf_scorespr2.color = 4294967040;
tf_scoresprblack.font = _local1.fontName;
tf_scoresprblack.size = 20;
tf_scoresprblack.color = 0;
tf_infooverlay.font = _local1.fontName;
tf_infooverlay.size = 60;
tf_infooverlay.color = 4294967295;
tf_score.font = _local1.fontName;
tf_score.size = 20;
tf_score.color = 4294967295;
}
function InitPreGameAd(){
InitStage();
adClip = new MovieClip();
addChild(adClip);
if (Math.random() < 0.25){
MochiAd.showPreGameAd({ad_finished:AdFinished, clip:adClip, id:adIDRobotJam, res:adRes, background:7369053, color:35071, outline:0xFFFFFF, no_bg:true});
} else {
MochiAd.showPreGameAd({ad_finished:AdFinished, clip:adClip, id:adIDLongAnimals, res:adRes, background:7369053, color:35071, outline:0xFFFFFF, no_bg:true});
};
}
public function mediumPressed(_arg1:MouseEvent){
difficultyLevel = 1;
}
function RunLevelGetReady(){
}
public function buttonCredits(_arg1:MouseEvent){
mochiScores.ShowLeaderboard(this);
}
function StartMusic(_arg1:int){
if (doMusic == false){
return;
};
if (musicChannel != null){
musicChannel.stop();
};
if (musicChannel1 != null){
musicChannel1.stop();
};
if (_arg1 == 0){
musicSoundTransform = new SoundTransform(1, 0);
musicSound = new Tune2();
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
if (_arg1 == 1){
musicSoundTransform = new SoundTransform(1, 0);
musicSound = new Tune1();
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
lastMusicID = _arg1;
}
function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
addChild(_arg3);
return (_arg3);
}
public function soundOnPressed(_arg1:MouseEvent){
if (doSound == true){
return;
};
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
doSound = true;
}
function calcFrameTime(){
var _local1:Number;
_local1 = currentTime;
currentTime = getTimer();
if (currentTime < _local1){
_local1 = (currentTime - 100);
};
if (currentTime > (_local1 + (100 * 10))){
_local1 = (100 * 10);
};
ftime = ((1 / (1000 / Defs.fps)) * (currentTime - _local1));
ftime = 1;
}
function BlurStarfield(){
var _local1:Array;
var _local2:BitmapFilter;
var _local3:BitmapFilter;
_local1 = new Array();
_local1 = _local1.concat([1, 0, 0, 0, 0]);
_local1 = _local1.concat([0, 1, 0, 0, 0]);
_local1 = _local1.concat([0, 0, 1, 0, 0]);
_local1 = _local1.concat([0, 0, 0, 0.9, 0]);
_local2 = new ColorMatrixFilter(_local1);
_local3 = new BlurFilter(2, 2, 1);
starfieldBD.applyFilter(starfieldBD, new Rectangle(0, 0, 600, 600), new Point(0, 0), _local3);
}
public function backPressed(_arg1:MouseEvent){
}
function InitGame(){
difficultyLevel = 1;
}
public function buttonHighScoresPressed(_arg1:MouseEvent){
mochiScores.ShowLeaderboard(this);
}
public function buttonMoreGames(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.longanimalsgames.com"));
}
function SetGameState(_arg1:int):void{
gameState = _arg1;
Mouse.show();
switch (gameState){
case gameState_TITLE:
TitleScreenState.Init(this);
break;
case gameState_LEVEL_SELECT:
break;
case gameState_HIGHSCORES:
break;
case gameState_LEVEL_PLAY:
InitLevel();
break;
case gameState_GAMEOVER:
GameOverState.Init(this);
break;
};
}
function InitLevelComplete(){
InitStage();
}
public function buttonStartPressed(_arg1:MouseEvent){
StartGameCallback();
}
function Render():void{
var _local1:int;
var _local2:uint;
_local1 = Game.currentLevel;
_local1 = (_local1 % Game.backgroundColList.length);
_local2 = Game.backgroundColList[_local1];
backgroundBD.fillRect(new Rectangle(0, 0, 600, 600), _local2);
screenBD.fillRect(new Rectangle(0, 0, 600, 600), 0);
BlurStarfield();
objs.Render();
particles.Render(this);
Game.RenderStarfield();
Game.RenderPanel();
InfoOverlay.Render();
}
function StartGameCallback(){
InitGame();
SetGameState(gameState_LEVEL_PLAY);
}
public function easyPressed(_arg1:MouseEvent){
difficultyLevel = 0;
}
function InitStage(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
addChild(screenB);
screenB.x = 0;
screenB.y = 0;
}
function AdFinished(){
SetGameState(gameState_TITLE);
}
function RunLevel(){
if (Game.state == Game.state_PLAY){
if (keyReader.Pressed(KeyReader.KEY_P)){
if (pauseMenu.IsPaused()){
pauseMenu.Unpause();
} else {
pauseMenu.Pause();
};
};
};
helpOverlay.Update(ftime);
if (pauseMenu.IsPaused() == false){
Game.UpdateGameplay();
if (Game.state == Game.state_PLAY){
objs.Update();
Collision.Update(this);
};
particles.Update(ftime);
InfoOverlay.UpdateOncePerFrame();
};
Render();
if (overlay.IsActive()){
scoretxt.text = "";
scoretxt.setTextFormat(tf_score);
} else {
scoretxt.text = ("Score: " + Game.currentScore);
scoretxt.setTextFormat(tf_score);
};
debugTxt.setTextFormat(tf_small);
}
public function ResumeMusic(){
currentMusicID = (lastMusicID - 1);
StartMusic(lastMusicID);
}
public function PauseMusic(){
musicChannel.stop();
}
}
}//package
Section 32
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.5");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
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;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
setTimeout(options.ad_finished, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 33
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 34
//MouseControl (MouseControl)
package {
import flash.events.*;
public class MouseControl {
public static var posX:Number = 0;
public static var posY:Number = 0;
public static var oldPosX:Number = 0;
public static var oldPosY:Number = 0;
public static var buttonPressed:Boolean = false;
public static var buttonDown:Boolean = false;
public static var velX:Number = 0;
public static var velY:Number = 0;
public static function MouseHandler(_arg1:MouseEvent):void{
posX = _arg1.stageX;
posY = _arg1.stageY;
velX = (posX - oldPosX);
velY = (posY - oldPosY);
oldPosX = posX;
oldPosY = posY;
}
public static function MouseClickHandler(_arg1:MouseEvent):void{
buttonPressed = true;
buttonDown = true;
}
public static function MouseUpHandler(_arg1:MouseEvent):void{
buttonPressed = false;
buttonDown = false;
}
public static function UpdateOncePerFrame():void{
if (buttonPressed){
buttonPressed = false;
};
}
public static function Reset():void{
buttonPressed = false;
buttonDown = false;
}
}
}//package
Section 35
//Overlay (Overlay)
package {
import flash.display.*;
public class Overlay {
var callback:Object;
var parent:MovieClip;
var fadingOut:Boolean;
var mcOut:MovieClip;
var mcIn:MovieClip;
var fadingIn:Boolean;
public function Overlay(_arg1:MovieClip, _arg2:MovieClip, _arg3:MovieClip){
fadingIn = false;
fadingOut = false;
AddClips(_arg1, _arg2, _arg3);
}
public function AddClips(_arg1:MovieClip, _arg2:MovieClip, _arg3:MovieClip):void{
mcIn = _arg3;
mcOut = _arg2;
parent = _arg1;
}
public function StartFadeIn(_arg1:Object){
if (mcIn == null){
return;
};
callback = _arg1;
parent.addChild(mcIn);
mcIn.gotoAndStop(0);
fadingIn = true;
}
public function Update():void{
if (fadingOut == true){
mcOut.nextFrame();
if (mcOut.currentFrame == mcOut.totalFrames){
fadingOut = false;
parent.removeChild(mcOut);
if (callback != null){
callback();
};
};
};
if (fadingIn == true){
mcIn.nextFrame();
if (mcIn.currentFrame == mcIn.totalFrames){
parent.removeChild(mcIn);
fadingIn = false;
if (callback != null){
callback();
};
};
};
}
public function IsActive():Boolean{
if (fadingIn == true){
return (true);
};
if (fadingOut == true){
return (true);
};
return (false);
}
public function StartFadeOut(_arg1:Object){
if (mcOut == null){
return;
};
callback = _arg1;
parent.addChild(mcOut);
mcOut.gotoAndStop(0);
fadingOut = true;
}
}
}//package
Section 36
//Panel (Panel)
package {
import flash.display.*;
public dynamic class Panel extends MovieClip {
}
}//package
Section 37
//Particles (Particles)
package {
import flash.geom.*;
public class Particles {
var max:int;
var list:Array;
var colorTable:Array;
var main:Main;
var nextIndex:int;
public static const type_explo_hitstar = 1;
public static const type_explo1 = 4;
public static const type_trail = 3;
public static const type_explo_hitpickup = 2;
public static const type_explo_hitarm = 0;
public function Particles(_arg1:Main, _arg2:int):void{
var _local3:int;
super();
main = _arg1;
max = _arg2;
nextIndex = 0;
list = new Array(max);
_local3 = 0;
while (_local3 < max) {
list[_local3] = new Particle();
list[_local3].active = false;
_local3++;
};
colorTable = new Array();
_local3 = 0;
while (_local3 < 100) {
_local3++;
};
colorTable.push(4294901760);
colorTable.push(4278255360);
colorTable.push(4278190335);
colorTable.push(4294967040);
colorTable.push(4278255615);
colorTable.push(4294902015);
colorTable.push(4294967295);
}
function RandBetween(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
public function GetNextIndex():int{
return (nextIndex);
}
function RandAngle(_arg1:Particle, _arg2:Number, _arg3:Number){
var _local4:Number;
var _local5:Number;
_local4 = RandBetween(_arg2, _arg3);
_local5 = RandBetween(0, (Math.PI * 2));
_arg1.xvel = (Math.sin(_local5) * _local4);
_arg1.yvel = (Math.cos(_local5) * _local4);
}
public function Add(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:Number;
var _local6:Number;
var _local7:Particle;
var _local8:int;
_local7 = list[nextIndex];
nextIndex++;
if (nextIndex >= max){
nextIndex = 0;
};
_local7.active = true;
_local7.timer = 0;
_local7.type = _arg1;
_local7.alpha = 1;
_local7.alphaAdd = 0;
_local7.additive = false;
_local7.xpos = _arg2;
_local7.ypos = _arg3;
_local7.color = 4294967295;
_local8 = int(_arg4);
if (_arg1 == type_explo_hitarm){
RandRotVel(_local7, 1, 1);
_local7.speed = RandBetween(0, 5);
if (_local8 == 0){
_local7.color = 4294967040;
};
if (_local8 == 1){
_local7.color = 4294940979;
};
if (_local8 == 2){
_local7.color = 4294967142;
};
if (_local8 == 3){
_local7.color = 4294941081;
};
} else {
if (_arg1 == type_explo_hitpickup){
RandRotVel(_local7, 1, 1);
_local7.speed = RandBetween(0, 10);
if (_local8 == 0){
_local7.color = 4278255360;
};
if (_local8 == 1){
_local7.color = 4278190335;
};
if (_local8 == 2){
_local7.color = 4278255581;
};
if (_local8 == 3){
_local7.color = 4294901862;
};
} else {
if (_arg1 == type_explo_hitstar){
RandRotVel(_local7, 1, 1);
_local7.speed = RandBetween(0, 10);
_local7.color = 4294901760;
} else {
if (_arg1 == type_explo1){
_local7.rot = RandBetween(0, 6);
_local7.rotVel = RandBetween(0.05, 0.1);
_local7.speed = RandBetween(5, 10);
_local7.color = 4291559424;
} else {
if (_arg1 == type_trail){
_local7.xvel = 0;
_local7.yvel = 0;
RandRotVel(_local7, 1, 1);
_local7.speed = 0.1;
_local7.yvel = (_local7.yvel + RandBetween(10, 60));
_local7.color = 4294967295;
};
};
};
};
};
_local7.alpha = RandBetween(0.75, 1);
_local7.alphaAdd = -0.025;
}
public function Reset(){
var _local1:int;
nextIndex = 0;
_local1 = 0;
while (_local1 < max) {
list[_local1].active = false;
_local1++;
};
}
public function CountActive():int{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < max) {
if (list[_local2].active){
_local1++;
};
_local2++;
};
return (_local1);
}
public function Update(_arg1:Number){
var _local2:int;
var _local3:Particle;
_local2 = 0;
while (_local2 < max) {
_local3 = list[_local2];
if (_local3.active == true){
_local3.Update(_arg1);
};
_local2++;
};
}
function RandRotVel(_arg1:Particle, _arg2:Number, _arg3:Number):void{
var _local4:Number;
var _local5:Number;
_local4 = RandBetween(_arg2, _arg3);
_local5 = RandBetween(0, (Math.PI * 2));
_arg1.xvel = (Math.cos(_local5) * _local4);
_arg1.yvel = (Math.sin(_local5) * _local4);
}
public function Render(_arg1:Main){
var _local2:int;
var _local3:Particle;
var _local4:Number;
var _local5:Number;
var _local6:uint;
_arg1.starfieldBD.lock();
_local2 = 0;
while (_local2 < max) {
_local3 = list[_local2];
if (_local3.active == true){
_local4 = _local3.xpos;
_local5 = _local3.ypos;
_local6 = _local3.color;
_arg1.starfieldBD.setPixel32(_local4, _local5, _local6);
_arg1.starfieldBD.setPixel32((_local4 + 1), _local5, _local6);
_arg1.starfieldBD.setPixel32((_local4 - 1), _local5, _local6);
_arg1.starfieldBD.setPixel32(_local4, (_local5 + 1), _local6);
_arg1.starfieldBD.setPixel32(_local4, (_local5 - 1), _local6);
if (_local3.additive){
};
};
_local2++;
};
_arg1.starfieldBD.unlock();
}
}
}//package
class Particle {
private var graphicID:int;
private var yvel:Number;
private var timer:Number;
private var active:Boolean;
private var maxframe:int;
private var speed:Number;
private var additive:Boolean;
private var rot:Number;
private var xpos:Number;
private var alpha:Number;
private var alphaAdd:Number;
private var xvel:Number;
private var m:Main;
private var color:uint;
private var frame:Number;
private var frameVel:Number;
private var type:int;
private var ypos:Number;
private var rotVel:Number;
private function Particle(){
}
private function CycleAnimation():void{
frame = (frame + frameVel);
if (frame > maxframe){
frame = (frame - maxframe);
};
if (frame < 0){
frame = (frame + maxframe);
};
}
private function PlayAnimation():Boolean{
frame = (frame + frameVel);
if (frame >= maxframe){
frame = maxframe;
return (true);
};
return (false);
}
private function Update(_arg1:Number){
var _local2:Number;
var _local3:Number;
_local3 = 0.02;
if (type == Particles.type_explo1){
xvel = (Math.cos(rot) * speed);
yvel = (Math.sin(rot) * speed);
rot = (rot + rotVel);
rotVel = (rotVel * 0.95);
xpos = (xpos + xvel);
ypos = (ypos + yvel);
alpha = (alpha + alphaAdd);
if (alpha < 0){
alpha = 0;
active = false;
};
} else {
xpos = (xpos + (xvel * speed));
ypos = (ypos + (yvel * speed));
speed = (speed * 0.95);
alpha = (alpha + alphaAdd);
if (alpha < 0){
alpha = 0;
active = false;
};
};
}
}
Section 38
//PauseMenu (PauseMenu)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.geom.*;
import flash.net.*;
import flash.ui.*;
public class PauseMenu {
var active:Boolean;
var main:Main;
var pauseMC:MovieClip;
public function PauseMenu(_arg1:Main):void{
main = _arg1;
active = false;
}
function InitButtonStates(){
pauseMC.buttonMusicSelected.visible = main.doMusic;
pauseMC.buttonSFXSelected.visible = main.doSound;
}
public function buttonPressed_SFX(_arg1:MouseEvent){
main.doSound = ToggleBool(main.doSound);
InitButtonStates();
}
public function InitForLevel():void{
active = false;
}
public function buttonPressed_Quit(_arg1:MouseEvent){
main.SetGameState(Main.gameState_TITLE);
}
public function IsPaused():Boolean{
return (active);
}
public function Unpause():void{
Mouse.hide();
active = false;
main.removeChild(pauseMC);
}
public function Pause():void{
Mouse.show();
pauseMC = AddMovieClip(0, 0, new PauseMenuPage());
main.addChild(pauseMC);
pauseMC.buttonMusic.addEventListener(MouseEvent.CLICK, buttonPressed_Music);
pauseMC.buttonSFX.addEventListener(MouseEvent.CLICK, buttonPressed_SFX);
pauseMC.buttonQuit.addEventListener(MouseEvent.CLICK, buttonPressed_Quit);
pauseMC.buttonResume.addEventListener(MouseEvent.CLICK, buttonPressed_Resume);
pauseMC.buttonHelp.addEventListener(MouseEvent.CLICK, buttonHelpPressed);
active = true;
InitButtonStates();
}
public function buttonPressed_Resume(_arg1:MouseEvent){
Unpause();
}
public function buttonPressed_Music(_arg1:MouseEvent){
main.doMusic = ToggleBool(main.doMusic);
if (main.doMusic == false){
main.PauseMusic();
};
if (main.doMusic == true){
main.ResumeMusic();
};
InitButtonStates();
}
function ToggleBool(_arg1:Boolean):Boolean{
if (_arg1 == true){
return (false);
};
return (true);
}
function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
main.addChild(_arg3);
return (_arg3);
}
public static function buttonHelpPressed(_arg1:MouseEvent){
HelpScreens.Start();
}
}
}//package
Section 39
//PauseMenuPage (PauseMenuPage)
package {
import flash.display.*;
public dynamic class PauseMenuPage extends MovieClip {
public var buttonSFX:SimpleButton;
public var buttonMusic:SimpleButton;
public var buttonHelp:SimpleButton;
public var buttonQuit:SimpleButton;
public var buttonSFXSelected:MovieClip;
public var buttonMusicSelected:MovieClip;
public var buttonResume:SimpleButton;
}
}//package
Section 40
//Pickup1 (Pickup1)
package {
import flash.display.*;
public dynamic class Pickup1 extends MovieClip {
}
}//package
Section 41
//Pickup2 (Pickup2)
package {
import flash.display.*;
public dynamic class Pickup2 extends MovieClip {
}
}//package
Section 42
//Pickup3 (Pickup3)
package {
import flash.display.*;
public dynamic class Pickup3 extends MovieClip {
}
}//package
Section 43
//Pickup4 (Pickup4)
package {
import flash.display.*;
public dynamic class Pickup4 extends MovieClip {
}
}//package
Section 44
//Player (Player)
package {
import flash.display.*;
public dynamic class Player extends MovieClip {
}
}//package
Section 45
//sfx (sfx)
package {
import flash.media.*;
public dynamic class sfx extends Sound {
}
}//package
Section 46
//SiteLock (SiteLock)
package {
import flash.events.*;
public class SiteLock {
static var miniclip_locked:Boolean = false;
static var sitelockActive:Boolean = true;
public static function InitOnce():void{
}
static function onValidDomain(_arg1:Event):void{
trace("Miniclip sitelock OK");
miniclip_locked = false;
}
public static function GetDomain():String{
var _local1:String;
var _local2:Number;
var _local3:Number;
var _local4:String;
var _local5:Number;
var _local6:Number;
_local1 = Main.theStage.loaderInfo.url;
_local2 = (_local1.indexOf("://") + 3);
_local3 = _local1.indexOf("/", _local2);
_local4 = _local1.substring(_local2, _local3);
_local5 = (_local4.lastIndexOf(".") - 1);
_local6 = (_local4.lastIndexOf(".", _local5) + 1);
_local4 = _local4.substring(_local6, _local4.length);
return (_local4);
}
public static function IsLocked():Boolean{
var _local1:String;
_local1 = GetDomain();
if (((!((_local1 == "flashgamelicense.com"))) && (!((_local1 == "longanimalsgames.com"))))){
return (true);
};
return (false);
}
static function onInvalidDomain(_arg1:Event):void{
trace("Miniclip sitelock INVALID");
miniclip_locked = true;
}
}
}//package
Section 47
//SoundPlayer (SoundPlayer)
package {
import flash.media.*;
import flash.utils.*;
public class SoundPlayer {
public static const minPlayTime = 3;
static const maxSounds = 4;
public static const SOUND_PICKUP0 = 0;
public static const SOUND_PICKUP1 = 2;
public static const SOUND_PICKUP2 = 4;
public static const SOUND_PICKUP3 = 5;
public static const SOUND_LEVELUP = 1;
public static const SOUND_MAX = 6;
public static const SOUND_EXTRASTAR = 3;
static var main:Main;
static var playingFlag:Boolean;
static var channel:SoundChannel;
public static var startTimes:Array;
static var timer:Timer;
static var active = false;
static var Instances:Array;
public static var sound:Sound;
public static var lengths:Array;
public static var soundTransform:SoundTransform;
static function AddSound(_arg1:int, _arg2:Number, _arg3:Number){
startTimes.push((_arg2 * 1000));
lengths.push((_arg3 * 1000));
}
public static function InitOnce(_arg1:Main):void{
var _local2:int;
var _local3:SoundPlay;
main = _arg1;
sound = new sfx();
Instances = new Array(maxSounds);
_local2 = 0;
while (_local2 < maxSounds) {
_local3 = new SoundPlay();
_local3.Clear();
Instances[_local2] = _local3;
_local2++;
};
startTimes = new Array();
lengths = new Array();
AddSound(0, 0, 0.78);
AddSound(0, 0.82, 3.31);
AddSound(0, 4.45, 1.28);
AddSound(0, 5.87, 3.65);
AddSound(0, 10.07, 1.9);
AddSound(0, 12.09, 3.76);
soundTransform = new SoundTransform(1, 0);
active = true;
playingFlag = false;
}
public static function Play(_arg1:int):void{
var _local2:int;
var _local3:SoundPlay;
trace(_arg1);
if (main.doSound == false){
return;
};
_local2 = 0;
while (_local2 < maxSounds) {
_local3 = Instances[_local2];
if (_local3.Active() == false){
_local3.Play(_arg1);
return;
};
_local2++;
};
}
}
}//package
import flash.events.*;
import flash.media.*;
import flash.utils.*;
class SoundPlay {
private var channel:SoundChannel;
private var timer:Timer;
private var playingFlag;
private function SoundPlay(){
}
private function timerHandler(_arg1:TimerEvent):void{
timer.stop();
channel.stop();
playingFlag = false;
}
public function Clear():void{
playingFlag = false;
timer = null;
}
public function Active():Boolean{
return (playingFlag);
}
public function Play(_arg1:int):void{
channel = SoundPlayer.sound.play(SoundPlayer.startTimes[_arg1], 1, SoundPlayer.soundTransform);
timer = new Timer(SoundPlayer.lengths[_arg1]);
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.start();
playingFlag = true;
}
}
Section 48
//Symbol2 (Symbol2)
package {
import flash.display.*;
public dynamic class Symbol2 extends MovieClip {
}
}//package
Section 49
//Symbol3 (Symbol3)
package {
import flash.display.*;
public dynamic class Symbol3 extends MovieClip {
}
}//package
Section 50
//TitlePage (TitlePage)
package {
import flash.display.*;
public dynamic class TitlePage extends MovieClip {
public var buttonHighScores:SimpleButton;
public var buttonLongAnimals:SimpleButton;
public var buttonStart:SimpleButton;
public var buttonMoreGames:SimpleButton;
public var buttonHelp:SimpleButton;
public function TitlePage(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
}
}
}//package
Section 51
//TitleScreenState (TitleScreenState)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class TitleScreenState {
static var main:Main;
static var titleMC:MovieClip;
static function UpdateRadioButtons(){
if (Game.difficulty == 0){
titleMC.b1o.visible = true;
titleMC.b2o.visible = false;
titleMC.b3o.visible = false;
};
if (Game.difficulty == 1){
titleMC.b1o.visible = false;
titleMC.b2o.visible = true;
titleMC.b3o.visible = false;
};
if (Game.difficulty == 2){
titleMC.b1o.visible = false;
titleMC.b2o.visible = false;
titleMC.b3o.visible = true;
};
}
public static function Init(_arg1:Main){
main = _arg1;
main.StartMusic(0);
main.InitStage();
titleMC = main.AddMovieClip(0, 0, new TitlePage());
titleMC.buttonStart.addEventListener(MouseEvent.CLICK, buttonStartPressed);
titleMC.buttonHighScores.addEventListener(MouseEvent.CLICK, buttonHighScoresPressed);
titleMC.buttonHelp.addEventListener(MouseEvent.CLICK, buttonHelpPressed);
titleMC.buttonMoreGames.addEventListener(MouseEvent.CLICK, buttonMoreGamesPressed);
titleMC.buttonLongAnimals.addEventListener(MouseEvent.CLICK, buttonMoreGamesPressed);
}
public static function buttonMoreGamesPressed(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.longanimalsgames.com"), "_blank");
}
public static function Update(_arg1:Main){
}
public static function buttonStartPressed(_arg1:MouseEvent){
Game.currentLevel = 0;
main.SetGameState(Main.gameState_LEVEL_PLAY);
}
public static function buttonHighScoresPressed(_arg1:MouseEvent){
HighScore.Show(0);
}
public static function buttonHelpPressed(_arg1:MouseEvent){
HelpScreens.Start();
}
}
}//package
Section 52
//Tune1 (Tune1)
package {
import flash.media.*;
public dynamic class Tune1 extends Sound {
}
}//package
Section 53
//Tune2 (Tune2)
package {
import flash.media.*;
public dynamic class Tune2 extends Sound {
}
}//package
Section 54
//Utils (Utils)
package {
import flash.display.*;
import flash.geom.*;
public class Utils {
static function RenderRectangle(_arg1:BitmapData, _arg2:Rectangle, _arg3:uint):void{
RenderDotLine(_arg1, _arg2.left, _arg2.top, _arg2.right, _arg2.top, 100, _arg3);
RenderDotLine(_arg1, _arg2.left, _arg2.bottom, _arg2.right, _arg2.bottom, 100, _arg3);
RenderDotLine(_arg1, _arg2.left, _arg2.top, _arg2.left, _arg2.bottom, 100, _arg3);
RenderDotLine(_arg1, _arg2.right, _arg2.top, _arg2.right, _arg2.bottom, 100, _arg3);
}
public static function DP1(_arg1:Number):Number{
var _local2:Number;
_local2 = (Math.ceil((_arg1 * 10)) / 10);
return (_local2);
}
public static function DP2(_arg1:Number):Number{
var _local2:Number;
_local2 = (Math.ceil((_arg1 * 100)) / 100);
return (_local2);
}
static function RenderDotLine(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:int, _arg7:uint):void{
var _local8:int;
var _local9:int;
var _local10:Number;
var _local11:Number;
_local9 = _arg6;
_local10 = ((_arg4 - _arg2) / Number(_local9));
_local11 = ((_arg5 - _arg3) / Number(_local9));
_local8 = 0;
while (_local8 < _local9) {
_arg2 = (_arg2 + _local10);
_arg3 = (_arg3 + _local11);
_arg1.setPixel32(int(_arg2), int(_arg3), _arg7);
_local8++;
};
}
public static function NumberToString2DP(_arg1:Number):String{
var _local2:String;
var _local3:int;
var _local4:int;
_local2 = DP2(_arg1).toString();
_local3 = _local2.lastIndexOf(".");
if (_local3 == -1){
_local2.concat(".00");
} else {
_local4 = _local2.length;
if (_local3 == (_local4 - 1)){
_local2.concat("0");
};
};
return (_local2);
}
static function RandBetweenInt(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = (Math.random() * ((_arg2 - _arg1) + 1));
_local3 = (_local3 + _arg1);
return (_local3);
}
static function RenderCircle(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:uint):void{
var _local6:int;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_local6 = 100;
_local7 = ((Math.PI * 2) / _local6);
_local9 = 0;
_local8 = 0;
while (_local8 < _local6) {
_local10 = (_arg2 + (Math.cos(_local9) * _arg4));
_local11 = (_arg3 + (Math.sin(_local9) * _arg4));
_local9 = (_local9 + _local7);
_arg1.setPixel32(int(_local10), int(_local11), _arg5);
_local8++;
};
}
static function DistBetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function RandCircle():Number{
return ((Math.random() * (Math.PI * 2)));
}
public static function RadToDeg(_arg1:Number):Number{
return (((360 / (Math.PI * 2)) * _arg1));
}
static function RandBetweenFloat(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = (Math.random() * (_arg2 - _arg1));
_local3 = (_local3 + _arg1);
return (_local3);
}
public static function LineLength(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function ScaleBetween(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
_local4 = ((_arg2 - _arg1) * _arg3);
_local4 = (_arg1 + _local4);
return (_local4);
}
}
}//package