Section 1
//AShip (game.entities.AShip)
package game.entities {
import flash.events.*;
import game.*;
import game.fx.*;
public class AShip extends Ent {
private var chaser:Emitter;
public function AShip(){
cooldown_time = 10;
width = 30;
height = 20;
hp = 50;
x = 300;
y = 300;
speed = 0;
dir = 0;
aim = 0;
hp = 60;
chaser = new Emitter(0, 0, 0);
chaser.speed = 0;
super.EntCon();
}
override public function onEnFra(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:Boolean;
var _local6:Boolean;
var _local7:Boolean;
var _local8:Boolean;
var _local9:Boolean;
var _local10:*;
_local2 = 0.75;
_local3 = 2.5;
_local4 = 10;
_local5 = false;
_local6 = Project.KeyDown(Project.LEFT);
_local7 = Project.KeyDown(Project.RIGHT);
_local8 = Project.KeyDown(Project.UP);
_local9 = Project.KeyDown(Project.DOWN);
chaser.x = Project.level.mouseX;
chaser.y = Project.level.mouseY;
chaser.livetime = 10;
if (_local8){
if (_local6){
dir = 225;
} else {
if (_local7){
dir = 315;
} else {
dir = 270;
};
};
} else {
if (_local9){
if (_local6){
dir = 135;
} else {
if (_local7){
dir = 45;
} else {
dir = 90;
};
};
} else {
if (_local6){
dir = 180;
} else {
if (_local7){
dir = 0;
};
};
};
};
aim = Logic.pointDirection(x, y, Project.level.mouseX, Project.level.mouseY);
if (((((((_local6) || (_local7))) || (_local8))) || (_local9))){
speed = Math.min(_local4, (speed + _local3));
rotation = Logic.pointDirection(0, 0, xVel, yVel);
Project.AddChild(new Spark(x, y, (((rotation - 180) + (Math.random() * 100)) - 50)));
Project.AddChild(new Spark(x, y, (((rotation - 180) + (Math.random() * 100)) - 55)));
Project.AddChild(new Spark(x, y, (((rotation - 180) + (Math.random() * 100)) - 50)));
Project.AddChild(new Spark(x, y, (((rotation - 180) + (Math.random() * 100)) - 50)));
};
speed = Math.max(0, (speed - _local2));
rotation = aim;
x = (x + xVel);
y = (y + yVel);
cooldown_remain = (cooldown_remain - 1);
if (((Project.KeyDown(Project.FIRE)) && ((cooldown_remain <= 0)))){
cooldown_remain = cooldown_time;
Project.FriendlyColList.push(new Bolt(this, x, y, rotation));
};
_local10 = 0;
while (_local10 < Project.EnemyColList.length) {
if (hitTestObject(Project.EnemyColList[_local10])){
Project.EnemyColList[_local10].collideWithMe(this, _local10);
if (hp <= 0){
Die();
};
};
_local10++;
};
}
override public function Die():void{
var _local1:*;
var _local2:*;
_local1 = 0;
while (_local1 < 100) {
_local2 = new Spark(x, y, (Math.random() * 360));
_local2.speed = (Math.random() * 10);
_local1++;
};
super.Die();
Project.This.reInit();
}
}
}//package game.entities
Section 2
//Bolt (game.entities.Bolt)
package game.entities {
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;
super.EntCon();
}
}
}//package game.entities
Section 3
//Bomb (game.entities.Bomb)
package game.entities {
import flash.events.*;
import game.*;
import game.fx.*;
public class Bomb extends Projectile {
private const brain_DEAD = 3;
private const brain_LAUNCHED = 0;
private const brain_EXPLODED = 1;
private var postexlivetime:int;// = 100
private var hits;
public function Bomb(_arg1:Ent, _arg2:Number, _arg3:Number, _arg4:Number):void{
postexlivetime = 100;
super();
livetime = 50;
damage = 1;
width = 30;
height = 30;
speed = 5;
hits = 10;
x = _arg2;
y = _arg3;
dir = _arg4;
rotation = dir;
creator = _arg1;
super.EntCon();
}
override public function onEnFra(_arg1){
var _local2:*;
switch (brain){
case brain_LAUNCHED:
x = (x + xVel);
y = (y + yVel);
_local2 = new Spark(x, y, ((rotation + (Math.random() * 50)) - 25));
Project.AddChild(_local2);
if (--livetime == 0){
Die();
};
break;
case brain_EXPLODED:
rotation = (rotation + 30);
if (width < 200){
width = (width + 4);
};
if (height < 200){
height = (height + 4);
};
if (--postexlivetime <= 0){
Die();
};
break;
default:
Die();
};
}
override public function Die():void{
if (brain == brain_LAUNCHED){
brain = brain_EXPLODED;
};
if (postexlivetime <= 0){
super.Die();
};
}
override public function collideWithMe(_arg1:Ent, _arg2:int):void{
_arg1.hp = (_arg1.hp - damage);
_arg1.dir = Logic.pointDirection(x, y, _arg1.x, _arg1.y);
_arg1.speed = 30;
if (--hits == 0){
Project.EnemyColList.splice((_arg2 - 1), 1);
this.Die();
};
}
}
}//package game.entities
Section 4
//Enemy (game.entities.Enemy)
package game.entities {
import flash.events.*;
import game.*;
import game.fx.*;
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 = 3;
cooldown_time = 5;
cooldown_remain = 0;
super.EntCon();
}
override public function onEnFra(_arg1){
var _local2:*;
var _local3:Ent;
var _local4:*;
turnToward(mtar.x, mtar.y);
rotation = dir;
speed = 1;
x = (x + xVel);
y = (y + yVel);
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 = 0;
while (_local2 < Project.FriendlyColList.length) {
if (hitTestObject(Project.FriendlyColList[_local2])){
_local4 = Project.FriendlyColList[_local2];
Project.FriendlyColList.splice((_local2 - 1), 1);
_local4.Die();
hp = (hp - _local4.damage);
if (hp <= 0){
Die();
};
};
_local2++;
};
}
override public function Die():void{
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local1 = new Enemy((x + 500), (x + 500), 30);
_local1.giveMeATarget(Project.viewportfollow);
_local1 = new Enemy((x - 500), (x - 500), 30);
_local1.giveMeATarget(Project.viewportfollow);
_local3 = 0;
while (_local3 != 6) {
_local4 = (x + (Math.random() * 50));
_local5 = (y + (Math.random() * 50));
if (_local3 == 0){
_local5 = 0;
_local4 = _local5;
};
_local2 = 0;
while (_local2 < 100) {
_local6 = new Spark(_local4, _local5, (Math.random() * 360));
_local6.speed = (Math.random() * 10);
_local2++;
};
_local3++;
};
super.Die();
}
}
}//package game.entities
Section 5
//Ent (game.entities.Ent)
package game.entities {
import flash.display.*;
import flash.events.*;
import game.*;
public class Ent extends Sprite {
var hp:Number;
var cooldown_time:Number;
var aim:Number;// = 0
var speed:Number;// = 0
var maxspeed:Number;
var dead:Boolean;
var mtar:Ent;
var par:Ent;
var dir:Number;// = 0
var cooldown_remain:Number;// = 0
var cargocount:Number;
var turnrate:Number;
var accel:Number;
var friction:Number;
var brain:int;// = 0
public function Ent(){
dir = 0;
speed = 0;
aim = 0;
cooldown_remain = 0;
brain = 0;
super();
}
public function get xVel():Number{
return (Logic.lengthDirectionX(speed, dir));
}
public function onEnFra(_arg1){
}
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 Die():void{
removeEventListener(Event.ENTER_FRAME, onEnFra);
Project.gameevents.removeEventListener(GameEvents.ALLDEAD, onAnihilate);
try {
Project.RemoveChild(this);
} catch(something) {
trace(this);
};
trace(delete ??getglobalscope
[this]);
}
public function The():void{
trace("utz workin' pardner");
}
public function get yVel():Number{
return (Logic.lengthDirectionY(speed, dir));
}
public function giveMeATarget(_arg1){
mtar = _arg1;
}
public function EntCon():void{
Project.AddChild(this);
addEventListener(Event.ENTER_FRAME, onEnFra);
Project.gameevents.addEventListener(GameEvents.ALLDEAD, onAnihilate);
}
public function onAnihilate(_arg1):void{
trace("seems to be working");
removeEventListener(Event.ENTER_FRAME, onEnFra);
Project.gameevents.removeEventListener(GameEvents.ALLDEAD, onAnihilate);
Project.RemoveChild(this);
}
}
}//package game.entities
Section 6
//Jimmy (game.entities.Jimmy)
package game.entities {
import flash.events.*;
import game.*;
import game.fx.*;
public class Jimmy extends Ent {
private const brain_ATTACKING = 0;
private const brain_RETURNING = 1;
private const brain_LIMPING = 2;
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;
width = 30;
height = 30;
hp = 20;
super.EntCon();
}
override public function onEnFra(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
switch (brain){
case brain_ATTACKING:
aim = Logic.pointDirection(x, y, mtar.x, mtar.y);
_local2 = Logic.pointDistance(x, y, mtar.x, mtar.y);
_local3 = 0;
while (_local3 < Project.FriendlyColList.length) {
_local5 = Project.FriendlyColList[_local3];
_local6 = Logic.pointDistance(x, y, _local5.x, _local5.y);
if (_local6 < 30){
Project.FriendlyColList.splice((_local3 - 1), 1);
_local5.Die();
hp = (hp - _local5.damage);
if (hp <= 0){
Die();
};
} else {
if (_local6 < 120){
if (!dashing){
speed = (maxspeed * 2);
dir = (Logic.pointDirection(_local5.x, _local5.y, x, y) + ((Math.random() * 180) - 90));
};
dashing = true;
change = 50;
};
};
_local3++;
};
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);
Project.AddChild(new Spark(x, y, ((rotation + (Math.random() * 100)) - 50)));
Project.AddChild(new Spark(x, y, ((rotation + (Math.random() * 100)) - 50)));
dir = aim;
dashing = true;
change = 50;
};
};
};
if (--change < 0){
change = 10;
dir = (aim + ((Math.random() * 100) - 200));
dashing = false;
};
if (dashing){
Project.AddChild(new Spark(x, y, ((rotation + (Math.random() * 100)) - 50)));
Project.AddChild(new Spark(x, y, ((rotation + (Math.random() * 100)) - 50)));
Project.AddChild(new Spark(x, y, ((rotation + (Math.random() * 100)) - 50)));
Project.AddChild(new Spark(x, y, ((rotation + (Math.random() * 100)) - 50)));
Project.AddChild(new Spark(x, y, ((rotation + (Math.random() * 100)) - 50)));
Project.AddChild(new Spark(x, y, ((rotation + (Math.random() * 100)) - 50)));
};
if (--cooldown_remain <= 0){
cooldown_remain = cooldown_time;
Project.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);
_local4 = 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;
x = (x + xVel);
y = (y + yVel);
}
override public function Die():void{
var _local1:*;
var _local2:*;
_local1 = 0;
while (_local1 < 100) {
_local2 = new Spark(x, y, (Math.random() * 360));
_local2.speed = (Math.random() * 10);
_local1++;
};
super.Die();
}
}
}//package game.entities
Section 7
//Projectile (game.entities.Projectile)
package game.entities {
import flash.events.*;
import game.*;
import game.fx.*;
public class Projectile extends Ent {
var creator:Ent;
public var damage;
var livetime;
public function collideWithMe(_arg1:Ent, _arg2:int):void{
_arg1.hp = (_arg1.hp - damage);
Project.EnemyColList.splice((_arg2 - 1), 1);
trace(_arg2);
this.Die();
}
override public function onEnFra(_arg1){
var _local2:*;
x = (x + xVel);
y = (y + yVel);
_local2 = new Spark(x, y, ((rotation + (Math.random() * 50)) - 25));
Project.AddChild(_local2);
if (--livetime == 0){
Die();
};
}
}
}//package game.entities
Section 8
//Spawn (game.entities.Spawn)
package game.entities {
import flash.events.*;
import game.*;
import game.fx.*;
public class Spawn extends Ent {
private const brain_RETURNING = 1;
private const brain_LIMPING = 2;
private const brain_SOJURNING = 0;
public function Spawn(_arg1, _arg2, _arg3):void{
x = _arg1;
y = _arg2;
dir = _arg3;
turnrate = 2.5;
width = 50;
height = 40;
hp = 20;
super.EntCon();
}
override public function onEnFra(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
speed = 11;
switch (brain){
case brain_SOJURNING:
turnToward(mtar.x, mtar.y);
if (Logic.pointDistance(x, y, mtar.x, mtar.y) < 200){
Project.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;
x = (x + xVel);
y = (y + yVel);
Project.AddChild(new Spark(x, y, ((rotation + (Math.random() * 100)) - 50)));
Project.AddChild(new Spark(x, y, ((rotation + (Math.random() * 100)) - 50)));
_local2 = 0;
while (_local2 < Project.FriendlyColList.length) {
if (hitTestObject(Project.FriendlyColList[_local2])){
_local4 = Project.FriendlyColList[_local2];
Project.FriendlyColList.splice((_local2 - 1), 1);
_local4.Die();
hp = (hp - _local4.damage);
if (hp <= 0){
Die();
};
};
_local2++;
};
}
override public function Die():void{
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
removeEventListener(Event.ENTER_FRAME, onEnFra);
_local2 = 0;
while (_local2 != 6) {
_local3 = (x + (Math.random() * 50));
_local4 = (y + (Math.random() * 50));
if (_local2 == 0){
_local4 = 0;
_local3 = _local4;
};
_local2++;
};
super.Die();
}
}
}//package game.entities
Section 9
//Emitter (game.fx.Emitter)
package game.fx {
import flash.events.*;
import game.*;
public class Emitter extends Spark {
public function Emitter(_arg1, _arg2, _arg3){
Project.AddChild(this);
addEventListener(Event.ENTER_FRAME, onEnFra);
addEventListener(GameEvents.ALLDEAD, Die);
x = (y = 0);
}
override public function onEnFra(_arg1):void{
Project.AddChild(new Spark(x, y, (Math.random() * 360)));
Project.AddChild(new Spark(x, y, (Math.random() * 360)));
Project.AddChild(new Spark(x, y, (Math.random() * 360)));
Project.AddChild(new Spark(x, y, (Math.random() * 360)));
}
}
}//package game.fx
Section 10
//Spark (game.fx.Spark)
package game.fx {
import flash.display.*;
import flash.events.*;
import game.entities.*;
import game.*;
public class Spark extends Sprite {
public var speed;
public var dir;
public var livetime;
private var Parent:Ent;
public function Spark(_arg1=0, _arg2=0, _arg3=0){
x = _arg1;
y = _arg2;
dir = _arg3;
speed = 3;
width = 3;
height = 3;
Project.AddChild(this);
livetime = 10;
addEventListener(Event.ENTER_FRAME, onEnFra);
Project.gameevents.addEventListener(GameEvents.ALLDEAD, onAnihilate);
}
public function get xVel():Number{
return (Logic.lengthDirectionX(speed, dir));
}
public function onEnFra(_arg1):void{
x = (x + xVel);
y = (y + yVel);
livetime--;
if (livetime <= 0){
Die();
};
}
public function Die(){
removeEventListener(Event.ENTER_FRAME, onEnFra);
Project.gameevents.removeEventListener(GameEvents.ALLDEAD, onAnihilate);
Project.RemoveChild(this);
delete ??getglobalscope
[this];
}
public function get yVel():Number{
return (Logic.lengthDirectionY(speed, dir));
}
public function onAnihilate(_arg1):void{
Die();
}
}
}//package game.fx
Section 11
//GameEvents (game.GameEvents)
package game {
import flash.display.*;
import flash.events.*;
public class GameEvents extends EventDispatcher {
public static const ALLDEAD:String = "allDead";
public function Movement(_arg1:MovieClip){
}
public function anihilateAll():void{
trace("Killling them off");
dispatchEvent(new Event(GameEvents.ALLDEAD));
}
}
}//package game
Section 12
//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 13
//Project (game.Project)
package game {
import flash.display.*;
import flash.events.*;
import game.entities.*;
import game.fx.*;
import flash.ui.*;
public class Project extends Sprite {
public static var FIRE = 5;
public static var LEFT = 1;
public static var level:Sprite;
public static var gameevents:GameEvents = new GameEvents();
private static var zoom:Boolean;
public static var refreshcount = 6;
public static var viewportfollow:AShip;
public static var Keys = new Array(6);
public static var DOWN = 4;
public static var UP = 2;
public static var OTHER = 6;
public static var EnemyColList;
public static var FriendlyColList;
public static var RIGHT = 3;
public static var This:Project;
public function Project():void{
stage.frameRate = 31;
init();
}
public function reInit():void{
if (--refreshcount <= 0){
stage.frameRate = 1;
trace("don't be alarmed, it's slow because I made it slow");
};
gameevents.anihilateAll();
EnemyColList = null;
FriendlyColList = null;
removeChild(level);
level = new Sprite();
stage.removeEventListener(MouseEvent.MOUSE_DOWN, reportClick);
stage.removeEventListener(MouseEvent.MOUSE_UP, reportUnClick);
removeEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
removeEventListener(KeyboardEvent.KEY_UP, reportKeyUp);
removeEventListener(Event.ENTER_FRAME, onEnFra);
init();
}
private function onEnFra(_arg1){
stage.focus = this;
level.x = (-(viewportfollow.x) + 300);
level.y = (-(viewportfollow.y) + 300);
}
private function init():void{
var _local1:int;
var _local2:*;
This = this;
EnemyColList = new Array();
FriendlyColList = new Array();
_local1 = 0;
while (_local1 <= 6) {
Keys[_local1] = 0;
_local1++;
};
level = new Sprite();
addChild(level);
viewportfollow = new AShip();
_local2 = new Enemy(30, 30, 30);
_local2.giveMeATarget(viewportfollow);
zoom = false;
stage.addEventListener(MouseEvent.MOUSE_DOWN, reportClick);
stage.addEventListener(MouseEvent.MOUSE_UP, reportUnClick);
addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
addEventListener(KeyboardEvent.KEY_UP, reportKeyUp);
addEventListener(Event.ENTER_FRAME, onEnFra);
}
public 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 function reportUnClick(_arg1:MouseEvent):void{
Keys[FIRE] = false;
}
public function reportClick(_arg1:MouseEvent):void{
Keys[FIRE] = true;
}
public 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 KeyDown(_arg1:int):Boolean{
return (Keys[_arg1]);
}
public static function RemoveChild(_arg1){
level.removeChild(_arg1);
}
public static function KeyReleased(_arg1:int):Boolean{
return (Keys[_arg1]);
}
public static function AddChild(_arg1){
level.addChild(_arg1);
}
public static function massDeath(){
}
}
}//package game