Section 1
//GameControl (com.game.control.GameControl)
package com.game.control {
import flash.display.*;
import com.game.item.player.*;
import flash.events.*;
import com.game.item.enemy.*;
import com.game.*;
import com.game.item.*;
import com.screen.*;
import flash.utils.*;
import com.game.item.bullet.*;
import com.game.item.obstacle.*;
public class GameControl extends Sprite {
public var _screenWidth:Number;
public var _field:Field;
public var _turnArrow:MovieClip;
private var _status:String;
public var _explodeClip:MovieClip;
public var _sideAttack:String;
public var _playerRobot_array:Array;
public var _stat:Stat;
public var _map_array:Array;
private var _mapXML:XML;
public var _score_time_bonus:int;
public var _framesLeft:int;
public var _robotXPosition_array:Array;
private var _mapID:int;
public var _framesPlay:int;
public var _gameScreen:GameScreen;
public var _currentAttackEnemyRobotID:int;
public var _loaderClip:MovieClip;
public var _attackCompleted:Boolean;
public var _screenHeight:Number;
public var _bullet_array:Array;
public var _frames:uint;
public var _parent;
private var _startFrame:uint;
public var _obstacle_array:Array;
private var _framesReady:uint;
private var _mapXMLLoaded:Boolean;
public var _currentAttackPlayerRobotID:int;
public var _bg:BG;
public var _attackLineClip:MovieClip;
public var _enemyRobot_array:Array;
public function GameControl(_arg1, _arg2:Number=0, _arg3:Number=0){
_parent = _arg1;
x = _arg2;
y = _arg3;
init();
}
public function setFinishAttackTimer(_arg1:int=3000):void{
var timerEventHandler:Function;
var $time = _arg1;
timerEventHandler = function (_arg1:TimerEvent):void{
if (((((noBulletOnField()) && (allRobotsOnGround()))) && (allRobotsAtRest()))){
finishAttack();
} else {
setFinishAttackTimer(500);
};
};
var timer:Timer = new Timer($time, 1);
timer.addEventListener(TimerEvent.TIMER, timerEventHandler);
timer.start();
}
private function mapLoadCompleteHandler(_arg1:Event):void{
var _local8:int;
var _local11:String;
var _local15:XML;
var _local16:Object;
var _local17:XML;
var _local18:Object;
var _local19:XML;
var _local20:Object;
_mapXMLLoaded = true;
_mapXML = XML(_arg1.target.data);
var _local2:XMLList = XMLList(_mapXML.map);
var _local3:int = _local2.length();
_mapID = Math.floor((_local3 * Math.random()));
var _local4:XML = _local2[_mapID];
var _local5:Object = (_map_array[_mapID] = {});
_local5.typeID = Number(_local4.typeID);
_local5.typeID = 1;
trace(("Moooo " + _local5.typeID));
var _local6:XMLList = XMLList(_local4.obstacles.obstacle);
var _local7:int = _local6.length();
_local5.obstacle_array = [];
_local8 = 0;
while (_local8 < _local7) {
_local15 = _local6[_local8];
_local16 = (_local5.obstacle_array[_local8] = {});
_local16.type = String(_local15.@type);
_local16.x = Number(_local15.@x);
_local16.y = Number(_local15.@y);
_local16.health = Number(_local15.@health);
_local8++;
};
var _local9:XMLList = XMLList(_local4.playerRobots.robot);
var _local10:int = _local9.length();
var _local12:int;
_local5.playerRobots_array = [];
_local8 = 0;
while (_local8 < _local10) {
trace(_local8);
_local17 = _local9[_local8];
_local18 = (_local5.playerRobots_array[_local8] = {});
_local18.id = _local8;
_local18.type = String(_local17.@type);
_local18.y = Constant.PLAYER_ROBOT_INIT_Y;
_local18.health = Number(_local17.@health);
_local18.attackPower = Number(_local17.@attackPower);
_local18.attackRange = Number(_local17.@attackRange);
_local18.attackOrder = _local8;
_local11 = (("player" + _local18.type.substring(0, 1).toUpperCase()) + _local18.type.substring(1, _local18.type.length));
_stat.setStatusClipPosition(_local11, _local12);
_local12++;
_local8++;
};
var _local13:XMLList = XMLList(_local4.enemyRobots.robot);
var _local14:int = _local13.length();
_local5.enemyRobots_array = [];
_local8 = 0;
while (_local8 < _local14) {
_local19 = _local13[_local8];
_local20 = (_local5.enemyRobots_array[_local8] = {});
_local20.id = _local8;
_local20.type = String(_local19.@type);
_local20.y = Constant.ENEMY_ROBOT_INIT_Y;
_local20.health = Number(_local19.@health);
_local20.attackPower = Number(_local19.@attackPower);
_local20.attackRange = Number(_local19.@attackRange);
_local20.statusPos = Number(_local19.@statusPos);
_local20.attackOrder = _local8;
_local11 = (("enemy" + _local20.type.substring(0, 1).toUpperCase()) + _local20.type.substring(1, _local20.type.length));
_stat.setStatusClipPosition(_local11, _local12);
_local12++;
_local8++;
};
_robotXPosition_array = getRobotsRandomXPositions(6, Constant.ROBOT_INIT_MIN_X, Constant.ROBOT_INIT_MAX_X, Constant.ROBOT_INIT_MIN_X_DIST);
readyGame();
}
private function init():void{
_gameScreen = _parent;
_loaderClip = _gameScreen.loader_mc;
_mapXML = new XML();
_stat = new Stat(this, 0, 0);
_field = new Field(this, 0, 0);
_bg = new BG(this, 0, 0, 0);
_explodeClip = new mcExplodeAnimation2();
_attackLineClip = new MovieClip();
_score_time_bonus = 0;
_turnArrow = new mcTurnArrow();
_turnArrow.x = -1000;
_turnArrow.y = -1000;
_framesPlay = Constant.GAME_FRAMES_PLAY;
_framesLeft = _framesPlay;
_screenWidth = _parent._parent.stage.stageWidth;
_screenHeight = _parent._parent.stage.stageHeight;
_map_array = [];
_playerRobot_array = [];
_enemyRobot_array = [];
_bullet_array = [];
_obstacle_array = [];
_mapID = -1;
_currentAttackPlayerRobotID = -1;
_currentAttackEnemyRobotID = -1;
_sideAttack = "";
_attackCompleted = false;
_framesReady = 60;
_startFrame = 0;
_frames = 0;
_mapXMLLoaded = false;
_status = "";
loadXML();
addEnterFrameEvent();
}
private function getPlayerRobotWithType(_arg1:String):Player{
var _local3:*;
var _local2:int;
while (_local2 < _playerRobot_array.length) {
_local3 = _playerRobot_array[_local2];
if (_local3._type == _arg1){
return (_local3);
};
_local2++;
};
return (null);
}
private function enterFrameHandler(_arg1:Event):void{
if (_status == "loadingXML"){
} else {
if (_status == "ready"){
updatePlayers();
updateEnemies();
if (_frames > _startFrame){
startGame();
};
} else {
if (_status == "play"){
_framesLeft--;
updateBullets();
updatePlayers();
updateEnemies();
updateStat();
};
};
};
_frames++;
}
private function removeEnterFrame():void{
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
private function updateEnemies():void{
var _local1:int;
var _local2:*;
while (_local1 < _enemyRobot_array.length) {
_local2 = _enemyRobot_array[_local1];
_local2.update();
_local1++;
};
}
public function clearText():void{
_parent._parent.temp_txt.text = "";
}
public function createBullet(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:String, _arg9:int, _arg10:int=0xFF00):void{
var _local11:Cannon;
var _local12:Laser;
switch (_arg1){
case "cannon":
_local11 = new Cannon(this, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
_field.addItem(_local11, "bullet");
_bullet_array.push(_local11);
break;
case "laser":
_local12 = new Laser(this, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
_field.addItem(_local12, "bullet");
_bullet_array.push(_local12);
break;
};
}
public function gameLose():void{
_status = "gameLose";
removeEnterFrame();
playSound("gameWin");
_parent._parent.gotoScreen("gameOver");
}
private function loadEnemyRobots(_arg1:Array):void{
var _local4:Object;
var _local5:Number;
var _local6:EnemyTypeCannon;
var _local7:EnemyTypeLaser;
var _local8:EnemyTypeMelee;
var _local2:Array = _arg1;
var _local3:int;
while (_local3 < _local2.length) {
_local4 = _local2[_local3];
switch (_local4.type){
case "cannon":
_local5 = _robotXPosition_array.pop();
_local6 = new EnemyTypeCannon(this, _local4.id, _local5, _local4.y, _local4.health, _local4.attackPower, _local4.attackRange, _local4.attackOrder);
_enemyRobot_array.push(_local6);
updateStatusClipTxt("enemy", _local4.id);
break;
case "laser":
_local5 = _robotXPosition_array.shift();
trace(("L X: " + _local5));
_local7 = new EnemyTypeLaser(this, _local4.id, _local5, _local4.y, _local4.health, _local4.attackPower, _local4.attackRange, _local4.attackOrder);
_enemyRobot_array.push(_local7);
updateStatusClipTxt("enemy", _local4.id);
break;
case "melee":
_local5 = _robotXPosition_array.pop();
_local8 = new EnemyTypeMelee(this, _local4.id, _local5, _local4.y, _local4.health, _local4.attackPower, _local4.attackRange, _local4.attackOrder);
_enemyRobot_array.push(_local8);
updateStatusClipTxt("enemy", _local4.id);
break;
};
_local3++;
};
}
private function getPlayerRobotsLeft():int{
var _local3:*;
var _local1:int;
var _local2:int;
while (_local2 < _playerRobot_array.length) {
_local3 = _playerRobot_array[_local2];
if (!_local3._isDestroyed){
_local1++;
};
_local2++;
};
return (_local1);
}
private function readyGame():void{
_startFrame = (_frames + _framesReady);
_status = "ready";
loadMap();
addField();
addItemsToField();
}
public function currentPlayerRobotAttack(_arg1:Number, _arg2:Number):void{
var _local3:* = _playerRobot_array[_currentAttackPlayerRobotID];
_local3.tryAttack(_arg1, _arg2);
}
public function playSound(_arg1:String, _arg2:Boolean=false, _arg3:int=0):void{
_parent._parent.playSound(_arg1, _arg2, _arg3);
}
private function setNextEnemyRobotAttack():void{
var _local2:*;
var _local1:Boolean;
do {
_currentAttackEnemyRobotID++;
if (_currentAttackEnemyRobotID > (_enemyRobot_array.length - 1)){
_currentAttackEnemyRobotID = 0;
};
_local2 = getEnemyRobotWithAttackOrder(_currentAttackEnemyRobotID);
if (!_local2._isDestroyed){
_local1 = true;
};
} while (!(_local1));
}
public function currentEnemyRobotAttack(_arg1:Event=null):void{
var _local2:* = _enemyRobot_array[_currentAttackEnemyRobotID];
_local2.tryAttack();
}
private function addEnterFrameEvent():void{
addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, true);
}
public function setNextEnemyRobotAttackTimer():void{
var _local1:Timer = new Timer(2500, 1);
_local1.addEventListener(TimerEvent.TIMER, currentEnemyRobotAttack);
_local1.start();
}
private function getRobotsRandomXPositions(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number):Array{
var _local12:*;
var _local13:*;
var _local14:*;
var _local5:int = _arg1;
var _local6:Number = _arg4;
var _local7:Number = _arg2;
var _local8:Number = _arg3;
var _local9:Number = (_local8 - _local7);
var _local10:Array = [];
var _local11:Boolean;
do {
_local11 = true;
_local12 = 0;
while (_local12 < _local5) {
_local13 = getRandomValueBetween(_local7, _local8);
_local10[_local12] = Math.floor(_local13);
if (_local12 == 1){
_local14 = Math.abs((_local10[0] - _local10[1]));
if (_local14 > 300){
_local11 = false;
};
};
_local12++;
};
if (areRobotsTooClose(_local10, _local6)){
_local11 = false;
};
} while (!(_local11));
return (_local10);
}
private function loadXML():void{
_status = "loadingXML";
loadMapXML();
}
private function getEnemyRobotsLeft():int{
var _local3:*;
var _local1:int;
var _local2:int;
while (_local2 < _enemyRobot_array.length) {
_local3 = _enemyRobot_array[_local2];
if (!_local3._isDestroyed){
_local1++;
};
_local2++;
};
return (_local1);
}
public function updateStatusClipTxt(_arg1:String, _arg2:int):void{
var _local3:*;
var _local4:String;
var _local5:String;
if (_arg1 == "player"){
_local3 = _playerRobot_array[_arg2];
_local4 = _local3._type;
_local5 = (("player" + _local4.substring(0, 1).toUpperCase()) + _local4.substring(1, _local4.length));
} else {
if (_arg1 == "enemy"){
_local3 = _enemyRobot_array[_arg2];
_local4 = _local3._type;
_local5 = (("enemy" + _local4.substring(0, 1).toUpperCase()) + _local4.substring(1, _local4.length));
};
};
_stat.updateStatusClipText(_local5, _local3._health, _local3._attackRange, _local3._attackPower);
}
private function getEnemyRobotWithAttackOrder(_arg1:int):Enemy{
var _local3:*;
var _local2:int;
while (_local2 < _enemyRobot_array.length) {
_local3 = _enemyRobot_array[_local2];
if (_local3._attackOrder == _arg1){
return (_local3);
};
_local2++;
};
return (null);
}
public function hideTurnArrow():void{
_turnArrow.visible = false;
}
public function addScore(_arg1:Number):void{
_parent._parent._score = (_parent._parent._score + _arg1);
}
private function setAllRobotsAttacking(_arg1:Boolean):void{
var _local2:int;
var _local3:*;
var _local4:*;
_local2 = 0;
while (_local2 < _playerRobot_array.length) {
_local3 = _playerRobot_array[_local2];
_local3._isAttacking = _arg1;
_local2++;
};
_local2 = 0;
while (_local2 < _enemyRobot_array.length) {
_local4 = _enemyRobot_array[_local2];
_local4._isAttacking = _arg1;
_local2++;
};
}
private function startGame():void{
_status = "play";
_sideAttack = "player";
_currentAttackPlayerRobotID = 0;
_currentAttackEnemyRobotID = 0;
_attackCompleted = false;
changeCurrentRobotStatusClip("selected");
updateTurnArrow();
}
public function printText(_arg1):void{
_parent._parent.temp_txt.appendText(String(_arg1));
}
private function loadObstacles(_arg1:Array):void{
var _local4:Object;
var _local5:ObstacleRock0;
var _local6:ObstacleRock1;
var _local7:ObstacleRock2;
var _local2:Array = _arg1;
var _local3:int;
while (_local3 < _local2.length) {
_local4 = _local2[_local3];
switch (_local4.type){
case "rock0":
_local5 = new ObstacleRock0(this, _local4.id, _local4.x, _local4.y, _local4.health);
_field.addItem(_local5, "obstacle");
_obstacle_array.push(_local5);
break;
case "rock1":
_local6 = new ObstacleRock1(this, _local4.id, _local4.x, _local4.y, _local4.health);
_field.addItem(_local6, "obstacle");
_obstacle_array.push(_local6);
break;
case "rock2":
_local7 = new ObstacleRock2(this, _local4.id, _local4.x, _local4.y, _local4.health);
_field.addItem(_local7, "obstacle");
_obstacle_array.push(_local7);
break;
};
_local3++;
};
}
private function changeCurrentRobotStatusClip(_arg1:String):void{
var _local2:String;
var _local3:String;
if (_sideAttack == "player"){
_local3 = _playerRobot_array[_currentAttackPlayerRobotID]._type;
_local2 = (("player" + _local3.substring(0, 1).toUpperCase()) + _local3.substring(1, _local3.length));
} else {
if (_sideAttack == "enemy"){
_local3 = _enemyRobot_array[_currentAttackEnemyRobotID]._type;
_local2 = (("enemy" + _local3.substring(0, 1).toUpperCase()) + _local3.substring(1, _local3.length));
};
};
_stat.setStatusClipStatus(_local2, _arg1);
}
private function addEnemyRobotsToField():void{
var _local2:*;
var _local1:int;
while (_local1 < _enemyRobot_array.length) {
_local2 = _enemyRobot_array[_local1];
_field.addItem(_local2, "robot");
_local1++;
};
}
public function allRobotsAtRest():Boolean{
var _local1:int;
var _local2:*;
var _local3:*;
_local1 = 0;
while (_local1 < _playerRobot_array.length) {
_local2 = _playerRobot_array[_local1];
if ((((!(_local2._xMov) == 0)) || ((!(_local2._yMov) == 0)))){
return (false);
};
_local1++;
};
_local1 = 0;
while (_local1 < _enemyRobot_array.length) {
_local3 = _enemyRobot_array[_local1];
if ((((!(_local3._xMov) == 0)) || ((!(_local3._yMov) == 0)))){
return (false);
};
_local1++;
};
return (true);
}
private function loadMap():void{
trace(("MAP ID " + _mapID));
var _local1:Object = _map_array[_mapID];
loadObstacles(_local1.obstacle_array);
loadPlayerRobots(_local1.playerRobots_array);
loadEnemyRobots(_local1.enemyRobots_array);
}
private function loadPlayerRobots(_arg1:Array):void{
var _local4:Object;
var _local5:Number;
var _local6:PlayerTypeCannon;
var _local7:PlayerTypeLaser;
var _local8:PlayerTypeMelee;
var _local2:Array = _arg1;
trace(("try " + _robotXPosition_array));
var _local3:int;
while (_local3 < _local2.length) {
_local4 = _local2[_local3];
switch (_local4.type){
case "cannon":
_local5 = _robotXPosition_array.pop();
_local6 = new PlayerTypeCannon(this, _local4.id, _local5, _local4.y, _local4.health, _local4.attackPower, _local4.attackRange, _local4.attackOrder);
_playerRobot_array.push(_local6);
updateStatusClipTxt("player", _local4.id);
break;
case "laser":
_local5 = _robotXPosition_array.shift();
trace(("L X: " + _local5));
_local7 = new PlayerTypeLaser(this, _local4.id, _local5, _local4.y, _local4.health, _local4.attackPower, _local4.attackRange, _local4.attackOrder);
_playerRobot_array.push(_local7);
updateStatusClipTxt("player", _local4.id);
break;
case "melee":
_local5 = _robotXPosition_array.pop();
_local8 = new PlayerTypeMelee(this, _local4.id, _local5, _local4.y, _local4.health, _local4.attackPower, _local4.attackRange, _local4.attackOrder);
_playerRobot_array.push(_local8);
updateStatusClipTxt("player", _local4.id);
break;
};
_local3++;
};
}
public function showExplosion(_arg1:Number, _arg2:Number):void{
_explodeClip.visible = true;
_explodeClip.x = _arg1;
_explodeClip.y = _arg2;
_explodeClip.gotoAndPlay("explode");
}
private function addItemsToField():void{
_field.addItem(_bg, "bg");
_field.addItem(_stat, "stat");
_field.addItem(_attackLineClip, "attackLine");
_field.addItem(_turnArrow, "turnArrow");
_field.addItem(_explodeClip, "explosion");
hideExplosion();
addPlayerRobotsToField();
addEnemyRobotsToField();
}
private function loadMapXML():void{
var _local1 = "xml/map.xml";
XMLHandler.load(_local1, mapLoadCompleteHandler);
}
private function updateBullets():void{
var _local1:int;
var _local2:*;
while (_local1 < _bullet_array.length) {
_local2 = _bullet_array[_local1];
_local2.update();
_local1++;
};
}
private function updatePlayers():void{
var _local1:int;
var _local2:*;
while (_local1 < _playerRobot_array.length) {
_local2 = _playerRobot_array[_local1];
_local2.update();
_local1++;
};
}
public function gameWin():void{
_status = "gameWin";
removeEnterFrame();
playSound("gameWin");
var _local1:Number = Math.floor((_score_time_bonus / 10));
addScore(_score_time_bonus);
addScore(5000);
_parent._parent.gotoScreen("gameWin");
}
public function allRobotsOnGround():Boolean{
var _local1:int;
var _local2:*;
var _local3:*;
_local1 = 0;
while (_local1 < _playerRobot_array.length) {
_local2 = _playerRobot_array[_local1];
if (!_local2._isOnGround){
return (false);
};
_local1++;
};
_local1 = 0;
while (_local1 < _enemyRobot_array.length) {
_local3 = _enemyRobot_array[_local1];
if (!_local3._isOnGround){
return (false);
};
_local1++;
};
return (true);
}
public function getRandomValueBetween(_arg1:Number, _arg2:Number):Number{
var _local3:Number = (_arg2 - _arg1);
return ((_arg1 + (_local3 * Math.random())));
}
public function noBulletOnField():Boolean{
var _local1:int;
var _local2:*;
while (_local1 < _bullet_array.length) {
_local2 = _bullet_array[_local1];
if (_local2._status == "normal"){
return (false);
};
_local1++;
};
return (true);
}
private function updateStat():void{
_score_time_bonus = (Constant.GAME_MAX_TIME_BONUS - ((_framesPlay - _framesLeft) * Constant.GAME_TIME_BONUS_PER_FRAME));
if (_score_time_bonus < 0){
_score_time_bonus = 0;
};
_stat.update();
}
public function finishAttack():void{
_field.clearAttackLine();
if (getPlayerRobotsLeft() == 0){
gameLose();
} else {
if (getEnemyRobotsLeft() == 0){
gameWin();
} else {
switchTurn();
};
};
}
private function setNextPlayerRobotAttack():void{
var _local2:*;
var _local1:Boolean;
do {
_currentAttackPlayerRobotID++;
if (_currentAttackPlayerRobotID > (_playerRobot_array.length - 1)){
_currentAttackPlayerRobotID = 0;
};
_local2 = getPlayerRobotWithAttackOrder(_currentAttackPlayerRobotID);
if (!_local2._isDestroyed){
_local1 = true;
};
} while (!(_local1));
}
public function reduceScore(_arg1:Number):void{
_parent._parent._score = (_parent._parent._score - _arg1);
if (_parent._parent._score < 0){
_parent._parent._score = 0;
};
}
private function switchTurn():void{
var _local1:*;
var _local2:*;
var _local3:*;
setAllRobotsAttacking(false);
changeCurrentRobotStatusClip("hide");
if (_sideAttack == "player"){
_local1 = _playerRobot_array[_currentAttackPlayerRobotID];
_local1.toDefaultMode();
_sideAttack = "enemy";
_attackCompleted = false;
setNextEnemyRobotAttack();
setNextEnemyRobotAttackTimer();
updateTurnArrow();
} else {
if (_sideAttack == "enemy"){
addScore(100);
_local2 = _enemyRobot_array[_currentAttackEnemyRobotID];
_local2.toDefaultMode();
_sideAttack = "player";
_attackCompleted = false;
setNextPlayerRobotAttack();
_local3 = _playerRobot_array[_currentAttackPlayerRobotID];
if ((((_local3._type == "cannon")) || ((_local3._type == "laser")))){
_local3.toAttackMode();
};
updateTurnArrow();
};
};
changeCurrentRobotStatusClip("selected");
_attackCompleted = false;
}
private function updateTurnArrow():void{
var _local1:*;
if (_sideAttack == "player"){
_local1 = _playerRobot_array[_currentAttackPlayerRobotID];
} else {
if (_sideAttack == "enemy"){
_local1 = _enemyRobot_array[_currentAttackEnemyRobotID];
};
};
_turnArrow.animation_mc.gotoAndStop(_sideAttack);
_turnArrow.visible = true;
_turnArrow.x = _local1._x;
_turnArrow.y = (_local1._y - 50);
}
private function addField():void{
_loaderClip.addChild(_field);
}
private function areRobotsTooClose(_arg1:Array, _arg2:Number):Boolean{
var _local6:Number;
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local3:Array = _arg1;
var _local4:Number = _arg2;
if (_arg1.length <= 1){
return (false);
};
var _local5:int;
while (_local5 < (_local3.length - 1)) {
_local6 = _local3[_local5];
_local7 = (_local5 + 1);
while (_local7 < _local3.length) {
_local8 = _local3[_local7];
_local9 = (_local8 - _local6);
if (Math.abs(_local9) < _local4){
return (true);
};
_local7++;
};
_local5++;
};
return (false);
}
public function getRandomAvailablePlayerRobot():Player{
var _local3:*;
var _local4:int;
var _local1:Array = [];
var _local2:int;
while (_local2 < _playerRobot_array.length) {
_local3 = _playerRobot_array[_local2];
if (!_local3._isDestroyed){
_local1.push(_local3);
};
_local2++;
};
if (_local1.length > 0){
_local4 = Math.floor((_local1.length * Math.random()));
return (_local1[_local4]);
};
return (null);
}
private function getPlayerRobotWithAttackOrder(_arg1:int):Player{
var _local3:*;
var _local2:int;
while (_local2 < _playerRobot_array.length) {
_local3 = _playerRobot_array[_local2];
if (_local3._attackOrder == _arg1){
return (_local3);
};
_local2++;
};
return (null);
}
public function hideExplosion():void{
_explodeClip.visible = false;
_explodeClip.x = -1000;
_explodeClip.y = -1000;
_explodeClip.gotoAndStop("hide");
}
private function addPlayerRobotsToField():void{
var _local2:*;
var _local1:int;
while (_local1 < _playerRobot_array.length) {
_local2 = _playerRobot_array[_local1];
_field.addItem(_local2, "robot");
_local1++;
};
}
private function getEnemyRobotWithType(_arg1:String):Enemy{
var _local3:*;
var _local2:int;
while (_local2 < _enemyRobot_array.length) {
_local3 = _enemyRobot_array[_local2];
if (_local3._type == _arg1){
return (_local3);
};
_local2++;
};
return (null);
}
}
}//package com.game.control
Section 2
//IndexHandler (com.game.control.IndexHandler)
package com.game.control {
public class IndexHandler {
public var _loaderClip;
public var _parent;
public var _item_array:Array;
public var _typeOrder_array:Array;
public function IndexHandler(_arg1, _arg2){
this._parent = _arg1;
this._loaderClip = _arg2;
this._item_array = new Array();
}
private function getTypeHighestIndex(_arg1:String):Number{
var _local5:Object;
var _local6:Number;
var _local2:Number = 0;
var _local3:Number = this.getItemTypeOrder(_arg1);
var _local4:Number = 0;
while (_local4 < this._item_array.length) {
_local5 = this._item_array[_local4];
_local6 = 0;
while (_local6 <= _local3) {
if (_local5.type == this._typeOrder_array[_local6]){
_local2++;
};
_local6++;
};
_local4++;
};
return (_local2);
}
private function updateIndexes():void{
var _local2:Object;
var _local1:Number = 0;
while (_local1 < this._item_array.length) {
_local2 = this._item_array[_local1];
if (_local2.item != this._loaderClip.getChildAt(_local1)){
this._loaderClip.setChildIndex(_local2.item, _local1);
};
_local1++;
};
}
private function getItemTypeOrder(_arg1:String):Number{
var _local2:Number = 0;
while (_local2 < this._typeOrder_array.length) {
if (_arg1 == this._typeOrder_array[_local2]){
return (_local2);
};
_local2++;
};
return (-1);
}
private function isNoItem():Boolean{
return ((this._item_array.length == 0));
}
private function getItemIndex(_arg1):Number{
var _local2:Number = 0;
while (_local2 < this._item_array.length) {
if (_arg1 === this._item_array[_local2].item){
return (_local2);
};
_local2++;
};
return (-1);
}
public function addItem(_arg1, _arg2:String, _arg3:Boolean=true):void{
var _local4:Number = this.getIndex(_arg1, _arg2, _arg3);
var _local5:Object = {};
_local5.item = _arg1;
_local5.type = _arg2;
this._item_array.splice(_local4, 0, _local5);
this._loaderClip.addChild(_arg1);
this.updateIndexes();
}
public function changeItemIndex(_arg1, _arg2:String, _arg3:Boolean=true):void{
var _local4:Number = this.getItemIndex(_arg1);
this._item_array.splice(_local4, 1);
var _local5:Number = this.getIndex(_arg1, _arg2, _arg3);
var _local6:Object = {};
_local6.item = _arg1;
_local6.type = _arg2;
this._item_array.splice(_local5, 0, _local6);
this.updateIndexes();
}
public function removeItem(_arg1):void{
var _local2:Number = this.getItemIndex(_arg1);
this._item_array.splice(_local2, 1);
this._loaderClip.removeChild(_arg1);
this.updateIndexes();
}
public function setTypeOrder(_arg1:Array):void{
this._typeOrder_array = _arg1;
}
private function getIndex(_arg1, _arg2:String, _arg3:Boolean):Number{
if (this.isNoItem()){
return (0);
};
if (!_arg3){
return (this.getTypeLowestIndex(_arg2));
};
return (this.getTypeHighestIndex(_arg2));
}
private function getTypeLowestIndex(_arg1:String):Number{
var _local5:Object;
var _local6:Number;
var _local2:Number = 0;
var _local3:Number = this.getItemTypeOrder(_arg1);
var _local4:Number = 0;
while (_local4 < this._item_array.length) {
_local5 = this._item_array[_local4];
_local6 = 0;
while (_local6 < _local3) {
if (_local5.type == this._typeOrder_array[_local6]){
_local2++;
};
_local6++;
};
_local4++;
};
return (_local2);
}
}
}//package com.game.control
Section 3
//XMLHandler (com.game.control.XMLHandler)
package com.game.control {
import flash.events.*;
import flash.net.*;
public class XMLHandler {
public static function load(_arg1:String, _arg2:Function):void{
var _local3:URLRequest = new URLRequest(_arg1);
var _local4:* = new URLLoader();
_local4.load(_local3);
_local4.addEventListener(Event.COMPLETE, _arg2, false, 0, true);
}
}
}//package com.game.control
Section 4
//Bullet (com.game.item.bullet.Bullet)
package com.game.item.bullet {
import com.game.control.*;
import com.game.item.*;
public class Bullet extends MovableItem {
private var _gameControl:GameControl;
public var _fromSide:String;
public var _fromRobotID:int;
public var _damage:Number;
public function Bullet(_arg1, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:String, _arg9:int){
super(_arg1, _arg2, _arg3);
_xMov = _arg4;
_yMov = _arg5;
_yAcc = _arg6;
_damage = _arg7;
_fromSide = _arg8;
_fromRobotID = _arg9;
init();
}
private function init():void{
_gameControl = _parent;
}
}
}//package com.game.item.bullet
Section 5
//Cannon (com.game.item.bullet.Cannon)
package com.game.item.bullet {
import flash.display.*;
import com.util.*;
import com.game.control.*;
import com.game.*;
public class Cannon extends Bullet {
private var _startRobotExplodeFrames:int;
private var _gameControl:GameControl;
public var animation_mc:MovieClip;
private var _framesStartRobotExplode:int;
private var _framesExplode:int;
private var _explodeEndFrames:int;
public function Cannon(_arg1, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:String, _arg9:int){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
init();
}
private function explode():void{
_explodeEndFrames = (_gameControl._frames + _framesExplode);
_status = "explode";
_clipAnimationStatus = "explode";
updateClipAniamtion();
}
private function checkGroundCollision():void{
if (_tempY > _maxY){
_tempY = _maxY;
_xMov = 0;
_yMov = 0;
if (_gameControl._attackCompleted){
_gameControl.playSound("attackCannon");
explode();
};
};
}
override public function updateTempPosition():void{
if (_status == "normal"){
_xMov = (_xMov + _xAcc);
_yMov = (_yMov + _yAcc);
_tempX = (_tempX + _xMov);
_tempY = (_tempY + _yMov);
};
}
private function checkEnemyRobotsCollision():void{
var _local1:int;
var _local2:*;
var _local3:Boolean;
if (_gameControl._frames > _startRobotExplodeFrames){
_local1 = 0;
while (_local1 < _gameControl._enemyRobot_array.length) {
_local2 = _gameControl._enemyRobot_array[_local1];
if (!(((_fromSide == "enemy")) && ((_fromRobotID == _local2._id)))){
_local3 = PixelPerfectCollisionDetection.isColliding(this, _local2, _gameControl._field, true);
if (_local3){
if (_gameControl._attackCompleted){
_gameControl.playSound("attackCannon");
explode();
_local2.tryDamage(_damage);
};
};
};
_local1++;
};
};
}
private function checkCollision():void{
checkEnemyRobotsCollision();
checkPlayerRobotsCollision();
checkObstaclesCollision();
checkGroundCollision();
}
override public function update():void{
if (_status == "normal"){
updateTempPosition();
checkCollision();
updatePosition();
updateClipPosition();
} else {
if (_status == "explode"){
if (_gameControl._frames > _explodeEndFrames){
remove();
};
};
};
}
private function checkPlayerRobotsCollision():void{
var _local1:int;
var _local2:*;
var _local3:Boolean;
if (_gameControl._frames > _startRobotExplodeFrames){
_local1 = 0;
while (_local1 < _gameControl._playerRobot_array.length) {
_local2 = _gameControl._playerRobot_array[_local1];
_local3 = PixelPerfectCollisionDetection.isColliding(this, _local2, _gameControl._field, true);
if (!(((_fromSide == "player")) && ((_fromRobotID == _local2._id)))){
if (_local3){
if (_gameControl._attackCompleted){
_gameControl.playSound("attackCannon");
explode();
_local2.tryDamage(_damage);
};
};
};
_local1++;
};
};
}
private function checkObstaclesCollision():void{
var _local2:*;
var _local3:Boolean;
var _local1:int;
while (_local1 < _gameControl._obstacle_array.length) {
_local2 = _gameControl._obstacle_array[_local1];
_local3 = PixelPerfectCollisionDetection.isColliding(this, _local2, _gameControl._field, true);
if (_local3){
if (_gameControl._attackCompleted){
_gameControl.playSound("attackCannon");
_gameControl.playSound("obstacleHit");
explode();
_local2.tryDamage(_damage);
};
};
_local1++;
};
}
private function init():void{
_gameControl = _parent;
_framesExplode = 18;
_explodeEndFrames = 0;
_framesStartRobotExplode = 3;
_startRobotExplodeFrames = (_gameControl._frames + _framesStartRobotExplode);
_animationClip = animation_mc;
_maxY = Constant.CANNON_MAX_Y;
}
}
}//package com.game.item.bullet
Section 6
//Laser (com.game.item.bullet.Laser)
package com.game.item.bullet {
import flash.display.*;
import com.util.*;
import com.game.control.*;
import com.game.*;
public class Laser extends Bullet {
private var _hitClip:MovieClip;
private var _length:Number;
private var _gameControl:GameControl;
private var _isCollided:Boolean;
private var _isReachingMaxLength:Boolean;
private var _framesStartRobotExplode:int;
private var _framesExplode:int;
private var _startRobotExplodeFrames:int;
private var _laserLineColor:int;
private var _maxDist:Number;
private var _fromX:Number;
private var _fromY:Number;
public var animation_mc:MovieClip;
private var _maxLength:Number;
public function Laser(_arg1, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:String, _arg9:int, _arg10:int){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
_laserLineColor = _arg10;
init();
}
private function checkPlayerRobotsCollision():void{
var _local1:int;
var _local2:*;
var _local3:Boolean;
if (_gameControl._frames > _startRobotExplodeFrames){
_local1 = 0;
while (_local1 < _gameControl._playerRobot_array.length) {
_local2 = _gameControl._playerRobot_array[_local1];
_local3 = PixelPerfectCollisionDetection.isColliding(_hitClip, _local2, _gameControl._field, true);
if (!(((_fromSide == "player")) && ((_fromRobotID == _local2._id)))){
if (_local3){
if (_gameControl._attackCompleted){
_gameControl.playSound("attackLaser");
_isCollided = true;
trace("EXPLODE 2");
explode();
_local2.tryDamage(_damage);
};
};
};
_local1++;
};
};
}
private function checkGroundCollision():void{
if (_tempY > _maxY){
_tempY = _maxY;
_xMov = 0;
_yMov = 0;
if (_gameControl._attackCompleted){
_gameControl.playSound("attackLaser");
_isCollided = true;
trace("EXPLODE 4");
explode();
};
};
}
override public function update():void{
if (_status == "normal"){
updateTempPosition();
checkCollision();
updatePosition();
updateClipPosition();
updateDist();
updateRotation();
} else {
if (_status == "explode"){
updateTempPosition();
updatePosition();
updateClipPosition();
updateRotation();
};
};
}
override public function updateTempPosition():void{
var _local1:Number;
var _local2:Number;
if (_status == "normal"){
if (!_isReachingMaxLength){
if (!_isCollided){
_tempX = (_tempX + _xMov);
_tempY = (_tempY + _yMov);
if (getLaserLineLength() >= _maxLength){
_isReachingMaxLength = true;
};
};
} else {
if (!_isCollided){
_tempX = (_tempX + _xMov);
_tempY = (_tempY + _yMov);
_fromX = (_fromX + _xMov);
_fromY = (_fromY + _yMov);
};
};
} else {
if (_status == "explode"){
_fromX = (_fromX + _xMov);
_fromY = (_fromY + _yMov);
_local1 = (_tempX - _fromX);
_local2 = (_tempY - _fromY);
};
};
}
private function init():void{
_gameControl = _parent;
_animationClip = animation_mc;
_hitClip = _animationClip.hit_mc;
_framesExplode = 18;
_framesStartRobotExplode = 3;
_startRobotExplodeFrames = (_gameControl._frames + _framesStartRobotExplode);
_initX = _x;
_initY = _y;
_fromX = _x;
_fromY = _y;
_maxDist = Constant.LASER_MAX_TRAVEL_DIST;
_maxLength = Constant.LASER_LENGTH;
_minX = Constant.LASER_MIN_X;
_minY = Constant.LASER_MIN_Y;
_maxX = Constant.LASER_MAX_X;
_maxY = Constant.LASER_MAX_Y;
_isReachingMaxLength = false;
_isCollided = false;
updateLength();
}
private function checkCollision():void{
checkEnemyRobotsCollision();
checkPlayerRobotsCollision();
checkObstaclesCollision();
checkGroundCollision();
checkWallCollision();
}
private function updateLength():void{
var _local1:Number = (_x - _fromX);
var _local2:Number = (_y - _fromY);
_length = Math.sqrt(((_local1 * _local1) + (_local2 * _local2)));
_width = ((_length * _local1) / _length);
_height = ((_length * _local2) / _length);
updateClipWidth();
}
private function checkWallCollision():void{
if (_tempX < _minX){
_tempX = _minX;
_xMov = 0;
_yMov = 0;
_isCollided = true;
remove();
} else {
if (_tempX > _maxX){
_tempX = _maxX;
_xMov = 0;
_yMov = 0;
_isCollided = true;
remove();
} else {
if (_tempY < _minY){
_tempY = _minY;
_xMov = 0;
_yMov = 0;
_isCollided = true;
remove();
};
};
};
}
private function explode():void{
trace("EXPLODE");
_status = "explode";
_clipAnimationStatus = "explode";
updateClipAniamtion();
}
private function checkEnemyRobotsCollision():void{
var _local1:int;
var _local2:*;
var _local3:Boolean;
if (_gameControl._frames > _startRobotExplodeFrames){
_local1 = 0;
while (_local1 < _gameControl._enemyRobot_array.length) {
_local2 = _gameControl._enemyRobot_array[_local1];
if (!(((_fromSide == "enemy")) && ((_fromRobotID == _local2._id)))){
_local3 = PixelPerfectCollisionDetection.isColliding(_hitClip, _local2, _gameControl._field, true);
if (_local3){
if (_gameControl._attackCompleted){
_gameControl.playSound("attackLaser");
_isCollided = true;
explode();
_local2.tryDamage(_damage);
};
};
};
_local1++;
};
};
}
override public function updateRotation():void{
var _local1:Number = _xMov;
var _local2:Number = _yMov;
if (_local1 == 0){
_local1 = 1E-5;
};
if (_xMov > 0){
_rotation = ((Math.atan((_local2 / _local1)) / Math.PI) * 180);
} else {
if (_local1 < 0){
_rotation = (((Math.atan((_local2 / _local1)) + Math.PI) / Math.PI) * 180);
};
};
updateClipRotation();
}
private function getLaserLineLength():Number{
var _local1:Number = (_tempX - _fromX);
var _local2:Number = (_tempY - _fromY);
return (Math.sqrt(((_local1 * _local1) + (_local2 * _local2))));
}
private function updateDist():void{
var _local1:Number = (_x - _initX);
var _local2:Number = (_y - _initY);
var _local3:Number = Math.sqrt(((_local1 * _local1) + (_local2 * _local2)));
if (_local3 > _maxDist){
_local3 = _maxDist;
explode();
};
}
private function checkObstaclesCollision():void{
var _local2:*;
var _local3:Boolean;
var _local1:int;
while (_local1 < _gameControl._obstacle_array.length) {
_local2 = _gameControl._obstacle_array[_local1];
_local3 = PixelPerfectCollisionDetection.isColliding(_hitClip, _local2, _gameControl._field, true);
if (_local3){
if (_gameControl._attackCompleted){
_gameControl.playSound("attackLaser");
_gameControl.playSound("obstacleHit");
_isCollided = true;
trace("EXPLODE 3");
explode();
_local2.tryDamage(_damage);
};
};
_local1++;
};
}
}
}//package com.game.item.bullet
Section 7
//Enemy (com.game.item.enemy.Enemy)
package com.game.item.enemy {
import com.util.*;
import com.game.control.*;
import com.game.*;
import com.game.item.*;
public class Enemy extends MovableItem {
public var _shootError:Number;
public var _targetPlayerID:int;
private var _gravity:Number;
public var _isAttacking:Boolean;
private var _gameControl:GameControl;
public var _clipAnimation:String;
public var _attackRange:Number;
public var _isDestroyed:Boolean;
public var _type:String;
public var _faceDirection:String;
public var _attackPower:Number;
public var _attackOrder:Number;
public var _isOnGround:Boolean;
public var _id:int;
public var _health:Number;
public function Enemy(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:int){
super(_arg1, _arg3, _arg4);
_id = _arg2;
_type = _arg5;
_health = _arg6;
_attackPower = _arg7;
_attackRange = _arg8;
_attackOrder = _arg9;
init();
}
public function destroy():void{
_isDestroyed = true;
var _local1:String = (("enemy" + _type.substring(0, 1).toUpperCase()) + _type.substring(1, _type.length));
_gameControl._stat.setStatusClipStatus(_local1, "destroyed");
remove();
}
private function checkObstacleCollision():void{
var _local1:Boolean = isCollidingWithObstacles();
if (_local1){
if (_yMov < 0){
_yMov = (_yMov + _gravity);
_tempX = (_tempX + _xMov);
_tempY = (_tempY + _yMov);
} else {
_xMov = 0;
_yMov = 0;
_isOnGround = true;
if (_type == "melee"){
toDefaultMode();
};
};
} else {
_yMov = (_yMov + _gravity);
_tempX = (_tempX + _xMov);
_tempY = (_tempY + _yMov);
if (_tempY > _maxY){
_tempY = _maxY;
_xMov = 0;
_yMov = 0;
_isOnGround = true;
if (_type == "melee"){
toDefaultMode();
};
};
};
updatePosition();
updateClipPosition();
}
private function boundBack():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = -0.3;
_local2 = 4;
_local3 = 4;
_tempX = (_tempX - _xMov);
_tempY = (_tempY - _yMov);
_xMov = (_xMov * _local1);
_yMov = (_yMov * _local1);
if (Math.abs(_xMov) < _local2){
if (_xMov < 0){
_xMov = (_local2 * -1);
} else {
_xMov = _local2;
};
};
if (Math.abs(_yMov) < _local3){
if (_yMov < 0){
_yMov = (_local3 * -1);
} else {
_yMov = _local3;
};
};
}
public function toDefaultMode():void{
if (_type == "cannon"){
_animationClip.animation_mc.gun_mc.visible = false;
} else {
if (_type == "laser"){
_animationClip.animation_mc.defaultArm_mc.visible = true;
_animationClip.animation_mc.attackArm_mc.visible = false;
} else {
if (_type == "melee"){
_animationClip.animation_mc.gotoAndStop("default");
};
};
};
}
public function tryDamage(_arg1:int):void{
damage(_arg1);
}
private function checkWallCollision():void{
if (((!((_xMov == 0))) || (!((_yMov == 0))))){
if (_tempX < _minX){
_tempX = _minX;
_xMov = (_xMov * -0.4);
} else {
if (_tempX > _maxX){
_tempX = _maxX;
_xMov = (_xMov * -0.4);
};
};
if (_tempY > _maxY){
_tempY = _maxY;
_xMov = 0;
_yMov = 0;
_isOnGround = true;
if (_type == "melee"){
toDefaultMode();
};
};
updatePosition();
updateClipPosition();
};
}
private function isCollidingWithObstacles():Boolean{
var _local4:*;
var _local5:Boolean;
var _local1:Array = _gameControl._obstacle_array;
var _local2:int = _local1.length;
var _local3:int;
while (_local3 < _local2) {
_local4 = _local1[_local3];
_local5 = PixelPerfectCollisionDetection.isColliding(this, _local4, _gameControl._field, true);
if (_local5){
return (true);
};
_local3++;
};
return (false);
}
private function explode():void{
}
public function toAttackMode():void{
if (_type == "cannon"){
_animationClip.animation_mc.gun_mc.visible = true;
} else {
if (_type == "laser"){
_animationClip.animation_mc.defaultArm_mc.visible = false;
_animationClip.animation_mc.attackArm_mc.visible = true;
} else {
if (_type == "melee"){
_animationClip.animation_mc.gotoAndStop("attack");
};
};
};
}
private function init():void{
_gameControl = _parent;
_targetPlayerID = -1;
_shootError = 0;
_maxY = Constant.ENEMY_ROBOT_MAX_Y;
_gravity = Constant.ENEMY_ROBOT_GRAVITY;
_isAttacking = true;
_isDestroyed = false;
_isOnGround = false;
_faceDirection = "right";
_status = "normal";
_clipAnimation = "normal";
}
protected function getAttackSpeed(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (Math.sqrt(((((_arg3 * _arg1) * _arg1) / (_arg2 - (_arg1 * Math.tan(_arg4)))) / ((Math.cos(_arg4) * Math.cos(_arg4)) * 2))));
}
override public function update():void{
checkObstacleCollision();
checkPlayerRobotsCollision();
checkWallCollision();
}
public function horFlip(_arg1:String):void{
_faceDirection = _arg1;
if (_arg1 == "right"){
scaleX = 1;
} else {
if (_arg1 == "left"){
scaleX = -1;
};
};
}
public function reduceHealth(_arg1:Number):void{
_health = (_health - _arg1);
if (_health <= 0){
_health = 0;
destroy();
};
}
private function checkPlayerRobotsCollision():void{
var _local2:*;
var _local3:Boolean;
var _local1:int;
while (_local1 < _gameControl._playerRobot_array.length) {
_local2 = _gameControl._playerRobot_array[_local1];
_local3 = PixelPerfectCollisionDetection.isColliding(this, _local2, _gameControl._field, true);
if (_local3){
if (_type == "melee"){
if (_xMov != 0){
_gameControl.playSound("attackMelee");
_gameControl.showExplosion(_local2.x, (_local2.y - 5));
_local2.tryDamage(_attackPower);
boundBack();
};
};
};
_local1++;
};
}
private function damage(_arg1:int):void{
reduceHealth(_arg1);
_gameControl.updateStatusClipTxt("enemy", _id);
_clipAnimation = "damage";
}
}
}//package com.game.item.enemy
Section 8
//EnemyCar (com.game.item.enemy.EnemyCar)
package com.game.item.enemy {
import flash.display.*;
public dynamic class EnemyCar extends MovieClip {
public var animation_mc:MovieClip;
}
}//package com.game.item.enemy
Section 9
//EnemyTypeCannon (com.game.item.enemy.EnemyTypeCannon)
package com.game.item.enemy {
import flash.display.*;
import com.game.control.*;
import com.game.*;
public class EnemyTypeCannon extends Enemy {
private var _maxShootSpeedLineDist:Number;
private var _gameControl:GameControl;
private var _maxShootSpeed:Number;
public var animation_mc:MovieClip;
private var _explodeClip:MovieClip;
public var explode_mc:mcExplodeAnimation2;
public function EnemyTypeCannon(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:int){
super(_arg1, _arg2, _arg3, _arg4, "cannon", _arg5, _arg6, _arg7, _arg8);
init();
}
public function tryAttack():void{
if ((((_gameControl._sideAttack == "enemy")) && (!(_gameControl._attackCompleted)))){
toAttackMode();
attack();
};
}
private function attack():void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local1:* = _gameControl.getRandomAvailablePlayerRobot();
if (_local1 != null){
_local2 = 0.3;
_local3 = Constant.CANNON_GRAVITY;
_local4 = (_local1.x - _x);
_local5 = (_local1.y - _y);
if (_local4 < 0){
_local6 = (-140 + (Math.random() * 40));
} else {
_local6 = (-80 + (Math.random() * 40));
};
_local7 = ((_local6 / 180) * Math.PI);
_local8 = getAttackSpeed(_local4, _local5, _local3, _local7);
_local9 = (_local8 * Math.cos(_local7));
_local10 = (_local8 * Math.sin(_local7));
_local9 = (_local9 * ((1 - _local2) + ((_local2 * 2) * Math.random())));
_local10 = (_local10 * ((1 - _local2) + ((_local2 * 2) * Math.random())));
if (_local9 > 0){
_gameControl.createBullet("cannon", (_x + 15), (_y - 10), _local9, _local10, _local3, _attackPower, "enemy", _id);
_clipAnimationStatus = "attackRight";
horFlip("right");
} else {
_gameControl.createBullet("cannon", (_x - 15), (_y - 10), _local9, _local10, _local3, _attackPower, "enemy", _id);
_clipAnimationStatus = "attackLeft";
horFlip("left");
};
_gameControl.playSound("attackCannon");
_gameControl.hideTurnArrow();
_isAttacking = true;
updateClipAniamtion();
updateGunRotation(_local9, _local10);
_animationClip.animation_mc.gun_mc.flash_mc.gotoAndPlay("show");
};
_gameControl._attackCompleted = true;
_gameControl.setFinishAttackTimer();
}
private function init():void{
_gameControl = _parent;
_animationClip = animation_mc;
_explodeClip = explode_mc;
_maxShootSpeed = 20;
_maxShootSpeedLineDist = 400;
toDefaultMode();
}
public function updateGunRotation(_arg1:Number, _arg2:Number):void{
var _local4:Number;
if (_faceDirection == "right"){
_arg1 = (_arg1 * -1);
};
var _local3:Number = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
if (_arg1 == 0){
_arg1 = 1E-5;
};
if (_arg1 > 0){
_local4 = ((Math.atan((_arg2 / _arg1)) / Math.PI) * 180);
} else {
if (_arg1 < 0){
_local4 = (((Math.atan((_arg2 / _arg1)) + Math.PI) / Math.PI) * 180);
};
};
_animationClip.animation_mc.gun_mc.rotation = _local4;
}
public function showExplodeClip():void{
_explodeClip.gotoAndPlay("explode");
}
}
}//package com.game.item.enemy
Section 10
//EnemyTypeLaser (com.game.item.enemy.EnemyTypeLaser)
package com.game.item.enemy {
import flash.display.*;
import com.game.control.*;
import com.game.*;
public class EnemyTypeLaser extends Enemy {
private var _shootSpeed:Number;
private var _gameControl:GameControl;
public var animation_mc:EnemyCar;
private var _explodeClip:MovieClip;
public var explode_mc:mcExplodeAnimation2;
public function EnemyTypeLaser(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:int){
super(_arg1, _arg2, _arg3, _arg4, "laser", _arg5, _arg6, _arg7, _arg8);
init();
}
public function tryAttack():void{
if ((((_gameControl._sideAttack == "enemy")) && (!(_gameControl._attackCompleted)))){
toAttackMode();
attack();
};
}
public function updateAttackArmRotation(_arg1:Number, _arg2:Number):void{
var _local4:Number;
if (_faceDirection == "right"){
_arg1 = (_arg1 * -1);
};
var _local3:Number = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
if (_arg1 == 0){
_arg1 = 1E-5;
};
if (_arg1 > 0){
_local4 = ((Math.atan((_arg2 / _arg1)) / Math.PI) * 180);
} else {
if (_arg1 < 0){
_local4 = (((Math.atan((_arg2 / _arg1)) + Math.PI) / Math.PI) * 180);
};
};
_animationClip.animation_mc.attackArm_mc.rotation = _local4;
}
private function attack():void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local1:* = _gameControl.getRandomAvailablePlayerRobot();
if (_local1 != null){
_local2 = 0.3;
_local3 = (_local1.x - _x);
_local4 = (_local1.y - _y);
_local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
_local6 = ((_shootSpeed * _local3) / _local5);
_local7 = ((_shootSpeed * _local4) / _local5);
_local6 = (_local6 * ((1 - _local2) + ((_local2 * 2) * Math.random())));
_local7 = (_local7 * ((1 - _local2) + ((_local2 * 2) * Math.random())));
_gameControl.createBullet("laser", _x, _y, _local6, _local7, 0, _attackPower, "enemy", _id, 0xFF0000);
if (_local6 > 0){
_clipAnimationStatus = "attackRight";
horFlip("right");
} else {
_clipAnimationStatus = "attackLeft";
horFlip("left");
};
_gameControl.playSound("attackLaser");
_gameControl.hideTurnArrow();
_isAttacking = true;
updateClipAniamtion();
updateAttackArmRotation(_local6, _local7);
_animationClip.animation_mc.attackArm_mc.flash_mc.gotoAndPlay("show");
};
_gameControl._attackCompleted = true;
_gameControl.setFinishAttackTimer();
}
private function init():void{
_gameControl = _parent;
_animationClip = animation_mc;
_explodeClip = explode_mc;
_shootSpeed = Constant.LASER_SPEED;
toDefaultMode();
}
public function showExplodeClip():void{
_explodeClip.gotoAndPlay("explode");
}
}
}//package com.game.item.enemy
Section 11
//EnemyTypeMelee (com.game.item.enemy.EnemyTypeMelee)
package com.game.item.enemy {
import flash.display.*;
import com.game.control.*;
import com.game.*;
public class EnemyTypeMelee extends Enemy {
private var _minJumpSpeed:Number;
private var _maxJumpSpeedLineDist:Number;
public var animation_mc:MovieClip;
private var _explodeClip:MovieClip;
private var _gameControl:GameControl;
public var explode_mc:mcExplodeAnimation2;
private var _maxJumpSpeed:Number;
public function EnemyTypeMelee(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:int){
super(_arg1, _arg2, _arg3, _arg4, "melee", _arg5, _arg6, _arg7, _arg8);
init();
}
public function showExplodeClip():void{
_explodeClip.gotoAndPlay("explode");
}
public function tryAttack():void{
if ((((_gameControl._sideAttack == "enemy")) && (!(_gameControl._attackCompleted)))){
toAttackMode();
attack();
};
}
private function init():void{
_gameControl = _parent;
_animationClip = animation_mc;
_explodeClip = explode_mc;
_maxJumpSpeed = 25;
toDefaultMode();
}
private function attack():void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local1:* = _gameControl.getRandomAvailablePlayerRobot();
if (_local1 != null){
_local2 = 0.1;
_local3 = Constant.ENEMY_ROBOT_GRAVITY;
_local4 = (_local1.x - _x);
_local5 = (_local1.y - _y);
if (_local4 < 0){
_local6 = (-140 + (Math.random() * 40));
} else {
_local6 = (-80 + (Math.random() * 40));
};
_local7 = ((_local6 / 180) * Math.PI);
_local8 = getAttackSpeed(_local4, _local5, _local3, _local7);
_xMov = (_local8 * Math.cos(_local7));
_yMov = (_local8 * Math.sin(_local7));
_xMov = (_xMov * ((1 - _local2) + ((_local2 * 2) * Math.random())));
_yMov = (_yMov * ((1 - _local2) + ((_local2 * 2) * Math.random())));
if (_xMov > 0){
_clipAnimationStatus = "attackRight";
horFlip("right");
} else {
_clipAnimationStatus = "attackLeft";
horFlip("left");
};
_gameControl.playSound("attackMelee");
_gameControl.hideTurnArrow();
_clipAnimationStatus = "attack";
_isAttacking = true;
_isOnGround = false;
updateClipAniamtion();
};
_gameControl._attackCompleted = true;
_gameControl.setFinishAttackTimer();
}
}
}//package com.game.item.enemy
Section 12
//Obstacle (com.game.item.obstacle.Obstacle)
package com.game.item.obstacle {
import com.game.control.*;
import com.game.item.*;
public class Obstacle extends MovableItem {
private var _gameControl:GameControl;
public var _isDestroyed:Boolean;
public var _clipAnimation:String;
public var _type:String;
public var _id:int;
public var _health:Number;
public function Obstacle(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Number){
super(_arg1, _arg3, _arg4);
_id = _arg2;
_type = _arg5;
_health = _arg6;
init();
}
public function destroy():void{
_isDestroyed = true;
remove();
}
public function reduceHealth(_arg1:Number):void{
_health = (_health - _arg1);
if (_health <= 0){
_health = 0;
destroy();
};
}
public function detroy():void{
}
private function damage(_arg1:int):void{
reduceHealth(_arg1);
_gameControl.updateStatusClipTxt("enemy", _id);
_clipAnimation = "damage";
}
public function tryDamage(_arg1:int):void{
damage(_arg1);
}
private function init():void{
_gameControl = _parent;
updateClipPosition();
}
}
}//package com.game.item.obstacle
Section 13
//ObstacleRock0 (com.game.item.obstacle.ObstacleRock0)
package com.game.item.obstacle {
public class ObstacleRock0 extends Obstacle {
public function ObstacleRock0(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number){
super(_arg1, _arg2, _arg3, _arg4, "rock0", _arg5);
}
}
}//package com.game.item.obstacle
Section 14
//ObstacleRock1 (com.game.item.obstacle.ObstacleRock1)
package com.game.item.obstacle {
public class ObstacleRock1 extends Obstacle {
public function ObstacleRock1(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number){
super(_arg1, _arg2, _arg3, _arg4, "rock1", _arg5);
}
}
}//package com.game.item.obstacle
Section 15
//ObstacleRock2 (com.game.item.obstacle.ObstacleRock2)
package com.game.item.obstacle {
public class ObstacleRock2 extends Obstacle {
public function ObstacleRock2(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number){
super(_arg1, _arg2, _arg3, _arg4, "rock2", _arg5);
}
}
}//package com.game.item.obstacle
Section 16
//Player (com.game.item.player.Player)
package com.game.item.player {
import com.util.*;
import com.game.control.*;
import com.game.*;
import com.game.item.*;
public class Player extends MovableItem {
private var _gameControl:GameControl;
private var _gravity:Number;
public var _isDestroyed:Boolean;
public var _isAttacking:Boolean;
public var _clipAnimation:String;
public var _attackRange:Number;
public var _type:String;
public var _attackOrder:Number;
public var _attackPower:Number;
public var _isOnGround:Boolean;
public var _id:int;
public var _health:Number;
public function Player(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:int){
super(_arg1, _arg3, _arg4);
_id = _arg2;
_type = _arg5;
_health = _arg6;
_attackPower = _arg7;
_attackRange = _arg8;
_attackOrder = _arg9;
init();
}
public function destroy():void{
_isDestroyed = true;
var _local1:String = (("player" + _type.substring(0, 1).toUpperCase()) + _type.substring(1, _type.length));
_gameControl._stat.setStatusClipStatus(_local1, "destroyed");
trace(("DISTROY " + _id));
remove();
}
private function checkObstacleCollision():void{
var _local1:Boolean = isCollidingWithObstacles();
if (_local1){
if (_yMov < 0){
_yMov = (_yMov + _gravity);
_tempX = (_tempX + _xMov);
_tempY = (_tempY + _yMov);
} else {
_xMov = 0;
_yMov = 0;
_isOnGround = true;
if (_type == "melee"){
toDefaultMode();
};
};
} else {
_yMov = (_yMov + _gravity);
_tempX = (_tempX + _xMov);
_tempY = (_tempY + _yMov);
if (_tempY > _maxY){
_tempY = _maxY;
_xMov = 0;
_yMov = 0;
_isOnGround = true;
if (_type == "melee"){
toDefaultMode();
};
};
};
updatePosition();
updateClipPosition();
}
private function boundBack():void{
var _local1:Number;
var _local2:Number;
_local1 = -0.3;
_local2 = 4;
var _local3:Number = 4;
_tempX = (_tempX - _xMov);
_tempY = (_tempY - _yMov);
_xMov = (_xMov * _local1);
_yMov = (_yMov * _local1);
if (Math.abs(_xMov) < _local2){
if (_xMov < 0){
_xMov = (_local2 * -1);
} else {
_xMov = _local2;
};
};
if (Math.abs(_yMov) < _local3){
if (_yMov < 0){
_yMov = (_local3 * -1);
} else {
_yMov = _local3;
};
};
}
public function toDefaultMode():void{
if (_type == "cannon"){
_animationClip.animation_mc.arm_mc.visible = true;
_animationClip.animation_mc.gun_mc.visible = false;
} else {
if (_type == "laser"){
_animationClip.rightArm_mc.gotoAndStop("down");
} else {
if (_type == "melee"){
_animationClip.animation_mc.gotoAndStop("default");
};
};
};
}
public function tryDamage(_arg1:int):void{
damage(_arg1);
}
private function init():void{
_gameControl = _parent;
_minX = Constant.PLAYER_ROBOT_MIN_X;
_maxX = Constant.PLAYER_ROBOT_MAX_X;
_maxY = Constant.PLAYER_ROBOT_MAX_Y;
_gravity = Constant.PLAYER_ROBOT_GRAVITY;
_isAttacking = true;
_isDestroyed = false;
_isOnGround = false;
_status = "normal";
_clipAnimation = "normal";
}
private function isCollidingWithObstacles():Boolean{
var _local4:*;
var _local5:Boolean;
var _local1:Array = _gameControl._obstacle_array;
var _local2:int = _local1.length;
var _local3:int;
while (_local3 < _local2) {
_local4 = _local1[_local3];
_local5 = PixelPerfectCollisionDetection.isColliding(this, _local4, _gameControl._field, true);
if (_local5){
return (true);
};
_local3++;
};
return (false);
}
public function horFlip(_arg1:String):void{
if (_arg1 == "right"){
scaleX = 1;
} else {
if (_arg1 == "left"){
scaleX = -1;
};
};
}
override public function update():void{
checkObstacleCollision();
checkEnemyRobotsCollision();
checkWallCollision();
}
public function toAttackMode():void{
if (_type == "cannon"){
_animationClip.animation_mc.arm_mc.visible = false;
_animationClip.animation_mc.gun_mc.visible = true;
} else {
if (_type == "laser"){
_animationClip.rightArm_mc.gotoAndStop("up");
} else {
if (_type == "melee"){
_animationClip.animation_mc.gotoAndStop("attack");
};
};
};
}
public function reduceHealth(_arg1:Number):void{
_health = (_health - _arg1);
if (_health <= 0){
_health = 0;
destroy();
};
}
private function checkEnemyRobotsCollision():void{
var _local2:*;
var _local3:Boolean;
var _local1:int;
while (_local1 < _gameControl._enemyRobot_array.length) {
_local2 = _gameControl._enemyRobot_array[_local1];
_local3 = PixelPerfectCollisionDetection.isColliding(this, _local2, _gameControl._field, true);
if (_local3){
if (_type == "melee"){
if (_xMov != 0){
_gameControl.playSound("attackMelee");
_gameControl.showExplosion(_local2.x, (_local2.y - 5));
_local2.tryDamage(_attackPower);
boundBack();
};
};
};
_local1++;
};
}
private function checkWallCollision():void{
if (((!((_xMov == 0))) || (!((_yMov == 0))))){
if (_tempX < _minX){
_tempX = _minX;
_xMov = (_xMov * -0.4);
} else {
if (_tempX > _maxX){
_tempX = _maxX;
_xMov = (_xMov * -0.4);
};
};
if (_tempY > _maxY){
_tempY = _maxY;
_xMov = 0;
_yMov = 0;
_isOnGround = true;
if (_type == "melee"){
toDefaultMode();
};
};
updatePosition();
updateClipPosition();
};
}
private function damage(_arg1:int):void{
reduceHealth(_arg1);
_gameControl.updateStatusClipTxt("player", _id);
_clipAnimation = "damage";
updateClipAniamtion();
}
}
}//package com.game.item.player
Section 17
//PlayerTypeCannon (com.game.item.player.PlayerTypeCannon)
package com.game.item.player {
import flash.display.*;
import com.game.control.*;
import com.game.*;
public class PlayerTypeCannon extends Player {
private var _maxAttackLineDist:Number;
private var _gameControl:GameControl;
private var _maxShootSpeed:Number;
public var animation_mc:MovieClip;
private var _explodeClip:MovieClip;
public var explode_mc:mcExplodeAnimation2;
private var _minShootSpeed:Number;
public function PlayerTypeCannon(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:int){
super(_arg1, _arg2, _arg3, _arg4, "cannon", _arg5, _arg6, _arg7, _arg8);
init();
}
public function showExplodeClip():void{
_explodeClip.gotoAndPlay("explode");
}
public function tryAttack(_arg1:Number, _arg2:Number):void{
if ((((_gameControl._sideAttack == "player")) && (!(_gameControl._attackCompleted)))){
attack(_arg1, _arg2);
};
}
private function attack(_arg1:Number, _arg2:Number):void{
var _local3:Number = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
var _local4:Number = _local3;
var _local5:Number = Constant.CANNON_GRAVITY;
if (_local4 > _maxAttackLineDist){
_local4 = _maxAttackLineDist;
};
var _local6:Number = ((_maxShootSpeed * _local4) / _maxAttackLineDist);
if (_local6 < _minShootSpeed){
_local6 = _minShootSpeed;
};
var _local7:Number = ((_local6 * _arg1) / _local3);
var _local8:Number = ((_local6 * _arg2) / _local3);
if (_local7 > 0){
_gameControl.createBullet("cannon", (_x + 15), (_y - 12), _local7, _local8, _local5, _attackPower, "player", _id);
} else {
_gameControl.createBullet("cannon", (_x - 15), (_y - 12), _local7, _local8, _local5, _attackPower, "player", _id);
};
updateClipAniamtion();
_isAttacking = true;
_gameControl.playSound("attackCannon");
_gameControl.hideTurnArrow();
_gameControl._attackCompleted = true;
_gameControl.setFinishAttackTimer();
_animationClip.animation_mc.gun_mc.flash_mc.gotoAndPlay("show");
}
private function init():void{
_gameControl = _parent;
_animationClip = animation_mc;
_explodeClip = explode_mc;
_minShootSpeed = Constant.PLAYER_ROBOT_MIN_SHOOT_CANNON_SPEED;
_maxShootSpeed = Constant.PLAYER_ROBOT_MAX_SHOOT_CANNON_SPEED;
_maxAttackLineDist = Constant.PLAYER_ROBOT_MAX_ATTACK_LINE_LENGTH;
toDefaultMode();
}
public function updateGunRotation(_arg1:Number, _arg2:Number):void{
var _local4:Number;
var _local3:Number = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
if (_arg1 == 0){
_arg1 = 1E-5;
};
if (_arg1 > 0){
_local4 = ((Math.atan((_arg2 / _arg1)) / Math.PI) * 180);
} else {
if (_arg1 < 0){
_local4 = (((Math.atan((_arg2 / _arg1)) + Math.PI) / Math.PI) * 180);
};
};
_animationClip.animation_mc.gun_mc.rotation = _local4;
}
}
}//package com.game.item.player
Section 18
//PlayerTypeLaser (com.game.item.player.PlayerTypeLaser)
package com.game.item.player {
import flash.display.*;
import com.game.control.*;
import com.game.*;
public class PlayerTypeLaser extends Player {
private var _shootSpeed:Number;
private var _gameControl:GameControl;
public var animation_mc:MovieClip;
private var _explodeClip:MovieClip;
public var explode_mc:mcExplodeAnimation2;
public function PlayerTypeLaser(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:int){
super(_arg1, _arg2, _arg3, _arg4, "laser", _arg5, _arg6, _arg7, _arg8);
init();
}
public function tryAttack(_arg1:Number, _arg2:Number):void{
if ((((_gameControl._sideAttack == "player")) && (!(_gameControl._attackCompleted)))){
attack(_arg1, _arg2);
};
}
public function updateLeftArmRotation(_arg1:Number, _arg2:Number):void{
var _local4:Number;
var _local3:Number = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
if (_arg1 == 0){
_arg1 = 1E-5;
};
if (_arg1 > 0){
_local4 = ((Math.atan((_arg2 / _arg1)) / Math.PI) * 180);
} else {
if (_arg1 < 0){
_local4 = (((Math.atan((_arg2 / _arg1)) + Math.PI) / Math.PI) * 180);
};
};
_animationClip.leftArm_mc.rotation = _local4;
trace(("ROTATION " + _local4));
}
private function attack(_arg1:Number, _arg2:Number):void{
var _local3:Number = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
var _local4:Number = ((_shootSpeed * _arg1) / _local3);
var _local5:Number = ((_shootSpeed * _arg2) / _local3);
_gameControl.createBullet("laser", _x, (_y - 12), _local4, _local5, 0, _attackPower, "player", _id, 0xFF00);
_isAttacking = true;
_gameControl.playSound("attackLaser");
_gameControl.hideTurnArrow();
_gameControl._attackCompleted = true;
_gameControl.setFinishAttackTimer();
_animationClip.leftArm_mc.flash_mc.gotoAndPlay("show");
}
private function init():void{
_gameControl = _parent;
_animationClip = animation_mc;
_explodeClip = explode_mc;
_shootSpeed = Constant.LASER_SPEED;
toDefaultMode();
}
public function showExplodeClip():void{
_explodeClip.gotoAndPlay("explode");
}
}
}//package com.game.item.player
Section 19
//PlayerTypeMelee (com.game.item.player.PlayerTypeMelee)
package com.game.item.player {
import flash.display.*;
import com.game.control.*;
import com.game.*;
public class PlayerTypeMelee extends Player {
private var _minJumpSpeed:Number;
private var _maxAttackLineDist:Number;
public var animation_mc:MovieClip;
private var _explodeClip:MovieClip;
private var _gameControl:GameControl;
public var explode_mc:mcExplodeAnimation2;
private var _maxJumpSpeed:Number;
public function PlayerTypeMelee(_arg1, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:int){
super(_arg1, _arg2, _arg3, _arg4, "melee", _arg5, _arg6, _arg7, _arg8);
init();
}
public function tryAttack(_arg1:Number, _arg2:Number):void{
if ((((_gameControl._sideAttack == "player")) && (!(_gameControl._attackCompleted)))){
toAttackMode();
attack(_arg1, _arg2);
};
}
private function init():void{
_gameControl = _parent;
_animationClip = animation_mc;
_explodeClip = explode_mc;
_maxAttackLineDist = Constant.PLAYER_ROBOT_MAX_ATTACK_LINE_LENGTH;
_minJumpSpeed = Constant.PLAYER_ROBOT_MIN_JUMP_SPEED;
_maxJumpSpeed = Constant.PLAYER_ROBOT_MAX_JUMP_SPEED;
toDefaultMode();
}
private function attack(_arg1:Number, _arg2:Number):void{
var _local3:Number = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
var _local4:Number = _local3;
if (_local4 > _maxAttackLineDist){
_local4 = _maxAttackLineDist;
};
var _local5:Number = ((_maxJumpSpeed * _local4) / _maxAttackLineDist);
if (_local5 < _minJumpSpeed){
_local5 = _minJumpSpeed;
};
_xMov = ((_local5 * _arg1) / _local3);
_yMov = ((_local5 * _arg2) / _local3);
_clipAnimationStatus = "attack";
updateClipAniamtion();
_isAttacking = true;
_isOnGround = false;
_gameControl.playSound("attackMelee");
_gameControl.hideTurnArrow();
_gameControl._attackCompleted = true;
_gameControl.setFinishAttackTimer();
}
}
}//package com.game.item.player
Section 20
//BG (com.game.item.BG)
package com.game.item {
import flash.display.*;
public class BG extends MovableItem {
public var _typeId:int;
private var _typeClip:MovieClip;
public var type_mc:MovieClip;
public function BG(_arg1, _arg2:int, _arg3:Number, _arg4:Number){
super(_arg1, _arg3, _arg4);
_typeId = _arg2;
init();
}
private function init():void{
_typeClip = type_mc;
updateClipType();
}
override public function update():void{
updateClips();
}
public function updateClipType():void{
_typeClip.gotoAndStop((_typeId + 1));
}
private function updateClips():void{
}
}
}//package com.game.item
Section 21
//Field (com.game.item.Field)
package com.game.item {
import flash.display.*;
import flash.events.*;
import com.game.control.*;
public class Field extends MovableItem {
public var _mouseX2:Number;
public var _mouseY1:Number;
public var _mouseX1:Number;
private var _gameControl:GameControl;
private var _isMouseDown:Boolean;
private var _indexHandler:IndexHandler;
public var _mouseY2:Number;
public function Field(_arg1, _arg2:Number, _arg3:Number){
super(_arg1, _arg2, _arg3);
init();
}
private function drawAttackLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
clearAttackLine();
_gameControl._attackLineClip.graphics.lineStyle(3, 58948, 1);
_gameControl._attackLineClip.graphics.moveTo(_arg1, _arg2);
_gameControl._attackLineClip.graphics.lineTo(_arg3, _arg4);
}
private function mouseUpEventHandler(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
if ((((((_gameControl._sideAttack == "player")) && (!(_gameControl._attackCompleted)))) && (_isMouseDown))){
_isMouseDown = false;
_gameControl._attackLineClip.graphics.clear();
_local2 = (_mouseX1 - _mouseX2);
_local3 = (_mouseY1 - _mouseY2);
_gameControl.currentPlayerRobotAttack(_local2, _local3);
};
}
public function clearAttackLine():void{
_gameControl._attackLineClip.graphics.clear();
}
public function removeItem(_arg1:MovieClip):void{
_indexHandler.removeItem(_arg1);
}
private function init():void{
_gameControl = _parent;
_indexHandler = new IndexHandler(_parent, this);
_indexHandler.setTypeOrder(["bg", "obstacle", "robot", "bullet", "stat", "turnArrow", "explosion", "attackLine", "soundBtn"]);
_mouseX1 = -1;
_mouseY1 = -1;
_mouseX2 = -1;
_mouseY2 = -1;
_isMouseDown = false;
addMouseEventListers();
}
public function changeItemIndex(_arg1:MovieClip, _arg2:String, _arg3:Boolean=true):void{
_indexHandler.changeItemIndex(_arg1, _arg2, _arg3);
}
public function addMouseEventListers():void{
addEventListener(MouseEvent.MOUSE_DOWN, mouseDownEventHandler);
addEventListener(MouseEvent.MOUSE_UP, mouseUpEventHandler);
addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveEventHandler);
}
public function addItem(_arg1:MovieClip, _arg2:String, _arg3:Boolean=true):void{
_indexHandler.addItem(_arg1, _arg2, _arg3);
}
private function mouseMoveEventHandler(_arg1:MouseEvent):void{
var _local2:*;
var _local3:Number;
var _local4:Number;
if ((((_gameControl._sideAttack == "player")) && (!(_gameControl._attackCompleted)))){
if (_isMouseDown){
_mouseX2 = mouseX;
_mouseY2 = mouseY;
drawAttackLine(_mouseX1, _mouseY1, _mouseX2, _mouseY2);
_local2 = _gameControl._playerRobot_array[_gameControl._currentAttackPlayerRobotID];
if (_mouseX2 > _mouseX1){
_local2.horFlip("left");
if (_local2._type == "cannon"){
_local3 = (_mouseX1 - _mouseX2);
_local4 = (_mouseY1 - _mouseY2);
_local2.updateGunRotation(-(_local3), _local4);
} else {
if (_local2._type == "laser"){
_local3 = (_mouseX1 - _mouseX2);
_local4 = (_mouseY1 - _mouseY2);
_local2.updateLeftArmRotation(-(_local3), _local4);
};
};
} else {
_local2.horFlip("right");
if (_local2._type == "cannon"){
_local3 = (_mouseX1 - _mouseX2);
_local4 = (_mouseY1 - _mouseY2);
_local2.updateGunRotation(_local3, _local4);
} else {
if (_local2._type == "laser"){
_local3 = (_mouseX1 - _mouseX2);
_local4 = (_mouseY1 - _mouseY2);
_local2.updateLeftArmRotation(_local3, _local4);
};
};
};
};
};
}
private function mouseDownEventHandler(_arg1:MouseEvent):void{
var _local2:*;
var _local3:Boolean;
if ((((_gameControl._sideAttack == "player")) && (!(_gameControl._attackCompleted)))){
_local2 = _gameControl._playerRobot_array[_gameControl._currentAttackPlayerRobotID];
_local3 = _local2.hitTestPoint(mouseX, mouseY, true);
if (_local3){
_isMouseDown = true;
_mouseX1 = mouseX;
_mouseY1 = mouseY;
};
};
}
}
}//package com.game.item
Section 22
//Item (com.game.item.Item)
package com.game.item {
import flash.display.*;
public class Item extends MovieClip {
public var _rotateMov:Number;
public var _height:Number;
public var _width:Number;
public var _clipStatus:String;
public var _parent;
public var _scale:Number;
public var _status:String;
public var _rotation:Number;
public var _alpha:Number;
private var _scaleX:Number;
private var _scaleY:Number;
public var _radius:Number;
public var _animationClip:MovieClip;
public var _clipAnimationStatus:String;
public var _x:Number;
public var _y:Number;
public function Item(_arg1, _arg2:Number=0, _arg3:Number=0){
_parent = _arg1;
_x = _arg2;
_y = _arg3;
init();
}
public function updateClipHeight():void{
height = _height;
}
public function remove():void{
_clipStatus = "removed";
_status = "removed";
_parent._field.removeItem(this);
}
public function setAnimationClip(_arg1:MovieClip):void{
_animationClip = _arg1;
_alpha = 1;
_rotation = 0;
updateClipAniamtion();
updateClipAlpha();
updateClipRotation();
}
public function updateClipWidth():void{
width = _width;
}
private function init():void{
_width = width;
_height = height;
_rotateMov = 0;
_status = "normal";
_clipStatus = "normal";
updateClipPosition();
}
public function updateClipRotation():void{
rotation = _rotation;
}
public function updateClipScale():void{
_scaleX = (_scaleY = _scale);
scaleX = _scaleX;
scaleY = _scaleY;
}
public function updateClipSize():void{
updateClipWidth();
updateClipHeight();
}
public function updateClipAniamtion():void{
_animationClip.gotoAndStop(_clipAnimationStatus);
}
public function updateClipPosition():void{
x = _x;
y = _y;
}
public function updateClipAlpha():void{
alpha = _alpha;
}
public function setPosition(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
updateClipPosition();
}
public function updateRotation():void{
_rotation = (_rotation + _rotateMov);
if (_rotation < 0){
_rotation = (_rotation + 360);
} else {
if (_rotation > 360){
_rotation = (_rotation - 360);
};
};
updateClipRotation();
}
}
}//package com.game.item
Section 23
//Message (com.game.item.Message)
package com.game.item {
import flash.display.*;
public dynamic class Message extends MovieClip {
public var levelComplete_mc:MovieClip;
public var levelStart_mc:MovieClip;
}
}//package com.game.item
Section 24
//MovableItem (com.game.item.MovableItem)
package com.game.item {
public class MovableItem extends Item {
public var _tempX:Number;
public var _tempY:Number;
public var _minYMov:Number;
public var _maxYMov:Number;
public var _movingDirection:String;
public var _verWallsOn:Boolean;
public var _minX:Number;
public var _yAccRate:Number;
public var _minY:Number;
public var _yAcc:Number;
public var _yDecRate:Number;
public var _minXMov:Number;
public var _yMov:Number;
public var _maxXMov:Number;
public var _moveStatus:String;
public var _xAcc:Number;
public var _initX:Number;
public var _xAccRate:Number;
public var _initY:Number;
public var _maxX:Number;
public var _maxY:Number;
public var _speed:Number;
public var _xDecRate:Number;
public var _xMov:Number;
public var _horWallsOn:Boolean;
public function MovableItem(_arg1, _arg2:Number=0, _arg3:Number=0){
super(_arg1, _arg2, _arg3);
_initX = _arg2;
_initY = _arg3;
_tempX = _arg2;
_tempY = _arg3;
init();
}
public function setMoves(_arg1:Number, _arg2:Number):void{
_xMov = _arg1;
_yMov = _arg2;
_horWallsOn = true;
}
public function setVerWalls(_arg1:Number, _arg2:Number):void{
_minY = _arg1;
_maxY = _arg2;
}
public function updateTempPosition():void{
_xMov = (_xMov + _xAcc);
_yMov = (_yMov + _yAcc);
_tempX = (_tempX + _xMov);
_tempY = (_tempY + _yMov);
}
public function moveDown():void{
_yMov = _speed;
}
public function stopXMov():void{
_xMov = 0;
}
public function updatePosition():void{
_x = _tempX;
_y = _tempY;
}
public function moveTo(_arg1:Number, _arg2:Number):void{
_tempX = _arg1;
_tempY = _arg2;
_x = _arg1;
_y = _arg2;
updatePosition();
updateClipPosition();
}
private function init():void{
_horWallsOn = false;
_horWallsOn = false;
_minX = -999999;
_maxX = 999999;
_minY = -999999;
_maxY = 999999;
_minXMov = -999999;
_maxXMov = 999999;
_minYMov = -999999;
_maxYMov = 999999;
_speed = 0;
_xMov = 0;
_yMov = 0;
_xAcc = 0;
_yAcc = 0;
_moveStatus = "rest";
_movingDirection = "none";
}
public function moveRight():void{
_xMov = _speed;
}
public function update():void{
updateMoves();
updateTempPosition();
updatePosition();
updateClipPosition();
}
public function moveUp():void{
_yMov = (_speed * -1);
}
public function setHorWalls(_arg1:Number, _arg2:Number):void{
_minX = _arg1;
_maxX = _arg2;
_verWallsOn = true;
}
public function stopMove():void{
stopXMov();
stopYMov();
}
protected function updateMoves():void{
_xMov = (_xMov + _xAcc);
_yMov = (_yMov + _yAcc);
if (_horWallsOn){
if (_xMov < _minXMov){
_xMov = _minXMov;
} else {
if (_xMov > _maxXMov){
_xMov = _maxXMov;
};
};
};
if (_verWallsOn){
if (_yMov < _minYMov){
_yMov = _minYMov;
} else {
if (_yMov > _maxYMov){
_yMov = _maxYMov;
};
};
};
}
public function stopYMov():void{
_yMov = 0;
}
public function moveLeft():void{
_xMov = (_speed * -1);
}
}
}//package com.game.item
Section 25
//Constant (com.game.Constant)
package com.game {
public class Constant {
public static const PLAYER_ROBOT_MIN_SHOOT_CANNON_SPEED:Number = 4;
public static const GAME_TIME_BONUS_PER_FRAME:int = 17;
public static const LASER_MIN_Y:Number = -200;
public static const LASER_MAX_X:Number = 1000;
public static const PLAYER_ROBOT_MAX_X:Number = 700;
public static const PLAYER_ROBOT_MAX_Y:Number = 280;
public static const LASER_MIN_X:Number = -200;
public static const ENEMY_ROBOT_MAX_Y:Number = 280;
public static const LASER_SPEED:Number = 15;
public static const ENEMY_ROBOT_MAX_X:Number = 700;
public static const LASER_MAX_TRAVEL_DIST:Number = 400;
public static const PLAYER_ROBOT_INIT_Y:Number = 150;
public static const LASER_DAMAGE:Number = 10;
public static const PLAYER_ROBOT_MAX_ATTACK_LINE_LENGTH:Number = 200;
public static const ENEMY_ROBOT_GRAVITY:Number = 0.4;
public static const LASER_MAX_Y:Number = 320;
public static const PLAYER_ROBOT_MAX_SHOOT_CANNON_SPEED:Number = 12;
public static const PLAYER_ROBOT_MIN_JUMP_SPEED:Number = 5;
public static const PLAYER_ROBOT_MIN_JUMP_ANGLE:Number = -140;
public static const ROBOT_INIT_MAX_X:Number = 700;
public static const PLAYER_ROBOT_SHOOT_LASER_SPEED:Number = 15;
public static const ROBOT_INIT_MIN_X:Number = 100;
public static const GAME_MAX_TIME_BONUS:int = 99999;
public static const PLAYER_ROBOT_GRAVITY:Number = 0.4;
public static const CANNON_MAX_Y:Number = 320;
public static const GAME_FRAMES_PLAY:int = 30303;
public static const PLAYER_ROBOT_MAX_JUMP_SPEED:Number = 20;
public static const CANNON_DAMAGE:Number = 20;
public static const ROBOT_INIT_MIN_X_DIST:Number = 80;
public static const ENEMY_ROBOT_INIT_Y:Number = 150;
public static const PLAYER_ROBOT_MAX_JUMP_ANGLE:Number = -40;
public static const PLAYER_ROBOT_MIN_X:Number = 100;
public static const LASER_LENGTH:Number = 200;
public static const CANNON_GRAVITY:Number = 0.2;
public static const ENEMY_ROBOT_MIN_X:Number = 100;
}
}//package com.game
Section 26
//Stat (com.game.Stat)
package com.game {
import flash.display.*;
import com.game.control.*;
import flash.text.*;
public class Stat extends MovieClip {
public var timeBonus_txt:TextField;
public var _enemyLaserStatusClip:MovieClip;
public var _enemyMeleeStatusClip:MovieClip;
public var playerLaserStatus_mc:MovieClip;
public var _parent;
public var _gameControl:GameControl;
public var _playerMeleeStatusClip:MovieClip;
public var enemyMeleeStatus_mc:MovieClip;
private var _timeBonusTxt:TextField;
public var enemyCannonStatus_mc:MovieClip;
public var _playerCannonStatusClip:MovieClip;
public var playerCannonStatus_mc:MovieClip;
private var _statusClipPos_array:Array;
public var enemyLaserStatus_mc:MovieClip;
public var _enemyCannonStatusClip:MovieClip;
public var _playerLaserStatusClip:MovieClip;
public var playerMeleeStatus_mc:MovieClip;
public var _x:Number;
public var _y:Number;
public function Stat(_arg1, _arg2:Number, _arg3:Number){
_parent = _arg1;
_x = _arg2;
_y = _arg3;
init();
}
public function updateStatusClipText(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number):void{
this[(("_" + _arg1) + "StatusClip")].health_txt.text = _arg2;
this[(("_" + _arg1) + "StatusClip")].attackRange_txt.text = _arg3;
this[(("_" + _arg1) + "StatusClip")].attackPower_txt.text = _arg4;
}
public function updatePosition():void{
x = _x;
y = _y;
}
public function update():void{
updateText();
}
public function setStatusClipPosition(_arg1:String, _arg2:int):void{
var _local3:Object = _statusClipPos_array[_arg2];
this[(("_" + _arg1) + "StatusClip")].x = _local3.x;
this[(("_" + _arg1) + "StatusClip")].y = _local3.y;
}
public function setStatusClipStatus(_arg1:String, _arg2:String):void{
this[(("_" + _arg1) + "StatusClip")].status_mc.gotoAndStop(_arg2);
}
public function updateText():void{
_timeBonusTxt.text = String(_gameControl._score_time_bonus);
}
private function init():void{
_gameControl = _parent;
_playerCannonStatusClip = playerCannonStatus_mc;
_playerLaserStatusClip = playerLaserStatus_mc;
_playerMeleeStatusClip = playerMeleeStatus_mc;
_enemyCannonStatusClip = enemyCannonStatus_mc;
_enemyLaserStatusClip = enemyLaserStatus_mc;
_enemyMeleeStatusClip = enemyMeleeStatus_mc;
_statusClipPos_array = [{x:65, y:379}, {x:195, y:379}, {x:325, y:379}, {x:475, y:379}, {x:605, y:379}, {x:735, y:379}];
_timeBonusTxt = timeBonus_txt;
updatePosition();
}
}
}//package com.game
Section 27
//GameOverScreen (com.screen.GameOverScreen)
package com.screen {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
public class GameOverScreen extends Sprite {
public var score_txt:TextField;
public var submit_btn:SimpleButton;
private var _submitBtn:SimpleButton;
public var _parent;
private var pPath:String;
public var name_txt:TextField;
private var pGameID:Number;
public function GameOverScreen(_arg1){
_parent = _arg1;
init();
}
private function submitButtonClickEvent(_arg1:MouseEvent):void{
_submitBtn.removeEventListener(MouseEvent.CLICK, funcEnterScore);
_parent.playSound("buttonClick");
}
private function setButtonEvents():void{
_submitBtn.addEventListener(MouseEvent.CLICK, funcEnterScore, false, 0, true);
}
public function init():void{
if (_parent._currentMusic != "menuMusic"){
if (_parent._currentMusic != "none"){
_parent.stopMusic(_parent._currentMusic);
};
_parent.playMusic("menuMusic", true);
};
pPath = "../scores/writeGameHighScore.asp";
pGameID = 448;
_submitBtn = submit_btn;
setButtonEvents();
score_txt.text = String(_parent._score);
}
public function errorLoading(_arg1:IOErrorEvent){
trace(("Error loading " + _arg1.target.data));
}
public function funcFinished(_arg1:Event){
submit_btn.visible = false;
_parent.gotoScreen("highScoreEnter");
}
public function funcEnterScore(_arg1:Event){
var _local2:String = ((((((pPath + "?gameid=") + pGameID) + "&name=") + name_txt.text) + "&score=") + Number(_parent._score));
var _local3:URLRequest = new URLRequest(_local2);
var _local4:URLLoader = new URLLoader();
_local4.dataFormat = URLLoaderDataFormat.VARIABLES;
_local4.addEventListener(Event.COMPLETE, funcFinished);
_local4.addEventListener(IOErrorEvent.IO_ERROR, errorLoading);
_local4.load(_local3);
}
}
}//package com.screen
Section 28
//GameScreen (com.screen.GameScreen)
package com.screen {
import flash.display.*;
import com.game.control.*;
public class GameScreen extends Sprite {
public var _loader:Sprite;
public var loader_mc:MovieClip;
public var _parent;
public var _gameControl:GameControl;
public function GameScreen(_arg1){
_parent = _arg1;
init();
}
public function init():void{
_loader = loader_mc;
if (_parent._soundOn){
_parent.stopMusic("menuMusic");
};
_parent.playMusic("gameMusic", true);
_gameControl = new GameControl(this, -200, -200);
}
}
}//package com.screen
Section 29
//GameWinScreen (com.screen.GameWinScreen)
package com.screen {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
public class GameWinScreen extends Sprite {
public var score_txt:TextField;
public var submit_btn:SimpleButton;
private var _submitBtn:SimpleButton;
public var _parent;
private var pPath:String;
public var name_txt:TextField;
private var pGameID:Number;
public function GameWinScreen(_arg1){
_parent = _arg1;
init();
}
private function submitButtonClickEvent(_arg1:MouseEvent):void{
_submitBtn.removeEventListener(MouseEvent.CLICK, funcEnterScore);
_parent.playSound("buttonClick");
}
private function setButtonEvents():void{
_submitBtn.addEventListener(MouseEvent.CLICK, funcEnterScore, false, 0, true);
}
public function init():void{
if (_parent._currentMusic != "menuMusic"){
if (_parent._currentMusic != "none"){
_parent.stopMusic(_parent._currentMusic);
};
_parent.playMusic("menuMusic", true);
};
pPath = "../scores/writeGameHighScore.asp";
pGameID = 448;
_submitBtn = submit_btn;
setButtonEvents();
score_txt.text = String(_parent._score);
}
public function errorLoading(_arg1:IOErrorEvent){
trace(("Error loading " + _arg1.target.data));
}
public function funcFinished(_arg1:Event){
submit_btn.visible = false;
_parent.gotoScreen("highScoreEnter");
}
public function funcEnterScore(_arg1:Event){
var _local2:String = ((((((pPath + "?gameid=") + pGameID) + "&name=") + name_txt.text) + "&score=") + Number(_parent._score));
var _local3:URLRequest = new URLRequest(_local2);
var _local4:URLLoader = new URLLoader();
_local4.dataFormat = URLLoaderDataFormat.VARIABLES;
_local4.addEventListener(Event.COMPLETE, funcFinished);
_local4.addEventListener(IOErrorEvent.IO_ERROR, errorLoading);
_local4.load(_local3);
}
}
}//package com.screen
Section 30
//HighScoreScreen (com.screen.HighScoreScreen)
package com.screen {
import flash.display.*;
import flash.events.*;
import com.*;
import flash.text.*;
import flash.net.*;
public class HighScoreScreen extends Sprite {
public var nametext8:TextField;
public var nametext4:TextField;
public var rank0:TextField;
public var rank1:TextField;
public var rank2:TextField;
public var rank3:TextField;
public var rank4:TextField;
public var rank5:TextField;
public var rank7:TextField;
public var rank9:TextField;
public var rank6:TextField;
public var rank8:TextField;
private var pGameID:Number;
public var nametext6:TextField;
public var nametext9:TextField;
private var _mainBtn:SimpleButton;
public var nametext0:TextField;
private var _soundBtn:SoundBtn;
private var pPath:String;
public var _parent;
private var pObject:Object;
public var main_btn:SimpleButton;
public var score0:TextField;
public var score1:TextField;
public var score2:TextField;
public var score3:TextField;
public var score4:TextField;
public var score5:TextField;
public var score6:TextField;
public var score7:TextField;
public var score8:TextField;
public var score9:TextField;
public var nametext1:TextField;
public var nametext2:TextField;
public var nametext3:TextField;
public var nametext5:TextField;
public var nametext7:TextField;
public function HighScoreScreen(_arg1){
_parent = _arg1;
init();
}
public function init():void{
_soundBtn = _soundBtn;
pPath = "../scores/getGameHighScores.asp";
pGameID = 448;
_mainBtn = main_btn;
setButtonEvents();
funcLoadHS();
}
public function errorLoading(_arg1:IOErrorEvent){
trace(("Error loading " + _arg1.target.data));
}
public function funcCompleteHandler(_arg1:Event){
var _local5:String;
var _local6:String;
var _local7:String;
trace("loaded");
pObject = new Object();
var _local2:Array = _arg1.target.data.split("&");
var _local3:* = 0;
while (_local3 < _local2.length) {
_local5 = _local2[_local3];
_local6 = _local5.substr(0, _local5.indexOf("=", 0));
_local7 = _local5.substr((_local5.indexOf("=", 0) + 1), _local5.length);
pObject[_local6] = _local7;
_local3++;
};
var _local4:* = 0;
while (_local4 < 10) {
if (pObject[("name" + _local4)] != undefined){
this[("nametext" + _local4)].text = pObject[("name" + _local4)].toUpperCase();
this[("score" + _local4)].text = pObject[("score" + _local4)];
} else {
this[("nametext" + _local4)].text = "AAA";
this[("score" + _local4)].text = "0";
};
_local4++;
};
}
private function mainButtonClickEvent(_arg1:MouseEvent):void{
_mainBtn.removeEventListener(MouseEvent.CLICK, mainButtonClickEvent);
_parent.playSound("buttonClick");
_parent.gotoScreen("title");
}
public function funcLoadHS(){
var _local1:String = ((pPath + "?gameid=") + pGameID);
var _local2:URLRequest = new URLRequest(_local1);
var _local3:URLLoader = new URLLoader();
_local3.dataFormat = URLLoaderDataFormat.TEXT;
_local3.addEventListener(Event.COMPLETE, funcCompleteHandler);
_local3.addEventListener(IOErrorEvent.IO_ERROR, errorLoading);
_local3.load(_local2);
}
private function setButtonEvents():void{
_mainBtn.addEventListener(MouseEvent.CLICK, mainButtonClickEvent, false, 0, true);
}
public function functionEntryAvailable(){
var _local1:contestPop = new contestPop();
_local1.x = 535;
_local1.y = 100;
this.addChild(_local1);
}
}
}//package com.screen
Section 31
//InstructionScreen (com.screen.InstructionScreen)
package com.screen {
import flash.display.*;
import flash.events.*;
public class InstructionScreen extends MovieClip {
public var back_btn:SimpleButton;
public var _parent;
private var _prevbtn:SimpleButton;
public var prev_btn:SimpleButton;
public var animation_mc:MovieClip;
private var _backBtn:SimpleButton;
public var next_btn:SimpleButton;
private var _nextbtn:SimpleButton;
public function InstructionScreen(_arg1){
addFrameScript(0, frame1, 1, frame2);
stop();
_parent = _arg1;
init();
}
function frame2(){
stop();
}
private function prevButtonClickEvent(_arg1:MouseEvent):void{
_prevbtn.removeEventListener(MouseEvent.CLICK, prevButtonClickEvent);
_nextbtn.visible = true;
_prevbtn.visible = false;
_nextbtn.alpha = 1;
_nextbtn.addEventListener(MouseEvent.CLICK, nextButtonClickEvent, false, 0, true);
_parent.playSound("buttonClick");
gotoAndStop(1);
}
private function backButtonClickEvent(_arg1:MouseEvent):void{
_backBtn.removeEventListener(MouseEvent.CLICK, backButtonClickEvent);
_parent.playSound("buttonClick");
_parent.gotoScreen("title");
}
private function setButtonEvents():void{
_backBtn.addEventListener(MouseEvent.CLICK, backButtonClickEvent, false, 0, true);
_nextbtn.addEventListener(MouseEvent.CLICK, nextButtonClickEvent, false, 0, true);
}
function frame1(){
stop();
}
private function nextButtonClickEvent(_arg1:MouseEvent):void{
_nextbtn.removeEventListener(MouseEvent.CLICK, nextButtonClickEvent);
_prevbtn.alpha = 1;
_nextbtn.visible = false;
_prevbtn.visible = true;
_prevbtn.addEventListener(MouseEvent.CLICK, prevButtonClickEvent, false, 0, true);
_parent.playSound("buttonClick");
gotoAndStop(2);
}
public function init():void{
_backBtn = back_btn;
_prevbtn = prev_btn;
_prevbtn.alpha = 0.1;
_nextbtn = next_btn;
setButtonEvents();
}
}
}//package com.screen
Section 32
//PreloadScreen (com.screen.PreloadScreen)
package com.screen {
import flash.display.*;
import com.*;
public class PreloadScreen extends Sprite {
private var _preloader:Preloader;
public var _parent;
public var preloader_mc:Preloader;
public function PreloadScreen(_arg1){
_parent = _arg1;
init();
}
private function init():void{
_preloader = preloader_mc;
}
}
}//package com.screen
Section 33
//TitleScreen (com.screen.TitleScreen)
package com.screen {
import flash.display.*;
import flash.events.*;
public class TitleScreen extends Sprite {
private var _highScoreBtn:SimpleButton;
private var _playBtn:SimpleButton;
public var instruction_btn:SimpleButton;
private var _instructionBtn:SimpleButton;
public var _parent;
public var play_btn:SimpleButton;
public var highScore_btn:SimpleButton;
public function TitleScreen(_arg1){
_parent = _arg1;
init();
}
private function instructionButtonClickEvent(_arg1:MouseEvent):void{
_instructionBtn.removeEventListener(MouseEvent.CLICK, instructionButtonClickEvent);
_parent.playSound("buttonClick");
_parent.gotoScreen("instruction");
}
public function init():void{
_playBtn = play_btn;
_instructionBtn = instruction_btn;
_highScoreBtn = highScore_btn;
setButtonEvents();
if (_parent._currentMusic != "menuMusic"){
if (_parent._currentMusic != "none"){
_parent.stopMusic(_parent._currentMusic);
};
_parent.playMusic("menuMusic", true);
};
}
private function playButtonClickEvent(_arg1:MouseEvent):void{
_playBtn.removeEventListener(MouseEvent.CLICK, playButtonClickEvent);
_parent._score = 0;
_parent.playSound("buttonClick");
_parent.gotoScreen("game");
}
private function highScoreButtonClickEvent(_arg1:MouseEvent):void{
_highScoreBtn.removeEventListener(MouseEvent.CLICK, highScoreButtonClickEvent);
_parent.playSound("buttonClick");
_parent.gotoScreen("highScore");
}
private function setButtonEvents():void{
_playBtn.addEventListener(MouseEvent.CLICK, playButtonClickEvent, false, 0, true);
_instructionBtn.addEventListener(MouseEvent.CLICK, instructionButtonClickEvent, false, 0, true);
_highScoreBtn.addEventListener(MouseEvent.CLICK, highScoreButtonClickEvent, false, 0, true);
}
}
}//package com.screen
Section 34
//hitbox (com.util.hitbox)
package com.util {
import flash.external.*;
public class hitbox {
public function hitbox():void{
}
public function fire(_arg1:String, _arg2:String, _arg3:Boolean){
_arg1 = _arg1.toLowerCase();
_arg2 = _arg2.toLowerCase();
var _local4:String = ((("/flash/" + _arg1.toLowerCase()) + "/") + _arg2.toLowerCase());
if (_arg3){
ExternalInterface.call("_hbLink", _local4);
};
}
}
}//package com.util
Section 35
//PixelPerfectCollisionDetection (com.util.PixelPerfectCollisionDetection)
package com.util {
import flash.geom.*;
import flash.display.*;
public class PixelPerfectCollisionDetection {
public static function getCollisionRect(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Rectangle{
var _local9:BitmapData;
var _local10:BitmapData;
var _local11:uint;
var _local12:Rectangle;
var _local13:int;
var _local6:Rectangle = _arg1.getBounds(_arg3);
var _local7:Rectangle = _arg2.getBounds(_arg3);
var _local8:Rectangle = _local6.intersection(_local7);
if (_local8.size.length > 0){
if (_arg4){
_local8.width = Math.ceil(_local8.width);
_local8.height = Math.ceil(_local8.height);
_local9 = getAlphaMap(_arg1, _local8, BitmapDataChannel.RED, _arg3);
_local10 = getAlphaMap(_arg2, _local8, BitmapDataChannel.GREEN, _arg3);
_local9.draw(_local10, null, null, BlendMode.LIGHTEN);
if (_arg5 <= 0){
_local11 = 65792;
} else {
if (_arg5 > 1){
_arg5 = 1;
};
_local13 = Math.round((_arg5 * 0xFF));
_local11 = (((_local13 << 16) | (_local13 << 8)) | 0);
};
_local12 = _local9.getColorBoundsRect(_local11, _local11);
_local9.getColorBoundsRect(_local11, _local11).x = (_local12.x + _local8.x);
_local12.y = (_local12.y + _local8.y);
return (_local12);
} else {
return (_local8);
};
//unresolved jump
};
return (null);
}
public static function isColliding(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Boolean{
var _local6:Rectangle = getCollisionRect(_arg1, _arg2, _arg3, _arg4, _arg5);
if (((!((_local6 == null))) && ((_local6.size.length > 0)))){
return (true);
};
return (false);
}
public static function getCollisionPoint(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Point{
var _local7:Number;
var _local8:Number;
var _local6:Rectangle = getCollisionRect(_arg1, _arg2, _arg3, _arg4, _arg5);
if (((!((_local6 == null))) && ((_local6.size.length > 0)))){
_local7 = ((_local6.left + _local6.right) / 2);
_local8 = ((_local6.top + _local6.bottom) / 2);
return (new Point(_local7, _local8));
};
return (null);
}
private static function getAlphaMap(_arg1:DisplayObject, _arg2:Rectangle, _arg3:uint, _arg4:DisplayObjectContainer):BitmapData{
var _local5:Matrix = _arg4.transform.concatenatedMatrix.clone();
_local5.invert();
var _local6:Matrix = _arg1.transform.concatenatedMatrix.clone();
_local6.concat(_local5);
_local6.translate(-(_arg2.x), -(_arg2.y));
var _local7:BitmapData = new BitmapData(_arg2.width, _arg2.height, true, 0);
_local7.draw(_arg1, _local6);
var _local8:BitmapData = new BitmapData(_arg2.width, _arg2.height, false, 0);
_local8.copyChannel(_local7, _local7.rect, new Point(0, 0), BitmapDataChannel.ALPHA, _arg3);
return (_local8);
}
}
}//package com.util
Section 36
//contestPop (com.contestPop)
package com {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class contestPop extends MovieClip {
public var btnClick:SimpleButton;
public function contestPop(){
init();
}
public function funcJump(_arg1:Event){
var _local2:URLRequest = new URLRequest("https://promos.ytv.com/transformersrotf/enter.aspx");
var _local3:URLVariables = new URLVariables();
_local3.secondaryprize = 1;
_local2.data = _local3;
_local2.method = URLRequestMethod.POST;
navigateToURL(_local2, "_PARENT");
}
public function init(){
btnClick.addEventListener(MouseEvent.CLICK, funcJump);
}
}
}//package com
Section 37
//FPS (com.FPS)
package com {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
public class FPS extends MovieClip {
private var _millSecsUpdate:int;// = 2000
private var _timer:Timer;
private var _fps:Number;// = 40
private var _nextUpdateFrame:int;
private var _framesPassed:int;
public var text_txt:TextField;
public function FPS():void{
this._framesPassed = 0;
this.createEnterFrame();
this.setTimer();
}
private function updateFPS(_arg1:TimerEvent):void{
var _local2:Number = ((this._framesPassed / _millSecsUpdate) * 1000);
this.text_txt.text = String(Math.round(_local2));
this._framesPassed = 0;
}
private function setTimer():void{
this._timer = new Timer(this._millSecsUpdate);
this._timer.addEventListener(TimerEvent.TIMER, this.updateFPS);
this._timer.start();
}
private function update():void{
this._framesPassed++;
}
private function enterFrameHandler(_arg1:Event):void{
this.update();
}
private function createEnterFrame():void{
this.addEventListener(Event.ENTER_FRAME, this.enterFrameHandler, false, 0, true);
}
private function removeEnterFrame():void{
this.removeEventListener(Event.ENTER_FRAME, this.enterFrameHandler);
}
}
}//package com
Section 38
//Preloader (com.Preloader)
package com {
import flash.display.*;
import flash.events.*;
public class Preloader extends MovieClip {
private var _loadPercent:MovieClip;
public var bar_mc:MovieClip;
private var _barClip:MovieClip;
public var _parent;
public function Preloader(){
_parent = parent;
_barClip = bar_mc;
createEnterFrame();
}
public function revmoveEnterFrame():void{
removeEventListener(Event.ENTER_FRAME, this.update);
}
public function createEnterFrame():void{
addEventListener(Event.ENTER_FRAME, this.update, false, 0, true);
}
private function update(_arg1:Event):void{
var _local2:Number = _parent._parent.stage.loaderInfo.bytesTotal;
var _local3:Number = _parent._parent.stage.loaderInfo.bytesLoaded;
var _local4:Number = Math.round(((_local3 / _local2) * 100));
this._barClip.gotoAndPlay((_local4 + 1));
if (_local3 >= _local2){
revmoveEnterFrame();
_parent._parent.gotoScreen("title");
};
}
}
}//package com
Section 39
//SoundBtn (com.SoundBtn)
package com {
import flash.display.*;
import flash.events.*;
public class SoundBtn extends MovieClip {
private var _frames:int;
private var _parent;
public function SoundBtn(){
addFrameScript(0, frame1);
_parent = parent;
init();
}
private function init():void{
_frames = 0;
addMouseEvent();
addTimerEvent();
}
function frame1(){
stop();
}
private function addMouseEvent():void{
addEventListener(MouseEvent.CLICK, mouseClickEventHandler, false, 0, true);
}
private function mouseClickEventHandler(_arg1:MouseEvent):void{
if (_parent._soundOn){
_parent._soundOn = false;
_parent.muteCurrentMusic();
trace("OFF");
gotoAndStop("off");
} else {
_parent._soundOn = true;
_parent.playCurrentMusic();
trace("ON");
gotoAndStop("on");
};
}
private function enterFrameEventHandler(_arg1:Event):void{
_frames++;
if ((_frames % 100) == 0){
removeEventListener(MouseEvent.CLICK, mouseClickEventHandler);
addEventListener(MouseEvent.CLICK, mouseClickEventHandler, false, 0, true);
};
}
private function addTimerEvent():void{
addEventListener(Event.ENTER_FRAME, enterFrameEventHandler);
}
}
}//package com
Section 40
//SoundControl (com.SoundControl)
package com {
import flash.display.*;
import flash.events.*;
public class SoundControl extends MovieClip {
public var _parent:Object;
public var _soundHandler:SoundHandler;
public function SoundControl(_arg1:Object){
_soundHandler = new SoundHandler(this);
super();
_parent = _arg1;
initSounds();
}
public function destroy():void{
_soundHandler.stopAllSounds();
_soundHandler.destroy();
_parent = null;
_soundHandler = null;
}
public function stopAllSounds():void{
_soundHandler.stopAllSounds();
}
public function initSounds():void{
var _local2 = _soundHandler;
with (_local2) {
addSound("menuMusic", new musicLoopMenu());
addSound("gameMusic", new musicLoopGame());
addSound("buttonClick", new sfxButtonClick());
addSound("gameWin", new sfxGameWin());
addSound("gameLose", new sfxGameLose());
addSound("attackCannon", new sfxAttackCannon());
addSound("attackLaser", new sfxAttackLaser());
addSound("attackMelee", new sfxAttackMelee());
addSound("hitCannon", new sfxHitCannon());
addSound("hitLaser", new sfxHitLaser());
addSound("hitMelee", new sfxHitMelee());
addSound("obstacleHit", new sfxObstacleHit());
};
}
public function stopSound(_arg1:String, _arg2:Number=0):void{
_soundHandler.stopSound(_arg1);
}
public function playSound(_arg1:String, _arg2:Boolean=false, _arg3:Number=0):void{
_soundHandler.playSound(_arg1, _arg2);
}
}
}//package com
Section 41
//SoundHandler (com.SoundHandler)
package com {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class SoundHandler {
public var _parent:Object;
private var _sound_item_array:Array;
public function SoundHandler(_arg1){
_parent = _arg1;
_sound_item_array = new Array();
}
public function getSoundChannels():Array{
return (_sound_item_array);
}
public function destroy():void{
_parent = null;
_sound_item_array = null;
}
public function stopAllSounds():void{
var _local3:Object;
var _local4:SoundChannel;
var _local1:int = _sound_item_array.length;
var _local2:int;
while (_local2 < _local1) {
_local3 = _sound_item_array[_local2];
while (_local3.soundChannel_array.length > 0) {
_local4 = _local3.soundChannel_array.pop();
_local4.stop();
};
_local2++;
};
}
public function playSound(_arg1:String, _arg2:Boolean):void{
var _local3:Object = getSoundObject(_arg1);
var _local4:SoundChannel = new SoundChannel();
if (_arg2){
_local4 = _local3.soundObject.play(0, 9999);
} else {
_local4 = (_local3.soundChannel = _local3.soundObject.play(0));
};
_local3.soundChannel_array.push(_local4);
}
public function stopSound(_arg1:String):void{
var _local2:Object = getSoundObject(_arg1);
var _local3:SoundChannel = _local2.soundChannel_array.pop();
if (_local3 != null){
_local3.stop();
};
}
public function addSound(_arg1:String, _arg2):void{
var _local3:Object = new Object();
_local3.name = _arg1;
_local3.soundObject = _arg2;
_local3.soundChannel_array = new Array();
_sound_item_array.push(_local3);
}
private function getSoundObject(_arg1:String):Object{
var _local4:Object;
var _local2:int = _sound_item_array.length;
var _local3:int;
while (_local3 < _local2) {
_local4 = _sound_item_array[_local3];
if (_local4.name == _arg1){
return (_local4);
};
_local3++;
};
return (null);
}
}
}//package com
Section 42
//_glowDeath_48 (TransformersGame_fla._glowDeath_48)
package TransformersGame_fla {
import flash.display.*;
public dynamic class _glowDeath_48 extends MovieClip {
public function _glowDeath_48(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package TransformersGame_fla
Section 43
//mc_14 (TransformersGame_fla.mc_14)
package TransformersGame_fla {
import flash.display.*;
public dynamic class mc_14 extends MovieClip {
public function mc_14(){
addFrameScript(7, frame8);
}
function frame8(){
stop();
}
}
}//package TransformersGame_fla
Section 44
//mc_preloader_29 (TransformersGame_fla.mc_preloader_29)
package TransformersGame_fla {
import flash.display.*;
public dynamic class mc_preloader_29 extends MovieClip {
public function mc_preloader_29(){
addFrameScript(0, frame1, 100, frame101);
}
function frame1(){
stop();
}
function frame101(){
stop();
}
}
}//package TransformersGame_fla
Section 45
//mcBGType_34 (TransformersGame_fla.mcBGType_34)
package TransformersGame_fla {
import flash.display.*;
public dynamic class mcBGType_34 extends MovieClip {
public function mcBGType_34(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package TransformersGame_fla
Section 46
//mcCannonAnimation_87 (TransformersGame_fla.mcCannonAnimation_87)
package TransformersGame_fla {
import flash.display.*;
public dynamic class mcCannonAnimation_87 extends MovieClip {
public var animation_mc:MovieClip;
public function mcCannonAnimation_87(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package TransformersGame_fla
Section 47
//mcExplodeAnimation_16 (TransformersGame_fla.mcExplodeAnimation_16)
package TransformersGame_fla {
import flash.display.*;
public dynamic class mcExplodeAnimation_16 extends MovieClip {
public function mcExplodeAnimation_16(){
addFrameScript(17, frame18);
}
function frame18(){
stop();
}
}
}//package TransformersGame_fla
Section 48
//mcLaserAnimation_13 (TransformersGame_fla.mcLaserAnimation_13)
package TransformersGame_fla {
import flash.display.*;
public dynamic class mcLaserAnimation_13 extends MovieClip {
public var hit_mc:MovieClip;
public function mcLaserAnimation_13(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package TransformersGame_fla
Section 49
//mcMessageLevelComplete_31 (TransformersGame_fla.mcMessageLevelComplete_31)
package TransformersGame_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mcMessageLevelComplete_31 extends MovieClip {
public var text_txt:TextField;
public function mcMessageLevelComplete_31(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package TransformersGame_fla
Section 50
//mcMessageLevelStart_32 (TransformersGame_fla.mcMessageLevelStart_32)
package TransformersGame_fla {
import flash.display.*;
public dynamic class mcMessageLevelStart_32 extends MovieClip {
public function mcMessageLevelStart_32(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package TransformersGame_fla
Section 51
//mcPlayerTypeLaserAnimationDefaultRightArm_80 (TransformersGame_fla.mcPlayerTypeLaserAnimationDefaultRightArm_80)
package TransformersGame_fla {
import flash.display.*;
public dynamic class mcPlayerTypeLaserAnimationDefaultRightArm_80 extends MovieClip {
public function mcPlayerTypeLaserAnimationDefaultRightArm_80(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package TransformersGame_fla
Section 52
//mcPlayerTypeMeleeAnimationDefault_44 (TransformersGame_fla.mcPlayerTypeMeleeAnimationDefault_44)
package TransformersGame_fla {
import flash.display.*;
public dynamic class mcPlayerTypeMeleeAnimationDefault_44 extends MovieClip {
public function mcPlayerTypeMeleeAnimationDefault_44(){
addFrameScript(0, frame1, 9, frame10);
}
function frame10(){
stop();
}
function frame1(){
stop();
}
}
}//package TransformersGame_fla
Section 53
//mcRobotStatusBox_20 (TransformersGame_fla.mcRobotStatusBox_20)
package TransformersGame_fla {
import flash.display.*;
public dynamic class mcRobotStatusBox_20 extends MovieClip {
public function mcRobotStatusBox_20(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package TransformersGame_fla
Section 54
//mcTurnArrowAnimation_8 (TransformersGame_fla.mcTurnArrowAnimation_8)
package TransformersGame_fla {
import flash.display.*;
public dynamic class mcTurnArrowAnimation_8 extends MovieClip {
public function mcTurnArrowAnimation_8(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package TransformersGame_fla
Section 55
//mcExplodeAnimation2 (mcExplodeAnimation2)
package {
import flash.display.*;
public dynamic class mcExplodeAnimation2 extends MovieClip {
public function mcExplodeAnimation2(){
addFrameScript(1, frame2, 27, frame28);
}
function frame28(){
gotoAndStop("hide");
}
function frame2(){
stop();
}
}
}//package
Section 56
//mcTurnArrow (mcTurnArrow)
package {
import flash.display.*;
public dynamic class mcTurnArrow extends MovieClip {
public var animation_mc:MovieClip;
}
}//package
Section 57
//musicLoopGame (musicLoopGame)
package {
import flash.media.*;
public dynamic class musicLoopGame extends Sound {
}
}//package
Section 58
//musicLoopMenu (musicLoopMenu)
package {
import flash.media.*;
public dynamic class musicLoopMenu extends Sound {
}
}//package
Section 59
//sfxAttackCannon (sfxAttackCannon)
package {
import flash.media.*;
public dynamic class sfxAttackCannon extends Sound {
}
}//package
Section 60
//sfxAttackLaser (sfxAttackLaser)
package {
import flash.media.*;
public dynamic class sfxAttackLaser extends Sound {
}
}//package
Section 61
//sfxAttackMelee (sfxAttackMelee)
package {
import flash.media.*;
public dynamic class sfxAttackMelee extends Sound {
}
}//package
Section 62
//sfxButtonClick (sfxButtonClick)
package {
import flash.media.*;
public dynamic class sfxButtonClick extends Sound {
}
}//package
Section 63
//sfxGameLose (sfxGameLose)
package {
import flash.media.*;
public dynamic class sfxGameLose extends Sound {
}
}//package
Section 64
//sfxGameWin (sfxGameWin)
package {
import flash.media.*;
public dynamic class sfxGameWin extends Sound {
}
}//package
Section 65
//sfxHitCannon (sfxHitCannon)
package {
import flash.media.*;
public dynamic class sfxHitCannon extends Sound {
}
}//package
Section 66
//sfxHitLaser (sfxHitLaser)
package {
import flash.media.*;
public dynamic class sfxHitLaser extends Sound {
}
}//package
Section 67
//sfxHitMelee (sfxHitMelee)
package {
import flash.media.*;
public dynamic class sfxHitMelee extends Sound {
}
}//package
Section 68
//sfxObstacleHit (sfxObstacleHit)
package {
import flash.media.*;
public dynamic class sfxObstacleHit extends Sound {
}
}//package
Section 69
//TransformersGame (TransformersGame)
package {
import flash.display.*;
import com.util.*;
import com.*;
import com.screen.*;
import flash.utils.*;
public class TransformersGame extends MovieClip {
public var _currentScreen:String;
public var _screen:Dictionary;
public var _soundOn:Boolean;
public var _currentMusic:String;
public var _score:Number;
public var _soundControl:SoundControl;
public var _screenLoaderClip:MovieClip;
public var screenLoader_mc:MovieClip;
public var HB:hitbox;
public function TransformersGame():void{
init();
}
public function playCurrentMusic(_arg1:int=0):void{
if (_soundOn){
_soundControl.playSound(_currentMusic, true);
};
}
public function stopMusic(_arg1:String, _arg2:int=0):void{
_currentMusic = "none";
_soundControl.stopSound(_arg1, _arg2);
}
private function init():void{
HB = new hitbox();
_soundControl = new SoundControl(this);
_screenLoaderClip = screenLoader_mc;
_screen = new Dictionary();
_soundOn = true;
_currentMusic = "none";
_score = 0;
gotoScreen("preload");
}
public function playMusic(_arg1:String, _arg2:int=0):void{
if (_soundOn){
trace(("PLAY Music " + _arg1));
_currentMusic = _arg1;
_soundControl.playSound(_arg1, true, _arg2);
};
}
public function muteCurrentMusic(_arg1:int=0):void{
_soundControl.stopSound(_currentMusic, _arg1);
}
public function gotoScreen(_arg1:String):void{
if (_currentScreen != null){
_screenLoaderClip.removeChild(_screen[_currentScreen]);
_screen[_arg1] = null;
};
switch (_arg1){
case "preload":
_screen[_arg1] = new PreloadScreen(this);
break;
case "title":
_screen[_arg1] = new TitleScreen(this);
break;
case "instruction":
HB.fire("misc", "instructions", true);
_screen[_arg1] = new InstructionScreen(this);
break;
case "highScore":
_screen[_arg1] = new HighScoreScreen(this);
break;
case "highScoreEnter":
_screen[_arg1] = new HighScoreScreen(this);
_screen[_arg1].functionEntryAvailable();
break;
case "gameWin":
_screen[_arg1] = new GameWinScreen(this);
break;
case "gameOver":
_screen[_arg1] = new GameOverScreen(this);
break;
case "game":
HB.fire("play_activity", "play", true);
_screen[_arg1] = new GameScreen(this);
break;
};
_screenLoaderClip.addChild(_screen[_arg1]);
_currentScreen = _arg1;
}
public function playSound(_arg1:String, _arg2:Boolean=false, _arg3:int=0):void{
if (_soundOn){
trace(("PLAY SOUND " + _arg1));
_soundControl.playSound(_arg1, _arg2, _arg3);
};
}
public function muteSound(_arg1:String, _arg2:int=0):void{
_soundControl.stopSound(_arg1, _arg2);
}
}
}//package