Symbol 3 MovieClip [Missile] Frame 1
#initclip 6
Object.registerClass("Missile", Missile);
#endinitclip
Symbol 5 MovieClip [EnemyShip] Frame 1
#initclip 4
Object.registerClass("EnemyShip", EnemyShip);
#endinitclip
Symbol 7 MovieClip [Ship] Frame 1
#initclip 5
Object.registerClass("Ship", Ship);
#endinitclip
Symbol 10 MovieClip [__Packages.EnemyShip] Frame 0
class EnemyShip extends MovieClip
{
var health, removeMovieClip, shootLimiter, shootingLimit, Xvelo, Yvelo, _x, _y;
function EnemyShip () {
super();
}
function updateHealth(update) {
health = health + update;
if (health < 1) {
removeMovieClip();
_root.ship.updateScore(15);
}
}
function setShootLimiter(limit, limit2) {
shootLimiter = limit;
shootingLimit = limit2;
}
function setVelo(xx, yy) {
Xvelo = xx;
Yvelo = yy;
}
function onLoad() {
_x = (Math.random() * 350) + 50;
_y = -10;
setVelo(-2 + (Math.random() * 4), (Math.random() * 10) + 5);
health = 100;
}
function onEnterFrame() {
_x = _x + Xvelo;
_y = _y + Yvelo;
if (_y > 630) {
removeMovieClip();
}
}
}
Symbol 11 MovieClip [__Packages.Ship] Frame 0
class Ship extends MovieClip
{
var score, enemyTimer, enemyTimerLimit, velocity, shootLimit, shootingLimit, enemies, _x, _y;
function Ship () {
super();
}
function updateScore(update) {
score = score + update;
_root.scoreText.text = score;
}
function setEnemyTimers(timer, timer2) {
enemyTimer = timer;
enemyTimerLimit = timer2;
}
function setVelocity(velo) {
velocity = velo;
}
function setShootingLimits(limit1, limit2) {
shootLimit = limit1;
shootingLimit = limit2;
}
function onLoad() {
velocity = 5;
var _local2 = new Sound();
_local2.attachSound("bgMusic");
_local2.start(0, 1000);
shootLimit = 0;
shootingLimit = 3;
enemyTimer = 0;
enemyTimerLimit = 15;
enemies = [];
score = 0;
}
function onEnterFrame() {
shootLimit++;
if (Key.isDown(32) && (shootLimit > shootingLimit)) {
shootLimit = 0;
var _local3 = _root.attachMovie("Missile", "Missile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3.setVelos(-1 + (Math.random() * 2), -10);
_local3._x = _x;
_local3._y = _y;
}
enemyTimer++;
if (enemyTimer > enemyTimerLimit) {
enemyTimer = 0;
var _local4 = _root.attachMovie("EnemyShip", "EnemyShip" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
enemies.push(_local4);
}
if (Key.isDown(39)) {
_x = _x + velocity;
}
if (Key.isDown(37)) {
_x = _x - velocity;
}
if (Key.isDown(38)) {
_y = _y - velocity;
}
if (Key.isDown(40)) {
_y = _y + velocity;
}
}
}
Symbol 12 MovieClip [__Packages.Missile] Frame 0
class Missile extends MovieClip
{
var Yvelo, Xvelo, hitTest, removeMovieClip, _y, _x;
function Missile () {
super();
}
function setVelos(velX, velY) {
Yvelo = velY;
Xvelo = velX;
}
function onLoad() {
}
function onEnterFrame() {
for (var _local3 in _root.ship.enemies) {
if (hitTest(_root.ship.enemies[_local3])) {
removeMovieClip();
_root.ship.enemies[_local3].updateHealth(-30);
}
}
_y = _y + Yvelo;
_x = _x + Xvelo;
if (_y < -5) {
removeMovieClip();
}
}
}