Section 1
//MainTimeline (Mini_SWW_fla.MainTimeline)
package Mini_SWW_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.net.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var background:MovieClip;
public var score_txt:TextField;
public var mc_play:MovieClip;
public var speed:Number;
public var i;
public var p;
public var q:int;
public var mc_again:MovieClip;
public var speed_txt:TextField;
public var container:Sprite;
public var score:int;
public var sharkproxy:Sharkproxy;
public var mc_instructions:MovieClip;
public var rock:Rock;
public var controls:Array;
public var mc_main:MovieClip;
public var song1:Song;
public var grass:Grass;
public var sndCh:SoundChannel;
public var shark:Shark;
public var mc_credits:MovieClip;
public var mc_back:MovieClip;
public function MainTimeline(){
addFrameScript(0, frame1, 4, frame5, 7, frame8, 10, frame11, 14, frame15);
}
public function keyboarddown(_arg1:KeyboardEvent){
controls[_arg1.keyCode] = 1;
}
public function gotoplay(_arg1:MouseEvent){
gotoAndStop("game");
}
public function gotomain3(_arg1:MouseEvent){
gotoAndStop("main");
}
public function gotoinst(_arg1:MouseEvent){
gotoAndStop("instructions");
}
public function goback2(_arg1:MouseEvent){
gotoAndStop("main");
}
function frame1(){
stop();
mc_play.addEventListener(MouseEvent.CLICK, gotoplay);
mc_credits.addEventListener(MouseEvent.CLICK, gotocredits);
mc_instructions.addEventListener(MouseEvent.CLICK, gotoinst);
}
function frame8(){
stop();
mc_back.addEventListener(MouseEvent.CLICK, goback2);
}
function frame5(){
stop();
mc_back.addEventListener(MouseEvent.CLICK, goback);
}
function frame15(){
stop();
controls = [];
controls[37] = 0;
controls[38] = 0;
controls[39] = 0;
controls[40] = 0;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyboarddown);
stage.addEventListener(KeyboardEvent.KEY_UP, keyboardup);
song1 = new Song();
container = new Sprite();
sharkproxy = new Sharkproxy();
shark = new Shark();
score = 0;
q = 0;
speed = 2;
speed_txt.text = ("Speed: " + (Math.floor(speed) - 1));
score_txt.text = ("Score: " + 0);
sndCh = song1.play(0, 999);
shark.rotation = 90;
sharkproxy.rotation = 90;
sharkproxy.scaleX = 0.25;
sharkproxy.scaleY = sharkproxy.scaleX;
shark.x = 100;
shark.y = 150;
shark.scaleX = 0.25;
shark.scaleY = shark.scaleX;
stage.addEventListener(Event.ENTER_FRAME, updateshark);
p = 0;
while (p < 3) {
grass = new Grass();
grass.x = ((Math.random() * 300) + 300);
grass.y = ((Math.random() * 150) + 50);
grass.scaleX = 0.3;
grass.scaleY = grass.scaleX;
grass.addEventListener(Event.ENTER_FRAME, movegrass);
container.addChild(grass);
p++;
};
i = 0;
while (i < 8) {
rock = new Rock();
rock.x = ((Math.random() * 300) + 300);
rock.y = ((Math.random() * 150) + 50);
rock.scaleX = ((Math.random() * 0.4) + 0.15);
rock.scaleY = rock.scaleX;
container.addChild(rock);
rock.addEventListener(Event.ENTER_FRAME, moverock);
i++;
};
container.addChild(shark);
addChild(container);
}
function frame11(){
stop();
Mouse.show();
removeChild(container);
score_txt.text = ("Score: " + score);
mc_again.addEventListener(MouseEvent.CLICK, playagain);
mc_main.addEventListener(MouseEvent.CLICK, gotomain3);
}
public function playagain(_arg1:MouseEvent){
gotoAndStop("game");
}
public function movegrass(_arg1:Event){
_arg1.currentTarget.x = (_arg1.currentTarget.x - speed);
if (_arg1.currentTarget.x < -100){
_arg1.currentTarget.x = ((Math.random() * 400) + 400);
_arg1.currentTarget.y = (Math.random() * 300);
};
}
public function keyboardup(_arg1:KeyboardEvent){
controls[_arg1.keyCode] = 0;
}
public function moverock(_arg1:Event){
var _local2:*;
_arg1.currentTarget.x = (_arg1.currentTarget.x - speed);
if (_arg1.currentTarget.x < -100){
_arg1.currentTarget.x = ((Math.random() * 400) + 400);
_arg1.currentTarget.y = (Math.random() * 300);
score++;
speed = (speed + 0.04);
score_txt.text = ("Score: " + score);
speed_txt.text = ("Speed: " + (Math.floor(speed) - 1));
};
if (_arg1.currentTarget.hitTestObject(sharkproxy)){
shark.gotoAndStop("crash");
shark.x = (shark.x - speed);
sharkproxy.x = (sharkproxy.x - speed);
stage.removeEventListener(Event.ENTER_FRAME, updateshark);
if (shark.x < 0){
_local2 = 0;
while (_local2 < container.numChildren) {
container.getChildAt(_local2).removeEventListener(Event.ENTER_FRAME, moverock);
sndCh.stop();
gotoAndStop("gameOver");
_local2++;
};
};
};
}
public function goback(_arg1:MouseEvent){
gotoAndStop("main");
}
public function updateshark(_arg1:Event){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
if ((((controls[37] == 1)) && ((shark.x > 0)))){
shark.x = (shark.x - 5);
};
if ((((controls[38] == 1)) && ((shark.y > 0)))){
shark.y = (shark.y - 5);
};
if ((((controls[39] == 1)) && ((shark.x < 350)))){
shark.x = (shark.x + 5);
};
if ((((controls[40] == 1)) && ((shark.y < 300)))){
shark.y = (shark.y + 5);
};
if ((((controls[39] == 0)) && ((shark.x > 0)))){
shark.x = (shark.x - 3);
};
sharkproxy.x = shark.x;
sharkproxy.y = shark.y;
if (q > 4){
_local2 = ((Math.random() * 200) + 56);
_local3 = ((Math.random() * 200) + 56);
_local4 = ((Math.random() * 200) + 56);
_local5 = new ColorTransform(1, 1, 1, 1, _local2, _local3, _local4, 1);
background.transform.colorTransform = _local5;
q = 0;
} else {
q++;
};
}
public function gotocredits(_arg1:MouseEvent){
gotoAndStop("credits");
}
}
}//package Mini_SWW_fla
Section 2
//Grass (Grass)
package {
import flash.display.*;
public dynamic class Grass extends MovieClip {
}
}//package
Section 3
//Rock (Rock)
package {
import flash.display.*;
public dynamic class Rock extends MovieClip {
public var rock:MovieClip;
}
}//package
Section 4
//Shark (Shark)
package {
import flash.display.*;
public dynamic class Shark extends MovieClip {
public function Shark(){
addFrameScript(12, frame13);
}
function frame13(){
gotoAndPlay("swim");
}
}
}//package
Section 5
//Sharkproxy (Sharkproxy)
package {
import flash.display.*;
public dynamic class Sharkproxy extends MovieClip {
}
}//package
Section 6
//Song (Song)
package {
import flash.media.*;
public dynamic class Song extends Sound {
}
}//package