Frame 1
function addWall(x, y, type) {
_root.wall_container.attachMovie("wall", "wall" + this.wallCount, _root.wall_container.getNextHighestDepth());
_root.wall_container["wall" + this.wallCount]._x = x;
_root.wall_container["wall" + this.wallCount]._y = y;
_root.wall_container["wall" + this.wallCount].gotoAndStop(type);
_root.wall_container["wall" + this.wallCount].idNumber = this.wallCount;
this.objMap.addObject(this.wallCount, 0, x, y);
this.wallCount++;
}
function addTank(x, y, type) {
_root.tank_container.attachMovie("enemy_" + type, "tank" + this.tankCount, _root.tank_container.getNextHighestDepth());
_root.tank_container["tank" + this.tankCount]._x = x;
_root.tank_container["tank" + this.tankCount]._y = y;
_root.tank_container["tank" + this.tankCount].idNumber = this.tankCount;
_root.tank_container["tank" + this.tankCount].aiType = type;
_root[("enemy" + type) + "_Create"].call(_root.tank_container["tank" + this.tankCount]);
this.objMap.addObject(this.tankCount, 1, x, y);
_root.tankCount++;
}
function addPlayer(x, y) {
_root.tank_container.attachMovie("player", "player", _root.tank_container.getNextHighestDepth());
_root.tank_container.player._x = x;
_root.tank_container.player._y = y;
_root.tank_container.player.base._rotation = 90;
_root.player_Create.call(_root.tank_container.player);
_root.tank_container.player.rotate = new mx.transitions.Tween(_root.tank_container.player, "currentRotation", mx.transitions.easing.None.easeNone, 90, 90, 10, false);
this.objMap.addObject(-1, 1, x, y);
}
function addTread(x, y, r) {
if (_root.tread_container["tread" + this.treadCount] != undefined) {
_root.tread_container["tread" + this.treadCount].removeMovieClip();
}
_root.tread_container.attachMovie("tank_tread", "tread" + this.treadCount, _root.tread_container.getNextHighestDepth());
_root.tread_container["tread" + this.treadCount]._x = x;
_root.tread_container["tread" + this.treadCount]._y = y;
_root.tread_container["tread" + this.treadCount]._rotation = r;
this.treadCount++;
if (this.treadCount > this.maxTreads) {
this.treadCount = 0;
}
}
function addMuzzleFlash(x, y) {
_root.explosion_container.attachMovie("tank_muzzleflash", "explosion" + this.explosionCount, _root.explosion_container.getNextHighestDepth());
_root.explosion_container["explosion" + this.explosionCount]._x = x;
_root.explosion_container["explosion" + this.explosionCount]._y = y;
this.explosionCount++;
if (this.explosionCount > this.maxExplosions) {
this.explosionCount = 0;
}
}
function addBullet(x, y, r, hits, owner) {
_root.bullet_container.attachMovie("bullet", "bullet" + this.bulletCount, _root.bullet_container.getNextHighestDepth());
_root.bullet_container["bullet" + this.bulletCount]._x = x;
_root.bullet_container["bullet" + this.bulletCount]._y = y;
_root.bullet_container["bullet" + this.bulletCount]._rotation = r;
_root.bullet_container["bullet" + this.bulletCount].idNumber = this.bulletCount;
_root.bullet_container["bullet" + this.bulletCount].hitMax = hits;
_root.bullet_container["bullet" + this.bulletCount].tankOwner = owner;
_root.bullet_shot.start(0, 0);
_root.bullet_Create.call(_root.bullet_container["bullet" + this.bulletCount]);
this.objMap.addObject(this.bulletCount, 2, x, y);
this.bulletCount++;
if (this.bulletCount > this.maxBullets) {
this.bulletCount = 0;
}
}
function addBulletSmoke(x, y) {
if (_root.smoke_container["smoke" + this.smokeCount] != undefined) {
_root.smoke_container["smoke" + this.smokeCount].removeMovieClip();
}
_root.smoke_container.attachMovie("bullet_smoke", "smoke" + this.smokeCount, _root.smoke_container.getNextHighestDepth());
_root.smoke_container["smoke" + this.smokeCount]._x = x;
_root.smoke_container["smoke" + this.smokeCount]._y = y;
this.smokeCount++;
if (this.smokeCount > this.maxSmokes) {
this.smokeCount = 0;
}
}
function addBulletExplosion(x, y) {
_root.explosion_container.attachMovie("bullet_explosion", "explosion" + this.explosionCount, _root.explosion_container.getNextHighestDepth());
_root.explosion_container["explosion" + this.explosionCount]._x = x;
_root.explosion_container["explosion" + this.explosionCount]._y = y;
this.explosionCount++;
if (this.explosionCount > this.maxExplosions) {
this.explosionCount = 0;
}
}
function addBulletBounceExp(x, y) {
_root.explosion_container.attachMovie("bullet_bounceExp", "explosion" + this.explosionCount, _root.explosion_container.getNextHighestDepth());
_root.explosion_container["explosion" + this.explosionCount]._x = x;
_root.explosion_container["explosion" + this.explosionCount]._y = y;
this.explosionCount++;
if (this.explosionCount > this.maxExplosions) {
this.explosionCount = 0;
}
}
function addBomb(x, y, owner) {
_root.bomb_container.attachMovie("bomb", "bomb" + this.bombCount, _root.bomb_container.getNextHighestDepth());
_root.bomb_container["bomb" + this.bombCount]._x = x;
_root.bomb_container["bomb" + this.bombCount]._y = y;
_root.bomb_container["bomb" + this.bombCount].tankOwner = owner;
_root.bomb_container["bomb" + this.bombCount].idNumber = this.bombCount;
_root.bomb_container["bomb" + this.bombCount].isActivated = 0;
this.objMap.addObject(this.bombCount, 3, x, y);
this.bombCount++;
if (this.bombCount > this.maxBombs) {
this.bombCount = 0;
}
}
function addBombExplosion(x, y) {
if (_root.explosion_container["explosion" + this.explosionCount] != undefined) {
_root.explosion_container["explosion" + this.explosionCount].removeMovieClip();
}
_root.explosion_container.attachMovie("bomb_explosion", "explosion" + this.explosionCount, _root.explosion_container.getNextHighestDepth());
_root.explosion_container["explosion" + this.explosionCount]._x = x;
_root.explosion_container["explosion" + this.explosionCount]._y = y;
_root.explosion_container["explosion" + this.explosionCount].idNumber = this.explosionCount;
this.objMap.addObject(this.explosionCount, 4, x, y);
this.explosionCount++;
if (this.explosionCount > this.maxExplosions) {
this.explosionCount = 0;
}
}
function addTankExplosion(x, y) {
if (_root.explosion_container["explosion" + this.explosionCount] != undefined) {
_root.explosion_container["explosion" + this.explosionCount].removeMovieClip();
}
_root.explosion_container.attachMovie("tank_explosion", "explosion" + this.explosionCount, _root.explosion_container.getNextHighestDepth());
_root.explosion_container["explosion" + this.explosionCount]._x = x;
_root.explosion_container["explosion" + this.explosionCount]._y = y;
this.explosionCount++;
if (this.explosionCount > this.maxExplosions) {
this.explosionCount = 0;
}
}
function addWallExplosion(x, y) {
if (_root.explosion_container["explosion" + this.explosionCount] != undefined) {
_root.explosion_container["explosion" + this.explosionCount].removeMovieClip();
}
_root.explosion_container.attachMovie("wall_explosion", "explosion" + this.explosionCount, _root.explosion_container.getNextHighestDepth());
_root.explosion_container["explosion" + this.explosionCount]._x = x;
_root.explosion_container["explosion" + this.explosionCount]._y = y;
this.explosionCount++;
if (this.explosionCount > this.maxExplosions) {
this.explosionCount = 0;
}
}
function addDeathMark(x, y) {
_root.tread_container.attachMovie("tank_death", "death" + this.killCount, _root.tread_container.getNextHighestDepth());
_root.tread_container["death" + this.killCount]._x = x;
_root.tread_container["death" + this.killCount]._y = y;
this.killCount++;
}
function clearBoard() {
_root.tank_container.player.removeMovieClip();
x = 0;
while (x < _root.tankCount) {
_root.tank_container["tank" + x].removeMovieClip();
x++;
}
x = 0;
while (x < _root.maxBullets) {
_root.bullet_container["bullet" + x].removeMovieClip();
x++;
}
x = 0;
while (x < _root.maxSmokes) {
_root.bullet_container["smoke" + x].removeMovieClip();
x++;
}
x = 0;
while (x < _root.maxBombs) {
_root.bomb_container["bomb" + x].removeMovieClip();
x++;
}
x = 0;
while (x < _root.maxExplosions) {
_root.explosion_container["explosion" + x].removeMovieClip();
x++;
}
x = 0;
while (x < _root.killCount) {
_root.tread_container["death" + x].removeMovieClip();
x++;
}
x = 0;
while (x < _root.maxTreads) {
_root.tread_container["tread" + x].removeMovieClip();
x++;
}
x = 0;
while (x < _root.wallCount) {
_root.wall_container["wall" + x].removeMovieClip();
x++;
}
this.objMap.clearAll();
this.node_Clear();
treadCount = 0;
smokeCount = 0;
bulletCount = 0;
explosionCount = 0;
bombCount = 0;
wallCount = 0;
tankCount = 0;
killCount = 0;
}
function loadBoard(level) {
var _local5 = this.mapData[level];
var _local6 = this.enemyData[level];
var _local7 = this.nodeData[level];
var _local8 = _local5[0].length;
var _local9 = _local5.length;
var _local12;
var _local11;
var _local4;
var _local3;
this.clearBoard();
_local4 = 0;
while (_local4 < _local9) {
_local3 = 0;
while (_local3 < _local8) {
switch (_local5[_local4][_local3]) {
case 0 :
break;
case 1 :
case 2 :
case 3 :
case 4 :
this.addWall((_local3 * this.cellW) + (0.5 * _root.cellW), (_local4 * this.cellH) + (0.5 * this.cellH), _local5[_local4][_local3]);
break;
case 5 :
this.addPlayer((_local3 * this.cellW) + (0.5 * _root.cellW), (_local4 * this.cellH) + (0.5 * this.cellH));
break;
case 6 :
this.addTank((_local3 * this.cellW) + (0.5 * this.cellW), (_local4 * this.cellH) + (0.5 * this.cellH), _local6[this.tankCount]);
break;
case 9 :
trace(this.nodeCount);
this.node_Add((_local3 * this.cellW) + (0.5 * this.cellW), (_local4 * this.cellH) + (0.5 * this.cellH), _local7[this.nodeCount], this.cellW, this.cellH);
}
_local3++;
}
_local4++;
}
this.node_Calculate();
}
function newLevel() {
this.currentLevel++;
this.currentEnemies = this.enemyData[currentLevel].length;
_root.attachMovie("mission_intro", "mission_intro", _root.getNextHighestDepth());
}
function endLevel() {
_root.pauseGame();
_root.attachMovie("mission_complete", "mission_complete", _root.getNextHighestDepth());
_root.mission_complete._x = 400;
_root.mission_complete._y = 125;
}
function endGame() {
_root.pauseGame();
if (_root.mission_failed) {
_root.mission_failed.removeMovieClip();
}
_root.attachMovie("mission_failed", "mission_failed", _root.getNextHighestDepth());
_root.mission_failed._x = 400;
_root.mission_failed._y = 125;
}
function pauseGame() {
var _local2;
var _local3 = _root.objMap.getList(3);
var _local4 = _root.objMap.getList(4);
if (_root.isPaused == 0) {
_root.isPaused = 1;
_local2 = 0;
while (_local2 < _local3.length) {
_root.bomb_container["bomb" + _local3[_local2]].base.stop();
_local2++;
}
_local2 = 0;
while (_local2 < _local4.length) {
_root.explosion_container["explosion" + _local4[_local2]].stop();
_local2++;
}
} else {
_root.isPaused = 0;
_local2 = 0;
while (_local2 < _local3.length) {
if (_root.bomb_container["bomb" + _local3[_local2]].isActivated == 1) {
_root.bomb_container["bomb" + _local3[_local2]].base.play();
}
_local2++;
}
_local2 = 0;
while (_local2 < _local4.length) {
_root.explosion_container["explosion" + _local4[_local2]].play();
_local2++;
}
}
}
function bullet_Create() {
this.hitCount = 0;
this.smokeTimer = 0;
this.speedBullet = 5;
}
function bullet_Move() {
newX = this.speedBullet * Math.sin(_root.toRadians(this._rotation + 90));
newY = this.speedBullet * Math.cos(_root.toRadians(this._rotation + 90));
this._x = this._x + newX;
this._y = this._y - newY;
_root.objMap.movObject(this.idNumber, 2, this._x, this._y);
if (this.smokeTimer == 0) {
_root.addBulletSmoke(this._x, this._y);
this.smokeTimer = 1;
} else {
this.smokeTimer--;
}
}
function bullet_CheckDeath() {
if (this.hitCount >= this.hitMax) {
if (this.tankOwner == -1) {
_root.tank_container.player.fireCount++;
} else {
_root.tank_container["tank" + this.tankOwner].fireCount++;
}
_root.addBulletExplosion(this._x, this._y);
_root.objMap.delObject(this.idNumber, 2);
this.removeMovieClip();
}
}
function bullet_CheckBullet(idA, idB) {
var _local2 = _root.bullet_container["bullet" + idA];
var _local3 = _root.bullet_container["bullet" + idB];
if (_local2.hitTest(_local3) == true) {
_local2.hitCount = _local2.hitMax;
_root.bullet_explosion.start(0, 0);
_local3.hitCount = _local3.hitMax;
}
}
function bullet_CheckWall(idA, idB) {
var _local3 = _root.bullet_container["bullet" + idA];
var _local4 = _root.wall_container["wall" + idB];
var _local7;
var _local8;
var _local5;
var _local9;
var _local6;
if (_local4._currentframe != 4) {
if (_local4.base.hitTest(_local3._x, _local3._y, false) == true) {
_local7 = _root.toDegrees(Math.atan((0.5 * _local4.base._width) / (0.5 * _local4.base._height)));
_local8 = _root.toDegrees(Math.atan((0.5 * _local4.base._height) / (0.5 * _local4.base._width)));
_local5 = _root.calcAngle(_local3._x, _local4._x, _local3._y, _local4._y);
_local9 = _local3._rotation;
if (_root.isBetween(_local7 * -1, _local7, _local5)) {
if (_local3._rotation > 0) {
_local6 = _local3._rotation * -1;
}
} else if (_root.isBetween(90 - _local8, 90 + _local8, _local5)) {
if ((_local3._rotation < -90) || (_local3._rotation > 90)) {
_local6 = 90 - (_local3._rotation - 90);
}
} else if (_root.isBetween(180 - _local7, 180, _local5) || (_root.isBetween(-180, -180 + _local7, _local5))) {
if (_local3._rotation < 0) {
_local6 = _local3._rotation * -1;
}
} else if (_root.isBetween(-90 - _local8, -90 + _local8, _local5)) {
if ((_local3._rotation > -90) || (_local3._rotation < 90)) {
_local6 = 90 - (_local3._rotation - 90);
}
}
if (_local6 != _local9) {
_local3.hitCount++;
if (_local3.hitCount == 1) {
_root.bullet_bounce.start(0, 0);
_root.addBulletBounceExp(_local3._x, _local3._y);
} else if (_local3.hitCount == 2) {
_root.bullet_explosion.start(0, 0);
}
if (_local3.hitCount < _local3.hitMax) {
_local3._rotation = _local6;
this.bullet_Move.call(_local3);
}
}
}
}
}
function bullet_CheckBomb(idA, idB) {
var _local2 = _root.bullet_container["bullet" + idA];
var _local3 = _root.bomb_container["bomb" + idB];
if (_local2.hitTest(_local3.base) == true) {
_local2.hitCount = _local2.hitMax;
_local3.explode = 1;
}
}
function bomb_CheckDeath() {
if (this.explode == 1) {
if (this.tankOwner == -1) {
_root.tank_container.player.mineCount++;
} else {
_root.tank_container["tank" + this.tankOwner].mineCount++;
}
_root.addBombExplosion(this._x, this._y);
_root.mine_explosion.start(0, 0);
_root.objMap.delObject(this.idNumber, 3);
this.removeMovieClip();
}
}
function explosion_CheckTank(idA, idB) {
var _local3 = _root.explosion_container["explosion" + idA];
var _local2 = _root.tank_container[((idB != -1) ? ("tank" + idB) : "player")];
if (_local3.detect.hitTest(_local2) == true) {
_local2.isDestroyed = 1;
}
}
function explosion_CheckBullet(idA, idB) {
var _local3 = _root.explosion_container["explosion" + idA];
var _local2 = _root.bullet_container["bullet" + idB];
if (_local3.detect.hitTest(_local2) == true) {
_local2.hitCount = _local2.hitMax;
}
}
function explosion_CheckWall(idA, idB) {
var _local3 = _root.explosion_container["explosion" + idA];
var _local2 = _root.wall_container["wall" + idB];
if (_local2._currentframe == 3) {
if (_local3.detect.hitTest(_local2) == true) {
_root.addWallExplosion(_local2._x, _local2._y);
_root.objMap.delObject(_local2.idNumber, 0);
_local2.removeMovieClip();
}
}
}
function explosion_CheckBomb(idA, idB) {
var _local3 = _root.explosion_container["explosion" + idA];
var _local2 = _root.bomb_container["bomb" + idB];
if (_local3.detect.hitTest(_local2) == true) {
_local2.explode = 1;
}
}
function tank_CheckTank(idA, idB) {
var _local2 = _root.tank_container[((idA != -1) ? ("tank" + idA) : "player")];
var _local3 = _root.tank_container[((idB != -1) ? ("tank" + idB) : "player")];
var _local5 = 3;
var _local4;
var _local7;
var _local6;
if ((((((((_local2.base.a.hitTest(_local3.base) == true) || (_local2.base.b.hitTest(_local3.base) == true)) || (_local2.base.c.hitTest(_local3.base) == true)) || (_local2.base.d.hitTest(_local3.base) == true)) || (_local2.base.e.hitTest(_local3.base) == true)) || (_local2.base.f.hitTest(_local3.base) == true)) || (_local2.base.g.hitTest(_local3.base) == true)) && (((((((_local3.base.a.hitTest(_local2.base) == true) || (_local3.base.b.hitTest(_local2.base) == true)) || (_local3.base.c.hitTest(_local2.base) == true)) || (_local3.base.d.hitTest(_local2.base) == true)) || (_local3.base.e.hitTest(_local2.base) == true)) || (_local3.base.f.hitTest(_local2.base) == true)) || (_local3.base.g.hitTest(_local2.base) == true))) {
_local4 = Math.abs(_root.toDegrees(Math.atan((_local2._x - _local3._x) / (_local3._y - _local2._y))));
if ((_local2._x > _local3._x) && (_local2._y > _local3._y)) {
_local4 = (90 - _local4) + 90;
} else if ((_local2._x < _local3._x) && (_local2._y >= _local3._y)) {
_local4 = _local4 + 180;
} else if ((_local2._x < _local3._x) && (_local2._y < _local3._y)) {
_local4 = (90 - _local4) + 270;
}
if (_local4 > 180) {
_local4 = -1 * (360 - _local4);
}
_local7 = _local5 * Math.sin(_root.toRadians(_local4));
_local6 = _local5 * Math.cos(_root.toRadians(_local4));
_local2._x = _local2._x + _local7;
_local2._y = _local2._y - _local6;
_local3._x = _local3._x - _local7;
_local3._y = _local3._y + _local6;
_root.objMap.movObject(idA, 1, _local2._x, _local2._y);
_root.objMap.movObject(idB, 1, _local3._x, _local3._y);
_local2.disabled = 2;
_local3.disabled = 2;
}
}
function tank_CheckWall(idA, idB) {
var _local2 = _root.tank_container[((idA != -1) ? ("tank" + idA) : "player")];
var _local3 = _root.wall_container["wall" + idB];
var _local6 = 3;
var _local5;
var _local7;
var _local4;
if (((((((_local2.base.a.hitTest(_local3) == true) || (_local2.base.b.hitTest(_local3) == true)) || (_local2.base.c.hitTest(_local3) == true)) || (_local2.base.d.hitTest(_local3) == true)) || (_local2.base.e.hitTest(_local3) == true)) || (_local2.base.f.hitTest(_local3) == true)) || (_local2.base.g.hitTest(_local3) == true)) {
_local5 = _root.toDegrees(Math.atan((0.5 * _local3._width) / (0.5 * _local3._height)));
_local7 = _root.toDegrees(Math.atan((0.5 * _local3._height) / (0.5 * _local3._width)));
_local4 = Math.abs(_root.toDegrees(Math.atan((_local2._x - _local3._x) / (_local3._y - _local2._y))));
if ((_local2._x > _local3._x) && (_local2._y > _local3._y)) {
_local4 = (90 - _local4) + 90;
} else if ((_local2._x < _local3._x) && (_local2._y >= _local3._y)) {
_local4 = _local4 + 180;
} else if ((_local2._x < _local3._x) && (_local2._y < _local3._y)) {
_local4 = (90 - _local4) + 270;
}
if (_local4 > 180) {
_local4 = -1 * (360 - _local4);
}
_local2.disabled = 0;
if (_root.isBetween(_local5 * -1, _local5, _local4)) {
_local2._y = _local2._y - _local6;
} else if (_root.isBetween(90 - _local7, 90 + _local7, _local4)) {
_local2._x = _local2._x + _local6;
} else if (_root.isBetween(180 - _local5, 180, _local4) || (_root.isBetween(-180, -180 + _local5, _local4))) {
_local2._y = _local2._y + _local6;
} else if (_root.isBetween(-90 - _local7, -90 + _local7, _local4)) {
_local2._x = _local2._x - _local6;
}
_root.objMap.movObject(idA, 1, _local2._x, _local2._y);
}
}
function tank_CheckBullet(idA, idB) {
var _local3 = _root.tank_container[((idA != -1) ? ("tank" + idA) : "player")];
var _local2 = _root.bullet_container["bullet" + idB];
if (_local3.hitTest(_local2._x, _local2._y, true) == true) {
_local2.hitCount = _local2.hitMax;
_local3.isDestroyed = 1;
}
}
function tank_CheckBomb(idA, idB) {
var _local3 = _root.tank_container[((idA != -1) ? ("tank" + idA) : "player")];
var _local2 = _root.bomb_container["bomb" + idB];
if (_local2.isActivated == 0) {
if (idA == _local2.tankOwner) {
if (_local2.detection.hitTest(_local3.base) == false) {
_local2.isActivated = 1;
_local2.base.play();
}
}
} else if (_local2.detection.hitTest(_local3.base) == true) {
_local2.explode = 1;
}
}
function player_Create() {
this.bulletMaxHits = 2;
this.speedVehicle = 3;
this.disabled = 0;
this.fireCount = 5;
this.mineCount = 2;
this.isFiring = 0;
this.isMining = 0;
this.isTread = 0;
this.isDestroyed = 0;
this.tread_sound_delay = 0;
}
function player_RotateTurret() {
if (_root.gameOver != 1) {
this.turret._rotation = _root.toDegrees(Math.atan2(_root._ymouse - this._y, _root._xmouse - this._x));
}
}
function player_MoveTank() {
this.base._rotation = this.currentRotation % 360;
if (this.disabled == 0) {
this.targetRotation = 200;
if ((!(_root.keys.isUp && (_root.keys.isDown))) && (!(_root.keys.isLeft && (_root.keys.isRight)))) {
if (_root.keys.isUp) {
if (_root.keys.isLeft) {
this.targetRotation = -45 + (Math.floor(this.currentRotation / 360) * 360);
} else if (_root.keys.isRight) {
this.targetRotation = 45 + (Math.floor(this.currentRotation / 360) * 360);
} else {
this.targetRotation = 0 + (Math.floor(this.currentRotation / 360) * 360);
}
} else if (_root.keys.isDown) {
if (_root.keys.isLeft) {
this.targetRotation = -135 + (Math.floor(this.currentRotation / 360) * 360);
} else if (_root.keys.isRight) {
this.targetRotation = 135 + (Math.floor(this.currentRotation / 360) * 360);
} else {
this.targetRotation = 180 + (Math.floor(this.currentRotation / 360) * 360);
}
} else if (_root.keys.isLeft) {
this.targetRotation = -90 + (Math.floor(this.currentRotation / 360) * 360);
} else if (_root.keys.isRight) {
this.targetRotation = 90 + (Math.floor(this.currentRotation / 360) * 360);
}
}
if (this.targetRotation != 200) {
if ((Math.abs(this.targetRotation - this.currentRotation) > 150) && (Math.abs(this.targetRotation - this.currentRotation) < 210)) {
this.dir = -1;
this.rotateTime = 0;
} else {
this.dir = 1;
if (Math.abs(this.targetRotation - this.currentRotation) > 180) {
if (this.currentRotation > 0) {
this.targetRotation = 360 + this.targetRotation;
} else {
this.targetRotation = this.targetRotation + 360;
}
}
this.rotateTime = Math.abs(this.targetRotation - this.currentRotation) / 5;
this.rotate.continueTo(this.targetRotation, this.rotateTime);
}
this.oldX = (this.speedVehicle * this.dir) * Math.sin(_root.toRadians(this.base._rotation));
this.oldY = (this.speedVehicle * this.dir) * Math.cos(_root.toRadians(this.base._rotation));
this.stepX = this._x + (this.oldX / ((this.rotateTime / 10) + 1));
this.stepY = this._y - (this.oldY / ((this.rotateTime / 10) + 1));
this._x = this.stepX;
this._y = this.stepY;
_root.objMap.movObject(-1, 1, this._x, this._y);
if (this.isTread == 0) {
_root.addTread(this._x, this._y, this.base._rotation);
this.isTread = 2;
this.tread_sound_delay++;
if (this.tread_sound_delay == 2) {
_root.treads.start(0, 0);
this.tread_sound_delay = 0;
}
} else {
this.isTread--;
}
} else {
this.rotate.stop();
}
} else {
this.disabled--;
}
}
function player_CheckDeath() {
if (this.isDestroyed == 1) {
_root.addTankExplosion(this._x, this._y);
_root.addDeathMark(this._x, this._y);
_root.pauseGame();
_root.gameOver = 1;
_root.objMap.delObject(-1, 1);
this.removeMovieClip();
}
}
function player_FireBullet() {
var _local5;
var _local4;
var _local3;
if (_root.keys.isMouse && (this.isFiring == 0)) {
if (this.fireCount != 0) {
_local5 = this._x + (Math.cos(_root.toRadians(this.turret._rotation)) * 30);
_local4 = this._y + (Math.sin(_root.toRadians(this.turret._rotation)) * 30);
_local3 = _root.objMap.getOthers(-1, 1, 0, 1);
x = 0;
while (x < _local3.length) {
if (_root.wall_container["wall" + _local3[x]].hidden.hitTest(_local5, _local4, false) == true) {
return(undefined);
}
x++;
}
_root.addBullet(_local5, _local4, this.turret._rotation, this.bulletMaxHits, -1);
_root.addMuzzleFlash(_local5, _local4);
this.isFiring = 3;
if (this.fireCount != 0) {
this.fireCount--;
}
}
}
if (!_root.keys.isMouse) {
if (this.isFiring != 0) {
this.isFiring--;
}
}
}
function player_FireMine() {
if (_root.keys.isSpace && (this.isMining == 0)) {
if (this.mineCount != 0) {
listMines = _root.objMap.getOthers(-1, 1, 3, 1);
x = 0;
while (x < listMines.length) {
if (_root.bomb_container["bomb" + listMines[x]].base.hitTest(this.base) == true) {
return(undefined);
}
x++;
}
_root.addBomb(this._x, this._y, -1);
_root.mine_drop.start(0, 0);
this.isMining = 3;
if (this.mineCount != 0) {
this.mineCount--;
}
}
}
if (!_root.keys.isSpace) {
if (this.isMining != 0) {
this.isMining--;
}
}
}
function enemy1_Create() {
this.bulletMaxHits = 1;
this.fireCount = 1;
this.speedVehicle = 3;
this.isFiring = 0;
this.isMining = 0;
this.isTread = 0;
this.isDestroyed = 0;
this.turret.dir = 1;
this.turret._rotation = 180;
}
function enemy1_RotateTurret() {
if (this.turret.dir == 1) {
this.turret._rotation = this.turret._rotation + 1;
} else {
this.turret._rotation = this.turret._rotation - 1;
}
if ((this.turret._rotation < 90) && (this.turret._rotation > -90)) {
this.turret.dir = this.turret.dir * -1;
}
}
function enemy1_MoveTank() {
}
function enemy1_CheckDeath() {
if (this.isDestroyed == 1) {
_root.addTankExplosion(this._x, this._y);
_root.addDeathMark(this._x, this._y);
_root.score++;
_root.objMap.delObject(this.idNumber, 1);
this.removeMovieClip();
}
}
function enemy1_FireBullet() {
var _local3;
var _local7;
var _local6;
var _local5;
var _local12;
var _local13;
var _local4;
_local12 = Math.floor(_root.toDegrees(Math.atan2(_root.tank_container.player._y - this._y, _root.tank_container.player._x - this._x)));
_local13 = Math.floor(this.turret._rotation);
if (_root.isBetween(_local12 - 2, _local12 + 2, _local13) == true) {
var _local9 = _root.calcDistance(_root.tank_container.player._x, this._x, _root.tank_container.player._y, this._y);
var _local11 = (_root.tank_container.player._x - this._x) / Math.floor(_local9 / 30);
var _local10 = (_root.tank_container.player._y - this._y) / Math.floor(_local9 / 30);
var _local8 = true;
_local7 = 0;
while (_local7 < Math.floor(_local9 / 30)) {
_local6 = this._x + (_local11 * (_local7 + 1));
_local5 = this._y + (_local10 * (_local7 + 1));
_local4 = _root.objMap.getAt(_local6, _local5, 0);
_local3 = 0;
while (_local3 < _local4.length) {
if (_root.wall_container["wall" + _local4[_local3]]._currentframe != 4) {
if (_root.wall_container["wall" + _local4[_local3]].hidden.hitTest(_local6, _local5, false) == true) {
_local8 = false;
}
}
_local3++;
}
_local7++;
}
if ((_local8 == true) && (this.fireCount != 0)) {
_local6 = this._x + (Math.cos(_root.toRadians(this.turret._rotation)) * 30);
_local5 = this._y + (Math.sin(_root.toRadians(this.turret._rotation)) * 30);
_local4 = _root.objMap.getOthers(-1, 1, 0, 1);
_local3 = 0;
while (_local3 < _local4.length) {
if (_root.wall_container["wall" + _local4[_local3]].hidden.hitTest(_local6, _local5, false) == true) {
return(undefined);
}
_local3++;
}
_root.addBullet(_local6, _local5, this.turret._rotation, this.bulletMaxHits, this.idNumber);
_root.addMuzzleFlash(_local6, _local5);
this.isFiring = 0;
if (this.fireCount != 0) {
this.fireCount--;
}
}
}
}
fscommand ("allowscale", false);
var mapData = new Array();
var enemyData = new Array();
var nodeData = new Array();
this.mapData[1] = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 0], [0, 1, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 0], [0, 1, 0, 0, 0, 0, 9, 0, 9, 0, 9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 9, 0, 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 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 0, 0, 6, 0, 1, 0], [0, 1, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
this.enemyData[1] = [1];
this.enemyData[2] = [1, 1];
this.enemyData[3] = [1, 1, 1];
this.enemyData[4] = [1, 1, 1, 1];
this.enemyData[5] = [1, 1];
this.enemyData[6] = [1, 1, 1, 1];
this.nodeData[1] = [8, 6, 0, 2, 0, 2, 6, 8, 0, 2, 6, 8, 6, 8, 2, 0];
this.nodeData[2] = [8, 6, 0, 2, 6, 8, 0, 2, 6, 8, 2, 0];
_root.isBetween = function (Min, Max, Num) {
if ((Num >= Min) && (Num <= Max)) {
return(true);
}
return(false);
};
_root.toRadians = function (Degrees) {
return(Degrees * (Math.PI/180));
};
_root.toDegrees = function (Radians) {
return(Radians * 57.2957795130823);
};
_root.calcDistance = function (x1, x2, y1, y2) {
return(Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)));
};
_root.calcAngle = function (x1, x2, y1, y2) {
var _local2 = Math.abs(_root.toDegrees(Math.atan((x1 - x2) / (y2 - y1))));
if ((x1 > x2) && (y1 > y2)) {
_local2 = (90 - _local2) + 90;
} else if ((x1 < x2) && (y1 > y2)) {
_local2 = _local2 + 180;
} else if ((x1 < x2) && (y1 < y2)) {
_local2 = (90 - _local2) + 270;
}
if (_local2 > 180) {
_local2 = -1 * (360 - _local2);
}
return(_local2);
};
var currentLevel = 0;
var currentEnemies = 0;
var cellW = 32;
var cellH = 32;
var objMap = new ObjectMap(14, 25, 5, this.cellW, this.cellH);
var maxTreads = 100;
var maxSmokes = 100;
var maxBullets = 20;
var maxExplosions = 50;
var maxBombs = 20;
var treadCount = 0;
var smokeCount = 0;
var bulletCount = 0;
var explosionCount = 0;
var bombCount = 0;
var wallCount = 0;
var tankCount = 0;
var killCount = 0;
var bullet_shot = new Sound();
bullet_shot.attachSound("shot.mp3");
var bullet_bounce = new Sound();
bullet_bounce.attachSound("bullet_bounce.mp3");
var mine_drop = new Sound();
mine_drop.attachSound("mine_drop.mp3");
var mine_explosion = new Sound();
mine_explosion.attachSound("mine_explosion.mp3");
var bullet_explosion = new Sound();
bullet_explosion.attachSound("bullet_explosion.wav");
var treads = new Sound();
treads.attachSound("treads.wav");
var intro = new Sound();
intro.attachSound("intro.mp3");
var maxCursors = 3;
var maxTrail = 100;
var trailCount = 0;
x = 0;
while (x < this.maxCursors) {
_root.cursor_container.attachMovie("cursor_floater", "cursor_floater" + x, _root.cursor_container.getNextHighestDepth());
_root.cursor_container["cursor_floater" + x]._x = 0;
_root.cursor_container["cursor_floater" + x]._y = 0;
x++;
}
this.lockCursor = function () {
_root.mouse._x = _root._xmouse;
_root.mouse._y = _root._ymouse;
if (_root.gameOver != 1) {
var _local4 = (_root._xmouse - _root.tank_container.player._x) / (this.maxCursors + 1);
var _local3 = (_root._ymouse - _root.tank_container.player._y) / (this.maxCursors + 1);
x = 0;
while (x < this.maxCursors) {
_root.cursor_container["cursor_floater" + x]._x = _root.tank_container.player._x + (_local4 * (x + 1));
_root.cursor_container["cursor_floater" + x]._y = _root.tank_container.player._y + (_local3 * (x + 1));
x++;
}
} else {
x = 0;
while (x < this.maxCursors) {
_root.cursor_container["cursor_floater" + x]._x = -10;
_root.cursor_container["cursor_floater" + x]._y = -10;
x++;
}
}
if (_root.cursor_container["trail" + this.trailCount] != undefined) {
_root.cursor_container["trail" + this.trailCount].removeMovieClip();
}
_root.cursor_container.attachMovie("cursor_trail", "trail" + this.trailCount, _root.cursor_container.getNextHighestDepth());
_root.cursor_container["trail" + this.trailCount]._x = _root._xmouse;
_root.cursor_container["trail" + this.trailCount]._y = _root._ymouse;
_root.cursor_container["trail" + this.trailCount].lineStyle(5, 65535, 100);
var _local5 = this.trailCount - 1;
if (_local5 < 0) {
_local5 = this.maxTrail;
}
_root.cursor_container["trail" + _local5].lineTo(_root.cursor_container["trail" + _local5]._xmouse, _root.cursor_container["trail" + _local5]._ymouse);
this.trailCount++;
if (this.trailCount > this.maxTrail) {
this.trailCount = 0;
}
};
this.onEnterFrame = function () {
var _local3;
var _local2;
var _local4;
var _local6;
var _local11;
var _local9;
var _local10;
var _local7;
var _local5;
var _local8;
_root.lockCursor();
_root.player_RotateTurret.call(_root.tank_container.player);
if (_root.isPaused == 0) {
_local4 = _root.objMap.getList(1);
_local6 = _root.objMap.getList(2);
_local11 = _root.objMap.getList(3);
_local9 = _root.objMap.getList(4);
_local3 = 0;
while (_local3 < _local4.length) {
if (_local4[_local3] != -1) {
_root[("enemy" + _root.tank_container["tank" + _local4[_local3]].aiType) + "_RotateTurret"].call(_root.tank_container["tank" + _local4[_local3]]);
}
_local3++;
}
_local3 = 0;
while (_local3 < _local4.length) {
if (_local4[_local3] == -1) {
_root.player_CheckDeath.call(_root.tank_container.player);
}
_root[("enemy" + _root.tank_container["tank" + _local4[_local3]].aiType) + "_CheckDeath"].call(_root.tank_container["tank" + _local4[_local3]]);
_local3++;
}
_local3 = 0;
while (_local3 < _local6.length) {
_root.bullet_CheckDeath.call(_root.bullet_container["bullet" + _local6[_local3]]);
_local3++;
}
_local3 = 0;
while (_local3 < _local11.length) {
_root.bomb_CheckDeath.call(_root.bomb_container["bomb" + _local11[_local3]]);
_local3++;
}
_local4 = _root.objMap.getList(1);
_local6 = _root.objMap.getList(2);
_local11 = _root.objMap.getList(3);
if (_root.gameOver == 1) {
_root.endGame();
return(undefined);
}
if (_local4.length == 1) {
_root.endLevel();
return(undefined);
}
_local3 = 0;
while (_local3 < _local4.length) {
if (_local4[_local3] == -1) {
_root.player_MoveTank.call(_root.tank_container.player);
} else {
_root[("enemy" + _root.tank_container["tank" + _local4[_local3]].aiType) + "_MoveTank"].call(_root.tank_container["tank" + _local4[_local3]]);
}
_local3++;
}
_local3 = 0;
while (_local3 < _local6.length) {
_root.bullet_Move.call(_root.bullet_container["bullet" + _local6[_local3]]);
_local3++;
}
_local3 = 0;
while (_local3 < _local4.length) {
_local10 = _root.objMap.getOthers(_local4[_local3], 1, 1, 1);
_local7 = _root.objMap.getOthers(_local4[_local3], 1, 0, 1);
_local5 = _root.objMap.getOthers(_local4[_local3], 1, 2, 1);
_local8 = _root.objMap.getOthers(_local4[_local3], 1, 3, 4);
_local2 = 0;
while (_local2 < _local10.length) {
if (_local4[_local3] < _local10[_local2]) {
_root.tank_CheckTank(_local4[_local3], _local10[_local2]);
}
_local2++;
}
_local2 = 0;
while (_local2 < _local7.length) {
_root.tank_CheckWall(_local4[_local3], _local7[_local2]);
_local2++;
}
_local2 = 0;
while (_local2 < _local5.length) {
_root.tank_CheckBullet(_local4[_local3], _local5[_local2]);
_local2++;
}
_local2 = 0;
while (_local2 < _local8.length) {
_root.tank_CheckBomb(_local4[_local3], _local8[_local2]);
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < _local6.length) {
_local5 = _root.objMap.getOthers(_local6[_local3], 2, 2, 1);
_local7 = _root.objMap.getOthers(_local6[_local3], 2, 0, 1);
_local8 = _root.objMap.getOthers(_local6[_local3], 2, 3, 1);
_local2 = 0;
while (_local2 < _local5.length) {
if (_local6[_local3] < _local5[_local2]) {
_root.bullet_CheckBullet(_local6[_local3], _local5[_local2]);
}
_local2++;
}
_local2 = 0;
while (_local2 < _local7.length) {
_root.bullet_CheckWall(_local6[_local3], _local7[_local2]);
_local2++;
}
_local2 = 0;
while (_local2 < _local8.length) {
_root.bullet_CheckBomb(_local6[_local3], _local8[_local2]);
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < _local9.length) {
_local7 = _root.objMap.getOthers(_local9[_local3], 4, 0, 5);
_local10 = _root.objMap.getOthers(_local9[_local3], 4, 1, 5);
_local5 = _root.objMap.getOthers(_local9[_local3], 4, 2, 5);
_local8 = _root.objMap.getOthers(_local9[_local3], 4, 3, 5);
_local2 = 0;
while (_local2 < _local10.length) {
_root.explosion_CheckTank(_local9[_local3], _local10[_local2]);
_local2++;
}
_local2 = 0;
while (_local2 < _local5.length) {
_root.explosion_CheckBullet(_local9[_local3], _local5[_local2]);
_local2++;
}
_local2 = 0;
while (_local2 < _local7.length) {
_root.explosion_CheckWall(_local9[_local3], _local7[_local2]);
_local2++;
}
_local2 = 0;
while (_local2 < _local8.length) {
_root.explosion_CheckBomb(_local9[_local3], _local8[_local2]);
_local2++;
}
_local3++;
}
_local3 = 0;
while (_local3 < _local4.length) {
if (_local4[_local3] == -1) {
_root.player_FireBullet.call(_root.tank_container.player);
} else {
_root[("enemy" + _root.tank_container["tank" + _local4[_local3]].aiType) + "_FireBullet"].call(_root.tank_container["tank" + _local4[_local3]]);
}
_local3++;
}
_local3 = 0;
while (_local3 < _local4.length) {
if (_local4[_local3] == -1) {
_root.player_FireMine.call(_root.tank_container.player);
} else {
_root[("enemy" + _root.tank_container["tank" + _local4[_local3]].aiType) + "_FireMine"].call(_root.tank_container["tank" + _local4[_local3]]);
}
_local3++;
}
}
};
_root.score = 0;
_root.gameOver = 0;
_root.isPaused = 1;
_root.missionGui._alpha = 0;
_root.playerGui._alpha = 0;
stop();
Frame 2
_root.score = 0;
_root.gameOver = 0;
_root.isPaused = 1;
Mouse.hide();
menu._visible = false;
newLevel();
stop();
Symbol 62 MovieClip [bomb_explosion] Frame 19
this.removeMovieClip();
Symbol 87 MovieClip [wall_explosion] Frame 18
this.removeMovieClip();
Symbol 96 MovieClip [bullet_bounceExp] Frame 4
this.removeMovieClip();
Symbol 113 MovieClip [bullet_explosion] Frame 8
this.removeMovieClip();
Symbol 122 MovieClip [bullet_smoke] Frame 25
this.removeMovieClip();
Symbol 135 MovieClip [tank_muzzleflash] Frame 11
this.removeMovieClip();
Symbol 143 MovieClip Frame 1
stop();
Symbol 143 MovieClip Frame 164
_parent.explode = 1;
Symbol 144 MovieClip [bomb] Frame 1
stop();
Symbol 168 MovieClip [tank_explosion] Frame 23
this.removeMovieClip();
Symbol 181 MovieClip [mission_intro] Frame 1
this.txt_level.text = _root.currentLevel;
this.txt_tanks.text = _root.currentEnemies;
Symbol 181 MovieClip [mission_intro] Frame 61
_root.loadBoard(_root.currentLevel);
_root.attachMovie("mission_start", "mission_start", _root.getNextHighestDepth());
_root.mission_start._x = 290;
_root.mission_start._y = 200;
this.removeMovieClip();
Symbol 185 MovieClip [mission_failed] Frame 51
this.removeMovieClip();
Symbol 192 MovieClip [mission_complete] Frame 51
_root.newLevel();
this.removeMovieClip();
Symbol 197 MovieClip [mission_start] Frame 15
_root.pauseGame();
Symbol 197 MovieClip [mission_start] Frame 26
_root.missionGui._alpha = 100;
_root.playerGui._alpha = 100;
Symbol 197 MovieClip [mission_start] Frame 27
this.removeMovieClip();
Symbol 198 MovieClip [cursor_trail] Frame 5
this.removeMovieClip();
Symbol 226 MovieClip Frame 1
_root.keys.isLeft = false;
_root.keys.isRight = false;
_root.keys.isUp = false;
_root.keys.isDown = false;
_root.keys.isSpace = false;
_root.keys.isNext = false;
keyListener = new Object();
keyListener.onKeyDown = function () {
switch (Key.getCode()) {
case 37 :
case 65 :
_root.keys.isLeft = true;
break;
case 39 :
case 68 :
_root.keys.isRight = true;
break;
case 38 :
case 87 :
_root.keys.isUp = true;
break;
case 40 :
case 83 :
_root.keys.isDown = true;
break;
case 17 :
_root.keys.isNext = true;
break;
case 32 :
_root.keys.isSpace = true;
}
};
keyListener.onKeyUp = function () {
switch (Key.getCode()) {
case 37 :
case 65 :
_root.keys.isLeft = false;
break;
case 39 :
case 68 :
_root.keys.isRight = false;
break;
case 38 :
case 87 :
_root.keys.isUp = false;
break;
case 40 :
case 83 :
_root.keys.isDown = false;
break;
case 17 :
_root.keys.isNext = false;
break;
case 32 :
_root.keys.isSpace = false;
}
};
Key.addListener(keyListener);
_root.keys.isMouse = false;
mouseListener = new Object();
mouseListener.onMouseDown = function () {
_root.keys.isMouse = true;
};
mouseListener.onMouseUp = function () {
_root.keys.isMouse = false;
};
Mouse.addListener(mouseListener);
Symbol 236 MovieClip Frame 1
btnPlayGame.onRelease = function () {
_root.gotoAndStop(2);
};
Symbol 237 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 238 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 239 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var version = "1.1.0.52";
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 240 MovieClip [__Packages.ObjectMap] Frame 0
class ObjectMap
{
var xSize, ySize, rowCount, colCount, typCount, mapArray, nameArray;
function ObjectMap (rows, cols, types, xPixels, yPixels) {
xSize = xPixels;
ySize = yPixels;
rowCount = rows;
colCount = cols;
typCount = types;
clearAll();
}
function addObject(name, type, xLoc, yLoc) {
var _local3 = Math.floor(xLoc / xSize);
var _local2 = Math.floor(yLoc / ySize);
var _local4 = mapArray[type][_local3][_local2].length;
nameArray[type][nameArray[type].length] = new Array(name, _local3, _local2, _local4);
mapArray[type][_local3][_local2][_local4] = name;
}
function delObject(name, type) {
var _local2 = findName(name, type);
mapArray[type][nameArray[type][_local2][1]][nameArray[type][_local2][2]].splice(nameArray[type][_local2][3], 1);
nameArray[type].splice(_local2, 1);
}
function movObject(name, type, xLoc, yLoc) {
var _local5 = Math.floor(xLoc / xSize);
var _local4 = Math.floor(yLoc / ySize);
var _local6;
var _local3 = findName(name, type);
mapArray[type][nameArray[type][_local3][1]][nameArray[type][_local3][2]].splice(nameArray[type][_local3][3], 1);
_local6 = mapArray[type][_local5][_local4].length;
mapArray[type][_local5][_local4][_local6] = name;
nameArray[type][_local3][1] = _local5;
nameArray[type][_local3][2] = _local4;
nameArray[type][_local3][3] = _local6;
}
function getOthers(name, type, target, size) {
var _local4;
var _local2;
var _local3;
var _local12 = findName(name, type);
var _local11 = nameArray[type][_local12][1];
var _local8 = nameArray[type][_local12][2];
var _local6 = new Array();
_local4 = _local11 - size;
while (_local4 <= (_local11 + size)) {
if ((_local4 >= 0) && (_local4 < colCount)) {
_local2 = _local8 - size;
while (_local2 <= (_local8 + size)) {
if ((_local2 >= 0) && (_local2 < rowCount)) {
_local3 = 0;
while (_local3 < mapArray[target][_local4][_local2].length) {
if (!((type == target) && (mapArray[target][_local4][_local2][_local3] == name))) {
_local6[_local6.length] = mapArray[target][_local4][_local2][_local3];
}
_local3++;
}
}
_local2++;
}
}
_local4++;
}
return(_local6);
}
function getList(type) {
var _local2;
var _local4 = new Array();
_local2 = 0;
while (_local2 < nameArray[type].length) {
_local4[_local2] = nameArray[type][_local2][0];
_local2++;
}
return(_local4);
}
function getAt(xLoc, yLoc, type) {
var _local4 = Math.floor(xLoc / xSize);
var _local3 = Math.floor(yLoc / ySize);
var _local2;
var _local6 = new Array();
_local2 = 0;
while (_local2 < mapArray[type][_local4][_local3].length) {
_local6[_local2] = mapArray[type][_local4][_local3][_local2];
_local2++;
}
return(_local6);
}
function getArea(xLoc, yLoc, type, size) {
var _local4;
var _local2;
var _local3;
var _local9 = Math.floor(xLoc / xSize);
var _local8 = Math.floor(yLoc / ySize);
var _local5 = new Array();
_local4 = _local9 - size;
while (_local4 <= (_local9 + size)) {
if ((_local4 >= 0) && (_local4 < colCount)) {
_local2 = _local8 - size;
while (_local2 <= (_local8 + size)) {
if ((_local2 >= 0) && (_local2 < rowCount)) {
_local3 = 0;
while (_local3 < mapArray[type][_local4][_local2].length) {
_local5[_local5.length] = mapArray[type][_local4][_local2][_local3];
_local3++;
}
}
_local2++;
}
}
_local4++;
}
return(_local5);
}
function clearAll() {
var _local3;
var _local2;
var _local4;
nameArray = new Array(typCount);
mapArray = new Array(typCount);
_local4 = 0;
while (_local4 < typCount) {
nameArray[_local4] = new Array();
mapArray[_local4] = new Array(colCount);
_local3 = 0;
while (_local3 < colCount) {
mapArray[_local4][_local3] = new Array(rowCount);
_local2 = 0;
while (_local2 < rowCount) {
mapArray[_local4][_local3][_local2] = new Array();
_local2++;
}
_local3++;
}
_local4++;
}
}
function findName(name, type) {
var _local2;
_local2 = 0;
while (_local2 < nameArray[type].length) {
if (nameArray[type][_local2][0] == name) {
return(_local2);
}
_local2++;
}
trace("help?");
}
}
Symbol 241 MovieClip [__Packages.mx.transitions.easing.None] Frame 0
class mx.transitions.easing.None
{
function None () {
}
static function easeNone(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeIn(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeInOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static var version = "1.1.0.52";
}