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 27 MovieClip "mc_sounds" in Frame 5
onClipEvent (load) {
CGP.createSounds(this);
}
Instance of Symbol 294 MovieClip "mc_sloop" in Frame 5
onClipEvent (load) {
var soundControl = new Sound(this);
}
Instance of Symbol 299 MovieClip "btn_sound" in Frame 5
onClipEvent (load) {
if (this._parent.stopSoundFlag) {
this.gotoAndStop(2);
}
}
Frame 7
this.stop();
Instance of Symbol 27 MovieClip "mc_control" in Frame 7
onClipEvent (load) {
this._parent.initLevel();
}
onClipEvent (enterFrame) {
this._parent.processGame();
}
onClipEvent (keyDown) {
CGP.keyPressedHandler();
}
onClipEvent (mouseDown) {
CGP.mouseDownHandler();
}
onClipEvent (mouseMove) {
CGP.mouseMoveHandler();
updateAfterEvent();
}
Symbol 1 MovieClip Frame 1
#initclip 15
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/?utm_source=Onslaught&utm_medium=flashGame", "_blank");
}
function back_pressed() {
this.gotoAndStop("main");
}
function inMenuFirst() {
mc_sloop.gotoAndStop(2);
CGP.createObjects();
}
function gameStart() {
CGP.lifesCount = CGP.START_LIFES_COUNT;
CGP.healthCount = CGP.MAX_HEALTH_COUNT;
CGP.score = 0;
CGP.level = 0;
nextLevel();
}
function nextLevel() {
CGP.level++;
CGP.restartLevel = false;
CGP.hasPacman = (CGP.level % 3) == 0;
this.gotoAndStop("reset");
this.gotoAndStop("game");
}
function newGame() {
this.gotoAndStop("main");
}
function playSnd(lib_snd) {
s = new Sound(this);
s.attachSound(lib_snd);
s.start();
}
function initLevel() {
lastTimer = getTimer();
CGP.setRootMovie(this);
CGP.setEnemiesMovie(mc_enemies);
CGP.setGrenadesMovie(mc_grenades);
CGP.setBombsMovie(mc_bombs);
CGP.setBoatsMovie(mc_boats);
CGP.setPlanesMovie(mc_planes);
CGP.setGunMovie(CGun(mc_gun));
CGP.setShots1Movie(mc_shots1);
CGP.setShots2Movie(mc_shots2);
CGP.setShotHitMovie(mc_shot_hit);
CGP.mc_pacman = CPacman(mc_pacman);
CGP.init();
_root.createEmptyMovieClip("mc", 0);
}
function processGame() {
var _local2;
var _local1;
_local2 = getTimer();
_local1 = _local2 - lastTimer;
txtFps = 1 / (_local1 / 1000);
lastTimer = _local2;
if (_local1 > 500) {
_local1 = 500;
}
CGP.process(_local1);
}
function testDrawing() {
mc.removeMovieClip();
createEmptyMovieClip("mc", 0);
var _local1 = {x:0, y:0, k:0};
mc.lineStyle(1, 16755200, 100);
CGP.objTransform.getScreenXY(CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, 0, _local1);
mc.moveTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(-CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, 0, _local1);
mc.lineTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(-CGP.WORLD_WIDTH, -CGP.WORLD_HEIGHT, 0, _local1);
mc.lineTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(CGP.WORLD_WIDTH, -CGP.WORLD_HEIGHT, 0, _local1);
mc.lineTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, 0, _local1);
mc.lineTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, CGP.objTransform.depth / 2, _local1);
mc.moveTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(-CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, CGP.objTransform.depth / 2, _local1);
mc.lineTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(-CGP.WORLD_WIDTH, -CGP.WORLD_HEIGHT, CGP.objTransform.depth / 2, _local1);
mc.lineTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(CGP.WORLD_WIDTH, -CGP.WORLD_HEIGHT, CGP.objTransform.depth / 2, _local1);
mc.lineTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, CGP.objTransform.depth / 2, _local1);
mc.lineTo(_local1.x, _local1.y);
mc.lineStyle(2, 16776960, 100);
CGP.objTransform.getScreenXY(CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, CGP.objTransform.depth, _local1);
mc.moveTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(-CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, CGP.objTransform.depth, _local1);
mc.lineTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(-CGP.WORLD_WIDTH, -CGP.WORLD_HEIGHT, CGP.objTransform.depth, _local1);
mc.lineTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(CGP.WORLD_WIDTH, -CGP.WORLD_HEIGHT, CGP.objTransform.depth, _local1);
mc.lineTo(_local1.x, _local1.y);
CGP.objTransform.getScreenXY(CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, CGP.objTransform.depth, _local1);
mc.lineTo(_local1.x, _local1.y);
var _local4 = {x:0, y:0, k:0};
var _local5 = {x:0, y:0, k:0};
CGP.objTransform.getScreenXY(-CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, 0, _local4);
CGP.objTransform.getScreenXY(-CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, CGP.objTransform.depth / 2, _local5);
var _local3 = CGP.LM_COLS;
var _local2;
var _local7 = (CGP.LEVEL_WIDTH - (_local5.x * 2)) / _local3;
var _local6 = (CGP.LEVEL_WIDTH - (_local4.x * 2)) / _local3;
mc.lineStyle(2, 16711680, 100);
_local2 = 0;
while (_local2 <= _local3) {
mc.moveTo(_local5.x + (_local7 * _local2), _local5.y);
mc.lineTo(_local4.x + (_local6 * _local2), _local4.y);
_local2++;
}
_local3 = CGP.LM_ROWS;
var _local8 = (CGP.objTransform.depth / 2) / _local3;
mc.lineStyle(2, 16711680, 100);
_local2 = 0;
while (_local2 <= _local3) {
CGP.objTransform.getScreenXY(-CGP.WORLD_WIDTH, CGP.WORLD_HEIGHT, _local8 * _local2, _local1);
mc.moveTo(_local1.x, _local1.y);
mc.lineTo(CGP.LEVEL_WIDTH - _local1.x, _local1.y);
_local2++;
}
}
var author = "Galimov Ruslan rigal@mail.ru";
var copyright = "www.sunnygames.com";
fscommand ("showmenu", "false");
fscommand ("trapallkeys", "true");
var lastTimer;
var stopSoundFlag = false;
#endinitclip
Symbol 360 MovieClip [__Packages.CGP] Frame 0
class CGP
{
static var mc_sounds, mc_root, mc_enemies, mc_grenades, mc_bombs, mc_boats, mc_planes, mc_gun, mc_shots1, mc_shots2, mc_shot_hit, objTransform, levelMatrix, depthSortArray, boatArray, boatPresentArray, boatSortArray, boatSortFunc, depthSortFunc, COL_WIDTH, COL_HEIGHT, MATRIX_FIELD_HEIGHT, iNumForVictory, level, hasPacman, pacmanManCount, mc_pacman, iMaxBoats, fBoatTimeShift, fPlaneTimeShift, iMaxPlane, iMaxPlaneLevel, fTankCoeff, fSpeedCoeff, fFireSpeedCoeff, restartLevel, fTankCurCoeff, iCurBoats, fBoatTime, curSoldiersCount, curTanksCount, enemiesCounter, planesCounter, hitCounter, boomHitCounter, fPlaneTime, healthCount, iCurNumForVictory, score, gameState, mouseVisible, lastGoSound, lastTankSound, lifesCount;
function CGP () {
}
static function createSounds(mc) {
var _local1;
var _local2;
mc_sounds = mc;
_local2 = soundsArray.length;
_local1 = 0;
while (_local1 < _local2) {
soundsArray[_local1].snd = new Sound(mc_sounds);
soundsArray[_local1].snd.attachSound(soundsArray[_local1].name);
_local1++;
}
}
static function playSound(i) {
if (!mc_root.stopSoundFlag) {
soundsArray[i].go = true;
}
}
static function processSounds() {
var _local1;
var _local2;
_local2 = soundsArray.length;
_local1 = 0;
while (_local1 < _local2) {
if (soundsArray[_local1].go) {
soundsArray[_local1].snd.start();
break;
}
_local1++;
}
_local1 = 0;
while (_local1 < _local2) {
soundsArray[_local1].go = false;
_local1++;
}
}
static function setRootMovie(mc_root_) {
mc_root = mc_root_;
}
static function setEnemiesMovie(mc_enemies_) {
mc_enemies = mc_enemies_;
}
static function setGrenadesMovie(mc_grenades_) {
mc_grenades = mc_grenades_;
}
static function setBombsMovie(mc_bombs_) {
mc_bombs = mc_bombs_;
}
static function setBoatsMovie(mc_boats_) {
mc_boats = mc_boats_;
}
static function setPlanesMovie(mc_planes_) {
mc_planes = mc_planes_;
}
static function setGunMovie(mc_gun_) {
mc_gun = mc_gun_;
}
static function setShots1Movie(mc_shots1_) {
mc_shots1 = mc_shots1_;
}
static function setShots2Movie(mc_shots2_) {
mc_shots2 = mc_shots2_;
}
static function setShotHitMovie(mc_shot_hit_) {
mc_shot_hit = mc_shot_hit_;
mc_shot_hit._visible = false;
}
static function recalcLevelCoeff() {
}
static function createObjects() {
var _local2;
var _local1;
objTransform = new CTransform(WORLD_CENTER_X, WORLD_CENTER_Y - WORLD_DY_FROM_DOWN);
levelMatrix = new Array(LM_ROWS);
depthSortArray = new Array(LM_ROWS);
_local2 = 0;
while (_local2 < LM_ROWS) {
levelMatrix[_local2] = new Array(LM_COLS);
depthSortArray[_local2] = new Array(LM_COLS);
_local1 = 0;
while (_local1 < LM_COLS) {
depthSortArray[_local2][_local1] = (levelMatrix[_local2][_local1] = new CMatrixCell(null, ((_local2 * 3) * LM_COLS) + _local1));
_local1++;
}
_local2++;
}
boatArray = new Array(MAX_BOATS);
boatPresentArray = new Array(MAX_BOATS);
boatSortArray = new Array(MAX_BOATS);
boatSortFunc = function (a, b) {
if (a._y < b._y) {
return(-1);
}
if (a._y > b._y) {
return(1);
}
return(0);
};
depthSortFunc = function (a, b) {
if ((a.mc == null) || (b.mc == null)) {
if ((a.mc == null) && (b.mc == null)) {
return(0);
}
if (a.mc == null) {
return(-1);
}
return(1);
}
if (a.mc._y < b.mc._y) {
return(-1);
}
if (a.mc._y > b.mc._y) {
return(1);
}
return(0);
};
}
static function init() {
var _local1;
objTransform.init(WORLD_WIDTH, WORLD_HEIGHT, WORLD_DEPTH, 0.16666667);
objTransform.nearDY = WORLD_DY;
COL_WIDTH = (WORLD_WIDTH * 2) / LM_COLS;
COL_HEIGHT = (objTransform.depth / 2) / LM_ROWS;
MATRIX_FIELD_HEIGHT = objTransform.depth / 2;
clearLevelMatrix();
recalcLevelCoeff();
iNumForVictory = (level * 40) + 10;
if (hasPacman) {
pacmanManCount = (iNumForVictory / 3) * (1 + Math.random());
}
mc_pacman = null;
if (level < 3) {
iMaxBoats = 3;
fBoatTimeShift = 5000;
fPlaneTimeShift = 4000;
iMaxPlane = 3;
iMaxPlaneLevel = 0;
fTankCoeff = 0;
fSpeedCoeff = 0.8;
fFireSpeedCoeff = 0.5;
} else if ((level >= 3) && (level < 5)) {
iMaxBoats = 3;
fBoatTimeShift = 5000;
fPlaneTimeShift = 10000;
iMaxPlane = 1;
if (!restartLevel) {
iMaxPlaneLevel = 9;
}
fTankCoeff = 0;
fSpeedCoeff = 0.8;
fFireSpeedCoeff = 2;
} else if ((level >= 5) && (level < 10)) {
iMaxBoats = 4;
fBoatTimeShift = 5000;
fPlaneTimeShift = 10000;
iMaxPlane = 1;
if (!restartLevel) {
iMaxPlaneLevel = 10;
}
fTankCoeff = 0.2;
fSpeedCoeff = 0.9;
fFireSpeedCoeff = 2;
} else if ((level >= 10) && (level < 15)) {
iMaxBoats = 4;
fBoatTimeShift = 4000;
fPlaneTimeShift = 15000;
iMaxPlane = 2;
if (!restartLevel) {
iMaxPlaneLevel = 20;
}
fTankCoeff = 0.3;
fSpeedCoeff = 1;
fFireSpeedCoeff = 1;
} else if ((level >= 15) && (level < 20)) {
iMaxBoats = 4;
fBoatTimeShift = 3500;
fPlaneTimeShift = 20000;
iMaxPlane = 3;
if (!restartLevel) {
iMaxPlaneLevel = 30;
}
fTankCoeff = 0.4;
fSpeedCoeff = 1.1;
fFireSpeedCoeff = 1;
} else if ((level >= 20) && (level < 25)) {
iMaxBoats = 4;
fBoatTimeShift = 3000;
fPlaneTimeShift = 20000;
iMaxPlane = 3;
if (!restartLevel) {
iMaxPlaneLevel = 50;
}
fTankCoeff = 0.5;
fSpeedCoeff = 1.2;
fFireSpeedCoeff = 0;
} else {
iMaxBoats = 4;
fBoatTimeShift = 1000;
fPlaneTimeShift = 20000;
iMaxPlane = 3;
if (!restartLevel) {
iMaxPlaneLevel = 200;
}
fTankCoeff = 0.6;
fSpeedCoeff = 1.3;
fFireSpeedCoeff = 0;
}
fTankCurCoeff = 0;
iCurBoats = 0;
fBoatTime = fBoatTimeShift - 1500;
_local1 = 0;
while (_local1 < MAX_BOATS) {
boatArray[_local1] = CBoat(mc_boats.attachMovie("lib_boat", "" + _local1, _local1));
boatArray[_local1].setSpeeds(BOAT_SPEED1 * fSpeedCoeff, BOAT_SPEED2 * fSpeedCoeff);
boatArray[_local1].setTransformObj(objTransform);
boatPresentArray[_local1] = false;
boatSortArray[_local1] = boatArray[_local1];
_local1++;
}
curSoldiersCount = 0;
curTanksCount = 0;
enemiesCounter = 0;
planesCounter = 10000;
hitCounter = 0;
boomHitCounter = 0;
CEnemyPlane.PLANES_COUNT = 0;
fPlaneTime = fPlaneTimeShift / 2;
CSoldier.objTransform = objTransform;
CSoldier.fSpeedCoeff = fSpeedCoeff;
CTank.objTransform = objTransform;
CTank.fSpeedCoeff = fSpeedCoeff;
CEnemyPlane.objTransform = objTransform;
CEnemyPlane.fSpeedCoeff = fSpeedCoeff;
CGrenade.fSpeedCoeff = fSpeedCoeff;
CPlaneShot.fSpeedCoeff = fSpeedCoeff;
CTankShot.fSpeedCoeff = fSpeedCoeff;
CPacman.fSpeedCoeff = fSpeedCoeff;
if (restartLevel || (healthCount <= 0)) {
healthCount = MAX_HEALTH_COUNT;
}
updateHealth();
updateLifes();
if (!restartLevel) {
iCurNumForVictory = 0;
}
mc_root.txtScore.text = String(score);
mc_root.txtMansAll.text = String(iNumForVictory);
mc_root.txtMans.text = String(iCurNumForVictory);
gameState = ST_START;
mc_root.mc_message.gotoAndStop("level");
mc_root.mc_message.txtLevel.text = String(level);
mc_root.mc_sight._visible = false;
mouseVisible = true;
restartLevel = true;
lastGoSound = 0;
lastTankSound = 0;
}
static function startSight() {
mc_root.mc_sight._x = mc_root._xmouse;
mc_root.mc_sight._y = mc_root._ymouse;
mouseVisible = true;
Mouse.show();
}
static function endSight() {
mouseVisible = true;
Mouse.show();
}
static function clearLevelMatrix() {
var _local2;
var _local1;
_local2 = 0;
while (_local2 < LM_ROWS) {
_local1 = 0;
while (_local1 < LM_COLS) {
CMatrixCell(levelMatrix[_local2][_local1]).clear();
_local1++;
}
_local2++;
}
}
static function process(dTime) {
if (gameState == ST_GAME) {
if (iCurNumForVictory < iNumForVictory) {
if (iCurBoats < iMaxBoats) {
generateBoats(dTime);
}
if ((iMaxPlaneLevel > 0) && (CEnemyPlane.PLANES_COUNT < iMaxPlane)) {
generatePlanes(dTime);
}
}
processBoats(dTime);
processPlanes(dTime);
processSoldiersAndTanks(dTime);
processGrenades(dTime);
processBombs(dTime);
mc_gun.process(dTime);
if (iCurNumForVictory >= iNumForVictory) {
iCurNumForVictory = iNumForVictory;
checkForVictory();
}
mc_root.txtMans.text = String(iCurNumForVictory);
mc_root.txtScore.text = String(score);
if (hasPacman && (iCurNumForVictory > pacmanManCount)) {
startPacman();
hasPacman = false;
}
if (gameState == ST_GAME) {
if (mouseVisible) {
if (mc_root._ymouse <= mc_root.mc_down._y) {
mouseVisible = false;
Mouse.hide();
}
} else if (mc_root._ymouse > mc_root.mc_down._y) {
mouseVisible = true;
Mouse.show();
}
}
}
processSounds();
}
static function mouseMoveHandler() {
if (gameState == ST_GAME) {
mc_root.mc_sight._x = mc_root._xmouse;
mc_root.mc_sight._y = mc_root._ymouse;
if (mc_root.mc_sight._x < 0) {
mc_root.mc_sight._x = 0;
} else if (mc_root.mc_sight._x > LEVEL_WIDTH) {
mc_root.mc_sight._x = LEVEL_WIDTH;
}
if (mc_root.mc_sight._y < 0) {
mc_root.mc_sight._y = 0;
} else if (mc_root.mc_sight._y > mc_root.mc_down._y) {
mc_root.mc_sight._y = mc_root.mc_down._y;
}
}
}
static function mouseDownHandler() {
if (gameState == ST_START) {
mc_root.mc_sight._visible = true;
startSight();
gameState = ST_GAME;
mc_root.mc_message.gotoAndStop("empty");
mc_gun.run();
} else if (gameState == ST_WIN) {
mc_root.nextLevel();
}
}
static function keyPressedHandler() {
if (gameState == ST_GAME) {
endSight();
gameState = ST_PAUSE;
stopSoldiers();
mc_root.mc_message.gotoAndStop("pause");
} else if (gameState == ST_PAUSE) {
startSight();
gameState = ST_GAME;
startSoldiers();
mc_root.mc_message.gotoAndStop("empty");
}
}
static function startPacman() {
mc_pacman = CPacman(mc_enemies.attachMovie("lib_pacman", "" + enemiesCounter, levelMatrix[0][0].depth + (LM_COLS * 2)));
mc_pacman.startRun();
playSound(snd_pac_create);
enemiesCounter++;
if (enemiesCounter > 10000) {
enemiesCounter = 0;
}
}
static function checkForVictory() {
var _local1;
if (iCurNumForVictory >= iNumForVictory) {
if ((((curTanksCount == 0) && (curSoldiersCount == 0)) && (CEnemyPlane.PLANES_COUNT == 0)) && (iCurBoats == 0)) {
for (_local1 in mc_grenades) {
return(undefined);
}
for (_local1 in mc_bombs) {
return(undefined);
}
endSight();
mc_gun.stopRun();
if (level == MAX_LEVEL) {
gameState = ST_COMPLETE;
mc_root.mc_message.gotoAndStop("complete");
} else {
gameState = ST_WIN;
mc_root.mc_message.gotoAndStop("victory");
}
}
}
}
static function stopSoldiers() {
var _local1;
for (_local1 in mc_enemies) {
mc_enemies[_local1].mc.stop();
}
for (_local1 in mc_grenades) {
mc_grenades[_local1].mc.stop();
}
mc_gun.stopRun();
}
static function startSoldiers() {
var _local1;
for (_local1 in mc_enemies) {
mc_enemies[_local1].mc.play();
}
for (_local1 in mc_grenades) {
mc_grenades[_local1].mc.play();
}
mc_gun.run();
}
static function removeAllEnemies() {
mc_enemies.swapDepths(10000);
mc_enemies.removeMovieClip();
mc_grenades.swapDepths(10000);
mc_grenades.removeMovieClip();
mc_bombs.swapDepths(10000);
mc_bombs.removeMovieClip();
mc_boats.swapDepths(10000);
mc_boats.removeMovieClip();
mc_planes.swapDepths(10000);
mc_planes.removeMovieClip();
}
static function dieMoment() {
stopSoldiers();
removeAllEnemies();
lifesCount--;
updateLifes();
}
static function endDie() {
if (lifesCount <= 0) {
gameState = ST_GAME_OVER;
mc_root.mc_message.gotoAndStop("game_over");
} else if (iCurNumForVictory >= iNumForVictory) {
if (level == MAX_LEVEL) {
gameState = ST_COMPLETE;
mc_root.mc_message.gotoAndStop("complete");
} else {
mc_root.nextLevel();
}
} else {
mc_root.gotoAndStop("reset");
mc_root.gotoAndStop("game");
}
}
static function levelIsEnd() {
return(iCurNumForVictory >= iNumForVictory);
}
static function doDamage(x, y) {
addBoomHit(mc_root.mc_damage, x + ((1 - (2 * Math.random())) * 20), y, 170);
mc_root.mc_damage_effect.gotoAndStop("stay");
mc_root.mc_damage_effect.gotoAndStop("effect");
healthCount--;
updateHealth();
}
static function updateHealth() {
var _local1;
if (healthCount < 0) {
healthCount = 0;
}
_local1 = 1;
while (_local1 <= healthCount) {
mc_root["mc_health" + _local1]._visible = true;
_local1++;
}
_local1 = healthCount + 1;
while (_local1 <= MAX_HEALTH_COUNT) {
mc_root["mc_health" + _local1]._visible = false;
_local1++;
}
if (healthCount == 0) {
endSight();
gameState = ST_DIE;
mc_gun.stopRun();
mc_root.mc_red_effect.gotoAndPlay(2);
}
}
static function updateLifes() {
var _local1;
if (lifesCount > MAX_LIFES_COUNT) {
lifesCount = MAX_LIFES_COUNT;
}
_local1 = 1;
while (_local1 <= lifesCount) {
mc_root["mc_life" + _local1]._visible = true;
_local1++;
}
_local1 = lifesCount + 1;
while (_local1 <= MAX_LIFES_COUNT) {
mc_root["mc_life" + _local1]._visible = false;
_local1++;
}
}
static function doShot() {
var _local14;
var _local3;
var _local2;
var _local5;
var _local11;
var _local10;
var _local12;
var _local9;
var _local8;
var _local7;
if (gameState != ST_GAME) {
return(undefined);
}
playSound(snd_gun);
_local14 = {x:mc_root.mc_sight._x, y:mc_root.mc_sight._y};
mc_root.localToGlobal(_local14);
_local3 = _local14.x;
_local2 = _local14.y;
for (_local5 in mc_planes) {
_local11 = CEnemyPlane(mc_planes[_local5]);
if (_local11.isHit(_local3, _local2)) {
if (_local11.doDamage(_local3, _local2)) {
iCurNumForVictory = iCurNumForVictory + manPlane;
score = score + scrPlane;
playSound(snd_planedown);
}
return(undefined);
}
}
for (_local5 in mc_grenades) {
_local10 = CGrenade(mc_grenades[_local5]);
if (_local10.isHit(_local3, _local2)) {
_local10.doDamage(_local3, _local2);
playSound(snd_grenade);
return(undefined);
}
}
for (_local5 in mc_bombs) {
_local12 = CPlaneShot(mc_bombs[_local5]);
if (_local12.isHit(_local3, _local2)) {
if (_local12.doDamage(_local3, _local2)) {
score = score + scrBomb;
playSound(snd_bombexplode);
}
return(undefined);
}
}
var _local15;
var _local13 = new CVector3D(0, 0, 0);
var _local6;
var _local4;
var _local1;
_local15 = objTransform.getKForY(mc_root.mc_sight._y, WORLD_HEIGHT);
_local13.x = objTransform.getWorldXFromScreen(mc_root.mc_sight._x, _local15);
_local13.y = WORLD_HEIGHT;
_local13.z = objTransform.getZForK(_local15);
_local6 = getColRowFromXZ(_local13.x, _local13.z);
_local4 = _local6.row + 2;
while (_local4 >= _local6.row) {
if ((_local4 >= 0) && (_local4 < LM_ROWS)) {
_local1 = _local6.col - 1;
while (_local1 <= (_local6.col + 1)) {
if (((_local1 >= 0) && (_local1 < LM_COLS)) && (levelMatrix[_local4][_local1].mc != null)) {
if (CMatrixCell(levelMatrix[_local4][_local1]).isTank) {
_local7 = CTank(levelMatrix[_local4][_local1].mc);
if (_local7.isHit(_local3, _local2)) {
if (_local7.doDamage(_local3, _local2)) {
curTanksCount--;
score = score + scrTank;
iCurNumForVictory = iCurNumForVictory + manTank;
playSound(snd_tankexplode2);
}
return(undefined);
}
} else {
_local8 = CSoldier(levelMatrix[_local4][_local1].mc);
if (_local8.isHit(_local3, _local2)) {
if (_local8.doDamage(_local3, _local2)) {
curSoldiersCount--;
score = score + scrSoldier;
iCurNumForVictory = iCurNumForVictory + manSoldier;
}
return(undefined);
}
}
}
_local1++;
}
}
_local4--;
}
for (_local5 in mc_boats) {
_local9 = CBoat(mc_boats[_local5]);
if (_local9.isHit(_local3, _local2)) {
if (_local9.doDamage(_local3, _local2)) {
score = score + scrBoat;
if (_local9.landingCount <= 0) {
iCurNumForVictory = iCurNumForVictory + manBoatEmpty;
} else {
iCurNumForVictory = iCurNumForVictory + _local9.landingCount;
}
playSound(snd_shipsink);
}
return(undefined);
}
}
if (mc_pacman != null) {
if (mc_pacman.isHit(_local3, _local2)) {
if (mc_pacman.doDamage(_local3, _local2)) {
lifesCount++;
updateLifes();
playSound(snd_pac_die);
}
return(undefined);
}
}
if (((mc_root.mc_sight._y >= mc_root.mc_up._y) && (mc_root.mc_sight._y <= mc_root.mc_down._y)) && (!mc_shot_hit.hitTest(_local14.x, _local14.y, true))) {
if (mc_root.mc_sight._y >= mc_root.mc_mid._y) {
addHit(mc_root.mc_sight._x, mc_root.mc_sight._y, mc_shots1, dirtHitLibName);
} else {
addHit(mc_root.mc_sight._x, mc_root.mc_sight._y, mc_shots2, waterHitLibName);
}
}
}
static function pacmanIsDie() {
mc_pacman = null;
}
static function addHit(x, y, mc_shots, hitLibName) {
var _local1;
_local1 = mc_shots.attachMovie(hitLibName, "" + hitCounter, hitCounter);
_local1._x = x;
_local1._y = y;
_local1._xscale = (_local1._yscale = objTransform.getKForY(y, WORLD_HEIGHT) * 100);
hitCounter++;
if (hitCounter > 10000) {
hitCounter = 0;
}
}
static function addBoomHit(mc_container, x, y, scale) {
var _local2 = {x:x, y:y};
var _local1;
mc_container.globalToLocal(_local2);
_local1 = mc_container.attachMovie(boomHitLibName, "" + boomHitCounter, boomHitCounter);
_local1._x = _local2.x;
_local1._y = _local2.y;
_local1._xscale = (_local1._yscale = scale);
boomHitCounter++;
if (boomHitCounter > 10000) {
boomHitCounter = 0;
}
}
static function generateBoats(dTime) {
fBoatTime = fBoatTime + dTime;
if (fBoatTime >= fBoatTimeShift) {
fBoatTime = 0;
addBoat();
}
}
static function processBoats(dTime) {
var _local1;
var _local2;
_local1 = 0;
while (_local1 < MAX_BOATS) {
_local2 = CBoat(boatArray[_local1]);
_local2.process(dTime);
_local1++;
}
boatSortArray.sort(boatSortFunc);
_local1 = 0;
while (_local1 < MAX_BOATS) {
boatSortArray[_local1].swapDepths(1000 + _local1);
_local1++;
}
_local1 = 0;
while (_local1 < MAX_BOATS) {
boatSortArray[_local1].swapDepths(_local1);
_local1++;
}
}
static function generatePlanes(dTime) {
fPlaneTime = fPlaneTime + dTime;
if (fPlaneTime >= fPlaneTimeShift) {
fPlaneTime = 0;
iMaxPlaneLevel--;
addPlane();
}
}
static function processPlanes(dTime) {
var _local1;
var _local2;
for (_local1 in mc_planes) {
_local2 = CEnemyPlane(mc_planes[_local1]);
_local2.process(dTime);
}
}
static function processSoldiersAndTanks(dTime) {
var _local2;
var _local1;
for (_local2 in mc_enemies) {
_local1 = mc_enemies[_local2];
_local1.process(dTime);
}
}
static function processGrenades(dTime) {
var _local2;
var _local1;
for (_local2 in mc_grenades) {
_local1 = mc_grenades[_local2];
_local1.process(dTime);
}
}
static function processBombs(dTime) {
var _local2;
var _local1;
for (_local2 in mc_bombs) {
_local1 = mc_bombs[_local2];
_local1.process(dTime);
}
}
static function addPlane() {
var _local1;
_local1 = CEnemyPlane(mc_planes.attachMovie(planeLibName, "" + planesCounter, planesCounter));
_local1.init();
planesCounter--;
if (planesCounter <= 0) {
planesCounter = 10000;
}
}
static function getNewPlaneDepth() {
var _local1;
_local1 = planesCounter;
planesCounter--;
if (planesCounter <= 0) {
planesCounter = 10000;
}
return(_local1);
}
static function addBoat() {
var _local1;
var _local2;
var _local4;
var _local3;
_local1 = random(MAX_BOATS);
while (boatPresentArray[_local1] == true) {
_local1++;
if (_local1 == MAX_BOATS) {
_local1 = 0;
}
}
if (_local1 < 2) {
_local2 = 1;
} else if (_local1 > 2) {
_local2 = -1;
} else if (Math.random() < 0.5) {
_local2 = 1;
} else {
_local2 = -1;
}
_local4 = true;
_local3 = true;
fTankCurCoeff = fTankCurCoeff + fTankCoeff;
if (fTankCurCoeff >= 1) {
fTankCurCoeff = fTankCurCoeff - 1;
_local3 = false;
if (curSoldiersCount < 5) {
_local4 = false;
}
}
boatArray[_local1].setCargoComposition(_local4, _local3);
boatArray[_local1].toSwim1(_local2, mc_root["mc_b_1_" + _local1], mc_root["mc_b_2_" + _local1], _local1);
boatPresentArray[_local1] = true;
iCurBoats++;
}
static function boatIsComeBack(boatNum) {
iCurBoats--;
boatPresentArray[boatNum] = false;
}
static function dropMan(screenX, screenY) {
var _local3;
var _local1 = new CVector3D(0, 0, 0);
var _local2;
var _local4;
if (curSoldiersCount >= MAX_SOLDIERS) {
return(false);
}
_local3 = objTransform.getKForY(screenY, WORLD_HEIGHT);
_local1.x = objTransform.getWorldXFromScreen(screenX, _local3);
_local1.y = WORLD_HEIGHT;
_local1.z = objTransform.getZForK(_local3);
_local2 = getColRowFromXZ(_local1.x, _local1.z);
if (_local2.row < 0) {
_local2.row = 0;
}
if (_local2.col < 0) {
_local2.col = 0;
}
if (_local2.col >= LM_COLS) {
_local2.col = LM_COLS - 1;
}
_local4 = getFreeCellIn(_local2.col, 0);
if (_local4 == -1) {
return(false);
}
_local1.x = _local1.x + ((1 - (2 * Math.random())) * 20);
dropNewManIn(_local4, 0, _local1, new CVector3D(getXFromCol(_local4), WORLD_HEIGHT, getZFromRow(0)), _local3);
return(true);
}
static function dropTank(screenX, screenY) {
var _local3;
var _local2 = new CVector3D(0, 0, 0);
var _local1;
var _local4;
_local3 = objTransform.getKForY(screenY, WORLD_HEIGHT);
_local2.x = objTransform.getWorldXFromScreen(screenX, _local3);
_local2.y = WORLD_HEIGHT;
_local2.z = objTransform.getZForK(_local3);
_local1 = getColRowFromXZ(_local2.x, _local2.z);
if (_local1.row < 0) {
_local1.row = 0;
}
if (_local1.col < 0) {
_local1.col = 0;
}
if (_local1.col >= LM_COLS) {
_local1.col = LM_COLS - 1;
}
_local4 = getFreeDoubleCellIn(_local1.col, 0);
if (_local4 == -1) {
return(false);
}
dropNewTankIn(_local4, 0, _local2, new CVector3D(getXFromCol(_local4 - 0.5), WORLD_HEIGHT, getZFromRow(-0.5)), _local3);
return(true);
}
static function dropNewManIn(col, row, curPos, newPos, k) {
var _local1;
_local1 = CSoldier(mc_enemies.attachMovie(soldierLibName, "" + enemiesCounter, levelMatrix[row][col].depth + LM_COLS));
captureCell(col, row, _local1);
_local1.startGo(col, row, curPos, newPos, k);
curSoldiersCount++;
enemiesCounter++;
if (enemiesCounter > 10000) {
enemiesCounter = 0;
}
}
static function dropNewTankIn(col, row, curPos, newPos, k) {
var _local1;
_local1 = CTank(mc_enemies.attachMovie(tankLibName, "" + enemiesCounter, levelMatrix[row][col].depth));
captureCellForTank(col, row, _local1);
_local1.startGo(col, row, curPos, newPos, k);
curTanksCount++;
enemiesCounter++;
if (enemiesCounter > 10000) {
enemiesCounter = 0;
}
}
static function getFreeCellIn(col, row) {
var _local2;
var _local1;
_local1 = (col - 1) + random(3);
_local2 = 0;
while (_local2 < 3) {
if ((_local1 >= 0) && (_local1 < LM_COLS)) {
if (levelMatrix[row][_local1].isFree()) {
return(_local1);
}
}
_local1++;
if (_local1 > (col + 1)) {
_local1 = col - 1;
}
_local2++;
}
return(-1);
}
static function getFreeDoubleCellIn(col, row) {
var _local3;
var _local1;
_local1 = (col - 1) + random(3);
_local3 = 0;
while (_local3 < 3) {
if ((_local1 >= 1) && (_local1 < LM_COLS)) {
if ((levelMatrix[row][_local1].isFree() && (levelMatrix[row][_local1 - 1].isFree())) && (((row - 1) < 0) || (levelMatrix[row - 1][_local1].isFree() && (levelMatrix[row - 1][_local1 - 1].isFree())))) {
return(_local1);
}
}
_local1++;
if (_local1 > (col + 1)) {
_local1 = col;
}
_local3++;
}
return(-1);
}
static function addGrenade(x, y) {
var _local1;
_local1 = mc_grenades.attachMovie(grenadeLibName, "" + enemiesCounter, enemiesCounter);
CGrenade(_local1).init(x, y);
enemiesCounter++;
if (enemiesCounter > 10000) {
enemiesCounter = 0;
}
}
static function addBomb(x, y) {
var _local1;
_local1 = mc_bombs.attachMovie(bombLibName, "" + enemiesCounter, enemiesCounter);
CPlaneShot(_local1).init(x, y);
playSound(snd_bomb);
enemiesCounter++;
if (enemiesCounter > 10000) {
enemiesCounter = 0;
}
}
static function addTankShot(x, y) {
var _local1;
_local1 = mc_grenades.attachMovie(tankShotLibName, "" + enemiesCounter, enemiesCounter);
CTankShot(_local1).init(x, y);
enemiesCounter++;
if (enemiesCounter > 10000) {
enemiesCounter = 0;
}
}
static function captureCell(col, row, mc) {
CMatrixCell(levelMatrix[row][col]).setObject(mc, false, false);
}
static function captureCellForTank(col, row, mc) {
CMatrixCell(levelMatrix[row][col]).setObject(mc, false, true);
CMatrixCell(levelMatrix[row][col - 1]).setObject(mc, true, true);
if ((row - 1) >= 0) {
CMatrixCell(levelMatrix[row - 1][col]).setObject(mc, true, true);
CMatrixCell(levelMatrix[row - 1][col - 1]).setObject(mc, true, true);
}
}
static function freeCell(col, row) {
CMatrixCell(levelMatrix[row][col]).clear();
}
static function freeCellForTank(col, row) {
CMatrixCell(levelMatrix[row][col]).clear();
CMatrixCell(levelMatrix[row][col - 1]).clear();
if ((row - 1) >= 0) {
CMatrixCell(levelMatrix[row - 1][col]).clear();
CMatrixCell(levelMatrix[row - 1][col - 1]).clear();
}
}
static function updateMovieToCellDepth(col, row, soldierFlag) {
if (soldierFlag) {
CMatrixCell(levelMatrix[row][col]).mc.swapDepths(CMatrixCell(levelMatrix[row][col]).depth + LM_COLS);
} else {
CMatrixCell(levelMatrix[row][col]).mc.swapDepths(CMatrixCell(levelMatrix[row][col]).depth);
}
}
static function doGunShot() {
}
static function getXZFromColRow(col, row) {
return({x:(-WORLD_WIDTH) + ((col + 0.5) * COL_WIDTH), z:MATRIX_FIELD_HEIGHT - ((row + 0.5) * COL_HEIGHT)});
}
static function getColRowFromXZ(x, z) {
return({col:Math.round(((x + WORLD_WIDTH) / COL_WIDTH) - 0.5), row:Math.round(((-(z - MATRIX_FIELD_HEIGHT)) / COL_HEIGHT) - 0.5)});
}
static function getXFromCol(col) {
return((-WORLD_WIDTH) + ((col + 0.5) * COL_WIDTH));
}
static function getZFromRow(row) {
return(MATRIX_FIELD_HEIGHT - ((row + 0.5) * COL_HEIGHT));
}
static function getColFromX(x) {
return(Math.round(((x + WORLD_WIDTH) / COL_WIDTH) - 0.5));
}
static function getRowFromZ(z) {
return(Math.round(((-(z - MATRIX_FIELD_HEIGHT)) / COL_HEIGHT) - 0.5));
}
static var LEVEL_WIDTH = 550;
static var LEVEL_HEIGHT = 400;
static var WORLD_WIDTH = LEVEL_WIDTH / 2;
static var WORLD_HEIGHT = LEVEL_HEIGHT / 2;
static var WORLD_DY = 190;
static var WORLD_DY_FROM_DOWN = 85;
static var WORLD_CENTER_X = 275;
static var WORLD_CENTER_Y = 200 - WORLD_DY;
static var WORLD_DEPTH = 2000;
static var MAX_LIFES_COUNT = 5;
static var START_LIFES_COUNT = 3;
static var MAX_HEALTH_COUNT = 5;
static var scrSoldier = 10;
static var scrPlane = 30;
static var scrBomb = 50;
static var scrTank = 80;
static var scrBoat = 150;
static var LM_COLS = 11;
static var LM_ROWS = 10;
static var MAX_LEVEL = 30;
static var MAX_SOLDIERS = 25;
static var manSoldier = 1;
static var manPlane = 3;
static var manTank = 5;
static var manBoatFull = 12;
static var manBoatEmpty = 1;
static var BOAT_SPEED1 = 100;
static var BOAT_SPEED2 = 100;
static var MAX_BOATS = 5;
static var soldierLibName = "lib_soldier";
static var tankLibName = "lib_tank";
static var grenadeLibName = "lib_grenade";
static var bombLibName = "lib_bomb";
static var tankShotLibName = "lib_tank_shot";
static var planeLibName = "lib_plane";
static var dirtHitLibName = "lib_dirt_hit";
static var waterHitLibName = "lib_water_hit";
static var boomHitLibName = "lib_boom_hit";
static var ST_START = 1;
static var ST_GAME = 2;
static var ST_PAUSE = 3;
static var ST_WIN = 4;
static var ST_GAME_OVER = 5;
static var ST_DIE = 6;
static var ST_COMPLETE = 7;
static var soundsArray = [{name:"pac_create", go:false, snd:null}, {name:"pac_die", go:false, snd:null}, {name:"trooper02", go:false, snd:null}, {name:"tankstart", go:false, snd:null}, {name:"shipsink", go:false, snd:null}, {name:"tankexplode2", go:false, snd:null}, {name:"bomb", go:false, snd:null}, {name:"bombexplode", go:false, snd:null}, {name:"grenade", go:false, snd:null}, {name:"planedown", go:false, snd:null}, {name:"squash02", go:false, snd:null}, {name:"squash03", go:false, snd:null}, {name:"squash07", go:false, snd:null}, {name:"gun", go:false, snd:null}];
static var snd_pac_create = 0;
static var snd_pac_die = 1;
static var snd_trooper02 = 2;
static var snd_tankstart = 3;
static var snd_shipsink = 4;
static var snd_tankexplode2 = 5;
static var snd_bomb = 6;
static var snd_bombexplode = 7;
static var snd_grenade = 8;
static var snd_planedown = 9;
static var snd_squash02 = 10;
static var snd_squash03 = 11;
static var snd_squash07 = 12;
static var snd_gun = 13;
static var SOUND_TIME_SHIFT = 15000;
static var SOUND_TIME_SHIFT2 = 3000;
}
Symbol 361 MovieClip [__Packages.CPacman] Frame 0
class CPacman extends MovieClip
{
static var fSpeedCoeff;
var mc_hit, state, _x, speed, _width, lifeCount, _y, _visible, gotoAndStop, removeMovieClip;
function CPacman () {
super();
mc_hit._visible = false;
toNone();
}
function process(dTime) {
if (state == ST_RUN) {
_x = _x + ((speed * dTime) / 1000);
if (_x > (CGP.LEVEL_WIDTH + (_width / 2))) {
toNone();
}
}
}
function startRun() {
lifeCount = LIFE_COUNT;
speed = INIT_SPEED * fSpeedCoeff;
toRun();
_x = (-_width) / 2;
_y = START_Y;
}
function toRun() {
state = ST_RUN;
_visible = true;
gotoAndStop("run");
}
function toNone() {
state = ST_NONE;
_visible = false;
gotoAndStop("empty");
}
function disable() {
CGP.pacmanIsDie();
removeMovieClip();
}
function toDie() {
state = ST_DIE;
gotoAndStop("die");
}
function endDie() {
disable();
}
function isHit(x, y) {
return(isAvailable() && (mc_hit.hitTest(x, y, false)));
}
function isAvailable() {
return(state == ST_RUN);
}
function doDamage(x, y) {
lifeCount--;
if (lifeCount <= 0) {
toDie();
} else {
CGP.addBoomHit(this, x, y, 25);
}
return(lifeCount <= 0);
}
static var LIFE_COUNT = 12;
static var ST_NONE = 1;
static var ST_RUN = 2;
static var ST_DIE = 3;
static var INIT_SPEED = 100;
static var START_Y = 135;
}
Symbol 362 MovieClip [__Packages.CTransform] Frame 0
class CTransform
{
var nearWidth, nearHeight, depth, farK, nearK, nearDX, nearDY;
function CTransform (nearCX_, nearCY_) {
nearCX = nearCX_;
nearCY = nearCY_;
}
function init(nearWidth_, nearHeight_, depth_, farK_) {
nearWidth = nearWidth_;
nearHeight = nearHeight_;
depth = depth_;
farK = farK_;
nearK = 1;
nearDX = (nearDY = 0);
}
function getScreenXY(x, y, z, point) {
var _local2 = getKForZ(z);
x = ((x + nearDX) * _local2) + nearCX;
y = ((y + nearDY) * _local2) + nearCY;
point.k = _local2;
point.x = x;
point.y = y;
}
function getKForZ(z) {
return(nearK + (((farK - nearK) * z) / depth));
}
function getZForK(k) {
return(((k - nearK) / (farK - nearK)) * depth);
}
function getKForY(screenY, worldY) {
return((screenY - nearCY) / (worldY + nearDY));
}
function getWorldXFromScreen(x, k) {
return(((x - nearCX) / k) - nearDX);
}
function getWorldYFromScreen(y, k) {
return(((y - nearCY) / k) - nearDY);
}
var nearCX = 275;
var nearCY = 200;
}
Symbol 363 MovieClip [__Packages.CGun] Frame 0
class CGun extends MovieClip
{
var mc_fire, timeCounter, runFlag, _parent, _y, _x, _width;
function CGun () {
super();
mc_fire._visible = false;
timeCounter = 0;
runFlag = false;
}
function run() {
runFlag = true;
onMouseMove();
}
function stopRun() {
runFlag = false;
}
function process(dTime) {
mc_fire._visible = false;
timeCounter = timeCounter - dTime;
if (timeCounter <= 0) {
timeCounter = 0;
if (Key.isDown(SHOT_KEY)) {
mc_fire._visible = true;
timeCounter = SHOT_TIME_SHIFT;
CGP.doShot();
}
}
if (_parent._ymouse <= ((CGP.LEVEL_HEIGHT * 2) / 3)) {
_y = CGP.LEVEL_HEIGHT;
} else {
_y = CGP.LEVEL_HEIGHT + (((_parent._ymouse - ((CGP.LEVEL_HEIGHT * 2) / 3)) / (CGP.LEVEL_HEIGHT / 3)) * MAX_DY);
}
}
function onMouseMove() {
if (runFlag) {
_x = _parent._xmouse;
if (_x < (_width / 2)) {
_x = _width / 2;
} else if (_x > (CGP.LEVEL_WIDTH - (_width / 2))) {
_x = CGP.LEVEL_WIDTH - (_width / 2);
}
}
updateAfterEvent();
}
static var SHOT_KEY = 1;
var SHOT_TIME_SHIFT = 150;
static var MAX_DY = 80;
}
Symbol 364 MovieClip [__Packages.CMatrixCell] Frame 0
class CMatrixCell
{
var mc, depth, tankSubsidiary, isTank;
function CMatrixCell (mc_, depth_) {
mc = mc_;
depth = depth_;
tankSubsidiary = false;
isTank = false;
}
function clear() {
mc = null;
}
function isFree() {
return(mc == null);
}
function setObject(mc_, tankSubsidiary_, isTank_) {
mc = mc_;
tankSubsidiary = tankSubsidiary_;
isTank = isTank_;
}
}
Symbol 365 MovieClip [__Packages.CBoat] Frame 0
class CBoat extends MovieClip
{
var myWidth, _width, curDir, curPos, mc_hit2, mc_hit1, speed1, speed2, objTransform, part1OfMans, part2OfMans, state, curLandingTime, _x, _y, _xscale, dir, _yscale, mc_point1, mc_point2, boatNum, landingCount, mc, gotoAndStop, curSpeed, lifeCount;
function CBoat () {
super();
myWidth = _width;
curDir = new CVector3D(0, 0, 0);
curPos = new CVector3D(0, 0, 0);
mc_hit1._visible = (mc_hit2._visible = false);
toNone();
}
function setSpeeds(speed1_, speed2_) {
speed1 = speed1_;
speed2 = speed2_;
}
function setTransformObj(objTransform_) {
objTransform = objTransform_;
}
function setCargoComposition(part1OfMans_, part2OfMans_) {
part1OfMans = part1OfMans_;
part2OfMans = part2OfMans_;
}
function process(dTime) {
var _local2 = 0;
if ((state == ST_SWIM1) || (state == ST_SWIM4)) {
_local2 = (speed1 * dTime) / 1000;
} else if ((state == ST_SWIM2) || (state == ST_SWIM3)) {
_local2 = (speed2 * dTime) / 1000;
}
curPos.x = curPos.x + (_local2 * curDir.x);
curPos.y = curPos.y + (_local2 * curDir.y);
curPos.z = curPos.z + (_local2 * curDir.z);
if (state == ST_LANDING) {
curLandingTime = curLandingTime + dTime;
if (curLandingTime >= LANDING_TIME) {
landNextUnit();
}
}
screenSynchronize();
}
function screenSynchronize() {
var _local2 = {x:0, y:0, k:0};
objTransform.getScreenXY(curPos.x, curPos.y, curPos.z, _local2);
_x = _local2.x;
_y = _local2.y;
if ((state != ST_NONE) && (state != ST_SWIM4)) {
_xscale = ((_yscale = (_local2.k * 100) * myScaleCoeff)) * dir;
}
if (state == ST_SWIM1) {
if (dir > 0) {
if (_x >= mc_point1._x) {
_x = mc_point1._x;
_y = mc_point1._y;
curPos.x = objTransform.getWorldXFromScreen(_x, objTransform.getKForZ(curPos.z));
curPos.y = objTransform.getWorldYFromScreen(_y, objTransform.getKForZ(curPos.z));
toSwim2();
}
} else if (_x <= mc_point1._x) {
_x = mc_point1._x;
_y = mc_point1._y;
curPos.x = objTransform.getWorldXFromScreen(_x, objTransform.getKForZ(curPos.z));
curPos.y = objTransform.getWorldYFromScreen(_y, objTransform.getKForZ(curPos.z));
toSwim2();
}
} else if (state == ST_SWIM2) {
if (_y >= mc_point2._y) {
_x = mc_point2._x;
_y = mc_point2._y;
curPos.x = objTransform.getWorldXFromScreen(_x, objTransform.getKForZ(curPos.z));
curPos.y = objTransform.getWorldYFromScreen(_y, objTransform.getKForZ(curPos.z));
toOpen();
}
} else if (state == ST_SWIM3) {
if (_y <= mc_point1._y) {
_x = mc_point1._x;
_y = mc_point1._y;
curPos.x = objTransform.getWorldXFromScreen(_x, objTransform.getKForZ(curPos.z));
curPos.y = objTransform.getWorldYFromScreen(_y, objTransform.getKForZ(curPos.z));
toSwim4();
}
} else if (state == ST_SWIM4) {
if (dir > 0) {
if (_x <= ((-_width) / 2)) {
toNone();
CGP.boatIsComeBack(boatNum);
}
} else if (_x >= (CGP.LEVEL_WIDTH + (_width / 2))) {
toNone();
CGP.boatIsComeBack(boatNum);
}
}
}
function landNextUnit() {
if (landingCount == MAX_LANDING_COUNT) {
if (part1OfMans) {
if (dropMan()) {
landingCount--;
// unexpected jump
}
return(undefined);
}
if (dropTank()) {
landingCount = landingCount - Math.round(MAX_LANDING_COUNT / 2);
} else {
return(undefined);
}
} else if (landingCount == Math.round(MAX_LANDING_COUNT / 2)) {
if (part2OfMans) {
if (dropMan()) {
landingCount--;
// unexpected jump
}
return(undefined);
}
if (dropTank()) {
landingCount = landingCount - Math.round(MAX_LANDING_COUNT / 2);
} else {
return(undefined);
}
} else if (dropMan()) {
landingCount--;
} else {
return(undefined);
}
curLandingTime = 0;
if (landingCount == 0) {
toSwim3();
}
}
function dropMan() {
if (CGP.dropMan(_x, _y)) {
if (landingCount == 10) {
mc.mc_s1._visible = false;
} else if (landingCount == 7) {
mc.mc_s2._visible = false;
}
if (landingCount == 4) {
mc.mc_s3._visible = false;
}
if (landingCount == 1) {
mc.mc_s4._visible = false;
}
return(true);
}
return(false);
}
function dropTank() {
if (CGP.dropTank(_x, _y)) {
if (landingCount == MAX_LANDING_COUNT) {
mc.mc_t1._visible = false;
} else {
mc.mc_t2._visible = false;
}
return(true);
}
return(false);
}
function endOpen() {
toLanding();
}
function toNone() {
state = ST_NONE;
gotoAndStop("empty");
}
function toSwim1(dir_, mc_point1_, mc_point2_, boatNum_) {
var _local2;
dir = dir_;
mc_point1 = mc_point1_;
mc_point2 = mc_point2_;
boatNum = boatNum_;
if (dir < 0) {
_x = CGP.LEVEL_WIDTH + (myWidth / 2);
_y = mc_point1._y;
} else {
_x = (-myWidth) / 2;
_y = mc_point1._y;
}
_local2 = objTransform.getKForY(_y, CGP.WORLD_HEIGHT);
curPos.x = objTransform.getWorldXFromScreen(_x, _local2);
curPos.y = CGP.WORLD_HEIGHT;
curPos.z = objTransform.getZForK(_local2);
_xscale = ((_yscale = (_local2 * 100) * myScaleCoeff)) * dir;
curSpeed = speed1;
curDir.x = dir;
curDir.y = 0;
curDir.z = 0;
state = ST_SWIM1;
gotoAndStop("boat0");
lifeCount = LIFE_COUNT;
landingCount = MAX_LANDING_COUNT;
}
function toSwim2() {
var _local2;
curSpeed = speed2;
_local2 = objTransform.getKForY(mc_point2._y, CGP.WORLD_HEIGHT);
curDir.x = objTransform.getWorldXFromScreen(mc_point2._x, _local2);
curDir.y = CGP.WORLD_HEIGHT;
curDir.z = objTransform.getZForK(_local2);
curDir.minus(curPos);
curDir.normalize();
state = ST_SWIM2;
if ((boatNum == 0) || (boatNum == 4)) {
gotoAndStop("boat3");
} else if ((boatNum == 1) || (boatNum == 3)) {
gotoAndStop("boat2");
} else {
gotoAndStop("boat1");
}
}
function toSwim3() {
curSpeed = speed2;
curDir.mult(-1);
state = ST_SWIM3;
}
function toSwim4() {
var _local2;
curSpeed = speed1;
_local2 = objTransform.getKForY(mc_point1._y, CGP.WORLD_HEIGHT);
curDir.x = objTransform.getWorldXFromScreen(mc_point1._x - (dir * 100), _local2);
curDir.y = CGP.WORLD_HEIGHT;
curDir.z = objTransform.getZForK(_local2);
curDir.minus(curPos);
curDir.normalize();
_xscale = ((_yscale = (_local2 * 100) * myScaleCoeff)) * (-dir);
gotoAndStop("boat0");
state = ST_SWIM4;
}
function toOpen() {
mc.gotoAndPlay(2);
if (part1OfMans) {
mc.mc_t1._visible = false;
} else {
mc.mc_s1._visible = false;
mc.mc_s2._visible = false;
}
if (part2OfMans) {
mc.mc_t2._visible = false;
} else {
mc.mc_s3._visible = false;
mc.mc_s4._visible = false;
}
curSpeed = 0;
state = ST_OPEN;
}
function toLanding() {
if (part1OfMans && (part2OfMans)) {
if ((getTimer() - CGP.lastGoSound) > CGP.SOUND_TIME_SHIFT) {
CGP.lastGoSound = getTimer();
CGP.playSound(CGP.snd_trooper02);
}
} else if ((getTimer() - CGP.lastTankSound) > CGP.SOUND_TIME_SHIFT2) {
CGP.lastTankSound = getTimer();
CGP.playSound(CGP.snd_tankstart);
}
curLandingTime = LANDING_TIME / 2;
state = ST_LANDING;
}
function toDie() {
state = ST_DIE;
gotoAndStop("die");
}
function endDie() {
toNone();
CGP.boatIsComeBack(boatNum);
}
function isHit(x, y) {
return(isAvailable() && (mc_hit1.hitTest(x, y, false) || (mc_hit2.hitTest(x, y, false))));
}
function isAvailable() {
return((state != ST_NONE) && (state != ST_DIE));
}
function doDamage(x, y) {
lifeCount--;
if (lifeCount <= 0) {
toDie();
} else {
CGP.addBoomHit(this, x, y, 15);
}
return(lifeCount <= 0);
}
static var LIFE_COUNT = 40;
static var ST_NONE = 0;
static var ST_SWIM1 = 1;
static var ST_SWIM2 = 2;
static var ST_SWIM3 = 3;
static var ST_SWIM4 = 4;
static var ST_OPEN = 5;
static var ST_LANDING = 6;
static var ST_DIE = 7;
static var myScaleCoeff = 2;
static var LANDING_TIME = 500;
static var MAX_LANDING_COUNT = 12;
}
Symbol 366 MovieClip [__Packages.CVector3D] Frame 0
class CVector3D
{
var x, y, z;
function CVector3D (x_, y_, z_) {
x = x_;
y = y_;
z = z_;
}
function reinit(x_, y_, z_) {
x = x_;
y = y_;
z = z_;
}
function duplicate() {
return(new CVector3D(x, y, z));
}
function copyTo(v) {
v.x = x;
v.y = y;
v.z = z;
}
function minus(v) {
x = x - v.x;
y = y - v.y;
z = z - v.z;
}
function minusNew(v) {
return(new CVector3D(x - v.x, y - v.y, z - v.z));
}
function plus(v) {
x = x + v.x;
y = y + v.y;
z = z + v.z;
}
function mult(num) {
x = x * num;
y = y * num;
z = z * num;
}
function multNew(num) {
return(new CVector3D(x * num, y * num, z * num));
}
function normalize() {
var _local2 = Math.sqrt(((x * x) + (y * y)) + (z * z));
if (_local2 > 0.001) {
x = x / _local2;
y = y / _local2;
z = z / _local2;
}
}
}
Symbol 367 MovieClip [__Packages.CEnemyPlane] Frame 0
class CEnemyPlane extends MovieClip
{
static var PLANES_COUNT, objTransform, fSpeedCoeff;
var hasBomb, pos, dir, mc_hit, lifeCount, speed, state, lastDepth, xDir, myWidth2, _width, myHeight2, _height, _visible, gotoAndStop, noneTimeCounter, swapDepths, _x, _y, _xscale, _yscale, removeMovieClip;
function CEnemyPlane () {
super();
PLANES_COUNT++;
hasBomb = false;
pos = new CVector3D(0, 0, 0);
dir = new CVector3D(0, 0, 0);
mc_hit._visible = false;
lifeCount = LIFE_COUNT;
}
function init() {
pos.reinit(((4 * CGP.WORLD_WIDTH) * Math.random()) - (2 * CGP.WORLD_WIDTH), ((0.2 * CGP.WORLD_HEIGHT) * Math.random()) + (0.9 * CGP.WORLD_HEIGHT), objTransform.depth);
dir.reinit((CGP.WORLD_WIDTH * Math.random()) - (CGP.WORLD_WIDTH / 2), (-0.45 * CGP.WORLD_HEIGHT) - ((0.15 * CGP.WORLD_HEIGHT) * Math.random()), 0);
dir.minus(pos);
dir.normalize();
speed = INIT_SPEED * fSpeedCoeff;
state = 0;
lastDepth = objTransform.depth / 5.5;
if (dir.x > 0) {
xDir = -1;
} else {
xDir = 1;
}
myWidth2 = _width * 0.5;
myHeight2 = _height * 0.4;
screenSynchronize();
_visible = true;
gotoAndStop("st_");
}
function process(dTime) {
if (state == 4) {
return(undefined);
}
if (state == 3) {
noneTimeCounter = noneTimeCounter - dTime;
if (noneTimeCounter <= 0) {
init();
swapDepths(CGP.getNewPlaneDepth());
}
return(undefined);
}
if ((state == 0) && (pos.z <= lastDepth)) {
dir.y = -Math.abs(dir.y);
gotoAndStop("st_u1");
if (hasBomb) {
CGP.addBomb(_x, _y + (_height / 4));
}
state = 1;
} else if ((state == 1) && (pos.z <= (lastDepth / 1.2))) {
gotoAndStop("st_u2");
state = 2;
} else if ((state == 2) && (pos.z < 0)) {
if (CGP.levelIsEnd()) {
disable();
} else {
toNone();
}
}
var _local2 = (speed * dTime) / 1000;
if (state == 0) {
pos.x = pos.x + (dir.x * _local2);
pos.y = pos.y + (dir.y * _local2);
pos.z = pos.z + (dir.z * _local2);
} else {
pos.x = pos.x + ((((dir.x * _local2) * 140) * (lastDepth - pos.z)) / lastDepth);
pos.y = pos.y + ((((dir.y * _local2) * 60) * (lastDepth - pos.z)) / lastDepth);
pos.z = pos.z + ((dir.z * _local2) * (((lastDepth - pos.z) / lastDepth) + 1));
}
screenSynchronize();
}
function screenSynchronize() {
var _local2 = {x:0, y:0, k:0};
objTransform.getScreenXY(pos.x, pos.y, pos.z, _local2);
_x = _local2.x;
_y = _local2.y;
_xscale = ((_yscale = _local2.k * 100)) * xDir;
}
function isRemoved() {
return(pos.z < 0);
}
function toNone() {
noneTimeCounter = NONE_TIME;
hasBomb = !hasBomb;
state = 3;
_visible = false;
gotoAndStop("st_empty");
}
function disable() {
PLANES_COUNT--;
removeMovieClip();
}
function toDie() {
state = ST_DIE;
gotoAndStop("die");
}
function endDie() {
disable();
}
function isHit(x, y) {
return(isAvailable() && (mc_hit.hitTest(x, y, false)));
}
function isAvailable() {
return(state <= 2);
}
function doDamage(x, y) {
lifeCount--;
if (lifeCount <= 0) {
toDie();
} else {
CGP.addBoomHit(this, x, y, 25);
}
return(lifeCount <= 0);
}
static var LIFE_COUNT = 20;
static var INIT_SPEED = 110;
static var ST_DIE = 4;
static var NONE_TIME = 1000;
}
Symbol 368 MovieClip [__Packages.CSoldier] Frame 0
class CSoldier extends MovieClip
{
static var fSpeedCoeff, stayTime, objTransform;
var speed, mc_hit_head, mc_hit_body, headFlag, lifeCount, state, curDir, curPos, newPos, myRow, stayTimeCounter, myCol, myDX, myDZ, _xscale, _yscale, gotoAndStop, _x, _y, mc, _parent, removeMovieClip;
function CSoldier () {
super();
speed = 85 * fSpeedCoeff;
stayTime = 1500 / fSpeedCoeff;
mc_hit_body._visible = (mc_hit_head._visible = false);
headFlag = false;
lifeCount = LIFE_COUNT;
}
function process(dTime) {
var _local2 = (speed * dTime) / 1000;
if (state == ST_RUN) {
curPos.x = curPos.x + (_local2 * curDir.x);
curPos.z = curPos.z + (_local2 * curDir.z);
if (curPos.z <= newPos.z) {
if (myRow == (CGP.LM_ROWS - 1)) {
toStay();
} else {
tryMoveToNextPos();
}
}
} else if (state == ST_WAIT) {
tryMoveToNextPos();
} else if (state == ST_STAY) {
stayTimeCounter = stayTimeCounter + dTime;
if (stayTimeCounter >= stayTime) {
toAttack();
}
}
if (state != ST_DIE) {
screenSynchronize();
}
}
function startGo(col, row, curPos_, newPos_, k) {
myCol = col;
myRow = row;
curPos = curPos_;
curPos = curPos_;
myDX = 12 * (-1 + (2 * Math.random()));
myDZ = 15 * (-1 + (2 * Math.random()));
newPos = newPos_;
newPos.x = newPos.x + myDX;
newPos.z = newPos.z + myDZ;
curDir = newPos.minusNew(curPos);
curDir.normalize();
_xscale = (_yscale = (k * 100) * myScaleCoeff);
gotoAndStop("run");
state = ST_RUN;
}
function screenSynchronize() {
var _local2 = {x:0, y:0, k:0};
objTransform.getScreenXY(curPos.x, curPos.y, curPos.z, _local2);
_x = _local2.x;
_y = _local2.y;
_xscale = (_yscale = (_local2.k * 100) * myScaleCoeff);
}
function tryMoveToNextPos() {
var _local2;
_local2 = CGP.getFreeCellIn(myCol, myRow + 1);
if (_local2 == -1) {
toWait();
return(undefined);
}
CGP.freeCell(myCol, myRow);
myCol = _local2;
myRow = myRow + 1;
CGP.captureCell(myCol, myRow, this);
CGP.updateMovieToCellDepth(myCol, myRow, true);
newPos.reinit(CGP.getXFromCol(myCol), CGP.WORLD_HEIGHT, CGP.getZFromRow(myRow));
newPos.x = newPos.x + myDX;
newPos.z = newPos.z + myDZ;
curDir = newPos.minusNew(curPos);
curDir.normalize();
gotoAndStop("run");
state = ST_RUN;
}
function endAttack() {
toStay();
}
function attackMoment() {
var _local2 = {x:mc.mc_point._x, y:mc.mc_point._y};
mc.localToGlobal(_local2);
_parent.globalToLocal(_local2);
CGP.addGrenade(_local2.x, _local2.y);
}
function toStay() {
stayTimeCounter = 0;
gotoAndStop("stay");
state = ST_STAY;
}
function toWait() {
gotoAndStop("stay");
state = ST_WAIT;
}
function toAttack() {
gotoAndStop("attack");
state = ST_ATTACK;
}
function disable() {
CGP.freeCell(myCol, myRow);
removeMovieClip();
}
function toDie() {
state = ST_DIE;
if (Math.random() < 0.66) {
gotoAndStop("die1");
} else {
gotoAndStop("die2");
}
}
function endDie() {
disable();
}
function isHit(x, y) {
return(isAvailable() && (((headFlag = mc_hit_head.hitTest(x, y, false))) || (mc_hit_body.hitTest(x, y, false))));
}
function isAvailable() {
return(state != ST_DIE);
}
function doDamage(x, y) {
var _local2 = Math.random();
lifeCount--;
if (_local2 < 0.33) {
CGP.playSound(CGP.snd_squash02);
} else if (_local2 < 0.66) {
CGP.playSound(CGP.snd_squash03);
} else {
CGP.playSound(CGP.snd_squash07);
}
headFlag = false;
toDie();
return(lifeCount <= 0);
}
static var LIFE_COUNT = 1;
static var ST_RUN = 1;
static var ST_WAIT = 2;
static var ST_STAY = 3;
static var ST_ATTACK = 4;
static var ST_DIE = 5;
static var myScaleCoeff = 0.4;
}
Symbol 369 MovieClip [__Packages.CTank] Frame 0
class CTank extends MovieClip
{
static var fSpeedCoeff, stayTime, objTransform;
var speed, mc_hit, lifeCount, state, curDir, curPos, newPos, downRow, stayTimeCounter, rightCol, myDX, myDZ, _xscale, _yscale, gotoAndStop, _x, _y, mc_point, localToGlobal, _parent, removeMovieClip;
function CTank () {
super();
speed = 40 * fSpeedCoeff;
stayTime = 1000 / fSpeedCoeff;
mc_hit._visible = false;
lifeCount = LIFE_COUNT;
}
function process(dTime) {
var _local2 = (speed * dTime) / 1000;
if (state == ST_RUN) {
curPos.x = curPos.x + (_local2 * curDir.x);
curPos.z = curPos.z + (_local2 * curDir.z);
if (curPos.z <= newPos.z) {
if (downRow == (CGP.LM_ROWS - 1)) {
toStay();
} else {
tryMoveToNextPos();
}
}
} else if (state == ST_WAIT) {
tryMoveToNextPos();
} else if (state == ST_STAY) {
stayTimeCounter = stayTimeCounter + dTime;
if (stayTimeCounter >= stayTime) {
toAttack();
}
}
if (state != ST_DIE) {
screenSynchronize();
}
}
function startGo(col, row, curPos_, newPos_, k) {
rightCol = col;
downRow = row;
curPos = curPos_;
curPos = curPos_;
myDX = 12 * (-1 + (2 * Math.random()));
myDZ = 15 * (-1 + (2 * Math.random()));
newPos = newPos_;
newPos.x = newPos.x + myDX;
newPos.z = newPos.z + myDZ;
curDir = newPos.minusNew(curPos);
curDir.normalize();
_xscale = (_yscale = (k * 100) * myScaleCoeff);
if ((newPos.x - curPos.x) >= ROTATE_AREA) {
gotoAndStop(3);
} else if ((curPos.x - newPos.x) >= ROTATE_AREA) {
gotoAndStop(2);
}
state = ST_RUN;
}
function screenSynchronize() {
var _local2 = {x:0, y:0, k:0};
objTransform.getScreenXY(curPos.x, curPos.y, curPos.z, _local2);
_x = _local2.x;
_y = _local2.y;
_xscale = (_yscale = (_local2.k * 100) * myScaleCoeff);
}
function tryMoveToNextPos() {
var _local2;
CGP.freeCellForTank(rightCol, downRow);
_local2 = CGP.getFreeDoubleCellIn(rightCol, downRow + 1);
if (_local2 == -1) {
CGP.captureCellForTank(rightCol, downRow, this);
if (downRow >= (CGP.LM_ROWS - 2)) {
toStay();
} else {
toWait();
}
return(undefined);
}
rightCol = _local2;
downRow = downRow + 1;
CGP.captureCellForTank(rightCol, downRow, this);
CGP.updateMovieToCellDepth(rightCol, downRow, true);
newPos.reinit(CGP.getXFromCol(rightCol - 0.5), CGP.WORLD_HEIGHT, CGP.getZFromRow(downRow - 0.5));
newPos.x = newPos.x + myDX;
newPos.z = newPos.z + myDZ;
curDir = newPos.minusNew(curPos);
curDir.normalize();
if ((newPos.x - curPos.x) >= ROTATE_AREA) {
gotoAndStop(3);
} else if ((curPos.x - newPos.x) >= ROTATE_AREA) {
gotoAndStop(2);
} else {
gotoAndStop(1);
}
state = ST_RUN;
}
function toStay() {
stayTimeCounter = 0;
state = ST_STAY;
}
function toWait() {
state = ST_WAIT;
}
function toAttack() {
var _local2 = {x:mc_point._x, y:mc_point._y};
localToGlobal(_local2);
_parent.globalToLocal(_local2);
CGP.addTankShot(_local2.x, _local2.y);
toStay();
}
function disable() {
CGP.freeCellForTank(rightCol, downRow);
removeMovieClip();
}
function toDie() {
state = ST_DIE;
gotoAndStop("die");
}
function endDie() {
disable();
}
function isHit(x, y) {
return(isAvailable() && (mc_hit.hitTest(x, y, false)));
}
function isAvailable() {
return(state != ST_DIE);
}
function doDamage(x, y) {
lifeCount--;
if (lifeCount <= 0) {
toDie();
} else {
CGP.addBoomHit(this, x, y, 30);
}
return(lifeCount <= 0);
}
static var LIFE_COUNT = 10;
static var ROTATE_AREA = 20;
static var ST_RUN = 1;
static var ST_WAIT = 2;
static var ST_STAY = 3;
static var ST_ATTACK = 4;
static var ST_DIE = 5;
static var myScaleCoeff = 0.6;
}
Symbol 370 MovieClip [__Packages.CGrenade] Frame 0
class CGrenade extends MovieClip
{
static var fSpeedCoeff;
var flySpeed, mc_hit, startY, midY, _x, _y, curPos, _xscale, _yscale, flyDir, curH, state, removeMovieClip, gotoAndStop;
function CGrenade () {
super();
flySpeed = 60 * fSpeedCoeff;
mc_hit._visible = false;
}
function init(x, y) {
startY = y;
midY = y + ((END_Y - y) / 2);
_x = x;
_y = y;
curPos = new CVector2D(x, y);
_xscale = (_yscale = START_SCALE);
if (((CGP.LEVEL_WIDTH / 2) - x) > RADIUS) {
flyDir = new CVector2D(x + RADIUS, END_Y);
} else if ((x - (CGP.LEVEL_WIDTH / 2)) > RADIUS) {
flyDir = new CVector2D(x - RADIUS, END_Y);
} else {
flyDir = new CVector2D(CGP.LEVEL_WIDTH / 2, END_Y);
}
flyDir.x = flyDir.x - x;
flyDir.y = flyDir.y - y;
flyDir.normalize();
curH = 0;
state = ST_FLY;
}
function process(dTime) {
var _local2 = (flySpeed * dTime) / 1000;
if (state == ST_DIE) {
return(undefined);
}
curPos.x = curPos.x + (flyDir.x * _local2);
curPos.y = curPos.y + (flyDir.y * _local2);
if (curPos.y < midY) {
curH = 50 * (1 - ((midY - curPos.y) / (midY - startY)));
} else {
curH = (50 * (END_Y - curPos.y)) / (END_Y - midY);
}
_x = curPos.x;
_y = curPos.y - curH;
if (curPos.y >= END_Y) {
boom();
} else {
_xscale = (_yscale = START_SCALE + ((END_SCALE - START_SCALE) * (1 - ((END_Y - curPos.y) / (END_Y - startY)))));
}
}
function boom() {
CGP.playSound(CGP.snd_grenade);
CGP.doDamage(_x, _y);
disable();
}
function disable() {
removeMovieClip();
}
function toDie() {
state = ST_DIE;
gotoAndStop("die");
}
function endDie() {
disable();
}
function isHit(x, y) {
return(isAvailable() && (mc_hit.hitTest(x, y, false)));
}
function isAvailable() {
return(state == ST_FLY);
}
function doDamage(x, y) {
toDie();
return(true);
}
static var RADIUS = 100;
static var END_Y = 360;
static var START_SCALE = 42;
static var END_SCALE = 100;
static var ST_FLY = 1;
static var ST_DIE = 2;
}
Symbol 371 MovieClip [__Packages.CVector2D] Frame 0
class CVector2D
{
var x, y;
function CVector2D (x_, y_) {
x = x_;
y = y_;
}
function reinit(x_, y_) {
x = x_;
y = y_;
}
function getUgol() {
return(Math.atan2(y, x));
}
function duplicate() {
return(new CVector2D(x, y));
}
function copyTo(v) {
v.x = x;
v.y = y;
}
function minus(v) {
x = x - v.x;
y = y - v.y;
}
function minusNew(v) {
return(new CVector2D(x - v.x, y - v.y));
}
function normalize() {
var _local2 = Math.sqrt((x * x) + (y * y));
if (_local2 > 0.001) {
x = x / _local2;
y = y / _local2;
}
}
function reverseNew() {
return(new CVector2D(-x, -y));
}
function scalar(v) {
return((x * v.x) + (y * v.y));
}
function modul() {
return(Math.sqrt((x * x) + (y * y)));
}
function reflectFromNormal(n) {
var _local2 = Math.atan2(n.y, n.x);
rotate(-_local2);
x = -x;
rotate(_local2);
}
function rotate(u) {
var _local4 = x;
var _local3 = y;
x = (_local4 * Math.cos(u)) - (_local3 * Math.sin(u));
y = (_local4 * Math.sin(u)) + (_local3 * Math.cos(u));
}
function rotateNew(u) {
return(new CVector2D((x * Math.cos(u)) - (y * Math.sin(u)), (x * Math.sin(u)) + (y * Math.cos(u))));
}
function mult(k) {
x = x * k;
y = y * k;
}
function multNew(k) {
return(new CVector2D(x * k, y * k));
}
function plus(v) {
x = x + v.x;
y = y + v.y;
}
function plusNew(v) {
return(new CVector2D(x + v.x, y + v.y));
}
function getDistanceTo(p1, p2) {
var _local3 = p1.y - p2.y;
var _local2 = p2.x - p1.x;
var _local6 = (p1.x * (p2.y - p1.y)) - (p1.y * (p2.x - p1.x));
var _local5 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
_local3 = _local3 / _local5;
_local2 = _local2 / _local5;
_local6 = _local6 / _local5;
return(((_local3 * x) + (_local2 * y)) + _local6);
}
}
Symbol 372 MovieClip [__Packages.CPlaneShot] Frame 0
class CPlaneShot extends MovieClip
{
static var fSpeedCoeff;
var flySpeed, mc_hit, startY, _x, _y, curPos, _xscale, _yscale, flyDir, state, removeMovieClip, gotoAndStop;
function CPlaneShot () {
super();
flySpeed = 130 * fSpeedCoeff;
mc_hit._visible = false;
}
function init(x, y) {
startY = y;
_x = x;
_y = y;
curPos = new CVector2D(x, y);
_xscale = (_yscale = START_SCALE);
if (((CGP.LEVEL_WIDTH / 2) - x) > RADIUS) {
flyDir = new CVector2D(x + RADIUS, END_Y);
} else if ((x - (CGP.LEVEL_WIDTH / 2)) > RADIUS) {
flyDir = new CVector2D(x - RADIUS, END_Y);
} else {
flyDir = new CVector2D(CGP.LEVEL_WIDTH / 2, END_Y);
}
flyDir.x = flyDir.x - x;
flyDir.y = flyDir.y - y;
flyDir.normalize();
state = ST_FLY;
}
function process(dTime) {
var _local2 = (flySpeed * dTime) / 1000;
if (state == ST_DIE) {
return(undefined);
}
curPos.x = curPos.x + (flyDir.x * _local2);
curPos.y = curPos.y + (flyDir.y * _local2);
_x = curPos.x;
_y = curPos.y;
if (curPos.y >= END_Y) {
boom();
} else {
_xscale = (_yscale = START_SCALE + ((END_SCALE - START_SCALE) * (1 - ((END_Y - curPos.y) / (END_Y - startY)))));
}
}
function boom() {
CGP.playSound(CGP.snd_bombexplode);
CGP.doDamage(_x, _y);
disable();
}
function disable() {
removeMovieClip();
}
function toDie() {
state = ST_DIE;
gotoAndStop("die");
}
function endDie() {
disable();
}
function isHit(x, y) {
return(isAvailable() && (mc_hit.hitTest(x, y, false)));
}
function isAvailable() {
return(state == ST_FLY);
}
function doDamage(x, y) {
toDie();
return(true);
}
static var RADIUS = 30;
static var END_Y = 287;
static var START_SCALE = 42;
static var END_SCALE = 100;
static var ST_FLY = 1;
static var ST_DIE = 2;
}
Symbol 373 MovieClip [__Packages.CTankShot] Frame 0
class CTankShot extends MovieClip
{
static var fSpeedCoeff;
var flySpeed, startY, _x, _y, curPos, _xscale, _yscale, flyDir, removeMovieClip;
function CTankShot () {
super();
flySpeed = 180 * fSpeedCoeff;
}
function init(x, y) {
startY = y;
_x = x;
_y = y;
curPos = new CVector2D(x, y);
_xscale = (_yscale = START_SCALE);
if (((CGP.LEVEL_WIDTH / 2) - x) > RADIUS) {
flyDir = new CVector2D(x + RADIUS, END_Y);
} else if ((x - (CGP.LEVEL_WIDTH / 2)) > RADIUS) {
flyDir = new CVector2D(x - RADIUS, END_Y);
} else {
flyDir = new CVector2D(CGP.LEVEL_WIDTH / 2, END_Y);
}
flyDir.x = flyDir.x - x;
flyDir.y = flyDir.y - y;
flyDir.normalize();
}
function process(dTime) {
var _local2 = (flySpeed * dTime) / 1000;
curPos.x = curPos.x + (flyDir.x * _local2);
curPos.y = curPos.y + (flyDir.y * _local2);
_x = curPos.x;
_y = curPos.y;
if (curPos.y >= END_Y) {
boom();
} else {
_xscale = (_yscale = START_SCALE + ((END_SCALE - START_SCALE) * (1 - ((END_Y - curPos.y) / (END_Y - startY)))));
}
}
function boom() {
CGP.doDamage(_x, _y);
disable();
}
function disable() {
removeMovieClip();
}
static var RADIUS = 30;
static var END_Y = 365;
static var START_SCALE = 42;
static var END_SCALE = 80;
}
Symbol 73 MovieClip [lib_boom] Frame 23
this._parent.endDie();
Symbol 74 MovieClip [lib_tank] Frame 1
#initclip 23
Object.registerClass("lib_tank", CTank);
#endinitclip
this.stop();
Symbol 99 MovieClip Frame 1
this.stop();
Symbol 99 MovieClip Frame 10
this.stop();
this._parent.endOpen();
Symbol 104 MovieClip Frame 1
this.stop();
Instance of Symbol 74 MovieClip [lib_tank] "mc_t2" in Symbol 104 MovieClip Frame 2
onClipEvent (load) {
this.gotoAndStop(2);
}
Instance of Symbol 74 MovieClip [lib_tank] "mc_t1" in Symbol 104 MovieClip Frame 2
onClipEvent (load) {
this.gotoAndStop(2);
}
Symbol 104 MovieClip Frame 10
this.stop();
this._parent.endOpen();
Symbol 109 MovieClip Frame 1
this.stop();
Instance of Symbol 74 MovieClip [lib_tank] "mc_t2" in Symbol 109 MovieClip Frame 2
onClipEvent (load) {
this.gotoAndStop(2);
}
Instance of Symbol 74 MovieClip [lib_tank] "mc_t1" in Symbol 109 MovieClip Frame 2
onClipEvent (load) {
this.gotoAndStop(2);
}
Symbol 109 MovieClip Frame 10
this.stop();
this._parent.endOpen();
Symbol 118 MovieClip [lib_water_boom] Frame 23
this._parent.endDie();
Symbol 119 MovieClip [lib_boat] Frame 1
#initclip 16
Object.registerClass("lib_boat", CBoat);
#endinitclip
this.stop();
Symbol 157 MovieClip Frame 7
this._parent.attackMoment();
Symbol 157 MovieClip Frame 12
this._parent.endAttack();
Symbol 192 MovieClip Frame 17
this._parent.endDie();
Symbol 200 MovieClip Frame 15
this._parent.endDie();
Symbol 201 MovieClip [lib_soldier] Frame 1
#initclip 17
Object.registerClass("lib_soldier", CSoldier);
#endinitclip
this.stop();
Symbol 217 MovieClip [lib_grenade] Frame 1
#initclip 18
Object.registerClass("lib_grenade", CGrenade);
#endinitclip
this.stop();
Symbol 220 MovieClip [lib_tank_shot] Frame 1
#initclip 19
Object.registerClass("lib_tank_shot", CTankShot);
#endinitclip
Symbol 227 MovieClip [lib_plane] Frame 1
#initclip 20
Object.registerClass("lib_plane", CEnemyPlane);
#endinitclip
this.stop();
Symbol 230 MovieClip [lib_bomb] Frame 1
#initclip 21
Object.registerClass("lib_bomb", CPlaneShot);
#endinitclip
this.stop();
Symbol 233 MovieClip [lib_dirt_hit] Frame 7
this.removeMovieClip();
Symbol 236 MovieClip [lib_water_hit] Frame 7
this.removeMovieClip();
Symbol 237 MovieClip [lib_boom_hit] Frame 13
this.removeMovieClip();
Symbol 255 MovieClip [lib_pacman] Frame 1
#initclip 22
Object.registerClass("lib_pacman", CPacman);
#endinitclip
Symbol 282 Button
on (release) {
new_game_pressed();
}
Symbol 287 Button
on (release) {
how_to_play_pressed();
}
Symbol 292 Button
on (release) {
more_pressed();
}
Symbol 294 MovieClip Frame 1
stop();
Symbol 296 Button
on (press) {
this._parent.soundOff();
this.gotoAndStop(2);
}
Symbol 298 Button
on (press) {
this._parent.soundOn();
this.gotoAndStop(1);
}
Symbol 299 MovieClip Frame 1
this.stop();
Symbol 304 Button
on (release) {
back_pressed();
}
Symbol 327 MovieClip [mc_gun] Frame 1
#initclip 24
Object.registerClass("mc_gun", CGun);
#endinitclip
Symbol 329 MovieClip Frame 6
this._parent.gotoAndStop("stay");
Symbol 330 MovieClip Frame 1
this.stop();
Symbol 332 MovieClip Frame 25
this.swapDepths(10000);
this.removeMovieClip();
Symbol 333 MovieClip Frame 1
this.stop();
Symbol 333 MovieClip Frame 5
CGP.dieMoment();
Symbol 333 MovieClip Frame 28
CGP.endDie();
this.stop();
Symbol 338 MovieClip Frame 24
this.stop();
Symbol 341 Button
on (release) {
this._parent.newGame();
}
Symbol 344 MovieClip Frame 1
this.stop();