Instance of Symbol 5 MovieClip in Frame 2
on (press) {
this._parent.more_pressed();
}
Instance of Symbol 12 MovieClip in Frame 2
on (press) {
this._parent.more_pressed();
}
Frame 3
stot = this.getBytesTotal();
sloa = this.getBytesLoaded();
if (stot != 0) {
per = Math.floor((sloa / stot) * 100);
} else {
per = 0;
}
mc_bar.mc._x = mc_bar.mc._width * (-1 + (sloa / stot));
txtPer = String(per) + "%";
if (((sloa >= 1) && (stot >= 1)) && (sloa == stot)) {
gotoAndStop ("main");
inMenuFirst();
} else {
gotoAndPlay (2);
}
Instance of Symbol 166 MovieClip "mc_sloop" in Frame 5
onClipEvent (load) {
var soundControl = new Sound(this);
}
Instance of Symbol 171 MovieClip "btn_sound" in Frame 5
onClipEvent (load) {
if (this._parent.stopSoundFlag) {
this.gotoAndStop(2);
}
}
Instance of Symbol 172 MovieClip in Frame 6
on (release) {
this._parent.back_pressed();
}
Frame 7
this.stop();
Instance of Symbol 64 MovieClip "mc_control" in Frame 7
onClipEvent (load) {
this._parent.initLevel();
}
onClipEvent (enterFrame) {
this._parent.processGame();
}
onClipEvent (keyDown) {
this._parent.keyPressed();
updateAfterEvent();
}
onClipEvent (mouseMove) {
this._parent.myMouseMove();
updateAfterEvent();
}
onClipEvent (mouseDown) {
this._parent.myMouseDown();
updateAfterEvent();
}
Symbol 1 MovieClip Frame 1
#initclip 19
function soundOff() {
mc_sloop.gotoAndStop(3);
stopSoundFlag = true;
}
function soundOn() {
mc_sloop.gotoAndStop(2);
stopSoundFlag = false;
}
function new_game_pressed() {
gameStart();
}
function how_to_play_pressed() {
this.gotoAndStop("rules");
}
function more_pressed() {
getURL ("http://www.justfreegames.com?r1=F&r2=GI&WT.mc_id=FlashGalaxyInvaders", "_blank");
}
function back_pressed() {
this.gotoAndStop("main");
}
function inMenuFirst() {
mc_sloop.gotoAndStop(2);
}
function gameStart() {
_quality = "MEDIUM";
bonusScores = (scores = 0);
lifeCount = maxLifeCount;
CPlayer.rocketCount = 0;
level = 0;
nextLevel();
}
function nextLevel() {
level++;
this.gotoAndStop("reset");
this.gotoAndStop("game");
}
function newGame() {
_quality = "HIGH";
this.gotoAndStop("main");
}
function playSnd(lib_snd) {
if (stopSoundFlag) {
return(undefined);
}
s = new Sound(this);
s.attachSound(lib_snd);
s.start();
}
function initLevel() {
sndBonus = false;
sndEnemyExp = false;
sndHeroExp = false;
sndLaserBoss = false;
sndLaserHero = false;
sndLaserHeroBig = false;
sndRocket = false;
lastTimer = getTimer();
shotCounter = 0;
flyCounter = 0;
boomCounter = 0;
bonusCounter = 0;
keyboardFlag = true;
txtScores = scores;
txtLifes = lifeCount;
updateRockets();
mc_player.init();
bossLevel = levels[level - 1].length == 0;
if (bossLevel) {
boss = mc_enemies.attachMovie("lib_boss", "0", 0);
boss.init(this);
boss.setLevel(level);
mc_ind.init(boss.getLifeCount());
} else {
mc_ind._visible = false;
enemyBlock.init(mc_enemies);
enemyBlock.setLevel(levels[level - 1]);
enemyBlock.recalcSpeed();
}
CFlyEnemy.player = mc_player;
CFlyEnemy.enemyBlock = enemyBlock;
CSmallEnemy.player = mc_player;
enemyBCounter = 0;
enemyBCount = random(ENEMY_BMAX) + 1;
slowTime.reset();
gameState = 0;
mc_caption.gotoAndStop("stLevel");
mc_caption.mc.txtLevel = level;
timeCounter.setTime(3000);
messageFlag = false;
}
function processGame() {
var _local7 = false;
var _local9;
var _local6;
_local9 = getTimer();
_local6 = _local9 - lastTimer;
txtFps = 1 / (_local6 / 1000);
lastTimer = _local9;
if (gameState == 2) {
return(undefined);
}
if (gameState == 1) {
if (mc_player.isDeadTooLong()) {
if (lifeCount <= 0) {
mc_caption.gotoAndStop("stOver");
gameState = 4;
timeCounter.setTime(5000);
messageFlag = false;
} else {
mc_player.init();
mc_player.toMig();
}
} else if ((enemyBlock.getMC()._y + enemyBlock.getMC()._height) > 360) {
if (mc_player.isLive()) {
killPlayer();
}
lifeCount = 0;
updateLifes();
}
}
var _local4;
var _local2;
var _local3 = {x:0, y:0};
var _local8 = mc_player._x;
if (Key.isDown(37)) {
keyboardFlag = true;
_local8 = 0;
mc_player.keyboardFlag = true;
} else if (Key.isDown(39)) {
keyboardFlag = true;
_local8 = 1000;
mc_player.keyboardFlag = true;
} else {
mc_player.keyboardFlag = false;
if (!keyboardFlag) {
_local8 = this._xmouse;
}
}
mc_player.process(_local6, _local8);
processBonuses(_local6);
if (gameState == 4) {
if (!timeCounter.process(_local6)) {
newGame();
return(undefined);
}
} else {
if (gameState == 0) {
if (!timeCounter.process(_local6)) {
toGame();
}
return(undefined);
}
if (gameState == 3) {
if (!timeCounter.process(_local6)) {
nextLevel();
return(undefined);
}
}
}
if (messageFlag) {
if (!timeCounter.process(_local6)) {
messageFlag = false;
mc_caption.gotoAndStop("stEmpty");
return(undefined);
}
}
if ((mc_player.isLive() && (Key.isDown(1))) || (Key.isDown(32))) {
if (mc_player.canShot()) {
playerShot();
}
}
if (bossLevel) {
boss.process(_local6);
if (!boss.isDead()) {
_local7 = true;
}
while (_local3 = boss.smallsArray.pop() , _local3 != undefined) {
addSmallEnemy(_local3.x, _local3.y);
}
while (_local3 = boss.shotsArray.pop() , _local3 != undefined) {
doEnemyShot(_local3.x, _local3.y, BOSS_SHOT_SPEED, mc_player._x - _local3.x, mc_player._y - _local3.y, CShot.TYPE_BOSS);
}
} else {
var _local11 = slowTime.process(_local6);
var _local5;
if (lifeCount > 0) {
enemyBlock.process(_local11);
}
if (enemyBlock.isLive()) {
_local7 = true;
}
while (_local5 = enemyBlock.shotArray.pop() , _local5 != undefined) {
doEnemyShot(_local5.x, _local5.y, ENEMY_SHOT_SPEED, 0, 1, _local5.shotType);
}
var _local10 = enemyBlock.getFlyEnemy();
if (_local10 != null) {
startFlyEnemy(_local10);
}
for (_local4 in mc_fly) {
_local7 = true;
_local2 = mc_fly[_local4];
_local2.process(_local6);
if (_local2.endFly()) {
_local2.returnEnemy();
_local2.removeMovieClip();
} else if (mc_player.isHere() && (mc_player.myHitTest(_local2.mc_hit))) {
addScores(scrHit);
killFlyEnemy(_local2);
if (mc_player.doHit()) {
killPlayer();
}
}
}
}
mc_bonEnemy.process(_local6);
_local3 = {x:0, y:0};
if ((bossLevel == false) && (mc_bonEnemy.hasSmallEnemy(_local3))) {
addSmallEnemy(_local3.x, _local3.y);
}
if (mc_bonEnemy.isLive()) {
_local7 = true;
}
for (_local4 in mc_smalls) {
_local7 = true;
_local2 = mc_smalls[_local4];
_local2.process(_local6);
if (_local2 == undefined) {
continue;
}
if (mc_player.isHere() && (mc_player.myHitTest(_local2.mc_hit))) {
addScores(scrSmallHit);
killSmallEnemy(_local2);
if (mc_player.doHit()) {
killPlayer();
}
}
}
processPlayerShots(_local6);
if (enemyBlock.recalcSpeedFlag) {
enemyBlock.recalcSpeed();
}
if ((mc_player.isLive() && (gameState == 1)) && (_local7 == false)) {
winLevel();
mc_bonEnemy.stopFlag = true;
}
if (sndLife) {
playSnd("snd_life");
} else if (sndBonus) {
playSnd("snd_bonus");
} else if (sndHeroExp) {
playSnd("snd_hero_exp");
} else if (sndLaserBoss) {
playSnd("snd_laser_boss");
} else if (sndLaserHeroBig) {
playSnd("snd_laser_hero_big");
} else if (sndRocket) {
playSnd("snd_rocket");
} else if (sndLaserHero) {
playSnd("snd_laser_hero");
} else if (sndEnemyExp) {
playSnd("snd_enemy_exp");
}
sndBonus = false;
sndHeroExp = false;
sndLaserBoss = false;
sndLaserHeroBig = false;
sndRocket = false;
sndLaserHero = false;
sndEnemyExp = false;
sndLife = false;
}
function keyPressed() {
if (gameState == 1) {
if (mc_player.isLive() && (Key.isDown(17))) {
if (mc_player.canRocketShot()) {
playerRocketShot();
}
}
}
if ((gameState == 1) || (gameState == 0)) {
if (Key.isDown(80)) {
gameState = 2;
mc_caption.gotoAndStop("stPause");
messageFlag = false;
return(undefined);
}
}
if (gameState == 2) {
toGame();
return(undefined);
}
}
function myMouseMove() {
keyboardFlag = false;
}
function myMouseDown() {
if (gameState == 0) {
toGame();
return(undefined);
}
if (gameState == 4) {
newGame();
return(undefined);
}
if (gameState == 3) {
nextLevel();
return(undefined);
}
}
function processPlayerShots(dTime) {
var _local4;
var _local1;
var _local2;
var _local3;
var _local5 = {x:0, y:0};
for (_local4 in mc_pshots) {
_local1 = mc_pshots[_local4];
_local5.x = _local1._x;
_local5.y = _local1._y;
mc_pshots.localToGlobal(_local5);
if (bossLevel && (boss.isLive())) {
if (boss.myHitTest(_local1.mc_hit)) {
if ((_local1.shotType == CShot.TYPE_PL_ROCKET) || (_local1.shotType == CShot.TYPE_PL_LASER)) {
doBoom(_local1._x, _local1._y, 50);
}
boss.doHit(_local1);
mc_ind.setValue(boss.getLifeCount());
_local1.destroy();
addScores(scrBossHit);
continue;
}
}
_local2 = enemyBlock.getEnemy(_local1._x, _local1._y, _local1.mc_hit);
if (_local2 != null) {
if (_local2.decLife(_local1.damage)) {
if (_local2.type == CEnemy.TYPE_2LIFE) {
addScores(scrHit * 2);
} else if (_local2.type == CEnemy.TYPE_3LIFE) {
addScores(scrHit * 3);
} else {
addScores(scrHit);
}
checkBonus(enemyBlock.getMC()._x + _local2._x, enemyBlock.getMC()._y + _local2._y);
doBoom(_local1._x, _local1._y, 70);
enemyBlock.killEnemy(_local2);
} else {
doBoom(_local1._x, _local1._y, 60);
}
if (_local1.decLife()) {
continue;
}
}
for (_local3 in mc_smalls) {
_local2 = mc_smalls[_local3];
if (_local2.mc_hit.hitTest(_local1.mc_hit)) {
addScores(scrSmallHit);
killSmallEnemy(_local2);
if (_local1.decLife()) {
_local1 = null;
break;
}
}
}
if (_local1 == null) {
continue;
}
if (mc_bonEnemy.isLive()) {
if (mc_bonEnemy.hitTest(_local1.mc_hit)) {
addScores(scrUpperEnemy);
addBonus(mc_bonEnemy._x, mc_bonEnemy._y);
doBoom(mc_bonEnemy._x, mc_bonEnemy._y, 90);
mc_bonEnemy.destroy();
if (_local1.decLife()) {
continue;
}
}
}
for (_local3 in mc_fly) {
_local2 = mc_fly[_local3];
if (_local2.mc_hit.hitTest(_local1.mc_hit)) {
addScores(scrHit);
killFlyEnemy(_local2);
if (_local1.decLife()) {
_local1 = null;
break;
}
}
}
if (_local1 != null) {
_local1.process(dTime);
}
}
for (_local4 in mc_eshots) {
_local1 = mc_eshots[_local4];
_local1.process(dTime);
if (mc_player.isHere() && (mc_player.myHitTest(_local1.mc_hit))) {
_local1.destroy();
if (mc_player.doHit()) {
killPlayer();
}
}
}
}
function killFlyEnemy(enemy) {
doBoom(enemy._x, enemy._y, 60);
enemyBlock.toNull(enemy.myFriend());
enemy.destroy();
}
function killSmallEnemy(enemy) {
doBoom(enemy._x, enemy._y, 60);
enemy.destroy();
}
function processBonuses(dTime) {
var _local1;
var _local3;
var _local2;
for (_local3 in mc_bonuses) {
_local1 = mc_bonuses[_local3];
_local1.process(dTime);
if (!mc_player.isLive()) {
continue;
}
if (mc_player.mc.mc_hit.hitTest(_local1)) {
_local2 = _local1.bonusType;
if (_local2 != 4) {
addScores(scrBonus);
}
sndBonus = true;
switch (_local2) {
case 1 :
mc_player.addLaser();
break;
case 2 :
powerBonus(_local1._x);
break;
case 3 :
mc_player.addRockets();
updateRockets();
break;
case 4 :
addScores(scrBonusBonus);
break;
case 5 :
mc_player.addShield();
break;
case 6 :
slowTime.activate();
}
_local1.destroy();
}
}
}
function powerBonus(x) {
var _local1;
var _local2 = (mc_player._width * 2) / 7;
var _local3 = (x - mc_player._width) + (_local2 / 2);
_local1 = 0;
while (_local1 < 7) {
doShot(_local3 + (_local1 * _local2), LHEIGHT + random(55), PLAYER_SHOT_SPEED, 0, -1, CShot.TYPE_PL_ROCKET);
_local1++;
}
}
function doBoom(x, y, scale) {
var _local1;
_local1 = mc_booms.attachMovie("lib_boom", "" + boomCounter, boomCounter);
_local1._x = x;
_local1._y = y;
_local1._xscale = (_local1._yscale = scale);
boomCounter++;
if (boomCounter > 1000) {
boomCounter = 0;
}
sndEnemyExp = true;
}
function addBonus(x, y) {
var _local1 = mc_bonuses.attachMovie("lib_bonus", "" + bonusCounter, bonusCounter);
_local1.init(x, y);
bonusCounter++;
if (bonusCounter > 1000) {
bonusCounter = 0;
}
}
function checkBonus(x, y) {
enemyBCounter++;
if (enemyBCounter >= enemyBCount) {
enemyBCounter = 0;
enemyBCount = random(ENEMY_BMAX) + 1;
addBonus(x, y);
}
}
function addSmallEnemy(x, y) {
var _local1;
_local1 = mc_smalls.attachMovie("lib_smallEnemy", "" + flyCounter, flyCounter);
_local1.init(x, y);
flyCounter++;
if (flyCounter == 1000) {
flyCounter = 0;
}
}
function startFlyEnemy(flyEnemy) {
var _local1;
_local1 = mc_fly.attachMovie("lib_flyEnemy", "" + flyCounter, flyCounter);
_local1.init(flyEnemy);
flyCounter++;
if (flyCounter == 1000) {
flyCounter = 0;
}
}
function playerShot() {
mc_player.shot();
if (mc_player.hasLaser()) {
mc_player.shotLaser();
doShot(mc_player._x, mc_player._y - 7, PLAYER_SHOT_SPEED, 0, -1, CShot.TYPE_PL_LASER);
} else {
doShot(mc_player._x, mc_player._y - 7, PLAYER_SHOT_SPEED, 0, -1, CShot.TYPE_PL);
}
}
function playerRocketShot() {
var _local2 = {x:mc_player.mc.mc_p1._x, y:mc_player.mc.mc_p1._y};
var _local1 = {x:mc_player.mc.mc_p2._x, y:mc_player.mc.mc_p2._y};
mc_player.mc.localToGlobal(_local2);
mc_player.mc.localToGlobal(_local1);
mc_player._parent.globalToLocal(_local2);
mc_player._parent.globalToLocal(_local1);
doShot(_local2.x, _local2.y, PLAYER_SHOT_SPEED, 0, -1, CShot.TYPE_PL_ROCKET);
doShot(_local1.x, _local1.y, PLAYER_SHOT_SPEED, 0, -1, CShot.TYPE_PL_ROCKET);
mc_player.rocketShot();
updateRockets();
}
function doShot(x, y, speed, dx, dy, shotType) {
var _local1;
_local1 = mc_pshots.attachMovie("lib_pshot", "" + shotCounter, shotCounter);
_local1.init(x, y, speed, dx, dy, shotType);
if (shotType == CShot.TYPE_PL_LASER) {
sndLaserHeroBig = true;
} else if (shotType == CShot.TYPE_PL_ROCKET) {
sndRocket = true;
} else {
sndLaserHero = true;
}
shotCounter++;
if (shotCounter > 1000) {
shotCounter = 0;
}
}
function doEnemyShot(x, y, speed, dx, dy, shotType) {
var _local1;
_local1 = mc_eshots.attachMovie("lib_pshot", "" + shotCounter, shotCounter);
_local1.init(x, y, speed, dx, dy, shotType);
if (shotType == CShot.TYPE_BOSS) {
sndLaserBoss = true;
}
shotCounter++;
if (shotCounter > 1000) {
shotCounter = 0;
}
}
function killPlayer() {
sndHeroExp = true;
doBoom(mc_player._x, mc_player._y, 150);
mc_player.toDead();
CPlayer.rocketCount = 0;
updateRockets();
lifeCount--;
updateLifes();
}
function addScores(scr) {
scores = scores + scr;
bonusScores = bonusScores + scr;
if (bonusScores > LIFE_SCORES) {
lifeCount++;
updateLifes();
bonusScores = bonusScores - LIFE_SCORES;
mc_caption.gotoAndStop("stLife");
timeCounter.setTime(2000);
messageFlag = true;
sndLife = true;
}
txtScores = scores;
}
function updateLifes() {
txtLifes = lifeCount;
}
function updateRockets() {
txtRockets = CPlayer.rocketCount;
}
function toGame() {
gameState = 1;
mc_caption.gotoAndStop("stEmpty");
messageFlag = false;
}
function winLevel() {
if (level == maxLevel) {
mc_caption.gotoAndStop("stWin");
timeCounter.setTime(50000);
mc_player.toFlyOut();
messageFlag = false;
gameState = 4;
} else {
mc_caption.gotoAndStop("stComplete");
timeCounter.setTime(3000);
mc_player.toFlyOut();
messageFlag = false;
gameState = 3;
}
}
fscommand ("showmenu", "false");
fscommand ("trapallkeys", "true");
var author = "Galimov Ruslan rigal@mail.ru";
var copyright = "www.sunnygames.com";
var lastTimer;
var level;
var maxLevel = 20;
var stopSoundFlag = false;
var scores;
var bonusScores;
var lifeCount;
var maxLifeCount = 3;
var scrHit = 10;
var scrSmallHit = 5;
var scrBonus = 10;
var scrUpperEnemy = 20;
var scrBoss = 1000;
var scrBossHit = 2;
var scrBonusBonus = 500;
var LIFE_SCORES = 4000;
var shotCounter;
var flyCounter;
var boomCounter;
var bonusCounter;
var bossLevel;
var boss;
var PLAYER_SHOT_SPEED = 200;
var ENEMY_SHOT_SPEED = 150;
var BOSS_SHOT_SPEED = 210;
var enemyBCount;
var enemyBCounter;
var ENEMY_BMAX = 15;
var slowTime = new CSlowTime();
var LHEIGHT = 400;
var gameState;
var timeCounter = new CTimeCounter();
var sndBonus;
var sndEnemyExp;
var sndHeroExp;
var sndLaserBoss;
var sndLaserHero;
var sndLaserHeroBig;
var sndRocket;
var sndLife;
var messageFlag;
var enemyBlock = new CEnemyBlock();
var keyboardFlag;
var levels = [[" 66 ", " 666666 ", " 66633666 ", " 6633333366 ", " 66633666 ", " 666666 ", " 66 "], [" 33 ", " 6 6 ", " 65 66 56 ", " 6566666656 ", " 65 66 56 ", " 6 6 ", " 33 "], [" 3355445533 ", " 3554444553 ", " 44444444 ", " 4446666444 ", " 44444444 ", " 6554444556 ", " 6655445566 "], [" 4444 ", " 44 33 44 ", " 3335555333 ", " 0 5555 0 ", " 00 33 00 ", " 0000 "], [" 0006666000 ", " 0466666640 ", " 04 6666 40 ", " 4444444444 ", " 24 5555 42 ", " 222 222 "], [" 11 11 ", " 5335115335 ", " 35111153 ", " 544445 ", " 544445 ", " 35111153 ", " 5335115335 ", " 11 11 "], [" 2121212121 ", " 1212121212 ", " 2 2 2 2 2 ", " 0 0 0 0 0 ", " 0 0 0 0 0 ", " 1616161616 ", " 6161616161 "], [" 666 444 ", " 636 434 ", " 5550550555 ", " 1115115111 ", " 5553003555 ", " 030 232 ", " 000 222 "], [" 4224 ", " 124421 ", " 2244444422 ", " 6664444666 ", " 0666446660 ", " 0066666600 ", " 306603 ", " 6006 "], [], [" 222222 ", " 25511552 ", " 2551221552 ", " 2512112152 ", " 6000220006 ", " 6600000066 ", " 66666666 ", " 666666 "], [" 331 133 ", " 0331 1330 ", " 03311330 ", " 422224 ", " 144441 ", " 13322331 ", " 0000 0000 "], [" 1111 1111 ", " 0202 2020 ", " 2020110202 ", " 22 ", " 4444116666 ", " 0004 6222 ", " 0004 6222 "], [" 0000 ", " 3 11 3 ", " 33122133 ", " 3332222333 ", " 33122133 ", " 3 22 3 ", " 0000 ", " 33 "], [" 55 55 ", " 44333344 ", " 4666666664 ", "455546645554", "443546645344", " 4333443334 ", " 44333344 ", " 443344 "], [" 1 444444 ", " 00000 1 ", " 1 222222 ", " 66666 1 ", " 1 44444 ", " 22222 1 ", " 1 00000 ", " 666666 "], [" 22222222 ", " 22000022 ", " 20022002 ", " 20222202 ", " 00022000 ", " 00000000 "], [" 451515154 ", " 2222222 ", " 666666 ", "301155551103", " 30300303 ", " 2 2 2 2 ", " 00 00 ", "44 4444 44"], [" 21212122 ", " 26666662 ", " 222222 ", "002111111200", " 222222 ", " 0 22 0 ", " 0 0 ", " 22 22 "], []];
#endinitclip
Symbol 226 MovieClip [__Packages.CSlowTime] Frame 0
class CSlowTime
{
var state, curTimer;
function CSlowTime () {
}
function reset() {
state = 0;
}
function process(dTime) {
if (state == 0) {
return(dTime);
}
if (state == 1) {
curTimer = curTimer + dTime;
if (curTimer > STOP_TIME) {
state = 2;
curTimer = 0;
}
return(dTime / 10);
}
if (state == 2) {
curTimer = curTimer + dTime;
if (curTimer >= ACC_TIME) {
state = 0;
return(dTime);
}
return(dTime * (0.1 + ((0.9 * curTimer) / ACC_TIME)));
}
}
function activate() {
state = 1;
curTimer = 0;
}
static var STOP_TIME = 4000;
static var ACC_TIME = 5000;
}
Symbol 227 MovieClip [__Packages.CTimeCounter] Frame 0
class CTimeCounter
{
var curTime;
function CTimeCounter () {
}
function setTime(time) {
curTime = time;
}
function process(dTime) {
curTime = curTime - dTime;
return(curTime > 0);
}
function endTime() {
curTime = 0;
}
}
Symbol 228 MovieClip [__Packages.CShot] Frame 0
class CShot extends MovieClip
{
var speed, dx, dy, _x, _y, shotType, lifeCount, damage, gotoAndStop, _rotation, _height, removeMovieClip;
function CShot () {
super();
}
function init(x, y, speed_, dx_, dy_, shotType_) {
speed = speed_;
dx = dx_;
dy = dy_;
_x = x;
_y = y;
shotType = shotType_;
if (shotType == TYPE_PL_LASER) {
lifeCount = 3;
} else {
lifeCount = 1;
}
if ((shotType == TYPE_PL_ROCKET) || (shotType == TYPE_PL_LASER)) {
damage = 3;
} else {
damage = 1;
}
gotoAndStop(shotType);
var _local2 = Math.sqrt((dx * dx) + (dy * dy));
dx = dx / _local2;
dy = dy / _local2;
_rotation = ((Math.atan2(dy, dx) * 180) / Math.PI) + 90;
}
function process(dTime) {
var _local2 = (speed * dTime) / 1000;
if (((shotType == TYPE_PL_LASER) || (shotType == TYPE_EN_LASER)) || (shotType == TYPE_BOSS)) {
_rotation = _rotation + ((180 * dTime) / 1000);
}
_x = _x + (_local2 * dx);
_y = _y + (_local2 * dy);
if (dy > 0) {
if ((_y - _height) > LHEIGHT) {
destroy();
return(false);
}
} else if ((_y + _height) < 0) {
destroy();
return(false);
}
return(true);
}
function decLife() {
lifeCount--;
if (lifeCount <= 0) {
destroy();
return(true);
}
return(false);
}
function destroy() {
removeMovieClip();
}
var LHEIGHT = 400;
static var TYPE_PL = 1;
static var TYPE_PL_ROCKET = 2;
static var TYPE_PL_LASER = 3;
static var TYPE_EN = 4;
static var TYPE_EN_LASER = 5;
static var TYPE_EN_BLUE = 6;
static var TYPE_BOSS = 7;
}
Symbol 229 MovieClip [__Packages.CEnemy] Frame 0
class CEnemy extends MovieClip
{
var type, maxLifeCount, lifeCount, gotoAndStop, mc, state, col, row, lastShotTime, _visible, removeMovieClip;
function CEnemy () {
super();
}
function init(type_, col_, row_) {
type = type_;
if (type == 0) {
maxLifeCount = 2;
} else if (type == 2) {
maxLifeCount = 3;
} else {
maxLifeCount = 1;
}
lifeCount = maxLifeCount;
gotoAndStop(type + 1);
mc.gotoAndStop(1);
state = 1;
col = col_;
row = row_;
lastShotTime = 0;
}
function decLife(num) {
var _local3;
lifeCount = lifeCount - num;
if (lifeCount < 0) {
lifeCount = 0;
}
mc.gotoAndStop((maxLifeCount - lifeCount) + 1);
return(lifeCount <= 0);
}
function hide() {
state = 0;
_visible = false;
gotoAndStop("st_empty");
}
function restore() {
state = 1;
_visible = true;
gotoAndStop(type + 1);
mc.gotoAndStop((maxLifeCount - lifeCount) + 1);
}
function destroy() {
removeMovieClip();
}
static var TYPE_2LIFE = 0;
static var TYPE_FLY = 1;
static var TYPE_3LIFE = 2;
}
Symbol 230 MovieClip [__Packages.CSmallEnemy] Frame 0
class CSmallEnemy extends MovieClip
{
static var player;
var _x, _y, tactic, state, _rotation, _height, removeMovieClip;
function CSmallEnemy () {
super();
}
function init(x, y) {
_x = x;
_y = y;
tactic = new CPursuitPattern();
tactic.init(this, player, SPEED, true);
state = 0;
}
function process(dTime) {
tactic.process(dTime);
if (state == 0) {
if (_y > DOWN_POINT) {
delete tactic;
tactic = new CFallPattern();
tactic.init(this, SPEED);
state = 1;
}
} else if (state == 1) {
_rotation = ((Math.atan2(player._y - _y, player._x - _x) * 180) / Math.PI) - 90;
if (_y > (LHEIGHT + (_height / 2))) {
destroy();
}
}
}
function destroy() {
removeMovieClip();
}
static var LHEIGHT = 400;
static var DOWN_POINT = LHEIGHT - 60;
static var SPEED = 50;
}
Symbol 231 MovieClip [__Packages.CPlayer] Frame 0
class CPlayer extends MovieClip
{
static var rocketCount;
var mc, shotTime, rocketTime, state, leftFlag, rightFlag, moveTime, keyboardFlag, _x, _visible, _y, _height, _width, gotoAndPlay;
function CPlayer () {
super();
}
function init() {
mc.mc_laser._visible = (mc.mc_shield._visible = false);
mc.mc_rocket._visible = rocketCount > 0;
shotTime = 0;
rocketTime = 0;
state = 1;
leftFlag = (rightFlag = false);
moveTime = 0;
keyboardFlag = false;
_x = LWIDTH / 2;
_visible = true;
}
function isHere() {
return(state == 1);
}
function isLive() {
return((state == 1) || (state == 2));
}
function process(dTime, mouseX) {
var _local2 = (speed * dTime) / 1000;
moveTime = moveTime + dTime;
if (state == 5) {
if (moveTime >= 2000) {
state = 6;
}
} else if (state == 3) {
if (moveTime < ACC_DTIME) {
_local2 = _local2 * (moveTime / ACC_DTIME);
}
_y = _y - _local2;
if (_y < ((-_height) / 2)) {
_visible = false;
state = 4;
}
} else if ((state == 1) || (state == 2)) {
if (keyboardFlag) {
if ((mouseX - _x) > 0) {
if (leftFlag) {
moveTime = 0;
}
rightFlag = true;
leftFlag = false;
} else {
if (rightFlag) {
moveTime = 0;
}
rightFlag = false;
leftFlag = true;
}
if (moveTime < ACC_DTIME) {
_local2 = _local2 * (0.2 + ((0.8 * moveTime) / ACC_DTIME));
}
} else {
moveTime = 0;
leftFlag = (rightFlag = false);
}
shotTime = shotTime + dTime;
rocketTime = rocketTime + dTime;
if (Math.abs(mouseX - _x) <= _local2) {
_x = mouseX;
} else if (mouseX > _x) {
_x = _x + _local2;
} else {
_x = _x - _local2;
}
if (_x < (_width / 2)) {
_x = _width / 2;
} else if (_x > (LWIDTH - (_width / 2))) {
_x = LWIDTH - (_width / 2);
}
}
}
function canShot() {
return(shotTime >= SHOT_DTIME);
}
function shot() {
shotTime = 0;
}
function canRocketShot() {
return((rocketTime >= ROCKET_DTIME) && (rocketCount > 0));
}
function rocketShot() {
rocketCount = rocketCount - 2;
rocketTime = 0;
updateRocketView();
}
function addRockets() {
rocketCount = rocketCount + ADD_ROCKET_COUNT;
updateRocketView();
}
function addLaser() {
mc.mc_laser._visible = true;
}
function hasLaser() {
return(mc.mc_laser._visible);
}
function shotLaser() {
mc.mc_laser._visible = false;
}
function addShield() {
mc.mc_shield._visible = true;
}
function doHit() {
if (mc.mc_shield._visible) {
mc.mc_shield._visible = false;
return(false);
}
return(true);
}
function myHitTest(hit) {
if (mc.mc_shield._visible) {
return(mc.mc_bonHit.hitTest(hit));
}
return(mc.mc_hit.hitTest(hit));
}
function updateRocketView() {
if (rocketCount > 0) {
mc.mc_rocket._visible = true;
} else {
mc.mc_rocket._visible = false;
}
}
function toMig() {
state = 2;
gotoAndPlay(2);
}
function endMig() {
if (state == 2) {
state = 1;
}
}
function toFlyOut() {
state = 3;
moveTime = 0;
}
function toDead() {
state = 5;
moveTime = 0;
_visible = false;
}
function isDeadTooLong() {
return(state == 6);
}
function isEndFly() {
return(state == 4);
}
var speed = 400;
var LWIDTH = 550;
var ADD_ROCKET_COUNT = 6;
var SHOT_DTIME = 650;
var ROCKET_DTIME = 200;
static var ACC_DTIME = 500;
}
Symbol 232 MovieClip [__Packages.CProcessPatternInterface] Frame 0
interface CProcessPatternInterface
{
}
Symbol 233 MovieClip [__Packages.CPursuitPattern] Frame 0
class CPursuitPattern implements CProcessPatternInterface
{
var mc, goalMC, speed, rotateFlag;
function CPursuitPattern () {
}
function init(mc_, goalMC_, speed_, rotateFlag_) {
mc = mc_;
goalMC = goalMC_;
speed = speed_;
rotateFlag = rotateFlag_;
}
function process(dTime) {
var _local4 = (speed * dTime) / 1000;
var _local3 = goalMC._x - mc._x;
var _local2 = goalMC._y - mc._y;
var _local6 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
var _local5;
_local3 = _local3 / _local6;
_local2 = _local2 / _local6;
_local5 = (_local3 * _local4) * 1.1;
if (Math.abs(mc._x - goalMC._x) <= Math.abs(_local5)) {
mc._x = goalMC._x;
} else {
mc._x = mc._x + _local5;
}
mc._y = mc._y + (_local2 * _local4);
if (rotateFlag) {
mc._rotation = ((Math.atan2(_local2, _local3) * 180) / Math.PI) - 90;
}
}
}
Symbol 234 MovieClip [__Packages.CFallPattern] Frame 0
class CFallPattern implements CProcessPatternInterface
{
var mc, speed;
function CFallPattern () {
}
function init(mc_, speed_) {
mc = mc_;
speed = speed_;
}
function process(dTime) {
mc._y = mc._y + ((speed * dTime) / 1000);
}
}
Symbol 235 MovieClip [__Packages.CEnemyBlock] Frame 0
class CEnemyBlock
{
var enemy_arr, enemyNum_arr, enemyType_arr, flyEnemy_arr, shotCurTimes, shotArray, mc_e, curEnemyCount, flyDTime, flyCurTime, recalcSpeedFlag, localTime, dir, startEnemyCount, speed, blockWidth, downStep, blockDX;
function CEnemyBlock () {
var _local2;
enemy_arr = new Array(MAX_COLS);
enemyNum_arr = new Array(MAX_COLS);
enemyType_arr = new Array(TYPES_COUNT);
_local2 = 0;
while (_local2 < MAX_COLS) {
enemy_arr[_local2] = new Array(MAX_ROWS);
_local2++;
}
flyEnemy_arr = null;
shotCurTimes = new Array(SHOT_COUNT);
shotArray = null;
}
function getMC() {
return(mc_e);
}
function isLive() {
return(curEnemyCount > 0);
}
function init(mc_enemies) {
var _local2;
var _local3;
mc_e = mc_enemies;
_local2 = 0;
while (_local2 < MAX_COLS) {
enemyNum_arr[_local2] = 0;
_local3 = 0;
while (_local3 < MAX_ROWS) {
enemy_arr[_local2][_local3] = null;
_local3++;
}
_local2++;
}
_local2 = 0;
while (_local2 < TYPES_COUNT) {
enemyType_arr[_local2] = 0;
_local2++;
}
flyDTime = FLY_DTIME_MAX;
flyCurTime = 0;
if (flyEnemy_arr != null) {
delete flyEnemy_arr;
}
flyEnemy_arr = new Array();
recalcSpeedFlag = false;
_local2 = 0;
while (_local2 < SHOT_COUNT) {
shotCurTimes[_local2] = SHOT_MINTIME + random(SHOT_MAXTIME - SHOT_MINTIME);
_local2++;
}
localTime = 0;
if (shotArray != null) {
delete shotArray;
}
shotArray = new Array();
}
function setLevel(level_arr) {
var _local8 = level_arr.length;
var _local3;
var _local5;
var _local7;
var _local2;
var _local6 = 0;
var _local4;
curEnemyCount = 0;
_local5 = 0;
while (_local5 < _local8) {
_local7 = level_arr[_local5];
_local3 = 0;
while (_local3 < MAX_COLS) {
_local2 = _local7.charCodeAt(_local3) - 48;
if ((_local2 >= 0) && (_local2 <= 6)) {
_local4 = mc_e.attachMovie("lib_enemy", "" + _local6, _local6);
_local6++;
_local4.init(_local2, _local3, _local5);
addEnemy(_local4, _local3, _local5);
enemyType_arr[_local2]++;
if (_local2 == CEnemy.TYPE_FLY) {
flyEnemy_arr.push(_local4);
}
curEnemyCount++;
}
_local3++;
}
_local5++;
}
mc_e._x = (LWIDTH - (MAX_COLS * ENEMY_DX)) / 2;
mc_e._y = 50;
if (Math.random() > 0.5) {
dir = 1;
} else {
dir = -1;
}
recalcSpeedFlag = true;
startEnemyCount = curEnemyCount;
}
function addEnemy(enemy, col, row) {
enemy_arr[col][row] = enemy;
enemyNum_arr[col]++;
enemy._x = getX(col);
enemy._y = getY(row);
}
function getX(col) {
return((col + 0.5) * ENEMY_DX);
}
function getY(row) {
return((row + 0.5) * ENEMY_DY);
}
function doShot() {
var _local9;
var _local5;
var _local4 = random(MAX_COLS);
var _local3 = random(MAX_ROWS);
var _local2;
var _local6;
_local9 = 0;
while (_local9 < MAX_COLS) {
_local5 = 0;
while (_local5 < MAX_ROWS) {
_local2 = enemy_arr[_local4][_local3];
if (((_local2 != null) && (_local2.state == 1)) && ((localTime - _local2.lastShotTime) > SHOT_DTIME)) {
if (_local2.type == CEnemy.TYPE_2LIFE) {
_local6 = CShot.TYPE_EN_BLUE;
} else if (_local2.type == CEnemy.TYPE_3LIFE) {
_local6 = CShot.TYPE_EN_LASER;
} else {
_local6 = CShot.TYPE_EN;
}
shotArray.push({x:_local2._x + mc_e._x, y:_local2._y + mc_e._y, shotType:_local6});
_local2.lastShotTime = localTime;
return(true);
}
_local4++;
if (_local4 == MAX_COLS) {
_local4 = 0;
_local3++;
if (_local3 == MAX_ROWS) {
_local3 = 0;
}
}
_local5++;
}
_local9++;
}
return(false);
}
function process(dTime) {
var _local2;
var _local4 = (speed * dTime) / 1000;
_local2 = 0;
while (_local2 < SHOT_COUNT) {
shotCurTimes[_local2] = shotCurTimes[_local2] - dTime;
if (shotCurTimes[_local2] <= 0) {
if (doShot()) {
shotCurTimes[_local2] = SHOT_MINTIME + random(SHOT_MAXTIME - SHOT_MINTIME);
}
}
_local2++;
}
localTime = localTime + dTime;
if (dir == 1) {
mc_e._x = mc_e._x + _local4;
if ((mc_e._x + blockWidth) > LWIDTH) {
mc_e._x = (LWIDTH - blockWidth) - ((mc_e._x + blockWidth) - LWIDTH);
dir = -1;
mc_e._y = mc_e._y + downStep;
}
} else {
mc_e._x = mc_e._x - _local4;
if ((mc_e._x + blockDX) < 0) {
mc_e._x = (-blockDX) - (mc_e._x + blockDX);
dir = 1;
mc_e._y = mc_e._y + downStep;
}
}
if (enemyType_arr[CEnemy.TYPE_FLY] > 0) {
flyCurTime = flyCurTime + dTime;
}
}
function getEnemy(x, y, mc_hit) {
var _local4;
var _local3;
var _local7 = {x:x, y:y};
var _local2 = null;
_local4 = Math.round(((x - mc_e._x) / ENEMY_DX) - 0.5);
_local3 = Math.round(((y - mc_e._y) / ENEMY_DY) - 0.5);
if ((((_local4 >= 0) && (_local4 < MAX_COLS)) && (_local3 >= 0)) && (_local3 < MAX_ROWS)) {
_local2 = enemy_arr[_local4][_local3];
}
if (_local2 == null) {
return(null);
}
if (_local2.mc.mc_hit.hitTest(mc_hit)) {
return(_local2);
}
return(null);
}
function killEnemy(enemy) {
enemy_arr[enemy.col][enemy.row] = null;
enemyType_arr[enemy.type]--;
curEnemyCount--;
enemyNum_arr[enemy.col]--;
enemy.destroy();
recalcSpeedFlag = true;
}
function toNull(enemy) {
enemy_arr[enemy.col][enemy.row] = null;
enemy.destroy();
}
function getFlyEnemy() {
if ((enemyType_arr[CEnemy.TYPE_FLY] == 0) || (flyCurTime <= flyDTime)) {
return(null);
}
flyCurTime = 0;
flyDTime = FLY_DTIME_MIN + (Math.random() * (FLY_DTIME_MAX - FLY_DTIME_MIN));
var _local3;
var _local5 = flyEnemy_arr.length;
var _local4;
var _local2 = random(_local5);
_local4 = 0;
while (_local4 < _local5) {
if ((flyEnemy_arr[_local2] != undefined) && (flyEnemy_arr[_local2].state == 1)) {
_local3 = flyEnemy_arr[_local2];
_local3.hide();
enemyType_arr[CEnemy.TYPE_FLY]--;
curEnemyCount--;
enemy_arr[_local3.col][_local3.row] = null;
enemyNum_arr[_local3.col]--;
recalcSpeedFlag = true;
return(_local3);
}
_local2++;
if (_local2 == _local5) {
_local2 = 0;
}
_local4++;
}
trace("OLA-LA! in CEnemyBlock.getFlyEnemy()");
}
function returnFlyEnemy(enemy_mc) {
enemy_mc.restore();
enemyType_arr[CEnemy.TYPE_FLY]++;
enemyNum_arr[enemy_mc.col]++;
curEnemyCount++;
recalcSpeedFlag = true;
}
function recalcSpeed() {
downStep = (DOWN_STEP * curEnemyCount) / startEnemyCount;
if (curEnemyCount >= (startEnemyCount / 2)) {
downStep = downStep + 2;
} else if (curEnemyCount >= (startEnemyCount / 4)) {
downStep = downStep + 1;
}
recalcSpeedFlag = false;
var _local2;
var _local4;
var _local3;
_local2 = 0;
while (_local2 < MAX_COLS) {
if (enemyNum_arr[_local2] > 0) {
blockDX = ENEMY_DX * _local2;
_local4 = _local2;
break;
}
_local2++;
}
_local2 = MAX_COLS - 1;
while (_local2 >= 0) {
if (enemyNum_arr[_local2] > 0) {
blockWidth = (_local2 + 1) * ENEMY_DX;
_local3 = _local2;
break;
}
_local2--;
}
speed = (((1 - (((_local3 - _local4) + 1) / MAX_COLS)) + 1) - (curEnemyCount / startEnemyCount)) / 2;
speed = 0.1 + (0.9 * speed);
speed = speed * 170;
}
function getFreeRandomPlace(point, enemy_mc) {
var _local7;
var _local6;
var _local2 = random(MAX_COLS);
var _local3 = Math.round(random(MAX_ROWS / 2));
_local7 = 0;
while (_local7 < MAX_COLS) {
_local6 = 0;
while (_local6 < MAX_ROWS) {
if ((enemyNum_arr[_local2] > 0) && (enemy_arr[_local2][_local3] == null)) {
point.x = getX(_local2);
point.y = getY(_local3);
enemy_arr[_local2][_local3] = enemy_mc;
enemy_mc.col = _local2;
enemy_mc.row = _local3;
enemy_mc._x = point.x;
enemy_mc._y = point.y;
return(undefined);
}
_local2++;
if (_local2 == MAX_COLS) {
_local2 = 0;
_local3++;
if (_local3 == MAX_ROWS) {
_local3 = 0;
}
}
_local6++;
}
_local7++;
}
_local2 = enemy_mc.col;
_local3 = enemy_mc.row;
point.x = getX(_local2);
point.y = getY(_local3);
enemy_arr[_local2][_local3] = enemy_mc;
enemy_mc._x = point.x;
enemy_mc._y = point.y;
}
var LWIDTH = 550;
static var TYPES_COUNT = 7;
var MAX_COLS = 12;
var MAX_ROWS = 8;
var ENEMY_DX = 40;
var ENEMY_DY = 30;
static var DOWN_STEP = 6;
static var FLY_DTIME_MAX = 6000;
static var FLY_DTIME_MIN = 1000;
static var SHOT_DTIME = 1000;
static var SHOT_MINTIME = 3000;
static var SHOT_MAXTIME = 6500;
static var SHOT_COUNT = 3;
}
Symbol 236 MovieClip [__Packages.CFlyEnemy] Frame 0
class CFlyEnemy extends MovieClip
{
static var player, enemyBlock;
var myFriend, _parent, _x, _y, tactic, state, returnFlag, startP, stop, _height, _width, removeMovieClip;
function CFlyEnemy () {
super();
}
function init(myFriend_) {
myFriend = myFriend_;
var _local2 = {x:myFriend._x, y:myFriend._y};
myFriend._parent.localToGlobal(_local2);
_parent.globalToLocal(_local2);
_x = _local2.x;
_y = _local2.y;
tactic = new CPursuitPattern();
tactic.init(this, player, SPEED, false);
state = 0;
returnFlag = false;
startP = {x:0, y:0};
enemyBlock.getFreeRandomPlace(startP, myFriend);
stop();
}
function process(dTime) {
tactic.process(dTime);
if (state == 0) {
if (_y >= DOWN_POINT) {
delete tactic;
tactic = new CFallPattern();
tactic.init(this, SPEED);
state = 1;
}
} else if (state == 1) {
if ((_y + (_height / 2)) > LHEIGHT) {
_y = (-_height) / 2;
delete tactic;
tactic = new CGoToPointPattern();
tactic.init(this, enemyBlock.getMC(), SPEED, startP.x, startP.y);
state = 2;
}
} else if (state == 2) {
var _local2 = enemyBlock.getMC();
if (_x < (_width / 2)) {
_x = _width / 2;
} else if (_x > (LWIDTH - (_width / 2))) {
_x = LWIDTH - (_width / 2);
}
if ((Math.abs((_x - _local2._x) - startP.x) + Math.abs((_y - _local2._y) - startP.y)) < 1) {
state = 3;
}
}
}
function endFly() {
return(state == 3);
}
function returnEnemy() {
enemyBlock.returnFlyEnemy(myFriend);
}
function destroy() {
removeMovieClip();
}
static var LHEIGHT = 400;
static var LWIDTH = 550;
static var DOWN_POINT = LHEIGHT - 60;
static var SPEED = 100;
}
Symbol 237 MovieClip [__Packages.CGoToPointPattern] Frame 0
class CGoToPointPattern implements CProcessPatternInterface
{
var mc, speed, goalMC, gX, gY;
function CGoToPointPattern () {
}
function init(mc_, goalMC_, speed_, gX_, gY_) {
mc = mc_;
speed = speed_;
goalMC = goalMC_;
gX = gX_;
gY = gY_;
}
function process(dTime) {
var _local4 = (speed * dTime) / 1000;
var _local3 = (goalMC._x + gX) - mc._x;
var _local2 = (goalMC._y + gY) - mc._y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
if (_local5 < _local4) {
mc._x = goalMC._x + gX;
mc._y = goalMC._y + gY;
} else {
_local3 = _local3 / _local5;
_local2 = _local2 / _local5;
mc._x = mc._x + (_local3 * _local4);
mc._y = mc._y + (_local2 * _local4);
}
}
}
Symbol 238 MovieClip [__Packages.CBonEnemy] Frame 0
class CBonEnemy extends MovieClip
{
var speed, stopFlag, timeCounter, _x, _width, _y, gotoAndStop, state, mc_point, localToGlobal, _parent;
function CBonEnemy () {
super();
speed = 25;
destroy();
stopFlag = false;
}
function activate() {
timeCounter = 0;
_x = LWIDTH + (_width / 2);
_y = 30;
gotoAndStop(1);
state = 1;
}
function isLive() {
return(state == 1);
}
function process(dTime) {
var _local2 = (speed * dTime) / 1000;
timeCounter = timeCounter + dTime;
if (state == 0) {
if (timeCounter >= START_DTIME) {
if (!stopFlag) {
activate();
}
}
}
if (state == 1) {
_x = _x - _local2;
if (_x < ((-_width) / 2)) {
destroy();
}
}
}
function hasSmallEnemy(point) {
if ((((state == 0) || (_x < ACTIVE_WIDTH)) || (_x > (LWIDTH - ACTIVE_WIDTH))) || (timeCounter < SMALL_START_DTIME)) {
return(false);
}
timeCounter = 0;
point.x = mc_point._x;
point.y = mc_point._y;
localToGlobal(point);
_parent.globalToLocal(point);
return(true);
}
function destroy() {
timeCounter = 0;
gotoAndStop("st_empty");
state = 0;
}
static var LWIDTH = 550;
static var START_DTIME = 16000;
static var ACTIVE_WIDTH = 80;
static var SMALL_START_DTIME = 1800;
}
Symbol 239 MovieClip [__Packages.CBonus] Frame 0
class CBonus extends MovieClip
{
var _x, _y, bonusType, gotoAndStop, _height, removeMovieClip;
function CBonus () {
super();
}
function init(x, y) {
_x = x;
_y = y;
bonusType = random(6) + 1;
if (bonusType == lastBonusNum) {
if (random(2) == 0) {
bonusType++;
if (bonusType > BONUS_STOP) {
bonusType = BONUS_LASER;
}
} else {
bonusType--;
if (bonusType < BONUS_LASER) {
bonusType = BONUS_STOP;
}
}
}
lastBonusNum = bonusType;
gotoAndStop(bonusType);
}
function process(dTime) {
var _local2 = (SPEED * dTime) / 1000;
_y = _y + _local2;
if ((_y + (_height / 2)) > LHEIGHT) {
destroy();
}
}
function destroy() {
removeMovieClip();
}
static var LHEIGHT = 400;
static var BONUS_LASER = 1;
static var BONUS_POWER = 2;
static var BONUS_ROCKET = 3;
static var BONUS_SCORE = 4;
static var BONUS_SHIELD = 5;
static var BONUS_STOP = 6;
static var lastBonusNum = -1;
static var SPEED = 50;
}
Symbol 240 MovieClip [__Packages.CBoss] Frame 0
class CBoss extends MovieClip
{
var lifeCount, myRoot, tactic, smallsArray, shotsArray, shotTime, downShot, state, mc, _parent, boomTime, _x, _y, _visible, startLifeCount, gotoAndPlay;
function CBoss () {
super();
}
function getLifeCount() {
return(lifeCount);
}
function init(myRoot_) {
myRoot = myRoot_;
tactic = new CSinXMovePattern();
tactic.init(this, speed, 1, startX, startY);
tactic.setSinParams(40, 2, 0);
smallsArray = new Array();
shotsArray = new Array();
shotTime = 0;
downShot = true;
state = 0;
}
function process(dTime) {
if (state == 4) {
return(undefined);
}
tactic.process(dTime);
shotTime = shotTime + dTime;
if (shotTime > SHOT_DTIME) {
var _local2 = {x:0, y:0};
shotTime = 0;
if (state == 0) {
if (downShot) {
_local2.x = mc.mc_hole2._x;
_local2.y = mc.mc_hole2._y;
mc.localToGlobal(_local2);
_parent.globalToLocal(_local2);
smallsArray.push({x:_local2.x, y:_local2.y});
_local2.x = mc.mc_hole3._x;
_local2.y = mc.mc_hole3._y;
mc.localToGlobal(_local2);
_parent.globalToLocal(_local2);
smallsArray.push({x:_local2.x, y:_local2.y});
} else {
_local2.x = mc.mc_hole1._x;
_local2.y = mc.mc_hole1._y;
mc.localToGlobal(_local2);
_parent.globalToLocal(_local2);
smallsArray.push({x:_local2.x, y:_local2.y});
}
} else if (state == 1) {
if (downShot) {
_local2.x = mc.mc_shot._x;
_local2.y = mc.mc_shot._y;
mc.localToGlobal(_local2);
_parent.globalToLocal(_local2);
shotsArray.push({x:_local2.x, y:_local2.y});
} else {
_local2.x = mc.mc_hole1._x;
_local2.y = mc.mc_hole1._y;
mc.localToGlobal(_local2);
_parent.globalToLocal(_local2);
smallsArray.push({x:_local2.x, y:_local2.y});
}
} else if (state == 2) {
_local2.x = mc.mc_shot._x;
_local2.y = mc.mc_shot._y;
mc.localToGlobal(_local2);
_parent.globalToLocal(_local2);
shotsArray.push({x:_local2.x, y:_local2.y});
}
downShot = !downShot;
}
if (state == 3) {
boomTime = boomTime + dTime;
if (boomTime >= BOOM_DTIME) {
boomTime = 0;
myRoot.doBoom((_x + 30) - random(60), (_y + 30) - random(60), 100);
}
if ((_y - 100) > LHEIGHT) {
_visible = false;
state = 4;
}
} else if (_x > (startX + maxDx)) {
tactic.goLeft();
} else if (_x < (startX - maxDx)) {
tactic.goRight();
}
}
function setLevel(level) {
lifeCount = Math.round((level / 10) * 200);
startLifeCount = lifeCount;
}
function isLive() {
return(state < 3);
}
function myHitTest(hit) {
return(mc.mc_hit.hitTest(hit));
}
function doHit(shot) {
if (shot.shotType == CShot.TYPE_PL) {
lifeCount = lifeCount - 5;
} else if (shot.shotType == CShot.TYPE_PL_ROCKET) {
lifeCount = lifeCount - 10;
} else if (shot.shotType == CShot.TYPE_PL_LASER) {
lifeCount = lifeCount - 15;
}
if ((state == 0) && (lifeCount <= ((startLifeCount * 2) / 3))) {
mc.mc_lgun._visible = (mc.mc_rgun._visible = false);
state = 1;
var _local2 = {x:0, y:0};
_local2.x = mc.mc_lgun._x;
_local2.y = mc.mc_lgun._y;
mc.localToGlobal(_local2);
_parent.globalToLocal(_local2);
myRoot.doBoom(_local2.x, _local2.y, 70);
_local2.x = mc.mc_rgun._x;
_local2.y = mc.mc_rgun._y;
mc.localToGlobal(_local2);
_parent.globalToLocal(_local2);
myRoot.doBoom(_local2.x, _local2.y, 70);
} else if ((state == 1) && (lifeCount <= (startLifeCount / 3))) {
mc.mc_cgun._visible = false;
state = 2;
var _local2 = {x:0, y:0};
_local2.x = mc.mc_cgun._x;
_local2.y = mc.mc_cgun._y;
mc.localToGlobal(_local2);
_parent.globalToLocal(_local2);
myRoot.doBoom(_local2.x, _local2.y, 70);
}
if (lifeCount <= 0) {
lifeCount = 0;
toDead();
} else {
toMig();
}
}
function isDead() {
return(state == 4);
}
function toMig() {
gotoAndPlay(2);
}
function toDead() {
state = 3;
delete tactic;
tactic = new CFallAndRotatePattern();
tactic.init(this);
boomTime = BOOM_DTIME;
}
var LWIDTH = 550;
var LHEIGHT = 400;
var speed = 150;
var startY = 150;
var startX = CBoss.prototype.LWIDTH / 2;
var maxDx = 135;
static var BOOM_DTIME = 600;
static var SHOT_DTIME = 1750;
}
Symbol 241 MovieClip [__Packages.CSinXMovePattern] Frame 0
class CSinXMovePattern implements CProcessPatternInterface
{
var mc, speed, dir, x0, y0, fA, fB, fC;
function CSinXMovePattern () {
}
function init(mc_, speed_, dir_, x0_, y0_) {
mc = mc_;
speed = speed_;
dir = dir_;
mc._x = (x0 = x0_);
mc._y = (y0 = y0_);
}
function setSinParams(fA_, fB_, fC_) {
fA = fA_;
fB = fB_;
fC = fC_;
}
function process(dTime) {
var _local2 = (speed * dTime) / 1000;
mc._x = mc._x + (_local2 * dir);
mc._y = formSinX(mc._x);
}
function goLeft() {
dir = -1;
}
function goRight() {
dir = 1;
}
function formSinX(x) {
return((fA * Math.sin((((fB * (x - x0)) + fC) / 180) * Math.PI)) + y0);
}
}
Symbol 242 MovieClip [__Packages.CFallAndRotatePattern] Frame 0
class CFallAndRotatePattern implements CProcessPatternInterface
{
var mc;
function CFallAndRotatePattern () {
}
function init(mc_) {
mc = mc_;
}
function process(dTime) {
mc._y = mc._y + ((fallSpeed * dTime) / 1000);
mc._rotation = mc._rotation - ((rotateSpeed * dTime) / 1000);
}
var fallSpeed = 100;
var rotateSpeed = 80;
}
Symbol 243 MovieClip [__Packages.CIndicator] Frame 0
class CIndicator extends MovieClip
{
var maxVal, txt, mc_bar;
function CIndicator () {
super();
}
function init(maxVal_) {
maxVal = maxVal_;
txt = (maxVal + "/") + maxVal;
}
function setValue(val) {
if (val < 0) {
val = 0;
}
mc_bar._x = ((-(maxVal - val)) / maxVal) * WIDTH;
txt = (val + "/") + maxVal;
}
var WIDTH = 250;
}
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 22 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 25 MovieClip [lib_flyEnemy] Frame 1
#initclip 26
Object.registerClass("lib_flyEnemy", CFlyEnemy);
#endinitclip
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 25 MovieClip [lib_flyEnemy] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 32 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 35 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 38 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 41 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 44 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 45 MovieClip [lib_enemy] Frame 1
#initclip 20
Object.registerClass("lib_enemy", CEnemy);
#endinitclip
this.stop();
Symbol 61 MovieClip [lib_pshot] Frame 1
#initclip 21
Object.registerClass("lib_pshot", CShot);
#endinitclip
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 61 MovieClip [lib_pshot] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 56 MovieClip "mc_hit" in Symbol 61 MovieClip [lib_pshot] Frame 3
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 61 MovieClip [lib_pshot] Frame 4
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 56 MovieClip "mc_hit" in Symbol 61 MovieClip [lib_pshot] Frame 5
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 61 MovieClip [lib_pshot] Frame 6
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 56 MovieClip "mc_hit" in Symbol 61 MovieClip [lib_pshot] Frame 7
onClipEvent (load) {
this._visible = false;
}
Symbol 65 MovieClip [lib_bonEnemy] Frame 1
#initclip 22
Object.registerClass("lib_bonEnemy", CBonEnemy);
#endinitclip
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 65 MovieClip [lib_bonEnemy] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 68 MovieClip [lib_smallEnemy] Frame 1
#initclip 23
Object.registerClass("lib_smallEnemy", CSmallEnemy);
#endinitclip
Instance of Symbol 56 MovieClip "mc_hit" in Symbol 68 MovieClip [lib_smallEnemy] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 110 MovieClip [lib_boom] Frame 23
this.removeMovieClip();
Symbol 123 MovieClip [lib_bonus] Frame 1
#initclip 24
Object.registerClass("lib_bonus", CBonus);
#endinitclip
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 135 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 136 MovieClip [lib_boss] Frame 1
#initclip 25
Object.registerClass("lib_boss", CBoss);
#endinitclip
this.stop();
Symbol 154 Button
on (release) {
new_game_pressed();
}
Symbol 159 Button
on (release) {
how_to_play_pressed();
}
Symbol 164 Button
on (release) {
more_pressed();
}
Symbol 166 MovieClip Frame 1
stop();
Symbol 168 Button
on (press) {
this._parent.soundOff();
this.gotoAndStop(2);
}
Symbol 170 Button
on (press) {
this._parent.soundOn();
this.gotoAndStop(1);
}
Symbol 171 MovieClip Frame 1
this.stop();
Symbol 182 MovieClip [mc_health_ind] Frame 1
#initclip 28
Object.registerClass("mc_health_ind", CIndicator);
#endinitclip
Instance of Symbol 17 MovieClip "mc_bonHit" in Symbol 196 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 17 MovieClip "mc_hit" in Symbol 196 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 197 MovieClip [mc_player] Frame 1
#initclip 27
Object.registerClass("mc_player", CPlayer);
#endinitclip
this.stop();
Symbol 197 MovieClip [mc_player] Frame 33
this.endMig();
Symbol 217 Button
on (press) {
this._parent.more_pressed();
}
Symbol 225 MovieClip Frame 1
this.stop();