Section 1
//MainTimeline (Glidden_Andrew_fla.MainTimeline)
package Glidden_Andrew_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.text.*;
import flash.system.*;
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.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 mc_quit:MovieClip;
public var speed:Number;
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 i;
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);
mc_quit.addEventListener(MouseEvent.CLICK, quitgame);
}
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 = 7;
speed_txt.text = ("Speed: " + (Math.floor(speed) - 6));
score_txt.text = ("Score: " + 0);
sndCh = song1.play();
shark.rotation = 90;
sharkproxy.rotation = 90;
sharkproxy.scaleX = 0.5;
sharkproxy.scaleY = sharkproxy.scaleX;
shark.x = 200;
shark.y = 300;
shark.scaleX = 0.5;
shark.scaleY = shark.scaleX;
stage.addEventListener(Event.ENTER_FRAME, updateshark);
p = 0;
while (p < 3) {
grass = new Grass();
grass.x = ((Math.random() * 600) + 600);
grass.y = ((Math.random() * 300) + 100);
grass.scaleX = 0.5;
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() * 600) + 600);
rock.y = ((Math.random() * 300) + 100);
rock.scaleX = (Math.random() + 0.2);
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() * 800) + 800);
_arg1.currentTarget.y = (Math.random() * 600);
};
}
public function quitgame(_arg1:MouseEvent){
fscommand("quit");
}
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() * 800) + 800);
_arg1.currentTarget.y = (Math.random() * 600);
score++;
speed = (speed + 0.05);
score_txt.text = ("Score: " + score);
speed_txt.text = ("Speed: " + (Math.floor(speed) - 6));
};
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 - 8);
};
if ((((controls[38] == 1)) && ((shark.y > 0)))){
shark.y = (shark.y - 8);
};
if ((((controls[39] == 1)) && ((shark.x < 700)))){
shark.x = (shark.x + 8);
};
if ((((controls[40] == 1)) && ((shark.y < 600)))){
shark.y = (shark.y + 8);
};
if ((((controls[39] == 0)) && ((shark.x > 0)))){
shark.x = (shark.x - 6);
};
sharkproxy.x = shark.x;
sharkproxy.y = shark.y;
if (q == 0){
_local2 = ((Math.random() * 511) - 0xFF);
_local3 = ((Math.random() * 100) + 156);
_local4 = ((Math.random() * 511) - 0xFF);
_local5 = new ColorTransform(1, 1, 1, 1, _local2, _local3, _local4, 1);
background.transform.colorTransform = _local5;
q++;
} else {
q = 0;
};
}
public function gotocredits(_arg1:MouseEvent){
gotoAndStop("credits");
}
}
}//package Glidden_Andrew_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