Section 1
//Bolt (game.entities.projectiles.Bolt)
package game.entities.projectiles {
import game.fx.*;
import game.entities.*;
import game.*;
public class Bolt extends Projectile {
public function Bolt(_arg1:Ent, _arg2:Number, _arg3:Number, _arg4:Number):void{
livetime = 60;
damage = 10;
width = 30;
height = 10;
speed = 15;
x = _arg2;
y = _arg3;
dir = _arg4;
rotation = dir;
creator = _arg1;
}
override public function die():void{
Project.particles.burst(x, y, 0, Particles.FIRE, 360, 4);
super.die();
}
}
}//package game.entities.projectiles
Section 2
//Bomb (game.entities.projectiles.Bomb)
package game.entities.projectiles {
import game.fx.*;
import game.entities.*;
import game.*;
public class Bomb extends Projectile {
private const brain_DEAD = 3;
private const brain_LAUNCHED = 0;
private const brain_EXPLODED = 1;
private var postexlivetime:int;// = 150
public function Bomb(_arg1:Ent, _arg2:Number, _arg3:Number, _arg4:Number):void{
postexlivetime = 150;
super();
livetime = 50;
damage = 10;
width = 30;
height = 30;
speed = 5;
x = _arg2;
y = _arg3;
dir = _arg4;
rotation = dir;
creator = _arg1;
}
override public function crashIntoMe(_arg1:Ent):void{
if (brain == brain_LAUNCHED){
brain = brain_EXPLODED;
};
_arg1.hp = (_arg1.hp - 1);
Project.particles.burst(_arg1.x, _arg1.y, 0, Particles.FIRE, 360, 15);
}
override public function stepTwo(_arg1){
switch (brain){
case brain_LAUNCHED:
if (--livetime == 0){
brain = brain_EXPLODED;
};
x = (x + xVel);
y = (y + yVel);
break;
case brain_EXPLODED:
speed = 0;
rotation = (rotation + 30);
if (width < 200){
width = (width + 4);
};
if (height < 200){
height = (height + 4);
};
if (--postexlivetime <= 0){
die();
};
break;
default:
die();
};
}
}
}//package game.entities.projectiles
Section 3
//Laser (game.entities.projectiles.Laser)
package game.entities.projectiles {
import game.fx.*;
import game.entities.*;
import game.*;
public class Laser extends Projectile {
private var co:int;// = 0
private static const DUMB:int = 0;
private static const HOMING:int = 1;
private static const GUIDED:int = 2;
public function Laser(_arg1:Ent, _arg2:Number, _arg3:Number, _arg4:Number):void{
co = 0;
super();
livetime = _arg1.cooldown_time;
damage = 1;
width = 300;
height = 5;
speed = 15;
turnrate = 10;
x = _arg2;
y = _arg3;
dir = _arg4;
rotation = dir;
creator = _arg1;
}
override public function die():void{
Project.particles.burst(x, y, 0, Particles.FIRE, 360, 4);
super.die();
}
override public function crashIntoMe(_arg1:Ent):void{
_arg1.hp = (_arg1.hp - damage);
Project.particles.burst(_arg1.x, _arg1.y, 0, Particles.FIRE, 360, 7);
}
override public function stepTwo(_arg1){
x = creator.x;
y = creator.y;
dir = creator.aim;
rotation = dir;
if (livetime-- == 0){
die();
};
}
}
}//package game.entities.projectiles
Section 4
//Lightning (game.entities.projectiles.Lightning)
package game.entities.projectiles {
import game.fx.*;
import game.entities.*;
import game.*;
public class Lightning extends Projectile {
private var co:int;// = 0
private static const DUMB:int = 0;
private static const HOMING:int = 1;
private static const GUIDED:int = 2;
public function Lightning(_arg1:Ent, _arg2:Number, _arg3:Number, _arg4:Number):void{
co = 0;
super();
livetime = 10;
damage = 1;
width = 300;
height = 70;
speed = 15;
turnrate = 10;
x = _arg2;
y = _arg3;
dir = _arg4;
rotation = dir;
creator = _arg1;
}
override public function die():void{
Project.particles.burst(x, y, 0, Particles.FIRE, 360, 4);
super.die();
}
override public function crashIntoMe(_arg1:Ent):void{
_arg1.hp = (_arg1.hp - damage);
Project.particles.burst(_arg1.x, _arg1.y, 0, Particles.FIRE, 360, 7);
}
override public function stepTwo(_arg1){
x = creator.x;
y = creator.y;
dir = creator.aim;
rotation = dir;
if (livetime-- == 0){
die();
};
}
}
}//package game.entities.projectiles
Section 5
//Missile (game.entities.projectiles.Missile)
package game.entities.projectiles {
import game.fx.*;
import game.entities.*;
import game.*;
public class Missile extends Projectile {
private static const DUMB:int = 0;
private static const HOMING:int = 1;
private static const GUIDED:int = 2;
public function Missile(_arg1:Ent, _arg2:Number, _arg3:Number, _arg4:Number):void{
livetime = 600;
damage = 5;
width = 30;
height = 10;
speed = 15;
turnrate = 10;
x = _arg2;
y = _arg3;
dir = _arg4;
rotation = dir;
creator = _arg1;
}
override public function die():void{
Project.particles.burst(x, y, 0, Particles.FIRE, 360, 15);
super.die();
}
override public function stepTwo(_arg1){
turnToward(Project.viewport.mouseX, Project.viewport.mouseY);
rotation = dir;
super.stepTwo(_arg1);
if (Math.random() > 0.9){
dir = (dir + ((Math.random() * 120) - 60));
};
}
}
}//package game.entities.projectiles
Section 6
//Pellet (game.entities.projectiles.Pellet)
package game.entities.projectiles {
import game.fx.*;
import game.entities.*;
import game.*;
public class Pellet extends Projectile {
public function Pellet(_arg1:Ent, _arg2:Number, _arg3:Number, _arg4:Number):void{
livetime = 60;
damage = 6;
width = 6;
height = 6;
speed = (15 + (Math.random() * 5));
x = _arg2;
y = _arg3;
dir = _arg4;
rotation = dir;
creator = _arg1;
}
override public function die():void{
Project.particles.burst(x, y, 0, Particles.FIRE, 360, 4);
super.die();
}
}
}//package game.entities.projectiles
Section 7
//Projectile (game.entities.projectiles.Projectile)
package game.entities.projectiles {
import game.fx.*;
import game.entities.*;
public class Projectile extends Ent {
var creator:Ent;
public var emitter:Emitter;
public var damage;
var livetime;
public function crashIntoMe(_arg1:Ent):void{
if (!dead){
_arg1.hp = (_arg1.hp - damage);
dead = true;
die();
};
}
override public function stepTwo(_arg1){
if (--livetime == 0){
die();
};
super.stepTwo(_arg1);
}
}
}//package game.entities.projectiles
Section 8
//AShip (game.entities.AShip)
package game.entities {
import game.fx.*;
import flash.geom.*;
import game.*;
import game.entities.projectiles.*;
public class AShip extends Ent {
private var pushed:Boolean;
private var gun:int;
private var wait:int;// = 0
private var mouse:Point;
private var beenthrudie;// = false
private static const SHOTGUN:int = 5;
private static const MISSILE:int = 2;
private static const PULSE:int = 1;
private static const LIGHTNING:int = 4;
private static const LASER:int = 3;
public function AShip(){
wait = 0;
beenthrudie = false;
super();
cooldown_time = 10;
width = 30;
height = 20;
hp = 60;
friction = 0.75;
accel = 2.5;
maxspeed = 10;
x = (y = -300);
speed = 0;
dir = 0;
aim = 0;
alliance = FRIENDLY;
gun = PULSE;
}
public function receiveMouseLoc(_arg1:Point){
mouse = _arg1;
beenthrudie = true;
}
override public function die():void{
var _local1:*;
var _local2:int;
Project.particles.burst(x, y, 0, Particles.FIRE, 360, 30);
_local2 = 0;
do {
new Em_Shrapnel(x, y, (Math.random() * 360), (Math.random() * 14));
var _temp1 = _local2;
_local2 = (_local2 + 1);
} while (_temp1 < 5);
super.die();
GEvents.AddEventListener(GEvents.STEP3, waitUntilRefresh);
}
private function waitUntilRefresh(_arg1):void{
if (wait++ > 30){
Project.reInitGame();
GEvents.RemoveEventListener(GEvents.STEP3, waitUntilRefresh);
};
}
override public function stepTwo(_arg1){
var _local2:Boolean;
var _local3:Projectile;
var _local4:Boolean;
var _local5:Boolean;
var _local6:Boolean;
var _local7:Boolean;
var _local8:int;
_local2 = false;
_local3 = (colCheck() as Projectile);
_local4 = Keys[LEFT];
_local5 = Keys[RIGHT];
_local6 = Keys[UP];
_local7 = Keys[DOWN];
if (_local6){
if (_local4){
dir = 225;
} else {
if (_local5){
dir = 315;
} else {
dir = 270;
};
};
} else {
if (_local7){
if (_local4){
dir = 135;
} else {
if (_local5){
dir = 45;
} else {
dir = 90;
};
};
} else {
if (_local4){
dir = 180;
} else {
if (_local5){
dir = 0;
};
};
};
};
aim = Logic.pointDirection(x, y, mouse.x, mouse.y);
if (Keys[OTHER]){
if (!pushed){
pushed = true;
if (++gun >= 6){
gun = 1;
};
};
} else {
pushed = false;
};
if (((((((_local4) || (_local5))) || (_local6))) || (_local7))){
speed = Math.min(maxspeed, (speed + accel));
dir = Logic.pointDirection(0, 0, xVel, yVel);
Project.particles.burst(x, y, (dir - 180), Particles.FIRE, 35);
Project.particles.burst(x, y, (dir - 180), Particles.FIRE, 100);
Project.particles.burst(x, y, (dir - 180), Particles.FIRE, 100);
Project.particles.burst(x, y, (dir - 180), Particles.FIRE, 35);
};
speed = Math.max(0, (speed - friction));
rotation = aim;
if ((((--cooldown_remain <= 0)) && (Keys[FIRE]))){
switch (gun){
case PULSE:
cooldown_remain = 10;
FriendlyColList.push(new Bolt(this, x, y, aim));
break;
case MISSILE:
cooldown_remain = 3;
FriendlyColList.push(new Missile(this, x, y, aim));
break;
case LASER:
cooldown_remain = 0;
FriendlyColList.push(new Laser(this, x, y, aim));
break;
case LIGHTNING:
cooldown_remain = 0;
FriendlyColList.push(new Lightning(this, x, y, aim));
break;
case SHOTGUN:
cooldown_remain = 20;
_local8 = 0;
while (_local8++ < 13) {
FriendlyColList.push(new Pellet(this, x, y, ((aim + (Math.random() * 10)) - 5)));
};
};
};
if (_local3){
_local3.crashIntoMe(this);
};
rotation = aim;
super.stepTwo(_arg1);
}
}
}//package game.entities
Section 9
//Enemy (game.entities.Enemy)
package game.entities {
import game.fx.*;
import flash.events.*;
import game.*;
import game.entities.projectiles.*;
public class Enemy extends Ent {
var spawn_jimmy;// = true
public function Enemy(_arg1, _arg2, _arg3):void{
spawn_jimmy = true;
super();
x = _arg1;
y = _arg2;
dir = _arg3;
dir = 10;
turnrate = 1;
hp = 100;
cargocount = 5;
cooldown_time = 5;
alliance = ENEMY;
cooldown_remain = 0;
}
override public function die():void{
var _local1:*;
var _local2:int;
_local1 = new Enemy((x + 500), (x + 500), 30);
_local1.giveMeATarget(mtar);
_local1 = new Enemy((x - 500), (x - 500), 30);
_local1.giveMeATarget(mtar);
_local2 = 0;
do {
new Em_Shrapnel(x, y, (Math.random() * 360), (Math.random() * 14));
var _temp1 = _local2;
_local2 = (_local2 + 1);
} while (_temp1 < 10);
super.die();
}
override public function stepTwo(_arg1){
var _local2:Projectile;
var _local3:Ent;
turnToward(mtar.x, mtar.y);
rotation = dir;
speed = 1;
if ((((cooldown_remain <= 0)) && ((cargocount > 0)))){
if (spawn_jimmy){
_local3 = new Jimmy(x, y, dir);
spawn_jimmy = !(spawn_jimmy);
} else {
_local3 = new Spawn(x, y, dir);
spawn_jimmy = !(spawn_jimmy);
};
_local3.giveMeATarget(mtar);
_local3.par = this;
cargocount--;
cooldown_remain = cooldown_time;
};
cooldown_remain--;
_local2 = (colCheck() as Projectile);
if (_local2){
_local2.crashIntoMe(this);
};
super.stepTwo(_arg1);
}
}
}//package game.entities
Section 10
//Ent (game.entities.Ent)
package game.entities {
import flash.display.*;
import game.fx.*;
import flash.events.*;
import game.*;
import game.entities.projectiles.*;
import flash.ui.*;
public class Ent extends Sprite {
public var hp:Number;
public var alliance:int;
public var cooldown_time:Number;
public var aim:Number;// = 0
public var speed:Number;// = 0
public var maxspeed:Number;
public var dead:Boolean;// = false
public var mtar:Ent;
public var par:Ent;
public var dir:Number;// = 0
public var cooldown_remain:Number;// = 0
public var cargocount:Number;
public var turnrate:Number;
public var accel:Number;
public var friction:Number;
public var brain:int;// = 0
public static const BOTH:int = 2;
public static const LEFT:int = 1;
public static const UP:int = 2;
public static const NEUTRAL:int = 3;
public static const ENEMY:int = 0;
public static const DOWN:int = 4;
public static const FRIENDLY:int = 1;
public static const OTHER:int = 6;
public static const FIRE:int = 5;
public static const RIGHT:int = 3;
public static var Keys;
public static var diedthisstep:Boolean = false;
public static var FriendlyColList:Array;
public static var instantiated:Boolean = false;
public static var EnemyColList:Array;
public function Ent():void{
dir = 0;
speed = 0;
aim = 0;
cooldown_remain = 0;
brain = 0;
dead = false;
super();
if (!instantiated){
enEnt(Project.This);
};
Project.AddChild(this);
GEvents.AddEventListener(GEvents.STEP2, stepTwo);
GEvents.AddEventListener(GEvents.ANNIHILATE, annihilate);
}
public function get xVel():Number{
return (Logic.lengthDirectionX(speed, dir));
}
public function turnToward(_arg1, _arg2){
var _local3:*;
var _local4:*;
_local3 = Logic.pointDirection(x, y, _arg1, _arg2);
_local4 = Math.min(turnrate, Math.abs((Logic.normalizeAngle(dir) - _local3)));
dir = (dir + (_local4 * Logic.angleRotateDirection(_local3, Logic.normalizeAngle(dir))));
}
public function colCheck():Ent{
var _local1:int;
var _local2:Boolean;
var _local3:Array;
_local2 = false;
switch (alliance){
case FRIENDLY:
_local3 = EnemyColList;
break;
case BOTH:
_local2 = true;
case ENEMY:
_local3 = FriendlyColList;
break;
case NEUTRAL:
_local3 = new Array();
};
do {
_local1 = 0;
while (_local1 < _local3.length) {
if (hitTestObject(_local3[_local1])){
return (_local3[_local1]);
};
_local1++;
};
_local3 = EnemyColList;
_local2 = false;
} while (_local2);
return (null);
}
public function get yVel():Number{
return (Logic.lengthDirectionY(speed, dir));
}
public function giveMeATarget(_arg1){
mtar = _arg1;
}
public function die():void{
GEvents.RemoveEventListener(GEvents.STEP2, stepTwo);
GEvents.RemoveEventListener(GEvents.ANNIHILATE, annihilate);
Project.RemoveChild(this);
dead = true;
diedthisstep = true;
}
public function annihilate(_arg1):void{
die();
}
public function stepTwo(_arg1){
if (hp <= 0){
die();
};
x = (x + xVel);
y = (y + yVel);
}
public static function reportClick(_arg1:MouseEvent):void{
Keys[FIRE] = true;
}
public static function reportKeyUp(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 65:
Keys[LEFT] = false;
break;
case 87:
Keys[UP] = false;
break;
case 68:
Keys[RIGHT] = false;
break;
case 83:
Keys[DOWN] = false;
break;
case Keyboard.SPACE:
break;
case 81:
Keys[OTHER] = false;
break;
};
}
public static function enEnt(_arg1:DisplayObject=null){
var _local2:int;
EnemyColList = new Array();
FriendlyColList = new Array();
Keys = new Array(6);
_local2 = 0;
while (_local2 <= 6) {
Keys[_local2] = 0;
_local2++;
};
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
_arg1.addEventListener(KeyboardEvent.KEY_UP, reportKeyUp);
_arg1.stage.addEventListener(MouseEvent.MOUSE_DOWN, reportClick);
_arg1.stage.addEventListener(MouseEvent.MOUSE_UP, reportUnClick);
GEvents.AddEventListener(GEvents.STEP3, stepThree);
instantiated = true;
}
public static function reportKeyDown(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 65:
Keys[LEFT] = true;
break;
case 87:
Keys[UP] = true;
break;
case 68:
Keys[RIGHT] = true;
break;
case 83:
Keys[DOWN] = true;
break;
case Keyboard.SPACE:
break;
case 81:
Keys[OTHER] = true;
break;
default:
trace(_arg1.keyCode);
break;
};
}
public static function unEnt(){
instantiated = false;
EnemyColList = null;
FriendlyColList = null;
Keys = null;
Project.This.removeEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
Project.This.removeEventListener(KeyboardEvent.KEY_UP, reportKeyUp);
Project.This.stage.removeEventListener(MouseEvent.MOUSE_DOWN, reportClick);
Project.This.stage.removeEventListener(MouseEvent.MOUSE_UP, reportUnClick);
GEvents.RemoveEventListener(GEvents.STEP3, stepThree);
}
public static function reportUnClick(_arg1:MouseEvent):void{
Keys[FIRE] = false;
GEvents.callEvent(GEvents.MOUSEUNCLICK);
}
public static function stepThree(_arg1){
var _local2:*;
var _local3:*;
if (diedthisstep){
_local2 = 0;
while (_local2 < FriendlyColList.length) {
_local3 = (FriendlyColList[_local2] as Ent);
if (_local3.dead){
FriendlyColList.splice(_local2, 1);
};
_local2++;
};
_local2 = 0;
while (_local2 < EnemyColList.length) {
_local3 = (EnemyColList[_local2] as Ent);
if (_local3.dead){
EnemyColList.splice(_local2, 1);
};
_local2++;
};
};
}
}
}//package game.entities
Section 11
//Jimmy (game.entities.Jimmy)
package game.entities {
import game.fx.*;
import game.*;
import game.entities.projectiles.*;
public class Jimmy extends Ent {
private const brain_ATTACKING = 0;
private const brain_LIMPING = 2;
private const brain_RETURNING = 1;
private var dashing:Boolean;// = false
private var change:Number;// = 0
public function Jimmy(_arg1, _arg2, _arg3):void{
change = 0;
dashing = false;
super();
x = _arg1;
y = _arg2;
dir = _arg3;
turnrate = 2.5;
maxspeed = 8;
accel = 1.5;
friction = 0.5;
cooldown_time = 40;
cargocount = 3;
alliance = ENEMY;
width = 30;
height = 30;
hp = 20;
}
override public function die():void{
var _local1:*;
_local1 = 0;
while (_local1 < 100) {
Project.particles.burst(x, y, 0, Particles.FIRE, 360);
_local1++;
};
super.die();
}
override public function stepTwo(_arg1){
var _local2:*;
var _local3:*;
var _local4:Projectile;
var _local5:*;
switch (brain){
case brain_ATTACKING:
aim = Logic.pointDirection(x, y, mtar.x, mtar.y);
_local2 = Logic.pointDistance(x, y, mtar.x, mtar.y);
_local4 = (colCheck() as Projectile);
if (_local4){
_local4.crashIntoMe(this);
};
if ((((_local2 > 100)) && ((_local2 < 200)))){
speed = Math.min(maxspeed, (speed + accel));
} else {
if (_local2 < 50){
speed = (maxspeed * 2);
dir = (aim + ((Math.random() * 30) - 60));
dashing = true;
change = 50;
} else {
if (_local2 > 200){
speed = (speed + maxspeed);
dir = aim;
dashing = true;
change = 50;
};
};
};
if (--change < 0){
change = 10;
dir = (aim + ((Math.random() * 100) - 200));
dashing = false;
};
if (dashing){
};
if (--cooldown_remain <= 0){
cooldown_remain = cooldown_time;
EnemyColList.push(new Bolt(this, x, y, aim));
if (--cargocount <= 0){
brain = brain_RETURNING;
};
};
break;
case brain_RETURNING:
dir = Logic.pointDirection(x, y, par.x, par.y);
speed = (maxspeed * 2);
_local5 = Logic.pointDistance(x, y, par.x, par.y);
if (Logic.pointDistance(x, y, par.x, par.y) < 20){
par.cargocount++;
this.die();
};
};
speed = Math.max((speed - friction), 0);
rotation = aim;
super.stepTwo(_arg1);
}
}
}//package game.entities
Section 12
//Spawn (game.entities.Spawn)
package game.entities {
import game.fx.*;
import game.*;
import game.entities.projectiles.*;
public class Spawn extends Ent {
private const brain_LIMPING = 2;
private const brain_SOJURNING = 0;
private const brain_RETURNING = 1;
public function Spawn(_arg1, _arg2, _arg3):void{
x = _arg1;
y = _arg2;
dir = _arg3;
turnrate = 2.5;
alliance = ENEMY;
width = 50;
height = 40;
hp = 20;
}
override public function die():void{
var _local1:*;
_local1 = 0;
while (_local1 < 100) {
Project.particles.burst(x, y, 0, Particles.FIRE, 360);
_local1++;
};
super.die();
}
override public function stepTwo(_arg1){
var _local2:Projectile;
var _local3:*;
speed = 11;
switch (brain){
case brain_SOJURNING:
turnToward(mtar.x, mtar.y);
if (Logic.pointDistance(x, y, mtar.x, mtar.y) < 200){
EnemyColList.push(new Bomb(this, x, y, dir));
brain = brain_RETURNING;
};
break;
case brain_RETURNING:
turnToward(par.x, par.y);
_local3 = Logic.pointDistance(x, y, par.x, par.y);
if (_local3 < 200){
speed = (_local3 / 11);
turnrate = (turnrate + 0.1);
};
if (Logic.pointDistance(x, y, par.x, par.y) < 20){
par.cargocount++;
this.die();
};
};
rotation = dir;
_local2 = (colCheck() as Projectile);
if (_local2){
_local2.crashIntoMe(this);
};
super.stepTwo(_arg1);
}
}
}//package game.entities
Section 13
//Avatar (game.fx.Avatar)
package game.fx {
import flash.display.*;
import flash.events.*;
import game.*;
public class Avatar extends MovieClip {
private var callback:Function;
private var dialog:String;
private var side:int;
private var state:int;
private var keythisstep:Boolean;
private var bounds:Number;
public static const SICNE:int = 3;
public static const VELOURIA:int = 2;
public static const ENTERING:int = 0;
public static const ZARNOLD:int = 5;
public static const READING:int = 1;
public static const EXITING:int = 2;
public static const PILOT:int = 1;
public static const MAGPIE:int = 6;
public static const HAYATO:int = 4;
public function Avatar(_arg1:int, _arg2:int, _arg3:String, _arg4:Function=null):void{
gotoAndStop(_arg1);
Project.This.addChild(this);
addEventListener(Event.ENTER_FRAME, onEnFra);
Project.This.addEventListener(KeyboardEvent.KEY_DOWN, key);
side = _arg2;
dialog = _arg3;
callback = _arg4;
state = 0;
if (Math.abs(side) != 1){
throw ("side must be equal to +1 or -1");
};
if (side == 1){
x = ((0 - width) - 10);
bounds = 0;
} else {
x = ((800 + width) + 10);
bounds = 800;
};
y = 0;
trace(x);
keythisstep = false;
}
public function onEnFra(_arg1):void{
switch (state){
case ENTERING:
x = (x + (side * 30));
if ((x * side) >= (side * bounds)){
state = READING;
};
break;
case READING:
if (keythisstep){
state = EXITING;
};
break;
case EXITING:
x = (x - (side * 30));
if (x <= ((side * -(width)) - 10)){
end();
};
break;
};
trace(("State is:" + state));
trace(x);
}
private function key(_arg1):void{
keythisstep = true;
}
public function end(){
removeEventListener(Event.ENTER_FRAME, onEnFra);
Project.This.removeChild(this);
delete ??getglobalscope
[this];
}
}
}//package game.fx
Section 14
//Em_Shrapnel (game.fx.Em_Shrapnel)
package game.fx {
import game.*;
public class Em_Shrapnel extends Emitter {
var xVel:Number;
var yVel:Number;
var livetime:int;// = 10
public function Em_Shrapnel(_arg1, _arg2, _arg3, _arg4){
livetime = 10;
super(_arg1, _arg2, _arg3);
xVel = Logic.lengthDirectionX(_arg4, _arg3);
yVel = Logic.lengthDirectionY(_arg4, _arg3);
}
override public function die(){
Project.particles.burst(x, y, 0, Particles.FIRE, 360, 15);
super.die();
}
override public function stepOne(_arg1):void{
Project.particles.burst(x, y, 0, Particles.FIRE, 360, 4);
x = (x + xVel);
y = (y + yVel);
if (--livetime <= 0){
die();
};
}
}
}//package game.fx
Section 15
//Em_Starfield (game.fx.Em_Starfield)
package game.fx {
import game.*;
public class Em_Starfield extends Emitter {
private var lastCreatedY:Number;
private var lastCreatedX:Number;
private var viewport:Viewport;
public function Em_Starfield(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Particles, _arg5:Viewport):void{
var _local6:int;
super();
partsys = _arg4;
viewport = _arg5;
Project.AddChild(this);
GEvents.AddEventListener(GEvents.STEP1, stepOne);
lastCreatedX = 0;
lastCreatedY = 0;
_local6 = 0;
while (_local6++ < 15) {
partsys.make(((x - 300) + (800 * Math.random())), ((y - 300) + (600 * Math.random())), Particles.STAR);
};
}
override public function stepOne(_arg1):void{
var _local2:Number;
x = -(viewport.x);
y = -(viewport.y);
_local2 = 50;
if (Math.abs((Math.abs(lastCreatedX) - Math.abs(x))) > _local2){
if (lastCreatedX > x){
partsys.make(x, (y + (600 * Math.random())), Particles.STAR);
} else {
partsys.make((x + 800), (y + (600 * Math.random())), Particles.STAR);
};
lastCreatedX = x;
};
if (Math.abs((Math.abs(lastCreatedY) - Math.abs(y))) > _local2){
if (lastCreatedY > y){
partsys.make((x + (800 * Math.random())), y, Particles.STAR);
} else {
partsys.make((x + (800 * Math.random())), (y + 600), Particles.STAR);
};
lastCreatedY = y;
};
}
}
}//package game.fx
Section 16
//Emitter (game.fx.Emitter)
package game.fx {
import flash.display.*;
import game.*;
public class Emitter extends Sprite {
var partsys:Particles;
public function Emitter(_arg1=0, _arg2=0, _arg3=0){
partsys = Project.getMainParticleSystem();
super();
Project.AddChild(this);
GEvents.AddEventListener(GEvents.STEP1, stepOne);
x = _arg1;
y = _arg2;
}
public function stepOne(_arg1):void{
partsys.burst(x, y, 0, Particles.FIRE, 360);
}
public function die(){
Project.RemoveChild(this);
GEvents.RemoveEventListener(GEvents.STEP1, stepOne);
}
}
}//package game.fx
Section 17
//Particle (game.fx.Particle)
package game.fx {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import game.*;
import flash.filters.*;
public class Particle extends Sprite {
private var distance:Number;
private var xVel:Number;
public var type:int;
private var timelife:int;
private var yVel:Number;
private var bmp:BitmapData;
private var livetime:int;
public static const E_ASHIP:int = 0;
public static const E_CARRIER:int = 1;
public static const E_BOMBER:int = 2;
public static const E_SHOOTER:int = 4;
public static const E_SPIDER:int = 3;
public static var vp:Viewport;
public function Particle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:int, _arg6:int, _arg7=1){
x = _arg1;
y = _arg2;
xVel = Logic.lengthDirectionX(_arg3, _arg4);
yVel = Logic.lengthDirectionY(_arg3, _arg4);
type = _arg5;
bmp = Particles.getBMP(type);
livetime = (timelife = _arg6);
if (type == Particles.STAR){
livetime = Math.random();
timelife = Math.random();
distance = Math.random();
} else {
distance = _arg7;
};
}
public function set dir(_arg1):void{
xVel = Logic.lengthDirectionX(speed, _arg1);
yVel = Logic.lengthDirectionY(speed, _arg1);
}
public function stepThree(_arg1):Boolean{
switch (type){
case Particles.FIRE:
x = (x + xVel);
y = (y + yVel);
return ((--livetime == 0));
case Particles.STAR:
return (!(Project.viewport.isPointOnScreen(((x * distance) / 1), ((y * distance) / 1), 14)));
};
return (true);
}
private function get livedelta():Number{
return ((livetime / timelife));
}
public function get speed():Number{
return (Logic.pointDistance(0, 0, xVel, yVel));
}
public function set speed(_arg1):void{
xVel = Logic.lengthDirectionX(_arg1, dir);
yVel = Logic.lengthDirectionY(_arg1, dir);
}
public function get dir():Number{
return (Logic.pointDirection(0, 0, xVel, yVel));
}
public function stampMe(_arg1:Particles){
var _local2:*;
var _local3:Matrix;
var _local4:ColorTransform;
_local2 = vp.worldSpaceToScreenSpace(x, y);
_local2 = new Point((_local2.x * distance), (_local2.y * distance));
switch (type){
case Particles.FIRE:
_local3 = new Matrix();
_local3.scale(0.6, 0.6);
_local3.translate(_local2.x, _local2.y);
_local4 = new ColorTransform(1, 0.3, 0, 0.5);
_arg1.bitmapData.draw(bmp, _local3, _local4);
break;
case Particles.STAR:
_local3 = new Matrix();
_local3.scale(distance, distance);
_local3.translate((_local2.x * distance), (_local2.y * distance));
_local4 = new ColorTransform(Math.random(), Math.random(), Math.random(), distance);
_arg1.bitmapData.draw(bmp, _local3, _local4);
break;
};
}
}
}//package game.fx
Section 18
//Particles (game.fx.Particles)
package game.fx {
import flash.display.*;
import game.*;
import flash.filters.*;
public class Particles extends Bitmap {
public var activeRects;
public var particles:Array;
public var blur:BlurFilter;
public static const STAR = 1;
public static const FIRE = 0;
public static const DETRITUS = 3;
public static const DEBRIS = 4;
public static var partypes:Array = new Array(4);
public function Particles(){
activeRects = new Array();
blur = new BlurFilter();
particles = new Array();
super();
partypes[FIRE] = new Par_Circle(0, 0);
partypes[STAR] = new Par_Star(0, 0);
partypes[FIRE];
this.bitmapData = new BitmapData(800, 600);
GEvents.AddEventListener(GEvents.STEP1, stepOne);
GEvents.AddEventListener(GEvents.ANNIHILATE, annihilate);
}
public function burst(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int=0, _arg5:Number=0, _arg6:int=1, _arg7=3, _arg8=15){
var _local9:*;
_local9 = 0;
while (_local9 < _arg6) {
particles.push(new Particle(_arg1, _arg2, _arg7, (_arg3 + ((Math.random() * _arg5) - (_arg5 / 2))), _arg4, _arg8));
_local9++;
};
}
private function annihilate(_arg1):void{
GEvents.RemoveEventListener(GEvents.STEP1, stepOne);
Project.This.removeChild(this);
GEvents.RemoveEventListener(GEvents.ANNIHILATE, annihilate);
}
public function make(_arg1, _arg2, _arg3, _arg4:int=1){
particles.push(new Particle(_arg1, _arg2, 0, 0, _arg4, 0));
}
public function stepOne(_arg1):void{
var _local2:BitmapData;
var _local3:int;
var _local4:Particle;
var _local5:Boolean;
_local2 = new BitmapData(800, 600, true, 0xFF);
bitmapData.fillRect(bitmapData.rect, 0);
_local3 = 0;
while (_local3 < particles.length) {
_local4 = particles[_local3];
_local5 = _local4.stepThree(null);
if (_local5){
particles.splice(_local3, 1);
} else {
_local4.stampMe(this);
};
_local3++;
};
}
public static function getBMP(_arg1:Number):BitmapData{
return (partypes[_arg1]);
}
}
}//package game.fx
Section 19
//Spark (game.fx.Spark)
package game.fx {
import flash.display.*;
public dynamic class Spark extends MovieClip {
}
}//package game.fx
Section 20
//GEvents (game.GEvents)
package game {
import flash.events.*;
public class GEvents extends EventDispatcher {
public static const STEP1:String = "step1";
public static const STEP2:String = "step2";
public static const STEP3:String = "step3";
public static const MOUSEUNCLICK:String = "mouseunclick";
public static const ANNIHILATE:String = "annihilate";
private static var This:GEvents;
public function GEvents(){
This = this;
}
public static function callEvent(_arg1:String):void{
This.dispatchEvent(new Event(_arg1));
}
public static function RemoveEventListener(_arg1, _arg2){
This.removeEventListener(_arg1, _arg2);
}
public static function AddEventListener(_arg1, _arg2){
This.addEventListener(_arg1, _arg2);
}
}
}//package game
Section 21
//Logic (game.Logic)
package game {
public class Logic {
static var degtorad = (Math.PI / 180);
static var radtodeg = (180 / Math.PI);
public static function lengthDirectionY(_arg1:Number, _arg2:Number){
return ((_arg1 * Math.sin((_arg2 * degtorad))));
}
public static function angleRotateDistance(_arg1:Number, _arg2:Number){
if (Math.abs((_arg1 - _arg2)) < 180){
return (Math.abs((_arg1 - _arg2)));
};
if (_arg2 > 180){
_arg2 = Math.abs((_arg2 - 360));
};
if (_arg1 > 180){
_arg1 = Math.abs((_arg1 - 360));
};
return ((_arg2 + _arg1));
}
public static function pointDistance(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
if ((((_arg1 == _arg3)) || ((_arg2 == _arg4)))){
return (Math.abs((Math.abs((_arg1 - _arg3)) + Math.abs((_arg2 - _arg4)))));
};
return (Math.sqrt((Math.pow(Math.abs((_arg3 - _arg1)), 2) + Math.pow(Math.abs((_arg4 - _arg2)), 2))));
}
public static function normalizeAngle(_arg1:Number):Number{
while (_arg1 > 360) {
_arg1 = (_arg1 - 360);
};
while (_arg1 < 0) {
_arg1 = (_arg1 + 360);
};
return (_arg1);
}
public static function Add_Speed_Direction(_arg1, _arg2, _arg3, _arg4){
_arg3 = (_arg3 + (_arg2 * Math.cos((_arg1 * degtorad))));
_arg4 = (_arg4 + (_arg2 * Math.sin((_arg1 * degtorad))));
}
public static function Set_Speed_Direction(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
_arg3 = (_arg2 * Math.cos((_arg1 * degtorad)));
_arg4 = (_arg2 * Math.sin((_arg1 * degtorad)));
}
public static function pointDirection(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:*;
_arg3 = (_arg3 - _arg1);
_arg4 = (_arg4 - _arg2);
_arg1 = 0;
_arg2 = 0;
if ((((_arg3 == 0)) && ((_arg4 == 0)))){
return (0);
};
if (_arg3 > 0){
if (_arg4 < 0){
_local5 = 4;
} else {
if (_arg4 > 0){
_local5 = 1;
} else {
_local5 = 80;
};
};
} else {
if (_arg3 < 0){
if (_arg4 < 0){
_local5 = 3;
} else {
if (_arg4 > 0){
_local5 = 2;
} else {
_local5 = 8180;
};
};
} else {
if (_arg4 > 0){
_local5 = 890;
} else {
_local5 = 8270;
};
};
};
switch (_local5){
case 1:
return ((Math.asin((pointDistance(_arg3, _arg2, _arg3, _arg4) / pointDistance(_arg1, _arg2, _arg3, _arg4))) * radtodeg));
case 2:
return (((Math.asin((pointDistance(_arg1, _arg4, _arg3, _arg4) / pointDistance(_arg1, _arg2, _arg3, _arg4))) * radtodeg) + 90));
case 3:
return (((Math.asin((pointDistance(_arg3, _arg2, _arg3, _arg4) / pointDistance(_arg1, _arg2, _arg3, _arg4))) * radtodeg) + 180));
case 4:
return (((Math.asin((pointDistance(_arg1, _arg4, _arg3, _arg4) / pointDistance(_arg1, _arg2, _arg3, _arg4))) * radtodeg) + 270));
case 80:
return (0);
case 890:
return (90);
case 8180:
return (180);
case 8270:
return (270);
};
}
public static function angleRotateDirection(_arg1:Number, _arg2:Number){
if (Math.abs((_arg1 - _arg2)) > 180){
return (sign((_arg2 - _arg1)));
};
return (sign((_arg1 - _arg2)));
}
public static function sign(_arg1:Number){
if (_arg1 >= 0){
return (1);
};
return (-1);
}
public static function lengthDirectionX(_arg1:Number, _arg2:Number){
return ((_arg1 * Math.cos((_arg2 * degtorad))));
}
}
}//package game
Section 22
//Project (game.Project)
package game {
import flash.display.*;
import game.fx.*;
import flash.events.*;
import game.entities.*;
import flash.geom.*;
import flash.media.*;
public class Project extends Sprite {
static var gevents:GEvents;
static var stars:Em_Starfield;
public static var viewport:Viewport;
public static var particles:Particles;
static var sau:MusicSauce;
static var mainchar:AShip;
static var sc:SoundChannel;
static var v:vel;
static var hud:AShipIcon;
public static var This:Project;
public function Project():void{
This = this;
stage.frameRate = 35;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
initGame();
}
public function initGame(){
var _local1:*;
var _local2:*;
if (gevents != null){
GEvents.callEvent(GEvents.ANNIHILATE);
};
if (v != null){
sc.stop();
};
gevents = new GEvents();
hud = new AShipIcon();
viewport = new Viewport(stage.width, stage.height);
_local1 = new Particles();
stars = new Em_Starfield(0, 0, 0, _local1, viewport);
addChild(_local1);
addChild(viewport);
particles = new Particles();
addChild(particles);
Particle.vp = viewport;
sau = new MusicSauce();
sau.width = 250;
sau.height = 62.5;
sau.x = 760;
sau.y = 600;
addChild(sau);
new Avatar(Avatar.PILOT, 1, "Hello my name is Coelocanth");
Ent.enEnt(this);
mainchar = new AShip();
addChild(hud);
hud.width = (mainchar.hp * 5);
hud.height = 10;
hud.x = 100;
hud.y = 10;
viewport.lockOn(mainchar);
_local2 = new Enemy(30, 30, 30);
_local2.giveMeATarget(mainchar);
v = new vel();
sc = v.play();
}
private function onEnterFrame(_arg1){
var _local2:*;
mainchar.receiveMouseLoc(new Point(viewport.mouseX, viewport.mouseY));
stage.focus = this;
hud.width = (mainchar.hp * 2);
stars.x = -(viewport.x);
stars.y = -(viewport.y);
GEvents.callEvent(GEvents.STEP1);
GEvents.callEvent(GEvents.STEP2);
GEvents.callEvent(GEvents.STEP3);
_local2 = viewport.worldSpaceToScreenSpace(mainchar.x, mainchar.y);
hud.x = (_local2.x - 30);
hud.y = (_local2.y - 50);
}
public static function reInitGame(){
Ent.unEnt();
mainchar = null;
This.initGame();
}
public static function getMainParticleSystem():Particles{
return (particles);
}
public static function AddChild(_arg1){
viewport.addChild(_arg1);
}
public static function RemoveChild(_arg1){
var item = _arg1;
try {
viewport.removeChild(item);
} catch(something) {
trace(item);
};
}
}
}//package game
Section 23
//Viewport (game.Viewport)
package game {
import flash.display.*;
import flash.geom.*;
public class Viewport extends Sprite {
private var _height:Number;
private var _mode:int;
public var movingtowardX:Number;
public var movingtowardY:Number;
private var _width:Number;
public var viewportLock:Sprite;
public static const LOCKED:int = 0;
public static const ARBITRARY:int = 1;
public function Viewport(_arg1:Number, _arg2:Number, _arg3:Sprite=null){
_mode = ARBITRARY;
movingtowardX = 0;
movingtowardY = 0;
_width = _arg1;
_height = _arg2;
GEvents.AddEventListener(GEvents.STEP3, stepThree);
GEvents.AddEventListener(GEvents.ANNIHILATE, annihilate);
}
public function moveTo(_arg1, _arg2){
movingtowardX = _arg1;
movingtowardY = _arg2;
_mode = ARBITRARY;
}
public function stepThree(_arg1){
switch (_mode){
case LOCKED:
x = (-(viewportLock.x) + 400);
y = (-(viewportLock.y) + 300);
break;
case ARBITRARY:
x = -(movingtowardX);
y = -(movingtowardY);
break;
};
}
public function worldSpaceToScreenSpace(_arg1, _arg2):Point{
return (new Point((_arg1 + x), (_arg2 + y)));
}
public function lockOn(_arg1:Sprite){
viewportLock = _arg1;
_mode = LOCKED;
}
private function annihilate(_arg1):void{
GEvents.RemoveEventListener(GEvents.STEP3, stepThree);
Project.This.removeChild(this);
GEvents.RemoveEventListener(GEvents.ANNIHILATE, annihilate);
}
public function isPointOnScreen(_arg1, _arg2, _arg3=0):Boolean{
var _local4:*;
var _local5:*;
_local4 = -(x);
_local5 = -(y);
return ((((((_arg1 > (_local4 - _arg3))) && ((_arg1 < ((_local4 + 800) + _arg3))))) && ((((_arg2 > (_local5 - _arg3))) && ((_arg2 < ((_local5 + 600) + _arg3)))))));
}
}
}//package game
Section 24
//AShipIcon (AShipIcon)
package {
import flash.display.*;
public dynamic class AShipIcon extends MovieClip {
}
}//package
Section 25
//MusicSauce (MusicSauce)
package {
import flash.display.*;
public dynamic class MusicSauce extends MovieClip {
}
}//package
Section 26
//Par_Circle (Par_Circle)
package {
import flash.display.*;
public dynamic class Par_Circle extends BitmapData {
public function Par_Circle(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 27
//Par_Star (Par_Star)
package {
import flash.display.*;
public dynamic class Par_Star extends BitmapData {
public function Par_Star(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 28
//vel (vel)
package {
import flash.media.*;
public dynamic class vel extends Sound {
}
}//package