Section 1
//MainTimeline (Flash_RPG_TD_fla.MainTimeline)
package Flash_RPG_TD_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var NPH_AngelsOfDeath:Array;
public var NPS_Bullets:Array;
public var NPH_MouseEvent:MouseEvent;
public var NP_Lives:int;
public var text_gold:TextField;
public var tower_select_arcane:MovieClip;
public var NPH_LastWave:Number;
public var NPS_SelectedTower:Number;
public var NPH_Map:Array;
public var restart_sure:MovieClip;
public var NPS_Buildings:Array;
public var NP_selectedtowertype:String;
public var NP_GameLevel:Number;
public var NPH_GameLevel:Number;
public var end_nopath_hard_score:TextField;
public var NPH_selectedtowertype:String;
public var text_tower_range:TextField;
public var tower_select_arrow:MovieClip;
public var buy_angel_death:MovieClip;
public var NPS_PlacedMine:Boolean;
public var NPI_Prayer:Number;
public var NP_Enemies:Array;
public var NPS_LastWave:Number;
public var NP_Muted:Boolean;
public var NPH_channel:SoundChannel;
public var NPS_PrayerUpdateSpeed:Number;
public var play_game_np_insane:MovieClip;
public var NPI_Buildings:Array;
public var pausebutton:MovieClip;
public var NP_Path:Array;
public var play_game_np_sandbox:MovieClip;
public var NPI_CurrentSong:int;
public var NPI_Enemies:Array;
public var NP_LastWave:Number;
public var restart_yes:MovieClip;
public var NP_LastGoldUpdate:Number;
public var NP_Gold:Number;
public var end_nopath_sandbox_score:TextField;
public var NPS_Judgement:Array;
public var NPS_ButtonClick:buttonclick;
public var NPH_GoldUpdateSpeed:Number;
public var NP_PlacedMine:Boolean;
public var NPS_AngelsOfDeath:Array;
public var text_score:TextField;
public var NPS_Path:Array;
public var NP_LastEnemyType:Number;
public var NPI_LastGoldUpdate:Number;
public var text_tower_sell:TextField;
public var NP_Prayer:Number;
public var play_game_np_hard:MovieClip;
public var text_towertype:TextField;
public var NPS_LastPrayerUpdate:Number;
public var NP_PrayerUpdateSpeed:Number;
public var NPS_Prayer:Number;
public var NPH_PlacedChurch:Boolean;
public var NP_Map:Array;
public var NPI_LastWave:Number;
public var play_game_normal:MovieClip;
public var NPH_PrayerUpdateSpeed:Number;
public var NPH_PausedTimer1:Number;
public var NPH_PausedTimer2:Number;
public var NPH_ButtonClick:buttonclick;
public var NPI_LastEnemyType:Number;
public var NP_SelectedTower:Number;
public var NPI_Judgement:Array;
public var NPI_Lives:int;
public var NPH_PlacedMine:Boolean;
public var NPH_EnemyDie:Sound;
public var NPS_Gold:Number;
public var buy_church:MovieClip;
public var text_next_level:TextField;
public var NPS_HealthBars:Array;
public var NPS_channel:SoundChannel;
public var NPI_SelectedTower:Number;
public var text_next_gold:TextField;
public var NPH_MapEnd;
public var NPS_CurrentSong:int;
public var NPH_Enemies:Array;
public var NPS_EnemyDie:Sound;
public var NPI_MouseEvent:MouseEvent;
public var NPS_GameScore:int;
public var select_mine:MovieClip;
public var musicmute:MovieClip;
public var NPH_LastPrayerUpdate:Number;
public var NPI_Muted:Boolean;
public var NP_EnemyDie:Sound;
public var NPH_MapStart;
public var NPS_Blizzards:Array;
public var NP_Buildings:Array;
public var play_game_hard:MovieClip;
public var NPH_Buildings:Array;
public var NPH_gamemode:String;
public var restart_no:MovieClip;
public var text_level:TextField;
public var NP_HealthBars:Array;
public var NPS_WaveDelay:Number;
public var NP_AngelsOfDeath:Array;
public var NPI_selectedtowertype:String;
public var end_nopath_insane_score:TextField;
public var NPH_CurrentSong:int;
public var NPH_Ambient5:ambient_5;
public var NPH_Ambient2:ambient_2;
public var NP_Bullets:Array;
public var NPH_Ambient4:ambient_4;
public var play_game:MovieClip;
public var NPI_Bullets:Array;
public var NPH_Ambient1:ambient_1;
public var NPH_Ambient3:ambient_3;
public var NPI_GameScore:int;
public var NPS_Lives:int;
public var play_game_30min:MovieClip;
public var NPH_Path:Array;
public var NP_LastPrayerUpdate:Number;
public var NPH_Towers:Array;
public var NPH_Lives:int;
public var NPS_gamemode:String;
public var NPI_Blizzards:Array;
public var NP_ButtonClick:buttonclick;
public var NPH_Gold:Number;
public var NP_MapStart;
public var NPI_AngelsOfDeath:Array;
public var NPS_MapStart;
public var NPS_Ambient2:ambient_2;
public var play_game_np_normal:MovieClip;
public var NPS_Ambient1:ambient_1;
public var NPI_EnemyDie:Sound;
public var NP_gamemode:String;
public var buy_judgement:MovieClip;
public var NPS_Muted:Boolean;
public var NPI_WaveDelay:Number;
public var NPI_MapEnd;
public var NPH_HealthBars:Array;
public var NP_Ambient1:ambient_1;
public var NP_Ambient2:ambient_2;
public var NP_Judgement:Array;
public var NP_Ambient5:ambient_5;
public var NP_Ambient3:ambient_3;
public var NP_Ambient4:ambient_4;
public var text_next_prayer:TextField;
public var NPH_Judgement:Array;
public var text_towerinfo:TextField;
public var NPS_GameLevel:Number;
public var play_game_sandbox:MovieClip;
public var buy_blizzard:MovieClip;
public var NPH_Muted:Boolean;
public var NPI_Path:Array;
public var NPS_Ambient5:ambient_5;
public var text_tower_level:TextField;
public var NPS_Enemies:Array;
public var NPI_PlacedMine:Boolean;
public var NPS_Map:Array;
public var play_game_5min:MovieClip;
public var nextlevelbutton:MovieClip;
public var tower_select_cannon:MovieClip;
public var NPI_GoldUpdateSpeed:Number;
public var NPS_Ambient4:ambient_4;
public var NPS_GoldUpdateSpeed:Number;
public var NPI_PausedTimer1:Number;
public var NPI_PlacedChurch:Boolean;
public var drawonme:MovieClip;
public var NPI_Gold:Number;
public var NPI_PausedTimer2:Number;
public var NPI_PrayerUpdateSpeed:Number;
public var NPI_gamemode:String;
public var NPS_PlacedChurch:Boolean;
public var musicright:MovieClip;
public var NP_MapEnd;
public var NP_CurrentSong:int;
public var NPI_GameLevel:Number;
public var upgrade_tower:MovieClip;
public var NPI_Towers:Array;
public var NPH_LastEnemyType:Number;
public var NPS_MapEnd;
public var NPH_Bullets:Array;
public var play_game_10min:MovieClip;
public var NPI_Ambient3:ambient_3;
public var NPI_Ambient5:ambient_5;
public var text_tower_damage:TextField;
public var text_prayer:TextField;
public var NPI_Ambient4:ambient_4;
public var NPI_MapStart;
public var NPH_LastGoldUpdate:Number;
public var NPI_Ambient1:ambient_1;
public var NPS_MouseEvent:MouseEvent;
public var NPI_Ambient2:ambient_2;
public var NPH_SelectedTower:Number;
public var end_nopath_score:TextField;
public var restart_button:MovieClip;
public var tower_select_fire:MovieClip;
public var playbutton:MovieClip;
public var NPH_GameScore:int;
public var NPS_Ambient3:ambient_3;
public var NP_GameScore:int;
public var NPS_PausedTimer2:Number;
public var text_lives:TextField;
public var text_nexttype:TextField;
public var NP_Blizzards:Array;
public var NP_channel:SoundChannel;
public var NPI_channel:SoundChannel;
public var NPH_Blizzards:Array;
public var play_game_insane:MovieClip;
public var NPS_PausedTimer1:Number;
public var NPH_Prayer:Number;
public var NPS_selectedtowertype:String;
public var musicleft:MovieClip;
public var NP_WaveDelay:Number;
public var NPH_WaveDelay:Number;
public var NP_MouseEvent:MouseEvent;
public var tower_select_ice:MovieClip;
public var NP_PlacedChurch:Boolean;
public var NP_Towers:Array;
public var NPI_Map:Array;
public var NPI_HealthBars:Array;
public var NP_PausedTimer1:Number;
public var TheGrid1:MovieClip;
public var sell_tower:MovieClip;
public var NPI_LastPrayerUpdate:Number;
public var NP_PausedTimer2:Number;
public var NP_GoldUpdateSpeed:Number;
public var NPI_ButtonClick:buttonclick;
public var NPS_Towers:Array;
public var NPS_LastEnemyType:Number;
public var text_enemy_hp:TextField;
public var NPS_LastGoldUpdate:Number;
public function MainTimeline(){
addFrameScript(0, frame1, 9, frame10, 94, frame95, 99, frame100, 104, frame105, 109, frame110, 114, frame115, 119, frame120, 124, frame125, 129, frame130, 134, frame135, 139, frame140, 199, frame200);
}
public function NPH_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(10 PP)";
text_towerinfo.text = "Calls forth the Angel of Death.";
}
public function NPS_buy_judgement_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:judgement;
if (NPS_gamemode != "paused"){
if (NPS_Prayer >= 15){
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
NPS_Prayer = (NPS_Prayer - 15);
text_prayer.text = String(NPS_Prayer);
_local2 = 0;
while (_local2 < (NPS_Enemies.length - 1)) {
_local3 = new judgement();
_local3.x = NPS_Enemies[_local2].x;
_local3.y = NPS_Enemies[_local2].y;
NPS_Enemies[_local2].GotHit(999999, 1);
drawonme.addChild(_local3);
NPS_Judgement.push(_local3);
_local2++;
};
};
};
}
public function NP_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(3 PP)";
text_towerinfo.text = "Calls forth a Blizzard to slow your enemies.";
}
public function NPS_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (NPS_gamemode != "paused"){
if (NPS_Enemies.length < 51){
if (NPS_GameLevel != 0){
NPS_GameScore = (NPS_GameScore + Math.round((((NPS_WaveDelay + NPS_LastWave) - getTimer()) / 1000)));
text_score.text = String(NPS_GameScore);
};
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
NPS_placeenemies();
};
};
}
public function NPH_tower_select_arrow_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Arrow Tower (30g)";
text_towerinfo.text = "Low Dmg, Fast Speed. (Normal Damage)";
}
public function NPS_tower_select_fire_mouse_up(_arg1:MouseEvent):void{
if (NPS_gamemode != "paused"){
if (NPS_gamemode == "set_tower"){
if (NPS_selectedtowertype == "Fire"){
NPS_gamemode = "off";
TheGrid1.alpha = 0;
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
NPS_selectedtowertype = "none";
} else {
if (NPS_selectedtowertype != "Fire"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Fire";
};
};
} else {
if (NPS_gamemode != "set_tower"){
NPS_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
NPS_selectedtowertype = "Fire";
};
};
};
}
public function NPH_placeenemies():void{
var _local1:*;
var _local2:script_enemy_orc;
var _local3:enemy_health_bar;
var _local4:script_enemy_armororc;
var _local5:enemy_health_bar;
var _local6:script_enemy_goblin;
var _local7:enemy_health_bar;
var _local8:script_enemy_fasttroll;
var _local9:enemy_health_bar;
var _local10:script_enemy_tauren;
var _local11:enemy_health_bar;
var _local12:script_enemy_armortroll;
var _local13:enemy_health_bar;
var _local14:script_enemy_lion;
var _local15:enemy_health_bar;
var _local16:script_enemy_undead;
var _local17:enemy_health_bar;
var _local18:script_enemy_clothundead;
var _local19:enemy_health_bar;
var _local20:script_enemy_demon;
var _local21:enemy_health_bar;
var _local22:script_enemy_boss1;
var _local23:enemy_health_bar;
if (NPH_gamemode != "paused"){
NPH_GameLevel = (NPH_GameLevel + 1);
NPH_WaveDelay = (NPH_WaveDelay - 500);
if (NPH_WaveDelay < 10000){
NPH_WaveDelay = 10000;
};
NPH_Path = Pathfinding.findPath(NPH_Map, NPH_MapStart.y, NPH_MapStart.x, NPH_MapEnd.y, NPH_MapEnd.x);
_local1 = 0;
while (_local1 < 25) {
if (NPH_LastEnemyType == 1){
_local2 = new script_enemy_orc(_local1, NPH_GameLevel, "hard");
addChild(_local2);
NPH_Enemies.push(_local2);
NPH_LastWave = getTimer();
text_level.text = String(NPH_GameLevel);
_local3 = new enemy_health_bar();
_local3.pEnemy = (NPH_Enemies.length - 1);
_local3.x = (_local2.x - 13);
_local3.y = (_local2.y - 16);
_local3.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local2.pStartHealth));
addChild(_local3);
NPH_HealthBars.push(_local3);
_local2.pPath = NPH_Path;
text_nexttype.text = "Next Enemy Type : Armor";
} else {
if (NPH_LastEnemyType == 2){
_local4 = new script_enemy_armororc(_local1, NPH_GameLevel, "hard");
addChild(_local4);
NPH_Enemies.push(_local4);
NPH_LastWave = getTimer();
text_level.text = String(NPH_GameLevel);
_local5 = new enemy_health_bar();
_local5.pEnemy = (NPH_Enemies.length - 1);
_local5.x = (_local4.x - 13);
_local5.y = (_local4.y - 16);
_local5.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local4.pStartHealth));
addChild(_local5);
NPH_HealthBars.push(_local5);
_local4.pPath = NPH_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPH_LastEnemyType == 3){
_local6 = new script_enemy_goblin(_local1, NPH_GameLevel, "hard");
addChild(_local6);
NPH_Enemies.push(_local6);
NPH_LastWave = getTimer();
text_level.text = String(NPH_GameLevel);
_local7 = new enemy_health_bar();
_local7.pEnemy = (NPH_Enemies.length - 1);
_local7.x = (_local6.x - 13);
_local7.y = (_local6.y - 16);
_local7.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local6.pStartHealth));
addChild(_local7);
NPH_HealthBars.push(_local7);
_local6.pPath = NPH_Path;
text_nexttype.text = "Next Enemy Type : Fast";
} else {
if (NPH_LastEnemyType == 4){
_local8 = new script_enemy_fasttroll(_local1, NPH_GameLevel, "hard");
addChild(_local8);
NPH_Enemies.push(_local8);
NPH_LastWave = getTimer();
text_level.text = String(NPH_GameLevel);
_local9 = new enemy_health_bar();
_local9.pEnemy = (NPH_Enemies.length - 1);
_local9.x = (_local8.x - 13);
_local9.y = (_local8.y - 16);
_local9.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local8.pStartHealth));
addChild(_local9);
NPH_HealthBars.push(_local9);
_local8.pPath = NPH_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPH_LastEnemyType == 5){
_local10 = new script_enemy_tauren(_local1, NPH_GameLevel, "hard");
addChild(_local10);
NPH_Enemies.push(_local10);
NPH_LastWave = getTimer();
text_level.text = String(NPH_GameLevel);
_local11 = new enemy_health_bar();
_local11.pEnemy = (NPH_Enemies.length - 1);
_local11.x = (_local10.x - 13);
_local11.y = (_local10.y - 16);
_local11.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local10.pStartHealth));
addChild(_local11);
NPH_HealthBars.push(_local11);
_local10.pPath = NPH_Path;
text_nexttype.text = "Next Enemy Type : Armor";
} else {
if (NPH_LastEnemyType == 6){
_local12 = new script_enemy_armortroll(_local1, NPH_GameLevel, "hard");
addChild(_local12);
NPH_Enemies.push(_local12);
NPH_LastWave = getTimer();
text_level.text = String(NPH_GameLevel);
_local13 = new enemy_health_bar();
_local13.pEnemy = (NPH_Enemies.length - 1);
_local13.x = (_local12.x - 13);
_local13.y = (_local12.y - 16);
_local13.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local12.pStartHealth));
addChild(_local13);
NPH_HealthBars.push(_local13);
_local12.pPath = NPH_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPH_LastEnemyType == 7){
_local14 = new script_enemy_lion(_local1, NPH_GameLevel, "hard");
addChild(_local14);
NPH_Enemies.push(_local14);
NPH_LastWave = getTimer();
text_level.text = String(NPH_GameLevel);
_local15 = new enemy_health_bar();
_local15.pEnemy = (NPH_Enemies.length - 1);
_local15.x = (_local14.x - 13);
_local15.y = (_local14.y - 16);
_local15.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local14.pStartHealth));
addChild(_local15);
NPH_HealthBars.push(_local15);
_local14.pPath = NPH_Path;
text_nexttype.text = "Next Enemy Type : Fast";
} else {
if (NPH_LastEnemyType == 8){
_local16 = new script_enemy_undead(_local1, NPH_GameLevel, "hard");
addChild(_local16);
NPH_Enemies.push(_local16);
NPH_LastWave = getTimer();
text_level.text = String(NPH_GameLevel);
_local17 = new enemy_health_bar();
_local17.pEnemy = (NPH_Enemies.length - 1);
_local17.x = (_local16.x - 13);
_local17.y = (_local16.y - 16);
_local17.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local16.pStartHealth));
addChild(_local17);
NPH_HealthBars.push(_local17);
_local16.pPath = NPH_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPH_LastEnemyType == 9){
_local18 = new script_enemy_clothundead(_local1, NPH_GameLevel, "hard");
addChild(_local18);
NPH_Enemies.push(_local18);
NPH_LastWave = getTimer();
text_level.text = String(NPH_GameLevel);
_local19 = new enemy_health_bar();
_local19.pEnemy = (NPH_Enemies.length - 1);
_local19.x = (_local18.x - 13);
_local19.y = (_local18.y - 16);
_local19.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local18.pStartHealth));
addChild(_local19);
NPH_HealthBars.push(_local19);
_local18.pPath = NPH_Path;
text_nexttype.text = "Next Enemy Type : Immune to magic!";
} else {
if (NPH_LastEnemyType == 10){
_local20 = new script_enemy_demon(_local1, NPH_GameLevel, "hard");
addChild(_local20);
NPH_Enemies.push(_local20);
NPH_LastWave = getTimer();
text_level.text = String(NPH_GameLevel);
_local21 = new enemy_health_bar();
_local21.pEnemy = (NPH_Enemies.length - 1);
_local21.x = (_local20.x - 13);
_local21.y = (_local20.y - 16);
_local21.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local20.pStartHealth));
addChild(_local21);
NPH_HealthBars.push(_local21);
_local20.pPath = NPH_Path;
text_nexttype.text = "Next Enemy Type : Boss Round";
};
};
};
};
};
};
};
};
};
};
_local1++;
};
if (NPH_LastEnemyType == 11){
_local22 = new script_enemy_boss1(0, NPH_GameLevel, "hard");
addChild(_local22);
NPH_Enemies.push(_local22);
NPH_LastWave = getTimer();
text_level.text = String(NPH_GameLevel);
_local23 = new enemy_health_bar();
_local23.pEnemy = (NPH_Enemies.length - 1);
_local23.x = (_local22.x - 13);
_local23.y = (_local22.y - 16);
_local23.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local22.pStartHealth));
addChild(_local23);
NPH_HealthBars.push(_local23);
_local22.pPath = NPH_Path;
text_nexttype.text = "Next Enemy Type : Normal";
};
NPH_LastEnemyType = (NPH_LastEnemyType + 1);
if (NPH_LastEnemyType == 12){
NPH_LastEnemyType = 1;
};
};
}
public function NPH_buy_church_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Church (750g)";
text_towerinfo.text = "Adds Prayer Points. Limit 1.";
}
public function play30min(_arg1:MouseEvent):void{
gotoAndStop(85);
}
public function NPI_musicleft_mouse_up(_arg1:MouseEvent):void{
if (NPI_Muted == false){
NPI_CurrentSong--;
if (NPI_CurrentSong == 0){
NPI_CurrentSong = 5;
};
NPI_channel.stop();
if (NPI_CurrentSong == 1){
NPI_channel = NPI_Ambient1.play(0, 99999);
};
if (NPI_CurrentSong == 2){
NPI_channel = NPI_Ambient2.play(0, 99999);
};
if (NPI_CurrentSong == 3){
NPI_channel = NPI_Ambient3.play(0, 99999);
};
if (NPI_CurrentSong == 4){
NPI_channel = NPI_Ambient4.play(0, 99999);
};
if (NPI_CurrentSong == 5){
NPI_channel = NPI_Ambient5.play(0, 99999);
};
};
}
public function NPH_tower_select_fire_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Fire Tower (100g)";
text_towerinfo.text = "Low Dmg, Fast Speed. (Magic Damage)";
}
public function NPS_reportKeyUp(_arg1:KeyboardEvent):void{
var _local2:Number;
var _local3:int;
if (_arg1.keyCode == 49){
NPS_tower_select_arrow_mouse_up(NPS_MouseEvent);
};
if (_arg1.keyCode == 50){
NPS_tower_select_cannon_mouse_up(NPS_MouseEvent);
};
if (_arg1.keyCode == 51){
NPS_tower_select_arcane_mouse_up(NPS_MouseEvent);
};
if (_arg1.keyCode == 52){
NPS_tower_select_fire_mouse_up(NPS_MouseEvent);
};
if (_arg1.keyCode == 53){
NPS_tower_select_ice_mouse_up(NPS_MouseEvent);
};
if (_arg1.keyCode == 85){
if (NPS_gamemode != "paused"){
if (NPS_SelectedTower != -1){
_local3 = 0;
while (_local3 <= 501) {
if (NPS_Towers[NPS_SelectedTower].pLevel < 501){
if (NPS_Gold >= (0.5 * (NPS_Towers[NPS_SelectedTower].pCost * (NPS_Towers[NPS_SelectedTower].pLevel + 1)))){
NPS_Gold = (NPS_Gold - (0.5 * (NPS_Towers[NPS_SelectedTower].pCost * (NPS_Towers[NPS_SelectedTower].pLevel + 1))));
NPS_Gold = Math.round(NPS_Gold);
text_gold.text = String(NPS_Gold);
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
NPS_Towers[NPS_SelectedTower].pLevel = (NPS_Towers[NPS_SelectedTower].pLevel + 1);
NPS_Towers[NPS_SelectedTower].pDamage = (NPS_Towers[NPS_SelectedTower].pOrigDamage * ((NPS_Towers[NPS_SelectedTower].pLevel / 1.1) * ((NPS_Towers[NPS_SelectedTower].pLevel / 10) + 1)));
upgrade_tower.x = 900;
text_tower_range.text = ("Range - " + NPS_Towers[NPS_SelectedTower].pRange);
text_tower_damage.text = ("Damage - " + NPS_Towers[NPS_SelectedTower].pDamage.toFixed(2));
text_tower_level.text = ("Level - " + String(NPS_Towers[NPS_SelectedTower].pLevel));
text_tower_sell.text = ("Sell Value - " + String(int(((NPS_Towers[NPS_SelectedTower].pLevel * NPS_Towers[NPS_SelectedTower].pCost) * 0.7))));
};
};
_local3++;
};
};
};
};
if (_arg1.keyCode == 83){
NPS_sell_tower_click(NPS_MouseEvent);
};
}
public function NPI_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 2% Of Your Gold Every 5 mins. Limit 1.";
}
public function NPH_the_grid_place_tower(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:Boolean;
var _local4:Number;
var _local5:*;
var _local6:int;
var _local7:tower_arrow;
var _local8:tower_arcane;
var _local9:tower_cannon;
var _local10:tower_ice;
var _local11:tower_fire;
var _local12:building_mine;
var _local13:building_church;
if (NPH_gamemode != "paused"){
if (NPH_gamemode == "set_tower"){
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) >= 2)) && ((int((root.mouseY / 32)) <= 13)))){
if (NPH_selectedtowertype == "Arrow"){
_local3 = true;
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPH_Map, NPH_MapStart.y, NPH_MapStart.x, NPH_MapEnd.y, NPH_MapEnd.x) != null){
_local6 = (NPH_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPH_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPH_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPH_Gold >= 30)) && ((_local3 == true)))){
_local7 = new tower_arrow();
_local7.x = (int((root.mouseX / 32)) * 32);
_local7.y = (int((root.mouseY / 32)) * 32);
addChild(_local7);
NPH_Towers.push(_local7);
NPH_Gold = (NPH_Gold - 30);
text_gold.text = String(NPH_Gold);
NPH_Map[Math.round((_local7.y / 32))][Math.round((_local7.x / 32))] = 0;
_local5 = (NPH_Enemies.length - 1);
while (_local5 >= 0) {
if (NPH_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][1]), Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPH_Path = Pathfinding.findPath(NPH_Map, _local2.y, _local2.x, NPH_MapEnd.y, NPH_MapEnd.x);
if (NPH_Path == null){
};
NPH_Enemies[_local5].pPath = NPH_Path;
NPH_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPH_selectedtowertype == "Arcane"){
_local3 = true;
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPH_Map, NPH_MapStart.y, NPH_MapStart.x, NPH_MapEnd.y, NPH_MapEnd.x) != null){
_local6 = (NPH_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPH_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPH_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPH_Gold >= 125)) && ((_local3 == true)))){
_local8 = new tower_arcane();
_local8.x = (int((root.mouseX / 32)) * 32);
_local8.y = (int((root.mouseY / 32)) * 32);
addChild(_local8);
NPH_Towers.push(_local8);
NPH_Gold = (NPH_Gold - 125);
text_gold.text = String(NPH_Gold);
NPH_Map[Math.round((_local8.y / 32))][Math.round((_local8.x / 32))] = 0;
_local5 = (NPH_Enemies.length - 1);
while (_local5 >= 0) {
if (NPH_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][1]), Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPH_Path = Pathfinding.findPath(NPH_Map, _local2.y, _local2.x, NPH_MapEnd.y, NPH_MapEnd.x);
if (NPH_Path == null){
};
NPH_Enemies[_local5].pPath = NPH_Path;
NPH_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPH_selectedtowertype == "Cannon"){
_local3 = true;
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPH_Map, NPH_MapStart.y, NPH_MapStart.x, NPH_MapEnd.y, NPH_MapEnd.x) != null){
_local6 = (NPH_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPH_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPH_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPH_Gold >= 75)) && ((_local3 == true)))){
_local9 = new tower_cannon();
_local9.x = (int((root.mouseX / 32)) * 32);
_local9.y = (int((root.mouseY / 32)) * 32);
addChild(_local9);
NPH_Towers.push(_local9);
NPH_Gold = (NPH_Gold - 75);
text_gold.text = String(NPH_Gold);
NPH_Map[Math.round((_local9.y / 32))][Math.round((_local9.x / 32))] = 0;
_local5 = (NPH_Enemies.length - 1);
while (_local5 >= 0) {
if (NPH_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][1]), Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPH_Path = Pathfinding.findPath(NPH_Map, _local2.y, _local2.x, NPH_MapEnd.y, NPH_MapEnd.x);
if (NPH_Path == null){
};
NPH_Enemies[_local5].pPath = NPH_Path;
NPH_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPH_selectedtowertype == "Ice"){
_local3 = true;
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPH_Map, NPH_MapStart.y, NPH_MapStart.x, NPH_MapEnd.y, NPH_MapEnd.x) != null){
_local6 = (NPH_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPH_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPH_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPH_Gold >= 25)) && ((_local3 == true)))){
_local10 = new tower_ice();
_local10.x = (int((root.mouseX / 32)) * 32);
_local10.y = (int((root.mouseY / 32)) * 32);
addChild(_local10);
NPH_Towers.push(_local10);
NPH_Gold = (NPH_Gold - 25);
text_gold.text = String(NPH_Gold);
NPH_Map[Math.round((_local10.y / 32))][Math.round((_local10.x / 32))] = 0;
_local5 = (NPH_Enemies.length - 1);
while (_local5 >= 0) {
if (NPH_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][1]), Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPH_Path = Pathfinding.findPath(NPH_Map, _local2.y, _local2.x, NPH_MapEnd.y, NPH_MapEnd.x);
if (NPH_Path == null){
};
NPH_Enemies[_local5].pPath = NPH_Path;
NPH_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPH_selectedtowertype == "Fire"){
_local3 = true;
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPH_Map, NPH_MapStart.y, NPH_MapStart.x, NPH_MapEnd.y, NPH_MapEnd.x) != null){
_local6 = (NPH_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPH_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPH_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPH_Gold >= 100)) && ((_local3 == true)))){
_local11 = new tower_fire();
_local11.x = (int((root.mouseX / 32)) * 32);
_local11.y = (int((root.mouseY / 32)) * 32);
addChild(_local11);
NPH_Towers.push(_local11);
NPH_Gold = (NPH_Gold - 100);
text_gold.text = String(NPH_Gold);
NPH_Map[Math.round((_local11.y / 32))][Math.round((_local11.x / 32))] = 0;
_local5 = (NPH_Enemies.length - 1);
while (_local5 >= 0) {
if (NPH_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][1]), Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPH_Path = Pathfinding.findPath(NPH_Map, _local2.y, _local2.x, NPH_MapEnd.y, NPH_MapEnd.x);
if (NPH_Path == null){
};
NPH_Enemies[_local5].pPath = NPH_Path;
NPH_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPH_selectedtowertype == "Mine"){
if (NPH_PlacedMine == false){
_local3 = true;
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPH_Map, NPH_MapStart.y, NPH_MapStart.x, NPH_MapEnd.y, NPH_MapEnd.x) != null){
_local6 = (NPH_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPH_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPH_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPH_Gold >= 750)) && ((_local3 == true)))){
_local12 = new building_mine();
_local12.x = (int((root.mouseX / 32)) * 32);
_local12.y = (int((root.mouseY / 32)) * 32);
addChild(_local12);
NPH_Towers.push(_local12);
text_next_gold.x = (_local12.x + 3);
text_next_gold.y = (_local12.y + 18);
addChild(text_next_gold);
NPH_Gold = (NPH_Gold - 750);
text_gold.text = String(NPH_Gold);
NPH_PlacedMine = true;
NPH_LastGoldUpdate = getTimer();
NPH_Map[Math.round((_local12.y / 32))][Math.round((_local12.x / 32))] = 0;
_local5 = (NPH_Enemies.length - 1);
while (_local5 >= 0) {
if (NPH_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][1]), Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPH_Path = Pathfinding.findPath(NPH_Map, _local2.y, _local2.x, NPH_MapEnd.y, NPH_MapEnd.x);
if (NPH_Path == null){
};
NPH_Enemies[_local5].pPath = NPH_Path;
NPH_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
};
if (NPH_selectedtowertype == "Church"){
if (NPH_PlacedChurch == false){
_local3 = true;
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPH_Map, NPH_MapStart.y, NPH_MapStart.x, NPH_MapEnd.y, NPH_MapEnd.x) != null){
_local6 = (NPH_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPH_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPH_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPH_Gold >= 750)) && ((_local3 == true)))){
_local13 = new building_church();
_local13.x = (int((root.mouseX / 32)) * 32);
_local13.y = (int((root.mouseY / 32)) * 32);
addChild(_local13);
NPH_Towers.push(_local13);
text_next_prayer.x = (_local13.x + 5);
text_next_prayer.y = (_local13.y + 18);
addChild(text_next_prayer);
NPH_Gold = (NPH_Gold - 750);
text_gold.text = String(NPH_Gold);
NPH_PlacedChurch = true;
NPH_LastPrayerUpdate = getTimer();
NPH_Map[Math.round((_local13.y / 32))][Math.round((_local13.x / 32))] = 0;
_local5 = (NPH_Enemies.length - 1);
while (_local5 >= 0) {
if (NPH_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][1]), Math.round(NPH_Enemies[_local5].pPath[NPH_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPH_Path = Pathfinding.findPath(NPH_Map, _local2.y, _local2.x, NPH_MapEnd.y, NPH_MapEnd.x);
if (NPH_Path == null){
};
NPH_Enemies[_local5].pPath = NPH_Path;
NPH_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPH_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
};
};
};
};
NPH_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
upgrade_tower.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
text_tower_sell.x = 900;
};
}
public function playnopathsnormal(_arg1:MouseEvent):void{
gotoAndStop(105);
}
public function NP_sell_tower_click(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:Number;
var _local4:int;
if (NP_gamemode != "paused"){
if (NP_SelectedTower != -1){
if (NP_Towers[NP_SelectedTower].pTowerType == 10){
NP_PlacedMine = false;
text_next_gold.x = 1000;
};
if (NP_Towers[NP_SelectedTower].pTowerType == 11){
NP_PlacedChurch = false;
text_next_prayer.x = 1000;
};
NP_Map[Math.round((NP_Towers[NP_SelectedTower].y / 32))][Math.round((NP_Towers[NP_SelectedTower].x / 32))] = 1;
_local4 = (NP_Enemies.length - 1);
while (_local4 >= 0) {
if (NP_Enemies[_local4].y < 45){
_local2 = new Point(Math.round(NP_Enemies[_local4].pPath[NP_Enemies[_local4].pPathIndex][1]), Math.round(NP_Enemies[_local4].pPath[NP_Enemies[_local4].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NP_Path = Pathfinding.findPath(NP_Map, _local2.y, _local2.x, NP_MapEnd.y, NP_MapEnd.x);
NP_Enemies[_local4].pPath = NP_Path;
NP_Enemies[_local4].mapchange();
};
_local4--;
};
NP_Gold = (NP_Gold + int((0.95 * (NP_Towers[NP_SelectedTower].pCost * NP_Towers[NP_SelectedTower].pLevel))));
NP_Gold = Math.round(NP_Gold);
text_gold.text = String(NP_Gold);
removeChild(NP_Towers[NP_SelectedTower]);
NP_Towers.splice(NP_SelectedTower, 1);
NP_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
upgrade_tower.x = 900;
text_tower_sell.x = 900;
};
};
}
public function NPI_CheckEnemiesForHit():void{
var i:int;
var k:int;
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var a:int;
if (NPI_gamemode != "paused"){
try {
i = (NPI_Enemies.length - 1);
while (i >= 0) {
k = (NPI_Bullets.length - 1);
while (k >= 0) {
if (NPI_Enemies[i].hitTestObject(NPI_Bullets[k])){
NPI_Enemies[i].GotHit(NPI_Bullets[k].pDamage, NPI_Bullets[k].pBulletType);
if (NPI_Bullets[k].pBulletType == 2){
if (NPI_Enemies[i].pSpeed > 0.3){
NPI_Enemies[i].pSpeed = (NPI_Enemies[i].pSpeed - 0.2);
};
};
if (NPI_Bullets[k].pBulletType == 4){
a = (NPI_Enemies.length - 1);
while (a >= 0) {
xdist = Math.round((NPI_Bullets[k].x - NPI_Enemies[a].x));
ydist = Math.round((NPI_Bullets[k].y - NPI_Enemies[a].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < 50){
if (a != NPI_Bullets[k].pTarget){
NPI_Enemies[a].GotHit(((5 * NPI_Towers[NPI_Bullets[k].pTower].pLevel) * 0.75), 4);
};
};
a = (a - 1);
};
};
NPI_Bullets[k].x = -100;
NPI_Bullets[k].y = -100;
if (NPI_Bullets[k].pVisible == true){
removeChild(NPI_Bullets[k].pBullet);
};
NPI_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function NP_MoveAndCheckAngelsOfDeath():void{
var _local1:int;
var _local2:int;
if (NP_gamemode != "paused"){
_local1 = (NP_AngelsOfDeath.length - 1);
while (_local1 >= 0) {
_local2 = (NP_Enemies.length - 1);
while (_local2 >= 0) {
if (NP_Enemies[_local2].hitTestObject(NP_AngelsOfDeath[_local1])){
NP_Enemies[_local2].GotHit(25, 1);
};
_local2--;
};
if (NP_AngelsOfDeath[_local1].y < -64){
drawonme.removeChild(NP_AngelsOfDeath[_local1]);
NP_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
public function restart_game9(_arg1:MouseEvent):void{
restart_sure.x = 51;
restart_yes.x = 142.9;
restart_no.x = 309;
}
public function NPH_MoveAndCheckAngelsOfDeath():void{
var _local1:int;
var _local2:int;
if (NPH_gamemode != "paused"){
_local1 = (NPH_AngelsOfDeath.length - 1);
while (_local1 >= 0) {
_local2 = (NPH_Enemies.length - 1);
while (_local2 >= 0) {
if (NPH_Enemies[_local2].hitTestObject(NPH_AngelsOfDeath[_local1])){
NPH_Enemies[_local2].GotHit(25, 1);
};
_local2--;
};
if (NPH_AngelsOfDeath[_local1].y < -64){
drawonme.removeChild(NPH_AngelsOfDeath[_local1]);
NPH_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
public function NPS_restart_yes(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (NPS_HealthBars.length - 1);
while (_local2 >= 0) {
removeChild(NPS_HealthBars[_local2]);
NPS_HealthBars.splice(_local2, 1);
_local2--;
};
_local3 = (NPS_Bullets.length - 1);
while (_local3 >= 0) {
if (NPS_Bullets[_local3].pVisible == true){
removeChild(NPS_Bullets[_local3]);
};
NPS_Bullets.splice(_local3, 1);
_local3--;
};
_local4 = (NPS_Towers.length - 1);
while (_local4 >= 0) {
removeChild(NPS_Towers[_local4]);
NPS_Towers.splice(_local4, 1);
_local4--;
};
_local5 = (NPS_Enemies.length - 1);
while (_local5 >= 0) {
removeChild(NPS_Enemies[_local5]);
NPS_Enemies.splice(_local5, 1);
_local5--;
};
removeEventListener(Event.ENTER_FRAME, NPS_everytime);
removeEventListener(KeyboardEvent.KEY_UP, NPS_reportKeyUp);
NPS_channel.stop();
gotoAndStop(10);
}
public function NP_tower_select_arcane_mouse_up(_arg1:MouseEvent):void{
if (NP_gamemode != "paused"){
if (NP_gamemode == "set_tower"){
if (NP_selectedtowertype == "Arcane"){
NP_gamemode = "off";
TheGrid1.alpha = 0;
if (NP_Muted == false){
NP_ButtonClick.play();
};
NP_selectedtowertype = "none";
} else {
if (NP_selectedtowertype != "Arcane"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
NP_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Arcane";
};
};
} else {
if (NP_gamemode != "set_tower"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
NP_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Arcane";
};
};
};
}
public function NPI_tower_select_fire_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Fire Tower (100g)";
text_towerinfo.text = "Low Dmg, Fast Speed. (Magic Damage)";
}
public function NPS_MoveAndCheckBlizzard():void{
var _local1:int;
var _local2:int;
if (NPS_gamemode != "paused"){
_local1 = (NPS_Blizzards.length - 1);
while (_local1 >= 0) {
_local2 = (NPS_Enemies.length - 1);
while (_local2 >= 0) {
if (NPS_Enemies[_local2].hitTestObject(NPS_Blizzards[_local1])){
NPS_Enemies[_local2].pSpeed = 0;
};
_local2--;
};
if (NPS_Blizzards[_local1].y < -128){
drawonme.removeChild(NPS_Blizzards[_local1]);
NPS_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
function frame10(){
stop();
play_game_normal.addEventListener(MouseEvent.MOUSE_UP, playnormal);
play_game_sandbox.addEventListener(MouseEvent.MOUSE_UP, playsandbox);
play_game_hard.addEventListener(MouseEvent.MOUSE_UP, playhard);
play_game_insane.addEventListener(MouseEvent.MOUSE_UP, playinsane);
play_game_5min.addEventListener(MouseEvent.MOUSE_UP, play5min);
play_game_10min.addEventListener(MouseEvent.MOUSE_UP, play10min);
play_game_30min.addEventListener(MouseEvent.MOUSE_UP, play30min);
play_game_np_normal.addEventListener(MouseEvent.MOUSE_UP, playnopathsnormal);
play_game_np_hard.addEventListener(MouseEvent.MOUSE_UP, playnopathshard);
play_game_np_insane.addEventListener(MouseEvent.MOUSE_UP, playnopathsinsane);
play_game_np_sandbox.addEventListener(MouseEvent.MOUSE_UP, playnopathssandbox);
}
public function NPI_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (NPI_gamemode != "paused"){
if (NPI_Prayer >= 10){
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
NPI_Prayer = (NPI_Prayer - 10);
text_prayer.text = String(NPI_Prayer);
_local2 = 0;
while (_local2 < 10) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
NPI_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function NPH_buy_judgement_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:judgement;
if (NPH_gamemode != "paused"){
if (NPH_Prayer >= 15){
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
NPH_Prayer = (NPH_Prayer - 15);
text_prayer.text = String(NPH_Prayer);
_local2 = 0;
while (_local2 < (NPH_Enemies.length - 1)) {
_local3 = new judgement();
_local3.x = NPH_Enemies[_local2].x;
_local3.y = NPH_Enemies[_local2].y;
NPH_Enemies[_local2].GotHit(999999, 1);
drawonme.addChild(_local3);
NPH_Judgement.push(_local3);
_local2++;
};
};
};
}
public function NPS_restart_no(_arg1:MouseEvent):void{
restart_sure.x = 1000;
restart_yes.x = 1000;
restart_no.x = 1000;
}
public function NPI_CheckEnemyHealth():void{
var i:int;
var h:int;
var k:int;
var a:int;
if (NPI_gamemode != "paused"){
try {
i = (NPI_Enemies.length - 1);
while (i >= 0) {
if (NPI_Enemies[i].pHealth <= 0){
NPI_Enemies[i].x = -500;
NPI_Enemies[i].y = -500;
if (NPI_Enemies[i].pType == 5){
NPI_Gold = (NPI_Gold + Math.round(((1.75 * NPI_GameLevel) + 0.5)));
NPI_GameScore = (NPI_GameScore + 50);
} else {
NPI_Gold = (NPI_Gold + Math.round(((0.25 * NPI_GameLevel) + 0.5)));
NPI_GameScore = (NPI_GameScore + 10);
};
removeChild(NPI_Enemies[i]);
NPI_Enemies.splice(i, 1);
text_gold.text = String(NPI_Gold);
text_score.text = String(NPI_GameScore);
h = (NPI_HealthBars.length - 1);
while (h >= 0) {
if (NPI_HealthBars[h].pEnemy == i){
NPI_HealthBars[h].x = -900;
removeChild(NPI_HealthBars[h]);
NPI_HealthBars.splice(h, 1);
};
if (NPI_HealthBars[h].pEnemy > i){
NPI_HealthBars[h].pEnemy = (NPI_HealthBars[h].pEnemy - 1);
};
h = (h - 1);
};
k = (NPI_Bullets.length - 1);
while (k >= 0) {
if (k != i){
if (NPI_Bullets[k].pTarget > i){
NPI_Bullets[k].pTarget = (NPI_Bullets[k].pTarget - 1);
};
};
if (NPI_Bullets[k].pTarget == i){
NPI_Bullets[k].x = -100;
NPI_Bullets[k].y = -100;
if (NPI_Bullets[k].pVisible == true){
removeChild(NPI_Bullets[k].pBullet);
};
NPI_Bullets.splice(k, 1);
};
k = (k - 1);
};
a = (NPI_Towers.length - 1);
while (a >= 0) {
if (NPI_Towers[a].pTarget == i){
NPI_Towers[a].pTarget = -1;
};
if (NPI_Towers[a].pTarget > i){
NPI_Towers[a].pTarget = (NPI_Towers[a].pTarget - 1);
};
a = (a - 1);
};
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function NPI_tower_select_ice_mouse_up(_arg1:MouseEvent):void{
if (NPI_gamemode != "paused"){
if (NPI_gamemode == "set_tower"){
if (NPI_selectedtowertype == "Ice"){
NPI_gamemode = "off";
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
TheGrid1.alpha = 0;
NPI_selectedtowertype = "none";
} else {
if (NPI_selectedtowertype != "Ice"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Ice";
};
};
} else {
if (NPI_gamemode != "set_tower"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Ice";
};
};
};
}
public function NPS_tower_select_arrow_mouse_up(_arg1:MouseEvent):void{
if (NPS_gamemode != "paused"){
if (NPS_gamemode == "set_tower"){
if (NPS_selectedtowertype == "Arrow"){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
NPS_gamemode = "off";
TheGrid1.alpha = 0;
NPS_selectedtowertype = "none";
} else {
if (NPS_selectedtowertype != "Arrow"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Arrow";
};
};
} else {
if (NPS_gamemode != "set_tower"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Arrow";
};
};
};
}
public function NPS_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
text_tower_level.text = ("Level - " + NPS_Towers[NPS_SelectedTower].pLevel);
text_tower_damage.text = ("Damage - " + NPS_Towers[NPS_SelectedTower].pDamage.toFixed(2));
} catch(e:TypeError) {
};
}
public function NPI_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(10 PP)";
text_towerinfo.text = "Calls forth the Angel of Death.";
}
public function NP_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
if (NP_gamemode != "paused"){
if (NP_Towers[NP_SelectedTower].pLevel < 51){
if (NP_Gold >= (0.5 * (NP_Towers[NP_SelectedTower].pCost * (NP_Towers[NP_SelectedTower].pLevel + 1)))){
NP_Gold = (NP_Gold - (0.5 * (NP_Towers[NP_SelectedTower].pCost * (NP_Towers[NP_SelectedTower].pLevel + 1))));
NP_Gold = Math.round(NP_Gold);
text_gold.text = String(NP_Gold);
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
NP_Towers[NP_SelectedTower].pLevel = (NP_Towers[NP_SelectedTower].pLevel + 1);
NP_Towers[NP_SelectedTower].pDamage = (NP_Towers[NP_SelectedTower].pOrigDamage * ((NP_Towers[NP_SelectedTower].pLevel / 1.1) * ((NP_Towers[NP_SelectedTower].pLevel / 10) + 1)));
upgrade_tower.x = 900;
_local2 = (NP_Towers[NP_SelectedTower].pOrigDamage * (((NP_Towers[NP_SelectedTower].pLevel + 1) / 1.1) * (((NP_Towers[NP_SelectedTower].pLevel + 1) / 10) + 1)));
text_towertype.text = (("Upgrade(" + (0.5 * (NP_Towers[NP_SelectedTower].pCost * (NP_Towers[NP_SelectedTower].pLevel + 1)))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_level.text = (((("Level - " + NP_Towers[NP_SelectedTower].pLevel) + "(") + (NP_Towers[NP_SelectedTower].pLevel + 1)) + ")");
text_tower_damage.text = (((("Damage - " + NP_Towers[NP_SelectedTower].pDamage.toFixed(2)) + "(") + _local2.toFixed(2)) + ")");
text_tower_range.text = ("Range - " + NP_Towers[NP_SelectedTower].pRange);
text_tower_sell.text = ("Sell Value - " + String(int(((NP_Towers[NP_SelectedTower].pLevel * NP_Towers[NP_SelectedTower].pCost) * 0.7))));
};
};
};
}
public function playthegame11(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function NP_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
NP_gamemode = "paused";
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
playbutton.x = 99;
pausebutton.x = 900;
NP_PausedTimer1 = getTimer();
_local2 = (NP_Enemies.length - 1);
while (_local2 >= 0) {
NP_Enemies[_local2].pPaused = true;
_local2--;
};
_local3 = (NP_AngelsOfDeath.length - 1);
while (_local3 >= 0) {
NP_AngelsOfDeath[_local3].pPaused = true;
_local3--;
};
_local4 = (NP_Blizzards.length - 1);
while (_local4 >= 0) {
NP_Blizzards[_local4].pPaused = true;
_local4--;
};
}
public function NPH_CheckTowerFireBullet():void{
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var closest:Number;
var closestmob:Number;
var i:int;
var a:int;
var k:int;
var Bullet1:script_bullet_arrow;
var Bullet2:script_bullet_ice;
var Bullet3:script_bullet_arcane;
var Bullet4:script_bullet_cannon;
var Bullet5:script_bullet_fire;
closest = 5000;
closestmob = -1;
if (NPH_gamemode != "paused"){
try {
i = (NPH_Towers.length - 1);
while (i >= 0) {
if (NPH_Towers[i].pTowerType <= 5){
closest = 5000;
NPH_Towers[i].pTarget = -1;
k = (NPH_Enemies.length - 1);
while (k >= 0) {
xdist = Math.round(((NPH_Towers[i].x + 16) - NPH_Enemies[k].x));
ydist = Math.round(((NPH_Towers[i].y + 16) - NPH_Enemies[k].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < NPH_Towers[i].pRange){
if (NPH_Enemies[k].pType == 4){
if (NPH_Towers[i].pTowerType != 2){
if (NPH_Towers[i].pTowerType != 3){
if (NPH_Towers[i].pTowerType != 5){
NPH_Towers[i].pTarget = k;
};
};
};
};
if (NPH_Enemies[k].pType != 4){
NPH_Towers[i].pTarget = k;
};
};
k = (k - 1);
};
};
i = (i - 1);
};
a = (NPH_Towers.length - 1);
while (a >= 0) {
if (NPH_Towers[a].pTowerType <= 5){
if (NPH_Enemies.length > 0){
if (NPH_Towers[a].pTarget != -1){
if (NPH_Enemies[NPH_Towers[a].pTarget].pHealth > 0){
xdist = Math.round(((NPH_Towers[a].x + 16) - NPH_Enemies[NPH_Towers[a].pTarget].x));
ydist = Math.round(((NPH_Towers[a].y + 16) - NPH_Enemies[NPH_Towers[a].pTarget].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < NPH_Towers[a].pRange){
if (NPH_Enemies[NPH_Towers[a].pTarget].y > 0){
if (getTimer() > (NPH_Towers[a].pLastFire + NPH_Towers[a].pSpeed)){
NPH_Towers[a].pLastFire = getTimer();
if (NPH_Towers[a].pTowerType == 1){
Bullet1 = new script_bullet_arrow(NPH_Towers[a].pTarget);
};
if (NPH_Towers[a].pTowerType == 2){
Bullet2 = new script_bullet_ice(NPH_Towers[a].pTarget);
};
if (NPH_Towers[a].pTowerType == 3){
Bullet3 = new script_bullet_arcane(NPH_Towers[a].pTarget);
};
if (NPH_Towers[a].pTowerType == 4){
Bullet4 = new script_bullet_cannon(NPH_Towers[a].pTarget);
};
if (NPH_Towers[a].pTowerType == 5){
Bullet5 = new script_bullet_fire(NPH_Towers[a].pTarget);
};
if (NPH_Towers[a].pTowerType == 1){
Bullet1.x = (NPH_Towers[a].x + 16);
Bullet1.y = (NPH_Towers[a].y + 16);
Bullet1.pDamage = NPH_Towers[a].pDamage;
Bullet1.pBullet = Bullet1;
if (NPH_Bullets.length < 100){
Bullet1.pVisible = true;
addChild(Bullet1);
};
NPH_Bullets.push(Bullet1);
Bullet1.pTower = a;
};
if (NPH_Towers[a].pTowerType == 2){
Bullet2.x = (NPH_Towers[a].x + 16);
Bullet2.y = (NPH_Towers[a].y + 16);
Bullet2.pDamage = NPH_Towers[a].pDamage;
Bullet2.pBullet = Bullet2;
if (NPH_Bullets.length < 100){
Bullet2.pVisible = true;
addChild(Bullet2);
};
NPH_Bullets.push(Bullet2);
Bullet2.pTower = a;
};
if (NPH_Towers[a].pTowerType == 3){
Bullet3.x = (NPH_Towers[a].x + 16);
Bullet3.y = (NPH_Towers[a].y + 16);
Bullet3.pDamage = NPH_Towers[a].pDamage;
Bullet3.pBullet = Bullet3;
if (NPH_Bullets.length < 100){
Bullet3.pVisible = true;
addChild(Bullet3);
};
NPH_Bullets.push(Bullet3);
Bullet3.pTower = a;
};
if (NPH_Towers[a].pTowerType == 4){
Bullet4.x = (NPH_Towers[a].x + 16);
Bullet4.y = (NPH_Towers[a].y + 16);
Bullet4.pDamage = NPH_Towers[a].pDamage;
Bullet4.pBullet = Bullet4;
if (NPH_Bullets.length < 100){
Bullet4.pVisible = true;
addChild(Bullet4);
};
NPH_Bullets.push(Bullet4);
Bullet4.pTower = a;
};
if (NPH_Towers[a].pTowerType == 5){
Bullet5.x = (NPH_Towers[a].x + 16);
Bullet5.y = (NPH_Towers[a].y + 16);
Bullet5.pDamage = NPH_Towers[a].pDamage;
Bullet5.pBullet = Bullet5;
if (NPH_Bullets.length < 100){
Bullet5.pVisible = true;
addChild(Bullet5);
};
NPH_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function NPH_reportKeyUp(_arg1:KeyboardEvent):void{
var _local2:int;
if (_arg1.keyCode == 49){
NPH_tower_select_arrow_mouse_up(NPH_MouseEvent);
};
if (_arg1.keyCode == 50){
NPH_tower_select_cannon_mouse_up(NPH_MouseEvent);
};
if (_arg1.keyCode == 51){
NPH_tower_select_arcane_mouse_up(NPH_MouseEvent);
};
if (_arg1.keyCode == 52){
NPH_tower_select_fire_mouse_up(NPH_MouseEvent);
};
if (_arg1.keyCode == 53){
NPH_tower_select_ice_mouse_up(NPH_MouseEvent);
};
if (_arg1.keyCode == 85){
if (NPH_gamemode != "paused"){
if (NPH_SelectedTower != -1){
_local2 = 0;
while (_local2 <= 41) {
if (NPH_Towers[NPH_SelectedTower].pLevel < 41){
if (NPH_Gold >= (0.5 * (NPH_Towers[NPH_SelectedTower].pCost * (NPH_Towers[NPH_SelectedTower].pLevel + 1)))){
NPH_Gold = (NPH_Gold - (0.5 * (NPH_Towers[NPH_SelectedTower].pCost * (NPH_Towers[NPH_SelectedTower].pLevel + 1))));
NPH_Gold = Math.round(NPH_Gold);
text_gold.text = String(NPH_Gold);
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
NPH_Towers[NPH_SelectedTower].pLevel = (NPH_Towers[NPH_SelectedTower].pLevel + 1);
NPH_Towers[NPH_SelectedTower].pDamage = (NPH_Towers[NPH_SelectedTower].pOrigDamage * ((NPH_Towers[NPH_SelectedTower].pLevel / 1.1) * ((NPH_Towers[NPH_SelectedTower].pLevel / 10) + 1)));
upgrade_tower.x = 900;
text_tower_range.text = ("Range - " + NPH_Towers[NPH_SelectedTower].pRange);
text_tower_damage.text = ("Damage - " + NPH_Towers[NPH_SelectedTower].pDamage.toFixed(2));
text_tower_level.text = ("Level - " + String(NPH_Towers[NPH_SelectedTower].pLevel));
text_tower_sell.text = ("Sell Value - " + String(int(((NPH_Towers[NPH_SelectedTower].pLevel * NPH_Towers[NPH_SelectedTower].pCost) * 0.7))));
};
};
_local2++;
};
};
};
};
if (_arg1.keyCode == 83){
NPH_sell_tower_click(NPH_MouseEvent);
};
}
public function NP_restart_no(_arg1:MouseEvent):void{
restart_sure.x = 1000;
restart_yes.x = 1000;
restart_no.x = 1000;
}
public function playthegame12(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function NPS_MoveAndCheckAngelsOfDeath():void{
var _local1:int;
var _local2:int;
if (NPS_gamemode != "paused"){
_local1 = (NPS_AngelsOfDeath.length - 1);
while (_local1 >= 0) {
_local2 = (NPS_Enemies.length - 1);
while (_local2 >= 0) {
if (NPS_Enemies[_local2].hitTestObject(NPS_AngelsOfDeath[_local1])){
NPS_Enemies[_local2].GotHit(25, 1);
};
_local2--;
};
if (NPS_AngelsOfDeath[_local1].y < -64){
drawonme.removeChild(NPS_AngelsOfDeath[_local1]);
NPS_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
public function playthegame10(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function NPI_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
NPI_gamemode = "paused";
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
playbutton.x = 99;
pausebutton.x = 900;
NPI_PausedTimer1 = getTimer();
_local2 = (NPI_Enemies.length - 1);
while (_local2 >= 0) {
NPI_Enemies[_local2].pPaused = true;
_local2--;
};
_local3 = (NPI_AngelsOfDeath.length - 1);
while (_local3 >= 0) {
NPI_AngelsOfDeath[_local3].pPaused = true;
_local3--;
};
_local4 = (NPI_Blizzards.length - 1);
while (_local4 >= 0) {
NPI_Blizzards[_local4].pPaused = true;
_local4--;
};
}
public function NP_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
text_tower_level.text = ("Level - " + NP_Towers[NP_SelectedTower].pLevel);
text_tower_damage.text = ("Damage - " + NP_Towers[NP_SelectedTower].pDamage.toFixed(2));
} catch(e:TypeError) {
};
}
function frame1(){
MochiAd.showPreloaderAd({clip:this.root, id:"d8d892ac1120ac68", res:"640x480"});
}
public function NP_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function NPH_restart_yes(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (NPH_HealthBars.length - 1);
while (_local2 >= 0) {
removeChild(NPH_HealthBars[_local2]);
NPH_HealthBars.splice(_local2, 1);
_local2--;
};
_local3 = (NPH_Bullets.length - 1);
while (_local3 >= 0) {
if (NPH_Bullets[_local3].pVisible == true){
removeChild(NPH_Bullets[_local3]);
};
NPH_Bullets.splice(_local3, 1);
_local3--;
};
_local4 = (NPH_Towers.length - 1);
while (_local4 >= 0) {
removeChild(NPH_Towers[_local4]);
NPH_Towers.splice(_local4, 1);
_local4--;
};
_local5 = (NPH_Enemies.length - 1);
while (_local5 >= 0) {
removeChild(NPH_Enemies[_local5]);
NPH_Enemies.splice(_local5, 1);
_local5--;
};
removeEventListener(Event.ENTER_FRAME, NPH_everytime);
removeEventListener(KeyboardEvent.KEY_UP, NPH_reportKeyUp);
NPH_channel.stop();
gotoAndStop(10);
}
public function NPI_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (NPI_gamemode != "paused"){
if (NPI_Enemies.length < 51){
if (NPI_GameLevel != 0){
NPI_GameScore = (NPI_GameScore + Math.round((((NPI_WaveDelay + NPI_LastWave) - getTimer()) / 1000)));
text_score.text = String(NPI_GameScore);
};
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
NPI_placeenemies();
};
};
}
public function NPH_select_mine_mouse_up(_arg1:MouseEvent):void{
if (NPH_gamemode != "paused"){
if (NPH_gamemode == "set_tower"){
if (NPH_selectedtowertype == "Mine"){
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
NPH_gamemode = "off";
TheGrid1.alpha = 0;
NPH_selectedtowertype = "none";
} else {
if (NPH_selectedtowertype != "Mine"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Mine";
};
};
} else {
if (NPH_gamemode != "set_tower"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Mine";
};
};
};
}
public function NPS_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
return (false);
}
public function NPS_tower_select_cannon_mouse_up(_arg1:MouseEvent):void{
if (NPS_gamemode != "paused"){
if (NPS_gamemode == "set_tower"){
if (NPS_selectedtowertype == "Cannon"){
NPS_gamemode = "off";
TheGrid1.alpha = 0;
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
NPS_selectedtowertype = "none";
} else {
if (NPS_selectedtowertype != "Cannon"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Cannon";
};
};
} else {
if (NPS_gamemode != "set_tower"){
NPS_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
NPS_selectedtowertype = "Cannon";
};
};
};
}
public function NPI_tower_select_cannon_mouse_up(_arg1:MouseEvent):void{
if (NPI_gamemode != "paused"){
if (NPI_gamemode == "set_tower"){
if (NPI_selectedtowertype == "Cannon"){
NPI_gamemode = "off";
TheGrid1.alpha = 0;
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
NPI_selectedtowertype = "none";
} else {
if (NPI_selectedtowertype != "Cannon"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Cannon";
};
};
} else {
if (NPI_gamemode != "set_tower"){
NPI_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
NPI_selectedtowertype = "Cannon";
};
};
};
}
public function NPI_everytime(_arg1:Event):void{
var b:int;
var mX:int;
var mY:int;
var didHit:Boolean;
var event = _arg1;
try {
if (NPI_gamemode != "paused"){
NPI_CheckEnemiesForDirections();
NPI_CheckTowerFireBullet();
NPI_MoveBullets();
NPI_CheckEnemiesForHit();
NPI_CheckEnemyHealth();
NPI_UpdateEnemyHealthBar();
NPI_CheckSelectedTower();
NPI_MoveAndCheckAngelsOfDeath();
NPI_MoveAndCheckBlizzard();
NPI_MoveAndCheckJudgement();
if (getTimer() > (NPI_LastWave + NPI_WaveDelay)){
NPI_placeenemies();
};
text_next_level.text = String(Math.round((((NPI_WaveDelay + NPI_LastWave) - getTimer()) / 1000)));
if (NPI_PlacedMine == true){
text_next_gold.text = String(Math.round((((NPI_GoldUpdateSpeed + NPI_LastGoldUpdate) - getTimer()) / 1000)));
if (getTimer() > (NPI_LastGoldUpdate + NPI_GoldUpdateSpeed)){
NPI_Gold = (NPI_Gold + (NPI_Gold * 0.02));
NPI_Gold = Math.round(NPI_Gold);
text_gold.text = String(NPI_Gold);
NPI_LastGoldUpdate = getTimer();
};
};
if (NPI_PlacedChurch == true){
text_next_prayer.text = String(Math.round((((NPI_PrayerUpdateSpeed + NPI_LastPrayerUpdate) - getTimer()) / 1000)));
if (getTimer() > (NPI_LastPrayerUpdate + NPI_PrayerUpdateSpeed)){
NPI_Prayer = (NPI_Prayer + 1);
text_prayer.text = String(NPI_Prayer);
NPI_LastPrayerUpdate = getTimer();
};
};
if (NPI_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) <= 13)) && ((int((root.mouseY / 32)) >= 2)))){
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.lineTo(mX, mY);
TheGrid1.graphics.lineTo((mX + 32), mY);
TheGrid1.graphics.lineTo((mX + 32), (mY + 32));
TheGrid1.graphics.lineTo(mX, (mY + 32));
TheGrid1.graphics.endFill();
};
};
};
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) <= 13)) && ((int((root.mouseY / 32)) >= 2)))){
if (NPI_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NPI_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NPI_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 124);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 123);
TheGrid1.graphics.endFill();
};
if (NPI_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NPI_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 100);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 99);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 98);
TheGrid1.graphics.endFill();
};
};
};
};
b = (NPI_Towers.length - 1);
while (b >= 0) {
NPI_Towers[b].graphics.clear();
b = (b - 1);
};
drawonme.graphics.clear();
if (NPI_SelectedTower != -1){
mX = 0;
mY = 0;
NPI_Towers[NPI_SelectedTower].graphics.clear();
NPI_Towers[NPI_SelectedTower].graphics.moveTo(mX, mY);
NPI_Towers[NPI_SelectedTower].graphics.beginFill(0xFFFFFF, 0.5);
NPI_Towers[NPI_SelectedTower].graphics.lineTo(mX, mY);
NPI_Towers[NPI_SelectedTower].graphics.lineTo((mX + 32), mY);
NPI_Towers[NPI_SelectedTower].graphics.lineTo((mX + 32), (mY + 32));
NPI_Towers[NPI_SelectedTower].graphics.lineTo(mX, (mY + 32));
NPI_Towers[NPI_SelectedTower].graphics.endFill();
if (NPI_Towers[NPI_SelectedTower].pTowerType <= 5){
upgrade_tower.x = 524;
} else {
upgrade_tower.x = 900;
};
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((NPI_Towers[NPI_SelectedTower].x + 16), (NPI_Towers[NPI_SelectedTower].y + 16), NPI_Towers[NPI_SelectedTower].pRange);
drawonme.graphics.endFill();
};
};
} catch(e:TypeError) {
};
}
public function NP_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(10 PP)";
text_towerinfo.text = "Calls forth the Angel of Death.";
}
public function NPH_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function NPI_MoveBullets():void{
var i:int;
var a:int;
if (NPI_gamemode != "paused"){
try {
i = (NPI_Bullets.length - 1);
while (i >= 0) {
NPI_Bullets[i].movebullet(NPI_Enemies[NPI_Bullets[i].pTarget].x, NPI_Enemies[NPI_Bullets[i].pTarget].y);
i = (i - 1);
};
} catch(e:TypeError) {
a = (NPI_Bullets.length - 1);
while (a >= 0) {
NPI_Bullets[a].x = -900;
NPI_Bullets[a].y = -900;
NPI_Bullets[a].pTarget = -1;
if (NPI_Bullets[a].pVisible == true){
removeChild(NPI_Bullets[a].pBullet);
};
NPI_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
public function NPH_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (NPH_gamemode != "paused"){
if (NPH_Prayer >= 3){
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
NPH_Prayer = (NPH_Prayer - 3);
text_prayer.text = String(NPH_Prayer);
_local2 = 0;
while (_local2 < 10) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
NPH_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function NPS_everytime(_arg1:Event):void{
var b:int;
var mX:int;
var mY:int;
var didHit:Boolean;
var event = _arg1;
try {
if (NPS_gamemode != "paused"){
NPS_CheckEnemiesForDirections();
NPS_CheckTowerFireBullet();
NPS_MoveBullets();
NPS_CheckEnemiesForHit();
NPS_CheckEnemyHealth();
NPS_UpdateEnemyHealthBar();
NPS_CheckSelectedTower();
NPS_MoveAndCheckAngelsOfDeath();
NPS_MoveAndCheckBlizzard();
NPS_MoveAndCheckJudgement();
if (getTimer() > (NPS_LastWave + NPS_WaveDelay)){
NPS_placeenemies();
};
text_next_level.text = String(Math.round((((NPS_WaveDelay + NPS_LastWave) - getTimer()) / 1000)));
if (NPS_PlacedMine == true){
text_next_gold.text = String(Math.round((((NPS_GoldUpdateSpeed + NPS_LastGoldUpdate) - getTimer()) / 1000)));
if (getTimer() > (NPS_LastGoldUpdate + NPS_GoldUpdateSpeed)){
NPS_Gold = (NPS_Gold + (NPS_Gold * 0.02));
NPS_Gold = Math.round(NPS_Gold);
text_gold.text = String(NPS_Gold);
NPS_LastGoldUpdate = getTimer();
};
};
if (NPS_PlacedChurch == true){
text_next_prayer.text = String(Math.round((((NPS_PrayerUpdateSpeed + NPS_LastPrayerUpdate) - getTimer()) / 1000)));
if (getTimer() > (NPS_LastPrayerUpdate + NPS_PrayerUpdateSpeed)){
NPS_Prayer = (NPS_Prayer + 1);
text_prayer.text = String(NPS_Prayer);
NPS_LastPrayerUpdate = getTimer();
};
};
if (NPS_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) <= 13)) && ((int((root.mouseY / 32)) >= 2)))){
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.lineTo(mX, mY);
TheGrid1.graphics.lineTo((mX + 32), mY);
TheGrid1.graphics.lineTo((mX + 32), (mY + 32));
TheGrid1.graphics.lineTo(mX, (mY + 32));
TheGrid1.graphics.endFill();
};
};
};
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) <= 13)) && ((int((root.mouseY / 32)) >= 2)))){
if (NPS_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NPS_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NPS_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 124);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 123);
TheGrid1.graphics.endFill();
};
if (NPS_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NPS_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 100);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 99);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 98);
TheGrid1.graphics.endFill();
};
};
};
};
b = (NPS_Towers.length - 1);
while (b >= 0) {
NPS_Towers[b].graphics.clear();
b = (b - 1);
};
drawonme.graphics.clear();
if (NPS_SelectedTower != -1){
mX = 0;
mY = 0;
NPS_Towers[NPS_SelectedTower].graphics.clear();
NPS_Towers[NPS_SelectedTower].graphics.moveTo(mX, mY);
NPS_Towers[NPS_SelectedTower].graphics.beginFill(0xFFFFFF, 0.5);
NPS_Towers[NPS_SelectedTower].graphics.lineTo(mX, mY);
NPS_Towers[NPS_SelectedTower].graphics.lineTo((mX + 32), mY);
NPS_Towers[NPS_SelectedTower].graphics.lineTo((mX + 32), (mY + 32));
NPS_Towers[NPS_SelectedTower].graphics.lineTo(mX, (mY + 32));
NPS_Towers[NPS_SelectedTower].graphics.endFill();
if (NPS_Towers[NPS_SelectedTower].pTowerType <= 5){
upgrade_tower.x = 524;
} else {
upgrade_tower.x = 900;
};
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((NPS_Towers[NPS_SelectedTower].x + 16), (NPS_Towers[NPS_SelectedTower].y + 16), NPS_Towers[NPS_SelectedTower].pRange);
drawonme.graphics.endFill();
};
};
} catch(e:TypeError) {
};
}
public function NPH_restart_no(_arg1:MouseEvent):void{
restart_sure.x = 1000;
restart_yes.x = 1000;
restart_no.x = 1000;
}
public function playsandbox(_arg1:MouseEvent):void{
gotoAndStop(20);
}
public function NP_UpdateEnemyHealthBar():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (NP_gamemode != "paused"){
_local3 = (NP_HealthBars.length - 1);
while (_local3 >= 0) {
_local1 = (NP_Enemies[NP_HealthBars[_local3].pEnemy].pHealth / NP_Enemies[NP_HealthBars[_local3].pEnemy].pStartHealth);
_local1 = (_local1 * 100);
_local2 = ((27 * _local1) / 100);
NP_HealthBars[_local3].x = (NP_Enemies[NP_HealthBars[_local3].pEnemy].x - 13);
NP_HealthBars[_local3].y = (NP_Enemies[NP_HealthBars[_local3].pEnemy].y - 16);
NP_HealthBars[_local3].pWidth = _local2;
NP_HealthBars[_local3].width = _local2;
_local3--;
};
};
}
public function NPI_MoveAndCheckAngelsOfDeath():void{
var _local1:int;
var _local2:int;
if (NPI_gamemode != "paused"){
_local1 = (NPI_AngelsOfDeath.length - 1);
while (_local1 >= 0) {
_local2 = (NPI_Enemies.length - 1);
while (_local2 >= 0) {
if (NPI_Enemies[_local2].hitTestObject(NPI_AngelsOfDeath[_local1])){
NPI_Enemies[_local2].GotHit(25, 1);
};
_local2--;
};
if (NPI_AngelsOfDeath[_local1].y < -64){
drawonme.removeChild(NPI_AngelsOfDeath[_local1]);
NPI_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
public function playnormal(_arg1:MouseEvent):void{
gotoAndStop(35);
}
public function play10min(_arg1:MouseEvent):void{
gotoAndStop(75);
}
public function NPH_tower_select_cannon_mouse_up(_arg1:MouseEvent):void{
if (NPH_gamemode != "paused"){
if (NPH_gamemode == "set_tower"){
if (NPH_selectedtowertype == "Cannon"){
NPH_gamemode = "off";
TheGrid1.alpha = 0;
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
NPH_selectedtowertype = "none";
} else {
if (NPH_selectedtowertype != "Cannon"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Cannon";
};
};
} else {
if (NPH_gamemode != "set_tower"){
NPH_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
NPH_selectedtowertype = "Cannon";
};
};
};
}
public function NP_tower_select_ice_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Ice Tower (25g)";
text_towerinfo.text = "Slows enemies down. (Magic Damage)";
}
public function NPI_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
return (false);
}
public function NP_buy_judgement_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Judgement Day(15 PP)";
text_towerinfo.text = "Calls forth Judgement Day upon your enemies.";
}
public function NPS_the_grid_place_tower(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:Boolean;
var _local4:Number;
var _local5:*;
var _local6:int;
var _local7:tower_arrow;
var _local8:tower_arcane;
var _local9:tower_cannon;
var _local10:tower_ice;
var _local11:tower_fire;
var _local12:building_mine;
var _local13:building_church;
if (NPS_gamemode != "paused"){
if (NPS_gamemode == "set_tower"){
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) >= 2)) && ((int((root.mouseY / 32)) <= 13)))){
if (NPS_selectedtowertype == "Arrow"){
_local3 = true;
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPS_Map, NPS_MapStart.y, NPS_MapStart.x, NPS_MapEnd.y, NPS_MapEnd.x) != null){
_local6 = (NPS_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPS_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPS_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPS_Gold >= 30)) && ((_local3 == true)))){
_local7 = new tower_arrow();
_local7.x = (int((root.mouseX / 32)) * 32);
_local7.y = (int((root.mouseY / 32)) * 32);
addChild(_local7);
NPS_Towers.push(_local7);
NPS_Gold = (NPS_Gold - 30);
text_gold.text = String(NPS_Gold);
NPS_Map[Math.round((_local7.y / 32))][Math.round((_local7.x / 32))] = 0;
_local5 = (NPS_Enemies.length - 1);
while (_local5 >= 0) {
if (NPS_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][1]), Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPS_Path = Pathfinding.findPath(NPS_Map, _local2.y, _local2.x, NPS_MapEnd.y, NPS_MapEnd.x);
if (NPS_Path == null){
};
NPS_Enemies[_local5].pPath = NPS_Path;
NPS_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPS_selectedtowertype == "Arcane"){
_local3 = true;
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPS_Map, NPS_MapStart.y, NPS_MapStart.x, NPS_MapEnd.y, NPS_MapEnd.x) != null){
_local6 = (NPS_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPS_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPS_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPS_Gold >= 125)) && ((_local3 == true)))){
_local8 = new tower_arcane();
_local8.x = (int((root.mouseX / 32)) * 32);
_local8.y = (int((root.mouseY / 32)) * 32);
addChild(_local8);
NPS_Towers.push(_local8);
NPS_Gold = (NPS_Gold - 125);
text_gold.text = String(NPS_Gold);
NPS_Map[Math.round((_local8.y / 32))][Math.round((_local8.x / 32))] = 0;
_local5 = (NPS_Enemies.length - 1);
while (_local5 >= 0) {
if (NPS_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][1]), Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPS_Path = Pathfinding.findPath(NPS_Map, _local2.y, _local2.x, NPS_MapEnd.y, NPS_MapEnd.x);
if (NPS_Path == null){
};
NPS_Enemies[_local5].pPath = NPS_Path;
NPS_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPS_selectedtowertype == "Cannon"){
_local3 = true;
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPS_Map, NPS_MapStart.y, NPS_MapStart.x, NPS_MapEnd.y, NPS_MapEnd.x) != null){
_local6 = (NPS_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPS_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPS_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPS_Gold >= 75)) && ((_local3 == true)))){
_local9 = new tower_cannon();
_local9.x = (int((root.mouseX / 32)) * 32);
_local9.y = (int((root.mouseY / 32)) * 32);
addChild(_local9);
NPS_Towers.push(_local9);
NPS_Gold = (NPS_Gold - 75);
text_gold.text = String(NPS_Gold);
NPS_Map[Math.round((_local9.y / 32))][Math.round((_local9.x / 32))] = 0;
_local5 = (NPS_Enemies.length - 1);
while (_local5 >= 0) {
if (NPS_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][1]), Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPS_Path = Pathfinding.findPath(NPS_Map, _local2.y, _local2.x, NPS_MapEnd.y, NPS_MapEnd.x);
if (NPS_Path == null){
};
NPS_Enemies[_local5].pPath = NPS_Path;
NPS_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPS_selectedtowertype == "Ice"){
_local3 = true;
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPS_Map, NPS_MapStart.y, NPS_MapStart.x, NPS_MapEnd.y, NPS_MapEnd.x) != null){
_local6 = (NPS_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPS_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPS_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPS_Gold >= 25)) && ((_local3 == true)))){
_local10 = new tower_ice();
_local10.x = (int((root.mouseX / 32)) * 32);
_local10.y = (int((root.mouseY / 32)) * 32);
addChild(_local10);
NPS_Towers.push(_local10);
NPS_Gold = (NPS_Gold - 25);
text_gold.text = String(NPS_Gold);
NPS_Map[Math.round((_local10.y / 32))][Math.round((_local10.x / 32))] = 0;
_local5 = (NPS_Enemies.length - 1);
while (_local5 >= 0) {
if (NPS_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][1]), Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPS_Path = Pathfinding.findPath(NPS_Map, _local2.y, _local2.x, NPS_MapEnd.y, NPS_MapEnd.x);
if (NPS_Path == null){
};
NPS_Enemies[_local5].pPath = NPS_Path;
NPS_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPS_selectedtowertype == "Fire"){
_local3 = true;
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPS_Map, NPS_MapStart.y, NPS_MapStart.x, NPS_MapEnd.y, NPS_MapEnd.x) != null){
_local6 = (NPS_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPS_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPS_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPS_Gold >= 100)) && ((_local3 == true)))){
_local11 = new tower_fire();
_local11.x = (int((root.mouseX / 32)) * 32);
_local11.y = (int((root.mouseY / 32)) * 32);
addChild(_local11);
NPS_Towers.push(_local11);
NPS_Gold = (NPS_Gold - 100);
text_gold.text = String(NPS_Gold);
NPS_Map[Math.round((_local11.y / 32))][Math.round((_local11.x / 32))] = 0;
_local5 = (NPS_Enemies.length - 1);
while (_local5 >= 0) {
if (NPS_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][1]), Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPS_Path = Pathfinding.findPath(NPS_Map, _local2.y, _local2.x, NPS_MapEnd.y, NPS_MapEnd.x);
if (NPS_Path == null){
};
NPS_Enemies[_local5].pPath = NPS_Path;
NPS_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPS_selectedtowertype == "Mine"){
if (NPS_PlacedMine == false){
_local3 = true;
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPS_Map, NPS_MapStart.y, NPS_MapStart.x, NPS_MapEnd.y, NPS_MapEnd.x) != null){
_local6 = (NPS_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPS_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPS_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPS_Gold >= 750)) && ((_local3 == true)))){
_local12 = new building_mine();
_local12.x = (int((root.mouseX / 32)) * 32);
_local12.y = (int((root.mouseY / 32)) * 32);
addChild(_local12);
NPS_Towers.push(_local12);
text_next_gold.x = (_local12.x + 3);
text_next_gold.y = (_local12.y + 18);
addChild(text_next_gold);
NPS_Gold = (NPS_Gold - 750);
text_gold.text = String(NPS_Gold);
NPS_PlacedMine = true;
NPS_LastGoldUpdate = getTimer();
NPS_Map[Math.round((_local12.y / 32))][Math.round((_local12.x / 32))] = 0;
_local5 = (NPS_Enemies.length - 1);
while (_local5 >= 0) {
if (NPS_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][1]), Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPS_Path = Pathfinding.findPath(NPS_Map, _local2.y, _local2.x, NPS_MapEnd.y, NPS_MapEnd.x);
if (NPS_Path == null){
};
NPS_Enemies[_local5].pPath = NPS_Path;
NPS_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
};
if (NPS_selectedtowertype == "Church"){
if (NPS_PlacedChurch == false){
_local3 = true;
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPS_Map, NPS_MapStart.y, NPS_MapStart.x, NPS_MapEnd.y, NPS_MapEnd.x) != null){
_local6 = (NPS_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPS_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPS_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPS_Gold >= 1000)) && ((_local3 == true)))){
_local13 = new building_church();
_local13.x = (int((root.mouseX / 32)) * 32);
_local13.y = (int((root.mouseY / 32)) * 32);
addChild(_local13);
NPS_Towers.push(_local13);
text_next_prayer.x = (_local13.x + 5);
text_next_prayer.y = (_local13.y + 18);
addChild(text_next_prayer);
NPS_Gold = (NPS_Gold - 1000);
text_gold.text = String(NPS_Gold);
NPS_PlacedChurch = true;
NPS_LastPrayerUpdate = getTimer();
NPS_Map[Math.round((_local13.y / 32))][Math.round((_local13.x / 32))] = 0;
_local5 = (NPS_Enemies.length - 1);
while (_local5 >= 0) {
if (NPS_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][1]), Math.round(NPS_Enemies[_local5].pPath[NPS_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPS_Path = Pathfinding.findPath(NPS_Map, _local2.y, _local2.x, NPS_MapEnd.y, NPS_MapEnd.x);
if (NPS_Path == null){
};
NPS_Enemies[_local5].pPath = NPS_Path;
NPS_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPS_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
};
};
};
};
NPS_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
upgrade_tower.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
text_tower_sell.x = 900;
};
}
public function NPH_road_deselect(_arg1:MouseEvent):void{
TheGrid1.graphics.clear();
TheGrid1.alpha = 0;
NPH_gamemode = "none";
NPH_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
upgrade_tower.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
text_tower_sell.x = 900;
}
public function NP_musicleft_mouse_up(_arg1:MouseEvent):void{
if (NP_Muted == false){
NP_CurrentSong--;
if (NP_CurrentSong == 0){
NP_CurrentSong = 5;
};
NP_channel.stop();
if (NP_CurrentSong == 1){
NP_channel = NP_Ambient1.play(0, 99999);
};
if (NP_CurrentSong == 2){
NP_channel = NP_Ambient2.play(0, 99999);
};
if (NP_CurrentSong == 3){
NP_channel = NP_Ambient3.play(0, 99999);
};
if (NP_CurrentSong == 4){
NP_channel = NP_Ambient4.play(0, 99999);
};
if (NP_CurrentSong == 5){
NP_channel = NP_Ambient5.play(0, 99999);
};
};
}
public function NPI_UpdateEnemyHealthBar():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (NPI_gamemode != "paused"){
_local3 = (NPI_HealthBars.length - 1);
while (_local3 >= 0) {
_local1 = (NPI_Enemies[NPI_HealthBars[_local3].pEnemy].pHealth / NPI_Enemies[NPI_HealthBars[_local3].pEnemy].pStartHealth);
_local1 = (_local1 * 100);
_local2 = ((27 * _local1) / 100);
NPI_HealthBars[_local3].x = (NPI_Enemies[NPI_HealthBars[_local3].pEnemy].x - 13);
NPI_HealthBars[_local3].y = (NPI_Enemies[NPI_HealthBars[_local3].pEnemy].y - 16);
NPI_HealthBars[_local3].pWidth = _local2;
NPI_HealthBars[_local3].width = _local2;
_local3--;
};
};
}
public function NPH_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (NPH_gamemode != "paused"){
if (NPH_Prayer >= 10){
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
NPH_Prayer = (NPH_Prayer - 10);
text_prayer.text = String(NPH_Prayer);
_local2 = 0;
while (_local2 < 10) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
NPH_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function NPH_buy_church_mouse_up(_arg1:MouseEvent):void{
if (NPH_gamemode != "paused"){
if (NPH_gamemode == "set_tower"){
if (NPH_selectedtowertype == "Church"){
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
NPH_gamemode = "off";
TheGrid1.alpha = 0;
NPH_selectedtowertype = "none";
} else {
if (NPH_selectedtowertype != "Church"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Church";
};
};
} else {
if (NPH_gamemode != "set_tower"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Church";
};
};
};
}
function frame95(){
MochiAd.showTimedAd({clip:this.root, id:"d8d892ac1120ac68", res:"640x480"});
}
public function NPH_buy_judgement_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Judgement Day(15 PP)";
text_towerinfo.text = "Calls forth Judgement Day upon your enemies.";
}
public function NP_CheckEnemiesForHit():void{
var i:int;
var k:int;
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var a:int;
if (NP_gamemode != "paused"){
try {
i = (NP_Enemies.length - 1);
while (i >= 0) {
k = (NP_Bullets.length - 1);
while (k >= 0) {
if (NP_Enemies[i].hitTestObject(NP_Bullets[k])){
NP_Enemies[i].GotHit(NP_Bullets[k].pDamage, NP_Bullets[k].pBulletType);
if (NP_Bullets[k].pBulletType == 2){
if (NP_Enemies[i].pSpeed > 0.3){
NP_Enemies[i].pSpeed = (NP_Enemies[i].pSpeed - 0.2);
};
};
if (NP_Bullets[k].pBulletType == 4){
a = (NP_Enemies.length - 1);
while (a >= 0) {
xdist = Math.round((NP_Bullets[k].x - NP_Enemies[a].x));
ydist = Math.round((NP_Bullets[k].y - NP_Enemies[a].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < 50){
if (a != NP_Bullets[k].pTarget){
NP_Enemies[a].GotHit(((5 * NP_Towers[NP_Bullets[k].pTower].pLevel) * 0.75), 4);
};
};
a = (a - 1);
};
};
NP_Bullets[k].x = -100;
NP_Bullets[k].y = -100;
if (NP_Bullets[k].pVisible == true){
removeChild(NP_Bullets[k].pBullet);
};
NP_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
function frame100(){
gotoAndStop(10);
}
public function NPS_CheckSelectedTower():void{
var _local1:int;
var _local2:int;
if (NPS_gamemode != "paused"){
_local1 = (NPS_Towers.length - 1);
while (_local1 >= 0) {
if (NPS_Towers[_local1].CheckSelected() == true){
NPS_SelectedTower = _local1;
sell_tower.x = 524;
text_tower_damage.x = 484;
text_tower_level.x = 484;
text_tower_range.x = 484;
text_tower_sell.x = 484;
text_tower_damage.text = ("Damage - " + NPS_Towers[_local1].pDamage.toFixed(2));
text_tower_range.text = ("Range - " + NPS_Towers[_local1].pRange);
text_tower_level.text = ("Level - " + NPS_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((NPS_Towers[_local1].pLevel * NPS_Towers[_local1].pCost) * 0.95))));
NPS_gamemode = "none";
TheGrid1.alpha = 0;
NPS_selectedtowertype = "none";
};
_local1--;
};
_local2 = (NPS_Towers.length - 1);
while (_local2 >= 0) {
NPS_Towers[_local2].pSelected = false;
_local2--;
};
};
}
public function NPI_tower_select_arcane_mouse_up(_arg1:MouseEvent):void{
if (NPI_gamemode != "paused"){
if (NPI_gamemode == "set_tower"){
if (NPI_selectedtowertype == "Arcane"){
NPI_gamemode = "off";
TheGrid1.alpha = 0;
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
NPI_selectedtowertype = "none";
} else {
if (NPI_selectedtowertype != "Arcane"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Arcane";
};
};
} else {
if (NPI_gamemode != "set_tower"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Arcane";
};
};
};
}
function frame105(){
stop();
NP_LastWave = getTimer();
NP_WaveDelay = 60000;
NP_GameLevel = 0;
NP_SelectedTower = -1;
NP_GameScore = 0;
NP_Gold = 300;
NP_Lives = 25;
NP_PlacedMine = false;
NP_PlacedChurch = false;
NP_LastGoldUpdate = 0;
NP_LastPrayerUpdate = 0;
NP_PrayerUpdateSpeed = 60000;
NP_GoldUpdateSpeed = 300000;
NP_LastEnemyType = 1;
NP_Map = [];
NP_MapStart = new Point(2, 1);
NP_MapEnd = new Point(14, 14);
NP_CurrentSong = 1;
NP_Muted = false;
NP_Prayer = 0;
NP_Map = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]];
NP_ButtonClick = new buttonclick();
NP_Ambient1 = new ambient_1();
NP_Ambient2 = new ambient_2();
NP_Ambient3 = new ambient_3();
NP_Ambient4 = new ambient_4();
NP_Ambient5 = new ambient_5();
NP_channel = NP_Ambient1.play(0, 99999);
NP_Enemies = new Array();
NP_Buildings = new Array();
NP_Judgement = new Array();
NP_Blizzards = new Array();
NP_HealthBars = new Array();
NP_Towers = new Array();
NP_Bullets = new Array();
NP_AngelsOfDeath = new Array();
NP_gamemode = "none";
addEventListener(Event.ENTER_FRAME, NP_everytime);
stage.addEventListener(KeyboardEvent.KEY_UP, NP_reportKeyUp);
nextlevelbutton.addEventListener(MouseEvent.MOUSE_UP, NP_nextlevelbutton_mouse_up);
pausebutton.addEventListener(MouseEvent.MOUSE_UP, NP_pausebutton_mouse_up);
playbutton.addEventListener(MouseEvent.MOUSE_UP, NP_playbutton_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_UP, NP_musicleft_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_OVER, NP_musicleft_mouse_enter);
musicleft.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
musicright.addEventListener(MouseEvent.MOUSE_UP, NP_musicright_mouse_up);
musicright.addEventListener(MouseEvent.MOUSE_OVER, NP_musicright_mouse_enter);
musicright.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
musicmute.addEventListener(MouseEvent.MOUSE_UP, NP_musicmute_mouse_up);
musicmute.addEventListener(MouseEvent.MOUSE_OVER, NP_musicmute_mouse_enter);
musicmute.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OVER, NP_tower_select_arrow_mouse_enter);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OVER, NP_tower_select_cannon_mouse_enter);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OVER, NP_tower_select_ice_mouse_enter);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OVER, NP_tower_select_fire_mouse_enter);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OVER, NP_tower_select_arcane_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OVER, NP_buy_angel_death_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_UP, NP_buy_angel_death_mouse_up);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
select_mine.addEventListener(MouseEvent.MOUSE_OVER, NP_select_mine_mouse_enter);
select_mine.addEventListener(MouseEvent.MOUSE_UP, NP_select_mine_mouse_up);
select_mine.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
buy_church.addEventListener(MouseEvent.MOUSE_OVER, NP_buy_church_mouse_enter);
buy_church.addEventListener(MouseEvent.MOUSE_UP, NP_buy_church_mouse_up);
buy_church.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OVER, NP_buy_blizzard_mouse_enter);
buy_blizzard.addEventListener(MouseEvent.MOUSE_UP, NP_buy_blizzard_mouse_up);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
buy_judgement.addEventListener(MouseEvent.MOUSE_OVER, NP_buy_judgement_mouse_enter);
buy_judgement.addEventListener(MouseEvent.MOUSE_UP, NP_buy_judgement_mouse_up);
buy_judgement.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OVER, NP_upgrade_tower_mouse_enter);
upgrade_tower.addEventListener(MouseEvent.MOUSE_UP, NP_upgrade_tower_mouse_up);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_UP, NP_tower_select_arrow_mouse_up);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_UP, NP_tower_select_cannon_mouse_up);
tower_select_ice.addEventListener(MouseEvent.MOUSE_UP, NP_tower_select_ice_mouse_up);
tower_select_fire.addEventListener(MouseEvent.MOUSE_UP, NP_tower_select_fire_mouse_up);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_UP, NP_tower_select_arcane_mouse_up);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OUT, NP_tower_select_deselect);
sell_tower.addEventListener(MouseEvent.MOUSE_UP, NP_sell_tower_click);
TheGrid1.addEventListener(MouseEvent.MOUSE_UP, NP_the_grid_place_tower);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game9);
restart_yes.addEventListener(MouseEvent.MOUSE_UP, NP_restart_yes);
restart_no.addEventListener(MouseEvent.MOUSE_UP, NP_restart_no);
}
function frame110(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame9);
end_nopath_score.text = ("Score - " + String(NP_GameScore));
}
function frame115(){
stop();
NPH_LastWave = getTimer();
NPH_WaveDelay = 60000;
NPH_GameLevel = 0;
NPH_SelectedTower = -1;
NPH_GameScore = 0;
NPH_Gold = 300;
NPH_Lives = 25;
NPH_PlacedMine = false;
NPH_PlacedChurch = false;
NPH_LastGoldUpdate = 0;
NPH_LastPrayerUpdate = 0;
NPH_PrayerUpdateSpeed = 120000;
NPH_GoldUpdateSpeed = 300000;
NPH_LastEnemyType = 1;
NPH_Map = [];
NPH_MapStart = new Point(2, 1);
NPH_MapEnd = new Point(14, 14);
NPH_CurrentSong = 1;
NPH_Muted = false;
NPH_Prayer = 0;
NPH_Map = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]];
NPH_ButtonClick = new buttonclick();
NPH_Ambient1 = new ambient_1();
NPH_Ambient2 = new ambient_2();
NPH_Ambient3 = new ambient_3();
NPH_Ambient4 = new ambient_4();
NPH_Ambient5 = new ambient_5();
NPH_channel = NPH_Ambient1.play(0, 99999);
NPH_Enemies = new Array();
NPH_Buildings = new Array();
NPH_Judgement = new Array();
NPH_Blizzards = new Array();
NPH_HealthBars = new Array();
NPH_Towers = new Array();
NPH_Bullets = new Array();
NPH_AngelsOfDeath = new Array();
NPH_gamemode = "none";
addEventListener(Event.ENTER_FRAME, NPH_everytime);
stage.addEventListener(KeyboardEvent.KEY_UP, NPH_reportKeyUp);
nextlevelbutton.addEventListener(MouseEvent.MOUSE_UP, NPH_nextlevelbutton_mouse_up);
pausebutton.addEventListener(MouseEvent.MOUSE_UP, NPH_pausebutton_mouse_up);
playbutton.addEventListener(MouseEvent.MOUSE_UP, NPH_playbutton_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_UP, NPH_musicleft_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_OVER, NPH_musicleft_mouse_enter);
musicleft.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
musicright.addEventListener(MouseEvent.MOUSE_UP, NPH_musicright_mouse_up);
musicright.addEventListener(MouseEvent.MOUSE_OVER, NPH_musicright_mouse_enter);
musicright.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
musicmute.addEventListener(MouseEvent.MOUSE_UP, NPH_musicmute_mouse_up);
musicmute.addEventListener(MouseEvent.MOUSE_OVER, NPH_musicmute_mouse_enter);
musicmute.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OVER, NPH_tower_select_arrow_mouse_enter);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OVER, NPH_tower_select_cannon_mouse_enter);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OVER, NPH_tower_select_ice_mouse_enter);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OVER, NPH_tower_select_fire_mouse_enter);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OVER, NPH_tower_select_arcane_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OVER, NPH_buy_angel_death_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_UP, NPH_buy_angel_death_mouse_up);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
select_mine.addEventListener(MouseEvent.MOUSE_OVER, NPH_select_mine_mouse_enter);
select_mine.addEventListener(MouseEvent.MOUSE_UP, NPH_select_mine_mouse_up);
select_mine.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
buy_church.addEventListener(MouseEvent.MOUSE_OVER, NPH_buy_church_mouse_enter);
buy_church.addEventListener(MouseEvent.MOUSE_UP, NPH_buy_church_mouse_up);
buy_church.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OVER, NPH_buy_blizzard_mouse_enter);
buy_blizzard.addEventListener(MouseEvent.MOUSE_UP, NPH_buy_blizzard_mouse_up);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
buy_judgement.addEventListener(MouseEvent.MOUSE_OVER, NPH_buy_judgement_mouse_enter);
buy_judgement.addEventListener(MouseEvent.MOUSE_UP, NPH_buy_judgement_mouse_up);
buy_judgement.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OVER, NPH_upgrade_tower_mouse_enter);
upgrade_tower.addEventListener(MouseEvent.MOUSE_UP, NPH_upgrade_tower_mouse_up);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_UP, NPH_tower_select_arrow_mouse_up);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_UP, NPH_tower_select_cannon_mouse_up);
tower_select_ice.addEventListener(MouseEvent.MOUSE_UP, NPH_tower_select_ice_mouse_up);
tower_select_fire.addEventListener(MouseEvent.MOUSE_UP, NPH_tower_select_fire_mouse_up);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_UP, NPH_tower_select_arcane_mouse_up);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OUT, NPH_tower_select_deselect);
sell_tower.addEventListener(MouseEvent.MOUSE_UP, NPH_sell_tower_click);
TheGrid1.addEventListener(MouseEvent.MOUSE_UP, NPH_the_grid_place_tower);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game10);
restart_yes.addEventListener(MouseEvent.MOUSE_UP, NPH_restart_yes);
restart_no.addEventListener(MouseEvent.MOUSE_UP, NPH_restart_no);
}
public function NP_reportKeyUp(_arg1:KeyboardEvent):void{
var _local2:Number;
var _local3:int;
if (_arg1.keyCode == 49){
NP_tower_select_arrow_mouse_up(NP_MouseEvent);
};
if (_arg1.keyCode == 50){
NP_tower_select_cannon_mouse_up(NP_MouseEvent);
};
if (_arg1.keyCode == 51){
NP_tower_select_arcane_mouse_up(NP_MouseEvent);
};
if (_arg1.keyCode == 52){
NP_tower_select_fire_mouse_up(NP_MouseEvent);
};
if (_arg1.keyCode == 53){
NP_tower_select_ice_mouse_up(NP_MouseEvent);
};
if (_arg1.keyCode == 85){
if (NP_gamemode != "paused"){
if (NP_SelectedTower != -1){
_local3 = 0;
while (_local3 <= 51) {
if (NP_Towers[NP_SelectedTower].pLevel < 51){
if (NP_Gold >= (0.5 * (NP_Towers[NP_SelectedTower].pCost * (NP_Towers[NP_SelectedTower].pLevel + 1)))){
NP_Gold = (NP_Gold - (0.5 * (NP_Towers[NP_SelectedTower].pCost * (NP_Towers[NP_SelectedTower].pLevel + 1))));
NP_Gold = Math.round(NP_Gold);
text_gold.text = String(NP_Gold);
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
NP_Towers[NP_SelectedTower].pLevel = (NP_Towers[NP_SelectedTower].pLevel + 1);
NP_Towers[NP_SelectedTower].pDamage = (NP_Towers[NP_SelectedTower].pOrigDamage * ((NP_Towers[NP_SelectedTower].pLevel / 1.1) * ((NP_Towers[NP_SelectedTower].pLevel / 10) + 1)));
upgrade_tower.x = 900;
text_tower_range.text = ("Range - " + NP_Towers[NP_SelectedTower].pRange);
text_tower_damage.text = ("Damage - " + NP_Towers[NP_SelectedTower].pDamage.toFixed(2));
text_tower_level.text = ("Level - " + String(NP_Towers[NP_SelectedTower].pLevel));
text_tower_sell.text = ("Sell Value - " + String(int(((NP_Towers[NP_SelectedTower].pLevel * NP_Towers[NP_SelectedTower].pCost) * 0.7))));
};
};
_local3++;
};
};
};
};
if (_arg1.keyCode == 83){
NP_sell_tower_click(NP_MouseEvent);
};
}
public function NPS_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(10 PP)";
text_towerinfo.text = "Calls forth the Angel of Death.";
}
public function NPS_select_mine_mouse_up(_arg1:MouseEvent):void{
if (NPS_gamemode != "paused"){
if (NPS_gamemode == "set_tower"){
if (NPS_selectedtowertype == "Mine"){
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
NPS_gamemode = "off";
TheGrid1.alpha = 0;
NPS_selectedtowertype = "none";
} else {
if (NPS_selectedtowertype != "Mine"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Mine";
};
};
} else {
if (NPS_gamemode != "set_tower"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Mine";
};
};
};
}
public function NP_tower_select_arrow_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Arrow Tower (30g)";
text_towerinfo.text = "Low Dmg, Fast Speed. (Normal Damage)";
}
public function NP_buy_church_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Church (500g)";
text_towerinfo.text = "Adds Prayer Points. Limit 1.";
}
public function NPI_CheckSelectedTower():void{
var _local1:int;
var _local2:int;
if (NPI_gamemode != "paused"){
_local1 = (NPI_Towers.length - 1);
while (_local1 >= 0) {
if (NPI_Towers[_local1].CheckSelected() == true){
NPI_SelectedTower = _local1;
sell_tower.x = 524;
text_tower_damage.x = 484;
text_tower_level.x = 484;
text_tower_range.x = 484;
text_tower_sell.x = 484;
text_tower_damage.text = ("Damage - " + NPI_Towers[_local1].pDamage.toFixed(2));
text_tower_range.text = ("Range - " + NPI_Towers[_local1].pRange);
text_tower_level.text = ("Level - " + NPI_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((NPI_Towers[_local1].pLevel * NPI_Towers[_local1].pCost) * 0.95))));
NPI_gamemode = "none";
TheGrid1.alpha = 0;
NPI_selectedtowertype = "none";
};
_local1--;
};
_local2 = (NPI_Towers.length - 1);
while (_local2 >= 0) {
NPI_Towers[_local2].pSelected = false;
_local2--;
};
};
}
function frame120(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame10);
end_nopath_hard_score.text = ("Score - " + String(NPH_GameScore));
}
public function NPH_musicright_mouse_up(_arg1:MouseEvent):void{
if (NPH_Muted == false){
NPH_CurrentSong++;
if (NPH_CurrentSong == 6){
NPH_CurrentSong = 1;
};
NPH_channel.stop();
if (NPH_CurrentSong == 1){
NPH_channel = NPH_Ambient1.play(0, 99999);
};
if (NPH_CurrentSong == 2){
NPH_channel = NPH_Ambient2.play(0, 99999);
};
if (NPH_CurrentSong == 3){
NPH_channel = NPH_Ambient3.play(0, 99999);
};
if (NPH_CurrentSong == 4){
NPH_channel = NPH_Ambient4.play(0, 99999);
};
if (NPH_CurrentSong == 5){
NPH_channel = NPH_Ambient5.play(0, 99999);
};
};
}
function frame125(){
stop();
NPI_LastWave = getTimer();
NPI_WaveDelay = 60000;
NPI_GameLevel = 0;
NPI_SelectedTower = -1;
NPI_GameScore = 0;
NPI_Gold = 300;
NPI_Lives = 25;
NPI_PlacedMine = false;
NPI_PlacedChurch = false;
NPI_LastGoldUpdate = 0;
NPI_LastPrayerUpdate = 0;
NPI_PrayerUpdateSpeed = 120000;
NPI_GoldUpdateSpeed = 300000;
NPI_LastEnemyType = 1;
NPI_Map = [];
NPI_MapStart = new Point(2, 1);
NPI_MapEnd = new Point(14, 14);
NPI_CurrentSong = 1;
NPI_Muted = false;
NPI_Prayer = 0;
NPI_Map = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]];
NPI_ButtonClick = new buttonclick();
NPI_Ambient1 = new ambient_1();
NPI_Ambient2 = new ambient_2();
NPI_Ambient3 = new ambient_3();
NPI_Ambient4 = new ambient_4();
NPI_Ambient5 = new ambient_5();
NPI_channel = NPI_Ambient1.play(0, 99999);
NPI_Enemies = new Array();
NPI_Buildings = new Array();
NPI_Judgement = new Array();
NPI_Blizzards = new Array();
NPI_HealthBars = new Array();
NPI_Towers = new Array();
NPI_Bullets = new Array();
NPI_AngelsOfDeath = new Array();
NPI_gamemode = "none";
addEventListener(Event.ENTER_FRAME, NPI_everytime);
stage.addEventListener(KeyboardEvent.KEY_UP, NPI_reportKeyUp);
nextlevelbutton.addEventListener(MouseEvent.MOUSE_UP, NPI_nextlevelbutton_mouse_up);
pausebutton.addEventListener(MouseEvent.MOUSE_UP, NPI_pausebutton_mouse_up);
playbutton.addEventListener(MouseEvent.MOUSE_UP, NPI_playbutton_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_UP, NPI_musicleft_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_OVER, NPI_musicleft_mouse_enter);
musicleft.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
musicright.addEventListener(MouseEvent.MOUSE_UP, NPI_musicright_mouse_up);
musicright.addEventListener(MouseEvent.MOUSE_OVER, NPI_musicright_mouse_enter);
musicright.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
musicmute.addEventListener(MouseEvent.MOUSE_UP, NPI_musicmute_mouse_up);
musicmute.addEventListener(MouseEvent.MOUSE_OVER, NPI_musicmute_mouse_enter);
musicmute.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OVER, NPI_tower_select_arrow_mouse_enter);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OVER, NPI_tower_select_cannon_mouse_enter);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OVER, NPI_tower_select_ice_mouse_enter);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OVER, NPI_tower_select_fire_mouse_enter);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OVER, NPI_tower_select_arcane_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OVER, NPI_buy_angel_death_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_UP, NPI_buy_angel_death_mouse_up);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
select_mine.addEventListener(MouseEvent.MOUSE_OVER, NPI_select_mine_mouse_enter);
select_mine.addEventListener(MouseEvent.MOUSE_UP, NPI_select_mine_mouse_up);
select_mine.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
buy_church.addEventListener(MouseEvent.MOUSE_OVER, NPI_buy_church_mouse_enter);
buy_church.addEventListener(MouseEvent.MOUSE_UP, NPI_buy_church_mouse_up);
buy_church.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OVER, NPI_buy_blizzard_mouse_enter);
buy_blizzard.addEventListener(MouseEvent.MOUSE_UP, NPI_buy_blizzard_mouse_up);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
buy_judgement.addEventListener(MouseEvent.MOUSE_OVER, NPI_buy_judgement_mouse_enter);
buy_judgement.addEventListener(MouseEvent.MOUSE_UP, NPI_buy_judgement_mouse_up);
buy_judgement.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OVER, NPI_upgrade_tower_mouse_enter);
upgrade_tower.addEventListener(MouseEvent.MOUSE_UP, NPI_upgrade_tower_mouse_up);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_UP, NPI_tower_select_arrow_mouse_up);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_UP, NPI_tower_select_cannon_mouse_up);
tower_select_ice.addEventListener(MouseEvent.MOUSE_UP, NPI_tower_select_ice_mouse_up);
tower_select_fire.addEventListener(MouseEvent.MOUSE_UP, NPI_tower_select_fire_mouse_up);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_UP, NPI_tower_select_arcane_mouse_up);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OUT, NPI_tower_select_deselect);
sell_tower.addEventListener(MouseEvent.MOUSE_UP, NPI_sell_tower_click);
TheGrid1.addEventListener(MouseEvent.MOUSE_UP, NPI_the_grid_place_tower);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game11);
restart_yes.addEventListener(MouseEvent.MOUSE_UP, NPI_restart_yes);
restart_no.addEventListener(MouseEvent.MOUSE_UP, NPI_restart_no);
}
function frame200(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, backtomenu);
}
public function NPH_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (NPH_gamemode != "paused"){
if (NPH_Enemies.length < 51){
if (NPH_GameLevel != 0){
NPH_GameScore = (NPH_GameScore + Math.round((((NPH_WaveDelay + NPH_LastWave) - getTimer()) / 1000)));
text_score.text = String(NPH_GameScore);
};
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
NPH_placeenemies();
};
};
}
public function NPS_CheckTowerFireBullet():void{
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var closest:Number;
var closestmob:Number;
var i:int;
var a:int;
var k:int;
var Bullet1:script_bullet_arrow;
var Bullet2:script_bullet_ice;
var Bullet3:script_bullet_arcane;
var Bullet4:script_bullet_cannon;
var Bullet5:script_bullet_fire;
closest = 5000;
closestmob = -1;
if (NPS_gamemode != "paused"){
try {
i = (NPS_Towers.length - 1);
while (i >= 0) {
if (NPS_Towers[i].pTowerType <= 5){
closest = 5000;
NPS_Towers[i].pTarget = -1;
k = (NPS_Enemies.length - 1);
while (k >= 0) {
xdist = Math.round(((NPS_Towers[i].x + 16) - NPS_Enemies[k].x));
ydist = Math.round(((NPS_Towers[i].y + 16) - NPS_Enemies[k].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < NPS_Towers[i].pRange){
if (NPS_Enemies[k].pType == 4){
if (NPS_Towers[i].pTowerType != 2){
if (NPS_Towers[i].pTowerType != 3){
if (NPS_Towers[i].pTowerType != 5){
NPS_Towers[i].pTarget = k;
};
};
};
};
if (NPS_Enemies[k].pType != 4){
NPS_Towers[i].pTarget = k;
};
};
k = (k - 1);
};
};
i = (i - 1);
};
a = (NPS_Towers.length - 1);
while (a >= 0) {
if (NPS_Towers[a].pTowerType <= 5){
if (NPS_Enemies.length > 0){
if (NPS_Towers[a].pTarget != -1){
if (NPS_Enemies[NPS_Towers[a].pTarget].pHealth > 0){
xdist = Math.round(((NPS_Towers[a].x + 16) - NPS_Enemies[NPS_Towers[a].pTarget].x));
ydist = Math.round(((NPS_Towers[a].y + 16) - NPS_Enemies[NPS_Towers[a].pTarget].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < NPS_Towers[a].pRange){
if (NPS_Enemies[NPS_Towers[a].pTarget].y > 0){
if (getTimer() > (NPS_Towers[a].pLastFire + NPS_Towers[a].pSpeed)){
NPS_Towers[a].pLastFire = getTimer();
if (NPS_Towers[a].pTowerType == 1){
Bullet1 = new script_bullet_arrow(NPS_Towers[a].pTarget);
};
if (NPS_Towers[a].pTowerType == 2){
Bullet2 = new script_bullet_ice(NPS_Towers[a].pTarget);
};
if (NPS_Towers[a].pTowerType == 3){
Bullet3 = new script_bullet_arcane(NPS_Towers[a].pTarget);
};
if (NPS_Towers[a].pTowerType == 4){
Bullet4 = new script_bullet_cannon(NPS_Towers[a].pTarget);
};
if (NPS_Towers[a].pTowerType == 5){
Bullet5 = new script_bullet_fire(NPS_Towers[a].pTarget);
};
if (NPS_Towers[a].pTowerType == 1){
Bullet1.x = (NPS_Towers[a].x + 16);
Bullet1.y = (NPS_Towers[a].y + 16);
Bullet1.pDamage = NPS_Towers[a].pDamage;
Bullet1.pBullet = Bullet1;
if (NPS_Bullets.length < 100){
Bullet1.pVisible = true;
addChild(Bullet1);
};
NPS_Bullets.push(Bullet1);
Bullet1.pTower = a;
};
if (NPS_Towers[a].pTowerType == 2){
Bullet2.x = (NPS_Towers[a].x + 16);
Bullet2.y = (NPS_Towers[a].y + 16);
Bullet2.pDamage = NPS_Towers[a].pDamage;
Bullet2.pBullet = Bullet2;
if (NPS_Bullets.length < 100){
Bullet2.pVisible = true;
addChild(Bullet2);
};
NPS_Bullets.push(Bullet2);
Bullet2.pTower = a;
};
if (NPS_Towers[a].pTowerType == 3){
Bullet3.x = (NPS_Towers[a].x + 16);
Bullet3.y = (NPS_Towers[a].y + 16);
Bullet3.pDamage = NPS_Towers[a].pDamage;
Bullet3.pBullet = Bullet3;
if (NPS_Bullets.length < 100){
Bullet3.pVisible = true;
addChild(Bullet3);
};
NPS_Bullets.push(Bullet3);
Bullet3.pTower = a;
};
if (NPS_Towers[a].pTowerType == 4){
Bullet4.x = (NPS_Towers[a].x + 16);
Bullet4.y = (NPS_Towers[a].y + 16);
Bullet4.pDamage = NPS_Towers[a].pDamage;
Bullet4.pBullet = Bullet4;
if (NPS_Bullets.length < 100){
Bullet4.pVisible = true;
addChild(Bullet4);
};
NPS_Bullets.push(Bullet4);
Bullet4.pTower = a;
};
if (NPS_Towers[a].pTowerType == 5){
Bullet5.x = (NPS_Towers[a].x + 16);
Bullet5.y = (NPS_Towers[a].y + 16);
Bullet5.pDamage = NPS_Towers[a].pDamage;
Bullet5.pBullet = Bullet5;
if (NPS_Bullets.length < 100){
Bullet5.pVisible = true;
addChild(Bullet5);
};
NPS_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function NPS_CheckEnemyHealth():void{
var i:int;
var h:int;
var k:int;
var a:int;
if (NPS_gamemode != "paused"){
try {
i = (NPS_Enemies.length - 1);
while (i >= 0) {
if (NPS_Enemies[i].pHealth <= 0){
NPS_Enemies[i].x = -500;
NPS_Enemies[i].y = -500;
if (NPS_Enemies[i].pType == 5){
NPS_Gold = (NPS_Gold + Math.round(((1.75 * NPS_GameLevel) + 0.5)));
NPS_GameScore = (NPS_GameScore + 50);
} else {
NPS_Gold = (NPS_Gold + Math.round(((0.25 * NPS_GameLevel) + 0.5)));
NPS_GameScore = (NPS_GameScore + 10);
};
removeChild(NPS_Enemies[i]);
NPS_Enemies.splice(i, 1);
text_gold.text = String(NPS_Gold);
text_score.text = String(NPS_GameScore);
h = (NPS_HealthBars.length - 1);
while (h >= 0) {
if (NPS_HealthBars[h].pEnemy == i){
NPS_HealthBars[h].x = -900;
removeChild(NPS_HealthBars[h]);
NPS_HealthBars.splice(h, 1);
};
if (NPS_HealthBars[h].pEnemy > i){
NPS_HealthBars[h].pEnemy = (NPS_HealthBars[h].pEnemy - 1);
};
h = (h - 1);
};
k = (NPS_Bullets.length - 1);
while (k >= 0) {
if (k != i){
if (NPS_Bullets[k].pTarget > i){
NPS_Bullets[k].pTarget = (NPS_Bullets[k].pTarget - 1);
};
};
if (NPS_Bullets[k].pTarget == i){
NPS_Bullets[k].x = -100;
NPS_Bullets[k].y = -100;
if (NPS_Bullets[k].pVisible == true){
removeChild(NPS_Bullets[k].pBullet);
};
NPS_Bullets.splice(k, 1);
};
k = (k - 1);
};
a = (NPS_Towers.length - 1);
while (a >= 0) {
if (NPS_Towers[a].pTarget == i){
NPS_Towers[a].pTarget = -1;
};
if (NPS_Towers[a].pTarget > i){
NPS_Towers[a].pTarget = (NPS_Towers[a].pTarget - 1);
};
a = (a - 1);
};
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function NPI_placeenemies():void{
var _local1:*;
var _local2:script_enemy_orc;
var _local3:enemy_health_bar;
var _local4:script_enemy_armororc;
var _local5:enemy_health_bar;
var _local6:script_enemy_goblin;
var _local7:enemy_health_bar;
var _local8:script_enemy_fasttroll;
var _local9:enemy_health_bar;
var _local10:script_enemy_tauren;
var _local11:enemy_health_bar;
var _local12:script_enemy_armortroll;
var _local13:enemy_health_bar;
var _local14:script_enemy_lion;
var _local15:enemy_health_bar;
var _local16:script_enemy_undead;
var _local17:enemy_health_bar;
var _local18:script_enemy_clothundead;
var _local19:enemy_health_bar;
var _local20:script_enemy_demon;
var _local21:enemy_health_bar;
var _local22:script_enemy_boss1;
var _local23:enemy_health_bar;
if (NPI_gamemode != "paused"){
NPI_GameLevel = (NPI_GameLevel + 1);
NPI_WaveDelay = (NPI_WaveDelay - 500);
if (NPI_WaveDelay < 10000){
NPI_WaveDelay = 10000;
};
NPI_Path = Pathfinding.findPath(NPI_Map, NPI_MapStart.y, NPI_MapStart.x, NPI_MapEnd.y, NPI_MapEnd.x);
_local1 = 0;
while (_local1 < 25) {
if (NPI_LastEnemyType == 1){
_local2 = new script_enemy_orc(_local1, NPI_GameLevel, "insane");
addChild(_local2);
NPI_Enemies.push(_local2);
NPI_LastWave = getTimer();
text_level.text = String(NPI_GameLevel);
_local3 = new enemy_health_bar();
_local3.pEnemy = (NPI_Enemies.length - 1);
_local3.x = (_local2.x - 13);
_local3.y = (_local2.y - 16);
_local3.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local2.pStartHealth));
addChild(_local3);
NPI_HealthBars.push(_local3);
_local2.pPath = NPI_Path;
text_nexttype.text = "Next Enemy Type : Armor";
} else {
if (NPI_LastEnemyType == 2){
_local4 = new script_enemy_armororc(_local1, NPI_GameLevel, "insane");
addChild(_local4);
NPI_Enemies.push(_local4);
NPI_LastWave = getTimer();
text_level.text = String(NPI_GameLevel);
_local5 = new enemy_health_bar();
_local5.pEnemy = (NPI_Enemies.length - 1);
_local5.x = (_local4.x - 13);
_local5.y = (_local4.y - 16);
_local5.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local4.pStartHealth));
addChild(_local5);
NPI_HealthBars.push(_local5);
_local4.pPath = NPI_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPI_LastEnemyType == 3){
_local6 = new script_enemy_goblin(_local1, NPI_GameLevel, "insane");
addChild(_local6);
NPI_Enemies.push(_local6);
NPI_LastWave = getTimer();
text_level.text = String(NPI_GameLevel);
_local7 = new enemy_health_bar();
_local7.pEnemy = (NPI_Enemies.length - 1);
_local7.x = (_local6.x - 13);
_local7.y = (_local6.y - 16);
_local7.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local6.pStartHealth));
addChild(_local7);
NPI_HealthBars.push(_local7);
_local6.pPath = NPI_Path;
text_nexttype.text = "Next Enemy Type : Fast";
} else {
if (NPI_LastEnemyType == 4){
_local8 = new script_enemy_fasttroll(_local1, NPI_GameLevel, "insane");
addChild(_local8);
NPI_Enemies.push(_local8);
NPI_LastWave = getTimer();
text_level.text = String(NPI_GameLevel);
_local9 = new enemy_health_bar();
_local9.pEnemy = (NPI_Enemies.length - 1);
_local9.x = (_local8.x - 13);
_local9.y = (_local8.y - 16);
_local9.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local8.pStartHealth));
addChild(_local9);
NPI_HealthBars.push(_local9);
_local8.pPath = NPI_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPI_LastEnemyType == 5){
_local10 = new script_enemy_tauren(_local1, NPI_GameLevel, "insane");
addChild(_local10);
NPI_Enemies.push(_local10);
NPI_LastWave = getTimer();
text_level.text = String(NPI_GameLevel);
_local11 = new enemy_health_bar();
_local11.pEnemy = (NPI_Enemies.length - 1);
_local11.x = (_local10.x - 13);
_local11.y = (_local10.y - 16);
_local11.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local10.pStartHealth));
addChild(_local11);
NPI_HealthBars.push(_local11);
_local10.pPath = NPI_Path;
text_nexttype.text = "Next Enemy Type : Armor";
} else {
if (NPI_LastEnemyType == 6){
_local12 = new script_enemy_armortroll(_local1, NPI_GameLevel, "insane");
addChild(_local12);
NPI_Enemies.push(_local12);
NPI_LastWave = getTimer();
text_level.text = String(NPI_GameLevel);
_local13 = new enemy_health_bar();
_local13.pEnemy = (NPI_Enemies.length - 1);
_local13.x = (_local12.x - 13);
_local13.y = (_local12.y - 16);
_local13.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local12.pStartHealth));
addChild(_local13);
NPI_HealthBars.push(_local13);
_local12.pPath = NPI_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPI_LastEnemyType == 7){
_local14 = new script_enemy_lion(_local1, NPI_GameLevel, "insane");
addChild(_local14);
NPI_Enemies.push(_local14);
NPI_LastWave = getTimer();
text_level.text = String(NPI_GameLevel);
_local15 = new enemy_health_bar();
_local15.pEnemy = (NPI_Enemies.length - 1);
_local15.x = (_local14.x - 13);
_local15.y = (_local14.y - 16);
_local15.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local14.pStartHealth));
addChild(_local15);
NPI_HealthBars.push(_local15);
_local14.pPath = NPI_Path;
text_nexttype.text = "Next Enemy Type : Fast";
} else {
if (NPI_LastEnemyType == 8){
_local16 = new script_enemy_undead(_local1, NPI_GameLevel, "insane");
addChild(_local16);
NPI_Enemies.push(_local16);
NPI_LastWave = getTimer();
text_level.text = String(NPI_GameLevel);
_local17 = new enemy_health_bar();
_local17.pEnemy = (NPI_Enemies.length - 1);
_local17.x = (_local16.x - 13);
_local17.y = (_local16.y - 16);
_local17.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local16.pStartHealth));
addChild(_local17);
NPI_HealthBars.push(_local17);
_local16.pPath = NPI_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPI_LastEnemyType == 9){
_local18 = new script_enemy_clothundead(_local1, NPI_GameLevel, "insane");
addChild(_local18);
NPI_Enemies.push(_local18);
NPI_LastWave = getTimer();
text_level.text = String(NPI_GameLevel);
_local19 = new enemy_health_bar();
_local19.pEnemy = (NPI_Enemies.length - 1);
_local19.x = (_local18.x - 13);
_local19.y = (_local18.y - 16);
_local19.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local18.pStartHealth));
addChild(_local19);
NPI_HealthBars.push(_local19);
_local18.pPath = NPI_Path;
text_nexttype.text = "Next Enemy Type : Immune to magic!";
} else {
if (NPI_LastEnemyType == 10){
_local20 = new script_enemy_demon(_local1, NPI_GameLevel, "insane");
addChild(_local20);
NPI_Enemies.push(_local20);
NPI_LastWave = getTimer();
text_level.text = String(NPI_GameLevel);
_local21 = new enemy_health_bar();
_local21.pEnemy = (NPI_Enemies.length - 1);
_local21.x = (_local20.x - 13);
_local21.y = (_local20.y - 16);
_local21.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local20.pStartHealth));
addChild(_local21);
NPI_HealthBars.push(_local21);
_local20.pPath = NPI_Path;
text_nexttype.text = "Next Enemy Type : Boss Round";
};
};
};
};
};
};
};
};
};
};
_local1++;
};
if (NPI_LastEnemyType == 11){
_local22 = new script_enemy_boss1(0, NPI_GameLevel, "insane");
addChild(_local22);
NPI_Enemies.push(_local22);
NPI_LastWave = getTimer();
text_level.text = String(NPI_GameLevel);
_local23 = new enemy_health_bar();
_local23.pEnemy = (NPI_Enemies.length - 1);
_local23.x = (_local22.x - 13);
_local23.y = (_local22.y - 16);
_local23.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local22.pStartHealth));
addChild(_local23);
NPI_HealthBars.push(_local23);
_local22.pPath = NPI_Path;
text_nexttype.text = "Next Enemy Type : Normal";
};
NPI_LastEnemyType = (NPI_LastEnemyType + 1);
if (NPI_LastEnemyType == 12){
NPI_LastEnemyType = 1;
};
};
}
public function NP_restart_yes(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (NP_HealthBars.length - 1);
while (_local2 >= 0) {
removeChild(NP_HealthBars[_local2]);
NP_HealthBars.splice(_local2, 1);
_local2--;
};
_local3 = (NP_Bullets.length - 1);
while (_local3 >= 0) {
if (NP_Bullets[_local3].pVisible == true){
removeChild(NP_Bullets[_local3]);
};
NP_Bullets.splice(_local3, 1);
_local3--;
};
_local4 = (NP_Towers.length - 1);
while (_local4 >= 0) {
removeChild(NP_Towers[_local4]);
NP_Towers.splice(_local4, 1);
_local4--;
};
_local5 = (NP_Enemies.length - 1);
while (_local5 >= 0) {
removeChild(NP_Enemies[_local5]);
NP_Enemies.splice(_local5, 1);
_local5--;
};
removeEventListener(Event.ENTER_FRAME, NP_everytime);
removeEventListener(KeyboardEvent.KEY_UP, NP_reportKeyUp);
NP_channel.stop();
gotoAndStop(10);
}
public function restart_game11(_arg1:MouseEvent):void{
restart_sure.x = 51;
restart_yes.x = 142.9;
restart_no.x = 309;
}
public function restart_game12(_arg1:MouseEvent):void{
restart_sure.x = 51;
restart_yes.x = 142.9;
restart_no.x = 309;
}
public function restart_game10(_arg1:MouseEvent):void{
restart_sure.x = 51;
restart_yes.x = 142.9;
restart_no.x = 309;
}
public function NPH_musicleft_mouse_up(_arg1:MouseEvent):void{
if (NPH_Muted == false){
NPH_CurrentSong--;
if (NPH_CurrentSong == 0){
NPH_CurrentSong = 5;
};
NPH_channel.stop();
if (NPH_CurrentSong == 1){
NPH_channel = NPH_Ambient1.play(0, 99999);
};
if (NPH_CurrentSong == 2){
NPH_channel = NPH_Ambient2.play(0, 99999);
};
if (NPH_CurrentSong == 3){
NPH_channel = NPH_Ambient3.play(0, 99999);
};
if (NPH_CurrentSong == 4){
NPH_channel = NPH_Ambient4.play(0, 99999);
};
if (NPH_CurrentSong == 5){
NPH_channel = NPH_Ambient5.play(0, 99999);
};
};
}
function frame130(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame11);
end_nopath_insane_score.text = ("Score - " + String(NPI_GameScore));
}
public function NP_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (NP_gamemode != "paused"){
if (NP_Prayer >= 10){
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
NP_Prayer = (NP_Prayer - 10);
text_prayer.text = String(NP_Prayer);
_local2 = 0;
while (_local2 < 10) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
NP_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function NPI_sell_tower_click(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:Number;
var _local4:int;
if (NPI_gamemode != "paused"){
if (NPI_SelectedTower != -1){
if (NPI_Towers[NPI_SelectedTower].pTowerType == 10){
NPI_PlacedMine = false;
text_next_gold.x = 1000;
};
if (NPI_Towers[NPI_SelectedTower].pTowerType == 11){
NPI_PlacedChurch = false;
text_next_prayer.x = 1000;
};
NPI_Map[Math.round((NPI_Towers[NPI_SelectedTower].y / 32))][Math.round((NPI_Towers[NPI_SelectedTower].x / 32))] = 1;
_local4 = (NPI_Enemies.length - 1);
while (_local4 >= 0) {
if (NPI_Enemies[_local4].y < 45){
_local2 = new Point(Math.round(NPI_Enemies[_local4].pPath[NPI_Enemies[_local4].pPathIndex][1]), Math.round(NPI_Enemies[_local4].pPath[NPI_Enemies[_local4].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPI_Path = Pathfinding.findPath(NPI_Map, _local2.y, _local2.x, NPI_MapEnd.y, NPI_MapEnd.x);
NPI_Enemies[_local4].pPath = NPI_Path;
NPI_Enemies[_local4].mapchange();
};
_local4--;
};
NPI_Gold = (NPI_Gold + int((0.95 * (NPI_Towers[NPI_SelectedTower].pCost * NPI_Towers[NPI_SelectedTower].pLevel))));
NPI_Gold = Math.round(NPI_Gold);
text_gold.text = String(NPI_Gold);
removeChild(NPI_Towers[NPI_SelectedTower]);
NPI_Towers.splice(NPI_SelectedTower, 1);
NPI_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
upgrade_tower.x = 900;
text_tower_sell.x = 900;
};
};
}
function frame135(){
stop();
NPS_LastWave = getTimer();
NPS_WaveDelay = 60000;
NPS_GameLevel = 0;
NPS_SelectedTower = -1;
NPS_GameScore = 0;
NPS_Gold = 999999;
NPS_Lives = 25;
NPS_PlacedMine = false;
NPS_PlacedChurch = false;
NPS_LastGoldUpdate = 0;
NPS_LastPrayerUpdate = 0;
NPS_PrayerUpdateSpeed = 120000;
NPS_GoldUpdateSpeed = 300000;
NPS_LastEnemyType = 1;
NPS_Map = [];
NPS_MapStart = new Point(2, 1);
NPS_MapEnd = new Point(14, 14);
NPS_CurrentSong = 1;
NPS_Muted = false;
NPS_Prayer = 99999;
NPS_Map = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]];
NPS_ButtonClick = new buttonclick();
NPS_Ambient1 = new ambient_1();
NPS_Ambient2 = new ambient_2();
NPS_Ambient3 = new ambient_3();
NPS_Ambient4 = new ambient_4();
NPS_Ambient5 = new ambient_5();
NPS_channel = NPS_Ambient1.play(0, 99999);
NPS_Enemies = new Array();
NPS_Buildings = new Array();
NPS_Judgement = new Array();
NPS_Blizzards = new Array();
NPS_HealthBars = new Array();
NPS_Towers = new Array();
NPS_Bullets = new Array();
NPS_AngelsOfDeath = new Array();
NPS_gamemode = "none";
addEventListener(Event.ENTER_FRAME, NPS_everytime);
stage.addEventListener(KeyboardEvent.KEY_UP, NPS_reportKeyUp);
nextlevelbutton.addEventListener(MouseEvent.MOUSE_UP, NPS_nextlevelbutton_mouse_up);
pausebutton.addEventListener(MouseEvent.MOUSE_UP, NPS_pausebutton_mouse_up);
playbutton.addEventListener(MouseEvent.MOUSE_UP, NPS_playbutton_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_UP, NPS_musicleft_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_OVER, NPS_musicleft_mouse_enter);
musicleft.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
musicright.addEventListener(MouseEvent.MOUSE_UP, NPS_musicright_mouse_up);
musicright.addEventListener(MouseEvent.MOUSE_OVER, NPS_musicright_mouse_enter);
musicright.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
musicmute.addEventListener(MouseEvent.MOUSE_UP, NPS_musicmute_mouse_up);
musicmute.addEventListener(MouseEvent.MOUSE_OVER, NPS_musicmute_mouse_enter);
musicmute.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OVER, NPS_tower_select_arrow_mouse_enter);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OVER, NPS_tower_select_cannon_mouse_enter);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OVER, NPS_tower_select_ice_mouse_enter);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OVER, NPS_tower_select_fire_mouse_enter);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OVER, NPS_tower_select_arcane_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OVER, NPS_buy_angel_death_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_UP, NPS_buy_angel_death_mouse_up);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
select_mine.addEventListener(MouseEvent.MOUSE_OVER, NPS_select_mine_mouse_enter);
select_mine.addEventListener(MouseEvent.MOUSE_UP, NPS_select_mine_mouse_up);
select_mine.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
buy_church.addEventListener(MouseEvent.MOUSE_OVER, NPS_buy_church_mouse_enter);
buy_church.addEventListener(MouseEvent.MOUSE_UP, NPS_buy_church_mouse_up);
buy_church.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OVER, NPS_buy_blizzard_mouse_enter);
buy_blizzard.addEventListener(MouseEvent.MOUSE_UP, NPS_buy_blizzard_mouse_up);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
buy_judgement.addEventListener(MouseEvent.MOUSE_OVER, NPS_buy_judgement_mouse_enter);
buy_judgement.addEventListener(MouseEvent.MOUSE_UP, NPS_buy_judgement_mouse_up);
buy_judgement.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OVER, NPS_upgrade_tower_mouse_enter);
upgrade_tower.addEventListener(MouseEvent.MOUSE_UP, NPS_upgrade_tower_mouse_up);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_UP, NPS_tower_select_arrow_mouse_up);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_UP, NPS_tower_select_cannon_mouse_up);
tower_select_ice.addEventListener(MouseEvent.MOUSE_UP, NPS_tower_select_ice_mouse_up);
tower_select_fire.addEventListener(MouseEvent.MOUSE_UP, NPS_tower_select_fire_mouse_up);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_UP, NPS_tower_select_arcane_mouse_up);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OUT, NPS_tower_select_deselect);
sell_tower.addEventListener(MouseEvent.MOUSE_UP, NPS_sell_tower_click);
TheGrid1.addEventListener(MouseEvent.MOUSE_UP, NPS_the_grid_place_tower);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game12);
restart_yes.addEventListener(MouseEvent.MOUSE_UP, NPS_restart_yes);
restart_no.addEventListener(MouseEvent.MOUSE_UP, NPS_restart_no);
}
public function NPH_MoveAndCheckJudgement():void{
var _local1:int;
if (NPH_gamemode != "paused"){
_local1 = (NPH_Judgement.length - 1);
while (_local1 >= 0) {
if (NPH_Judgement[_local1].y < -114){
drawonme.removeChild(NPH_Judgement[_local1]);
NPH_Judgement.splice(_local1, 1);
};
_local1--;
};
};
}
public function NPH_CheckEnemiesForHit():void{
var i:int;
var k:int;
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var a:int;
if (NPH_gamemode != "paused"){
try {
i = (NPH_Enemies.length - 1);
while (i >= 0) {
k = (NPH_Bullets.length - 1);
while (k >= 0) {
if (NPH_Enemies[i].hitTestObject(NPH_Bullets[k])){
NPH_Enemies[i].GotHit(NPH_Bullets[k].pDamage, NPH_Bullets[k].pBulletType);
if (NPH_Bullets[k].pBulletType == 2){
if (NPH_Enemies[i].pSpeed > 0.3){
NPH_Enemies[i].pSpeed = (NPH_Enemies[i].pSpeed - 0.2);
};
};
if (NPH_Bullets[k].pBulletType == 4){
a = (NPH_Enemies.length - 1);
while (a >= 0) {
xdist = Math.round((NPH_Bullets[k].x - NPH_Enemies[a].x));
ydist = Math.round((NPH_Bullets[k].y - NPH_Enemies[a].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < 50){
if (a != NPH_Bullets[k].pTarget){
NPH_Enemies[a].GotHit(((5 * NPH_Towers[NPH_Bullets[k].pTower].pLevel) * 0.75), 4);
};
};
a = (a - 1);
};
};
NPH_Bullets[k].x = -100;
NPH_Bullets[k].y = -100;
if (NPH_Bullets[k].pVisible == true){
removeChild(NPH_Bullets[k].pBullet);
};
NPH_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function NPH_tower_select_arcane_mouse_up(_arg1:MouseEvent):void{
if (NPH_gamemode != "paused"){
if (NPH_gamemode == "set_tower"){
if (NPH_selectedtowertype == "Arcane"){
NPH_gamemode = "off";
TheGrid1.alpha = 0;
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
NPH_selectedtowertype = "none";
} else {
if (NPH_selectedtowertype != "Arcane"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Arcane";
};
};
} else {
if (NPH_gamemode != "set_tower"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Arcane";
};
};
};
}
function frame140(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame12);
end_nopath_sandbox_score.text = ("Score - " + String(NPS_GameScore));
}
public function NPS_placeenemies():void{
var _local1:*;
var _local2:script_enemy_orc;
var _local3:enemy_health_bar;
var _local4:script_enemy_armororc;
var _local5:enemy_health_bar;
var _local6:script_enemy_goblin;
var _local7:enemy_health_bar;
var _local8:script_enemy_fasttroll;
var _local9:enemy_health_bar;
var _local10:script_enemy_tauren;
var _local11:enemy_health_bar;
var _local12:script_enemy_armortroll;
var _local13:enemy_health_bar;
var _local14:script_enemy_lion;
var _local15:enemy_health_bar;
var _local16:script_enemy_undead;
var _local17:enemy_health_bar;
var _local18:script_enemy_clothundead;
var _local19:enemy_health_bar;
var _local20:script_enemy_demon;
var _local21:enemy_health_bar;
var _local22:script_enemy_boss1;
var _local23:enemy_health_bar;
if (NPS_gamemode != "paused"){
NPS_WaveDelay = (NPS_WaveDelay - 500);
if (NPS_WaveDelay < 10000){
NPS_WaveDelay = 10000;
};
NPS_GameLevel = (NPS_GameLevel + 1);
NPS_Path = Pathfinding.findPath(NPS_Map, NPS_MapStart.y, NPS_MapStart.x, NPS_MapEnd.y, NPS_MapEnd.x);
_local1 = 0;
while (_local1 < 25) {
if (NPS_LastEnemyType == 1){
_local2 = new script_enemy_orc(_local1, NPS_GameLevel, "hard");
addChild(_local2);
NPS_Enemies.push(_local2);
NPS_LastWave = getTimer();
text_level.text = String(NPS_GameLevel);
_local3 = new enemy_health_bar();
_local3.pEnemy = (NPS_Enemies.length - 1);
_local3.x = (_local2.x - 13);
_local3.y = (_local2.y - 16);
_local3.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local2.pStartHealth));
addChild(_local3);
NPS_HealthBars.push(_local3);
_local2.pPath = NPS_Path;
text_nexttype.text = "Next Enemy Type : Armor";
} else {
if (NPS_LastEnemyType == 2){
_local4 = new script_enemy_armororc(_local1, NPS_GameLevel, "hard");
addChild(_local4);
NPS_Enemies.push(_local4);
NPS_LastWave = getTimer();
text_level.text = String(NPS_GameLevel);
_local5 = new enemy_health_bar();
_local5.pEnemy = (NPS_Enemies.length - 1);
_local5.x = (_local4.x - 13);
_local5.y = (_local4.y - 16);
_local5.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local4.pStartHealth));
addChild(_local5);
NPS_HealthBars.push(_local5);
_local4.pPath = NPS_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPS_LastEnemyType == 3){
_local6 = new script_enemy_goblin(_local1, NPS_GameLevel, "hard");
addChild(_local6);
NPS_Enemies.push(_local6);
NPS_LastWave = getTimer();
text_level.text = String(NPS_GameLevel);
_local7 = new enemy_health_bar();
_local7.pEnemy = (NPS_Enemies.length - 1);
_local7.x = (_local6.x - 13);
_local7.y = (_local6.y - 16);
_local7.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local6.pStartHealth));
addChild(_local7);
NPS_HealthBars.push(_local7);
_local6.pPath = NPS_Path;
text_nexttype.text = "Next Enemy Type : Fast";
} else {
if (NPS_LastEnemyType == 4){
_local8 = new script_enemy_fasttroll(_local1, NPS_GameLevel, "hard");
addChild(_local8);
NPS_Enemies.push(_local8);
NPS_LastWave = getTimer();
text_level.text = String(NPS_GameLevel);
_local9 = new enemy_health_bar();
_local9.pEnemy = (NPS_Enemies.length - 1);
_local9.x = (_local8.x - 13);
_local9.y = (_local8.y - 16);
_local9.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local8.pStartHealth));
addChild(_local9);
NPS_HealthBars.push(_local9);
_local8.pPath = NPS_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPS_LastEnemyType == 5){
_local10 = new script_enemy_tauren(_local1, NPS_GameLevel, "hard");
addChild(_local10);
NPS_Enemies.push(_local10);
NPS_LastWave = getTimer();
text_level.text = String(NPS_GameLevel);
_local11 = new enemy_health_bar();
_local11.pEnemy = (NPS_Enemies.length - 1);
_local11.x = (_local10.x - 13);
_local11.y = (_local10.y - 16);
_local11.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local10.pStartHealth));
addChild(_local11);
NPS_HealthBars.push(_local11);
_local10.pPath = NPS_Path;
text_nexttype.text = "Next Enemy Type : Armor";
} else {
if (NPS_LastEnemyType == 6){
_local12 = new script_enemy_armortroll(_local1, NPS_GameLevel, "hard");
addChild(_local12);
NPS_Enemies.push(_local12);
NPS_LastWave = getTimer();
text_level.text = String(NPS_GameLevel);
_local13 = new enemy_health_bar();
_local13.pEnemy = (NPS_Enemies.length - 1);
_local13.x = (_local12.x - 13);
_local13.y = (_local12.y - 16);
_local13.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local12.pStartHealth));
addChild(_local13);
NPS_HealthBars.push(_local13);
_local12.pPath = NPS_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPS_LastEnemyType == 7){
_local14 = new script_enemy_lion(_local1, NPS_GameLevel, "hard");
addChild(_local14);
NPS_Enemies.push(_local14);
NPS_LastWave = getTimer();
text_level.text = String(NPS_GameLevel);
_local15 = new enemy_health_bar();
_local15.pEnemy = (NPS_Enemies.length - 1);
_local15.x = (_local14.x - 13);
_local15.y = (_local14.y - 16);
_local15.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local14.pStartHealth));
addChild(_local15);
NPS_HealthBars.push(_local15);
_local14.pPath = NPS_Path;
text_nexttype.text = "Next Enemy Type : Fast";
} else {
if (NPS_LastEnemyType == 8){
_local16 = new script_enemy_undead(_local1, NPS_GameLevel, "hard");
addChild(_local16);
NPS_Enemies.push(_local16);
NPS_LastWave = getTimer();
text_level.text = String(NPS_GameLevel);
_local17 = new enemy_health_bar();
_local17.pEnemy = (NPS_Enemies.length - 1);
_local17.x = (_local16.x - 13);
_local17.y = (_local16.y - 16);
_local17.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local16.pStartHealth));
addChild(_local17);
NPS_HealthBars.push(_local17);
_local16.pPath = NPS_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NPS_LastEnemyType == 9){
_local18 = new script_enemy_clothundead(_local1, NPS_GameLevel, "hard");
addChild(_local18);
NPS_Enemies.push(_local18);
NPS_LastWave = getTimer();
text_level.text = String(NPS_GameLevel);
_local19 = new enemy_health_bar();
_local19.pEnemy = (NPS_Enemies.length - 1);
_local19.x = (_local18.x - 13);
_local19.y = (_local18.y - 16);
_local19.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local18.pStartHealth));
addChild(_local19);
NPS_HealthBars.push(_local19);
_local18.pPath = NPS_Path;
text_nexttype.text = "Next Enemy Type : Immune to magic!";
} else {
if (NPS_LastEnemyType == 10){
_local20 = new script_enemy_demon(_local1, NPS_GameLevel, "hard");
addChild(_local20);
NPS_Enemies.push(_local20);
NPS_LastWave = getTimer();
text_level.text = String(NPS_GameLevel);
_local21 = new enemy_health_bar();
_local21.pEnemy = (NPS_Enemies.length - 1);
_local21.x = (_local20.x - 13);
_local21.y = (_local20.y - 16);
_local21.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local20.pStartHealth));
addChild(_local21);
NPS_HealthBars.push(_local21);
_local20.pPath = NPS_Path;
text_nexttype.text = "Next Enemy Type : Boss Round";
};
};
};
};
};
};
};
};
};
};
_local1++;
};
if (NPS_LastEnemyType == 11){
_local22 = new script_enemy_boss1(0, NPS_GameLevel, "hard");
addChild(_local22);
NPS_Enemies.push(_local22);
NPS_LastWave = getTimer();
text_level.text = String(NPS_GameLevel);
_local23 = new enemy_health_bar();
_local23.pEnemy = (NPS_Enemies.length - 1);
_local23.x = (_local22.x - 13);
_local23.y = (_local22.y - 16);
_local23.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local22.pStartHealth));
addChild(_local23);
NPS_HealthBars.push(_local23);
_local22.pPath = NPS_Path;
text_nexttype.text = "Next Enemy Type : Normal";
};
NPS_LastEnemyType = (NPS_LastEnemyType + 1);
if (NPS_LastEnemyType == 12){
NPS_LastEnemyType = 1;
};
};
}
public function NP_buy_judgement_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:judgement;
if (NP_gamemode != "paused"){
if (NP_Prayer >= 15){
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
NP_Prayer = (NP_Prayer - 15);
text_prayer.text = String(NP_Prayer);
_local2 = 0;
while (_local2 < (NP_Enemies.length - 1)) {
_local3 = new judgement();
_local3.x = NP_Enemies[_local2].x;
_local3.y = NP_Enemies[_local2].y;
NP_Enemies[_local2].GotHit(999999, 1);
drawonme.addChild(_local3);
NP_Judgement.push(_local3);
_local2++;
};
};
};
}
public function NPH_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function NPI_buy_judgement_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Judgement Day(15 PP)";
text_towerinfo.text = "Calls forth Judgement Day upon your enemies.";
}
public function NPS_musicmute_mouse_up(_arg1:MouseEvent):void{
if (NPS_Muted == false){
NPS_channel.stop();
NPS_Muted = true;
} else {
if (NPS_CurrentSong == 1){
NPS_channel = NPS_Ambient1.play(0, 99999);
};
if (NPS_CurrentSong == 2){
NPS_channel = NPS_Ambient2.play(0, 99999);
};
if (NPS_CurrentSong == 3){
NPS_channel = NPS_Ambient3.play(0, 99999);
};
if (NPS_CurrentSong == 4){
NPS_channel = NPS_Ambient4.play(0, 99999);
};
if (NPS_CurrentSong == 5){
NPS_channel = NPS_Ambient5.play(0, 99999);
};
NPS_Muted = false;
};
}
public function NPH_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
NPH_gamemode = "paused";
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
playbutton.x = 99;
pausebutton.x = 900;
NPH_PausedTimer1 = getTimer();
_local2 = (NPH_Enemies.length - 1);
while (_local2 >= 0) {
NPH_Enemies[_local2].pPaused = true;
_local2--;
};
_local3 = (NPH_AngelsOfDeath.length - 1);
while (_local3 >= 0) {
NPH_AngelsOfDeath[_local3].pPaused = true;
_local3--;
};
_local4 = (NPH_Blizzards.length - 1);
while (_local4 >= 0) {
NPH_Blizzards[_local4].pPaused = true;
_local4--;
};
}
public function NPS_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(3 PP)";
text_towerinfo.text = "Calls forth a Blizzard to slow your enemies.";
}
public function NPI_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
if (NPI_gamemode != "paused"){
if (NPI_Towers[NPI_SelectedTower].pLevel < 31){
if (NPI_Gold >= (0.5 * (NPI_Towers[NPI_SelectedTower].pCost * (NPI_Towers[NPI_SelectedTower].pLevel + 1)))){
NPI_Gold = (NPI_Gold - (0.5 * (NPI_Towers[NPI_SelectedTower].pCost * (NPI_Towers[NPI_SelectedTower].pLevel + 1))));
NPI_Gold = Math.round(NPI_Gold);
text_gold.text = String(NPI_Gold);
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
NPI_Towers[NPI_SelectedTower].pLevel = (NPI_Towers[NPI_SelectedTower].pLevel + 1);
NPI_Towers[NPI_SelectedTower].pDamage = (NPI_Towers[NPI_SelectedTower].pOrigDamage * ((NPI_Towers[NPI_SelectedTower].pLevel / 1.1) * ((NPI_Towers[NPI_SelectedTower].pLevel / 10) + 1)));
upgrade_tower.x = 900;
_local2 = (NPI_Towers[NPI_SelectedTower].pOrigDamage * (((NPI_Towers[NPI_SelectedTower].pLevel + 1) / 1.1) * (((NPI_Towers[NPI_SelectedTower].pLevel + 1) / 10) + 1)));
text_towertype.text = (("Upgrade(" + (0.5 * (NPI_Towers[NPI_SelectedTower].pCost * (NPI_Towers[NPI_SelectedTower].pLevel + 1)))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_level.text = (((("Level - " + NPI_Towers[NPI_SelectedTower].pLevel) + "(") + (NPI_Towers[NPI_SelectedTower].pLevel + 1)) + ")");
text_tower_damage.text = (((("Damage - " + NPI_Towers[NPI_SelectedTower].pDamage.toFixed(2)) + "(") + _local2.toFixed(2)) + ")");
text_tower_range.text = ("Range - " + NPI_Towers[NPI_SelectedTower].pRange);
text_tower_sell.text = ("Sell Value - " + String(int(((NPI_Towers[NPI_SelectedTower].pLevel * NPI_Towers[NPI_SelectedTower].pCost) * 0.7))));
};
};
};
}
public function NP_MoveAndCheckBlizzard():void{
var _local1:int;
var _local2:int;
if (NP_gamemode != "paused"){
_local1 = (NP_Blizzards.length - 1);
while (_local1 >= 0) {
_local2 = (NP_Enemies.length - 1);
while (_local2 >= 0) {
if (NP_Enemies[_local2].hitTestObject(NP_Blizzards[_local1])){
NP_Enemies[_local2].pSpeed = 0;
};
_local2--;
};
if (NP_Blizzards[_local1].y < -128){
drawonme.removeChild(NP_Blizzards[_local1]);
NP_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
public function NP_tower_select_fire_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Fire Tower (100g)";
text_towerinfo.text = "Low Dmg, Fast Speed. (Magic Damage)";
}
public function playhard(_arg1:MouseEvent):void{
gotoAndStop(45);
}
public function NPS_MoveBullets():void{
var i:int;
var a:int;
if (NPS_gamemode != "paused"){
try {
i = (NPS_Bullets.length - 1);
while (i >= 0) {
NPS_Bullets[i].movebullet(NPS_Enemies[NPS_Bullets[i].pTarget].x, NPS_Enemies[NPS_Bullets[i].pTarget].y);
i = (i - 1);
};
} catch(e:TypeError) {
a = (NPS_Bullets.length - 1);
while (a >= 0) {
NPS_Bullets[a].x = -900;
NPS_Bullets[a].y = -900;
NPS_Bullets[a].pTarget = -1;
if (NPS_Bullets[a].pVisible == true){
removeChild(NPS_Bullets[a].pBullet);
};
NPS_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
public function NP_everytime(_arg1:Event):void{
var b:int;
var mX:int;
var mY:int;
var didHit:Boolean;
var event = _arg1;
try {
if (NP_gamemode != "paused"){
NP_CheckEnemiesForDirections();
NP_CheckTowerFireBullet();
NP_MoveBullets();
NP_CheckEnemiesForHit();
NP_CheckEnemyHealth();
NP_UpdateEnemyHealthBar();
NP_CheckSelectedTower();
NP_MoveAndCheckAngelsOfDeath();
NP_MoveAndCheckBlizzard();
NP_MoveAndCheckJudgement();
if (getTimer() > (NP_LastWave + NP_WaveDelay)){
NP_placeenemies();
};
text_next_level.text = String(Math.round((((NP_WaveDelay + NP_LastWave) - getTimer()) / 1000)));
if (NP_PlacedMine == true){
text_next_gold.text = String(Math.round((((NP_GoldUpdateSpeed + NP_LastGoldUpdate) - getTimer()) / 1000)));
if (getTimer() > (NP_LastGoldUpdate + NP_GoldUpdateSpeed)){
NP_Gold = (NP_Gold + (NP_Gold * 0.02));
NP_Gold = Math.round(NP_Gold);
text_gold.text = String(NP_Gold);
NP_LastGoldUpdate = getTimer();
};
};
if (NP_PlacedChurch == true){
text_next_prayer.text = String(Math.round((((NP_PrayerUpdateSpeed + NP_LastPrayerUpdate) - getTimer()) / 1000)));
if (getTimer() > (NP_LastPrayerUpdate + NP_PrayerUpdateSpeed)){
NP_Prayer = (NP_Prayer + 1);
text_prayer.text = String(NP_Prayer);
NP_LastPrayerUpdate = getTimer();
};
};
if (NP_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) <= 13)) && ((int((root.mouseY / 32)) >= 2)))){
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.lineTo(mX, mY);
TheGrid1.graphics.lineTo((mX + 32), mY);
TheGrid1.graphics.lineTo((mX + 32), (mY + 32));
TheGrid1.graphics.lineTo(mX, (mY + 32));
TheGrid1.graphics.endFill();
};
};
};
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) <= 13)) && ((int((root.mouseY / 32)) >= 2)))){
if (NP_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NP_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NP_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 124);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 123);
TheGrid1.graphics.endFill();
};
if (NP_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NP_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 100);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 99);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 98);
TheGrid1.graphics.endFill();
};
};
};
};
b = (NP_Towers.length - 1);
while (b >= 0) {
NP_Towers[b].graphics.clear();
b = (b - 1);
};
drawonme.graphics.clear();
if (NP_SelectedTower != -1){
mX = 0;
mY = 0;
NP_Towers[NP_SelectedTower].graphics.clear();
NP_Towers[NP_SelectedTower].graphics.moveTo(mX, mY);
NP_Towers[NP_SelectedTower].graphics.beginFill(0xFFFFFF, 0.5);
NP_Towers[NP_SelectedTower].graphics.lineTo(mX, mY);
NP_Towers[NP_SelectedTower].graphics.lineTo((mX + 32), mY);
NP_Towers[NP_SelectedTower].graphics.lineTo((mX + 32), (mY + 32));
NP_Towers[NP_SelectedTower].graphics.lineTo(mX, (mY + 32));
NP_Towers[NP_SelectedTower].graphics.endFill();
if (NP_Towers[NP_SelectedTower].pTowerType <= 5){
upgrade_tower.x = 524;
} else {
upgrade_tower.x = 900;
};
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((NP_Towers[NP_SelectedTower].x + 16), (NP_Towers[NP_SelectedTower].y + 16), NP_Towers[NP_SelectedTower].pRange);
drawonme.graphics.endFill();
};
};
} catch(e:TypeError) {
};
}
public function NPH_everytime(_arg1:Event):void{
var b:int;
var mX:int;
var mY:int;
var didHit:Boolean;
var event = _arg1;
try {
if (NPH_gamemode != "paused"){
NPH_CheckEnemiesForDirections();
NPH_CheckTowerFireBullet();
NPH_MoveBullets();
NPH_CheckEnemiesForHit();
NPH_CheckEnemyHealth();
NPH_UpdateEnemyHealthBar();
NPH_CheckSelectedTower();
NPH_MoveAndCheckAngelsOfDeath();
NPH_MoveAndCheckBlizzard();
NPH_MoveAndCheckJudgement();
if (getTimer() > (NPH_LastWave + NPH_WaveDelay)){
NPH_placeenemies();
};
text_next_level.text = String(Math.round((((NPH_WaveDelay + NPH_LastWave) - getTimer()) / 1000)));
if (NPH_PlacedMine == true){
text_next_gold.text = String(Math.round((((NPH_GoldUpdateSpeed + NPH_LastGoldUpdate) - getTimer()) / 1000)));
if (getTimer() > (NPH_LastGoldUpdate + NPH_GoldUpdateSpeed)){
NPH_Gold = (NPH_Gold + (NPH_Gold * 0.02));
NPH_Gold = Math.round(NPH_Gold);
text_gold.text = String(NPH_Gold);
NPH_LastGoldUpdate = getTimer();
};
};
if (NPH_PlacedChurch == true){
text_next_prayer.text = String(Math.round((((NPH_PrayerUpdateSpeed + NPH_LastPrayerUpdate) - getTimer()) / 1000)));
if (getTimer() > (NPH_LastPrayerUpdate + NPH_PrayerUpdateSpeed)){
NPH_Prayer = (NPH_Prayer + 1);
text_prayer.text = String(NPH_Prayer);
NPH_LastPrayerUpdate = getTimer();
};
};
if (NPH_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) <= 13)) && ((int((root.mouseY / 32)) >= 2)))){
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.lineTo(mX, mY);
TheGrid1.graphics.lineTo((mX + 32), mY);
TheGrid1.graphics.lineTo((mX + 32), (mY + 32));
TheGrid1.graphics.lineTo(mX, (mY + 32));
TheGrid1.graphics.endFill();
};
};
};
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) <= 13)) && ((int((root.mouseY / 32)) >= 2)))){
if (NPH_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NPH_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NPH_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 124);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 123);
TheGrid1.graphics.endFill();
};
if (NPH_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 175);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 174);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 173);
TheGrid1.graphics.endFill();
};
if (NPH_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(88193, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 100);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0, 0.5);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 99);
TheGrid1.graphics.endFill();
TheGrid1.graphics.beginFill(0xFFFFFF, 1);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 98);
TheGrid1.graphics.endFill();
};
};
};
};
b = (NPH_Towers.length - 1);
while (b >= 0) {
NPH_Towers[b].graphics.clear();
b = (b - 1);
};
drawonme.graphics.clear();
if (NPH_SelectedTower != -1){
mX = 0;
mY = 0;
NPH_Towers[NPH_SelectedTower].graphics.clear();
NPH_Towers[NPH_SelectedTower].graphics.moveTo(mX, mY);
NPH_Towers[NPH_SelectedTower].graphics.beginFill(0xFFFFFF, 0.5);
NPH_Towers[NPH_SelectedTower].graphics.lineTo(mX, mY);
NPH_Towers[NPH_SelectedTower].graphics.lineTo((mX + 32), mY);
NPH_Towers[NPH_SelectedTower].graphics.lineTo((mX + 32), (mY + 32));
NPH_Towers[NPH_SelectedTower].graphics.lineTo(mX, (mY + 32));
NPH_Towers[NPH_SelectedTower].graphics.endFill();
if (NPH_Towers[NPH_SelectedTower].pTowerType <= 5){
upgrade_tower.x = 524;
} else {
upgrade_tower.x = 900;
};
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((NPH_Towers[NPH_SelectedTower].x + 16), (NPH_Towers[NPH_SelectedTower].y + 16), NPH_Towers[NPH_SelectedTower].pRange);
drawonme.graphics.endFill();
};
};
} catch(e:TypeError) {
};
}
public function NP_tower_select_arcane_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Arcane Tower (125g)";
text_towerinfo.text = "Medium Speed, High Dmg. (Magic Damage)";
}
public function NPH_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
NPH_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 99;
NPH_PausedTimer2 = getTimer();
_local2 = (NPH_PausedTimer2 - NPH_PausedTimer1);
_local3 = (NPH_Towers.length - 1);
while (_local3 >= 0) {
NPH_Towers[_local3].pLastFire = (NPH_Towers[_local3].pLastFire + _local2);
_local3--;
};
NPH_LastPrayerUpdate = (NPH_LastPrayerUpdate + _local2);
NPH_LastGoldUpdate = (NPH_LastGoldUpdate + _local2);
NPH_LastWave = (NPH_LastWave + _local2);
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
_local4 = (NPH_Enemies.length - 1);
while (_local4 >= 0) {
NPH_Enemies[_local4].pPaused = false;
_local4--;
};
_local5 = (NPH_AngelsOfDeath.length - 1);
while (_local5 >= 0) {
NPH_AngelsOfDeath[_local5].pPaused = false;
_local5--;
};
_local6 = (NPH_Blizzards.length - 1);
while (_local6 >= 0) {
NPH_Blizzards[_local6].pPaused = false;
_local6--;
};
}
public function NPS_musicright_mouse_up(_arg1:MouseEvent):void{
if (NPS_Muted == false){
NPS_CurrentSong++;
if (NPS_CurrentSong == 6){
NPS_CurrentSong = 1;
};
NPS_channel.stop();
if (NPS_CurrentSong == 1){
NPS_channel = NPS_Ambient1.play(0, 99999);
};
if (NPS_CurrentSong == 2){
NPS_channel = NPS_Ambient2.play(0, 99999);
};
if (NPS_CurrentSong == 3){
NPS_channel = NPS_Ambient3.play(0, 99999);
};
if (NPS_CurrentSong == 4){
NPS_channel = NPS_Ambient4.play(0, 99999);
};
if (NPS_CurrentSong == 5){
NPS_channel = NPS_Ambient5.play(0, 99999);
};
};
}
public function NP_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 2% Of Your Gold Every 5 mins. Limit 1.";
}
public function NPI_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function NP_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (NP_gamemode != "paused"){
if (NP_Enemies.length < 51){
if (NP_GameLevel != 0){
NP_GameScore = (NP_GameScore + Math.round((((NP_WaveDelay + NP_LastWave) - getTimer()) / 1000)));
text_score.text = String(NP_GameScore);
};
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
NP_placeenemies();
};
};
}
public function NP_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
return (false);
}
public function NPI_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (NPI_gamemode != "paused"){
if (NPI_Prayer >= 3){
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
NPI_Prayer = (NPI_Prayer - 3);
text_prayer.text = String(NPI_Prayer);
_local2 = 0;
while (_local2 < 10) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
NPI_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function NPH_CheckEnemyHealth():void{
var i:int;
var h:int;
var k:int;
var a:int;
if (NPH_gamemode != "paused"){
try {
i = (NPH_Enemies.length - 1);
while (i >= 0) {
if (NPH_Enemies[i].pHealth <= 0){
NPH_Enemies[i].x = -500;
NPH_Enemies[i].y = -500;
if (NPH_Enemies[i].pType == 5){
NPH_Gold = (NPH_Gold + Math.round(((1.75 * NPH_GameLevel) + 0.5)));
NPH_GameScore = (NPH_GameScore + 50);
} else {
NPH_Gold = (NPH_Gold + Math.round(((0.25 * NPH_GameLevel) + 0.5)));
NPH_GameScore = (NPH_GameScore + 10);
};
removeChild(NPH_Enemies[i]);
NPH_Enemies.splice(i, 1);
text_gold.text = String(NPH_Gold);
text_score.text = String(NPH_GameScore);
h = (NPH_HealthBars.length - 1);
while (h >= 0) {
if (NPH_HealthBars[h].pEnemy == i){
NPH_HealthBars[h].x = -900;
removeChild(NPH_HealthBars[h]);
NPH_HealthBars.splice(h, 1);
};
if (NPH_HealthBars[h].pEnemy > i){
NPH_HealthBars[h].pEnemy = (NPH_HealthBars[h].pEnemy - 1);
};
h = (h - 1);
};
k = (NPH_Bullets.length - 1);
while (k >= 0) {
if (k != i){
if (NPH_Bullets[k].pTarget > i){
NPH_Bullets[k].pTarget = (NPH_Bullets[k].pTarget - 1);
};
};
if (NPH_Bullets[k].pTarget == i){
NPH_Bullets[k].x = -100;
NPH_Bullets[k].y = -100;
if (NPH_Bullets[k].pVisible == true){
removeChild(NPH_Bullets[k].pBullet);
};
NPH_Bullets.splice(k, 1);
};
k = (k - 1);
};
a = (NPH_Towers.length - 1);
while (a >= 0) {
if (NPH_Towers[a].pTarget == i){
NPH_Towers[a].pTarget = -1;
};
if (NPH_Towers[a].pTarget > i){
NPH_Towers[a].pTarget = (NPH_Towers[a].pTarget - 1);
};
a = (a - 1);
};
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function NP_buy_church_mouse_up(_arg1:MouseEvent):void{
if (NP_gamemode != "paused"){
if (NP_gamemode == "set_tower"){
if (NP_selectedtowertype == "Church"){
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
NP_gamemode = "off";
TheGrid1.alpha = 0;
NP_selectedtowertype = "none";
} else {
if (NP_selectedtowertype != "Church"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Church";
};
};
} else {
if (NP_gamemode != "set_tower"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Church";
};
};
};
}
public function NPI_tower_select_fire_mouse_up(_arg1:MouseEvent):void{
if (NPI_gamemode != "paused"){
if (NPI_gamemode == "set_tower"){
if (NPI_selectedtowertype == "Fire"){
NPI_gamemode = "off";
TheGrid1.alpha = 0;
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
NPI_selectedtowertype = "none";
} else {
if (NPI_selectedtowertype != "Fire"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Fire";
};
};
} else {
if (NPI_gamemode != "set_tower"){
NPI_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
NPI_selectedtowertype = "Fire";
};
};
};
}
public function NPI_musicmute_mouse_up(_arg1:MouseEvent):void{
if (NPI_Muted == false){
NPI_channel.stop();
NPI_Muted = true;
} else {
if (NPI_CurrentSong == 1){
NPI_channel = NPI_Ambient1.play(0, 99999);
};
if (NPI_CurrentSong == 2){
NPI_channel = NPI_Ambient2.play(0, 99999);
};
if (NPI_CurrentSong == 3){
NPI_channel = NPI_Ambient3.play(0, 99999);
};
if (NPI_CurrentSong == 4){
NPI_channel = NPI_Ambient4.play(0, 99999);
};
if (NPI_CurrentSong == 5){
NPI_channel = NPI_Ambient5.play(0, 99999);
};
NPI_Muted = false;
};
}
public function NPI_MoveAndCheckBlizzard():void{
var _local1:int;
var _local2:int;
if (NPI_gamemode != "paused"){
_local1 = (NPI_Blizzards.length - 1);
while (_local1 >= 0) {
_local2 = (NPI_Enemies.length - 1);
while (_local2 >= 0) {
if (NPI_Enemies[_local2].hitTestObject(NPI_Blizzards[_local1])){
NPI_Enemies[_local2].pSpeed = 0;
};
_local2--;
};
if (NPI_Blizzards[_local1].y < -128){
drawonme.removeChild(NPI_Blizzards[_local1]);
NPI_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
public function NP_tower_select_cannon_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Cannon Tower (75g)";
text_towerinfo.text = "Medium Dmg, Splash Dmg. (Normal Damage)";
}
public function NP_tower_select_fire_mouse_up(_arg1:MouseEvent):void{
if (NP_gamemode != "paused"){
if (NP_gamemode == "set_tower"){
if (NP_selectedtowertype == "Fire"){
NP_gamemode = "off";
TheGrid1.alpha = 0;
if (NP_Muted == false){
NP_ButtonClick.play();
};
NP_selectedtowertype = "none";
} else {
if (NP_selectedtowertype != "Fire"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
NP_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Fire";
};
};
} else {
if (NP_gamemode != "set_tower"){
NP_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (NP_Muted == false){
NP_ButtonClick.play();
};
NP_selectedtowertype = "Fire";
};
};
};
}
public function NPI_restart_no(_arg1:MouseEvent):void{
restart_sure.x = 1000;
restart_yes.x = 1000;
restart_no.x = 1000;
}
public function NPI_tower_select_ice_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Ice Tower (25g)";
text_towerinfo.text = "Slows enemies down. (Magic Damage)";
}
public function NPS_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 2% Of Your Gold Every 5 mins. Limit 1.";
}
public function playnopathsinsane(_arg1:MouseEvent):void{
gotoAndStop(125);
}
public function playnopathshard(_arg1:MouseEvent):void{
gotoAndStop(115);
}
public function backtomenu(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function NPH_MoveBullets():void{
var i:int;
var a:int;
if (NPH_gamemode != "paused"){
try {
i = (NPH_Bullets.length - 1);
while (i >= 0) {
NPH_Bullets[i].movebullet(NPH_Enemies[NPH_Bullets[i].pTarget].x, NPH_Enemies[NPH_Bullets[i].pTarget].y);
i = (i - 1);
};
} catch(e:TypeError) {
a = (NPH_Bullets.length - 1);
while (a >= 0) {
NPH_Bullets[a].x = -900;
NPH_Bullets[a].y = -900;
NPH_Bullets[a].pTarget = -1;
if (NPH_Bullets[a].pVisible == true){
removeChild(NPH_Bullets[a].pBullet);
};
NPH_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
public function NPH_UpdateEnemyHealthBar():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (NPH_gamemode != "paused"){
_local3 = (NPH_HealthBars.length - 1);
while (_local3 >= 0) {
_local1 = (NPH_Enemies[NPH_HealthBars[_local3].pEnemy].pHealth / NPH_Enemies[NPH_HealthBars[_local3].pEnemy].pStartHealth);
_local1 = (_local1 * 100);
_local2 = ((27 * _local1) / 100);
NPH_HealthBars[_local3].x = (NPH_Enemies[NPH_HealthBars[_local3].pEnemy].x - 13);
NPH_HealthBars[_local3].y = (NPH_Enemies[NPH_HealthBars[_local3].pEnemy].y - 16);
NPH_HealthBars[_local3].pWidth = _local2;
NPH_HealthBars[_local3].width = _local2;
_local3--;
};
};
}
public function playnopathssandbox(_arg1:MouseEvent):void{
gotoAndStop(135);
}
public function NP_placeenemies():void{
var _local1:*;
var _local2:script_enemy_orc;
var _local3:enemy_health_bar;
var _local4:script_enemy_armororc;
var _local5:enemy_health_bar;
var _local6:script_enemy_goblin;
var _local7:enemy_health_bar;
var _local8:script_enemy_fasttroll;
var _local9:enemy_health_bar;
var _local10:script_enemy_tauren;
var _local11:enemy_health_bar;
var _local12:script_enemy_armortroll;
var _local13:enemy_health_bar;
var _local14:script_enemy_lion;
var _local15:enemy_health_bar;
var _local16:script_enemy_undead;
var _local17:enemy_health_bar;
var _local18:script_enemy_clothundead;
var _local19:enemy_health_bar;
var _local20:script_enemy_demon;
var _local21:enemy_health_bar;
var _local22:script_enemy_boss1;
var _local23:enemy_health_bar;
if (NP_gamemode != "paused"){
NP_WaveDelay = (NP_WaveDelay - 500);
if (NP_WaveDelay < 10000){
NP_WaveDelay = 10000;
};
NP_GameLevel = (NP_GameLevel + 1);
NP_Path = Pathfinding.findPath(NP_Map, NP_MapStart.y, NP_MapStart.x, NP_MapEnd.y, NP_MapEnd.x);
_local1 = 0;
while (_local1 < 25) {
if (NP_LastEnemyType == 1){
_local2 = new script_enemy_orc(_local1, NP_GameLevel, "normal");
addChild(_local2);
NP_Enemies.push(_local2);
NP_LastWave = getTimer();
text_level.text = String(NP_GameLevel);
_local3 = new enemy_health_bar();
_local3.pEnemy = (NP_Enemies.length - 1);
_local3.x = (_local2.x - 13);
_local3.y = (_local2.y - 16);
_local3.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local2.pStartHealth));
addChild(_local3);
NP_HealthBars.push(_local3);
_local2.pPath = NP_Path;
text_nexttype.text = "Next Enemy Type : Armor";
} else {
if (NP_LastEnemyType == 2){
_local4 = new script_enemy_armororc(_local1, NP_GameLevel, "normal");
addChild(_local4);
NP_Enemies.push(_local4);
NP_LastWave = getTimer();
text_level.text = String(NP_GameLevel);
_local5 = new enemy_health_bar();
_local5.pEnemy = (NP_Enemies.length - 1);
_local5.x = (_local4.x - 13);
_local5.y = (_local4.y - 16);
_local5.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local4.pStartHealth));
addChild(_local5);
NP_HealthBars.push(_local5);
_local4.pPath = NP_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NP_LastEnemyType == 3){
_local6 = new script_enemy_goblin(_local1, NP_GameLevel, "normal");
addChild(_local6);
NP_Enemies.push(_local6);
NP_LastWave = getTimer();
text_level.text = String(NP_GameLevel);
_local7 = new enemy_health_bar();
_local7.pEnemy = (NP_Enemies.length - 1);
_local7.x = (_local6.x - 13);
_local7.y = (_local6.y - 16);
_local7.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local6.pStartHealth));
addChild(_local7);
NP_HealthBars.push(_local7);
_local6.pPath = NP_Path;
text_nexttype.text = "Next Enemy Type : Fast";
} else {
if (NP_LastEnemyType == 4){
_local8 = new script_enemy_fasttroll(_local1, NP_GameLevel, "normal");
addChild(_local8);
NP_Enemies.push(_local8);
NP_LastWave = getTimer();
text_level.text = String(NP_GameLevel);
_local9 = new enemy_health_bar();
_local9.pEnemy = (NP_Enemies.length - 1);
_local9.x = (_local8.x - 13);
_local9.y = (_local8.y - 16);
_local9.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local8.pStartHealth));
addChild(_local9);
NP_HealthBars.push(_local9);
_local8.pPath = NP_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NP_LastEnemyType == 5){
_local10 = new script_enemy_tauren(_local1, NP_GameLevel, "normal");
addChild(_local10);
NP_Enemies.push(_local10);
NP_LastWave = getTimer();
text_level.text = String(NP_GameLevel);
_local11 = new enemy_health_bar();
_local11.pEnemy = (NP_Enemies.length - 1);
_local11.x = (_local10.x - 13);
_local11.y = (_local10.y - 16);
_local11.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local10.pStartHealth));
addChild(_local11);
NP_HealthBars.push(_local11);
_local10.pPath = NP_Path;
text_nexttype.text = "Next Enemy Type : Armor";
} else {
if (NP_LastEnemyType == 6){
_local12 = new script_enemy_armortroll(_local1, NP_GameLevel, "normal");
addChild(_local12);
NP_Enemies.push(_local12);
NP_LastWave = getTimer();
text_level.text = String(NP_GameLevel);
_local13 = new enemy_health_bar();
_local13.pEnemy = (NP_Enemies.length - 1);
_local13.x = (_local12.x - 13);
_local13.y = (_local12.y - 16);
_local13.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local12.pStartHealth));
addChild(_local13);
NP_HealthBars.push(_local13);
_local12.pPath = NP_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NP_LastEnemyType == 7){
_local14 = new script_enemy_lion(_local1, NP_GameLevel, "normal");
addChild(_local14);
NP_Enemies.push(_local14);
NP_LastWave = getTimer();
text_level.text = String(NP_GameLevel);
_local15 = new enemy_health_bar();
_local15.pEnemy = (NP_Enemies.length - 1);
_local15.x = (_local14.x - 13);
_local15.y = (_local14.y - 16);
_local15.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local14.pStartHealth));
addChild(_local15);
NP_HealthBars.push(_local15);
_local14.pPath = NP_Path;
text_nexttype.text = "Next Enemy Type : Fast";
} else {
if (NP_LastEnemyType == 8){
_local16 = new script_enemy_undead(_local1, NP_GameLevel, "normal");
addChild(_local16);
NP_Enemies.push(_local16);
NP_LastWave = getTimer();
text_level.text = String(NP_GameLevel);
_local17 = new enemy_health_bar();
_local17.pEnemy = (NP_Enemies.length - 1);
_local17.x = (_local16.x - 13);
_local17.y = (_local16.y - 16);
_local17.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local16.pStartHealth));
addChild(_local17);
NP_HealthBars.push(_local17);
_local16.pPath = NP_Path;
text_nexttype.text = "Next Enemy Type : Normal";
} else {
if (NP_LastEnemyType == 9){
_local18 = new script_enemy_clothundead(_local1, NP_GameLevel, "normal");
addChild(_local18);
NP_Enemies.push(_local18);
NP_LastWave = getTimer();
text_level.text = String(NP_GameLevel);
_local19 = new enemy_health_bar();
_local19.pEnemy = (NP_Enemies.length - 1);
_local19.x = (_local18.x - 13);
_local19.y = (_local18.y - 16);
_local19.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local18.pStartHealth));
addChild(_local19);
NP_HealthBars.push(_local19);
_local18.pPath = NP_Path;
text_nexttype.text = "Next Enemy Type : Immune to magic!";
} else {
if (NP_LastEnemyType == 10){
_local20 = new script_enemy_demon(_local1, NP_GameLevel, "normal");
addChild(_local20);
NP_Enemies.push(_local20);
NP_LastWave = getTimer();
text_level.text = String(NP_GameLevel);
_local21 = new enemy_health_bar();
_local21.pEnemy = (NP_Enemies.length - 1);
_local21.x = (_local20.x - 13);
_local21.y = (_local20.y - 16);
_local21.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local20.pStartHealth));
addChild(_local21);
NP_HealthBars.push(_local21);
_local20.pPath = NP_Path;
text_nexttype.text = "Next Enemy Type : Boss Round";
};
};
};
};
};
};
};
};
};
};
_local1++;
};
if (NP_LastEnemyType == 11){
_local22 = new script_enemy_boss1(0, NP_GameLevel, "normal");
addChild(_local22);
NP_Enemies.push(_local22);
NP_LastWave = getTimer();
text_level.text = String(NP_GameLevel);
_local23 = new enemy_health_bar();
_local23.pEnemy = (NP_Enemies.length - 1);
_local23.x = (_local22.x - 13);
_local23.y = (_local22.y - 16);
_local23.pWidth = 32;
text_enemy_hp.text = String(Math.round(_local22.pStartHealth));
addChild(_local23);
NP_HealthBars.push(_local23);
_local22.pPath = NP_Path;
text_nexttype.text = "Next Enemy Type : Normal";
};
NP_LastEnemyType = (NP_LastEnemyType + 1);
if (NP_LastEnemyType == 12){
NP_LastEnemyType = 1;
};
};
}
public function NPH_tower_select_ice_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Ice Tower (25g)";
text_towerinfo.text = "Slows enemies down. (Magic Damage)";
}
public function NPI_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(3 PP)";
text_towerinfo.text = "Calls forth a Blizzard to slow your enemies.";
}
public function NP_musicright_mouse_up(_arg1:MouseEvent):void{
if (NP_Muted == false){
NP_CurrentSong++;
if (NP_CurrentSong == 6){
NP_CurrentSong = 1;
};
NP_channel.stop();
if (NP_CurrentSong == 1){
NP_channel = NP_Ambient1.play(0, 99999);
};
if (NP_CurrentSong == 2){
NP_channel = NP_Ambient2.play(0, 99999);
};
if (NP_CurrentSong == 3){
NP_channel = NP_Ambient3.play(0, 99999);
};
if (NP_CurrentSong == 4){
NP_channel = NP_Ambient4.play(0, 99999);
};
if (NP_CurrentSong == 5){
NP_channel = NP_Ambient5.play(0, 99999);
};
};
}
public function NPH_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
text_tower_level.text = ("Level - " + NPH_Towers[NPH_SelectedTower].pLevel);
text_tower_damage.text = ("Damage - " + NPH_Towers[NPH_SelectedTower].pDamage.toFixed(2));
} catch(e:TypeError) {
};
}
public function NPI_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function NPH_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
return (false);
}
public function NP_CheckEnemiesForDirections(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
if (NP_gamemode != "paused"){
_local1 = (NP_Enemies.length - 1);
while (_local1 >= 0) {
if (NP_Enemies[_local1].y > 500){
NP_Lives = (NP_Lives - 1);
text_lives.text = String(NP_Lives);
if (NP_Lives < 1){
_local5 = (NP_HealthBars.length - 1);
while (_local5 >= 0) {
removeChild(NP_HealthBars[_local5]);
NP_HealthBars.splice(_local5, 1);
_local5--;
};
_local6 = (NP_Bullets.length - 1);
while (_local6 >= 0) {
if (NP_Bullets[_local6].pVisible == true){
removeChild(NP_Bullets[_local6]);
};
NP_Bullets.splice(_local6, 1);
_local6--;
};
_local7 = (NP_Towers.length - 1);
while (_local7 >= 0) {
removeChild(NP_Towers[_local7]);
NP_Towers.splice(_local7, 1);
_local7--;
};
_local8 = (NP_Enemies.length - 1);
while (_local8 >= 0) {
removeChild(NP_Enemies[_local8]);
NP_Enemies.splice(_local8, 1);
_local8--;
};
removeEventListener(Event.ENTER_FRAME, NP_everytime);
removeEventListener(KeyboardEvent.KEY_UP, NP_reportKeyUp);
NP_channel.stop();
gotoAndStop(110);
};
removeChild(NP_Enemies[_local1]);
NP_Enemies.splice(_local1, 1);
_local2 = (NP_HealthBars.length - 1);
while (_local2 >= 0) {
if (NP_HealthBars[_local2].pEnemy == _local1){
NP_HealthBars[_local2].x = -900;
removeChild(NP_HealthBars[_local2]);
NP_HealthBars.splice(_local2, 1);
};
if (NP_HealthBars[_local2].pEnemy > _local1){
NP_HealthBars[_local2].pEnemy = (NP_HealthBars[_local2].pEnemy - 1);
};
_local2--;
};
_local3 = (NP_Bullets.length - 1);
while (_local3 >= 0) {
if (NP_Bullets[_local3].pTarget > _local1){
NP_Bullets[_local3].pTarget = (NP_Bullets[_local3].pTarget - 1);
};
if (NP_Bullets[_local3].pTarget == _local1){
NP_Bullets[_local3].x = -100;
NP_Bullets[_local3].y = -100;
removeChild(NP_Bullets[_local3].pBullet);
NP_Bullets.splice(_local3, 1);
};
_local3--;
};
_local4 = (NP_Towers.length - 1);
while (_local4 >= 0) {
if (NP_Towers[_local4].pTarget == _local1){
NP_Towers[_local4].pTarget = -1;
};
if (NP_Towers[_local4].pTarget > _local1){
NP_Towers[_local4].pTarget = (NP_Towers[_local4].pTarget - 1);
};
_local4--;
};
};
_local1--;
};
};
}
public function NPS_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
NPS_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 99;
NPS_PausedTimer2 = getTimer();
_local2 = (NPS_PausedTimer2 - NPS_PausedTimer1);
_local3 = (NPS_Towers.length - 1);
while (_local3 >= 0) {
NPS_Towers[_local3].pLastFire = (NPS_Towers[_local3].pLastFire + _local2);
_local3--;
};
NPS_LastPrayerUpdate = (NPS_LastPrayerUpdate + _local2);
NPS_LastGoldUpdate = (NPS_LastGoldUpdate + _local2);
NPS_LastWave = (NPS_LastWave + _local2);
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
_local4 = (NPS_Enemies.length - 1);
while (_local4 >= 0) {
NPS_Enemies[_local4].pPaused = false;
_local4--;
};
_local5 = (NPS_AngelsOfDeath.length - 1);
while (_local5 >= 0) {
NPS_AngelsOfDeath[_local5].pPaused = false;
_local5--;
};
_local6 = (NPS_Blizzards.length - 1);
while (_local6 >= 0) {
NPS_Blizzards[_local6].pPaused = false;
_local6--;
};
}
public function NP_the_grid_place_tower(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:Boolean;
var _local4:Number;
var _local5:*;
var _local6:int;
var _local7:tower_arrow;
var _local8:tower_arcane;
var _local9:tower_cannon;
var _local10:tower_ice;
var _local11:tower_fire;
var _local12:building_mine;
var _local13:building_church;
if (NP_gamemode != "paused"){
if (NP_gamemode == "set_tower"){
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) >= 2)) && ((int((root.mouseY / 32)) <= 13)))){
if (NP_selectedtowertype == "Arrow"){
_local3 = true;
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NP_Map, NP_MapStart.y, NP_MapStart.x, NP_MapEnd.y, NP_MapEnd.x) != null){
_local6 = (NP_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NP_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NP_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NP_Gold >= 30)) && ((_local3 == true)))){
_local7 = new tower_arrow();
_local7.x = (int((root.mouseX / 32)) * 32);
_local7.y = (int((root.mouseY / 32)) * 32);
addChild(_local7);
NP_Towers.push(_local7);
NP_Gold = (NP_Gold - 30);
text_gold.text = String(NP_Gold);
NP_Map[Math.round((_local7.y / 32))][Math.round((_local7.x / 32))] = 0;
_local5 = (NP_Enemies.length - 1);
while (_local5 >= 0) {
if (NP_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][1]), Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NP_Path = Pathfinding.findPath(NP_Map, _local2.y, _local2.x, NP_MapEnd.y, NP_MapEnd.x);
if (NP_Path == null){
};
NP_Enemies[_local5].pPath = NP_Path;
NP_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NP_selectedtowertype == "Arcane"){
_local3 = true;
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NP_Map, NP_MapStart.y, NP_MapStart.x, NP_MapEnd.y, NP_MapEnd.x) != null){
_local6 = (NP_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NP_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NP_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NP_Gold >= 125)) && ((_local3 == true)))){
_local8 = new tower_arcane();
_local8.x = (int((root.mouseX / 32)) * 32);
_local8.y = (int((root.mouseY / 32)) * 32);
addChild(_local8);
NP_Towers.push(_local8);
NP_Gold = (NP_Gold - 125);
text_gold.text = String(NP_Gold);
NP_Map[Math.round((_local8.y / 32))][Math.round((_local8.x / 32))] = 0;
_local5 = (NP_Enemies.length - 1);
while (_local5 >= 0) {
if (NP_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][1]), Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NP_Path = Pathfinding.findPath(NP_Map, _local2.y, _local2.x, NP_MapEnd.y, NP_MapEnd.x);
if (NP_Path == null){
};
NP_Enemies[_local5].pPath = NP_Path;
NP_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NP_selectedtowertype == "Cannon"){
_local3 = true;
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NP_Map, NP_MapStart.y, NP_MapStart.x, NP_MapEnd.y, NP_MapEnd.x) != null){
_local6 = (NP_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NP_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NP_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NP_Gold >= 75)) && ((_local3 == true)))){
_local9 = new tower_cannon();
_local9.x = (int((root.mouseX / 32)) * 32);
_local9.y = (int((root.mouseY / 32)) * 32);
addChild(_local9);
NP_Towers.push(_local9);
NP_Gold = (NP_Gold - 75);
text_gold.text = String(NP_Gold);
NP_Map[Math.round((_local9.y / 32))][Math.round((_local9.x / 32))] = 0;
_local5 = (NP_Enemies.length - 1);
while (_local5 >= 0) {
if (NP_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][1]), Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NP_Path = Pathfinding.findPath(NP_Map, _local2.y, _local2.x, NP_MapEnd.y, NP_MapEnd.x);
if (NP_Path == null){
};
NP_Enemies[_local5].pPath = NP_Path;
NP_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NP_selectedtowertype == "Ice"){
_local3 = true;
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NP_Map, NP_MapStart.y, NP_MapStart.x, NP_MapEnd.y, NP_MapEnd.x) != null){
_local6 = (NP_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NP_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NP_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NP_Gold >= 25)) && ((_local3 == true)))){
_local10 = new tower_ice();
_local10.x = (int((root.mouseX / 32)) * 32);
_local10.y = (int((root.mouseY / 32)) * 32);
addChild(_local10);
NP_Towers.push(_local10);
NP_Gold = (NP_Gold - 25);
text_gold.text = String(NP_Gold);
NP_Map[Math.round((_local10.y / 32))][Math.round((_local10.x / 32))] = 0;
_local5 = (NP_Enemies.length - 1);
while (_local5 >= 0) {
if (NP_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][1]), Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NP_Path = Pathfinding.findPath(NP_Map, _local2.y, _local2.x, NP_MapEnd.y, NP_MapEnd.x);
if (NP_Path == null){
};
NP_Enemies[_local5].pPath = NP_Path;
NP_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NP_selectedtowertype == "Fire"){
_local3 = true;
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NP_Map, NP_MapStart.y, NP_MapStart.x, NP_MapEnd.y, NP_MapEnd.x) != null){
_local6 = (NP_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NP_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NP_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NP_Gold >= 100)) && ((_local3 == true)))){
_local11 = new tower_fire();
_local11.x = (int((root.mouseX / 32)) * 32);
_local11.y = (int((root.mouseY / 32)) * 32);
addChild(_local11);
NP_Towers.push(_local11);
NP_Gold = (NP_Gold - 100);
text_gold.text = String(NP_Gold);
NP_Map[Math.round((_local11.y / 32))][Math.round((_local11.x / 32))] = 0;
_local5 = (NP_Enemies.length - 1);
while (_local5 >= 0) {
if (NP_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][1]), Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NP_Path = Pathfinding.findPath(NP_Map, _local2.y, _local2.x, NP_MapEnd.y, NP_MapEnd.x);
if (NP_Path == null){
};
NP_Enemies[_local5].pPath = NP_Path;
NP_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NP_selectedtowertype == "Mine"){
if (NP_PlacedMine == false){
_local3 = true;
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NP_Map, NP_MapStart.y, NP_MapStart.x, NP_MapEnd.y, NP_MapEnd.x) != null){
_local6 = (NP_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NP_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NP_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NP_Gold >= 750)) && ((_local3 == true)))){
_local12 = new building_mine();
_local12.x = (int((root.mouseX / 32)) * 32);
_local12.y = (int((root.mouseY / 32)) * 32);
addChild(_local12);
NP_Towers.push(_local12);
text_next_gold.x = (_local12.x + 3);
text_next_gold.y = (_local12.y + 18);
addChild(text_next_gold);
NP_Gold = (NP_Gold - 750);
text_gold.text = String(NP_Gold);
NP_PlacedMine = true;
NP_LastGoldUpdate = getTimer();
NP_Map[Math.round((_local12.y / 32))][Math.round((_local12.x / 32))] = 0;
_local5 = (NP_Enemies.length - 1);
while (_local5 >= 0) {
if (NP_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][1]), Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NP_Path = Pathfinding.findPath(NP_Map, _local2.y, _local2.x, NP_MapEnd.y, NP_MapEnd.x);
if (NP_Path == null){
};
NP_Enemies[_local5].pPath = NP_Path;
NP_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
};
if (NP_selectedtowertype == "Church"){
if (NP_PlacedChurch == false){
_local3 = true;
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NP_Map, NP_MapStart.y, NP_MapStart.x, NP_MapEnd.y, NP_MapEnd.x) != null){
_local6 = (NP_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NP_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NP_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NP_Gold >= 500)) && ((_local3 == true)))){
_local13 = new building_church();
_local13.x = (int((root.mouseX / 32)) * 32);
_local13.y = (int((root.mouseY / 32)) * 32);
addChild(_local13);
NP_Towers.push(_local13);
text_next_prayer.x = (_local13.x + 5);
text_next_prayer.y = (_local13.y + 18);
addChild(text_next_prayer);
NP_Gold = (NP_Gold - 500);
text_gold.text = String(NP_Gold);
NP_PlacedChurch = true;
NP_LastPrayerUpdate = getTimer();
NP_Map[Math.round((_local13.y / 32))][Math.round((_local13.x / 32))] = 0;
_local5 = (NP_Enemies.length - 1);
while (_local5 >= 0) {
if (NP_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][1]), Math.round(NP_Enemies[_local5].pPath[NP_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NP_Path = Pathfinding.findPath(NP_Map, _local2.y, _local2.x, NP_MapEnd.y, NP_MapEnd.x);
if (NP_Path == null){
};
NP_Enemies[_local5].pPath = NP_Path;
NP_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NP_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
};
};
};
};
NP_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
upgrade_tower.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
text_tower_sell.x = 900;
};
}
public function NPS_road_deselect(_arg1:MouseEvent):void{
TheGrid1.graphics.clear();
TheGrid1.alpha = 0;
NPS_gamemode = "none";
NPS_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
upgrade_tower.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
text_tower_sell.x = 900;
}
public function NP_CheckSelectedTower():void{
var _local1:int;
var _local2:int;
if (NP_gamemode != "paused"){
_local1 = (NP_Towers.length - 1);
while (_local1 >= 0) {
if (NP_Towers[_local1].CheckSelected() == true){
NP_SelectedTower = _local1;
sell_tower.x = 524;
text_tower_damage.x = 484;
text_tower_level.x = 484;
text_tower_range.x = 484;
text_tower_sell.x = 484;
text_tower_damage.text = ("Damage - " + NP_Towers[_local1].pDamage.toFixed(2));
text_tower_range.text = ("Range - " + NP_Towers[_local1].pRange);
text_tower_level.text = ("Level - " + NP_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((NP_Towers[_local1].pLevel * NP_Towers[_local1].pCost) * 0.95))));
NP_gamemode = "none";
TheGrid1.alpha = 0;
NP_selectedtowertype = "none";
};
_local1--;
};
_local2 = (NP_Towers.length - 1);
while (_local2 >= 0) {
NP_Towers[_local2].pSelected = false;
_local2--;
};
};
}
public function NPS_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function NPH_CheckEnemiesForDirections(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
if (NPH_gamemode != "paused"){
_local1 = (NPH_Enemies.length - 1);
while (_local1 >= 0) {
if (NPH_Enemies[_local1].y > 500){
NPH_Lives = (NPH_Lives - 1);
text_lives.text = String(NPH_Lives);
if (NPH_Lives < 1){
_local5 = (NPH_HealthBars.length - 1);
while (_local5 >= 0) {
removeChild(NPH_HealthBars[_local5]);
NPH_HealthBars.splice(_local5, 1);
_local5--;
};
_local6 = (NPH_Bullets.length - 1);
while (_local6 >= 0) {
if (NPH_Bullets[_local6].pVisible == true){
removeChild(NPH_Bullets[_local6]);
};
NPH_Bullets.splice(_local6, 1);
_local6--;
};
_local7 = (NPH_Towers.length - 1);
while (_local7 >= 0) {
removeChild(NPH_Towers[_local7]);
NPH_Towers.splice(_local7, 1);
_local7--;
};
_local8 = (NPH_Enemies.length - 1);
while (_local8 >= 0) {
removeChild(NPH_Enemies[_local8]);
NPH_Enemies.splice(_local8, 1);
_local8--;
};
removeEventListener(Event.ENTER_FRAME, NPH_everytime);
removeEventListener(KeyboardEvent.KEY_UP, NPH_reportKeyUp);
NPH_channel.stop();
gotoAndStop(120);
};
removeChild(NPH_Enemies[_local1]);
NPH_Enemies.splice(_local1, 1);
_local2 = (NPH_HealthBars.length - 1);
while (_local2 >= 0) {
if (NPH_HealthBars[_local2].pEnemy == _local1){
NPH_HealthBars[_local2].x = -900;
removeChild(NPH_HealthBars[_local2]);
NPH_HealthBars.splice(_local2, 1);
};
if (NPH_HealthBars[_local2].pEnemy > _local1){
NPH_HealthBars[_local2].pEnemy = (NPH_HealthBars[_local2].pEnemy - 1);
};
_local2--;
};
_local3 = (NPH_Bullets.length - 1);
while (_local3 >= 0) {
if (NPH_Bullets[_local3].pTarget > _local1){
NPH_Bullets[_local3].pTarget = (NPH_Bullets[_local3].pTarget - 1);
};
if (NPH_Bullets[_local3].pTarget == _local1){
NPH_Bullets[_local3].x = -100;
NPH_Bullets[_local3].y = -100;
removeChild(NPH_Bullets[_local3].pBullet);
NPH_Bullets.splice(_local3, 1);
};
_local3--;
};
_local4 = (NPH_Towers.length - 1);
while (_local4 >= 0) {
if (NPH_Towers[_local4].pTarget == _local1){
NPH_Towers[_local4].pTarget = -1;
};
if (NPH_Towers[_local4].pTarget > _local1){
NPH_Towers[_local4].pTarget = (NPH_Towers[_local4].pTarget - 1);
};
_local4--;
};
};
_local1--;
};
};
}
public function NPS_tower_select_arrow_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Arrow Tower (30g)";
text_towerinfo.text = "Low Dmg, Fast Speed. (Normal Damage)";
}
public function NPS_buy_judgement_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Judgement Day(15 PP)";
text_towerinfo.text = "Calls forth Judgement Day upon your enemies.";
}
public function NP_CheckEnemyHealth():void{
var i:int;
var h:int;
var k:int;
var a:int;
if (NP_gamemode != "paused"){
try {
i = (NP_Enemies.length - 1);
while (i >= 0) {
if (NP_Enemies[i].pHealth <= 0){
NP_Enemies[i].x = -500;
NP_Enemies[i].y = -500;
if (NP_Enemies[i].pType == 5){
NP_Gold = (NP_Gold + Math.round(((1.75 * NP_GameLevel) + 0.5)));
NP_GameScore = (NP_GameScore + 50);
} else {
NP_Gold = (NP_Gold + Math.round(((0.25 * NP_GameLevel) + 0.5)));
NP_GameScore = (NP_GameScore + 10);
};
removeChild(NP_Enemies[i]);
NP_Enemies.splice(i, 1);
text_gold.text = String(NP_Gold);
text_score.text = String(NP_GameScore);
h = (NP_HealthBars.length - 1);
while (h >= 0) {
if (NP_HealthBars[h].pEnemy == i){
NP_HealthBars[h].x = -900;
removeChild(NP_HealthBars[h]);
NP_HealthBars.splice(h, 1);
};
if (NP_HealthBars[h].pEnemy > i){
NP_HealthBars[h].pEnemy = (NP_HealthBars[h].pEnemy - 1);
};
h = (h - 1);
};
k = (NP_Bullets.length - 1);
while (k >= 0) {
if (k != i){
if (NP_Bullets[k].pTarget > i){
NP_Bullets[k].pTarget = (NP_Bullets[k].pTarget - 1);
};
};
if (NP_Bullets[k].pTarget == i){
NP_Bullets[k].x = -100;
NP_Bullets[k].y = -100;
if (NP_Bullets[k].pVisible == true){
removeChild(NP_Bullets[k].pBullet);
};
NP_Bullets.splice(k, 1);
};
k = (k - 1);
};
a = (NP_Towers.length - 1);
while (a >= 0) {
if (NP_Towers[a].pTarget == i){
NP_Towers[a].pTarget = -1;
};
if (NP_Towers[a].pTarget > i){
NP_Towers[a].pTarget = (NP_Towers[a].pTarget - 1);
};
a = (a - 1);
};
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function NPS_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
NPS_gamemode = "paused";
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
playbutton.x = 99;
pausebutton.x = 900;
NPS_PausedTimer1 = getTimer();
_local2 = (NPS_Enemies.length - 1);
while (_local2 >= 0) {
NPS_Enemies[_local2].pPaused = true;
_local2--;
};
_local3 = (NPS_AngelsOfDeath.length - 1);
while (_local3 >= 0) {
NPS_AngelsOfDeath[_local3].pPaused = true;
_local3--;
};
_local4 = (NPS_Blizzards.length - 1);
while (_local4 >= 0) {
NPS_Blizzards[_local4].pPaused = true;
_local4--;
};
}
public function NPS_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (NPS_gamemode != "paused"){
if (NPS_Prayer >= 3){
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
NPS_Prayer = (NPS_Prayer - 3);
text_prayer.text = String(NPS_Prayer);
_local2 = 0;
while (_local2 < 10) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
NPS_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function NPS_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
if (NPS_gamemode != "paused"){
if (NPS_Gold >= (0.5 * (NPS_Towers[NPS_SelectedTower].pCost * (NPS_Towers[NPS_SelectedTower].pLevel + 1)))){
NPS_Gold = (NPS_Gold - (0.5 * (NPS_Towers[NPS_SelectedTower].pCost * (NPS_Towers[NPS_SelectedTower].pLevel + 1))));
NPS_Gold = Math.round(NPS_Gold);
text_gold.text = String(NPS_Gold);
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
NPS_Towers[NPS_SelectedTower].pLevel = (NPS_Towers[NPS_SelectedTower].pLevel + 1);
NPS_Towers[NPS_SelectedTower].pDamage = (NPS_Towers[NPS_SelectedTower].pOrigDamage * ((NPS_Towers[NPS_SelectedTower].pLevel / 1.1) * ((NPS_Towers[NPS_SelectedTower].pLevel / 10) + 1)));
upgrade_tower.x = 900;
_local2 = (NPS_Towers[NPS_SelectedTower].pOrigDamage * (((NPS_Towers[NPS_SelectedTower].pLevel + 1) / 1.1) * (((NPS_Towers[NPS_SelectedTower].pLevel + 1) / 10) + 1)));
text_towertype.text = (("Upgrade(" + (0.5 * (NPS_Towers[NPS_SelectedTower].pCost * (NPS_Towers[NPS_SelectedTower].pLevel + 1)))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_level.text = (((("Level - " + NPS_Towers[NPS_SelectedTower].pLevel) + "(") + (NPS_Towers[NPS_SelectedTower].pLevel + 1)) + ")");
text_tower_damage.text = (((("Damage - " + NPS_Towers[NPS_SelectedTower].pDamage.toFixed(2)) + "(") + _local2.toFixed(2)) + ")");
text_tower_range.text = ("Range - " + NPS_Towers[NPS_SelectedTower].pRange);
text_tower_sell.text = ("Sell Value - " + String(int(((NPS_Towers[NPS_SelectedTower].pLevel * NPS_Towers[NPS_SelectedTower].pCost) * 0.7))));
};
};
}
public function NPI_the_grid_place_tower(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:Boolean;
var _local4:Number;
var _local5:*;
var _local6:int;
var _local7:tower_arrow;
var _local8:tower_arcane;
var _local9:tower_cannon;
var _local10:tower_ice;
var _local11:tower_fire;
var _local12:building_mine;
var _local13:building_church;
if (NPI_gamemode != "paused"){
if (NPI_gamemode == "set_tower"){
if ((((int((root.mouseX / 32)) >= 1)) && ((int((root.mouseX / 32)) <= 14)))){
if ((((int((root.mouseY / 32)) >= 2)) && ((int((root.mouseY / 32)) <= 13)))){
if (NPI_selectedtowertype == "Arrow"){
_local3 = true;
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPI_Map, NPI_MapStart.y, NPI_MapStart.x, NPI_MapEnd.y, NPI_MapEnd.x) != null){
_local6 = (NPI_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPI_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPI_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPI_Gold >= 30)) && ((_local3 == true)))){
_local7 = new tower_arrow();
_local7.x = (int((root.mouseX / 32)) * 32);
_local7.y = (int((root.mouseY / 32)) * 32);
addChild(_local7);
NPI_Towers.push(_local7);
NPI_Gold = (NPI_Gold - 30);
text_gold.text = String(NPI_Gold);
NPI_Map[Math.round((_local7.y / 32))][Math.round((_local7.x / 32))] = 0;
_local5 = (NPI_Enemies.length - 1);
while (_local5 >= 0) {
if (NPI_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][1]), Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPI_Path = Pathfinding.findPath(NPI_Map, _local2.y, _local2.x, NPI_MapEnd.y, NPI_MapEnd.x);
if (NPI_Path == null){
};
NPI_Enemies[_local5].pPath = NPI_Path;
NPI_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPI_selectedtowertype == "Arcane"){
_local3 = true;
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPI_Map, NPI_MapStart.y, NPI_MapStart.x, NPI_MapEnd.y, NPI_MapEnd.x) != null){
_local6 = (NPI_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPI_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPI_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPI_Gold >= 125)) && ((_local3 == true)))){
_local8 = new tower_arcane();
_local8.x = (int((root.mouseX / 32)) * 32);
_local8.y = (int((root.mouseY / 32)) * 32);
addChild(_local8);
NPI_Towers.push(_local8);
NPI_Gold = (NPI_Gold - 125);
text_gold.text = String(NPI_Gold);
NPI_Map[Math.round((_local8.y / 32))][Math.round((_local8.x / 32))] = 0;
_local5 = (NPI_Enemies.length - 1);
while (_local5 >= 0) {
if (NPI_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][1]), Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPI_Path = Pathfinding.findPath(NPI_Map, _local2.y, _local2.x, NPI_MapEnd.y, NPI_MapEnd.x);
if (NPI_Path == null){
};
NPI_Enemies[_local5].pPath = NPI_Path;
NPI_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPI_selectedtowertype == "Cannon"){
_local3 = true;
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPI_Map, NPI_MapStart.y, NPI_MapStart.x, NPI_MapEnd.y, NPI_MapEnd.x) != null){
_local6 = (NPI_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPI_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPI_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPI_Gold >= 75)) && ((_local3 == true)))){
_local9 = new tower_cannon();
_local9.x = (int((root.mouseX / 32)) * 32);
_local9.y = (int((root.mouseY / 32)) * 32);
addChild(_local9);
NPI_Towers.push(_local9);
NPI_Gold = (NPI_Gold - 75);
text_gold.text = String(NPI_Gold);
NPI_Map[Math.round((_local9.y / 32))][Math.round((_local9.x / 32))] = 0;
_local5 = (NPI_Enemies.length - 1);
while (_local5 >= 0) {
if (NPI_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][1]), Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPI_Path = Pathfinding.findPath(NPI_Map, _local2.y, _local2.x, NPI_MapEnd.y, NPI_MapEnd.x);
if (NPI_Path == null){
};
NPI_Enemies[_local5].pPath = NPI_Path;
NPI_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPI_selectedtowertype == "Ice"){
_local3 = true;
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPI_Map, NPI_MapStart.y, NPI_MapStart.x, NPI_MapEnd.y, NPI_MapEnd.x) != null){
_local6 = (NPI_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPI_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPI_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPI_Gold >= 25)) && ((_local3 == true)))){
_local10 = new tower_ice();
_local10.x = (int((root.mouseX / 32)) * 32);
_local10.y = (int((root.mouseY / 32)) * 32);
addChild(_local10);
NPI_Towers.push(_local10);
NPI_Gold = (NPI_Gold - 25);
text_gold.text = String(NPI_Gold);
NPI_Map[Math.round((_local10.y / 32))][Math.round((_local10.x / 32))] = 0;
_local5 = (NPI_Enemies.length - 1);
while (_local5 >= 0) {
if (NPI_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][1]), Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPI_Path = Pathfinding.findPath(NPI_Map, _local2.y, _local2.x, NPI_MapEnd.y, NPI_MapEnd.x);
if (NPI_Path == null){
};
NPI_Enemies[_local5].pPath = NPI_Path;
NPI_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPI_selectedtowertype == "Fire"){
_local3 = true;
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPI_Map, NPI_MapStart.y, NPI_MapStart.x, NPI_MapEnd.y, NPI_MapEnd.x) != null){
_local6 = (NPI_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPI_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPI_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPI_Gold >= 100)) && ((_local3 == true)))){
_local11 = new tower_fire();
_local11.x = (int((root.mouseX / 32)) * 32);
_local11.y = (int((root.mouseY / 32)) * 32);
addChild(_local11);
NPI_Towers.push(_local11);
NPI_Gold = (NPI_Gold - 100);
text_gold.text = String(NPI_Gold);
NPI_Map[Math.round((_local11.y / 32))][Math.round((_local11.x / 32))] = 0;
_local5 = (NPI_Enemies.length - 1);
while (_local5 >= 0) {
if (NPI_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][1]), Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPI_Path = Pathfinding.findPath(NPI_Map, _local2.y, _local2.x, NPI_MapEnd.y, NPI_MapEnd.x);
if (NPI_Path == null){
};
NPI_Enemies[_local5].pPath = NPI_Path;
NPI_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
if (NPI_selectedtowertype == "Mine"){
if (NPI_PlacedMine == false){
_local3 = true;
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPI_Map, NPI_MapStart.y, NPI_MapStart.x, NPI_MapEnd.y, NPI_MapEnd.x) != null){
_local6 = (NPI_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPI_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPI_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPI_Gold >= 750)) && ((_local3 == true)))){
_local12 = new building_mine();
_local12.x = (int((root.mouseX / 32)) * 32);
_local12.y = (int((root.mouseY / 32)) * 32);
addChild(_local12);
NPI_Towers.push(_local12);
text_next_gold.x = (_local12.x + 3);
text_next_gold.y = (_local12.y + 18);
addChild(text_next_gold);
NPI_Gold = (NPI_Gold - 750);
text_gold.text = String(NPI_Gold);
NPI_PlacedMine = true;
NPI_LastGoldUpdate = getTimer();
NPI_Map[Math.round((_local12.y / 32))][Math.round((_local12.x / 32))] = 0;
_local5 = (NPI_Enemies.length - 1);
while (_local5 >= 0) {
if (NPI_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][1]), Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPI_Path = Pathfinding.findPath(NPI_Map, _local2.y, _local2.x, NPI_MapEnd.y, NPI_MapEnd.x);
if (NPI_Path == null){
};
NPI_Enemies[_local5].pPath = NPI_Path;
NPI_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
};
if (NPI_selectedtowertype == "Church"){
if (NPI_PlacedChurch == false){
_local3 = true;
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 0;
if (Pathfinding.findPath(NPI_Map, NPI_MapStart.y, NPI_MapStart.x, NPI_MapEnd.y, NPI_MapEnd.x) != null){
_local6 = (NPI_Enemies.length - 1);
while (_local6 >= 0) {
if ((((int((root.mouseY / 32)) == int((NPI_Enemies[_local6].y / 32)))) && ((int((root.mouseX / 32)) == int((NPI_Enemies[_local6].x / 32)))))){
_local3 = false;
};
_local6--;
};
if ((((NPI_Gold >= 1000)) && ((_local3 == true)))){
_local13 = new building_church();
_local13.x = (int((root.mouseX / 32)) * 32);
_local13.y = (int((root.mouseY / 32)) * 32);
addChild(_local13);
NPI_Towers.push(_local13);
text_next_prayer.x = (_local13.x + 5);
text_next_prayer.y = (_local13.y + 18);
addChild(text_next_prayer);
NPI_Gold = (NPI_Gold - 1000);
text_gold.text = String(NPI_Gold);
NPI_PlacedChurch = true;
NPI_LastPrayerUpdate = getTimer();
NPI_Map[Math.round((_local13.y / 32))][Math.round((_local13.x / 32))] = 0;
_local5 = (NPI_Enemies.length - 1);
while (_local5 >= 0) {
if (NPI_Enemies[_local5].y < 250){
_local2 = new Point(Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][1]), Math.round(NPI_Enemies[_local5].pPath[NPI_Enemies[_local5].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPI_Path = Pathfinding.findPath(NPI_Map, _local2.y, _local2.x, NPI_MapEnd.y, NPI_MapEnd.x);
if (NPI_Path == null){
};
NPI_Enemies[_local5].pPath = NPI_Path;
NPI_Enemies[_local5].mapchange();
};
_local5--;
};
};
} else {
NPI_Map[int((root.mouseY / 32))][int((root.mouseX / 32))] = 1;
};
};
};
};
};
};
NPI_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
upgrade_tower.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
text_tower_sell.x = 900;
};
}
public function NPH_tower_select_arrow_mouse_up(_arg1:MouseEvent):void{
if (NPH_gamemode != "paused"){
if (NPH_gamemode == "set_tower"){
if (NPH_selectedtowertype == "Arrow"){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
NPH_gamemode = "off";
TheGrid1.alpha = 0;
NPH_selectedtowertype = "none";
} else {
if (NPH_selectedtowertype != "Arrow"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Arrow";
};
};
} else {
if (NPH_gamemode != "set_tower"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Arrow";
};
};
};
}
public function NP_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = (NP_Towers[NP_SelectedTower].pOrigDamage * (((NP_Towers[NP_SelectedTower].pLevel + 1) / 1.1) * (((NP_Towers[NP_SelectedTower].pLevel + 1) / 10) + 1)));
text_towertype.text = (("Upgrade(" + (0.5 * (NP_Towers[NP_SelectedTower].pCost * (NP_Towers[NP_SelectedTower].pLevel + 1)))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_level.text = (((("Level - " + NP_Towers[NP_SelectedTower].pLevel) + "(") + (NP_Towers[NP_SelectedTower].pLevel + 1)) + ")");
text_tower_damage.text = (((("Damage - " + NP_Towers[NP_SelectedTower].pDamage.toFixed(2)) + "(") + _local2.toFixed(2)) + ")");
}
public function NPS_tower_select_ice_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Ice Tower (25g)";
text_towerinfo.text = "Slows enemies down. (Magic Damage)";
}
public function NPH_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = (NPH_Towers[NPH_SelectedTower].pOrigDamage * (((NPH_Towers[NPH_SelectedTower].pLevel + 1) / 1.1) * (((NPH_Towers[NPH_SelectedTower].pLevel + 1) / 10) + 1)));
text_towertype.text = (("Upgrade(" + (0.5 * (NPH_Towers[NPH_SelectedTower].pCost * (NPH_Towers[NPH_SelectedTower].pLevel + 1)))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_level.text = (((("Level - " + NPH_Towers[NPH_SelectedTower].pLevel) + "(") + (NPH_Towers[NPH_SelectedTower].pLevel + 1)) + ")");
text_tower_damage.text = (((("Damage - " + NPH_Towers[NPH_SelectedTower].pDamage.toFixed(2)) + "(") + _local2.toFixed(2)) + ")");
}
public function NPI_buy_church_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Church (1000g)";
text_towerinfo.text = "Adds Prayer Points. Limit 1.";
}
public function NPH_tower_select_fire_mouse_up(_arg1:MouseEvent):void{
if (NPH_gamemode != "paused"){
if (NPH_gamemode == "set_tower"){
if (NPH_selectedtowertype == "Fire"){
NPH_gamemode = "off";
TheGrid1.alpha = 0;
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
NPH_selectedtowertype = "none";
} else {
if (NPH_selectedtowertype != "Fire"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Fire";
};
};
} else {
if (NPH_gamemode != "set_tower"){
NPH_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
NPH_selectedtowertype = "Fire";
};
};
};
}
public function NPS_buy_church_mouse_up(_arg1:MouseEvent):void{
if (NPS_gamemode != "paused"){
if (NPS_gamemode == "set_tower"){
if (NPS_selectedtowertype == "Church"){
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
NPS_gamemode = "off";
TheGrid1.alpha = 0;
NPS_selectedtowertype = "none";
} else {
if (NPS_selectedtowertype != "Church"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Church";
};
};
} else {
if (NPS_gamemode != "set_tower"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Church";
};
};
};
}
public function NPS_tower_select_fire_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Fire Tower (100g)";
text_towerinfo.text = "Low Dmg, Fast Speed. (Magic Damage)";
}
public function NPS_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function NPI_buy_church_mouse_up(_arg1:MouseEvent):void{
if (NPI_gamemode != "paused"){
if (NPI_gamemode == "set_tower"){
if (NPI_selectedtowertype == "Church"){
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
NPI_gamemode = "off";
TheGrid1.alpha = 0;
NPI_selectedtowertype = "none";
} else {
if (NPI_selectedtowertype != "Church"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Church";
};
};
} else {
if (NPI_gamemode != "set_tower"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Church";
};
};
};
}
public function NPH_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
if (NPH_gamemode != "paused"){
if (NPH_Towers[NPH_SelectedTower].pLevel < 41){
if (NPH_Gold >= (0.5 * (NPH_Towers[NPH_SelectedTower].pCost * (NPH_Towers[NPH_SelectedTower].pLevel + 1)))){
NPH_Gold = (NPH_Gold - (0.5 * (NPH_Towers[NPH_SelectedTower].pCost * (NPH_Towers[NPH_SelectedTower].pLevel + 1))));
NPH_Gold = Math.round(NPH_Gold);
text_gold.text = String(NPH_Gold);
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
NPH_Towers[NPH_SelectedTower].pLevel = (NPH_Towers[NPH_SelectedTower].pLevel + 1);
NPH_Towers[NPH_SelectedTower].pDamage = (NPH_Towers[NPH_SelectedTower].pOrigDamage * ((NPH_Towers[NPH_SelectedTower].pLevel / 1.1) * ((NPH_Towers[NPH_SelectedTower].pLevel / 10) + 1)));
upgrade_tower.x = 900;
_local2 = (NPH_Towers[NPH_SelectedTower].pOrigDamage * (((NPH_Towers[NPH_SelectedTower].pLevel + 1) / 1.1) * (((NPH_Towers[NPH_SelectedTower].pLevel + 1) / 10) + 1)));
text_towertype.text = (("Upgrade(" + (0.5 * (NPH_Towers[NPH_SelectedTower].pCost * (NPH_Towers[NPH_SelectedTower].pLevel + 1)))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_level.text = (((("Level - " + NPH_Towers[NPH_SelectedTower].pLevel) + "(") + (NPH_Towers[NPH_SelectedTower].pLevel + 1)) + ")");
text_tower_damage.text = (((("Damage - " + NPH_Towers[NPH_SelectedTower].pDamage.toFixed(2)) + "(") + _local2.toFixed(2)) + ")");
text_tower_range.text = ("Range - " + NPH_Towers[NPH_SelectedTower].pRange);
text_tower_sell.text = ("Sell Value - " + String(int(((NPH_Towers[NPH_SelectedTower].pLevel * NPH_Towers[NPH_SelectedTower].pCost) * 0.7))));
};
};
};
}
public function NP_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (NP_gamemode != "paused"){
if (NP_Prayer >= 3){
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
NP_Prayer = (NP_Prayer - 3);
text_prayer.text = String(NP_Prayer);
_local2 = 0;
while (_local2 < 10) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
NP_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function NPI_reportKeyUp(_arg1:KeyboardEvent):void{
var _local2:Number;
var _local3:int;
if (_arg1.keyCode == 49){
NPI_tower_select_arrow_mouse_up(NPI_MouseEvent);
};
if (_arg1.keyCode == 50){
NPI_tower_select_cannon_mouse_up(NPI_MouseEvent);
};
if (_arg1.keyCode == 51){
NPI_tower_select_arcane_mouse_up(NPI_MouseEvent);
};
if (_arg1.keyCode == 52){
NPI_tower_select_fire_mouse_up(NPI_MouseEvent);
};
if (_arg1.keyCode == 53){
NPI_tower_select_ice_mouse_up(NPI_MouseEvent);
};
if (_arg1.keyCode == 85){
if (NPI_gamemode != "paused"){
if (NPI_SelectedTower != -1){
_local3 = 0;
while (_local3 <= 31) {
if (NPI_Towers[NPI_SelectedTower].pLevel < 31){
if (NPI_Gold >= (0.5 * (NPI_Towers[NPI_SelectedTower].pCost * (NPI_Towers[NPI_SelectedTower].pLevel + 1)))){
NPI_Gold = (NPI_Gold - (0.5 * (NPI_Towers[NPI_SelectedTower].pCost * (NPI_Towers[NPI_SelectedTower].pLevel + 1))));
NPI_Gold = Math.round(NPI_Gold);
text_gold.text = String(NPI_Gold);
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
NPI_Towers[NPI_SelectedTower].pLevel = (NPI_Towers[NPI_SelectedTower].pLevel + 1);
NPI_Towers[NPI_SelectedTower].pDamage = (NPI_Towers[NPI_SelectedTower].pOrigDamage * ((NPI_Towers[NPI_SelectedTower].pLevel / 1.1) * ((NPI_Towers[NPI_SelectedTower].pLevel / 10) + 1)));
upgrade_tower.x = 900;
text_tower_range.text = ("Range - " + NPI_Towers[NPI_SelectedTower].pRange);
text_tower_damage.text = ("Damage - " + NPI_Towers[NPI_SelectedTower].pDamage.toFixed(2));
text_tower_level.text = ("Level - " + String(NPI_Towers[NPI_SelectedTower].pLevel));
text_tower_sell.text = ("Sell Value - " + String(int(((NPI_Towers[NPI_SelectedTower].pLevel * NPI_Towers[NPI_SelectedTower].pCost) * 0.7))));
};
};
_local3++;
};
};
};
};
if (_arg1.keyCode == 83){
NPI_sell_tower_click(NPI_MouseEvent);
};
}
public function NP_CheckTowerFireBullet():void{
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var closest:Number;
var closestmob:Number;
var i:int;
var a:int;
var k:int;
var Bullet1:script_bullet_arrow;
var Bullet2:script_bullet_ice;
var Bullet3:script_bullet_arcane;
var Bullet4:script_bullet_cannon;
var Bullet5:script_bullet_fire;
closest = 5000;
closestmob = -1;
if (NP_gamemode != "paused"){
try {
i = (NP_Towers.length - 1);
while (i >= 0) {
if (NP_Towers[i].pTowerType <= 5){
closest = 5000;
NP_Towers[i].pTarget = -1;
k = (NP_Enemies.length - 1);
while (k >= 0) {
xdist = Math.round(((NP_Towers[i].x + 16) - NP_Enemies[k].x));
ydist = Math.round(((NP_Towers[i].y + 16) - NP_Enemies[k].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < NP_Towers[i].pRange){
if (NP_Enemies[k].pType == 4){
if (NP_Towers[i].pTowerType != 2){
if (NP_Towers[i].pTowerType != 3){
if (NP_Towers[i].pTowerType != 5){
NP_Towers[i].pTarget = k;
};
};
};
};
if (NP_Enemies[k].pType != 4){
NP_Towers[i].pTarget = k;
};
};
k = (k - 1);
};
};
i = (i - 1);
};
a = (NP_Towers.length - 1);
while (a >= 0) {
if (NP_Towers[a].pTowerType <= 5){
if (NP_Enemies.length > 0){
if (NP_Towers[a].pTarget != -1){
if (NP_Enemies[NP_Towers[a].pTarget].pHealth > 0){
xdist = Math.round(((NP_Towers[a].x + 16) - NP_Enemies[NP_Towers[a].pTarget].x));
ydist = Math.round(((NP_Towers[a].y + 16) - NP_Enemies[NP_Towers[a].pTarget].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < NP_Towers[a].pRange){
if (NP_Enemies[NP_Towers[a].pTarget].y > 0){
if (getTimer() > (NP_Towers[a].pLastFire + NP_Towers[a].pSpeed)){
NP_Towers[a].pLastFire = getTimer();
if (NP_Towers[a].pTowerType == 1){
Bullet1 = new script_bullet_arrow(NP_Towers[a].pTarget);
};
if (NP_Towers[a].pTowerType == 2){
Bullet2 = new script_bullet_ice(NP_Towers[a].pTarget);
};
if (NP_Towers[a].pTowerType == 3){
Bullet3 = new script_bullet_arcane(NP_Towers[a].pTarget);
};
if (NP_Towers[a].pTowerType == 4){
Bullet4 = new script_bullet_cannon(NP_Towers[a].pTarget);
};
if (NP_Towers[a].pTowerType == 5){
Bullet5 = new script_bullet_fire(NP_Towers[a].pTarget);
};
if (NP_Towers[a].pTowerType == 1){
Bullet1.x = (NP_Towers[a].x + 16);
Bullet1.y = (NP_Towers[a].y + 16);
Bullet1.pDamage = NP_Towers[a].pDamage;
Bullet1.pBullet = Bullet1;
if (NP_Bullets.length < 100){
Bullet1.pVisible = true;
addChild(Bullet1);
};
NP_Bullets.push(Bullet1);
Bullet1.pTower = a;
};
if (NP_Towers[a].pTowerType == 2){
Bullet2.x = (NP_Towers[a].x + 16);
Bullet2.y = (NP_Towers[a].y + 16);
Bullet2.pDamage = NP_Towers[a].pDamage;
Bullet2.pBullet = Bullet2;
if (NP_Bullets.length < 100){
Bullet2.pVisible = true;
addChild(Bullet2);
};
NP_Bullets.push(Bullet2);
Bullet2.pTower = a;
};
if (NP_Towers[a].pTowerType == 3){
Bullet3.x = (NP_Towers[a].x + 16);
Bullet3.y = (NP_Towers[a].y + 16);
Bullet3.pDamage = NP_Towers[a].pDamage;
Bullet3.pBullet = Bullet3;
if (NP_Bullets.length < 100){
Bullet3.pVisible = true;
addChild(Bullet3);
};
NP_Bullets.push(Bullet3);
Bullet3.pTower = a;
};
if (NP_Towers[a].pTowerType == 4){
Bullet4.x = (NP_Towers[a].x + 16);
Bullet4.y = (NP_Towers[a].y + 16);
Bullet4.pDamage = NP_Towers[a].pDamage;
Bullet4.pBullet = Bullet4;
if (NP_Bullets.length < 100){
Bullet4.pVisible = true;
addChild(Bullet4);
};
NP_Bullets.push(Bullet4);
Bullet4.pTower = a;
};
if (NP_Towers[a].pTowerType == 5){
Bullet5.x = (NP_Towers[a].x + 16);
Bullet5.y = (NP_Towers[a].y + 16);
Bullet5.pDamage = NP_Towers[a].pDamage;
Bullet5.pBullet = Bullet5;
if (NP_Bullets.length < 100){
Bullet5.pVisible = true;
addChild(Bullet5);
};
NP_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function NPI_MoveAndCheckJudgement():void{
var _local1:int;
if (NPI_gamemode != "paused"){
_local1 = (NPI_Judgement.length - 1);
while (_local1 >= 0) {
if (NPI_Judgement[_local1].y < -114){
drawonme.removeChild(NPI_Judgement[_local1]);
NPI_Judgement.splice(_local1, 1);
};
_local1--;
};
};
}
public function NP_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function NPH_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function play5min(_arg1:MouseEvent):void{
gotoAndStop(65);
}
public function NPI_tower_select_arcane_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Arcane Tower (125g)";
text_towerinfo.text = "Medium Speed, High Dmg. (Magic Damage)";
}
public function NPH_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 2% Of Your Gold Every 5 mins. Limit 1.";
}
public function NPI_musicright_mouse_up(_arg1:MouseEvent):void{
if (NPI_Muted == false){
NPI_CurrentSong++;
if (NPI_CurrentSong == 6){
NPI_CurrentSong = 1;
};
NPI_channel.stop();
if (NPI_CurrentSong == 1){
NPI_channel = NPI_Ambient1.play(0, 99999);
};
if (NPI_CurrentSong == 2){
NPI_channel = NPI_Ambient2.play(0, 99999);
};
if (NPI_CurrentSong == 3){
NPI_channel = NPI_Ambient3.play(0, 99999);
};
if (NPI_CurrentSong == 4){
NPI_channel = NPI_Ambient4.play(0, 99999);
};
if (NPI_CurrentSong == 5){
NPI_channel = NPI_Ambient5.play(0, 99999);
};
};
}
public function NPS_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = (NPS_Towers[NPS_SelectedTower].pOrigDamage * (((NPS_Towers[NPS_SelectedTower].pLevel + 1) / 1.1) * (((NPS_Towers[NPS_SelectedTower].pLevel + 1) / 10) + 1)));
text_towertype.text = (("Upgrade(" + (0.5 * (NPS_Towers[NPS_SelectedTower].pCost * (NPS_Towers[NPS_SelectedTower].pLevel + 1)))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_level.text = (((("Level - " + NPS_Towers[NPS_SelectedTower].pLevel) + "(") + (NPS_Towers[NPS_SelectedTower].pLevel + 1)) + ")");
text_tower_damage.text = (((("Damage - " + NPS_Towers[NPS_SelectedTower].pDamage.toFixed(2)) + "(") + _local2.toFixed(2)) + ")");
}
public function NP_road_deselect(_arg1:MouseEvent):void{
TheGrid1.graphics.clear();
TheGrid1.alpha = 0;
NP_gamemode = "none";
NP_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
upgrade_tower.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
text_tower_sell.x = 900;
}
public function NP_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
NP_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 99;
NP_PausedTimer2 = getTimer();
_local2 = (NP_PausedTimer2 - NP_PausedTimer1);
_local3 = (NP_Towers.length - 1);
while (_local3 >= 0) {
NP_Towers[_local3].pLastFire = (NP_Towers[_local3].pLastFire + _local2);
_local3--;
};
NP_LastPrayerUpdate = (NP_LastPrayerUpdate + _local2);
NP_LastGoldUpdate = (NP_LastGoldUpdate + _local2);
NP_LastWave = (NP_LastWave + _local2);
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
_local4 = (NP_Enemies.length - 1);
while (_local4 >= 0) {
NP_Enemies[_local4].pPaused = false;
_local4--;
};
_local5 = (NP_AngelsOfDeath.length - 1);
while (_local5 >= 0) {
NP_AngelsOfDeath[_local5].pPaused = false;
_local5--;
};
_local6 = (NP_Blizzards.length - 1);
while (_local6 >= 0) {
NP_Blizzards[_local6].pPaused = false;
_local6--;
};
}
public function NP_select_mine_mouse_up(_arg1:MouseEvent):void{
if (NP_gamemode != "paused"){
if (NP_gamemode == "set_tower"){
if (NP_selectedtowertype == "Mine"){
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
NP_gamemode = "off";
TheGrid1.alpha = 0;
NP_selectedtowertype = "none";
} else {
if (NP_selectedtowertype != "Mine"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Mine";
};
};
} else {
if (NP_gamemode != "set_tower"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Mine";
};
};
};
}
public function NPI_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function NPS_tower_select_arcane_mouse_up(_arg1:MouseEvent):void{
if (NPS_gamemode != "paused"){
if (NPS_gamemode == "set_tower"){
if (NPS_selectedtowertype == "Arcane"){
NPS_gamemode = "off";
TheGrid1.alpha = 0;
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
NPS_selectedtowertype = "none";
} else {
if (NPS_selectedtowertype != "Arcane"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Arcane";
};
};
} else {
if (NPS_gamemode != "set_tower"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Arcane";
};
};
};
}
public function NPH_CheckSelectedTower():void{
var _local1:int;
var _local2:int;
if (NPH_gamemode != "paused"){
_local1 = (NPH_Towers.length - 1);
while (_local1 >= 0) {
if (NPH_Towers[_local1].CheckSelected() == true){
NPH_SelectedTower = _local1;
sell_tower.x = 524;
text_tower_damage.x = 484;
text_tower_level.x = 484;
text_tower_range.x = 484;
text_tower_sell.x = 484;
text_tower_damage.text = ("Damage - " + NPH_Towers[_local1].pDamage.toFixed(2));
text_tower_range.text = ("Range - " + NPH_Towers[_local1].pRange);
text_tower_level.text = ("Level - " + NPH_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((NPH_Towers[_local1].pLevel * NPH_Towers[_local1].pCost) * 0.95))));
NPH_gamemode = "none";
TheGrid1.alpha = 0;
NPH_selectedtowertype = "none";
};
_local1--;
};
_local2 = (NPH_Towers.length - 1);
while (_local2 >= 0) {
NPH_Towers[_local2].pSelected = false;
_local2--;
};
};
}
public function NPI_buy_judgement_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:judgement;
if (NPI_gamemode != "paused"){
if (NPI_Prayer >= 15){
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
NPI_Prayer = (NPI_Prayer - 15);
text_prayer.text = String(NPI_Prayer);
_local2 = 0;
while (_local2 < (NPI_Enemies.length - 1)) {
_local3 = new judgement();
_local3.x = NPI_Enemies[_local2].x;
_local3.y = NPI_Enemies[_local2].y;
NPI_Enemies[_local2].GotHit(999999, 1);
drawonme.addChild(_local3);
NPI_Judgement.push(_local3);
_local2++;
};
};
};
}
public function NPI_CheckTowerFireBullet():void{
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var closest:Number;
var closestmob:Number;
var i:int;
var a:int;
var k:int;
var Bullet1:script_bullet_arrow;
var Bullet2:script_bullet_ice;
var Bullet3:script_bullet_arcane;
var Bullet4:script_bullet_cannon;
var Bullet5:script_bullet_fire;
closest = 5000;
closestmob = -1;
if (NPI_gamemode != "paused"){
try {
i = (NPI_Towers.length - 1);
while (i >= 0) {
if (NPI_Towers[i].pTowerType <= 5){
closest = 5000;
NPI_Towers[i].pTarget = -1;
k = (NPI_Enemies.length - 1);
while (k >= 0) {
xdist = Math.round(((NPI_Towers[i].x + 16) - NPI_Enemies[k].x));
ydist = Math.round(((NPI_Towers[i].y + 16) - NPI_Enemies[k].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < NPI_Towers[i].pRange){
if (NPI_Enemies[k].pType == 4){
if (NPI_Towers[i].pTowerType != 2){
if (NPI_Towers[i].pTowerType != 3){
if (NPI_Towers[i].pTowerType != 5){
NPI_Towers[i].pTarget = k;
};
};
};
};
if (NPI_Enemies[k].pType != 4){
NPI_Towers[i].pTarget = k;
};
};
k = (k - 1);
};
};
i = (i - 1);
};
a = (NPI_Towers.length - 1);
while (a >= 0) {
if (NPI_Towers[a].pTowerType <= 5){
if (NPI_Enemies.length > 0){
if (NPI_Towers[a].pTarget != -1){
if (NPI_Enemies[NPI_Towers[a].pTarget].pHealth > 0){
xdist = Math.round(((NPI_Towers[a].x + 16) - NPI_Enemies[NPI_Towers[a].pTarget].x));
ydist = Math.round(((NPI_Towers[a].y + 16) - NPI_Enemies[NPI_Towers[a].pTarget].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < NPI_Towers[a].pRange){
if (NPI_Enemies[NPI_Towers[a].pTarget].y > 0){
if (getTimer() > (NPI_Towers[a].pLastFire + NPI_Towers[a].pSpeed)){
NPI_Towers[a].pLastFire = getTimer();
if (NPI_Towers[a].pTowerType == 1){
Bullet1 = new script_bullet_arrow(NPI_Towers[a].pTarget);
};
if (NPI_Towers[a].pTowerType == 2){
Bullet2 = new script_bullet_ice(NPI_Towers[a].pTarget);
};
if (NPI_Towers[a].pTowerType == 3){
Bullet3 = new script_bullet_arcane(NPI_Towers[a].pTarget);
};
if (NPI_Towers[a].pTowerType == 4){
Bullet4 = new script_bullet_cannon(NPI_Towers[a].pTarget);
};
if (NPI_Towers[a].pTowerType == 5){
Bullet5 = new script_bullet_fire(NPI_Towers[a].pTarget);
};
if (NPI_Towers[a].pTowerType == 1){
Bullet1.x = (NPI_Towers[a].x + 16);
Bullet1.y = (NPI_Towers[a].y + 16);
Bullet1.pDamage = NPI_Towers[a].pDamage;
Bullet1.pBullet = Bullet1;
if (NPI_Bullets.length < 100){
Bullet1.pVisible = true;
addChild(Bullet1);
};
NPI_Bullets.push(Bullet1);
Bullet1.pTower = a;
};
if (NPI_Towers[a].pTowerType == 2){
Bullet2.x = (NPI_Towers[a].x + 16);
Bullet2.y = (NPI_Towers[a].y + 16);
Bullet2.pDamage = NPI_Towers[a].pDamage;
Bullet2.pBullet = Bullet2;
if (NPI_Bullets.length < 100){
Bullet2.pVisible = true;
addChild(Bullet2);
};
NPI_Bullets.push(Bullet2);
Bullet2.pTower = a;
};
if (NPI_Towers[a].pTowerType == 3){
Bullet3.x = (NPI_Towers[a].x + 16);
Bullet3.y = (NPI_Towers[a].y + 16);
Bullet3.pDamage = NPI_Towers[a].pDamage;
Bullet3.pBullet = Bullet3;
if (NPI_Bullets.length < 100){
Bullet3.pVisible = true;
addChild(Bullet3);
};
NPI_Bullets.push(Bullet3);
Bullet3.pTower = a;
};
if (NPI_Towers[a].pTowerType == 4){
Bullet4.x = (NPI_Towers[a].x + 16);
Bullet4.y = (NPI_Towers[a].y + 16);
Bullet4.pDamage = NPI_Towers[a].pDamage;
Bullet4.pBullet = Bullet4;
if (NPI_Bullets.length < 100){
Bullet4.pVisible = true;
addChild(Bullet4);
};
NPI_Bullets.push(Bullet4);
Bullet4.pTower = a;
};
if (NPI_Towers[a].pTowerType == 5){
Bullet5.x = (NPI_Towers[a].x + 16);
Bullet5.y = (NPI_Towers[a].y + 16);
Bullet5.pDamage = NPI_Towers[a].pDamage;
Bullet5.pBullet = Bullet5;
if (NPI_Bullets.length < 100){
Bullet5.pVisible = true;
addChild(Bullet5);
};
NPI_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function NPI_select_mine_mouse_up(_arg1:MouseEvent):void{
if (NPI_gamemode != "paused"){
if (NPI_gamemode == "set_tower"){
if (NPI_selectedtowertype == "Mine"){
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
NPI_gamemode = "off";
TheGrid1.alpha = 0;
NPI_selectedtowertype = "none";
} else {
if (NPI_selectedtowertype != "Mine"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Mine";
};
};
} else {
if (NPI_gamemode != "set_tower"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Mine";
};
};
};
}
public function NPI_restart_yes(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (NPI_HealthBars.length - 1);
while (_local2 >= 0) {
removeChild(NPI_HealthBars[_local2]);
NPI_HealthBars.splice(_local2, 1);
_local2--;
};
_local3 = (NPI_Bullets.length - 1);
while (_local3 >= 0) {
if (NPI_Bullets[_local3].pVisible == true){
removeChild(NPI_Bullets[_local3]);
};
NPI_Bullets.splice(_local3, 1);
_local3--;
};
_local4 = (NPI_Towers.length - 1);
while (_local4 >= 0) {
removeChild(NPI_Towers[_local4]);
NPI_Towers.splice(_local4, 1);
_local4--;
};
_local5 = (NPI_Enemies.length - 1);
while (_local5 >= 0) {
removeChild(NPI_Enemies[_local5]);
NPI_Enemies.splice(_local5, 1);
_local5--;
};
removeEventListener(Event.ENTER_FRAME, NPI_everytime);
removeEventListener(KeyboardEvent.KEY_UP, NPI_reportKeyUp);
NPI_channel.stop();
gotoAndStop(10);
}
public function NPS_sell_tower_click(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:Number;
var _local4:int;
if (NPS_gamemode != "paused"){
if (NPS_SelectedTower != -1){
if (NPS_Towers[NPS_SelectedTower].pTowerType == 10){
NPS_PlacedMine = false;
text_next_gold.x = 1000;
};
if (NPS_Towers[NPS_SelectedTower].pTowerType == 11){
NPS_PlacedChurch = false;
text_next_prayer.x = 1000;
};
NPS_Map[Math.round((NPS_Towers[NPS_SelectedTower].y / 32))][Math.round((NPS_Towers[NPS_SelectedTower].x / 32))] = 1;
_local4 = (NPS_Enemies.length - 1);
while (_local4 >= 0) {
if (NPS_Enemies[_local4].y < 45){
_local2 = new Point(Math.round(NPS_Enemies[_local4].pPath[NPS_Enemies[_local4].pPathIndex][1]), Math.round(NPS_Enemies[_local4].pPath[NPS_Enemies[_local4].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPS_Path = Pathfinding.findPath(NPS_Map, _local2.y, _local2.x, NPS_MapEnd.y, NPS_MapEnd.x);
NPS_Enemies[_local4].pPath = NPS_Path;
NPS_Enemies[_local4].mapchange();
};
_local4--;
};
NPS_Gold = (NPS_Gold + int((0.95 * (NPS_Towers[NPS_SelectedTower].pCost * NPS_Towers[NPS_SelectedTower].pLevel))));
NPS_Gold = Math.round(NPS_Gold);
text_gold.text = String(NPS_Gold);
removeChild(NPS_Towers[NPS_SelectedTower]);
NPS_Towers.splice(NPS_SelectedTower, 1);
NPS_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
upgrade_tower.x = 900;
text_tower_sell.x = 900;
};
};
}
public function NPH_tower_select_arcane_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Arcane Tower (125g)";
text_towerinfo.text = "Medium Speed, High Dmg. (Magic Damage)";
}
public function playinsane(_arg1:MouseEvent):void{
gotoAndStop(55);
}
public function NPI_tower_select_arrow_mouse_up(_arg1:MouseEvent):void{
if (NPI_gamemode != "paused"){
if (NPI_gamemode == "set_tower"){
if (NPI_selectedtowertype == "Arrow"){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
NPI_gamemode = "off";
TheGrid1.alpha = 0;
NPI_selectedtowertype = "none";
} else {
if (NPI_selectedtowertype != "Arrow"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Arrow";
};
};
} else {
if (NPI_gamemode != "set_tower"){
NPI_gamemode = "set_tower";
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPI_selectedtowertype = "Arrow";
};
};
};
}
public function NPS_CheckEnemiesForDirections(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
if (NPS_gamemode != "paused"){
_local1 = (NPS_Enemies.length - 1);
while (_local1 >= 0) {
if (NPS_Enemies[_local1].y > 500){
NPS_Lives = (NPS_Lives - 1);
text_lives.text = String(NPS_Lives);
if (NPS_Lives < 1){
_local5 = (NPS_HealthBars.length - 1);
while (_local5 >= 0) {
removeChild(NPS_HealthBars[_local5]);
NPS_HealthBars.splice(_local5, 1);
_local5--;
};
_local6 = (NPS_Bullets.length - 1);
while (_local6 >= 0) {
if (NPS_Bullets[_local6].pVisible == true){
removeChild(NPS_Bullets[_local6]);
};
NPS_Bullets.splice(_local6, 1);
_local6--;
};
_local7 = (NPS_Towers.length - 1);
while (_local7 >= 0) {
removeChild(NPS_Towers[_local7]);
NPS_Towers.splice(_local7, 1);
_local7--;
};
_local8 = (NPS_Enemies.length - 1);
while (_local8 >= 0) {
removeChild(NPS_Enemies[_local8]);
NPS_Enemies.splice(_local8, 1);
_local8--;
};
removeEventListener(Event.ENTER_FRAME, NPS_everytime);
removeEventListener(KeyboardEvent.KEY_UP, NPS_reportKeyUp);
NPS_channel.stop();
gotoAndStop(140);
};
removeChild(NPS_Enemies[_local1]);
NPS_Enemies.splice(_local1, 1);
_local2 = (NPS_HealthBars.length - 1);
while (_local2 >= 0) {
if (NPS_HealthBars[_local2].pEnemy == _local1){
NPS_HealthBars[_local2].x = -900;
removeChild(NPS_HealthBars[_local2]);
NPS_HealthBars.splice(_local2, 1);
};
if (NPS_HealthBars[_local2].pEnemy > _local1){
NPS_HealthBars[_local2].pEnemy = (NPS_HealthBars[_local2].pEnemy - 1);
};
_local2--;
};
_local3 = (NPS_Bullets.length - 1);
while (_local3 >= 0) {
if (NPS_Bullets[_local3].pTarget > _local1){
NPS_Bullets[_local3].pTarget = (NPS_Bullets[_local3].pTarget - 1);
};
if (NPS_Bullets[_local3].pTarget == _local1){
NPS_Bullets[_local3].x = -100;
NPS_Bullets[_local3].y = -100;
removeChild(NPS_Bullets[_local3].pBullet);
NPS_Bullets.splice(_local3, 1);
};
_local3--;
};
_local4 = (NPS_Towers.length - 1);
while (_local4 >= 0) {
if (NPS_Towers[_local4].pTarget == _local1){
NPS_Towers[_local4].pTarget = -1;
};
if (NPS_Towers[_local4].pTarget > _local1){
NPS_Towers[_local4].pTarget = (NPS_Towers[_local4].pTarget - 1);
};
_local4--;
};
};
_local1--;
};
};
}
public function NPH_tower_select_cannon_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Cannon Tower (75g)";
text_towerinfo.text = "Medium Dmg, Splash Dmg. (Normal Damage)";
}
public function NPI_tower_select_cannon_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Cannon Tower (75g)";
text_towerinfo.text = "Medium Dmg, Splash Dmg. (Normal Damage)";
}
public function NP_musicmute_mouse_up(_arg1:MouseEvent):void{
if (NP_Muted == false){
NP_channel.stop();
NP_Muted = true;
} else {
if (NP_CurrentSong == 1){
NP_channel = NP_Ambient1.play(0, 99999);
};
if (NP_CurrentSong == 2){
NP_channel = NP_Ambient2.play(0, 99999);
};
if (NP_CurrentSong == 3){
NP_channel = NP_Ambient3.play(0, 99999);
};
if (NP_CurrentSong == 4){
NP_channel = NP_Ambient4.play(0, 99999);
};
if (NP_CurrentSong == 5){
NP_channel = NP_Ambient5.play(0, 99999);
};
NP_Muted = false;
};
}
public function NPS_tower_select_cannon_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Cannon Tower (75g)";
text_towerinfo.text = "Medium Dmg, Splash Dmg. (Normal Damage)";
}
public function NPS_tower_select_arcane_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Arcane Tower (125g)";
text_towerinfo.text = "Medium Speed, High Dmg. (Magic Damage)";
}
public function NPI_road_deselect(_arg1:MouseEvent):void{
TheGrid1.graphics.clear();
TheGrid1.alpha = 0;
NPI_gamemode = "none";
NPI_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
upgrade_tower.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
text_tower_sell.x = 900;
}
public function NP_tower_select_cannon_mouse_up(_arg1:MouseEvent):void{
if (NP_gamemode != "paused"){
if (NP_gamemode == "set_tower"){
if (NP_selectedtowertype == "Cannon"){
NP_gamemode = "off";
TheGrid1.alpha = 0;
if (NP_Muted == false){
NP_ButtonClick.play();
};
NP_selectedtowertype = "none";
} else {
if (NP_selectedtowertype != "Cannon"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
NP_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Cannon";
};
};
} else {
if (NP_gamemode != "set_tower"){
NP_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (NP_Muted == false){
NP_ButtonClick.play();
};
NP_selectedtowertype = "Cannon";
};
};
};
}
public function NP_MoveBullets():void{
var i:int;
var a:int;
if (NP_gamemode != "paused"){
try {
i = (NP_Bullets.length - 1);
while (i >= 0) {
NP_Bullets[i].movebullet(NP_Enemies[NP_Bullets[i].pTarget].x, NP_Enemies[NP_Bullets[i].pTarget].y);
i = (i - 1);
};
} catch(e:TypeError) {
a = (NP_Bullets.length - 1);
while (a >= 0) {
NP_Bullets[a].x = -900;
NP_Bullets[a].y = -900;
NP_Bullets[a].pTarget = -1;
if (NP_Bullets[a].pVisible == true){
removeChild(NP_Bullets[a].pBullet);
};
NP_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
public function NPH_MoveAndCheckBlizzard():void{
var _local1:int;
var _local2:int;
if (NPH_gamemode != "paused"){
_local1 = (NPH_Blizzards.length - 1);
while (_local1 >= 0) {
_local2 = (NPH_Enemies.length - 1);
while (_local2 >= 0) {
if (NPH_Enemies[_local2].hitTestObject(NPH_Blizzards[_local1])){
NPH_Enemies[_local2].pSpeed = 0;
};
_local2--;
};
if (NPH_Blizzards[_local1].y < -128){
drawonme.removeChild(NPH_Blizzards[_local1]);
NPH_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
public function NPH_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(3 PP)";
text_towerinfo.text = "Calls forth a Blizzard to slow your enemies.";
}
public function NP_tower_select_ice_mouse_up(_arg1:MouseEvent):void{
if (NP_gamemode != "paused"){
if (NP_gamemode == "set_tower"){
if (NP_selectedtowertype == "Ice"){
NP_gamemode = "off";
if (NP_Muted == false){
NP_ButtonClick.play();
};
TheGrid1.alpha = 0;
NP_selectedtowertype = "none";
} else {
if (NP_selectedtowertype != "Ice"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
NP_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Ice";
};
};
} else {
if (NP_gamemode != "set_tower"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
NP_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Ice";
};
};
};
}
public function NPH_tower_select_ice_mouse_up(_arg1:MouseEvent):void{
if (NPH_gamemode != "paused"){
if (NPH_gamemode == "set_tower"){
if (NPH_selectedtowertype == "Ice"){
NPH_gamemode = "off";
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
TheGrid1.alpha = 0;
NPH_selectedtowertype = "none";
} else {
if (NPH_selectedtowertype != "Ice"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Ice";
};
};
} else {
if (NPH_gamemode != "set_tower"){
NPH_gamemode = "set_tower";
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPH_selectedtowertype = "Ice";
};
};
};
}
public function NPI_CheckEnemiesForDirections(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
if (NPI_gamemode != "paused"){
_local1 = (NPI_Enemies.length - 1);
while (_local1 >= 0) {
if (NPI_Enemies[_local1].y > 500){
NPI_Lives = (NPI_Lives - 1);
text_lives.text = String(NPI_Lives);
if (NPI_Lives < 1){
_local5 = (NPI_HealthBars.length - 1);
while (_local5 >= 0) {
removeChild(NPI_HealthBars[_local5]);
NPI_HealthBars.splice(_local5, 1);
_local5--;
};
_local6 = (NPI_Bullets.length - 1);
while (_local6 >= 0) {
if (NPI_Bullets[_local6].pVisible == true){
removeChild(NPI_Bullets[_local6]);
};
NPI_Bullets.splice(_local6, 1);
_local6--;
};
_local7 = (NPI_Towers.length - 1);
while (_local7 >= 0) {
removeChild(NPI_Towers[_local7]);
NPI_Towers.splice(_local7, 1);
_local7--;
};
_local8 = (NPI_Enemies.length - 1);
while (_local8 >= 0) {
removeChild(NPI_Enemies[_local8]);
NPI_Enemies.splice(_local8, 1);
_local8--;
};
removeEventListener(Event.ENTER_FRAME, NPI_everytime);
removeEventListener(KeyboardEvent.KEY_UP, NPI_reportKeyUp);
NPI_channel.stop();
gotoAndStop(130);
};
removeChild(NPI_Enemies[_local1]);
NPI_Enemies.splice(_local1, 1);
_local2 = (NPI_HealthBars.length - 1);
while (_local2 >= 0) {
if (NPI_HealthBars[_local2].pEnemy == _local1){
NPI_HealthBars[_local2].x = -900;
removeChild(NPI_HealthBars[_local2]);
NPI_HealthBars.splice(_local2, 1);
};
if (NPI_HealthBars[_local2].pEnemy > _local1){
NPI_HealthBars[_local2].pEnemy = (NPI_HealthBars[_local2].pEnemy - 1);
};
_local2--;
};
_local3 = (NPI_Bullets.length - 1);
while (_local3 >= 0) {
if (NPI_Bullets[_local3].pTarget > _local1){
NPI_Bullets[_local3].pTarget = (NPI_Bullets[_local3].pTarget - 1);
};
if (NPI_Bullets[_local3].pTarget == _local1){
NPI_Bullets[_local3].x = -100;
NPI_Bullets[_local3].y = -100;
removeChild(NPI_Bullets[_local3].pBullet);
NPI_Bullets.splice(_local3, 1);
};
_local3--;
};
_local4 = (NPI_Towers.length - 1);
while (_local4 >= 0) {
if (NPI_Towers[_local4].pTarget == _local1){
NPI_Towers[_local4].pTarget = -1;
};
if (NPI_Towers[_local4].pTarget > _local1){
NPI_Towers[_local4].pTarget = (NPI_Towers[_local4].pTarget - 1);
};
_local4--;
};
};
_local1--;
};
};
}
public function NPI_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
NPI_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 99;
NPI_PausedTimer2 = getTimer();
_local2 = (NPI_PausedTimer2 - NPI_PausedTimer1);
_local3 = (NPI_Towers.length - 1);
while (_local3 >= 0) {
NPI_Towers[_local3].pLastFire = (NPI_Towers[_local3].pLastFire + _local2);
_local3--;
};
NPI_LastPrayerUpdate = (NPI_LastPrayerUpdate + _local2);
NPI_LastGoldUpdate = (NPI_LastGoldUpdate + _local2);
NPI_LastWave = (NPI_LastWave + _local2);
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
_local4 = (NPI_Enemies.length - 1);
while (_local4 >= 0) {
NPI_Enemies[_local4].pPaused = false;
_local4--;
};
_local5 = (NPI_AngelsOfDeath.length - 1);
while (_local5 >= 0) {
NPI_AngelsOfDeath[_local5].pPaused = false;
_local5--;
};
_local6 = (NPI_Blizzards.length - 1);
while (_local6 >= 0) {
NPI_Blizzards[_local6].pPaused = false;
_local6--;
};
}
public function NPS_UpdateEnemyHealthBar():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (NPS_gamemode != "paused"){
_local3 = (NPS_HealthBars.length - 1);
while (_local3 >= 0) {
_local1 = (NPS_Enemies[NPS_HealthBars[_local3].pEnemy].pHealth / NPS_Enemies[NPS_HealthBars[_local3].pEnemy].pStartHealth);
_local1 = (_local1 * 100);
_local2 = ((27 * _local1) / 100);
NPS_HealthBars[_local3].x = (NPS_Enemies[NPS_HealthBars[_local3].pEnemy].x - 13);
NPS_HealthBars[_local3].y = (NPS_Enemies[NPS_HealthBars[_local3].pEnemy].y - 16);
NPS_HealthBars[_local3].pWidth = _local2;
NPS_HealthBars[_local3].width = _local2;
_local3--;
};
};
}
public function NPS_MoveAndCheckJudgement():void{
var _local1:int;
if (NPS_gamemode != "paused"){
_local1 = (NPS_Judgement.length - 1);
while (_local1 >= 0) {
if (NPS_Judgement[_local1].y < -114){
drawonme.removeChild(NPS_Judgement[_local1]);
NPS_Judgement.splice(_local1, 1);
};
_local1--;
};
};
}
public function NPH_sell_tower_click(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:Number;
var _local4:int;
if (NPH_gamemode != "paused"){
if (NPH_SelectedTower != -1){
if (NPH_Towers[NPH_SelectedTower].pTowerType == 10){
NPH_PlacedMine = false;
text_next_gold.x = 1000;
};
if (NPH_Towers[NPH_SelectedTower].pTowerType == 11){
NPH_PlacedChurch = false;
text_next_prayer.x = 1000;
};
NPH_Map[Math.round((NPH_Towers[NPH_SelectedTower].y / 32))][Math.round((NPH_Towers[NPH_SelectedTower].x / 32))] = 1;
_local4 = (NPH_Enemies.length - 1);
while (_local4 >= 0) {
if (NPH_Enemies[_local4].y < 45){
_local2 = new Point(Math.round(NPH_Enemies[_local4].pPath[NPH_Enemies[_local4].pPathIndex][1]), Math.round(NPH_Enemies[_local4].pPath[NPH_Enemies[_local4].pPathIndex][0]));
if (_local2.y < 0){
_local2.y = 0;
};
NPH_Path = Pathfinding.findPath(NPH_Map, _local2.y, _local2.x, NPH_MapEnd.y, NPH_MapEnd.x);
NPH_Enemies[_local4].pPath = NPH_Path;
NPH_Enemies[_local4].mapchange();
};
_local4--;
};
NPH_Gold = (NPH_Gold + int((0.95 * (NPH_Towers[NPH_SelectedTower].pCost * NPH_Towers[NPH_SelectedTower].pLevel))));
NPH_Gold = Math.round(NPH_Gold);
text_gold.text = String(NPH_Gold);
removeChild(NPH_Towers[NPH_SelectedTower]);
NPH_Towers.splice(NPH_SelectedTower, 1);
NPH_SelectedTower = -1;
sell_tower.x = 900;
text_tower_damage.x = 900;
text_tower_level.x = 900;
text_tower_range.x = 900;
upgrade_tower.x = 900;
text_tower_sell.x = 900;
};
};
}
public function NPI_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = (NPI_Towers[NPI_SelectedTower].pOrigDamage * (((NPI_Towers[NPI_SelectedTower].pLevel + 1) / 1.1) * (((NPI_Towers[NPI_SelectedTower].pLevel + 1) / 10) + 1)));
text_towertype.text = (("Upgrade(" + (0.5 * (NPI_Towers[NPI_SelectedTower].pCost * (NPI_Towers[NPI_SelectedTower].pLevel + 1)))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_level.text = (((("Level - " + NPI_Towers[NPI_SelectedTower].pLevel) + "(") + (NPI_Towers[NPI_SelectedTower].pLevel + 1)) + ")");
text_tower_damage.text = (((("Damage - " + NPI_Towers[NPI_SelectedTower].pDamage.toFixed(2)) + "(") + _local2.toFixed(2)) + ")");
}
public function NPS_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (NPS_gamemode != "paused"){
if (NPS_Prayer >= 10){
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
NPS_Prayer = (NPS_Prayer - 10);
text_prayer.text = String(NPS_Prayer);
_local2 = 0;
while (_local2 < 10) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
NPS_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function NPS_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function NP_MoveAndCheckJudgement():void{
var _local1:int;
if (NP_gamemode != "paused"){
_local1 = (NP_Judgement.length - 1);
while (_local1 >= 0) {
if (NP_Judgement[_local1].y < -114){
drawonme.removeChild(NP_Judgement[_local1]);
NP_Judgement.splice(_local1, 1);
};
_local1--;
};
};
}
public function NP_tower_select_arrow_mouse_up(_arg1:MouseEvent):void{
if (NP_gamemode != "paused"){
if (NP_gamemode == "set_tower"){
if (NP_selectedtowertype == "Arrow"){
if (NP_Muted == false){
NP_ButtonClick.play();
};
NP_gamemode = "off";
TheGrid1.alpha = 0;
NP_selectedtowertype = "none";
} else {
if (NP_selectedtowertype != "Arrow"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
NP_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Arrow";
};
};
} else {
if (NP_gamemode != "set_tower"){
NP_gamemode = "set_tower";
if (NP_Muted == false){
NP_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NP_selectedtowertype = "Arrow";
};
};
};
}
public function NPS_musicleft_mouse_up(_arg1:MouseEvent):void{
if (NPS_Muted == false){
NPS_CurrentSong--;
if (NPS_CurrentSong == 0){
NPS_CurrentSong = 5;
};
NPS_channel.stop();
if (NPS_CurrentSong == 1){
NPS_channel = NPS_Ambient1.play(0, 99999);
};
if (NPS_CurrentSong == 2){
NPS_channel = NPS_Ambient2.play(0, 99999);
};
if (NPS_CurrentSong == 3){
NPS_channel = NPS_Ambient3.play(0, 99999);
};
if (NPS_CurrentSong == 4){
NPS_channel = NPS_Ambient4.play(0, 99999);
};
if (NPS_CurrentSong == 5){
NPS_channel = NPS_Ambient5.play(0, 99999);
};
};
}
public function NPS_buy_church_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Church (1000g)";
text_towerinfo.text = "Adds Prayer Points. Limit 1.";
}
public function NPS_tower_select_ice_mouse_up(_arg1:MouseEvent):void{
if (NPS_gamemode != "paused"){
if (NPS_gamemode == "set_tower"){
if (NPS_selectedtowertype == "Ice"){
NPS_gamemode = "off";
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
TheGrid1.alpha = 0;
NPS_selectedtowertype = "none";
} else {
if (NPS_selectedtowertype != "Ice"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Ice";
};
};
} else {
if (NPS_gamemode != "set_tower"){
NPS_gamemode = "set_tower";
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
NPS_selectedtowertype = "Ice";
};
};
};
}
public function playthegame9(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function NP_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function NPH_musicmute_mouse_up(_arg1:MouseEvent):void{
if (NPH_Muted == false){
NPH_channel.stop();
NPH_Muted = true;
} else {
if (NPH_CurrentSong == 1){
NPH_channel = NPH_Ambient1.play(0, 99999);
};
if (NPH_CurrentSong == 2){
NPH_channel = NPH_Ambient2.play(0, 99999);
};
if (NPH_CurrentSong == 3){
NPH_channel = NPH_Ambient3.play(0, 99999);
};
if (NPH_CurrentSong == 4){
NPH_channel = NPH_Ambient4.play(0, 99999);
};
if (NPH_CurrentSong == 5){
NPH_channel = NPH_Ambient5.play(0, 99999);
};
NPH_Muted = false;
};
}
public function NPI_tower_select_arrow_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Arrow Tower (30g)";
text_towerinfo.text = "Low Dmg, Fast Speed. (Normal Damage)";
}
public function NPI_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
text_tower_level.text = ("Level - " + NPI_Towers[NPI_SelectedTower].pLevel);
text_tower_damage.text = ("Damage - " + NPI_Towers[NPI_SelectedTower].pDamage.toFixed(2));
} catch(e:TypeError) {
};
}
public function NPS_CheckEnemiesForHit():void{
var i:int;
var k:int;
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var a:int;
if (NPS_gamemode != "paused"){
try {
i = (NPS_Enemies.length - 1);
while (i >= 0) {
k = (NPS_Bullets.length - 1);
while (k >= 0) {
if (NPS_Enemies[i].hitTestObject(NPS_Bullets[k])){
NPS_Enemies[i].GotHit(NPS_Bullets[k].pDamage, NPS_Bullets[k].pBulletType);
if (NPS_Bullets[k].pBulletType == 2){
if (NPS_Enemies[i].pSpeed > 0.3){
NPS_Enemies[i].pSpeed = (NPS_Enemies[i].pSpeed - 0.2);
};
};
if (NPS_Bullets[k].pBulletType == 4){
a = (NPS_Enemies.length - 1);
while (a >= 0) {
xdist = Math.round((NPS_Bullets[k].x - NPS_Enemies[a].x));
ydist = Math.round((NPS_Bullets[k].y - NPS_Enemies[a].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < 50){
if (a != NPS_Bullets[k].pTarget){
NPS_Enemies[a].GotHit(((5 * NPS_Towers[NPS_Bullets[k].pTower].pLevel) * 0.75), 4);
};
};
a = (a - 1);
};
};
NPS_Bullets[k].x = -100;
NPS_Bullets[k].y = -100;
if (NPS_Bullets[k].pVisible == true){
removeChild(NPS_Bullets[k].pBullet);
};
NPS_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
}
}//package Flash_RPG_TD_fla
Section 2
//ambient_1 (ambient_1)
package {
import flash.media.*;
public dynamic class ambient_1 extends Sound {
}
}//package
Section 3
//ambient_2 (ambient_2)
package {
import flash.media.*;
public dynamic class ambient_2 extends Sound {
}
}//package
Section 4
//ambient_3 (ambient_3)
package {
import flash.media.*;
public dynamic class ambient_3 extends Sound {
}
}//package
Section 5
//ambient_4 (ambient_4)
package {
import flash.media.*;
public dynamic class ambient_4 extends Sound {
}
}//package
Section 6
//ambient_5 (ambient_5)
package {
import flash.media.*;
public dynamic class ambient_5 extends Sound {
}
}//package
Section 7
//angel_of_death (angel_of_death)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class angel_of_death extends MovieClip {
public var pLastAnim:int;// = 0
public var pAnimDelay:int;// = 100
public var pCurrentAnim:int;// = 0
public var pPaused:Boolean;// = false
public var pAnimCount:int;// = 4
public function angel_of_death():void{
pLastAnim = 0;
pAnimDelay = 100;
pAnimCount = 4;
pCurrentAnim = 0;
pPaused = false;
super();
x = (Math.random() * 500);
y = ((Math.random() * 500) + 500);
if (x > 480){
x = (x - 200);
};
addEventListener(Event.ENTER_FRAME, everytime);
}
public function moveenemy(){
y = (y - 2);
}
public function everytime(_arg1:Event):void{
if (getTimer() > (pLastAnim + pAnimDelay)){
if (pCurrentAnim == pAnimCount){
pCurrentAnim = -1;
};
gotoAndStop((pCurrentAnim + 1));
pCurrentAnim++;
pLastAnim = getTimer();
};
if (pPaused == false){
moveenemy();
};
}
}
}//package
Section 8
//blizzard_graphic (blizzard_graphic)
package {
import flash.display.*;
import flash.events.*;
public class blizzard_graphic extends Sprite {
public var pPaused:Boolean;// = false
public function blizzard_graphic():void{
pPaused = false;
super();
x = (Math.random() * 500);
y = ((Math.random() * 100) + 500);
if (x > 480){
x = (x - 200);
};
addEventListener(Event.ENTER_FRAME, everytime);
}
public function moveenemy(){
y = (y - 1);
rotation = (rotation + 1);
}
public function everytime(_arg1:Event):void{
if (pPaused == false){
moveenemy();
};
}
}
}//package
Section 9
//building_church (building_church)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class building_church extends MovieClip {
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pPlayDelay:int;// = 0
public var pTarget:Number;// = -1
public var pBuilding:building_church;
public var pLastAnim:int;// = 0
public var pCost:Number;// = 500
public var pAddPrayer:Number;// = 1
public var pTowerType:Number;// = 11
public var pAnimDelay:int;// = 50
public var pLastFire:Number;// = 0
public var pCurrentAnim:int;// = 0
public var pLastPlay:int;// = 0
public var pRange:Number;// = 0
public var pSpeed:Number;// = 200
public var pAnimCount:int;// = 15
public var pDamage:Number;// = 0
public function building_church():void{
pAddPrayer = 1;
pTowerType = 11;
pDamage = 0;
pCost = 500;
pLevel = 1;
pSpeed = 200;
pRange = 0;
pTarget = -1;
pLastFire = 0;
pSelected = false;
pLastAnim = 0;
pAnimDelay = 50;
pAnimCount = 15;
pCurrentAnim = 0;
pLastPlay = 0;
pPlayDelay = 0;
super();
gotoAndStop(0);
addEventListener(MouseEvent.MOUSE_UP, clickedon);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function everytime(_arg1:Event):void{
if (getTimer() > (pLastPlay + pPlayDelay)){
if (getTimer() > (pLastAnim + pAnimDelay)){
if (pCurrentAnim == pAnimCount){
pCurrentAnim = -1;
pLastPlay = getTimer();
};
gotoAndStop((pCurrentAnim + 1));
pCurrentAnim++;
pLastAnim = getTimer();
};
};
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 10
//building_mine (building_mine)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class building_mine extends MovieClip {
public var pAddGold:Number;// = 1
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pPlayDelay:int;// = 0
public var pTarget:Number;// = -1
public var pBuilding:building_mine;
public var pLastAnim:int;// = 0
public var pCost:Number;// = 100
public var pTowerType:Number;// = 10
public var pAnimDelay:int;// = 75
public var pLastFire:Number;// = 0
public var pCurrentAnim:int;// = 0
public var pLastPlay:int;// = 0
public var pRange:Number;// = 0
public var pSpeed:Number;// = 200
public var pAnimCount:int;// = 25
public var pDamage:Number;// = 0
public function building_mine():void{
pAddGold = 1;
pTowerType = 10;
pDamage = 0;
pCost = 100;
pLevel = 1;
pSpeed = 200;
pRange = 0;
pTarget = -1;
pLastFire = 0;
pSelected = false;
pLastAnim = 0;
pAnimDelay = 75;
pAnimCount = 25;
pCurrentAnim = 0;
pLastPlay = 0;
pPlayDelay = 0;
super();
gotoAndStop(0);
addEventListener(MouseEvent.MOUSE_UP, clickedon);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function everytime(_arg1:Event):void{
if (getTimer() > (pLastPlay + pPlayDelay)){
if (getTimer() > (pLastAnim + pAnimDelay)){
if (pCurrentAnim == pAnimCount){
pCurrentAnim = -1;
pLastPlay = getTimer();
};
gotoAndStop((pCurrentAnim + 1));
pCurrentAnim++;
pLastAnim = getTimer();
};
};
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 11
//buttonclick (buttonclick)
package {
import flash.media.*;
public dynamic class buttonclick extends Sound {
}
}//package
Section 12
//enemy_health_bar (enemy_health_bar)
package {
import flash.display.*;
public class enemy_health_bar extends Sprite {
public var pWidth:Number;// = 32
public var pEnemy:Number;// = -1
public function enemy_health_bar():void{
pWidth = 32;
pEnemy = -1;
super();
}
}
}//package
Section 13
//judgement (judgement)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class judgement extends MovieClip {
public var pLastAnim:int;// = 0
public var pAnimDelay:int;// = 100
public var pCurrentAnim:int;// = 0
public var pAnimCount:int;// = 13
public function judgement():void{
pLastAnim = 0;
pAnimDelay = 100;
pAnimCount = 13;
pCurrentAnim = 0;
super();
addEventListener(Event.ENTER_FRAME, everytime);
}
public function everytime(_arg1:Event):void{
if (getTimer() > (pLastAnim + pAnimDelay)){
if (pCurrentAnim == pAnimCount){
y = -900;
pCurrentAnim = -1;
};
gotoAndStop((pCurrentAnim + 1));
pCurrentAnim++;
pLastAnim = getTimer();
};
}
}
}//package
Section 14
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
public class MochiAd {
public static function getVersion():String{
return ("1.5");
}
public static function showTimedAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
var _local2:MovieClip;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
_local2 = this.parent.parent;
MochiAd.unload(_local2);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
_arg1.removeChild(_arg1._mochiad);
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
if (clip.loaderInfo.loaderURL.indexOf("http") != 0){
options.no_page = true;
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
mc["onEnterFrame"] = function ():void{
if (!this._mochiad_ctr){
delete this["onEnterFrame"];
MochiAd.unload(this.parent);
};
};
doOnEnterFrame(mc);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreloaderAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
var _local2:MovieClip;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
_local2 = this.parent.parent;
MochiAd.unload(_local2);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
_local1 = this.parent.parent.root;
if (!_local1){
delete this["onEnterFrame"];
return;
};
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local4 = true;
};
if ((((((_local5 > 0)) && ((_local6 >= _local5)))) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
mc.removeEventListener(Event.ENTER_FRAME, f);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 15
//Pathfinding (Pathfinding)
package {
public class Pathfinding {
var D_COST;// = 14
var ALLOW_DIAGONAL;// = true
var mapStatus:Array;
var openList:Array;
var ALLOW_DIAGONAL_CORNERING;// = false
var HV_COST;// = 10
public function Pathfinding(){
HV_COST = 10;
D_COST = 14;
ALLOW_DIAGONAL = true;
ALLOW_DIAGONAL_CORNERING = false;
super();
}
function openSquare(_arg1:Number, _arg2:Number, _arg3, _arg4, _arg5, _arg6){
if (!_arg6){
openList.push([_arg1, _arg2]);
mapStatus[_arg1][_arg2] = {heuristic:_arg5, open:true, closed:false};
};
mapStatus[_arg1][_arg2].parent = _arg3;
mapStatus[_arg1][_arg2].movementCost = _arg4;
}
function nearerSquare(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = 999999;
_local2 = 0;
_local3 = undefined;
_local4 = undefined;
_local5 = openList.length;
while (_local5-- > 0) {
_local4 = mapStatus[openList[_local5][0]][openList[_local5][1]];
_local3 = (_local4.heuristic + _local4.movementCost);
if (_local3 <= _local1){
_local1 = _local3;
_local2 = _local5;
};
};
return (_local2);
}
function isOpen(_arg1:Number, _arg2:Number){
return (mapStatus[_arg1][_arg2].open);
}
function closeSquare(_arg1:Number, _arg2:Number){
var _local3:*;
var _local4:*;
_local3 = openList.length;
_local4 = 0;
while (_local4 < _local3) {
if (openList[_local4][0] == _arg1){
if (openList[_local4][1] == _arg2){
openList.splice(_local4, 1);
break;
};
};
_local4++;
};
mapStatus[_arg1][_arg2].open = false;
mapStatus[_arg1][_arg2].closed = true;
}
function findPathInternal(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Array{
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:Array;
var _local16:*;
var _local17:*;
var _local18:*;
var _local19:*;
_local6 = _arg1.length;
_local7 = _arg1[0].length;
mapStatus = new Array();
_local8 = 0;
while (_local8 < _local6) {
mapStatus[_local8] = new Array();
_local10 = 0;
while (_local10 < _local7) {
mapStatus[_local8][_local10] = new Array();
_local10++;
};
_local8++;
};
openList = new Array();
openSquare(_arg2, _arg3, undefined, 0, undefined, undefined);
while ((((openList.length > 0)) && (!(isClosed(_arg4, _arg5))))) {
_local8 = nearerSquare();
_local16 = openList[_local8][0];
_local17 = openList[_local8][1];
closeSquare(_local16, _local17);
_local11 = (_local16 - 1);
while (_local11 < (_local16 + 2)) {
_local12 = (_local17 - 1);
while (_local12 < (_local17 + 2)) {
if ((((((((((((((_local11 >= 0)) && ((_local11 < _local6)))) && ((_local12 >= 0)))) && ((_local12 < _local7)))) && (!((((_local11 == _local16)) && ((_local12 == _local17))))))) && (((((ALLOW_DIAGONAL) || ((_local11 == _local16)))) || ((_local12 == _local17)))))) && (((((((ALLOW_DIAGONAL_CORNERING) || ((_local11 == _local16)))) || ((_local12 == _local17)))) || (((!((_arg1[_local11][_local17] == 0))) && (_arg1[_local16][_local12]))))))){
if (_arg1[_local11][_local12] != 0){
if (!isClosed(_local11, _local12)){
_local13 = (mapStatus[_local16][_local17].movementCost + (((((_local11 == _local16)) || ((_local12 == _local17)))) ? HV_COST : D_COST * _arg1[_local11][_local12]));
if (isOpen(_local11, _local12)){
if (_local13 < mapStatus[_local11][_local12].movementCost){
openSquare(_local11, _local12, [_local16, _local17], _local13, undefined, true);
};
} else {
_local14 = ((Math.abs((_local11 - _arg4)) + Math.abs((_local12 - _arg5))) * 10);
openSquare(_local11, _local12, [_local16, _local17], _local13, _local14, false);
};
};
};
};
_local12++;
};
_local11++;
};
};
_local9 = isClosed(_arg4, _arg5);
if (_local9){
_local15 = new Array();
_local16 = _arg4;
_local17 = _arg5;
while (((!((_local16 == _arg2))) || (!((_local17 == _arg3))))) {
_local15.push([_local16, _local17]);
_local18 = mapStatus[_local16][_local17].parent[0];
_local19 = mapStatus[_local16][_local17].parent[1];
_local16 = _local18;
_local17 = _local19;
};
_local15.push([_arg2, _arg3]);
_local15.reverse();
return (_local15);
//unresolved jump
};
return (null);
}
function isClosed(_arg1:Number, _arg2:Number){
return (mapStatus[_arg1][_arg2].closed);
}
public static function findPath(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Array{
var _local6:Pathfinding;
var _local7:Array;
_local6 = new (Pathfinding);
_local7 = _local6.findPathInternal(_arg1, _arg2, _arg3, _arg4, _arg5);
return (_local7);
}
}
}//package
Section 16
//script_bullet_arcane (script_bullet_arcane)
package {
import flash.display.*;
public class script_bullet_arcane extends Sprite {
public var pBulletType:Number;// = 3
public var pTarget:Number;// = -1
public var pTargetX:Number;// = -1
public var pTargetY:Number;// = -1
public var pTower:Number;// = -1
public var pBullet:script_bullet_arcane;
public var pSpeed:Number;// = 7
public var pVisible:Boolean;// = false
public var pDamage:Number;// = 1
public function script_bullet_arcane(_arg1:Number):void{
pBulletType = 3;
pDamage = 1;
pSpeed = 7;
pTargetX = -1;
pTargetY = -1;
pTarget = -1;
pTower = -1;
pVisible = false;
super();
pTarget = _arg1;
}
public function movebullet(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
pTargetX = _arg1;
pTargetY = _arg2;
rotation = GetAngle(pTargetX, pTargetY);
_local6 = ((2 * Math.PI) * (rotation / 360));
_local7 = (pSpeed * Math.cos(_local6));
_local8 = (pSpeed * Math.sin(_local6));
x = (x + _local7);
y = (y + _local8);
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
}
}//package
Section 17
//script_bullet_arrow (script_bullet_arrow)
package {
import flash.display.*;
public class script_bullet_arrow extends Sprite {
public var pBulletType:Number;// = 1
public var pTarget:Number;// = -1
public var pTargetX:Number;// = -1
public var pTargetY:Number;// = -1
public var pTower:Number;// = -1
public var pBullet:script_bullet_arrow;
public var pSpeed:Number;// = 10
public var pVisible:Boolean;// = false
public var pDamage:Number;// = 1
public function script_bullet_arrow(_arg1:Number):void{
pBulletType = 1;
pDamage = 1;
pSpeed = 10;
pTargetX = -1;
pTargetY = -1;
pTarget = -1;
pTower = -1;
pVisible = false;
super();
pTarget = _arg1;
}
public function movebullet(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
pTargetX = _arg1;
pTargetY = _arg2;
rotation = GetAngle(pTargetX, pTargetY);
_local6 = ((2 * Math.PI) * (rotation / 360));
_local7 = (pSpeed * Math.cos(_local6));
_local8 = (pSpeed * Math.sin(_local6));
x = (x + _local7);
y = (y + _local8);
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
}
}//package
Section 18
//script_bullet_cannon (script_bullet_cannon)
package {
import flash.display.*;
public class script_bullet_cannon extends Sprite {
public var pBulletType:Number;// = 4
public var pTarget:Number;// = -1
public var pTargetX:Number;// = -1
public var pTargetY:Number;// = -1
public var pTower:Number;// = -1
public var pBullet:script_bullet_cannon;
public var pSpeed:Number;// = 4
public var pVisible:Boolean;// = false
public var pDamage:Number;// = 1
public function script_bullet_cannon(_arg1:Number):void{
pBulletType = 4;
pDamage = 1;
pSpeed = 4;
pTargetX = -1;
pTargetY = -1;
pTarget = -1;
pVisible = false;
pTower = -1;
super();
pTarget = _arg1;
}
public function movebullet(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
pTargetX = _arg1;
pTargetY = _arg2;
rotation = GetAngle(pTargetX, pTargetY);
_local6 = ((2 * Math.PI) * (rotation / 360));
_local7 = (pSpeed * Math.cos(_local6));
_local8 = (pSpeed * Math.sin(_local6));
x = (x + _local7);
y = (y + _local8);
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
}
}//package
Section 19
//script_bullet_fire (script_bullet_fire)
package {
import flash.display.*;
public class script_bullet_fire extends Sprite {
public var pBulletType:Number;// = 5
public var pTarget:Number;// = -1
public var pTargetX:Number;// = -1
public var pTargetY:Number;// = -1
public var pTower:Number;// = -1
public var pBullet:script_bullet_fire;
public var pSpeed:Number;// = 8
public var pVisible:Boolean;// = false
public var pDamage:Number;// = 1
public function script_bullet_fire(_arg1:Number):void{
pBulletType = 5;
pDamage = 1;
pSpeed = 8;
pTargetX = -1;
pTargetY = -1;
pTarget = -1;
pTower = -1;
pVisible = false;
super();
pTarget = _arg1;
}
public function movebullet(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
pTargetX = _arg1;
pTargetY = _arg2;
rotation = GetAngle(pTargetX, pTargetY);
_local6 = ((2 * Math.PI) * (rotation / 360));
_local7 = (pSpeed * Math.cos(_local6));
_local8 = (pSpeed * Math.sin(_local6));
x = (x + _local7);
y = (y + _local8);
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
}
}//package
Section 20
//script_bullet_ice (script_bullet_ice)
package {
import flash.display.*;
public class script_bullet_ice extends Sprite {
public var pBulletType:Number;// = 2
public var pTarget:Number;// = -1
public var pTargetX:Number;// = -1
public var pTargetY:Number;// = -1
public var pTower:Number;// = -1
public var pBullet:script_bullet_ice;
public var pSpeed:Number;// = 10
public var pVisible:Boolean;// = false
public var pDamage:Number;// = 1
public function script_bullet_ice(_arg1:Number):void{
pBulletType = 2;
pDamage = 1;
pSpeed = 10;
pTargetX = -1;
pTargetY = -1;
pTarget = -1;
pTower = -1;
pVisible = false;
super();
pTarget = _arg1;
}
public function movebullet(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
pTargetX = _arg1;
pTargetY = _arg2;
rotation = GetAngle(pTargetX, pTargetY);
_local6 = ((2 * Math.PI) * (rotation / 360));
_local7 = (pSpeed * Math.cos(_local6));
_local8 = (pSpeed * Math.sin(_local6));
x = (x + _local7);
y = (y + _local8);
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
}
}//package
Section 21
//script_enemy_armororc (script_enemy_armororc)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class script_enemy_armororc extends MovieClip {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pAnimFrame:int;// = 1
public var pLastAnim:Number;// = 0
public var pAnimDelay:int;// = 100
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 10
public var pPath:Array;
public var pSpeed:Number;// = 1
public var pPaused:Boolean;// = false
public var pType:Number;// = 1
public var pStartHealth:Number;// = 1
public var pNumber:int;
public var pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_armororc;
public function script_enemy_armororc(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 1;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1;
pSpeed = 1;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
pLastAnim = 0;
pAnimDelay = 100;
pAnimFrame = 1;
super();
_local4 = _arg3;
pLevel = _arg2;
pNumber = _arg1;
gotoAndStop(1);
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10 * Math.pow(pLevel, 1.22)) + 15);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.15 * Math.pow(pLevel, 1.31)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.5 * Math.pow(pLevel, 1.48)) + 25);
pHealth = pStartHealth;
};
pPaused = false;
x = (64 + 15);
y = ((_arg1 * 40) * -1);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function mapchange():void{
pPathIndex = 0;
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
public function moveenemy(){
var _local1:*;
var _local2:int;
if (pPath == null){
if (pTheDirection == 1){
y = (y + pSpeed);
pAnimFrame = 1;
gotoAndStop(1);
};
if (pTheDirection == 2){
x = (x + pSpeed);
pAnimFrame = 9;
gotoAndStop(9);
};
if (pTheDirection == 3){
x = (x - pSpeed);
pAnimFrame = 5;
gotoAndStop(5);
};
if (pTheDirection == 4){
y = (y - pSpeed);
pAnimFrame = 13;
gotoAndStop(13);
};
} else {
if (pPathIndex <= (pPath.length - 1)){
_local1 = pPath[pPathIndex][1];
_local2 = pPath[pPathIndex][0];
moveenemy1(((_local2 * 32) + 16), ((_local1 * 32) + 16));
} else {
moveenemy1(((16 * 32) + 50), ((14 * 32) + 16));
};
};
}
public function everytime(_arg1:Event):void{
var _local2:Point;
if (pPaused == false){
moveenemy();
if (pSpeed < pOrigSpeed){
pSpeed = (pSpeed + 0.01);
};
if (getTimer() > (pAnimDelay + pLastAnim)){
switch (pAnimFrame){
case 1:
pAnimFrame = 2;
gotoAndStop(2);
pLastAnim = getTimer();
break;
case 2:
pAnimFrame = 3;
gotoAndStop(3);
pLastAnim = getTimer();
break;
case 3:
pAnimFrame = 4;
gotoAndStop(4);
pLastAnim = getTimer();
break;
case 4:
pAnimFrame = 1;
gotoAndStop(1);
pLastAnim = getTimer();
break;
case 5:
pAnimFrame = 6;
gotoAndStop(6);
pLastAnim = getTimer();
break;
case 6:
pAnimFrame = 7;
gotoAndStop(7);
pLastAnim = getTimer();
break;
case 7:
pAnimFrame = 8;
gotoAndStop(8);
pLastAnim = getTimer();
break;
case 8:
pAnimFrame = 5;
gotoAndStop(5);
pLastAnim = getTimer();
break;
case 9:
pAnimFrame = 10;
gotoAndStop(10);
pLastAnim = getTimer();
break;
case 10:
pAnimFrame = 11;
gotoAndStop(11);
pLastAnim = getTimer();
break;
case 11:
pAnimFrame = 12;
gotoAndStop(12);
pLastAnim = getTimer();
break;
case 12:
pAnimFrame = 9;
gotoAndStop(9);
pLastAnim = getTimer();
break;
case 13:
pAnimFrame = 14;
gotoAndStop(14);
pLastAnim = getTimer();
break;
case 14:
pAnimFrame = 15;
gotoAndStop(15);
pLastAnim = getTimer();
break;
case 15:
pAnimFrame = 16;
gotoAndStop(16);
pLastAnim = getTimer();
break;
case 16:
pAnimFrame = 13;
gotoAndStop(13);
pLastAnim = getTimer();
break;
};
};
};
}
public function GotHit(_arg1:Number, _arg2:int):void{
pHealth = (pHealth - _arg1);
}
public function moveenemy1(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local6 = _arg2;
_local7 = _arg1;
rotation = GetAngle(_local6, _local7);
_local11 = ((2 * Math.PI) * (rotation / 360));
_local12 = (pSpeed * Math.cos(_local11));
_local13 = (pSpeed * Math.sin(_local11));
x = (x + _local12);
y = (y + _local13);
if (pPathIndex <= (pPath.length - 1)){
_local8 = Math.round((x - ((pPath[pPathIndex][1] * 32) + 16)));
_local9 = Math.round((y - ((pPath[pPathIndex][0] * 32) + 16)));
_local10 = Math.round(Math.sqrt(((_local8 * _local8) + (_local9 * _local9))));
if (_local10 < 5){
pPathIndex++;
};
};
if ((((rotation >= -80)) && ((rotation < 60)))){
if (pTheDirection != 2){
pAnimFrame = 9;
pTheDirection = 2;
pLastAnim = getTimer();
gotoAndStop(9);
};
} else {
if ((((rotation >= 170)) && ((rotation < 240)))){
if (pTheDirection != 3){
pAnimFrame = 5;
gotoAndStop(5);
pTheDirection = 3;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= 60)) && ((rotation < 175)))){
if (pTheDirection != 1){
pAnimFrame = 1;
gotoAndStop(1);
pTheDirection = 1;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= -100)) && ((rotation < -80)))){
if (pTheDirection != 4){
pAnimFrame = 13;
gotoAndStop(13);
pTheDirection = 4;
pLastAnim = getTimer();
};
};
};
};
};
rotation = 0;
}
}
}//package
Section 22
//script_enemy_armortroll (script_enemy_armortroll)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class script_enemy_armortroll extends MovieClip {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pAnimFrame:int;// = 1
public var pLastAnim:Number;// = 0
public var pAnimDelay:int;// = 100
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 10
public var pPath:Array;
public var pSpeed:Number;// = 1
public var pPaused:Boolean;// = false
public var pType:Number;// = 1
public var pStartHealth:Number;// = 1
public var pNumber:int;
public var pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_armortroll;
public function script_enemy_armortroll(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 1;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1;
pSpeed = 1;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
pLastAnim = 0;
pAnimDelay = 100;
pAnimFrame = 1;
super();
_local4 = _arg3;
pLevel = _arg2;
pNumber = _arg1;
gotoAndStop(1);
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10 * Math.pow(pLevel, 1.22)) + 15);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.15 * Math.pow(pLevel, 1.31)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.5 * Math.pow(pLevel, 1.48)) + 25);
pHealth = pStartHealth;
};
pPaused = false;
x = (64 + 15);
y = ((_arg1 * 40) * -1);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function mapchange():void{
pPathIndex = 0;
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
public function moveenemy(){
var _local1:*;
var _local2:int;
if (pPath == null){
if (pTheDirection == 1){
y = (y + pSpeed);
pAnimFrame = 1;
gotoAndStop(1);
};
if (pTheDirection == 2){
x = (x + pSpeed);
pAnimFrame = 9;
gotoAndStop(9);
};
if (pTheDirection == 3){
x = (x - pSpeed);
pAnimFrame = 5;
gotoAndStop(5);
};
if (pTheDirection == 4){
y = (y - pSpeed);
pAnimFrame = 13;
gotoAndStop(13);
};
} else {
if (pPathIndex <= (pPath.length - 1)){
_local1 = pPath[pPathIndex][1];
_local2 = pPath[pPathIndex][0];
moveenemy1(((_local2 * 32) + 16), ((_local1 * 32) + 16));
} else {
moveenemy1(((16 * 32) + 50), ((14 * 32) + 16));
};
};
}
public function everytime(_arg1:Event):void{
var _local2:Point;
if (pPaused == false){
moveenemy();
if (pSpeed < pOrigSpeed){
pSpeed = (pSpeed + 0.01);
};
if (getTimer() > (pAnimDelay + pLastAnim)){
switch (pAnimFrame){
case 1:
pAnimFrame = 2;
gotoAndStop(2);
pLastAnim = getTimer();
break;
case 2:
pAnimFrame = 3;
gotoAndStop(3);
pLastAnim = getTimer();
break;
case 3:
pAnimFrame = 4;
gotoAndStop(4);
pLastAnim = getTimer();
break;
case 4:
pAnimFrame = 1;
gotoAndStop(1);
pLastAnim = getTimer();
break;
case 5:
pAnimFrame = 6;
gotoAndStop(6);
pLastAnim = getTimer();
break;
case 6:
pAnimFrame = 7;
gotoAndStop(7);
pLastAnim = getTimer();
break;
case 7:
pAnimFrame = 8;
gotoAndStop(8);
pLastAnim = getTimer();
break;
case 8:
pAnimFrame = 5;
gotoAndStop(5);
pLastAnim = getTimer();
break;
case 9:
pAnimFrame = 10;
gotoAndStop(10);
pLastAnim = getTimer();
break;
case 10:
pAnimFrame = 11;
gotoAndStop(11);
pLastAnim = getTimer();
break;
case 11:
pAnimFrame = 12;
gotoAndStop(12);
pLastAnim = getTimer();
break;
case 12:
pAnimFrame = 9;
gotoAndStop(9);
pLastAnim = getTimer();
break;
case 13:
pAnimFrame = 14;
gotoAndStop(14);
pLastAnim = getTimer();
break;
case 14:
pAnimFrame = 15;
gotoAndStop(15);
pLastAnim = getTimer();
break;
case 15:
pAnimFrame = 16;
gotoAndStop(16);
pLastAnim = getTimer();
break;
case 16:
pAnimFrame = 13;
gotoAndStop(13);
pLastAnim = getTimer();
break;
};
};
};
}
public function GotHit(_arg1:Number, _arg2:int):void{
pHealth = (pHealth - _arg1);
}
public function moveenemy1(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local6 = _arg2;
_local7 = _arg1;
rotation = GetAngle(_local6, _local7);
_local11 = ((2 * Math.PI) * (rotation / 360));
_local12 = (pSpeed * Math.cos(_local11));
_local13 = (pSpeed * Math.sin(_local11));
x = (x + _local12);
y = (y + _local13);
if (pPathIndex <= (pPath.length - 1)){
_local8 = Math.round((x - ((pPath[pPathIndex][1] * 32) + 16)));
_local9 = Math.round((y - ((pPath[pPathIndex][0] * 32) + 16)));
_local10 = Math.round(Math.sqrt(((_local8 * _local8) + (_local9 * _local9))));
if (_local10 < 5){
pPathIndex++;
};
};
if ((((rotation >= -80)) && ((rotation < 60)))){
if (pTheDirection != 2){
pAnimFrame = 9;
pTheDirection = 2;
pLastAnim = getTimer();
gotoAndStop(9);
};
} else {
if ((((rotation >= 170)) && ((rotation < 240)))){
if (pTheDirection != 3){
pAnimFrame = 5;
gotoAndStop(5);
pTheDirection = 3;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= 60)) && ((rotation < 175)))){
if (pTheDirection != 1){
pAnimFrame = 1;
gotoAndStop(1);
pTheDirection = 1;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= -100)) && ((rotation < -80)))){
if (pTheDirection != 4){
pAnimFrame = 13;
gotoAndStop(13);
pTheDirection = 4;
pLastAnim = getTimer();
};
};
};
};
};
rotation = 0;
}
}
}//package
Section 23
//script_enemy_boss1 (script_enemy_boss1)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class script_enemy_boss1 extends MovieClip {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pAnimFrame:int;// = 1
public var pLastAnim:Number;// = 0
public var pAnimDelay:int;// = 100
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 10
public var pPath:Array;
public var pSpeed:Number;// = 1
public var pPaused:Boolean;// = false
public var pType:Number;// = 1
public var pStartHealth:Number;// = 1
public var pNumber:int;
public var pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_boss1;
public function script_enemy_boss1(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 1;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1;
pSpeed = 1;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
pLastAnim = 0;
pAnimDelay = 100;
pAnimFrame = 1;
super();
_local4 = _arg3;
pLevel = _arg2;
pNumber = _arg1;
gotoAndStop(1);
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((11 * Math.pow(pLevel, 1.8)) + 80);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((12 * Math.pow(pLevel, 2)) + 100);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((13 * Math.pow(pLevel, 2.2)) + 120);
pHealth = pStartHealth;
};
pPaused = false;
x = (64 + 15);
y = ((_arg1 * 40) * -1);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function mapchange():void{
pPathIndex = 0;
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
public function moveenemy(){
var _local1:*;
var _local2:int;
if (pPath == null){
if (pTheDirection == 1){
y = (y + pSpeed);
pAnimFrame = 1;
gotoAndStop(1);
};
if (pTheDirection == 2){
x = (x + pSpeed);
pAnimFrame = 9;
gotoAndStop(9);
};
if (pTheDirection == 3){
x = (x - pSpeed);
pAnimFrame = 5;
gotoAndStop(5);
};
if (pTheDirection == 4){
y = (y - pSpeed);
pAnimFrame = 13;
gotoAndStop(13);
};
} else {
if (pPathIndex <= (pPath.length - 1)){
_local1 = pPath[pPathIndex][1];
_local2 = pPath[pPathIndex][0];
moveenemy1(((_local2 * 32) + 16), ((_local1 * 32) + 16));
} else {
moveenemy1(((16 * 32) + 50), ((14 * 32) + 16));
};
};
}
public function everytime(_arg1:Event):void{
var _local2:Point;
if (pPaused == false){
moveenemy();
if (pSpeed < pOrigSpeed){
pSpeed = (pSpeed + 0.1);
};
if (getTimer() > (pAnimDelay + pLastAnim)){
switch (pAnimFrame){
case 1:
pAnimFrame = 2;
gotoAndStop(2);
pLastAnim = getTimer();
break;
case 2:
pAnimFrame = 3;
gotoAndStop(3);
pLastAnim = getTimer();
break;
case 3:
pAnimFrame = 4;
gotoAndStop(4);
pLastAnim = getTimer();
break;
case 4:
pAnimFrame = 1;
gotoAndStop(1);
pLastAnim = getTimer();
break;
case 5:
pAnimFrame = 6;
gotoAndStop(6);
pLastAnim = getTimer();
break;
case 6:
pAnimFrame = 7;
gotoAndStop(7);
pLastAnim = getTimer();
break;
case 7:
pAnimFrame = 8;
gotoAndStop(8);
pLastAnim = getTimer();
break;
case 8:
pAnimFrame = 5;
gotoAndStop(5);
pLastAnim = getTimer();
break;
case 9:
pAnimFrame = 10;
gotoAndStop(10);
pLastAnim = getTimer();
break;
case 10:
pAnimFrame = 11;
gotoAndStop(11);
pLastAnim = getTimer();
break;
case 11:
pAnimFrame = 12;
gotoAndStop(12);
pLastAnim = getTimer();
break;
case 12:
pAnimFrame = 9;
gotoAndStop(9);
pLastAnim = getTimer();
break;
case 13:
pAnimFrame = 14;
gotoAndStop(14);
pLastAnim = getTimer();
break;
case 14:
pAnimFrame = 15;
gotoAndStop(15);
pLastAnim = getTimer();
break;
case 15:
pAnimFrame = 16;
gotoAndStop(16);
pLastAnim = getTimer();
break;
case 16:
pAnimFrame = 13;
gotoAndStop(13);
pLastAnim = getTimer();
break;
};
};
};
}
public function GotHit(_arg1:Number, _arg2:int):void{
pHealth = (pHealth - _arg1);
}
public function moveenemy1(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local6 = _arg2;
_local7 = _arg1;
rotation = GetAngle(_local6, _local7);
_local11 = ((2 * Math.PI) * (rotation / 360));
_local12 = (pSpeed * Math.cos(_local11));
_local13 = (pSpeed * Math.sin(_local11));
x = (x + _local12);
y = (y + _local13);
if (pPathIndex <= (pPath.length - 1)){
_local8 = Math.round((x - ((pPath[pPathIndex][1] * 32) + 16)));
_local9 = Math.round((y - ((pPath[pPathIndex][0] * 32) + 16)));
_local10 = Math.round(Math.sqrt(((_local8 * _local8) + (_local9 * _local9))));
if (_local10 < 5){
pPathIndex++;
};
};
if ((((rotation >= -80)) && ((rotation < 60)))){
if (pTheDirection != 2){
pAnimFrame = 9;
pTheDirection = 2;
pLastAnim = getTimer();
gotoAndStop(9);
};
} else {
if ((((rotation >= 170)) && ((rotation < 240)))){
if (pTheDirection != 3){
pAnimFrame = 5;
gotoAndStop(5);
pTheDirection = 3;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= 60)) && ((rotation < 175)))){
if (pTheDirection != 1){
pAnimFrame = 1;
gotoAndStop(1);
pTheDirection = 1;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= -100)) && ((rotation < -80)))){
if (pTheDirection != 4){
pAnimFrame = 13;
gotoAndStop(13);
pTheDirection = 4;
pLastAnim = getTimer();
};
};
};
};
};
rotation = 0;
}
}
}//package
Section 24
//script_enemy_clothundead (script_enemy_clothundead)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class script_enemy_clothundead extends MovieClip {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pAnimFrame:int;// = 1
public var pLastAnim:Number;// = 0
public var pAnimDelay:int;// = 100
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 10
public var pPath:Array;
public var pSpeed:Number;// = 1
public var pPaused:Boolean;// = false
public var pType:Number;// = 1
public var pStartHealth:Number;// = 1
public var pNumber:int;
public var pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_clothundead;
public function script_enemy_clothundead(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 1;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1;
pSpeed = 1;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
pLastAnim = 0;
pAnimDelay = 100;
pAnimFrame = 1;
super();
_local4 = _arg3;
pLevel = _arg2;
pNumber = _arg1;
gotoAndStop(1);
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10 * Math.pow(pLevel, 1.2)) + 15);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.15 * Math.pow(pLevel, 1.28)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.5 * Math.pow(pLevel, 1.44)) + 25);
pHealth = pStartHealth;
};
pPaused = false;
x = (64 + 15);
y = ((_arg1 * 40) * -1);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function mapchange():void{
pPathIndex = 0;
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
public function moveenemy(){
var _local1:*;
var _local2:int;
if (pPath == null){
if (pTheDirection == 1){
y = (y + pSpeed);
pAnimFrame = 1;
gotoAndStop(1);
};
if (pTheDirection == 2){
x = (x + pSpeed);
pAnimFrame = 9;
gotoAndStop(9);
};
if (pTheDirection == 3){
x = (x - pSpeed);
pAnimFrame = 5;
gotoAndStop(5);
};
if (pTheDirection == 4){
y = (y - pSpeed);
pAnimFrame = 13;
gotoAndStop(13);
};
} else {
if (pPathIndex <= (pPath.length - 1)){
_local1 = pPath[pPathIndex][1];
_local2 = pPath[pPathIndex][0];
moveenemy1(((_local2 * 32) + 16), ((_local1 * 32) + 16));
} else {
moveenemy1(((16 * 32) + 50), ((14 * 32) + 16));
};
};
}
public function everytime(_arg1:Event):void{
var _local2:Point;
if (pPaused == false){
moveenemy();
if (pSpeed < pOrigSpeed){
pSpeed = (pSpeed + 0.01);
};
if (getTimer() > (pAnimDelay + pLastAnim)){
switch (pAnimFrame){
case 1:
pAnimFrame = 2;
gotoAndStop(2);
pLastAnim = getTimer();
break;
case 2:
pAnimFrame = 3;
gotoAndStop(3);
pLastAnim = getTimer();
break;
case 3:
pAnimFrame = 4;
gotoAndStop(4);
pLastAnim = getTimer();
break;
case 4:
pAnimFrame = 1;
gotoAndStop(1);
pLastAnim = getTimer();
break;
case 5:
pAnimFrame = 6;
gotoAndStop(6);
pLastAnim = getTimer();
break;
case 6:
pAnimFrame = 7;
gotoAndStop(7);
pLastAnim = getTimer();
break;
case 7:
pAnimFrame = 8;
gotoAndStop(8);
pLastAnim = getTimer();
break;
case 8:
pAnimFrame = 5;
gotoAndStop(5);
pLastAnim = getTimer();
break;
case 9:
pAnimFrame = 10;
gotoAndStop(10);
pLastAnim = getTimer();
break;
case 10:
pAnimFrame = 11;
gotoAndStop(11);
pLastAnim = getTimer();
break;
case 11:
pAnimFrame = 12;
gotoAndStop(12);
pLastAnim = getTimer();
break;
case 12:
pAnimFrame = 9;
gotoAndStop(9);
pLastAnim = getTimer();
break;
case 13:
pAnimFrame = 14;
gotoAndStop(14);
pLastAnim = getTimer();
break;
case 14:
pAnimFrame = 15;
gotoAndStop(15);
pLastAnim = getTimer();
break;
case 15:
pAnimFrame = 16;
gotoAndStop(16);
pLastAnim = getTimer();
break;
case 16:
pAnimFrame = 13;
gotoAndStop(13);
pLastAnim = getTimer();
break;
};
};
};
}
public function GotHit(_arg1:Number, _arg2:int):void{
pHealth = (pHealth - _arg1);
}
public function moveenemy1(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local6 = _arg2;
_local7 = _arg1;
rotation = GetAngle(_local6, _local7);
_local11 = ((2 * Math.PI) * (rotation / 360));
_local12 = (pSpeed * Math.cos(_local11));
_local13 = (pSpeed * Math.sin(_local11));
x = (x + _local12);
y = (y + _local13);
if (pPathIndex <= (pPath.length - 1)){
_local8 = Math.round((x - ((pPath[pPathIndex][1] * 32) + 16)));
_local9 = Math.round((y - ((pPath[pPathIndex][0] * 32) + 16)));
_local10 = Math.round(Math.sqrt(((_local8 * _local8) + (_local9 * _local9))));
if (_local10 < 5){
pPathIndex++;
};
};
if ((((rotation >= -80)) && ((rotation < 60)))){
if (pTheDirection != 2){
pAnimFrame = 9;
pTheDirection = 2;
pLastAnim = getTimer();
gotoAndStop(9);
};
} else {
if ((((rotation >= 170)) && ((rotation < 240)))){
if (pTheDirection != 3){
pAnimFrame = 5;
gotoAndStop(5);
pTheDirection = 3;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= 60)) && ((rotation < 175)))){
if (pTheDirection != 1){
pAnimFrame = 1;
gotoAndStop(1);
pTheDirection = 1;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= -100)) && ((rotation < -80)))){
if (pTheDirection != 4){
pAnimFrame = 13;
gotoAndStop(13);
pTheDirection = 4;
pLastAnim = getTimer();
};
};
};
};
};
rotation = 0;
}
}
}//package
Section 25
//script_enemy_demon (script_enemy_demon)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class script_enemy_demon extends MovieClip {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pAnimFrame:int;// = 1
public var pLastAnim:Number;// = 0
public var pAnimDelay:int;// = 100
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 10
public var pPath:Array;
public var pSpeed:Number;// = 1
public var pPaused:Boolean;// = false
public var pType:Number;// = 4
public var pStartHealth:Number;// = 1
public var pNumber:int;
public var pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_demon;
public function script_enemy_demon(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 4;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1;
pSpeed = 1;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
pLastAnim = 0;
pAnimDelay = 100;
pAnimFrame = 1;
super();
_local4 = _arg3;
pLevel = _arg2;
pNumber = _arg1;
gotoAndStop(1);
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10 * Math.pow(pLevel, 1.2)) + 15);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.15 * Math.pow(pLevel, 1.28)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.5 * Math.pow(pLevel, 1.44)) + 25);
pHealth = pStartHealth;
};
pPaused = false;
x = (64 + 15);
y = ((_arg1 * 40) * -1);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function mapchange():void{
pPathIndex = 0;
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
public function moveenemy(){
var _local1:*;
var _local2:int;
if (pPath == null){
if (pTheDirection == 1){
y = (y + pSpeed);
pAnimFrame = 1;
gotoAndStop(1);
};
if (pTheDirection == 2){
x = (x + pSpeed);
pAnimFrame = 9;
gotoAndStop(9);
};
if (pTheDirection == 3){
x = (x - pSpeed);
pAnimFrame = 5;
gotoAndStop(5);
};
if (pTheDirection == 4){
y = (y - pSpeed);
pAnimFrame = 13;
gotoAndStop(13);
};
} else {
if (pPathIndex <= (pPath.length - 1)){
_local1 = pPath[pPathIndex][1];
_local2 = pPath[pPathIndex][0];
moveenemy1(((_local2 * 32) + 16), ((_local1 * 32) + 16));
} else {
moveenemy1(((16 * 32) + 50), ((14 * 32) + 16));
};
};
}
public function everytime(_arg1:Event):void{
var _local2:Point;
if (pPaused == false){
moveenemy();
if (pSpeed < pOrigSpeed){
pSpeed = (pSpeed + 0.01);
};
if (getTimer() > (pAnimDelay + pLastAnim)){
switch (pAnimFrame){
case 1:
pAnimFrame = 2;
gotoAndStop(2);
pLastAnim = getTimer();
break;
case 2:
pAnimFrame = 3;
gotoAndStop(3);
pLastAnim = getTimer();
break;
case 3:
pAnimFrame = 4;
gotoAndStop(4);
pLastAnim = getTimer();
break;
case 4:
pAnimFrame = 1;
gotoAndStop(1);
pLastAnim = getTimer();
break;
case 5:
pAnimFrame = 6;
gotoAndStop(6);
pLastAnim = getTimer();
break;
case 6:
pAnimFrame = 7;
gotoAndStop(7);
pLastAnim = getTimer();
break;
case 7:
pAnimFrame = 8;
gotoAndStop(8);
pLastAnim = getTimer();
break;
case 8:
pAnimFrame = 5;
gotoAndStop(5);
pLastAnim = getTimer();
break;
case 9:
pAnimFrame = 10;
gotoAndStop(10);
pLastAnim = getTimer();
break;
case 10:
pAnimFrame = 11;
gotoAndStop(11);
pLastAnim = getTimer();
break;
case 11:
pAnimFrame = 12;
gotoAndStop(12);
pLastAnim = getTimer();
break;
case 12:
pAnimFrame = 9;
gotoAndStop(9);
pLastAnim = getTimer();
break;
case 13:
pAnimFrame = 14;
gotoAndStop(14);
pLastAnim = getTimer();
break;
case 14:
pAnimFrame = 15;
gotoAndStop(15);
pLastAnim = getTimer();
break;
case 15:
pAnimFrame = 16;
gotoAndStop(16);
pLastAnim = getTimer();
break;
case 16:
pAnimFrame = 13;
gotoAndStop(13);
pLastAnim = getTimer();
break;
};
};
};
}
public function GotHit(_arg1:Number, _arg2:int):void{
if (_arg2 != 2){
if (_arg2 != 3){
if (_arg2 != 5){
pHealth = (pHealth - _arg1);
};
};
};
}
public function moveenemy1(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local6 = _arg2;
_local7 = _arg1;
rotation = GetAngle(_local6, _local7);
_local11 = ((2 * Math.PI) * (rotation / 360));
_local12 = (pSpeed * Math.cos(_local11));
_local13 = (pSpeed * Math.sin(_local11));
x = (x + _local12);
y = (y + _local13);
if (pPathIndex <= (pPath.length - 1)){
_local8 = Math.round((x - ((pPath[pPathIndex][1] * 32) + 16)));
_local9 = Math.round((y - ((pPath[pPathIndex][0] * 32) + 16)));
_local10 = Math.round(Math.sqrt(((_local8 * _local8) + (_local9 * _local9))));
if (_local10 < 5){
pPathIndex++;
};
};
if ((((rotation >= -80)) && ((rotation < 60)))){
if (pTheDirection != 2){
pAnimFrame = 9;
pTheDirection = 2;
pLastAnim = getTimer();
gotoAndStop(9);
};
} else {
if ((((rotation >= 170)) && ((rotation < 240)))){
if (pTheDirection != 3){
pAnimFrame = 5;
gotoAndStop(5);
pTheDirection = 3;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= 60)) && ((rotation < 175)))){
if (pTheDirection != 1){
pAnimFrame = 1;
gotoAndStop(1);
pTheDirection = 1;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= -100)) && ((rotation < -80)))){
if (pTheDirection != 4){
pAnimFrame = 13;
gotoAndStop(13);
pTheDirection = 4;
pLastAnim = getTimer();
};
};
};
};
};
rotation = 0;
}
}
}//package
Section 26
//script_enemy_fasttroll (script_enemy_fasttroll)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class script_enemy_fasttroll extends MovieClip {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pAnimFrame:int;// = 1
public var pLastAnim:Number;// = 0
public var pAnimDelay:int;// = 100
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 10
public var pPath:Array;
public var pSpeed:Number;// = 1.5
public var pPaused:Boolean;// = false
public var pType:Number;// = 1
public var pStartHealth:Number;// = 1
public var pNumber:int;
public var pOrigSpeed:Number;// = 1.5
public var pEnemy:script_enemy_fasttroll;
public function script_enemy_fasttroll(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 1;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1.5;
pSpeed = 1.5;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
pLastAnim = 0;
pAnimDelay = 100;
pAnimFrame = 1;
super();
_local4 = _arg3;
pLevel = _arg2;
pNumber = _arg1;
gotoAndStop(1);
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10 * Math.pow(pLevel, 1.2)) + 15);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.15 * Math.pow(pLevel, 1.28)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.5 * Math.pow(pLevel, 1.44)) + 25);
pHealth = pStartHealth;
};
pPaused = false;
x = (64 + 15);
y = ((_arg1 * 40) * -1);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function mapchange():void{
pPathIndex = 0;
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
public function moveenemy(){
var _local1:*;
var _local2:int;
if (pPath == null){
if (pTheDirection == 1){
y = (y + pSpeed);
pAnimFrame = 1;
gotoAndStop(1);
};
if (pTheDirection == 2){
x = (x + pSpeed);
pAnimFrame = 9;
gotoAndStop(9);
};
if (pTheDirection == 3){
x = (x - pSpeed);
pAnimFrame = 5;
gotoAndStop(5);
};
if (pTheDirection == 4){
y = (y - pSpeed);
pAnimFrame = 13;
gotoAndStop(13);
};
} else {
if (pPathIndex <= (pPath.length - 1)){
_local1 = pPath[pPathIndex][1];
_local2 = pPath[pPathIndex][0];
moveenemy1(((_local2 * 32) + 16), ((_local1 * 32) + 16));
} else {
moveenemy1(((16 * 32) + 50), ((14 * 32) + 16));
};
};
}
public function everytime(_arg1:Event):void{
var _local2:Point;
if (pPaused == false){
moveenemy();
if (pSpeed < pOrigSpeed){
pSpeed = (pSpeed + 0.01);
};
if (getTimer() > (pAnimDelay + pLastAnim)){
switch (pAnimFrame){
case 1:
pAnimFrame = 2;
gotoAndStop(2);
pLastAnim = getTimer();
break;
case 2:
pAnimFrame = 3;
gotoAndStop(3);
pLastAnim = getTimer();
break;
case 3:
pAnimFrame = 4;
gotoAndStop(4);
pLastAnim = getTimer();
break;
case 4:
pAnimFrame = 1;
gotoAndStop(1);
pLastAnim = getTimer();
break;
case 5:
pAnimFrame = 6;
gotoAndStop(6);
pLastAnim = getTimer();
break;
case 6:
pAnimFrame = 7;
gotoAndStop(7);
pLastAnim = getTimer();
break;
case 7:
pAnimFrame = 8;
gotoAndStop(8);
pLastAnim = getTimer();
break;
case 8:
pAnimFrame = 5;
gotoAndStop(5);
pLastAnim = getTimer();
break;
case 9:
pAnimFrame = 10;
gotoAndStop(10);
pLastAnim = getTimer();
break;
case 10:
pAnimFrame = 11;
gotoAndStop(11);
pLastAnim = getTimer();
break;
case 11:
pAnimFrame = 12;
gotoAndStop(12);
pLastAnim = getTimer();
break;
case 12:
pAnimFrame = 9;
gotoAndStop(9);
pLastAnim = getTimer();
break;
case 13:
pAnimFrame = 14;
gotoAndStop(14);
pLastAnim = getTimer();
break;
case 14:
pAnimFrame = 15;
gotoAndStop(15);
pLastAnim = getTimer();
break;
case 15:
pAnimFrame = 16;
gotoAndStop(16);
pLastAnim = getTimer();
break;
case 16:
pAnimFrame = 13;
gotoAndStop(13);
pLastAnim = getTimer();
break;
};
};
};
}
public function GotHit(_arg1:Number, _arg2:int):void{
pHealth = (pHealth - _arg1);
}
public function moveenemy1(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local6 = _arg2;
_local7 = _arg1;
rotation = GetAngle(_local6, _local7);
_local11 = ((2 * Math.PI) * (rotation / 360));
_local12 = (pSpeed * Math.cos(_local11));
_local13 = (pSpeed * Math.sin(_local11));
x = (x + _local12);
y = (y + _local13);
if (pPathIndex <= (pPath.length - 1)){
_local8 = Math.round((x - ((pPath[pPathIndex][1] * 32) + 16)));
_local9 = Math.round((y - ((pPath[pPathIndex][0] * 32) + 16)));
_local10 = Math.round(Math.sqrt(((_local8 * _local8) + (_local9 * _local9))));
if (_local10 < 5){
pPathIndex++;
};
};
if ((((rotation >= -80)) && ((rotation < 60)))){
if (pTheDirection != 2){
pAnimFrame = 9;
pTheDirection = 2;
pLastAnim = getTimer();
gotoAndStop(9);
};
} else {
if ((((rotation >= 170)) && ((rotation < 240)))){
if (pTheDirection != 3){
pAnimFrame = 5;
gotoAndStop(5);
pTheDirection = 3;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= 60)) && ((rotation < 175)))){
if (pTheDirection != 1){
pAnimFrame = 1;
gotoAndStop(1);
pTheDirection = 1;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= -100)) && ((rotation < -80)))){
if (pTheDirection != 4){
pAnimFrame = 13;
gotoAndStop(13);
pTheDirection = 4;
pLastAnim = getTimer();
};
};
};
};
};
rotation = 0;
}
}
}//package
Section 27
//script_enemy_goblin (script_enemy_goblin)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class script_enemy_goblin extends MovieClip {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pAnimFrame:int;// = 1
public var pLastAnim:Number;// = 0
public var pAnimDelay:int;// = 100
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 10
public var pPath:Array;
public var pSpeed:Number;// = 1
public var pPaused:Boolean;// = false
public var pType:Number;// = 1
public var pStartHealth:Number;// = 1
public var pNumber:int;
public var pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_goblin;
public function script_enemy_goblin(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 1;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1;
pSpeed = 1;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
pLastAnim = 0;
pAnimDelay = 100;
pAnimFrame = 1;
super();
_local4 = _arg3;
pLevel = _arg2;
pNumber = _arg1;
gotoAndStop(1);
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10 * Math.pow(pLevel, 1.2)) + 15);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.15 * Math.pow(pLevel, 1.28)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.5 * Math.pow(pLevel, 1.44)) + 25);
pHealth = pStartHealth;
};
pPaused = false;
x = (64 + 15);
y = ((_arg1 * 40) * -1);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function mapchange():void{
pPathIndex = 0;
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
public function moveenemy(){
var _local1:*;
var _local2:int;
if (pPath == null){
if (pTheDirection == 1){
y = (y + pSpeed);
pAnimFrame = 1;
gotoAndStop(1);
};
if (pTheDirection == 2){
x = (x + pSpeed);
pAnimFrame = 9;
gotoAndStop(9);
};
if (pTheDirection == 3){
x = (x - pSpeed);
pAnimFrame = 5;
gotoAndStop(5);
};
if (pTheDirection == 4){
y = (y - pSpeed);
pAnimFrame = 13;
gotoAndStop(13);
};
} else {
if (pPathIndex <= (pPath.length - 1)){
_local1 = pPath[pPathIndex][1];
_local2 = pPath[pPathIndex][0];
moveenemy1(((_local2 * 32) + 16), ((_local1 * 32) + 16));
} else {
moveenemy1(((16 * 32) + 50), ((14 * 32) + 16));
};
};
}
public function everytime(_arg1:Event):void{
var _local2:Point;
if (pPaused == false){
moveenemy();
if (pSpeed < pOrigSpeed){
pSpeed = (pSpeed + 0.01);
};
if (getTimer() > (pAnimDelay + pLastAnim)){
switch (pAnimFrame){
case 1:
pAnimFrame = 2;
gotoAndStop(2);
pLastAnim = getTimer();
break;
case 2:
pAnimFrame = 3;
gotoAndStop(3);
pLastAnim = getTimer();
break;
case 3:
pAnimFrame = 4;
gotoAndStop(4);
pLastAnim = getTimer();
break;
case 4:
pAnimFrame = 1;
gotoAndStop(1);
pLastAnim = getTimer();
break;
case 5:
pAnimFrame = 6;
gotoAndStop(6);
pLastAnim = getTimer();
break;
case 6:
pAnimFrame = 7;
gotoAndStop(7);
pLastAnim = getTimer();
break;
case 7:
pAnimFrame = 8;
gotoAndStop(8);
pLastAnim = getTimer();
break;
case 8:
pAnimFrame = 5;
gotoAndStop(5);
pLastAnim = getTimer();
break;
case 9:
pAnimFrame = 10;
gotoAndStop(10);
pLastAnim = getTimer();
break;
case 10:
pAnimFrame = 11;
gotoAndStop(11);
pLastAnim = getTimer();
break;
case 11:
pAnimFrame = 12;
gotoAndStop(12);
pLastAnim = getTimer();
break;
case 12:
pAnimFrame = 9;
gotoAndStop(9);
pLastAnim = getTimer();
break;
case 13:
pAnimFrame = 14;
gotoAndStop(14);
pLastAnim = getTimer();
break;
case 14:
pAnimFrame = 15;
gotoAndStop(15);
pLastAnim = getTimer();
break;
case 15:
pAnimFrame = 16;
gotoAndStop(16);
pLastAnim = getTimer();
break;
case 16:
pAnimFrame = 13;
gotoAndStop(13);
pLastAnim = getTimer();
break;
};
};
};
}
public function GotHit(_arg1:Number, _arg2:int):void{
pHealth = (pHealth - _arg1);
}
public function moveenemy1(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local6 = _arg2;
_local7 = _arg1;
rotation = GetAngle(_local6, _local7);
_local11 = ((2 * Math.PI) * (rotation / 360));
_local12 = (pSpeed * Math.cos(_local11));
_local13 = (pSpeed * Math.sin(_local11));
x = (x + _local12);
y = (y + _local13);
if (pPathIndex <= (pPath.length - 1)){
_local8 = Math.round((x - ((pPath[pPathIndex][1] * 32) + 16)));
_local9 = Math.round((y - ((pPath[pPathIndex][0] * 32) + 16)));
_local10 = Math.round(Math.sqrt(((_local8 * _local8) + (_local9 * _local9))));
if (_local10 < 5){
pPathIndex++;
};
};
if ((((rotation >= -80)) && ((rotation < 60)))){
if (pTheDirection != 2){
pAnimFrame = 9;
pTheDirection = 2;
pLastAnim = getTimer();
gotoAndStop(9);
};
} else {
if ((((rotation >= 170)) && ((rotation < 240)))){
if (pTheDirection != 3){
pAnimFrame = 5;
gotoAndStop(5);
pTheDirection = 3;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= 60)) && ((rotation < 175)))){
if (pTheDirection != 1){
pAnimFrame = 1;
gotoAndStop(1);
pTheDirection = 1;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= -100)) && ((rotation < -80)))){
if (pTheDirection != 4){
pAnimFrame = 13;
gotoAndStop(13);
pTheDirection = 4;
pLastAnim = getTimer();
};
};
};
};
};
rotation = 0;
}
}
}//package
Section 28
//script_enemy_lion (script_enemy_lion)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class script_enemy_lion extends MovieClip {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pAnimFrame:int;// = 1
public var pLastAnim:Number;// = 0
public var pAnimDelay:int;// = 100
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 10
public var pPath:Array;
public var pSpeed:Number;// = 1
public var pPaused:Boolean;// = false
public var pType:Number;// = 1
public var pStartHealth:Number;// = 1
public var pNumber:int;
public var pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_lion;
public function script_enemy_lion(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 1;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1;
pSpeed = 1;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
pLastAnim = 0;
pAnimDelay = 100;
pAnimFrame = 1;
super();
_local4 = _arg3;
pLevel = _arg2;
pNumber = _arg1;
gotoAndStop(1);
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10 * Math.pow(pLevel, 1.2)) + 15);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.15 * Math.pow(pLevel, 1.28)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.5 * Math.pow(pLevel, 1.44)) + 25);
pHealth = pStartHealth;
};
pPaused = false;
x = (64 + 15);
y = ((_arg1 * 40) * -1);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function mapchange():void{
pPathIndex = 0;
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
public function moveenemy(){
var _local1:*;
var _local2:int;
if (pPath == null){
if (pTheDirection == 1){
y = (y + pSpeed);
pAnimFrame = 1;
gotoAndStop(1);
};
if (pTheDirection == 2){
x = (x + pSpeed);
pAnimFrame = 9;
gotoAndStop(9);
};
if (pTheDirection == 3){
x = (x - pSpeed);
pAnimFrame = 5;
gotoAndStop(5);
};
if (pTheDirection == 4){
y = (y - pSpeed);
pAnimFrame = 13;
gotoAndStop(13);
};
} else {
if (pPathIndex <= (pPath.length - 1)){
_local1 = pPath[pPathIndex][1];
_local2 = pPath[pPathIndex][0];
moveenemy1(((_local2 * 32) + 16), ((_local1 * 32) + 16));
} else {
moveenemy1(((16 * 32) + 50), ((14 * 32) + 16));
};
};
}
public function everytime(_arg1:Event):void{
var _local2:Point;
if (pPaused == false){
moveenemy();
if (pSpeed < pOrigSpeed){
pSpeed = (pSpeed + 0.01);
};
if (getTimer() > (pAnimDelay + pLastAnim)){
switch (pAnimFrame){
case 1:
pAnimFrame = 2;
gotoAndStop(2);
pLastAnim = getTimer();
break;
case 2:
pAnimFrame = 3;
gotoAndStop(3);
pLastAnim = getTimer();
break;
case 3:
pAnimFrame = 4;
gotoAndStop(4);
pLastAnim = getTimer();
break;
case 4:
pAnimFrame = 1;
gotoAndStop(1);
pLastAnim = getTimer();
break;
case 5:
pAnimFrame = 6;
gotoAndStop(6);
pLastAnim = getTimer();
break;
case 6:
pAnimFrame = 7;
gotoAndStop(7);
pLastAnim = getTimer();
break;
case 7:
pAnimFrame = 8;
gotoAndStop(8);
pLastAnim = getTimer();
break;
case 8:
pAnimFrame = 5;
gotoAndStop(5);
pLastAnim = getTimer();
break;
case 9:
pAnimFrame = 10;
gotoAndStop(10);
pLastAnim = getTimer();
break;
case 10:
pAnimFrame = 11;
gotoAndStop(11);
pLastAnim = getTimer();
break;
case 11:
pAnimFrame = 12;
gotoAndStop(12);
pLastAnim = getTimer();
break;
case 12:
pAnimFrame = 9;
gotoAndStop(9);
pLastAnim = getTimer();
break;
case 13:
pAnimFrame = 14;
gotoAndStop(14);
pLastAnim = getTimer();
break;
case 14:
pAnimFrame = 15;
gotoAndStop(15);
pLastAnim = getTimer();
break;
case 15:
pAnimFrame = 16;
gotoAndStop(16);
pLastAnim = getTimer();
break;
case 16:
pAnimFrame = 13;
gotoAndStop(13);
pLastAnim = getTimer();
break;
};
};
};
}
public function GotHit(_arg1:Number, _arg2:int):void{
pHealth = (pHealth - _arg1);
}
public function moveenemy1(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local6 = _arg2;
_local7 = _arg1;
rotation = GetAngle(_local6, _local7);
_local11 = ((2 * Math.PI) * (rotation / 360));
_local12 = (pSpeed * Math.cos(_local11));
_local13 = (pSpeed * Math.sin(_local11));
x = (x + _local12);
y = (y + _local13);
if (pPathIndex <= (pPath.length - 1)){
_local8 = Math.round((x - ((pPath[pPathIndex][1] * 32) + 16)));
_local9 = Math.round((y - ((pPath[pPathIndex][0] * 32) + 16)));
_local10 = Math.round(Math.sqrt(((_local8 * _local8) + (_local9 * _local9))));
if (_local10 < 5){
pPathIndex++;
};
};
if ((((rotation >= -80)) && ((rotation < 60)))){
if (pTheDirection != 2){
pAnimFrame = 9;
pTheDirection = 2;
pLastAnim = getTimer();
gotoAndStop(9);
};
} else {
if ((((rotation >= 170)) && ((rotation < 240)))){
if (pTheDirection != 3){
pAnimFrame = 5;
gotoAndStop(5);
pTheDirection = 3;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= 60)) && ((rotation < 175)))){
if (pTheDirection != 1){
pAnimFrame = 1;
gotoAndStop(1);
pTheDirection = 1;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= -100)) && ((rotation < -80)))){
if (pTheDirection != 4){
pAnimFrame = 13;
gotoAndStop(13);
pTheDirection = 4;
pLastAnim = getTimer();
};
};
};
};
};
rotation = 0;
}
}
}//package
Section 29
//script_enemy_orc (script_enemy_orc)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class script_enemy_orc extends MovieClip {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pAnimFrame:int;// = 1
public var pLastAnim:Number;// = 0
public var pAnimDelay:int;// = 100
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 10
public var pPath:Array;
public var pSpeed:Number;// = 1
public var pPaused:Boolean;// = false
public var pType:Number;// = 1
public var pStartHealth:Number;// = 1
public var pNumber:int;
public var pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_orc;
public function script_enemy_orc(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 1;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1;
pSpeed = 1;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
pLastAnim = 0;
pAnimDelay = 100;
pAnimFrame = 1;
super();
_local4 = _arg3;
pLevel = _arg2;
pNumber = _arg1;
gotoAndStop(1);
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10 * Math.pow(pLevel, 1.2)) + 15);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.15 * Math.pow(pLevel, 1.28)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.5 * Math.pow(pLevel, 1.44)) + 25);
pHealth = pStartHealth;
};
pPaused = false;
x = (64 + 15);
y = ((_arg1 * 40) * -1);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function mapchange():void{
pPathIndex = 0;
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
public function moveenemy(){
var _local1:*;
var _local2:int;
if (pPath == null){
if (pTheDirection == 1){
y = (y + pSpeed);
pAnimFrame = 1;
gotoAndStop(1);
};
if (pTheDirection == 2){
x = (x + pSpeed);
pAnimFrame = 9;
gotoAndStop(9);
};
if (pTheDirection == 3){
x = (x - pSpeed);
pAnimFrame = 5;
gotoAndStop(5);
};
if (pTheDirection == 4){
y = (y - pSpeed);
pAnimFrame = 13;
gotoAndStop(13);
};
} else {
if (pPathIndex <= (pPath.length - 1)){
_local1 = pPath[pPathIndex][1];
_local2 = pPath[pPathIndex][0];
moveenemy1(((_local2 * 32) + 16), ((_local1 * 32) + 16));
} else {
moveenemy1(((16 * 32) + 50), ((14 * 32) + 16));
};
};
}
public function everytime(_arg1:Event):void{
var _local2:Point;
if (pPaused == false){
moveenemy();
if (pSpeed < pOrigSpeed){
pSpeed = (pSpeed + 0.01);
};
if (getTimer() > (pAnimDelay + pLastAnim)){
switch (pAnimFrame){
case 1:
pAnimFrame = 2;
gotoAndStop(2);
pLastAnim = getTimer();
break;
case 2:
pAnimFrame = 3;
gotoAndStop(3);
pLastAnim = getTimer();
break;
case 3:
pAnimFrame = 4;
gotoAndStop(4);
pLastAnim = getTimer();
break;
case 4:
pAnimFrame = 1;
gotoAndStop(1);
pLastAnim = getTimer();
break;
case 5:
pAnimFrame = 6;
gotoAndStop(6);
pLastAnim = getTimer();
break;
case 6:
pAnimFrame = 7;
gotoAndStop(7);
pLastAnim = getTimer();
break;
case 7:
pAnimFrame = 8;
gotoAndStop(8);
pLastAnim = getTimer();
break;
case 8:
pAnimFrame = 5;
gotoAndStop(5);
pLastAnim = getTimer();
break;
case 9:
pAnimFrame = 10;
gotoAndStop(10);
pLastAnim = getTimer();
break;
case 10:
pAnimFrame = 11;
gotoAndStop(11);
pLastAnim = getTimer();
break;
case 11:
pAnimFrame = 12;
gotoAndStop(12);
pLastAnim = getTimer();
break;
case 12:
pAnimFrame = 9;
gotoAndStop(9);
pLastAnim = getTimer();
break;
case 13:
pAnimFrame = 14;
gotoAndStop(14);
pLastAnim = getTimer();
break;
case 14:
pAnimFrame = 15;
gotoAndStop(15);
pLastAnim = getTimer();
break;
case 15:
pAnimFrame = 16;
gotoAndStop(16);
pLastAnim = getTimer();
break;
case 16:
pAnimFrame = 13;
gotoAndStop(13);
pLastAnim = getTimer();
break;
};
};
};
}
public function GotHit(_arg1:Number, _arg2:int):void{
pHealth = (pHealth - _arg1);
}
public function moveenemy1(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local6 = _arg2;
_local7 = _arg1;
rotation = GetAngle(_local6, _local7);
_local11 = ((2 * Math.PI) * (rotation / 360));
_local12 = (pSpeed * Math.cos(_local11));
_local13 = (pSpeed * Math.sin(_local11));
x = (x + _local12);
y = (y + _local13);
if (pPathIndex <= (pPath.length - 1)){
_local8 = Math.round((x - ((pPath[pPathIndex][1] * 32) + 16)));
_local9 = Math.round((y - ((pPath[pPathIndex][0] * 32) + 16)));
_local10 = Math.round(Math.sqrt(((_local8 * _local8) + (_local9 * _local9))));
if (_local10 < 5){
pPathIndex++;
};
};
if ((((rotation >= -80)) && ((rotation < 60)))){
if (pTheDirection != 2){
pAnimFrame = 9;
pTheDirection = 2;
pLastAnim = getTimer();
gotoAndStop(9);
};
} else {
if ((((rotation >= 170)) && ((rotation < 240)))){
if (pTheDirection != 3){
pAnimFrame = 5;
gotoAndStop(5);
pTheDirection = 3;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= 60)) && ((rotation < 175)))){
if (pTheDirection != 1){
pAnimFrame = 1;
gotoAndStop(1);
pTheDirection = 1;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= -100)) && ((rotation < -80)))){
if (pTheDirection != 4){
pAnimFrame = 13;
gotoAndStop(13);
pTheDirection = 4;
pLastAnim = getTimer();
};
};
};
};
};
rotation = 0;
}
}
}//package
Section 30
//script_enemy_tauren (script_enemy_tauren)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class script_enemy_tauren extends MovieClip {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pAnimFrame:int;// = 1
public var pLastAnim:Number;// = 0
public var pAnimDelay:int;// = 100
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 10
public var pPath:Array;
public var pSpeed:Number;// = 1
public var pPaused:Boolean;// = false
public var pType:Number;// = 1
public var pStartHealth:Number;// = 1
public var pNumber:int;
public var pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_tauren;
public function script_enemy_tauren(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 1;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1;
pSpeed = 1;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
pLastAnim = 0;
pAnimDelay = 100;
pAnimFrame = 1;
super();
_local4 = _arg3;
pLevel = _arg2;
pNumber = _arg1;
gotoAndStop(1);
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10 * Math.pow(pLevel, 1.2)) + 15);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.15 * Math.pow(pLevel, 1.28)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.5 * Math.pow(pLevel, 1.44)) + 25);
pHealth = pStartHealth;
};
pPaused = false;
x = (64 + 15);
y = ((_arg1 * 40) * -1);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function mapchange():void{
pPathIndex = 0;
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
public function moveenemy(){
var _local1:*;
var _local2:int;
if (pPath == null){
if (pTheDirection == 1){
y = (y + pSpeed);
pAnimFrame = 1;
gotoAndStop(1);
};
if (pTheDirection == 2){
x = (x + pSpeed);
pAnimFrame = 9;
gotoAndStop(9);
};
if (pTheDirection == 3){
x = (x - pSpeed);
pAnimFrame = 5;
gotoAndStop(5);
};
if (pTheDirection == 4){
y = (y - pSpeed);
pAnimFrame = 13;
gotoAndStop(13);
};
} else {
if (pPathIndex <= (pPath.length - 1)){
_local1 = pPath[pPathIndex][1];
_local2 = pPath[pPathIndex][0];
moveenemy1(((_local2 * 32) + 16), ((_local1 * 32) + 16));
} else {
moveenemy1(((16 * 32) + 50), ((14 * 32) + 16));
};
};
}
public function everytime(_arg1:Event):void{
var _local2:Point;
if (pPaused == false){
moveenemy();
if (pSpeed < pOrigSpeed){
pSpeed = (pSpeed + 0.01);
};
if (getTimer() > (pAnimDelay + pLastAnim)){
switch (pAnimFrame){
case 1:
pAnimFrame = 2;
gotoAndStop(2);
pLastAnim = getTimer();
break;
case 2:
pAnimFrame = 3;
gotoAndStop(3);
pLastAnim = getTimer();
break;
case 3:
pAnimFrame = 4;
gotoAndStop(4);
pLastAnim = getTimer();
break;
case 4:
pAnimFrame = 1;
gotoAndStop(1);
pLastAnim = getTimer();
break;
case 5:
pAnimFrame = 6;
gotoAndStop(6);
pLastAnim = getTimer();
break;
case 6:
pAnimFrame = 7;
gotoAndStop(7);
pLastAnim = getTimer();
break;
case 7:
pAnimFrame = 8;
gotoAndStop(8);
pLastAnim = getTimer();
break;
case 8:
pAnimFrame = 5;
gotoAndStop(5);
pLastAnim = getTimer();
break;
case 9:
pAnimFrame = 10;
gotoAndStop(10);
pLastAnim = getTimer();
break;
case 10:
pAnimFrame = 11;
gotoAndStop(11);
pLastAnim = getTimer();
break;
case 11:
pAnimFrame = 12;
gotoAndStop(12);
pLastAnim = getTimer();
break;
case 12:
pAnimFrame = 9;
gotoAndStop(9);
pLastAnim = getTimer();
break;
case 13:
pAnimFrame = 14;
gotoAndStop(14);
pLastAnim = getTimer();
break;
case 14:
pAnimFrame = 15;
gotoAndStop(15);
pLastAnim = getTimer();
break;
case 15:
pAnimFrame = 16;
gotoAndStop(16);
pLastAnim = getTimer();
break;
case 16:
pAnimFrame = 13;
gotoAndStop(13);
pLastAnim = getTimer();
break;
};
};
};
}
public function GotHit(_arg1:Number, _arg2:int):void{
pHealth = (pHealth - _arg1);
}
public function moveenemy1(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local6 = _arg2;
_local7 = _arg1;
rotation = GetAngle(_local6, _local7);
_local11 = ((2 * Math.PI) * (rotation / 360));
_local12 = (pSpeed * Math.cos(_local11));
_local13 = (pSpeed * Math.sin(_local11));
x = (x + _local12);
y = (y + _local13);
if (pPathIndex <= (pPath.length - 1)){
_local8 = Math.round((x - ((pPath[pPathIndex][1] * 32) + 16)));
_local9 = Math.round((y - ((pPath[pPathIndex][0] * 32) + 16)));
_local10 = Math.round(Math.sqrt(((_local8 * _local8) + (_local9 * _local9))));
if (_local10 < 5){
pPathIndex++;
};
};
if ((((rotation >= -80)) && ((rotation < 60)))){
if (pTheDirection != 2){
pAnimFrame = 9;
pTheDirection = 2;
pLastAnim = getTimer();
gotoAndStop(9);
};
} else {
if ((((rotation >= 170)) && ((rotation < 240)))){
if (pTheDirection != 3){
pAnimFrame = 5;
gotoAndStop(5);
pTheDirection = 3;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= 60)) && ((rotation < 175)))){
if (pTheDirection != 1){
pAnimFrame = 1;
gotoAndStop(1);
pTheDirection = 1;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= -100)) && ((rotation < -80)))){
if (pTheDirection != 4){
pAnimFrame = 13;
gotoAndStop(13);
pTheDirection = 4;
pLastAnim = getTimer();
};
};
};
};
};
rotation = 0;
}
}
}//package
Section 31
//script_enemy_undead (script_enemy_undead)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class script_enemy_undead extends MovieClip {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pAnimFrame:int;// = 1
public var pLastAnim:Number;// = 0
public var pAnimDelay:int;// = 100
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 10
public var pPath:Array;
public var pSpeed:Number;// = 1.5
public var pPaused:Boolean;// = false
public var pType:Number;// = 1
public var pStartHealth:Number;// = 1
public var pNumber:int;
public var pOrigSpeed:Number;// = 1.5
public var pEnemy:script_enemy_undead;
public function script_enemy_undead(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 1;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1.5;
pSpeed = 1.5;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
pLastAnim = 0;
pAnimDelay = 100;
pAnimFrame = 1;
super();
_local4 = _arg3;
pLevel = _arg2;
pNumber = _arg1;
gotoAndStop(1);
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10 * Math.pow(pLevel, 1.18)) + 15);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.15 * Math.pow(pLevel, 1.25)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((10.5 * Math.pow(pLevel, 1.4)) + 25);
pHealth = pStartHealth;
};
pPaused = false;
x = (64 + 15);
y = ((_arg1 * 40) * -1);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function mapchange():void{
pPathIndex = 0;
}
function GetAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (360 * (_local5 / (2 * Math.PI)));
return (_local6);
}
public function moveenemy(){
var _local1:*;
var _local2:int;
if (pPath == null){
if (pTheDirection == 1){
y = (y + pSpeed);
pAnimFrame = 1;
gotoAndStop(1);
};
if (pTheDirection == 2){
x = (x + pSpeed);
pAnimFrame = 9;
gotoAndStop(9);
};
if (pTheDirection == 3){
x = (x - pSpeed);
pAnimFrame = 5;
gotoAndStop(5);
};
if (pTheDirection == 4){
y = (y - pSpeed);
pAnimFrame = 13;
gotoAndStop(13);
};
} else {
if (pPathIndex <= (pPath.length - 1)){
_local1 = pPath[pPathIndex][1];
_local2 = pPath[pPathIndex][0];
moveenemy1(((_local2 * 32) + 16), ((_local1 * 32) + 16));
} else {
moveenemy1(((16 * 32) + 50), ((14 * 32) + 16));
};
};
}
public function everytime(_arg1:Event):void{
var _local2:Point;
if (pPaused == false){
moveenemy();
if (pSpeed < pOrigSpeed){
pSpeed = (pSpeed + 0.01);
};
if (getTimer() > (pAnimDelay + pLastAnim)){
switch (pAnimFrame){
case 1:
pAnimFrame = 2;
gotoAndStop(2);
pLastAnim = getTimer();
break;
case 2:
pAnimFrame = 3;
gotoAndStop(3);
pLastAnim = getTimer();
break;
case 3:
pAnimFrame = 4;
gotoAndStop(4);
pLastAnim = getTimer();
break;
case 4:
pAnimFrame = 1;
gotoAndStop(1);
pLastAnim = getTimer();
break;
case 5:
pAnimFrame = 6;
gotoAndStop(6);
pLastAnim = getTimer();
break;
case 6:
pAnimFrame = 7;
gotoAndStop(7);
pLastAnim = getTimer();
break;
case 7:
pAnimFrame = 8;
gotoAndStop(8);
pLastAnim = getTimer();
break;
case 8:
pAnimFrame = 5;
gotoAndStop(5);
pLastAnim = getTimer();
break;
case 9:
pAnimFrame = 10;
gotoAndStop(10);
pLastAnim = getTimer();
break;
case 10:
pAnimFrame = 11;
gotoAndStop(11);
pLastAnim = getTimer();
break;
case 11:
pAnimFrame = 12;
gotoAndStop(12);
pLastAnim = getTimer();
break;
case 12:
pAnimFrame = 9;
gotoAndStop(9);
pLastAnim = getTimer();
break;
case 13:
pAnimFrame = 14;
gotoAndStop(14);
pLastAnim = getTimer();
break;
case 14:
pAnimFrame = 15;
gotoAndStop(15);
pLastAnim = getTimer();
break;
case 15:
pAnimFrame = 16;
gotoAndStop(16);
pLastAnim = getTimer();
break;
case 16:
pAnimFrame = 13;
gotoAndStop(13);
pLastAnim = getTimer();
break;
};
};
};
}
public function GotHit(_arg1:Number, _arg2:int):void{
pHealth = (pHealth - _arg1);
}
public function moveenemy1(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local6 = _arg2;
_local7 = _arg1;
rotation = GetAngle(_local6, _local7);
_local11 = ((2 * Math.PI) * (rotation / 360));
_local12 = (pSpeed * Math.cos(_local11));
_local13 = (pSpeed * Math.sin(_local11));
x = (x + _local12);
y = (y + _local13);
if (pPathIndex <= (pPath.length - 1)){
_local8 = Math.round((x - ((pPath[pPathIndex][1] * 32) + 16)));
_local9 = Math.round((y - ((pPath[pPathIndex][0] * 32) + 16)));
_local10 = Math.round(Math.sqrt(((_local8 * _local8) + (_local9 * _local9))));
if (_local10 < 5){
pPathIndex++;
};
};
if ((((rotation >= -80)) && ((rotation < 60)))){
if (pTheDirection != 2){
pAnimFrame = 9;
pTheDirection = 2;
pLastAnim = getTimer();
gotoAndStop(9);
};
} else {
if ((((rotation >= 170)) && ((rotation < 240)))){
if (pTheDirection != 3){
pAnimFrame = 5;
gotoAndStop(5);
pTheDirection = 3;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= 60)) && ((rotation < 175)))){
if (pTheDirection != 1){
pAnimFrame = 1;
gotoAndStop(1);
pTheDirection = 1;
pLastAnim = getTimer();
};
} else {
if ((((rotation >= -100)) && ((rotation < -80)))){
if (pTheDirection != 4){
pAnimFrame = 13;
gotoAndStop(13);
pTheDirection = 4;
pLastAnim = getTimer();
};
};
};
};
};
rotation = 0;
}
}
}//package
Section 32
//tower_arcane (tower_arcane)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class tower_arcane extends MovieClip {
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pPlayDelay:int;// = 0
public var pTarget:Number;// = -1
public var pLastAnim:int;// = 0
public var pCost:Number;// = 125
public var pTowerType:Number;// = 3
public var pAnimDelay:int;// = 25
public var pLastFire:Number;// = 0
public var pTower:tower_arcane;
public var pCurrentAnim:int;// = 0
public var pOrigDamage:Number;// = 10
public var pRange:Number;// = 175
public var pLastPlay:int;// = 0
public var pSpeed:Number;// = 600
public var pAnimCount:int;// = 6
public var pDamage:Number;// = 10
public function tower_arcane():void{
pTowerType = 3;
pDamage = 10;
pOrigDamage = 10;
pRange = 175;
pCost = 125;
pLevel = 1;
pSpeed = 600;
pLastFire = 0;
pTarget = -1;
pSelected = false;
pLastAnim = 0;
pAnimDelay = 25;
pAnimCount = 6;
pCurrentAnim = 0;
pLastPlay = 0;
pPlayDelay = 0;
super();
gotoAndStop(0);
addEventListener(MouseEvent.MOUSE_UP, clickedon);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function everytime(_arg1:Event):void{
if (getTimer() > (pLastPlay + pPlayDelay)){
if (getTimer() > (pLastAnim + pAnimDelay)){
if (pCurrentAnim == pAnimCount){
pCurrentAnim = -1;
pLastPlay = getTimer();
};
gotoAndStop((pCurrentAnim + 1));
pCurrentAnim++;
pLastAnim = getTimer();
};
};
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 33
//tower_arrow (tower_arrow)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class tower_arrow extends MovieClip {
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pPlayDelay:int;// = 3000
public var pTarget:Number;// = -1
public var pLastAnim:int;// = 0
public var pCost:Number;// = 30
public var pTowerType:Number;// = 1
public var pAnimDelay:int;// = 35
public var pLastFire:Number;// = 0
public var pTower:tower_arrow;
public var pCurrentAnim:int;// = 0
public var pOrigDamage:Number;// = 2
public var pRange:Number;// = 175
public var pLastPlay:int;// = 0
public var pSpeed:Number;// = 300
public var pAnimCount:int;// = 18
public var pDamage:Number;// = 2
public function tower_arrow():void{
pTowerType = 1;
pDamage = 2;
pOrigDamage = 2;
pRange = 175;
pCost = 30;
pLevel = 1;
pSpeed = 300;
pLastFire = 0;
pTarget = -1;
pSelected = false;
pLastAnim = 0;
pAnimDelay = 35;
pAnimCount = 18;
pCurrentAnim = 0;
pLastPlay = 0;
pPlayDelay = 3000;
super();
gotoAndStop(0);
addEventListener(MouseEvent.MOUSE_UP, clickedon);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function everytime(_arg1:Event):void{
if (getTimer() > (pLastPlay + pPlayDelay)){
if (getTimer() > (pLastAnim + pAnimDelay)){
if (pCurrentAnim == pAnimCount){
pCurrentAnim = -1;
pLastPlay = getTimer();
};
gotoAndStop((pCurrentAnim + 1));
pCurrentAnim++;
pLastAnim = getTimer();
};
};
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 34
//tower_cannon (tower_cannon)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class tower_cannon extends MovieClip {
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pPlayDelay:int;// = 10000
public var pTarget:Number;// = -1
public var pLastAnim:int;// = 0
public var pCost:Number;// = 75
public var pTowerType:Number;// = 4
public var pAnimDelay:int;// = 50
public var pLastFire:Number;// = 0
public var pTower:tower_cannon;
public var pCurrentAnim:int;// = 0
public var pOrigDamage:Number;// = 15
public var pRange:Number;// = 125
public var pLastPlay:int;// = 0
public var pSpeed:Number;// = 1500
public var pAnimCount:int;// = 23
public var pDamage:Number;// = 15
public function tower_cannon():void{
pTowerType = 4;
pDamage = 15;
pOrigDamage = 15;
pRange = 125;
pCost = 75;
pLevel = 1;
pSpeed = 1500;
pLastFire = 0;
pTarget = -1;
pSelected = false;
pLastAnim = 0;
pAnimDelay = 50;
pAnimCount = 23;
pCurrentAnim = 0;
pLastPlay = 0;
pPlayDelay = 10000;
super();
gotoAndStop(0);
addEventListener(MouseEvent.MOUSE_UP, clickedon);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function everytime(_arg1:Event):void{
if (getTimer() > (pLastPlay + pPlayDelay)){
if (getTimer() > (pLastAnim + pAnimDelay)){
if (pCurrentAnim == pAnimCount){
pCurrentAnim = -1;
pLastPlay = getTimer();
};
gotoAndStop((pCurrentAnim + 1));
pCurrentAnim++;
pLastAnim = getTimer();
};
};
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 35
//tower_fire (tower_fire)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class tower_fire extends MovieClip {
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pPlayDelay:int;// = 10
public var pTarget:Number;// = -1
public var pLastAnim:int;// = 0
public var pCost:Number;// = 100
public var pTowerType:Number;// = 5
public var pAnimDelay:int;// = 50
public var pLastFire:Number;// = 0
public var pTower:tower_fire;
public var pCurrentAnim:int;// = 0
public var pOrigDamage:Number;// = 5
public var pRange:Number;// = 175
public var pLastPlay:int;// = 0
public var pSpeed:Number;// = 200
public var pAnimCount:int;// = 5
public var pDamage:Number;// = 5
public function tower_fire():void{
pTowerType = 5;
pDamage = 5;
pOrigDamage = 5;
pRange = 175;
pCost = 100;
pLevel = 1;
pSpeed = 200;
pLastFire = 0;
pTarget = -1;
pSelected = false;
pLastAnim = 0;
pAnimDelay = 50;
pAnimCount = 5;
pCurrentAnim = 0;
pLastPlay = 0;
pPlayDelay = 10;
super();
gotoAndStop(0);
addEventListener(MouseEvent.MOUSE_UP, clickedon);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function everytime(_arg1:Event):void{
if (getTimer() > (pLastPlay + pPlayDelay)){
if (getTimer() > (pLastAnim + pAnimDelay)){
if (pCurrentAnim == pAnimCount){
pCurrentAnim = -1;
pLastPlay = getTimer();
};
gotoAndStop((pCurrentAnim + 1));
pCurrentAnim++;
pLastAnim = getTimer();
};
};
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 36
//tower_ice (tower_ice)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class tower_ice extends MovieClip {
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pPlayDelay:int;// = 1000
public var pTarget:Number;// = -1
public var pLastAnim:int;// = 0
public var pCost:Number;// = 25
public var pTowerType:Number;// = 2
public var pAnimDelay:int;// = 50
public var pLastFire:Number;// = 0
public var pTower:tower_ice;
public var pCurrentAnim:int;// = 0
public var pOrigDamage:Number;// = 0.2
public var pRange:Number;// = 100
public var pLastPlay:int;// = 0
public var pSpeed:Number;// = 350
public var pAnimCount:int;// = 7
public var pDamage:Number;// = 0.2
public function tower_ice():void{
pTowerType = 2;
pDamage = 0.2;
pOrigDamage = 0.2;
pRange = 100;
pCost = 25;
pLevel = 1;
pSpeed = 350;
pLastFire = 0;
pTarget = -1;
pSelected = false;
pLastAnim = 0;
pAnimDelay = 50;
pAnimCount = 7;
pCurrentAnim = 0;
pLastPlay = 0;
pPlayDelay = 1000;
super();
gotoAndStop(0);
addEventListener(MouseEvent.MOUSE_UP, clickedon);
addEventListener(Event.ENTER_FRAME, everytime);
}
public function everytime(_arg1:Event):void{
if (getTimer() > (pLastPlay + pPlayDelay)){
if (getTimer() > (pLastAnim + pAnimDelay)){
if (pCurrentAnim == pAnimCount){
pCurrentAnim = -1;
pLastPlay = getTimer();
};
gotoAndStop((pCurrentAnim + 1));
pCurrentAnim++;
pLastAnim = getTimer();
};
};
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 37
//TurnPoint (TurnPoint)
package {
import flash.display.*;
public dynamic class TurnPoint extends MovieClip {
}
}//package