Section 1
//3eelcopy_309 (TreasureDive_fla.3eelcopy_309)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class 3eelcopy_309 extends MovieClip {
public function 3eelcopy_309(){
super();
addFrameScript(23, frame24);
}
function frame24(){
gotoAndPlay(1);
}
}
}//package TreasureDive_fla
Section 2
//3mantacopy_306 (TreasureDive_fla.3mantacopy_306)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class 3mantacopy_306 extends MovieClip {
public function 3mantacopy_306(){
super();
addFrameScript(23, frame24);
}
function frame24(){
gotoAndPlay(1);
}
}
}//package TreasureDive_fla
Section 3
//bubbles_30 (TreasureDive_fla.bubbles_30)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class bubbles_30 extends MovieClip {
public function bubbles_30(){
super();
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package TreasureDive_fla
Section 4
//dead_364 (TreasureDive_fla.dead_364)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class dead_364 extends MovieClip {
public function dead_364(){
super();
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package TreasureDive_fla
Section 5
//dead_365 (TreasureDive_fla.dead_365)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class dead_365 extends MovieClip {
public function dead_365(){
super();
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package TreasureDive_fla
Section 6
//levi_300 (TreasureDive_fla.levi_300)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class levi_300 extends MovieClip {
public function levi_300(){
super();
addFrameScript(210, frame211);
}
function frame211(){
stop();
}
}
}//package TreasureDive_fla
Section 7
//levi_302 (TreasureDive_fla.levi_302)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class levi_302 extends MovieClip {
public function levi_302(){
super();
addFrameScript(110, frame111);
}
function frame111(){
stop();
}
}
}//package TreasureDive_fla
Section 8
//levi_303 (TreasureDive_fla.levi_303)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class levi_303 extends MovieClip {
public function levi_303(){
super();
addFrameScript(220, frame221);
}
function frame221(){
stop();
}
}
}//package TreasureDive_fla
Section 9
//MainTimeline (TreasureDive_fla.MainTimeline)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class MainTimeline extends MovieClip {
public var treasureDive;
public var preloadmc:MovieClip;
public function MainTimeline(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
treasureDive = null;
if (!treasureDive){
treasureDive = new TreasureDive(stage);
treasureDive.ShowPreMovie();
};
gotoAndStop(2);
}
}
}//package TreasureDive_fla
Section 10
//octo_293 (TreasureDive_fla.octo_293)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class octo_293 extends MovieClip {
public function octo_293(){
super();
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package TreasureDive_fla
Section 11
//octo_294 (TreasureDive_fla.octo_294)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class octo_294 extends MovieClip {
public function octo_294(){
super();
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package TreasureDive_fla
Section 12
//octo_295 (TreasureDive_fla.octo_295)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class octo_295 extends MovieClip {
public function octo_295(){
super();
addFrameScript(40, frame41);
}
function frame41(){
stop();
}
}
}//package TreasureDive_fla
Section 13
//prefmi_loader_freshnewgames_1 (TreasureDive_fla.prefmi_loader_freshnewgames_1)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class prefmi_loader_freshnewgames_1 extends MovieClip {
public var freloaderbar:MovieClip;
public var playbutton:SimpleButton;
public var freebutton:SimpleButton;
public function prefmi_loader_freshnewgames_1(){
super();
addFrameScript(0, frame1, 15, frame16, 88, frame89);
}
function frame89(){
this.freebutton.removeEventListener(MouseEvent.MOUSE_DOWN, gotoFree);
root.play();
stop();
}
function frame16(){
this.playbutton.addEventListener(MouseEvent.MOUSE_DOWN, playGame);
stop();
}
function frame1(){
this.freebutton.addEventListener(MouseEvent.MOUSE_DOWN, gotoFree);
if ((root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal) >= 1){
gotoAndPlay(3);
} else {
freloaderbar.gotoAndStop(Math.floor(((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100)));
gotoAndPlay(1);
};
}
public function gotoFree(e:MouseEvent):void{
navigateToURL(new URLRequest("http://www.freshnewgames.com/"), "_blank");
}
public function playGame(e:MouseEvent):void{
this.playbutton.removeEventListener(MouseEvent.MOUSE_DOWN, playGame);
this.play();
}
}
}//package TreasureDive_fla
Section 14
//sharky_287 (TreasureDive_fla.sharky_287)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class sharky_287 extends MovieClip {
public function sharky_287(){
super();
addFrameScript(34, frame35);
}
function frame35(){
stop();
}
}
}//package TreasureDive_fla
Section 15
//sharky_288 (TreasureDive_fla.sharky_288)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class sharky_288 extends MovieClip {
public function sharky_288(){
super();
addFrameScript(31, frame32);
}
function frame32(){
stop();
}
}
}//package TreasureDive_fla
Section 16
//sharky_289 (TreasureDive_fla.sharky_289)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class sharky_289 extends MovieClip {
public function sharky_289(){
super();
addFrameScript(70, frame71);
}
function frame71(){
stop();
}
}
}//package TreasureDive_fla
Section 17
//sharky_290 (TreasureDive_fla.sharky_290)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class sharky_290 extends MovieClip {
public function sharky_290(){
super();
addFrameScript(60, frame61);
}
function frame61(){
stop();
}
}
}//package TreasureDive_fla
Section 18
//Symbol4_201 (TreasureDive_fla.Symbol4_201)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class Symbol4_201 extends MovieClip {
public function Symbol4_201(){
super();
addFrameScript(129, frame130);
}
function frame130(){
stop();
}
}
}//package TreasureDive_fla
Section 19
//treasure_38 (TreasureDive_fla.treasure_38)
package TreasureDive_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class treasure_38 extends MovieClip {
public function treasure_38(){
super();
addFrameScript(32, frame33);
}
function frame33(){
stop();
}
}
}//package TreasureDive_fla
Section 20
//atlanticcrown (atlanticcrown)
package {
import flash.display.*;
public dynamic class atlanticcrown extends MovieClip {
public function atlanticcrown(){
super();
}
}
}//package
Section 21
//atlanticstaff (atlanticstaff)
package {
import flash.display.*;
public dynamic class atlanticstaff extends MovieClip {
public function atlanticstaff(){
super();
}
}
}//package
Section 22
//atlanticsword (atlanticsword)
package {
import flash.display.*;
public dynamic class atlanticsword extends MovieClip {
public function atlanticsword(){
super();
}
}
}//package
Section 23
//attackdetector (attackdetector)
package {
import flash.display.*;
public dynamic class attackdetector extends MovieClip {
public function attackdetector(){
super();
}
}
}//package
Section 24
//barhealth (barhealth)
package {
import flash.display.*;
public dynamic class barhealth extends MovieClip {
public function barhealth(){
super();
}
}
}//package
Section 25
//barlevi (barlevi)
package {
import flash.display.*;
public dynamic class barlevi extends MovieClip {
public function barlevi(){
super();
}
}
}//package
Section 26
//barocto (barocto)
package {
import flash.display.*;
public dynamic class barocto extends MovieClip {
public function barocto(){
super();
}
}
}//package
Section 27
//baroxygen (baroxygen)
package {
import flash.display.*;
public dynamic class baroxygen extends MovieClip {
public function baroxygen(){
super();
}
}
}//package
Section 28
//barshark (barshark)
package {
import flash.display.*;
public dynamic class barshark extends MovieClip {
public function barshark(){
super();
}
}
}//package
Section 29
//BaseMovieClip (BaseMovieClip)
package {
import flash.display.*;
import flash.events.*;
public class BaseMovieClip extends MovieClip {
const INITRANGE = 20;
const DELTAANGLE = 5;
const LIMITLEFT = 50;
const LIMITLOWER = 475;
const GRAVITY = 0.7;
const MINSCALE = 0.55;
const MAXSCALE = 0.45;
const INITDELAY = 0.2;
const ANGLE = 0;
const LIMITRIGHT = 500;
const MINANGLE = 330;
const LIMITUPPER = 50;
const MAXANGLE = 30;
public var faceLeft:Boolean;// = true
public var limitLower:Number;// = 475
public var moveDelay:Number;// = 0.2
public var gravity:Number;
public var limitLeft:Number;// = 50
public var xPos:Number;
public var angle:Number;// = 0
public var gravityActive:Boolean;// = false
public var yPos:Number;
public var limitRight:Number;// = 500
public var scale:Number;// = 1
public var limitUpper:Number;// = 50
public var borderless:Boolean;// = false
public var handlerStatus:Boolean;// = false
public function BaseMovieClip(){
angle = ANGLE;
scale = 1;
moveDelay = INITDELAY;
gravityActive = false;
faceLeft = true;
handlerStatus = false;
borderless = false;
limitUpper = LIMITUPPER;
limitLower = LIMITLOWER;
limitLeft = LIMITLEFT;
limitRight = LIMITRIGHT;
super();
}
public function SetMoveDelay(_delay:Number=0.2){
moveDelay = _delay;
}
public function SetScale(_scale:Number=0.55){
scale = _scale;
}
public function MoveDown(_range:Number=20){
yPos = this.y;
if (!borderless){
yPos = Math.min((yPos + _range), limitLower);
} else {
yPos = (yPos + _range);
};
StartMovement();
}
public function SetOrientation(_left:Boolean=true, _center:Number=0){
if (faceLeft != _left){
this.scaleX = (this.scaleX * -1);
this.rotation = (this.rotation * -1);
faceLeft = _left;
scale = this.scaleY;
angle = this.rotation;
if (faceLeft){
this.x = (this.x - _center);
} else {
this.x = (this.x + _center);
};
};
}
public function ZoomOut(_zoom:Number=0.45){
scale = _zoom;
StartMovement();
}
public function MoveUp(_range:Number=20){
yPos = this.y;
if (gravityActive){
if (!borderless){
yPos = Math.max((yPos - (_range * (1 - gravity))), limitUpper);
} else {
yPos = (yPos - (_range * (1 - gravity)));
};
} else {
if (!borderless){
yPos = Math.max((yPos - _range), limitUpper);
} else {
yPos = (yPos - _range);
};
};
StartMovement();
}
public function ZoomIn(_zoom:Number=0.55){
scale = _zoom;
StartMovement();
}
public function SetLimit(_upper:Number=50, _lower:Number=475, _left:Number=50, _right:Number=500){
limitUpper = _upper;
limitLower = _lower;
limitLeft = _left;
limitRight = _right;
}
public function MoveRight(_range:Number=20){
xPos = this.x;
if (!borderless){
xPos = Math.min((xPos + _range), limitRight);
} else {
xPos = (xPos + _range);
};
StartMovement();
}
public function TurnGravityOn(_gravity:Number=0.7){
gravity = _gravity;
gravityActive = true;
StartMovement();
}
public function RotateDown(_angle:Number=5){
angle = this.rotation;
if (angle > 180){
angle = (angle - 360);
};
if (faceLeft){
if ((angle - _angle) > -30){
angle = (angle - _angle);
} else {
angle = -30;
};
} else {
if ((angle + _angle) < 30){
angle = (angle + _angle);
} else {
angle = 30;
};
};
StartMovement();
}
public function TurnGravityOff(){
gravity = GRAVITY;
gravityActive = false;
StartMovement();
}
public function MoveToCoordinate(_X:Number=0, _Y:Number=0){
xPos = _X;
yPos = _Y;
StartMovement();
}
public function StopMovement(){
if (handlerStatus){
handlerStatus = false;
this.removeEventListener(Event.ENTER_FRAME, MovementHandler);
};
}
public function StartMovement(){
if (!handlerStatus){
handlerStatus = true;
this.addEventListener(Event.ENTER_FRAME, MovementHandler);
};
}
public function RotateUp(_angle:Number=5){
angle = this.rotation;
if (angle > 180){
angle = (angle - 360);
};
if (faceLeft){
if ((angle + _angle) < 30){
angle = (angle + _angle);
} else {
angle = 30;
};
} else {
if ((angle - _angle) > -30){
angle = (angle - _angle);
} else {
angle = -30;
};
};
StartMovement();
}
private function MovementHandler(event:Event){
var XDelta:Number;
var YDelta:Number;
var ScaleDelta:Number;
var AngleDelta:Number;
XDelta = (this.x - xPos);
YDelta = (this.y - yPos);
ScaleDelta = (this.scaleY - Math.abs(scale));
if (Math.abs(XDelta) > 1){
this.x = (this.x - (XDelta * moveDelay));
};
if (Math.abs(YDelta) > 1){
this.y = (this.y - (YDelta * moveDelay));
};
if (Math.abs(ScaleDelta) > 0.01){
this.scaleY = (this.scaleY - (ScaleDelta * moveDelay));
if (this.scaleX < 0){
this.scaleX = (this.scaleX + (ScaleDelta * moveDelay));
} else {
this.scaleX = (this.scaleX - (ScaleDelta * moveDelay));
};
};
if (this.rotation > 180){
AngleDelta = (angle - (this.rotation - 360));
} else {
AngleDelta = (angle - this.rotation);
};
if (AngleDelta > 180){
AngleDelta = (AngleDelta - 360);
};
if (Math.abs(AngleDelta) > 1){
this.rotation = (this.rotation + (AngleDelta * moveDelay));
};
if (gravityActive){
if (yPos < limitLower){
yPos = (yPos + GRAVITY);
};
};
}
public function CalibrateCoordinate(_X:Number=0, _Y:Number=0){
xPos = (xPos - _X);
yPos = (yPos - _Y);
StartMovement();
}
public function MoveLeft(_range:Number=20){
xPos = this.x;
if (!borderless){
xPos = Math.max((xPos - _range), limitLeft);
} else {
xPos = (xPos - _range);
};
StartMovement();
}
public function MoveToX(_X:Number=0){
xPos = _X;
StartMovement();
}
public function MoveToY(_Y:Number=0){
yPos = _Y;
StartMovement();
}
public function MoveOut(){
xPos = this.y;
if (faceLeft){
MoveLeft(500);
} else {
MoveRight(500);
};
}
public function SimpleRotate(_newAngle:Number=0){
if (_newAngle > 180){
angle = (_newAngle - 360);
} else {
angle = _newAngle;
};
}
public function SetRotation(_newAngle:Number=0){
var _angle:Number;
angle = this.rotation;
_angle = _newAngle;
if (angle > 180){
angle = (angle - 360);
};
if (_angle > 180){
_angle = (_angle - 360);
};
if (faceLeft){
if (_angle > -30){
angle = (_angle + 30);
} else {
if (_angle < -150){
angle = (_angle + 150);
} else {
angle = ANGLE;
};
};
} else {
if (_angle < 30){
angle = (_angle - 30);
} else {
if (_angle > 150){
angle = (_angle - 150);
} else {
angle = ANGLE;
};
};
};
}
}
}//package
Section 30
//BaseSound (BaseSound)
package {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class BaseSound extends Sound {
private var sndTransform:SoundTransform;
private var sndFadeOut:Boolean;
private var sndFadeIn:Boolean;
private var sndPosTime:Number;
private var loop:Boolean;
private var sndObj:Sound;
private var sndChannel:SoundChannel;
private var sndTimer:Timer;
private var sndVolume:Number;
private var sndPan:Number;
public function BaseSound(){
super();
sndObj = this;
sndChannel = null;
sndTransform = null;
sndVolume = 1;
sndPan = 0;
sndPosTime = 0;
sndFadeIn = false;
sndFadeOut = false;
loop = false;
sndTimer = new Timer(50);
sndTimer.addEventListener(TimerEvent.TIMER, sndTimerHandler);
sndTimer.start();
}
public function setVolume(vol:Number):void{
var sndTransform:SoundTransform;
sndVolume = vol;
if (sndChannel){
sndTransform = sndChannel.soundTransform;
sndTransform.volume = sndVolume;
sndChannel.soundTransform = sndTransform;
};
}
public function stopSound():void{
if (sndChannel){
sndChannel.stop();
sndChannel.removeEventListener(Event.SOUND_COMPLETE, sound_loop);
loop = false;
};
}
public function fadeOut(init:Boolean):void{
sndFadeOut = true;
sndFadeIn = false;
if (init){
setVolume(1);
};
}
public function pauseSound():void{
if (sndChannel){
sndPosTime = sndChannel.position;
sndChannel.stop();
sndChannel.removeEventListener(Event.SOUND_COMPLETE, sound_loop);
};
}
public function playSound():void{
stopSound();
sndChannel = sndObj.play();
setVolume(sndVolume);
setPan(sndPan);
}
public function fadeIn(init:Boolean):void{
sndFadeIn = true;
sndFadeOut = false;
if (init){
setVolume(0);
};
}
private function sndTimerHandler(event:TimerEvent):void{
if (((sndFadeIn) && (sndFadeOut))){
sndFadeIn = false;
sndFadeOut = false;
setVolume(1);
};
if (sndFadeIn){
sndVolume = (sndVolume + 0.01);
if (sndVolume > 1){
setVolume(1);
sndFadeIn = false;
} else {
setVolume(sndVolume);
};
};
if (sndFadeOut){
sndVolume = (sndVolume - 0.01);
if (sndVolume < 0){
setVolume(0);
sndFadeOut = false;
} else {
setVolume(sndVolume);
};
};
}
public function setPan(pan:Number):void{
var sndTransform:SoundTransform;
sndPan = pan;
if (sndChannel){
sndTransform = sndChannel.soundTransform;
sndTransform.pan = sndPan;
sndChannel.soundTransform = sndTransform;
};
}
public function resumeSound():void{
stopSound();
sndChannel = sndObj.play(sndPosTime);
if (loop){
sndChannel.addEventListener(Event.SOUND_COMPLETE, sound_loop);
};
setVolume(sndVolume);
setPan(sndPan);
}
private function sound_loop(event:Event){
sndChannel = sndObj.play();
setVolume(sndVolume);
setPan(sndPan);
sndChannel.addEventListener(Event.SOUND_COMPLETE, sound_loop);
}
public function playSoundLoop():void{
stopSound();
sndChannel = sndObj.play();
sndChannel.addEventListener(Event.SOUND_COMPLETE, sound_loop);
setVolume(sndVolume);
setPan(sndPan);
loop = true;
}
}
}//package
Section 31
//bodydetector (bodydetector)
package {
import flash.display.*;
public dynamic class bodydetector extends MovieClip {
public function bodydetector(){
super();
}
}
}//package
Section 32
//boss1 (boss1)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class boss1 extends BossOctoChar {
public function boss1(){
super();
addFrameScript(29, frame30, 59, frame60, 89, frame90, 129, frame130, 130, frame131);
}
function frame30(){
gotoAndPlay("stand");
}
function frame60(){
gotoAndPlay("stand");
}
function frame90(){
gotoAndPlay("stand");
}
function frame131(){
stop();
}
function frame130(){
gotoAndPlay("stand");
}
}
}//package
Section 33
//boss2 (boss2)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class boss2 extends BossSharkChar {
public function boss2(){
super();
addFrameScript(19, frame20, 53, frame54, 84, frame85, 154, frame155, 214, frame215, 215, frame216);
}
function frame155(){
gotoAndPlay("stand");
}
function frame20(){
gotoAndPlay("stand");
}
function frame54(){
gotoAndPlay("stand");
}
function frame85(){
gotoAndPlay("stand");
}
function frame215(){
gotoAndPlay("stand");
}
function frame216(){
stop();
}
}
}//package
Section 34
//boss3 (boss3)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class boss3 extends BossLeviChar {
public function boss3(){
super();
addFrameScript(39, frame40, 221, frame222, 431, frame432, 671, frame672, 781, frame782, 1001, frame1002, 1002, frame1003);
}
function frame40(){
gotoAndPlay("stand");
}
function frame432(){
gotoAndPlay("stand");
}
function frame672(){
gotoAndPlay("stand");
}
function frame782(){
gotoAndPlay("stand");
}
function frame1003(){
stop();
}
function frame1002(){
gotoAndPlay("stand");
}
function frame222(){
gotoAndPlay("stand");
}
}
}//package
Section 35
//bossbgm (bossbgm)
package {
public dynamic class bossbgm extends BaseSound {
public function bossbgm(){
super();
}
}
}//package
Section 36
//BossLeviChar (BossLeviChar)
package {
import flash.display.*;
import flash.events.*;
public class BossLeviChar extends BaseMovieClip {
const HP = 3000;
public var bodydetect3:bodydetector;
public var bodydetect4:bodydetector;
public var bodydetect1:bodydetector;
public var bodydetect5:bodydetector;
public var bodydetect2:bodydetector;
public var destroyed:Boolean;// = false
public var gold:int;// = 2000
public var typed;// = "boss"
private var lastX:int;
private var lastY:int;
private var nextAct:String;// = "stand"
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var attackdetect2:attackdetector;
public var attackdetect3:attackdetector;
public var attackdetect4:attackdetector;
public var destroyedTimer:int;// = 0
public var attackdetect1:attackdetector;
private var movingDown:Boolean;// = false
public var attack1:MovieClip;
public var attack2:MovieClip;
public var attack5:MovieClip;
public var attack4:MovieClip;
public var attack3:MovieClip;
public var hp:int;// = 3000
public var shadow:MovieClip;
public var named;// = "levi"
public var damage:int;// = 40
private var movingCount:Number;// = 0
private var movingLeft:Boolean;// = false
private var myParent;
private var attackCount:Number;// = 0
private var gamePaused:Boolean;// = false
private var nowAct:String;// = "stand"
public function BossLeviChar(){
typed = "boss";
named = "levi";
hp = HP;
damage = 40;
gold = 2000;
nextAct = "stand";
nowAct = "stand";
movingCount = 0;
attackCount = 0;
movingLeft = false;
movingDown = false;
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function Act(_action:String="stand"){
nextAct = _action;
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
if (bodydetect1){
hit = ((hit) || (bodydetect1.hitTestObject(obj)));
};
if (bodydetect2){
hit = ((hit) || (bodydetect2.hitTestObject(obj)));
};
if (bodydetect3){
hit = ((hit) || (bodydetect3.hitTestObject(obj)));
};
if (bodydetect4){
hit = ((hit) || (bodydetect4.hitTestObject(obj)));
};
if (bodydetect5){
hit = ((hit) || (bodydetect5.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_face:String="stand"){
this.gotoAndPlay(_face);
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectAttack(obj):Boolean{
var hit:Boolean;
hit = false;
if (bodydetect1){
hit = ((hit) || (bodydetect1.hitTestObject(obj)));
};
if (bodydetect2){
hit = ((hit) || (bodydetect2.hitTestObject(obj)));
};
if (bodydetect3){
hit = ((hit) || (bodydetect3.hitTestObject(obj)));
};
if (bodydetect4){
hit = ((hit) || (bodydetect4.hitTestObject(obj)));
};
if (bodydetect5){
hit = ((hit) || (bodydetect5.hitTestObject(obj)));
};
if (attackdetect1){
hit = ((hit) || (attackdetect1.hitTestObject(obj)));
};
if (attackdetect2){
hit = ((hit) || (attackdetect2.hitTestObject(obj)));
};
if (attackdetect3){
hit = ((hit) || (attackdetect3.hitTestObject(obj)));
};
return (hit);
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.moveDelay = 0.05;
this.TurnGravityOff();
this.StartMovement();
this.shadow.alpha = 0;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(50);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
if (attacking){
if (this.currentLabel == "stand"){
nowAct = "stand";
attacking = false;
};
};
if (movingLeft){
this.SetOrientation(true);
} else {
this.SetOrientation(false);
};
if (nowAct == "stand"){
if (movingLeft){
if (this.x > 700){
this.y = 400;
this.MoveToY(400);
this.MoveToX((this.x - 200));
} else {
if (this.y > -100){
this.x = 700;
this.MoveToY((this.y - 75));
this.MoveToX((this.x - 25));
} else {
this.y = -100;
this.MoveToX((this.x - 200));
};
};
if (this.x < -1600){
movingLeft = false;
movingCount++;
};
} else {
if (this.x < -150){
this.y = 400;
this.MoveToY(400);
this.MoveToX((this.x + 200));
} else {
if (this.y > -100){
this.x = -150;
this.MoveToY((this.y - 75));
this.MoveToX((this.x + 25));
} else {
this.y = -100;
this.MoveToX((this.x + 200));
};
};
if (this.x > 2000){
movingLeft = true;
movingCount++;
};
};
if ((movingCount % 2) == 1){
nowAct = ("attack" + ((attackCount % 4) + 1));
attackCount++;
movingCount++;
};
} else {
if (nowAct == "attack1"){
if (this.x > 275){
if (this.x > 1075){
this.y = 250;
this.MoveToY(250);
this.MoveToX((this.x - 200));
} else {
if (this.currentLabel != nowAct){
this.gotoAndPlay(nowAct);
attacking = true;
};
};
} else {
if (this.x < -525){
this.y = 250;
this.MoveToY(250);
this.MoveToX((this.x + 200));
} else {
if (this.currentLabel != nowAct){
this.gotoAndPlay(nowAct);
attacking = true;
};
};
};
if (this.currentFrame > 215){
if (this.x < 225){
this.x = 2000;
movingLeft = true;
} else {
this.x = -1600;
movingLeft = false;
};
};
} else {
if (nowAct == "attack2"){
if (this.x > 275){
if (this.x > 1150){
this.y = (myParent.thePirate.y - 100);
this.MoveToY((myParent.thePirate.y - 100));
this.MoveToX((this.x - 200));
} else {
if (this.currentLabel != nowAct){
this.gotoAndPlay(nowAct);
attacking = true;
};
};
} else {
if (this.x < -650){
this.y = (myParent.thePirate.y - 100);
this.MoveToY((myParent.thePirate.y - 100));
this.MoveToX((this.x + 200));
} else {
if (this.currentLabel != nowAct){
this.gotoAndPlay(nowAct);
attacking = true;
};
};
};
if (this.currentFrame > 370){
if (this.x < 225){
this.MoveToX((this.x - 200));
} else {
this.MoveToX((this.x + 200));
};
};
} else {
if (nowAct == "attack3"){
if (this.x > 275){
if (this.x > 875){
this.y = (myParent.thePirate.y - 100);
this.MoveToY((myParent.thePirate.y - 100));
this.MoveToX((this.x - 200));
} else {
if (this.currentLabel != nowAct){
this.gotoAndPlay(nowAct);
attacking = true;
};
};
} else {
if (this.x < -325){
this.y = (myParent.thePirate.y - 100);
this.MoveToY((myParent.thePirate.y - 100));
this.MoveToX((this.x + 200));
} else {
if (this.currentLabel != nowAct){
this.gotoAndPlay(nowAct);
attacking = true;
};
};
};
if (this.currentFrame > 775){
if (this.x < 225){
this.x = 2000;
movingLeft = true;
} else {
this.x = -1600;
movingLeft = false;
};
};
} else {
if (nowAct == "attack4"){
if (this.x > 275){
if (this.x > 900){
this.y = 50;
this.MoveToY(50);
this.MoveToX((this.x - 200));
} else {
if (this.currentLabel != nowAct){
this.gotoAndPlay(nowAct);
attacking = true;
};
};
} else {
if (this.x < -350){
this.y = 50;
this.MoveToY(50);
this.MoveToX((this.x + 200));
} else {
if (this.currentLabel != nowAct){
this.gotoAndPlay(nowAct);
attacking = true;
};
};
};
if (this.currentFrame > 960){
if (this.x < 225){
this.MoveToX((this.x - 100));
} else {
this.MoveToX((this.x + 100));
};
};
};
};
};
};
};
if (DetectAttack(myParent.thePirate.bodydetect)){
myParent.thePirate.StartAttacked(this);
};
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
attackedTimer = 10;
if (this.shadow){
this.shadow.alpha = 1;
};
if (_obj){
hp = (hp - _obj.GetDamage());
myParent.SetBossHealthDisplay(((hp / HP) * 100));
};
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
public function Destroy(){
this.StopMovement();
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveBoss();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.thePirate.IncreaseGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 37
//BossManager (BossManager)
package {
import flash.events.*;
public class BossManager {
private var gamePaused;// = true
public var thePirate;
private var gameLevel;
private var gameTimer:int;// = 0
private var myParent;
public var theBoss;// = null
public function BossManager(_myparent){
gameTimer = 0;
gamePaused = true;
theBoss = null;
super();
myParent = _myparent;
}
private function FrameEnterHandler(event:Event){
gameTimer++;
if ((gameTimer % 1200) == 0){
if (theBoss){
if (theBoss.named != "octo"){
theBoss.Act("attack4");
} else {
theBoss.Act("attack1");
};
};
} else {
if ((gameTimer % 900) == 0){
if (theBoss){
theBoss.Act("attack3");
};
} else {
if ((gameTimer % 600) == 0){
if (theBoss){
theBoss.Act("attack2");
};
} else {
if ((gameTimer % 300) == 0){
if (theBoss){
theBoss.Act("attack1");
};
};
};
};
};
}
public function StartBossFight(){
gameLevel = myParent.gameLevel;
if (gameLevel == 3){
myParent.soundMgr.playBgm(8);
} else {
myParent.soundMgr.playBgm(7);
};
gameTimer = 0;
thePirate = myParent.GetPirate();
CreateBoss();
myParent.stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function CreateBoss(){
switch (gameLevel){
case 1:
theBoss = new boss1();
theBoss.x = 100;
theBoss.y = -150;
break;
case 2:
theBoss = new boss2();
theBoss.x = 100;
theBoss.y = -150;
break;
case 3:
theBoss = new boss3();
theBoss.x = -800;
theBoss.y = -300;
break;
};
myParent.sceneContainer.addChild(theBoss);
myParent.sceneContainer.swapChildren(theBoss, thePirate);
theBoss.Init(this);
theBoss.Act("stand");
}
private function DestroyBoss(){
if (theBoss){
myParent.sceneContainer.removeChild(theBoss);
theBoss = null;
};
}
public function StopBossFight(){
DestroyBoss();
myParent.stageRoot.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function RemoveBoss(){
DestroyBoss();
}
public function PauseGame(){
if (theBoss){
theBoss.PauseGame();
};
myParent.stageRoot.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function SetBossHealthDisplay(_lv=100){
myParent.scoreMgr.SetBossBar(_lv);
if (_lv <= 0){
myParent.StopBossFight();
};
}
public function ResumeGame(){
if (theBoss){
theBoss.ResumeGame();
};
myParent.stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
}
}//package
Section 38
//BossOctoChar (BossOctoChar)
package {
import flash.display.*;
import flash.events.*;
public class BossOctoChar extends BaseMovieClip {
const HP = 800;
public var destroyed:Boolean;// = false
public var gold:int;// = 2000
public var typed;// = "boss"
private var lastX:int;
private var lastY:int;
private var nextAct:String;
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var attackdetect2:attackdetector;
public var attackdetect3:attackdetector;
public var destroyedTimer:int;// = 0
public var attackdetect1:attackdetector;
public var bodydetect:bodydetector;
public var hp:int;// = 800
public var shadow:MovieClip;
public var named;// = "octo"
public var damage:int;// = 40
private var movingLeft:Boolean;// = false
private var myParent;
private var gamePaused:Boolean;// = false
public function BossOctoChar(){
typed = "boss";
named = "octo";
hp = HP;
damage = 40;
gold = 2000;
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
movingLeft = false;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function Act(_action:String="stand"){
nextAct = _action;
if ((((((_action == "attack1")) || ((_action == "attack2")))) || ((_action == "attack3")))){
if (myParent.thePirate.x > this.x){
lastX = (myParent.thePirate.x - 100);
} else {
lastX = (myParent.thePirate.x + 100);
};
lastY = (myParent.thePirate.y - 150);
this.MoveToCoordinate(lastX, lastY);
};
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
return (hit);
}
private function SetSkin(_face:String="stand"){
this.gotoAndPlay(_face);
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectAttack(obj):Boolean{
var hit:Boolean;
hit = false;
hit = ((hit) || (bodydetect.hitTestObject(obj)));
if ((((((this.currentLabel == "attack1")) || ((this.currentLabel == "attack2")))) || ((this.currentLabel == "attack3")))){
hit = ((hit) || (attackdetect1.hitTestObject(obj)));
hit = ((hit) || (attackdetect2.hitTestObject(obj)));
hit = ((hit) || (attackdetect3.hitTestObject(obj)));
};
return (hit);
}
private function StopAttacked(){
this.shadow.alpha = 0;
}
public function Init(_myParent){
myParent = _myParent;
this.moveDelay = 0.05;
this.StartMovement();
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(50);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
if (myParent.thePirate.x > this.x){
this.SetOrientation(false);
} else {
this.SetOrientation(true);
};
if (nextAct == "stand"){
if (movingLeft){
this.MoveToX((this.x - 50));
if (this.x <= 100){
movingLeft = false;
};
} else {
this.MoveToX((this.x + 50));
if (this.x >= 450){
movingLeft = true;
};
};
this.MoveToY(425);
} else {
if ((((((nextAct == "attack1")) || ((nextAct == "attack2")))) || ((nextAct == "attack3")))){
if ((((Math.abs((this.x - lastX)) < 10)) && ((Math.abs((this.y - lastY)) < 10)))){
this.gotoAndPlay(nextAct);
Act("stand");
};
};
};
if (DetectAttack(myParent.thePirate.bodydetect)){
myParent.thePirate.StartAttacked(this);
};
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
attackedTimer = 10;
if (this.shadow){
this.shadow.alpha = 1;
};
if (_obj){
hp = (hp - _obj.GetDamage());
myParent.SetBossHealthDisplay(((hp / HP) * 100));
};
}
public function Destroy(){
this.StopMovement();
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveBoss();
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.thePirate.IncreaseGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 39
//BossSharkChar (BossSharkChar)
package {
import flash.display.*;
import flash.events.*;
public class BossSharkChar extends BaseMovieClip {
const HP = 2000;
public var destroyed:Boolean;// = false
public var gold:int;// = 2000
public var typed;// = "boss"
private var lastX:int;
private var lastY:int;
private var nextAct:String;
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var destroyedTimer:int;// = 0
private var theta:Number;// = 0
private var movingDown:Boolean;// = false
public var bodydetect:bodydetector;
public var attackdetect:attackdetector;
public var hp:int;// = 2000
public var shadow:MovieClip;
public var named;// = "shark"
public var damage:int;// = 40
private var myParent;
private var gamePaused:Boolean;// = false
public function BossSharkChar(){
typed = "boss";
named = "shark";
hp = HP;
damage = 40;
gold = 2000;
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
theta = 0;
movingDown = false;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function Act(_action:String="stand"){
nextAct = _action;
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
return (hit);
}
private function SetSkin(_face:String="stand"){
this.gotoAndPlay(_face);
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectAttack(obj):Boolean{
var hit:Boolean;
hit = false;
hit = ((hit) || (bodydetect.hitTestObject(obj)));
if ((((((((this.currentLabel == "attack1")) || ((this.currentLabel == "attack2")))) || ((this.currentLabel == "attack3")))) || ((this.currentLabel == "attack4")))){
hit = ((hit) || (attackdetect.hitTestObject(obj)));
};
return (hit);
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.moveDelay = 0.05;
this.StartMovement();
this.shadow.alpha = 0;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(50);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
if (myParent.thePirate.x > this.x){
this.SetOrientation(false);
} else {
this.SetOrientation(true);
};
if (nextAct == "stand"){
theta++;
if (movingDown){
this.MoveToY((this.y + 50));
if (this.x < 275){
this.MoveToX((50 + (Math.sin(((this.y * Math.PI) / 25)) * 50)));
} else {
this.MoveToX((500 - (Math.sin(((this.y * Math.PI) / 25)) * 50)));
};
if (this.y >= 500){
movingDown = false;
};
} else {
this.MoveToY((this.y - 50));
if (this.y < 50){
movingDown = true;
};
};
} else {
if ((((nextAct == "attack2")) || ((nextAct == "attack3")))){
if (this.x > 275){
this.MoveLeft(100);
} else {
this.MoveRight(100);
};
this.gotoAndPlay(nextAct);
nextAct = "stand";
} else {
if (nextAct == "attack4"){
this.gotoAndPlay(nextAct);
nextAct = "stand";
} else {
if (nextAct == "attack1"){
this.gotoAndPlay(nextAct);
nextAct = "attack1prep";
};
};
};
};
if (nextAct == "attack1prep"){
if (this.currentLabel != "attack1"){
nextAct = "stand";
if (this.x < 275){
this.x = 650;
} else {
this.x = -100;
};
};
};
if (DetectAttack(myParent.thePirate.bodydetect)){
myParent.thePirate.StartAttacked(this);
};
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
attackedTimer = 10;
if (this.shadow){
this.shadow.alpha = 1;
};
if (_obj){
hp = (hp - _obj.GetDamage());
myParent.SetBossHealthDisplay(((hp / HP) * 100));
};
}
public function Destroy(){
this.StopMovement();
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveBoss();
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.thePirate.IncreaseGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 40
//bosswarning (bosswarning)
package {
import flash.display.*;
public dynamic class bosswarning extends MovieClip {
public function bosswarning(){
super();
}
}
}//package
Section 41
//breath (breath)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class breath extends ItemBreathChar {
public function breath(){
super();
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package
Section 42
//bullet (bullet)
package {
public dynamic class bullet extends BulletChar {
public function bullet(){
super();
}
}
}//package
Section 43
//BulletChar (BulletChar)
package {
import flash.display.*;
import flash.events.*;
public class BulletChar extends MovieClip {
const SPEED = 10;
public var named;// = "bullet"
private var initY;
private var initX;
public var typed;// = "bullet"
public var damage:int;// = 10
public var level;// = 0
private var myParent;
private var gamePaused:Boolean;// = false
private var angle:Number;// = 0
public function BulletChar(){
typed = "bullet";
named = "bullet";
level = 0;
damage = 10;
angle = 0;
gamePaused = false;
super();
}
public function Init(_myParent, _X, _Y, _angle){
var r:*;
myParent = _myParent;
this.x = _X;
initX = _X;
this.y = _Y;
initY = _Y;
if (myParent.thePirate.faceLeft){
r = (360 - (_angle - 90));
} else {
r = (360 - (_angle - 90));
};
angle = r;
this.rotation = (360 - (r - 90));
this.visible = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
var obj:*;
var range:*;
obj = null;
this.x = (this.x + (Math.cos(((angle * Math.PI) / 180)) * SPEED));
this.y = (this.y - (Math.sin(((angle * Math.PI) / 180)) * SPEED));
range = Math.sqrt((Math.pow((this.x - initX), 2) + Math.pow((this.y - initY), 2)));
if (!this.visible){
if (range > 40){
this.visible = true;
};
};
if (this.visible){
obj = DetectObjectHit();
};
if (obj != null){
if ((((obj.typed == "enemy")) || ((obj.typed == "boss")))){
obj.StartAttacked(this);
};
Destroy();
};
if (DetectOutScreen()){
Destroy();
};
}
public function GetDamage():Number{
var factor:*;
factor = myParent.GetDamageFactor();
return ((damage * factor));
}
private function DetectObjectHit():MovieClip{
var hit:*;
var obj:*;
var i:*;
hit = false;
obj = null;
i = 0;
while (((!(hit)) && ((i < myParent.sceneContainer.numChildren)))) {
obj = myParent.sceneContainer.getChildAt(i);
if (obj.typed == "wall"){
hit = !((obj.DetectObjectHit(this) == null));
} else {
if (obj.typed == "enemy"){
hit = obj.DetectAttacked(this);
} else {
if (obj.typed == "boss"){
hit = obj.DetectAttacked(this);
};
};
};
i++;
};
if (hit){
return (obj);
};
return (null);
}
private function DetectOutScreen():Boolean{
var out:Boolean;
out = false;
out = ((out) || ((this.x < 0)));
out = ((out) || ((this.x > 550)));
out = ((out) || ((this.y < 0)));
out = ((out) || ((this.y > 550)));
return (out);
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.DestroyBullet(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
}
}//package
Section 44
//crate (crate)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class crate extends ItemCrateChar {
public function crate(){
super();
addFrameScript(0, frame1, 6, frame7, 7, frame8);
}
function frame1(){
stop();
}
function frame7(){
gotoAndStop(1);
}
function frame8(){
stop();
}
}
}//package
Section 45
//creditswindow (creditswindow)
package {
import flash.display.*;
public dynamic class creditswindow extends MovieClip {
public var closebtn:SimpleButton;
public function creditswindow(){
super();
}
}
}//package
Section 46
//dolphin (dolphin)
package {
public dynamic class dolphin extends ItemDolphinChar {
public function dolphin(){
super();
}
}
}//package
Section 47
//dying_enemy (dying_enemy)
package {
public dynamic class dying_enemy extends BaseSound {
public function dying_enemy(){
super();
}
}
}//package
Section 48
//eel (eel)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class eel extends EnemyEelChar {
public function eel(){
super();
addFrameScript(23, frame24, 47, frame48, 48, frame49);
}
function frame24(){
gotoAndPlay("stand");
}
function frame48(){
gotoAndPlay("stand");
}
function frame49(){
stop();
}
}
}//package
Section 49
//electric_attack (electric_attack)
package {
public dynamic class electric_attack extends BaseSound {
public function electric_attack(){
super();
}
}
}//package
Section 50
//ending (ending)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class ending extends MovieClip {
public var btnendingplaymore:SimpleButton;
public var btnendingback:SimpleButton;
public function ending(){
super();
addFrameScript(859, frame860);
}
function frame860(){
stop();
}
}
}//package
Section 51
//endingbgm (endingbgm)
package {
public dynamic class endingbgm extends BaseSound {
public function endingbgm(){
super();
}
}
}//package
Section 52
//endstagewarning (endstagewarning)
package {
import flash.display.*;
public dynamic class endstagewarning extends MovieClip {
public function endstagewarning(){
super();
}
}
}//package
Section 53
//EnemyEelChar (EnemyEelChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemyEelChar extends BaseMovieClip {
const MOVEDELAY = 0.3;
const MOVESPEED = 20;
const RANGE = 300;
const SCALE = 0.6;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
private var IncrUp:Boolean;// = true
public var gold:int;// = 15
public var typed;// = "enemy"
private var movingRight:Boolean;
public var attacking:Boolean;// = false
private var prevx;
public var destroyedTimer:int;// = 0
private var prevy;
public var bodydetect:bodydetector;
public var attackedTimer:int;// = 0
public var attackdetect:attackdetector;
public var hp:int;// = 50
public var shadow:MovieClip;
public var named;// = "eel"
private var ypos:int;// = -25
private var rotating;
public var damage:int;// = 40
private var myParent;
public var level;// = 1
public var effect;// = "stun"
private var gamePaused:Boolean;// = false
public function EnemyEelChar(){
ypos = -25;
IncrUp = true;
typed = "enemy";
named = "eel";
level = 1;
gold = 15;
hp = 50;
damage = 40;
effect = "stun";
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
}
private function DoMove(){
prevx = this.x;
prevy = this.y;
this.y = ypos;
if (IncrUp){
this.x = ((Math.sin((((((ypos + 25) * 360) / 600) / 180) * Math.PI)) * 125) + 275);
} else {
this.x = ((Math.sin((((((ypos + 25) * 360) / 600) / 180) * Math.PI)) * -125) + 275);
};
if (IncrUp){
this.rotation = 90;
if (ypos < 625){
ypos = (ypos + 2);
} else {
IncrUp = false;
};
} else {
this.rotation = -90;
if (ypos > -75){
ypos = (ypos - 2);
} else {
IncrUp = true;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
movingRight = (this.x < 0);
attacking = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 800)) || ((this.x < -200)))) || ((this.y > 800)))) || ((this.y < -200)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 54
//EnemyHammerChar (EnemyHammerChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemyHammerChar extends BaseMovieClip {
const MOVEDELAY = 0.3;
const MOVESPEED = 20;
const RANGE = 300;
const SCALE = 0.6;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
private var IncrUp:Boolean;// = true
public var gold:int;// = 15
public var typed;// = "enemy"
public var attacking:Boolean;// = false
private var prevx;
public var destroyedTimer:int;// = 0
private var prevy;
public var bodydetect:bodydetector;
public var attackedTimer:int;// = 0
public var attackdetect:attackdetector;
public var hp:int;// = 50
public var shadow:MovieClip;
public var named;// = "hammer"
private var ypos:int;// = -25
private var rotating;
public var damage:int;// = 30
private var myParent;
public var level;// = 1
public var effect;// = "stun"
private var gamePaused:Boolean;// = false
public function EnemyHammerChar(){
ypos = -25;
IncrUp = true;
typed = "enemy";
named = "hammer";
level = 1;
gold = 15;
hp = 50;
damage = 30;
effect = "stun";
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
}
private function DoMove(){
var dx:*;
var dy:*;
prevx = this.x;
prevy = this.y;
this.y = ypos;
if (IncrUp){
this.x = ((Math.sin((((((ypos + 25) * 360) / 600) / 180) * Math.PI)) * 125) + 275);
} else {
this.x = ((Math.sin((((((ypos + 25) * 360) / 600) / 180) * Math.PI)) * -125) + 275);
};
dx = (prevx - this.x);
dy = (this.y - prevy);
if (dx != 0){
rotating = ((Math.atan2(dx, dy) * 180) / Math.PI);
};
if (rotating > 180){
rotating = (rotating - 360);
};
this.SimpleRotate((rotating + 90));
if (IncrUp){
if (ypos < 575){
ypos = (ypos + 2);
} else {
IncrUp = false;
};
} else {
if (ypos > -25){
ypos = (ypos - 2);
} else {
IncrUp = true;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
this.TurnGravityOff();
if (this.y < 0){
IncrUp = true;
ypos = -25;
} else {
IncrUp = false;
ypos = 575;
};
attacking = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 800)) || ((this.x < -200)))) || ((this.y > 800)))) || ((this.y < -200)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 55
//EnemyHydraChar (EnemyHydraChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemyHydraChar extends BaseMovieClip {
const MOVESPEEDH = 40;
const MOVESPEEDV = 1600;
const MOVEDELAY = 0.06;
const SCALE = 0.5;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
public var gold:int;// = 20
public var typed;// = "enemy"
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var destroyedTimer:int;// = 0
public var bodydetect:bodydetector;
private var lastYPos;
public var attackdetect:attackdetector;
public var hp:int;// = 50
public var shadow:MovieClip;
public var named;// = "hydra"
private var initY;
public var damage:int;// = 40
private var myParent;
public var level;// = 1
public var effect;// = "poison"
private var gamePaused:Boolean;// = false
public function EnemyHydraChar(){
typed = "enemy";
named = "hydra";
level = 1;
hp = 50;
damage = 40;
effect = "poison";
gold = 20;
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
if (myParent.thePirate.x < this.x){
this.SetOrientation(true, 0);
} else {
if (myParent.thePirate.x > this.x){
this.SetOrientation(false, 0);
};
};
}
private function DoMove(){
this.MoveLeft(MOVESPEEDH);
this.MoveToY((myParent.thePirate.y - 75));
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
initY = this.y;
attacking = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 650)) || ((this.x < -100)))) || ((this.y > 650)))) || ((this.y < -100)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 56
//EnemyJellyChar (EnemyJellyChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemyJellyChar extends BaseMovieClip {
const MOVEDELAY = 0.1;
const MOVESPEED = 10;
const SCALE = 0.4;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
public var gold:int;// = 10
public var typed;// = "enemy"
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var destroyedTimer:int;// = 0
public var bodydetect:bodydetector;
public var attackdetect:attackdetector;
public var hp:int;// = 30
public var shadow:MovieClip;
public var named;// = "jelly"
public var damage:int;// = 20
private var myParent;
public var level;// = 1
public var effect;// = "poison"
private var gamePaused:Boolean;// = false
public function EnemyJellyChar(){
typed = "enemy";
named = "jelly";
level = 1;
hp = 30;
damage = 20;
gold = 10;
effect = "poison";
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
if (myParent.thePirate.x < (this.x - this.width)){
this.SetOrientation(true, 77);
} else {
if (myParent.thePirate.x > (this.x + this.width)){
this.SetOrientation(false, 77);
};
};
}
private function DoMove(){
this.MoveUp(MOVESPEED);
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
attacking = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 650)) || ((this.x < -100)))) || ((this.y > 650)))) || ((this.y < -100)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 57
//EnemyManager (EnemyManager)
package {
import flash.display.*;
import flash.events.*;
public class EnemyManager {
const INITPOS = 550;
const JELLYSPACE = 30;
const PATTERNSIZE = 10;
const DISPATCHTIMER = 120.01200120012;
private var enemyInit2;
private var enemyPointer:int;// = 0
public var enemies:Array;
public var thePirate;
public var gameLevel:int;
private var enemyInit;// = null
public var gamePaused;// = false
private var enemyPattern1;
private var enemyPattern2;
private var enemyPattern3;
public var gameSublevel:int;
private var patternLoop:int;// = 0
public var enemyCount:int;// = 0
private var dispatchTimer:int;
private var enemyPattern;// = null
public var myParent;
private var enemyInit1;
private var enemyInit3;
public function EnemyManager(_myParent){
enemyPattern1 = new Array("jelly", "jelly", "sting", "jelly", "squid", "jelly", "octo", "jelly", "jelly", "squid");
enemyPattern2 = new Array("saw", "sword", "sword", "tiger", "saw", "sword", "tiger", "sword", "sword", "hammer");
enemyPattern3 = new Array("eel", "manta", "manta", "manta", "snake", "eel", "manta", "manta", "manta", "hydra");
enemyInit1 = new Array(4, 1, -1, 2, 3, 2, 1, 1, 4, 3);
enemyInit2 = new Array(0, -2, 7, 6, 5, 0, -1, 0, 5, 0);
enemyInit3 = new Array(-1, -2, 7, 6, 5, 6, -1, 0, 5, 0);
enemyPointer = 0;
patternLoop = 0;
enemyPattern = null;
enemyInit = null;
enemies = new Array();
enemyCount = 0;
gamePaused = false;
super();
myParent = _myParent;
}
public function GetClosestEnemy(obj):MovieClip{
var i:int;
var j:int;
var dx:Number;
var dy:Number;
var ddx:Number;
var ddy:Number;
var e:*;
i = 0;
j = 0;
dx = 500;
dy = 500;
ddx = 0;
ddy = 0;
e = null;
if (obj){
i = 0;
while (i < enemies.length) {
e = enemies[i];
trace(((((e + ":") + e.x) + ",") + e.y));
if (e){
ddx = (e.x - obj.x);
ddy = (e.y - obj.y);
if (Math.sqrt((Math.pow(ddx, 2) + Math.pow(ddy, 2))) < Math.sqrt((Math.pow(dx, 2) + Math.pow(dy, 2)))){
dx = ddx;
dy = ddy;
j = i;
};
};
i++;
};
return (enemies[j]);
//unresolved jump
};
return (null);
}
private function GetEnemy(_named:String=""):MovieClip{
var obj:*;
var i:int;
i = 0;
while (i < myParent.sceneContainer.numChildren) {
obj = myParent.sceneContainer.getChildAt(i);
if (obj.typed == "enemy"){
if (obj.named == _named){
return (obj);
};
};
i++;
};
return (null);
}
private function DispatchEnemy(_typed, _pointer){
var theEnemy:*;
theEnemy = null;
if (_typed == "jelly"){
theEnemy = new jelly();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = (enemyInit[_pointer] * 100);
theEnemy.y = INITPOS;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
if (enemyInit[_pointer] > 1){
theEnemy = new jelly();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = ((enemyInit[_pointer] * 100) + JELLYSPACE);
theEnemy.y = (INITPOS + JELLYSPACE);
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
};
if ((((enemyInit[_pointer] == 1)) || ((enemyInit[_pointer] == 3)))){
theEnemy = new jelly();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = ((enemyInit[_pointer] * 100) - JELLYSPACE);
theEnemy.y = (INITPOS + JELLYSPACE);
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
};
} else {
if (_typed == "squid"){
theEnemy = new squid();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = (enemyInit[_pointer] * 100);
theEnemy.y = INITPOS;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
} else {
if (_typed == "octo"){
theEnemy = new octo();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = INITPOS;
theEnemy.y = INITPOS;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
} else {
if (_typed == "sting"){
theEnemy = new sting();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = (enemyInit[_pointer] * 100);
theEnemy.y = 0;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
if (enemyInit[_pointer] > 0){
theEnemy = new sting();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = (enemyInit[_pointer] * 100);
theEnemy.y = -100;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
theEnemy = new sting();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = (enemyInit[_pointer] * 100);
theEnemy.y = -50;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
theEnemy = new sting();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = ((enemyInit[_pointer] * 100) + 50);
theEnemy.y = 0;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
theEnemy = new sting();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = ((enemyInit[_pointer] * 100) + 100);
theEnemy.y = 0;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
} else {
theEnemy = new sting();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = (enemyInit[_pointer] * 100);
theEnemy.y = -50;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
theEnemy = new sting();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = ((enemyInit[_pointer] * 100) - 50);
theEnemy.y = 0;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
};
} else {
if (_typed == "saw"){
if (enemyInit[_pointer] < 3){
theEnemy = new saw();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = -200;
theEnemy.y = 0;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
} else {
theEnemy = new saw();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = -200;
theEnemy.y = 500;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
};
} else {
if (_typed == "sword"){
theEnemy = new sword();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = ((enemyInit[_pointer] * 100) - 50);
theEnemy.y = 600;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
} else {
if (_typed == "hammer"){
if (!GetEnemy("hammer")){
theEnemy = new hammer();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = 275;
theEnemy.y = (enemyInit[_pointer] * 100);
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
};
} else {
if (_typed == "tiger"){
theEnemy = new tiger();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = INITPOS;
theEnemy.y = INITPOS;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
} else {
if (_typed == "eel"){
if (!GetEnemy("eel")){
theEnemy = new eel();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = 275;
theEnemy.y = (enemyInit[_pointer] * 100);
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
};
} else {
if (_typed == "manta"){
if (enemyInit[_pointer] < 3){
theEnemy = new manta();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = -200;
theEnemy.y = 0;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
} else {
theEnemy = new manta();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = -200;
theEnemy.y = 500;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
};
} else {
if (_typed == "hydra"){
theEnemy = new hydra();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = INITPOS;
theEnemy.y = INITPOS;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
} else {
if (_typed == "snake"){
theEnemy = new snake();
myParent.sceneContainer.addChild(theEnemy);
theEnemy.x = INITPOS;
theEnemy.y = INITPOS;
theEnemy.Init(this);
InsertEnemyTable(theEnemy);
};
};
};
};
};
};
};
};
};
};
};
};
}
public function StopGame(){
EmptyEnemyTable();
myParent.stageRoot.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function EmptyEnemyTable(){
var i:*;
var obj:*;
i = 0;
obj = null;
while (enemies.length > 0) {
obj = enemies.pop();
if (obj){
obj.Destroy();
};
obj = null;
};
enemyCount = 0;
}
private function RemoveRemainEnemy(){
var obj:*;
var i:*;
obj = null;
i = 0;
while (i < myParent.sceneContainer.numChildren) {
obj = myParent.sceneContainer.getChildAt(i);
if (obj){
if (obj.typed == "enemy"){
obj.visible = false;
obj.Destroy();
};
};
obj = null;
i++;
};
}
public function RemoveEnemy(_theEnemy){
var idx:int;
if (_theEnemy){
idx = enemies.indexOf(_theEnemy);
if (idx >= 0){
enemies.splice(idx, 1);
enemyCount--;
myParent.sceneContainer.removeChild(_theEnemy);
} else {
_theEnemy.visible = false;
myParent.sceneContainer.removeChild(_theEnemy);
};
};
}
private function FrameEnterHandler(event:Event){
if (!myParent.bossFight){
if (dispatchTimer <= 0){
dispatchTimer = DISPATCHTIMER;
if (enemyPointer < PATTERNSIZE){
DispatchEnemy(enemyPattern[enemyPointer], enemyPointer);
enemyPointer++;
} else {
patternLoop++;
enemyPointer = 0;
};
} else {
dispatchTimer--;
};
};
}
public function StartGame(){
gameLevel = myParent.gameLevel;
gameSublevel = myParent.gameSublevel;
dispatchTimer = (DISPATCHTIMER / 10);
enemyPointer = 0;
thePirate = myParent.GetPirate();
enemyPattern = this[("enemyPattern" + myParent.gameLevel)];
enemyInit = this[("enemyInit" + myParent.gameLevel)];
EmptyEnemyTable();
myParent.stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function ResumeGame(){
var obj:*;
var i:*;
obj = null;
i = 0;
gamePaused = false;
i = 0;
while (i < enemies.length) {
obj = enemies[i];
if (obj){
obj.ResumeGame();
};
i++;
};
myParent.stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function InsertEnemyTable(_theEnemy){
if (_theEnemy){
enemies.push(_theEnemy);
enemyCount++;
};
}
public function IncreasePirateGold(_val:int=5){
myParent.pirateMgr.IncreaseGold(_val);
}
public function PauseGame(){
var obj:*;
var i:*;
obj = null;
i = 0;
gamePaused = true;
i = 0;
while (i < enemies.length) {
obj = enemies[i];
if (obj){
obj.PauseGame();
};
i++;
};
myParent.stageRoot.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
}
}//package
Section 58
//EnemyMantaChar (EnemyMantaChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemyMantaChar extends BaseMovieClip {
const MOVEDELAY = 0.1;
const MOVESPEED = 75;
const SCALE = 0.6;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
public var gold:int;// = 15
public var typed;// = "enemy"
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var destroyedTimer:int;// = 0
public var bodydetect:bodydetector;
public var attackdetect:attackdetector;
public var hp:int;// = 40
public var shadow:MovieClip;
public var named;// = "manta"
public var damage:int;// = 30
private var myParent;
public var level;// = 1
private var movingUp:Boolean;
public var effect;// = "slow"
private var gamePaused:Boolean;// = false
public function EnemyMantaChar(){
typed = "enemy";
named = "manta";
level = 1;
hp = 40;
damage = 30;
effect = "slow";
gold = 15;
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
}
private function DoMove(){
if (this.x < -175){
this.SetOrientation(false);
} else {
if (this.x > 725){
this.SetOrientation(true);
};
};
if (this.faceLeft){
this.MoveLeft(MOVESPEED);
} else {
this.MoveRight(MOVESPEED);
};
if (movingUp){
this.MoveUp((MOVESPEED * 0.2));
} else {
this.MoveDown((MOVESPEED * 0.2));
};
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
this.TurnGravityOn(0.5);
if (this.y < 300){
movingUp = false;
} else {
movingUp = true;
};
attacking = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 800)) || ((this.x < -300)))) || ((this.y > 800)))) || ((this.y < -300)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 59
//EnemyOctoChar (EnemyOctoChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemyOctoChar extends BaseMovieClip {
const MOVESPEEDH = 40;
const MOVESPEEDV = 1600;
const MOVEDELAY = 0.06;
const SCALE = 0.5;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
public var gold:int;// = 20
public var typed;// = "enemy"
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var destroyedTimer:int;// = 0
public var bodydetect:bodydetector;
private var lastYPos;
public var attackdetect:attackdetector;
public var hp:int;// = 50
public var shadow:MovieClip;
public var named;// = "octo"
private var initY;
public var damage:int;// = 30
private var myParent;
public var level;// = 1
public var effect;// = "absorb"
private var gamePaused:Boolean;// = false
public function EnemyOctoChar(){
typed = "enemy";
named = "octo";
level = 1;
hp = 50;
damage = 30;
gold = 20;
effect = "absorb";
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (this.currentLabel != "destroyed"){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
if (myParent.thePirate.x < (this.x - 70)){
this.SetOrientation(true, 140);
} else {
if (myParent.thePirate.x > (this.x + 70)){
this.SetOrientation(false, 140);
};
};
}
private function DoMove(){
this.MoveLeft(MOVESPEEDH);
this.MoveToY((myParent.thePirate.y - 75));
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
this.TurnGravityOn(0.5);
initY = this.y;
attacking = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 650)) || ((this.x < -100)))) || ((this.y > 650)))) || ((this.y < -100)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 60
//EnemySawChar (EnemySawChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemySawChar extends BaseMovieClip {
const MOVEDELAY = 0.1;
const MOVESPEED = 50;
const SCALE = 0.6;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
public var gold:int;// = 15
public var typed;// = "enemy"
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var destroyedTimer:int;// = 0
public var bodydetect:bodydetector;
public var attackdetect:attackdetector;
public var hp:int;// = 50
public var shadow:MovieClip;
public var named;// = "saw"
public var damage:int;// = 40
private var myParent;
public var level;// = 1
private var movingUp:Boolean;
public var effect;// = "slow"
private var gamePaused:Boolean;// = false
public function EnemySawChar(){
typed = "enemy";
named = "saw";
level = 1;
hp = 50;
damage = 40;
effect = "slow";
gold = 15;
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
}
private function DoMove(){
if (this.x < -175){
this.SetOrientation(false);
} else {
if (this.x > 725){
this.SetOrientation(true);
};
};
if (this.faceLeft){
this.MoveLeft(MOVESPEED);
} else {
this.MoveRight(MOVESPEED);
};
if (movingUp){
this.MoveUp((MOVESPEED * 0.2));
} else {
this.MoveDown((MOVESPEED * 0.2));
};
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
if (this.y < 300){
movingUp = false;
} else {
movingUp = true;
};
attacking = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 800)) || ((this.x < -300)))) || ((this.y > 800)))) || ((this.y < -300)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 61
//EnemySnakeChar (EnemySnakeChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemySnakeChar extends BaseMovieClip {
const MOVESPEEDH = 40;
const MOVESPEEDV = 1600;
const MOVEDELAY = 0.06;
const SCALE = 0.5;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
public var gold:int;// = 25
public var typed;// = "enemy"
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var destroyedTimer:int;// = 0
public var bodydetect:bodydetector;
private var lastYPos;
public var attackdetect:attackdetector;
public var hp:int;// = 50
public var shadow:MovieClip;
public var named;// = "snake"
private var initY;
public var damage:int;// = 25
private var myParent;
public var level;// = 1
public var effect;// = "poison"
private var gamePaused:Boolean;// = false
public function EnemySnakeChar(){
typed = "enemy";
named = "snake";
level = 1;
hp = 50;
damage = 25;
effect = "poison";
gold = 25;
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
if (myParent.thePirate.x < (this.x - 70)){
this.SetOrientation(true, 140);
} else {
if (myParent.thePirate.x > (this.x + 70)){
this.SetOrientation(false, 140);
};
};
}
private function DoMove(){
this.MoveLeft(MOVESPEEDH);
this.MoveToY((myParent.thePirate.y - 75));
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
initY = this.y;
attacking = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 650)) || ((this.x < -100)))) || ((this.y > 650)))) || ((this.y < -100)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 62
//EnemySquidChar (EnemySquidChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemySquidChar extends BaseMovieClip {
const MOVEDELAY = 0.05;
const MOVESPEED = 100;
const SCALE = 0.6;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
public var gold:int;// = 25
public var typed;// = "enemy"
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var destroyedTimer:int;// = 0
public var bodydetect:bodydetector;
private var lastYPos;
public var attackdetect:attackdetector;
public var hp:int;// = 50
public var shadow:MovieClip;
public var named;// = "squid"
public var damage:int;// = 20
private var myParent;
public var level;// = 1
public var effect;// = "slow"
private var gamePaused:Boolean;// = false
public function EnemySquidChar(){
typed = "enemy";
named = "squid";
level = 1;
hp = 50;
damage = 20;
gold = 25;
effect = "slow";
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (this.currentLabel != "destroyed"){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
if (myParent.thePirate.x < this.x){
this.SetOrientation(false, 70);
} else {
if (myParent.thePirate.x > this.x){
this.SetOrientation(true, 70);
};
};
}
private function DoMove(){
if (Math.abs((this.y - lastYPos)) <= 1){
this.MoveUp(MOVESPEED);
};
lastYPos = this.y;
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
attacking = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 650)) || ((this.x < -100)))) || ((this.y > 650)))) || ((this.y < -100)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 63
//EnemyStingChar (EnemyStingChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemyStingChar extends BaseMovieClip {
const MOVEDELAY = 0.5;
const MOVESPEED = 15;
const SCALE = 0.6;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
public var gold:int;// = 15
public var typed;// = "enemy"
private var movingRight:Boolean;
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var destroyedTimer:int;// = 0
public var bodydetect:bodydetector;
public var attackdetect:attackdetector;
public var hp:int;// = 30
public var shadow:MovieClip;
public var named;// = "sting"
public var damage:int;// = 20
private var myParent;
public var level;// = 1
public var effect;// = "poison"
private var gamePaused:Boolean;// = false
public function EnemyStingChar(){
typed = "enemy";
named = "sting";
level = 1;
hp = 30;
damage = 20;
gold = 15;
effect = "poison";
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (this.currentLabel != "destroyed"){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
}
private function DoMove(){
if (this.y < 375){
if (this.x > 550){
movingRight = false;
this.SetOrientation(false, 95);
} else {
if (this.x < 0){
movingRight = true;
this.SetOrientation(true, 95);
};
};
};
if (movingRight){
this.MoveRight(MOVESPEED);
} else {
this.MoveLeft(MOVESPEED);
};
this.MoveDown((MOVESPEED * 0.25));
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
movingRight = (this.x < 0);
attacking = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 800)) || ((this.x < -200)))) || ((this.y > 800)))) || ((this.y < -200)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 64
//EnemySwordChar (EnemySwordChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemySwordChar extends BaseMovieClip {
const MOVESPEEDH = 20;
const MOVEDELAY = 0.1;
const SCALE = 0.5;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
public var gold:int;// = 25
public var typed;// = "enemy"
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var destroyedTimer:int;// = 0
public var bodydetect:bodydetector;
private var lastYPos;
private var moveSpeed:int;
public var attackdetect:attackdetector;
public var hp:int;// = 50
public var shadow:MovieClip;
public var named;// = "sword"
private var initY;
public var damage:int;// = 50
private var myParent;
public var level;// = 1
private var movingUp:Boolean;
public var effect;// = "critical"
private var attackSound:BaseSound;// = null
private var gamePaused:Boolean;// = false
public function EnemySwordChar(){
typed = "enemy";
named = "sword";
level = 1;
hp = 50;
damage = 50;
effect = "critical";
gold = 25;
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
attackSound = null;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
}
private function DoMove(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
moveSpeed = (MOVESPEEDH * 20);
};
if (moveSpeed < 100){
if (this.x < 50){
this.SetOrientation(false, 75);
} else {
if (this.x > 550){
this.SetOrientation(true, 75);
};
};
};
if (!this.faceLeft){
this.MoveRight(moveSpeed);
} else {
this.MoveLeft(moveSpeed);
};
if (movingUp){
this.MoveUp(3);
} else {
this.MoveDown(3);
};
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
this.TurnGravityOff();
moveSpeed = MOVESPEEDH;
if (this.y < 300){
movingUp = false;
} else {
movingUp = true;
};
initY = this.y;
attacking = false;
if (!attackSound){
attackSound = new swordfish_attack();
};
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 800)) || ((this.x < -300)))) || ((this.y > 800)))) || ((this.y < -300)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 65
//EnemyTigerChar (EnemyTigerChar)
package {
import flash.display.*;
import flash.events.*;
public class EnemyTigerChar extends BaseMovieClip {
const MOVEDELAY = 0.05;
const MOVESPEED = 100;
const SCALE = 0.6;
public var destroyed:Boolean;// = false
public var piratedetect:piratedetector;
public var gold:int;// = 20
public var typed;// = "enemy"
public var attacking:Boolean;// = false
public var attackedTimer:int;// = 0
public var destroyedTimer:int;// = 0
public var bodydetect:bodydetector;
private var lastYPos;
public var attackdetect:attackdetector;
public var hp:int;// = 75
public var shadow:MovieClip;
public var named;// = "tiger"
public var damage:int;// = 40
private var myParent;
public var level;// = 1
public var effect;// = ""
private var gamePaused:Boolean;// = false
public function EnemyTigerChar(){
typed = "enemy";
named = "tiger";
level = 1;
hp = 75;
damage = 40;
effect = "";
gold = 20;
attacking = false;
attackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
gamePaused = false;
super();
}
public function GetDamage():int{
return (damage);
}
public function DetectAttacked(obj):Boolean{
var hit:Boolean;
hit = false;
if (!destroyed){
if (obj){
hit = ((hit) || (bodydetect.hitTestObject(obj)));
};
};
return (hit);
}
private function SetSkin(_skin){
if (_skin == "attack"){
if (this.currentLabel == "stand"){
gotoAndPlay("attack");
};
};
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StopMovement();
}
private function DetectPirate(){
if (piratedetect.hitTestObject(myParent.thePirate.bodydetect)){
SetSkin("attack");
};
if (myParent.thePirate.x < this.x){
this.SetOrientation(false, 150);
} else {
if (myParent.thePirate.x > this.x){
this.SetOrientation(true, 150);
};
};
}
private function DoMove(){
this.MoveLeft(40);
this.MoveToY((myParent.thePirate.y - 75));
}
private function DetectAttack(){
if (this.currentLabel == "attacking"){
if (attackdetect.hitTestObject(myParent.thePirate.bodydetect)){
if (!attacking){
myParent.thePirate.StartAttacked(this);
attacking = true;
};
} else {
if (attacking){
attacking = false;
};
};
} else {
if (attacking){
attacking = false;
};
};
}
private function StopAttacked(){
if (this.shadow){
this.shadow.alpha = 0;
};
}
public function Init(_myParent){
myParent = _myParent;
this.scaleX = SCALE;
this.scaleY = SCALE;
this.scale = SCALE;
this.borderless = true;
this.moveDelay = MOVEDELAY;
attacking = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (hp <= 0){
if (!destroyed){
StartDestroyed();
} else {
destroyedTimer--;
this.MoveUp(15);
if (destroyedTimer <= 0){
Destroy();
};
};
};
if (!destroyed){
DoMove();
DetectPirate();
DetectAttack();
DetectOutScreen();
if (myParent.thePirate.attackdetect){
if (DetectAttacked(myParent.thePirate.attackdetect)){
if (myParent.thePirate.Attacking){
if (attackedTimer <= 0){
StartAttacked(myParent.thePirate);
};
};
};
};
if (attackedTimer > 0){
attackedTimer--;
if (attackedTimer == 0){
StopAttacked();
};
};
};
}
public function StartAttacked(_obj=null){
if (_obj){
hp = (hp - _obj.GetDamage());
};
if (this.shadow){
this.shadow.alpha = 1;
};
attackedTimer = 10;
}
private function DetectOutScreen(){
if ((((((((this.x > 650)) || ((this.x < -100)))) || ((this.y > 650)))) || ((this.y < -100)))){
Destroy();
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.RemoveEnemy(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
this.StartMovement();
}
private function StartDestroyed(){
if (!destroyed){
destroyed = true;
destroyedTimer = 30;
myParent.IncreasePirateGold(gold);
this.gotoAndPlay("destroyed");
};
}
}
}//package
Section 66
//gameover (gameover)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class gameover extends MovieClip {
public var btnmain:SimpleButton;
public var btnretry:SimpleButton;
public function gameover(){
super();
addFrameScript(359, frame360);
}
function frame360(){
stop();
}
}
}//package
Section 67
//gameoverbgm (gameoverbgm)
package {
public dynamic class gameoverbgm extends BaseSound {
public function gameoverbgm(){
super();
}
}
}//package
Section 68
//gold (gold)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class gold extends ItemGoldChar {
public function gold(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 69
//hammer (hammer)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class hammer extends EnemyHammerChar {
public function hammer(){
super();
addFrameScript(19, frame20, 39, frame40, 40, frame41);
}
function frame20(){
gotoAndPlay("stand");
}
function frame40(){
gotoAndPlay("stand");
}
function frame41(){
stop();
}
}
}//package
Section 70
//hydra (hydra)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class hydra extends EnemyHydraChar {
public function hydra(){
super();
addFrameScript(11, frame12, 36, frame37, 37, frame38);
}
function frame37(){
gotoAndPlay("stand");
}
function frame38(){
stop();
}
function frame12(){
gotoAndPlay("stand");
}
}
}//package
Section 71
//instruction1 (instruction1)
package {
import flash.display.*;
public dynamic class instruction1 extends MovieClip {
public var btnskipinstruction1:SimpleButton;
public var Arrow:MovieClip;
public function instruction1(){
super();
}
}
}//package
Section 72
//instruction2 (instruction2)
package {
import flash.display.*;
public dynamic class instruction2 extends MovieClip {
public var btnstartgame:SimpleButton;
public function instruction2(){
super();
}
}
}//package
Section 73
//introlevel1 (introlevel1)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class introlevel1 extends MovieClip {
public var btnskipintro1:SimpleButton;
public function introlevel1(){
super();
addFrameScript(229, frame230);
}
function frame230(){
stop();
}
}
}//package
Section 74
//introlevel2 (introlevel2)
package {
import flash.display.*;
public dynamic class introlevel2 extends MovieClip {
public var btnskipintro2:SimpleButton;
public function introlevel2(){
super();
}
}
}//package
Section 75
//introlevel3 (introlevel3)
package {
import flash.display.*;
public dynamic class introlevel3 extends MovieClip {
public var btnskipintro3:SimpleButton;
public function introlevel3(){
super();
}
}
}//package
Section 76
//introlevelbgm (introlevelbgm)
package {
public dynamic class introlevelbgm extends BaseSound {
public function introlevelbgm(){
super();
}
}
}//package
Section 77
//ItemBreathChar (ItemBreathChar)
package {
import flash.display.*;
import flash.events.*;
public class ItemBreathChar extends MovieClip {
public var named:String;// = "breath"
public var typed:String;// = "item"
private var myParent;
public var level:int;// = 1
private var gamePaused:Boolean;// = false
public function ItemBreathChar(){
typed = "item";
named = "breath";
level = 1;
gamePaused = false;
super();
}
public function Init(_myParent){
myParent = _myParent;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (this.currentFrame == this.totalFrames){
this.Destroy();
} else {
this.y = (this.y - 5);
this.x = (this.x + (Math.sin(((this.y / 10) * Math.PI)) * 2));
this.x = (this.x + (Math.sin(((this.y / 50) * Math.PI)) * 2));
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.Remove(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
}
}//package
Section 78
//ItemCrateChar (ItemCrateChar)
package {
import flash.display.*;
import flash.events.*;
public class ItemCrateChar extends MovieClip {
public var named:String;// = "crate"
public var typed:String;// = "item"
private var destroyTimer:int;// = 0
private var myParent;
private var Health;// = 20
public var level:int;// = 1
public function ItemCrateChar(){
typed = "item";
named = "crate";
level = 1;
Health = 20;
destroyTimer = 0;
super();
}
public function Init(_myParent){
myParent = _myParent;
this.width = 40;
this.height = 40;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
var i:*;
if (Health > 0){
if (((myParent.thePirate.attackdetect) && (myParent.thePirate.Attacking))){
if (this.currentLabel != "hit"){
if (DetectHit(myParent.thePirate.attackdetect)){
Health = (Health - myParent.thePirate.GetDamage());
this.gotoAndPlay("hit");
};
};
};
} else {
if (this.currentLabel != "opened"){
this.gotoAndStop("opened");
StartDestroyTimer();
i = Math.random();
if (i < 0.1){
myParent.IncreasePirateHPotion();
} else {
if (i < 0.2){
myParent.IncreasePirateOPotion();
} else {
if (i < 0.3){
myParent.IncreasePirateHarpoon(25);
} else {
if (i < 0.8){
myParent.IncreasePirateGold(500);
} else {
if (i < 0.9){
myParent.IncreasePirateHealth(250);
} else {
myParent.IncreasePirateOxygen(100);
};
};
};
};
};
};
};
if (destroyTimer > 0){
destroyTimer--;
if (destroyTimer <= 0){
Destroy();
};
};
}
private function StartDestroyTimer(){
if (destroyTimer == 0){
destroyTimer = 30;
};
}
private function DetectHit(obj):Boolean{
var hit:Boolean;
hit = false;
if (obj){
hit = ((hit) || (this.hitTestObject(obj)));
};
return (hit);
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.Remove(this);
}
public function ResumeGame(){
}
public function PauseGame(){
}
}
}//package
Section 79
//ItemDolphinChar (ItemDolphinChar)
package {
import flash.display.*;
import flash.events.*;
public class ItemDolphinChar extends MovieClip {
const SPEED = 10;
private var attachedTimer:int;// = 0
public var attackdetect:attackdetector;
private var targetx:Number;// = 0
private var targety:Number;// = 0
private var attachedTimerDef:int;// = 0
public var named;// = "dolphin"
private var detecting:Boolean;
public var typed;// = "item"
public var damage:int;// = 10
private var moveLeft:Boolean;
public var level;// = 0
private var myParent;
private var attacking:Boolean;// = false
private var targetObj;// = null
private var attached:Boolean;// = false
public var bodydetect:attackdetector;
private var gamePaused:Boolean;// = false
private var angle:Number;// = 0
private var attackTimer:int;// = 0
public function ItemDolphinChar(){
typed = "item";
named = "dolphin";
level = 0;
damage = 10;
angle = 0;
gamePaused = false;
attached = false;
attachedTimer = 0;
attachedTimerDef = 0;
attacking = false;
attackTimer = 0;
targetx = 0;
targety = 0;
targetObj = null;
super();
}
private function StartAttached(){
if (!attached){
attached = true;
attachedTimer = attachedTimerDef;
};
}
private function DetectPirate():Boolean{
var thePirate:*;
var hit:Boolean;
thePirate = myParent.GetPirate();
hit = false;
if (thePirate.bodydetect){
if (this.bodydetect){
hit = thePirate.bodydetect.hitTestObject(this.bodydetect);
};
};
if (detecting){
return (hit);
};
return (false);
}
public function Init(_myParent=null, _t=3600){
myParent = _myParent;
attachedTimerDef = _t;
this.x = -50;
this.y = 100;
moveLeft = (this.x > 275);
this.visible = true;
if (_t > 900){
this.scaleX = 0.5;
this.scaleY = 0.5;
} else {
this.scaleX = 0.6;
this.scaleY = 0.6;
};
attacking = false;
detecting = true;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function GetDamage():Number{
return (damage);
}
private function DetectObjectHit():MovieClip{
var hit:*;
var obj:*;
var i:*;
hit = false;
obj = null;
i = 0;
while (((!(hit)) && ((i < myParent.sceneContainer.numChildren)))) {
obj = myParent.sceneContainer.getChildAt(i);
if (obj.typed == "enemy"){
hit = obj.DetectAttacked(this);
} else {
if (obj.typed == "boss"){
hit = obj.DetectAttacked(this);
};
};
i++;
};
if (hit){
return (obj);
};
return (null);
}
private function StartAttacking(obj=null){
if (attackTimer <= 0){
attackTimer = 30;
if (obj){
obj.StartAttacked(this);
};
};
}
private function FrameEnterHandler(event:Event){
var obj:*;
var thePirate:*;
obj = null;
thePirate = myParent.GetPirate();
trace(((((((((targetx + ",") + targety) + ":") + this.x) + ",") + this.y) + ":") + attacking));
if (!attached){
if (moveLeft){
this.x = (this.x - 3);
this.y = (this.y + 1);
if (this.x < -50){
if (detecting){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
moveLeft = false;
};
};
} else {
this.x = (this.x + 3);
this.y = (this.y + 1);
if (this.x > 600){
if (detecting){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
moveLeft = true;
};
};
};
if (DetectPirate()){
StartAttached();
};
if (!detecting){
if (moveLeft){
this.x = (this.x - 10);
} else {
this.x = (this.x + 10);
};
};
} else {
if (attacking){
if (targetObj){
targetx = targetObj.x;
targety = targetObj.y;
};
if (this.x < targetx){
this.x = (this.x + ((targetx - this.x) * 0.3));
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
} else {
this.x = (this.x + ((targetx - this.x) * 0.3));
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.y < targety){
this.y = (this.y + ((targety - this.y) * 0.3));
} else {
this.y = (this.y + ((targety - this.y) * 0.3));
};
if ((((Math.abs((targetx - this.x)) < 5)) && ((Math.abs((targety - this.y)) < 5)))){
moveLeft = (this.x > thePirate.x);
if (moveLeft){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
} else {
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
attacking = false;
};
} else {
if (moveLeft){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
this.x = (this.x - 10);
if (Math.abs((this.y - thePirate.y)) > 5){
if (this.y < thePirate.y){
this.y = (this.y + 2);
} else {
this.y = (this.y - 2);
};
} else {
this.y = thePirate.y;
};
if (this.x < (thePirate.x - 100)){
moveLeft = false;
};
} else {
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
this.x = (this.x + 10);
if (Math.abs((this.y - thePirate.y)) > 5){
if (this.y < thePirate.y){
this.y = (this.y + 2);
} else {
this.y = (this.y - 2);
};
} else {
this.y = thePirate.y;
};
if (this.x > (thePirate.x + 100)){
moveLeft = true;
};
};
};
obj = DetectObjectHit();
if (obj != null){
if ((((obj.typed == "enemy")) || ((obj.typed == "boss")))){
if (attackTimer <= 0){
StartAttacking(obj);
};
};
};
if (attachedTimer > 0){
attachedTimer--;
if (attachedTimer <= 0){
StopAttached();
};
};
if ((attachedTimer % 150) == 10){
if (!myParent.bossFight){
obj = myParent.GetClosestEnemy(this);
if (obj){
attacking = true;
targetObj = obj;
targetx = obj.x;
targety = obj.y;
};
trace(obj);
} else {
obj = myParent.GetBoss();
if (obj){
attacking = true;
targetObj = obj;
targetx = obj.x;
targety = obj.y;
};
trace(obj);
};
};
};
if (attackTimer > 0){
attackTimer--;
};
if (DetectOutScreen()){
Destroy();
};
}
private function DetectOutScreen():Boolean{
var out:Boolean;
out = false;
out = ((out) || ((this.x < -200)));
out = ((out) || ((this.x > 750)));
out = ((out) || ((this.y < -200)));
out = ((out) || ((this.y > 750)));
return (out);
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.Remove(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function StopAttached(){
if (attached){
attached = false;
detecting = false;
};
}
}
}//package
Section 80
//ItemGoldChar (ItemGoldChar)
package {
import flash.display.*;
import flash.events.*;
public class ItemGoldChar extends MovieClip {
public var named:String;// = "gold"
public var typed:String;// = "item"
private var myParent;
public var level:int;// = 1
public function ItemGoldChar(){
typed = "item";
named = "gold";
level = 1;
super();
}
public function Init(_myParent){
myParent = _myParent;
this.width = 40;
this.height = 40;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (this.y < -100){
if (this.currentLabel == "destroyed"){
Destroy();
};
};
if (((myParent.thePirate.bodydetect) && (!((this.currentLabel == "destroyed"))))){
if (DetectHit(myParent.thePirate.bodydetect)){
myParent.IncreasePirateGold(100);
gotoAndStop("destroyed");
};
};
}
private function DetectHit(obj):Boolean{
var hit:Boolean;
hit = false;
if (obj){
hit = ((hit) || (this.hitTestObject(obj)));
};
return (hit);
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.Remove(this);
}
public function ResumeGame(){
}
public function PauseGame(){
}
}
}//package
Section 81
//ItemManager (ItemManager)
package {
import flash.display.*;
import flash.events.*;
public class ItemManager {
private var crateCount:int;// = 2
public var itemArray:Array;
private var goldMapLv11:Array;
private var goldMapLv12:Array;
public var thePirate;
private var timerEnabled:Boolean;// = true
private var timer:int;// = 0
private var goldMapLv22:Array;
private var seaweedMapLv11:Array;
private var seaweedMapLv12:Array;
public var sceneContainer;// = null
private var gameSublevel:int;// = 1
private var goldMapLv21:Array;
private var crateMapLv11:Array;
private var goldMapLv32:Array;
private var seaweedMapLv21:Array;
private var seaweedMapLv22:Array;
private var crateMapLv12:Array;
private var pearlCount:int;// = 1
private var goldMapLv31:Array;
private var myParent;
private var pearlMapLv11:Array;
private var crateMapLv21:Array;
private var crateMapLv22:Array;
private var seaweedMapLv31:Array;
private var seaweedMapLv32:Array;
private var goldCount:int;// = 4
private var pearlMapLv12:Array;
private var pearlMapLv21:Array;
private var pearlMapLv22:Array;
private var crateMapLv31:Array;
private var crateMapLv32:Array;
public var bossFight:Boolean;
private var gameLevel:int;// = 1
private var seaweedCount:int;// = 3
public var itemCount:int;// = 0
private var pearlMapLv31:Array;
private var pearlMapLv32:Array;
private var gamePaused;// = false
public function ItemManager(_myParent){
gameLevel = 1;
gameSublevel = 1;
timer = 0;
timerEnabled = true;
seaweedCount = 3;
seaweedMapLv11 = new Array(110, 810, 500, 1120, 560, 1360);
seaweedMapLv12 = new Array(460, 310, 100, 540, 140, 1220);
seaweedMapLv21 = new Array(155, 1370, 570, 1375, 115, 860);
seaweedMapLv22 = new Array(130, 745, 510, 840, 575, 1120);
seaweedMapLv31 = new Array(220, 1200, 400, 1030, 150, 750);
seaweedMapLv32 = new Array(190, 590, 445, 410, 450, 900);
crateCount = 2;
crateMapLv11 = new Array(620, 1360, 100, 1275);
crateMapLv12 = new Array(170, 825, 140, 1410);
crateMapLv21 = new Array(100, 1370, 610, 1375);
crateMapLv22 = new Array(80, 745, 590, 840);
crateMapLv31 = new Array(75, 1230, 555, 1020);
crateMapLv32 = new Array(550, 410, 70, 840);
goldCount = 4;
goldMapLv11 = new Array(190, 800, 375, 1100, 150, 810, 510, 1350);
goldMapLv12 = new Array(340, 290, 230, 550, 260, 810, 450, 950);
goldMapLv21 = new Array(190, 1360, 220, 1360, 470, 1370, 520, 1370);
goldMapLv22 = new Array(415, 440, 180, 730, 450, 830, 480, 830);
goldMapLv31 = new Array(100, 750, 130, 1220, 360, 1030, 200, 740);
goldMapLv32 = new Array(400, 400, 250, 560, 420, 650, 250, 810);
pearlCount = 1;
pearlMapLv11 = new Array(160, 1275);
pearlMapLv12 = new Array(180, 550);
pearlMapLv21 = new Array(595, 1120);
pearlMapLv22 = new Array(480, 440);
pearlMapLv31 = new Array(520, 1370);
pearlMapLv32 = new Array(270, 1060);
itemArray = new Array();
itemCount = 0;
sceneContainer = null;
gamePaused = false;
super();
myParent = _myParent;
}
public function GetClosestEnemy(obj):MovieClip{
return (myParent.enemyMgr.GetClosestEnemy(obj));
}
public function IncreasePirateOPotion(_val:int=1){
myParent.pirateMgr.IncreaseOxygenPotion(1);
}
public function DispatchGold(){
var obj:*;
var goldMap:*;
var i:int;
obj = null;
goldMap = this[(("goldMapLv" + gameLevel) + gameSublevel)];
i = 0;
i = 0;
while (i < goldCount) {
obj = new gold();
obj.x = goldMap[(2 * i)];
obj.y = goldMap[((2 * i) + 1)];
myParent.sceneContainer.addChild(obj);
obj.Init(this);
if (obj){
itemArray.push(obj);
itemCount++;
};
i++;
};
}
public function GetPirate():MovieClip{
return (thePirate);
}
public function StopGame(){
EmptyItemTable();
timerEnabled = false;
myParent.stageRoot.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
timer++;
if ((timer % 180) == 0){
DispatchBreath();
};
if ((timer % 200) == 0){
DispatchBreath();
};
if ((timer % 300) == 0){
DispatchOxygen();
};
if ((((timer == 2700)) && (!(bossFight)))){
DispatchDolphin(300);
};
}
public function IncreasePirateHPotion(_val:int=1){
myParent.pirateMgr.IncreaseHealthPotion(1);
}
public function DispatchCrate(){
var obj:*;
var crateMap:*;
var i:int;
obj = null;
crateMap = this[(("crateMapLv" + gameLevel) + gameSublevel)];
i = 0;
i = 0;
while (i < crateCount) {
obj = new crate();
obj.x = crateMap[(2 * i)];
obj.y = crateMap[((2 * i) + 1)];
myParent.sceneContainer.addChild(obj);
obj.Init(this);
if (obj){
itemArray.push(obj);
itemCount++;
};
i++;
};
}
public function StartGame(){
gameLevel = myParent.gameLevel;
gameSublevel = myParent.gameSublevel;
timer = 0;
bossFight = false;
timerEnabled = true;
thePirate = myParent.GetPirate();
sceneContainer = myParent.sceneContainer;
EmptyItemTable();
DispatchSeaweed();
DispatchCrate();
DispatchGold();
DispatchPearl();
myParent.stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function IncreasePirateHarpoon(_val:int=25){
myParent.pirateMgr.IncreaseHarpoon(_val);
}
public function IncreasePirateGold(_val:int=5){
myParent.pirateMgr.IncreaseGold(_val);
}
public function IncreasePirateHealth(_val:int=25){
myParent.pirateMgr.IncreaseHealth(_val);
}
public function StartBossFight(){
bossFight = true;
timerEnabled = false;
DispatchDolphin();
}
private function DispatchBreath(){
var br:*;
br = new breath();
br.x = thePirate.x;
br.y = (thePirate.y - 20);
if (bossFight){
br.scaleX = 0.3;
br.scaleY = 0.3;
} else {
br.scaleX = 0.5;
br.scaleY = 0.5;
};
myParent.sceneContainer.addChild(br);
br.Init(this);
myParent.pirateMgr.ReduceOxygen();
if (br){
itemArray.push(br);
itemCount++;
};
}
public function Remove(_obj){
var idx:int;
if (_obj){
idx = itemArray.indexOf(_obj);
if (idx >= 0){
itemArray.splice(idx, 1);
itemCount--;
myParent.sceneContainer.removeChild(_obj);
} else {
_obj.visible = false;
myParent.sceneContainer.removeChild(_obj);
};
};
}
public function DispatchSeaweed(){
var sw:*;
var seaweedMap:*;
var i:int;
sw = null;
seaweedMap = this[(("seaweedMapLv" + gameLevel) + gameSublevel)];
i = 0;
i = 0;
while (i < seaweedCount) {
sw = new seaweed();
sw.x = seaweedMap[(2 * i)];
sw.y = seaweedMap[((2 * i) + 1)];
myParent.sceneContainer.addChild(sw);
sw.Init(this);
if (sw){
itemArray.push(sw);
itemCount++;
};
i++;
};
}
public function GetBoss():MovieClip{
return (myParent.bossMgr.theBoss);
}
public function DispatchPearl(){
var obj:*;
var pearlMap:*;
var i:int;
obj = null;
pearlMap = this[(("pearlMapLv" + gameLevel) + gameSublevel)];
i = 0;
i = 0;
while (i < pearlCount) {
obj = new pearl();
obj.x = pearlMap[(2 * i)];
obj.y = pearlMap[((2 * i) + 1)];
myParent.sceneContainer.addChild(obj);
obj.Init(this);
if (obj){
itemArray.push(obj);
itemCount++;
};
i++;
};
}
private function EmptyItemTable(){
var i:*;
var obj:*;
i = 0;
obj = null;
while (itemArray.length > 0) {
obj = itemArray.pop();
if (obj){
obj.Destroy();
};
};
itemCount = 0;
}
private function DispatchOxygen(){
var ox:*;
ox = new oxygen();
ox.x = ((thePirate.x + (Math.random() * 200)) - 100);
ox.y = 600;
if (bossFight){
ox.scaleX = 0.2;
ox.scaleY = 0.2;
} else {
ox.scaleX = 0.3;
ox.scaleY = 0.3;
};
myParent.sceneContainer.addChild(ox);
ox.Init(this);
if (ox){
itemArray.push(ox);
itemCount++;
};
}
public function IncreasePirateOxygen(_val:int=15){
myParent.pirateMgr.IncreaseOxygen(_val);
}
public function ResumeGame(){
var obj:*;
var i:*;
obj = null;
i = 0;
gamePaused = false;
if (!bossFight){
timerEnabled = true;
};
i = 0;
while (i < 100) {
obj = itemArray[i];
if (obj){
obj.ResumeGame();
};
i++;
};
myParent.stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function DispatchDolphin(t:int=1800){
var dl:*;
dl = new dolphin();
myParent.sceneContainer.addChild(dl);
dl.Init(this, t);
if (dl){
itemArray.push(dl);
itemCount++;
};
}
public function PauseGame(){
var obj:*;
var i:*;
obj = null;
i = 0;
gamePaused = true;
timerEnabled = false;
i = 0;
while (i < 100) {
obj = itemArray[i];
if (obj){
obj.PauseGame();
};
i++;
};
myParent.stageRoot.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
}
}//package
Section 82
//ItemOxygenChar (ItemOxygenChar)
package {
import flash.display.*;
import flash.events.*;
public class ItemOxygenChar extends MovieClip {
public var named:String;// = "oxygen"
public var typed:String;// = "item"
private var myParent;
public var level:int;// = 1
private var gamePaused:Boolean;// = false
public function ItemOxygenChar(){
typed = "item";
named = "oxygen";
level = 1;
gamePaused = false;
super();
}
public function Init(_myParent){
myParent = _myParent;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (this.y < -100){
Destroy();
} else {
this.y = (this.y - 2);
this.x = (this.x + (Math.sin(((this.y * Math.PI) / 50)) * 2));
};
if (((myParent.thePirate.bodydetect) && (!((this.currentLabel == "destroyed"))))){
if (DetectHit(myParent.thePirate.bodydetect)){
myParent.IncreasePirateOxygen();
gotoAndStop("destroyed");
};
};
}
private function DetectHit(obj):Boolean{
var hit:Boolean;
hit = false;
if (obj){
hit = ((hit) || (this.hitTestObject(obj)));
};
return (hit);
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.Remove(this);
}
public function ResumeGame(){
gamePaused = false;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function PauseGame(){
gamePaused = true;
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
}
}//package
Section 83
//ItemPearlChar (ItemPearlChar)
package {
import flash.display.*;
import flash.events.*;
public class ItemPearlChar extends MovieClip {
public var named:String;// = "pearl"
public var typed:String;// = "item"
private var myParent;
public var level:int;// = 1
public function ItemPearlChar(){
typed = "item";
named = "pearl";
level = 1;
super();
}
public function Init(_myParent){
myParent = _myParent;
this.width = 40;
this.height = 40;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (this.y < -100){
if (this.currentLabel == "destroyed"){
Destroy();
};
};
if (((myParent.thePirate.bodydetect) && (!((this.currentLabel == "destroyed"))))){
if (DetectHit(myParent.thePirate.bodydetect)){
myParent.IncreasePirateGold(250);
gotoAndStop("destroyed");
};
};
}
private function DetectHit(obj):Boolean{
var hit:Boolean;
hit = false;
if (obj){
hit = ((hit) || (this.hitTestObject(obj)));
};
return (hit);
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.Remove(this);
}
public function ResumeGame(){
}
public function PauseGame(){
}
}
}//package
Section 84
//ItemSeaweedChar (ItemSeaweedChar)
package {
import flash.display.*;
import flash.events.*;
public class ItemSeaweedChar extends MovieClip {
public var named:String;// = "seaweed"
public var typed:String;// = "item"
private var myParent;
public var level:int;// = 1
public function ItemSeaweedChar(){
typed = "item";
named = "seaweed";
level = 1;
super();
}
public function Init(_myParent){
myParent = _myParent;
this.width = 40;
this.height = 40;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
if (this.x < -100){
Destroy();
};
if (((myParent.thePirate.bodydetect) && (!((this.currentLabel == "destroyed"))))){
if (DetectHit(myParent.thePirate.bodydetect)){
myParent.IncreasePirateHealth(50);
gotoAndStop("destroyed");
};
};
}
private function DetectHit(obj):Boolean{
var hit:Boolean;
hit = false;
if (obj){
hit = ((hit) || (this.hitTestObject(obj)));
};
return (hit);
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.Remove(this);
}
public function ResumeGame(){
}
public function PauseGame(){
}
}
}//package
Section 85
//jelly (jelly)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class jelly extends EnemyJellyChar {
public function jelly(){
super();
addFrameScript(29, frame30, 59, frame60, 60, frame61);
}
function frame30(){
gotoAndPlay("stand");
}
function frame60(){
gotoAndPlay("stand");
}
function frame61(){
stop();
}
}
}//package
Section 86
//levelpanel (levelpanel)
package {
import flash.display.*;
import flash.text.*;
public dynamic class levelpanel extends MovieClip {
public var levelpaneltxt:TextField;
public function levelpanel(){
super();
}
}
}//package
Section 87
//levibgm (levibgm)
package {
public dynamic class levibgm extends BaseSound {
public function levibgm(){
super();
}
}
}//package
Section 88
//mainmenu (mainmenu)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class mainmenu extends MovieClip {
public var btnaddgame:SimpleButton;
public var btnplaygame:SimpleButton;
public var btncredits:SimpleButton;
public var btnplaymore:SimpleButton;
public function mainmenu(){
super();
addFrameScript(79, frame80);
}
function frame80(){
stop();
}
}
}//package
Section 89
//mainmenubgm (mainmenubgm)
package {
public dynamic class mainmenubgm extends BaseSound {
public function mainmenubgm(){
super();
}
}
}//package
Section 90
//manta (manta)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class manta extends EnemyMantaChar {
public function manta(){
super();
addFrameScript(23, frame24, 46, frame47, 47, frame48);
}
function frame24(){
gotoAndPlay("stand");
}
function frame48(){
stop();
}
function frame47(){
gotoAndPlay("stand");
}
}
}//package
Section 91
//menu (menu)
package {
import flash.display.*;
import flash.text.*;
public dynamic class menu extends MovieClip {
public var btnmenuupgrade:SimpleButton;
public var btnmenubuy:SimpleButton;
public var goldtxt:TextField;
public var noticetxt:TextField;
public var btnmenudone:SimpleButton;
public function menu(){
super();
}
}
}//package
Section 92
//menubgm (menubgm)
package {
public dynamic class menubgm extends BaseSound {
public function menubgm(){
super();
}
}
}//package
Section 93
//menubuy (menubuy)
package {
import flash.display.*;
import flash.text.*;
public dynamic class menubuy extends MovieClip {
public var btnbuyopotion:SimpleButton;
public var goldtxt:TextField;
public var btnbuyhpotion:SimpleButton;
public var btnbuydone:SimpleButton;
public var btnsellopotion:SimpleButton;
public var opotiontxt:TextField;
public var hpotiontxt:TextField;
public var noticetxt:TextField;
public var btnsellhpotion:SimpleButton;
public function menubuy(){
super();
}
}
}//package
Section 94
//MenuManager (MenuManager)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class MenuManager extends Sprite {
private var stageRoot;
private var moreGameURL:URLRequest;
public var nextpage:String;
public var next1page:String;
private var addGameURL:URLRequest;
public var prevpage:String;
private var myParent;
public var page:String;
private var thePage;
private var theWindow;
public var showing:Boolean;
private var menuContainer;
public function MenuManager(_myParent){
addGameURL = new URLRequest("http://www.freshnewgames.com/webmaster_games.html");
moreGameURL = new URLRequest("http://www.freshnewgames.com/");
super();
myParent = _myParent;
stageRoot = myParent.stageRoot;
menuContainer = myParent.menuContainer;
thePage = null;
showing = false;
}
private function ResetPauseMenu(){
var thePirate:*;
thePirate = myParent.GetPirate();
thePage.goldtxt.text = thePirate.Gold;
thePage.harpoontxt.text = thePirate.Harpoon;
thePage.hpotiontxt.text = (thePirate.HealthPotion + "/3");
thePage.opotiontxt.text = (thePirate.OxygenPotion + "/3");
if (thePirate.Boots){
thePage.bootstxt.text = "Equipped";
};
if (thePirate.Tanks){
thePage.tankstxt.text = "Equipped";
};
switch (thePirate.WeaponTypeInt){
case 1:
thePage.big1.visible = true;
thePage.btnred.visible = false;
thePage.big2.visible = false;
thePage.big3.visible = false;
thePage.big4.visible = false;
thePage.big5.visible = false;
thePage.btnblue.visible = true;
thePage.btngreen.visible = true;
thePage.btnyellow.visible = true;
thePage.btnorange.visible = true;
break;
case 2:
thePage.big2.visible = true;
thePage.btnblue.visible = false;
thePage.big1.visible = false;
thePage.big3.visible = false;
thePage.big4.visible = false;
thePage.big5.visible = false;
thePage.btnred.visible = true;
thePage.btngreen.visible = true;
thePage.btnyellow.visible = true;
thePage.btnorange.visible = true;
break;
case 3:
thePage.big3.visible = true;
thePage.btngreen.visible = false;
thePage.big1.visible = false;
thePage.big2.visible = false;
thePage.big4.visible = false;
thePage.big5.visible = false;
thePage.btnred.visible = true;
thePage.btnblue.visible = true;
thePage.btnyellow.visible = true;
thePage.btnorange.visible = true;
break;
case 4:
thePage.big4.visible = true;
thePage.btnyellow.visible = false;
thePage.big1.visible = false;
thePage.big2.visible = false;
thePage.big3.visible = false;
thePage.big5.visible = false;
thePage.btnred.visible = true;
thePage.btnblue.visible = true;
thePage.btngreen.visible = true;
thePage.btnorange.visible = true;
break;
case 5:
thePage.big5.visible = true;
thePage.btnorange.visible = false;
thePage.big1.visible = false;
thePage.big2.visible = false;
thePage.big3.visible = false;
thePage.big4.visible = false;
thePage.btnred.visible = true;
thePage.btnblue.visible = true;
thePage.btngreen.visible = true;
thePage.btnyellow.visible = true;
break;
};
}
private function PrevClick(event:MouseEvent){
EndPage();
ShowPage(prevpage);
}
private function MoreClick(event:MouseEvent){
navigateToURL(moreGameURL, "_blank");
}
private function RefreshMenuUpgrade(){
var thePirate:*;
thePirate = myParent.GetPirate();
thePage.goldtxt.text = thePirate.Gold;
if (thePirate.Boots){
thePage.btnbuyboots.visible = false;
thePage.bootstxt.text = "Boots (Equipped)";
};
if (thePirate.Tanks){
thePage.btnbuytanks.visible = false;
thePage.tankstxt.text = "Tanks (Equipped)";
};
if (((thePirate.Tanks) && (thePirate.Boots))){
thePage.noticetxt.text = "Nothing to buy? Anything to upgrade?";
};
}
private function RefreshMenuUpgradeSword(){
var thePirate:*;
thePirate = myParent.GetPirate();
thePage.goldtxt.text = thePirate.Gold;
if (thePirate.GetSwordLevel() == 1){
thePage.swordlevel2.visible = true;
thePage.swordlevel3.visible = false;
} else {
if (thePirate.GetSwordLevel() == 2){
thePage.swordlevel2.visible = false;
thePage.swordlevel3.visible = true;
} else {
thePage.swordlevel2.visible = false;
thePage.swordlevel3.visible = false;
thePage.btnupgradesword.visible = false;
thePage.noticetxt.text = "What about upgrading gun?";
};
};
}
public function ShowMenu(){
ShowPage("menu");
}
public function ShowGameOver(){
ShowPage("gameover");
}
private function BtnOrangeClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
thePirate.WeaponType = "orange";
thePirate.WeaponTypeInt = 5;
ResetPauseMenu();
}
private function BtnOPotionClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
if (thePirate.OxygenPotion > 0){
thePirate.UseOxygenPotion();
ResetPauseMenu();
};
}
private function CreditsClick(event:MouseEvent){
if (theWindow){
menuContainer.removeChild(theWindow);
theWindow = null;
};
theWindow = new creditswindow();
theWindow.x = 275;
theWindow.y = 275;
menuContainer.addChild(theWindow);
theWindow.closebtn.addEventListener(MouseEvent.CLICK, CloseWindowClick);
}
private function NextClick(event:MouseEvent){
EndPage();
ShowPage(nextpage);
}
private function UpgradeGunClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
if (thePirate.GetGunLevel() == 1){
if (thePirate.Gold >= 1500){
thePirate.IncreaseGunLevel();
thePirate.ReduceGold(1500);
RefreshMenuUpgradeGun();
} else {
thePage.noticetxt.text = "Not enough money";
};
} else {
if (thePirate.GetGunLevel() == 2){
if (thePirate.Gold >= 2500){
thePirate.IncreaseGunLevel();
thePirate.ReduceGold(2500);
RefreshMenuUpgradeGun();
} else {
thePage.noticetxt.text = "Not enough money";
};
};
};
}
private function BuyTanksClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
if (((!(thePirate.Tanks)) && ((thePirate.Gold >= 2500)))){
thePirate.IncreaseTanks();
thePirate.ReduceGold(2500);
RefreshMenuUpgrade();
} else {
if (thePirate.Gold < 2500){
thePage.noticetxt.text = "Not enough money";
} else {
thePage.noticetxt.text = "Tanks already equipped";
};
};
}
public function ShowPage(_page:String){
if (_page == "intro"){
prevpage = page;
nextpage = "mainmenu";
page = _page;
showing = true;
thePage = new prolog();
thePage.x = 275;
thePage.y = 275;
menuContainer.addChild(thePage);
myParent.ResetLevel();
thePage.btnskipprolog.addEventListener(MouseEvent.CLICK, NextClick);
stageRoot.addEventListener(Event.ENTER_FRAME, EndFrameHandler);
} else {
if (_page == "mainmenu"){
prevpage = page;
nextpage = "instruction1";
page = _page;
showing = true;
thePage = new mainmenu();
thePage.x = 275;
thePage.y = 275;
menuContainer.addChild(thePage);
thePage.btnplaygame.addEventListener(MouseEvent.CLICK, NextClick);
thePage.btnaddgame.addEventListener(MouseEvent.CLICK, AddClick);
thePage.btnplaymore.addEventListener(MouseEvent.CLICK, MoreClick);
thePage.btncredits.addEventListener(MouseEvent.CLICK, CreditsClick);
} else {
if (_page == "instruction1"){
prevpage = page;
nextpage = "instruction2";
page = _page;
showing = true;
thePage = new instruction1();
thePage.x = 275;
thePage.y = 275;
menuContainer.addChild(thePage);
thePage.btnskipinstruction1.addEventListener(MouseEvent.CLICK, NextClick);
} else {
if (_page == "instruction2"){
prevpage = "instruction1";
nextpage = "story";
page = _page;
showing = true;
thePage = new instruction2();
thePage.x = 275;
thePage.y = 275;
menuContainer.addChild(thePage);
thePage.btnstartgame.addEventListener(MouseEvent.CLICK, NextClick);
} else {
if (_page == "story"){
prevpage = page;
nextpage = "introlevel1";
page = _page;
showing = true;
thePage = new story();
thePage.x = 275;
thePage.y = 275;
menuContainer.addChild(thePage);
thePage.btnskipstory.addEventListener(MouseEvent.CLICK, NextClick);
stageRoot.addEventListener(Event.ENTER_FRAME, EndFrameHandler);
} else {
if (_page == "introlevel1"){
prevpage = page;
nextpage = page;
page = _page;
showing = true;
thePage = new introlevel1();
thePage.x = 275;
thePage.y = 275;
thePage.width = 650;
thePage.height = 600;
menuContainer.addChild(thePage);
myParent.soundMgr.playBgm(2);
thePage.btnskipintro1.addEventListener(MouseEvent.CLICK, SkipIntroHandler);
stageRoot.addEventListener(Event.ENTER_FRAME, StartGameHandler);
} else {
if (_page == "introlevel2"){
prevpage = page;
nextpage = page;
page = _page;
showing = true;
thePage = new introlevel2();
thePage.x = 275;
thePage.y = 275;
thePage.width = 650;
thePage.height = 600;
menuContainer.addChild(thePage);
myParent.soundMgr.playBgm(2);
thePage.btnskipintro2.addEventListener(MouseEvent.CLICK, SkipIntroHandler);
stageRoot.addEventListener(Event.ENTER_FRAME, StartGameHandler);
} else {
if (_page == "introlevel3"){
prevpage = page;
nextpage = page;
page = _page;
showing = true;
thePage = new introlevel3();
thePage.x = 275;
thePage.y = 275;
thePage.width = 650;
thePage.height = 600;
menuContainer.addChild(thePage);
myParent.soundMgr.playBgm(2);
thePage.btnskipintro3.addEventListener(MouseEvent.CLICK, SkipIntroHandler);
stageRoot.addEventListener(Event.ENTER_FRAME, StartGameHandler);
} else {
if (_page == "gameover"){
prevpage = page;
nextpage = "mainmenu";
page = _page;
showing = true;
thePage = new gameover();
thePage.x = 275;
thePage.y = 275;
menuContainer.addChild(thePage);
thePage.btnretry.addEventListener(MouseEvent.CLICK, MenuDoneHandler);
thePage.btnmain.addEventListener(MouseEvent.CLICK, NextClick);
} else {
if (_page == "ending"){
prevpage = page;
nextpage = "mainmenu";
page = _page;
showing = true;
thePage = new ending();
thePage.x = 275;
thePage.y = 275;
menuContainer.addChild(thePage);
thePage.btnendingback.addEventListener(MouseEvent.CLICK, NextClick);
thePage.btnendingplaymore.addEventListener(MouseEvent.CLICK, MoreClick);
} else {
if (_page == "pause"){
prevpage = page;
nextpage = page;
page = _page;
showing = true;
thePage = new pausemenu();
thePage.x = 275;
thePage.y = 275;
menuContainer.addChild(thePage);
thePage.big1.visible = false;
thePage.big2.visible = false;
thePage.big3.visible = false;
thePage.big4.visible = false;
thePage.big5.visible = false;
thePage.btnred.addEventListener(MouseEvent.CLICK, BtnRedClick);
thePage.btnblue.addEventListener(MouseEvent.CLICK, BtnBlueClick);
thePage.btngreen.addEventListener(MouseEvent.CLICK, BtnGreenClick);
thePage.btnyellow.addEventListener(MouseEvent.CLICK, BtnYellowClick);
thePage.btnorange.addEventListener(MouseEvent.CLICK, BtnOrangeClick);
thePage.btnhpotion.addEventListener(MouseEvent.CLICK, BtnHPotionClick);
thePage.btnopotion.addEventListener(MouseEvent.CLICK, BtnOPotionClick);
thePage.btnresumegame.addEventListener(MouseEvent.CLICK, ResumeGameHandler);
thePage.btnquitgame.addEventListener(MouseEvent.CLICK, StopGameHandler);
ResetPauseMenu();
} else {
if (_page == "menu"){
prevpage = page;
nextpage = "menubuy";
next1page = "menuupgrade";
page = _page;
showing = true;
thePage = new menu();
thePage.x = 275;
thePage.y = 275;
thePage.width = 640;
menuContainer.addChild(thePage);
thePage.btnmenubuy.addEventListener(MouseEvent.CLICK, NextClick);
thePage.btnmenuupgrade.addEventListener(MouseEvent.CLICK, Next1Click);
thePage.btnmenudone.addEventListener(MouseEvent.CLICK, MenuDoneHandler);
RefreshMenu();
} else {
if (_page == "menubuy"){
prevpage = "menu";
nextpage = page;
page = _page;
showing = true;
thePage = new menubuy();
thePage.x = 275;
thePage.y = 275;
thePage.width = 640;
menuContainer.addChild(thePage);
thePage.btnbuydone.addEventListener(MouseEvent.CLICK, PrevClick);
thePage.btnbuyhpotion.addEventListener(MouseEvent.CLICK, BuyHPotionClick);
thePage.btnsellhpotion.addEventListener(MouseEvent.CLICK, SellHPotionClick);
thePage.btnbuyopotion.addEventListener(MouseEvent.CLICK, BuyOPotionClick);
thePage.btnsellopotion.addEventListener(MouseEvent.CLICK, SellOPotionClick);
RefreshMenuBuy();
} else {
if (_page == "menuupgrade"){
prevpage = "menu";
nextpage = "menuupgradesword";
next1page = "menuupgradegun";
page = _page;
showing = true;
thePage = new menuupgrade();
thePage.x = 275;
thePage.y = 275;
thePage.width = 640;
menuContainer.addChild(thePage);
thePage.btnupgradedone.addEventListener(MouseEvent.CLICK, PrevClick);
thePage.btnupgradesword.addEventListener(MouseEvent.CLICK, NextClick);
thePage.btnupgradegun.addEventListener(MouseEvent.CLICK, Next1Click);
thePage.btnbuyboots.addEventListener(MouseEvent.CLICK, BuyBootsClick);
thePage.btnbuytanks.addEventListener(MouseEvent.CLICK, BuyTanksClick);
RefreshMenuUpgrade();
} else {
if (_page == "menuupgradegun"){
prevpage = "menuupgrade";
nextpage = page;
page = _page;
showing = true;
thePage = new menuupgradegun();
thePage.x = 275;
thePage.y = 275;
thePage.width = 640;
menuContainer.addChild(thePage);
thePage.btnupgradegun.addEventListener(MouseEvent.CLICK, UpgradeGunClick);
thePage.btnupgradegundone.addEventListener(MouseEvent.CLICK, PrevClick);
RefreshMenuUpgradeGun();
} else {
if (_page == "menuupgradesword"){
prevpage = "menuupgrade";
nextpage = page;
page = _page;
showing = true;
thePage = new menuupgradesword();
thePage.x = 275;
thePage.y = 275;
thePage.width = 640;
menuContainer.addChild(thePage);
thePage.btnupgradesword.addEventListener(MouseEvent.CLICK, UpgradeSwordClick);
thePage.btnupgradesworddone.addEventListener(MouseEvent.CLICK, PrevClick);
RefreshMenuUpgradeSword();
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
}
public function ShowEndMovie(){
ShowPage("ending");
}
private function BuyOPotionClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
if ((((thePirate.Gold >= 120)) && ((thePirate.OxygenPotion < 3)))){
thePirate.IncreaseOxygenPotion(1);
thePirate.ReduceGold(120);
RefreshMenuBuy();
} else {
if (thePirate.Gold < 120){
thePage.noticetxt.text = "Not enough gold";
} else {
thePage.noticetxt.text = "No place for new one";
};
};
}
private function StartGameHandler(event:Event){
if (thePage.currentFrame == thePage.totalFrames){
EndPage();
menuContainer.stage.focus = stageRoot;
myParent.StartGame();
};
}
private function SellOPotionClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
if (thePirate.OxygenPotion > 0){
thePirate.ReduceOxygenPotion(1);
thePirate.IncreaseGold(80);
RefreshMenuBuy();
} else {
thePage.noticetxt.text = "No oxygen potion";
};
}
private function ResumeGameHandler(event:MouseEvent){
menuContainer.stage.focus = stageRoot;
myParent.ResumeGame();
}
private function BuyBootsClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
if (((!(thePirate.Boots)) && ((thePirate.Gold >= 2000)))){
thePirate.Boots = true;
thePirate.ReduceGold(2000);
RefreshMenuUpgrade();
} else {
if (thePirate.Gold < 2000){
thePage.noticetxt.text = "Not enough money";
} else {
thePage.noticetxt.text = "Boots already equipped";
};
};
}
private function MenuDoneHandler(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
if (page == "gameover"){
thePirate.ResetGold();
thePirate.ResetHealthPotion();
thePirate.ResetOxygenPotion();
};
EndPage();
if (myParent.gameLevel == 1){
ShowIntroLevel(1);
} else {
if (myParent.gameLevel == 2){
ShowIntroLevel(2);
} else {
if (myParent.gameLevel == 3){
ShowIntroLevel(3);
};
};
};
}
public function ShowIntroLevel(val:int=1){
switch (val){
case 1:
ShowPage("introlevel1");
break;
case 2:
ShowPage("introlevel2");
break;
case 3:
ShowPage("introlevel3");
break;
};
}
private function RefreshMenuBuy(){
var thePirate:*;
thePirate = myParent.GetPirate();
thePage.hpotiontxt.text = (thePirate.HealthPotion + "/3");
thePage.opotiontxt.text = (thePirate.OxygenPotion + "/3");
thePage.goldtxt.text = thePirate.Gold;
if ((((thePirate.HealthPotion == 3)) && ((thePirate.OxygenPotion == 3)))){
thePage.noticetxt.text = "Nothing to buy? Selling perhaps?";
};
}
private function AddClick(event:MouseEvent){
navigateToURL(addGameURL, "_blank");
}
private function BtnHPotionClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
if (thePirate.HealthPotion > 0){
thePirate.UseHealthPotion();
ResetPauseMenu();
};
}
public function ShowPreMovie(){
ShowPage("intro");
}
private function SkipIntroHandler(event:MouseEvent){
if (page == "introlevel1"){
if (thePage.currentFrame < 200){
thePage.gotoAndPlay(200);
};
} else {
if (page == "introlevel2"){
if (thePage.currentFrame < 290){
thePage.gotoAndPlay(290);
};
} else {
if (page == "introlevel3"){
if (thePage.currentFrame < 360){
thePage.gotoAndPlay(360);
};
};
};
};
}
private function BtnYellowClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
thePirate.WeaponType = "yellow";
thePirate.WeaponTypeInt = 4;
ResetPauseMenu();
}
private function EndFrameHandler(event:Event){
if (thePage.currentFrame == thePage.totalFrames){
EndPage();
ShowPage(nextpage);
};
}
private function BtnBlueClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
thePirate.WeaponType = "blue";
thePirate.WeaponTypeInt = 2;
ResetPauseMenu();
}
private function BtnGreenClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
thePirate.WeaponType = "green";
thePirate.WeaponTypeInt = 3;
ResetPauseMenu();
}
private function CloseWindowClick(event:MouseEvent){
theWindow.closebtn.removeEventListener(MouseEvent.CLICK, CloseWindowClick);
if (theWindow){
menuContainer.removeChild(theWindow);
theWindow = null;
};
}
private function StopGameHandler(event:MouseEvent){
myParent.StopGame();
EndPage();
ShowPage("mainmenu");
}
private function Next1Click(event:MouseEvent){
EndPage();
ShowPage(next1page);
}
private function BuyHPotionClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
if ((((thePirate.Gold >= 100)) && ((thePirate.HealthPotion < 3)))){
thePirate.IncreaseHealthPotion(1);
thePirate.ReduceGold(100);
RefreshMenuBuy();
} else {
if (thePirate.Gold < 100){
thePage.noticetxt.text = "Not enough gold";
} else {
thePage.noticetxt.text = "No place for new one";
};
};
}
private function RefreshMenu(){
var thePirate:*;
thePirate = myParent.GetPirate();
thePage.goldtxt.text = thePirate.Gold;
}
private function UpgradeSwordClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
if (thePirate.GetSwordLevel() == 1){
if (thePirate.Gold >= 1500){
thePirate.IncreaseSwordLevel();
thePirate.ReduceGold(1500);
RefreshMenuUpgradeSword();
} else {
thePage.noticetxt.text = "Not enough money";
};
} else {
if (thePirate.GetSwordLevel() == 2){
if (thePirate.Gold >= 2500){
thePirate.IncreaseSwordLevel();
thePirate.ReduceGold(2500);
RefreshMenuUpgradeSword();
} else {
thePage.noticetxt.text = "Not enough money";
};
};
};
}
private function SellHPotionClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
if (thePirate.HealthPotion > 0){
thePirate.ReduceHealthPotion(1);
thePirate.IncreaseGold(60);
RefreshMenuBuy();
} else {
thePage.noticetxt.text = "No health potion";
};
}
public function ShowPause(){
ShowPage("pause");
}
private function BtnRedClick(event:MouseEvent){
var thePirate:*;
thePirate = myParent.GetPirate();
thePirate.WeaponType = "red";
thePirate.WeaponTypeInt = 1;
ResetPauseMenu();
}
private function RefreshMenuUpgradeGun(){
var thePirate:*;
thePirate = myParent.GetPirate();
thePage.goldtxt.text = thePirate.Gold;
if (thePirate.GetGunLevel() == 1){
thePage.txtlevel2.visible = true;
thePage.txtlevel3.visible = false;
} else {
if (thePirate.GetGunLevel() == 2){
thePage.txtlevel2.visible = false;
thePage.txtlevel3.visible = true;
} else {
thePage.txtlevel2.visible = false;
thePage.txtlevel3.visible = false;
thePage.btnupgradegun.visible = false;
thePage.noticetxt.text = "What about upgrading sword?";
};
};
}
public function EndPage(){
if (thePage){
if (page == "intro"){
thePage.btnskipprolog.removeEventListener(MouseEvent.CLICK, NextClick);
stageRoot.removeEventListener(Event.ENTER_FRAME, EndFrameHandler);
} else {
if (page == "mainmenu"){
thePage.btnplaygame.removeEventListener(MouseEvent.CLICK, NextClick);
thePage.btnaddgame.removeEventListener(MouseEvent.CLICK, AddClick);
thePage.btnplaymore.removeEventListener(MouseEvent.CLICK, MoreClick);
thePage.btncredits.removeEventListener(MouseEvent.CLICK, CreditsClick);
} else {
if (page == "instruction1"){
thePage.btnskipinstruction1.removeEventListener(MouseEvent.CLICK, NextClick);
} else {
if (page == "instruction2"){
thePage.btnstartgame.removeEventListener(MouseEvent.CLICK, NextClick);
} else {
if (page == "story"){
thePage.btnskipstory.removeEventListener(MouseEvent.CLICK, NextClick);
stageRoot.removeEventListener(Event.ENTER_FRAME, EndFrameHandler);
} else {
if (page == "introlevel1"){
thePage.btnskipintro1.removeEventListener(MouseEvent.CLICK, SkipIntroHandler);
stageRoot.removeEventListener(Event.ENTER_FRAME, StartGameHandler);
} else {
if (page == "introlevel2"){
thePage.btnskipintro2.removeEventListener(MouseEvent.CLICK, SkipIntroHandler);
stageRoot.removeEventListener(Event.ENTER_FRAME, StartGameHandler);
} else {
if (page == "introlevel3"){
thePage.btnskipintro3.removeEventListener(MouseEvent.CLICK, SkipIntroHandler);
stageRoot.removeEventListener(Event.ENTER_FRAME, StartGameHandler);
} else {
if (page == "ending"){
thePage.btnendingback.removeEventListener(MouseEvent.CLICK, NextClick);
thePage.btnendingplaymore.removeEventListener(MouseEvent.CLICK, MoreClick);
} else {
if (page == "gameover"){
thePage.btnmain.removeEventListener(MouseEvent.CLICK, NextClick);
thePage.btnretry.removeEventListener(MouseEvent.CLICK, MenuDoneHandler);
} else {
if (page == "pause"){
thePage.btnred.removeEventListener(MouseEvent.CLICK, BtnRedClick);
thePage.btnblue.removeEventListener(MouseEvent.CLICK, BtnBlueClick);
thePage.btngreen.removeEventListener(MouseEvent.CLICK, BtnGreenClick);
thePage.btnyellow.removeEventListener(MouseEvent.CLICK, BtnYellowClick);
thePage.btnorange.removeEventListener(MouseEvent.CLICK, BtnOrangeClick);
thePage.btnhpotion.removeEventListener(MouseEvent.CLICK, BtnHPotionClick);
thePage.btnopotion.removeEventListener(MouseEvent.CLICK, BtnOPotionClick);
thePage.btnresumegame.removeEventListener(MouseEvent.CLICK, ResumeGameHandler);
thePage.btnquitgame.removeEventListener(MouseEvent.CLICK, StopGameHandler);
} else {
if (page == "menu"){
thePage.btnmenubuy.removeEventListener(MouseEvent.CLICK, NextClick);
thePage.btnmenuupgrade.removeEventListener(MouseEvent.CLICK, Next1Click);
thePage.btnmenudone.removeEventListener(MouseEvent.CLICK, MenuDoneHandler);
} else {
if (page == "menubuy"){
thePage.btnbuydone.removeEventListener(MouseEvent.CLICK, PrevClick);
thePage.btnbuyhpotion.removeEventListener(MouseEvent.CLICK, BuyHPotionClick);
thePage.btnsellhpotion.removeEventListener(MouseEvent.CLICK, SellHPotionClick);
thePage.btnbuyopotion.removeEventListener(MouseEvent.CLICK, BuyOPotionClick);
thePage.btnsellopotion.removeEventListener(MouseEvent.CLICK, SellOPotionClick);
} else {
if (page == "menuupgrade"){
thePage.btnupgradedone.removeEventListener(MouseEvent.CLICK, PrevClick);
thePage.btnupgradesword.removeEventListener(MouseEvent.CLICK, NextClick);
thePage.btnupgradegun.removeEventListener(MouseEvent.CLICK, Next1Click);
thePage.btnbuyboots.removeEventListener(MouseEvent.CLICK, BuyBootsClick);
thePage.btnbuytanks.removeEventListener(MouseEvent.CLICK, BuyTanksClick);
} else {
if (page == "menuupgradegun"){
thePage.btnupgradegun.removeEventListener(MouseEvent.CLICK, UpgradeGunClick);
thePage.btnupgradegundone.removeEventListener(MouseEvent.CLICK, PrevClick);
} else {
if (page == "menuupgradesword"){
thePage.btnupgradesword.removeEventListener(MouseEvent.CLICK, UpgradeSwordClick);
thePage.btnupgradesworddone.removeEventListener(MouseEvent.CLICK, PrevClick);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
menuContainer.removeChild(thePage);
thePage = null;
};
showing = false;
}
}
}//package
Section 95
//menuupgrade (menuupgrade)
package {
import flash.display.*;
import flash.text.*;
public dynamic class menuupgrade extends MovieClip {
public var btnupgradegun:SimpleButton;
public var tankstxt:TextField;
public var goldtxt:TextField;
public var bootstxt:TextField;
public var btnbuyboots:SimpleButton;
public var btnbuytanks:SimpleButton;
public var noticetxt:TextField;
public var btnupgradesword:SimpleButton;
public var btnupgradedone:SimpleButton;
public function menuupgrade(){
super();
}
}
}//package
Section 96
//menuupgradegun (menuupgradegun)
package {
import flash.display.*;
import flash.text.*;
public dynamic class menuupgradegun extends MovieClip {
public var btnupgradegun:SimpleButton;
public var goldtxt:TextField;
public var btnupgradegundone:SimpleButton;
public var noticetxt:TextField;
public var txtlevel3:TextField;
public var txtlevel2:TextField;
public function menuupgradegun(){
super();
}
}
}//package
Section 97
//menuupgradesword (menuupgradesword)
package {
import flash.display.*;
import flash.text.*;
public dynamic class menuupgradesword extends MovieClip {
public var goldtxt:TextField;
public var swordlevel2:TextField;
public var swordlevel3:TextField;
public var noticetxt:TextField;
public var btnupgradesword:SimpleButton;
public var btnupgradesworddone:SimpleButton;
public function menuupgradesword(){
super();
}
}
}//package
Section 98
//notification (notification)
package {
import flash.display.*;
import flash.text.*;
public dynamic class notification extends MovieClip {
public var notificationtxt:TextField;
public function notification(){
super();
}
}
}//package
Section 99
//octo (octo)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class octo extends EnemyOctoChar {
public function octo(){
super();
addFrameScript(29, frame30, 59, frame60, 60, frame61);
}
function frame30(){
gotoAndPlay("stand");
}
function frame60(){
gotoAndPlay("stand");
}
function frame61(){
stop();
}
}
}//package
Section 100
//octo_attack (octo_attack)
package {
public dynamic class octo_attack extends BaseSound {
public function octo_attack(){
super();
}
}
}//package
Section 101
//oxygen (oxygen)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class oxygen extends ItemOxygenChar {
public function oxygen(){
super();
addFrameScript(19, frame20, 20, frame21);
}
function frame20(){
gotoAndPlay(1);
}
function frame21(){
stop();
}
}
}//package
Section 102
//paneldepth (paneldepth)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class paneldepth extends MovieClip {
public var paneldepthtxt:TextField;
public function paneldepth(){
super();
addFrameScript(14, frame15, 29, frame30);
}
function frame15(){
gotoAndPlay("down");
}
function frame30(){
gotoAndPlay("up");
}
}
}//package
Section 103
//panelgold (panelgold)
package {
import flash.display.*;
import flash.text.*;
public dynamic class panelgold extends MovieClip {
public var panelgoldtxt:TextField;
public function panelgold(){
super();
}
}
}//package
Section 104
//panelharpoon (panelharpoon)
package {
import flash.display.*;
import flash.text.*;
public dynamic class panelharpoon extends MovieClip {
public var panelharpoontxt:TextField;
public function panelharpoon(){
super();
}
}
}//package
Section 105
//panelhpotion (panelhpotion)
package {
import flash.display.*;
import flash.text.*;
public dynamic class panelhpotion extends MovieClip {
public var panelhpotiontxt:TextField;
public function panelhpotion(){
super();
}
}
}//package
Section 106
//panelopotion (panelopotion)
package {
import flash.display.*;
import flash.text.*;
public dynamic class panelopotion extends MovieClip {
public var panelopotiontxt:TextField;
public function panelopotion(){
super();
}
}
}//package
Section 107
//pausemenu (pausemenu)
package {
import flash.display.*;
import flash.text.*;
public dynamic class pausemenu extends MovieClip {
public var tankstxt:TextField;
public var goldtxt:TextField;
public var bootstxt:TextField;
public var btnquitgame:SimpleButton;
public var btngreen:SimpleButton;
public var big1:MovieClip;
public var big2:MovieClip;
public var big3:MovieClip;
public var big5:MovieClip;
public var big4:MovieClip;
public var btnhpotion:SimpleButton;
public var opotiontxt:TextField;
public var btnresumegame:SimpleButton;
public var btnorange:SimpleButton;
public var hpotiontxt:TextField;
public var btnred:SimpleButton;
public var btnblue:SimpleButton;
public var btnyellow:SimpleButton;
public var harpoontxt:TextField;
public var btnopotion:SimpleButton;
public function pausemenu(){
super();
}
}
}//package
Section 108
//pearl (pearl)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class pearl extends ItemPearlChar {
public function pearl(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 109
//picking_coin (picking_coin)
package {
public dynamic class picking_coin extends BaseSound {
public function picking_coin(){
super();
}
}
}//package
Section 110
//pirate (pirate)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class pirate extends PirateChar {
public function pirate(){
super();
addFrameScript(29, frame30, 59, frame60, 89, frame90, 119, frame120, 149, frame150, 179, frame180, 209, frame210, 239, frame240, 269, frame270, 284, frame285, 299, frame300, 314, frame315, 329, frame330, 344, frame345, 359, frame360, 374, frame375, 389, frame390, 404, frame405, 419, frame420, 434, frame435, 449, frame450, 464, frame465, 479, frame480, 494, frame495, 524, frame525, 554, frame555, 584, frame585, 614, frame615, 644, frame645, 674, frame675, 704, frame705, 734, frame735, 764, frame765, 794, frame795, 824, frame825, 854, frame855, 864, frame865, 874, frame875, 904, frame905, 934, frame935);
}
function frame705(){
gotoAndPlay("gunbackwardnormal");
}
function frame285(){
gotoAndPlay("swordstandnormal");
}
function frame855(){
gotoAndPlay("gunattacklow");
}
function frame180(){
gotoAndPlay("swordforwardlow");
}
function frame735(){
gotoAndPlay("gunbackwardhigh");
}
function frame615(){
gotoAndPlay("gunforwardnormal");
}
function frame865(){
gotoAndPlay("swordstandnormal");
}
function frame30(){
gotoAndPlay("swordstandnormal");
}
function frame765(){
gotoAndPlay("gunbackwardlow");
}
function frame645(){
gotoAndPlay("gunforwardhigh");
}
function frame525(){
gotoAndPlay("gunstandnormal");
}
function frame405(){
gotoAndPlay("swordstandnormal");
}
function frame875(){
gotoAndPlay("gunstandnormal");
}
function frame420(){
gotoAndPlay("swordstandnormal");
}
function frame60(){
gotoAndPlay("swordstandhigh");
}
function frame300(){
gotoAndPlay("swordstandnormal");
}
function frame435(){
gotoAndPlay("swordstandnormal");
}
function frame795(){
gotoAndPlay("gunattacknormal");
}
function frame675(){
gotoAndPlay("gunforwardlow");
}
function frame315(){
gotoAndPlay("swordstandnormal");
}
function frame555(){
gotoAndPlay("gunstandhigh");
}
function frame330(){
gotoAndPlay("swordstandnormal");
}
function frame90(){
gotoAndPlay("swordstandlow");
}
function frame210(){
gotoAndPlay("swordbackwardnormal");
}
function frame450(){
gotoAndPlay("swordstandnormal");
}
function frame345(){
gotoAndPlay("swordstandnormal");
}
function frame905(){
stop();
}
function frame585(){
gotoAndPlay("gunstandlow");
}
function frame360(){
gotoAndPlay("swordstandnormal");
}
function frame120(){
gotoAndPlay("swordforwardnormal");
}
function frame465(){
gotoAndPlay("swordstandnormal");
}
function frame480(){
gotoAndPlay("swordstandnormal");
}
function frame240(){
gotoAndPlay("swordbackwardhigh");
}
function frame495(){
gotoAndPlay("swordstandnormal");
}
function frame375(){
gotoAndPlay("swordstandnormal");
}
function frame935(){
stop();
}
function frame825(){
gotoAndPlay("gunattackhigh");
}
function frame390(){
gotoAndPlay("swordstandnormal");
}
function frame270(){
gotoAndPlay("swordbackwardlow");
}
function frame150(){
gotoAndPlay("swordforwardhigh");
}
}
}//package
Section 111
//PirateChar (PirateChar)
package {
import flash.display.*;
import flash.events.*;
public class PirateChar extends BaseMovieClip {
const MOVESPEED = 20;
const HP = 250;
const HEIGHT = 120;
const INITY = 25;
const INITX = 275;
const WIDTH = 60;
public var Harpoon:int;// = 50
public var destroyed:Boolean;// = false
private var hurt1Sound:BaseSound;// = null
public var Weapon:String;
public var HighLow:String;
public var typed;// = "pirate"
public var Health:int;// = 250
public var Gold:int;// = 0
public var WeaponTypeInt:int;// = 3
public var Attacking:Boolean;
public var WeaponLevel:Array;
public var Tanks:Boolean;// = false
public var destroyedTimer:int;// = 0
public var bodydetect:bodydetector;
public var WeaponDamage:Array;
public var Movement:String;
private var hurt2Sound:BaseSound;// = null
public var attackdetect:attackdetector;
private var swordSound:BaseSound;// = null
public var HealthPotion:int;// = 1
public var named;// = "pirate"
public var OxygenPotion:int;// = 1
public var myParent;
public var level;// = 0
public var Boots:Boolean;// = false
public var gunhand:MovieClip;
public var atackedTimer:int;// = 0
public var Oxygen:int;
public var O2;// = 100
public var WeaponType:String;// = "green"
private var gamePaused:Boolean;// = false
public function PirateChar(){
typed = "pirate";
named = "pirate";
level = 0;
O2 = 100;
Boots = false;
Tanks = false;
Health = HP;
Oxygen = O2;
Gold = 0;
HealthPotion = 1;
OxygenPotion = 1;
Harpoon = 50;
atackedTimer = 0;
destroyed = false;
destroyedTimer = 0;
WeaponType = "green";
WeaponTypeInt = 3;
WeaponLevel = new Array(1, 1, 1, 1, 1, 1);
WeaponDamage = new Array(10, 15, 10, 15, 15, 10);
hurt1Sound = null;
hurt2Sound = null;
swordSound = null;
gamePaused = false;
super();
}
public function ReduceOxygenPotion(_val:int=1){
OxygenPotion = (OxygenPotion - _val);
if (OxygenPotion < 0){
OxygenPotion = 0;
};
myParent.SetOxygenPotionDisplay(OxygenPotion);
myParent.SetNotificationDisplay((("-" + _val) + " Oxygen Potion"));
}
public function UseHealthPotion(){
if ((((HealthPotion > 0)) && (!((Health == HP))))){
ReduceHealthPotion();
IncreaseHealth((HP * 0.8));
};
myParent.SetNotificationDisplay("-1 Health Potion");
}
public function ResetOxygenPotion(){
OxygenPotion = 1;
myParent.SetOxygenPotionDisplay(Gold);
}
public function ResetGold(){
Gold = 0;
myParent.SetGoldDisplay(Gold);
}
public function GetDamage():Number{
var dmg:Number;
dmg = 0;
if (Weapon == "gun"){
dmg = (0.75 + (WeaponLevel[0] / 4));
} else {
dmg = (0.75 + (WeaponLevel[1] / 4));
};
return ((WeaponDamage[WeaponTypeInt] * dmg));
}
public function UseOxygenPotion(){
if ((((OxygenPotion > 0)) && (!((Oxygen == O2))))){
ReduceOxygenPotion();
IncreaseOxygen((O2 * 0.8));
};
myParent.SetNotificationDisplay("-1 Oxygen Potion");
}
public function MoveTo(_newPos:String){
if (_newPos == "left"){
if (Boots){
this.MoveLeft((MOVESPEED * 1.5));
} else {
this.MoveLeft(MOVESPEED);
};
} else {
if (_newPos == "right"){
if (Boots){
this.MoveRight((MOVESPEED * 1.5));
} else {
this.MoveRight(MOVESPEED);
};
} else {
if (_newPos == "up"){
if (Boots){
this.MoveUp((MOVESPEED * 1.5));
} else {
this.MoveUp(MOVESPEED);
};
} else {
if (_newPos == "down"){
if (Boots){
this.MoveDown((MOVESPEED * 1.5));
} else {
this.MoveDown(MOVESPEED);
};
};
};
};
};
}
public function ResetAttackSkin(){
if (Attacking){
Attacking = false;
if (Weapon == "gun"){
SetSkin("stand");
};
};
}
public function IncreaseHealthPotion(_val:int=1){
HealthPotion = (HealthPotion + _val);
if (HealthPotion > 3){
HealthPotion = 3;
};
myParent.SetHealthPotionDisplay(HealthPotion);
myParent.SetNotificationDisplay((("+" + _val) + " Health Potion"));
}
public function IncreaseGunLevel(){
if (WeaponLevel[0] < 3){
var _local1 = WeaponLevel;
var _local2:int;
var _local3 = (_local1[_local2] + 1);
_local1[_local2] = _local3;
};
}
public function IncreaseOxygen(_val:int=1){
Oxygen = (Oxygen + _val);
if (Oxygen > 100){
Oxygen = 100;
};
myParent.SetOxygenDisplay(((Oxygen / O2) * 100));
myParent.SetNotificationDisplay("Oxygen Increased");
}
public function ReduceOxygen(_val:int=1){
Oxygen = (Oxygen - _val);
if (Oxygen < 0){
Oxygen = 0;
ReduceHealth(5);
};
myParent.SetOxygenDisplay(((Oxygen / O2) * 100));
}
public function IncreaseOxygenPotion(_val:int=1){
OxygenPotion = (OxygenPotion + _val);
if (OxygenPotion > 3){
OxygenPotion = 3;
};
myParent.SetOxygenPotionDisplay(OxygenPotion);
myParent.SetNotificationDisplay((("+" + _val) + " Oxygen Potion"));
}
public function PauseGame(){
gamePaused = true;
this.StopMovement();
}
public function SetSword(_param:String="red"){
WeaponType = _param;
if (WeaponType == "red"){
WeaponTypeInt = 1;
} else {
if (WeaponType == "blue"){
WeaponTypeInt = 2;
} else {
if (WeaponType == "green"){
WeaponTypeInt = 3;
} else {
if (WeaponType == "yellow"){
WeaponTypeInt = 4;
} else {
if (WeaponType == "orange"){
WeaponTypeInt = 5;
};
};
};
};
};
myParent.SetNotificationDisplay((("Used " + WeaponType) + " gem"));
SetSkin();
}
public function SetSkin(_param:String=""){
if (_param == "sword"){
Weapon = "sword";
} else {
if (_param == "gun"){
Weapon = "gun";
};
};
if (_param == "stand"){
Movement = "stand";
} else {
if (_param == "forward"){
Movement = "forward";
} else {
if (_param == "backward"){
Movement = "backward";
} else {
if (_param == "attack"){
Movement = "attack";
};
};
};
};
if (_param == "normal"){
HighLow = "normal";
} else {
if (_param == "high"){
HighLow = "high";
} else {
if (_param == "low"){
HighLow = "low";
};
};
};
if (!myParent.pirateDead){
if ((((this.currentFrame <= 270)) || ((this.currentFrame >= 496)))){
if (this.currentLabel != ((Weapon + Movement) + HighLow)){
if (this.currentLabel != (Weapon + "hurt")){
this.gotoAndPlay(((Weapon + Movement) + HighLow));
};
};
};
} else {
if (this.currentLabel != (Weapon + "dead")){
this.gotoAndPlay((Weapon + "dead"));
};
};
}
public function ResetPanels(){
myParent.SetHealthDisplay(((Health / HP) * 100));
myParent.SetOxygenDisplay(Oxygen);
myParent.SetGoldDisplay(Gold);
myParent.SetHealthPotionDisplay(HealthPotion);
myParent.SetOxygenPotionDisplay(OxygenPotion);
myParent.SetHarpoonDisplay(Harpoon);
}
public function ReduceGold(_val:int=1){
Gold = (Gold - _val);
if (Gold < 0){
Gold = 0;
};
myParent.SetGoldDisplay(Gold);
}
public function Init(_myParent){
this.x = INITX;
this.y = INITY;
this.scaleX = MINSCALE;
this.scaleY = MINSCALE;
this.SetScale(0.55);
this.StartMovement();
this.TurnGravityOff();
myParent = _myParent;
if (Tanks){
O2 = 150;
};
Health = HP;
Oxygen = O2;
if (Harpoon < 50){
Harpoon = 50;
};
Weapon = "sword";
Movement = "stand";
HighLow = "normal";
SetSkin();
faceLeft = true;
if (!hurt1Sound){
hurt1Sound = new player_pain1();
};
if (!hurt2Sound){
hurt2Sound = new player_pain2();
};
if (!swordSound){
swordSound = new player_sword();
};
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
var r:*;
if (!gamePaused){
if (this.faceLeft){
r = (myParent.theta + 90);
} else {
r = (360 - (myParent.theta - 90));
};
if (gunhand){
gunhand.rotation = r;
};
};
}
public function GetSwordLevel():int{
return (WeaponLevel[1]);
}
public function StartAttacked(_param){
if (!myParent.gamePaused){
Attacking = false;
if ((((Health > 0)) && (!((this.currentLabel == (Weapon + "hurt")))))){
gotoAndPlay((Weapon + "hurt"));
if (Math.random() < 0.5){
hurt1Sound.playSound();
} else {
hurt2Sound.playSound();
};
if (_param){
ReduceHealth(_param.GetDamage());
};
};
};
}
public function IncreaseHealth(_val:int=50){
Health = (Health + _val);
if (Health > HP){
Health = HP;
};
myParent.SetHealthDisplay(((Health / HP) * 100));
myParent.SetNotificationDisplay("Health Increased");
}
public function IncreaseHarpoon(_val:int=1){
Harpoon = (Harpoon + _val);
if (Harpoon > 100){
Harpoon = 100;
};
myParent.SetHarpoonDisplay(Harpoon);
myParent.SetNotificationDisplay((("+" + _val) + " Harpoon Ammo"));
}
public function GetGunLevel():int{
return (WeaponLevel[0]);
}
public function IncreaseSwordLevel(){
if (WeaponLevel[1] < 3){
var _local1 = WeaponLevel;
var _local2 = 1;
var _local3 = (_local1[_local2] + 1);
_local1[_local2] = _local3;
};
}
public function ReduceHealth(_val:int=1){
Health = (Health - _val);
if (Health <= 0){
Health = 0;
myParent.StartDead();
};
if (Health > 0){
myParent.SetHealthDisplay(((Health / HP) * 100));
myParent.SetNotificationDisplay("Health Decreased");
};
}
public function IncreaseTanks(){
Tanks = true;
O2 = 150;
myParent.SetOxygenDisplay(((Oxygen / O2) * 100));
}
public function GetWeaponLevel():int{
if (Weapon == "gun"){
return (WeaponLevel[0]);
};
return (WeaponLevel[1]);
}
public function ReduceHealthPotion(_val:int=1){
HealthPotion = (HealthPotion - _val);
if (HealthPotion < 0){
HealthPotion = 0;
};
myParent.SetHealthPotionDisplay(HealthPotion);
myParent.SetNotificationDisplay((("-" + _val) + " Health Potion"));
}
public function SwapWeapon(){
if (Weapon == "sword"){
Weapon = "gun";
myParent.SetNotificationDisplay("Gun Equipped");
} else {
if (Weapon == "gun"){
Weapon = "sword";
myParent.SetNotificationDisplay("Sword Equipped");
};
};
SetSkin();
}
public function SetAttackSkin(_param:String=""){
Attacking = true;
if (Weapon == "gun"){
SetSkin("attack");
} else {
gotoAndPlay((WeaponType + WeaponLevel[WeaponTypeInt]));
swordSound.playSound();
};
}
public function ReduceHarpoon(_val:int=1){
Harpoon = (Harpoon - _val);
if (Harpoon < 0){
Harpoon = 0;
};
myParent.SetHarpoonDisplay(Harpoon);
}
public function Destroy(){
this.StopMovement();
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function ResetHealthPotion(){
HealthPotion = 1;
myParent.SetHealthPotionDisplay(Gold);
}
public function ResumeGame(){
gamePaused = false;
this.StartMovement();
}
public function IncreaseGold(_val:int=1){
Gold = (Gold + _val);
if (Gold > 9999){
Gold = 9999;
};
myParent.SetGoldDisplay(Gold);
myParent.SetNotificationDisplay((("+" + _val) + " Gold"));
}
}
}//package
Section 112
//piratedetector (piratedetector)
package {
import flash.display.*;
public dynamic class piratedetector extends MovieClip {
public function piratedetector(){
super();
}
}
}//package
Section 113
//PirateManager (PirateManager)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
public class PirateManager {
const BTORANGE = 53;
const ARROWDOWN;
const ARROWUP;
const BTYELLOW = 52;
const BTLEFT = 65;
const ARROWLEFT;
const BTUSEHEALTH = 81;
const BTUP = 87;
const BTSWAPWPN;
const ARROWRIGHT;
const BTUSEOXYGEN = 69;
const BTBLUE = 50;
const BTGREEN = 51;
const BTRED = 49;
const BTRIGHT = 68;
const BTDOWN = 83;
private var btDown:Boolean;
public var thePirate;
private var bulletSound:BaseSound;// = null
private var deadTimer:Boolean;// = false
private var mouseLeft:Boolean;
public var sceneContainer;// = null
public var gameSublevel:int;
public var pirateDead:Boolean;// = false
public var myParent;
private var btLeft:Boolean;
private var btUp:Boolean;
public var theta:Number;// = 0
private var mousePress:Boolean;
public var gameLevel:int;
public var gamePaused:Boolean;// = false
private var attackTimer:int;// = 0
private var btRight:Boolean;
public function PirateManager(_myParent){
theta = 0;
gamePaused = false;
ARROWUP = Keyboard.UP;
ARROWDOWN = Keyboard.DOWN;
ARROWLEFT = Keyboard.LEFT;
ARROWRIGHT = Keyboard.RIGHT;
BTSWAPWPN = Keyboard.SPACE;
sceneContainer = null;
pirateDead = false;
deadTimer = false;
attackTimer = 0;
bulletSound = null;
super();
myParent = _myParent;
}
public function ReduceGold(qty:int=10){
thePirate.ReduceGold(qty);
}
public function SetHealthPotionDisplay(_lv:int=0){
myParent.scoreMgr.SetHealthPotion(_lv);
}
public function ResetOxygenPotion(){
thePirate.ResetOxygenPotion();
}
public function ResetGold(){
thePirate.ResetGold();
}
private function MouseUpHandler(event:MouseEvent){
mousePress = false;
}
public function StopGame(goMain:Boolean=false){
if (goMain){
DestroyObject();
};
myParent.stageRoot.removeEventListener(MouseEvent.MOUSE_MOVE, MouseMoveHandler);
myParent.stageRoot.removeEventListener(MouseEvent.MOUSE_DOWN, MouseDownHandler);
myParent.stageRoot.removeEventListener(MouseEvent.MOUSE_UP, MouseUpHandler);
myParent.stageRoot.removeEventListener(KeyboardEvent.KEY_DOWN, KeyPressHandler);
myParent.stageRoot.removeEventListener(KeyboardEvent.KEY_UP, KeyReleaseHandler);
myParent.stageRoot.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
var blt:*;
blt = null;
if (!pirateDead){
if (btRight){
thePirate.MoveTo("right");
if (attackTimer <= 0){
if (thePirate.faceLeft){
thePirate.SetSkin("backward");
} else {
thePirate.SetSkin("forward");
};
};
} else {
if (btLeft){
thePirate.MoveTo("left");
if (attackTimer <= 0){
if (thePirate.faceLeft){
thePirate.SetSkin("forward");
} else {
thePirate.SetSkin("backward");
};
};
};
};
if (thePirate.Weapon == "gun"){
if (((mousePress) && ((((attackTimer == 16)) || ((attackTimer == 8)))))){
if (thePirate.Harpoon > 0){
ReduceHarpoon();
blt = new bullet();
blt.Init(this, thePirate.x, (thePirate.y - 8), theta);
sceneContainer.addChild(blt);
if (thePirate.GetWeaponLevel() > 1){
blt = new bullet();
blt.Init(this, thePirate.x, (thePirate.y - 8), (theta - 15));
sceneContainer.addChild(blt);
};
if (thePirate.GetWeaponLevel() > 2){
blt = new bullet();
blt.Init(this, thePirate.x, (thePirate.y - 8), (theta + 15));
sceneContainer.addChild(blt);
};
bulletSound.playSound();
};
};
};
if (attackTimer > 0){
attackTimer--;
if (attackTimer <= 0){
if (mousePress){
thePirate.SetAttackSkin();
attackTimer = 16;
} else {
thePirate.ResetAttackSkin();
};
thePirate.SetOrientation(mouseLeft, 0);
};
} else {
if (mousePress){
thePirate.SetAttackSkin();
attackTimer = 16;
};
};
if (btUp){
thePirate.MoveTo("up");
} else {
if (btDown){
thePirate.MoveTo("down");
};
};
};
if (deadTimer > 0){
deadTimer--;
if (deadTimer <= 0){
myParent.ShowGameOver();
};
};
}
public function SetOxygenPotionDisplay(_lv:int=0){
myParent.scoreMgr.SetOxygenPotion(_lv);
}
public function StartGame(){
gameLevel = myParent.gameLevel;
gameSublevel = myParent.gameSublevel;
sceneContainer = myParent.sceneContainer;
gamePaused = false;
pirateDead = false;
if (!bulletSound){
bulletSound = new player_harpoon();
};
CreateObject();
btRight = false;
btLeft = false;
btUp = false;
btDown = false;
mousePress = false;
mouseLeft = false;
myParent.stageRoot.addEventListener(MouseEvent.MOUSE_MOVE, MouseMoveHandler);
myParent.stageRoot.addEventListener(MouseEvent.MOUSE_DOWN, MouseDownHandler);
myParent.stageRoot.addEventListener(MouseEvent.MOUSE_UP, MouseUpHandler);
myParent.stageRoot.addEventListener(KeyboardEvent.KEY_DOWN, KeyPressHandler);
myParent.stageRoot.addEventListener(KeyboardEvent.KEY_UP, KeyReleaseHandler);
myParent.stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function IncreaseHealth(qty:int=50){
thePirate.IncreaseHealth(qty);
}
private function KeyReleaseHandler(event:KeyboardEvent){
switch (event.keyCode){
case ARROWRIGHT:
case BTRIGHT:
btRight = false;
break;
case ARROWLEFT:
case BTLEFT:
btLeft = false;
break;
case ARROWUP:
case BTUP:
btUp = false;
break;
case ARROWDOWN:
case BTDOWN:
btDown = false;
break;
};
}
public function SetHarpoonDisplay(_lv:int=0){
myParent.scoreMgr.SetHarpoon(_lv);
}
public function IncreaseHarpoon(qty:int=10){
thePirate.IncreaseHarpoon(qty);
}
private function CreateObject(){
if (thePirate == null){
thePirate = new pirate();
sceneContainer.addChild(thePirate);
};
thePirate.Init(this);
thePirate.MoveDown(200);
}
public function DestroyBullet(_obj:MovieClip){
if (_obj){
if (_obj.typed == "bullet"){
sceneContainer.removeChild(_obj);
};
};
}
private function KeyPressHandler(event:KeyboardEvent){
switch (event.keyCode){
case ARROWRIGHT:
case BTRIGHT:
btRight = true;
btLeft = false;
break;
case ARROWLEFT:
case BTLEFT:
btLeft = true;
btRight = false;
break;
case ARROWUP:
case BTUP:
btUp = true;
btDown = false;
break;
case ARROWDOWN:
case BTDOWN:
btDown = true;
btUp = false;
break;
case BTSWAPWPN:
thePirate.SwapWeapon();
break;
case BTUSEHEALTH:
thePirate.UseHealthPotion();
break;
case BTUSEOXYGEN:
thePirate.UseOxygenPotion();
break;
case BTRED:
thePirate.SetSword("red");
break;
case BTBLUE:
thePirate.SetSword("blue");
break;
case BTGREEN:
thePirate.SetSword("green");
break;
case BTYELLOW:
thePirate.SetSword("yellow");
break;
case BTORANGE:
thePirate.SetSword("orange");
break;
};
}
private function MouseMoveHandler(event:MouseEvent){
var dx:Number;
var dy:Number;
if (!pirateDead){
dx = (event.stageX - thePirate.x);
dy = (thePirate.y - event.stageY);
theta = ((Math.atan2(dx, dy) * 360) / 6.28);
if (theta > 180){
theta = (theta - 360);
};
if (thePirate.handgun){
thePirate.handgun.rotate = theta;
};
mouseLeft = (event.stageX < thePirate.x);
if (thePirate.Weapon != "sword"){
thePirate.SetOrientation(mouseLeft, 0);
} else {
if (attackTimer <= 0){
thePirate.SetOrientation(mouseLeft, 0);
};
};
if (thePirate.faceLeft){
if (theta < -120){
thePirate.SetSkin("low");
} else {
if (theta > -60){
thePirate.SetSkin("high");
} else {
thePirate.SetSkin("normal");
};
};
} else {
if (theta > 120){
thePirate.SetSkin("low");
} else {
if (theta < 60){
thePirate.SetSkin("high");
} else {
thePirate.SetSkin("normal");
};
};
};
};
}
public function ReduceHealth(qty:int=5){
thePirate.ReduceHealth(qty);
}
private function MouseDownHandler(event:MouseEvent){
mousePress = true;
}
public function IncreaseHealthPotion(qty:int=1){
thePirate.IncreaseHealthPotion(qty);
}
public function StartBossFight(){
thePirate.ZoomOut();
}
public function SetGoldDisplay(_lv:int=0){
myParent.scoreMgr.SetGold(_lv);
}
public function SetHealthDisplay(_lv:int=100){
myParent.scoreMgr.SetHealthBar(_lv);
}
public function IncreaseOxygen(qty:int=15){
thePirate.IncreaseOxygen(qty);
}
public function SetNotificationDisplay(msg=""){
myParent.scoreMgr.SetNotification(msg);
}
public function ReduceHealthPotion(qty:int=1){
thePirate.ReduceHealthPotion(qty);
}
public function ReduceOxygen(qty:int=5){
thePirate.ReduceOxygen(qty);
}
public function DestroyObject(){
if (thePirate){
sceneContainer.removeChild(thePirate);
thePirate = null;
};
}
public function StartDead(){
if (!pirateDead){
pirateDead = true;
deadTimer = 300;
thePirate.SetSkin();
SetNotificationDisplay("It's time to rest!");
};
}
public function IncreaseOxygenPotion(qty:int=1){
thePirate.IncreaseOxygenPotion(qty);
}
public function ReduceHarpoon(qty:int=1){
thePirate.ReduceHarpoon(qty);
}
public function ResetHealthPotion(){
thePirate.ResetHealthPotion();
}
public function ResumeGame(){
var obj:*;
var i:*;
obj = null;
i = 0;
gamePaused = false;
if (thePirate){
thePirate.ResumeGame();
};
myParent.stageRoot.addEventListener(MouseEvent.MOUSE_MOVE, MouseMoveHandler);
myParent.stageRoot.addEventListener(MouseEvent.MOUSE_DOWN, MouseDownHandler);
myParent.stageRoot.addEventListener(MouseEvent.MOUSE_UP, MouseUpHandler);
myParent.stageRoot.addEventListener(KeyboardEvent.KEY_DOWN, KeyPressHandler);
myParent.stageRoot.addEventListener(KeyboardEvent.KEY_UP, KeyReleaseHandler);
myParent.stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function SetOxygenDisplay(_lv:int=100){
myParent.scoreMgr.SetOxygenBar(_lv);
}
public function IncreaseGold(qty:int=5){
thePirate.IncreaseGold(qty);
}
public function PauseGame(){
var obj:*;
var i:*;
obj = null;
i = 0;
gamePaused = true;
if (thePirate){
thePirate.PauseGame();
};
myParent.stageRoot.removeEventListener(MouseEvent.MOUSE_MOVE, MouseMoveHandler);
myParent.stageRoot.removeEventListener(MouseEvent.MOUSE_DOWN, MouseDownHandler);
myParent.stageRoot.removeEventListener(MouseEvent.MOUSE_UP, MouseUpHandler);
myParent.stageRoot.removeEventListener(KeyboardEvent.KEY_DOWN, KeyPressHandler);
myParent.stageRoot.removeEventListener(KeyboardEvent.KEY_UP, KeyReleaseHandler);
myParent.stageRoot.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function ReduceOxygenPotion(qty:int=1){
thePirate.ReduceOxygenPotion(qty);
}
public function GetDamageFactor():Number{
var i:int;
i = 0;
i = thePirate.GetGunLevel();
switch (i){
case 1:
return (1);
case 2:
return (0.7);
case 3:
return (0.5);
default:
return (1);
};
}
public function ResetPanels(){
thePirate.ResetPanels();
}
}
}//package
Section 114
//player_harpoon (player_harpoon)
package {
public dynamic class player_harpoon extends BaseSound {
public function player_harpoon(){
super();
}
}
}//package
Section 115
//player_pain1 (player_pain1)
package {
public dynamic class player_pain1 extends BaseSound {
public function player_pain1(){
super();
}
}
}//package
Section 116
//player_pain2 (player_pain2)
package {
public dynamic class player_pain2 extends BaseSound {
public function player_pain2(){
super();
}
}
}//package
Section 117
//player_sword (player_sword)
package {
public dynamic class player_sword extends BaseSound {
public function player_sword(){
super();
}
}
}//package
Section 118
//prolog (prolog)
package {
import flash.display.*;
public dynamic class prolog extends MovieClip {
public var btnskipprolog:SimpleButton;
public function prolog(){
super();
}
}
}//package
Section 119
//saw (saw)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class saw extends EnemySawChar {
public function saw(){
super();
addFrameScript(19, frame20, 39, frame40, 40, frame41);
}
function frame20(){
gotoAndPlay("stand");
}
function frame40(){
gotoAndPlay("stand");
}
function frame41(){
stop();
}
}
}//package
Section 120
//ScoreManager (ScoreManager)
package {
import flash.events.*;
public class ScoreManager {
private var oxyBar;// = null
private var oPotionBar;// = null
private var goldBar;// = null
private var depthBar;// = null
private var notificationTimer;// = 0
private var harpoonBar;// = null
private var prevDepth:int;// = 0
private var bossBar;// = null
private var notificationBar;// = null
private var hpBar;// = null
private var stageBar;// = null
private var myParent;
private var hPotionBar;// = null
public function ScoreManager(_myParent){
bossBar = null;
oxyBar = null;
hpBar = null;
goldBar = null;
harpoonBar = null;
hPotionBar = null;
oPotionBar = null;
depthBar = null;
stageBar = null;
notificationBar = null;
prevDepth = 0;
notificationTimer = 0;
super();
myParent = _myParent;
}
public function SetHealthPotion(_lv:int=3){
if (hPotionBar){
hPotionBar.panelhpotiontxt.text = (_lv + "/3");
};
}
public function SetGold(_lv:int=0){
if (goldBar){
goldBar.panelgoldtxt.text = _lv;
};
}
public function SetBossBar(_lv:int=100){
if (bossBar){
bossBar.gotoAndStop((101 - _lv));
};
}
private function FrameEnterHandler(event:Event){
if (notificationTimer > 0){
notificationTimer--;
if (notificationBar){
notificationBar.alpha = (notificationTimer / 100);
};
if (notificationTimer <= 0){
SetNotification();
};
};
}
public function StartBossFight(){
if (depthBar){
depthBar.visible = false;
};
if (bossBar != null){
myParent.scoreContainer.removeChild(bossBar);
};
switch (myParent.gameLevel){
case 1:
bossBar = new barocto();
bossBar.x = 275;
bossBar.y = 520;
bossBar.scaleX = 0.7;
bossBar.scaleY = 0.7;
myParent.scoreContainer.addChild(bossBar);
bossBar.gotoAndStop(1);
break;
case 2:
bossBar = new barshark();
bossBar.x = 275;
bossBar.y = 520;
bossBar.scaleX = 0.7;
bossBar.scaleY = 0.7;
myParent.scoreContainer.addChild(bossBar);
bossBar.gotoAndStop(1);
break;
case 3:
bossBar = new barlevi();
bossBar.x = 275;
bossBar.y = 520;
bossBar.scaleX = 0.7;
bossBar.scaleY = 0.7;
myParent.scoreContainer.addChild(bossBar);
bossBar.gotoAndStop(1);
break;
};
}
public function SetOxygenPotion(_lv:int=3){
if (oPotionBar){
oPotionBar.panelopotiontxt.text = (_lv + "/3");
};
}
private function isDown(_lv):Boolean{
var p:int;
p = prevDepth;
prevDepth = _lv;
return ((_lv >= p));
}
public function StartGame(){
if (oxyBar != null){
myParent.scoreContainer.removeChild(oxyBar);
};
if (hpBar != null){
myParent.scoreContainer.removeChild(hpBar);
};
if (harpoonBar != null){
myParent.scoreContainer.removeChild(harpoonBar);
};
if (goldBar != null){
myParent.scoreContainer.removeChild(goldBar);
};
if (hPotionBar != null){
myParent.scoreContainer.removeChild(hPotionBar);
};
if (oPotionBar != null){
myParent.scoreContainer.removeChild(oPotionBar);
};
if (depthBar != null){
myParent.scoreContainer.removeChild(depthBar);
};
if (stageBar != null){
myParent.scoreContainer.removeChild(stageBar);
};
if (notificationBar != null){
myParent.scoreContainer.removeChild(notificationBar);
};
oxyBar = new baroxygen();
oxyBar.x = 60;
oxyBar.y = 25;
oxyBar.height = 25;
oxyBar.width = 100;
myParent.scoreContainer.addChild(oxyBar);
oxyBar.gotoAndStop(1);
hpBar = new barhealth();
hpBar.x = 60;
hpBar.y = 50;
hpBar.height = 25;
hpBar.width = 100;
myParent.scoreContainer.addChild(hpBar);
hpBar.gotoAndStop(1);
goldBar = new panelgold();
goldBar.x = 70;
goldBar.y = 75;
goldBar.height = 40;
goldBar.width = 100;
myParent.scoreContainer.addChild(goldBar);
SetGold();
harpoonBar = new panelharpoon();
harpoonBar.x = 505;
harpoonBar.y = 25;
harpoonBar.height = 40;
harpoonBar.width = 80;
myParent.scoreContainer.addChild(harpoonBar);
SetHarpoon();
hPotionBar = new panelhpotion();
hPotionBar.x = 505;
hPotionBar.y = 75;
hPotionBar.height = 40;
hPotionBar.width = 80;
myParent.scoreContainer.addChild(hPotionBar);
SetHealthPotion();
oPotionBar = new panelopotion();
oPotionBar.x = 505;
oPotionBar.y = 125;
oPotionBar.height = 40;
oPotionBar.width = 80;
myParent.scoreContainer.addChild(oPotionBar);
SetOxygenPotion();
depthBar = new paneldepth();
depthBar.x = 515;
depthBar.y = 525;
depthBar.height = 40;
depthBar.width = 120;
myParent.scoreContainer.addChild(depthBar);
SetDepth();
stageBar = new levelpanel();
stageBar.x = 40;
stageBar.y = 535;
stageBar.height = 20;
stageBar.width = 100;
myParent.scoreContainer.addChild(stageBar);
SetStage();
notificationBar = new notification();
notificationBar.x = 275;
notificationBar.y = 15;
notificationBar.height = 20;
notificationBar.width = 200;
myParent.scoreContainer.addChild(notificationBar);
SetNotification("");
myParent.pirateMgr.ResetPanels();
myParent.stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function SetHarpoon(_lv:int=100){
if (harpoonBar){
harpoonBar.panelharpoontxt.text = _lv;
};
}
public function StopBossFight(){
if (bossBar != null){
myParent.scoreContainer.removeChild(bossBar);
bossBar = null;
};
}
public function SetStage(){
stageBar.levelpaneltxt.text = ((myParent.gameLevel + "/") + myParent.gameSublevel);
}
public function SetNotification(msg:String=""){
if (notificationBar){
notificationTimer = 100;
notificationBar.notificationtxt.text = msg;
notificationBar.alpha = (notificationTimer / 100);
};
}
public function SetOxygenBar(_lv:int=100){
if (oxyBar){
oxyBar.gotoAndStop((101 - _lv));
};
}
public function SetDepth(_lv:int=0){
if (depthBar){
depthBar.paneldepthtxt.text = _lv;
};
if (Math.abs((_lv - prevDepth)) > 5){
if (isDown(_lv)){
if (depthBar.currentLabel != "down"){
depthBar.gotoAndPlay("down");
};
} else {
if (depthBar.currentLabel != "up"){
depthBar.gotoAndPlay("up");
};
};
};
}
public function StopGame(){
if (oxyBar != null){
myParent.scoreContainer.removeChild(oxyBar);
};
if (hpBar != null){
myParent.scoreContainer.removeChild(hpBar);
};
if (harpoonBar != null){
myParent.scoreContainer.removeChild(harpoonBar);
};
if (goldBar != null){
myParent.scoreContainer.removeChild(goldBar);
};
if (hPotionBar != null){
myParent.scoreContainer.removeChild(hPotionBar);
};
if (oPotionBar != null){
myParent.scoreContainer.removeChild(oPotionBar);
};
if (depthBar != null){
myParent.scoreContainer.removeChild(depthBar);
};
if (stageBar != null){
myParent.scoreContainer.removeChild(stageBar);
};
if (notificationBar != null){
myParent.scoreContainer.removeChild(notificationBar);
};
oxyBar = null;
hpBar = null;
harpoonBar = null;
goldBar = null;
hPotionBar = null;
oPotionBar = null;
depthBar = null;
stageBar = null;
notificationBar = null;
myParent.stageRoot.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function SetHealthBar(_lv:int=100){
if (hpBar){
hpBar.gotoAndStop((101 - _lv));
};
}
}
}//package
Section 121
//seaweed (seaweed)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class seaweed extends ItemSeaweedChar {
public function seaweed(){
super();
addFrameScript(0, frame1, 13, frame14);
}
function frame14(){
stop();
}
function frame1(){
stop();
}
}
}//package
Section 122
//snake (snake)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class snake extends EnemySnakeChar {
public function snake(){
super();
addFrameScript(11, frame12, 31, frame32, 32, frame33);
}
function frame32(){
gotoAndPlay("stand");
}
function frame33(){
stop();
}
function frame12(){
gotoAndPlay("stand");
}
}
}//package
Section 123
//SoundManager (SoundManager)
package {
public class SoundManager {
private var stage_bgm;// = null
private var gameover_bgm;// = null
private var sndBgm;// = null
private var introlevel_bgm;// = null
private var bgmFade:Boolean;// = false
private var mainmenu_bgm;// = null
private var menu_bgm;// = null
private var ending_bgm;// = null
private var levi_bgm;// = null
private var boss_bgm;// = null
private var stage3_bgm;// = null
public function SoundManager(){
mainmenu_bgm = null;
introlevel_bgm = null;
gameover_bgm = null;
ending_bgm = null;
menu_bgm = null;
stage_bgm = null;
boss_bgm = null;
stage3_bgm = null;
levi_bgm = null;
sndBgm = null;
bgmFade = false;
super();
mainmenu_bgm = new mainmenubgm();
introlevel_bgm = new introlevelbgm();
gameover_bgm = new gameoverbgm();
ending_bgm = new endingbgm();
menu_bgm = new menubgm();
stage_bgm = new stagebgm();
boss_bgm = new bossbgm();
stage3_bgm = new stage3bgm();
levi_bgm = new levibgm();
}
public function setVolume(val:Number){
if (sndBgm){
sndBgm.setVolume(val);
};
}
public function stopBgm(){
if (sndBgm){
sndBgm.stopSound();
};
}
public function playBgm(val:int){
if (sndBgm){
sndBgm.stopSound();
};
if (val == 1){
sndBgm = mainmenu_bgm;
} else {
if (val == 2){
sndBgm = introlevel_bgm;
} else {
if (val == 3){
sndBgm = stage_bgm;
} else {
if (val == 4){
sndBgm = menu_bgm;
} else {
if (val == 5){
sndBgm = gameover_bgm;
} else {
if (val == 6){
sndBgm = ending_bgm;
} else {
if (val == 7){
sndBgm = boss_bgm;
} else {
if (val == 8){
sndBgm = levi_bgm;
} else {
if (val == 9){
sndBgm = stage3_bgm;
};
};
};
};
};
};
};
};
};
sndBgm.playSoundLoop();
if (val == 3){
sndBgm.setVolume(0.1);
} else {
sndBgm.setVolume(1);
};
sndBgm.fadeIn(false);
}
public function fadeBgm(){
if (sndBgm){
sndBgm.fadeOut(false);
};
}
}
}//package
Section 124
//squid (squid)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class squid extends EnemySquidChar {
public function squid(){
super();
addFrameScript(29, frame30, 59, frame60, 60, frame61);
}
function frame30(){
gotoAndPlay("stand");
}
function frame60(){
gotoAndPlay("stand");
}
function frame61(){
stop();
}
}
}//package
Section 125
//stage3bgm (stage3bgm)
package {
public dynamic class stage3bgm extends BaseSound {
public function stage3bgm(){
super();
}
}
}//package
Section 126
//stagebgm (stagebgm)
package {
public dynamic class stagebgm extends BaseSound {
public function stagebgm(){
super();
}
}
}//package
Section 127
//sting (sting)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class sting extends EnemyStingChar {
public function sting(){
super();
addFrameScript(29, frame30, 45, frame46, 46, frame47);
}
function frame30(){
gotoAndPlay("stand");
}
function frame46(){
gotoAndPlay("stand");
}
function frame47(){
stop();
}
}
}//package
Section 128
//story (story)
package {
import flash.display.*;
public dynamic class story extends MovieClip {
public var btnskipstory:SimpleButton;
public function story(){
super();
}
}
}//package
Section 129
//sword (sword)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class sword extends EnemySwordChar {
public function sword(){
super();
addFrameScript(19, frame20, 39, frame40, 40, frame41);
}
function frame20(){
gotoAndPlay("stand");
}
function frame40(){
gotoAndPlay("stand");
}
function frame41(){
stop();
}
}
}//package
Section 130
//swordfish_attack (swordfish_attack)
package {
public dynamic class swordfish_attack extends BaseSound {
public function swordfish_attack(){
super();
}
}
}//package
Section 131
//tiger (tiger)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class tiger extends EnemyTigerChar {
public function tiger(){
super();
addFrameScript(19, frame20, 39, frame40, 40, frame41);
}
function frame20(){
gotoAndPlay("stand");
}
function frame40(){
gotoAndPlay("stand");
}
function frame41(){
stop();
}
}
}//package
Section 132
//treasure_break (treasure_break)
package {
public dynamic class treasure_break extends BaseSound {
public function treasure_break(){
super();
}
}
}//package
Section 133
//TreasureDive (TreasureDive)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
public class TreasureDive {
const BTPAUSE;
public var stageRoot;// = null
public var itemMgr;
public var soundMgr;
public var scoreContainer;// = null
public var bossFight:Boolean;// = false
public var worldMgr;
public var scoreMgr;
public var gameLevel:int;// = 1
public var menuMgr;
public var bgContainer;// = null
private var gamePaused:Boolean;// = false
private var theTreasure;// = null
public var sceneContainer;// = null
public var gameSublevel:int;// = 1
public var menuContainer;// = null
public var bossMgr;
public var enemyMgr;
public var pirateMgr;
public function TreasureDive(_stageRoot){
BTPAUSE = Keyboard.ENTER;
stageRoot = null;
menuContainer = null;
scoreContainer = null;
sceneContainer = null;
bgContainer = null;
gameLevel = 1;
gameSublevel = 1;
bossFight = false;
gamePaused = false;
theTreasure = null;
super();
stageRoot = _stageRoot;
worldMgr = new WorldManager(this);
pirateMgr = new PirateManager(this);
enemyMgr = new EnemyManager(this);
itemMgr = new ItemManager(this);
bossMgr = new BossManager(this);
scoreMgr = new ScoreManager(this);
menuMgr = new MenuManager(this);
soundMgr = new SoundManager();
bossFight = false;
}
public function StartBossFight(){
enemyMgr.StopGame();
worldMgr.StartBossFight();
pirateMgr.StartBossFight();
itemMgr.StartBossFight();
scoreMgr.StartBossFight();
bossFight = true;
}
public function ShowPreMovie(){
soundMgr.playBgm(1);
menuMgr.ShowPreMovie();
}
public function ResetLevel(){
gameLevel = 1;
gameSublevel = 1;
}
public function ShowMenu(){
soundMgr.playBgm(4);
menuMgr.ShowMenu();
}
public function StopBossFight(){
scoreMgr.StopBossFight();
ShowTreasure();
}
public function EndLevel(){
IncreaseSubLevel();
}
public function GetPirate():MovieClip{
return (pirateMgr.thePirate);
}
private function HideTreasure(){
stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
bgContainer.removeChild(theTreasure);
theTreasure = null;
}
public function StopGame(){
worldMgr.StopGame();
if (bossFight){
bossMgr.StopBossFight();
bossFight = false;
};
pirateMgr.StopGame();
enemyMgr.StopGame();
itemMgr.StopGame();
scoreMgr.StopGame();
stageRoot.removeEventListener(KeyboardEvent.KEY_DOWN, KeyPressHandler);
}
public function IncreaseSubLevel(){
StopGame();
if ((((gameLevel == 3)) && ((gameSublevel == 2)))){
ShowEndMovie();
} else {
if (gameSublevel == 1){
gameSublevel = 2;
} else {
gameLevel++;
gameSublevel = 1;
};
ShowMenu();
};
}
public function ShowGameOver(){
soundMgr.playBgm(5);
if (bossFight){
scoreMgr.StopBossFight();
};
StopGame();
menuMgr.ShowGameOver();
}
private function FrameEnterHandler(event:Event){
if (theTreasure){
if (theTreasure.currentFrame == theTreasure.totalFrames){
HideTreasure();
EndLevel();
};
};
}
public function ShowEndMovie(){
soundMgr.playBgm(6);
menuMgr.ShowEndMovie();
}
public function StartGame(){
gamePaused = false;
worldMgr.StartGame();
pirateMgr.StartGame();
enemyMgr.StartGame();
itemMgr.StartGame();
scoreMgr.StartGame();
if ((((gameLevel == 3)) && ((gameSublevel == 2)))){
soundMgr.playBgm(9);
} else {
soundMgr.playBgm(3);
};
stageRoot.addEventListener(KeyboardEvent.KEY_DOWN, KeyPressHandler);
}
public function ResumeGame(){
if (gamePaused){
gamePaused = false;
if (bossFight){
bossMgr.ResumeGame();
};
if (menuMgr.showing){
menuMgr.EndPage();
};
worldMgr.ResumeGame();
pirateMgr.ResumeGame();
enemyMgr.ResumeGame();
itemMgr.ResumeGame();
};
}
private function KeyPressHandler(event:KeyboardEvent){
switch (event.keyCode){
case BTPAUSE:
if (gamePaused){
ResumeGame();
} else {
PauseGame();
};
break;
};
}
public function PauseGame(){
if (!worldMgr.noPause){
if (!gamePaused){
gamePaused = true;
if (bossFight){
bossMgr.PauseGame();
};
if (!menuMgr.showing){
menuMgr.ShowPause();
};
worldMgr.PauseGame();
pirateMgr.PauseGame();
enemyMgr.PauseGame();
itemMgr.PauseGame();
};
};
}
private function ShowTreasure(){
if (!theTreasure){
if (gameLevel == 1){
theTreasure = new atlanticsword();
theTreasure.x = 275;
theTreasure.y = 450;
bgContainer.addChild(theTreasure);
} else {
if (gameLevel == 2){
theTreasure = new atlanticcrown();
theTreasure.x = 275;
theTreasure.y = 440;
bgContainer.addChild(theTreasure);
} else {
if (gameLevel == 3){
theTreasure = new atlanticstaff();
theTreasure.x = 275;
theTreasure.y = 450;
bgContainer.addChild(theTreasure);
};
};
};
};
stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
}
}//package
Section 134
//wall (wall)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class wall extends WallChar {
public function wall(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame6(){
stop();
}
function frame3(){
stop();
}
function frame2(){
stop();
}
function frame1(){
stop();
}
}
}//package
Section 135
//wallback (wallback)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.geom.*;
import flash.system.*;
public dynamic class wallback extends MovieClip {
public function wallback(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 136
//WallChar (WallChar)
package {
import flash.display.*;
import flash.events.*;
public class WallChar extends BaseMovieClip {
const HEIGHT = 550;
const INITY = -1400;
const INITX = 0;
const WIDTH = 125;
public var typed;// = "wall"
public var detectorCount:int;// = 0
public var named;// = "wall"
public var walldetect1_10:walldetector;
public var walldetect1_11:walldetector;
public var walldetect1_13:walldetector;
public var walldetect1_15:walldetector;
public var walldetect1_12:walldetector;
public var walldetect1_14:walldetector;
public var walldetect1_18:walldetector;
public var walldetect1_19:walldetector;
public var walldetect1_16:walldetector;
public var walldetect1_17:walldetector;
public var walldetect1_20:walldetector;
private var myParent;
public var level;// = 0
public var walldetect1_2:walldetector;
public var walldetect1_4:walldetector;
public var walldetect1_5:walldetector;
public var walldetect1_7:walldetector;
public var walldetect1_9:walldetector;
public var walldetect1_3:walldetector;
public var walldetect1_6:walldetector;
public var walldetect1_8:walldetector;
private var gamePaused:Boolean;// = false
public var walldetect1_1:walldetector;
public function WallChar(){
typed = "wall";
named = "wall";
level = 0;
detectorCount = 0;
gamePaused = false;
super();
}
public function DetectObjectHit(_obj):MovieClip{
var hit:*;
var detector:*;
var i:*;
hit = false;
detector = null;
i = 1;
while (((!(hit)) && ((i <= detectorCount)))) {
if (_obj){
hit = this[("walldetect1_" + i)].hitTestObject(_obj);
};
if (hit){
detector = this[("walldetect1_" + i)];
};
i++;
};
return (detector);
}
public function PauseGame(){
gamePaused = true;
this.StopMovement();
}
public function SetSkin(frlabel:String="lv11"){
gotoAndStop(frlabel);
}
public function Init(_myParent){
myParent = _myParent;
this.x = INITX;
this.y = INITY;
this.SetLimit(-550, 0, 0, 0);
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
var thePirate:*;
var hitdetect:*;
thePirate = myParent.GetPirate();
hitdetect = null;
if (!gamePaused){
if (thePirate.bodydetect){
hitdetect = DetectObjectHit(thePirate.bodydetect);
};
if (hitdetect){
if (thePirate.x > (hitdetect.x + this.x)){
thePirate.MoveRight(50);
} else {
thePirate.MoveLeft(50);
};
if (thePirate.y < (hitdetect.y + this.y)){
thePirate.MoveUp(20);
} else {
thePirate.MoveDown(20);
};
};
};
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function ResumeGame(){
gamePaused = false;
this.StartMovement();
}
}
}//package
Section 137
//walldetector (walldetector)
package {
import flash.display.*;
public dynamic class walldetector extends MovieClip {
public function walldetector(){
super();
}
}
}//package
Section 138
//wavedetector (wavedetector)
package {
public dynamic class wavedetector extends WaveDetectorChar {
public function wavedetector(){
super();
}
}
}//package
Section 139
//WaveDetectorChar (WaveDetectorChar)
package {
import flash.display.*;
import flash.events.*;
public class WaveDetectorChar extends MovieClip {
public var named:String;// = "wave"
private var myParent;
public var level:int;// = 1
public var type:String;// = "detector"
public function WaveDetectorChar(){
type = "detector";
named = "wave";
level = 1;
super();
}
public function Init(_myParent){
myParent = _myParent;
this.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
private function FrameEnterHandler(event:Event){
var thePirate:*;
thePirate = myParent.GetPirate();
if (this.x < -100){
Destroy();
};
if (thePirate.bodydetect){
if (DetectHit(thePirate.bodydetect)){
myParent.StartWave();
Destroy();
};
};
}
private function DetectHit(obj):Boolean{
var hit:Boolean;
hit = false;
if (obj){
hit = ((hit) || (this.hitTestObject(obj)));
};
return (hit);
}
public function Destroy(){
this.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
myParent.Remove(this);
}
}
}//package
Section 140
//whirlpool (whirlpool)
package {
import flash.display.*;
public dynamic class whirlpool extends MovieClip {
public function whirlpool(){
super();
}
}
}//package
Section 141
//WorldManager (WorldManager)
package {
import flash.display.*;
import flash.events.*;
public class WorldManager {
private var distort:int;// = 0
private var waveMapLv21:Array;
private var waveMapLv22:Array;
public var scoreContainer;// = null
private var waveCount:int;// = 2
private var endStageTimer:int;// = 0
private var theWhirlpool;// = null
private var waveMapLv31:Array;
public var gameLevel:int;
public var noPause:Boolean;// = false
private var waveOn:Boolean;// = false
private var waveMapLv32:Array;
public var bgContainer;// = null
private var zoomingout:Boolean;// = false
private var gamePaused;// = false
private var waveTimer:int;// = 0
public var sceneContainer;// = null
public var gameSublevel:int;
private var starty:Number;// = 0
public var theWall;// = null
public var menuContainer;// = null
public var theBackWall;// = null
public var theWarning;
private var waveMapLv11:Array;
private var waveMapLv12:Array;
private var myParent;
private var stageEnd:Boolean;// = false
public function WorldManager(_myParent){
starty = 0;
distort = 0;
menuContainer = null;
scoreContainer = null;
sceneContainer = null;
bgContainer = null;
theWall = null;
theBackWall = null;
noPause = false;
theWhirlpool = null;
zoomingout = false;
stageEnd = false;
endStageTimer = 0;
waveOn = false;
waveTimer = 0;
waveCount = 2;
waveMapLv11 = new Array(250, 1000, 250, 1250);
waveMapLv12 = new Array(250, 750, 250, 1150);
waveMapLv21 = new Array(250, 1300, 300, 1300);
waveMapLv22 = new Array(300, 750, 275, 1300);
waveMapLv31 = new Array(225, 950, 300, 1150);
waveMapLv32 = new Array(250, 550, 300, 1000);
gamePaused = false;
super();
myParent = _myParent;
bgContainer = new Sprite();
sceneContainer = new Sprite();
scoreContainer = new Sprite();
menuContainer = new Sprite();
myParent.stageRoot.addChild(bgContainer);
myParent.stageRoot.addChild(sceneContainer);
myParent.stageRoot.addChild(scoreContainer);
myParent.stageRoot.addChild(menuContainer);
myParent.bgContainer = bgContainer;
myParent.sceneContainer = sceneContainer;
myParent.scoreContainer = scoreContainer;
myParent.menuContainer = menuContainer;
}
private function EndStage(){
stageEnd = false;
StopGame();
HideWarning();
myParent.IncreaseSubLevel();
}
private function DestroyBackWall(){
if (theBackWall != null){
bgContainer.removeChild(theBackWall);
theBackWall = null;
};
}
private function ShowWarning(){
if (!theWarning){
noPause = true;
if (myParent.gameSublevel == 1){
theWarning = new endstagewarning();
} else {
myParent.soundMgr.stopBgm();
theWarning = new bosswarning();
};
theWarning.x = 275;
theWarning.y = 275;
};
menuContainer.addChild(theWarning);
}
private function CreateWall(){
if (theWall == null){
theWall = new wall();
sceneContainer.addChild(theWall);
theWall.Init(this);
theWall.detectorCount = 20;
};
}
public function StartBossFight(){
zoomingout = true;
}
private function StartEndTimer(){
noPause = true;
endStageTimer = 30;
myParent.enemyMgr.StopGame();
}
private function CreateBackWall(){
if (theBackWall == null){
theBackWall = new wallback();
bgContainer.addChild(theBackWall);
};
}
private function RedrawObjects(){
var obj:*;
var dx:*;
var dy:*;
var thePirate:*;
var ddx:*;
var i:*;
obj = null;
dx = 0;
dy = 0;
thePirate = myParent.GetPirate();
if (thePirate){
dx = ((thePirate.x - 275) * 0.01);
dy = 0.3;
};
if (dy < 0.5){
dy = 0.5;
};
if (waveOn){
dy = (dy - (Math.sin(((waveTimer / 25) * Math.PI)) + 0.1));
};
ddx = ((Math.sin(((distort / 180) * Math.PI)) * Math.random()) * 3);
distort = ((distort)>=360) ? 0 : (distort + 5);
if (theWall){
if (dx < 0){
dx = Math.max(theWall.x, dx);
} else {
dx = Math.min((90 + theWall.x), dx);
};
if (dy < 0){
dy = Math.max(theWall.y, (dy * 10));
} else {
dy = Math.min((1640 + theWall.y), dy);
};
};
i = 0;
while (i < myParent.sceneContainer.numChildren) {
obj = myParent.sceneContainer.getChildAt(i);
if (obj){
if (obj.typed == "pirate"){
obj.CalibrateCoordinate((ddx + dx), ((thePirate.y - 275) * 0.01));
} else {
if (!myParent.bossFight){
if (((!((obj.typed == "boss"))) && (!((obj.typed == "bullet"))))){
obj.x = (obj.x - dx);
obj.y = (obj.y - dy);
};
};
};
};
i++;
};
if (!myParent.bossFight){
if (theBackWall){
theBackWall.x = (theBackWall.x - dx);
if ((theBackWall.y - ((dy * 3) / 4)) <= 0){
theBackWall.y = (theBackWall.y - ((dy * 3) / 4));
};
};
};
}
private function ZoomOut(){
var i:int;
var obj:*;
var scale:*;
var prevHeight:Number;
var prevWidth:Number;
i = 0;
obj = null;
scale = theWall.scaleX;
if (scale > 0.86){
scale = (scale - 0.001);
theWall.scaleX = scale;
theWall.scaleY = scale;
theWall.scale = scale;
theWall.x = (theWall.x + ((0 - theWall.x) * 0.05));
theWall.y = (theWall.y - ((theWall.y + 1340) * 0.3));
theBackWall.scaleX = scale;
theBackWall.scaleY = scale;
theBackWall.x = (theBackWall.x + ((0 - theBackWall.x) * 0.05));
theBackWall.y = (theBackWall.y - ((theBackWall.y + 1040) * 0.3));
} else {
zoomingout = false;
HideWarning();
myParent.bossMgr.StartBossFight();
noPause = false;
};
}
public function GetPirate():MovieClip{
return (myParent.GetPirate());
}
public function StopGame(){
myParent.stageRoot.removeEventListener(Event.ENTER_FRAME, FrameEnterHandler);
DestroyBackWall();
DestroyWall();
DestroyWhirlpool();
}
private function FrameEnterHandler(event:Event){
var thePirate:*;
thePirate = myParent.GetPirate();
if (!gamePaused){
if ((((theWall.y < -1600)) && (((!(myParent.bossFight)) && ((endStageTimer == 0)))))){
if (myParent.gameSublevel == 1){
ShowWarning();
StartEndTimer();
} else {
if (myParent.gameSublevel == 2){
ShowWarning();
myParent.StartBossFight();
};
};
};
if (zoomingout){
ZoomOut();
};
if (thePirate){
RedrawObjects();
myParent.scoreMgr.SetDepth(((theWall.y - thePirate.y) * -1));
};
if (waveTimer > 0){
waveTimer--;
theWhirlpool.x = ((Math.sin(((waveTimer / 25) * Math.PI)) * 20) + 275);
theWhirlpool.y = ((Math.cos(((waveTimer / 25) * Math.PI)) * 20) + thePirate.y);
if (waveTimer <= 0){
waveOn = false;
theWhirlpool.visible = false;
};
};
if (endStageTimer > 0){
endStageTimer--;
if (endStageTimer <= 0){
stageEnd = true;
};
};
if (stageEnd){
EndStageRedraw();
if (theWall.y >= -100){
EndStage();
};
};
};
}
public function Remove(_obj){
if (_obj){
myParent.sceneContainer.removeChild(_obj);
_obj = null;
};
}
private function SetWall(_label:String="lv11"){
theWall.SetSkin(_label);
sceneContainer.setChildIndex(theWall, 0);
theWall.x = 0;
theWall.y = starty;
}
private function CreateWhirlpool(){
if (!theWhirlpool){
theWhirlpool = new whirlpool();
theWhirlpool.x = 275;
theWhirlpool.y = 275;
theWhirlpool.visible = false;
scoreContainer.addChild(theWhirlpool);
};
}
public function StartGame(){
stageEnd = false;
noPause = false;
gameLevel = myParent.gameLevel;
gameSublevel = myParent.gameSublevel;
CreateBackWall();
CreateWall();
theWall.scaleX = 1;
theWall.scaleY = 1;
theWall.scale = 1;
theWall.x = 0;
theWall.y = 0;
theBackWall.scaleX = 1;
theBackWall.scaleY = 1;
theBackWall.x = 0;
theBackWall.y = 0;
SetWall((("lv" + gameLevel) + gameSublevel));
SetBackWall((("bg" + gameLevel) + gameSublevel));
PlaceWaveDetector();
CreateWhirlpool();
myParent.stageRoot.addEventListener(Event.ENTER_FRAME, FrameEnterHandler);
}
public function ResumeGame(){
gamePaused = false;
}
private function SetBackWall(_label:String="bg11"){
theBackWall.gotoAndPlay(_label);
theBackWall.x = 0;
theBackWall.y = 0;
}
public function Destroy(){
myParent.stageRoot.removeChild(bgContainer);
myParent.stageRoot.removeChild(sceneContainer);
myParent.stageRoot.removeChild(scoreContainer);
myParent.stageRoot.removeChild(menuContainer);
}
private function DestroyWhirlpool(){
if (theWhirlpool){
scoreContainer.removeChild(theWhirlpool);
};
theWhirlpool = null;
}
private function PlaceWaveDetector(){
var sw:*;
var waveMap:*;
var i:int;
sw = null;
waveMap = this[(("waveMapLv" + myParent.gameLevel) + myParent.gameSublevel)];
i = 0;
i = 0;
while (i < waveCount) {
sw = new wavedetector();
sw.x = 0;
sw.y = waveMap[((2 * i) + 1)];
myParent.sceneContainer.addChild(sw);
sw.Init(this);
i++;
};
}
public function PauseGame(){
gamePaused = true;
}
private function DestroyWall(){
if (theWall != null){
theWall.Destroy();
sceneContainer.removeChild(theWall);
theWall = null;
};
}
public function HideWarning(){
if (theWarning){
menuContainer.removeChild(theWarning);
theWarning = null;
};
}
public function StartWave(){
if (!waveOn){
waveOn = true;
waveTimer = 150;
if (theWhirlpool){
theWhirlpool.visible = true;
};
};
}
private function EndStageRedraw(){
var obj:*;
var i:*;
obj = null;
theWall.y = (theWall.y + 10);
theWall.MoveToY(theWall.y);
if (((theBackWall.y + 7.5) <= 0)){
theBackWall.y = (theBackWall.y + 7.5);
};
i = 0;
while (i < myParent.sceneContainer.numChildren) {
obj = myParent.sceneContainer.getChildAt(i);
if (obj){
if ((((((((obj.typed == "enemy")) || ((obj.typed == "item")))) || ((obj.typed == "bullet")))) || ((obj.typed == "detector")))){
obj.y = (obj.y + 10);
};
obj = null;
};
i++;
};
}
}
}//package