Section 1
//HelpBTN (pg.bubblegame.assets.btn.HelpBTN)
package pg.bubblegame.assets.btn {
import pg.bubblegame.*;
import flash.events.*;
import flash.display.*;
public class HelpBTN extends SimpleButton {
private var _bubbleGame:BubbleGame;
public function HelpBTN(_arg1:BubbleGame){
_bubbleGame = _arg1;
this.addEventListener(Event.ADDED, onAdded);
}
private function onClick(_arg1:MouseEvent):void{
_bubbleGame.drawHelp();
}
private function onAdded(_arg1:Event):void{
this.addEventListener(MouseEvent.CLICK, onClick);
}
}
}//package pg.bubblegame.assets.btn
Section 2
//NewGameBtn (pg.bubblegame.assets.btn.NewGameBtn)
package pg.bubblegame.assets.btn {
import flash.display.*;
public class NewGameBtn extends MovieClip {
}
}//package pg.bubblegame.assets.btn
Section 3
//PickGirlBTN (pg.bubblegame.assets.btn.PickGirlBTN)
package pg.bubblegame.assets.btn {
import pg.bubblegame.*;
import flash.events.*;
import flash.display.*;
public class PickGirlBTN extends SimpleButton {
private var _playZone:PlayZone;
public function PickGirlBTN(_arg1:PlayZone){
_playZone = _arg1;
this.addEventListener(Event.ADDED, onAdded);
}
private function onClick(_arg1:MouseEvent):void{
_playZone.bubbleGame.drawLogOut();
}
private function onAdded(_arg1:Event):void{
this.addEventListener(MouseEvent.CLICK, onClick);
}
}
}//package pg.bubblegame.assets.btn
Section 4
//PlayNextBTN (pg.bubblegame.assets.btn.PlayNextBTN)
package pg.bubblegame.assets.btn {
import flash.display.*;
public class PlayNextBTN extends MovieClip {
}
}//package pg.bubblegame.assets.btn
Section 5
//PlayVideoBTN (pg.bubblegame.assets.btn.PlayVideoBTN)
package pg.bubblegame.assets.btn {
import flash.display.*;
public class PlayVideoBTN extends SimpleButton {
public function PlayVideoBTN(_arg1:DisplayObject=null, _arg2:DisplayObject=null, _arg3:DisplayObject=null, _arg4:DisplayObject=null){
super(_arg1, _arg2, _arg3, _arg4);
}
}
}//package pg.bubblegame.assets.btn
Section 6
//ReplayBTN (pg.bubblegame.assets.btn.ReplayBTN)
package pg.bubblegame.assets.btn {
import flash.display.*;
public class ReplayBTN extends SimpleButton {
}
}//package pg.bubblegame.assets.btn
Section 7
//SoundBTN (pg.bubblegame.assets.btn.SoundBTN)
package pg.bubblegame.assets.btn {
import flash.display.*;
public class SoundBTN extends MovieClip {
}
}//package pg.bubblegame.assets.btn
Section 8
//StartMenuBTN (pg.bubblegame.assets.btn.StartMenuBTN)
package pg.bubblegame.assets.btn {
import flash.display.*;
public class StartMenuBTN extends MovieClip {
public var chems_btn:SimpleButton;
public var morgane_btn:SimpleButton;
public var jana_btn:SimpleButton;
public var monica_btn:SimpleButton;
public var lilly_btn:SimpleButton;
}
}//package pg.bubblegame.assets.btn
Section 9
//WirtualGirlHDBTN (pg.bubblegame.assets.btn.WirtualGirlHDBTN)
package pg.bubblegame.assets.btn {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class WirtualGirlHDBTN extends SimpleButton {
public function WirtualGirlHDBTN(){
this.addEventListener(Event.ADDED, onAdded);
}
private function onAdded(_arg1:Event):void{
this.addEventListener(MouseEvent.CLICK, onMouseClick);
}
private function onMouseClick(_arg1:MouseEvent):void{
var url:String;
var e = _arg1;
switch (e.currentTarget.name){
case "monicahd_btn":
url = " http://c.actiondesk.com/?s=43872&p=26&pp=1&g=44";
break;
case "lillyhd_btn":
url = " http://c.actiondesk.com/?s=43872&p=26&pp=1&g=70";
break;
case "janahd_btn":
url = "http://c.actiondesk.com/?s=43872&p=26&pp=1&g=84";
break;
case "morganehd_btn":
url = "http://c.actiondesk.com/?s=43872&p=26&pp=1&g=449";
break;
case "chemshd_btn":
url = "http://c.actiondesk.com/?s=43872&p=26&pp=1&g=490";
break;
default:
url = "http://gamcore.com";
break;
};
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
}
}//package pg.bubblegame.assets.btn
Section 10
//ChemsFlv (pg.bubblegame.assets.flv.ChemsFlv)
package pg.bubblegame.assets.flv {
import flash.events.*;
import flash.display.*;
import pg.bubblegame.assets.btn.*;
import flash.net.*;
public class ChemsFlv extends MovieClip {
public var virtualgirlhdbaner_btn:SimpleButton;
public var gamecore_btn:SimpleButton;
public var chemshd_btn:WirtualGirlHDBTN;
public function ChemsFlv(){
virtualgirlhdbaner_btn.addEventListener(Event.ADDED, onAdded);
gamecore_btn.addEventListener(Event.ADDED, onAdded);
}
private function onAdded(_arg1:Event):void{
virtualgirlhdbaner_btn.addEventListener(MouseEvent.CLICK, onClick);
gamecore_btn.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(_arg1:MouseEvent):void{
var url:String;
var e = _arg1;
switch (e.currentTarget.name){
case "virtualgirlhdbaner_btn":
url = "http://c.actiondesk.com/?s=43872&p=26&pp=1";
break;
case "gamecore_btn":
url = "http://gamcore.com";
break;
default:
url = "http://gamcore.com";
break;
};
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
}
}//package pg.bubblegame.assets.flv
Section 11
//JanaFlv (pg.bubblegame.assets.flv.JanaFlv)
package pg.bubblegame.assets.flv {
import flash.events.*;
import flash.display.*;
import pg.bubblegame.assets.btn.*;
import flash.net.*;
public class JanaFlv extends MovieClip {
public var janahd_btn:WirtualGirlHDBTN;
public var virtualgirlhdbaner_btn:SimpleButton;
public var gamecore_btn:SimpleButton;
public function JanaFlv(){
virtualgirlhdbaner_btn.addEventListener(Event.ADDED, onAdded);
gamecore_btn.addEventListener(Event.ADDED, onAdded);
}
private function onAdded(_arg1:Event):void{
virtualgirlhdbaner_btn.addEventListener(MouseEvent.CLICK, onClick);
gamecore_btn.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(_arg1:MouseEvent):void{
var url:String;
var e = _arg1;
switch (e.currentTarget.name){
case "virtualgirlhdbaner_btn":
url = "http://c.actiondesk.com/?s=43872&p=26&pp=1";
break;
case "gamecore_btn":
url = "http://gamcore.com";
break;
default:
url = "http://gamcore.com";
break;
};
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
}
}//package pg.bubblegame.assets.flv
Section 12
//LillyFlv (pg.bubblegame.assets.flv.LillyFlv)
package pg.bubblegame.assets.flv {
import flash.events.*;
import flash.display.*;
import pg.bubblegame.assets.btn.*;
import flash.net.*;
public class LillyFlv extends MovieClip {
public var lillyhd_btn:WirtualGirlHDBTN;
public var virtualgirlhdbaner_btn:SimpleButton;
public var gamecore_btn:SimpleButton;
public function LillyFlv(){
virtualgirlhdbaner_btn.addEventListener(Event.ADDED, onAdded);
gamecore_btn.addEventListener(Event.ADDED, onAdded);
}
private function onAdded(_arg1:Event):void{
virtualgirlhdbaner_btn.addEventListener(MouseEvent.CLICK, onClick);
gamecore_btn.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(_arg1:MouseEvent):void{
var url:String;
var e = _arg1;
switch (e.currentTarget.name){
case "virtualgirlhdbaner_btn":
url = "http://c.actiondesk.com/?s=43872&p=26&pp=1";
break;
case "gamecore_btn":
url = "http://gamcore.com";
break;
default:
url = "http://gamcore.com";
break;
};
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
}
}//package pg.bubblegame.assets.flv
Section 13
//MonicaFlv (pg.bubblegame.assets.flv.MonicaFlv)
package pg.bubblegame.assets.flv {
import flash.events.*;
import flash.display.*;
import pg.bubblegame.assets.btn.*;
import flash.net.*;
public class MonicaFlv extends MovieClip {
public var monicahd_btn:WirtualGirlHDBTN;
public var virtualgirlhdbaner_btn:SimpleButton;
public var gamecore_btn:SimpleButton;
public function MonicaFlv(){
virtualgirlhdbaner_btn.addEventListener(Event.ADDED, onAdded);
gamecore_btn.addEventListener(Event.ADDED, onAdded);
}
private function onAdded(_arg1:Event):void{
virtualgirlhdbaner_btn.addEventListener(MouseEvent.CLICK, onClick);
gamecore_btn.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(_arg1:MouseEvent):void{
var url:String;
var e = _arg1;
switch (e.currentTarget.name){
case "virtualgirlhdbaner_btn":
url = "http://c.actiondesk.com/?s=43872&p=26&pp=1";
break;
case "gamecore_btn":
url = "http://gamcore.com";
break;
default:
url = "http://gamcore.com";
break;
};
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
}
}//package pg.bubblegame.assets.flv
Section 14
//MorganeFlv (pg.bubblegame.assets.flv.MorganeFlv)
package pg.bubblegame.assets.flv {
import flash.events.*;
import flash.display.*;
import pg.bubblegame.assets.btn.*;
import flash.net.*;
public class MorganeFlv extends MovieClip {
public var virtualgirlhdbaner_btn:SimpleButton;
public var morganehd_btn:WirtualGirlHDBTN;
public var gamecore_btn:SimpleButton;
public function MorganeFlv(){
virtualgirlhdbaner_btn.addEventListener(Event.ADDED, onAdded);
gamecore_btn.addEventListener(Event.ADDED, onAdded);
}
private function onAdded(_arg1:Event):void{
virtualgirlhdbaner_btn.addEventListener(MouseEvent.CLICK, onClick);
gamecore_btn.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(_arg1:MouseEvent):void{
var url:String;
var e = _arg1;
switch (e.currentTarget.name){
case "virtualgirlhdbaner_btn":
url = "http://c.actiondesk.com/?s=43872&p=26&pp=1";
break;
case "gamecore_btn":
url = "http://gamcore.com";
break;
default:
url = "http://gamcore.com";
break;
};
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
}
}//package pg.bubblegame.assets.flv
Section 15
//AimMC (pg.bubblegame.assets.mc.AimMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
public class AimMC extends MovieClip {
}
}//package pg.bubblegame.assets.mc
Section 16
//BanerMC (pg.bubblegame.assets.mc.BanerMC)
package pg.bubblegame.assets.mc {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class BanerMC extends MovieClip {
public var virtualgirlhdbaner_btn:SimpleButton;
public var gamecore_btn:SimpleButton;
public function BanerMC(){
virtualgirlhdbaner_btn.addEventListener(Event.ADDED, onAdded);
gamecore_btn.addEventListener(Event.ADDED, onAdded);
}
private function onAdded(_arg1:Event):void{
virtualgirlhdbaner_btn.addEventListener(MouseEvent.CLICK, onClick);
gamecore_btn.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(_arg1:MouseEvent):void{
var url:String;
var e = _arg1;
switch (e.currentTarget.name){
case "virtualgirlhdbaner_btn":
url = "http://c.actiondesk.com/?s=43872&p=26&pp=1";
break;
case "gamecore_btn":
url = "http://gamcore.com";
break;
default:
url = "http://gamcore.com";
break;
};
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
}
}//package pg.bubblegame.assets.mc
Section 17
//BubbleMC (pg.bubblegame.assets.mc.BubbleMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
public class BubbleMC extends MovieClip {
}
}//package pg.bubblegame.assets.mc
Section 18
//ChemsMC (pg.bubblegame.assets.mc.ChemsMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
public class ChemsMC extends MovieClip {
public function ChemsMC(){
addFrameScript(0, frame1);
super();
}
function frame1(){
stop();
}
}
}//package pg.bubblegame.assets.mc
Section 19
//FrameMC (pg.bubblegame.assets.mc.FrameMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
public class FrameMC extends MovieClip {
}
}//package pg.bubblegame.assets.mc
Section 20
//HelpMC (pg.bubblegame.assets.mc.HelpMC)
package pg.bubblegame.assets.mc {
import pg.bubblegame.*;
import flash.events.*;
import flash.display.*;
public class HelpMC extends Sprite {
public var play_btn:SimpleButton;
private var _bubbleGame:BubbleGame;
public function HelpMC(_arg1:BubbleGame){
play_btn.addEventListener(Event.ADDED, onAdded);
_bubbleGame = _arg1;
}
private function onAdded(_arg1:Event):void{
play_btn.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
}
private function onClick(_arg1:MouseEvent):void{
_bubbleGame.closeHelp();
}
}
}//package pg.bubblegame.assets.mc
Section 21
//JanaMC (pg.bubblegame.assets.mc.JanaMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
public class JanaMC extends MovieClip {
public function JanaMC(){
addFrameScript(0, frame1);
super();
}
function frame1(){
stop();
}
}
}//package pg.bubblegame.assets.mc
Section 22
//LevelMC (pg.bubblegame.assets.mc.LevelMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
import flash.text.*;
public class LevelMC extends MovieClip {
public var txt:TextField;
}
}//package pg.bubblegame.assets.mc
Section 23
//LillyMC (pg.bubblegame.assets.mc.LillyMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
public class LillyMC extends MovieClip {
public function LillyMC(){
addFrameScript(0, frame1);
super();
}
function frame1(){
stop();
}
}
}//package pg.bubblegame.assets.mc
Section 24
//LogOutMC (pg.bubblegame.assets.mc.LogOutMC)
package pg.bubblegame.assets.mc {
import pg.bubblegame.*;
import flash.events.*;
import flash.display.*;
public class LogOutMC extends Sprite {
public var yesBTN:SimpleButton;
public var noBTN:SimpleButton;
private var _bubbleGame:BubbleGame;
public function LogOutMC(_arg1:BubbleGame){
_bubbleGame = _arg1;
this.addEventListener(Event.ADDED, onAdded);
}
private function onAdded(_arg1:Event):void{
yesBTN.addEventListener(MouseEvent.CLICK, onClickYes);
noBTN.addEventListener(MouseEvent.CLICK, onClickNo);
}
private function onClickNo(_arg1:MouseEvent):void{
_bubbleGame.closeHelp();
}
private function onClickYes(_arg1:MouseEvent):void{
_bubbleGame.closeLogOut();
}
}
}//package pg.bubblegame.assets.mc
Section 25
//MoicaMC (pg.bubblegame.assets.mc.MoicaMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
public class MoicaMC extends MovieClip {
public function MoicaMC(){
addFrameScript(0, frame1);
super();
}
function frame1(){
stop();
}
}
}//package pg.bubblegame.assets.mc
Section 26
//MorganeMC (pg.bubblegame.assets.mc.MorganeMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
public class MorganeMC extends MovieClip {
public function MorganeMC(){
addFrameScript(0, frame1);
super();
}
function frame1(){
stop();
}
}
}//package pg.bubblegame.assets.mc
Section 27
//ScoreMC (pg.bubblegame.assets.mc.ScoreMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
import flash.text.*;
public class ScoreMC extends MovieClip {
public var txt:TextField;
}
}//package pg.bubblegame.assets.mc
Section 28
//ShooterMC (pg.bubblegame.assets.mc.ShooterMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
public class ShooterMC extends MovieClip {
}
}//package pg.bubblegame.assets.mc
Section 29
//StartLogoMC (pg.bubblegame.assets.mc.StartLogoMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
public class StartLogoMC extends MovieClip {
}
}//package pg.bubblegame.assets.mc
Section 30
//ToBadMC (pg.bubblegame.assets.mc.ToBadMC)
package pg.bubblegame.assets.mc {
import flash.display.*;
public class ToBadMC extends Sprite {
}
}//package pg.bubblegame.assets.mc
Section 31
//BgSound (pg.bubblegame.assets.snd.BgSound)
package pg.bubblegame.assets.snd {
import flash.media.*;
public class BgSound extends Sound {
}
}//package pg.bubblegame.assets.snd
Section 32
//Drop (pg.bubblegame.assets.snd.Drop)
package pg.bubblegame.assets.snd {
import flash.media.*;
public class Drop extends Sound {
}
}//package pg.bubblegame.assets.snd
Section 33
//Floating (pg.bubblegame.assets.snd.Floating)
package pg.bubblegame.assets.snd {
import flash.media.*;
public class Floating extends Sound {
}
}//package pg.bubblegame.assets.snd
Section 34
//Shoot (pg.bubblegame.assets.snd.Shoot)
package pg.bubblegame.assets.snd {
import flash.media.*;
public class Shoot extends Sound {
}
}//package pg.bubblegame.assets.snd
Section 35
//DrawRect (pg.bubblegame.draw.DrawRect)
package pg.bubblegame.draw {
import flash.display.*;
public class DrawRect extends Sprite {
private var _radius:Number;
private var _color:uint;
private var _w:Number;
private var _h:Number;
public function DrawRect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:uint=0xFFFFFF, _arg6:Number=0){
this.x = _arg1;
this.y = _arg2;
_w = _arg3;
_h = _arg4;
_color = _arg5;
_radius = _arg6;
init();
}
private function init():void{
this.graphics.beginFill(_color);
this.graphics.lineStyle(3, _color, 1);
this.graphics.moveTo(_radius, 0);
this.graphics.lineTo((_w - _radius), 0);
if (_radius){
this.graphics.curveTo(_w, 0, _w, _radius);
};
this.graphics.lineTo(_w, (_h - _radius));
if (_radius){
this.graphics.curveTo(_w, _h, (_w - _radius), _h);
};
this.graphics.lineTo(_radius, _h);
if (_radius){
this.graphics.curveTo(0, _h, 0, (_h - _radius));
};
this.graphics.lineTo(0, _radius);
if (_radius){
this.graphics.curveTo(0, 0, _radius, 0);
};
this.graphics.endFill();
}
}
}//package pg.bubblegame.draw
Section 36
//Bubble (pg.bubblegame.Bubble)
package pg.bubblegame {
import flash.events.*;
import flash.display.*;
import pg.bubblegame.assets.mc.*;
public class Bubble extends Sprite {
private var _anchorX:Number;
private var _anchorY:Number;
private var _gravity:Number;
private var _destVy:Number;
private var _bubble:BubbleMC;
private var _spring:Number;
private var _rate:Number;
private var _id:uint;
private var _destScale:Number;
private var _easing:Number;
private var _friction:Number;
private var _playZone:PlayZone;
private var _vx:Number;
private var _vy:Number;
private var _degrees:Number;
private var _r:Number;
private var _v:Number;
private var _ids:Array;
public function Bubble(_arg1:PlayZone, _arg2:uint, _arg3:Number, _arg4:Number=0, _arg5:Number=0){
_playZone = _arg1;
_id = _arg2;
_r = _arg3;
_anchorX = _arg4;
_anchorY = _arg5;
this.x = _arg4;
this.y = _arg5;
_easing = 0.05;
_spring = 0.05;
_friction = 0.999;
_gravity = 0.1;
_rate = 0.75;
_v = (_r / 2);
init();
}
public function floating():void{
this.alpha = ((Math.random() * 0.3) + 0.2);
_vx = ((Math.random() * 16) - 8);
_vy = 0;
_destScale = (this.scaleX * (Math.random() + 1.1));
_destVy = ((-(Math.random()) * 0.5) - 0.5);
this.addEventListener(Event.ENTER_FRAME, floatUp);
if (((_playZone.bubbleGame.sounds.on) && (_playZone.floatSound))){
_playZone.bubbleGame.sounds.float.play();
_playZone.floatSound = false;
};
}
public function checkIsolated(_arg1:uint):void{
var _local5:uint;
var _local2:int;
var _local3:int;
var _local4:uint;
_local4 = 0;
_local2 = 0;
while (_local2 < _playZone.row) {
_local3 = 0;
while (_local3 < _playZone.col) {
if (_playZone.map[_local2][_local3]){
_playZone.mark[_local2][_local3] = 1;
} else {
_playZone.mark[_local2][_local3] = 0;
};
_local3++;
};
_local2++;
};
_local2 = 0;
while (_local2 < _playZone.col) {
if (_playZone.map[0][_local2]){
_playZone.mark[0][_local2] = 0;
markCircle(0, _local2);
_local4 = (_local4 + 1);
};
_local2++;
};
_local4 = 0;
_local2 = 0;
while (_local2 < _playZone.row) {
_local3 = 0;
while (_local3 < _playZone.col) {
if (_playZone.mark[_local2][_local3]){
_playZone.map[_local2][_local3] = 0;
_playZone.bubbleMap[_local2][_local3].drop();
_playZone.bubbleMap[_local2][_local3] = null;
_local4 = (_local4 + 1);
};
_local3++;
};
_local2++;
};
_local5 = (_arg1 + _local4);
if (_local5 < 4){
_playZone.addScore((_local5 * _playZone.level));
} else {
_playZone.addScore(((_local5 + (_local5 - 3)) * _playZone.level));
};
}
private function checkConnection(_arg1:int, _arg2:int):void{
var _local6:int;
var _local7:int;
var _local8:Array;
var _local9:uint;
var _local10:uint;
var _local11:Bubble;
var _local3:uint;
var _local4:uint;
var _local5:uint;
_local3 = 0;
while (_local3 < _playZone.row) {
_local4 = 0;
while (_local4 < _playZone.col) {
if (_playZone.map[_local3][_local4]){
_playZone.mark[_local3][_local4] = 1;
} else {
_playZone.mark[_local3][_local4] = 0;
};
_local4 = (_local4 + 1);
};
_local3 = (_local3 + 1);
};
_ids = [];
checkCircle(_arg1, _arg2);
if (_ids.length >= 3){
_local5 = 0;
while (_local5 < _ids.length) {
_local3 = _ids[_local5][0];
_local4 = _ids[_local5][1];
_playZone.map[_local3][_local4] = 0;
_playZone.bubbleMap[_local3][_local4].floating();
_playZone.bubbleMap[_local3][_local4] = null;
_local5 = (_local5 + 1);
};
_playZone.healthReward();
checkIsolated(uint(_ids.length));
} else {
if (_id == 5){
_local6 = 0;
_local7 = 0;
_local8 = new Array();
_local9 = _playZone.bubbleGame.bubbleColors.length;
_local10 = 1;
if ((_arg1 % 2)){
_local8 = _playZone.oddCircle;
} else {
_local8 = _playZone.evenCircle;
};
_local3 = 0;
while (_local3 < _local8.length) {
_local6 = (_arg1 + _local8[_local3][0]);
_local7 = (_arg2 + _local8[_local3][1]);
if ((((((((_local6 >= 0)) && ((_local6 < _playZone.row)))) && ((_local7 >= 0)))) && ((_local7 < _playZone.col)))){
if (_playZone.map[_local6][_local7] == 0){
_local10 = (Math.floor((Math.random() * _local9)) + 1);
_local11 = new Bubble(_playZone, _local10, _r);
_local11.setXY(_local6, _local7);
_playZone.map[_local6][_local7] = _local10;
_playZone.bubbleMap[_local6][_local7] = _local11;
_playZone.addChild(_local11);
};
};
_local3++;
};
};
_playZone.healthCut();
};
_playZone.next();
}
private function init():void{
var _local1:String;
this.cacheAsBitmap = true;
_local1 = _playZone.bubbleGame.allBubbleColors[(_id - 1)];
_bubble = new BubbleMC();
_bubble.gotoAndStop(_local1);
this.scaleX = ((_r / _bubble.width) * 0.99);
this.scaleY = ((_r / _bubble.width) * 0.99);
this.addChild(_bubble);
}
private function checkSuperConnection(_arg1:int, _arg2:int):void{
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:Array;
var _local3:uint;
var _local4:int;
if (_id == 10){
_local3 = 0;
while (_local3 < _playZone.row) {
if (_playZone.map[_local3][_arg2]){
_playZone.map[_local3][_arg2] = 0;
_playZone.bubbleMap[_local3][_arg2].floating();
_playZone.bubbleMap[_local3][_arg2] = null;
_local4++;
};
_local3++;
};
if (_local4 == 1){
_local5 = (_arg2 + 1);
_local6 = (_arg2 - 1);
if (_degrees < 90){
if (_local5 < _playZone.col){
_local3 = 0;
while (_local3 < _playZone.row) {
if (_playZone.map[_local3][_local5]){
_playZone.map[_local3][_local5] = 0;
_playZone.bubbleMap[_local3][_local5].floating();
_playZone.bubbleMap[_local3][_local5] = null;
_local4++;
};
_local3++;
};
};
if (_local4 == 1){
_local3 = 0;
while (_local3 < _playZone.row) {
if (_playZone.map[_local3][_local6]){
_playZone.map[_local3][_local6] = 0;
_playZone.bubbleMap[_local3][_local6].floating();
_playZone.bubbleMap[_local3][_local6] = null;
_local4++;
};
_local3++;
};
};
} else {
if (_local6 >= 0){
_local3 = 0;
while (_local3 < _playZone.row) {
if (_playZone.map[_local3][_local6]){
_playZone.map[_local3][_local6] = 0;
_playZone.bubbleMap[_local3][_local6].floating();
_playZone.bubbleMap[_local3][_local6] = null;
_local4++;
};
_local3++;
};
};
if (_local4 == 1){
_local3 = 0;
while (_local3 < _playZone.row) {
if (_playZone.map[_local3][_local5]){
_playZone.map[_local3][_local5] = 0;
_playZone.bubbleMap[_local3][_local5].floating();
_playZone.bubbleMap[_local3][_local5] = null;
_local4++;
};
_local3++;
};
};
};
};
} else {
if (_id == 9){
_local3 = 0;
while (_local3 < _playZone.col) {
if (_playZone.map[_arg1][_local3]){
_playZone.map[_arg1][_local3] = 0;
_playZone.bubbleMap[_arg1][_local3].floating();
_playZone.bubbleMap[_arg1][_local3] = null;
_local4++;
};
_local3++;
};
} else {
if (_id == 11){
_local7 = 0;
_local8 = 0;
_local9 = new Array();
_local4 = 1;
if ((_arg1 % 2)){
_local9 = _playZone.oddCircle;
} else {
_local9 = _playZone.evenCircle;
};
_local3 = 0;
while (_local3 < _local9.length) {
_local7 = (_arg1 + _local9[_local3][0]);
_local8 = (_arg2 + _local9[_local3][1]);
if ((((((((_local7 >= 0)) && ((_local7 < _playZone.row)))) && ((_local8 >= 0)))) && ((_local8 < _playZone.col)))){
if (_playZone.map[_local7][_local8]){
_playZone.map[_local7][_local8] = 0;
_playZone.bubbleMap[_local7][_local8].floating();
_playZone.bubbleMap[_local7][_local8] = null;
_local4++;
};
};
_local3++;
};
_playZone.map[_arg1][_arg2] = 0;
_playZone.bubbleMap[_arg1][_arg2].floating();
_playZone.bubbleMap[_arg1][_arg2] = null;
};
};
};
checkIsolated(_local4);
_playZone.next();
}
private function floatUp(_arg1:Event):void{
var _local2:Number = ((_destScale - this.scaleX) * _easing);
var _local3:Number = ((_destVy - _vy) * _easing);
if (_local2 != 0){
if (_local2 < 0.01){
this.scaleY = _destScale;
this.scaleX = _destScale;
};
this.scaleX = (this.scaleX + _local2);
this.scaleY = (this.scaleY + _local2);
};
if (_local3 != 0){
if (_local3 < 0.1){
_vy = _destVy;
};
if (_vy == _destVy){
_vx = 0;
};
_vy = (_vy + _local3);
this.x = (this.x + _vx);
};
this.y = (this.y + _vy);
if (this.y < ((_r * this.scaleX) / 2)){
this.removeEventListener(Event.ENTER_FRAME, floatUp);
_playZone.removeChild(this);
};
}
public function setId(_arg1:Number):void{
_id = _arg1;
var _local2:String = _playZone.bubbleColors[(_id - 1)];
_bubble.gotoAndStop(_local2);
}
private function launchBubble(_arg1:Event):void{
var _local2:Number = (this.x - _anchorX);
_vy = (_vy + (_gravity + 0.2));
this.x = (this.x + _vx);
this.y = (this.y + _vy);
if (_local2 < 0.1){
this.x = _anchorX;
this.y = _anchorY;
this.removeEventListener(Event.ENTER_FRAME, launchBubble);
_playZone.readyForShoot = true;
_playZone.shooter.next.alpha = 0.8;
};
}
private function checkOverlap(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Array{
var _local5:Array;
var _local6:Array;
var _local7:int;
var _local8:int;
_arg1 = (_arg1 - _arg3);
_arg2 = (_arg2 - _arg4);
var _local9:Number = _arg1;
var _local10:Number = _arg2;
if (_arg1 < ((_r / 2) * _rate)){
_arg1 = ((_r / 2) * _rate);
_arg2 = (((_arg4 / _arg3) * (_arg1 - _local9)) + _local10);
_arg3 = (_arg3 * -1);
} else {
if (_arg1 > (_playZone.w - ((_r / 2) * _rate))){
_arg1 = (_playZone.w - ((_r / 2) * _rate));
_arg2 = (((_arg4 / _arg3) * (_arg1 - _local9)) + _local10);
_arg3 = (_arg3 * -1);
};
};
_local5 = getRowCol(_arg1, _arg2);
_local7 = _local5[0];
_local8 = _local5[1];
if (_playZone.map[_local7][_local8]){
_local6 = checkOverlap(_arg1, _arg2, _arg3, _arg4);
return (_local6);
};
return (_local5);
}
private function createBubble(_arg1:Number, _arg2:Number):void{
if (_id == 12){
if (_playZone.id == 12){
(_id == 2);
} else {
_id = _playZone.id;
};
};
var _local3:Bubble = new Bubble(_playZone, _id, _r);
_local3.setXY(_arg1, _arg2);
_playZone.map[_arg1][_arg2] = _id;
_playZone.bubbleMap[_arg1][_arg2] = _local3;
_playZone.addChild(_local3);
if ((((((_id == 10)) || ((_id == 9)))) || ((_id == 11)))){
checkSuperConnection(_arg1, _arg2);
} else {
checkConnection(_arg1, _arg2);
};
}
public function removeBubble():void{
_playZone.removeChild(this);
}
public function overrideSetId(_arg1:Number):void{
_id = _arg1;
var _local2:String = _playZone.bubbleGame.allBubbleColors[(_id - 1)];
_bubble.gotoAndStop(_local2);
}
private function dropDown(_arg1:Event):void{
_vy = (_vy + _gravity);
this.y = (this.y + _vy);
if (this.y > _playZone.h){
if (((_playZone.bubbleGame.sounds.on) && (_playZone.dropSound))){
_playZone.bubbleGame.sounds.drop.play();
_playZone.dropSound = false;
};
_playZone.removeChild(this);
this.removeEventListener(Event.ENTER_FRAME, dropDown);
};
}
public function launch():void{
this.y = _anchorY;
this.x = (_anchorX + 45);
this.alpha = 1;
_vx = -2.5;
_vy = -3;
this.addEventListener(Event.ENTER_FRAME, launchBubble);
}
private function getRowCol(_arg1:Number, _arg2:Number):Array{
var _local3:int;
var _local4:int;
_local3 = Math.round(((_arg2 / _r) - 0.5));
if (_local3 >= _playZone.row){
_local3 = (_playZone.row - 1);
} else {
if (_local3 < 0){
_local3 = 0;
};
};
if ((_local3 % 2)){
_local4 = Math.round(((_arg1 / _r) - 1));
} else {
_local4 = Math.round(((_arg1 / _r) - 0.5));
};
if (_local4 < 0){
_local4 = 0;
} else {
if (_local4 >= _playZone.col){
_local4 = (_playZone.col - 1);
};
};
return ([_local3, _local4]);
}
private function move(_arg1:Event):void{
var _local2:Boolean;
var _local3:Boolean;
var _local6:Array;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Array;
var _local13:Array;
var _local14:int;
var _local15:int;
var _local4:Number = this.x;
var _local5:Number = this.y;
var _local7:int;
var _local8:int;
this.x = (this.x + _vx);
this.y = (this.y + _vy);
_local2 = false;
_local3 = false;
if (this.y < 0){
this.alpha = 0;
_local2 = true;
};
_local4 = this.x;
_local5 = this.y;
if (this.x < ((_r / 2) * _rate)){
this.x = ((_r / 2) * _rate);
this.y = (((_vy / _vx) * (this.x - _local4)) + _local5);
_vx = (_vx * -1);
} else {
if (this.x > (_playZone.w - ((_r / 2) * _rate))){
this.x = (_playZone.w - ((_r / 2) * _rate));
this.y = (((_vy / _vx) * (this.x - _local4)) + _local5);
_vx = (_vx * -1);
};
};
if (this.y < _playZone.h){
_local6 = getRowCol(this.x, this.y);
_local7 = _local6[0];
_local8 = _local6[1];
if (_playZone.map[_local7][_local8]){
if (_local7 == (_playZone.row - 1)){
_local3 = true;
} else {
_local12 = checkOverlap(this.x, this.y, (_vx / 2), (_vy / 2));
_local7 = _local12[0];
_local8 = _local12[1];
_local13 = getXY(_local7, _local8);
this.x = _local13[0];
this.y = _local13[1];
};
_local2 = true;
};
if (((!(_local2)) && (!(_local3)))){
_local14 = (_local7 - 1);
while (_local14 <= (_local7 + 1)) {
if ((((_local14 >= 0)) && ((_local14 < _playZone.row)))){
_local15 = (_local8 - 1);
while (_local15 <= (_local8 + 1)) {
if ((((_local15 >= 0)) && ((_local15 < _playZone.col)))){
if (_playZone.map[_local14][_local15]){
_local9 = (this.x - _playZone.bubbleMap[_local14][_local15].x);
_local10 = (this.y - _playZone.bubbleMap[_local14][_local15].y);
_local11 = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
if (_local11 <= (_r * _rate)){
if (_local14 >= (_playZone.row - 1)){
_local3 = true;
};
_local2 = true;
};
};
};
if (_local2){
break;
};
_local15++;
};
};
if (_local2){
break;
};
_local14++;
};
};
if (_local2){
this.alpha = 0;
if (_local3){
_playZone.gameOver();
this.removeEventListener(Event.ENTER_FRAME, move);
} else {
createBubble(_local7, _local8);
};
this.removeEventListener(Event.ENTER_FRAME, move);
};
};
}
private function getXY(_arg1:Number, _arg2:Number):Array{
var _local4:Number;
var _local3:Number = ((_r / 2) + (_arg1 * _r));
if ((_arg1 % 2)){
_local4 = (_r + (_arg2 * _r));
} else {
_local4 = ((_r / 2) + (_arg2 * _r));
};
return ([_local4, _local3]);
}
public function setXY(_arg1:int, _arg2:int):void{
this.y = ((_r / 2) + (_arg1 * _r));
if ((_arg1 % 2)){
this.x = (_r + (_arg2 * _r));
} else {
this.x = ((_r / 2) + (_arg2 * _r));
};
}
public function drop():void{
_vy = 0;
this.addEventListener(Event.ENTER_FRAME, dropDown);
}
private function checkCircle(_arg1:int, _arg2:int):void{
var _local3:int;
var _local4:int;
var _local5:Array = new Array();
if ((_arg1 % 2)){
_local5 = _playZone.oddCircle;
} else {
_local5 = _playZone.evenCircle;
};
var _local6:uint;
while (_local6 < _local5.length) {
_local3 = (_arg1 + _local5[_local6][0]);
_local4 = (_arg2 + _local5[_local6][1]);
if ((((((((_local3 >= 0)) && ((_local3 < _playZone.row)))) && ((_local4 >= 0)))) && ((_local4 < _playZone.col)))){
if (_playZone.mark[_local3][_local4]){
_playZone.mark[_local3][_local4] = 0;
if (_playZone.map[_local3][_local4] == _id){
_ids.push([_local3, _local4]);
checkCircle(_local3, _local4);
};
};
};
_local6++;
};
}
public function shot(_arg1:Number):void{
_vx = (_v * Math.cos(_arg1));
_vy = (_v * Math.sin(_arg1));
this.addEventListener(Event.ENTER_FRAME, move);
_degrees = Math.abs(((_arg1 * 180) / Math.PI));
}
private function markCircle(_arg1:int, _arg2:int):void{
var _local3:int;
var _local4:int;
var _local5:Array = new Array();
if ((_arg1 % 2)){
_local5 = _playZone.oddCircle;
} else {
_local5 = _playZone.evenCircle;
};
var _local6:uint;
while (_local6 < _local5.length) {
_local3 = (_arg1 + _local5[_local6][0]);
_local4 = (_arg2 + _local5[_local6][1]);
if ((((((((_local3 >= 0)) && ((_local3 < _playZone.row)))) && ((_local4 >= 0)))) && ((_local4 < _playZone.col)))){
if (((_playZone.map[_local3][_local4]) && (_playZone.mark[_local3][_local4]))){
_playZone.mark[_local3][_local4] = 0;
markCircle(_local3, _local4);
};
};
_local6++;
};
}
}
}//package pg.bubblegame
Section 37
//BubbleGame (pg.bubblegame.BubbleGame)
package pg.bubblegame {
import flash.events.*;
import flash.display.*;
import pg.bubblegame.assets.btn.*;
import pg.bubblegame.assets.mc.*;
import pg.bubblegame.draw.*;
import flash.text.*;
import flash.ui.*;
public class BubbleGame extends MovieClip {
public var loaded:Number;
public var bar:MovieClip;
public var levelMC:LevelMC;
private var _row:int;
private var _allBubbleColors:Array;
public var aim:AimMC;
private var _border:Number;
public var percent:Number;
private var _girlMC:MovieClip;
private var _playZoneActive:Boolean;
public var loader_info:TextField;
public var helpBTN:HelpBTN;
private var _playZone:PlayZone;
private var _sounds:Sounds;
private var _frame:FrameMC;
private var _shield:Sprite;
private var _colors:int;
private var banerMC:BanerMC;
private var _top:Number;
private var startLogoMc:StartLogoMC;
public var scoreMC:ScoreMC;
public var _mouseCover:Sprite;
private var startMenuBtn:StartMenuBTN;
private var _col:int;
private var _vidLoderPath:String;
public var soundBTN:SoundBTN;
private var _h:Number;
private var _w:Number;
private var _bubbleColors:Array;
public function BubbleGame(){
addFrameScript(0, frame1, 1, frame2);
this.x = 0;
this.y = 0;
stage.addChild(this);
}
private function drawGirl():void{
_girlMC.x = 340;
_girlMC.y = 230;
_frame = new FrameMC();
_frame.x = 2;
_frame.y = 2;
this.addChild(_girlMC);
this.addChild(_frame);
}
public function get playZone():PlayZone{
return (_playZone);
}
private function aimActivated(_arg1:MouseEvent):void{
_playZoneActive = true;
Mouse.hide();
aim.visible = true;
_mouseCover.addEventListener(MouseEvent.MOUSE_MOVE, aimMove);
_playZone.shooter.startRotate();
_arg1.updateAfterEvent();
}
public function set playZone(_arg1:PlayZone):void{
_playZone = _arg1;
}
private function init():void{
_w = 680;
_h = 450;
_col = 20;
_row = 12;
_top = 10;
_border = 10;
_allBubbleColors = ["green", "red", "blue", "yellow", "purple", "gray", "lightblue", "darkyellow", "row", "col", "tnt", "mystery"];
_bubbleColors = ["green", "red"];
_colors = _bubbleColors.length;
drawGirl();
drawLayers();
drawLevel();
drawCanvas();
}
public function set col(_arg1:int):void{
_col = _arg1;
}
public function get bubbleColors():Array{
return (_bubbleColors);
}
private function soundButton(_arg1:MouseEvent):void{
if (_sounds.on){
_sounds.stopPlayBG();
_sounds.on = false;
soundBTN.gotoAndStop("off");
} else {
_sounds.stopPlayBG();
_sounds.on = true;
soundBTN.gotoAndStop("on");
};
}
public function setGirlMCViseble(_arg1:Number):void{
_girlMC.alpha = _arg1;
}
public function set bubbleColors(_arg1:Array):void{
_bubbleColors = _arg1;
}
public function setGirlMC(_arg1:uint):void{
_girlMC.gotoAndStop(_arg1);
}
public function setLevel(_arg1:uint):void{
levelMC.txt.text = String(_arg1);
}
public function get sounds():Sounds{
return (_sounds);
}
private function onreGirlPickUp(_arg1:MouseEvent):void{
switch (_arg1.currentTarget.name){
case "monica_btn":
_girlMC = new MoicaMC();
_vidLoderPath = "monica";
break;
case "lilly_btn":
_girlMC = new LillyMC();
_vidLoderPath = "lilly";
break;
case "jana_btn":
_girlMC = new JanaMC();
_vidLoderPath = "jana";
break;
case "morgane_btn":
_girlMC = new MorganeMC();
_vidLoderPath = "morgane";
break;
case "chems_btn":
_girlMC = new ChemsMC();
_vidLoderPath = "chems";
break;
default:
_girlMC = new JanaMC();
_vidLoderPath = "jana";
break;
};
removereStartMenu();
}
public function hideShield():void{
shield.visible = false;
}
public function setScore(_arg1:uint):void{
scoreMC.txt.text = String(_arg1);
}
public function closeHelp():void{
if (_shield.numChildren != 0){
while (_shield.numChildren) {
_shield.removeChildAt(0);
};
};
hideShield();
}
public function get allBubbleColors():Array{
return (_allBubbleColors);
}
function frame1(){
stop();
bar.addEventListener(Event.ENTER_FRAME, load_progress);
}
function frame2(){
stop();
startMenu();
}
public function load_progress(_arg1:Event):void{
loaded = (stage.loaderInfo.bytesLoaded / stage.loaderInfo.bytesTotal);
percent = Math.round((loaded * 100));
bar.scaleX = loaded;
loader_info.text = (percent + "%");
if ((((percent == 100)) || ((percent > 100)))){
bar.removeEventListener(Event.ENTER_FRAME, load_progress);
bar.visible = false;
loader_info.text = "";
play();
};
}
public function get h():Number{
return (_h);
}
public function get shield():Sprite{
return (_shield);
}
public function get colors():int{
return (_colors);
}
public function get w():Number{
return (_w);
}
private function onNewGameBtnClick(_arg1:MouseEvent):void{
if (_shield.numChildren != 0){
while (_shield.numChildren) {
_shield.removeChildAt(0);
};
};
restartStartMenu();
hideShield();
}
public function get col():int{
return (_col);
}
public function playZoneInactive():void{
if (_playZoneActive){
Mouse.show();
aim.visible = false;
_mouseCover.removeEventListener(MouseEvent.MOUSE_OVER, aimActivated);
_mouseCover.removeEventListener(MouseEvent.MOUSE_OUT, aimInactive);
_mouseCover.removeEventListener(MouseEvent.MOUSE_MOVE, aimMove);
_mouseCover.removeEventListener(MouseEvent.MOUSE_DOWN, shot);
_playZone.shooter.endRotate();
_playZoneActive = false;
} else {
_mouseCover.removeEventListener(MouseEvent.MOUSE_OVER, aimActivated);
_mouseCover.removeEventListener(MouseEvent.MOUSE_OUT, aimInactive);
_mouseCover.removeEventListener(MouseEvent.MOUSE_DOWN, shot);
};
}
public function set sounds(_arg1:Sounds):void{
_sounds = _arg1;
}
public function restartStartMenu():void{
this.removeChild(_girlMC);
_girlMC = null;
_frame.visible = false;
_playZone.visible = false;
levelMC.visible = false;
scoreMC.visible = false;
startLogoMc = new StartLogoMC();
startLogoMc.x = 353;
startLogoMc.y = 226.35;
startMenuBtn = new StartMenuBTN();
startMenuBtn.x = 340.5;
startMenuBtn.y = 199.5;
this.addChild(startLogoMc);
this.addChild(startMenuBtn);
startMenuBtn.monica_btn.addEventListener(MouseEvent.CLICK, onreGirlPickUp);
startMenuBtn.lilly_btn.addEventListener(MouseEvent.CLICK, onreGirlPickUp);
startMenuBtn.jana_btn.addEventListener(MouseEvent.CLICK, onreGirlPickUp);
startMenuBtn.morgane_btn.addEventListener(MouseEvent.CLICK, onreGirlPickUp);
startMenuBtn.chems_btn.addEventListener(MouseEvent.CLICK, onreGirlPickUp);
playZoneInactive();
}
private function onGirlPickUp(_arg1:MouseEvent):void{
switch (_arg1.currentTarget.name){
case "monica_btn":
_girlMC = new MoicaMC();
_vidLoderPath = "monica";
break;
case "lilly_btn":
_girlMC = new LillyMC();
_vidLoderPath = "lilly";
break;
case "jana_btn":
_girlMC = new JanaMC();
_vidLoderPath = "jana";
break;
case "morgane_btn":
_girlMC = new MorganeMC();
_vidLoderPath = "morgane";
break;
case "chems_btn":
_girlMC = new ChemsMC();
_vidLoderPath = "chems";
break;
default:
_girlMC = new JanaMC();
_vidLoderPath = "jana";
break;
};
removeStartMenu();
}
private function drawLevel():void{
levelMC = new LevelMC();
levelMC.x = 20;
levelMC.y = (_h + 20);
levelMC.scaleY = 0.9;
levelMC.scaleX = 0.9;
scoreMC = new ScoreMC();
scoreMC.x = 110;
scoreMC.y = (_h + 20);
scoreMC.scaleY = 0.9;
scoreMC.scaleX = 0.9;
this.addChild(levelMC);
this.addChild(scoreMC);
}
private function newgame(_arg1:MouseEvent):void{
_playZone.newGame();
}
public function closeLogOut():void{
_playZone.dropBubbles();
if (_shield.numChildren != 0){
while (_shield.numChildren) {
_shield.removeChildAt(0);
};
};
restartStartMenu();
hideShield();
}
public function drawHelp():void{
this.setChildIndex(_shield, (this.numChildren - 1));
var _local1:DrawRect = new DrawRect(0, 0, 680, 520, 0);
var _local2:HelpMC = new HelpMC(this);
_shield.visible = true;
_shield.addChild(_local1);
_shield.addChild(_local2);
}
private function drawLayers():void{
aim = new AimMC();
aim.visible = false;
var _local1:Sprite = new Sprite();
_local1.name = "canvas_layer";
this.addChild(_local1);
this.addChild(aim);
}
public function playVideo():void{
drawShield();
}
public function playZoneActivated():void{
if (_playZoneActive){
} else {
_mouseCover.addEventListener(MouseEvent.MOUSE_OVER, aimActivated);
_mouseCover.addEventListener(MouseEvent.MOUSE_OUT, aimInactive);
_mouseCover.addEventListener(MouseEvent.MOUSE_DOWN, shot);
};
}
public function set allBubbleColors(_arg1:Array):void{
_allBubbleColors = _arg1;
}
private function drawCanvas():void{
var _local1:Number = (_w - (_border * 2));
var _local2:Number = ((_local1 * _row) / _col);
var _local3:Sprite = Sprite(this.getChildByName("canvas_layer"));
_local3.x = 10;
_local3.y = _top;
_mouseCover = new Sprite();
_mouseCover.graphics.beginFill(0xFFCC00);
_mouseCover.graphics.drawRect(0, 0, _local1, _local2);
_mouseCover.alpha = 0;
_mouseCover.x = _local3.x;
_mouseCover.y = _local3.y;
_playZone = new PlayZone(this, _local1, _h);
_local3.addChild(_playZone);
addChild(_mouseCover);
_mouseCover.addEventListener(MouseEvent.MOUSE_OVER, aimActivated);
_mouseCover.addEventListener(MouseEvent.MOUSE_OUT, aimInactive);
_mouseCover.addEventListener(MouseEvent.MOUSE_DOWN, shot);
}
private function removeStartMenu():void{
startMenuBtn.monica_btn.removeEventListener(MouseEvent.CLICK, onGirlPickUp);
startMenuBtn.lilly_btn.removeEventListener(MouseEvent.CLICK, onGirlPickUp);
startMenuBtn.jana_btn.removeEventListener(MouseEvent.CLICK, onGirlPickUp);
startMenuBtn.morgane_btn.removeEventListener(MouseEvent.CLICK, onGirlPickUp);
startMenuBtn.chems_btn.removeEventListener(MouseEvent.CLICK, onGirlPickUp);
this.removeChild(startLogoMc);
this.removeChild(startMenuBtn);
startLogoMc = null;
startMenuBtn = null;
init();
}
public function set row(_arg1:int):void{
_row = _arg1;
}
private function aimMove(_arg1:MouseEvent):void{
aim.x = this.mouseX;
aim.y = this.mouseY;
_arg1.updateAfterEvent();
}
public function drawLogOut():void{
this.setChildIndex(_shield, (this.numChildren - 1));
var _local1:DrawRect = new DrawRect(0, 0, 680, 520, 0);
var _local2:LogOutMC = new LogOutMC(this);
_shield.visible = true;
_shield.addChild(_local1);
_shield.addChild(_local2);
}
private function aimInactive(_arg1:MouseEvent):void{
_playZoneActive = false;
Mouse.show();
aim.visible = false;
_mouseCover.removeEventListener(MouseEvent.MOUSE_MOVE, aimMove);
_playZone.shooter.endRotate();
_arg1.updateAfterEvent();
}
private function drawShield():void{
var _local1:DrawRect = new DrawRect(0, 0, _w, (_h + 100), 0);
var _local2:NewGameBtn = new NewGameBtn();
this.setChildIndex(_shield, (this.numChildren - 1));
_shield.visible = true;
_shield.addChild(_local1);
_local2.x = (_local1.width / 2);
_local2.y = (_local1.height - 63);
_local2.buttonMode = true;
var _local3:EmbedFlvLoder = new EmbedFlvLoder(_vidLoderPath);
_local1.addChild(_local3);
_local1.addChild(_local2);
this.setChildIndex(scoreMC, (this.numChildren - 1));
_local2.addEventListener(MouseEvent.CLICK, onNewGameBtnClick);
}
public function set h(_arg1:Number):void{
_h = _arg1;
}
public function set shield(_arg1:Sprite):void{
_shield = _arg1;
}
public function get row():int{
return (_row);
}
public function set colors(_arg1:int):void{
_colors = _arg1;
}
public function startMenu():void{
banerMC = new BanerMC();
banerMC.x = 356;
banerMC.y = 461;
startLogoMc = new StartLogoMC();
startLogoMc.x = 340.65;
startLogoMc.y = 226;
startMenuBtn = new StartMenuBTN();
startMenuBtn.x = 340;
startMenuBtn.y = 199;
_sounds = new Sounds(this);
soundBTN = new SoundBTN();
soundBTN.x = 645;
soundBTN.y = 472;
soundBTN.scaleY = 0.2;
soundBTN.scaleX = 0.2;
soundBTN.buttonMode = true;
soundBTN.gotoAndStop("on");
helpBTN = new HelpBTN(this);
helpBTN.x = 565;
helpBTN.y = 460;
helpBTN.scaleY = 0.7;
helpBTN.scaleX = 0.7;
_shield = new Sprite();
_shield.visible = false;
this.addChild(banerMC);
this.addChild(startLogoMc);
this.addChild(startMenuBtn);
this.addChild(soundBTN);
this.addChild(helpBTN);
this.addChild(_shield);
startMenuBtn.monica_btn.addEventListener(MouseEvent.CLICK, onGirlPickUp);
startMenuBtn.lilly_btn.addEventListener(MouseEvent.CLICK, onGirlPickUp);
startMenuBtn.jana_btn.addEventListener(MouseEvent.CLICK, onGirlPickUp);
startMenuBtn.morgane_btn.addEventListener(MouseEvent.CLICK, onGirlPickUp);
startMenuBtn.chems_btn.addEventListener(MouseEvent.CLICK, onGirlPickUp);
soundBTN.addEventListener(MouseEvent.CLICK, soundButton);
}
private function removereStartMenu():void{
startMenuBtn.monica_btn.removeEventListener(MouseEvent.CLICK, onreGirlPickUp);
startMenuBtn.lilly_btn.removeEventListener(MouseEvent.CLICK, onreGirlPickUp);
startMenuBtn.jana_btn.removeEventListener(MouseEvent.CLICK, onreGirlPickUp);
startMenuBtn.morgane_btn.removeEventListener(MouseEvent.CLICK, onreGirlPickUp);
startMenuBtn.chems_btn.removeEventListener(MouseEvent.CLICK, onreGirlPickUp);
playZoneActivated();
this.removeChild(startLogoMc);
this.removeChild(startMenuBtn);
startLogoMc = null;
startMenuBtn = null;
_girlMC.x = 340;
_girlMC.y = 230;
this.addChildAt(_girlMC, 1);
_frame.visible = true;
_playZone.visible = true;
levelMC.visible = true;
scoreMC.visible = true;
_playZone.restartReplay();
}
public function set w(_arg1:Number):void{
_w = _arg1;
}
public function displayScore():void{
}
private function shot(_arg1:MouseEvent):void{
_playZone.shot();
}
}
}//package pg.bubblegame
Section 38
//EmbedFlvLoder (pg.bubblegame.EmbedFlvLoder)
package pg.bubblegame {
import flash.display.*;
import pg.bubblegame.assets.flv.*;
public class EmbedFlvLoder extends Sprite {
private var _loadFlvMC:String;
private var chems:ChemsFlv;
private var morgane:MorganeFlv;
private var jana:JanaFlv;
private var monica:MonicaFlv;
private var lilly:LillyFlv;
public function EmbedFlvLoder(_arg1:String){
_loadFlvMC = _arg1;
init();
}
private function init():void{
switch (_loadFlvMC){
case "chems":
chems = new ChemsFlv();
this.addChild(chems);
break;
case "jana":
jana = new JanaFlv();
this.addChild(jana);
break;
case "lilly":
lilly = new LillyFlv();
this.addChild(lilly);
break;
case "monica":
monica = new MonicaFlv();
this.addChild(monica);
break;
case "morgane":
morgane = new MorganeFlv();
this.addChild(morgane);
break;
default:
jana = new JanaFlv();
this.addChild(jana);
break;
};
}
}
}//package pg.bubblegame
Section 39
//PlayZone (pg.bubblegame.PlayZone)
package pg.bubblegame {
import flash.events.*;
import flash.display.*;
import pg.bubblegame.assets.btn.*;
import pg.bubblegame.assets.mc.*;
public class PlayZone extends Sprite {
private var _pickGirlBTN:PickGirlBTN;
private var _nextBubbleColors:Array;
private var _count:uint;
private var _row:int;
private var _bubblesOnStage:Array;
private var _evenCircle:Array;
private var _wholeCount:int;
private var _bubbleGame:BubbleGame;
private var _healthCheck:Boolean;
private var _playNextBtnOn:Boolean;
private var _oddCircle:Array;
private var _playVidoBtn:PlayVideoBTN;
private var _nextID:uint;
private var _replayBTN:ReplayBTN;
private var _randomBubblesOnStage:Number;
private var _health:uint;
private var _doubleFlag:Boolean;
private var _level:uint;
private var _healthFlag:Boolean;
private var _healthCutCount:uint;
private var _colors:int;
public var _score:uint;
private var _map:Array;
private var _readyForShoot:Boolean;
private var _playVidoBtnOn:Boolean;
private var _bubble:Bubble;
private var _mark:Array;
private var _bubbleMap:Array;
private var _floatSound:Boolean;
private var _levelStartScore:uint;
private var _id:uint;
private var _shootFlag:Boolean;
private var _col:int;
private var _rewardNotice:Boolean;
private var _shooter:Shooter;
private var _tooBadMC:ToBadMC;
private var _playNextBtn:PlayNextBTN;
private var _dropSound:Boolean;
private var _newGameBTN:NewGameBtn;
private var _h:Number;
private var _rewardFlag:Boolean;
private var _r:Number;
private var _replayBtnOn:Boolean;
private var _w:Number;
private var _bubbleColors:Array;
public function PlayZone(_arg1:BubbleGame, _arg2:Number, _arg3:Number){
this.name = "PlayZone";
_bubbleGame = _arg1;
_w = _arg2;
_h = _arg3;
_col = bubbleGame.col;
_row = bubbleGame.row;
_bubbleColors = _bubbleGame.bubbleColors;
_colors = _bubbleGame.colors;
_nextBubbleColors = ["blue", "yellow", "purple", "gray", "lightblue", "darkyellow"];
_score = 0;
_level = 1;
_map = new Array();
_mark = new Array();
_bubbleMap = new Array();
_oddCircle = [[-1, 0], [-1, 1], [0, -1], [0, 1], [1, 0], [1, 1]];
_evenCircle = [[-1, -1], [-1, 0], [0, -1], [0, 1], [1, -1], [1, 0]];
_rewardNotice = true;
_floatSound = true;
_dropSound = true;
init();
start();
drawPickGirlBTN();
_playNextBtnOn = false;
_playVidoBtnOn = false;
_replayBtnOn = false;
}
public function shot():void{
var _local1:Number = ((_shooter.arrow.rotation / 180) * Math.PI);
if (_readyForShoot){
if (_bubbleGame.sounds.on){
_bubbleGame.sounds.shoot.play();
};
_bubble.shot(_local1);
_readyForShoot = false;
_floatSound = true;
_dropSound = true;
};
}
public function set level(_arg1:uint):void{
_level = _arg1;
}
public function get shooter():Shooter{
return (_shooter);
}
public function set col(_arg1:int):void{
_col = _arg1;
}
public function get floatSound():Boolean{
return (_floatSound);
}
public function set evenCircle(_arg1:Array):void{
_evenCircle = _arg1;
}
public function get count():uint{
return (_count);
}
private function init():void{
_r = (_w / (_col + 0.5));
_score = 0;
_levelStartScore = 0;
_level = 1;
_count = 0;
_wholeCount = 0;
_readyForShoot = false;
_doubleFlag = false;
_shootFlag = false;
_rewardFlag = true;
_healthFlag = false;
_healthCheck = false;
_healthCutCount = 0;
_health = 5;
_nextID = (Math.floor((Math.random() * _colors)) + 1);
var _local1:int;
while (_local1 < _row) {
_bubbleMap[_local1] = new Array();
_mark[_local1] = new Array();
_map[_local1] = new Array();
_local1++;
};
drawShooter();
drawBubbles();
}
public function set shooter(_arg1:Shooter):void{
_shooter = _arg1;
}
public function get id():uint{
return (_id);
}
public function get bubbleColors():Array{
return (_bubbleColors);
}
public function set score(_arg1:uint):void{
_score = _arg1;
}
public function set bubble(_arg1:Bubble):void{
_bubble = _arg1;
}
private function drawShooter():void{
_shooter = new Shooter(this, _r);
_shooter.x = (_w / 2);
_shooter.y = (_h + 25);
this.addChild(_shooter);
}
public function set count(_arg1:uint):void{
_count = _arg1;
}
public function get bubbleMap():Array{
return (_bubbleMap);
}
public function set readyForShoot(_arg1:Boolean):void{
_readyForShoot = _arg1;
}
public function set floatSound(_arg1:Boolean):void{
_floatSound = _arg1;
}
public function set bubbleColors(_arg1:Array):void{
_bubbleColors = _arg1;
}
private function countCheck():void{
var _local1:int;
var _local2:int;
if (_level < 10){
_local1 = (20 - (_level * 2));
} else {
_local1 = 2;
};
if (!_doubleFlag){
if ((_count % _local1) == 0){
if (_count == _local1){
_healthFlag = true;
};
};
if (_count >= (_local1 * 3)){
_doubleFlag = true;
};
};
if (_healthFlag){
_health = 5;
_healthFlag = false;
_healthCheck = true;
};
}
public function set bubbleGame(_arg1:BubbleGame):void{
_bubbleGame = _arg1;
}
public function set wholeCount(_arg1:int):void{
_wholeCount = _arg1;
}
public function set id(_arg1:uint):void{
_id = _arg1;
}
public function healthCut():void{
if (_healthCheck){
if (_health > 0){
_health = (_health - 1);
} else {
_health = 5;
pushBubbles();
if (_rewardFlag){
_healthCutCount = (_healthCutCount + 1);
if (_healthCutCount >= 50){
_rewardFlag = false;
};
};
};
_shootFlag = false;
};
}
public function get nextID():uint{
return (_nextID);
}
public function nextLevel():void{
_bubbleGame.playZoneInactive();
_level++;
_bubbleGame.setScore(_score);
_levelStartScore = _score;
if (_level == 11){
playVideo();
} else {
_shooter.visible = false;
_playNextBtn = new PlayNextBTN();
_playNextBtn.x = (_w / 2);
_playNextBtn.y = (_h + 25);
this.addChild(_playNextBtn);
_playNextBtnOn = true;
_playNextBtn.addEventListener(MouseEvent.CLICK, onNextLevelClick);
_playNextBtn.buttonMode = true;
};
}
public function get map():Array{
return (_map);
}
private function start():void{
_id = (Math.floor((Math.random() * _colors)) + 1);
_bubble = new Bubble(this, _id, _r, (_w / 2), (_h + 25));
this.addChild(_bubble);
_bubbleGame.setScore(_score);
launchShooter();
_bubble.launch();
}
public function get health():uint{
return (_health);
}
public function set bubbleMap(_arg1:Array):void{
_bubbleMap = _arg1;
}
public function get h():Number{
return (_h);
}
public function get dropSound():Boolean{
return (_dropSound);
}
public function addScore(_arg1:uint):void{
_score = (_score + _arg1);
_bubbleGame.setScore(_score);
}
public function get w():Number{
return (_w);
}
public function dropBubbles():void{
var _local1:int;
var _local2:int;
if (((_playNextBtnOn) || (_replayBtnOn))){
} else {
_local1 = 0;
while (_local1 < _row) {
_local2 = 0;
while (_local2 < _col) {
if (_map[_local1][_local2]){
_bubbleMap[_local1][_local2].removeBubble();
};
_local2++;
};
_local1++;
};
};
}
private function onNextLevelClick(_arg1:MouseEvent):void{
_playNextBtn.removeEventListener(MouseEvent.CLICK, onNextLevelClick);
this.removeChild(_playNextBtn);
_bubbleGame.setLevel(_level);
if (_nextBubbleColors.length >= 1){
_bubbleGame.bubbleColors.push(_nextBubbleColors[0]);
_nextBubbleColors.splice(0, 1);
};
_playNextBtnOn = false;
_bubbleGame.playZoneActivated();
_shooter.visible = true;
_bubbleGame.setGirlMC(_level);
playNextLevel();
}
public function get col():int{
return (_col);
}
private function drawBubbles():void{
var _local2:Bubble;
var _local4:uint;
var _local1:int = int(((_row / 2) - 2));
var _local3:uint;
while (_local3 < _row) {
_local4 = 0;
while (_local4 < _col) {
if (_local3 > _local1){
_map[_local3][_local4] = 0;
_bubbleMap[_local3][_local4] = null;
} else {
_map[_local3][_local4] = (Math.floor((Math.random() * _colors)) + 1);
_local2 = new Bubble(this, _map[_local3][_local4], _r);
if ((_local3 % 2)){
_local2.x = (_r + (_local4 * _r));
} else {
_local2.x = ((_r / 2) + (_local4 * _r));
};
_local2.y = ((_r / 2) + (_local3 * _r));
_bubbleMap[_local3][_local4] = _local2;
this.addChild(_local2);
};
_local4++;
};
_local3++;
};
}
private function playNextLevel():void{
_bubbleColors = _bubbleGame.bubbleColors;
_colors = _bubbleColors.length;
_count = 0;
_wholeCount = 0;
_healthCutCount = 0;
_healthFlag = false;
_healthCheck = false;
_doubleFlag = false;
_rewardFlag = true;
_shootFlag = false;
_nextID = (Math.floor((Math.random() * _colors)) + 1);
drawBubbles();
next();
}
private function onReplayClick(_arg1:MouseEvent):void{
_replayBTN.removeEventListener(MouseEvent.CLICK, onReplayClick);
this.removeChild(_replayBTN);
this.removeChild(_tooBadMC);
_replayBtnOn = false;
_bubbleGame.playZoneActivated();
_shooter.visible = true;
_score = _levelStartScore;
_bubbleGame.setScore(_score);
_bubbleGame.setGirlMCViseble(1);
replay();
}
public function get evenCircle():Array{
return (_evenCircle);
}
public function get level():uint{
return (_level);
}
public function get score():uint{
return (_score);
}
private function onPlayVideo(_arg1:MouseEvent):void{
_playVidoBtn.removeEventListener(MouseEvent.CLICK, onPlayVideo);
this.removeChild(_playVidoBtn);
_playVidoBtnOn = false;
_shooter.visible = true;
_bubbleGame.playVideo();
}
public function get wholeCount():int{
return (_wholeCount);
}
public function get readyForShoot():Boolean{
return (_readyForShoot);
}
public function set nextID(_arg1:uint):void{
_nextID = _arg1;
}
public function get bubbleGame():BubbleGame{
return (_bubbleGame);
}
public function get bubble():Bubble{
return (_bubble);
}
private function playVideo():void{
_shooter.visible = false;
_playVidoBtn = new PlayVideoBTN();
_playVidoBtn.x = (_w / 2);
_playVidoBtn.y = (_h + 25);
this.addChild(_playVidoBtn);
_playVidoBtnOn = true;
_playVidoBtn.addEventListener(MouseEvent.CLICK, onPlayVideo);
}
public function set map(_arg1:Array):void{
_map = _arg1;
}
public function set mark(_arg1:Array):void{
_mark = _arg1;
}
public function set oddCircle(_arg1:Array):void{
_oddCircle = _arg1;
}
public function set health(_arg1:uint):void{
_health = _arg1;
}
public function healthReward():void{
if (_healthCheck){
if (_rewardFlag){
if (_shootFlag){
if (_health < 5){
_health = (_health + 1);
_shootFlag = false;
if (_rewardNotice){
_rewardNotice = false;
};
};
} else {
_shootFlag = true;
};
};
};
}
public function set dropSound(_arg1:Boolean):void{
_dropSound = _arg1;
}
public function newGame():void{
var _local2:int;
var _local1:int;
while (_local1 < _row) {
_local2 = 0;
while (_local2 < _col) {
if (_map[_local1][_local2]){
_bubbleMap[_local1][_local2].drop();
};
_local2++;
};
_local1++;
};
_bubbleGame.setGirlMCViseble(0);
_bubbleGame.playZoneInactive();
_shooter.visible = false;
_replayBTN = new ReplayBTN();
_replayBTN.x = (_w / 2);
_replayBTN.y = (_h + 25);
_tooBadMC = new ToBadMC();
_tooBadMC.x = (_w / 2);
_tooBadMC.y = (_h / 2);
this.addChildAt(_tooBadMC, 2);
this.addChild(_replayBTN);
_replayBtnOn = true;
_replayBTN.addEventListener(MouseEvent.CLICK, onReplayClick);
}
public function set row(_arg1:int):void{
_row = _arg1;
}
public function set h(_arg1:Number):void{
_h = _arg1;
}
public function get mark():Array{
return (_mark);
}
private function launchShooter():void{
_shooter.next.alpha = 0;
}
private function drawPickGirlBTN():void{
_pickGirlBTN = new PickGirlBTN(this);
_pickGirlBTN.x = ((_w - _pickGirlBTN.width) - 40);
_pickGirlBTN.y = _h;
this.addChild(_pickGirlBTN);
}
public function get oddCircle():Array{
return (_oddCircle);
}
public function restartReplay():void{
if (_playNextBtnOn == true){
_playNextBtn.removeEventListener(MouseEvent.CLICK, onNextLevelClick);
this.removeChild(_playNextBtn);
_playNextBtn = null;
_playNextBtnOn = false;
_shooter.visible = true;
};
if (_replayBtnOn == true){
_replayBTN.removeEventListener(MouseEvent.CLICK, onReplayClick);
this.removeChild(_replayBTN);
_replayBTN = null;
this.removeChild(_tooBadMC);
_replayBtnOn = false;
_bubbleGame.setGirlMCViseble(1);
_shooter.visible = true;
};
if (_playVidoBtnOn == true){
_playVidoBtn.removeEventListener(MouseEvent.CLICK, onPlayVideo);
this.removeChild(_playVidoBtn);
_playVidoBtn = null;
_playVidoBtnOn = false;
_shooter.visible = true;
};
_level = 1;
_score = 0;
_count = 0;
_wholeCount = 0;
_healthCutCount = 0;
_healthFlag = false;
_healthCheck = false;
_doubleFlag = false;
_rewardFlag = true;
_shootFlag = false;
_bubbleGame.bubbleColors = ["green", "red"];
_nextBubbleColors = ["blue", "yellow", "purple", "gray", "lightblue", "darkyellow"];
_colors = _bubbleGame.bubbleColors.length;
_bubbleGame.setLevel(_level);
_bubbleGame.setScore(_score);
_nextID = (Math.floor((Math.random() * _colors)) + 1);
drawBubbles();
next();
}
public function replay():void{
_count = 0;
_wholeCount = 0;
_healthCutCount = 0;
_healthFlag = false;
_healthCheck = false;
_doubleFlag = false;
_rewardFlag = true;
_shootFlag = false;
_bubbleGame.setLevel(_level);
_nextID = (Math.floor((Math.random() * _colors)) + 1);
drawBubbles();
next();
}
private function pushBubbles():void{
var _local4:Bubble;
var _local1:int;
var _local2:int;
var _local3:uint;
_local3 = 1;
if (_doubleFlag){
_local3 = 2;
};
_local1 = 0;
while (_local1 < _col) {
if (_map[(_row - _local3)][_local1]){
gameOver();
return;
};
_local1++;
};
_local2 = (_row - 1);
while (_local2 >= _local3) {
_local1 = 0;
while (_local1 < _col) {
_map[_local2][_local1] = _map[(_local2 - _local3)][_local1];
_bubbleMap[_local2][_local1] = _bubbleMap[(_local2 - _local3)][_local1];
if (_map[_local2][_local1]){
if ((_local2 % 2)){
_bubbleMap[_local2][_local1].x = (_r + (_local1 * _r));
} else {
_bubbleMap[_local2][_local1].x = ((_r / 2) + (_local1 * _r));
};
_bubbleMap[_local2][_local1].y = (_bubbleMap[_local2][_local1].y + (_r * _local3));
};
_local1++;
};
_local2--;
};
_local2 = 0;
while (_local2 < _local3) {
_local1 = 0;
while (_local1 < _col) {
_randomBubblesOnStage = Math.round((Math.random() * (_bubblesOnStage.length - 1)));
_map[_local2][_local1] = _bubblesOnStage[_randomBubblesOnStage];
_local4 = new Bubble(this, _map[_local2][_local1], _r);
if ((_local2 % 2)){
_local4.x = (_r + (_local1 * _r));
} else {
_local4.x = ((_r / 2) + (_local1 * _r));
};
_local4.y = ((_r / 2) + (_local2 * _r));
_bubbleMap[_local2][_local1] = _local4;
this.addChild(_local4);
_local1++;
};
_local2++;
};
_bubble.checkIsolated(0);
}
public function set w(_arg1:Number):void{
_w = _arg1;
}
public function next():void{
var _local1:int;
var _local2:int;
var _local5:uint;
var _local6:String;
var _local3:int;
var _local4:int;
_bubblesOnStage = [];
_randomBubblesOnStage = 0;
_local1 = 0;
while (_local1 < _row) {
_local2 = 0;
while (_local2 < _col) {
if (_map[_local1][_local2] > 0){
_bubblesOnStage.push(_map[_local1][_local2]);
_local4++;
};
_local2++;
};
_local1++;
};
_local1 = 0;
while (_local1 < (_bubblesOnStage.length - 1)) {
_local2 = (_local1 + 1);
while (_local2 < _bubblesOnStage.length) {
if (_bubblesOnStage[_local1] == _bubblesOnStage[_local2]){
_bubblesOnStage.splice(_local2, 1);
_local2--;
};
_local2++;
};
_local1++;
};
if (_local4 == 0){
nextLevel();
} else {
_count = (_count + 1);
countCheck();
_local5 = Math.floor((Math.random() * 100));
if ((((_count > 7)) && ((_local5 > 90)))){
_id = 9;
_bubble.overrideSetId(_id);
_bubble.launch();
} else {
if ((((((_count > 5)) && ((_local5 > 80)))) && ((_local5 < 90)))){
_id = 10;
_bubble.overrideSetId(_id);
_bubble.launch();
} else {
if ((((((_count > 3)) && ((_local5 > 70)))) && ((_local5 < 80)))){
_id = 11;
_bubble.overrideSetId(_id);
_bubble.launch();
} else {
if ((((((_count > 2)) && ((_local5 > 60)))) && ((_local5 < 70)))){
_id = 12;
_bubble.overrideSetId(_id);
_bubble.launch();
_randomBubblesOnStage = Math.round((Math.random() * (_bubblesOnStage.length - 1)));
_local1 = 0;
while (_local1 < _bubblesOnStage.length) {
if (_nextID == _bubblesOnStage[_local1]){
_local3++;
};
_local1++;
};
if (_local3 == 0){
_nextID = _bubblesOnStage[_randomBubblesOnStage];
};
_id = _bubblesOnStage[_randomBubblesOnStage];
} else {
_randomBubblesOnStage = Math.round((Math.random() * (_bubblesOnStage.length - 1)));
_local1 = 0;
while (_local1 < _bubblesOnStage.length) {
if (_nextID == _bubblesOnStage[_local1]){
_local3++;
};
_local1++;
};
if (_local3 == 0){
_nextID = _bubblesOnStage[_randomBubblesOnStage];
};
_id = _nextID;
_nextID = _bubblesOnStage[_randomBubblesOnStage];
_local6 = _bubbleColors[(_nextID - 1)];
launchShooter();
_shooter.next.gotoAndStop(_local6);
_bubble.setId(_id);
_bubble.launch();
};
};
};
};
};
}
public function get row():int{
return (_row);
}
public function gameOver():void{
var _local2:uint;
var _local1:uint;
while (_local1 < _row) {
_local2 = 0;
while (_local2 < _col) {
if (_map[_local1][_local2]){
_bubbleMap[_local1][_local2].drop();
};
_local2++;
};
_local1++;
};
_bubbleGame.displayScore();
newGame();
}
}
}//package pg.bubblegame
Section 40
//Shooter (pg.bubblegame.Shooter)
package pg.bubblegame {
import flash.events.*;
import flash.display.*;
import pg.bubblegame.assets.mc.*;
import flash.filters.*;
public class Shooter extends Sprite {
private var _anchorX:Number;
private var _anchorY:Number;
public var arrow:ShooterMC;
public var next:BubbleMC;
private var _r:Number;
private var _playZone:PlayZone;
public function Shooter(_arg1:PlayZone, _arg2:Number){
_playZone = _arg1;
_r = _arg2;
_anchorX = ((_playZone.w / 2) + _playZone.bubbleGame.getChildByName("canvas_layer").x);
_anchorY = ((_playZone.h + 25) + _playZone.bubbleGame.getChildByName("canvas_layer").y);
init();
}
private function init():void{
var _local1:DropShadowFilter = new DropShadowFilter(2, 45, 0, 0.6, 2, 2, 2, 1, false, false, false);
var _local2:Number = ((_r / 64) * 0.9);
var _local3:String = _playZone.bubbleColors[(_playZone.nextID - 1)];
arrow = new ShooterMC();
arrow.scaleY = _local2;
arrow.scaleX = _local2;
arrow.rotation = -60;
arrow.filters = [_local1];
next = new BubbleMC();
next.x = 45;
next.scaleY = _local2;
next.scaleX = _local2;
next.alpha = 0.8;
next.gotoAndStop(_local3);
next.filters = [_local1];
this.addChild(arrow);
this.addChild(next);
}
public function endRotate():void{
_playZone.bubbleGame.removeEventListener(Event.ENTER_FRAME, rotate);
}
private function rotate(_arg1:Event):void{
var _local2:Number = (_playZone.bubbleGame.mouseX - _anchorX);
var _local3:Number = (_playZone.bubbleGame.mouseY - _anchorY);
if (_local3 < -30){
arrow.rotation = ((Math.atan2(_local3, _local2) * 180) / Math.PI);
};
}
public function startRotate():void{
_playZone.bubbleGame.addEventListener(Event.ENTER_FRAME, rotate);
}
}
}//package pg.bubblegame
Section 41
//Sounds (pg.bubblegame.Sounds)
package pg.bubblegame {
import pg.bubblegame.assets.snd.*;
import flash.media.*;
public class Sounds {
public var float:Floating;
private var _playBG:Boolean;
public var bgSound:BgSound;
private var _soundChanen:SoundChannel;
public var drop:Drop;
private var _bubbleGame:BubbleGame;
private var _on:Boolean;
public var shoot:Shoot;
public function Sounds(_arg1:BubbleGame){
_bubbleGame = _arg1;
init();
}
public function set on(_arg1:Boolean):void{
_on = _arg1;
}
public function get on():Boolean{
return (_on);
}
private function init():void{
_on = true;
drop = new Drop();
float = new Floating();
shoot = new Shoot();
_playBG = false;
stopPlayBG();
}
public function stopPlayBG():void{
if (_playBG){
_soundChanen.stop();
_playBG = false;
bgSound = null;
_soundChanen = null;
} else {
bgSound = new BgSound();
_soundChanen = new SoundChannel();
_soundChanen = bgSound.play(0, 100);
_playBG = true;
};
}
}
}//package pg.bubblegame