Section 1
//albertHelp_165 (Blockular_fla.albertHelp_165)
package Blockular_fla {
import flash.display.*;
public dynamic class albertHelp_165 extends MovieClip {
public var eyes:MovieClip;
public var mouth:MovieClip;
}
}//package Blockular_fla
Section 2
//badGuy_121 (Blockular_fla.badGuy_121)
package Blockular_fla {
import flash.display.*;
public dynamic class badGuy_121 extends MovieClip {
public var head:MovieClip;
}
}//package Blockular_fla
Section 3
//badHead_142 (Blockular_fla.badHead_142)
package Blockular_fla {
import flash.display.*;
public dynamic class badHead_142 extends MovieClip {
public var eyes:MovieClip;
public var mouth:MovieClip;
}
}//package Blockular_fla
Section 4
//badHeadAnim_84 (Blockular_fla.badHeadAnim_84)
package Blockular_fla {
import flash.display.*;
public dynamic class badHeadAnim_84 extends MovieClip {
public var eyes:MovieClip;
public var mouth:MovieClip;
}
}//package Blockular_fla
Section 5
//blueblink_anim_71 (Blockular_fla.blueblink_anim_71)
package Blockular_fla {
import flash.display.*;
public dynamic class blueblink_anim_71 extends MovieClip {
public var blink:MovieClip;
}
}//package Blockular_fla
Section 6
//bluehead_138 (Blockular_fla.bluehead_138)
package Blockular_fla {
import flash.display.*;
public dynamic class bluehead_138 extends MovieClip {
public var blink:MovieClip;
public var eyes:MovieClip;
public var mouth:MovieClip;
}
}//package Blockular_fla
Section 7
//blueheadAnim_68 (Blockular_fla.blueheadAnim_68)
package Blockular_fla {
import flash.display.*;
public dynamic class blueheadAnim_68 extends MovieClip {
public var mouth:MovieClip;
public function blueheadAnim_68(){
addFrameScript(0, frame1);
}
function frame1(){
mouth.stop();
}
}
}//package Blockular_fla
Section 8
//cliveHelp_173 (Blockular_fla.cliveHelp_173)
package Blockular_fla {
import flash.display.*;
public dynamic class cliveHelp_173 extends MovieClip {
public var mouth:MovieClip;
}
}//package Blockular_fla
Section 9
//drink_86 (Blockular_fla.drink_86)
package Blockular_fla {
import flash.display.*;
public dynamic class drink_86 extends MovieClip {
public var fizz:MovieClip;
public var drinkcolour:MovieClip;
}
}//package Blockular_fla
Section 10
//eyeAnim_76 (Blockular_fla.eyeAnim_76)
package Blockular_fla {
import flash.display.*;
public dynamic class eyeAnim_76 extends MovieClip {
public var eye:MovieClip;
}
}//package Blockular_fla
Section 11
//eyesAnim_69 (Blockular_fla.eyesAnim_69)
package Blockular_fla {
import flash.display.*;
public dynamic class eyesAnim_69 extends MovieClip {
public var eyes:MovieClip;
}
}//package Blockular_fla
Section 12
//MainTimeline (Blockular_fla.MainTimeline)
package Blockular_fla {
import flash.events.*;
import flash.display.*;
import CPMStar.*;
public dynamic class MainTimeline extends MovieClip {
public var buttonSkipCPMStarAd:SimpleButton;
public var loader:MovieClip;
public var ad:DisplayObject;
public var adIDLongAnimals;
public var adBox:MovieClip;
public var CPMStarContentSpotID:String;
public var adIDRobotJam;
public function MainTimeline(){
addFrameScript(0, frame1, 4, frame5, 15, frame16, 25, frame26, 34, frame35, 43, frame44, 67, frame68, 74, frame75);
}
function frame75(){
stop();
}
public function myloading(_arg1:Event){
var _local2:*;
var _local3:*;
var _local4:*;
trace("loading..");
_local2 = stage.loaderInfo.bytesTotal;
_local3 = stage.loaderInfo.bytesLoaded;
_local4 = Math.round(((_local3 * 100) / _local2));
if (_local3 >= _local2){
trace("loaded");
removeEventListener(Event.ENTER_FRAME, myloading);
buttonSkipCPMStarAd.visible = true;
loader.visible = false;
};
}
function frame16(){
stop();
loader.visible = true;
buttonSkipCPMStarAd.visible = false;
CPMStarContentSpotID = "163Q54F3818A";
buttonSkipCPMStarAd.addEventListener(MouseEvent.CLICK, buttonSkipCPMStarAdPressed);
addEventListener(Event.ENTER_FRAME, myloading);
ad = new AdLoader(CPMStarContentSpotID);
adBox.addChild(ad);
}
function frame1(){
Licensors.InitOnce(this.stage);
if (Licensors.GetLicensor() == Licensors.LICENSOR_MINDJOLT){
gotoAndStop("mochiad");
} else {
if (SiteLock.GetDomainFromStage(stage) == "kongregate.com"){
gotoAndStop("mochiad");
} else {
gotoAndStop("cpmstar");
};
};
}
function frame26(){
gotoAndPlay("post_intro");
}
function frame5(){
adIDLongAnimals = "b9f5609e30c7ca42";
adIDRobotJam = "46d9f634dde486c6";
stop();
if (Math.random() < 0.5){
MochiAd.showPreGameAd({clip:root, id:adIDRobotJam, res:"640x480", background:7369053, color:35071, outline:0xFFFFFF, no_bg:true, ad_finished:AdFinishedCallback});
} else {
MochiAd.showPreGameAd({clip:root, id:adIDLongAnimals, res:"640x480", background:7369053, color:35071, outline:0xFFFFFF, no_bg:true, ad_finished:AdFinishedCallback});
};
}
public function AdFinishedCallback(){
gotoAndPlay("post_ad");
}
function frame35(){
gotoAndPlay("post_intro");
}
function frame44(){
gotoAndPlay("continue_loading");
}
public function buttonSkipCPMStarAdPressed(_arg1:MouseEvent){
gotoAndPlay("post_ad");
}
function frame68(){
if (Licensors.GetLicensor() == Licensors.LICENSOR_MINDJOLT){
gotoAndPlay("mjintro_short");
} else {
gotoAndPlay("mjintro_long");
};
}
}
}//package Blockular_fla
Section 13
//mindjolt_ident_5 (Blockular_fla.mindjolt_ident_5)
package Blockular_fla {
import flash.events.*;
import flash.display.*;
import com.mindjolt.api.as3.*;
public dynamic class mindjolt_ident_5 extends MovieClip {
public var eyes:MovieClip;
public var mindlogo:MovieClip;
public function mindjolt_ident_5(){
addFrameScript(0, frame1, 53, frame54, 59, frame60, 176, frame177);
}
public function screenPressed(_arg1:MouseEvent){
trace("clicked here");
MindJoltSponsoredAPI.openLink(1);
}
function frame177(){
MovieClip(parent).play();
stop();
}
function frame1(){
MovieClip(parent).stop();
addEventListener(MouseEvent.CLICK, screenPressed);
}
function frame54(){
mindlogo.stop();
}
function frame60(){
mindlogo.play();
}
}
}//package Blockular_fla
Section 14
//mindjolt_ident_short_19 (Blockular_fla.mindjolt_ident_short_19)
package Blockular_fla {
import flash.events.*;
import flash.display.*;
import com.mindjolt.api.as3.*;
public dynamic class mindjolt_ident_short_19 extends MovieClip {
public var mindlogo:MovieClip;
public function mindjolt_ident_short_19(){
addFrameScript(0, frame1, 9, frame10, 15, frame16, 72, frame73);
}
function frame73(){
MovieClip(parent).play();
stop();
}
public function screenPressed(_arg1:MouseEvent){
trace("clicked here");
MindJoltSponsoredAPI.openLink(1);
}
function frame10(){
mindlogo.stop();
}
function frame16(){
mindlogo.play();
}
function frame1(){
MovieClip(parent).stop();
addEventListener(MouseEvent.CLICK, screenPressed);
}
}
}//package Blockular_fla
Section 15
//mj_logo_17 (Blockular_fla.mj_logo_17)
package Blockular_fla {
import flash.display.*;
public dynamic class mj_logo_17 extends MovieClip {
public function mj_logo_17(){
addFrameScript(37, frame38);
}
function frame38(){
stop();
}
}
}//package Blockular_fla
Section 16
//mj_marker_8 (Blockular_fla.mj_marker_8)
package Blockular_fla {
import flash.display.*;
public dynamic class mj_marker_8 extends MovieClip {
public function mj_marker_8(){
addFrameScript(0, frame1);
}
function frame1(){
this.visible = false;
}
}
}//package Blockular_fla
Section 17
//mouth_73 (Blockular_fla.mouth_73)
package Blockular_fla {
import flash.display.*;
public dynamic class mouth_73 extends MovieClip {
public function mouth_73(){
addFrameScript(49, frame50);
}
function frame50(){
gotoAndStop(1);
}
}
}//package Blockular_fla
Section 18
//orange_eyeAnim_80 (Blockular_fla.orange_eyeAnim_80)
package Blockular_fla {
import flash.display.*;
public dynamic class orange_eyeAnim_80 extends MovieClip {
public var eye:MovieClip;
}
}//package Blockular_fla
Section 19
//orangeHead_79 (Blockular_fla.orangeHead_79)
package Blockular_fla {
import flash.display.*;
public dynamic class orangeHead_79 extends MovieClip {
public var mouth:MovieClip;
public function orangeHead_79(){
addFrameScript(0, frame1);
}
function frame1(){
mouth.stop();
}
}
}//package Blockular_fla
Section 20
//redHeadAnim_75 (Blockular_fla.redHeadAnim_75)
package Blockular_fla {
import flash.display.*;
public dynamic class redHeadAnim_75 extends MovieClip {
public var eyelids:MovieClip;
public var mouth:MovieClip;
public function redHeadAnim_75(){
addFrameScript(0, frame1);
}
function frame1(){
mouth.stop();
eyelids.play();
}
}
}//package Blockular_fla
Section 21
//redTed_62 (Blockular_fla.redTed_62)
package Blockular_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
import flash.net.*;
import flash.ui.*;
import flash.system.*;
import flash.external.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class redTed_62 extends MovieClip {
public var lleg:MovieClip;
public var rleg:MovieClip;
public var larm:MovieClip;
public var drink:MovieClip;
public var body:MovieClip;
public var rarm:MovieClip;
public var head:MovieClip;
public function redTed_62(){
addFrameScript(12, frame13, 33, frame34, 59, frame60, 70, frame71, 92, frame93, 96, frame97, 101, frame102, 106, frame107, 113, frame114, 119, frame120, 147, frame148, 155, frame156, 205, frame206, 206, frame207, 215, frame216, 284, frame285, 316, frame317);
}
function frame156(){
head.head.mouth.gotoAndStop(2);
}
function frame71(){
head.head.mouth.gotoAndStop(7);
}
function frame317(){
gotoAndPlay("sleep");
}
function frame285(){
head.head.eye.gotoAndStop(1);
}
function frame206(){
head.head.mouth.gotoAndStop(1);
}
function frame207(){
gotoAndPlay("idle");
}
function frame93(){
gotoAndPlay("idle");
head.head.mouth.gotoAndStop(1);
}
function frame107(){
head.head.mouth.gotoAndStop(6);
}
function frame97(){
head.head.mouth.gotoAndStop(6);
}
function frame13(){
gotoAndPlay("idle");
}
function frame102(){
head.head.mouth.gotoAndStop(4);
}
function frame216(){
head.head.mouth.gotoAndPlay("yawn");
}
function frame114(){
head.head.mouth.gotoAndStop(4);
}
function frame34(){
gotoAndPlay("idle");
}
function frame120(){
head.head.mouth.gotoAndStop(1);
}
function frame148(){
gotoAndPlay("idle");
}
function frame60(){
gotoAndPlay("walk");
}
}
}//package Blockular_fla
Section 22
//speech_166 (Blockular_fla.speech_166)
package Blockular_fla {
import flash.display.*;
import flash.text.*;
public dynamic class speech_166 extends MovieClip {
public var speech:TextField;
}
}//package Blockular_fla
Section 23
//star_106 (Blockular_fla.star_106)
package Blockular_fla {
import flash.display.*;
public dynamic class star_106 extends MovieClip {
public var randstart;
public function star_106(){
addFrameScript(0, frame1, 60, frame61);
}
function frame1(){
randstart = ((Math.random() * 30) + 1);
gotoAndPlay(randstart);
}
function frame61(){
gotoAndPlay("start");
}
}
}//package Blockular_fla
Section 24
//tedHead_67 (Blockular_fla.tedHead_67)
package Blockular_fla {
import flash.display.*;
public dynamic class tedHead_67 extends MovieClip {
public var head:MovieClip;
}
}//package Blockular_fla
Section 25
//yellow_blinkAnim_82 (Blockular_fla.yellow_blinkAnim_82)
package Blockular_fla {
import flash.display.*;
public dynamic class yellow_blinkAnim_82 extends MovieClip {
public var blink:MovieClip;
}
}//package Blockular_fla
Section 26
//RC4 (com.meychi.ascrypt3.RC4)
package com.meychi.ascrypt3 {
public class RC4 {
private static var mykey:Array = new Array(0xFF);
private static var sbox:Array = new Array(0xFF);
public function encrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Array;
_local3 = strToChars(_arg1);
_local4 = strToChars(_arg2);
_local5 = calculate(_local3, _local4);
return (charsToHex(_local5));
}
public function decrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Array;
_local3 = hexToChars(_arg1);
_local4 = strToChars(_arg2);
_local5 = calculate(_local3, _local4);
return (charsToStr(_local5));
}
private static function initialize(_arg1:Array):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = 0;
_local4 = _arg1.length;
_local5 = 0;
_local5 = 0;
while (_local5 <= 0xFF) {
mykey[_local5] = _arg1[(_local5 % _local4)];
sbox[_local5] = _local5;
_local5++;
};
_local5 = 0;
while (_local5 <= 0xFF) {
_local2 = (((_local2 + sbox[_local5]) + mykey[_local5]) % 0x0100);
_local3 = sbox[_local5];
sbox[_local5] = sbox[_local2];
sbox[_local2] = _local3;
_local5++;
};
}
private static function strToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.push(_arg1.charCodeAt(_local3));
_local3++;
};
return (_local2);
}
private static function charsToStr(_arg1:Array):String{
var _local2:String;
var _local3:Number;
_local2 = new String("");
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(_arg1[_local3]));
_local3++;
};
return (_local2);
}
private static function charsToHex(_arg1:Array):String{
var _local2:String;
var _local3:Array;
var _local4:Number;
_local2 = new String("");
_local3 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
_local4 = 0;
while (_local4 < _arg1.length) {
_local2 = (_local2 + (_local3[(_arg1[_local4] >> 4)] + _local3[(_arg1[_local4] & 15)]));
_local4++;
};
return (_local2);
}
private static function calculate(_arg1:Array, _arg2:Array):Array{
var _local3:Number;
var _local4:Number;
var _local5:Array;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
initialize(_arg2);
_local3 = 0;
_local4 = 0;
_local5 = new Array();
_local9 = 0;
while (_local9 < _arg1.length) {
_local3 = ((_local3 + 1) % 0x0100);
_local4 = ((_local4 + sbox[_local3]) % 0x0100);
_local7 = sbox[_local3];
sbox[_local3] = sbox[_local4];
sbox[_local4] = _local7;
_local10 = ((sbox[_local3] + sbox[_local4]) % 0x0100);
_local6 = sbox[_local10];
_local8 = (_arg1[_local9] ^ _local6);
_local5.push(_local8);
_local9++;
};
return (_local5);
}
private static function hexToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = ((_arg1.substr(0, 2))=="0x") ? 2 : 0;
while (_local3 < _arg1.length) {
_local2.push(parseInt(_arg1.substr(_local3, 2), 16));
_local3 = (_local3 + 2);
};
return (_local2);
}
}
}//package com.meychi.ascrypt3
Section 27
//MindJoltAPI (com.mindjolt.api.as3.MindJoltAPI)
package com.mindjolt.api.as3 {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class MindJoltAPI extends MovieClip {
private var dispatcher:CustomDispatcher;
public static var service:Object;
public function MindJoltAPI(){
dispatcher = new CustomDispatcher();
dispatcher.doAction(1, 100);
dispatcher.addEventListener(_slot2.ACTION, createRoot);
}
private function createRoot(_arg1:Event):void{
if (root != null){
_arg1.currentTarget.removeEventListener(_slot2.ACTION, createRoot);
init();
};
}
private function init():void{
var _local1:Object;
var _local2:String;
var _local3:Loader;
_local1 = Object(parent.root).loaderInfo.parameters;
_local2 = "";
if (((!((_local1.mjPath == null))) && (isDomainAllowed()))){
_local2 = _local1.mjPath;
} else {
_local2 = "http://static.mindjolt.com/api/as3/scoreapi_as3_local.swf";
};
_local3 = new Loader();
_local3.contentLoaderInfo.addEventListener(Event.COMPLETE, loadFinished);
_local3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadFailed);
_local3.load(new URLRequest(_local2));
addChild(_local3);
}
private function loadFinished(_arg1:Event):void{
service = _arg1.currentTarget.content.service;
service.connect();
trace("[MindJoltAPI] service loaded");
}
private function isDomainAllowed():Boolean{
var _local1:String;
var _local2:LocalConnection;
var _local3:String;
_local1 = ".mindjolt.com";
_local2 = new LocalConnection();
_local3 = _local2.domain;
if (_local3.indexOf(_local1) == (_local3.length - _local1.length)){
return (true);
};
return (false);
}
private function loadFailed(_arg1:IOErrorEvent):void{
trace("[MindJoltAPI] unable to load service");
}
}
}//package com.mindjolt.api.as3
import flash.events.*;
import flash.utils.*;
class CustomDispatcher extends EventDispatcher {
public static var ACTION:String = "action";
private function CustomDispatcher(){
}
public function doAction(_arg1:Number, _arg2:Number):void{
var myTimer:Timer;
var propAction:Function;
var delay = _arg1;
var repeat = _arg2;
propAction = function (_arg1:TimerEvent):void{
dispatchEvent(new Event(_slot2.ACTION));
};
myTimer = new Timer(delay, repeat);
myTimer.addEventListener(TimerEvent.TIMER, propAction);
myTimer.start();
}
}
Section 28
//MindJoltSponsoredAPI (com.mindjolt.api.as3.MindJoltSponsoredAPI)
package com.mindjolt.api.as3 {
import flash.events.*;
import flash.display.*;
import com.meychi.ascrypt3.*;
import flash.net.*;
import flash.external.*;
public class MindJoltSponsoredAPI {
private static var displayObject:Object;
private static var connected:Boolean = false;
private static var gameId:String;
private static var flashCookie:SharedObject;
private static var key:String;
public static function openLink(_arg1:uint, _arg2:String=null):void{
var url:String;
var browserAgent:String;
var linkId = _arg1;
var mode = _arg2;
url = (((((("http://game.mindjolt.com/servlet/GameLink?key=" + gameId) + "&link=") + linkId) + ((mode)!=null) ? ("&mode=" + escape(mode)) : "") + "&httpref=") + escape(displayObject.loaderInfo.loaderURL));
browserAgent = null;
try {
if (ExternalInterface.available){
browserAgent = ExternalInterface.call("function getBrowser(){return navigator.userAgent;}");
};
} catch(e:Error) {
browserAgent = null;
};
if (((((!((browserAgent == null))) && (ExternalInterface.available))) && ((((browserAgent.indexOf("Firefox") >= 0)) || ((browserAgent.indexOf("MSIE") >= 0)))))){
trace("window.open");
ExternalInterface.call("window.open", url);
} else {
trace("navigatetourl");
navigateToURL(new URLRequest(url), "_blank");
};
}
public static function connect(_arg1:String, _arg2:String, _arg3:Object){
if ((_arg3 is DisplayObject)){
if (!connected){
flashCookie = SharedObject.getLocal("com.mindjolt", "/");
flashCookie.objectEncoding = ObjectEncoding.AMF0;
gameId = _arg1.toUpperCase();
key = _arg2.toUpperCase();
displayObject = _arg3;
trace(displayObject.loaderInfo.loaderURL);
connected = true;
} else {
trace("already connected!");
};
} else {
trace("Error: MindJoltSponsoredAPI requires a displayobject. Try passing in root.");
};
}
private static function finishedSubmitScore(_arg1:Event):void{
var _local2:String;
var _local3:RC4;
var _local4:URLVariables;
var _local5:String;
_local2 = _arg1.target.data.session;
if (_local2 != null){
trace("got back session");
_local3 = new RC4();
_local4 = new URLVariables();
_local4.decode(_local3.decrypt(_local2, key));
_local5 = _local4.userToken;
trace((("result [" + _local4.result) + "]"));
if (_local5 != null){
trace((("we are being told to set userToken [" + _local5) + "]"));
flashCookie.data.userToken = _local5;
flashCookie.flush();
};
};
}
public static function submitScore(_arg1:String, _arg2:Number, _arg3:String=null){
var userToken:String;
var rc4:RC4;
var session:String;
var send_lv:URLVariables;
var request:URLRequest;
var loader:URLLoader;
var name = _arg1;
var score = _arg2;
var mode = _arg3;
userToken = null;
trace("testing if we have a userToken in shared object yet");
if (flashCookie.data.userToken != null){
userToken = flashCookie.data.userToken;
trace((("FOUND [" + userToken) + "]"));
} else {
userToken = null;
trace("no userToken set");
};
rc4 = new RC4();
session = rc4.encrypt(((((("score=" + score) + "&name=") + escape(name)) + ((mode)!=null) ? ("&mode=" + escape(mode)) : "") + ((userToken)!=null) ? ("&userToken=" + escape(userToken)) : ""), key);
send_lv = new URLVariables();
send_lv.gameId = gameId;
send_lv.session = session;
request = new URLRequest();
request.url = "http://game.mindjolt.com/servlet/GameScore";
request.method = URLRequestMethod.POST;
request.data = send_lv;
loader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, finishedSubmitScore);
loader.addEventListener(IOErrorEvent.IO_ERROR, failedSubmitScore);
try {
loader.load(request);
} catch(e:Error) {
trace(("SubmitScore send data Error: " + e));
};
}
private static function failedSubmitScore(_arg1:Event):void{
trace("IOError in SubmitScore");
}
}
}//package com.mindjolt.api.as3
Section 29
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class AdLoader extends Sprite {
private var contentspotid:String;
private var cpmstarLoader:Loader;
public function AdLoader(_arg1:String){
this.contentspotid = _arg1;
addEventListener(Event.ADDED, addedHandler);
}
private function addedHandler(_arg1:Event):void{
var _local2:String;
var _local3:DisplayObjectContainer;
removeEventListener(Event.ADDED, addedHandler);
Security.allowDomain("server.cpmstar.com");
_local2 = "http://server.cpmstar.com/adviewas3.swf";
_local3 = parent;
cpmstarLoader = new Loader();
cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler);
cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
cpmstarLoader.load(new URLRequest(((_local2 + "?contentspotid=") + contentspotid)));
addChild(cpmstarLoader);
}
private function dispatchHandler(_arg1:Event):void{
dispatchEvent(_arg1);
}
}
}//package CPMStar
Section 30
//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 31
//MochiServices (mochi.MochiServices)
package mochi {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, 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 32
//Arrow (Arrow)
package {
import flash.display.*;
public dynamic class Arrow extends MovieClip {
}
}//package
Section 33
//Background (Background)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
import flash.net.*;
import flash.ui.*;
import flash.system.*;
import flash.external.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Background extends MovieClip {
public var buttonDevLink:SimpleButton;
public var viewScores:SimpleButton;
public var background:MovieClip;
public var blueTed:MovieClip;
public var moreGames:SimpleButton;
public var playGame:SimpleButton;
public var buttonArcadeMode:SimpleButton;
public var redTed:MovieClip;
public var buttonPracticeMode:SimpleButton;
public var mjLogo:MovieClip;
public var yellowTed:MovieClip;
public function Background(){
addFrameScript(0, frame1, 35, frame36, 36, frame37, 198, frame199);
}
function frame1(){
redTed.head.gotoAndStop(1);
redTed.body.gotoAndStop(1);
redTed.lleg.gotoAndStop(1);
redTed.rleg.gotoAndStop(1);
redTed.rarm.gotoAndStop(1);
redTed.larm.gotoAndStop(1);
blueTed.head.gotoAndStop(2);
blueTed.body.gotoAndStop(2);
blueTed.lleg.gotoAndStop(2);
blueTed.rleg.gotoAndStop(2);
blueTed.rarm.gotoAndStop(2);
blueTed.larm.gotoAndStop(2);
yellowTed.head.gotoAndStop(3);
yellowTed.body.gotoAndStop(3);
yellowTed.lleg.gotoAndStop(3);
yellowTed.rleg.gotoAndStop(3);
yellowTed.rarm.gotoAndStop(3);
yellowTed.larm.gotoAndStop(3);
}
function frame36(){
stop();
}
function frame37(){
play();
}
function frame199(){
TitleScreenState.MovieFinished();
}
}
}//package
Section 34
//Background_albert (Background_albert)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
import flash.net.*;
import flash.ui.*;
import flash.system.*;
import flash.external.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Background_albert extends MovieClip {
public var buttonPause:SimpleButton;
public var background:MovieClip;
public var blueTed:MovieClip;
public var redTed:MovieClip;
public var yellowTed:MovieClip;
public function Background_albert(){
addFrameScript(0, frame1, 36, frame37, 65, frame66, 107, frame108, 124, frame125, 135, frame136, 212, frame213, 241, frame242, 0x0101, frame258, 273, frame274, 327, frame328, 378, frame379, 380, frame381, 454, frame455, 478, frame479, 0x0200, frame513, 561, frame562);
}
function frame274(){
Game.BackgroundAnimFinished();
stop();
}
function frame562(){
Game.BackgroundAnimFinished();
stop();
}
function frame328(){
Game.BackgroundAnimFinished();
stop();
}
function frame213(){
Game.BackgroundAnimFinished();
stop();
}
function frame455(){
yellowTed.head.gotoAndStop(3);
yellowTed.body.gotoAndStop(3);
yellowTed.lleg.gotoAndStop(3);
yellowTed.rleg.gotoAndStop(3);
yellowTed.rarm.gotoAndStop(3);
yellowTed.larm.gotoAndStop(3);
yellowTed.gotoAndPlay("dance");
}
function frame1(){
redTed.head.gotoAndStop(1);
redTed.body.gotoAndStop(1);
redTed.lleg.gotoAndStop(1);
redTed.rleg.gotoAndStop(1);
redTed.rarm.gotoAndStop(1);
redTed.larm.gotoAndStop(1);
redTed.gotoAndPlay("fall");
stop();
}
function frame108(){
Game.BackgroundAnimFinished();
stop();
}
function frame513(){
blueTed.head.gotoAndStop(2);
blueTed.body.gotoAndStop(2);
blueTed.lleg.gotoAndStop(2);
blueTed.rleg.gotoAndStop(2);
blueTed.rarm.gotoAndStop(2);
blueTed.larm.gotoAndStop(2);
blueTed.gotoAndPlay("dance");
}
function frame479(){
redTed.head.gotoAndStop(1);
redTed.body.gotoAndStop(1);
redTed.lleg.gotoAndStop(1);
redTed.rleg.gotoAndStop(1);
redTed.rarm.gotoAndStop(1);
redTed.larm.gotoAndStop(1);
redTed.gotoAndPlay("dance");
}
function frame37(){
Game.BackgroundAnimFinished();
stop();
}
function frame125(){
redTed.head.gotoAndStop(3);
redTed.body.gotoAndStop(3);
redTed.lleg.gotoAndStop(3);
redTed.rleg.gotoAndStop(3);
redTed.rarm.gotoAndStop(3);
redTed.larm.gotoAndStop(3);
}
function frame242(){
redTed.gotoAndPlay("fall");
redTed.head.gotoAndStop(2);
redTed.body.gotoAndStop(2);
redTed.lleg.gotoAndStop(2);
redTed.rleg.gotoAndStop(2);
redTed.rarm.gotoAndStop(2);
redTed.larm.gotoAndStop(2);
}
function frame136(){
Game.BackgroundAnimFinished();
stop();
}
function frame258(){
redTed.gotoAndPlay("yawn");
}
function frame379(){
Game.BackgroundAnimFinished();
stop();
redTed.gotoAndPlay("fall");
}
function frame381(){
redTed.gotoAndPlay("fall");
}
function frame66(){
Game.BackgroundAnimFinished();
stop();
}
}
}//package
Section 35
//Blink1 (Blink1)
package {
import flash.display.*;
public dynamic class Blink1 extends MovieClip {
}
}//package
Section 36
//Blink2 (Blink2)
package {
import flash.display.*;
public dynamic class Blink2 extends MovieClip {
}
}//package
Section 37
//Blink3 (Blink3)
package {
import flash.display.*;
public dynamic class Blink3 extends MovieClip {
}
}//package
Section 38
//Blink4 (Blink4)
package {
import flash.display.*;
public dynamic class Blink4 extends MovieClip {
}
}//package
Section 39
//Block1 (Block1)
package {
import flash.display.*;
public dynamic class Block1 extends MovieClip {
}
}//package
Section 40
//Block2 (Block2)
package {
import flash.display.*;
public dynamic class Block2 extends MovieClip {
}
}//package
Section 41
//Block3 (Block3)
package {
import flash.display.*;
public dynamic class Block3 extends MovieClip {
}
}//package
Section 42
//Block4 (Block4)
package {
import flash.display.*;
public dynamic class Block4 extends MovieClip {
}
}//package
Section 43
//BlockAsteroid (BlockAsteroid)
package {
import flash.display.*;
public dynamic class BlockAsteroid extends MovieClip {
}
}//package
Section 44
//BlockBaddie (BlockBaddie)
package {
import flash.display.*;
public dynamic class BlockBaddie extends MovieClip {
}
}//package
Section 45
//BlockBeer (BlockBeer)
package {
import flash.display.*;
public dynamic class BlockBeer extends MovieClip {
}
}//package
Section 46
//BlockBlack (BlockBlack)
package {
import flash.display.*;
public dynamic class BlockBlack extends MovieClip {
}
}//package
Section 47
//BlockBlue (BlockBlue)
package {
import flash.display.*;
public dynamic class BlockBlue extends MovieClip {
}
}//package
Section 48
//BlockBoat (BlockBoat)
package {
import flash.display.*;
public dynamic class BlockBoat extends MovieClip {
}
}//package
Section 49
//BlockBomb (BlockBomb)
package {
import flash.display.*;
public dynamic class BlockBomb extends MovieClip {
}
}//package
Section 50
//BlockBouy (BlockBouy)
package {
import flash.display.*;
public dynamic class BlockBouy extends MovieClip {
}
}//package
Section 51
//BlockBubble (BlockBubble)
package {
import flash.display.*;
public dynamic class BlockBubble extends MovieClip {
}
}//package
Section 52
//BlockCake (BlockCake)
package {
import flash.display.*;
public dynamic class BlockCake extends MovieClip {
}
}//package
Section 53
//BlockCloud (BlockCloud)
package {
import flash.display.*;
public dynamic class BlockCloud extends MovieClip {
}
}//package
Section 54
//BlockGround (BlockGround)
package {
import flash.display.*;
public dynamic class BlockGround extends MovieClip {
}
}//package
Section 55
//BlockHighlight (BlockHighlight)
package {
import flash.display.*;
public dynamic class BlockHighlight extends MovieClip {
}
}//package
Section 56
//blockparticle (blockparticle)
package {
import flash.display.*;
public dynamic class blockparticle extends MovieClip {
}
}//package
Section 57
//blockparticle1 (blockparticle1)
package {
import flash.display.*;
public dynamic class blockparticle1 extends MovieClip {
}
}//package
Section 58
//blockparticle2 (blockparticle2)
package {
import flash.display.*;
public dynamic class blockparticle2 extends MovieClip {
}
}//package
Section 59
//blockparticle3 (blockparticle3)
package {
import flash.display.*;
public dynamic class blockparticle3 extends MovieClip {
}
}//package
Section 60
//BlockPlane (BlockPlane)
package {
import flash.display.*;
public dynamic class BlockPlane extends MovieClip {
}
}//package
Section 61
//BlockPlanet (BlockPlanet)
package {
import flash.display.*;
public dynamic class BlockPlanet extends MovieClip {
}
}//package
Section 62
//BlockPurple (BlockPurple)
package {
import flash.display.*;
public dynamic class BlockPurple extends MovieClip {
}
}//package
Section 63
//BlockRocket (BlockRocket)
package {
import flash.display.*;
public dynamic class BlockRocket extends MovieClip {
}
}//package
Section 64
//BlockSheep (BlockSheep)
package {
import flash.display.*;
public dynamic class BlockSheep extends MovieClip {
}
}//package
Section 65
//BlockSpecial1 (BlockSpecial1)
package {
import flash.display.*;
public dynamic class BlockSpecial1 extends MovieClip {
public var mouth:MovieClip;
}
}//package
Section 66
//BlockSpecial2 (BlockSpecial2)
package {
import flash.display.*;
public dynamic class BlockSpecial2 extends MovieClip {
public var head:MovieClip;
}
}//package
Section 67
//BlockSpecial3 (BlockSpecial3)
package {
import flash.display.*;
public dynamic class BlockSpecial3 extends MovieClip {
public var head:MovieClip;
}
}//package
Section 68
//BlockTree (BlockTree)
package {
import flash.display.*;
public dynamic class BlockTree extends MovieClip {
}
}//package
Section 69
//boingSFX (boingSFX)
package {
import flash.media.*;
public dynamic class boingSFX extends Sound {
}
}//package
Section 70
//bombSFX (bombSFX)
package {
import flash.media.*;
public dynamic class bombSFX extends Sound {
}
}//package
Section 71
//chompSFX (chompSFX)
package {
import flash.media.*;
public dynamic class chompSFX extends Sound {
}
}//package
Section 72
//CountdownTimer (CountdownTimer)
package {
import flash.display.*;
public dynamic class CountdownTimer extends MovieClip {
}
}//package
Section 73
//Cursor (Cursor)
package {
import flash.display.*;
public dynamic class Cursor extends MovieClip {
}
}//package
Section 74
//Defs (Defs)
package {
public class Defs {
public static const zpos_PICKUP = 1100;
public static const zpos_ENEMY = 1000;
public static const displayarea_w = 640;
public static const zpos_OVERLAY = 500;
public static const zpos_PLAYER = 1000;
public static const fps:Number = 30;
public static const zpos_FAR = 10000;
public static const zpos_BACKGROUND = 10000;
public static const displayarea_h = 480;
}
}//package
Section 75
//DisplayObj (DisplayObj)
package {
import flash.events.*;
import flash.display.*;
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);
}
function CreateAsciiStringTable():Array{
var _local1:Array;
_local1 = new Array();
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push("");
_local1.push(" ");
_local1.push("!");
_local1.push("'");
_local1.push("#");
_local1.push("$");
_local1.push("%");
_local1.push("&");
_local1.push("'");
_local1.push("(");
_local1.push(")");
_local1.push("*");
_local1.push("+");
_local1.push(",");
_local1.push("-");
_local1.push(".");
_local1.push("/");
_local1.push("0");
_local1.push("1");
_local1.push("2");
_local1.push("3");
_local1.push("4");
_local1.push("5");
_local1.push("6");
_local1.push("7");
_local1.push("8");
_local1.push("9");
_local1.push(":");
_local1.push(";");
_local1.push("<");
_local1.push("=");
_local1.push(">");
_local1.push("?");
_local1.push("@");
_local1.push("A");
_local1.push("B");
_local1.push("C");
_local1.push("D");
_local1.push("E");
_local1.push("F");
_local1.push("G");
_local1.push("H");
_local1.push("I");
_local1.push("J");
_local1.push("K");
_local1.push("L");
_local1.push("M");
_local1.push("N");
_local1.push("O");
_local1.push("P");
_local1.push("Q");
_local1.push("R");
_local1.push("S");
_local1.push("T");
_local1.push("U");
_local1.push("V");
_local1.push("W");
_local1.push("X");
_local1.push("Y");
_local1.push("Z");
_local1.push("[");
_local1.push("\\");
_local1.push("]");
_local1.push("^");
_local1.push("_");
_local1.push("'");
_local1.push("a");
_local1.push("b");
_local1.push("c");
_local1.push("d");
_local1.push("e");
_local1.push("f");
_local1.push("g");
_local1.push("h");
_local1.push("i");
_local1.push("j");
_local1.push("k");
_local1.push("l");
_local1.push("m");
_local1.push("n");
_local1.push("o");
_local1.push("p");
_local1.push("q");
_local1.push("r");
_local1.push("s");
_local1.push("t");
_local1.push("u");
_local1.push("v");
_local1.push("w");
_local1.push("x");
_local1.push("y");
_local1.push("z");
_local1.push("{");
_local1.push("|");
_local1.push("}");
_local1.push("~");
return (_local1);
}
public function RenderAt(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
frames[frame].RenderAt(_arg1, _arg2, _arg3);
}
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 = CreateAsciiStringTable();
_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 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:ColorTransform;
var _local22: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.burnedbitmaps = 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);
_local21 = new ColorTransform(1, 1, 1, 1, -100, -100, -100, 0);
_local13 = new BitmapData((_local9.width * 2), (_local9.height * 2), true, 0);
_local13.draw(_arg1, _local8, _local21);
_local12 = new Bitmap(_local13);
_local15.burnedbitmaps.push(_local12);
_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)));
_local22 = (_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 SetFrame(_arg1:int){
frame = _arg1;
if (frame < 0){
frame = 0;
};
if (frame >= frames.length){
frame = (frames.length - 1);
};
}
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 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 76
//Eyeball (Eyeball)
package {
import flash.display.*;
public dynamic class Eyeball extends MovieClip {
}
}//package
Section 77
//Font20 (Font20)
package {
import flash.text.*;
public dynamic class Font20 extends Font {
}
}//package
Section 78
//Game (Game)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import flash.net.*;
import flash.ui.*;
public class Game {
static const state_SPEECH = 3;
static const levelFinishedState_WON = 1;
static const celltype_BADDIE = 8;
static const levelFinishedState_NOT = 0;
static const levelFinishedState_LOST = 2;
static const state_GAME = 5;
static const state_BLOCKS_ON = 4;
static const dir_E = 1;
static const dir_N = 0;
static const state_INTRO = 2;
static const dir_S = 2;
static const dir_W = 3;
static const state_TUTORIAL = 1;
static const celltype_BOMB = 9;
static const celltype_COLLECT = 7;
static const state_BLOCKS_OFF = 6;
static const state_GAMEOVER = 7;
static const celltype_SPECIAL1 = 4;
static const celltype_SPECIAL2 = 5;
static const celltype_SPECIAL3 = 6;
static var mouseDragY:int = 0;
static var gamemode_checkForPortals:Boolean;
public static var arcadeMode_pickupBlock;
static var mouseDragX:int = 0;
static var levelFinishedState:int;
static var levelTimer:int;
static var numCollects:int;
static var levelTimer1:int;
static var scoreX:Number = 660;
static var minX;
static var minY;
static var gamemode_mustAlignSpecials:Boolean;
static var objectsMoving:Boolean;
static var state:int;
static var numLevels:int;
static var gridWH:int;
static var currentScore:int;
static var gamemode_MinDragDist:Number;
static var gamemode_BringNewBlocksIn;
static var numStandardBlockTypes:int;
static var blockPosX:Number;
static var blockPosY:Number;
static var gamemode_checkForCollects:Boolean;
static var helpBubbleY:Number = 500;
static var levelFinishedTimer:int;
static var oldGridPositions:Array;
static var gameOverMovie:MovieClip;
static var adjacentCount:int;
static var gamemode_UseDragDirection;
static var gamemode_StoryMode:Boolean;
static var gamemode_numBlocksInGroupToClear = 3;
static var gamemode_PracticeMode:Boolean;
static var currentBlocksMovable:Boolean;
static var numBaddies:int;
static var levelTimer1Max:Number;
static var characterPosHitBaddieX:int;
public static var scrollH:Number;
static var numPortals:int;
static var cellH;
public static var scrollW:Number;
public static var scrollX:Number;
public static var scrollY:Number;
static var stateTimer:int;
static var cellW;
static var characterPosHitBaddieY:int;
static var portalList:Array;
static var objectsMovingFirstTime:Boolean;
static var numSpecialCharsPerType:int;
static var grid:Array;
static var uniqueBlockID:int = 0;
static var GridCellY:int;
static var maxX;
static var maxY;
static var GridCellX:int;
public static var arcadeMode_baddieBlock;
static var currentLevel:int;
static var numSpecialCharsPerTypeList:Array;
static var numSpecialCharTypes:int;
static var gridCentreX:Number;
static var gridCentreY:Number;
static var main:Main;
static var multiplier:int;
static var gridH:int;
static var gridW:int;
static var mouseMode:int = 0;
static var levelCompleteFlag:Boolean;
static var helpBubbleOn:Boolean = false;
static function InitGridCellMovingOn(_arg1:GridCell, _arg2:int){
var _local3:GameObj;
_local3 = FindBlockGOByUniqueID(_arg1.uniqueID);
GetTransformedBlockPos(_arg1.x, _arg1.y);
RandOffScreen(_local3, 2);
_local3.SetBlockMove(blockPosX, blockPosY);
_local3.timer = Number(_arg2);
_local3.controlMode = 2;
}
static function RandOffScreen(_arg1:GameObj, _arg2:int){
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = (minX + ((gridW * cellW) * 0.5));
_local4 = (minY + ((gridH * cellH) * 0.5));
if (_arg2 == 0){
_local5 = Math.atan2((_arg1.ypos - _local4), (_arg1.xpos - _local3));
_arg1.xpos = (_arg1.xpos + (Math.cos(_local5) * 500));
_arg1.ypos = (_arg1.ypos + (Math.sin(_local5) * 500));
};
if (_arg2 == 1){
_arg1.ypos = (_arg1.ypos + 450);
};
if (_arg2 == 2){
_arg1.xpos = (_arg1.ypos - 450);
_arg1.ypos = (_arg1.xpos - 450);
};
}
public static function BackgroundAnimFinished(){
trace("anim finished");
if (state == state_INTRO){
if (gamemode_StoryMode){
if (currentLevel == 12){
InitState(state_GAMEOVER);
} else {
InitState(state_SPEECH);
};
} else {
InitState(state_BLOCKS_ON);
};
};
}
static function CountMovingBlocks():int{
var _local1:int;
var _local2:GameObj;
for each (_local2 in GameObjects.objs) {
if (((_local2.active) && ((_local2.type == GameObj.gotype_BLOCK)))){
if (_local2.controlMode != 0){
_local1++;
};
};
};
return (_local1);
}
static function UpdateBlocksOn(){
var _local1:int;
_local1 = CountMovingBlocks();
if (_local1 == 0){
InitState(state_GAME);
};
}
static function RenderGrid():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:GridCell;
var _local6:int;
var _local7:Rectangle;
var _local8:Rectangle;
return;
}
static function FindGroup(_arg1:GridCell){
adjacentCount = 0;
ClearGridCheckedFlag();
_arg1.checkedFlag = true;
adjacentCount++;
FindAdjacent(_arg1);
}
static function NextLevel(){
currentLevel++;
InitLevel();
}
public static function InitLevel(){
main.backgroundMC.buttonPause.addEventListener(MouseEvent.CLICK, buttonPressed_Pause);
GameObjects.ClearAll();
if (currentLevel == 0){
InitState(state_TUTORIAL);
} else {
InitState(state_INTRO);
};
}
static function CheckSpecialsAlignment():int{
var _local1:int;
var _local2:int;
var _local3:Boolean;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:GridCell;
_local1 = 0;
_local2 = 0;
_local3 = true;
_local6 = 0;
while (_local6 < numSpecialCharTypes) {
_local7 = GetNumCharsPerType((celltype_SPECIAL1 + _local6));
if (_local7 > 1){
_local2++;
_local8 = FindFirstBlockOfType((celltype_SPECIAL1 + _local6));
if (_local8){
FindGroup(_local8);
};
if (adjacentCount == _local7){
_local1++;
};
};
_local6++;
};
if ((((_local1 == _local2)) && (!((_local2 == 0))))){
AddScore(20, _local8);
SoundPlayer.Play(SoundPlayer.SOUND_ALIGNMENT);
return (1);
};
return (0);
}
static function FindAdjacent(_arg1:GridCell){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:GridCell;
_local2 = _arg1.x;
_local3 = _arg1.y;
_local4 = _arg1.type;
_local5 = GetGridCell((_local2 + 1), _local3);
if (_local5){
if ((((_local5.checkedFlag == false)) && ((_local5.type == _local4)))){
_local5.checkedFlag = true;
adjacentCount++;
FindAdjacent(_local5);
};
};
_local5 = GetGridCell((_local2 - 1), _local3);
if (_local5){
if ((((_local5.checkedFlag == false)) && ((_local5.type == _local4)))){
_local5.checkedFlag = true;
adjacentCount++;
FindAdjacent(_local5);
};
};
_local5 = GetGridCell(_local2, (_local3 - 1));
if (_local5){
if ((((_local5.checkedFlag == false)) && ((_local5.type == _local4)))){
_local5.checkedFlag = true;
adjacentCount++;
FindAdjacent(_local5);
};
};
_local5 = GetGridCell(_local2, (_local3 + 1));
if (_local5){
if ((((_local5.checkedFlag == false)) && ((_local5.type == _local4)))){
_local5.checkedFlag = true;
adjacentCount++;
FindAdjacent(_local5);
};
};
}
static function GetAdjacentBlocks(_arg1:GridCell):Array{
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:GridCell;
_local2 = new Array();
_local3 = _arg1.x;
_local4 = _arg1.y;
_local5 = GetGridCell((_local3 + 1), _local4);
if (_local5){
_local2.push(_local5);
};
_local5 = GetGridCell((_local3 - 1), _local4);
if (_local5){
_local2.push(_local5);
};
_local5 = GetGridCell(_local3, (_local4 - 1));
if (_local5){
_local2.push(_local5);
};
_local5 = GetGridCell(_local3, (_local4 + 1));
if (_local5){
_local2.push(_local5);
};
return (_local2);
}
static function CheckAdjacentTypes(_arg1:int, _arg2:int, _arg3:int):Boolean{
var _local4:GridCell;
_local4 = GetGridCell((_arg1 + 1), _arg2);
if (_local4){
if (_local4.type == _arg3){
return (true);
};
};
_local4 = GetGridCell((_arg1 - 1), _arg2);
if (_local4){
if (_local4.type == _arg3){
return (true);
};
};
_local4 = GetGridCell(_arg1, (_arg2 - 1));
if (_local4){
if (_local4.type == _arg3){
return (true);
};
};
_local4 = GetGridCell(_arg1, (_arg2 + 1));
if (_local4){
if (_local4.type == _arg3){
return (true);
};
};
return (false);
}
public static function UpdateGameplay():void{
var _local1:Particle;
if (state == state_TUTORIAL){
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
Tutorial.Stop();
InitState(state_INTRO);
};
return;
};
if (state == state_INTRO){
};
if (state == state_SPEECH){
stateTimer++;
if (stateTimer >= (Defs.fps * 4)){
InitState(state_BLOCKS_ON);
};
};
if (state == state_BLOCKS_ON){
UpdateBlocksOn();
};
if (state == state_BLOCKS_OFF){
UpdateBlocksOff();
};
if (state == state_GAME){
if (levelFinishedState == levelFinishedState_NOT){
if ((((gamemode_StoryMode == true)) || ((gamemode_PracticeMode == true)))){
if (levelTimer > 1){
levelTimer1--;
if (levelTimer1 < 0){
levelTimer--;
levelTimer1 = levelTimer1Max;
};
};
} else {
if (levelTimer > 0){
levelTimer1--;
if (levelTimer1 < 0){
levelTimer--;
levelTimer1 = levelTimer1Max;
if (levelTimer == 0){
InitState(state_GAMEOVER);
};
};
};
};
UpdateMovingObjects();
UpdateMouseControl();
};
if (levelFinishedState == levelFinishedState_WON){
levelFinishedTimer--;
if (levelFinishedTimer < 0){
SoundPlayer.Play(SoundPlayer.SOUND_LEVELUP);
InitState(state_BLOCKS_OFF);
};
};
if (levelFinishedState == levelFinishedState_LOST){
GetTransformedBlockPos(characterPosHitBaddieX, characterPosHitBaddieY);
_local1 = Particles.Add(Particles.type_block_explode1, 0, 0, 0);
_local1.xpos = blockPosX;
_local1.ypos = blockPosY;
_local1.xpos = (_local1.xpos + Utils.RandBetweenFloat(0, cellW));
_local1.ypos = (_local1.ypos + Utils.RandBetweenFloat(0, cellW));
_local1.graphicID = (Utils.RandBetweenInt(0, 3) + GraphicObjects.gfx_blockparticle);
levelFinishedTimer--;
if (levelFinishedTimer < 0){
RestartLevel();
};
};
};
GameObjects.Update();
Particles.Update(1);
}
static function GetRandomPortalCell():GridCell{
var _local1:int;
var _local2:int;
var _local3:GridCell;
_local1 = Utils.RandBetweenInt(2, (gridW - 3));
_local2 = Utils.RandBetweenInt(3, (gridH - 3));
_local3 = GetGridCell(_local1, _local2);
_local3.x = _local1;
_local3.y = _local2;
return (_local3);
}
static function CheckForCollects():int{
var _local1:int;
var _local2:int;
var _local3:GridCell;
var _local4:Array;
var _local5:GridCell;
var _local6:GameObj;
_local1 = 0;
trace("checkingForCollects!");
_local2 = 0;
while (_local2 < gridWH) {
_local3 = grid[_local2];
if (IsTypeCharacter(_local3.type)){
_local4 = GetAdjacentBlocks(_local3);
for each (_local5 in _local4) {
if (_local5.type == celltype_COLLECT){
trace("FOUND COLLECT");
_local6 = FindBlockGOByUniqueID(_local5.uniqueID);
if (_local6.graphicID == GraphicObjects.gfx_blockbeer){
PlayTedAnim("drink");
SoundPlayer.Play(SoundPlayer.SOUND_SLURP);
} else {
if (_local6.graphicID == GraphicObjects.gfx_blockcake){
PlayTedAnim("eat");
SoundPlayer.Play(SoundPlayer.SOUND_EAT);
} else {
if (_local6.graphicID == GraphicObjects.gfx_blocksheep){
PlayTedAnim("yawn");
SoundPlayer.Play(SoundPlayer.SOUND_YAWN);
} else {
PlayTedAnim("jump");
SoundPlayer.Play(SoundPlayer.SOUND_BOING);
};
};
};
_local5.type = 0;
SetBlockGOType(_local5);
AddScore(10, _local5);
};
};
};
_local2++;
};
_local2 = 0;
while (_local2 < gridWH) {
_local3 = grid[_local2];
if (_local3.type == celltype_COLLECT){
_local1++;
};
_local2++;
};
if (_local1 == 0){
return (1);
};
return (0);
}
static function GetGridCellUnderMouse():GridCell{
var _local1:int;
var _local2:int;
_local1 = MouseControl.mousePosX;
_local2 = MouseControl.mousePosY;
return (GetGridCellAtPixelPos(_local1, _local2));
}
static function RemoveCheckedRow(_arg1:int, _arg2:int){
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:GridCell;
var _local8:GridCell;
var _local9:GridCell;
_local3 = _arg1;
if (_arg2 == 0){
_local4 = (gridW - 1);
while (_local4 >= 0) {
_local7 = GetGridCell(_local4, _local3);
if (_local7.checkedFlag){
if (_local4 == 0){
_local8 = GetGridCell(_local4, _local3);
_local8.Clear();
} else {
_local6 = _local4;
while (_local6 > 0) {
_local8 = GetGridCell(_local6, _local3);
_local9 = GetGridCell((_local6 - 1), _local3);
_local8.CopyFrom(_local9);
_local9.Clear();
_local6--;
};
};
_local4++;
};
_local4--;
};
} else {
_local4 = 0;
while (_local4 <= (gridW - 1)) {
_local7 = GetGridCell(_local4, _local3);
if (_local7.checkedFlag){
if (_local4 == (gridW - 1)){
_local8 = GetGridCell(_local4, _local3);
_local8.Clear();
} else {
_local6 = _local4;
while (_local6 < (gridW - 1)) {
_local8 = GetGridCell(_local6, _local3);
_local9 = GetGridCell((_local6 + 1), _local3);
_local8.CopyFrom(_local9);
_local9.Clear();
_local6++;
};
};
_local4--;
};
_local4++;
};
};
}
static function RenderScore(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:int;
_local1 = 480;
if (helpBubbleOn == false){
_local1 = 680;
};
scoreX = (scoreX + ((_local1 - scoreX) * 0.2));
_local2 = scoreX;
_local3 = 115;
_local5 = levelTimer;
_local4 = ((9 * levelTimer1) / levelTimer1Max);
GraphicObjects.RenderAt(GraphicObjects.gfx_timerback, 0, main.screenBD, (_local2 - 32), (_local3 - 55));
GraphicObjects.RenderAt(GraphicObjects.gfx_timer, (9 - _local4), main.screenBD, _local2, _local3);
GraphicObjects.RenderNumberAt(main.screenBD, GraphicObjects.gfx_fontwhite, (_local2 - 11), (_local3 - 23), _local5);
GraphicObjects.RenderNumberAt(main.screenBD, GraphicObjects.gfx_font1, (_local2 + 25), (_local3 - 21), currentScore, 6);
}
static function UpdateMovingObjects(){
var _local1:GameObj;
var _local2:int;
var _local3:*;
var _local4:*;
if (objectsMoving == false){
return;
};
_local2 = CountMovingBlocks();
if (_local2 == 0){
objectsMoving = false;
_local3 = 0;
_local4 = 0;
if (gamemode_mustAlignSpecials){
_local4++;
_local3 = (_local3 + CheckSpecialsAlignment());
};
if (gamemode_checkForCollects){
_local4++;
_local3 = (_local3 + CheckForCollects());
};
if (gamemode_checkForPortals){
_local4++;
_local3 = (_local3 + CheckForPortals());
};
if ((((_local4 > 0)) && ((_local4 == _local3)))){
levelFinishedState = levelFinishedState_WON;
PlayTedAnim("dance");
if (gamemode_StoryMode == false){
_local1 = GameObjects.AddObj(GameObj.gotype_OVERLAY, gridCentreX, gridCentreY, 100);
_local1.InitOverlay(0);
};
levelFinishedTimer = (Defs.fps * 3);
};
CheckCharactersAgainstBaddies();
};
}
static function UpdateMouseControl():void{
var _local1:int;
var _local2:Boolean;
var _local3:GridCell;
var _local4:GridCell;
var _local5:int;
var _local6:Number;
var _local7:int;
var _local8:int;
var _local9:GridCell;
_local1 = 0;
_local2 = false;
_local3 = null;
currentBlocksMovable = false;
if (objectsMoving){
return;
};
if (gamemode_UseDragDirection){
if (mouseMode == 0){
ClearGridCheckedFlag();
ClearGridSelectedFlag();
_local4 = GetGridCellUnderMouse();
if (((!((_local4 == null))) && ((_local4.type < 4)))){
MarkNeighboursOfSameType(GridCellX, GridCellY);
_local5 = CountGridCellsChecked();
if (_local5 >= gamemode_numBlocksInGroupToClear){
currentBlocksMovable = true;
} else {
ClearGridCheckedFlag();
};
CheckedToSelected();
};
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
if (currentBlocksMovable){
mouseDragX = MouseControl.mousePosX;
mouseDragY = MouseControl.mousePosY;
mouseMode = 1;
};
};
} else {
if (MouseControl.buttonReleased){
_local6 = Utils.DistBetweenPoints(mouseDragX, mouseDragY, MouseControl.mousePosX, MouseControl.mousePosY);
if (_local6 > gamemode_MinDragDist){
_local1 = GetDirToMove();
_local3 = GetGridCellAtPixelPos(mouseDragX, mouseDragY);
_local2 = true;
};
MouseControl.buttonReleased = false;
mouseMode = 0;
};
};
} else {
if (MouseControl.buttonPressed){
MouseControl.buttonPressed = false;
_local3 = GetGridCellUnderMouse();
_local2 = true;
_local1 = 2;
};
};
if (((_local2) && (!((_local3 == null))))){
ClearGridCheckedFlag();
MarkNeighboursOfSameType(GridCellX, GridCellY);
_local7 = CountGridCellsChecked();
if (_local7 >= gamemode_numBlocksInGroupToClear){
_local8 = 0;
while (_local8 < gridWH) {
_local9 = oldGridPositions[_local8];
_local9.CopyFrom(grid[_local8]);
_local8++;
};
GenerateParticlesAtCheckedBlocks();
RemoveCheckedGridCells(_local1);
SetGridCellsPositions();
SetObjectsToMove();
InitMovingObjects();
if (gamemode_BringNewBlocksIn){
BringInNewGridCells(_local1);
};
};
};
}
static function RemoveCheckedGridCells(_arg1:int){
var _local2:GridCell;
var _local3:int;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
if (_arg1 == dir_N){
_local3 = 0;
while (_local3 < gridW) {
RemoveCheckedColumn(_local3, 1);
_local3++;
};
};
if (_arg1 == dir_S){
_local3 = 0;
while (_local3 < gridW) {
RemoveCheckedColumn(_local3, 0);
_local3++;
};
};
if (_arg1 == dir_W){
_local3 = 0;
while (_local3 < gridH) {
RemoveCheckedRow(_local3, 1);
_local3++;
};
};
if (_arg1 == dir_E){
_local3 = 0;
while (_local3 < gridH) {
RemoveCheckedRow(_local3, 0);
_local3++;
};
};
_local5 = false;
if ((((gamemode_BringNewBlocksIn == false)) && ((_arg1 == dir_S)))){
_local3 = 0;
while (_local3 < (gridW - 1)) {
_local6 = gridW;
_local7 = _local3;
while (_local7 < gridW) {
_local2 = GetGridCell(_local7, (gridH - 1));
if (_local2.type == -1){
_local6--;
};
_local7++;
};
if (_local6 != _local3){
_local2 = GetGridCell(_local3, (gridH - 1));
if (_local2.type == -1){
_local4 = (_local3 + 1);
while (_local4 < gridW) {
CopyColumn(_local4, (_local4 - 1));
_local4++;
};
_local3--;
};
};
_local3++;
};
};
}
static function CheckCharactersAgainstBaddies():int{
var _local1:int;
var _local2:GridCell;
var _local3:Array;
var _local4:GridCell;
_local1 = 0;
while (_local1 < gridWH) {
_local2 = grid[_local1];
if (IsTypeCharacter(_local2.type)){
_local3 = GetAdjacentBlocks(_local2);
for each (_local4 in _local3) {
if (_local4.type == celltype_BADDIE){
trace("BADDIE!!!");
SoundPlayer.Play(SoundPlayer.SOUND_BOMB);
levelFinishedState = levelFinishedState_LOST;
levelFinishedTimer = (Defs.fps * 2);
characterPosHitBaddieX = _local2.x;
characterPosHitBaddieY = _local2.y;
};
};
};
_local1++;
};
return (0);
}
static function CountGridCellsChecked():int{
var _local1:int;
var _local2:GridCell;
for each (_local2 in grid) {
if (_local2.checkedFlag){
_local1++;
};
};
return (_local1);
}
static function ClearBlockObjects():void{
var _local1:GameObj;
for each (_local1 in GameObjects.objs) {
if (((_local1.active) && ((_local1.type == GameObj.gotype_BLOCK)))){
_local1.active = false;
};
};
}
static function NewBlockGO(_arg1:int, _arg2:int, _arg3:int):GameObj{
var _local4:GameObj;
_local4 = GameObjects.AddObj(GameObj.gotype_BLOCK, _arg1, _arg2, 1000);
if (_local4){
GetTransformedBlockPos(_arg1, _arg2);
_local4.InitBlock(blockPosX, blockPosY, uniqueBlockID, _arg3);
};
return (_local4);
}
static function ClearGridCheckedFlag(){
var _local1:GridCell;
for each (_local1 in grid) {
_local1.checkedFlag = false;
};
}
public static function AddScore(_arg1:int, _arg2:GridCell):void{
var _local3:int;
var _local4:int;
var _local5:Number;
var _local6:Number;
_local3 = levelTimer;
_local4 = (_arg1 * _local3);
currentScore = (currentScore + _local4);
trace(((((_arg1 + " * ") + _local3) + " = ") + _local4));
if (_arg2 != null){
GetTransformedBlockPos(_arg2.x, _arg2.y);
_local5 = (blockPosX + 10);
_local6 = (blockPosY - 10);
InitScoreObjects(_arg1, _local3, _local5, _local6);
};
}
static function InitFromLevel(_arg1:int){
var _local2:Array;
var _local3:int;
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:*;
_local2 = new Array();
_local3 = Utils.RandBetweenInt(0, 5);
if (_local3 == 0){
_local2.push(0, 1, 2);
};
if (_local3 == 1){
_local2.push(0, 2, 1);
};
if (_local3 == 2){
_local2.push(1, 2, 0);
};
if (_local3 == 3){
_local2.push(1, 0, 2);
};
if (_local3 == 4){
_local2.push(2, 1, 0);
};
if (_local3 == 5){
_local2.push(2, 0, 1);
};
_local4 = new Array();
_local4.push(2, 0, 0);
_local4.push(3, 0, 0);
_local4.push(4, 0, 0);
_local4.push(2, 2, 0);
_local4.push(3, 3, 0);
_local4.push(4, 4, 0);
_local4.push(4, 4, 2);
_local4.push(4, 4, 3);
_local4.push(4, 4, 4);
_local5 = (_arg1 % 3);
_local6 = (_arg1 / 3);
numSpecialCharsPerTypeList = new Array(3);
numSpecialCharsPerTypeList[0] = 0;
numSpecialCharsPerTypeList[1] = 0;
numSpecialCharsPerTypeList[2] = 0;
gamemode_mustAlignSpecials = false;
gamemode_checkForPortals = false;
gamemode_checkForCollects = false;
if (_local5 == 0){
if (_local6 < (_local4.length / 3)){
_local9 = _local4[((_local6 * 3) + 0)];
_local10 = _local4[((_local6 * 3) + 1)];
_local11 = _local4[((_local6 * 3) + 2)];
} else {
_local9 = 4;
_local10 = 4;
_local11 = 4;
_local6 = (_local6 - (_local4.length / 3));
_local9 = (_local9 + (_local6 / 3));
_local10 = (_local10 + (_local6 / 3));
_local11 = (_local11 + (_local6 / 3));
_local12 = (_local6 % 3);
if (_local12 == 0){
_local9++;
};
if (_local12 == 1){
_local9++;
_local10++;
};
if (_local12 == 2){
_local9++;
_local10++;
_local11++;
};
};
numSpecialCharsPerTypeList[_local2[0]] = _local9;
numSpecialCharsPerTypeList[_local2[1]] = _local10;
numSpecialCharsPerTypeList[_local2[2]] = _local11;
trace(((((((("ALIGN diff " + _local6) + " ") + _local9) + " ") + _local10) + " ") + _local11));
gamemode_mustAlignSpecials = true;
};
if (_local5 == 1){
numCollects = (_local6 + 2);
gamemode_checkForCollects = true;
numSpecialCharsPerTypeList[_local2[0]] = 1;
trace(((("COLLECT diff=" + _local6) + " collects=") + numCollects));
};
if (_local5 == 2){
gamemode_checkForPortals = true;
if (_local6 < 5){
numBaddies = (_local6 + 2);
numPortals = 1;
_local9 = 0;
} else {
_local6 = (_local6 - 5);
numBaddies = (4 + (_local6 / 2));
_local9 = (1 + (_local6 / 3));
};
numSpecialCharsPerTypeList[_local2[0]] = _local9;
numPortals = 1;
trace(((((("PORTALS diff " + _local6) + " ") + _local9) + " ") + numBaddies));
};
_local7 = new Array();
_local8 = new Array();
_local7.push(GraphicObjects.gfx_blockcake);
_local7.push(GraphicObjects.gfx_blockbeer);
_local7.push(GraphicObjects.gfx_blocksheep);
_local8.push(GraphicObjects.gfx_blockbaddie);
_local8.push(GraphicObjects.gfx_blockbomb);
arcadeMode_pickupBlock = _local7[Utils.RandBetweenInt(0, (_local7.length - 1))];
arcadeMode_baddieBlock = _local8[Utils.RandBetweenInt(0, (_local8.length - 1))];
}
public static function InitBlocksOff(){
var _local1:GridCell;
var _local2:int;
var _local3:GameObj;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local2 = 0;
while (_local2 < gridWH) {
_local1 = grid[_local2];
_local3 = FindBlockGOByUniqueID(_local1.uniqueID);
GetTransformedBlockPos(_local1.x, _local1.y);
_local4 = _local3.xpos;
_local5 = _local3.ypos;
RandOffScreen(_local3, 0);
_local6 = _local3.xpos;
_local7 = _local3.ypos;
_local3.xpos = _local4;
_local3.ypos = _local5;
_local3.SetBlockMove(_local6, _local7);
_local2++;
};
}
static function PlayTedAnim(_arg1:String){
main.backgroundMC.redTed.gotoAndPlay(_arg1);
}
static function GetBlockType(_arg1:int, _arg2:int):int{
var _local3:int;
var _local4:GridCell;
_local3 = ((_arg2 * gridW) + _arg1);
_local4 = grid[_local3];
return (_local4.type);
}
public static function InitIntroState(){
var _local1:LevelDef;
if (gamemode_StoryMode){
_local1 = Levels.GetLevelDef(currentLevel);
if (_local1.backgroundScene != ""){
main.backgroundMC.gotoAndPlay(_local1.backgroundScene);
} else {
BackgroundAnimFinished();
};
} else {
if (currentLevel == 0){
main.backgroundMC.gotoAndPlay(0);
};
BackgroundAnimFinished();
};
}
static function MarkNeighboursOfSameType(_arg1:int, _arg2:int){
var _local3:GridCell;
var _local4:GridCell;
_local3 = GetGridCell(_arg1, _arg2);
if (_local3 != null){
if (_local3.checkedFlag == true){
return;
};
_local3.checkedFlag = true;
_local4 = GetGridCell((_arg1 + 1), _arg2);
if (_local4 != null){
if (_local3.type == _local4.type){
MarkNeighboursOfSameType((_arg1 + 1), _arg2);
};
};
_local4 = GetGridCell((_arg1 - 1), _arg2);
if (_local4 != null){
if (_local3.type == _local4.type){
MarkNeighboursOfSameType((_arg1 - 1), _arg2);
};
};
_local4 = GetGridCell(_arg1, (_arg2 - 1));
if (_local4 != null){
if (_local3.type == _local4.type){
MarkNeighboursOfSameType(_arg1, (_arg2 - 1));
};
};
_local4 = GetGridCell(_arg1, (_arg2 + 1));
if (_local4 != null){
if (_local3.type == _local4.type){
MarkNeighboursOfSameType(_arg1, (_arg2 + 1));
};
};
};
}
static function RestartLevel(){
InitLevel();
}
static function SetGridCellsPositions():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:GridCell;
_local3 = 0;
_local1 = 0;
while (_local1 < gridW) {
_local2 = 0;
while (_local2 < gridH) {
_local4 = GetGridCell(_local1, _local2);
_local4.x = _local1;
_local4.y = _local2;
_local2++;
};
_local1++;
};
}
static function GenerateParticlesAtCheckedBlocks():void{
var _local1:GridCell;
var _local2:int;
var _local3:Number;
var _local4:Number;
var _local5:Particle;
_local2 = 0;
while (_local2 < gridWH) {
_local1 = grid[_local2];
if (_local1.checkedFlag == true){
GetTransformedBlockPos(_local1.x, _local1.y);
_local5 = Particles.Add(Particles.type_block_explode1, 0, 0, _local1.type);
_local5.xpos = blockPosX;
_local5.ypos = blockPosY;
_local5.graphicID = (Utils.RandBetweenInt(0, 3) + GraphicObjects.gfx_blockparticle);
};
_local2++;
};
}
static function ResetBoard():void{
ClearBlockObjects();
InitLevelGrid();
}
static function InitFromLevelDef(_arg1:int){
var _local2:LevelDef;
_local2 = Levels.GetLevelDef(_arg1);
numSpecialCharsPerTypeList = new Array(3);
numSpecialCharsPerTypeList[0] = _local2.numCharactersA;
numSpecialCharsPerTypeList[1] = _local2.numCharactersB;
numSpecialCharsPerTypeList[2] = _local2.numCharactersC;
gamemode_mustAlignSpecials = false;
if ((((((_local2.numCharactersA >= 2)) || ((_local2.numCharactersB >= 2)))) || ((_local2.numCharactersC >= 2)))){
gamemode_mustAlignSpecials = true;
};
numCollects = _local2.numCollects;
gamemode_checkForCollects = false;
if (numCollects > 0){
gamemode_checkForCollects = true;
};
numBaddies = _local2.numBaddies;
numPortals = _local2.numPortals;
gamemode_checkForPortals = false;
if ((((numBaddies > 0)) && ((numPortals > 0)))){
gamemode_checkForPortals = true;
};
}
static function GetGridCellAtPixelPos(_arg1:int, _arg2:int){
var _local3:int;
var _local4:GridCell;
GridCellX = -1;
GridCellY = -1;
if (_arg1 < minX){
return (null);
};
if (_arg1 > maxX){
return (null);
};
if (_arg2 < minY){
return (null);
};
if (_arg2 > maxY){
return (null);
};
_arg1 = (_arg1 - minX);
_arg1 = (_arg1 / cellW);
_arg2 = (_arg2 - minY);
_arg2 = (_arg2 / cellH);
if (_arg1 < 0){
_arg1 = 0;
};
if (_arg1 > (gridW - 1)){
_arg1 = (gridW - 1);
};
if (_arg2 < 0){
_arg2 = 0;
};
if (_arg2 > (gridH - 1)){
_arg1 = (gridH - 1);
};
GridCellX = _arg1;
GridCellY = _arg2;
_local3 = ((_arg2 * gridW) + _arg1);
_local4 = grid[_local3];
return (_local4);
}
static function IsTypeBaddie(_arg1:int):Boolean{
if (_arg1 == celltype_BADDIE){
return (true);
};
return (false);
}
public static function GameOverClipFinished(){
main.removeChild(gameOverMovie);
main.SetGameState(Main.gameState_TITLE);
}
static function RenderMouseLine():void{
var _local1:Number;
var _local2:int;
if (state != state_GAME){
return;
};
if (mouseMode == 1){
_local1 = Utils.DistBetweenPoints(mouseDragX, mouseDragY, MouseControl.mousePosX, MouseControl.mousePosY);
if (_local1 > gamemode_MinDragDist){
_local2 = GetDirToMove();
GraphicObjects.RenderAt(GraphicObjects.gfx_arrow, _local2, main.screenBD, mouseDragX, mouseDragY);
} else {
GraphicObjects.RenderAt(GraphicObjects.gfx_arrow, 4, main.screenBD, mouseDragX, mouseDragY);
};
} else {
if (currentBlocksMovable){
GraphicObjects.RenderAt(GraphicObjects.gfx_cursor, 0, main.screenBD, MouseControl.mousePosX, MouseControl.mousePosY);
} else {
GraphicObjects.RenderAt(GraphicObjects.gfx_cursor, 1, main.screenBD, MouseControl.mousePosX, MouseControl.mousePosY);
};
};
}
static function CheckedToSelected(){
var _local1:GridCell;
var _local2:GameObj;
for each (_local1 in grid) {
_local1.selectedFlag = _local1.checkedFlag;
_local2 = FindBlockGOByUniqueID(_local1.uniqueID);
_local2.blockSelected = _local1.selectedFlag;
};
}
static function UpdateBlocksOff(){
var _local1:int;
_local1 = CountMovingBlocks();
if (_local1 == 0){
currentLevel++;
InitState(state_INTRO);
};
}
static function GetGridCell(_arg1:int, _arg2:int):GridCell{
var _local3:int;
var _local4:GridCell;
if (_arg1 < 0){
return (null);
};
if (_arg2 < 0){
return (null);
};
if (_arg1 > (gridW - 1)){
return (null);
};
if (_arg2 > (gridH - 1)){
return (null);
};
_local3 = ((_arg2 * gridW) + _arg1);
_local4 = grid[_local3];
return (_local4);
}
public static function Init(_arg1:Main){
main = _arg1;
currentScore = 0;
multiplier = 1;
numLevels = 8;
currentLevel = 0;
objectsMoving = false;
gamemode_StoryMode = true;
gamemode_PracticeMode = false;
}
static function SetHelpBubble(_arg1:Boolean){
helpBubbleOn = _arg1;
}
public static function InitState(_arg1:int){
ShowPauseButton(false);
SetHelpBubble(false);
state = _arg1;
stateTimer = 0;
if (state == state_GAMEOVER){
Mouse.show();
trace("state_GAMEOVER");
gameOverMovie = new GameOverMovie();
main.addChild(gameOverMovie);
if (gamemode_StoryMode == true){
main.DoMochiBot(1);
HighScore.SubmitScore(currentScore, 0, ScoreDoneCallback);
} else {
main.DoMochiBot(2);
HighScore.SubmitScore(currentScore, 1, ScoreDoneCallback);
};
};
if (state == state_TUTORIAL){
trace("state_TUTORIAL");
Tutorial.Start();
};
if (state == state_INTRO){
trace("state_INTRO");
InitIntroState();
};
if (state == state_SPEECH){
trace("state_SPEECH");
};
if (state == state_BLOCKS_ON){
SetHelpBubble(true);
ShowPauseButton(true);
trace("state_BLOCKS_ON");
InitBlocksOn();
};
if (state == state_GAME){
SetHelpBubble(true);
ShowPauseButton(true);
trace("state_GAME");
objectsMoving = false;
};
if (state == state_BLOCKS_OFF){
trace("state_BLOCKS_OFF");
InitBlocksOff();
};
}
public static function InitGame(){
currentScore = 0;
currentLevel = 0;
objectsMoving = false;
helpBubbleOn = false;
helpBubbleY = 500;
scoreX = 680;
MusicPlayer.StartMusic(1);
}
static function GetDirToMove():int{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local1 = 0;
_local2 = (MouseControl.mousePosX - mouseDragX);
_local3 = (MouseControl.mousePosY - mouseDragY);
_local4 = Math.abs(_local2);
_local5 = Math.abs(_local3);
if (_local4 > _local5){
_local1 = 3;
if (_local2 > 0){
_local1 = 1;
};
} else {
_local1 = 0;
if (_local3 > 0){
_local1 = 2;
};
};
return (_local1);
}
static function CopyColumn(_arg1:int, _arg2:int){
var _local3:GridCell;
var _local4:GridCell;
var _local5:int;
_local5 = 0;
while (_local5 < gridH) {
_local3 = GetGridCell(_arg1, _local5);
_local4 = GetGridCell(_arg2, _local5);
_local4.CopyFrom(_local3);
_local3.Clear();
_local5++;
};
}
static function ClearGridSelectedFlag(){
var _local1:GridCell;
for each (_local1 in grid) {
_local1.selectedFlag = false;
};
}
public static function InitBlocksOn(){
var _local1:int;
GameObjects.ClearAll();
levelFinishedState = levelFinishedState_NOT;
levelFinishedTimer = 0;
gamemode_BringNewBlocksIn = true;
gamemode_UseDragDirection = true;
gamemode_numBlocksInGroupToClear = 3;
numStandardBlockTypes = 3;
gamemode_MinDragDist = 30;
gridW = 10;
gridH = 10;
cellW = 40;
cellH = 40;
minX = 20;
minY = 40;
numSpecialCharTypes = 3;
numSpecialCharsPerTypeList = new Array(3);
numSpecialCharsPerTypeList[0] = 2;
numSpecialCharsPerTypeList[1] = 2;
numSpecialCharsPerTypeList[2] = 2;
gamemode_mustAlignSpecials = true;
numCollects = 0;
gamemode_checkForCollects = false;
numPortals = 0;
gamemode_checkForPortals = false;
numBaddies = 0;
if (gamemode_StoryMode){
InitFromLevelDef(currentLevel);
} else {
InitFromLevel(currentLevel);
};
gridCentreX = (minX + ((gridW * cellW) / 2));
gridCentreY = (minY + ((gridH * cellH) / 2));
uniqueBlockID = 0;
portalList = new Array();
objectsMoving = false;
gridWH = (gridW * gridH);
maxX = (minX + (cellW * gridW));
maxY = (minY + (cellH * gridH));
GameObjects.AddObj(GameObj.gotype_BACKGROUND, 0, 0, 2000);
grid = new Array(gridWH);
oldGridPositions = new Array(gridWH);
_local1 = 0;
while (_local1 < gridWH) {
grid[_local1] = new GridCell();
oldGridPositions[_local1] = new GridCell();
_local1++;
};
ClearBlockObjects();
InitLevelGrid();
SetGridCellsPositions();
levelTimer1Max = (Defs.fps * 6);
if (gamemode_StoryMode){
levelTimer1Max = (Defs.fps * 3);
};
levelTimer = 9;
levelTimer1 = levelTimer1Max;
PlayTedAnim("idle");
}
static function FindBlockGOByUniqueID(_arg1:int):GameObj{
var _local2:GameObj;
for each (_local2 in GameObjects.objs) {
if (((((_local2.active) && ((_local2.type == GameObj.gotype_BLOCK)))) && ((_local2.blockID == _arg1)))){
return (_local2);
};
};
return (null);
}
static function ShowPauseButton(_arg1:Boolean){
main.backgroundMC.buttonPause.visible = _arg1;
}
static function SetBlockGOType(_arg1:GridCell){
var _local2:GameObj;
_local2 = FindBlockGOByUniqueID(_arg1.uniqueID);
_local2.subtype = _arg1.type;
_local2.graphicID = (GraphicObjects.gfx_block1 + _local2.subtype);
_local2.InitBlock1();
}
public static function buttonPressed_Pause(_arg1:MouseEvent){
PauseMenu.Pause();
}
static function ScoreDoneCallback(){
gameOverMovie.gotoAndPlay("playToEnd");
}
static function SetBlock(_arg1:int, _arg2:int, _arg3:int, _arg4:int){
var _local5:int;
var _local6:GridCell;
_local5 = ((_arg2 * gridW) + _arg1);
_local6 = grid[_local5];
_local6.type = _arg3;
if (_arg4 >= 0){
_local6.uniqueID = _arg4;
};
}
public static function InitScoreObjects(_arg1:int, _arg2:int, _arg3:Number, _arg4:Number):void{
var _local5:Array;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:GameObj;
var _local10:Boolean;
var _local11:int;
var _local12:Bitmap;
_local5 = new Array();
_local6 = _arg1;
_local10 = false;
_local11 = 0;
_local5 = new Array();
_local6 = _arg1;
_local7 = 0;
while (_local7 < 11) {
_local8 = (_local6 % 10);
_local5.push(_local8);
_local6 = (_local6 / 10);
_local7++;
};
_local10 = false;
_local11 = 0;
_local7 = (_local5.length - 1);
while (_local7--) {
_local8 = _local5[_local7];
if ((((_local10 == false)) && (!((_local8 == 0))))){
_local10 = true;
};
if (_local10){
_local9 = GameObjects.AddObj(GameObj.gotype_SCORE, _arg3, _arg4, 500);
_local9.InitScore(_local8, _local11);
_local11++;
_local12 = GraphicObjects.GetBitmap(GraphicObjects.gfx_font2, (_local8 + 48));
_arg3 = (_arg3 + _local12.width);
};
(_local7 >= 0);
};
_local9 = GameObjects.AddObj(GameObj.gotype_SCORE, _arg3, _arg4, 500);
_local9.InitScore((120 - 48), _local11);
_local11++;
_local12 = GraphicObjects.GetBitmap(GraphicObjects.gfx_font2, 120);
_arg3 = (_arg3 + _local12.width);
_local5 = new Array();
_local6 = _arg2;
_local7 = 0;
while (_local7 < 11) {
_local8 = (_local6 % 10);
_local5.push(_local8);
_local6 = (_local6 / 10);
_local7++;
};
_local10 = false;
_local11 = 0;
_local7 = (_local5.length - 1);
while (_local7--) {
_local8 = _local5[_local7];
if ((((_local10 == false)) && (!((_local8 == 0))))){
_local10 = true;
};
if (_local10){
_local9 = GameObjects.AddObj(GameObj.gotype_SCORE, _arg3, _arg4, 500);
_local9.InitScore(_local8, _local11);
_local11++;
_local12 = GraphicObjects.GetBitmap(GraphicObjects.gfx_font2, (_local8 + 48));
_arg3 = (_arg3 + _local12.width);
};
(_local7 >= 0);
};
}
static function RenderHelpBubble():void{
var _local1:String;
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:int;
_local4 = 445;
if (helpBubbleOn == false){
_local4 = (_local4 + 40);
};
helpBubbleY = (helpBubbleY + ((_local4 - helpBubbleY) * 0.2));
_local2 = 8;
_local3 = helpBubbleY;
_local5 = 0;
GraphicObjects.RenderAt(GraphicObjects.gfx_helpbubble, 0, main.screenBD, _local2, _local3);
_local1 = "";
if (gamemode_mustAlignSpecials){
_local5++;
_local1 = "Get all the same sorts of things together";
};
if (gamemode_checkForCollects){
_local5++;
_local1 = "Collect goodies with your character";
};
if (gamemode_checkForPortals){
_local5++;
if (((((!((numSpecialCharsPerTypeList[0] == 0))) || (!((numSpecialCharsPerTypeList[1] == 0))))) || (!((numSpecialCharsPerTypeList[2] == 0))))){
_local1 = "Get the baddies to the portals. Don't touch them!";
} else {
_local1 = "Get the baddies to the portals.";
};
};
if (_local5 > 1){
_local1 = "So much to do!";
};
_local2 = (_local2 + 13);
_local3 = (_local3 + 2);
GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font3, _local2, _local3, _local1, null, -4);
}
static function CheckForPortals():int{
var _local1:int;
var _local2:int;
var _local3:GridCell;
var _local4:Point;
_local1 = 0;
while (_local1 < gridWH) {
_local3 = grid[_local1];
if (IsTypeBaddie(_local3.type)){
for each (_local4 in portalList) {
if ((((_local4.x == _local3.x)) && ((_local4.y == _local3.y)))){
_local3.type = 0;
SetBlockGOType(_local3);
AddScore(10, _local3);
SoundPlayer.Play(SoundPlayer.SOUND_VORTEX);
PlayTedAnim("jump");
};
};
};
_local1++;
};
_local2 = 0;
_local1 = 0;
while (_local1 < gridWH) {
_local3 = grid[_local1];
if (IsTypeBaddie(_local3.type)){
_local2++;
};
_local1++;
};
if (_local2 == 0){
return (1);
};
return (0);
}
static function InitMovingObjects(){
objectsMoving = true;
}
static function RemoveCheckedColumn(_arg1:int, _arg2:int){
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:GridCell;
var _local8:GridCell;
var _local9:GridCell;
_local4 = _arg1;
if (_arg2 == 0){
_local3 = (gridH - 1);
while (_local3 >= 0) {
_local7 = GetGridCell(_local4, _local3);
if (_local7.checkedFlag){
if (_local3 == 0){
_local8 = GetGridCell(_local4, _local3);
_local8.Clear();
} else {
_local6 = _local3;
while (_local6 > 0) {
_local8 = GetGridCell(_local4, _local6);
_local9 = GetGridCell(_local4, (_local6 - 1));
_local8.CopyFrom(_local9);
_local9.Clear();
_local6--;
};
};
_local3++;
};
_local3--;
};
} else {
_local3 = 0;
while (_local3 <= (gridH - 1)) {
_local7 = GetGridCell(_local4, _local3);
if (_local7.checkedFlag){
if (_local3 == (gridH - 1)){
_local8 = GetGridCell(_local4, _local3);
_local8.Clear();
} else {
_local6 = _local3;
while (_local6 < (gridH - 1)) {
_local8 = GetGridCell(_local4, _local6);
_local9 = GetGridCell(_local4, (_local6 + 1));
_local8.CopyFrom(_local9);
_local9.Clear();
_local6++;
};
};
_local3--;
};
_local3++;
};
};
}
static function InitLevelGrid():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:GridCell;
var _local7:GameObj;
_local1 = 0;
while (_local1 < gridW) {
_local2 = 0;
while (_local2 < gridH) {
_local4 = Utils.RandBetweenInt(0, (numStandardBlockTypes - 1));
SetBlock(_local1, _local2, _local4, uniqueBlockID);
NewBlockGO(_local1, _local2, _local4);
uniqueBlockID++;
_local2++;
};
_local1++;
};
_local2 = 0;
while (_local2 < numSpecialCharTypes) {
_local5 = GetNumCharsPerType((celltype_SPECIAL1 + _local2));
_local1 = 0;
while (_local1 < _local5) {
_local6 = GetRandomNormalGridCell();
_local6.type = (celltype_SPECIAL1 + _local2);
SetBlockGOType(_local6);
_local1++;
};
_local2++;
};
_local1 = 0;
while (_local1 < numCollects) {
_local6 = GetRandomNormalGridCell();
_local6.type = celltype_COLLECT;
SetBlockGOType(_local6);
_local1++;
};
portalList = new Array();
_local1 = 0;
while (_local1 < numPortals) {
_local6 = GetRandomPortalCell();
portalList.push(new Point(_local6.x, _local6.y));
AddPortalGO(_local6.x, _local6.y);
_local1++;
};
_local1 = 0;
while (_local1 < numBaddies) {
_local6 = GetRandomNormalGridCell();
_local6.type = celltype_BADDIE;
SetBlockGOType(_local6);
_local1++;
};
SetGridCellsPositions();
_local3 = Utils.RandBetweenInt(0, 2);
if (_local3 == 2){
ForEachGridSpiral(InitGridCellMovingOn);
} else {
_local1 = 0;
while (_local1 < gridWH) {
_local6 = grid[_local1];
_local7 = FindBlockGOByUniqueID(_local6.uniqueID);
GetTransformedBlockPos(_local6.x, _local6.y);
RandOffScreen(_local7, _local3);
_local7.SetBlockMove(blockPosX, blockPosY);
if (_local3 == 1){
_local7.timer = Number(_local1);
_local7.controlMode = 2;
};
_local1++;
};
};
ClearGridCheckedFlag();
InitMovingObjects();
}
static function GetTransformedBlockPos(_arg1:int, _arg2:int){
blockPosX = (minX + (_arg1 * cellW));
blockPosY = (minY + (_arg2 * cellH));
}
static function Render():void{
RenderMouseLine();
}
static function FindGridCellByUniqueID(_arg1:int):GridCell{
var _local2:int;
var _local3:GridCell;
_local2 = 0;
while (_local2 < gridWH) {
_local3 = grid[_local2];
if (_local3.uniqueID == _arg1){
return (_local3);
};
_local2++;
};
return (null);
}
static function FindFirstBlockOfType(_arg1:int):GridCell{
var _local2:int;
var _local3:int;
var _local4:GridCell;
_local2 = 0;
while (_local2 < gridW) {
_local3 = 0;
while (_local3 < gridH) {
_local4 = GetGridCell(_local2, _local3);
if (_local4.type == _arg1){
return (_local4);
};
_local3++;
};
_local2++;
};
return (null);
}
static function ForEachGridSpiral(_arg1:Object){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
_local2 = 0;
_local3 = 0;
_local4 = (gridW - 1);
_local5 = (gridH - 1);
_local6 = 0;
_local7 = 0;
_local8 = 0;
_local9 = 1;
_local10 = 3;
ClearGridCheckedFlag();
do {
_local11 = GetGridCell(_local2, _local3);
_local11.checkedFlag = true;
_arg1(_local11, (_local8 / 2));
if (_local9 == 0){
_local6 = _local2;
_local7 = (_local3 - 1);
};
if (_local9 == 1){
_local6 = (_local2 + 1);
_local7 = _local3;
};
if (_local9 == 2){
_local6 = _local2;
_local7 = (_local3 + 1);
};
if (_local9 == 3){
_local6 = (_local2 - 1);
_local7 = _local3;
};
_local12 = GetGridCell(_local6, _local7);
if (((!((_local12 == null))) && ((_local12.checkedFlag == false)))){
_local2 = _local6;
_local3 = _local7;
} else {
++_local9;
_local9 = (_local9 & 3);
if (_local9 == 0){
_local6 = _local2;
_local7 = (_local3 - 1);
};
if (_local9 == 1){
_local6 = (_local2 + 1);
_local7 = _local3;
};
if (_local9 == 2){
_local6 = _local2;
_local7 = (_local3 + 1);
};
if (_local9 == 3){
_local6 = (_local2 - 1);
_local7 = _local3;
};
_local2 = _local6;
_local3 = _local7;
};
_local8++;
_local11 = GetGridCell(_local4, _local5);
_local11.checkedFlag = true;
_arg1(_local11, (_local8 / 2));
if (_local10 == 0){
_local6 = _local4;
_local7 = (_local5 - 1);
};
if (_local10 == 1){
_local6 = (_local4 + 1);
_local7 = _local5;
};
if (_local10 == 2){
_local6 = _local4;
_local7 = (_local5 + 1);
};
if (_local10 == 3){
_local6 = (_local4 - 1);
_local7 = _local5;
};
_local12 = GetGridCell(_local6, _local7);
if (((!((_local12 == null))) && ((_local12.checkedFlag == false)))){
_local4 = _local6;
_local5 = _local7;
} else {
++_local10;
_local10 = (_local10 & 3);
if (_local10 == 0){
_local6 = _local4;
_local7 = (_local5 - 1);
};
if (_local10 == 1){
_local6 = (_local4 + 1);
_local7 = _local5;
};
if (_local10 == 2){
_local6 = _local4;
_local7 = (_local5 + 1);
};
if (_local10 == 3){
_local6 = (_local4 - 1);
_local7 = _local5;
};
_local4 = _local6;
_local5 = _local7;
};
_local8++;
} while (_local8 < gridWH);
}
static function BringInNewGridCells(_arg1:int){
var _local2:GridCell;
var _local3:int;
var _local4:int;
var _local5:GameObj;
_local3 = 0;
while (_local3 < gridW) {
_local4 = 0;
while (_local4 < gridH) {
_local2 = GetGridCell(_local3, _local4);
if (_local2.type == -1){
_local2.type = Utils.RandBetweenInt(0, (numStandardBlockTypes - 1));
_local2.uniqueID = uniqueBlockID;
if (_arg1 == dir_S){
_local5 = NewBlockGO(_local3, -5, _local2.type);
};
if (_arg1 == dir_N){
_local5 = NewBlockGO(_local3, (gridH + 5), _local2.type);
};
if (_arg1 == dir_E){
_local5 = NewBlockGO(-5, _local4, _local2.type);
};
if (_arg1 == dir_W){
_local5 = NewBlockGO((gridW + 5), _local4, _local2.type);
};
GetTransformedBlockPos(_local3, _local4);
_local5.SetBlockMove(blockPosX, blockPosY);
uniqueBlockID++;
};
_local4++;
};
_local3++;
};
}
static function GetRandomNormalGridCell():GridCell{
var _local1:*;
var _local2:*;
var _local3:*;
do {
_local1 = Utils.RandBetweenInt(0, (gridW - 1));
_local2 = Utils.RandBetweenInt(0, (gridH - 1));
_local3 = GetGridCell(_local1, _local2);
_local3.x = _local1;
_local3.y = _local2;
if (_local3.type < celltype_SPECIAL1){
return (_local3);
};
} while (true);
return (null);
}
static function IsTypeCharacter(_arg1:int):Boolean{
if (_arg1 == celltype_SPECIAL1){
return (true);
};
if (_arg1 == celltype_SPECIAL2){
return (true);
};
if (_arg1 == celltype_SPECIAL3){
return (true);
};
return (false);
}
static function GetNumCharsPerType(_arg1:int):int{
return (numSpecialCharsPerTypeList[(_arg1 - 4)]);
}
static function RenderPanel(){
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:int;
RenderHelpBubble();
if (state == state_SPEECH){
_local1 = 230;
_local2 = 150;
_local3 = currentLevel;
_local4 = (GraphicObjects.GetNumFrames(GraphicObjects.gfx_speechbubble) - 1);
if (_local3 > _local4){
_local3 = _local4;
};
GraphicObjects.RenderAt(GraphicObjects.gfx_speechbubble, _local3, main.screenBD, _local1, _local2);
};
if (state == state_GAME){
};
RenderScore();
}
static function AddPortalGO(_arg1:int, _arg2:int):void{
var _local3:GameObj;
GetTransformedBlockPos(_arg1, _arg2);
_local3 = GameObjects.AddObj(GameObj.gotype_PORTAL, blockPosX, blockPosY, 900);
}
static function SetObjectsToMove():void{
var _local1:int;
var _local2:GridCell;
var _local3:GridCell;
var _local4:GameObj;
_local1 = 0;
while (_local1 < gridWH) {
_local2 = oldGridPositions[_local1];
if (_local2.type != -1){
_local3 = FindGridCellByUniqueID(_local2.uniqueID);
_local4 = FindBlockGOByUniqueID(_local2.uniqueID);
if (((_local3) && (_local4))){
GetTransformedBlockPos(_local3.x, _local3.y);
_local4.SetBlockMove(blockPosX, blockPosY);
};
if (((_local4) && (!(_local3)))){
_local4.active = false;
};
};
_local1++;
};
}
}
}//package
Section 79
//GameObj (GameObj)
package {
import flash.geom.*;
public class GameObj {
var graphicID:int;
public var xacc:Number;
var xoffset:Number;
public var active:Boolean;
public var hp:int;
public var count:int;
var externyvel:Number;
public var xvel:Number;
var blinking:Boolean;
public var todir:Number;
var ftime:Number;
var flashTimer:Number;
var shootTimerMax:Number;
public var type:int;
public var ypos:Number;
var minFrame:int;
var timer:Number;
var rotVel:Number;
var blinkTimer:int;
var yoffset:Number;
public var speed:Number;
var blockSelected:Boolean;
var startx:Number;
public var ypos2:Number;
var health:Number;
var starty:Number;
var blinkGfxID:int;
var shootTimer:Number;
public var yacc:Number;
var maxFrame:int;
var frame:Number;
var blockID:int;
public var hitTimer:Number;
public var controlIndex:int;
public var subtype:int;
var flashFlag:Boolean;
public var oldxpos:Number;
public var yvel:Number;
var timer1:Number;
public var dir:Number;
public var radius:Number;
public var visible:Boolean;
public var zpos:Number;
var scoreNum:int;
public var toPosX:Number;
public var controlMode:int;
public var origspeed:Number;
public var toPosY:Number;
var dist:Number;
var main:Main;
public var baseID:int;
var externxvel:Number;
public var xpos2:Number;
public var xpos:Number;
var blockSelectedTimer:Number;
var timerMax:Number;
var shootMissileType:int;
public var oldypos:Number;
public var handleRender:Boolean;
var xflip:Boolean;
public var explosionType:int;
public var frameVel:Number;
var flashTimerMax:Number;
static const gotype_BLOCK = 1;
static const gotype_OVERLAY = 4;
static const gotype_SCORE = 3;
static const gotype_PORTAL = 2;
static const gotype_BACKGROUND = 0;
public function GameObj(_arg1, _arg2, _arg3){
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;
flashTimer = 0;
flashFlag = true;
xflip = false;
}
public function InitOverlay(_arg1:int){
toPosX = xpos;
toPosY = ypos;
xpos = (xpos - 100);
ypos = (ypos + 300);
subtype = _arg1;
if (subtype == 0){
graphicID = GraphicObjects.gfx_overlay_levelup;
};
timer = (Defs.fps * 2);
controlMode = 0;
xvel = 0;
yvel = 0;
yvel = -20;
}
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 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 UpdateBaddieEyes():void{
if (subtype == Game.celltype_BADDIE){
};
}
function DoExternalVel():void{
var _local1:Number;
xpos = (xpos + (externxvel * ftime));
ypos = (ypos + (externyvel * ftime));
_local1 = 0.9;
externxvel = (externxvel * _local1);
externyvel = (externyvel * _local1);
}
function UpdateScore(){
var _local1:Number;
if (controlMode == 0){
timer--;
if (timer < 0){
dir = Utils.RandCircle();
speed = Utils.RandBetweenFloat(3, 4);
toPosX = 700;
toPosY = 80;
controlMode = 1;
};
} else {
if (controlMode == 1){
todir = Math.atan2((toPosY - ypos), (toPosX - xpos));
_local1 = Utils.DotProductAng(dir, (todir + (Math.PI * 0.5)));
if (_local1 > 0.05){
dir = (dir - 0.1);
};
if (_local1 < -0.05){
dir = (dir + 0.1);
};
dir = NormalizeDir(dir);
speed = (speed + 0.5);
xpos = (xpos + (Math.cos(dir) * speed));
ypos = (ypos + (Math.sin(dir) * speed));
if (xpos > 680){
active = false;
};
};
};
}
function Graph(_arg1:Number, _arg2:int):Number{
var _local3:Number;
if (_arg2 == 0){
_local3 = (_arg1 * (Math.PI * 0.5));
_local3 = Math.sin(_local3);
return (_local3);
};
return (_arg1);
}
public function Init(_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;
flashTimer = _local3;
flashFlag = true;
dir = 0;
todir = 0;
health = 1;
if (type == gotype_BACKGROUND){
frame = 0;
graphicID = GraphicObjects.gfx_background;
} else {
if (type == gotype_BLOCK){
graphicID = GraphicObjects.gfx_block1;
} else {
if (type == gotype_PORTAL){
graphicID = GraphicObjects.gfx_portal;
} else {
if (type == gotype_SCORE){
graphicID = GraphicObjects.gfx_font2;
} else {
if (type == gotype_OVERLAY){
};
};
};
};
};
}
public function InitBlock(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int){
subtype = _arg4;
blockID = _arg3;
xpos = _arg1;
ypos = _arg2;
frame = 0;
controlMode = 0;
frameVel = Utils.RandBetweenFloat(0.6, 1.2);
blinking = false;
blinkTimer = Utils.RandBetweenInt(20, 100);
blinkGfxID = GraphicObjects.gfx_blink1;
InitBlock1();
blockSelected = false;
blockSelectedTimer = 0;
}
function UpdateOverlay(){
var _local1:Number;
var _local2:Number;
if (controlMode == 0){
timer--;
if (timer < 0){
controlMode = 1;
timer = 50;
toPosX = (toPosX + 100);
toPosY = (toPosY - 300);
};
};
if (controlMode == 1){
timer--;
if (timer < 0){
active = false;
};
};
_local1 = 3;
_local2 = 20;
if (xpos < toPosX){
xvel = (xvel + _local1);
};
if (xpos > toPosX){
xvel = (xvel - _local1);
};
if (ypos < toPosY){
yvel = (yvel + _local1);
};
if (ypos > toPosY){
yvel = (yvel - _local1);
};
if (xvel > _local2){
xvel = _local2;
};
if (xvel < -(_local2)){
xvel = -(_local2);
};
if (yvel > _local2){
yvel = _local2;
};
if (yvel < -(_local2)){
yvel = -(_local2);
};
xpos = (xpos + xvel);
ypos = (ypos + yvel);
}
public function AddImpulse(_arg1:Number, _arg2:Number, _arg3:Number){
externxvel = (externxvel + (_arg1 * _arg3));
externyvel = (externyvel + (_arg2 * _arg3));
}
function UpdateBlock():void{
var _local1:Number;
UpdateBlockBlink();
UpdateBlockSelected();
if (controlMode == 1){
_local1 = Graph(((1 / 20) * timer), 0);
xpos = (startx + (xvel * _local1));
ypos = (starty + (yvel * _local1));
timer = (timer + ftime);
if (timer >= 20){
controlMode = 0;
xpos = toPosX;
ypos = toPosY;
};
} else {
if (controlMode == 2){
timer = (timer - ftime);
if (timer <= 0){
timer = 0;
controlMode = 1;
};
};
};
}
function InitScore(_arg1:int, _arg2:int){
scoreNum = _arg1;
timer = (Defs.fps + (_arg2 * 3));
controlMode = 0;
}
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);
}
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);
}
function RenderBlockFace():void{
var _local1:Number;
var _local2:Number;
_local1 = xpos;
_local2 = ypos;
if (subtype == Game.celltype_SPECIAL1){
RenderEye((_local1 + 10), (_local2 + 15), false);
RenderEye((_local1 + 30), (_local2 + 15), false);
};
if (subtype == Game.celltype_SPECIAL2){
RenderEye((_local1 + 20), (_local2 + 15), false);
};
if (subtype == Game.celltype_SPECIAL3){
RenderEye((_local1 + 20), (_local2 + 15), false);
RenderEye((_local1 + 10), (_local2 + 18), false);
RenderEye((_local1 + 30), (_local2 + 18), false);
};
if ((((subtype == Game.celltype_BADDIE)) && ((graphicID == GraphicObjects.gfx_blockbaddie)))){
RenderEye((_local1 + 20), (_local2 + 15), true);
RenderEye((_local1 + 10), (_local2 + 18), true);
RenderEye((_local1 + 30), (_local2 + 18), true);
};
}
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 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;
};
};
}
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 PlayAnimation():Boolean{
var _local1:int;
_local1 = GraphicObjects.GetNumFrames(graphicID);
frame = (frame + (frameVel * ftime));
if (frame >= _local1){
frame = _local1;
return (true);
};
return (false);
}
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 RenderEye(_arg1:Number, _arg2:Number, _arg3:Boolean){
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local4 = (MouseControl.mousePosX - _arg1);
_local5 = (MouseControl.mousePosY - _arg2);
if (_arg3){
_local4 = (_arg1 - MouseControl.mousePosX);
_local5 = (_arg2 - MouseControl.mousePosY);
};
_local4 = (_local4 * 0.1);
_local5 = (_local5 * 0.1);
_local6 = (_arg1 + _local4);
_local7 = (_arg2 + _local5);
_local8 = Utils.DistBetweenPoints(_arg1, _arg2, _local6, _local7);
if (_local8 > 4){
_local8 = 4;
_local9 = Math.atan2(_local5, _local4);
_local6 = (_arg1 + (Math.cos(_local9) * _local8));
_local7 = (_arg2 + (Math.sin(_local9) * _local8));
};
GraphicObjects.RenderAt(GraphicObjects.gfx_eyeball, 0, main.screenBD, _arg1, _arg2);
GraphicObjects.RenderAt(GraphicObjects.gfx_iris, 0, main.screenBD, _local6, _local7);
if (blinking){
GraphicObjects.RenderAt(blinkGfxID, 0, main.screenBD, _arg1, _arg2);
};
}
public function InitBlock1(){
var _local1:LevelDef;
if (Game.gamemode_StoryMode){
_local1 = Levels.GetLevelDef(Game.currentLevel);
if (subtype == 0){
graphicID = _local1.blockGfx0;
};
if (subtype == 1){
graphicID = _local1.blockGfx1;
};
if (subtype == 2){
graphicID = _local1.blockGfx2;
};
if (subtype == 3){
graphicID = _local1.blockGfx3;
};
if (subtype == Game.celltype_COLLECT){
graphicID = _local1.blockCollection;
};
if (subtype == Game.celltype_BADDIE){
graphicID = _local1.blockBaddie;
};
} else {
if (subtype == 0){
graphicID = GraphicObjects.gfx_block1;
};
if (subtype == 1){
graphicID = GraphicObjects.gfx_block2;
};
if (subtype == 2){
graphicID = GraphicObjects.gfx_block3;
};
if (subtype == 3){
graphicID = GraphicObjects.gfx_block4;
};
if (subtype == Game.celltype_COLLECT){
graphicID = Game.arcadeMode_pickupBlock;
};
if (subtype == Game.celltype_BADDIE){
graphicID = Game.arcadeMode_baddieBlock;
};
};
if (subtype == Game.celltype_SPECIAL1){
blinkGfxID = GraphicObjects.gfx_blink1;
};
if (subtype == Game.celltype_SPECIAL2){
blinkGfxID = GraphicObjects.gfx_blink2;
};
if (subtype == Game.celltype_SPECIAL3){
blinkGfxID = GraphicObjects.gfx_blink3;
};
if (subtype == Game.celltype_BADDIE){
blinkGfxID = GraphicObjects.gfx_blink4;
};
}
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);
}
public function GetDirBetween(_arg1, _arg2, _arg3, _arg4):Number{
var _local5:*;
_local5 = Math.atan2((_arg4 - _arg2), (_arg3 - _arg1));
return (_local5);
}
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 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);
}
public function Render(_arg1):void{
var _local2:Number;
var _local3:Number;
if (visible == false){
return;
};
_local2 = xpos;
_local3 = ypos;
if (type == gotype_BACKGROUND){
main.screenBD.fillRect(new Rectangle(0, 0, Defs.displayarea_w, Defs.displayarea_h), 0);
} else {
if (type == gotype_SCORE){
GraphicObjects.RenderAt(GraphicObjects.gfx_fontblack, (scoreNum + 48), main.screenBD, _local2, _local3);
GraphicObjects.RenderAt(graphicID, (scoreNum + 48), main.screenBD, _local2, _local3);
} else {
GraphicObjects.RenderAt(graphicID, frame, main.screenBD, _local2, _local3);
};
};
if (type == gotype_BLOCK){
RenderBlockFace();
RenderSelectedOverlay();
};
}
function RenderSelectedOverlay():void{
if (blockSelected == false){
return;
};
GraphicObjects.RenderAt(GraphicObjects.gfx_blockhighlight, int(blockSelectedTimer), main.screenBD, xpos, ypos);
}
function IsInWorld(_arg1:Number):Boolean{
if (xpos < (0 - _arg1)){
return (false);
};
if (ypos < (0 - _arg1)){
return (false);
};
if (xpos > (Game.scrollW + _arg1)){
return (false);
};
if (ypos > (Game.scrollH + _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);
}
function UpdateBlockBlink(){
if (blinking == false){
blinkTimer--;
if (blinkTimer < 0){
blinkTimer = Utils.RandBetweenInt(1, 2);
blinking = true;
};
} else {
blinkTimer--;
if (blinkTimer < 0){
blinkTimer = Utils.RandBetweenInt(20, 100);
blinking = false;
};
};
}
function SetBlockMove(_arg1:Number, _arg2:Number){
toPosX = _arg1;
toPosY = _arg2;
timer = 0;
xvel = (toPosX - xpos);
yvel = (toPosY - ypos);
startx = xpos;
starty = ypos;
controlMode = 1;
}
function UpdateBlockSelected(){
blockSelectedTimer++;
if (blockSelectedTimer > 70){
blockSelectedTimer = 0;
};
}
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 Update():void{
oldxpos = xpos;
oldypos = ypos;
ftime = main.ftime;
if (type == gotype_BACKGROUND){
xpos = -(Game.scrollX);
ypos = -(Game.scrollY);
} else {
if (type == gotype_BLOCK){
UpdateBlock();
} else {
if (type == gotype_PORTAL){
UpdatePortal();
} else {
if (type == gotype_SCORE){
UpdateScore();
} else {
if (type == gotype_OVERLAY){
UpdateOverlay();
};
};
};
};
};
}
function UpdatePortal():void{
visible = false;
if (Game.state == Game.state_GAME){
visible = true;
};
frameVel = 1;
CycleAnimation();
}
public function GetVelFromDir(_arg1:Number){
xvel = (Math.cos(dir) * _arg1);
yvel = (Math.sin(dir) * _arg1);
}
function GetLen(_arg1, _arg2):Number{
var _local3:*;
_local3 = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
return (_local3);
}
}
}//package
Section 80
//GameObjects (GameObjects)
package {
import flash.events.*;
class GameObjects {
public static var numobjs;
static var m:Main;
public static var zorder:Array;
public static var objs:Array;
public function GameObjGroup(){
}
public static 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 static function Update():void{
var _local1:int;
_local1 = 0;
while (_local1 < objs.length) {
if (objs[_local1].active == true){
objs[_local1].Update();
};
_local1++;
};
}
public static function InitOnce(_arg1:Main, _arg2:int){
var _local3:*;
numobjs = _arg2;
m = _arg1;
objs = new Array();
zorder = new Array(numobjs);
_local3 = 0;
while (_local3 < numobjs) {
objs.push(new GameObj(m, 0, 0));
_local3++;
};
}
public static function ClearAll(){
var _local1:int;
_local1 = 0;
while (_local1 < numobjs) {
objs[_local1].active = false;
_local1++;
};
}
public static function AddObj(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number):GameObj{
var _local5:int;
var _local6:GameObj;
_local5 = 0;
while (_local5 < numobjs) {
if (objs[_local5].active == false){
_local6 = objs[_local5];
_local6.active = true;
_local6.zpos = _arg4;
_local6.xpos = _arg2;
_local6.ypos = _arg3;
_local6.startx = _arg2;
_local6.starty = _arg3;
_local6.Init(_arg1);
return (objs[_local5]);
};
_local5++;
};
trace("ERROR! NO FREE OBJECTS");
return (null);
}
public static function Render():void{
var _local1:int;
var _local2:int;
_local1 = GetZOrder();
_local2 = 0;
while (_local2 < _local1) {
objs[zorder[_local2]].Render(m);
_local2++;
};
}
}
}//package
Section 81
//GameOverMovie (GameOverMovie)
package {
import flash.display.*;
public dynamic class GameOverMovie extends MovieClip {
public var background:MovieClip;
public function GameOverMovie(){
addFrameScript(35, frame36, 76, frame77);
}
function frame77(){
stop();
Game.GameOverClipFinished();
}
function frame36(){
stop();
}
}
}//package
Section 82
//GraphicObjects (GraphicObjects)
package {
import flash.display.*;
import flash.text.*;
public class GraphicObjects {
public static const gfx_blockasteroid = 32;
public static const gfx_blockparticle2 = 82;
public static const gfx_blockparticle3 = 82;
public static const gfx_blockboat = 28;
public static const gfx_arrow = 60;
public static const gfx_blockparticle1 = 81;
public static const gfx_blockcake = 17;
public static const gfx_blockblack = 29;
public static const gfx_iris = 41;
public static const gfx_blockblue = 24;
public static const gfx_blockhighlight = 50;
public static const gfx_blockcloud = 20;
public static const gfx_particle_red = 48;
public static const gfx_blockbaddie = 18;
public static const gfx_blocktree = 23;
public static const gfx_timerback = 73;
public static const gfx_blockbomb = 19;
public static const gfx_overlay_levelup = 70;
public static const gfx_blocksheep = 25;
public static const gfx_blockplane = 27;
public static const gfx_blockbouy = 33;
public static const gfx_font1 = 100;
public static const gfx_font2 = 101;
public static const gfx_font3 = 102;
public static const gfx_blockground = 22;
public static const gfx_blockbubble = 34;
public static const gfx_blockplanet = 31;
public static const gfx_helpbubble = 72;
public static const gfx_background = 0;
public static const gfx_particle_white = 49;
public static const gfx_blockpurple = 30;
public static const gfx_block2 = 11;
public static const gfx_block3 = 12;
public static const gfx_block4 = 13;
public static const gfx_block1 = 10;
public static const gfx_blockrocket = 26;
public static const gfx_blink2 = 43;
public static const gfx_blink3 = 44;
public static const gfx_blink4 = 45;
public static const gfx_blockspecial1 = 14;
public static const gfx_blockspecial2 = 15;
public static const gfx_blockspecial3 = 16;
public static const gfx_fontblack = 103;
public static const gfx_cursor = 61;
public static const gfx_blockparticle = 80;
public static const gfx_eyeball = 40;
public static const gfx_portal = 51;
public static const gfx_blink1 = 42;
public static const gfx_speechbubble = 71;
public static const gfx_blockbeer = 21;
public static const gfx_fontwhite = 104;
public static const gfx_timer = 62;
static var count:int;
public static var stringCharBitmap:Bitmap;
public static var stringCharX:Number;
public static var stringCharY:Number;
static var graphicobjs:Array;
static var idList:Array;
static var main:Main;
public static function RenderStringAt(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Object, _arg7:int=0){
var _local8:int;
var _local9:int;
stringCharX = _arg3;
stringCharY = _arg4;
_local8 = 0;
while (_local8 < _arg5.length) {
_local9 = int(_arg5.charCodeAt(_local8));
if (_local9 < 0){
_local9 = 0;
};
if (_local9 > 127){
_local9 = 127;
};
RenderAt(_arg2, _local9, _arg1, stringCharX, stringCharY);
stringCharBitmap = GetBitmap(_arg2, _local9);
if (_arg6 != null){
_arg6();
} else {
stringCharX = (stringCharX + stringCharBitmap.width);
stringCharX = (stringCharX + _arg7);
};
_local8++;
};
}
public static function GetBitmap(_arg1, _arg2):Bitmap{
var _local3:int;
_local3 = idList[_arg1];
return (graphicobjs[_local3].frames[_arg2].bitmaps[0]);
}
public static function GetNumFrames(_arg1:int):int{
var _local2:int;
_local2 = idList[_arg1];
return (graphicobjs[_local2].frames.length);
}
public static function RenderNumberAt(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int, _arg6:int=0){
var _local7:Bitmap;
var _local8:Array;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:Boolean;
_local8 = new Array();
_local9 = _arg5;
_local10 = 0;
while (_local10 < 11) {
_local12 = (_local9 % 10);
_local8.push(_local12);
_local9 = (_local9 / 10);
_local10++;
};
if (_arg6 > 0){
_local10 = _arg6;
while (_local10--) {
_local11 = _local8[_local10];
RenderAt(_arg2, (_local11 + 48), _arg1, _arg3, _arg4);
_local7 = GetBitmap(_arg2, (_local11 + 48));
_arg3 = (_arg3 + (_local7.width - 4));
(_local10 >= 0);
};
} else {
_local13 = false;
_local10 = (_local8.length - 1);
while (_local10--) {
_local11 = _local8[_local10];
if ((((_local13 == false)) && (!((_local11 == 0))))){
_local13 = true;
};
if (_local13){
RenderAt(_arg2, (_local11 + 48), _arg1, _arg3, _arg4);
_local7 = GetBitmap(_arg2, (_local11 + 48));
_arg3 = (_arg3 + (_local7.width - 4));
};
(_local10 >= 0);
};
};
return (_arg3);
}
static function CreateAsciiTable():void{
}
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 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 Add(_arg1:int, _arg2:DisplayObj):void{
idList[_arg1] = count;
graphicobjs.push(_arg2);
count++;
}
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);
}
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 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 InitOnce(_arg1:Main):void{
main = _arg1;
graphicobjs = new Array();
idList = new Array(110);
count = 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);
AddFont(gfx_fontwhite, main.tf_scoresprwhite);
Add(gfx_block1, new DisplayObj(new Block1(), 1, 0));
Add(gfx_block2, new DisplayObj(new Block2(), 1, 0));
Add(gfx_block3, new DisplayObj(new Block3(), 1, 0));
Add(gfx_block4, new DisplayObj(new Block4(), 1, 0));
Add(gfx_blockspecial1, new DisplayObj(new BlockSpecial1(), 1, 0));
Add(gfx_blockspecial2, new DisplayObj(new BlockSpecial2(), 1, 0));
Add(gfx_blockspecial3, new DisplayObj(new BlockSpecial3(), 1, 0));
Add(gfx_blockcake, new DisplayObj(new BlockCake(), 1, 0));
Add(gfx_blockbaddie, new DisplayObj(new BlockBaddie(), 1, 0));
Add(gfx_blockbomb, new DisplayObj(new BlockBomb(), 1, 0));
Add(gfx_blockcloud, new DisplayObj(new BlockCloud(), 1, 0));
Add(gfx_blockbeer, new DisplayObj(new BlockBeer(), 1, 0));
Add(gfx_blockground, new DisplayObj(new BlockGround(), 1, 0));
Add(gfx_blocktree, new DisplayObj(new BlockTree(), 1, 0));
Add(gfx_blockblue, new DisplayObj(new BlockBlue(), 1, 0));
Add(gfx_blocksheep, new DisplayObj(new BlockSheep(), 1, 0));
Add(gfx_blockrocket, new DisplayObj(new BlockRocket(), 1, 0));
Add(gfx_blockplane, new DisplayObj(new BlockPlane(), 1, 0));
Add(gfx_blockboat, new DisplayObj(new BlockBoat(), 1, 0));
Add(gfx_blockblack, new DisplayObj(new BlockBlack(), 1, 0));
Add(gfx_blockpurple, new DisplayObj(new BlockPurple(), 1, 0));
Add(gfx_blockplanet, new DisplayObj(new BlockPlanet(), 1, 0));
Add(gfx_blockasteroid, new DisplayObj(new BlockAsteroid(), 1, 0));
Add(gfx_blockbouy, new DisplayObj(new BlockBouy(), 1, 0));
Add(gfx_blockbubble, new DisplayObj(new BlockBubble(), 1, 0));
Add(gfx_arrow, new DisplayObj(new Arrow(), 1, 0));
Add(gfx_cursor, new DisplayObj(new Cursor(), 1, 0));
Add(gfx_timer, new DisplayObj(new CountdownTimer(), 1, 0));
Add(gfx_overlay_levelup, new DisplayObj(new levelUp(), 1, 0));
Add(gfx_speechbubble, new DisplayObj(new speechBubble(), 1, 0));
Add(gfx_helpbubble, new DisplayObj(new helpbubble(), 1, 0));
Add(gfx_timerback, new DisplayObj(new timerBack(), 1, 0));
Add(gfx_blockparticle, new DisplayObj(new blockparticle(), 1, 0));
Add(gfx_blockparticle1, new DisplayObj(new blockparticle1(), 1, 0));
Add(gfx_blockparticle2, new DisplayObj(new blockparticle2(), 1, 0));
Add(gfx_blockparticle3, new DisplayObj(new blockparticle3(), 1, 0));
Add(gfx_particle_red, new DisplayObj(new Particle_Red(), 1, 0));
Add(gfx_particle_white, new DisplayObj(new Particle_White(), 1, 0));
Add(gfx_eyeball, new DisplayObj(new Eyeball(), 1, 0));
Add(gfx_iris, new DisplayObj(new Iris(), 1, 0));
Add(gfx_blink1, new DisplayObj(new Blink1(), 1, 0));
Add(gfx_blink2, new DisplayObj(new Blink2(), 1, 0));
Add(gfx_blink3, new DisplayObj(new Blink3(), 1, 0));
Add(gfx_blink4, new DisplayObj(new Blink4(), 1, 0));
Add(gfx_blockhighlight, new DisplayObj(new BlockHighlight(), 1, 0));
Add(gfx_portal, new DisplayObj(new Portal(), 1, 0));
}
}
}//package
Section 83
//GridCell (GridCell)
package {
public class GridCell {
public var uniqueID:int;
public var selectedFlag:Boolean;
public var checkedFlag:Boolean;
public var x:int;
public var y:int;
public var type:int;
public function GridCell(){
type = -1;
checkedFlag = false;
uniqueID = -1;
selectedFlag = false;
x = 0;
y = 0;
}
public function Clear(){
checkedFlag = false;
type = -1;
uniqueID = -1;
selectedFlag = false;
x = 0;
y = 0;
}
public function CopyFrom(_arg1:GridCell){
type = _arg1.type;
checkedFlag = _arg1.checkedFlag;
uniqueID = _arg1.uniqueID;
x = _arg1.x;
y = _arg1.y;
selectedFlag = _arg1.selectedFlag;
}
}
}//package
Section 84
//helpbubble (helpbubble)
package {
import flash.display.*;
public dynamic class helpbubble extends MovieClip {
public function helpbubble(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 85
//HelpOverlay (HelpOverlay)
package {
import flash.display.*;
public class HelpOverlay {
static var currentType:String;
static var displayTimer:Number;
static var textQueue:Array;
static var displayedFlags:Array;
static var fps:Number;
static var overlayMC:MovieClip;
static var displayingFlag:Boolean;
static var allowHelpFlag:Boolean;
static var typeQueue:Array;
static var main:MovieClip;
public static function DisplayOnce(_arg1:int, _arg2:String, _arg3:String){
if (_arg1 >= 0x0100){
return;
};
if (displayedFlags[_arg1] == 0){
Display(_arg2, _arg3);
displayedFlags[_arg1] = 1;
};
}
public static function IsBeingDisplayed():Boolean{
return (displayingFlag);
}
public static function InitOnce(_arg1:MovieClip, _arg2:Number){
var _local3:int;
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++;
};
}
static function AddToQueue(_arg1:String, _arg2:String){
if ((((allowHelpFlag == false)) && ((_arg1 == "standard")))){
return;
};
typeQueue.push(_arg1);
textQueue.push(_arg2);
}
static function RemoveMovieClip(_arg1:MovieClip):void{
main.removeChild(_arg1);
}
static function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
main.addChild(_arg3);
return (_arg3);
}
static 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 * 4);
currentType = _local1;
if (_local1 == "standard"){
};
};
};
}
public static function Update(_arg1:Number){
UpdateQueue();
if (displayingFlag == true){
displayTimer = (displayTimer - _arg1);
if (displayTimer <= 0){
displayingFlag = false;
displayTimer = 0;
RemoveMovieClip(overlayMC);
overlayMC = null;
};
};
}
public static function Display(_arg1:String, _arg2:String){
if ((((allowHelpFlag == false)) && ((_arg1 == "standard")))){
return;
};
AddToQueue(_arg1, _arg2);
}
}
}//package
Section 86
//HighScore (HighScore)
package {
import flash.events.*;
import flash.display.*;
import com.mindjolt.api.as3.*;
import com.meychi.ascrypt3.*;
import mochi.*;
public class HighScore {
public static const hiscoretype_NONE = 0;
public static const hiscoretype_MOCHI = 1;
public static const hiscoretype_MINDJOLT_VIRAL = 3;
public static const hiscoretype_MINDJOLT = 2;
static var callback:Object;
static var MindJoltViral_mc:MovieClip;
static var mochiConnectIDs:Array;
static var mochiBoardIDs:Array;
static var main:Main;
static var s:int;
static var difficulty:int;
static var mochiMovieClip:MovieClip;
public static function SubmitScore(_arg1:int, _arg2:int, _arg3):void{
s = _arg1;
difficulty = _arg2;
callback = _arg3;
if (Licensors.GetHighScoreType() == hiscoretype_MOCHI){
main.addChild(mochiMovieClip);
MochiScores.showLeaderboard({boardID:mochiBoardIDs[difficulty], score:s, onClose:callback, onError:callback});
};
if (Licensors.GetHighScoreType() == hiscoretype_MINDJOLT_VIRAL){
trace("Submitting Mindjolt HiScore - viral version");
MindJoltViral_mc = new your_score();
MindJoltViral_mc.x = 320;
MindJoltViral_mc.y = 240;
MindJoltViral_mc.scoreText.text = s.toString();
MindJoltViral_mc.nameText.text = "YourName";
MindJoltViral_mc.buttonSubmit.addEventListener(MouseEvent.CLICK, buttonSubmitPressed);
MindJoltViral_mc.buttonHighScores.addEventListener(MouseEvent.CLICK, buttonHighScoresPressed);
MindJoltViral_mc.buttonBack.addEventListener(MouseEvent.CLICK, buttonBackPressed);
MindJoltViral_mc.overlay.visible = false;
Game.main.addChild(MindJoltViral_mc);
};
if (Licensors.GetHighScoreType() == hiscoretype_MINDJOLT){
trace("Submitting Mindjolt HiScore - on mindjolt.com");
if (difficulty == 0){
MindJoltAPI.service.submitScore(s, "story");
} else {
MindJoltAPI.service.submitScore(s, "arcade");
};
callback();
};
}
public static function InitOnce(_arg1:Main){
main = _arg1;
if (Licensors.GetHighScoreType() == hiscoretype_MOCHI){
mochiConnectIDs = new Array();
mochiBoardIDs = new Array();
mochiConnectIDs.push("b9f5609e30c7ca42");
mochiBoardIDs.push("7dd76fda0ac9a0f5");
mochiConnectIDs.push("b9f5609e30c7ca42");
mochiBoardIDs.push("5a5df88cdd44562b");
mochiMovieClip = new MovieClip();
MochiServices.connect(mochiConnectIDs[0], mochiMovieClip, errorFunc);
};
}
public static function Show(_arg1:int):void{
}
static function buttonSubmitPressed(_arg1:MouseEvent){
trace("submit");
MindJoltViral_ScoreSubmitted();
MindJoltViral_mc.buttonSubmit.visible = false;
MindJoltViral_mc.overlay.visible = true;
}
static function buttonBackPressed(_arg1:MouseEvent){
trace("back");
Game.main.removeChild(MindJoltViral_mc);
MindJoltViral_mc = null;
callback();
}
public static function errorFunc(_arg1:Object){
trace("MOCHI ERROR");
}
static function buttonHighScoresPressed(_arg1:MouseEvent){
trace("highscores");
MindJoltSponsoredAPI.openLink(4);
}
public static function MindJoltViral_ScoreSubmitted(){
var _local1:String;
_local1 = MindJoltViral_mc.nameText.text;
if (difficulty == 0){
MindJoltSponsoredAPI.submitScore(_local1, s, "story");
} else {
MindJoltSponsoredAPI.submitScore(_local1, s, "arcade");
};
}
}
}//package
Section 87
//Iris (Iris)
package {
import flash.display.*;
public dynamic class Iris extends MovieClip {
}
}//package
Section 88
//KeyReader (KeyReader)
package {
import flash.events.*;
import flash.display.*;
public class KeyReader {
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;
static var keysPressed:Array;
static var keysDown:Array;
public static function Pressed(_arg1:int):Boolean{
return (keysPressed[_arg1]);
}
static function keyUpListener(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = _arg1.keyCode;
keysDown[_local2] = 0;
}
public static function Down(_arg1:int):Boolean{
return (!((keysDown[_arg1] == 0)));
}
static 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 static 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++;
};
}
public static function InitOnce(_arg1:Stage){
var _local2:int;
_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++;
};
}
}
}//package
Section 89
//LevelDef (LevelDef)
package {
public class LevelDef {
var blockGfx0:int;
var blockGfx1:int;
var blockGfx2:int;
var blockCollection:int;
var blockGfx3:int;
var numBaddies:int;
var blockBaddie:int;
var title:String;
var numPortals:int;
var numCollects:int;
var numCharactersA:int;
var numCharactersB:int;
var numCharactersC:int;
var endCutsceneName:String;
var backgroundScene:String;
public function LevelDef(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:String, _arg8:String, _arg9:String){
numCharactersA = _arg1;
numCharactersB = _arg2;
numCharactersC = _arg3;
numCollects = _arg4;
numBaddies = _arg5;
numPortals = _arg6;
title = _arg9;
blockGfx0 = GraphicObjects.gfx_block1;
blockGfx1 = GraphicObjects.gfx_block2;
blockGfx2 = GraphicObjects.gfx_block3;
blockGfx3 = GraphicObjects.gfx_block4;
blockCollection = GraphicObjects.gfx_blockcake;
blockBaddie = GraphicObjects.gfx_blockbaddie;
backgroundScene = _arg7;
endCutsceneName = _arg8;
}
public function SetBaddieBlock(_arg1:int):void{
blockBaddie = _arg1;
}
public function SetCollectionBlock(_arg1:int):void{
blockCollection = _arg1;
}
public function SetBackgroundBlocks(_arg1:int, _arg2:int, _arg3:int):void{
blockGfx0 = _arg1;
blockGfx1 = _arg2;
blockGfx2 = _arg3;
}
}
}//package
Section 90
//Levels (Levels)
package {
public class Levels {
static var list:Array;
public static function GetLevelDef(_arg1:int):LevelDef{
return (list[_arg1]);
}
public static function InitOnce():void{
var _local1:LevelDef;
list = new Array();
list.push(new LevelDef(0, 0, 1, 4, 0, 0, "", "endcutscenename", "cakes"));
_local1 = new LevelDef(0, 0, 1, 8, 0, 0, "", "endcutscenename", "beers");
_local1.SetCollectionBlock(GraphicObjects.gfx_blockbeer);
list.push(_local1);
_local1 = new LevelDef(0, 0, 1, 0, 4, 4, "forest", "endcutscenename", "bombs in the forest");
_local1.SetBackgroundBlocks(GraphicObjects.gfx_blockground, GraphicObjects.gfx_blocktree, GraphicObjects.gfx_block4);
_local1.SetBaddieBlock(GraphicObjects.gfx_blockbomb);
list.push(_local1);
_local1 = new LevelDef(0, 0, 1, 0, 4, 4, "", "endcutscenename", "baddies in the forest");
_local1.SetBackgroundBlocks(GraphicObjects.gfx_blockground, GraphicObjects.gfx_blocktree, GraphicObjects.gfx_block4);
_local1.SetBaddieBlock(GraphicObjects.gfx_blockbaddie);
list.push(_local1);
_local1 = new LevelDef(0, 0, 1, 4, 0, 0, "", "endcutscenename", "get the boat");
_local1.SetBackgroundBlocks(GraphicObjects.gfx_blockground, GraphicObjects.gfx_blocktree, GraphicObjects.gfx_block4);
_local1.SetCollectionBlock(GraphicObjects.gfx_blockboat);
list.push(_local1);
_local1 = new LevelDef(0, 0, 1, 6, 0, 0, "sea", "endcutscenename", "boat markers");
_local1.SetBackgroundBlocks(GraphicObjects.gfx_blockblue, GraphicObjects.gfx_blockcloud, GraphicObjects.gfx_block2);
_local1.SetCollectionBlock(GraphicObjects.gfx_blockbouy);
list.push(_local1);
_local1 = new LevelDef(0, 0, 1, 8, 0, 0, "", "endcutscenename", "boat plane");
_local1.SetBackgroundBlocks(GraphicObjects.gfx_blockblue, GraphicObjects.gfx_blockcloud, GraphicObjects.gfx_block2);
_local1.SetCollectionBlock(GraphicObjects.gfx_blockplane);
list.push(_local1);
_local1 = new LevelDef(0, 1, 0, 6, 0, 0, "air", "endcutscenename", "");
_local1.SetBackgroundBlocks(GraphicObjects.gfx_blockblue, GraphicObjects.gfx_blockcloud, GraphicObjects.gfx_block2);
_local1.SetCollectionBlock(GraphicObjects.gfx_blockrocket);
list.push(_local1);
_local1 = new LevelDef(0, 1, 0, 6, 0, 0, "space", "endcutscenename", "");
_local1.SetBackgroundBlocks(GraphicObjects.gfx_blockblack, GraphicObjects.gfx_blockpurple, GraphicObjects.gfx_block2);
_local1.SetCollectionBlock(GraphicObjects.gfx_blockplanet);
list.push(_local1);
_local1 = new LevelDef(1, 0, 0, 10, 0, 0, "planet", "endcutscenename", "");
_local1.SetBackgroundBlocks(GraphicObjects.gfx_blockground, GraphicObjects.gfx_blockpurple, GraphicObjects.gfx_block2);
_local1.SetCollectionBlock(GraphicObjects.gfx_blocksheep);
list.push(_local1);
_local1 = new LevelDef(1, 0, 0, 0, 8, 2, "blastoff", "endcutscenename", "boat plane");
_local1.SetBackgroundBlocks(GraphicObjects.gfx_blockblack, GraphicObjects.gfx_blockpurple, GraphicObjects.gfx_block2);
_local1.SetBaddieBlock(GraphicObjects.gfx_blockasteroid);
list.push(_local1);
_local1 = new LevelDef(1, 0, 0, 8, 0, 0, "dessert", "endcutscenename", "boat plane");
_local1.SetBackgroundBlocks(GraphicObjects.gfx_blockground, GraphicObjects.gfx_blocktree, GraphicObjects.gfx_block2);
_local1.SetCollectionBlock(GraphicObjects.gfx_blockbubble);
list.push(_local1);
_local1 = new LevelDef(1, 0, 0, 0, 0, 0, "end", "endcutscenename", "boat plane");
_local1.SetBackgroundBlocks(GraphicObjects.gfx_block3, GraphicObjects.gfx_block4, GraphicObjects.gfx_blockblue);
_local1.SetCollectionBlock(GraphicObjects.gfx_blockboat);
list.push(_local1);
}
public static function GetNumLevels():int{
return (list.length);
}
}
}//package
Section 91
//levelUp (levelUp)
package {
import flash.display.*;
public dynamic class levelUp extends MovieClip {
}
}//package
Section 92
//levelupSFX (levelupSFX)
package {
import flash.media.*;
public dynamic class levelupSFX extends Sound {
}
}//package
Section 93
//Licensors (Licensors)
package {
import flash.display.*;
import com.mindjolt.api.as3.*;
public class Licensors {
public static const LICENSOR_MINDJOLT_VIRAL = 11;
public static const LICENSOR_BIGFISH = 7;
public static const LICENSOR_KONGREGATE = 1;
public static const LICENSOR_MINDJOLT = 4;
public static const LICENSOR_DOOF = 3;
public static const LICENSOR_MINICLIP = 2;
public static const LICENSOR_MINIJUEGOS = 10;
public static const LICENSOR_GAMEZHERO = 8;
public static const LICENSOR_ADDICTINGGAMES = 9;
public static const LICENSOR_NONE = 0;
public static const LICENSOR_NONOBA = 5;
public static const LICENSOR_OURWORLD = 6;
static var licensor:int = 4;
public static function InitOnce(_arg1:Stage):void{
if (licensor == LICENSOR_MINDJOLT){
MindJoltSponsoredAPI.connect("1849D2ZF", "9DE8545D89F2E04A", _arg1);
if (SiteLock.GetDomainFromStage(_arg1) != "mindjolt.com"){
licensor = LICENSOR_MINDJOLT_VIRAL;
};
};
}
public static function GetHighScoreType():int{
if (licensor == LICENSOR_MINDJOLT){
return (HighScore.hiscoretype_MINDJOLT);
};
if (licensor == LICENSOR_MINDJOLT_VIRAL){
return (HighScore.hiscoretype_MINDJOLT_VIRAL);
};
return (HighScore.hiscoretype_MOCHI);
}
public static function GetLicensor():int{
return (licensor);
}
public static function CanUseMochiAds():Boolean{
if (licensor == LICENSOR_NONE){
return (true);
};
if (licensor == LICENSOR_KONGREGATE){
return (true);
};
if (licensor == LICENSOR_MINICLIP){
return (false);
};
if (licensor == LICENSOR_DOOF){
return (false);
};
if (licensor == LICENSOR_MINDJOLT){
return (true);
};
if (licensor == LICENSOR_MINDJOLT_VIRAL){
return (false);
};
if (licensor == LICENSOR_NONOBA){
return (true);
};
if (licensor == LICENSOR_OURWORLD){
return (false);
};
if (licensor == LICENSOR_BIGFISH){
return (false);
};
if (licensor == LICENSOR_GAMEZHERO){
return (false);
};
if (licensor == LICENSOR_ADDICTINGGAMES){
return (false);
};
if (licensor == LICENSOR_MINIJUEGOS){
return (true);
};
return (true);
}
public static function SetLicensor(_arg1:int):void{
licensor = _arg1;
}
public static function IsHosted():Boolean{
if (licensor == LICENSOR_NONE){
return (false);
};
if (licensor == LICENSOR_ADDICTINGGAMES){
if (SiteLock.GetDomain() == "addictinggames.com"){
return (true);
};
return (false);
};
if (licensor == LICENSOR_KONGREGATE){
if (SiteLock.GetDomain() == "kongregate.com"){
return (true);
};
return (false);
};
if (licensor == LICENSOR_MINICLIP){
if (SiteLock.GetDomain() == "miniclip.com"){
return (true);
};
return (false);
};
if (licensor == LICENSOR_DOOF){
if (SiteLock.GetDomain() == "doof.com"){
return (true);
};
return (false);
};
if (licensor == LICENSOR_MINDJOLT){
return (false);
};
return (false);
}
}
}//package
Section 94
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
import flash.ui.*;
public class Main extends MovieClip {
var tf_small:TextFormat;
public var tf_scorespr:TextFormat;
public var tf_scorespr2:TextFormat;
var cheatMode:Boolean;
var tf_large:TextFormat;
var levelTimer:Number;
public var tf_scoresprwhite:TextFormat;
var ftime:Number;
public var tf_scorespr1:TextFormat;
private var screenB:Bitmap;
public var backgroundMC:MovieClip;
var levelTimerMax:Number;
public var mochiScores;
var debugMode:Boolean;// = false
public var screenBD:BitmapData;
var gameState:int;// = 0
var currentTime:Number;// = 0
public var tf_scoresprblack:TextFormat;
static const gameState_HIGHSCORES = 5;
public static const gameState_TITLE = 0;
static const gameState_LEVEL_PLAY = 2;
public static var theStage:Stage;
static var theRoot:MovieClip;
public function Main(){
currentTime = 0;
debugMode = false;
gameState = gameState_TITLE;
super();
theRoot = this;
theStage = this.root.stage;
SetEverythingUpOnce();
}
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;
}
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);
}
function InitLevel(){
InitStageForGame();
Overlay.StartFadeIn(null);
Particles.Reset();
Mouse.hide();
MouseControl.Reset();
Particles.Reset();
GameObjects.ClearAll();
Game.InitLevel();
}
public function DoMochiBot(_arg1:int){
if (_arg1 == 0){
MochiBot.track(this, "6beb2290");
};
if (_arg1 == 1){
MochiBot.track(this, "04823266");
};
if (_arg1 == 2){
MochiBot.track(this, "7fb114f0");
};
if (_arg1 == 3){
MochiBot.track(this, "38d6a04a");
};
if (_arg1 == 4){
MochiBot.track(this, "3e047035");
};
if (_arg1 == 5){
MochiBot.track(this, "8fa8291b");
};
}
function run(_arg1:Event):void{
KeyReader.UpdateOncePerFrame();
calcFrameTime();
Overlay.Update();
switch (gameState){
case gameState_TITLE:
TitleScreenState.Update(this);
break;
case gameState_HIGHSCORES:
break;
case gameState_LEVEL_PLAY:
RunLevel();
break;
};
}
function RunTitle(){
}
function SetEverythingUpOnce():void{
trace("SetEverythingUpOnce");
addEventListener(Event.ENTER_FRAME, run);
MusicPlayer.InitOnce();
KeyReader.InitOnce(theStage);
MouseControl.InitOnce(theStage);
SoundPlayer.InitOnce(this);
PauseMenu.InitOnce(this);
Tutorial.InitOnce(this);
Particles.InitOnce(this, 1000);
GameObjects.InitOnce(this, 300);
InitDrawScreen();
InitFonts();
GraphicObjects.InitOnce(this);
Overlay.InitOnce(this, null, null);
HelpOverlay.InitOnce(this, Defs.fps);
HighScore.InitOnce(this);
DoMochiBot(0);
Levels.InitOnce();
InitStage();
Game.Init(this);
SetGameState(gameState_TITLE);
}
function InitFonts():void{
var _local1:Font;
tf_large = new TextFormat();
tf_small = new TextFormat();
_local1 = new Font20();
tf_large.font = _local1.fontName;
tf_large.size = 45;
tf_large.color = 4294967295;
tf_small.font = _local1.fontName;
tf_small.size = 16;
tf_small.color = 4294967295;
tf_scorespr = new TextFormat();
tf_scorespr1 = new TextFormat();
tf_scorespr2 = new TextFormat();
tf_scoresprblack = new TextFormat();
tf_scoresprwhite = new TextFormat();
tf_scorespr.font = _local1.fontName;
tf_scorespr.size = 28;
tf_scorespr.color = 4288806912;
tf_scorespr2.font = _local1.fontName;
tf_scorespr2.size = 16;
tf_scorespr2.color = 4288806912;
tf_scoresprwhite.font = _local1.fontName;
tf_scoresprwhite.size = 32;
tf_scoresprwhite.color = 4294967295;
tf_scorespr1.font = _local1.fontName;
tf_scorespr1.size = 14;
tf_scorespr1.color = 4294967295;
tf_scoresprblack.font = _local1.fontName;
tf_scoresprblack.size = 16;
tf_scoresprblack.color = 4278190080;
}
function InitStage(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
addChild(screenB);
screenB.x = 0;
screenB.y = 0;
}
function Render(){
this.x = 0;
this.y = 0;
screenBD.fillRect(new Rectangle(0, 0, Defs.displayarea_w, Defs.displayarea_h), 0);
GameObjects.Render();
Game.Render();
Particles.Render(this);
Game.RenderPanel();
}
function InitDrawScreen():void{
screenBD = new BitmapData(Defs.displayarea_w, Defs.displayarea_h, true, 0);
screenB = new Bitmap(screenBD);
}
function InitStageNoBackground(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
}
function InitStageForGame(){
var _local1:int;
_local1 = (this.numChildren - 1);
while (_local1 >= 0) {
removeChildAt(_local1);
_local1--;
};
backgroundMC = new Background_albert();
addChild(backgroundMC);
addChild(screenB);
screenB.x = 0;
screenB.y = 0;
}
function SetGameState(_arg1:int):void{
gameState = _arg1;
Mouse.show();
switch (gameState){
case gameState_TITLE:
TitleScreenState.Init(this);
break;
case gameState_HIGHSCORES:
break;
case gameState_LEVEL_PLAY:
InitLevel();
break;
};
}
function RunLevel(){
HelpOverlay.Update(ftime);
if (PauseMenu.IsPaused() == false){
Game.UpdateGameplay();
};
Render();
}
function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
addChild(_arg3);
return (_arg3);
}
}
}//package
Section 95
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.7");
}
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?cacheBust=") + new Date().getTime()));
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 fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 96
//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 97
//MouseControl (MouseControl)
package {
import flash.events.*;
import flash.display.*;
public class MouseControl {
public static var mouseVelX:Number = 0;
public static var mouseVelY:Number = 0;
public static var mouseOldPosX:Number = 0;
public static var mouseOldPosY:Number = 0;
public static var mousePosX:Number = 0;
public static var mousePosY:Number = 0;
public static var buttonPressed:Boolean = false;
public static var buttonReleased:Boolean = false;
public static function MouseHandler(_arg1:MouseEvent):void{
mousePosX = _arg1.stageX;
mousePosY = _arg1.stageY;
mouseVelX = (mousePosX - mouseOldPosX);
mouseVelY = (mousePosY - mouseOldPosY);
mouseOldPosX = mousePosX;
mouseOldPosY = mousePosY;
}
public static function InitOnce(_arg1:Stage):void{
_arg1.addEventListener(MouseEvent.MOUSE_MOVE, MouseHandler);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, MouseClickHandler);
_arg1.addEventListener(MouseEvent.MOUSE_UP, MouseUpHandler);
}
public static function MouseUpHandler(_arg1:MouseEvent):void{
buttonPressed = false;
buttonReleased = true;
}
public static function Reset():void{
buttonPressed = false;
buttonReleased = false;
}
public static function MouseClickHandler(_arg1:MouseEvent):void{
buttonPressed = true;
buttonReleased = false;
}
}
}//package
Section 98
//MusicPlayer (MusicPlayer)
package {
import flash.events.*;
import flash.media.*;
public class MusicPlayer {
static var musicChannel:SoundChannel = null;
static var musicSound1:Sound;
static var musicSoundTransform:SoundTransform;
static var musicSound:Sound;
static var musicSoundTransform1:SoundTransform;
static var lastMusicID = -1;
static var musicChannel1:SoundChannel = null;
static var currentMusicID:int = -1;
static var doMusic:Boolean = true;
public static function PauseMusic(){
musicChannel.stop();
}
public static function StartMusic(_arg1:int){
if (doMusic == false){
return;
};
if (musicChannel != null){
musicChannel.stop();
};
if (musicChannel1 != null){
musicChannel1.stop();
};
if (_arg1 == 0){
musicSoundTransform = new SoundTransform(0.75, 0);
musicSound = new titleTune();
musicChannel = musicSound.play(0, 999999, musicSoundTransform);
};
if (_arg1 == 1){
musicSoundTransform = new SoundTransform(0.5, 0);
musicSound = new Tune1();
musicChannel = musicSound.play(0, 1, musicSoundTransform);
};
if (_arg1 == 2){
musicSoundTransform = new SoundTransform(0.5, 0);
musicSound = new Tune2();
musicChannel = musicSound.play(0, 1, musicSoundTransform);
};
if (_arg1 == 3){
musicSoundTransform = new SoundTransform(0.5, 0);
musicSound = new Tune3();
musicChannel = musicSound.play(0, 1, musicSoundTransform);
};
if (_arg1 == 4){
musicSoundTransform = new SoundTransform(0.5, 0);
musicSound = new Tune4();
musicChannel = musicSound.play(0, 1, musicSoundTransform);
};
musicChannel.addEventListener(Event.SOUND_COMPLETE, soundComplete);
lastMusicID = _arg1;
}
static function soundComplete(_arg1:Event){
var _local2:int;
trace("sound");
_local2 = Utils.RandBetweenInt(0, 3);
StartMusic((1 + _local2));
}
public static function InitOnce():void{
doMusic = true;
lastMusicID = -1;
currentMusicID = -1;
}
public static function ResumeMusic(){
currentMusicID = (lastMusicID - 1);
StartMusic(lastMusicID);
}
}
}//package
Section 99
//Overlay (Overlay)
package {
import flash.display.*;
public class Overlay {
static var callback:Object;
static var parent:MovieClip;
static var fadingOut:Boolean;
static var mcOut:MovieClip;
static var mcIn:MovieClip;
static var fadingIn:Boolean;
public static function InitOnce(_arg1:MovieClip, _arg2:MovieClip, _arg3:MovieClip){
fadingIn = false;
fadingOut = false;
AddClips(_arg1, _arg2, _arg3);
}
public static 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 static function StartFadeIn(_arg1:Object):void{
if (mcIn == null){
return;
};
callback = _arg1;
parent.addChild(mcIn);
mcIn.gotoAndStop(0);
fadingIn = true;
}
public static function AddClips(_arg1:MovieClip, _arg2:MovieClip, _arg3:MovieClip):void{
mcIn = _arg3;
mcOut = _arg2;
parent = _arg1;
}
public static function IsActive():Boolean{
if (fadingIn == true){
return (true);
};
if (fadingOut == true){
return (true);
};
return (false);
}
public static function StartFadeOut(_arg1:Object):void{
if (mcOut == null){
return;
};
callback = _arg1;
parent.addChild(mcOut);
mcOut.gotoAndStop(0);
fadingOut = true;
}
}
}//package
Section 100
//Particle (Particle)
package {
class Particle {
var graphicID:int;
public var yvel:Number;
var timer:Number;
var active:Boolean;
var maxframe:int;
var counter:int;
var speed:Number;
var xpos:Number;
var alpha:Number;
var alphaAdd:Number;
public var xvel:Number;
var m:Main;
var frame:Number;
var frameVel:Number;
var visible:Boolean;
var type:int;
var ypos:Number;
function PlayAnimation(_arg1):Boolean{
frame = (frame + frameVel);
if (frame >= maxframe){
frame = maxframe;
return (true);
};
return (false);
}
function Update(_arg1:Number){
var _local2:Number;
var _local3:Number;
_local3 = 0.02;
if (type == Particles.type_block_explode){
xpos = (xpos + (xvel * _arg1));
ypos = (ypos + (yvel * _arg1));
if (PlayAnimation(m) == true){
active = false;
};
};
if (type == Particles.type_block_explode1){
if (PlayAnimation(m) == true){
active = false;
};
};
}
}
}//package
Section 101
//Particle_Red (Particle_Red)
package {
import flash.display.*;
public dynamic class Particle_Red extends MovieClip {
}
}//package
Section 102
//Particle_White (Particle_White)
package {
import flash.display.*;
public dynamic class Particle_White extends MovieClip {
}
}//package
Section 103
//Particles (Particles)
package {
import flash.geom.*;
public class Particles {
public static const type_block_explode1 = 1;
public static const type_block_explode = 0;
static var max:int;
static var main:Main;
static var list:Array;
static var nextIndex:int;
public function Particles():void{
}
public static function Add(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number):Particle{
var _local5:Number;
var _local6:Number;
var _local7:Particle;
_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.visible = true;
if (_arg1 == type_block_explode){
_local7.xpos = _arg2;
_local7.ypos = _arg3;
_local7.graphicID = GraphicObjects.gfx_particle_white;
_local7.frame = Utils.RandBetweenInt(20, 30);
_local7.frameVel = 1;
};
if (_arg1 == type_block_explode1){
_local7.xpos = _arg2;
_local7.ypos = _arg3;
_local7.graphicID = GraphicObjects.gfx_blockparticle;
_local7.frame = 0;
_local7.frameVel = 1;
};
_local7.maxframe = (GraphicObjects.GetNumFrames(_local7.graphicID) - 1);
return (_local7);
}
public static function GetNextIndex():int{
return (nextIndex);
}
public static function Reset(){
var _local1:int;
nextIndex = 0;
_local1 = 0;
while (_local1 < max) {
list[_local1].active = false;
_local1++;
};
}
public static 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++;
};
}
public static function InitOnce(_arg1:Main, _arg2:int):void{
var _local3:int;
main = _arg1;
max = _arg2;
nextIndex = 0;
list = new Array(max);
_local3 = 0;
while (_local3 < max) {
list[_local3] = new Particle();
list[_local3].active = false;
_local3++;
};
}
public static 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 static function Render(_arg1:Main){
var _local2:int;
var _local3:Particle;
var _local4:Number;
var _local5:Number;
_local2 = 0;
while (_local2 < max) {
_local3 = list[_local2];
if (((_local3.active) && (_local3.visible))){
_local4 = _local3.xpos;
_local5 = _local3.ypos;
GraphicObjects.RenderAt(_local3.graphicID, _local3.frame, _arg1.screenBD, _local4, _local5);
};
_local2++;
};
}
}
}//package
Section 104
//PauseMenu (PauseMenu)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import flash.net.*;
import flash.ui.*;
public class PauseMenu {
static var active:Boolean;
static var pauseMC:MovieClip;
static var main:Main;
public function PauseMenu():void{
}
static function InitButtonStates(){
pauseMC.buttonMusicSelected.visible = MusicPlayer.doMusic;
pauseMC.buttonSFXSelected.visible = SoundPlayer.doSFX;
}
public static function buttonPressed_Quit(_arg1:MouseEvent){
Unpause();
Game.main.SetGameState(Main.gameState_TITLE);
}
public static function IsPaused():Boolean{
return (active);
}
public static function buttonPressed_SFX(_arg1:MouseEvent){
SoundPlayer.doSFX = ToggleBool(SoundPlayer.doSFX);
InitButtonStates();
}
public static function buttonHelpPressed(_arg1:MouseEvent){
}
public static function InitOnce(_arg1:Main):void{
main = _arg1;
active = false;
}
public static function Unpause():void{
Mouse.hide();
active = false;
main.removeChild(pauseMC);
}
public static 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);
active = true;
InitButtonStates();
}
public static function buttonPressed_Resume(_arg1:MouseEvent){
Unpause();
}
public static function buttonPressed_Music(_arg1:MouseEvent){
MusicPlayer.doMusic = ToggleBool(MusicPlayer.doMusic);
if (MusicPlayer.doMusic == false){
MusicPlayer.PauseMusic();
};
if (MusicPlayer.doMusic == true){
MusicPlayer.ResumeMusic();
};
InitButtonStates();
}
static function ToggleBool(_arg1:Boolean):Boolean{
if (_arg1 == true){
return (false);
};
return (true);
}
static function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{
_arg3.x = _arg1;
_arg3.y = _arg2;
main.addChild(_arg3);
return (_arg3);
}
}
}//package
Section 105
//PauseMenuPage (PauseMenuPage)
package {
import flash.display.*;
public dynamic class PauseMenuPage extends MovieClip {
public var buttonSFX:SimpleButton;
public var buttonMusic:SimpleButton;
public var buttonQuit:SimpleButton;
public var buttonSFXSelected:MovieClip;
public var buttonMusicSelected:MovieClip;
public var buttonResume:SimpleButton;
}
}//package
Section 106
//Portal (Portal)
package {
import flash.display.*;
public dynamic class Portal extends MovieClip {
}
}//package
Section 107
//SiteLock (SiteLock)
package {
import flash.events.*;
import flash.display.*;
public class SiteLock {
static var miniclip_locked:Boolean = false;
static var sitelockActive:Boolean = false;
public static function GetDomainFromStage(_arg1:Stage):String{
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:String;
var _local6:Number;
var _local7:Number;
_local2 = _arg1.loaderInfo.url;
_local3 = (_local2.indexOf("://") + 3);
_local4 = _local2.indexOf("/", _local3);
_local5 = _local2.substring(_local3, _local4);
_local6 = (_local5.lastIndexOf(".") - 1);
_local7 = (_local5.lastIndexOf(".", _local6) + 1);
_local5 = _local5.substring(_local7, _local5.length);
return (_local5);
}
public static function InitOnce():void{
}
public static function IsLocked():Boolean{
var _local1:String;
if (Licensors.GetLicensor() == Licensors.LICENSOR_MINIJUEGOS){
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_ADDICTINGGAMES){
_local1 = GetDomain();
if (_local1 != "addictinggames.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_GAMEZHERO){
_local1 = GetDomain();
if (_local1 != "gamezhero.com"){
return (true);
};
return (false);
};
if (Licensors.GetLicensor() == Licensors.LICENSOR_BIGFISH){
_local1 = GetDomain();
if (((((((((((!((_local1 == "bigfishgames.com"))) && (!((_local1 == "bigfishgames.de"))))) && (!((_local1 == "bigfishgames.fr"))))) && (!((_local1 == "bigfishgames.es"))))) && (!((_local1 == "bigfishgames.mx"))))) && (!((_local1 == "bigfishgames.jp"))))){
return (true);
};
return (false);
};
return (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 GetDomainFromUrl(_arg1:String):String{
var _local2:Number;
var _local3:Number;
var _local4:String;
var _local5:Number;
var _local6:Number;
_local2 = (_arg1.indexOf("://") + 3);
_local3 = _arg1.indexOf("/", _local2);
_local4 = _arg1.substring(_local2, _local3);
_local5 = (_local4.lastIndexOf(".") - 1);
_local6 = (_local4.lastIndexOf(".", _local5) + 1);
_local4 = _local4.substring(_local6, _local4.length);
return (_local4);
}
static function onInvalidDomain(_arg1:Event):void{
trace("Miniclip sitelock INVALID");
miniclip_locked = true;
}
static function onValidDomain(_arg1:Event):void{
trace("Miniclip sitelock OK");
miniclip_locked = false;
}
}
}//package
Section 108
//slurpSFX (slurpSFX)
package {
import flash.media.*;
public dynamic class slurpSFX extends Sound {
}
}//package
Section 109
//SoundPlayer (SoundPlayer)
package {
import flash.media.*;
import flash.utils.*;
public class SoundPlayer {
public static const SOUND_BOING = 7;
public static const SOUND_SLURP = 3;
public static const minPlayTime = 3;
public static const SOUND_MAX = 6;
public static const SOUND_LEVELUP = 0;
public static const SOUND_YAWN = 6;
static const maxSounds = 6;
public static const SOUND_COLLECT = 1;
public static const SOUND_EAT = 2;
public static const SOUND_ALIGNMENT = 7;
public static const SOUND_BOMB = 5;
public static const SOUND_VORTEX = 4;
static var channel:SoundChannel;
public static var startTimes:Array;
static var active = false;
public static var sound:Sound;
public static var soundTransform:SoundTransform;
static var main:Main;
static var playingFlag:Boolean;
public static var sounds:Array;
static var timer:Timer;
public static var lengths:Array;
static var Instances:Array;
static var doSFX:Boolean;
static function AddSound(_arg1:Number, _arg2:Number){
startTimes.push((_arg1 * 1000));
lengths.push((_arg2 * 1000));
sounds.push(null);
}
public static function InitOnce(_arg1:Main):void{
var _local2:int;
var _local3:SoundPlay;
doSFX = true;
main = _arg1;
Instances = new Array(maxSounds);
_local2 = 0;
while (_local2 < maxSounds) {
_local3 = new SoundPlay();
_local3.Clear();
Instances[_local2] = _local3;
_local2++;
};
startTimes = new Array();
lengths = new Array();
sounds = new Array();
AddSound1(new levelupSFX());
AddSound1(new boingSFX());
AddSound1(new chompSFX());
AddSound1(new slurpSFX());
AddSound1(new vortexSFX());
AddSound1(new bombSFX());
AddSound1(new yawnSFX());
AddSound1(new boingSFX());
soundTransform = new SoundTransform(1, 0);
active = true;
playingFlag = false;
}
public static function Play(_arg1:int):void{
var _local2:SoundTransform;
var _local3:Sound;
var _local4:int;
var _local5:SoundPlay;
if (doSFX == false){
return;
};
if (sounds[_arg1] != null){
_local3 = sounds[_arg1];
_local2 = new SoundTransform();
_local3.play();
} else {
_local4 = 0;
while (_local4 < maxSounds) {
_local5 = Instances[_local4];
if (_local5.Active() == false){
_local5.Play(_arg1);
return;
};
_local4++;
};
};
}
static function AddSound1(_arg1:Sound){
sounds.push(_arg1);
startTimes.push(0);
lengths.push(0);
}
}
}//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 110
//speechBubble (speechBubble)
package {
import flash.display.*;
public dynamic class speechBubble extends MovieClip {
}
}//package
Section 111
//timerBack (timerBack)
package {
import flash.display.*;
public dynamic class timerBack extends MovieClip {
}
}//package
Section 112
//TitlePage (TitlePage)
package {
import flash.display.*;
public dynamic class TitlePage extends MovieClip {
}
}//package
Section 113
//TitleScreenState (TitleScreenState)
package {
import flash.events.*;
import flash.display.*;
import com.mindjolt.api.as3.*;
import com.meychi.ascrypt3.*;
import flash.net.*;
public class TitleScreenState {
static var titleMC:MovieClip;
static var main:Main;
static function buttonLongAnimalsPressed(_arg1:MouseEvent){
trace("here");
navigateToURL(new URLRequest("http://www.longanimalsgames.com"), "_blank");
}
public static function buttonPracticeModePressed(_arg1:MouseEvent){
main.DoMochiBot(3);
Game.gamemode_StoryMode = false;
Game.gamemode_PracticeMode = true;
Game.InitGame();
main.SetGameState(Main.gameState_LEVEL_PLAY);
}
public static function buttonHardPressed(_arg1:MouseEvent){
}
static function buttonMindJoltLogoPressed(_arg1:MouseEvent){
trace("here2");
MindJoltSponsoredAPI.openLink(6);
}
static function buttonMoreGamesPressed(_arg1:MouseEvent){
trace("here1");
MindJoltSponsoredAPI.openLink(2);
}
public static function Update(_arg1:Main){
}
public static function buttonStartPressed(_arg1:MouseEvent){
main.DoMochiBot(5);
Game.gamemode_StoryMode = true;
Game.InitGame();
main.SetGameState(Main.gameState_LEVEL_PLAY);
}
static function buttonHighScoresPressed(_arg1:MouseEvent){
trace("highscores");
MindJoltSponsoredAPI.openLink(3);
}
public static function buttonEasyPressed(_arg1:MouseEvent){
}
public static function buttonHelpPressed(_arg1:MouseEvent){
}
public static function Init(_arg1:Main){
main = _arg1;
MusicPlayer.StartMusic(0);
main.InitStage();
titleMC = main.AddMovieClip(0, 0, new Background());
titleMC.playGame.addEventListener(MouseEvent.CLICK, buttonStartPressed);
titleMC.viewScores.addEventListener(MouseEvent.CLICK, buttonHighScoresPressed);
titleMC.moreGames.addEventListener(MouseEvent.CLICK, buttonMoreGamesPressed);
titleMC.buttonArcadeMode.addEventListener(MouseEvent.CLICK, buttonArcadeModePressed);
titleMC.buttonPracticeMode.addEventListener(MouseEvent.CLICK, buttonPracticeModePressed);
titleMC.buttonDevLink.addEventListener(MouseEvent.CLICK, buttonLongAnimalsPressed);
titleMC.mjLogo.addEventListener(MouseEvent.CLICK, buttonMindJoltLogoPressed);
if (Licensors.GetLicensor() == Licensors.LICENSOR_MINDJOLT){
titleMC.viewScores.visible = false;
};
UpdateRadioButtons();
}
public static function MovieFinished(){
Game.InitGame();
main.SetGameState(Main.gameState_LEVEL_PLAY);
}
static function UpdateRadioButtons(){
}
public static function buttonMediumPressed(_arg1:MouseEvent){
}
public static function buttonArcadeModePressed(_arg1:MouseEvent){
main.DoMochiBot(4);
Game.gamemode_StoryMode = false;
Game.gamemode_PracticeMode = false;
Game.InitGame();
main.SetGameState(Main.gameState_LEVEL_PLAY);
}
}
}//package
Section 114
//titleTune (titleTune)
package {
import flash.media.*;
public dynamic class titleTune extends Sound {
}
}//package
Section 115
//Tune1 (Tune1)
package {
import flash.media.*;
public dynamic class Tune1 extends Sound {
}
}//package
Section 116
//Tune2 (Tune2)
package {
import flash.media.*;
public dynamic class Tune2 extends Sound {
}
}//package
Section 117
//Tune3 (Tune3)
package {
import flash.media.*;
public dynamic class Tune3 extends Sound {
}
}//package
Section 118
//Tune4 (Tune4)
package {
import flash.media.*;
public dynamic class Tune4 extends Sound {
}
}//package
Section 119
//Tutorial (Tutorial)
package {
import flash.display.*;
import flash.ui.*;
public class Tutorial {
static var mc:MovieClip;
static var main:Main;
static var active:Boolean;
public function PauseMenu():void{
}
public static function Stop():void{
Mouse.hide();
active = false;
main.removeChild(mc);
}
public static function InitOnce(_arg1:Main):void{
main = _arg1;
active = false;
}
public static function Start():void{
Mouse.show();
mc = new TutorialScreen();
mc.x = 0;
mc.y = 0;
main.addChild(mc);
active = true;
}
public static function IsPaused():Boolean{
return (active);
}
}
}//package
Section 120
//TutorialScreen (TutorialScreen)
package {
import flash.display.*;
public dynamic class TutorialScreen extends MovieClip {
public var speech:MovieClip;
public function TutorialScreen(){
addFrameScript(0, frame1, 134, frame135, 247, frame248, 370, frame371, 489, frame490, 616, frame617, 730, frame731);
}
function frame731(){
speech.gotoAndStop(7);
}
function frame1(){
speech.gotoAndStop(1);
}
function frame617(){
speech.gotoAndStop(6);
}
function frame248(){
speech.gotoAndStop(3);
}
function frame490(){
speech.gotoAndStop(5);
}
function frame135(){
speech.gotoAndStop(2);
}
function frame371(){
speech.gotoAndStop(4);
}
}
}//package
Section 121
//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);
}
static function SideOfLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Boolean{
var _local7:Number;
_local7 = DotProduct((_arg3 - _arg1), (_arg4 - _arg2), (_arg5 - _arg1), (_arg6 - _arg2));
if (_local7 < 0){
return (false);
};
return (true);
}
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++;
};
}
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 RandBetweenInt(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = (Math.random() * ((_arg2 - _arg1) + 1));
_local3 = (_local3 + _arg1);
return (_local3);
}
static function DotProduct(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
_local5 = ((_arg1 * _arg3) + (_arg2 * _arg4));
return (_local5);
}
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 DotProductAng(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
_local5 = Math.cos(_arg2);
_local6 = Math.sin(_arg2);
_local7 = ((_local3 * _local5) + (_local4 * _local6));
return (_local7);
}
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))));
}
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 ScaleBetween(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
_local4 = ((_arg2 - _arg1) * _arg3);
_local4 = (_arg1 + _local4);
return (_local4);
}
}
}//package
Section 122
//vortexSFX (vortexSFX)
package {
import flash.media.*;
public dynamic class vortexSFX extends Sound {
}
}//package
Section 123
//yawnSFX (yawnSFX)
package {
import flash.media.*;
public dynamic class yawnSFX extends Sound {
}
}//package
Section 124
//your_score (your_score)
package {
import flash.display.*;
import flash.text.*;
public dynamic class your_score extends MovieClip {
public var buttonHighScores:SimpleButton;
public var buttonBack:SimpleButton;
public var overlay:MovieClip;
public var nameText:TextField;
public var scoreText:TextField;
public var buttonSubmit:SimpleButton;
}
}//package