MAIN.AS:
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.TimerEvent;
import flash.ui.Keyboard
public class Main extends Sprite
{
private var aDown:Boolean = false;
private var dDown:Boolean = false;
private var sDown:Boolean = false;
private var wDown:Boolean = false;
private var char : player;
private var gDown:Boolean = false;
private var jDown:Boolean = false;
private var hDown:Boolean = false;
private var yDown:Boolean = false;
private var par : shark;
private var bar : Back;
private var sar : Speed;
private var oar : Over;
private var speed:int = 10;
private var speedDuration:int = 30;
private var randomX:int = Math.floor(Math.random()*12)+1;
public function Main():void
{
bar = new Back();
bar.x = -300;
bar.y = 0;
addChild(bar);
sar = new Speed();
if(randomX == 1)
{
sar.x = -100;
sar.y = 400;
}
else if(randomX == 2)
{
sar.x = 275;
sar.y = 350;
}
else if(randomX == 3)
{
sar.x = 150;
sar.y = 200;
}
else if(randomX == 4)
{
sar.x = 700;
sar.y = 50
}
else if(randomX == 5)
{
sar.x = -50;
sar.y = 300;
}
else if(randomX == 6)
{
sar.x = 100;
sar.y = 400;
}
else if(randomX == 7)
{
sar.x = 750;
sar.y = 50;
}
else if(randomX == 8)
{
sar.x = 800;
sar.y = 400;
}
else if(randomX == 9)
{
sar.x = 350;
sar.y = 400;
}
else if(randomX == 10)
{
sar.x = 650;
sar.y = 450
}
else if(randomX == 11)
{
sar.x = 150;
sar.y = 500;
}
else if(randomX == 12)
{
sar.x = 700;
sar.y = 200;
}
addChild(sar);
char = new player();
char.x = 500;
char.y = 300;
addChild(char);
par = new shark();
par.x = 600;
par.y = 400;
addChild(par);
stage.addEventListener(Event.ENTER_FRAME, keys);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keysdown);
stage.addEventListener(KeyboardEvent.KEY_UP, keysup);
}
public function keys(e:Event):void
{
if (aDown == true)
char.x -= speed;
if (dDown == true)
char.x += speed;
if (sDown == true)
char.y += speed;
if (wDown == true)
char.y -= speed;
if(char.hitTestObject(sar))
{
speed = 20;
speedDuration = 30
}
if (gDown == true)
par.x -= 11;
if (jDown == true)
par.x += 11;
if (hDown == true)
par.y += 11;
if (yDown == true)
par.y -= 11;
if(par.hitTestObject(sar))
{
speed = 10;
speedDuration = 30
}
if(par.hitTestObject(char))
{
oar = new Over();
oar.x = -300;
oar.y = 0;
addChild(oar);
}
}
public function keysdown(e:KeyboardEvent):void
{
switch (e.keyCode)
{
case Keyboard.A:
{
aDown = true;
break;
}
case Keyboard.D:
{
dDown = true;
break;
}
case Keyboard.S:
{
sDown = true;
break;
}
case Keyboard.W:
{
wDown = true;
break;
}
case Keyboard.G:
{
gDown = true;
break;
}
case Keyboard.J:
{
jDown = true;
break;
}
case Keyboard.H:
{
hDown = true;
break;
}
case Keyboard.Y:
{
yDown = true;
break;
}
}
}
public function keysup(e:KeyboardEvent):void
{
switch (e.keyCode)
{
case Keyboard.A:
{
aDown = false;
break;
}
case Keyboard.D:
{
dDown = false;
break;
}
case Keyboard.S:
{
sDown = false;
break;
}
case Keyboard.W:
{
wDown = false;
break;
}
case Keyboard.G:
{
gDown = false;
break;
}
case Keyboard.J:
{
jDown = false;
break;
}
case Keyboard.H:
{
hDown = false;
break;
}
case Keyboard.Y:
{
yDown = false;
break;
}
}
}
}
}
BACK.AS:
package
{
import flash.display.MovieClip;
public class Back extends MovieClip
{
public function Back()
{
this.graphics.beginFill(0x000080, 1);
this.graphics.drawRect(this.x, this.y, 7000, 7000);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+150, this.y, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+150, this.y+100, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+150, this.y+200, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+150, this.y+300, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+150, this.y+400, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+150, this.y+500, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+250, this.y, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+250, this.y+100, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+250, this.y+200, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+250, this.y+300, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+250, this.y+400, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+250, this.y+500, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+350, this.y, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+350, this.y+100, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+350, this.y+200, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+350, this.y+300, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+350, this.y+400, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+350, this.y+500, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+450, this.y, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+450, this.y+100, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+450, this.y+200, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+450, this.y+300, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+450, this.y+400, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+450, this.y+500, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+550, this.y, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+550, this.y+100, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+550, this.y+200, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+550, this.y+300, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+550, this.y+400, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+550, this.y+500, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+650, this.y, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+650, this.y+100, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+650, this.y+200, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+650, this.y+300, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+650, this.y+400, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+650, this.y+500, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+750, this.y, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+750, this.y+100, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+750, this.y+200, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+750, this.y+300, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+750, this.y+400, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+750, this.y+500, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+850, this.y, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+850, this.y+100, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+850, this.y+200, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+850, this.y+300, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+850, this.y+400, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+850, this.y+500, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+950, this.y, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+950, this.y+100, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+950, this.y+200, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+950, this.y+300, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+950, this.y+400, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+950, this.y+500, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1050, this.y, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1050, this.y+100, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1050, this.y+200, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1050, this.y+300, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1050, this.y+400, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1050, this.y+500, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1150, this.y, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1150, this.y+100, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1150, this.y+200, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1150, this.y+300, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1150, this.y+400, 40, 40);
this.graphics.endFill ();
this.graphics.beginFill(0x008000, 1);
this.graphics.drawRect(this.x+1150, this.y+500, 40, 40);
this.graphics.endFill ();
}
}
}
PLAYER.AS(BOB):
package
{
import flash.display.MovieClip;
public class player extends MovieClip
{
public function player()
{
this.graphics.beginFill(0xfff000, 1);
this.graphics.drawRect(this.x, this.y, 10, 10);
this.graphics.endFill ();
this.graphics.beginFill(0x000000, 1);
this.graphics.drawRect(this.x + 3, this.y + 7, 5, 2);
this.graphics.endFill ();
this.graphics.beginFill(0x000000, 1);
this.graphics.drawRect(this.x + 7, this.y + 2, 2, 2);
this.graphics.endFill ();
this.graphics.beginFill(0x000000, 1);
this.graphics.drawRect(this.x + 2, this.y + 2, 2, 2);
this.graphics.endFill ();
this.graphics.beginFill(0x000000, 1);
this.graphics.drawRect(this.x - 1, this.y - 1, 12, 2);
this.graphics.endFill ();
this.graphics.beginFill(0x000000, 1);
this.graphics.drawRect(this.x, this.y - 4, 10, 3);
this.graphics.endFill ();
}
}
}
SHARK.AS:
package
{
import flash.display.MovieClip;
public class shark extends MovieClip
{
public function shark()
{
this.graphics.beginFill(0x484848, 1);
this.graphics.drawRect(this.x, this.y, 10, 10);
this.graphics.endFill ();
this.graphics.beginFill(0x484848, 1);
this.graphics.drawRect(this.x+1, this.y-0.5, 8, 0.5);
this.graphics.endFill ();
this.graphics.beginFill(0x484848, 1);
this.graphics.drawRect(this.x+2, this.y-1, 6, 0.5);
this.graphics.endFill ();
this.graphics.beginFill(0x484848, 1);
this.graphics.drawRect(this.x+3, this.y-2, 4, 1);
this.graphics.endFill ();
this.graphics.beginFill(0x484848, 1);
this.graphics.drawRect(this.x + 4, this.y-3, 2, 1);
this.graphics.endFill ();
this.graphics.beginFill(0x484848, 1);
this.graphics.drawRect(this.x + 4.5, this.y-3.5, 1, 1);
this.graphics.endFill ();
this.graphics.beginFill(0xffffff, 1);
this.graphics.drawRect(this.x + 2, this.y+2, 2, 2);
this.graphics.endFill ();
this.graphics.beginFill(0xffffff, 1);
this.graphics.drawRect(this.x +6, this.y+2, 2, 2);
this.graphics.endFill ();
this.graphics.beginFill(0x000000, 1);
this.graphics.drawRect(this.x + 3, this.y+3, 1, 1);
this.graphics.endFill ();
this.graphics.beginFill(0x000000, 1);
this.graphics.drawRect(this.x +6, this.y+2, 1, 1);
this.graphics.endFill ();
this.graphics.beginFill(0xff0000, 1);
this.graphics.drawRect(this.x +2, this.y+6, 6, 2);
this.graphics.endFill ();
}
}
}
SPEED.AS:
package
{
import flash.display.MovieClip;
public class Speed extends MovieClip
{
public function Speed()
{
this.graphics.beginFill(0xffffff, 1);
this.graphics.drawCircle(this.x, this.y, 10);
this.graphics.endFill ();
}
}
}
OVER.AS:
package
{
import flash.display.MovieClip;
public class Over extends MovieClip
{
public function Over()
{
this.graphics.beginFill(0x000000, 0.9);
this.graphics.drawRect(this.x, this.y, 2000, 2000);
this.graphics.endFill ();
///This is the background it is 90% transparent
this.graphics.beginFill(0xffffff, 1);
this.graphics.drawRect(this.x + 350, this.y + 200, 55, 55);
this.graphics.drawRect(this.x+350, this.y+255, 15, 45);
this.graphics.drawRect(this.x+350, this.y+300, 50, 15);
this.graphics.drawRect(this.x+360, this.y+210, 35, 35);
this.graphics.endFill ();
///g 100%
this.graphics.beginFill(0xffffff, 1);
this.graphics.drawRect(this.x + 415, this.y + 210, 45, 45);
this.graphics.drawRect(this.x+460, this.y+185, 10, 70);
this.graphics.drawRect(this.x+420, this.y+185, 40, 7.5);
this.graphics.drawRect(this.x+427.5, this.y+217.5, 30, 30);
this.graphics.endFill ();
///a 100%
this.graphics.beginFill(0xffffff, 1);
this.graphics.drawRect(this.x + 490, this.y + 200, 110, 55);
this.graphics.drawRect(this.x+505, this.y+210, 35, 45);
this.graphics.drawRect(this.x+550, this.y+210, 35, 45);
this.graphics.endFill ();
///m 100%
this.graphics.beginFill(0xffffff, 1);
this.graphics.drawRect(this.x + 615, this.y + 195, 60, 60);
this.graphics.drawRect(this.x + 622.5, this.y + 230, 52.5, 17);
this.graphics.drawRect(this.x+622.5, this.y+202.5, 45, 20);
this.graphics.endFill ();
///e 100%
this.graphics.beginFill(0xffffff, 1);
this.graphics.drawRect(this.x + 662, this.y + 290, 70, 70);
this.graphics.drawRect(this.x+672, this.y+300, 50, 50);
this.graphics.endFill ();
///o 100%
this.graphics.beginFill(0xffffff, 1);
this.graphics.drawRect(this.x + 742, this.y + 300, 40, 60);
this.graphics.drawRect(this.x+752, this.y+300, 20, 45);
this.graphics.endFill ();
///v 100%
this.graphics.beginFill(0xffffff, 1);
this.graphics.drawRect(this.x + 793, this.y + 300, 60, 60);
this.graphics.drawRect(this.x+800.5, this.y+307.5, 45, 20);
this.graphics.drawRect(this.x+800.5, this.y+335, 52.5, 17);
this.graphics.endFill ();
///e 100%
this.graphics.beginFill(0xffffff, 1)
this.graphics.drawRect(this.x + 863, this.y + 290, 15, 70);
this.graphics.drawRect(this.x + 878, this.y + 300, 25, 10);
this.graphics.endFill ();
///r 100%
}
}
}