Frame 1
_root._quality = "HIGH";
var preloader = new Preloader();
gamename = "Hill_Defender";
domain_parts = _url.split("://");
real_domain = domain_parts[1].split("/");
hostingdomain = real_domain[0];
if (hostingdomain == "") {
hostingdomain = "unknown";
}
savedomain1 = "gamedev.dev.spilgames.com";
savedomain2 = "www8.agame.com";
if ((hostingdomain == savedomain1) || (hostingdomain == savedomain2)) {
spilnetwerk = "internal";
} else {
spilnetwerk = "external";
}
_root.localization_url1 = (((("http://www.agame.com/?utm_medium=brandedgames_" + spilnetwerk) + "&utm_campaign=") + gamename) + "&utm_source=") + hostingdomain;
_root.localization_language_nr = 1;
_root.localization_branding_nr = 1;
_root.localization_portal = "tweens";
Frame 12
var gameInstance = new Game();
attachMovie("SubmitterProxy", "proxyInstance", this.getNextHighestDepth());
gameInstance.initSubmitter(proxyInstance);
proxyInstance._visible = false;
proxyInstance.mouseEnabled = false;
Symbol 11 MovieClip [Gamemc] Frame 1
#initclip 49
Object.registerClass("Gamemc", Game);
#endinitclip
Symbol 13 MovieClip [SubmitterProxy] Frame 1
#initclip 36
Object.registerClass("SubmitterProxy", SubmitterProxy);
#endinitclip
Symbol 22 MovieClip Frame 4
stop();
Symbol 22 MovieClip Frame 7
gotoAndStop (4);
Symbol 22 MovieClip Frame 30
stop();
Symbol 184 MovieClip Frame 1
gotoAndStop(_root.localization_branding_nr);
Symbol 185 MovieClip [level_7] Frame 1
#initclip 37
Object.registerClass("level_7", Levels.Level7);
#endinitclip
Symbol 192 MovieClip [level_4] Frame 1
#initclip 38
Object.registerClass("level_4", Levels.Level4);
#endinitclip
Symbol 200 MovieClip [level_8] Frame 1
#initclip 39
Object.registerClass("level_8", Levels.Level8);
#endinitclip
Symbol 208 MovieClip [level_6] Frame 1
#initclip 40
Object.registerClass("level_6", Levels.Level6);
#endinitclip
Symbol 216 MovieClip [level_2] Frame 1
#initclip 41
Object.registerClass("level_2", Levels.Level2);
#endinitclip
Symbol 238 MovieClip [tank] Frame 1
#initclip 42
Object.registerClass("tank", Units.Tank);
#endinitclip
Symbol 238 MovieClip [tank] Frame 8
gotoAndPlay (1);
Symbol 238 MovieClip [tank] Frame 10
gotoAndPlay (1);
Symbol 238 MovieClip [tank] Frame 19
stop();
Symbol 268 MovieClip [soldier] Frame 1
#initclip 43
Object.registerClass("soldier", Units.Soldier);
#endinitclip
Symbol 268 MovieClip [soldier] Frame 7
gotoAndPlay (1);
Symbol 268 MovieClip [soldier] Frame 9
gotoAndPlay (1);
Symbol 268 MovieClip [soldier] Frame 13
stop();
Symbol 278 MovieClip [helicopter] Frame 1
#initclip 44
Object.registerClass("helicopter", Units.Heli);
#endinitclip
Symbol 278 MovieClip [helicopter] Frame 6
gotoAndPlay (1);
Symbol 278 MovieClip [helicopter] Frame 8
gotoAndPlay (1);
Symbol 278 MovieClip [helicopter] Frame 24
stop();
Symbol 286 MovieClip [level_5] Frame 1
#initclip 45
Object.registerClass("level_5", Levels.Level5);
#endinitclip
Symbol 294 MovieClip [level_3] Frame 1
#initclip 46
Object.registerClass("level_3", Levels.Level3);
#endinitclip
Symbol 302 MovieClip [level_1] Frame 1
#initclip 47
Object.registerClass("level_1", Levels.Level1);
#endinitclip
Symbol 314 MovieClip [GameOverFeedback1Screen] Frame 1
if (_root.localization_portal == "game_com_cn") {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1, "_blank");
};
} else {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1 + "&utm_content=button_mainscreen_moregames", "_blank");
};
}
Symbol 338 MovieClip [UpgradeScreen] Frame 1
if (_root.localization_portal == "game_com_cn") {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1, "_blank");
};
} else {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1 + "&utm_content=button_mainscreen_moregames", "_blank");
};
}
Symbol 345 MovieClip [GameOverScreenMc] Frame 1
if (_root.localization_portal == "game_com_cn") {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1, "_blank");
};
} else {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1 + "&utm_content=button_mainscreen_moregames", "_blank");
};
}
Symbol 360 MovieClip [highscoresScreenMc] Frame 1
if (_root.localization_portal == "game_com_cn") {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1, "_blank");
};
} else {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1 + "&utm_content=button_mainscreen_moregames", "_blank");
};
}
Symbol 380 MovieClip [MainMenuScreenMc] Frame 1
if (_root.localization_portal == "game_com_cn") {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1, "_blank");
};
} else {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1 + "&utm_content=button_mainscreen_moregames", "_blank");
};
}
Symbol 408 MovieClip [dot_anim] Frame 1
#initclip 48
Object.registerClass("dot_anim", CMovieClip);
#endinitclip
Symbol 464 MovieClip [SubmitScoreScreenMc] Frame 1
if (_root.localization_portal == "game_com_cn") {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1, "_blank");
};
} else {
this.moreGames.onRelease = function () {
getURL (_root.localization_url1 + "&utm_content=button_mainscreen_moregames", "_blank");
};
}
Symbol 471 MovieClip [__Packages.Preloader] Frame 0
class Preloader extends MovieClip
{
var mc, showPerc;
function Preloader () {
super();
Data.getSO();
_root.stop();
mc = _root.attachMovie("PreloaderMc", "mc", 0);
var _local5 = 320;
var _local6 = 240;
var _local4 = Math.min(Stage.width / _local5, Stage.height / _local6);
mc._x = (Stage.width - (_local5 * _local4)) / 2;
mc._y = (Stage.height - (_local6 * _local4)) / 2;
mc._xscale = (mc._yscale = 100 * _local4);
showPerc = 0;
var _local7 = setInterval(mx.utils.Delegate.create(this, update), 100);
}
function update() {
var _local4 = 320;
var _local5 = 240;
var _local3 = Math.min(Stage.width / _local4, Stage.height / _local5);
mc._x = (Stage.width - (_local4 * _local3)) / 2;
mc._y = (Stage.height - (_local5 * _local3)) / 2;
mc._xscale = (mc._yscale = 100 * _local3);
var _local6 = _root.getBytesLoaded() / _root.getBytesTotal();
if (_local6 > showPerc) {
showPerc = showPerc + 0.25;
}
mc.bar._xscale = showPerc * 100;
mc.progressTf.text = String(Math.floor(showPerc * 100)) + " %";
if (showPerc >= 1) {
mc.removeMovieClip();
_root.gotoAndStop("game");
}
}
}
Symbol 472 MovieClip [__Packages.Data] Frame 0
class Data
{
static var so;
function Data () {
soData = new Object();
}
static function getSO() {
so = SharedObject.getLocal("HillDefendr");
}
static function initSO() {
trace("InitSO");
if (!System.capabilities.hasSharedObjects) {
}
trace("size = " + so.getSize());
if ((so.getSize() == 0) || (System.capabilities.hasSharedObjects == false)) {
trace("Zet waarden voor soData");
soData.version = 4;
soData.lang = "UNKNOWN";
soData.scores = new Array({n:"LRS", s:3000}, {n:"THO", s:2700}, {n:"WTZ", s:2250}, {n:"MIK", s:1900}, {n:"PET", s:1000});
var _local1 = System.capabilities.language.substr(0, 2);
soData.lang = "en_us";
saveValues();
} else {
soData = so.data;
bSavedGameData = soData.bSavedGameData;
SavedLevel = soData.SavedLevel;
SavedHealth = soData.SavedHealth;
SavedUpgradeReload = soData.SavedUpgradeReload;
SavedUpgradeDamage = soData.SavedUpgradeDamage;
SavedUpgradeHealth = soData.SavedUpgradeHealth;
SavedCash = soData.SavedCash;
}
Localisation.language = soData.lang;
trace("soLanges" + soData.lang);
trace("so.datalang" + so.data.lang);
trace("soDatascores" + soData.scores);
trace("so.datascores" + so.data.scores);
updateSO();
trace("soLanges" + soData.lang);
trace("so.datalang" + so.data.lang);
trace("soDatascores" + soData.scores);
trace("so.datascores" + so.data.scores);
so.flush();
}
static function saveValues() {
soData.bSavedGameData = bSavedGameData;
soData.SavedLevel = SavedLevel;
soData.SavedHealth = SavedHealth;
soData.SavedUpgradeReload = SavedUpgradeReload;
soData.SavedUpgradeDamage = SavedUpgradeDamage;
soData.SavedUpgradeHealth = SavedUpgradeHealth;
soData.SavedCash = SavedCash;
}
static function updateSO() {
saveValues();
so.data.lang = soData.lang;
so.data.scores = soData.scores;
so.data.bSavedGameData = soData.bSavedGameData;
so.data.SavedLevel = soData.SavedLevel;
so.data.SavedHealth = soData.SavedHealth;
so.data.SavedUpgradeReload = soData.SavedUpgradeReload;
so.data.SavedUpgradeDamage = soData.SavedUpgradeDamage;
so.data.SavedUpgradeHealth = soData.SavedUpgradeHealth;
so.data.SavedCash = soData.SavedCash;
so.flush();
}
static function postNewScore(n, s) {
var _local3 = soData.scores.splice();
soData.scores.push({n:n, s:s});
soData.scores.sortOn("s", Array.NUMERIC | Array.DESCENDING);
if (soData.scores.length > 5) {
soData.scores.splice(6, soData.scores.length - 5);
}
updateSO();
}
static function SaveGame(player, newLevelIdx) {
bSavedGameData = true;
SavedLevel = newLevelIdx;
SavedHealth = player.health;
updateSO();
}
static var screenOrientation = "270";
static var soData = new Object();
static var sound = false;
static var bSavedGameData = false;
static var SavedLevel = 0;
static var SavedHealth = 0;
static var SavedUpgradeReload = 0;
static var SavedUpgradeDamage = 0;
static var SavedUpgradeHealth = 0;
static var SavedCash = 0;
}
Symbol 473 MovieClip [__Packages.Localisation] Frame 0
class Localisation
{
function Localisation () {
}
static function init() {
locText = new Array();
locText["LANG_EN-US"] = {en_us:"English", de:"English", es:"English"};
locText.LANG_DE = {en_us:"Deutsch", de:"Deutsch", es:"Deutsch"};
locText.LANG_ES = {en_us:"Enspa\u00F1ol", de:"Espa\u00F1ol", es:"Espa\u00F1ol"};
locText.TITLESCREEN_MAINMENU = {en_us:"Main menu", de:"Main menu", es:"Main menu"};
locText.MAINMENU_NEWGAME = {en_us:"New game", de:"deNew game", es:"esNew game"};
locText.MAINMENU_CONTINUEGAME = {en_us:"Continue", de:"Continue", es:"Continue"};
locText.MAINMENU_HIGHSCORES = {en_us:"High scores", de:"Highscores", es:"Highscores"};
locText.MAINMENU_MOREGAMES = {en_us:"More games", de:"More games", es:"More games"};
locText.SETTINGSMENU_SOUND = {en_us:"Sound", de:"Sound", es:"Sound"};
locText.SETTINGSMENU_SELECTLANGUAGE = {en_us:"Select language", de:"Select language", es:"Select language"};
locText.SETTINGSMENU_LANGUAGE = {en_us:"Language", de:"Language", es:"Language"};
locText.SETTINGSMENU_QUALITY_LOW = {en_us:"Quality low", de:"Quality low", es:"Quality low"};
locText.SETTINGSMENU_QUALITY_MEDIUM = {en_us:"Quality med", de:"Quality med", es:"Quality med"};
locText.SETTINGSMENU_QUALITY_HIGH = {en_us:"Quality high", de:"Quality high", es:"Quality high"};
locText.SETTINGSMENU_SOUND_ON = {en_us:"Sound on", de:"Sound on", es:"Sound on"};
locText.SETTINGSMENU_SOUND_OFF = {en_us:"Sound off", de:"Sound off", es:"Sound off"};
locText.INSTRUCTIONS_TEXT = {en_us:"Lange\ntekst\nhier", de:"Lange\ntekst\nhier", es:"Lange\ntekst\nhier"};
locText.GAME_GAMEOVER = {en_us:"Game over!", de:"Game over!", es:"Game over!"};
locText.GAME_SCORE = {en_us:"Score :", de:"Score", es:"Score"};
locText.GAME_YOURSCORE = {en_us:"Your score:", de:"Your score:", es:"Your score:"};
locText.GAME_SUBMITSCORE = {en_us:"Submit score", de:"Submit score", es:"Submit score"};
locText.GAME_TRYAGAIN = {en_us:"Try again", de:"Try again", es:"Try again"};
locText.GAME_ENTERNAME = {en_us:"Please enter your name", de:"Please enter your name", es:"Please enter your name"};
locText.SOFT_SELECT = {en_us:"Select", de:"Select", es:"Select"};
locText.SOFT_PAUSE = {en_us:"Pause", de:"Pause", es:"Pause"};
locText.SOFT_CHANGE = {en_us:"Change", de:"Change", es:"Change"};
locText.SOFT_NEXT = {en_us:"Next", de:"Next", es:"Next"};
locText.SOFT_PREVIOUS = {en_us:"Previous", de:"Previous", es:"Previous"};
locText.BUTTON_CONTINUE = {en_us:"Continue", de:"Continue", es:"Continue"};
locText.BUTTON_BACK = {en_us:"Back", de:"Back", es:"Back"};
locText.BUTTON_EXIT = {en_us:"Exit", de:"Exit", es:"Exit"};
locText.GAME_WAVES = {en_us:"Wave :", de:"w", es:"w"};
locText.GAME_LEVELS = {en_us:"Level :", de:"l", es:"l"};
locText.FAILED_YES = {en_us:"Yes", de:"l", es:"l"};
locText.FAILED_NO = {en_us:"No", de:"l", es:"l"};
locText.UPGRADE_BUY = {en_us:"Buy", de:"l", es:"l"};
locText.UPGRADE_CONTINUE = {en_us:"Continue", de:"l", es:"l"};
locText.MAIN_LINK = {en_us:"http://games.mobi/?am_src_prv=games&am_src_cmp=Hill_Defender&am_src_adv=main", nl:"http://games.mobi/?am_src_prv=games&am_src_cmp=Hill_Defender&am_src_adv=main", de:"http://spiele.mobi/?am_src_prv=games&am_src_cmp=Hill_Defender&am_src_adv=main", es:"http://juegos.mobi/?am_src_prv=games&am_src_cmp=Hill_Defender&am_src_adv=main"};
}
static function setLanguage(l) {
language = l;
Data.so.data.lang = l;
Data.so.flush();
}
static function text(s) {
if (language != "UNKNOWN") {
return(locText[s][language]);
}
return(locText[s].en_us);
}
static var locText = new Array();
static var language = "en_us";
}
Symbol 474 MovieClip [__Packages.screens.game.Player] Frame 0
class screens.game.Player
{
var levelMC, playerMC, CollisionMC, weaponMC, healthbarMC, projectiles, projectilesFired, sFire;
function Player (GameMC) {
levelMC = GameMC;
playerMC = levelMC.Player;
CollisionMC = playerMC.CollisionMC;
weaponMC = playerMC.gun;
rotateWeaponCenter = weaponMC._rotation;
healthbarMC = playerMC.healthbar;
healthbarMC.gotoAndStop(21);
CollisionMC._visible = false;
projectiles = new Array();
projectilesFired = new Array();
createProjetiles();
BeforeLevelCash = Data.SavedCash;
sFire = new Sound();
sFire.attachSound("HD_gunfire");
}
function createProjetiles() {
var _local3;
var _local2 = 24;
while (_local2 > 0) {
_local3 = new screens.game.Projectile(levelMC.attachMovie("bullet", "bullet_" + _local2, levelMC.getNextHighestDepth()), this);
projectiles.push(_local3);
_local2--;
}
}
function rotateWeapon(dir) {
rotateWeaponDir = dir;
}
function updateHealthBar() {
healthbarMC.gotoAndStop(Math.round((20 / healthBase) * health) + 1);
}
function getHit(instigator) {
if (health > 0) {
healthbarMC._visible = true;
health = health - instigator.damage;
updateHealthBar();
if (health <= 0) {
weaponMC.gotoAndPlay(8);
} else {
weaponMC.gotoAndPlay(5);
}
}
}
function fire() {
var _local2 = projectiles.pop();
var _local3 = {x:playerMC._x + weaponMC._x, y:playerMC._y + weaponMC._y};
_local2.setPos(_local3.x, _local3.y);
_local2.setFireProperties(Math.abs(-300 + (weaponMC._rotation * 3)), 0, weaponMC._rotation - 8, damage);
projectilesFired.push(_local2);
weaponMC.gotoAndPlay(1);
sFire.start(0, 1);
}
function update(deltaTime) {
if (health > 0) {
if (rotateWeaponDir != 0) {
weaponMC._rotation = weaponMC._rotation + ((rotateWeaponDir * rotateWeaponSpeed) * deltaTime);
if (weaponMC._rotation < (rotateWeaponCenter - 80)) {
weaponMC._rotation = rotateWeaponCenter - 79;
}
if (weaponMC._rotation > (rotateWeaponCenter + 40)) {
weaponMC._rotation = rotateWeaponCenter + 39;
}
}
if ((fireRateTimer >= fireRate) && (projectiles.length > 0)) {
fire();
fireRateTimer = 0;
} else {
fireRateTimer = fireRateTimer + deltaTime;
}
} else if (weaponMC._currentframe >= 29) {
Data.SavedCash = BeforeLevelCash;
Data.gameRoot.showScreen("GameOverFeedback1");
}
updateProjectiles(deltaTime);
}
function updateProjectiles(deltaTime) {
var _local2 = projectilesFired.length - 1;
while (_local2 >= 0) {
projectilesFired[_local2].update(deltaTime);
if (projectilesFired[_local2].isCompleted()) {
projectilesFired[_local2].setPos(-6, -6);
var _local3 = projectilesFired.splice(_local2, 1);
projectiles.push(_local3[0]);
_local3 = null;
} else {
var _local4 = levelMC.hitTestEnemy(projectilesFired[_local2]);
if (_local4) {
_local4.getHit(projectilesFired[_local2]);
projectilesFired[_local2].setCompleted();
}
}
_local2--;
}
}
var xPos = 0;
var xSpeed = 0;
var healthBase = 40;
var health = screens.game.Player.prototype.healthBase;
var fireRate = 1.6;
var fireRateTimer = 0;
var damage = 1;
var rotateWeaponDir = 0;
var rotateWeaponCenter = 0;
var rotateWeaponSpeed = 50;
var BeforeLevelCash = 0;
}
Symbol 475 MovieClip [__Packages.screens.game.Projectile] Frame 0
class screens.game.Projectile
{
var mc, parentObject;
function Projectile (bulletMC, ParentObj) {
mc = bulletMC;
setPos(-6, -6);
parentObject = ParentObj;
}
function setPos(xPos, yPos) {
mc._x = xPos;
mc._y = yPos;
bCompleted = false;
}
function setFireProperties(_xSpeed, _ySpeed, _angle, damageValue) {
xSpeed = _xSpeed;
ySpeed = _ySpeed;
angle = _angle * PIover180;
damage = damageValue;
}
function isCompleted() {
return(bCompleted);
}
function setCompleted() {
bCompleted = true;
}
function update(deltaTime) {
if (!isCompleted()) {
mc._x = mc._x + ((Math.cos(angle) * xSpeed) * deltaTime);
mc._y = mc._y + ((Math.sin(angle) * xSpeed) * deltaTime);
mc._y = mc._y + ((gravity + ySpeed) * deltaTime);
xSpeed = xSpeed * (1 - (1.03 * deltaTime));
ySpeed = ySpeed + (96 * deltaTime);
if ((((mc._y < -180) || (mc._x > 320)) || (mc._y > 240)) || (mc._x < 1)) {
setCompleted();
}
}
}
function updateGraphics() {
}
function remove() {
removeMovieClip(mc);
}
var damage = 1;
var ySpeed = 0;
var xSpeed = 0;
var gravity = 40;
var angle = 0;
var PIover180 = (Math.PI/180);
var bCompleted = false;
}
Symbol 476 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 477 MovieClip [__Packages.SubmitterProxy] Frame 0
class SubmitterProxy extends MovieClip
{
var parentObj, _parent, m_scoreType, m_scoreOrder, gameName, htmlName, locale, iconData, pagesize, pagenr, requestStackInvalidUser, gameid, siteid, channelid, swfURL, delegateOnIoError, delegateOnLoadDone, createEmptyMovieClip, getNextHighestDepth, content, delegateHyscoreSubmitterReady, dispatchEvent, m_scoreXMLData, m_scoreServerTimeXMLData, m_achievXMLData;
function SubmitterProxy () {
super();
System.security.allowDomain("*");
parentObj = _parent;
mx.events.EventDispatcher.initialize(this);
}
function setLoader(_container, _gameName, _htmlName, _order, _scoreType, _locale, _iconData, _pagesize, _pagenr, _bTest, _serverSelect) {
bTestModeOn = _bTest;
m_scoreType = _scoreType;
m_scoreOrder = _order;
gameName = _gameName;
if (_htmlName == "") {
htmlName = gameName;
} else {
htmlName = _htmlName;
}
locale = _locale;
iconData = _iconData;
pagesize = _pagesize;
pagenr = _pagenr;
serverSelect = _serverSelect;
requestStackInvalidUser = new Array();
if (_container != null) {
userName = _container.username;
userHash = _container.hash;
gameid = _container.id;
siteid = _container.s;
channelid = _container.c;
swfURL = "http://www8.agame.com/games/flash/highscore/SubmitterAS2.swf";
getSwf();
} else {
SubmitterFailedToLoad();
}
}
function getSwf() {
var _local3 = new Object();
delegateOnIoError = mx.utils.Delegate.create(this, onLoadDone);
_local3.onLoadInit = delegateOnIoError;
delegateOnLoadDone = mx.utils.Delegate.create(this, onIoError);
_local3.onLoadError = delegateOnLoadDone;
var _local4 = new MovieClipLoader();
_local4.addListener(_local3);
var _local2 = createEmptyMovieClip("loadedComp", getNextHighestDepth());
_local4.loadClip(swfURL, _local2);
_local2._x = 10;
_local2._y = 10;
_local2._visible = false;
}
function isSWFReady() {
return(content != null);
}
function isDomainAllowed(value) {
if (content) {
return(content.isDomainValid(value));
}
return(false);
}
function hasUserData() {
return((userName != null) && (userHash != null));
}
function doCommTest() {
if (content) {
return(content.m_get_TEST());
}
return("Error: Failed to communicatie with: " + content);
}
function getScoreServerTime() {
if (content) {
content.m_getLatestScoreServerTime();
}
}
function submitScore(score) {
content.m_submitScore(score, userName, userHash, "", 0);
}
function requestHighscoreList() {
if (content) {
content.m_submitHighscoreListRequest();
}
}
function requestUserHighscoreList(target_username) {
if (content) {
content.m_submitUserHighscoreListRequest(target_username);
}
}
function submitGrantAward(tag) {
if (content) {
if (!hasUserData()) {
requestStackInvalidUser.push({type:"SUBMIT_AWARD", value:tag});
}
content.m_submitAward(tag, userName, userHash);
}
}
function requestAwardList() {
if (content) {
if (!hasUserData()) {
requestStackInvalidUser.push({type:"REQUEST_AWARDLIST"});
}
content.m_getUserAwardList(userName, userHash);
}
}
function requestAwardInfo(awardID) {
if (content) {
content.m_getAwardInfo(awardID);
}
}
function SubmitterIsLoaded() {
delegateHyscoreSubmitterReady = mx.utils.Delegate.create(this, onHyScorSubmitterReady);
content.addEventListener("HyScorSubmitterLoaded", delegateHyscoreSubmitterReady);
content.addEventListener("ScoreLoadError", this);
content.addEventListener("ScoreLoadTimeComplete", this);
content.addEventListener("ScoreLoadSubmitComplete", this);
content.addEventListener("ScoreLoadListComplete", this);
content.addEventListener("ScoreLoadUserListComplete", this);
content.addEventListener("AchievLoadError", this);
content.addEventListener("AchievLoadTimeComplete", this);
content.addEventListener("AchievLoadListComplete", this);
content.addEventListener("AchievLoadInfoComplete", this);
content.addEventListener("AchievLoadGrantComplete", this);
}
function SubmitterFailedToLoad() {
dispatchEvent({target:this, type:"LoadingFailed", elapsedTime:getTimer()});
}
function onLoadDone(target_mc) {
content = target_mc.SubmitterInstance;
content.gotoAndPlay(1);
if (isDomainAllowed(bTestModeOn)) {
trace("Spil Submitter component downloaded.");
SubmitterIsLoaded();
content.init(siteid, 1, gameid, channelid, m_scoreOrder, locale, iconData, pagesize, pagenr, userName, userHash, serverSelect);
initJStoSWFListeners();
} else {
trace("Error: Could not init spil submitter...played on an invalid domain.");
SubmitterFailedToLoad();
}
}
function onIoError(target_mc, errorCode, httpStatus) {
trace((("Error: loadListener.onLoadError() errorCode: " + errorCode) + " httpStatus: ") + httpStatus);
SubmitterFailedToLoad();
}
function onHyScorSubmitterReady(target_mc) {
if (content) {
content.removeEventListener("HyScorSubmitterLoaded", delegateHyscoreSubmitterReady);
}
dispatchEvent({target:this, type:"SubmitterLoadedSuccesfull", elapsedTime:getTimer()});
}
function handleEvent(e) {
if (((e.type == "ScoreLoadSubmitComplete") || (e.type == "ScoreLoadListComplete")) || (e.type == "ScoreLoadUserListComplete")) {
m_scoreXMLData = content.m_getLastestHighscoreData();
} else if (e.type == "ScoreLoadTimeComplete") {
m_scoreServerTimeXMLData = content.m_getLatestScoreServerTime();
} else if (((e.type == "AchievLoadListComplete") || (e.type == "AchievLoadInfoComplete")) || (e.type == "AchievLoadGrantComplete")) {
m_achievXMLData = content.m_getLastestAchievementData();
} else if (e.type == "AchievLoadTimeComplete") {
} else if (e.type == "ScoreLoadError") {
m_scoreXMLData = content.m_getLatestHighscoreError();
} else if (e.type == "AchievLoadError") {
m_achievXMLData = content.m_getLatestAchievError();
}
dispatchEvent({target:this, type:e.type, elapsedTime:getTimer()});
}
function initJStoSWFListeners() {
}
function updateUser(params) {
var _local3 = params.username;
var _local2 = params.hash;
var _local4 = params.id;
userName = _local3;
userHash = _local2;
var _local6 = (((("UPDATE_USER|-|" + _local3) + "|-|") + _local2) + "|-|") + _local4;
processInvalidUserList();
}
function updateAvatar(params) {
var _local1 = params.id;
var _local2 = params.type;
var _local3 = (("UPDATE_AVATAR|-|" + _local1) + "|-|") + _local2;
}
function updateGallery(params) {
var _local1 = params.id;
var _local2 = params.type;
var _local3 = (("UPDATE_GALLERY|-|" + _local1) + "|-|") + _local2;
}
function processInvalidUserList() {
while (requestStackInvalidUser.length > 0) {
var _local2 = requestStackInvalidUser.pop();
if (_local2.type == "SUBMIT_SCORE") {
submitScore(_local2.value);
} else if (_local2.type == "SUBMIT_AWARD") {
submitGrantAward(_local2.value);
} else if (_local2.type == "REQUEST_AWARDLIST") {
requestAwardList();
}
}
}
function destroy() {
parentObj = null;
content.removeMovieClip();
content = null;
siteid = null;
channelid = null;
gameid = null;
userName = null;
userHash = null;
m_scoreXMLData = null;
m_achievXMLData = null;
}
var userName = null;
var userHash = null;
var serverSelect = 1;
var bTestModeOn = false;
}
Symbol 478 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
if (queue != undefined) {
var _local4 = queue.length;
var _local1;
_local1 = 0;
while (_local1 < _local4) {
var _local2 = queue[_local1];
if (_local2 == handler) {
queue.splice(_local1, 1);
return(undefined);
}
_local1++;
}
}
}
static function initialize(object) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
object.addEventListener = _fEventDispatcher.addEventListener;
object.removeEventListener = _fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var _local7 = "__q_" + eventObj.type;
var _local4 = queueObj[_local7];
if (_local4 != undefined) {
var _local5;
for (_local5 in _local4) {
var _local1 = _local4[_local5];
var _local3 = typeof(_local1);
if ((_local3 == "object") || (_local3 == "movieclip")) {
if (_local1.handleEvent != undefined) {
_local1.handleEvent(eventObj);
}
if (_local1[eventObj.type] != undefined) {
if (exceptions[eventObj.type] == undefined) {
_local1[eventObj.type](eventObj);
}
}
} else {
_local1.apply(queueObj, [eventObj]);
}
}
}
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(this, eventObj);
}
function addEventListener(event, handler) {
var _local3 = "__q_" + event;
if (this[_local3] == undefined) {
this[_local3] = new Array();
}
_global.ASSetPropFlags(this, _local3, 1);
_removeEventListener(this[_local3], event, handler);
this[_local3].push(handler);
}
function removeEventListener(event, handler) {
var _local2 = "__q_" + event;
_removeEventListener(this[_local2], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1, load:1};
}
Symbol 479 MovieClip [__Packages.Levels.Level7] Frame 0
class Levels.Level7 extends MovieClip
{
var EnemyProjectiles, EnemyProjectilesFired, attachMovie, getNextHighestDepth, SoldierPool, TankPool, HeliPool, waves, playerReference, ActiveUnits;
function Level7 () {
super();
var _local3 = HillStart_X - HillEnd_X;
var _local4 = HillStart_Y - HillEnd_Y;
HeightPerUnitDistance = _local4 / _local3;
createUnits();
EnemyProjectiles = new Array();
EnemyProjectilesFired = new Array();
createEnemyProjetiles();
createWaves();
}
function createEnemyProjetiles() {
var _local3;
var _local2 = 16;
while (_local2 > 0) {
_local3 = new screens.game.Projectile(attachMovie("bullet", "Enemy_bullet_" + _local2, getNextHighestDepth()), this);
EnemyProjectiles.push(_local3);
_local2--;
}
}
function createUnits() {
SoldierPool = new Array();
TankPool = new Array();
HeliPool = new Array();
HeliPool.push(attachMovie("helicopter", "Heli_1", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_2", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_3", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_4", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_5", getNextHighestDepth()));
}
function createWaves() {
waves = new Array(new Array("Heli", "Heli", "Heli"), new Array("Heli", "Heli", "Heli", "Heli"), new Array("Heli", "Heli", "Heli", "Heli", "Heli"));
totalAmountOfWaves = waves.length;
}
function getTotalWaves() {
return(totalAmountOfWaves);
}
function getProjectile() {
return(EnemyProjectiles.pop());
}
function AddProjectileToFired(proj) {
EnemyProjectilesFired.push(proj);
}
function levelComplete() {
return(waveCounter >= waves.length);
}
function startLevel(playerRef) {
playerReference = playerRef;
ActiveUnits = new Array();
}
function spawnNewUnit() {
if (waves[waveCounter] && (waves[waveCounter].length > 0)) {
var _local3 = waves[waveCounter].pop();
var _local2;
if (_local3 == "Soldier") {
_local2 = SoldierPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Tank") {
_local2 = TankPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Heli") {
_local2 = HeliPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
}
_local2.init(this);
ActiveUnits.push(_local2);
}
}
function startNextWave() {
waveCounter++;
Data.screen.updateWavesFeedback(waveCounter + 1, getTotalWaves());
}
function update(deltaTime) {
unitSpawnTimer = unitSpawnTimer + deltaTime;
if (unitSpawnTimer >= unitSpawnDelay) {
spawnNewUnit();
unitSpawnTimer = 0;
} else if (((ActiveUnits.length == 0) && (waves[waveCounter])) && (waves[waveCounter].length == 0)) {
unitSpawnTimer = 0;
startNextWave();
}
var _local2 = ActiveUnits.length - 1;
while (_local2 >= 0) {
ActiveUnits[_local2].update(deltaTime);
_local2--;
}
updateEnemyProjectiles(deltaTime);
}
function IsBeforeStartOfHill(xPos) {
return(xPos > HillStart_X);
}
function getHeightAtPosX(xPos) {
if (IsBeforeStartOfHill(xPos)) {
return(HeightBeforeStart_X);
}
return(HillEnd_Y + ((xPos - HillEnd_X) * HeightPerUnitDistance));
}
function updateEnemyProjectiles(deltaTime) {
var _local2 = EnemyProjectilesFired.length - 1;
while (_local2 >= 0) {
EnemyProjectilesFired[_local2].update(deltaTime);
if (EnemyProjectilesFired[_local2].isCompleted()) {
EnemyProjectilesFired[_local2].setPos(-6, -6);
var _local3 = EnemyProjectilesFired.splice(_local2, 1);
EnemyProjectiles.push(_local3[0]);
_local3 = null;
} else if (EnemyProjectilesFired[_local2].mc.hitTest(playerReference.CollisionMC)) {
playerReference.getHit(EnemyProjectilesFired[_local2]);
EnemyProjectilesFired[_local2].setCompleted();
} else if (EnemyProjectilesFired[_local2]._y > getHeightAtPosX(EnemyProjectilesFired[_local2]._x)) {
EnemyProjectilesFired[_local2].setCompleted();
}
_local2--;
}
}
function enemyDied(enemy) {
var _local3 = 0;
while (_local3 < ActiveUnits.length) {
if (ActiveUnits[_local3] == enemy) {
var _local2 = ActiveUnits.splice(_local3, 1)[0];
if (_local2 instanceof Units.Soldier) {
_local2.setPos(-100, -100);
SoldierPool.push(_local2);
Data.SavedCash = Data.SavedCash + 25;
} else if (_local2 instanceof Units.Tank) {
_local2.setPos(-100, -100);
TankPool.push(_local2);
Data.SavedCash = Data.SavedCash + 125;
} else if (_local2 instanceof Units.Heli) {
_local2.setPos(-100, -100);
HeliPool.push(_local2);
Data.SavedCash = Data.SavedCash + 50;
}
Data.screen.updateCashFeedback();
}
_local3++;
}
}
function hitTestEnemy(target) {
var _local2 = 0;
while (_local2 < ActiveUnits.length) {
if (target.mc.hitTest(ActiveUnits[_local2].CollisionMC)) {
return(ActiveUnits[_local2]);
}
_local2++;
}
return(null);
}
var HillStart_X = 99;
var HillStart_Y = 220;
var HillEnd_X = 50;
var HillEnd_Y = 40;
var HeightBeforeStart_X = 220;
var HeightPerUnitDistance = 0;
var totalAmountOfWaves = 0;
var waveCounter = 0;
var unitSpawnTimer = 0;
var unitSpawnDelay = 1.8;
}
Symbol 480 MovieClip [__Packages.Units.Soldier] Frame 0
class Units.Soldier extends MovieClip
{
var _x, _y, CollisionMC, levelMC, gotoAndPlay, healthbarMC, _currentframe;
function Soldier () {
super();
_x = -100;
_y = -100;
CollisionMC._visible = false;
}
function init(parentLevelMC) {
levelMC = parentLevelMC;
bDeath = false;
health = healthBase;
gotoAndPlay(1);
healthbarMC._visible = false;
healthbarMC.gotoAndStop(21);
setPos(320, levelMC.getHeightAtPosX(320));
}
function setPos(newX, newY) {
_x = newX;
_y = newY;
}
function isCompleted() {
return(bDeath && (_currentframe >= 13));
}
function moveLeft(deltaTime) {
if (_x > 64) {
_x = _x - (xSpeed * deltaTime);
_y = levelMC.getHeightAtPosX(_x);
}
}
function rotateWeapon(dir) {
rotateWeaponDir = dir;
}
function getHit(instigator) {
healthbarMC._visible = true;
health = health - instigator.damage;
healthbarMC.gotoAndStop(Math.round((20 / healthBase) * health) + 1);
if (health <= 0) {
bDeath = true;
gotoAndPlay(10);
} else {
gotoAndPlay(8);
}
}
function setFiringTargetPosition(targetX, targetY) {
targetPosY = targetY;
}
function fire() {
var _local2 = levelMC.getProjectile();
var _local3 = {x:_x, y:_y - 7};
_local2.setPos(_local3.x, _local3.y);
_local2.setFireProperties(-700, -4, 10 + ((_y - targetPosY) * 0.25), damage);
levelMC.AddProjectileToFired(_local2);
}
function update(deltaTime) {
if (!bDeath) {
moveLeft(deltaTime);
if (_x < fireDistance) {
if (fireRate >= 5) {
fire();
fireRate = 0;
} else {
fireRate = fireRate + deltaTime;
}
}
} else if (isCompleted()) {
levelMC.enemyDied(this);
}
}
var xSpeed = 12;
var healthBase = 2;
var health = Units.Soldier.prototype.healthBase;
var fireRate = 0;
var damage = 1;
var fireDistance = 200;
var bDeath = false;
var rotateWeaponDir = 0;
var targetPosY = 0;
}
Symbol 481 MovieClip [__Packages.Units.Tank] Frame 0
class Units.Tank extends MovieClip
{
var _x, _y, CollisionMC, sExplosion, levelMC, gotoAndPlay, healthbarMC, _rotation, _currentframe;
function Tank () {
super();
_x = -100;
_y = -100;
CollisionMC._visible = false;
sExplosion = new Sound();
sExplosion.attachSound("HD_explosion");
}
function init(parentLevelMC) {
levelMC = parentLevelMC;
bDeath = false;
health = healthBase;
gotoAndPlay(1);
healthbarMC._visible = false;
healthbarMC.gotoAndStop(21);
bRotatedAgainstHill = false;
_rotation = 0;
setPos(320, levelMC.getHeightAtPosX(320));
}
function setPos(newX, newY) {
_x = newX;
_y = newY;
}
function isCompleted() {
return(bDeath && (_currentframe >= 19));
}
function moveLeft(deltaTime) {
if (_x > 130) {
_x = _x - (xSpeed * deltaTime);
_y = levelMC.getHeightAtPosX(_x);
}
if (!bRotatedAgainstHill) {
if (!levelMC.IsBeforeStartOfHill(_x)) {
bRotatedAgainstHill = true;
_rotation = _rotation + 8;
}
}
}
function rotateWeapon(dir) {
rotateWeaponDir = dir;
}
function getHit(instigator) {
healthbarMC._visible = true;
health = health - instigator.damage;
healthbarMC.gotoAndStop(Math.round((20 / healthBase) * health) + 1);
if (health <= 0) {
bDeath = true;
gotoAndPlay(11);
sExplosion.start(0, 1);
} else {
gotoAndPlay(9);
}
}
function setFiringTargetPosition(targetX, targetY) {
targetPosX = targetX;
targetPosY = targetY;
}
function fire() {
var _local2 = levelMC.getProjectile();
var _local3 = {x:_x - 19, y:_y - 16};
_local2.setPos(_local3.x, _local3.y);
_local2.setFireProperties(-420, -30, 1 + ((_y - targetPosY) * 0.32), damage);
trace(((((" tar: " + targetPosY) + " _y: ") + _y) + " diff: ") + (targetPosY - _y));
levelMC.AddProjectileToFired(_local2);
}
function update(deltaTime) {
if (!bDeath) {
moveLeft(deltaTime);
if (_x < fireDistance) {
if (fireRate >= 9) {
fire();
fireRate = 0;
} else {
fireRate = fireRate + deltaTime;
}
}
} else if (isCompleted()) {
levelMC.enemyDied(this);
}
}
var xSpeed = 5;
var healthBase = 5;
var health = Units.Tank.prototype.healthBase;
var fireRate = 0;
var damage = 4;
var fireDistance = 310;
var bDeath = false;
var rotateWeaponDir = 0;
var bRotatedAgainstHill = false;
var targetPosX = 0;
var targetPosY = 0;
}
Symbol 482 MovieClip [__Packages.Units.Heli] Frame 0
class Units.Heli extends MovieClip
{
var _x, _y, CollisionMC, weaponMuzzleMC, _rotation, sExplosion, levelMC, gotoAndPlay, healthbarMC, _currentframe;
function Heli () {
super();
_x = -100;
_y = -100;
CollisionMC._visible = false;
weaponMuzzleMC._visible = false;
_rotation = _rotation - 12;
sExplosion = new Sound();
sExplosion.attachSound("HD_explosion");
}
function init(parentLevelMC) {
levelMC = parentLevelMC;
bDeath = false;
health = healthBase;
gotoAndPlay(1);
healthbarMC._visible = false;
healthbarMC.gotoAndStop(21);
setPos(320, 40 + (Math.random() * 80));
if (Math.random() > 0.5) {
yDir = -1;
} else {
yDir = 1;
}
}
function setPos(newX, newY) {
_x = newX;
_y = newY;
}
function isCompleted() {
return(bDeath && (_currentframe >= 24));
}
function moveLeft(deltaTime) {
if (_x > 140) {
_x = _x - (xSpeed * deltaTime);
} else {
_y = _y + ((yDir * 10) * deltaTime);
if (_y < 40) {
yDir = 1;
_y = 41;
}
if (_y > 130) {
yDir = -1;
_y = 129;
}
}
}
function rotateWeapon(dir) {
rotateWeaponDir = dir;
}
function getHit(instigator) {
healthbarMC._visible = true;
health = health - instigator.damage;
healthbarMC.gotoAndStop(Math.round((20 / healthBase) * health) + 1);
if (health <= 0) {
bDeath = true;
gotoAndPlay(9);
sExplosion.start(0, 1);
} else {
gotoAndPlay(7);
}
}
function setFiringTargetPosition(targetX, targetY) {
targetPosY = targetY;
}
function fire() {
var _local2 = levelMC.getProjectile();
var _local3 = {x:_x - 22, y:_y + 4};
_local2.setPos(_local3.x, _local3.y);
_local2.setFireProperties(-580, (targetPosY - _y) * 3.6, (_y - targetPosY) * 0.1, damage);
levelMC.AddProjectileToFired(_local2);
}
function update(deltaTime) {
if (!bDeath) {
moveLeft(deltaTime);
if (_x < fireDistance) {
if (fireRate >= 2) {
fire();
fireRate = 0;
} else {
fireRate = fireRate + deltaTime;
}
}
} else if (isCompleted()) {
levelMC.enemyDied(this);
}
}
var xSpeed = 20;
var yDir = 1;
var healthBase = 3;
var health = Units.Heli.prototype.healthBase;
var fireRate = 0;
var damage = 2;
var fireDistance = 290;
var bDeath = false;
var rotateWeaponDir = 0;
var targetPosY = 0;
}
Symbol 483 MovieClip [__Packages.Levels.Level4] Frame 0
class Levels.Level4 extends MovieClip
{
var EnemyProjectiles, EnemyProjectilesFired, attachMovie, getNextHighestDepth, SoldierPool, TankPool, HeliPool, waves, playerReference, ActiveUnits;
function Level4 () {
super();
var _local3 = HillStart_X - HillEnd_X;
var _local4 = HillStart_Y - HillEnd_Y;
HeightPerUnitDistance = _local4 / _local3;
createUnits();
EnemyProjectiles = new Array();
EnemyProjectilesFired = new Array();
createEnemyProjetiles();
createWaves();
}
function createEnemyProjetiles() {
var _local3;
var _local2 = 16;
while (_local2 > 0) {
_local3 = new screens.game.Projectile(attachMovie("bullet", "Enemy_bullet_" + _local2, getNextHighestDepth()), this);
EnemyProjectiles.push(_local3);
_local2--;
}
}
function createUnits() {
SoldierPool = new Array();
TankPool = new Array();
HeliPool = new Array();
HeliPool.push(attachMovie("helicopter", "Heli_1", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_2", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_3", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_4", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_5", getNextHighestDepth()));
}
function createWaves() {
waves = new Array(new Array("Heli", "Heli", "Heli"), new Array("Heli", "Heli", "Heli", "Heli", "Heli"));
totalAmountOfWaves = waves.length;
}
function getTotalWaves() {
return(totalAmountOfWaves);
}
function getProjectile() {
return(EnemyProjectiles.pop());
}
function AddProjectileToFired(proj) {
EnemyProjectilesFired.push(proj);
}
function levelComplete() {
return(waveCounter >= waves.length);
}
function startLevel(playerRef) {
playerReference = playerRef;
ActiveUnits = new Array();
}
function spawnNewUnit() {
if (waves[waveCounter] && (waves[waveCounter].length > 0)) {
var _local3 = waves[waveCounter].pop();
var _local2;
if (_local3 == "Soldier") {
_local2 = SoldierPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Tank") {
_local2 = TankPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Heli") {
_local2 = HeliPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
}
_local2.init(this);
ActiveUnits.push(_local2);
}
}
function startNextWave() {
waveCounter++;
Data.screen.updateWavesFeedback(waveCounter + 1, getTotalWaves());
}
function update(deltaTime) {
unitSpawnTimer = unitSpawnTimer + deltaTime;
if (unitSpawnTimer >= unitSpawnDelay) {
spawnNewUnit();
unitSpawnTimer = 0;
} else if (((ActiveUnits.length == 0) && (waves[waveCounter])) && (waves[waveCounter].length == 0)) {
unitSpawnTimer = 0;
startNextWave();
}
var _local2 = ActiveUnits.length - 1;
while (_local2 >= 0) {
ActiveUnits[_local2].update(deltaTime);
_local2--;
}
updateEnemyProjectiles(deltaTime);
}
function IsBeforeStartOfHill(xPos) {
return(xPos > HillStart_X);
}
function getHeightAtPosX(xPos) {
if (IsBeforeStartOfHill(xPos)) {
return(HeightBeforeStart_X);
}
return(HillEnd_Y + ((xPos - HillEnd_X) * HeightPerUnitDistance));
}
function updateEnemyProjectiles(deltaTime) {
var _local2 = EnemyProjectilesFired.length - 1;
while (_local2 >= 0) {
EnemyProjectilesFired[_local2].update(deltaTime);
if (EnemyProjectilesFired[_local2].isCompleted()) {
EnemyProjectilesFired[_local2].setPos(-6, -6);
var _local3 = EnemyProjectilesFired.splice(_local2, 1);
EnemyProjectiles.push(_local3[0]);
_local3 = null;
} else if (EnemyProjectilesFired[_local2].mc.hitTest(playerReference.CollisionMC)) {
playerReference.getHit(EnemyProjectilesFired[_local2]);
EnemyProjectilesFired[_local2].setCompleted();
} else if (EnemyProjectilesFired[_local2]._y > getHeightAtPosX(EnemyProjectilesFired[_local2]._x)) {
EnemyProjectilesFired[_local2].setCompleted();
}
_local2--;
}
}
function enemyDied(enemy) {
var _local3 = 0;
while (_local3 < ActiveUnits.length) {
if (ActiveUnits[_local3] == enemy) {
var _local2 = ActiveUnits.splice(_local3, 1)[0];
if (_local2 instanceof Units.Soldier) {
_local2.setPos(-100, -100);
SoldierPool.push(_local2);
Data.SavedCash = Data.SavedCash + 25;
} else if (_local2 instanceof Units.Tank) {
_local2.setPos(-100, -100);
TankPool.push(_local2);
Data.SavedCash = Data.SavedCash + 125;
} else if (_local2 instanceof Units.Heli) {
_local2.setPos(-100, -100);
HeliPool.push(_local2);
Data.SavedCash = Data.SavedCash + 50;
}
Data.screen.updateCashFeedback();
}
_local3++;
}
}
function hitTestEnemy(target) {
var _local2 = 0;
while (_local2 < ActiveUnits.length) {
if (target.mc.hitTest(ActiveUnits[_local2].CollisionMC)) {
return(ActiveUnits[_local2]);
}
_local2++;
}
return(null);
}
var HillStart_X = 99;
var HillStart_Y = 220;
var HillEnd_X = 50;
var HillEnd_Y = 40;
var HeightBeforeStart_X = 220;
var HeightPerUnitDistance = 0;
var totalAmountOfWaves = 0;
var waveCounter = 0;
var unitSpawnTimer = 0;
var unitSpawnDelay = 2;
}
Symbol 484 MovieClip [__Packages.Levels.Level8] Frame 0
class Levels.Level8 extends MovieClip
{
var EnemyProjectiles, EnemyProjectilesFired, attachMovie, getNextHighestDepth, SoldierPool, TankPool, HeliPool, waves, playerReference, ActiveUnits;
function Level8 () {
super();
var _local3 = HillStart_X - HillEnd_X;
var _local4 = HillStart_Y - HillEnd_Y;
HeightPerUnitDistance = _local4 / _local3;
createUnits();
EnemyProjectiles = new Array();
EnemyProjectilesFired = new Array();
createEnemyProjetiles();
createWaves();
}
function createEnemyProjetiles() {
var _local3;
var _local2 = 16;
while (_local2 > 0) {
_local3 = new screens.game.Projectile(attachMovie("bullet", "Enemy_bullet_" + _local2, getNextHighestDepth()), this);
EnemyProjectiles.push(_local3);
_local2--;
}
}
function createUnits() {
SoldierPool = new Array();
SoldierPool.push(attachMovie("soldier", "soldier_1", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_2", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_3", getNextHighestDepth()));
TankPool = new Array();
TankPool.push(attachMovie("Tank", "Tank_1", getNextHighestDepth()));
TankPool.push(attachMovie("Tank", "Tank_2", getNextHighestDepth()));
TankPool.push(attachMovie("Tank", "Tank_3", getNextHighestDepth()));
HeliPool = new Array();
HeliPool.push(attachMovie("helicopter", "Heli_1", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_2", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_3", getNextHighestDepth()));
}
function createWaves() {
waves = new Array(new Array("Soldier", "Heli", "Heli", "Soldier", "Soldier", "Tank", "Tank"), new Array("Soldier", "Heli", "Soldier", "Tank", "Tank", "Soldier"), new Array("Soldier", "Soldier", "Tank", "Heli", "Soldier", "Heli"), new Array("Heli", "Soldier", "Heli", "Soldier", "Heli", "Tank", "Soldier"));
totalAmountOfWaves = waves.length;
}
function getTotalWaves() {
return(totalAmountOfWaves);
}
function getProjectile() {
return(EnemyProjectiles.pop());
}
function AddProjectileToFired(proj) {
EnemyProjectilesFired.push(proj);
}
function levelComplete() {
return(waveCounter >= waves.length);
}
function startLevel(playerRef) {
playerReference = playerRef;
ActiveUnits = new Array();
}
function spawnNewUnit() {
if (waves[waveCounter] && (waves[waveCounter].length > 0)) {
var _local3 = waves[waveCounter].pop();
var _local2;
if (_local3 == "Soldier") {
_local2 = SoldierPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Tank") {
_local2 = TankPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Heli") {
_local2 = HeliPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
}
_local2.init(this);
ActiveUnits.push(_local2);
}
}
function startNextWave() {
waveCounter++;
Data.screen.updateWavesFeedback(waveCounter + 1, getTotalWaves());
}
function update(deltaTime) {
unitSpawnTimer = unitSpawnTimer + deltaTime;
if (unitSpawnTimer >= unitSpawnDelay) {
spawnNewUnit();
unitSpawnTimer = 0;
} else if (((ActiveUnits.length == 0) && (waves[waveCounter])) && (waves[waveCounter].length == 0)) {
unitSpawnTimer = 0;
startNextWave();
}
var _local2 = ActiveUnits.length - 1;
while (_local2 >= 0) {
ActiveUnits[_local2].update(deltaTime);
_local2--;
}
updateEnemyProjectiles(deltaTime);
}
function IsBeforeStartOfHill(xPos) {
return(xPos > HillStart_X);
}
function getHeightAtPosX(xPos) {
if (IsBeforeStartOfHill(xPos)) {
return(HeightBeforeStart_X);
}
return(HillEnd_Y + ((xPos - HillEnd_X) * HeightPerUnitDistance));
}
function updateEnemyProjectiles(deltaTime) {
var _local2 = EnemyProjectilesFired.length - 1;
while (_local2 >= 0) {
EnemyProjectilesFired[_local2].update(deltaTime);
if (EnemyProjectilesFired[_local2].isCompleted()) {
EnemyProjectilesFired[_local2].setPos(-6, -6);
var _local3 = EnemyProjectilesFired.splice(_local2, 1);
EnemyProjectiles.push(_local3[0]);
_local3 = null;
} else if (EnemyProjectilesFired[_local2].mc.hitTest(playerReference.CollisionMC)) {
playerReference.getHit(EnemyProjectilesFired[_local2]);
EnemyProjectilesFired[_local2].setCompleted();
} else if (EnemyProjectilesFired[_local2]._y > getHeightAtPosX(EnemyProjectilesFired[_local2]._x)) {
EnemyProjectilesFired[_local2].setCompleted();
}
_local2--;
}
}
function enemyDied(enemy) {
var _local3 = 0;
while (_local3 < ActiveUnits.length) {
if (ActiveUnits[_local3] == enemy) {
var _local2 = ActiveUnits.splice(_local3, 1)[0];
if (_local2 instanceof Units.Soldier) {
_local2.setPos(-100, -100);
SoldierPool.push(_local2);
Data.SavedCash = Data.SavedCash + 25;
} else if (_local2 instanceof Units.Tank) {
_local2.setPos(-100, -100);
TankPool.push(_local2);
Data.SavedCash = Data.SavedCash + 125;
} else if (_local2 instanceof Units.Heli) {
_local2.setPos(-100, -100);
HeliPool.push(_local2);
Data.SavedCash = Data.SavedCash + 50;
}
Data.screen.updateCashFeedback();
}
_local3++;
}
}
function hitTestEnemy(target) {
var _local2 = 0;
while (_local2 < ActiveUnits.length) {
if (target.mc.hitTest(ActiveUnits[_local2].CollisionMC)) {
return(ActiveUnits[_local2]);
}
_local2++;
}
return(null);
}
var HillStart_X = 190;
var HillStart_Y = 220;
var HillEnd_X = 40;
var HillEnd_Y = 135;
var HeightBeforeStart_X = 220;
var HeightPerUnitDistance = 0;
var totalAmountOfWaves = 0;
var waveCounter = 0;
var unitSpawnTimer = 0;
var unitSpawnDelay = 1.4;
}
Symbol 485 MovieClip [__Packages.Levels.Level6] Frame 0
class Levels.Level6 extends MovieClip
{
var EnemyProjectiles, EnemyProjectilesFired, attachMovie, getNextHighestDepth, SoldierPool, TankPool, HeliPool, waves, playerReference, ActiveUnits;
function Level6 () {
super();
var _local3 = HillStart_X - HillEnd_X;
var _local4 = HillStart_Y - HillEnd_Y;
HeightPerUnitDistance = _local4 / _local3;
createUnits();
EnemyProjectiles = new Array();
EnemyProjectilesFired = new Array();
createEnemyProjetiles();
createWaves();
}
function createEnemyProjetiles() {
var _local3;
var _local2 = 16;
while (_local2 > 0) {
_local3 = new screens.game.Projectile(attachMovie("bullet", "Enemy_bullet_" + _local2, getNextHighestDepth()), this);
EnemyProjectiles.push(_local3);
_local2--;
}
}
function createUnits() {
SoldierPool = new Array();
SoldierPool.push(attachMovie("soldier", "soldier_1", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_2", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_3", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_4", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_5", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_6", getNextHighestDepth()));
TankPool = new Array();
TankPool.push(attachMovie("Tank", "Tank_1", getNextHighestDepth()));
TankPool.push(attachMovie("Tank", "Tank_2", getNextHighestDepth()));
HeliPool = new Array();
HeliPool.push(attachMovie("helicopter", "Heli_1", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_2", getNextHighestDepth()));
}
function createWaves() {
waves = new Array(new Array("Soldier", "Soldier", "Heli", "Soldier", "Soldier", "Soldier", "Tank"), new Array("Soldier", "Heli", "Soldier", "Soldier", "Soldier", "Heli"), new Array("Soldier", "Soldier", "Heli", "Tank", "Soldier", "Soldier", "Soldier", "Tank"));
totalAmountOfWaves = waves.length;
}
function getTotalWaves() {
return(totalAmountOfWaves);
}
function getProjectile() {
return(EnemyProjectiles.pop());
}
function AddProjectileToFired(proj) {
EnemyProjectilesFired.push(proj);
}
function levelComplete() {
return(waveCounter >= waves.length);
}
function startLevel(playerRef) {
playerReference = playerRef;
ActiveUnits = new Array();
}
function spawnNewUnit() {
if (waves[waveCounter] && (waves[waveCounter].length > 0)) {
var _local3 = waves[waveCounter].pop();
var _local2;
if (_local3 == "Soldier") {
_local2 = SoldierPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Tank") {
_local2 = TankPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Heli") {
_local2 = HeliPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
}
_local2.init(this);
ActiveUnits.push(_local2);
}
}
function startNextWave() {
waveCounter++;
Data.screen.updateWavesFeedback(waveCounter + 1, getTotalWaves());
}
function update(deltaTime) {
unitSpawnTimer = unitSpawnTimer + deltaTime;
if (unitSpawnTimer >= unitSpawnDelay) {
spawnNewUnit();
unitSpawnTimer = 0;
} else if (((ActiveUnits.length == 0) && (waves[waveCounter])) && (waves[waveCounter].length == 0)) {
unitSpawnTimer = 0;
startNextWave();
}
var _local2 = ActiveUnits.length - 1;
while (_local2 >= 0) {
ActiveUnits[_local2].update(deltaTime);
_local2--;
}
updateEnemyProjectiles(deltaTime);
}
function IsBeforeStartOfHill(xPos) {
return(xPos > HillStart_X);
}
function getHeightAtPosX(xPos) {
if (IsBeforeStartOfHill(xPos)) {
return(HeightBeforeStart_X);
}
return(HillEnd_Y + ((xPos - HillEnd_X) * HeightPerUnitDistance));
}
function updateEnemyProjectiles(deltaTime) {
var _local2 = EnemyProjectilesFired.length - 1;
while (_local2 >= 0) {
EnemyProjectilesFired[_local2].update(deltaTime);
if (EnemyProjectilesFired[_local2].isCompleted()) {
EnemyProjectilesFired[_local2].setPos(-6, -6);
var _local3 = EnemyProjectilesFired.splice(_local2, 1);
EnemyProjectiles.push(_local3[0]);
_local3 = null;
} else if (EnemyProjectilesFired[_local2].mc.hitTest(playerReference.CollisionMC)) {
playerReference.getHit(EnemyProjectilesFired[_local2]);
EnemyProjectilesFired[_local2].setCompleted();
} else if (EnemyProjectilesFired[_local2]._y > getHeightAtPosX(EnemyProjectilesFired[_local2]._x)) {
EnemyProjectilesFired[_local2].setCompleted();
}
_local2--;
}
}
function enemyDied(enemy) {
var _local3 = 0;
while (_local3 < ActiveUnits.length) {
if (ActiveUnits[_local3] == enemy) {
var _local2 = ActiveUnits.splice(_local3, 1)[0];
if (_local2 instanceof Units.Soldier) {
_local2.setPos(-100, -100);
SoldierPool.push(_local2);
Data.SavedCash = Data.SavedCash + 25;
} else if (_local2 instanceof Units.Tank) {
_local2.setPos(-100, -100);
TankPool.push(_local2);
Data.SavedCash = Data.SavedCash + 125;
} else if (_local2 instanceof Units.Heli) {
_local2.setPos(-100, -100);
HeliPool.push(_local2);
Data.SavedCash = Data.SavedCash + 50;
}
Data.screen.updateCashFeedback();
}
_local3++;
}
}
function hitTestEnemy(target) {
var _local2 = 0;
while (_local2 < ActiveUnits.length) {
if (target.mc.hitTest(ActiveUnits[_local2].CollisionMC)) {
return(ActiveUnits[_local2]);
}
_local2++;
}
return(null);
}
var HillStart_X = 190;
var HillStart_Y = 220;
var HillEnd_X = 40;
var HillEnd_Y = 135;
var HeightBeforeStart_X = 220;
var HeightPerUnitDistance = 0;
var totalAmountOfWaves = 0;
var waveCounter = 0;
var unitSpawnTimer = 0;
var unitSpawnDelay = 3;
}
Symbol 486 MovieClip [__Packages.Levels.Level2] Frame 0
class Levels.Level2 extends MovieClip
{
var EnemyProjectiles, EnemyProjectilesFired, attachMovie, getNextHighestDepth, SoldierPool, TankPool, HeliPool, waves, playerReference, ActiveUnits;
function Level2 () {
super();
var _local3 = HillStart_X - HillEnd_X;
var _local4 = HillStart_Y - HillEnd_Y;
HeightPerUnitDistance = _local4 / _local3;
createUnits();
EnemyProjectiles = new Array();
EnemyProjectilesFired = new Array();
createEnemyProjetiles();
createWaves();
}
function createEnemyProjetiles() {
var _local3;
var _local2 = 16;
while (_local2 > 0) {
_local3 = new screens.game.Projectile(attachMovie("bullet", "Enemy_bullet_" + _local2, getNextHighestDepth()), this);
EnemyProjectiles.push(_local3);
_local2--;
}
}
function createUnits() {
SoldierPool = new Array();
SoldierPool.push(attachMovie("soldier", "soldier_1", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_2", getNextHighestDepth()));
TankPool = new Array();
TankPool.push(attachMovie("Tank", "Tank_1", getNextHighestDepth()));
TankPool.push(attachMovie("Tank", "Tank_2", getNextHighestDepth()));
HeliPool = new Array();
HeliPool.push(attachMovie("helicopter", "Heli_1", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_2", getNextHighestDepth()));
}
function createWaves() {
waves = new Array(new Array("Soldier", "Heli", "Heli", "Tank", "Soldier"), new Array("Heli", "Tank", "Tank"));
totalAmountOfWaves = waves.length;
}
function getTotalWaves() {
return(totalAmountOfWaves);
}
function getProjectile() {
return(EnemyProjectiles.pop());
}
function AddProjectileToFired(proj) {
EnemyProjectilesFired.push(proj);
}
function levelComplete() {
return(waveCounter >= waves.length);
}
function startLevel(playerRef) {
playerReference = playerRef;
ActiveUnits = new Array();
}
function spawnNewUnit() {
if (waves[waveCounter] && (waves[waveCounter].length > 0)) {
var _local3 = waves[waveCounter].pop();
var _local2;
if (_local3 == "Soldier") {
_local2 = SoldierPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Tank") {
_local2 = TankPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Heli") {
_local2 = HeliPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
}
_local2.init(this);
ActiveUnits.push(_local2);
}
}
function startNextWave() {
waveCounter++;
Data.screen.updateWavesFeedback(waveCounter + 1, getTotalWaves());
}
function update(deltaTime) {
unitSpawnTimer = unitSpawnTimer + deltaTime;
if (unitSpawnTimer >= unitSpawnDelay) {
spawnNewUnit();
unitSpawnTimer = 0;
} else if (((ActiveUnits.length == 0) && (waves[waveCounter])) && (waves[waveCounter].length == 0)) {
unitSpawnTimer = 0;
startNextWave();
}
var _local2 = ActiveUnits.length - 1;
while (_local2 >= 0) {
ActiveUnits[_local2].update(deltaTime);
_local2--;
}
updateEnemyProjectiles(deltaTime);
}
function IsBeforeStartOfHill(xPos) {
return(xPos > HillStart_X);
}
function getHeightAtPosX(xPos) {
if (IsBeforeStartOfHill(xPos)) {
return(HeightBeforeStart_X);
}
return(HillEnd_Y + ((xPos - HillEnd_X) * HeightPerUnitDistance));
}
function updateEnemyProjectiles(deltaTime) {
var _local2 = EnemyProjectilesFired.length - 1;
while (_local2 >= 0) {
EnemyProjectilesFired[_local2].update(deltaTime);
if (EnemyProjectilesFired[_local2].isCompleted()) {
EnemyProjectilesFired[_local2].setPos(-6, -6);
var _local3 = EnemyProjectilesFired.splice(_local2, 1);
EnemyProjectiles.push(_local3[0]);
_local3 = null;
} else if (EnemyProjectilesFired[_local2].mc.hitTest(playerReference.CollisionMC)) {
playerReference.getHit(EnemyProjectilesFired[_local2]);
EnemyProjectilesFired[_local2].setCompleted();
} else if (EnemyProjectilesFired[_local2]._y > getHeightAtPosX(EnemyProjectilesFired[_local2]._x)) {
EnemyProjectilesFired[_local2].setCompleted();
}
_local2--;
}
}
function enemyDied(enemy) {
var _local3 = 0;
while (_local3 < ActiveUnits.length) {
if (ActiveUnits[_local3] == enemy) {
var _local2 = ActiveUnits.splice(_local3, 1)[0];
if (_local2 instanceof Units.Soldier) {
_local2.setPos(-100, -100);
SoldierPool.push(_local2);
Data.SavedCash = Data.SavedCash + 25;
} else if (_local2 instanceof Units.Tank) {
_local2.setPos(-100, -100);
TankPool.push(_local2);
Data.SavedCash = Data.SavedCash + 125;
} else if (_local2 instanceof Units.Heli) {
_local2.setPos(-100, -100);
HeliPool.push(_local2);
Data.SavedCash = Data.SavedCash + 50;
}
Data.screen.updateCashFeedback();
}
_local3++;
}
}
function hitTestEnemy(target) {
var _local2 = 0;
while (_local2 < ActiveUnits.length) {
if (target.mc.hitTest(ActiveUnits[_local2].CollisionMC)) {
return(ActiveUnits[_local2]);
}
_local2++;
}
return(null);
}
var HillStart_X = 190;
var HillStart_Y = 220;
var HillEnd_X = 40;
var HillEnd_Y = 135;
var HeightBeforeStart_X = 220;
var HeightPerUnitDistance = 0;
var totalAmountOfWaves = 0;
var waveCounter = 0;
var unitSpawnTimer = 0;
var unitSpawnDelay = 4;
}
Symbol 487 MovieClip [__Packages.Levels.Level5] Frame 0
class Levels.Level5 extends MovieClip
{
var EnemyProjectiles, EnemyProjectilesFired, attachMovie, getNextHighestDepth, SoldierPool, TankPool, HeliPool, waves, playerReference, ActiveUnits;
function Level5 () {
super();
var _local3 = HillStart_X - HillEnd_X;
var _local4 = HillStart_Y - HillEnd_Y;
HeightPerUnitDistance = _local4 / _local3;
createUnits();
EnemyProjectiles = new Array();
EnemyProjectilesFired = new Array();
createEnemyProjetiles();
createWaves();
}
function createEnemyProjetiles() {
var _local3;
var _local2 = 16;
while (_local2 > 0) {
_local3 = new screens.game.Projectile(attachMovie("bullet", "Enemy_bullet_" + _local2, getNextHighestDepth()), this);
EnemyProjectiles.push(_local3);
_local2--;
}
}
function createUnits() {
SoldierPool = new Array();
SoldierPool.push(attachMovie("soldier", "soldier_1", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_2", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_3", getNextHighestDepth()));
TankPool = new Array();
TankPool.push(attachMovie("Tank", "Tank_1", getNextHighestDepth()));
TankPool.push(attachMovie("Tank", "Tank_2", getNextHighestDepth()));
HeliPool = new Array();
HeliPool.push(attachMovie("helicopter", "Heli_1", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_2", getNextHighestDepth()));
}
function createWaves() {
waves = new Array(new Array("Heli", "Heli", "Tank", "Tank"), new Array("Heli", "Heli", "Soldier", "Soldier", "Soldier"), new Array("Tank", "Soldier", "Soldier", "Heli"));
totalAmountOfWaves = waves.length;
}
function getTotalWaves() {
return(totalAmountOfWaves);
}
function getProjectile() {
return(EnemyProjectiles.pop());
}
function AddProjectileToFired(proj) {
EnemyProjectilesFired.push(proj);
}
function levelComplete() {
return(waveCounter >= waves.length);
}
function startLevel(playerRef) {
playerReference = playerRef;
ActiveUnits = new Array();
}
function spawnNewUnit() {
if (waves[waveCounter] && (waves[waveCounter].length > 0)) {
var _local3 = waves[waveCounter].pop();
var _local2;
if (_local3 == "Soldier") {
_local2 = SoldierPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Tank") {
_local2 = TankPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Heli") {
_local2 = HeliPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
}
_local2.init(this);
ActiveUnits.push(_local2);
}
}
function startNextWave() {
waveCounter++;
Data.screen.updateWavesFeedback(waveCounter + 1, getTotalWaves());
}
function update(deltaTime) {
unitSpawnTimer = unitSpawnTimer + deltaTime;
if (unitSpawnTimer >= unitSpawnDelay) {
spawnNewUnit();
unitSpawnTimer = 0;
} else if (((ActiveUnits.length == 0) && (waves[waveCounter])) && (waves[waveCounter].length == 0)) {
unitSpawnTimer = 0;
startNextWave();
}
var _local2 = ActiveUnits.length - 1;
while (_local2 >= 0) {
ActiveUnits[_local2].update(deltaTime);
_local2--;
}
updateEnemyProjectiles(deltaTime);
}
function IsBeforeStartOfHill(xPos) {
return(xPos > HillStart_X);
}
function getHeightAtPosX(xPos) {
if (IsBeforeStartOfHill(xPos)) {
return(HeightBeforeStart_X);
}
return(HillEnd_Y + ((xPos - HillEnd_X) * HeightPerUnitDistance));
}
function updateEnemyProjectiles(deltaTime) {
var _local2 = EnemyProjectilesFired.length - 1;
while (_local2 >= 0) {
EnemyProjectilesFired[_local2].update(deltaTime);
if (EnemyProjectilesFired[_local2].isCompleted()) {
EnemyProjectilesFired[_local2].setPos(-6, -6);
var _local3 = EnemyProjectilesFired.splice(_local2, 1);
EnemyProjectiles.push(_local3[0]);
_local3 = null;
} else if (EnemyProjectilesFired[_local2].mc.hitTest(playerReference.CollisionMC)) {
playerReference.getHit(EnemyProjectilesFired[_local2]);
EnemyProjectilesFired[_local2].setCompleted();
} else if (EnemyProjectilesFired[_local2]._y > getHeightAtPosX(EnemyProjectilesFired[_local2]._x)) {
EnemyProjectilesFired[_local2].setCompleted();
}
_local2--;
}
}
function enemyDied(enemy) {
var _local3 = 0;
while (_local3 < ActiveUnits.length) {
if (ActiveUnits[_local3] == enemy) {
var _local2 = ActiveUnits.splice(_local3, 1)[0];
if (_local2 instanceof Units.Soldier) {
_local2.setPos(-100, -100);
SoldierPool.push(_local2);
Data.SavedCash = Data.SavedCash + 25;
} else if (_local2 instanceof Units.Tank) {
_local2.setPos(-100, -100);
TankPool.push(_local2);
Data.SavedCash = Data.SavedCash + 125;
} else if (_local2 instanceof Units.Heli) {
_local2.setPos(-100, -100);
HeliPool.push(_local2);
Data.SavedCash = Data.SavedCash + 50;
}
Data.screen.updateCashFeedback();
}
_local3++;
}
}
function hitTestEnemy(target) {
var _local2 = 0;
while (_local2 < ActiveUnits.length) {
if (target.mc.hitTest(ActiveUnits[_local2].CollisionMC)) {
return(ActiveUnits[_local2]);
}
_local2++;
}
return(null);
}
var HillStart_X = 235;
var HillStart_Y = 221;
var HillEnd_X = 61;
var HillEnd_Y = 185;
var HeightBeforeStart_X = 221;
var HeightPerUnitDistance = 0;
var totalAmountOfWaves = 0;
var waveCounter = 0;
var unitSpawnTimer = 0;
var unitSpawnDelay = 3;
}
Symbol 488 MovieClip [__Packages.Levels.Level3] Frame 0
class Levels.Level3 extends MovieClip
{
var EnemyProjectiles, EnemyProjectilesFired, attachMovie, getNextHighestDepth, SoldierPool, TankPool, HeliPool, waves, playerReference, ActiveUnits;
function Level3 () {
super();
var _local3 = HillStart_X - HillEnd_X;
var _local4 = HillStart_Y - HillEnd_Y;
HeightPerUnitDistance = _local4 / _local3;
createUnits();
EnemyProjectiles = new Array();
EnemyProjectilesFired = new Array();
createEnemyProjetiles();
createWaves();
}
function createEnemyProjetiles() {
var _local3;
var _local2 = 16;
while (_local2 > 0) {
_local3 = new screens.game.Projectile(attachMovie("bullet", "Enemy_bullet_" + _local2, getNextHighestDepth()), this);
EnemyProjectiles.push(_local3);
_local2--;
}
}
function createUnits() {
SoldierPool = new Array();
SoldierPool.push(attachMovie("soldier", "soldier_1", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_2", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_3", getNextHighestDepth()));
TankPool = new Array();
TankPool.push(attachMovie("Tank", "Tank_1", getNextHighestDepth()));
TankPool.push(attachMovie("Tank", "Tank_2", getNextHighestDepth()));
HeliPool = new Array();
HeliPool.push(attachMovie("helicopter", "Heli_1", getNextHighestDepth()));
HeliPool.push(attachMovie("helicopter", "Heli_2", getNextHighestDepth()));
}
function createWaves() {
waves = new Array(new Array("Heli", "Tank", "Soldier", "Soldier", "Soldier"), new Array("Heli", "Soldier", "Heli", "Tank", "Tank"));
totalAmountOfWaves = waves.length;
}
function getTotalWaves() {
return(totalAmountOfWaves);
}
function getProjectile() {
return(EnemyProjectiles.pop());
}
function AddProjectileToFired(proj) {
EnemyProjectilesFired.push(proj);
}
function levelComplete() {
return(waveCounter >= waves.length);
}
function startLevel(playerRef) {
playerReference = playerRef;
ActiveUnits = new Array();
}
function spawnNewUnit() {
if (waves[waveCounter] && (waves[waveCounter].length > 0)) {
var _local3 = waves[waveCounter].pop();
var _local2;
if (_local3 == "Soldier") {
_local2 = SoldierPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Tank") {
_local2 = TankPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Heli") {
_local2 = HeliPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
}
_local2.init(this);
ActiveUnits.push(_local2);
}
}
function startNextWave() {
waveCounter++;
Data.screen.updateWavesFeedback(waveCounter + 1, getTotalWaves());
}
function update(deltaTime) {
unitSpawnTimer = unitSpawnTimer + deltaTime;
if (unitSpawnTimer >= unitSpawnDelay) {
spawnNewUnit();
unitSpawnTimer = 0;
} else if (((ActiveUnits.length == 0) && (waves[waveCounter])) && (waves[waveCounter].length == 0)) {
unitSpawnTimer = 0;
startNextWave();
}
var _local2 = ActiveUnits.length - 1;
while (_local2 >= 0) {
ActiveUnits[_local2].update(deltaTime);
_local2--;
}
updateEnemyProjectiles(deltaTime);
}
function IsBeforeStartOfHill(xPos) {
return(xPos > HillStart_X);
}
function getHeightAtPosX(xPos) {
if (IsBeforeStartOfHill(xPos)) {
return(HeightBeforeStart_X);
}
return(HillEnd_Y + ((xPos - HillEnd_X) * HeightPerUnitDistance));
}
function updateEnemyProjectiles(deltaTime) {
var _local2 = EnemyProjectilesFired.length - 1;
while (_local2 >= 0) {
EnemyProjectilesFired[_local2].update(deltaTime);
if (EnemyProjectilesFired[_local2].isCompleted()) {
EnemyProjectilesFired[_local2].setPos(-6, -6);
var _local3 = EnemyProjectilesFired.splice(_local2, 1);
EnemyProjectiles.push(_local3[0]);
_local3 = null;
} else if (EnemyProjectilesFired[_local2].mc.hitTest(playerReference.CollisionMC)) {
playerReference.getHit(EnemyProjectilesFired[_local2]);
EnemyProjectilesFired[_local2].setCompleted();
} else if (EnemyProjectilesFired[_local2]._y > getHeightAtPosX(EnemyProjectilesFired[_local2]._x)) {
EnemyProjectilesFired[_local2].setCompleted();
}
_local2--;
}
}
function enemyDied(enemy) {
var _local3 = 0;
while (_local3 < ActiveUnits.length) {
if (ActiveUnits[_local3] == enemy) {
var _local2 = ActiveUnits.splice(_local3, 1)[0];
if (_local2 instanceof Units.Soldier) {
_local2.setPos(-100, -100);
SoldierPool.push(_local2);
Data.SavedCash = Data.SavedCash + 25;
} else if (_local2 instanceof Units.Tank) {
_local2.setPos(-100, -100);
TankPool.push(_local2);
Data.SavedCash = Data.SavedCash + 125;
} else if (_local2 instanceof Units.Heli) {
_local2.setPos(-100, -100);
HeliPool.push(_local2);
Data.SavedCash = Data.SavedCash + 50;
}
Data.screen.updateCashFeedback();
}
_local3++;
}
}
function hitTestEnemy(target) {
var _local2 = 0;
while (_local2 < ActiveUnits.length) {
if (target.mc.hitTest(ActiveUnits[_local2].CollisionMC)) {
return(ActiveUnits[_local2]);
}
_local2++;
}
return(null);
}
var HillStart_X = 235;
var HillStart_Y = 221;
var HillEnd_X = 61;
var HillEnd_Y = 185;
var HeightBeforeStart_X = 221;
var HeightPerUnitDistance = 0;
var totalAmountOfWaves = 0;
var waveCounter = 0;
var unitSpawnTimer = 0;
var unitSpawnDelay = 3;
}
Symbol 489 MovieClip [__Packages.Levels.Level1] Frame 0
class Levels.Level1 extends MovieClip
{
var EnemyProjectiles, EnemyProjectilesFired, attachMovie, getNextHighestDepth, SoldierPool, TankPool, HeliPool, waves, playerReference, ActiveUnits, HowToPlayMC;
function Level1 () {
super();
var _local3 = HillStart_X - HillEnd_X;
var _local4 = HillStart_Y - HillEnd_Y;
HeightPerUnitDistance = _local4 / _local3;
createUnits();
EnemyProjectiles = new Array();
EnemyProjectilesFired = new Array();
createEnemyProjetiles();
createWaves();
}
function createEnemyProjetiles() {
var _local3;
var _local2 = 16;
while (_local2 > 0) {
_local3 = new screens.game.Projectile(attachMovie("bullet", "Enemy_bullet_" + _local2, getNextHighestDepth()), this);
EnemyProjectiles.push(_local3);
_local2--;
}
}
function createUnits() {
SoldierPool = new Array();
SoldierPool.push(attachMovie("soldier", "soldier_1", getNextHighestDepth()));
SoldierPool.push(attachMovie("soldier", "soldier_2", getNextHighestDepth()));
TankPool = new Array();
TankPool.push(attachMovie("Tank", "Tank_1", getNextHighestDepth()));
HeliPool = new Array();
HeliPool.push(attachMovie("helicopter", "Heli_1", getNextHighestDepth()));
}
function createWaves() {
waves = new Array(new Array("Soldier", "Soldier"), new Array("Heli"), new Array("Tank"));
totalAmountOfWaves = waves.length;
}
function getTotalWaves() {
return(totalAmountOfWaves);
}
function getProjectile() {
return(EnemyProjectiles.pop());
}
function AddProjectileToFired(proj) {
EnemyProjectilesFired.push(proj);
}
function levelComplete() {
return(waveCounter >= waves.length);
}
function startLevel(playerRef) {
playerReference = playerRef;
ActiveUnits = new Array();
}
function spawnNewUnit() {
if (waves[waveCounter] && (waves[waveCounter].length > 0)) {
var _local3 = waves[waveCounter].pop();
var _local2;
if (_local3 == "Soldier") {
_local2 = SoldierPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Tank") {
_local2 = TankPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
} else if (_local3 == "Heli") {
_local2 = HeliPool.pop();
_local2.setFiringTargetPosition(playerReference.playerMC._x, playerReference.playerMC._y);
}
_local2.init(this);
ActiveUnits.push(_local2);
}
}
function startNextWave() {
waveCounter++;
Data.screen.updateWavesFeedback(waveCounter + 1, getTotalWaves());
}
function update(deltaTime) {
unitSpawnTimer = unitSpawnTimer + deltaTime;
if (unitSpawnTimer >= unitSpawnDelay) {
spawnNewUnit();
unitSpawnTimer = 0;
} else if (((ActiveUnits.length == 0) && (waves[waveCounter])) && (waves[waveCounter].length == 0)) {
unitSpawnTimer = unitSpawnDelay;
startNextWave();
}
var _local2 = ActiveUnits.length - 1;
while (_local2 >= 0) {
ActiveUnits[_local2].update(deltaTime);
_local2--;
}
updateEnemyProjectiles(deltaTime);
if ((hideHowToPlay <= 0) && (HowToPlayMC._visible)) {
HowToPlayMC._visible = false;
} else {
hideHowToPlay = hideHowToPlay - deltaTime;
}
}
function IsBeforeStartOfHill(xPos) {
return(xPos > HillStart_X);
}
function getHeightAtPosX(xPos) {
if (IsBeforeStartOfHill(xPos)) {
return(HeightBeforeStart_X);
}
return(HillEnd_Y + ((xPos - HillEnd_X) * HeightPerUnitDistance));
}
function updateEnemyProjectiles(deltaTime) {
var _local2 = EnemyProjectilesFired.length - 1;
while (_local2 >= 0) {
EnemyProjectilesFired[_local2].update(deltaTime);
if (EnemyProjectilesFired[_local2].isCompleted()) {
EnemyProjectilesFired[_local2].setPos(-6, -6);
var _local3 = EnemyProjectilesFired.splice(_local2, 1);
EnemyProjectiles.push(_local3[0]);
_local3 = null;
} else if (EnemyProjectilesFired[_local2].mc.hitTest(playerReference.CollisionMC)) {
playerReference.getHit(EnemyProjectilesFired[_local2]);
EnemyProjectilesFired[_local2].setCompleted();
} else if (EnemyProjectilesFired[_local2]._y > getHeightAtPosX(EnemyProjectilesFired[_local2]._x)) {
EnemyProjectilesFired[_local2].setCompleted();
}
_local2--;
}
}
function enemyDied(enemy) {
var _local3 = 0;
while (_local3 < ActiveUnits.length) {
if (ActiveUnits[_local3] == enemy) {
var _local2 = ActiveUnits.splice(_local3, 1)[0];
if (_local2 instanceof Units.Soldier) {
_local2.setPos(-100, -100);
SoldierPool.push(_local2);
Data.SavedCash = Data.SavedCash + 25;
} else if (_local2 instanceof Units.Tank) {
_local2.setPos(-100, -100);
TankPool.push(_local2);
Data.SavedCash = Data.SavedCash + 125;
} else if (_local2 instanceof Units.Heli) {
_local2.setPos(-100, -100);
HeliPool.push(_local2);
Data.SavedCash = Data.SavedCash + 50;
}
Data.screen.updateCashFeedback();
}
_local3++;
}
}
function hitTestEnemy(target) {
var _local2 = 0;
while (_local2 < ActiveUnits.length) {
if (target.mc.hitTest(ActiveUnits[_local2].CollisionMC)) {
return(ActiveUnits[_local2]);
}
_local2++;
}
return(null);
}
var HillStart_X = 235;
var HillStart_Y = 221;
var HillEnd_X = 61;
var HillEnd_Y = 185;
var HeightBeforeStart_X = 221;
var HeightPerUnitDistance = 0;
var totalAmountOfWaves = 0;
var waveCounter = 0;
var unitSpawnTimer = 0;
var unitSpawnDelay = 4;
var hideHowToPlay = 4;
}
Symbol 490 MovieClip [__Packages.CMovieClip] Frame 0
class CMovieClip extends MovieClip
{
var stop, xPos, _x, yPos, _y, xScale, _xscale, yScale, _yscale, cFrame, _currentframe, tFrames, _totalframes, alpha, _alpha, gotoAndStop;
function CMovieClip () {
super();
stop();
xPos = _x;
yPos = _y;
xScale = _xscale;
yScale = _yscale;
cFrame = _currentframe;
tFrames = _totalframes;
alpha = _alpha;
}
function next() {
cFrame++;
}
function loopNext() {
cFrame++;
if (cFrame > tFrames) {
cFrame = 1;
}
}
function update() {
_x = xPos;
_y = yPos;
_xscale = xScale;
_yscale = yScale;
_alpha = alpha;
gotoAndStop(cFrame);
}
}
Symbol 491 MovieClip [__Packages.Game] Frame 0
class Game extends MovieClip
{
var input, screen, submitter, delegateSubmitterFailed, delegateSubmitterReady;
function Game () {
super();
Data.initSO();
Localisation.init();
Data.screenMcHolder = _root.createEmptyMovieClip("screenMcHolder", 0);
Data.inputMcHolder = _root.createEmptyMovieClip("inputMcHolder", 1);
input = new Input();
Data.input = input;
Data.gameRoot = this;
showScreen("Branding");
Data.screen = screen;
var _local4 = new Object();
_local4.onResize = mx.utils.Delegate.create(this, position);
Stage.addListener(_local4);
setupAwards();
}
function setupAwards() {
_root.bAward1 = false;
_root.bAward2 = false;
_root.bAward3 = false;
_root.bAward4 = false;
_root.bAward5 = false;
}
function getAwards(nr) {
if ((_root && (!_root.bAward1)) && (nr == 1)) {
if (_root.proxyInstance) {
_root.proxyInstance.submitGrantAward("award1");
}
_root.bAward1 = true;
} else if ((_root && (!_root.bAward2)) && (nr == 2)) {
if (_root.proxyInstance) {
_root.proxyInstance.submitGrantAward("award2");
}
_root.bAward2 = true;
} else if ((_root && (!_root.bAward3)) && (nr == 3)) {
if (_root.proxyInstance) {
_root.proxyInstance.submitGrantAward("award3");
}
_root.bAward3 = true;
} else if ((_root && (!_root.bAward4)) && (nr == 4)) {
if (_root.proxyInstance) {
_root.proxyInstance.submitGrantAward("award4");
}
_root.bAward4 = true;
} else if ((_root && (!_root.bAward5)) && (nr == 5)) {
if (_root.proxyInstance) {
_root.proxyInstance.submitGrantAward("award5");
}
_root.bAward5 = true;
}
}
function initSubmitter(proxyInstance) {
trace("init Game with spil submitterProxy");
submitter = proxyInstance;
delegateSubmitterFailed = mx.utils.Delegate.create(this, SubmitterFailedToLoad);
submitter.addEventListener("LoadingFailed", delegateSubmitterFailed);
delegateSubmitterReady = mx.utils.Delegate.create(this, SubmitterIsReady);
submitter.addEventListener("SubmitterLoadedSuccesfull", delegateSubmitterReady);
submitter.setLoader(_root, "Hill_Defender", "Hill-Defender.html", 0, "normal", "", 0, 0, 1, true, 1);
}
function SubmitterIsReady(target_mc) {
trace("Spil Submitter component initialised and ready");
submitter.removeEventListener("HyScorSubmitterLoaded", delegateSubmitterReady);
submitter.removeEventListener("LoadingFailed", delegateSubmitterFailed);
}
function SubmitterFailedToLoad() {
trace("Spil Submitter component failed to load");
submitter.removeEventListener("HyScorSubmitterLoaded", delegateSubmitterReady);
submitter.removeEventListener("LoadingFailed", delegateSubmitterFailed);
}
function showScreen(s) {
switch (s) {
case "BrandingLanguageSelect" :
screen = new screens.branding.LanguageSelectScreen();
break;
case "Branding" :
showScreen("Main");
break;
case "Title" :
screen = new screens.menu.MainMenuScreen();
break;
case "Main" :
screen = new screens.menu.MainMenuScreen();
break;
case "Game" :
newGame();
break;
case "GameOverFeedback1" :
screen = new screens.menu.GameOverFeedback1Screen();
break;
case "GameOver" :
screen = new screens.menu.GameOverScreen();
break;
case "SubmitScore" :
screen = new screens.menu.SubmitScoreScreen();
break;
case "GameOverHighscores" :
screen = new screens.menu.HighscoresScreen();
break;
case "Highscores" :
break;
case "Upgrade" :
screen = new screens.menu.UpgradeScreen();
break;
case "Continue" :
ContinueGame();
}
}
function position() {
Data.screen.positionScreen();
Data.input.positionSoftKeys();
}
function newGame() {
Data.bSavedGameData = false;
Data.SavedLevel = 0;
Data.SavedHealth = 40;
Data.SavedUpgradeReload = 0;
Data.SavedUpgradeDamage = 0;
Data.SavedUpgradeHealth = 0;
Data.SavedCash = 525;
Data.updateSO();
screen = new screens.game.GameScreen();
}
function ContinueGame() {
screen = new screens.game.GameScreen();
}
function quit() {
}
}
Symbol 492 MovieClip [__Packages.Input] Frame 0
class Input extends MovieClip
{
var mc;
function Input () {
super();
mc = Data.inputMcHolder.attachMovie("InputMc", "mc", 0);
mc.select.tabEnabled = false;
mc.soft1.tabEnabled = false;
mc.soft2.tabEnabled = false;
mc.select._visible = false;
var _local3 = new Object();
_local3.onKeyDown = mx.utils.Delegate.create(this, keyPressed);
_local3.onKeyUp = mx.utils.Delegate.create(this, keyReleased);
Key.addListener(_local3);
positionSoftKeys();
}
function keyPressed() {
var _local1 = Key.getCode();
if (Data.screenRotation == 0) {
switch (_local1) {
case 38 :
case 50 :
Data.screen.upKeyPressed();
Data.screen.prevKeyPressed();
break;
case 37 :
case 52 :
Data.screen.leftKeyPressed();
Data.screen.prevKeyPressed();
break;
case 40 :
case 56 :
Data.screen.downKeyPressed();
Data.screen.nextKeyPressed();
break;
case 39 :
case 54 :
Data.screen.rightKeyPressed();
Data.screen.nextKeyPressed();
break;
case 80 :
case 27 :
Data.screen.PauseToggle();
}
}
if (Data.screenRotation == -90) {
switch (_local1) {
case 39 :
case 54 :
Data.screen.upKeyPressed();
Data.screen.prevKeyPressed();
break;
case 38 :
case 50 :
Data.screen.leftKeyPressed();
Data.screen.prevKeyPressed();
break;
case 37 :
case 52 :
Data.screen.downKeyPressed();
Data.screen.nextKeyPressed();
break;
case 40 :
case 56 :
Data.screen.rightKeyPressed();
Data.screen.nextKeyPressed();
break;
case 80 :
case 27 :
Data.screen.PauseToggle();
}
}
switch (_local1) {
case ExtendedKey.SOFT1 :
case 56 :
Data.screen.softKey1Pressed();
break;
case ExtendedKey.SOFT2 :
case 51 :
Data.screen.softKey2Pressed();
break;
case 13 :
case 53 :
Data.screen.selectKeyPressed();
}
}
function keyReleased() {
var _local1 = Key.getCode();
if (Data.screenRotation == 0) {
switch (_local1) {
case 38 :
case 50 :
Data.screen.upKeyReleased();
Data.screen.prevKeyReleased();
break;
case 37 :
case 52 :
Data.screen.leftKeyReleased();
Data.screen.prevKeyReleased();
break;
case 40 :
case 56 :
Data.screen.downKeyReleased();
Data.screen.nextKeyReleased();
break;
case 39 :
case 54 :
Data.screen.rightKeyReleased();
Data.screen.nextKeyReleased();
break;
case 80 :
case 27 :
Data.screen.PauseToggle();
}
}
if (Data.screenRotation == -90) {
switch (_local1) {
case 39 :
case 54 :
Data.screen.upKeyReleased();
Data.screen.prevKeyReleased();
break;
case 38 :
case 50 :
Data.screen.leftKeyReleased();
Data.screen.prevKeyReleased();
break;
case 37 :
case 52 :
Data.screen.downKeyReleased();
Data.screen.nextKeyReleased();
break;
case 40 :
case 56 :
Data.screen.rightKeyReleased();
Data.screen.nextKeyReleased();
break;
case 80 :
case 27 :
Data.screen.PauseToggle();
}
}
switch (_local1) {
case ExtendedKey.SOFT1 :
case 56 :
Data.screen.softKey1Released();
break;
case ExtendedKey.SOFT2 :
case 51 :
Data.screen.softKey2Released();
break;
case 13 :
case 53 :
Data.screen.selectKeyReleased();
}
}
function setSoftKeys(sl1, sl2, sl) {
}
function positionSoftKeys() {
var _local2 = 1;
if (System.capabilities.hasMouse != undefined) {
}
if ((System.capabilities.hasStylus || (System.capabilities.hasMouse)) || (System.capabilities.hasMouse == undefined)) {
if (Data.screenMcHolder.mc.btn_exit) {
Data.screenMcHolder.mc.btn_exit.onRelease = Data.screen.softKey2Pressed;
}
} else if (Data.screenMcHolder.mc.btn_exit) {
Data.screenMcHolder.mc.btn_exit._visible = false;
}
if (_local2 == 3) {
mc.soft1._x = Stage.width - 69;
mc.soft1._y = 0;
mc.soft2._x = Stage.width - 69;
mc.soft2._y = Stage.height - 28;
mc.select._x = Stage.width - 98;
mc.select._y = (Stage.height / 2) - 16;
mc.soft1.tf.htmlText = (mc.soft1.tf2.htmlText = ("<p align = 'right'>" + labelSoft1) + "</p>");
mc.soft2.tf.htmlText = (mc.soft2.tf2.htmlText = ("<p align = 'right'>" + labelSoft2) + "</p>");
mc.select.tf.htmlText = (mc.select.tf2.htmlText = ("<p align = 'right'>" + labelSelect) + "</p>");
} else {
mc.soft1._x = 0;
mc.soft1._y = Stage.height - 24;
mc.select._x = (Stage.width / 2) - 49;
mc.select._y = Stage.height - 32;
mc.soft2._x = Stage.width - 69;
mc.soft2._y = Stage.height - 24;
mc.soft1.tf.htmlText = (mc.soft1.tf2.htmlText = ("<p align = 'left'>" + labelSoft1) + "</p>");
mc.soft2.tf.htmlText = (mc.soft2.tf2.htmlText = ("<p align = 'right'>" + labelSoft2) + "</p>");
mc.select.tf.htmlText = (mc.select.tf2.htmlText = ("<p align = 'center'>" + labelSelect) + "</p>");
}
}
var labelSoft1 = "";
var labelSoft2 = "";
var labelSelect = "";
}
Symbol 493 MovieClip [__Packages.screens.Screen] Frame 0
class screens.Screen extends MovieClip
{
var screenWidth, screenHeight;
function Screen () {
super();
Data.screen = this;
positionScreen();
initScreenUpdate();
}
function initScreenUpdate() {
previousTime = getTimer();
_root.onEnterFrame = mx.utils.Delegate.create(this, update);
trace("Initscreenupdate");
}
function update() {
var _local2 = (getTimer() - previousTime) * 0.001;
previousTime = getTimer();
updateActions(_local2);
updateGraphics(_local2);
}
function updateActions(deltaTime) {
}
function updateGraphics(deltaTime) {
}
function positionScreen() {
if (Data.screenOrientation == "270") {
positionScreen270Rotation();
}
}
function positionScreen270Rotation() {
screenWidth = 320;
screenHeight = 240;
var _local2 = Math.min(Stage.width / screenWidth, Stage.height / screenHeight);
Data.screenMcHolder._rotation = 0;
Data.screenMcHolder._x = 0;
Data.screenMcHolder._y = 0;
Data.screenRotation = 0;
Data.screenMcHolder._xscale = (Data.screenMcHolder._yscale = 100 * _local2);
}
function upKeyPressed() {
}
function leftKeyPressed() {
}
function downKeyPressed() {
}
function rightKeyPressed() {
}
function prevKeyPressed() {
}
function nextKeyPressed() {
}
function softKey1Pressed() {
}
function softKey2Pressed() {
}
function selectKeyPressed() {
}
function prevKeyReleased() {
}
function nextKeyReleased() {
}
function PauseToggle() {
}
var previousTime = 1;
}
Symbol 494 MovieClip [__Packages.screens.MenuScreen] Frame 0
class screens.MenuScreen extends screens.Screen
{
var selectedButton, lButtons;
function MenuScreen () {
super();
}
function LanguageSelectMenuScreen() {
}
function initMenuButtons(b, l) {
selectedButton = 0;
lButtons = new Array();
var _local2 = 0;
while (_local2 < b.length) {
var _local4 = new screens.LButton(b[_local2], l[_local2], _local2);
b[_local2].thisNum = _local2;
lButtons.push(_local4);
if ((System.capabilities.hasMouse || (System.capabilities.hasStylus)) || (System.capabilities.hasMouse == undefined)) {
selectedButton = -1;
b[_local2].onPress = function () {
Data.screen.selectedButton = this.thisNum;
Data.screen.setButtonStates();
};
if (System.capabilities.hasMouse || (System.capabilities.hasMouse == undefined)) {
b[_local2].onRollOver = function () {
Data.screen.selectedButton = this.thisNum;
Data.screen.setButtonStates();
};
}
b[_local2].onRollOut = (b[_local2].onReleaseOutside = (b[_local2].onDragOut = function () {
Data.screen.selectedButton = -1;
Data.screen.setButtonStates();
}));
b[_local2].onRelease = function () {
Data.screen.selectedButton = this.thisNum;
this.setButtonStates();
Data.screen.clickMenuButton(Data.screen.selectedButton);
};
b[_local2].tabEnabled = false;
}
_local2++;
}
setButtonStates();
}
function setButtonLabels(labels) {
var _local2 = 0;
while (_local2 < lButtons.length) {
lButtons[_local2].setLabel(labels[_local2]);
_local2++;
}
}
function nextKeyPressed() {
selectedButton++;
if (selectedButton > (lButtons.length - 1)) {
selectedButton = lButtons.length - 1;
}
setButtonStates();
}
function prevKeyPressed() {
selectedButton--;
if (selectedButton < 0) {
selectedButton = 0;
}
setButtonStates();
}
function setButtonStates() {
var _local2 = 0;
while (_local2 < lButtons.length) {
if (_local2 != selectedButton) {
lButtons[_local2].upState();
} else {
lButtons[_local2].overState();
}
_local2++;
}
}
function selectKeyPressed() {
clickMenuButton(selectedButton);
}
function clickMenuButton(button) {
}
function removeButton(button) {
var _local2 = lButtons.length - 1;
while (_local2 >= 0) {
if (lButtons[_local2].getMCRef() == button) {
var _local3 = lButtons.splice(_local2, 1)[0];
_local3.hideButton();
_local3 = null;
}
_local2--;
}
selectedButton = 0;
setButtonStates();
}
function getButtonNumber(listNr) {
return(lButtons[listNr].thisNum);
}
}
Symbol 495 MovieClip [__Packages.screens.LButton] Frame 0
class screens.LButton
{
var mcRef, thisNum;
function LButton (mc, l, n) {
mcRef = mc;
mcRef.stop();
lbl = l;
thisNum = n;
}
function setLabel(l) {
lbl = l;
mcRef.tf.text = lbl;
mcRef.tf.embedFonts = true;
}
function upState() {
mcRef.gotoAndStop("up");
mcRef.tf.text = lbl;
}
function overState() {
mcRef.gotoAndStop("over");
mcRef.tf.text = lbl;
}
function getMCRef() {
return(mcRef);
}
function hideButton() {
mcRef._visible = false;
}
var lbl = "NOU";
}
Symbol 496 MovieClip [__Packages.screens.menu.LanguageSelectMenuScreen] Frame 0
class screens.menu.LanguageSelectMenuScreen extends screens.MenuScreen
{
var mc, initMenuButtons;
function LanguageSelectMenuScreen () {
super();
mc = Data.screenMcHolder.attachMovie("LanguageSelectMenuScreenMc", "mc", 0);
mc.title.tf.text = Localisation.text("SETTINGSMENU_LANGUAGE");
initMenuButtons([mc.btn_enus, mc.btn_de, mc.btn_es, mc.btn_back], [Localisation.text("LANG_EN-US"), Localisation.text("LANG_DE"), Localisation.text("LANG_ES"), Localisation.text("BUTTON_BACK")]);
Data.input.setSoftKeys("", Localisation.text("BUTTON_BACK"), Localisation.text("SOFT_SELECT"));
}
function clickMenuButton(button) {
switch (button) {
case 0 :
Localisation.setLanguage("en_us");
Data.gameRoot.showScreen("Settings");
break;
case 1 :
Localisation.setLanguage("de");
Data.gameRoot.showScreen("Settings");
break;
case 2 :
Localisation.setLanguage("es");
Data.gameRoot.showScreen("Settings");
break;
case 3 :
Data.gameRoot.showScreen("Settings");
}
}
function softKey2Pressed() {
Data.gameRoot.showScreen("Options");
}
}
Symbol 497 MovieClip [__Packages.screens.branding.LanguageSelectScreen] Frame 0
class screens.branding.LanguageSelectScreen extends screens.menu.LanguageSelectMenuScreen
{
var mc, initMenuButtons;
function LanguageSelectScreen () {
super();
mc = Data.screenMcHolder.attachMovie("LanguageSelectBrandingScreenMc", "mc", 0);
mc.tf_title.text = Localisation.text("LANG_TITLE");
initMenuButtons([mc.btn_usen, mc.btn_de, mc.btn_es], [Localisation.text("LANG_EN-US"), Localisation.text("LANG_DE"), Localisation.text("LANG_ES")]);
Data.input.setSoftKeys("", Localisation.text("BUTTON_EXIT"), Localisation.text("SOFT_SELECT"));
}
function clickMenuButton(button) {
switch (button) {
case 0 :
Localisation.setLanguage("en_us");
trace("Language = en_us");
Data.gameRoot.showScreen("Branding");
break;
case 1 :
Localisation.setLanguage("de");
Data.gameRoot.showScreen("Branding");
break;
case 2 :
Localisation.setLanguage("es");
Data.gameRoot.showScreen("Branding");
}
}
function softKey2Pressed() {
Data.gameRoot.quit();
}
}
Symbol 498 MovieClip [__Packages.screens.menu.MainMenuScreen] Frame 0
class screens.menu.MainMenuScreen extends screens.MenuScreen
{
var mc, initMenuButtons, nextKeyPressed, getURL;
function MainMenuScreen () {
super();
mc = Data.screenMcHolder.attachMovie("MainMenuScreenMc", "mc", 0);
initMenuButtons([mc.btn_continue, mc.btn_newGame, mc.btn_highscores, mc.btn_moreGames, mc.btn_lang_English, mc.btn_lang_Spanish, mc.btn_lang_German], [Localisation.text("MAINMENU_CONTINUEGAME"), Localisation.text("MAINMENU_NEWGAME"), Localisation.text("MAINMENU_HIGHSCORES"), Localisation.text("MAINMENU_MOREGAMES"), "", "", ""]);
Data.input.setSoftKeys("", Localisation.text("BUTTON_EXIT"), Localisation.text("SOFT_SELECT"));
if (!Data.bSavedGameData) {
mc.btn_continue._alpha = 25;
mc.btn_continue.enabled = false;
nextKeyPressed();
}
mc.btn_lang_English._visible = false;
mc.btn_lang_Spanish._visible = false;
mc.btn_lang_German._visible = false;
mc.btn_highscores._visible = false;
mc.btn_moreGames._visible = false;
mc.btn_spilGames.onRelease = function () {
this.getURL("http://www.spilgames.com/company/ip.php", "_blank");
};
playJingleSound();
}
function playJingleSound() {
var _local1 = new Sound();
_local1.attachSound("HD_jingle");
_local1.start(0, 1);
}
function clickMenuButton(button) {
trace(button);
switch (button) {
case 0 :
Data.gameRoot.showScreen("Continue");
break;
case 1 :
Data.gameRoot.showScreen("Game");
break;
case 2 :
Data.gameRoot.showScreen("Highscores");
break;
case 3 :
getURL(Localisation.text("MAIN_LINK"), "_blank");
break;
case 4 :
Localisation.setLanguage("en_us");
break;
case 5 :
Localisation.setLanguage("es");
break;
case 6 :
Localisation.setLanguage("de");
}
}
function softKey2Pressed() {
Data.gameRoot.quit();
}
}
Symbol 499 MovieClip [__Packages.screens.menu.GameOverFeedback1Screen] Frame 0
class screens.menu.GameOverFeedback1Screen extends screens.MenuScreen
{
var mc, initMenuButtons;
function GameOverFeedback1Screen () {
super();
mc = Data.screenMcHolder.attachMovie("GameOverFeedback1Screen", "mc", 0);
initMenuButtons([mc.btn_yes, mc.btn_no], [Localisation.text("FAILED_YES"), Localisation.text("FAILED_NO")]);
Data.input.setSoftKeys("", "", Localisation.text("SOFT_SELECT"));
}
function clickMenuButton(button) {
switch (button) {
case 0 :
if ((Data.SavedHealth + 5) <= (40 + (Data.SavedUpgradeHealth * 20))) {
Data.SavedHealth = Data.SavedHealth + 5;
} else {
Data.SavedHealth = 40 + (Data.SavedUpgradeHealth * 20);
}
Data.gameRoot.showScreen("Continue");
break;
case 1 :
Data.gameRoot.showScreen("Title");
}
}
function softKey2Pressed() {
Data.gameRoot.showScreen("Main");
}
}
Symbol 500 MovieClip [__Packages.screens.menu.GameOverScreen] Frame 0
class screens.menu.GameOverScreen extends screens.MenuScreen
{
var mc, initMenuButtons;
function GameOverScreen () {
super();
mc = Data.screenMcHolder.attachMovie("GameOverScreenMc", "mc", 0);
initMenuButtons([mc.btn_submitScore], [Localisation.text("GAME_SUBMITSCORE")]);
Data.input.setSoftKeys("", "", Localisation.text("SOFT_SELECT"));
var _local3 = new Sound();
_local3.attachSound("HD_jingle");
_local3.start(0, 1);
}
function clickMenuButton(button) {
if (!(button === 0)) {
} else {
Data.gameRoot.showScreen("SubmitScore");
}
}
function softKey2Pressed() {
Data.gameRoot.showScreen("Title");
}
}
Symbol 501 MovieClip [__Packages.screens.menu.SubmitScoreScreen] Frame 0
class screens.menu.SubmitScoreScreen extends screens.Screen
{
var mc;
function SubmitScoreScreen () {
super();
selectedLetter = 0;
letterArray = new Array();
mc = Data.screenMcHolder.attachMovie("SubmitScoreScreenMc", "mc", 0);
mc.title.tf.text = Localisation.text("GAME_GAMEOVER");
mc.yourScore_tf.text = Localisation.text("GAME_YOURSCORE").toUpperCase();
if (_root.username) {
mc.name_tf.text = _root.username;
}
mc.scoreTf.text = String(Data.SavedCash);
Data.input.setSoftKeys("", Localisation.text("BUTTON_BACK"), Localisation.text("SOFT_NEXT"));
mc.branding.gotoAndStop(Localisation.language);
mc.branding.onRelease = function () {
this.getURL(Localisation.text("ENTER_NAME_LINK"), "_blank");
};
letterArray.push({l:0, lMc:mc.l1, slMc:mc.sl1, uMc:mc.u1, dMc:mc.d1});
letterArray.push({l:0, lMc:mc.l2, slMc:mc.sl2, uMc:mc.u2, dMc:mc.d2});
letterArray.push({l:0, lMc:mc.l3, slMc:mc.sl3, uMc:mc.u3, dMc:mc.d3});
var _local4 = 0;
while (_local4 < letterArray.length) {
letterArray[_local4].lMc.text = letters[letterArray[_local4].l];
letterArray[_local4].slMc.text = letters[letterArray[_local4].l];
letterArray[_local4].slMc._visible = false;
letterArray[_local4].slMc.tabEnabled = false;
letterArray[_local4].uMc.gotoAndStop("up");
letterArray[_local4].uMc.tabEnabled = false;
letterArray[_local4].dMc.gotoAndStop("up");
letterArray[_local4].dMc.tabEnabled = false;
letterArray[_local4].uMc._visible = false;
letterArray[_local4].dMc._visible = false;
if ((System.capabilities.hasMouse || (System.capabilities.hasStylus)) || (System.capabilities.hasMouse == undefined)) {
letterArray[_local4].uMc.thisNum = (letterArray[_local4].dMc.thisNum = _local4);
letterArray[_local4].uMc._visible = true;
letterArray[_local4].dMc._visible = true;
letterArray[_local4].uMc.onRollOver = (letterArray[_local4].dMc.onRollOver = function () {
this.gotoAndStop("over");
});
letterArray[_local4].uMc.onRollOut = (letterArray[_local4].dMc.onRollOut = (letterArray[_local4].uMc.onDragOut = (letterArray[_local4].dMc.onDragOut = function () {
this.gotoAndStop("up");
})));
letterArray[_local4].uMc.onRelease = function () {
Data.screen.selectLetter(this.thisNum);
Data.screen.prevLetter();
};
letterArray[_local4].dMc.onRelease = function () {
Data.screen.selectLetter(this.thisNum);
Data.screen.nextLetter();
};
}
_local4++;
}
letterArray[selectedLetter].slMc._visible = true;
letterArray[selectedLetter].uMc._visible = true;
letterArray[selectedLetter].dMc._visible = true;
mc.btn_ok.gotoAndStop("up");
mc.btn_ok.tabEnabled = false;
mc.btn_ok.tf.text = Localisation.text("GAME_SUBMITSCORE");
if ((System.capabilities.hasMouse || (System.capabilities.hasStylus)) || (System.capabilities.hasMouse == undefined)) {
mc.btn_ok.onRollOver = function () {
this.gotoAndStop("over");
this.tf.text = Localisation.text("GAME_SUBMITSCORE");
};
mc.btn_ok.onRollOut = (mc.btn_ok.onDragOut = function () {
this.gotoAndStop("up");
this.tf.text = Localisation.text("GAME_SUBMITSCORE");
});
mc.btn_ok.onRelease = function () {
Data.screen.okSelected();
};
}
mc.l1._visible = false;
mc.l2._visible = false;
mc.l3._visible = false;
mc.d1._visible = false;
mc.d2._visible = false;
mc.d3._visible = false;
}
function upKeyPressed() {
letterArray[selectedLetter].uMc.gotoAndStop("over");
prevLetter();
}
function upKeyReleased() {
letterArray[selectedLetter].uMc.gotoAndStop("up");
}
function downKeyPressed() {
letterArray[selectedLetter].dMc.gotoAndStop("over");
nextLetter();
}
function downKeyReleased() {
letterArray[selectedLetter].dMc.gotoAndStop("up");
}
function rightKeyReleased() {
selectNextLetter();
}
function leftKeyReleased() {
selectPrevLetter();
}
function selectLetter(l) {
selectedLetter = l;
var _local2 = 0;
while (_local2 < letterArray.length) {
letterArray[_local2].slMc._visible = _local2 == selectedLetter;
_local2++;
}
}
function selectNextLetter() {
selectedLetter++;
var _local2 = 0;
while (_local2 < letterArray.length) {
letterArray[_local2].slMc._visible = _local2 == selectedLetter;
letterArray[_local2].uMc._visible = _local2 == selectedLetter;
letterArray[_local2].dMc._visible = _local2 == selectedLetter;
_local2++;
}
if (selectedLetter > letterArray.length) {
selectedLetter = letterArray.length;
}
if (selectedLetter == letterArray.length) {
mc.btn_ok.gotoAndStop("over");
mc.btn_ok.tf.text = Localisation.text("GAME_SUBMITSCORE");
} else {
mc.btn_ok.gotoAndStop("up");
mc.btn_ok.tf.text = Localisation.text("GAME_SUBMITSCORE");
}
setSoftkeys();
}
function selectPrevLetter() {
selectedLetter--;
if (selectedLetter < 0) {
selectedLetter = 0;
}
var _local2 = 0;
while (_local2 < letterArray.length) {
letterArray[_local2].slMc._visible = _local2 == selectedLetter;
letterArray[_local2].uMc._visible = _local2 == selectedLetter;
letterArray[_local2].dMc._visible = _local2 == selectedLetter;
_local2++;
}
mc.btn_ok.gotoAndStop("up");
mc.btn_ok.tf.text = Localisation.text("GAME_SUBMITSCORE");
setSoftkeys();
}
function setSoftkeys() {
if (((selectedLetter == 0) || (selectedLetter == 1)) || (selectedLetter == 2)) {
Data.input.setSoftKeys("", Localisation.text("BUTTON_BACK"), Localisation.text("SOFT_NEXT"));
}
if (selectedLetter == 3) {
Data.input.setSoftKeys("", Localisation.text("BUTTON_BACK"), Localisation.text("SOFT_SELECT"));
}
}
function selectKeyPressed() {
if (selectedLetter == letterArray.length) {
okSelected();
} else {
selectNextLetter();
}
}
function okSelected() {
Data.postNewScore((letters[letterArray[0].l] + letters[letterArray[1].l]) + letters[letterArray[2].l], Data.SavedCash);
Data.gameRoot.showScreen("Main");
}
function nextLetter() {
letterArray[selectedLetter].l++;
if (letterArray[selectedLetter].l >= letters.length) {
letterArray[selectedLetter].l = 0;
}
letterArray[selectedLetter].lMc.text = letters[letterArray[selectedLetter].l];
letterArray[selectedLetter].slMc.text = letters[letterArray[selectedLetter].l];
}
function prevLetter() {
letterArray[selectedLetter].l--;
if (letterArray[selectedLetter].l < 0) {
letterArray[selectedLetter].l = letters.length - 1;
}
letterArray[selectedLetter].lMc.text = letters[letterArray[selectedLetter].l];
letterArray[selectedLetter].slMc.text = letters[letterArray[selectedLetter].l];
}
function softKey2Pressed() {
}
var letters = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "_");
var selectedLetter = 0;
var letterArray = new Array();
}
Symbol 502 MovieClip [__Packages.screens.menu.HighscoresScreen] Frame 0
class screens.menu.HighscoresScreen extends screens.MenuScreen
{
var mc, initMenuButtons;
function HighscoresScreen () {
super();
trace("Highscores------");
mc = Data.screenMcHolder.attachMovie("HighscoresScreenMc", "mc", 0);
mc.title.tf.text = Localisation.text("MAINMENU_HIGHSCORES");
initMenuButtons([mc.btn_back], [Localisation.text("BUTTON_BACK")]);
Data.input.setSoftKeys("", Localisation.text("BUTTON_BACK"), Localisation.text("SOFT_SELECT"));
mc.n1.text = Data.so.data.scores[0].n;
mc.n2.text = Data.so.data.scores[1].n;
mc.n3.text = Data.so.data.scores[2].n;
mc.n4.text = Data.so.data.scores[3].n;
mc.n5.text = Data.so.data.scores[4].n;
mc.s1.text = Data.so.data.scores[0].s;
mc.s2.text = Data.so.data.scores[1].s;
mc.s3.text = Data.so.data.scores[2].s;
mc.s4.text = Data.so.data.scores[3].s;
mc.s5.text = Data.so.data.scores[4].s;
}
function clickMenuButton(button) {
if (!(button === 0)) {
} else {
Data.gameRoot.showScreen("Main");
}
}
function softKey2Pressed() {
Data.gameRoot.showScreen("Main");
}
function updateActions() {
mc.character.loopNext();
}
function updateGraphics() {
mc.character.update();
}
}
Symbol 503 MovieClip [__Packages.screens.menu.UpgradeScreen] Frame 0
class screens.menu.UpgradeScreen extends screens.MenuScreen
{
var mc, initMenuButtons, getButtonNumber;
function UpgradeScreen () {
super();
mc = Data.screenMcHolder.attachMovie("UpgradeScreen", "mc", 0);
initMenuButtons([mc.btn_buyRepair, mc.btn_buyFireRate, mc.btn_buyDamage, mc.btn_buyHealth, mc.btn_continue], [Localisation.text("UPGRADE_BUY"), Localisation.text("UPGRADE_BUY"), Localisation.text("UPGRADE_BUY"), Localisation.text("UPGRADE_BUY"), Localisation.text("UPGRADE_CONTINUE")]);
Data.input.setSoftKeys("", "", Localisation.text("SOFT_SELECT"));
setSavedCash();
verifyButtons();
}
function setSavedCash() {
mc.tf_CashAmount.text = "$" + Data.SavedCash;
}
function verifyButtons() {
if ((Data.SavedCash < 250) || (Data.SavedHealth >= (40 + (Data.SavedUpgradeHealth * 20)))) {
mc.btn_buyRepair._visible = false;
}
if (((Data.SavedCash < 500) || (Data.SavedUpgradeReload > 3)) || (Data.SavedUpgradeReload >= 3)) {
mc.btn_buyFireRate._visible = false;
}
if (((Data.SavedCash < 500) || (Data.SavedUpgradeDamage > 3)) || (Data.SavedUpgradeDamage >= 3)) {
mc.btn_buyDamage._visible = false;
}
if (((Data.SavedCash < 500) || (Data.SavedUpgradeHealth > 3)) || (Data.SavedUpgradeHealth >= 3)) {
mc.btn_buyHealth._visible = false;
}
}
function clickMenuButton(button) {
switch (getButtonNumber(button)) {
case 0 :
trace("Buy repair");
if ((Data.SavedCash >= 250) && (Data.SavedHealth < (40 + (Data.SavedUpgradeHealth * 20)))) {
Data.SavedHealth = 40 + (Data.SavedUpgradeHealth * 20);
Data.SavedCash = Data.SavedCash - 250;
verifyButtons();
}
setSavedCash();
break;
case 1 :
trace("Buy fire rate");
if ((Data.SavedCash >= 500) && (Data.SavedUpgradeReload <= 3)) {
Data.SavedUpgradeReload++;
Data.SavedCash = Data.SavedCash - 500;
verifyButtons();
_root.gameInstance.getAwards(1);
if (Data.SavedUpgradeReload >= 3) {
_root.gameInstance.getAwards(2);
}
}
setSavedCash();
break;
case 2 :
trace("Buy damage");
if ((Data.SavedCash >= 500) && (Data.SavedUpgradeDamage <= 3)) {
Data.SavedUpgradeDamage++;
Data.SavedCash = Data.SavedCash - 500;
verifyButtons();
_root.gameInstance.getAwards(1);
if (Data.SavedUpgradeDamage >= 3) {
_root.gameInstance.getAwards(2);
}
}
setSavedCash();
break;
case 3 :
trace("Buy health");
if ((Data.SavedCash >= 500) && (Data.SavedUpgradeHealth <= 3)) {
Data.SavedUpgradeHealth++;
Data.SavedHealth = Data.SavedHealth + 10;
Data.SavedCash = Data.SavedCash - 500;
verifyButtons();
_root.gameInstance.getAwards(1);
if (Data.SavedUpgradeHealth >= 3) {
_root.gameInstance.getAwards(2);
}
}
setSavedCash();
break;
case 4 :
trace("continue");
Data.SavedLevel++;
Data.updateSO();
Data.gameRoot.showScreen("Continue");
}
}
function softKey2Pressed() {
Data.gameRoot.showScreen("Main");
}
}
Symbol 504 MovieClip [__Packages.screens.game.GameScreen] Frame 0
class screens.game.GameScreen extends screens.Screen
{
var score, bPaused, mc, player, positionScreen, initScreenUpdate;
function GameScreen () {
super();
score = 0;
bPaused = false;
if (Data.bSavedGameData) {
levelIdx = Data.SavedLevel;
}
if (mc) {
mc.removeMovieClip();
}
mc = Data.screenMcHolder.attachMovie(levels[levelIdx], "mc", 0);
mc.tf_scoreDescr.text = (Localisation.text("GAME_SCORE") + ": ") + String(score);
mc.tf_waveDescr.text = (Localisation.text("GAME_WAVES") + ": ") + String(score);
mc.tf_levelDescr.text = (Localisation.text("GAME_LEVELS") + ": ") + String(score);
Data.input.setSoftKeys("", Localisation.text("SOFT_PAUSE"), "");
setUp();
mc.startLevel(player);
updateCashFeedback();
updateWavesFeedback(1, mc.getTotalWaves());
updateLevelFeedback();
var _local3 = new Object();
_local3.onMouseDown = mx.utils.Delegate.create(this, mouseDownHandler);
_local3.onMouseUp = mx.utils.Delegate.create(this, mouseUpHandler);
Mouse.addListener(_local3);
addBranding();
}
function mouseDownHandler() {
if (mc._ymouse <= 140) {
upKeyPressed();
} else {
downKeyPressed();
}
}
function mouseUpHandler() {
player.rotateWeapon(0);
}
function setUp() {
player = new screens.game.Player(mc);
player.health = Data.SavedHealth;
player.healthBase = 40 + (Data.SavedUpgradeHealth * 20);
player.updateHealthBar();
switch (Data.SavedUpgradeReload) {
case 1 :
player.fireRate = 1.3;
break;
case 2 :
player.fireRate = 1.1;
break;
case 3 :
player.fireRate = 0.9;
}
switch (Data.SavedUpgradeDamage) {
case 1 :
player.damage = 1.5;
break;
case 2 :
player.damage = 2;
break;
case 3 :
player.damage = 2.5;
}
}
function upKeyPressed() {
player.rotateWeapon(-1);
}
function rightKeyPressed() {
player.rotateWeapon(1);
}
function downKeyPressed() {
player.rotateWeapon(1);
}
function leftKeyPressed() {
player.rotateWeapon(-1);
}
function upKeyReleased() {
player.rotateWeapon(0);
}
function rightKeyReleased() {
player.rotateWeapon(0);
}
function downKeyReleased() {
player.rotateWeapon(0);
}
function leftKeyReleased() {
player.rotateWeapon(0);
}
function game_over() {
Data.gameRoot.showScreen("GameOverFeedback1");
}
function softKey2Pressed() {
pause();
}
function PauseToggle() {
trace("pause g");
if (bPaused) {
unPause();
} else {
pause();
}
}
function pause() {
var _local2 = new screens.game.GamePausedMenuScreen(this);
bPaused = true;
}
function unPause() {
Data.screen = this;
positionScreen();
initScreenUpdate();
Data.input.setSoftKeys("", Localisation.text("SOFT_PAUSE"), "");
bPaused = false;
}
function updateActions(deltaTime) {
if (!bPaused) {
player.update(deltaTime);
mc.update(deltaTime);
if (mc.levelComplete()) {
Data.SaveGame(player, levelIdx++);
var _local3 = new Sound();
_local3.attachSound("HD_levelComplete");
_local3.start(0, 1);
if (((Data && _root) && (_root.gameInstance)) && (Data.SavedCash >= 2500)) {
_root.gameInstance.getAwards(5);
} else if (((Data && _root) && (_root.gameInstance)) && (Data.SavedCash >= 1400)) {
_root.gameInstance.getAwards(4);
}
if (levelIdx >= levels.length) {
if ((_root && (_root.proxyInstance)) && (Data.SavedCash)) {
_root.proxyInstance.submitScore(Number(Data.SavedCash));
}
_root.gameInstance.getAwards(3);
Data.gameRoot.showScreen("GameOver");
} else {
Data.gameRoot.showScreen("Upgrade");
}
}
}
}
function updateCashFeedback() {
mc.tf_scorePoints.text = "$" + Data.SavedCash;
}
function updateWavesFeedback(currentWave, totalWaves) {
mc.tf_wavePoints.text = (("" + currentWave) + "/") + totalWaves;
}
function updateLevelFeedback() {
mc.tf_LevelPoints.text = ("" + (levelIdx + 1)) + "/8";
}
function addBranding() {
if (_root.localization_portal == "game_com_cn") {
mc.moreGames.onRelease = function () {
this.getURL(_root.localization_url1, "_blank");
};
} else {
mc.moreGames.onRelease = function () {
this.getURL(_root.localization_url1 + "&utm_content=button_mainscreen_moregames", "_blank");
};
}
}
var gameOver = false;
var levels = new Array("level_1", "level_2", "level_3", "level_4", "level_5", "level_6", "level_7", "level_8");
var levelIdx = 0;
}
Symbol 505 MovieClip [__Packages.screens.game.GamePausedMenuScreen] Frame 0
class screens.game.GamePausedMenuScreen extends screens.MenuScreen
{
var parent, pmc, initMenuButtons, mc;
function GamePausedMenuScreen (p) {
super();
parent = p;
pmc = Data.screenMcHolder.attachMovie("GameScreen_pausedMc", "pmc", 1);
initMenuButtons([pmc.btn_continue, pmc.btn_mainMenu], [Localisation.text("BUTTON_CONTINUE"), Localisation.text("TITLESCREEN_MAINMENU")]);
Data.input.setSoftKeys("", Localisation.text("BUTTON_CONTINUE"), Localisation.text("SOFT_SELECT"));
}
function clickMenuButton(button) {
switch (button) {
case 0 :
Data.screenMcHolder.pmc.removeMovieClip();
parent.unPause();
this=null;//parameter overwritten
break;
case 1 :
Data.screenMcHolder.pmc.removeMovieClip();
Data.gameRoot.showScreen("Main");
this=null;//parameter overwritten
}
}
function softKey2Pressed() {
Data.screenMcHolder.pmc.removeMovieClip();
parent.unPause();
this=null;//parameter overwritten
}
function updateActions() {
mc.title.loopNext();
}
function updateGraphics() {
mc.title.update();
}
}