Section 1
//gameover_10 (fpkvsdinos_fla.gameover_10)
package fpkvsdinos_fla {
import flash.display.*;
public dynamic class gameover_10 extends MovieClip {
public function gameover_10(){
addFrameScript(127, frame128);
}
function frame128(){
stop();
}
}
}//package fpkvsdinos_fla
Section 2
//backgrounds (backgrounds)
package {
import flash.display.*;
public dynamic class backgrounds extends MovieClip {
public function backgrounds(){
addFrameScript(83, frame84, 85, frame86, 136, frame137, 149, frame150);
}
function frame84(){
gotoAndPlay("prehistoric");
}
function frame86(){
gotoAndPlay("space");
}
function frame137(){
gotoAndPlay("yeti");
}
function frame150(){
gotoAndPlay("bobby");
}
}
}//package
Section 3
//dino (dino)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class dino extends MovieClip {
private var currentdirection:uint;// = 0
private var Speed:Number;// = 10
private var startX:uint;
private var startY:uint;
public var health;// = 10
private var distancetotravelX:uint;// = 60
private var distancetotravelY:uint;// = 5
private var sizeX:Number;// = 0.3
private var sizeY:Number;// = 0.3
private var lastTime:uint;
private var lastY:uint;
private var lastX:uint;
private var lastdirection:uint;// = 1
public function dino(_arg1:uint, _arg2:uint, _arg3:uint){
Speed = 10;
sizeX = 0.3;
sizeY = 0.3;
distancetotravelX = 60;
distancetotravelY = 5;
lastdirection = 1;
currentdirection = 0;
health = 10;
super();
addFrameScript(23, frame24, 34, frame35);
this.x = _arg1;
this.y = _arg2;
this.Speed = _arg3;
lastX = _arg1;
lastY = _arg2;
startX = _arg1;
startY = _arg2;
this.scaleX = sizeX;
this.scaleY = sizeY;
lastTime = getTimer();
gotoAndPlay("flyinglizard");
}
public function deleteinvader(){
gotoAndPlay("lizardboom");
MovieClip(parent).removeinvader(this);
}
public function removeinvader(){
MovieClip(parent).removeinvader(this);
gotoAndStop("gone");
}
function frame24(){
gotoAndPlay("flyinglizard");
}
public function resetPosition(){
this.x = startX;
this.y = startY;
lastX = startX;
lastY = startY;
this.scaleX = sizeX;
lastTime = getTimer();
lastdirection = 1;
currentdirection = 0;
}
public function control_invader(){
var _local1:int;
var _local2:*;
var _local3:*;
_local1 = (getTimer() - lastTime);
lastTime = (lastTime + _local1);
_local2 = this.x;
_local3 = this.y;
if (currentdirection == 0){
if (_local2 < (lastX + distancetotravelX)){
_local2 = (_local2 + ((this.Speed * _local1) / 1000));
} else {
lastdirection = currentdirection;
currentdirection = 1;
lastY = this.y;
lastX = this.x;
};
} else {
if (currentdirection == 1){
if (_local3 < (lastY + distancetotravelY)){
_local3 = (_local3 + ((this.Speed * _local1) / 1000));
} else {
if (lastdirection == 0){
lastdirection = currentdirection;
currentdirection = 2;
lastY = this.y;
lastX = this.x;
this.scaleX = -(sizeX);
} else {
lastdirection = currentdirection;
currentdirection = 0;
lastY = this.y;
lastX = this.x;
this.scaleX = sizeX;
};
};
} else {
if (currentdirection == 2){
if (_local2 > (lastX - distancetotravelX)){
_local2 = (_local2 - ((this.Speed * _local1) / 1000));
} else {
lastdirection = currentdirection;
currentdirection = 1;
lastY = this.y;
lastX = this.x;
};
};
};
};
if (_local2 < MovieClip(parent).PlayAreaBorder){
_local2 = MovieClip(parent).PlayAreaBorder;
};
if (_local2 > (MovieClip(parent).PlayAreaWidth - MovieClip(parent).PlayAreaBorder)){
_local2 = (MovieClip(parent).PlayAreaWidth - MovieClip(parent).PlayAreaBorder);
};
this.x = _local2;
this.y = _local3;
}
function frame35(){
parent.removeChild(this);
stop();
}
}
}//package
Section 4
//fart (fart)
package {
import flash.media.*;
public dynamic class fart extends Sound {
}
}//package
Section 5
//fpk (fpk)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class fpk extends MovieClip {
private var startX:uint;
private var startY:uint;
public var health:uint;// = 10
private var sizeX:Number;// = 0.1
private var sizeY:Number;// = 0.1
private var lastTime:uint;
static const baseHealth:uint = 10;
static const Speed:Number = 100;
public function fpk(_arg1:uint, _arg2:uint){
sizeX = 0.1;
sizeY = 0.1;
health = 10;
super();
addFrameScript(94, frame95, 105, frame106);
this.x = _arg1;
this.y = _arg2;
startX = _arg1;
startY = _arg2;
this.scaleX = sizeX;
this.scaleY = sizeY;
lastTime = getTimer();
}
public function killkitty(){
gotoAndPlay("explodekitty");
}
function frame95(){
gotoAndPlay("flyingkitty");
}
public function resetDefender(){
this.x = startX;
this.y = startY;
this.scaleX = sizeX;
this.health = baseHealth;
gotoAndPlay("flyingkitty");
}
function frame106(){
resetDefender();
}
public function control_defender(){
var _local1:int;
var _local2:*;
_local1 = (getTimer() - lastTime);
lastTime = (lastTime + _local1);
_local2 = this.x;
if (MovieClip(parent).leftArrow){
_local2 = (_local2 - ((Speed * _local1) / 1000));
this.scaleX = -(sizeX);
} else {
if (((MovieClip(parent).rightArrow) && ((this.x < (MovieClip(parent).PlayAreaWidth - MovieClip(parent).PlayAreaBorder))))){
_local2 = (_local2 + ((Speed * _local1) / 1000));
this.scaleX = sizeX;
};
};
if (_local2 < MovieClip(parent).PlayAreaBorder){
_local2 = MovieClip(parent).PlayAreaBorder;
};
if (_local2 > (MovieClip(parent).PlayAreaWidth - MovieClip(parent).PlayAreaBorder)){
_local2 = (MovieClip(parent).PlayAreaWidth - MovieClip(parent).PlayAreaBorder);
};
this.x = _local2;
}
}
}//package
Section 6
//FPK_ingame (FPK_ingame)
package {
import flash.media.*;
public dynamic class FPK_ingame extends Sound {
}
}//package
Section 7
//hit (hit)
package {
import flash.media.*;
public dynamic class hit extends Sound {
}
}//package
Section 8
//intro (intro)
package {
import flash.display.*;
public dynamic class intro extends MovieClip {
public function intro(){
addFrameScript(148, frame149);
}
function frame149(){
stop();
MovieClip(parent).nextFrame();
}
}
}//package
Section 9
//Invaders (Invaders)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
public class Invaders extends MovieClip {
private const AlienCountRow:uint = 2;
private const DefenderStartY:uint = 550;
private const AlienCountColumn:uint = 5;
private const DefenderStartX:uint = 200;
private const BaseScore = 20;
public const PlayAreaWidth:uint = 400;
public const PlayAreaHeight:uint = 600;
private const TimeBetweenShots:uint = 350;
private const AlienMaxShots:uint = 4;
public const PlayAreaBorder:uint = 25;
private const AlienStartX:uint = 60;
private const AlienStartY:uint = 100;
private const AlienTimeBetweenShots:uint = 750;
private const MaxShots:uint = 4;
private const AlienSpeed:uint = 50;
public var Defender:fpk;
public var showLives:TextField;
private var btnSound:pressplay;
public var StartButton:SimpleButton;
private var shootSound:pizzafire;
private var alienshots:Array;
public var leftArrow:Boolean;// = false
public var nextlevel:SimpleButton;
private var AlienLastShot:uint;
public var playAgain:SimpleButton;
private var aliens:Array;
private var lastShot:uint;
private var shots:Array;
private var poopSound:fart;
private var bgMusic:FPK_ingame;
private var playMode:uint;// = 1
private var bgChannel:SoundChannel;
public var lives;// = 3
public var levelTitle:TextField;
private var hitSound:hit;
public var rightArrow:Boolean;// = false
private var cutScene:splash_screens;// = null
public var currentLevel:uint;// = 1
public var showScore:TextField;
private var gameIntro:intro;// = null
private var playareaBackgroundmc:backgrounds;// = null
public var gameScore;
public var titleMovie:MovieClip;
public var ScoreMultiplier:uint;// = 1
public function Invaders(){
ScoreMultiplier = 1;
lives = 3;
currentLevel = 1;
playMode = 1;
leftArrow = false;
rightArrow = false;
poopSound = new fart();
hitSound = new hit();
shootSound = new pizzafire();
btnSound = new pressplay();
bgMusic = new FPK_ingame();
playareaBackgroundmc = null;
gameIntro = null;
cutScene = null;
super();
addFrameScript(0, frame1, 1, frame2, 3, frame4, 5, frame6, 6, frame7);
gotoAndStop(1);
gameScore = 0;
}
public function gotoIntroKb(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 32){
StartButton.removeEventListener(MouseEvent.CLICK, gotoIntro);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, gotoIntroKb);
PlayIntro();
};
}
public function poop(_arg1:uint, _arg2:uint):void{
var _local3:poo;
if (AlienLastShot < (getTimer() - AlienTimeBetweenShots)){
playSound(poopSound);
_local3 = new poo(_arg1, (_arg2 + 20));
addChild(_local3);
alienshots.push(_local3);
AlienLastShot = getTimer();
};
}
public function shoot():void{
var _local1:pizza;
if (shots.length < MaxShots){
if (lastShot < (getTimer() - TimeBetweenShots)){
playSound(shootSound);
_local1 = new pizza(Defender.x, (Defender.y - 30));
addChild(_local1);
shots.push(_local1);
lastShot = getTimer();
};
};
}
public function collisionscheck(){
var _local1:Boolean;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = false;
for (_local2 in aliens) {
for (_local4 in shots) {
if (aliens[_local2].hitTestObject(shots[_local4])){
aliens[_local2].health = (aliens[_local2].health - shots[_local4].damage);
shots[_local4].deleteshot();
playSound(hitSound);
if (aliens[_local2].health <= 0){
aliens[_local2].deleteinvader();
increment_score();
};
break;
};
};
if (aliens[_local2] != null){
if (aliens[_local2].y > PlayAreaHeight){
lives = (lives - 1);
Defender.killkitty();
updatelives();
resetLevel();
break;
} else {
if (aliens[_local2].hitTestObject(Defender)){
lives = (lives - 1);
Defender.killkitty();
updatelives();
resetLevel();
break;
};
};
};
};
for (_local3 in alienshots) {
for (_local5 in shots) {
if (alienshots[_local3].hitTestObject(shots[_local5])){
alienshots[_local3].deleteshot();
shots[_local5].deleteshot();
playSound(hitSound);
break;
};
};
if (alienshots[_local3] != null){
if (alienshots[_local3].hitTestObject(Defender)){
playSound(hitSound);
Defender.health = (Defender.health - alienshots[_local3].damage);
alienshots[_local3].deleteshot();
if (Defender.health <= 0){
lives = (lives - 1);
Defender.killkitty();
updatelives();
resetLevel();
};
break;
};
};
};
}
public function playSound(_arg1:Object){
var _local2:SoundChannel;
_local2 = _arg1.play();
}
function frame2(){
StartButton.addEventListener(MouseEvent.CLICK, gotoIntro);
stage.addEventListener(KeyboardEvent.KEY_DOWN, gotoIntroKb);
}
function frame4(){
stop();
CommenceGame();
}
function frame6(){
levelTitle.text = String(("LEVEL " + currentLevel));
nextlevel.addEventListener(MouseEvent.CLICK, nextlevelstart);
}
function frame7(){
playAgain.addEventListener(MouseEvent.CLICK, replayGame);
stage.addEventListener(KeyboardEvent.KEY_DOWN, replayGameKb);
}
function frame1(){
addEventListener(Event.ENTER_FRAME, preloader);
}
public function resetMultiplier():void{
ScoreMultiplier = 1;
}
public function preloader(_arg1:Event):void{
var _local2:*;
var _local3:*;
var _local4:int;
_local2 = stage.loaderInfo.bytesTotal;
_local3 = stage.loaderInfo.bytesLoaded;
_local4 = ((_local3 * 100) / _local2);
if (_local3 >= _local2){
removeEventListener(Event.ENTER_FRAME, preloader);
gotoAndStop(2);
};
}
public function replayGame(_arg1:MouseEvent):void{
playAgain.removeEventListener(MouseEvent.CLICK, replayGame);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, replayGameKb);
ReplayGame();
}
public function CommenceGame():void{
if (gameIntro != null){
removeChild(gameIntro);
gameIntro = null;
};
if (cutScene != null){
removeChild(cutScene);
cutScene = null;
};
gotoAndStop("gamefield");
createGame();
}
public function nextlevelstart(_arg1:MouseEvent){
CommenceGame();
}
public function removeinvader(_arg1:dino){
var _local2:*;
for (_local2 in aliens) {
if (aliens[_local2] == _arg1){
aliens.splice(_local2, 1);
break;
};
};
}
public function ReplayGame(){
lives = 3;
currentLevel = 1;
gameScore = 0;
PlayIntro();
}
public function keyDownFunction(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 37){
leftArrow = true;
} else {
if (_arg1.keyCode == 39){
rightArrow = true;
} else {
if (_arg1.keyCode == 32){
shoot();
};
};
};
}
public function populatethealiens(){
var _local1:uint;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:dino;
_local1 = AlienStartX;
_local2 = AlienStartY;
_local3 = 0;
while (_local3 < AlienCountRow) {
_local4 = 0;
while (_local4 < AlienCountColumn) {
_local5 = new dino(_local1, _local2, ((AlienSpeed * currentLevel) / 2));
aliens.push(_local5);
addChild(_local5);
_local1 = (_local1 + 60);
_local4++;
};
_local3++;
_local1 = AlienStartX;
_local2 = (_local2 + 80);
};
}
public function cleanup(){
var _local1:int;
var _local2:int;
var _local3:int;
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownFunction);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyUpFunction);
stage.removeEventListener(Event.ENTER_FRAME, gameLoop);
bgChannel.stop();
_local1 = (aliens.length - 1);
while (_local1 >= 0) {
if (aliens[_local1] != null){
aliens[_local1].removeinvader();
};
_local1--;
};
_local2 = (shots.length - 1);
while (_local2 >= 0) {
if (shots[_local2] != null){
shots[_local2].deleteshot();
};
_local2--;
};
_local3 = (alienshots.length - 1);
while (_local3 >= 0) {
if (alienshots[_local3] != null){
alienshots[_local3].deleteshot();
};
_local3--;
};
aliens = null;
shots = null;
alienshots = null;
removeChild(Defender);
Defender = null;
leftArrow = false;
rightArrow = false;
}
public function gotoIntro(_arg1:MouseEvent):void{
StartButton.removeEventListener(MouseEvent.CLICK, gotoIntro);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, gotoIntroKb);
PlayIntro();
}
public function PlayCutscene():void{
var _local1:*;
var _local2:String;
gotoAndStop("Cutscene");
_local1 = (4 - (uint(currentLevel) % 4));
_local2 = "prehistoric";
if (currentLevel >= 2){
switch (_local1){
case 1:
_local2 = "fpk";
break;
case 2:
_local2 = "lizard";
break;
case 3:
_local2 = "pizza";
break;
case 4:
_local2 = "beaarthur";
break;
default:
_local2 = "fpk";
};
};
cutScene = new splash_screens();
addChild(cutScene);
cutScene.gotoAndPlay(_local2);
}
public function createGame():void{
var _local1:*;
if (playareaBackgroundmc == null){
playareaBackgroundmc = new backgrounds();
addChildAt(playareaBackgroundmc, 0);
};
if (currentLevel >= 2){
_local1 = (4 - (uint(currentLevel) % 4));
changeLevel(_local1);
};
bgChannel = bgMusic.play(0, 999);
playSound(btnSound);
Defender = new fpk(DefenderStartX, DefenderStartY);
addChild(Defender);
lastShot = getTimer();
AlienLastShot = getTimer();
shots = new Array();
aliens = new Array();
alienshots = new Array();
populatethealiens();
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownFunction);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpFunction);
stage.addEventListener(Event.ENTER_FRAME, gameLoop);
}
public function removepoo(_arg1:poo){
var _local2:*;
for (_local2 in alienshots) {
if (alienshots[_local2] == _arg1){
alienshots.splice(_local2, 1);
break;
};
};
}
public function keyUpFunction(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 37){
leftArrow = false;
} else {
if (_arg1.keyCode == 39){
rightArrow = false;
};
};
}
public function updatescore(){
if (showScore != null){
showScore.text = String(("SCORE: " + gameScore));
};
}
public function resetLevel(){
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = (aliens.length - 1);
while (_local1 >= 0) {
aliens[_local1].resetPosition();
_local1--;
};
_local2 = (shots.length - 1);
while (_local2 >= 0) {
shots[_local2].deleteshot();
_local2--;
};
shots = new Array();
_local3 = (alienshots.length - 1);
while (_local3 >= 0) {
if (alienshots[_local3] != null){
alienshots[_local3].deleteshot();
};
_local3--;
};
alienshots = new Array();
}
public function moveShots(){
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = (shots.length - 1);
while (_local1 >= 0) {
shots[_local1].move_shot();
_local1--;
};
_local2 = (alienshots.length - 1);
while (_local2 >= 0) {
alienshots[_local2].move_shot();
_local2--;
};
_local3 = (aliens.length - 1);
while (_local3 >= 0) {
aliens[_local3].control_invader();
_local3--;
};
Defender.control_defender();
}
public function PlayIntro():void{
gotoAndStop("Cutscene");
gameIntro = new intro();
addChild(gameIntro);
}
public function removeshot(_arg1:pizza){
var _local2:*;
for (_local2 in shots) {
if (shots[_local2] == _arg1){
shots.splice(_local2, 1);
break;
};
};
}
public function replayGameKb(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 32){
playAgain.removeEventListener(MouseEvent.CLICK, replayGame);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, replayGameKb);
ReplayGame();
};
}
public function changeLevel(_arg1:uint):void{
var _local2:String;
_local2 = "prehistoric";
switch (_arg1){
case 1:
_local2 = "prehistoric";
break;
case 2:
_local2 = "space";
break;
case 3:
_local2 = "yeti";
break;
case 4:
_local2 = "bobby";
break;
default:
_local2 = "prehistoric";
};
playareaBackgroundmc.gotoAndPlay(_local2);
}
public function gameLoop(_arg1:Event){
var _local2:uint;
_local2 = Math.floor((Math.random() * aliens.length));
poop(aliens[_local2].x, aliens[_local2].y);
moveShots();
collisionscheck();
updatescore();
if (aliens.length == 0){
cleanup();
currentLevel = (currentLevel + 1);
PlayCutscene();
};
if (lives <= 0){
cleanup();
removeChild(playareaBackgroundmc);
playareaBackgroundmc = null;
gotoAndStop("gameover");
};
}
public function increment_score():void{
gameScore = (gameScore + (BaseScore * ScoreMultiplier));
ScoreMultiplier = (ScoreMultiplier + 1);
}
public function updatelives(){
if (showLives != null){
showLives.text = String(lives);
};
}
}
}//package
Section 10
//pizza (pizza)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class pizza extends MovieClip {
public var damage:uint;// = 10
private var lastTime:uint;
static const Speed:Number = 200;
public function pizza(_arg1:uint, _arg2:uint){
damage = 10;
super();
this.x = _arg1;
this.y = _arg2;
this.scaleX = 0.2;
this.scaleY = 0.2;
lastTime = getTimer();
}
public function deleteshot(){
MovieClip(parent).removeshot(this);
parent.removeChild(this);
}
public function move_shot(){
var _local1:int;
var _local2:*;
_local1 = (getTimer() - lastTime);
lastTime = (lastTime + _local1);
_local2 = this.y;
_local2 = (_local2 - ((Speed * _local1) / 1000));
if (_local2 < 0){
MovieClip(parent).resetMultiplier();
deleteshot();
} else {
this.y = _local2;
};
}
}
}//package
Section 11
//pizzafire (pizzafire)
package {
import flash.media.*;
public dynamic class pizzafire extends Sound {
}
}//package
Section 12
//poo (poo)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class poo extends MovieClip {
public var damage:uint;// = 5
private var lastTime:uint;
static const Speed:Number = 200;
public function poo(_arg1:uint, _arg2:uint){
damage = 5;
super();
addFrameScript(8, frame9, 13, frame14);
this.x = _arg1;
this.y = _arg2;
this.scaleX = 0.2;
this.scaleY = 0.2;
lastTime = getTimer();
}
public function deleteshot(){
MovieClip(parent).removepoo(this);
gotoAndPlay("pooboom");
}
function frame14(){
parent.removeChild(this);
}
function frame9(){
gotoAndPlay("poostart");
}
public function move_shot(){
var _local1:int;
var _local2:*;
_local1 = (getTimer() - lastTime);
lastTime = (lastTime + _local1);
_local2 = this.y;
_local2 = (_local2 + ((Speed * _local1) / 1000));
if (_local2 > MovieClip(parent).PlayAreaHeight){
deleteshot();
} else {
this.y = _local2;
};
}
}
}//package
Section 13
//pressplay (pressplay)
package {
import flash.media.*;
public dynamic class pressplay extends Sound {
}
}//package
Section 14
//splash_screens (splash_screens)
package {
import flash.display.*;
public dynamic class splash_screens extends MovieClip {
public function splash_screens(){
addFrameScript(22, frame23, 46, frame47, 70, frame71, 94, frame95);
}
function frame71(){
stop();
MovieClip(parent).nextFrame();
}
function frame95(){
stop();
MovieClip(parent).nextFrame();
}
function frame23(){
stop();
MovieClip(parent).nextFrame();
}
function frame47(){
stop();
MovieClip(parent).nextFrame();
}
}
}//package