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 flash.geom.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var NPS_Towers:Array;
public var NPH_AngelsOfDeath:Array;
public var SB_Enemies:Array;
public var NPI_ButtonClick:buttonclick;
public var NPS_Bullets:Array;
public var Min10_Gold:Number;
public var IN_AngelsOfDeath:Array;
public var text_gold:TextField;
public var tower_select_arcane:MovieClip;
public var Min30_GoldUpdateSpeed:Number;
public var NP_Lives:int;
public var NPH_Map:Array;
public var HD_Muted:Boolean;
public var NP_GameLevel:Number;
public var NPH_GameLevel:Number;
public var end_nopath_hard_score:TextField;
public var backdrop:MovieClip;
public var GoldUpdateSpeed:Number;
public var Min5_GoldUpdateSpeed:Number;
public var SB_PausedTimer1:Number;
public var SB_PausedTimer2:Number;
public var NPH_selectedtowertype:String;
public var Min5_EnemyDie:Sound;
public var text_tower_range:TextField;
public var PausedTimer1:Number;
public var PausedTimer2:Number;
public var tower_select_arrow:MovieClip;
public var NPS_LastWave:Number;
public var NPS_PlacedMine:Boolean;
public var HD_gamemode:String;
public var SB_LastGoldUpdate:Number;
public var HD_Ambient4:ambient_4;
public var NP_Path:Array;
public var HD_Ambient1:ambient_1;
public var HD_Ambient2:ambient_2;
public var play_game_np_insane:MovieClip;
public var HD_Ambient5:ambient_5;
public var Min30_LastEnemyType:Number;
public var play_game_np_sandbox:MovieClip;
public var HD_Ambient3:ambient_3;
public var NPI_Buildings:Array;
public var Min10_EnemyDie:Sound;
public var Min30_Lives:int;
public var HD_channel:SoundChannel;
public var Min5_HealthBars:Array;
public var NPS_AngelsOfDeath:Array;
public var end_nopath_sandbox_score:TextField;
public var IN_selectedtowertype:String;
public var IN_Enemies:Array;
public var NPH_GoldUpdateSpeed:Number;
public var text_score:TextField;
public var HD_selectedtowertype:String;
public var Min30_SelectedTower:Number;
public var Min5_channel:SoundChannel;
public var Min5_TimeLeft:Number;
public var Min5_gamemode:String;
public var text_tower_sell:TextField;
public var Min10_Bullets:Array;
public var play_game_np_hard:MovieClip;
public var tp1:TurnPoint;
public var tp2:TurnPoint;
public var tp4:TurnPoint;
public var tp5:TurnPoint;
public var tp6:TurnPoint;
public var tp7:TurnPoint;
public var tp8:TurnPoint;
public var tp9:TurnPoint;
public var tp3:TurnPoint;
public var Min10_TimeLeft:Number;
public var Min5_Ambient3:ambient_3;
public var Min5_Ambient2:ambient_2;
public var Min5_Ambient5:ambient_5;
public var IN_Lives:int;
public var Muted:Boolean;
public var NPH_ButtonClick:buttonclick;
public var Min10_Ambient4:ambient_4;
public var Min10_TimeStarted:Number;
public var Min5_Ambient1:ambient_1;
public var Min10_Ambient2:ambient_2;
public var Min10_gamemode:String;
public var Min5_Ambient4:ambient_4;
public var Min10_Ambient1:ambient_1;
public var Min10_Ambient3:ambient_3;
public var NPS_Gold:int;
public var Min10_Ambient5:ambient_5;
public var Min30_selectedtowertype:String;
public var text_next_level:TextField;
public var Min30_HealthBars:Array;
public var Min5_GameLevel:Number;
public var text_next_gold:TextField;
public var GameScore:int;
public var IN_PlacedMine:Boolean;
public var NPS_EnemyDie:Sound;
public var NPS_channel:SoundChannel;
public var NPS_GameScore:int;
public var Blizzards:Array;
public var HD_Enemies:Array;
public var AngelsOfDeath:Array;
public var play_game_hard:MovieClip;
public var NPS_ButtonClick:buttonclick;
public var Min30_CurrentSong:int;
public var NPS_Blizzards:Array;
public var HD_Gold:Number;
public var Min10_AngelsOfDeath:Array;
public var Min10_ButtonClick:buttonclick;
public var WaveDelay:Number;
public var Min5_Lives:int;
public var IN_CurrentSong:int;
public var NPI_Muted:Boolean;
public var NP_HealthBars:Array;
public var NPS_WaveDelay:Number;
public var CurrentSong:int;
public var NPI_selectedtowertype:String;
public var NP_Bullets:Array;
public var Min5_Enemies:Array;
public var play_game:MovieClip;
public var end_normal_score:TextField;
public var end_insane_score:TextField;
public var HD_GameScore:int;
public var Min5_Towers:Array;
public var NPI_Bullets:Array;
public var SB_Buildings:Array;
public var NP_AngelsOfDeath:Array;
public var play_game_30min:MovieClip;
public var NPH_Lives:int;
public var NPS_MapStart;
public var HD_Blizzards:Array;
public var NPH_Towers:Array;
public var HD_LastGoldUpdate:Number;
public var NPS_gamemode:String;
public var SB_PlacedMine:Boolean;
public var NP_ButtonClick:buttonclick;
public var NPS_Muted:Boolean;
public var NPH_Gold:int;
public var HD_WaveDelay:Number;
public var NPS_Ambient2:ambient_2;
public var play_game_np_normal:MovieClip;
public var NPI_AngelsOfDeath:Array;
public var SB_GoldUpdateSpeed:Number;
public var NPH_HealthBars:Array;
public var NPS_Ambient3:ambient_3;
public var HD_HealthBars:Array;
public var NPS_Ambient1:ambient_1;
public var NPS_Ambient4:ambient_4;
public var HD_ButtonClick:buttonclick;
public var NPS_Enemies:Array;
public var SB_Towers:Array;
public var Min10_channel:SoundChannel;
public var text_towerinfo:TextField;
public var Min30_PausedTimer2:Number;
public var play_game_sandbox:MovieClip;
public var buy_blizzard:MovieClip;
public var Min10_GameScore:int;
public var Min30_PausedTimer1:Number;
public var SB_LastWave:Number;
public var text_tower_level:TextField;
public var Min30_GameLevel:Number;
public var NPI_PlacedMine:Boolean;
public var NPI_MapEnd;
public var LastWave:Number;
public var Min10_Blizzards:Array;
public var road_1:MovieClip;
public var road_2:MovieClip;
public var road_3:MovieClip;
public var road_4:MovieClip;
public var road_5:MovieClip;
public var road_6:MovieClip;
public var road_7:MovieClip;
public var road_8:MovieClip;
public var road_9:MovieClip;
public var HD_PausedTimer1:Number;
public var HD_PausedTimer2:Number;
public var SB_LastEnemyType:Number;
public var Min5_AngelsOfDeath:Array;
public var tower_select_cannon:MovieClip;
public var NPS_Ambient5:ambient_5;
public var SB_Lives:int;
public var drawonme:MovieClip;
public var IN_LastGoldUpdate:Number;
public var Min10_WaveDelay:Number;
public var IN_GameScore:int;
public var Min30_LastGoldUpdate:Number;
public var NPS_GoldUpdateSpeed:Number;
public var NPH_LastEnemyType:Number;
public var musicright:MovieClip;
public var SB_SelectedTower:Number;
public var NPI_GameLevel:Number;
public var text_timeleft:TextField;
public var IN_Blizzards:Array;
public var play_game_10min:MovieClip;
public var IN_LastEnemyType:Number;
public var text_tower_damage:TextField;
public var end_30min_score:TextField;
public var NPH_Bullets:Array;
public var NPI_Gold:int;
public var NPS_MapEnd;
public var IN_WaveDelay:Number;
public var NPH_SelectedTower:Number;
public var IN_Gold:Number;
public var HealthBars:Array;
public var end_nopath_score:TextField;
public var NP_GameScore:int;
public var Min10_Muted:Boolean;
public var playbutton:MovieClip;
public var NPH_GameScore:int;
public var Min30_Bullets:Array;
public var IN_SelectedTower:Number;
public var NPS_Map:Array;
public var NP_Blizzards:Array;
public var NPI_channel:SoundChannel;
public var Bullets:Array;
public var play_game_insane:MovieClip;
public var NP_channel:SoundChannel;
public var SB_selectedtowertype:String;
public var NPS_selectedtowertype:String;
public var Min10_Enemies:Array;
public var musicleft:MovieClip;
public var NPH_WaveDelay:Number;
public var end_5min_score:TextField;
public var tower_select_ice:MovieClip;
public var HD_AngelsOfDeath:Array;
public var Min5_PlacedMine:Boolean;
public var NP_Towers:Array;
public var NP_PausedTimer1:Number;
public var NP_WaveDelay:Number;
public var sell_tower:MovieClip;
public var NPS_LastEnemyType:Number;
public var NP_PausedTimer2:Number;
public var NP_GoldUpdateSpeed:Number;
public var SB_EnemyDie:Sound;
public var NPH_Blizzards:Array;
public var Min10_GoldUpdateSpeed:Number;
public var text_enemy_hp:TextField;
public var HD_Lives:int;
public var EnemyDie:Sound;
public var Min5_CurrentSong:int;
public var Min5_LastGoldUpdate:Number;
public var SB_CurrentSong:int;
public var Buildings:Array;
public var end_hard_score:TextField;
public var NPH_LastWave:Number;
public var NP_selectedtowertype:String;
public var NPS_Buildings:Array;
public var SB_Gold:Number;
public var buy_angel_death:MovieClip;
public var Gold:Number;
public var NP_Enemies:Array;
public var Min10_HealthBars:Array;
public var SB_gamemode:String;
public var NP_Muted:Boolean;
public var Min30_PlacedMine:Boolean;
public var NPH_channel:SoundChannel;
public var Min5_selectedtowertype:String;
public var gamemode:String;
public var NPI_CurrentSong:int;
public var Min10_selectedtowertype:String;
public var HD_Buildings:Array;
public var LastGoldUpdate:Number;
public var Min5_GameScore:int;
public var pausebutton:MovieClip;
public var SB_GameLevel:Number;
public var SB_Ambient2:ambient_2;
public var SB_Ambient3:ambient_3;
public var SB_Ambient4:ambient_4;
public var SB_Ambient5:ambient_5;
public var SB_Ambient1:ambient_1;
public var Min30_TimeStarted:Number;
public var IN_LastWave:Number;
public var Ambient1:ambient_1;
public var Ambient2:ambient_2;
public var Ambient4:ambient_4;
public var Ambient5:ambient_5;
public var Ambient3:ambient_3;
public var Min5_Blizzards:Array;
public var NPI_Enemies:Array;
public var LastEnemyType:Number;
public var Min30_channel:SoundChannel;
public var NP_LastGoldUpdate:Number;
public var NP_LastWave:Number;
public var NP_Gold:int;
public var Min30_Towers:Array;
public var Min10_LastEnemyType:Number;
public var Lives:int;
public var NPS_SelectedTower:Number;
public var NPS_Path:Array;
public var NP_PlacedMine:Boolean;
public var Min5_WaveDelay:Number;
public var Min30_LastWave:Number;
public var channel:SoundChannel;
public var SelectedTower:Number;
public var Min30_Muted:Boolean;
public var NP_LastEnemyType:Number;
public var Min10_SelectedTower:Number;
public var NPI_LastGoldUpdate:Number;
public var text_towertype:TextField;
public var Min30_ButtonClick:buttonclick;
public var Min10_Buildings:Array;
public var IN_ButtonClick:buttonclick;
public var NP_Map:Array;
public var IN_GoldUpdateSpeed:Number;
public var NPI_LastWave:Number;
public var play_game_normal:MovieClip;
public var IN_PausedTimer2:Number;
public var ButtonClick:buttonclick;
public var NP_SelectedTower:Number;
public var IN_PausedTimer1:Number;
public var NPH_PausedTimer1:Number;
public var NPH_PlacedMine:Boolean;
public var Min30_GameScore:int;
public var HD_PlacedMine:Boolean;
public var NPH_PausedTimer2:Number;
public var NPI_LastEnemyType:Number;
public var IN_Buildings:Array;
public var NPI_Lives:int;
public var selectedtowertype:String;
public var Min30_Blizzards:Array;
public var NPS_HealthBars:Array;
public var NPH_MapEnd;
public var tp10:TurnPoint;
public var NPH_Enemies:Array;
public var NPI_SelectedTower:Number;
public var NPS_CurrentSong:int;
public var SB_Bullets:Array;
public var IN_Muted:Boolean;
public var select_mine:MovieClip;
public var end_10min_score:TextField;
public var musicmute:MovieClip;
public var Min30_WaveDelay:Number;
public var Min5_LastEnemyType:Number;
public var IN_EnemyDie:Sound;
public var Min30_Enemies:Array;
public var Min30_AngelsOfDeath:Array;
public var NP_Buildings:Array;
public var NPH_Buildings:Array;
public var end_game_score:TextField;
public var text_level:TextField;
public var NP_EnemyDie:Sound;
public var NPH_EnemyDie:Sound;
public var NPH_gamemode:String;
public var Enemies:Array;
public var NPS_Lives:int;
public var end_nopath_insane_score:TextField;
public var NPH_CurrentSong:int;
public var NPH_MapStart;
public var NPH_Ambient3:ambient_3;
public var NPH_Ambient4:ambient_4;
public var NPH_Ambient5:ambient_5;
public var Min5_SelectedTower:Number;
public var NPH_Path:Array;
public var Min10_PausedTimer1:Number;
public var Min10_PausedTimer2:Number;
public var NPH_Ambient1:ambient_1;
public var Min30_EnemyDie:Sound;
public var NPH_Ambient2:ambient_2;
public var NPI_Blizzards:Array;
public var Min5_Muted:Boolean;
public var PlacedMine:Boolean;
public var NPI_GameScore:int;
public var NP_MapStart;
public var IN_gamemode:String;
public var NP_gamemode:String;
public var IN_Bullets:Array;
public var NPI_WaveDelay:Number;
public var NPI_EnemyDie:Sound;
public var GameLevel:Number;
public var IN_Ambient2:ambient_2;
public var IN_Ambient3:ambient_3;
public var IN_Ambient5:ambient_5;
public var IN_Ambient4:ambient_4;
public var NP_Ambient2:ambient_2;
public var NP_Ambient3:ambient_3;
public var IN_Ambient1:ambient_1;
public var Min10_CurrentSong:int;
public var NP_Ambient4:ambient_4;
public var NP_Ambient5:ambient_5;
public var Towers:Array;
public var Min30_Gold:Number;
public var HD_LastWave:Number;
public var NPS_GameLevel:Number;
public var IN_HealthBars:Array;
public var NPH_Muted:Boolean;
public var NP_Ambient1:ambient_1;
public var Min30_gamemode:String;
public var HD_LastEnemyType:Number;
public var Min10_LastGoldUpdate:Number;
public var play_game_5min:MovieClip;
public var nextlevelbutton:MovieClip;
public var Min30_TimeLeft:Number;
public var Min5_TimeStarted:Number;
public var Min30_Ambient1:ambient_1;
public var Min10_Towers:Array;
public var Min30_Ambient2:ambient_2;
public var Min30_Ambient3:ambient_3;
public var Min30_Ambient4:ambient_4;
public var Min30_Ambient5:ambient_5;
public var Min5_PausedTimer1:Number;
public var Min5_PausedTimer2:Number;
public var Min10_Lives:int;
public var NPI_GoldUpdateSpeed:Number;
public var Min5_Gold:Number;
public var IN_Towers:Array;
public var HD_SelectedTower:Number;
public var NPI_gamemode:String;
public var HD_GameLevel:Number;
public var SB_channel:SoundChannel;
public var NPI_PausedTimer2:Number;
public var HD_GoldUpdateSpeed:Number;
public var NPI_PausedTimer1:Number;
public var NP_CurrentSong:int;
public var Min5_Buildings:Array;
public var upgrade_tower:MovieClip;
public var NPS_PausedTimer1:Number;
public var NPI_Towers:Array;
public var NP_MapEnd;
public var NPI_Ambient3:ambient_3;
public var NPI_Ambient4:ambient_4;
public var NPI_Ambient5:ambient_5;
public var NPH_LastGoldUpdate:Number;
public var NPI_Ambient2:ambient_2;
public var NPI_Path:Array;
public var NPI_MapStart;
public var NPI_Ambient1:ambient_1;
public var HD_CurrentSong:int;
public var SB_HealthBars:Array;
public var HD_Towers:Array;
public var HD_Bullets:Array;
public var Min5_LastWave:Number;
public var Min5_ButtonClick:buttonclick;
public var SB_Muted:Boolean;
public var restart_button:MovieClip;
public var tower_select_fire:MovieClip;
public var SB_ButtonClick:buttonclick;
public var NPS_PausedTimer2:Number;
public var text_lives:TextField;
public var Min10_LastWave:Number;
public var Min10_PlacedMine:Boolean;
public var Min5_Bullets:Array;
public var road_10:MovieClip;
public var road_11:MovieClip;
public var Min10_GameLevel:Number;
public var SB_GameScore:int;
public var NPI_Map:Array;
public var NPS_LastGoldUpdate:Number;
public var NPI_HealthBars:Array;
public var SB_Blizzards:Array;
public var TheGrid1:MovieClip;
public var SB_AngelsOfDeath:Array;
public var IN_channel:SoundChannel;
public var HD_EnemyDie:Sound;
public var IN_GameLevel:Number;
public var SB_WaveDelay:Number;
public var Min30_Buildings:Array;
public function MainTimeline(){
addFrameScript(0, frame1, 9, frame10, 19, frame20, 29, frame30, 34, frame35, 39, frame40, 44, frame45, 49, frame50, 54, frame55, 59, frame60, 64, frame65, 69, frame70, 74, frame75, 79, frame80, 84, frame85, 89, frame90, 94, frame95, 99, frame100, 104, frame105, 109, frame110, 114, frame115, 119, frame120, 124, frame125, 129, frame130, 134, frame135, 139, frame140);
}
public function Min5_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(500g)";
text_towerinfo.text = "Calls forth the Angel of Death";
}
public function Min30_tower_select_fire_mouse_up(_arg1:MouseEvent):void{
if (Min30_gamemode != "paused"){
if (Min30_gamemode == "set_tower"){
if (Min30_selectedtowertype == "Fire"){
Min30_gamemode = "off";
TheGrid1.alpha = 0;
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
Min30_selectedtowertype = "none";
} else {
if (Min30_selectedtowertype != "Fire"){
Min30_gamemode = "set_tower";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min30_selectedtowertype = "Fire";
};
};
} else {
if (Min30_gamemode != "set_tower"){
Min30_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
Min30_selectedtowertype = "Fire";
};
};
};
}
public function Min30_musicmute_mouse_up(_arg1:MouseEvent):void{
if (Min30_Muted == false){
Min30_channel.stop();
Min30_Muted = true;
} else {
if (Min30_CurrentSong == 1){
Min30_channel = Min30_Ambient1.play(0, 99999);
};
if (Min30_CurrentSong == 2){
Min30_channel = Min30_Ambient2.play(0, 99999);
};
if (Min30_CurrentSong == 3){
Min30_channel = Min30_Ambient3.play(0, 99999);
};
if (Min30_CurrentSong == 4){
Min30_channel = Min30_Ambient4.play(0, 99999);
};
if (Min30_CurrentSong == 5){
Min30_channel = Min30_Ambient5.play(0, 99999);
};
Min30_Muted = false;
};
}
public function Min30_the_grid_place_tower_enter(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (Min30_gamemode != "paused"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (Min30_selectedtowertype == "Arrow"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (Min30_selectedtowertype == "Arcane"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (Min30_selectedtowertype == "Cannon"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 125);
drawonme.graphics.endFill();
};
if (Min30_selectedtowertype == "Fire"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (Min30_selectedtowertype == "Ice"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 150);
drawonme.graphics.endFill();
};
};
};
};
}
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 playthegame8(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function SB_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(500g)";
text_towerinfo.text = "Calls forth the Angel of Death";
}
public function NPI_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = (("Upgrade(" + (NPI_Towers[NPI_SelectedTower].pCost * (NPI_Towers[NPI_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
}
public function HD_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
if (HD_gamemode != "paused"){
if (HD_Towers[HD_SelectedTower].pLevel < 15){
if (HD_Gold >= (HD_Towers[HD_SelectedTower].pCost * (HD_Towers[HD_SelectedTower].pLevel + 1))){
HD_Gold = (HD_Gold - (HD_Towers[HD_SelectedTower].pCost * (HD_Towers[HD_SelectedTower].pLevel + 1)));
text_gold.text = String(HD_Gold);
if (HD_Muted == false){
HD_ButtonClick.play();
};
HD_Towers[HD_SelectedTower].pLevel = (HD_Towers[HD_SelectedTower].pLevel + 1);
HD_Towers[HD_SelectedTower].pDamage = (HD_Towers[HD_SelectedTower].pDamage * 1.25);
upgrade_tower.x = 900;
text_towertype.text = (("Upgrade(" + (HD_Towers[HD_SelectedTower].pCost * (HD_Towers[HD_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_damage.text = ("Tower Damage - " + Math.round(HD_Towers[HD_SelectedTower].pDamage));
text_tower_range.text = ("Tower Range - " + HD_Towers[HD_SelectedTower].pRange);
text_tower_level.text = ("Tower Level - " + HD_Towers[HD_SelectedTower].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((HD_Towers[HD_SelectedTower].pLevel * HD_Towers[HD_SelectedTower].pCost) * 0.7))));
};
};
};
}
public function HD_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 (HD_gamemode != "paused"){
try {
i = (HD_Towers.length - 1);
while (i >= 0) {
if (HD_Towers[i].pTowerType <= 5){
closest = 5000;
HD_Towers[i].pTarget = -1;
k = (HD_Enemies.length - 1);
while (k >= 0) {
xdist = Math.round(((HD_Towers[i].x + 16) - HD_Enemies[k].x));
ydist = Math.round(((HD_Towers[i].y + 16) - HD_Enemies[k].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < HD_Towers[i].pRange){
if (HD_Enemies[k].pType == 4){
if (HD_Towers[i].pTowerType != 2){
if (HD_Towers[i].pTowerType != 3){
if (HD_Towers[i].pTowerType != 5){
HD_Towers[i].pTarget = k;
};
};
};
};
if (HD_Enemies[k].pType != 4){
HD_Towers[i].pTarget = k;
};
};
k = (k - 1);
};
};
i = (i - 1);
};
a = (HD_Towers.length - 1);
while (a >= 0) {
if (HD_Towers[a].pTowerType <= 5){
if (HD_Enemies.length > 0){
if (HD_Towers[a].pTarget != -1){
if (HD_Enemies[HD_Towers[a].pTarget].pHealth > 0){
xdist = Math.round(((HD_Towers[a].x + 16) - HD_Enemies[HD_Towers[a].pTarget].x));
ydist = Math.round(((HD_Towers[a].y + 16) - HD_Enemies[HD_Towers[a].pTarget].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < HD_Towers[a].pRange){
if (HD_Enemies[HD_Towers[a].pTarget].y > 0){
if (getTimer() > (HD_Towers[a].pLastFire + HD_Towers[a].pSpeed)){
HD_Towers[a].pLastFire = getTimer();
if (HD_Towers[a].pTowerType == 1){
Bullet1 = new script_bullet_arrow(HD_Towers[a].pTarget);
};
if (HD_Towers[a].pTowerType == 2){
Bullet2 = new script_bullet_ice(HD_Towers[a].pTarget);
};
if (HD_Towers[a].pTowerType == 3){
Bullet3 = new script_bullet_arcane(HD_Towers[a].pTarget);
};
if (HD_Towers[a].pTowerType == 4){
Bullet4 = new script_bullet_cannon(HD_Towers[a].pTarget);
};
if (HD_Towers[a].pTowerType == 5){
Bullet5 = new script_bullet_fire(HD_Towers[a].pTarget);
};
if (HD_Towers[a].pTowerType == 1){
Bullet1.x = (HD_Towers[a].x + 16);
Bullet1.y = (HD_Towers[a].y + 16);
Bullet1.pDamage = HD_Towers[a].pDamage;
Bullet1.pBullet = Bullet1;
addChild(Bullet1);
HD_Bullets.push(Bullet1);
Bullet1.pTower = a;
};
if (HD_Towers[a].pTowerType == 2){
Bullet2.x = (HD_Towers[a].x + 16);
Bullet2.y = (HD_Towers[a].y + 16);
Bullet2.pDamage = HD_Towers[a].pDamage;
Bullet2.pBullet = Bullet2;
addChild(Bullet2);
HD_Bullets.push(Bullet2);
Bullet2.pTower = a;
};
if (HD_Towers[a].pTowerType == 3){
Bullet3.x = (HD_Towers[a].x + 16);
Bullet3.y = (HD_Towers[a].y + 16);
Bullet3.pDamage = HD_Towers[a].pDamage;
Bullet3.pBullet = Bullet3;
addChild(Bullet3);
HD_Bullets.push(Bullet3);
Bullet3.pTower = a;
};
if (HD_Towers[a].pTowerType == 4){
Bullet4.x = (HD_Towers[a].x + 16);
Bullet4.y = (HD_Towers[a].y + 16);
Bullet4.pDamage = HD_Towers[a].pDamage;
Bullet4.pBullet = Bullet4;
addChild(Bullet4);
HD_Bullets.push(Bullet4);
Bullet4.pTower = a;
};
if (HD_Towers[a].pTowerType == 5){
Bullet5.x = (HD_Towers[a].x + 16);
Bullet5.y = (HD_Towers[a].y + 16);
Bullet5.pDamage = HD_Towers[a].pDamage;
Bullet5.pBullet = Bullet5;
addChild(Bullet5);
HD_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function HD_tower_select_ice_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Ice Tower (25g)";
text_towerinfo.text = "Slows enemies down. (Magic Damage)";
}
public function HD_tower_select_arrow_mouse_up(_arg1:MouseEvent):void{
if (HD_gamemode != "paused"){
if (HD_gamemode == "set_tower"){
if (HD_selectedtowertype == "Arrow"){
if (HD_Muted == false){
HD_ButtonClick.play();
};
HD_gamemode = "off";
TheGrid1.alpha = 0;
HD_selectedtowertype = "none";
} else {
if (HD_selectedtowertype != "Arrow"){
HD_gamemode = "set_tower";
if (HD_Muted == false){
HD_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
HD_selectedtowertype = "Arrow";
};
};
} else {
if (HD_gamemode != "set_tower"){
HD_gamemode = "set_tower";
if (HD_Muted == false){
HD_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
HD_selectedtowertype = "Arrow";
};
};
};
}
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 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 IN_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (IN_gamemode != "paused"){
if (IN_Enemies.length < 35){
if (IN_GameLevel != 0){
IN_GameScore = (IN_GameScore + Math.round((((IN_WaveDelay + IN_LastWave) - getTimer()) / 1000)));
text_score.text = String(IN_GameScore);
};
if (IN_Muted == false){
IN_ButtonClick.play();
};
IN_placeenemies();
};
};
}
public function HD_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (HD_gamemode != "paused"){
if (HD_Enemies.length < 35){
if (HD_GameLevel != 0){
HD_GameScore = (HD_GameScore + Math.round((((HD_WaveDelay + HD_LastWave) - getTimer()) / 1000)));
text_score.text = String(HD_GameScore);
};
if (HD_Muted == false){
HD_ButtonClick.play();
};
HD_placeenemies();
};
};
}
public function Min10_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = (("Upgrade(" + (Min10_Towers[Min10_SelectedTower].pCost * (Min10_Towers[Min10_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
}
public function HD_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function NPI_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 5% Of Your Gold Every 2 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;
if (NPH_gamemode != "paused"){
if (NPH_gamemode == "set_tower"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
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) {
_local2 = new Point(Math.round((NPH_Enemies[_local5].x / 32)), Math.round((NPH_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPH_Enemies[_local5].pSpeed;
NPH_Enemies[_local5].pSpeed = 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 = new Array();
NPH_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPH_Enemies[_local5].x / 32)), Math.round((NPH_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPH_Enemies[_local5].pSpeed;
NPH_Enemies[_local5].pSpeed = 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 = new Array();
NPH_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPH_Enemies[_local5].x / 32)), Math.round((NPH_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPH_Enemies[_local5].pSpeed;
NPH_Enemies[_local5].pSpeed = 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 = new Array();
NPH_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPH_Enemies[_local5].x / 32)), Math.round((NPH_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPH_Enemies[_local5].pSpeed;
NPH_Enemies[_local5].pSpeed = 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 = new Array();
NPH_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPH_Enemies[_local5].x / 32)), Math.round((NPH_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPH_Enemies[_local5].pSpeed;
NPH_Enemies[_local5].pSpeed = 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 = new Array();
NPH_Enemies[_local5].pSpeed = _local4;
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;
text_next_gold.y = (_local12.y + 6);
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) {
_local2 = new Point(Math.round((NPH_Enemies[_local5].x / 32)), Math.round((NPH_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPH_Enemies[_local5].pSpeed;
NPH_Enemies[_local5].pSpeed = 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 = new Array();
NPH_Enemies[_local5].pSpeed = _local4;
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 HD_select_mine_mouse_up(_arg1:MouseEvent):void{
if (HD_gamemode != "paused"){
if (HD_gamemode == "set_tower"){
if (HD_selectedtowertype == "Mine"){
if (HD_Muted == false){
HD_ButtonClick.play();
};
HD_gamemode = "off";
TheGrid1.alpha = 0;
HD_selectedtowertype = "none";
} else {
if (HD_selectedtowertype != "Mine"){
HD_gamemode = "set_tower";
if (HD_Muted == false){
HD_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
HD_selectedtowertype = "Mine";
};
};
} else {
if (HD_gamemode != "set_tower"){
HD_gamemode = "set_tower";
if (HD_Muted == false){
HD_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
HD_selectedtowertype = "Mine";
};
};
};
}
public function Min10_tower_select_arcane_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Arcane Tower (125g)";
text_towerinfo.text = "Medium Speed, High Dmg. (Magic Damage)";
}
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 HD_sell_tower_click(_arg1:MouseEvent):void{
if (HD_gamemode != "paused"){
if (HD_SelectedTower != -1){
if (HD_Towers[HD_SelectedTower].pTowerType == 10){
HD_PlacedMine = false;
};
HD_Gold = (HD_Gold + int((0.9 * (HD_Towers[HD_SelectedTower].pCost * HD_Towers[HD_SelectedTower].pLevel))));
text_gold.text = String(HD_Gold);
removeChild(HD_Towers[HD_SelectedTower]);
HD_Towers.splice(HD_SelectedTower, 1);
HD_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 Min30_tower_select_cannon_mouse_up(_arg1:MouseEvent):void{
if (Min30_gamemode != "paused"){
if (Min30_gamemode == "set_tower"){
if (Min30_selectedtowertype == "Cannon"){
Min30_gamemode = "off";
TheGrid1.alpha = 0;
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
Min30_selectedtowertype = "none";
} else {
if (Min30_selectedtowertype != "Cannon"){
Min30_gamemode = "set_tower";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min30_selectedtowertype = "Cannon";
};
};
} else {
if (Min30_gamemode != "set_tower"){
Min30_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
Min30_selectedtowertype = "Cannon";
};
};
};
}
public function Min10_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 (Min10_gamemode != "paused"){
try {
i = (Min10_Towers.length - 1);
while (i >= 0) {
if (Min10_Towers[i].pTowerType <= 5){
closest = 5000;
Min10_Towers[i].pTarget = -1;
k = (Min10_Enemies.length - 1);
while (k >= 0) {
xdist = Math.round(((Min10_Towers[i].x + 16) - Min10_Enemies[k].x));
ydist = Math.round(((Min10_Towers[i].y + 16) - Min10_Enemies[k].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < Min10_Towers[i].pRange){
if (Min10_Enemies[k].pType == 4){
if (Min10_Towers[i].pTowerType != 2){
if (Min10_Towers[i].pTowerType != 3){
if (Min10_Towers[i].pTowerType != 5){
Min10_Towers[i].pTarget = k;
};
};
};
};
if (Min10_Enemies[k].pType != 4){
Min10_Towers[i].pTarget = k;
};
};
k = (k - 1);
};
};
i = (i - 1);
};
a = (Min10_Towers.length - 1);
while (a >= 0) {
if (Min10_Towers[a].pTowerType <= 5){
if (Min10_Enemies.length > 0){
if (Min10_Towers[a].pTarget != -1){
if (Min10_Enemies[Min10_Towers[a].pTarget].pHealth > 0){
xdist = Math.round(((Min10_Towers[a].x + 16) - Min10_Enemies[Min10_Towers[a].pTarget].x));
ydist = Math.round(((Min10_Towers[a].y + 16) - Min10_Enemies[Min10_Towers[a].pTarget].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < Min10_Towers[a].pRange){
if (Min10_Enemies[Min10_Towers[a].pTarget].y > 0){
if (getTimer() > (Min10_Towers[a].pLastFire + Min10_Towers[a].pSpeed)){
Min10_Towers[a].pLastFire = getTimer();
if (Min10_Towers[a].pTowerType == 1){
Bullet1 = new script_bullet_arrow(Min10_Towers[a].pTarget);
};
if (Min10_Towers[a].pTowerType == 2){
Bullet2 = new script_bullet_ice(Min10_Towers[a].pTarget);
};
if (Min10_Towers[a].pTowerType == 3){
Bullet3 = new script_bullet_arcane(Min10_Towers[a].pTarget);
};
if (Min10_Towers[a].pTowerType == 4){
Bullet4 = new script_bullet_cannon(Min10_Towers[a].pTarget);
};
if (Min10_Towers[a].pTowerType == 5){
Bullet5 = new script_bullet_fire(Min10_Towers[a].pTarget);
};
if (Min10_Towers[a].pTowerType == 1){
Bullet1.x = (Min10_Towers[a].x + 16);
Bullet1.y = (Min10_Towers[a].y + 16);
Bullet1.pDamage = Min10_Towers[a].pDamage;
Bullet1.pBullet = Bullet1;
addChild(Bullet1);
Min10_Bullets.push(Bullet1);
Bullet1.pTower = a;
};
if (Min10_Towers[a].pTowerType == 2){
Bullet2.x = (Min10_Towers[a].x + 16);
Bullet2.y = (Min10_Towers[a].y + 16);
Bullet2.pDamage = Min10_Towers[a].pDamage;
Bullet2.pBullet = Bullet2;
addChild(Bullet2);
Min10_Bullets.push(Bullet2);
Bullet2.pTower = a;
};
if (Min10_Towers[a].pTowerType == 3){
Bullet3.x = (Min10_Towers[a].x + 16);
Bullet3.y = (Min10_Towers[a].y + 16);
Bullet3.pDamage = Min10_Towers[a].pDamage;
Bullet3.pBullet = Bullet3;
addChild(Bullet3);
Min10_Bullets.push(Bullet3);
Bullet3.pTower = a;
};
if (Min10_Towers[a].pTowerType == 4){
Bullet4.x = (Min10_Towers[a].x + 16);
Bullet4.y = (Min10_Towers[a].y + 16);
Bullet4.pDamage = Min10_Towers[a].pDamage;
Bullet4.pBullet = Bullet4;
addChild(Bullet4);
Min10_Bullets.push(Bullet4);
Bullet4.pTower = a;
};
if (Min10_Towers[a].pTowerType == 5){
Bullet5.x = (Min10_Towers[a].x + 16);
Bullet5.y = (Min10_Towers[a].y + 16);
Bullet5.pDamage = Min10_Towers[a].pDamage;
Bullet5.pBullet = Bullet5;
addChild(Bullet5);
Min10_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function everytime(_arg1:Event):void{
var b:int;
var mX:int;
var mY:int;
var didHit:Boolean;
var event = _arg1;
try {
if (gamemode != "paused"){
CheckEnemiesForDirections();
CheckTowerFireBullet();
MoveBullets();
CheckEnemiesForHit();
CheckEnemyHealth();
UpdateEnemyHealthBar();
CheckSelectedTower();
MoveAndCheckAngelsOfDeath();
MoveAndCheckBlizzard();
if (getTimer() > (LastWave + WaveDelay)){
placeenemies();
};
text_next_level.text = String(Math.round((((WaveDelay + LastWave) - getTimer()) / 1000)));
if (PlacedMine == true){
text_next_gold.text = String(Math.round((((GoldUpdateSpeed + LastGoldUpdate) - getTimer()) / 1000)));
if (getTimer() > (LastGoldUpdate + GoldUpdateSpeed)){
Gold = (Gold + (Gold * 0.05));
text_gold.text = String(Gold);
LastGoldUpdate = getTimer();
};
};
if (gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
didHit = checkpathcollision(mX, mY);
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF);
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)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
};
if (selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 150);
TheGrid1.graphics.endFill();
};
};
};
};
b = (Towers.length - 1);
while (b >= 0) {
Towers[b].graphics.clear();
b = (b - 1);
};
drawonme.graphics.clear();
if (SelectedTower != -1){
mX = 0;
mY = 0;
Towers[SelectedTower].graphics.clear();
Towers[SelectedTower].graphics.moveTo(mX, mY);
Towers[SelectedTower].graphics.beginFill(0xFFFFFF, 0.5);
Towers[SelectedTower].graphics.lineTo(mX, mY);
Towers[SelectedTower].graphics.lineTo((mX + 32), mY);
Towers[SelectedTower].graphics.lineTo((mX + 32), (mY + 32));
Towers[SelectedTower].graphics.lineTo(mX, (mY + 32));
Towers[SelectedTower].graphics.endFill();
if (Towers[SelectedTower].pTowerType <= 5){
upgrade_tower.x = 524;
} else {
upgrade_tower.x = 900;
};
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((Towers[SelectedTower].x + 16), (Towers[SelectedTower].y + 16), Towers[SelectedTower].pRange);
drawonme.graphics.endFill();
};
};
} catch(e:TypeError) {
};
}
public function Min30_musicright_mouse_up(_arg1:MouseEvent):void{
if (Min30_Muted == false){
Min30_CurrentSong++;
if (Min30_CurrentSong == 6){
Min30_CurrentSong = 1;
};
Min30_channel.stop();
if (Min30_CurrentSong == 1){
Min30_channel = Min30_Ambient1.play(0, 99999);
};
if (Min30_CurrentSong == 2){
Min30_channel = Min30_Ambient2.play(0, 99999);
};
if (Min30_CurrentSong == 3){
Min30_channel = Min30_Ambient3.play(0, 99999);
};
if (Min30_CurrentSong == 4){
Min30_channel = Min30_Ambient4.play(0, 99999);
};
if (Min30_CurrentSong == 5){
Min30_channel = Min30_Ambient5.play(0, 99999);
};
};
}
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 < 0){
drawonme.removeChild(NPS_Blizzards[_local1]);
NPS_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
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_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();
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.05));
text_gold.text = String(NPS_Gold);
NPS_LastGoldUpdate = getTimer();
};
};
if (NPS_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
didHit = NPS_checkpathcollision(mX, mY);
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF);
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)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (NPS_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NPS_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NPS_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
};
if (NPS_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NPS_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 150);
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 Min10_tower_select_cannon_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Cannon Tower (75g)";
text_towerinfo.text = "Medium Dmg, Splash Dmg. (Normal Damage)";
}
function frame20(){
stop();
SB_LastWave = getTimer();
SB_WaveDelay = 60000;
SB_GameLevel = 0;
SB_SelectedTower = -1;
SB_GameScore = 0;
SB_Gold = 1000000;
SB_Lives = 25;
SB_PlacedMine = false;
SB_LastGoldUpdate = 0;
SB_GoldUpdateSpeed = 120000;
SB_LastEnemyType = 1;
SB_CurrentSong = 1;
SB_Muted = false;
SB_ButtonClick = new buttonclick();
SB_Ambient1 = new ambient_1();
SB_Ambient2 = new ambient_2();
SB_Ambient3 = new ambient_3();
SB_Ambient4 = new ambient_4();
SB_Ambient5 = new ambient_5();
SB_channel = SB_Ambient1.play(0, 99999);
SB_Enemies = new Array();
SB_Buildings = new Array();
SB_Blizzards = new Array();
SB_HealthBars = new Array();
SB_Towers = new Array();
SB_Bullets = new Array();
SB_AngelsOfDeath = new Array();
SB_gamemode = "none";
addEventListener(Event.ENTER_FRAME, SB_everytime);
nextlevelbutton.addEventListener(MouseEvent.MOUSE_UP, SB_nextlevelbutton_mouse_up);
pausebutton.addEventListener(MouseEvent.MOUSE_UP, SB_pausebutton_mouse_up);
playbutton.addEventListener(MouseEvent.MOUSE_UP, SB_playbutton_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_UP, SB_musicleft_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_OVER, SB_musicleft_mouse_enter);
musicleft.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
musicright.addEventListener(MouseEvent.MOUSE_UP, SB_musicright_mouse_up);
musicright.addEventListener(MouseEvent.MOUSE_OVER, SB_musicright_mouse_enter);
musicright.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
musicmute.addEventListener(MouseEvent.MOUSE_UP, SB_musicmute_mouse_up);
musicmute.addEventListener(MouseEvent.MOUSE_OVER, SB_musicmute_mouse_enter);
musicmute.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OVER, SB_tower_select_arrow_mouse_enter);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OVER, SB_tower_select_cannon_mouse_enter);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OVER, SB_tower_select_ice_mouse_enter);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OVER, SB_tower_select_fire_mouse_enter);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OVER, SB_tower_select_arcane_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OVER, SB_buy_angel_death_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_UP, SB_buy_angel_death_mouse_up);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
select_mine.addEventListener(MouseEvent.MOUSE_OVER, SB_select_mine_mouse_enter);
select_mine.addEventListener(MouseEvent.MOUSE_UP, SB_select_mine_mouse_up);
select_mine.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OVER, SB_buy_blizzard_mouse_enter);
buy_blizzard.addEventListener(MouseEvent.MOUSE_UP, SB_buy_blizzard_mouse_up);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OVER, SB_upgrade_tower_mouse_enter);
upgrade_tower.addEventListener(MouseEvent.MOUSE_UP, SB_upgrade_tower_mouse_up);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_UP, SB_tower_select_arrow_mouse_up);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_UP, SB_tower_select_cannon_mouse_up);
tower_select_ice.addEventListener(MouseEvent.MOUSE_UP, SB_tower_select_ice_mouse_up);
tower_select_fire.addEventListener(MouseEvent.MOUSE_UP, SB_tower_select_fire_mouse_up);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_UP, SB_tower_select_arcane_mouse_up);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OUT, SB_tower_select_deselect);
road_1.addEventListener(MouseEvent.MOUSE_UP, SB_road_deselect);
road_2.addEventListener(MouseEvent.MOUSE_UP, SB_road_deselect);
road_3.addEventListener(MouseEvent.MOUSE_UP, SB_road_deselect);
road_4.addEventListener(MouseEvent.MOUSE_UP, SB_road_deselect);
road_5.addEventListener(MouseEvent.MOUSE_UP, SB_road_deselect);
road_6.addEventListener(MouseEvent.MOUSE_UP, SB_road_deselect);
road_7.addEventListener(MouseEvent.MOUSE_UP, SB_road_deselect);
road_8.addEventListener(MouseEvent.MOUSE_UP, SB_road_deselect);
road_9.addEventListener(MouseEvent.MOUSE_UP, SB_road_deselect);
road_10.addEventListener(MouseEvent.MOUSE_UP, SB_road_deselect);
road_11.addEventListener(MouseEvent.MOUSE_UP, SB_road_deselect);
sell_tower.addEventListener(MouseEvent.MOUSE_UP, SB_sell_tower_click);
TheGrid1.addEventListener(MouseEvent.MOUSE_UP, SB_the_grid_place_tower);
TheGrid1.addEventListener(MouseEvent.MOUSE_OVER, SB_the_grid_place_tower_enter);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game1);
}
public function NPI_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(500g)";
text_towerinfo.text = "Calls forth the Angel of Death";
}
public function MoveAndCheckAngelsOfDeath():void{
var _local1:int;
var _local2:int;
if (gamemode != "paused"){
_local1 = (AngelsOfDeath.length - 1);
while (_local1 >= 0) {
_local2 = (Enemies.length - 1);
while (_local2 >= 0) {
if (Enemies[_local2].hitTestObject(AngelsOfDeath[_local1])){
Enemies[_local2].GotHit(25, 1);
};
_local2--;
};
if (AngelsOfDeath[_local1].y < 0){
drawonme.removeChild(AngelsOfDeath[_local1]);
AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
function frame30(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame2);
end_game_score.text = ("Score - " + String(SB_GameScore));
}
public function IN_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = (("Upgrade(" + (IN_Towers[IN_SelectedTower].pCost * (IN_Towers[IN_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
}
public function Min10_select_mine_mouse_up(_arg1:MouseEvent):void{
if (Min10_gamemode != "paused"){
if (Min10_gamemode == "set_tower"){
if (Min10_selectedtowertype == "Mine"){
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
Min10_gamemode = "off";
TheGrid1.alpha = 0;
Min10_selectedtowertype = "none";
} else {
if (Min10_selectedtowertype != "Mine"){
Min10_gamemode = "set_tower";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min10_selectedtowertype = "Mine";
};
};
} else {
if (Min10_gamemode != "set_tower"){
Min10_gamemode = "set_tower";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min10_selectedtowertype = "Mine";
};
};
};
}
public function Min30_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 NP_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
if (NP_gamemode != "paused"){
if (NP_Towers[NP_SelectedTower].pLevel < 15){
if (NP_Gold >= (NP_Towers[NP_SelectedTower].pCost * (NP_Towers[NP_SelectedTower].pLevel + 1))){
NP_Gold = (NP_Gold - (NP_Towers[NP_SelectedTower].pCost * (NP_Towers[NP_SelectedTower].pLevel + 1)));
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].pDamage * 1.25);
upgrade_tower.x = 900;
text_towertype.text = (("Upgrade(" + (NP_Towers[NP_SelectedTower].pCost * (NP_Towers[NP_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_damage.text = ("Tower Damage - " + Math.round(NP_Towers[NP_SelectedTower].pDamage));
text_tower_range.text = ("Tower Range - " + NP_Towers[NP_SelectedTower].pRange);
text_tower_level.text = ("Tower Level - " + 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))));
};
};
};
}
public function SB_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
if (road_1.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_2.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_3.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_4.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_5.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_6.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_7.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_8.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_9.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_10.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_11.hitTestPoint(_local3, _local4)){
return (true);
};
return (false);
}
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 NP_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
NP_gamemode = "paused";
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
playbutton.x = 119;
pausebutton.x = 900;
NP_PausedTimer1 = getTimer();
_local2 = (NP_Enemies.length - 1);
while (_local2 >= 0) {
NP_Enemies[_local2].pPaused = true;
_local2--;
};
}
public function IN_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 5% Of Your Gold Every 2 mins. Limit 1.";
}
public function musicright_mouse_up(_arg1:MouseEvent):void{
if (Muted == false){
CurrentSong++;
if (CurrentSong == 6){
CurrentSong = 1;
};
channel.stop();
if (CurrentSong == 1){
channel = Ambient1.play(0, 99999);
};
if (CurrentSong == 2){
channel = Ambient2.play(0, 99999);
};
if (CurrentSong == 3){
channel = Ambient3.play(0, 99999);
};
if (CurrentSong == 4){
channel = Ambient4.play(0, 99999);
};
if (CurrentSong == 5){
channel = Ambient5.play(0, 99999);
};
};
}
public function Min5_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(300g)";
text_towerinfo.text = "Calls forth a Blizzard";
}
public function SB_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 (SB_gamemode != "paused"){
try {
i = (SB_Towers.length - 1);
while (i >= 0) {
if (SB_Towers[i].pTowerType <= 5){
closest = 5000;
SB_Towers[i].pTarget = -1;
k = (SB_Enemies.length - 1);
while (k >= 0) {
xdist = Math.round(((SB_Towers[i].x + 16) - SB_Enemies[k].x));
ydist = Math.round(((SB_Towers[i].y + 16) - SB_Enemies[k].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < SB_Towers[i].pRange){
if (SB_Enemies[k].pType == 4){
if (SB_Towers[i].pTowerType != 2){
if (SB_Towers[i].pTowerType != 3){
if (SB_Towers[i].pTowerType != 5){
SB_Towers[i].pTarget = k;
};
};
};
};
if (SB_Enemies[k].pType != 4){
SB_Towers[i].pTarget = k;
};
};
k = (k - 1);
};
};
i = (i - 1);
};
a = (SB_Towers.length - 1);
while (a >= 0) {
if (SB_Towers[a].pTowerType <= 5){
if (SB_Enemies.length > 0){
if (SB_Towers[a].pTarget != -1){
if (SB_Enemies[SB_Towers[a].pTarget].pHealth > 0){
xdist = Math.round(((SB_Towers[a].x + 16) - SB_Enemies[SB_Towers[a].pTarget].x));
ydist = Math.round(((SB_Towers[a].y + 16) - SB_Enemies[SB_Towers[a].pTarget].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < SB_Towers[a].pRange){
if (SB_Enemies[SB_Towers[a].pTarget].y > 0){
if (getTimer() > (SB_Towers[a].pLastFire + SB_Towers[a].pSpeed)){
SB_Towers[a].pLastFire = getTimer();
if (SB_Towers[a].pTowerType == 1){
Bullet1 = new script_bullet_arrow(SB_Towers[a].pTarget);
};
if (SB_Towers[a].pTowerType == 2){
Bullet2 = new script_bullet_ice(SB_Towers[a].pTarget);
};
if (SB_Towers[a].pTowerType == 3){
Bullet3 = new script_bullet_arcane(SB_Towers[a].pTarget);
};
if (SB_Towers[a].pTowerType == 4){
Bullet4 = new script_bullet_cannon(SB_Towers[a].pTarget);
};
if (SB_Towers[a].pTowerType == 5){
Bullet5 = new script_bullet_fire(SB_Towers[a].pTarget);
};
if (SB_Towers[a].pTowerType == 1){
Bullet1.x = (SB_Towers[a].x + 16);
Bullet1.y = (SB_Towers[a].y + 16);
Bullet1.pDamage = SB_Towers[a].pDamage;
Bullet1.pBullet = Bullet1;
addChild(Bullet1);
SB_Bullets.push(Bullet1);
Bullet1.pTower = a;
};
if (SB_Towers[a].pTowerType == 2){
Bullet2.x = (SB_Towers[a].x + 16);
Bullet2.y = (SB_Towers[a].y + 16);
Bullet2.pDamage = SB_Towers[a].pDamage;
Bullet2.pBullet = Bullet2;
addChild(Bullet2);
SB_Bullets.push(Bullet2);
Bullet2.pTower = a;
};
if (SB_Towers[a].pTowerType == 3){
Bullet3.x = (SB_Towers[a].x + 16);
Bullet3.y = (SB_Towers[a].y + 16);
Bullet3.pDamage = SB_Towers[a].pDamage;
Bullet3.pBullet = Bullet3;
addChild(Bullet3);
SB_Bullets.push(Bullet3);
Bullet3.pTower = a;
};
if (SB_Towers[a].pTowerType == 4){
Bullet4.x = (SB_Towers[a].x + 16);
Bullet4.y = (SB_Towers[a].y + 16);
Bullet4.pDamage = SB_Towers[a].pDamage;
Bullet4.pBullet = Bullet4;
addChild(Bullet4);
SB_Bullets.push(Bullet4);
Bullet4.pTower = a;
};
if (SB_Towers[a].pTowerType == 5){
Bullet5.x = (SB_Towers[a].x + 16);
Bullet5.y = (SB_Towers[a].y + 16);
Bullet5.pDamage = SB_Towers[a].pDamage;
Bullet5.pBullet = Bullet5;
addChild(Bullet5);
SB_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
function frame40(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame3);
end_normal_score.text = ("Score - " + String(GameScore));
}
public function Min10_CheckEnemyHealth():void{
var i:int;
var h:int;
var k:int;
var a:int;
if (Min10_gamemode != "paused"){
try {
i = (Min10_Enemies.length - 1);
while (i >= 0) {
if (Min10_Enemies[i].pHealth <= 0){
Min10_Enemies[i].x = -500;
Min10_Enemies[i].y = -500;
if (Min10_Enemies[i].pType == 5){
Min10_Gold = (Min10_Gold + Math.round(((1.75 * Min10_GameLevel) + 0.5)));
Min10_GameScore = (Min10_GameScore + 50);
} else {
Min10_Gold = (Min10_Gold + Math.round(((0.25 * Min10_GameLevel) + 0.5)));
Min10_GameScore = (Min10_GameScore + 10);
};
removeChild(Min10_Enemies[i]);
Min10_Enemies.splice(i, 1);
text_gold.text = String(Min10_Gold);
text_score.text = String(Min10_GameScore);
h = (Min10_HealthBars.length - 1);
while (h >= 0) {
if (Min10_HealthBars[h].pEnemy == i){
Min10_HealthBars[h].x = -900;
removeChild(Min10_HealthBars[h]);
Min10_HealthBars.splice(h, 1);
};
if (Min10_HealthBars[h].pEnemy > i){
Min10_HealthBars[h].pEnemy = (Min10_HealthBars[h].pEnemy - 1);
};
h = (h - 1);
};
k = (Min10_Bullets.length - 1);
while (k >= 0) {
if (k != i){
if (Min10_Bullets[k].pTarget > i){
Min10_Bullets[k].pTarget = (Min10_Bullets[k].pTarget - 1);
};
};
if (Min10_Bullets[k].pTarget == i){
Min10_Bullets[k].x = -100;
Min10_Bullets[k].y = -100;
removeChild(Min10_Bullets[k].pBullet);
Min10_Bullets.splice(k, 1);
};
k = (k - 1);
};
a = (Min10_Towers.length - 1);
while (a >= 0) {
if (Min10_Towers[a].pTarget == i){
Min10_Towers[a].pTarget = -1;
};
if (Min10_Towers[a].pTarget > i){
Min10_Towers[a].pTarget = (Min10_Towers[a].pTarget - 1);
};
a = (a - 1);
};
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function Min5_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 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 (gamemode != "paused"){
try {
i = (Towers.length - 1);
while (i >= 0) {
if (Towers[i].pTowerType <= 5){
closest = 5000;
Towers[i].pTarget = -1;
k = (Enemies.length - 1);
while (k >= 0) {
xdist = Math.round(((Towers[i].x + 16) - Enemies[k].x));
ydist = Math.round(((Towers[i].y + 16) - Enemies[k].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < Towers[i].pRange){
if (Enemies[k].pType == 4){
if (Towers[i].pTowerType != 2){
if (Towers[i].pTowerType != 3){
if (Towers[i].pTowerType != 5){
Towers[i].pTarget = k;
};
};
};
};
if (Enemies[k].pType != 4){
Towers[i].pTarget = k;
};
};
k = (k - 1);
};
};
i = (i - 1);
};
a = (Towers.length - 1);
while (a >= 0) {
if (Towers[a].pTowerType <= 5){
if (Enemies.length > 0){
if (Towers[a].pTarget != -1){
if (Enemies[Towers[a].pTarget].pHealth > 0){
xdist = Math.round(((Towers[a].x + 16) - Enemies[Towers[a].pTarget].x));
ydist = Math.round(((Towers[a].y + 16) - Enemies[Towers[a].pTarget].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < Towers[a].pRange){
if (Enemies[Towers[a].pTarget].y > 0){
if (getTimer() > (Towers[a].pLastFire + Towers[a].pSpeed)){
Towers[a].pLastFire = getTimer();
if (Towers[a].pTowerType == 1){
Bullet1 = new script_bullet_arrow(Towers[a].pTarget);
};
if (Towers[a].pTowerType == 2){
Bullet2 = new script_bullet_ice(Towers[a].pTarget);
};
if (Towers[a].pTowerType == 3){
Bullet3 = new script_bullet_arcane(Towers[a].pTarget);
};
if (Towers[a].pTowerType == 4){
Bullet4 = new script_bullet_cannon(Towers[a].pTarget);
};
if (Towers[a].pTowerType == 5){
Bullet5 = new script_bullet_fire(Towers[a].pTarget);
};
if (Towers[a].pTowerType == 1){
Bullet1.x = (Towers[a].x + 16);
Bullet1.y = (Towers[a].y + 16);
Bullet1.pDamage = Towers[a].pDamage;
Bullet1.pBullet = Bullet1;
addChild(Bullet1);
Bullets.push(Bullet1);
Bullet1.pTower = a;
};
if (Towers[a].pTowerType == 2){
Bullet2.x = (Towers[a].x + 16);
Bullet2.y = (Towers[a].y + 16);
Bullet2.pDamage = Towers[a].pDamage;
Bullet2.pBullet = Bullet2;
addChild(Bullet2);
Bullets.push(Bullet2);
Bullet2.pTower = a;
};
if (Towers[a].pTowerType == 3){
Bullet3.x = (Towers[a].x + 16);
Bullet3.y = (Towers[a].y + 16);
Bullet3.pDamage = Towers[a].pDamage;
Bullet3.pBullet = Bullet3;
addChild(Bullet3);
Bullets.push(Bullet3);
Bullet3.pTower = a;
};
if (Towers[a].pTowerType == 4){
Bullet4.x = (Towers[a].x + 16);
Bullet4.y = (Towers[a].y + 16);
Bullet4.pDamage = Towers[a].pDamage;
Bullet4.pBullet = Bullet4;
addChild(Bullet4);
Bullets.push(Bullet4);
Bullet4.pTower = a;
};
if (Towers[a].pTowerType == 5){
Bullet5.x = (Towers[a].x + 16);
Bullet5.y = (Towers[a].y + 16);
Bullet5.pDamage = Towers[a].pDamage;
Bullet5.pBullet = Bullet5;
addChild(Bullet5);
Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function NP_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
function frame45(){
stop();
HD_LastWave = getTimer();
HD_WaveDelay = 60000;
HD_GameLevel = 0;
HD_SelectedTower = -1;
HD_GameScore = 0;
HD_Gold = 300;
HD_Lives = 25;
HD_PlacedMine = false;
HD_LastGoldUpdate = 0;
HD_GoldUpdateSpeed = 120000;
HD_LastEnemyType = 1;
HD_CurrentSong = 1;
HD_Muted = false;
HD_ButtonClick = new buttonclick();
HD_Ambient1 = new ambient_1();
HD_Ambient2 = new ambient_2();
HD_Ambient3 = new ambient_3();
HD_Ambient4 = new ambient_4();
HD_Ambient5 = new ambient_5();
HD_channel = HD_Ambient1.play(0, 99999);
HD_Enemies = new Array();
HD_Buildings = new Array();
HD_Blizzards = new Array();
HD_HealthBars = new Array();
HD_Towers = new Array();
HD_Bullets = new Array();
HD_AngelsOfDeath = new Array();
HD_gamemode = "none";
addEventListener(Event.ENTER_FRAME, HD_everytime);
nextlevelbutton.addEventListener(MouseEvent.MOUSE_UP, HD_nextlevelbutton_mouse_up);
pausebutton.addEventListener(MouseEvent.MOUSE_UP, HD_pausebutton_mouse_up);
playbutton.addEventListener(MouseEvent.MOUSE_UP, HD_playbutton_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_UP, HD_musicleft_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_OVER, HD_musicleft_mouse_enter);
musicleft.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
musicright.addEventListener(MouseEvent.MOUSE_UP, HD_musicright_mouse_up);
musicright.addEventListener(MouseEvent.MOUSE_OVER, HD_musicright_mouse_enter);
musicright.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
musicmute.addEventListener(MouseEvent.MOUSE_UP, HD_musicmute_mouse_up);
musicmute.addEventListener(MouseEvent.MOUSE_OVER, HD_musicmute_mouse_enter);
musicmute.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OVER, HD_tower_select_arrow_mouse_enter);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OVER, HD_tower_select_cannon_mouse_enter);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OVER, HD_tower_select_ice_mouse_enter);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OVER, HD_tower_select_fire_mouse_enter);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OVER, HD_tower_select_arcane_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OVER, HD_buy_angel_death_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_UP, HD_buy_angel_death_mouse_up);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
select_mine.addEventListener(MouseEvent.MOUSE_OVER, HD_select_mine_mouse_enter);
select_mine.addEventListener(MouseEvent.MOUSE_UP, HD_select_mine_mouse_up);
select_mine.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OVER, HD_buy_blizzard_mouse_enter);
buy_blizzard.addEventListener(MouseEvent.MOUSE_UP, HD_buy_blizzard_mouse_up);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OVER, HD_upgrade_tower_mouse_enter);
upgrade_tower.addEventListener(MouseEvent.MOUSE_UP, HD_upgrade_tower_mouse_up);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_UP, HD_tower_select_arrow_mouse_up);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_UP, HD_tower_select_cannon_mouse_up);
tower_select_ice.addEventListener(MouseEvent.MOUSE_UP, HD_tower_select_ice_mouse_up);
tower_select_fire.addEventListener(MouseEvent.MOUSE_UP, HD_tower_select_fire_mouse_up);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_UP, HD_tower_select_arcane_mouse_up);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OUT, HD_tower_select_deselect);
road_1.addEventListener(MouseEvent.MOUSE_UP, HD_road_deselect);
road_2.addEventListener(MouseEvent.MOUSE_UP, HD_road_deselect);
road_3.addEventListener(MouseEvent.MOUSE_UP, HD_road_deselect);
road_4.addEventListener(MouseEvent.MOUSE_UP, HD_road_deselect);
road_5.addEventListener(MouseEvent.MOUSE_UP, HD_road_deselect);
road_6.addEventListener(MouseEvent.MOUSE_UP, HD_road_deselect);
road_7.addEventListener(MouseEvent.MOUSE_UP, HD_road_deselect);
road_8.addEventListener(MouseEvent.MOUSE_UP, HD_road_deselect);
road_9.addEventListener(MouseEvent.MOUSE_UP, HD_road_deselect);
road_10.addEventListener(MouseEvent.MOUSE_UP, HD_road_deselect);
road_11.addEventListener(MouseEvent.MOUSE_UP, HD_road_deselect);
sell_tower.addEventListener(MouseEvent.MOUSE_UP, HD_sell_tower_click);
TheGrid1.addEventListener(MouseEvent.MOUSE_UP, HD_the_grid_place_tower);
TheGrid1.addEventListener(MouseEvent.MOUSE_OVER, HD_the_grid_place_tower_enter);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game3);
}
public function IN_tower_select_arrow_mouse_up(_arg1:MouseEvent):void{
if (IN_gamemode != "paused"){
if (IN_gamemode == "set_tower"){
if (IN_selectedtowertype == "Arrow"){
if (IN_Muted == false){
IN_ButtonClick.play();
};
IN_gamemode = "off";
TheGrid1.alpha = 0;
IN_selectedtowertype = "none";
} else {
if (IN_selectedtowertype != "Arrow"){
IN_gamemode = "set_tower";
if (IN_Muted == false){
IN_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
IN_selectedtowertype = "Arrow";
};
};
} else {
if (IN_gamemode != "set_tower"){
IN_gamemode = "set_tower";
if (IN_Muted == false){
IN_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
IN_selectedtowertype = "Arrow";
};
};
};
}
public function 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_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
NPI_gamemode = "paused";
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
playbutton.x = 119;
pausebutton.x = 900;
NPI_PausedTimer1 = getTimer();
_local2 = (NPI_Enemies.length - 1);
while (_local2 >= 0) {
NPI_Enemies[_local2].pPaused = true;
_local2--;
};
}
public function HD_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
if (road_1.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_2.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_3.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_4.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_5.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_6.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_7.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_8.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_9.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_10.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_11.hitTestPoint(_local3, _local4)){
return (true);
};
return (false);
}
function frame55(){
stop();
IN_LastWave = getTimer();
IN_WaveDelay = 60000;
IN_GameLevel = 0;
IN_SelectedTower = -1;
IN_GameScore = 0;
IN_Gold = 300;
IN_Lives = 25;
IN_PlacedMine = false;
IN_LastGoldUpdate = 0;
IN_GoldUpdateSpeed = 120000;
IN_LastEnemyType = 1;
IN_CurrentSong = 1;
IN_Muted = false;
IN_ButtonClick = new buttonclick();
IN_Ambient1 = new ambient_1();
IN_Ambient2 = new ambient_2();
IN_Ambient3 = new ambient_3();
IN_Ambient4 = new ambient_4();
IN_Ambient5 = new ambient_5();
IN_channel = IN_Ambient1.play(0, 99999);
IN_Enemies = new Array();
IN_Buildings = new Array();
IN_Blizzards = new Array();
IN_HealthBars = new Array();
IN_Towers = new Array();
IN_Bullets = new Array();
IN_AngelsOfDeath = new Array();
IN_gamemode = "none";
addEventListener(Event.ENTER_FRAME, IN_everytime);
nextlevelbutton.addEventListener(MouseEvent.MOUSE_UP, IN_nextlevelbutton_mouse_up);
pausebutton.addEventListener(MouseEvent.MOUSE_UP, IN_pausebutton_mouse_up);
playbutton.addEventListener(MouseEvent.MOUSE_UP, IN_playbutton_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_UP, IN_musicleft_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_OVER, IN_musicleft_mouse_enter);
musicleft.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
musicright.addEventListener(MouseEvent.MOUSE_UP, IN_musicright_mouse_up);
musicright.addEventListener(MouseEvent.MOUSE_OVER, IN_musicright_mouse_enter);
musicright.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
musicmute.addEventListener(MouseEvent.MOUSE_UP, IN_musicmute_mouse_up);
musicmute.addEventListener(MouseEvent.MOUSE_OVER, IN_musicmute_mouse_enter);
musicmute.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OVER, IN_tower_select_arrow_mouse_enter);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OVER, IN_tower_select_cannon_mouse_enter);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OVER, IN_tower_select_ice_mouse_enter);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OVER, IN_tower_select_fire_mouse_enter);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OVER, IN_tower_select_arcane_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OVER, IN_buy_angel_death_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_UP, IN_buy_angel_death_mouse_up);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
select_mine.addEventListener(MouseEvent.MOUSE_OVER, IN_select_mine_mouse_enter);
select_mine.addEventListener(MouseEvent.MOUSE_UP, IN_select_mine_mouse_up);
select_mine.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OVER, IN_buy_blizzard_mouse_enter);
buy_blizzard.addEventListener(MouseEvent.MOUSE_UP, IN_buy_blizzard_mouse_up);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OVER, IN_upgrade_tower_mouse_enter);
upgrade_tower.addEventListener(MouseEvent.MOUSE_UP, IN_upgrade_tower_mouse_up);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_UP, IN_tower_select_arrow_mouse_up);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_UP, IN_tower_select_cannon_mouse_up);
tower_select_ice.addEventListener(MouseEvent.MOUSE_UP, IN_tower_select_ice_mouse_up);
tower_select_fire.addEventListener(MouseEvent.MOUSE_UP, IN_tower_select_fire_mouse_up);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_UP, IN_tower_select_arcane_mouse_up);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OUT, IN_tower_select_deselect);
road_1.addEventListener(MouseEvent.MOUSE_UP, IN_road_deselect);
road_2.addEventListener(MouseEvent.MOUSE_UP, IN_road_deselect);
road_3.addEventListener(MouseEvent.MOUSE_UP, IN_road_deselect);
road_4.addEventListener(MouseEvent.MOUSE_UP, IN_road_deselect);
road_5.addEventListener(MouseEvent.MOUSE_UP, IN_road_deselect);
road_6.addEventListener(MouseEvent.MOUSE_UP, IN_road_deselect);
road_7.addEventListener(MouseEvent.MOUSE_UP, IN_road_deselect);
road_8.addEventListener(MouseEvent.MOUSE_UP, IN_road_deselect);
road_9.addEventListener(MouseEvent.MOUSE_UP, IN_road_deselect);
road_10.addEventListener(MouseEvent.MOUSE_UP, IN_road_deselect);
road_11.addEventListener(MouseEvent.MOUSE_UP, IN_road_deselect);
sell_tower.addEventListener(MouseEvent.MOUSE_UP, IN_sell_tower_click);
TheGrid1.addEventListener(MouseEvent.MOUSE_UP, IN_the_grid_place_tower);
TheGrid1.addEventListener(MouseEvent.MOUSE_OVER, IN_the_grid_place_tower_enter);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game4);
}
public function SB_select_mine_mouse_up(_arg1:MouseEvent):void{
if (SB_gamemode != "paused"){
if (SB_gamemode == "set_tower"){
if (SB_selectedtowertype == "Mine"){
if (SB_Muted == false){
SB_ButtonClick.play();
};
SB_gamemode = "off";
TheGrid1.alpha = 0;
SB_selectedtowertype = "none";
} else {
if (SB_selectedtowertype != "Mine"){
SB_gamemode = "set_tower";
if (SB_Muted == false){
SB_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
SB_selectedtowertype = "Mine";
};
};
} else {
if (SB_gamemode != "set_tower"){
SB_gamemode = "set_tower";
if (SB_Muted == false){
SB_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
SB_selectedtowertype = "Mine";
};
};
};
}
function frame50(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame4);
end_hard_score.text = ("Score - " + String(HD_GameScore));
}
public function Min30_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_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
return (false);
}
function frame35(){
stop();
LastWave = getTimer();
WaveDelay = 60000;
GameLevel = 0;
SelectedTower = -1;
GameScore = 0;
Gold = 300;
Lives = 25;
PlacedMine = false;
LastGoldUpdate = 0;
GoldUpdateSpeed = 120000;
LastEnemyType = 1;
CurrentSong = 1;
Muted = false;
ButtonClick = new buttonclick();
Ambient1 = new ambient_1();
Ambient2 = new ambient_2();
Ambient3 = new ambient_3();
Ambient4 = new ambient_4();
Ambient5 = new ambient_5();
channel = Ambient1.play(0, 99999);
Enemies = new Array();
Buildings = new Array();
Blizzards = new Array();
HealthBars = new Array();
Towers = new Array();
Bullets = new Array();
AngelsOfDeath = new Array();
gamemode = "none";
addEventListener(Event.ENTER_FRAME, everytime);
nextlevelbutton.addEventListener(MouseEvent.MOUSE_UP, nextlevelbutton_mouse_up);
pausebutton.addEventListener(MouseEvent.MOUSE_UP, pausebutton_mouse_up);
playbutton.addEventListener(MouseEvent.MOUSE_UP, playbutton_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_UP, musicleft_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_OVER, musicleft_mouse_enter);
musicleft.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
musicright.addEventListener(MouseEvent.MOUSE_UP, musicright_mouse_up);
musicright.addEventListener(MouseEvent.MOUSE_OVER, musicright_mouse_enter);
musicright.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
musicmute.addEventListener(MouseEvent.MOUSE_UP, musicmute_mouse_up);
musicmute.addEventListener(MouseEvent.MOUSE_OVER, musicmute_mouse_enter);
musicmute.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OVER, tower_select_arrow_mouse_enter);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OVER, tower_select_cannon_mouse_enter);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OVER, tower_select_ice_mouse_enter);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OVER, tower_select_fire_mouse_enter);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OVER, tower_select_arcane_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OVER, buy_angel_death_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_UP, buy_angel_death_mouse_up);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
select_mine.addEventListener(MouseEvent.MOUSE_OVER, select_mine_mouse_enter);
select_mine.addEventListener(MouseEvent.MOUSE_UP, select_mine_mouse_up);
select_mine.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OVER, buy_blizzard_mouse_enter);
buy_blizzard.addEventListener(MouseEvent.MOUSE_UP, buy_blizzard_mouse_up);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OVER, upgrade_tower_mouse_enter);
upgrade_tower.addEventListener(MouseEvent.MOUSE_UP, upgrade_tower_mouse_up);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_UP, tower_select_arrow_mouse_up);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_UP, tower_select_cannon_mouse_up);
tower_select_ice.addEventListener(MouseEvent.MOUSE_UP, tower_select_ice_mouse_up);
tower_select_fire.addEventListener(MouseEvent.MOUSE_UP, tower_select_fire_mouse_up);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_UP, tower_select_arcane_mouse_up);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OUT, tower_select_deselect);
road_1.addEventListener(MouseEvent.MOUSE_UP, road_deselect);
road_2.addEventListener(MouseEvent.MOUSE_UP, road_deselect);
road_3.addEventListener(MouseEvent.MOUSE_UP, road_deselect);
road_4.addEventListener(MouseEvent.MOUSE_UP, road_deselect);
road_5.addEventListener(MouseEvent.MOUSE_UP, road_deselect);
road_6.addEventListener(MouseEvent.MOUSE_UP, road_deselect);
road_7.addEventListener(MouseEvent.MOUSE_UP, road_deselect);
road_8.addEventListener(MouseEvent.MOUSE_UP, road_deselect);
road_9.addEventListener(MouseEvent.MOUSE_UP, road_deselect);
road_10.addEventListener(MouseEvent.MOUSE_UP, road_deselect);
road_11.addEventListener(MouseEvent.MOUSE_UP, road_deselect);
sell_tower.addEventListener(MouseEvent.MOUSE_UP, sell_tower_click);
TheGrid1.addEventListener(MouseEvent.MOUSE_UP, the_grid_place_tower);
TheGrid1.addEventListener(MouseEvent.MOUSE_OVER, the_grid_place_tower_enter);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game2);
}
public function HD_musicright_mouse_up(_arg1:MouseEvent):void{
if (HD_Muted == false){
HD_CurrentSong++;
if (HD_CurrentSong == 6){
HD_CurrentSong = 1;
};
HD_channel.stop();
if (HD_CurrentSong == 1){
HD_channel = HD_Ambient1.play(0, 99999);
};
if (HD_CurrentSong == 2){
HD_channel = HD_Ambient2.play(0, 99999);
};
if (HD_CurrentSong == 3){
HD_channel = HD_Ambient3.play(0, 99999);
};
if (HD_CurrentSong == 4){
HD_channel = HD_Ambient4.play(0, 99999);
};
if (HD_CurrentSong == 5){
HD_channel = HD_Ambient5.play(0, 99999);
};
};
}
public function select_mine_mouse_up(_arg1:MouseEvent):void{
if (gamemode != "paused"){
if (gamemode == "set_tower"){
if (selectedtowertype == "Mine"){
if (Muted == false){
ButtonClick.play();
};
gamemode = "off";
TheGrid1.alpha = 0;
selectedtowertype = "none";
} else {
if (selectedtowertype != "Mine"){
gamemode = "set_tower";
if (Muted == false){
ButtonClick.play();
};
TheGrid1.alpha = 0.5;
selectedtowertype = "Mine";
};
};
} else {
if (gamemode != "set_tower"){
gamemode = "set_tower";
if (Muted == false){
ButtonClick.play();
};
TheGrid1.alpha = 0.5;
selectedtowertype = "Mine";
};
};
};
}
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 Min5_tower_select_fire_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Fire Tower (100g)";
text_towerinfo.text = "Low Dmg, Fast Speed. (Magic Damage)";
}
function frame60(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame5);
end_insane_score.text = ("Score - " + String(IN_GameScore));
}
public function 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 HD_everytime(_arg1:Event):void{
var b:int;
var mX:int;
var mY:int;
var didHit:Boolean;
var event = _arg1;
try {
if (HD_gamemode != "paused"){
HD_CheckEnemiesForDirections();
HD_CheckTowerFireBullet();
HD_MoveBullets();
HD_CheckEnemiesForHit();
HD_CheckEnemyHealth();
HD_UpdateEnemyHealthBar();
HD_CheckSelectedTower();
HD_MoveAndCheckAngelsOfDeath();
HD_MoveAndCheckBlizzard();
if (getTimer() > (HD_LastWave + HD_WaveDelay)){
HD_placeenemies();
};
text_next_level.text = String(Math.round((((HD_WaveDelay + HD_LastWave) - getTimer()) / 1000)));
if (HD_PlacedMine == true){
text_next_gold.text = String(Math.round((((HD_GoldUpdateSpeed + HD_LastGoldUpdate) - getTimer()) / 1000)));
if (getTimer() > (HD_LastGoldUpdate + HD_GoldUpdateSpeed)){
HD_Gold = (HD_Gold + (HD_Gold * 0.05));
text_gold.text = String(HD_Gold);
HD_LastGoldUpdate = getTimer();
};
};
if (HD_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
didHit = HD_checkpathcollision(mX, mY);
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF);
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)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (HD_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (HD_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (HD_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
};
if (HD_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (HD_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 150);
TheGrid1.graphics.endFill();
};
};
};
};
b = (HD_Towers.length - 1);
while (b >= 0) {
HD_Towers[b].graphics.clear();
b = (b - 1);
};
drawonme.graphics.clear();
if (HD_SelectedTower != -1){
mX = 0;
mY = 0;
HD_Towers[HD_SelectedTower].graphics.clear();
HD_Towers[HD_SelectedTower].graphics.moveTo(mX, mY);
HD_Towers[HD_SelectedTower].graphics.beginFill(0xFFFFFF, 0.5);
HD_Towers[HD_SelectedTower].graphics.lineTo(mX, mY);
HD_Towers[HD_SelectedTower].graphics.lineTo((mX + 32), mY);
HD_Towers[HD_SelectedTower].graphics.lineTo((mX + 32), (mY + 32));
HD_Towers[HD_SelectedTower].graphics.lineTo(mX, (mY + 32));
HD_Towers[HD_SelectedTower].graphics.endFill();
if (HD_Towers[HD_SelectedTower].pTowerType <= 5){
upgrade_tower.x = 524;
} else {
upgrade_tower.x = 900;
};
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((HD_Towers[HD_SelectedTower].x + 16), (HD_Towers[HD_SelectedTower].y + 16), HD_Towers[HD_SelectedTower].pRange);
drawonme.graphics.endFill();
};
};
} catch(e:TypeError) {
};
}
public function Min5_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 Min10_tower_select_ice_mouse_up(_arg1:MouseEvent):void{
if (Min10_gamemode != "paused"){
if (Min10_gamemode == "set_tower"){
if (Min10_selectedtowertype == "Ice"){
Min10_gamemode = "off";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
TheGrid1.alpha = 0;
Min10_selectedtowertype = "none";
} else {
if (Min10_selectedtowertype != "Ice"){
Min10_gamemode = "set_tower";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min10_selectedtowertype = "Ice";
};
};
} else {
if (Min10_gamemode != "set_tower"){
Min10_gamemode = "set_tower";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min10_selectedtowertype = "Ice";
};
};
};
}
public function Min5_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
if (Min5_gamemode != "paused"){
if (Min5_Towers[Min5_SelectedTower].pLevel < 15){
if (Min5_Gold >= (Min5_Towers[Min5_SelectedTower].pCost * (Min5_Towers[Min5_SelectedTower].pLevel + 1))){
Min5_Gold = (Min5_Gold - (Min5_Towers[Min5_SelectedTower].pCost * (Min5_Towers[Min5_SelectedTower].pLevel + 1)));
text_gold.text = String(Min5_Gold);
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
Min5_Towers[Min5_SelectedTower].pLevel = (Min5_Towers[Min5_SelectedTower].pLevel + 1);
Min5_Towers[Min5_SelectedTower].pDamage = (Min5_Towers[Min5_SelectedTower].pDamage * 1.25);
upgrade_tower.x = 900;
text_towertype.text = (("Upgrade(" + (Min5_Towers[Min5_SelectedTower].pCost * (Min5_Towers[Min5_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_damage.text = ("Tower Damage - " + Math.round(Min5_Towers[Min5_SelectedTower].pDamage));
text_tower_range.text = ("Tower Range - " + Min5_Towers[Min5_SelectedTower].pRange);
text_tower_level.text = ("Tower Level - " + Min5_Towers[Min5_SelectedTower].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((Min5_Towers[Min5_SelectedTower].pLevel * Min5_Towers[Min5_SelectedTower].pCost) * 0.7))));
};
};
};
}
public function Min30_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
Min30_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 119;
Min30_PausedTimer2 = getTimer();
_local2 = (Min30_PausedTimer2 - Min30_PausedTimer1);
_local3 = (Min30_Towers.length - 1);
while (_local3 >= 0) {
Min30_Towers[_local3].pLastFire = (Min30_Towers[_local3].pLastFire + _local2);
_local3--;
};
Min30_TimeLeft = (Min30_TimeLeft + _local2);
Min30_LastGoldUpdate = (Min30_LastGoldUpdate + _local2);
Min30_LastWave = (Min30_LastWave + _local2);
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
_local4 = (Min30_Enemies.length - 1);
while (_local4 >= 0) {
Min30_Enemies[_local4].pPaused = false;
_local4--;
};
}
public function IN_musicleft_mouse_up(_arg1:MouseEvent):void{
if (IN_Muted == false){
IN_CurrentSong--;
if (IN_CurrentSong == 0){
IN_CurrentSong = 5;
};
IN_channel.stop();
if (IN_CurrentSong == 1){
IN_channel = IN_Ambient1.play(0, 99999);
};
if (IN_CurrentSong == 2){
IN_channel = IN_Ambient2.play(0, 99999);
};
if (IN_CurrentSong == 3){
IN_channel = IN_Ambient3.play(0, 99999);
};
if (IN_CurrentSong == 4){
IN_channel = IN_Ambient4.play(0, 99999);
};
if (IN_CurrentSong == 5){
IN_channel = IN_Ambient5.play(0, 99999);
};
};
}
function frame65(){
stop();
Min5_LastWave = getTimer();
Min5_WaveDelay = 60000;
Min5_GameLevel = 0;
Min5_SelectedTower = -1;
Min5_GameScore = 0;
Min5_Gold = 300;
Min5_Lives = 25;
Min5_PlacedMine = false;
Min5_LastGoldUpdate = 0;
Min5_GoldUpdateSpeed = 120000;
Min5_LastEnemyType = 1;
Min5_CurrentSong = 1;
Min5_Muted = false;
Min5_TimeLeft = 300000;
Min5_ButtonClick = new buttonclick();
Min5_Ambient1 = new ambient_1();
Min5_Ambient2 = new ambient_2();
Min5_Ambient3 = new ambient_3();
Min5_Ambient4 = new ambient_4();
Min5_Ambient5 = new ambient_5();
Min5_channel = Min5_Ambient1.play(0, 99999);
Min5_Enemies = new Array();
Min5_Buildings = new Array();
Min5_Blizzards = new Array();
Min5_HealthBars = new Array();
Min5_Towers = new Array();
Min5_Bullets = new Array();
Min5_AngelsOfDeath = new Array();
Min5_gamemode = "none";
Min5_TimeStarted = getTimer();
addEventListener(Event.ENTER_FRAME, Min5_everytime);
nextlevelbutton.addEventListener(MouseEvent.MOUSE_UP, Min5_nextlevelbutton_mouse_up);
pausebutton.addEventListener(MouseEvent.MOUSE_UP, Min5_pausebutton_mouse_up);
playbutton.addEventListener(MouseEvent.MOUSE_UP, Min5_playbutton_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_UP, Min5_musicleft_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_OVER, Min5_musicleft_mouse_enter);
musicleft.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
musicright.addEventListener(MouseEvent.MOUSE_UP, Min5_musicright_mouse_up);
musicright.addEventListener(MouseEvent.MOUSE_OVER, Min5_musicright_mouse_enter);
musicright.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
musicmute.addEventListener(MouseEvent.MOUSE_UP, Min5_musicmute_mouse_up);
musicmute.addEventListener(MouseEvent.MOUSE_OVER, Min5_musicmute_mouse_enter);
musicmute.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OVER, Min5_tower_select_arrow_mouse_enter);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OVER, Min5_tower_select_cannon_mouse_enter);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OVER, Min5_tower_select_ice_mouse_enter);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OVER, Min5_tower_select_fire_mouse_enter);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OVER, Min5_tower_select_arcane_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OVER, Min5_buy_angel_death_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_UP, Min5_buy_angel_death_mouse_up);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
select_mine.addEventListener(MouseEvent.MOUSE_OVER, Min5_select_mine_mouse_enter);
select_mine.addEventListener(MouseEvent.MOUSE_UP, Min5_select_mine_mouse_up);
select_mine.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OVER, Min5_buy_blizzard_mouse_enter);
buy_blizzard.addEventListener(MouseEvent.MOUSE_UP, Min5_buy_blizzard_mouse_up);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OVER, Min5_upgrade_tower_mouse_enter);
upgrade_tower.addEventListener(MouseEvent.MOUSE_UP, Min5_upgrade_tower_mouse_up);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_UP, Min5_tower_select_arrow_mouse_up);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_UP, Min5_tower_select_cannon_mouse_up);
tower_select_ice.addEventListener(MouseEvent.MOUSE_UP, Min5_tower_select_ice_mouse_up);
tower_select_fire.addEventListener(MouseEvent.MOUSE_UP, Min5_tower_select_fire_mouse_up);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_UP, Min5_tower_select_arcane_mouse_up);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OUT, Min5_tower_select_deselect);
road_1.addEventListener(MouseEvent.MOUSE_UP, Min5_road_deselect);
road_2.addEventListener(MouseEvent.MOUSE_UP, Min5_road_deselect);
road_3.addEventListener(MouseEvent.MOUSE_UP, Min5_road_deselect);
road_4.addEventListener(MouseEvent.MOUSE_UP, Min5_road_deselect);
road_5.addEventListener(MouseEvent.MOUSE_UP, Min5_road_deselect);
road_6.addEventListener(MouseEvent.MOUSE_UP, Min5_road_deselect);
road_7.addEventListener(MouseEvent.MOUSE_UP, Min5_road_deselect);
road_8.addEventListener(MouseEvent.MOUSE_UP, Min5_road_deselect);
road_9.addEventListener(MouseEvent.MOUSE_UP, Min5_road_deselect);
road_10.addEventListener(MouseEvent.MOUSE_UP, Min5_road_deselect);
road_11.addEventListener(MouseEvent.MOUSE_UP, Min5_road_deselect);
sell_tower.addEventListener(MouseEvent.MOUSE_UP, Min5_sell_tower_click);
TheGrid1.addEventListener(MouseEvent.MOUSE_UP, Min5_the_grid_place_tower);
TheGrid1.addEventListener(MouseEvent.MOUSE_OVER, Min5_the_grid_place_tower_enter);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game5);
}
function frame70(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame6);
end_5min_score.text = ("Score - " + String(Min5_GameScore));
}
public function SB_road_deselect(_arg1:MouseEvent):void{
TheGrid1.graphics.clear();
TheGrid1.alpha = 0;
SB_gamemode = "none";
SB_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 Min5_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
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 IN_the_grid_place_tower_enter(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (IN_gamemode != "paused"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (IN_selectedtowertype == "Arrow"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (IN_selectedtowertype == "Arcane"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (IN_selectedtowertype == "Cannon"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 125);
drawonme.graphics.endFill();
};
if (IN_selectedtowertype == "Fire"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (IN_selectedtowertype == "Ice"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 150);
drawonme.graphics.endFill();
};
};
};
};
}
public function playnormal(_arg1:MouseEvent):void{
gotoAndStop(35);
}
public function NPH_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (NPH_gamemode != "paused"){
if (NPH_Gold >= 300){
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
NPH_Gold = (NPH_Gold - 300);
text_gold.text = String(NPH_Gold);
_local2 = 0;
while (_local2 < 100) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
NPH_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function IN_CheckEnemiesForHit():void{
var i:int;
var k:int;
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var a:int;
if (IN_gamemode != "paused"){
try {
i = (IN_Enemies.length - 1);
while (i >= 0) {
k = (IN_Bullets.length - 1);
while (k >= 0) {
if (IN_Enemies[i].hitTestObject(IN_Bullets[k])){
IN_Enemies[i].GotHit(IN_Bullets[k].pDamage, IN_Bullets[k].pBulletType);
if (IN_Bullets[k].pBulletType == 2){
if (IN_Enemies[i].pSpeed > 0.3){
IN_Enemies[i].pSpeed = (IN_Enemies[i].pSpeed - 0.2);
};
};
if (IN_Bullets[k].pBulletType == 4){
a = (IN_Enemies.length - 1);
while (a >= 0) {
xdist = Math.round((IN_Bullets[k].x - IN_Enemies[a].x));
ydist = Math.round((IN_Bullets[k].y - IN_Enemies[a].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < 50){
if (a != IN_Bullets[k].pTarget){
IN_Enemies[a].GotHit(((5 * IN_Towers[IN_Bullets[k].pTower].pLevel) * 0.75), 4);
};
};
a = (a - 1);
};
};
IN_Bullets[k].x = -100;
IN_Bullets[k].y = -100;
removeChild(IN_Bullets[k].pBullet);
IN_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function Min5_musicleft_mouse_up(_arg1:MouseEvent):void{
if (Min5_Muted == false){
Min5_CurrentSong--;
if (Min5_CurrentSong == 0){
Min5_CurrentSong = 5;
};
Min5_channel.stop();
if (Min5_CurrentSong == 1){
Min5_channel = Min5_Ambient1.play(0, 99999);
};
if (Min5_CurrentSong == 2){
Min5_channel = Min5_Ambient2.play(0, 99999);
};
if (Min5_CurrentSong == 3){
Min5_channel = Min5_Ambient3.play(0, 99999);
};
if (Min5_CurrentSong == 4){
Min5_channel = Min5_Ambient4.play(0, 99999);
};
if (Min5_CurrentSong == 5){
Min5_channel = Min5_Ambient5.play(0, 99999);
};
};
}
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 IN_tower_select_fire_mouse_up(_arg1:MouseEvent):void{
if (IN_gamemode != "paused"){
if (IN_gamemode == "set_tower"){
if (IN_selectedtowertype == "Fire"){
IN_gamemode = "off";
TheGrid1.alpha = 0;
if (IN_Muted == false){
IN_ButtonClick.play();
};
IN_selectedtowertype = "none";
} else {
if (IN_selectedtowertype != "Fire"){
IN_gamemode = "set_tower";
if (IN_Muted == false){
IN_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
IN_selectedtowertype = "Fire";
};
};
} else {
if (IN_gamemode != "set_tower"){
IN_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (IN_Muted == false){
IN_ButtonClick.play();
};
IN_selectedtowertype = "Fire";
};
};
};
}
public function playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
gamemode = "none";
playbutton.x = 900;
pausebutton.x = 119;
PausedTimer2 = getTimer();
_local2 = (PausedTimer2 - PausedTimer1);
_local3 = (Towers.length - 1);
while (_local3 >= 0) {
Towers[_local3].pLastFire = (Towers[_local3].pLastFire + _local2);
_local3--;
};
LastGoldUpdate = (LastGoldUpdate + _local2);
LastWave = (LastWave + _local2);
if (Muted == false){
ButtonClick.play();
};
_local4 = (Enemies.length - 1);
while (_local4 >= 0) {
Enemies[_local4].pPaused = false;
_local4--;
};
}
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--;
};
};
}
function frame85(){
stop();
Min30_LastWave = getTimer();
Min30_WaveDelay = 60000;
Min30_GameLevel = 0;
Min30_SelectedTower = -1;
Min30_GameScore = 0;
Min30_Gold = 300;
Min30_Lives = 25;
Min30_PlacedMine = false;
Min30_LastGoldUpdate = 0;
Min30_GoldUpdateSpeed = 120000;
Min30_LastEnemyType = 1;
Min30_CurrentSong = 1;
Min30_Muted = false;
Min30_TimeLeft = 1800000;
Min30_ButtonClick = new buttonclick();
Min30_Ambient1 = new ambient_1();
Min30_Ambient2 = new ambient_2();
Min30_Ambient3 = new ambient_3();
Min30_Ambient4 = new ambient_4();
Min30_Ambient5 = new ambient_5();
Min30_channel = Min30_Ambient1.play(0, 99999);
Min30_Enemies = new Array();
Min30_Buildings = new Array();
Min30_Blizzards = new Array();
Min30_HealthBars = new Array();
Min30_Towers = new Array();
Min30_Bullets = new Array();
Min30_AngelsOfDeath = new Array();
Min30_gamemode = "none";
Min30_TimeStarted = getTimer();
addEventListener(Event.ENTER_FRAME, Min30_everytime);
nextlevelbutton.addEventListener(MouseEvent.MOUSE_UP, Min30_nextlevelbutton_mouse_up);
pausebutton.addEventListener(MouseEvent.MOUSE_UP, Min30_pausebutton_mouse_up);
playbutton.addEventListener(MouseEvent.MOUSE_UP, Min30_playbutton_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_UP, Min30_musicleft_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_OVER, Min30_musicleft_mouse_enter);
musicleft.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
musicright.addEventListener(MouseEvent.MOUSE_UP, Min30_musicright_mouse_up);
musicright.addEventListener(MouseEvent.MOUSE_OVER, Min30_musicright_mouse_enter);
musicright.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
musicmute.addEventListener(MouseEvent.MOUSE_UP, Min30_musicmute_mouse_up);
musicmute.addEventListener(MouseEvent.MOUSE_OVER, Min30_musicmute_mouse_enter);
musicmute.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OVER, Min30_tower_select_arrow_mouse_enter);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OVER, Min30_tower_select_cannon_mouse_enter);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OVER, Min30_tower_select_ice_mouse_enter);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OVER, Min30_tower_select_fire_mouse_enter);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OVER, Min30_tower_select_arcane_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OVER, Min30_buy_angel_death_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_UP, Min30_buy_angel_death_mouse_up);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
select_mine.addEventListener(MouseEvent.MOUSE_OVER, Min30_select_mine_mouse_enter);
select_mine.addEventListener(MouseEvent.MOUSE_UP, Min30_select_mine_mouse_up);
select_mine.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OVER, Min30_buy_blizzard_mouse_enter);
buy_blizzard.addEventListener(MouseEvent.MOUSE_UP, Min30_buy_blizzard_mouse_up);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OVER, Min30_upgrade_tower_mouse_enter);
upgrade_tower.addEventListener(MouseEvent.MOUSE_UP, Min30_upgrade_tower_mouse_up);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_UP, Min30_tower_select_arrow_mouse_up);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_UP, Min30_tower_select_cannon_mouse_up);
tower_select_ice.addEventListener(MouseEvent.MOUSE_UP, Min30_tower_select_ice_mouse_up);
tower_select_fire.addEventListener(MouseEvent.MOUSE_UP, Min30_tower_select_fire_mouse_up);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_UP, Min30_tower_select_arcane_mouse_up);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OUT, Min30_tower_select_deselect);
road_1.addEventListener(MouseEvent.MOUSE_UP, Min30_road_deselect);
road_2.addEventListener(MouseEvent.MOUSE_UP, Min30_road_deselect);
road_3.addEventListener(MouseEvent.MOUSE_UP, Min30_road_deselect);
road_4.addEventListener(MouseEvent.MOUSE_UP, Min30_road_deselect);
road_5.addEventListener(MouseEvent.MOUSE_UP, Min30_road_deselect);
road_6.addEventListener(MouseEvent.MOUSE_UP, Min30_road_deselect);
road_7.addEventListener(MouseEvent.MOUSE_UP, Min30_road_deselect);
road_8.addEventListener(MouseEvent.MOUSE_UP, Min30_road_deselect);
road_9.addEventListener(MouseEvent.MOUSE_UP, Min30_road_deselect);
road_10.addEventListener(MouseEvent.MOUSE_UP, Min30_road_deselect);
road_11.addEventListener(MouseEvent.MOUSE_UP, Min30_road_deselect);
sell_tower.addEventListener(MouseEvent.MOUSE_UP, Min30_sell_tower_click);
TheGrid1.addEventListener(MouseEvent.MOUSE_UP, Min30_the_grid_place_tower);
TheGrid1.addEventListener(MouseEvent.MOUSE_OVER, Min30_the_grid_place_tower_enter);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game7);
}
public function SB_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = (("Upgrade(" + (SB_Towers[SB_SelectedTower].pCost * (SB_Towers[SB_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
}
public function CheckSelectedTower():void{
var _local1:int;
var _local2:int;
if (gamemode != "paused"){
_local1 = (Towers.length - 1);
while (_local1 >= 0) {
if (Towers[_local1].CheckSelected() == true){
SelectedTower = _local1;
sell_tower.x = 524;
text_tower_damage.x = 495;
text_tower_level.x = 495;
text_tower_range.x = 495;
text_tower_sell.x = 495;
text_tower_damage.text = ("Tower Damage - " + Math.round(Towers[_local1].pDamage));
text_tower_range.text = ("Tower Range - " + Towers[_local1].pRange);
text_tower_level.text = ("Tower Level - " + Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((Towers[_local1].pLevel * Towers[_local1].pCost) * 0.7))));
gamemode = "none";
TheGrid1.alpha = 0;
selectedtowertype = "none";
};
_local1--;
};
_local2 = (Towers.length - 1);
while (_local2 >= 0) {
Towers[_local2].pSelected = false;
_local2--;
};
};
}
public function HD_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(500g)";
text_towerinfo.text = "Calls forth the Angel of Death";
}
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);
};
};
}
function frame95(){
MochiAd.showTimedAd({clip:this.root, id:"d8d892ac1120ac68", res:"640x480"});
}
public function IN_road_deselect(_arg1:MouseEvent):void{
TheGrid1.graphics.clear();
TheGrid1.alpha = 0;
IN_gamemode = "none";
IN_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 SB_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
if (SB_gamemode != "paused"){
if (SB_Towers[SB_SelectedTower].pLevel < 15){
if (SB_Gold >= (SB_Towers[SB_SelectedTower].pCost * (SB_Towers[SB_SelectedTower].pLevel + 1))){
SB_Gold = (SB_Gold - (SB_Towers[SB_SelectedTower].pCost * (SB_Towers[SB_SelectedTower].pLevel + 1)));
text_gold.text = String(SB_Gold);
if (SB_Muted == false){
SB_ButtonClick.play();
};
SB_Towers[SB_SelectedTower].pLevel = (SB_Towers[SB_SelectedTower].pLevel + 1);
SB_Towers[SB_SelectedTower].pDamage = (SB_Towers[SB_SelectedTower].pDamage * 1.25);
upgrade_tower.x = 900;
text_towertype.text = (("Upgrade(" + (SB_Towers[SB_SelectedTower].pCost * (SB_Towers[SB_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_damage.text = ("Tower Damage - " + Math.round(SB_Towers[SB_SelectedTower].pDamage));
text_tower_range.text = ("Tower Range - " + SB_Towers[SB_SelectedTower].pRange);
text_tower_level.text = ("Tower Level - " + SB_Towers[SB_SelectedTower].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((SB_Towers[SB_SelectedTower].pLevel * SB_Towers[SB_SelectedTower].pCost) * 0.7))));
};
};
};
}
public function Min5_CheckEnemiesForHit():void{
var i:int;
var k:int;
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var a:int;
if (Min5_gamemode != "paused"){
try {
i = (Min5_Enemies.length - 1);
while (i >= 0) {
k = (Min5_Bullets.length - 1);
while (k >= 0) {
if (Min5_Enemies[i].hitTestObject(Min5_Bullets[k])){
Min5_Enemies[i].GotHit(Min5_Bullets[k].pDamage, Min5_Bullets[k].pBulletType);
if (Min5_Bullets[k].pBulletType == 2){
if (Min5_Enemies[i].pSpeed > 0.3){
Min5_Enemies[i].pSpeed = (Min5_Enemies[i].pSpeed - 0.2);
};
};
if (Min5_Bullets[k].pBulletType == 4){
a = (Min5_Enemies.length - 1);
while (a >= 0) {
xdist = Math.round((Min5_Bullets[k].x - Min5_Enemies[a].x));
ydist = Math.round((Min5_Bullets[k].y - Min5_Enemies[a].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < 50){
if (a != Min5_Bullets[k].pTarget){
Min5_Enemies[a].GotHit(((5 * Min5_Towers[Min5_Bullets[k].pTower].pLevel) * 0.75), 4);
};
};
a = (a - 1);
};
};
Min5_Bullets[k].x = -100;
Min5_Bullets[k].y = -100;
removeChild(Min5_Bullets[k].pBullet);
Min5_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function IN_tower_select_ice_mouse_up(_arg1:MouseEvent):void{
if (IN_gamemode != "paused"){
if (IN_gamemode == "set_tower"){
if (IN_selectedtowertype == "Ice"){
IN_gamemode = "off";
if (IN_Muted == false){
IN_ButtonClick.play();
};
TheGrid1.alpha = 0;
IN_selectedtowertype = "none";
} else {
if (IN_selectedtowertype != "Ice"){
IN_gamemode = "set_tower";
if (IN_Muted == false){
IN_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
IN_selectedtowertype = "Ice";
};
};
} else {
if (IN_gamemode != "set_tower"){
IN_gamemode = "set_tower";
if (IN_Muted == false){
IN_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
IN_selectedtowertype = "Ice";
};
};
};
}
public function HD_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
HD_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 119;
HD_PausedTimer2 = getTimer();
_local2 = (HD_PausedTimer2 - HD_PausedTimer1);
_local3 = (HD_Towers.length - 1);
while (_local3 >= 0) {
HD_Towers[_local3].pLastFire = (HD_Towers[_local3].pLastFire + _local2);
_local3--;
};
HD_LastGoldUpdate = (HD_LastGoldUpdate + _local2);
HD_LastWave = (HD_LastWave + _local2);
if (HD_Muted == false){
HD_ButtonClick.play();
};
_local4 = (HD_Enemies.length - 1);
while (_local4 >= 0) {
HD_Enemies[_local4].pPaused = false;
_local4--;
};
}
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;
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 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";
};
};
};
}
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 Min5_tower_select_arcane_mouse_up(_arg1:MouseEvent):void{
if (Min5_gamemode != "paused"){
if (Min5_gamemode == "set_tower"){
if (Min5_selectedtowertype == "Arcane"){
Min5_gamemode = "off";
TheGrid1.alpha = 0;
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
Min5_selectedtowertype = "none";
} else {
if (Min5_selectedtowertype != "Arcane"){
Min5_gamemode = "set_tower";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min5_selectedtowertype = "Arcane";
};
};
} else {
if (Min5_gamemode != "set_tower"){
Min5_gamemode = "set_tower";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min5_selectedtowertype = "Arcane";
};
};
};
}
public function SB_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function Min30_placeenemies():void{
var _local1:*;
var _local2:script_enemy_normal;
var _local3:enemy_health_bar;
var _local4:script_enemy_armor;
var _local5:enemy_health_bar;
var _local6:script_enemy_fast;
var _local7:enemy_health_bar;
var _local8:script_enemy_immune;
var _local9:enemy_health_bar;
var _local10:script_enemy_boss;
var _local11:enemy_health_bar;
if (Min30_gamemode != "paused"){
Min30_GameLevel = (Min30_GameLevel + 1);
_local1 = 0;
while (_local1 < 25) {
if (Min30_LastEnemyType == 1){
_local2 = new script_enemy_normal(_local1, Min30_GameLevel, "normal");
addChild(_local2);
Min30_Enemies.push(_local2);
Min30_LastWave = getTimer();
text_level.text = String(Min30_GameLevel);
_local3 = new enemy_health_bar();
_local3.pEnemy = (Min30_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);
Min30_HealthBars.push(_local3);
} else {
if (Min30_LastEnemyType == 2){
_local4 = new script_enemy_armor(_local1, Min30_GameLevel, "normal");
addChild(_local4);
Min30_Enemies.push(_local4);
Min30_LastWave = getTimer();
text_level.text = String(Min30_GameLevel);
_local5 = new enemy_health_bar();
_local5.pEnemy = (Min30_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);
Min30_HealthBars.push(_local5);
} else {
if (Min30_LastEnemyType == 3){
_local6 = new script_enemy_fast(_local1, Min30_GameLevel, "normal");
addChild(_local6);
Min30_Enemies.push(_local6);
Min30_LastWave = getTimer();
text_level.text = String(Min30_GameLevel);
_local7 = new enemy_health_bar();
_local7.pEnemy = (Min30_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);
Min30_HealthBars.push(_local7);
};
};
};
if (Min30_LastEnemyType == 4){
_local8 = new script_enemy_immune(_local1, Min30_GameLevel, "normal");
addChild(_local8);
Min30_Enemies.push(_local8);
Min30_LastWave = getTimer();
text_level.text = String(Min30_GameLevel);
_local9 = new enemy_health_bar();
_local9.pEnemy = (Min30_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);
Min30_HealthBars.push(_local9);
};
_local1++;
};
if (Min30_LastEnemyType == 5){
_local10 = new script_enemy_boss(0, Min30_GameLevel, "insane");
addChild(_local10);
Min30_Enemies.push(_local10);
Min30_LastWave = getTimer();
text_level.text = String(Min30_GameLevel);
_local11 = new enemy_health_bar();
_local11.pEnemy = (Min30_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);
Min30_HealthBars.push(_local11);
};
Min30_LastEnemyType = (Min30_LastEnemyType + 1);
if (Min30_LastEnemyType == 6){
Min30_LastEnemyType = 1;
};
};
}
function frame80(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame7);
end_10min_score.text = ("Score - " + String(Min10_GameScore));
}
public function Min10_everytime(_arg1:Event):void{
var b:int;
var r:int;
var q:int;
var w:int;
var e:int;
var mX:int;
var mY:int;
var didHit:Boolean;
var event = _arg1;
try {
if (Min10_gamemode != "paused"){
Min10_CheckEnemiesForDirections();
Min10_CheckTowerFireBullet();
Min10_MoveBullets();
Min10_CheckEnemiesForHit();
Min10_CheckEnemyHealth();
Min10_UpdateEnemyHealthBar();
Min10_CheckSelectedTower();
Min10_MoveAndCheckAngelsOfDeath();
Min10_MoveAndCheckBlizzard();
if (getTimer() > (Min10_LastWave + Min10_WaveDelay)){
Min10_placeenemies();
};
text_timeleft.text = String(Math.round((((Min10_TimeStarted + Min10_TimeLeft) - getTimer()) / 1000)));
if (Math.round((((Min10_TimeStarted + Min10_TimeLeft) - getTimer()) / 1000)) < 0){
r = (Min10_HealthBars.length - 1);
while (r >= 0) {
removeChild(Min10_HealthBars[r]);
Min10_HealthBars.splice(r, 1);
r = (r - 1);
};
q = (Min10_Bullets.length - 1);
while (q >= 0) {
removeChild(Min10_Bullets[q]);
Min10_Bullets.splice(q, 1);
q = (q - 1);
};
w = (Min10_Towers.length - 1);
while (w >= 0) {
removeChild(Min10_Towers[w]);
Min10_Towers.splice(w, 1);
w = (w - 1);
};
e = (Min10_Enemies.length - 1);
while (e >= 0) {
removeChild(Min10_Enemies[e]);
Min10_Enemies.splice(e, 1);
e = (e - 1);
};
Min10_channel.stop();
gotoAndStop(80);
};
text_next_level.text = String(Math.round((((Min10_WaveDelay + Min10_LastWave) - getTimer()) / 1000)));
if (Min10_PlacedMine == true){
text_next_gold.text = String(Math.round((((Min10_GoldUpdateSpeed + Min10_LastGoldUpdate) - getTimer()) / 1000)));
if (getTimer() > (Min10_LastGoldUpdate + Min10_GoldUpdateSpeed)){
Min10_Gold = (Min10_Gold + (Min10_Gold * 0.05));
text_gold.text = String(Min10_Gold);
Min10_LastGoldUpdate = getTimer();
};
};
if (Min10_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
didHit = Min10_checkpathcollision(mX, mY);
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF);
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)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (Min10_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (Min10_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (Min10_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
};
if (Min10_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (Min10_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 150);
TheGrid1.graphics.endFill();
};
};
};
};
b = (Min10_Towers.length - 1);
while (b >= 0) {
Min10_Towers[b].graphics.clear();
b = (b - 1);
};
drawonme.graphics.clear();
if (Min10_SelectedTower != -1){
mX = 0;
mY = 0;
Min10_Towers[Min10_SelectedTower].graphics.clear();
Min10_Towers[Min10_SelectedTower].graphics.moveTo(mX, mY);
Min10_Towers[Min10_SelectedTower].graphics.beginFill(0xFFFFFF, 0.5);
Min10_Towers[Min10_SelectedTower].graphics.lineTo(mX, mY);
Min10_Towers[Min10_SelectedTower].graphics.lineTo((mX + 32), mY);
Min10_Towers[Min10_SelectedTower].graphics.lineTo((mX + 32), (mY + 32));
Min10_Towers[Min10_SelectedTower].graphics.lineTo(mX, (mY + 32));
Min10_Towers[Min10_SelectedTower].graphics.endFill();
if (Min10_Towers[Min10_SelectedTower].pTowerType <= 5){
upgrade_tower.x = 524;
} else {
upgrade_tower.x = 900;
};
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((Min10_Towers[Min10_SelectedTower].x + 16), (Min10_Towers[Min10_SelectedTower].y + 16), Min10_Towers[Min10_SelectedTower].pRange);
drawonme.graphics.endFill();
};
};
} catch(e:TypeError) {
};
}
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_LastGoldUpdate = 0;
NP_GoldUpdateSpeed = 120000;
NP_LastEnemyType = 1;
NP_Map = [];
NP_MapStart = new Point(2, 1);
NP_MapEnd = new Point(14, 14);
NP_CurrentSong = 1;
NP_Muted = false;
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_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);
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_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);
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);
TheGrid1.addEventListener(MouseEvent.MOUSE_OVER, NP_the_grid_place_tower_enter);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game9);
}
public function HD_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
HD_gamemode = "paused";
if (HD_Muted == false){
HD_ButtonClick.play();
};
playbutton.x = 119;
pausebutton.x = 900;
HD_PausedTimer1 = getTimer();
_local2 = (HD_Enemies.length - 1);
while (_local2 >= 0) {
HD_Enemies[_local2].pPaused = true;
_local2--;
};
}
function frame110(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame9);
end_nopath_score.text = ("Score - " + String(NP_GameScore));
}
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 Min30_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 5% Of Your Gold Every 2 mins. Limit 1.";
}
public function Min30_sell_tower_click(_arg1:MouseEvent):void{
if (Min30_gamemode != "paused"){
if (Min30_SelectedTower != -1){
if (Min30_Towers[Min30_SelectedTower].pTowerType == 10){
Min30_PlacedMine = false;
};
Min30_Gold = (Min30_Gold + int((0.9 * (Min30_Towers[Min30_SelectedTower].pCost * Min30_Towers[Min30_SelectedTower].pLevel))));
text_gold.text = String(Min30_Gold);
removeChild(Min30_Towers[Min30_SelectedTower]);
Min30_Towers.splice(Min30_SelectedTower, 1);
Min30_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 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_LastGoldUpdate = 0;
NPH_GoldUpdateSpeed = 120000;
NPH_LastEnemyType = 1;
NPH_Map = [];
NPH_MapStart = new Point(2, 1);
NPH_MapEnd = new Point(14, 14);
NPH_CurrentSong = 1;
NPH_Muted = false;
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_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);
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_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);
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);
TheGrid1.addEventListener(MouseEvent.MOUSE_OVER, NPH_the_grid_place_tower_enter);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game10);
}
public function Min10_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
if (Min10_gamemode != "paused"){
if (Min10_Towers[Min10_SelectedTower].pLevel < 15){
if (Min10_Gold >= (Min10_Towers[Min10_SelectedTower].pCost * (Min10_Towers[Min10_SelectedTower].pLevel + 1))){
Min10_Gold = (Min10_Gold - (Min10_Towers[Min10_SelectedTower].pCost * (Min10_Towers[Min10_SelectedTower].pLevel + 1)));
text_gold.text = String(Min10_Gold);
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
Min10_Towers[Min10_SelectedTower].pLevel = (Min10_Towers[Min10_SelectedTower].pLevel + 1);
Min10_Towers[Min10_SelectedTower].pDamage = (Min10_Towers[Min10_SelectedTower].pDamage * 1.25);
upgrade_tower.x = 900;
text_towertype.text = (("Upgrade(" + (Min10_Towers[Min10_SelectedTower].pCost * (Min10_Towers[Min10_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_damage.text = ("Tower Damage - " + Math.round(Min10_Towers[Min10_SelectedTower].pDamage));
text_tower_range.text = ("Tower Range - " + Min10_Towers[Min10_SelectedTower].pRange);
text_tower_level.text = ("Tower Level - " + Min10_Towers[Min10_SelectedTower].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((Min10_Towers[Min10_SelectedTower].pLevel * Min10_Towers[Min10_SelectedTower].pCost) * 0.7))));
};
};
};
}
public function IN_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_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
return (false);
}
public function HD_placeenemies():void{
var _local1:*;
var _local2:script_enemy_normal;
var _local3:enemy_health_bar;
var _local4:script_enemy_armor;
var _local5:enemy_health_bar;
var _local6:script_enemy_fast;
var _local7:enemy_health_bar;
var _local8:script_enemy_immune;
var _local9:enemy_health_bar;
var _local10:script_enemy_boss;
var _local11:enemy_health_bar;
if (HD_gamemode != "paused"){
HD_GameLevel = (HD_GameLevel + 1);
_local1 = 0;
while (_local1 < 25) {
if (HD_LastEnemyType == 1){
_local2 = new script_enemy_normal(_local1, HD_GameLevel, "hard");
addChild(_local2);
HD_Enemies.push(_local2);
HD_LastWave = getTimer();
text_level.text = String(HD_GameLevel);
_local3 = new enemy_health_bar();
_local3.pEnemy = (HD_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);
HD_HealthBars.push(_local3);
} else {
if (HD_LastEnemyType == 2){
_local4 = new script_enemy_armor(_local1, HD_GameLevel, "hard");
addChild(_local4);
HD_Enemies.push(_local4);
HD_LastWave = getTimer();
text_level.text = String(HD_GameLevel);
_local5 = new enemy_health_bar();
_local5.pEnemy = (HD_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);
HD_HealthBars.push(_local5);
} else {
if (HD_LastEnemyType == 3){
_local6 = new script_enemy_fast(_local1, HD_GameLevel, "hard");
addChild(_local6);
HD_Enemies.push(_local6);
HD_LastWave = getTimer();
text_level.text = String(HD_GameLevel);
_local7 = new enemy_health_bar();
_local7.pEnemy = (HD_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);
HD_HealthBars.push(_local7);
};
};
};
if (HD_LastEnemyType == 4){
_local8 = new script_enemy_immune(_local1, HD_GameLevel, "hard");
addChild(_local8);
HD_Enemies.push(_local8);
HD_LastWave = getTimer();
text_level.text = String(HD_GameLevel);
_local9 = new enemy_health_bar();
_local9.pEnemy = (HD_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);
HD_HealthBars.push(_local9);
};
_local1++;
};
if (HD_LastEnemyType == 5){
_local10 = new script_enemy_boss(0, HD_GameLevel, "hard");
addChild(_local10);
HD_Enemies.push(_local10);
HD_LastWave = getTimer();
text_level.text = String(HD_GameLevel);
_local11 = new enemy_health_bar();
_local11.pEnemy = (HD_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);
HD_HealthBars.push(_local11);
};
HD_LastEnemyType = (HD_LastEnemyType + 1);
if (HD_LastEnemyType == 6){
HD_LastEnemyType = 1;
};
};
}
public function NPH_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (NPH_gamemode != "paused"){
if (NPH_Gold >= 500){
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
NPH_Gold = (NPH_Gold - 500);
text_gold.text = String(NPH_Gold);
_local2 = 0;
while (_local2 < 50) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
NPH_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function Min30_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function HD_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = (("Upgrade(" + (HD_Towers[HD_SelectedTower].pCost * (HD_Towers[HD_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
}
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_LastGoldUpdate = 0;
NPI_GoldUpdateSpeed = 120000;
NPI_LastEnemyType = 1;
NPI_Map = [];
NPI_MapStart = new Point(2, 1);
NPI_MapEnd = new Point(14, 14);
NPI_CurrentSong = 1;
NPI_Muted = false;
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_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);
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_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);
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);
TheGrid1.addEventListener(MouseEvent.MOUSE_OVER, NPI_the_grid_place_tower_enter);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game11);
}
public function NPH_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (NPH_gamemode != "paused"){
if (NPH_Enemies.length < 35){
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 Min30_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 select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 5% Of Your Gold Every 2 mins. Limit 1.";
}
public function Min10_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_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;
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;
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;
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;
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;
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;
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 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 the_grid_place_tower_enter(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (gamemode != "paused"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (selectedtowertype == "Arrow"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (selectedtowertype == "Arcane"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (selectedtowertype == "Cannon"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 125);
drawonme.graphics.endFill();
};
if (selectedtowertype == "Fire"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (selectedtowertype == "Ice"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 150);
drawonme.graphics.endFill();
};
};
};
};
}
public function buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (gamemode != "paused"){
if (Gold >= 300){
if (Muted == false){
ButtonClick.play();
};
Gold = (Gold - 300);
text_gold.text = String(Gold);
_local2 = 0;
while (_local2 < 100) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
Blizzards.push(_local3);
_local2++;
};
};
};
}
public function IN_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
if (IN_gamemode != "paused"){
if (IN_Towers[IN_SelectedTower].pLevel < 15){
if (IN_Gold >= (IN_Towers[IN_SelectedTower].pCost * (IN_Towers[IN_SelectedTower].pLevel + 1))){
IN_Gold = (IN_Gold - (IN_Towers[IN_SelectedTower].pCost * (IN_Towers[IN_SelectedTower].pLevel + 1)));
text_gold.text = String(IN_Gold);
if (IN_Muted == false){
IN_ButtonClick.play();
};
IN_Towers[IN_SelectedTower].pLevel = (IN_Towers[IN_SelectedTower].pLevel + 1);
IN_Towers[IN_SelectedTower].pDamage = (IN_Towers[IN_SelectedTower].pDamage * 1.25);
upgrade_tower.x = 900;
text_towertype.text = (("Upgrade(" + (IN_Towers[IN_SelectedTower].pCost * (IN_Towers[IN_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_damage.text = ("Tower Damage - " + Math.round(IN_Towers[IN_SelectedTower].pDamage));
text_tower_range.text = ("Tower Range - " + IN_Towers[IN_SelectedTower].pRange);
text_tower_level.text = ("Tower Level - " + IN_Towers[IN_SelectedTower].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((IN_Towers[IN_SelectedTower].pLevel * IN_Towers[IN_SelectedTower].pCost) * 0.7))));
};
};
};
}
public function IN_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 tower_select_fire_mouse_up(_arg1:MouseEvent):void{
if (gamemode != "paused"){
if (gamemode == "set_tower"){
if (selectedtowertype == "Fire"){
gamemode = "off";
TheGrid1.alpha = 0;
if (Muted == false){
ButtonClick.play();
};
selectedtowertype = "none";
} else {
if (selectedtowertype != "Fire"){
gamemode = "set_tower";
if (Muted == false){
ButtonClick.play();
};
TheGrid1.alpha = 0.5;
selectedtowertype = "Fire";
};
};
} else {
if (gamemode != "set_tower"){
gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (Muted == false){
ButtonClick.play();
};
selectedtowertype = "Fire";
};
};
};
}
public function Min10_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function IN_everytime(_arg1:Event):void{
var b:int;
var mX:int;
var mY:int;
var didHit:Boolean;
var event = _arg1;
try {
if (IN_gamemode != "paused"){
IN_CheckEnemiesForDirections();
IN_CheckTowerFireBullet();
IN_MoveBullets();
IN_CheckEnemiesForHit();
IN_CheckEnemyHealth();
IN_UpdateEnemyHealthBar();
IN_CheckSelectedTower();
IN_MoveAndCheckAngelsOfDeath();
IN_MoveAndCheckBlizzard();
if (getTimer() > (IN_LastWave + IN_WaveDelay)){
IN_placeenemies();
};
text_next_level.text = String(Math.round((((IN_WaveDelay + IN_LastWave) - getTimer()) / 1000)));
if (IN_PlacedMine == true){
text_next_gold.text = String(Math.round((((IN_GoldUpdateSpeed + IN_LastGoldUpdate) - getTimer()) / 1000)));
if (getTimer() > (IN_LastGoldUpdate + IN_GoldUpdateSpeed)){
IN_Gold = (IN_Gold + (IN_Gold * 0.05));
text_gold.text = String(IN_Gold);
IN_LastGoldUpdate = getTimer();
};
};
if (IN_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
didHit = IN_checkpathcollision(mX, mY);
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF);
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)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (IN_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (IN_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (IN_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
};
if (IN_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (IN_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 150);
TheGrid1.graphics.endFill();
};
};
};
};
b = (IN_Towers.length - 1);
while (b >= 0) {
IN_Towers[b].graphics.clear();
b = (b - 1);
};
drawonme.graphics.clear();
if (IN_SelectedTower != -1){
mX = 0;
mY = 0;
IN_Towers[IN_SelectedTower].graphics.clear();
IN_Towers[IN_SelectedTower].graphics.moveTo(mX, mY);
IN_Towers[IN_SelectedTower].graphics.beginFill(0xFFFFFF, 0.5);
IN_Towers[IN_SelectedTower].graphics.lineTo(mX, mY);
IN_Towers[IN_SelectedTower].graphics.lineTo((mX + 32), mY);
IN_Towers[IN_SelectedTower].graphics.lineTo((mX + 32), (mY + 32));
IN_Towers[IN_SelectedTower].graphics.lineTo(mX, (mY + 32));
IN_Towers[IN_SelectedTower].graphics.endFill();
if (IN_Towers[IN_SelectedTower].pTowerType <= 5){
upgrade_tower.x = 524;
} else {
upgrade_tower.x = 900;
};
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((IN_Towers[IN_SelectedTower].x + 16), (IN_Towers[IN_SelectedTower].y + 16), IN_Towers[IN_SelectedTower].pRange);
drawonme.graphics.endFill();
};
};
} catch(e:TypeError) {
};
}
public function musicmute_mouse_up(_arg1:MouseEvent):void{
if (Muted == false){
channel.stop();
Muted = true;
} else {
if (CurrentSong == 1){
channel = Ambient1.play(0, 99999);
};
if (CurrentSong == 2){
channel = Ambient2.play(0, 99999);
};
if (CurrentSong == 3){
channel = Ambient3.play(0, 99999);
};
if (CurrentSong == 4){
channel = Ambient4.play(0, 99999);
};
if (CurrentSong == 5){
channel = Ambient5.play(0, 99999);
};
Muted = false;
};
}
public function Min10_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
Min10_gamemode = "paused";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
playbutton.x = 119;
pausebutton.x = 900;
Min10_PausedTimer1 = getTimer();
_local2 = (Min10_Enemies.length - 1);
while (_local2 >= 0) {
Min10_Enemies[_local2].pPaused = true;
_local2--;
};
}
public function NP_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (NP_gamemode != "paused"){
if (NP_Gold >= 500){
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
NP_Gold = (NP_Gold - 500);
text_gold.text = String(NP_Gold);
_local2 = 0;
while (_local2 < 50) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
NP_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function IN_CheckEnemyHealth():void{
var i:int;
var h:int;
var k:int;
var a:int;
if (IN_gamemode != "paused"){
try {
i = (IN_Enemies.length - 1);
while (i >= 0) {
if (IN_Enemies[i].pHealth <= 0){
IN_Enemies[i].x = -500;
IN_Enemies[i].y = -500;
if (IN_Enemies[i].pType == 5){
IN_Gold = (IN_Gold + Math.round(((1.75 * IN_GameLevel) + 0.5)));
IN_GameScore = (IN_GameScore + 50);
} else {
IN_Gold = (IN_Gold + Math.round(((0.25 * IN_GameLevel) + 0.5)));
IN_GameScore = (IN_GameScore + 10);
};
removeChild(IN_Enemies[i]);
IN_Enemies.splice(i, 1);
text_gold.text = String(IN_Gold);
text_score.text = String(IN_GameScore);
h = (IN_HealthBars.length - 1);
while (h >= 0) {
if (IN_HealthBars[h].pEnemy == i){
IN_HealthBars[h].x = -900;
removeChild(IN_HealthBars[h]);
IN_HealthBars.splice(h, 1);
};
if (IN_HealthBars[h].pEnemy > i){
IN_HealthBars[h].pEnemy = (IN_HealthBars[h].pEnemy - 1);
};
h = (h - 1);
};
k = (IN_Bullets.length - 1);
while (k >= 0) {
if (k != i){
if (IN_Bullets[k].pTarget > i){
IN_Bullets[k].pTarget = (IN_Bullets[k].pTarget - 1);
};
};
if (IN_Bullets[k].pTarget == i){
IN_Bullets[k].x = -100;
IN_Bullets[k].y = -100;
removeChild(IN_Bullets[k].pBullet);
IN_Bullets.splice(k, 1);
};
k = (k - 1);
};
a = (IN_Towers.length - 1);
while (a >= 0) {
if (IN_Towers[a].pTarget == i){
IN_Towers[a].pTarget = -1;
};
if (IN_Towers[a].pTarget > i){
IN_Towers[a].pTarget = (IN_Towers[a].pTarget - 1);
};
a = (a - 1);
};
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function IN_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(500g)";
text_towerinfo.text = "Calls forth the Angel of Death";
}
public function SB_tower_select_ice_mouse_up(_arg1:MouseEvent):void{
if (SB_gamemode != "paused"){
if (SB_gamemode == "set_tower"){
if (SB_selectedtowertype == "Ice"){
SB_gamemode = "off";
if (SB_Muted == false){
SB_ButtonClick.play();
};
TheGrid1.alpha = 0;
SB_selectedtowertype = "none";
} else {
if (SB_selectedtowertype != "Ice"){
SB_gamemode = "set_tower";
if (SB_Muted == false){
SB_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
SB_selectedtowertype = "Ice";
};
};
} else {
if (SB_gamemode != "set_tower"){
SB_gamemode = "set_tower";
if (SB_Muted == false){
SB_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
SB_selectedtowertype = "Ice";
};
};
};
}
public function SB_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (SB_gamemode != "paused"){
if (SB_Gold >= 500){
if (SB_Muted == false){
SB_ButtonClick.play();
};
SB_Gold = (SB_Gold - 500);
text_gold.text = String(SB_Gold);
_local2 = 0;
while (_local2 < 50) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
SB_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function Min30_MoveAndCheckBlizzard():void{
var _local1:int;
var _local2:int;
if (Min30_gamemode != "paused"){
_local1 = (Min30_Blizzards.length - 1);
while (_local1 >= 0) {
_local2 = (Min30_Enemies.length - 1);
while (_local2 >= 0) {
if (Min30_Enemies[_local2].hitTestObject(Min30_Blizzards[_local1])){
Min30_Enemies[_local2].pSpeed = 0;
};
_local2--;
};
if (Min30_Blizzards[_local1].y < 0){
drawonme.removeChild(Min30_Blizzards[_local1]);
Min30_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
function frame130(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame11);
end_nopath_insane_score.text = ("Score - " + String(NPI_GameScore));
}
function frame140(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame12);
end_nopath_sandbox_score.text = ("Score - " + String(NPS_GameScore));
}
public function IN_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function SB_CheckEnemyHealth():void{
var i:int;
var h:int;
var k:int;
var a:int;
if (SB_gamemode != "paused"){
try {
i = (SB_Enemies.length - 1);
while (i >= 0) {
if (SB_Enemies[i].pHealth <= 0){
SB_Enemies[i].x = -500;
SB_Enemies[i].y = -500;
if (SB_Enemies[i].pType == 5){
SB_Gold = (SB_Gold + Math.round(((1.75 * SB_GameLevel) + 0.5)));
SB_GameScore = (SB_GameScore + 50);
} else {
SB_Gold = (SB_Gold + Math.round(((0.25 * SB_GameLevel) + 0.5)));
SB_GameScore = (SB_GameScore + 10);
};
removeChild(SB_Enemies[i]);
SB_Enemies.splice(i, 1);
text_gold.text = String(SB_Gold);
text_score.text = String(SB_GameScore);
h = (SB_HealthBars.length - 1);
while (h >= 0) {
if (SB_HealthBars[h].pEnemy == i){
SB_HealthBars[h].x = -900;
removeChild(SB_HealthBars[h]);
SB_HealthBars.splice(h, 1);
};
if (SB_HealthBars[h].pEnemy > i){
SB_HealthBars[h].pEnemy = (SB_HealthBars[h].pEnemy - 1);
};
h = (h - 1);
};
k = (SB_Bullets.length - 1);
while (k >= 0) {
if (k != i){
if (SB_Bullets[k].pTarget > i){
SB_Bullets[k].pTarget = (SB_Bullets[k].pTarget - 1);
};
};
if (SB_Bullets[k].pTarget == i){
SB_Bullets[k].x = -100;
SB_Bullets[k].y = -100;
removeChild(SB_Bullets[k].pBullet);
SB_Bullets.splice(k, 1);
};
k = (k - 1);
};
a = (SB_Towers.length - 1);
while (a >= 0) {
if (SB_Towers[a].pTarget == i){
SB_Towers[a].pTarget = -1;
};
if (SB_Towers[a].pTarget > i){
SB_Towers[a].pTarget = (SB_Towers[a].pTarget - 1);
};
a = (a - 1);
};
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
function frame120(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame10);
end_nopath_hard_score.text = ("Score - " + String(NPH_GameScore));
}
public function buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (gamemode != "paused"){
if (Gold >= 500){
if (Muted == false){
ButtonClick.play();
};
Gold = (Gold - 500);
text_gold.text = String(Gold);
_local2 = 0;
while (_local2 < 50) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function CheckEnemyHealth():void{
var i:int;
var h:int;
var k:int;
var a:int;
if (gamemode != "paused"){
try {
i = (Enemies.length - 1);
while (i >= 0) {
if (Enemies[i].pHealth <= 0){
Enemies[i].x = -500;
Enemies[i].y = -500;
if (Enemies[i].pType == 5){
Gold = (Gold + Math.round(((1.75 * GameLevel) + 0.5)));
GameScore = (GameScore + 50);
} else {
Gold = (Gold + Math.round(((0.25 * GameLevel) + 0.5)));
GameScore = (GameScore + 10);
};
removeChild(Enemies[i]);
Enemies.splice(i, 1);
text_gold.text = String(Gold);
text_score.text = String(GameScore);
h = (HealthBars.length - 1);
while (h >= 0) {
if (HealthBars[h].pEnemy == i){
HealthBars[h].x = -900;
removeChild(HealthBars[h]);
HealthBars.splice(h, 1);
};
if (HealthBars[h].pEnemy > i){
HealthBars[h].pEnemy = (HealthBars[h].pEnemy - 1);
};
h = (h - 1);
};
k = (Bullets.length - 1);
while (k >= 0) {
if (k != i){
if (Bullets[k].pTarget > i){
Bullets[k].pTarget = (Bullets[k].pTarget - 1);
};
};
if (Bullets[k].pTarget == i){
Bullets[k].x = -100;
Bullets[k].y = -100;
removeChild(Bullets[k].pBullet);
Bullets.splice(k, 1);
};
k = (k - 1);
};
a = (Towers.length - 1);
while (a >= 0) {
if (Towers[a].pTarget == i){
Towers[a].pTarget = -1;
};
if (Towers[a].pTarget > i){
Towers[a].pTarget = (Towers[a].pTarget - 1);
};
a = (a - 1);
};
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
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;
};
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) {
_local2 = new Point(Math.round((NPI_Enemies[_local4].x / 32)), Math.round((NPI_Enemies[_local4].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local3 = NPI_Enemies[_local4].pSpeed;
NPI_Enemies[_local4].pSpeed = 0;
NPI_Path = Pathfinding.findPath(NPI_Map, _local2.y, _local2.x, NPI_MapEnd.y, NPI_MapEnd.x);
NPI_Enemies[_local4].pSpeed = _local3;
NPI_Enemies[_local4].pPath = NPI_Path;
NPI_Enemies[_local4].mapchange();
_local4--;
};
NPI_Gold = (NPI_Gold + int((0.7 * (NPI_Towers[NPI_SelectedTower].pCost * NPI_Towers[NPI_SelectedTower].pLevel))));
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 frame90(){
stop();
play_game.addEventListener(MouseEvent.MOUSE_UP, playthegame8);
end_30min_score.text = ("Score - " + String(Min30_GameScore));
}
public function Min5_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 (Min5_gamemode != "paused"){
_local1 = (Min5_Enemies.length - 1);
while (_local1 >= 0) {
if (Min5_Enemies[_local1].y > 500){
Min5_Lives = (Min5_Lives - 1);
text_lives.text = String(Min5_Lives);
if (Min5_Lives < 1){
_local5 = (Min5_HealthBars.length - 1);
while (_local5 >= 0) {
removeChild(Min5_HealthBars[_local5]);
Min5_HealthBars.splice(_local5, 1);
_local5--;
};
_local6 = (Min5_Bullets.length - 1);
while (_local6 >= 0) {
removeChild(Min5_Bullets[_local6]);
Min5_Bullets.splice(_local6, 1);
_local6--;
};
_local7 = (Min5_Towers.length - 1);
while (_local7 >= 0) {
removeChild(Min5_Towers[_local7]);
Min5_Towers.splice(_local7, 1);
_local7--;
};
_local8 = (Min5_Enemies.length - 1);
while (_local8 >= 0) {
removeChild(Min5_Enemies[_local8]);
Min5_Enemies.splice(_local8, 1);
_local8--;
};
removeEventListener(Event.ENTER_FRAME, Min5_everytime);
Min5_channel.stop();
gotoAndStop(70);
};
removeChild(Min5_Enemies[_local1]);
Min5_Enemies.splice(_local1, 1);
_local2 = (Min5_HealthBars.length - 1);
while (_local2 >= 0) {
if (Min5_HealthBars[_local2].pEnemy == _local1){
Min5_HealthBars[_local2].x = -900;
removeChild(Min5_HealthBars[_local2]);
Min5_HealthBars.splice(_local2, 1);
};
if (Min5_HealthBars[_local2].pEnemy > _local1){
Min5_HealthBars[_local2].pEnemy = (Min5_HealthBars[_local2].pEnemy - 1);
};
_local2--;
};
_local3 = (Min5_Bullets.length - 1);
while (_local3 >= 0) {
if (Min5_Bullets[_local3].pTarget > _local1){
Min5_Bullets[_local3].pTarget = (Min5_Bullets[_local3].pTarget - 1);
};
if (Min5_Bullets[_local3].pTarget == _local1){
Min5_Bullets[_local3].x = -100;
Min5_Bullets[_local3].y = -100;
removeChild(Min5_Bullets[_local3].pBullet);
Min5_Bullets.splice(_local3, 1);
};
_local3--;
};
_local4 = (Min5_Towers.length - 1);
while (_local4 >= 0) {
if (Min5_Towers[_local4].pTarget == _local1){
Min5_Towers[_local4].pTarget = -1;
};
if (Min5_Towers[_local4].pTarget > _local1){
Min5_Towers[_local4].pTarget = (Min5_Towers[_local4].pTarget - 1);
};
_local4--;
};
};
if (Min5_Enemies[_local1].hitTestObject(tp1)){
Min5_Enemies[_local1].pTheDirection = 2;
};
if (Min5_Enemies[_local1].hitTestObject(tp2)){
Min5_Enemies[_local1].pTheDirection = 1;
};
if (Min5_Enemies[_local1].hitTestObject(tp3)){
Min5_Enemies[_local1].pTheDirection = 3;
};
if (Min5_Enemies[_local1].hitTestObject(tp4)){
Min5_Enemies[_local1].pTheDirection = 1;
};
if (Min5_Enemies[_local1].hitTestObject(tp5)){
Min5_Enemies[_local1].pTheDirection = 2;
};
if (Min5_Enemies[_local1].hitTestObject(tp6)){
Min5_Enemies[_local1].pTheDirection = 4;
};
if (Min5_Enemies[_local1].hitTestObject(tp7)){
Min5_Enemies[_local1].pTheDirection = 2;
};
if (Min5_Enemies[_local1].hitTestObject(tp8)){
Min5_Enemies[_local1].pTheDirection = 1;
};
if (Min5_Enemies[_local1].hitTestObject(tp9)){
Min5_Enemies[_local1].pTheDirection = 3;
};
if (Min5_Enemies[_local1].hitTestObject(tp10)){
Min5_Enemies[_local1].pTheDirection = 1;
};
_local1--;
};
};
}
function frame135(){
stop();
NPS_LastWave = getTimer();
NPS_WaveDelay = 60000;
NPS_GameLevel = 0;
NPS_SelectedTower = -1;
NPS_GameScore = 0;
NPS_Gold = 1000000;
NPS_Lives = 25;
NPS_PlacedMine = false;
NPS_LastGoldUpdate = 0;
NPS_GoldUpdateSpeed = 120000;
NPS_LastEnemyType = 1;
NPS_Map = [];
NPS_MapStart = new Point(2, 1);
NPS_MapEnd = new Point(14, 14);
NPS_CurrentSong = 1;
NPS_Muted = false;
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_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);
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_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);
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);
TheGrid1.addEventListener(MouseEvent.MOUSE_OVER, NPS_the_grid_place_tower_enter);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game12);
}
public function IN_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(300g)";
text_towerinfo.text = "Calls forth a Blizzard";
}
public function HD_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(300g)";
text_towerinfo.text = "Calls forth a Blizzard";
}
public function HD_UpdateEnemyHealthBar():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (HD_gamemode != "paused"){
_local3 = (HD_HealthBars.length - 1);
while (_local3 >= 0) {
_local1 = (HD_Enemies[HD_HealthBars[_local3].pEnemy].pHealth / HD_Enemies[HD_HealthBars[_local3].pEnemy].pStartHealth);
_local1 = (_local1 * 100);
_local2 = ((27 * _local1) / 100);
HD_HealthBars[_local3].x = (HD_Enemies[HD_HealthBars[_local3].pEnemy].x - 13);
HD_HealthBars[_local3].y = (HD_Enemies[HD_HealthBars[_local3].pEnemy].y - 16);
HD_HealthBars[_local3].pWidth = _local2;
HD_HealthBars[_local3].width = _local2;
_local3--;
};
};
}
public function SB_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
SB_gamemode = "paused";
if (SB_Muted == false){
SB_ButtonClick.play();
};
playbutton.x = 119;
pausebutton.x = 900;
SB_PausedTimer1 = getTimer();
_local2 = (SB_Enemies.length - 1);
while (_local2 >= 0) {
SB_Enemies[_local2].pPaused = true;
_local2--;
};
}
public function playhard(_arg1:MouseEvent):void{
gotoAndStop(45);
}
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();
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.05));
text_gold.text = String(NP_Gold);
NP_LastGoldUpdate = getTimer();
};
};
if (NP_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
didHit = NP_checkpathcollision(mX, mY);
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF);
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)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (NP_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NP_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NP_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
};
if (NP_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NP_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 150);
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 pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
gamemode = "paused";
if (Muted == false){
ButtonClick.play();
};
playbutton.x = 119;
pausebutton.x = 900;
PausedTimer1 = getTimer();
_local2 = (Enemies.length - 1);
while (_local2 >= 0) {
Enemies[_local2].pPaused = true;
_local2--;
};
}
public function IN_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (IN_gamemode != "paused"){
if (IN_Gold >= 300){
if (IN_Muted == false){
IN_ButtonClick.play();
};
IN_Gold = (IN_Gold - 300);
text_gold.text = String(IN_Gold);
_local2 = 0;
while (_local2 < 100) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
IN_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function NP_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (NP_gamemode != "paused"){
if (NP_Enemies.length < 35){
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 Min5_MoveAndCheckBlizzard():void{
var _local1:int;
var _local2:int;
if (Min5_gamemode != "paused"){
_local1 = (Min5_Blizzards.length - 1);
while (_local1 >= 0) {
_local2 = (Min5_Enemies.length - 1);
while (_local2 >= 0) {
if (Min5_Enemies[_local2].hitTestObject(Min5_Blizzards[_local1])){
Min5_Enemies[_local2].pSpeed = 0;
};
_local2--;
};
if (Min5_Blizzards[_local1].y < 0){
drawonme.removeChild(Min5_Blizzards[_local1]);
Min5_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
public function NP_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 5% Of Your Gold Every 2 mins. Limit 1.";
}
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 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();
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.05));
text_gold.text = String(NPH_Gold);
NPH_LastGoldUpdate = getTimer();
};
};
if (NPH_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
didHit = NPH_checkpathcollision(mX, mY);
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF);
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)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (NPH_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NPH_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NPH_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
};
if (NPH_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NPH_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 150);
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 SB_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (SB_gamemode != "paused"){
if (SB_Enemies.length < 35){
if (SB_GameLevel != 0){
SB_GameScore = (SB_GameScore + Math.round((((SB_WaveDelay + SB_LastWave) - getTimer()) / 1000)));
text_score.text = String(SB_GameScore);
};
if (SB_Muted == false){
SB_ButtonClick.play();
};
SB_placeenemies();
};
};
}
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 IN_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 Min30_MoveBullets():void{
var i:int;
var a:int;
if (Min30_gamemode != "paused"){
try {
i = (Min30_Bullets.length - 1);
while (i >= 0) {
Min30_Bullets[i].movebullet(Min30_Enemies[Min30_Bullets[i].pTarget].x, Min30_Enemies[Min30_Bullets[i].pTarget].y);
i = (i - 1);
};
} catch(e:TypeError) {
a = (Min30_Bullets.length - 1);
while (a >= 0) {
Min30_Bullets[a].x = -900;
Min30_Bullets[a].y = -900;
Min30_Bullets[a].pTarget = -1;
removeChild(Min30_Bullets[a].pBullet);
Min30_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
public function nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (gamemode != "paused"){
if (Enemies.length < 35){
if (GameLevel != 0){
GameScore = (GameScore + Math.round((((WaveDelay + LastWave) - getTimer()) / 1000)));
text_score.text = String(GameScore);
};
if (Muted == false){
ButtonClick.play();
};
placeenemies();
};
};
}
public function HD_tower_select_ice_mouse_up(_arg1:MouseEvent):void{
if (HD_gamemode != "paused"){
if (HD_gamemode == "set_tower"){
if (HD_selectedtowertype == "Ice"){
HD_gamemode = "off";
if (HD_Muted == false){
HD_ButtonClick.play();
};
TheGrid1.alpha = 0;
HD_selectedtowertype = "none";
} else {
if (HD_selectedtowertype != "Ice"){
HD_gamemode = "set_tower";
if (HD_Muted == false){
HD_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
HD_selectedtowertype = "Ice";
};
};
} else {
if (HD_gamemode != "set_tower"){
HD_gamemode = "set_tower";
if (HD_Muted == false){
HD_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
HD_selectedtowertype = "Ice";
};
};
};
}
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 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;
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 NPI_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (NPI_gamemode != "paused"){
if (NPI_Gold >= 300){
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
NPI_Gold = (NPI_Gold - 300);
text_gold.text = String(NPI_Gold);
_local2 = 0;
while (_local2 < 100) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
NPI_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function Min5_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 5% Of Your Gold Every 2 mins. Limit 1.";
}
public function IN_MoveBullets():void{
var i:int;
var a:int;
if (IN_gamemode != "paused"){
try {
i = (IN_Bullets.length - 1);
while (i >= 0) {
IN_Bullets[i].movebullet(IN_Enemies[IN_Bullets[i].pTarget].x, IN_Enemies[IN_Bullets[i].pTarget].y);
i = (i - 1);
};
} catch(e:TypeError) {
a = (IN_Bullets.length - 1);
while (a >= 0) {
IN_Bullets[a].x = -900;
IN_Bullets[a].y = -900;
IN_Bullets[a].pTarget = -1;
removeChild(IN_Bullets[a].pBullet);
IN_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
public function Min10_UpdateEnemyHealthBar():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (Min10_gamemode != "paused"){
_local3 = (Min10_HealthBars.length - 1);
while (_local3 >= 0) {
_local1 = (Min10_Enemies[Min10_HealthBars[_local3].pEnemy].pHealth / Min10_Enemies[Min10_HealthBars[_local3].pEnemy].pStartHealth);
_local1 = (_local1 * 100);
_local2 = ((27 * _local1) / 100);
Min10_HealthBars[_local3].x = (Min10_Enemies[Min10_HealthBars[_local3].pEnemy].x - 13);
Min10_HealthBars[_local3].y = (Min10_Enemies[Min10_HealthBars[_local3].pEnemy].y - 16);
Min10_HealthBars[_local3].pWidth = _local2;
Min10_HealthBars[_local3].width = _local2;
_local3--;
};
};
}
public function MoveBullets():void{
var i:int;
var a:int;
if (gamemode != "paused"){
try {
i = (Bullets.length - 1);
while (i >= 0) {
Bullets[i].movebullet(Enemies[Bullets[i].pTarget].x, Enemies[Bullets[i].pTarget].y);
i = (i - 1);
};
} catch(e:TypeError) {
a = (Bullets.length - 1);
while (a >= 0) {
Bullets[a].x = -900;
Bullets[a].y = -900;
Bullets[a].pTarget = -1;
removeChild(Bullets[a].pBullet);
Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
public function Min30_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function playnopathsinsane(_arg1:MouseEvent):void{
gotoAndStop(125);
}
public function playnopathshard(_arg1:MouseEvent):void{
gotoAndStop(115);
}
public function IN_CheckSelectedTower():void{
var _local1:int;
var _local2:int;
if (IN_gamemode != "paused"){
_local1 = (IN_Towers.length - 1);
while (_local1 >= 0) {
if (IN_Towers[_local1].CheckSelected() == true){
IN_SelectedTower = _local1;
sell_tower.x = 524;
text_tower_damage.x = 495;
text_tower_level.x = 495;
text_tower_range.x = 495;
text_tower_sell.x = 495;
text_tower_damage.text = ("Tower Damage - " + Math.round(IN_Towers[_local1].pDamage));
text_tower_range.text = ("Tower Range - " + IN_Towers[_local1].pRange);
text_tower_level.text = ("Tower Level - " + IN_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((IN_Towers[_local1].pLevel * IN_Towers[_local1].pCost) * 0.7))));
IN_gamemode = "none";
TheGrid1.alpha = 0;
IN_selectedtowertype = "none";
};
_local1--;
};
_local2 = (IN_Towers.length - 1);
while (_local2 >= 0) {
IN_Towers[_local2].pSelected = false;
_local2--;
};
};
}
public function IN_musicright_mouse_up(_arg1:MouseEvent):void{
if (IN_Muted == false){
IN_CurrentSong++;
if (IN_CurrentSong == 6){
IN_CurrentSong = 1;
};
IN_channel.stop();
if (IN_CurrentSong == 1){
IN_channel = IN_Ambient1.play(0, 99999);
};
if (IN_CurrentSong == 2){
IN_channel = IN_Ambient2.play(0, 99999);
};
if (IN_CurrentSong == 3){
IN_channel = IN_Ambient3.play(0, 99999);
};
if (IN_CurrentSong == 4){
IN_channel = IN_Ambient4.play(0, 99999);
};
if (IN_CurrentSong == 5){
IN_channel = IN_Ambient5.play(0, 99999);
};
};
}
public function HD_tower_select_cannon_mouse_up(_arg1:MouseEvent):void{
if (HD_gamemode != "paused"){
if (HD_gamemode == "set_tower"){
if (HD_selectedtowertype == "Cannon"){
HD_gamemode = "off";
TheGrid1.alpha = 0;
if (HD_Muted == false){
HD_ButtonClick.play();
};
HD_selectedtowertype = "none";
} else {
if (HD_selectedtowertype != "Cannon"){
HD_gamemode = "set_tower";
if (HD_Muted == false){
HD_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
HD_selectedtowertype = "Cannon";
};
};
} else {
if (HD_gamemode != "set_tower"){
HD_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (HD_Muted == false){
HD_ButtonClick.play();
};
HD_selectedtowertype = "Cannon";
};
};
};
}
public function playnopathssandbox(_arg1:MouseEvent):void{
gotoAndStop(135);
}
public function IN_MoveAndCheckBlizzard():void{
var _local1:int;
var _local2:int;
if (IN_gamemode != "paused"){
_local1 = (IN_Blizzards.length - 1);
while (_local1 >= 0) {
_local2 = (IN_Enemies.length - 1);
while (_local2 >= 0) {
if (IN_Enemies[_local2].hitTestObject(IN_Blizzards[_local1])){
IN_Enemies[_local2].pSpeed = 0;
};
_local2--;
};
if (IN_Blizzards[_local1].y < 0){
drawonme.removeChild(IN_Blizzards[_local1]);
IN_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
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 Min5_CheckSelectedTower():void{
var _local1:int;
var _local2:int;
if (Min5_gamemode != "paused"){
_local1 = (Min5_Towers.length - 1);
while (_local1 >= 0) {
if (Min5_Towers[_local1].CheckSelected() == true){
Min5_SelectedTower = _local1;
sell_tower.x = 524;
text_tower_damage.x = 495;
text_tower_level.x = 495;
text_tower_range.x = 495;
text_tower_sell.x = 495;
text_tower_damage.text = ("Tower Damage - " + Math.round(Min5_Towers[_local1].pDamage));
text_tower_range.text = ("Tower Range - " + Min5_Towers[_local1].pRange);
text_tower_level.text = ("Tower Level - " + Min5_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((Min5_Towers[_local1].pLevel * Min5_Towers[_local1].pCost) * 0.7))));
Min5_gamemode = "none";
TheGrid1.alpha = 0;
Min5_selectedtowertype = "none";
};
_local1--;
};
_local2 = (Min5_Towers.length - 1);
while (_local2 >= 0) {
Min5_Towers[_local2].pSelected = false;
_local2--;
};
};
}
public function NP_placeenemies():void{
var _local1:*;
var _local2:script_enemy_normal;
var _local3:enemy_health_bar;
var _local4:script_enemy_armor;
var _local5:enemy_health_bar;
var _local6:script_enemy_fast;
var _local7:enemy_health_bar;
var _local8:script_enemy_immune;
var _local9:enemy_health_bar;
var _local10:script_enemy_boss;
var _local11:enemy_health_bar;
if (NP_gamemode != "paused"){
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_normal(_local1, NP_GameLevel, "hard");
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;
} else {
if (NP_LastEnemyType == 2){
_local4 = new script_enemy_armor(_local1, NP_GameLevel, "hard");
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;
} else {
if (NP_LastEnemyType == 3){
_local6 = new script_enemy_fast(_local1, NP_GameLevel, "hard");
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;
};
};
};
if (NP_LastEnemyType == 4){
_local8 = new script_enemy_immune(_local1, NP_GameLevel, "hard");
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;
};
_local1++;
};
if (NP_LastEnemyType == 5){
_local10 = new script_enemy_boss(0, NP_GameLevel, "hard");
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;
};
NP_LastEnemyType = (NP_LastEnemyType + 1);
if (NP_LastEnemyType == 6){
NP_LastEnemyType = 1;
};
};
}
public function SB_UpdateEnemyHealthBar():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (SB_gamemode != "paused"){
_local3 = (SB_HealthBars.length - 1);
while (_local3 >= 0) {
_local1 = (SB_Enemies[SB_HealthBars[_local3].pEnemy].pHealth / SB_Enemies[SB_HealthBars[_local3].pEnemy].pStartHealth);
_local1 = (_local1 * 100);
_local2 = ((27 * _local1) / 100);
SB_HealthBars[_local3].x = (SB_Enemies[SB_HealthBars[_local3].pEnemy].x - 13);
SB_HealthBars[_local3].y = (SB_Enemies[SB_HealthBars[_local3].pEnemy].y - 16);
SB_HealthBars[_local3].pWidth = _local2;
SB_HealthBars[_local3].width = _local2;
_local3--;
};
};
}
public function Min5_CheckEnemyHealth():void{
var i:int;
var h:int;
var k:int;
var a:int;
if (Min5_gamemode != "paused"){
try {
i = (Min5_Enemies.length - 1);
while (i >= 0) {
if (Min5_Enemies[i].pHealth <= 0){
Min5_Enemies[i].x = -500;
Min5_Enemies[i].y = -500;
if (Min5_Enemies[i].pType == 5){
Min5_Gold = (Min5_Gold + Math.round(((1.75 * Min5_GameLevel) + 0.5)));
Min5_GameScore = (Min5_GameScore + 50);
} else {
Min5_Gold = (Min5_Gold + Math.round(((0.25 * Min5_GameLevel) + 0.5)));
Min5_GameScore = (Min5_GameScore + 10);
};
removeChild(Min5_Enemies[i]);
Min5_Enemies.splice(i, 1);
text_gold.text = String(Min5_Gold);
text_score.text = String(Min5_GameScore);
h = (Min5_HealthBars.length - 1);
while (h >= 0) {
if (Min5_HealthBars[h].pEnemy == i){
Min5_HealthBars[h].x = -900;
removeChild(Min5_HealthBars[h]);
Min5_HealthBars.splice(h, 1);
};
if (Min5_HealthBars[h].pEnemy > i){
Min5_HealthBars[h].pEnemy = (Min5_HealthBars[h].pEnemy - 1);
};
h = (h - 1);
};
k = (Min5_Bullets.length - 1);
while (k >= 0) {
if (k != i){
if (Min5_Bullets[k].pTarget > i){
Min5_Bullets[k].pTarget = (Min5_Bullets[k].pTarget - 1);
};
};
if (Min5_Bullets[k].pTarget == i){
Min5_Bullets[k].x = -100;
Min5_Bullets[k].y = -100;
removeChild(Min5_Bullets[k].pBullet);
Min5_Bullets.splice(k, 1);
};
k = (k - 1);
};
a = (Min5_Towers.length - 1);
while (a >= 0) {
if (Min5_Towers[a].pTarget == i){
Min5_Towers[a].pTarget = -1;
};
if (Min5_Towers[a].pTarget > i){
Min5_Towers[a].pTarget = (Min5_Towers[a].pTarget - 1);
};
a = (a - 1);
};
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function SB_musicright_mouse_up(_arg1:MouseEvent):void{
if (SB_Muted == false){
SB_CurrentSong++;
if (SB_CurrentSong == 6){
SB_CurrentSong = 1;
};
SB_channel.stop();
if (SB_CurrentSong == 1){
SB_channel = SB_Ambient1.play(0, 99999);
};
if (SB_CurrentSong == 2){
SB_channel = SB_Ambient2.play(0, 99999);
};
if (SB_CurrentSong == 3){
SB_channel = SB_Ambient3.play(0, 99999);
};
if (SB_CurrentSong == 4){
SB_channel = SB_Ambient4.play(0, 99999);
};
if (SB_CurrentSong == 5){
SB_channel = SB_Ambient5.play(0, 99999);
};
};
}
public function UpdateEnemyHealthBar():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (gamemode != "paused"){
_local3 = (HealthBars.length - 1);
while (_local3 >= 0) {
_local1 = (Enemies[HealthBars[_local3].pEnemy].pHealth / Enemies[HealthBars[_local3].pEnemy].pStartHealth);
_local1 = (_local1 * 100);
_local2 = ((27 * _local1) / 100);
HealthBars[_local3].x = (Enemies[HealthBars[_local3].pEnemy].x - 13);
HealthBars[_local3].y = (Enemies[HealthBars[_local3].pEnemy].y - 16);
HealthBars[_local3].pWidth = _local2;
HealthBars[_local3].width = _local2;
_local3--;
};
};
}
public function HD_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function Min10_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (Min10_gamemode != "paused"){
if (Min10_Gold >= 500){
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
Min10_Gold = (Min10_Gold - 500);
text_gold.text = String(Min10_Gold);
_local2 = 0;
while (_local2 < 50) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
Min10_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function NPH_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
return (false);
}
public function Min5_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function SB_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_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) {
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);
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_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
NPS_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 119;
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_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--;
};
}
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) {
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);
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 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;
if (NP_gamemode != "paused"){
if (NP_gamemode == "set_tower"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
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) {
_local2 = new Point(Math.round((NP_Enemies[_local5].x / 32)), Math.round((NP_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NP_Enemies[_local5].pSpeed;
NP_Enemies[_local5].pSpeed = 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 = new Array();
NP_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NP_Enemies[_local5].x / 32)), Math.round((NP_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NP_Enemies[_local5].pSpeed;
NP_Enemies[_local5].pSpeed = 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 = new Array();
NP_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NP_Enemies[_local5].x / 32)), Math.round((NP_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NP_Enemies[_local5].pSpeed;
NP_Enemies[_local5].pSpeed = 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 = new Array();
NP_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NP_Enemies[_local5].x / 32)), Math.round((NP_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NP_Enemies[_local5].pSpeed;
NP_Enemies[_local5].pSpeed = 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 = new Array();
NP_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NP_Enemies[_local5].x / 32)), Math.round((NP_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NP_Enemies[_local5].pSpeed;
NP_Enemies[_local5].pSpeed = 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 = new Array();
NP_Enemies[_local5].pSpeed = _local4;
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;
text_next_gold.y = (_local12.y + 6);
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) {
_local2 = new Point(Math.round((NP_Enemies[_local5].x / 32)), Math.round((NP_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NP_Enemies[_local5].pSpeed;
NP_Enemies[_local5].pSpeed = 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 = new Array();
NP_Enemies[_local5].pSpeed = _local4;
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 HD_the_grid_place_tower_enter(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (HD_gamemode != "paused"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (HD_selectedtowertype == "Arrow"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (HD_selectedtowertype == "Arcane"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (HD_selectedtowertype == "Cannon"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 125);
drawonme.graphics.endFill();
};
if (HD_selectedtowertype == "Fire"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (HD_selectedtowertype == "Ice"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 150);
drawonme.graphics.endFill();
};
};
};
};
}
public function Min30_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
if (road_1.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_2.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_3.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_4.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_5.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_6.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_7.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_8.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_9.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_10.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_11.hitTestPoint(_local3, _local4)){
return (true);
};
return (false);
}
public function Min30_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 (Min30_gamemode != "paused"){
try {
i = (Min30_Towers.length - 1);
while (i >= 0) {
if (Min30_Towers[i].pTowerType <= 5){
closest = 5000;
Min30_Towers[i].pTarget = -1;
k = (Min30_Enemies.length - 1);
while (k >= 0) {
xdist = Math.round(((Min30_Towers[i].x + 16) - Min30_Enemies[k].x));
ydist = Math.round(((Min30_Towers[i].y + 16) - Min30_Enemies[k].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < Min30_Towers[i].pRange){
if (Min30_Enemies[k].pType == 4){
if (Min30_Towers[i].pTowerType != 2){
if (Min30_Towers[i].pTowerType != 3){
if (Min30_Towers[i].pTowerType != 5){
Min30_Towers[i].pTarget = k;
};
};
};
};
if (Min30_Enemies[k].pType != 4){
Min30_Towers[i].pTarget = k;
};
};
k = (k - 1);
};
};
i = (i - 1);
};
a = (Min30_Towers.length - 1);
while (a >= 0) {
if (Min30_Towers[a].pTowerType <= 5){
if (Min30_Enemies.length > 0){
if (Min30_Towers[a].pTarget != -1){
if (Min30_Enemies[Min30_Towers[a].pTarget].pHealth > 0){
xdist = Math.round(((Min30_Towers[a].x + 16) - Min30_Enemies[Min30_Towers[a].pTarget].x));
ydist = Math.round(((Min30_Towers[a].y + 16) - Min30_Enemies[Min30_Towers[a].pTarget].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < Min30_Towers[a].pRange){
if (Min30_Enemies[Min30_Towers[a].pTarget].y > 0){
if (getTimer() > (Min30_Towers[a].pLastFire + Min30_Towers[a].pSpeed)){
Min30_Towers[a].pLastFire = getTimer();
if (Min30_Towers[a].pTowerType == 1){
Bullet1 = new script_bullet_arrow(Min30_Towers[a].pTarget);
};
if (Min30_Towers[a].pTowerType == 2){
Bullet2 = new script_bullet_ice(Min30_Towers[a].pTarget);
};
if (Min30_Towers[a].pTowerType == 3){
Bullet3 = new script_bullet_arcane(Min30_Towers[a].pTarget);
};
if (Min30_Towers[a].pTowerType == 4){
Bullet4 = new script_bullet_cannon(Min30_Towers[a].pTarget);
};
if (Min30_Towers[a].pTowerType == 5){
Bullet5 = new script_bullet_fire(Min30_Towers[a].pTarget);
};
if (Min30_Towers[a].pTowerType == 1){
Bullet1.x = (Min30_Towers[a].x + 16);
Bullet1.y = (Min30_Towers[a].y + 16);
Bullet1.pDamage = Min30_Towers[a].pDamage;
Bullet1.pBullet = Bullet1;
addChild(Bullet1);
Min30_Bullets.push(Bullet1);
Bullet1.pTower = a;
};
if (Min30_Towers[a].pTowerType == 2){
Bullet2.x = (Min30_Towers[a].x + 16);
Bullet2.y = (Min30_Towers[a].y + 16);
Bullet2.pDamage = Min30_Towers[a].pDamage;
Bullet2.pBullet = Bullet2;
addChild(Bullet2);
Min30_Bullets.push(Bullet2);
Bullet2.pTower = a;
};
if (Min30_Towers[a].pTowerType == 3){
Bullet3.x = (Min30_Towers[a].x + 16);
Bullet3.y = (Min30_Towers[a].y + 16);
Bullet3.pDamage = Min30_Towers[a].pDamage;
Bullet3.pBullet = Bullet3;
addChild(Bullet3);
Min30_Bullets.push(Bullet3);
Bullet3.pTower = a;
};
if (Min30_Towers[a].pTowerType == 4){
Bullet4.x = (Min30_Towers[a].x + 16);
Bullet4.y = (Min30_Towers[a].y + 16);
Bullet4.pDamage = Min30_Towers[a].pDamage;
Bullet4.pBullet = Bullet4;
addChild(Bullet4);
Min30_Bullets.push(Bullet4);
Bullet4.pTower = a;
};
if (Min30_Towers[a].pTowerType == 5){
Bullet5.x = (Min30_Towers[a].x + 16);
Bullet5.y = (Min30_Towers[a].y + 16);
Bullet5.pDamage = Min30_Towers[a].pDamage;
Bullet5.pBullet = Bullet5;
addChild(Bullet5);
Min30_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
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 HD_CheckEnemyHealth():void{
var i:int;
var h:int;
var k:int;
var a:int;
if (HD_gamemode != "paused"){
try {
i = (HD_Enemies.length - 1);
while (i >= 0) {
if (HD_Enemies[i].pHealth <= 0){
HD_Enemies[i].x = -500;
HD_Enemies[i].y = -500;
if (HD_Enemies[i].pType == 5){
HD_Gold = (HD_Gold + Math.round(((1.75 * HD_GameLevel) + 0.5)));
HD_GameScore = (HD_GameScore + 50);
} else {
HD_Gold = (HD_Gold + Math.round(((0.25 * HD_GameLevel) + 0.5)));
HD_GameScore = (HD_GameScore + 10);
};
removeChild(HD_Enemies[i]);
HD_Enemies.splice(i, 1);
text_gold.text = String(HD_Gold);
text_score.text = String(HD_GameScore);
h = (HD_HealthBars.length - 1);
while (h >= 0) {
if (HD_HealthBars[h].pEnemy == i){
HD_HealthBars[h].x = -900;
removeChild(HD_HealthBars[h]);
HD_HealthBars.splice(h, 1);
};
if (HD_HealthBars[h].pEnemy > i){
HD_HealthBars[h].pEnemy = (HD_HealthBars[h].pEnemy - 1);
};
h = (h - 1);
};
k = (HD_Bullets.length - 1);
while (k >= 0) {
if (k != i){
if (HD_Bullets[k].pTarget > i){
HD_Bullets[k].pTarget = (HD_Bullets[k].pTarget - 1);
};
};
if (HD_Bullets[k].pTarget == i){
HD_Bullets[k].x = -100;
HD_Bullets[k].y = -100;
removeChild(HD_Bullets[k].pBullet);
HD_Bullets.splice(k, 1);
};
k = (k - 1);
};
a = (HD_Towers.length - 1);
while (a >= 0) {
if (HD_Towers[a].pTarget == i){
HD_Towers[a].pTarget = -1;
};
if (HD_Towers[a].pTarget > i){
HD_Towers[a].pTarget = (HD_Towers[a].pTarget - 1);
};
a = (a - 1);
};
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
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 = 495;
text_tower_level.x = 495;
text_tower_range.x = 495;
text_tower_sell.x = 495;
text_tower_damage.text = ("Tower Damage - " + Math.round(NP_Towers[_local1].pDamage));
text_tower_range.text = ("Tower Range - " + NP_Towers[_local1].pRange);
text_tower_level.text = ("Tower Level - " + NP_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((NP_Towers[_local1].pLevel * NP_Towers[_local1].pCost) * 0.7))));
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 SB_tower_select_arcane_mouse_up(_arg1:MouseEvent):void{
if (SB_gamemode != "paused"){
if (SB_gamemode == "set_tower"){
if (SB_selectedtowertype == "Arcane"){
SB_gamemode = "off";
TheGrid1.alpha = 0;
if (SB_Muted == false){
SB_ButtonClick.play();
};
SB_selectedtowertype = "none";
} else {
if (SB_selectedtowertype != "Arcane"){
SB_gamemode = "set_tower";
if (SB_Muted == false){
SB_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
SB_selectedtowertype = "Arcane";
};
};
} else {
if (SB_gamemode != "set_tower"){
SB_gamemode = "set_tower";
if (SB_Muted == false){
SB_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
SB_selectedtowertype = "Arcane";
};
};
};
}
public function NPS_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
NPS_gamemode = "paused";
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
playbutton.x = 119;
pausebutton.x = 900;
NPS_PausedTimer1 = getTimer();
_local2 = (NPS_Enemies.length - 1);
while (_local2 >= 0) {
NPS_Enemies[_local2].pPaused = true;
_local2--;
};
}
public function HD_tower_select_fire_mouse_up(_arg1:MouseEvent):void{
if (HD_gamemode != "paused"){
if (HD_gamemode == "set_tower"){
if (HD_selectedtowertype == "Fire"){
HD_gamemode = "off";
TheGrid1.alpha = 0;
if (HD_Muted == false){
HD_ButtonClick.play();
};
HD_selectedtowertype = "none";
} else {
if (HD_selectedtowertype != "Fire"){
HD_gamemode = "set_tower";
if (HD_Muted == false){
HD_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
HD_selectedtowertype = "Fire";
};
};
} else {
if (HD_gamemode != "set_tower"){
HD_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (HD_Muted == false){
HD_ButtonClick.play();
};
HD_selectedtowertype = "Fire";
};
};
};
}
public function Min10_CheckEnemiesForHit():void{
var i:int;
var k:int;
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var a:int;
if (Min10_gamemode != "paused"){
try {
i = (Min10_Enemies.length - 1);
while (i >= 0) {
k = (Min10_Bullets.length - 1);
while (k >= 0) {
if (Min10_Enemies[i].hitTestObject(Min10_Bullets[k])){
Min10_Enemies[i].GotHit(Min10_Bullets[k].pDamage, Min10_Bullets[k].pBulletType);
if (Min10_Bullets[k].pBulletType == 2){
if (Min10_Enemies[i].pSpeed > 0.3){
Min10_Enemies[i].pSpeed = (Min10_Enemies[i].pSpeed - 0.2);
};
};
if (Min10_Bullets[k].pBulletType == 4){
a = (Min10_Enemies.length - 1);
while (a >= 0) {
xdist = Math.round((Min10_Bullets[k].x - Min10_Enemies[a].x));
ydist = Math.round((Min10_Bullets[k].y - Min10_Enemies[a].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < 50){
if (a != Min10_Bullets[k].pTarget){
Min10_Enemies[a].GotHit(((5 * Min10_Towers[Min10_Bullets[k].pTower].pLevel) * 0.75), 4);
};
};
a = (a - 1);
};
};
Min10_Bullets[k].x = -100;
Min10_Bullets[k].y = -100;
removeChild(Min10_Bullets[k].pBullet);
Min10_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function Min10_musicleft_mouse_up(_arg1:MouseEvent):void{
if (Min10_Muted == false){
Min10_CurrentSong--;
if (Min10_CurrentSong == 0){
Min10_CurrentSong = 5;
};
Min10_channel.stop();
if (Min10_CurrentSong == 1){
Min10_channel = Min10_Ambient1.play(0, 99999);
};
if (Min10_CurrentSong == 2){
Min10_channel = Min10_Ambient2.play(0, 99999);
};
if (Min10_CurrentSong == 3){
Min10_channel = Min10_Ambient3.play(0, 99999);
};
if (Min10_CurrentSong == 4){
Min10_channel = Min10_Ambient4.play(0, 99999);
};
if (Min10_CurrentSong == 5){
Min10_channel = Min10_Ambient5.play(0, 99999);
};
};
}
public function SB_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 road_deselect(_arg1:MouseEvent):void{
TheGrid1.graphics.clear();
TheGrid1.alpha = 0;
gamemode = "none";
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_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 Min10_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (Min10_gamemode != "paused"){
if (Min10_Enemies.length < 35){
if (Min10_GameLevel != 0){
Min10_GameScore = (Min10_GameScore + Math.round((((Min10_WaveDelay + Min10_LastWave) - getTimer()) / 1000)));
text_score.text = String(Min10_GameScore);
};
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
Min10_placeenemies();
};
};
}
public function tower_select_arcane_mouse_up(_arg1:MouseEvent):void{
if (gamemode != "paused"){
if (gamemode == "set_tower"){
if (selectedtowertype == "Arcane"){
gamemode = "off";
TheGrid1.alpha = 0;
if (Muted == false){
ButtonClick.play();
};
selectedtowertype = "none";
} else {
if (selectedtowertype != "Arcane"){
gamemode = "set_tower";
if (Muted == false){
ButtonClick.play();
};
TheGrid1.alpha = 0.5;
selectedtowertype = "Arcane";
};
};
} else {
if (gamemode != "set_tower"){
gamemode = "set_tower";
if (Muted == false){
ButtonClick.play();
};
TheGrid1.alpha = 0.5;
selectedtowertype = "Arcane";
};
};
};
}
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 Min10_road_deselect(_arg1:MouseEvent):void{
TheGrid1.graphics.clear();
TheGrid1.alpha = 0;
Min10_gamemode = "none";
Min10_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 Min30_select_mine_mouse_up(_arg1:MouseEvent):void{
if (Min30_gamemode != "paused"){
if (Min30_gamemode == "set_tower"){
if (Min30_selectedtowertype == "Mine"){
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
Min30_gamemode = "off";
TheGrid1.alpha = 0;
Min30_selectedtowertype = "none";
} else {
if (Min30_selectedtowertype != "Mine"){
Min30_gamemode = "set_tower";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min30_selectedtowertype = "Mine";
};
};
} else {
if (Min30_gamemode != "set_tower"){
Min30_gamemode = "set_tower";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min30_selectedtowertype = "Mine";
};
};
};
}
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 Min5_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 IN_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
IN_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 119;
IN_PausedTimer2 = getTimer();
_local2 = (IN_PausedTimer2 - IN_PausedTimer1);
_local3 = (IN_Towers.length - 1);
while (_local3 >= 0) {
IN_Towers[_local3].pLastFire = (IN_Towers[_local3].pLastFire + _local2);
_local3--;
};
IN_LastGoldUpdate = (IN_LastGoldUpdate + _local2);
IN_LastWave = (IN_LastWave + _local2);
if (IN_Muted == false){
IN_ButtonClick.play();
};
_local4 = (IN_Enemies.length - 1);
while (_local4 >= 0) {
IN_Enemies[_local4].pPaused = false;
_local4--;
};
}
public function NPS_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
if (NPS_gamemode != "paused"){
if (NPS_Towers[NPS_SelectedTower].pLevel < 15){
if (NPS_Gold >= (NPS_Towers[NPS_SelectedTower].pCost * (NPS_Towers[NPS_SelectedTower].pLevel + 1))){
NPS_Gold = (NPS_Gold - (NPS_Towers[NPS_SelectedTower].pCost * (NPS_Towers[NPS_SelectedTower].pLevel + 1)));
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].pDamage * 1.25);
upgrade_tower.x = 900;
text_towertype.text = (("Upgrade(" + (NPS_Towers[NPS_SelectedTower].pCost * (NPS_Towers[NPS_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_damage.text = ("Tower Damage - " + Math.round(NPS_Towers[NPS_SelectedTower].pDamage));
text_tower_range.text = ("Tower Range - " + NPS_Towers[NPS_SelectedTower].pRange);
text_tower_level.text = ("Tower Level - " + 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))));
};
};
};
}
public function NP_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function Min30_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 (Min30_gamemode != "paused"){
_local1 = (Min30_Enemies.length - 1);
while (_local1 >= 0) {
if (Min30_Enemies[_local1].y > 500){
Min30_Lives = (Min30_Lives - 1);
text_lives.text = String(Min30_Lives);
if (Min30_Lives < 1){
_local5 = (Min30_HealthBars.length - 1);
while (_local5 >= 0) {
removeChild(Min30_HealthBars[_local5]);
Min30_HealthBars.splice(_local5, 1);
_local5--;
};
_local6 = (Min30_Bullets.length - 1);
while (_local6 >= 0) {
removeChild(Min30_Bullets[_local6]);
Min30_Bullets.splice(_local6, 1);
_local6--;
};
_local7 = (Min30_Towers.length - 1);
while (_local7 >= 0) {
removeChild(Min30_Towers[_local7]);
Min30_Towers.splice(_local7, 1);
_local7--;
};
_local8 = (Min30_Enemies.length - 1);
while (_local8 >= 0) {
removeChild(Min30_Enemies[_local8]);
Min30_Enemies.splice(_local8, 1);
_local8--;
};
removeEventListener(Event.ENTER_FRAME, Min30_everytime);
Min30_channel.stop();
gotoAndStop(90);
};
removeChild(Min30_Enemies[_local1]);
Min30_Enemies.splice(_local1, 1);
_local2 = (Min30_HealthBars.length - 1);
while (_local2 >= 0) {
if (Min30_HealthBars[_local2].pEnemy == _local1){
Min30_HealthBars[_local2].x = -900;
removeChild(Min30_HealthBars[_local2]);
Min30_HealthBars.splice(_local2, 1);
};
if (Min30_HealthBars[_local2].pEnemy > _local1){
Min30_HealthBars[_local2].pEnemy = (Min30_HealthBars[_local2].pEnemy - 1);
};
_local2--;
};
_local3 = (Min30_Bullets.length - 1);
while (_local3 >= 0) {
if (Min30_Bullets[_local3].pTarget > _local1){
Min30_Bullets[_local3].pTarget = (Min30_Bullets[_local3].pTarget - 1);
};
if (Min30_Bullets[_local3].pTarget == _local1){
Min30_Bullets[_local3].x = -100;
Min30_Bullets[_local3].y = -100;
removeChild(Min30_Bullets[_local3].pBullet);
Min30_Bullets.splice(_local3, 1);
};
_local3--;
};
_local4 = (Min30_Towers.length - 1);
while (_local4 >= 0) {
if (Min30_Towers[_local4].pTarget == _local1){
Min30_Towers[_local4].pTarget = -1;
};
if (Min30_Towers[_local4].pTarget > _local1){
Min30_Towers[_local4].pTarget = (Min30_Towers[_local4].pTarget - 1);
};
_local4--;
};
};
if (Min30_Enemies[_local1].hitTestObject(tp1)){
Min30_Enemies[_local1].pTheDirection = 2;
};
if (Min30_Enemies[_local1].hitTestObject(tp2)){
Min30_Enemies[_local1].pTheDirection = 1;
};
if (Min30_Enemies[_local1].hitTestObject(tp3)){
Min30_Enemies[_local1].pTheDirection = 3;
};
if (Min30_Enemies[_local1].hitTestObject(tp4)){
Min30_Enemies[_local1].pTheDirection = 1;
};
if (Min30_Enemies[_local1].hitTestObject(tp5)){
Min30_Enemies[_local1].pTheDirection = 2;
};
if (Min30_Enemies[_local1].hitTestObject(tp6)){
Min30_Enemies[_local1].pTheDirection = 4;
};
if (Min30_Enemies[_local1].hitTestObject(tp7)){
Min30_Enemies[_local1].pTheDirection = 2;
};
if (Min30_Enemies[_local1].hitTestObject(tp8)){
Min30_Enemies[_local1].pTheDirection = 1;
};
if (Min30_Enemies[_local1].hitTestObject(tp9)){
Min30_Enemies[_local1].pTheDirection = 3;
};
if (Min30_Enemies[_local1].hitTestObject(tp10)){
Min30_Enemies[_local1].pTheDirection = 1;
};
_local1--;
};
};
}
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;
if (NPI_gamemode != "paused"){
if (NPI_gamemode == "set_tower"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
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) {
_local2 = new Point(Math.round((NPI_Enemies[_local5].x / 32)), Math.round((NPI_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPI_Enemies[_local5].pSpeed;
NPI_Enemies[_local5].pSpeed = 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 = new Array();
NPI_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPI_Enemies[_local5].x / 32)), Math.round((NPI_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPI_Enemies[_local5].pSpeed;
NPI_Enemies[_local5].pSpeed = 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 = new Array();
NPI_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPI_Enemies[_local5].x / 32)), Math.round((NPI_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPI_Enemies[_local5].pSpeed;
NPI_Enemies[_local5].pSpeed = 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 = new Array();
NPI_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPI_Enemies[_local5].x / 32)), Math.round((NPI_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPI_Enemies[_local5].pSpeed;
NPI_Enemies[_local5].pSpeed = 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 = new Array();
NPI_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPI_Enemies[_local5].x / 32)), Math.round((NPI_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPI_Enemies[_local5].pSpeed;
NPI_Enemies[_local5].pSpeed = 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 = new Array();
NPI_Enemies[_local5].pSpeed = _local4;
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;
text_next_gold.y = (_local12.y + 6);
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) {
_local2 = new Point(Math.round((NPI_Enemies[_local5].x / 32)), Math.round((NPI_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPI_Enemies[_local5].pSpeed;
NPI_Enemies[_local5].pSpeed = 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 = new Array();
NPI_Enemies[_local5].pSpeed = _local4;
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 upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = (("Upgrade(" + (Towers[SelectedTower].pCost * (Towers[SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
}
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) {
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);
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 HD_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 Min10_musicright_mouse_up(_arg1:MouseEvent):void{
if (Min10_Muted == false){
Min10_CurrentSong++;
if (Min10_CurrentSong == 6){
Min10_CurrentSong = 1;
};
Min10_channel.stop();
if (Min10_CurrentSong == 1){
Min10_channel = Min10_Ambient1.play(0, 99999);
};
if (Min10_CurrentSong == 2){
Min10_channel = Min10_Ambient2.play(0, 99999);
};
if (Min10_CurrentSong == 3){
Min10_channel = Min10_Ambient3.play(0, 99999);
};
if (Min10_CurrentSong == 4){
Min10_channel = Min10_Ambient4.play(0, 99999);
};
if (Min10_CurrentSong == 5){
Min10_channel = Min10_Ambient5.play(0, 99999);
};
};
}
public function IN_musicmute_mouse_up(_arg1:MouseEvent):void{
if (IN_Muted == false){
IN_channel.stop();
IN_Muted = true;
} else {
if (IN_CurrentSong == 1){
IN_channel = IN_Ambient1.play(0, 99999);
};
if (IN_CurrentSong == 2){
IN_channel = IN_Ambient2.play(0, 99999);
};
if (IN_CurrentSong == 3){
IN_channel = IN_Ambient3.play(0, 99999);
};
if (IN_CurrentSong == 4){
IN_channel = IN_Ambient4.play(0, 99999);
};
if (IN_CurrentSong == 5){
IN_channel = IN_Ambient5.play(0, 99999);
};
IN_Muted = false;
};
}
public function Min5_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 (Min5_gamemode != "paused"){
try {
i = (Min5_Towers.length - 1);
while (i >= 0) {
if (Min5_Towers[i].pTowerType <= 5){
closest = 5000;
Min5_Towers[i].pTarget = -1;
k = (Min5_Enemies.length - 1);
while (k >= 0) {
xdist = Math.round(((Min5_Towers[i].x + 16) - Min5_Enemies[k].x));
ydist = Math.round(((Min5_Towers[i].y + 16) - Min5_Enemies[k].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < Min5_Towers[i].pRange){
if (Min5_Enemies[k].pType == 4){
if (Min5_Towers[i].pTowerType != 2){
if (Min5_Towers[i].pTowerType != 3){
if (Min5_Towers[i].pTowerType != 5){
Min5_Towers[i].pTarget = k;
};
};
};
};
if (Min5_Enemies[k].pType != 4){
Min5_Towers[i].pTarget = k;
};
};
k = (k - 1);
};
};
i = (i - 1);
};
a = (Min5_Towers.length - 1);
while (a >= 0) {
if (Min5_Towers[a].pTowerType <= 5){
if (Min5_Enemies.length > 0){
if (Min5_Towers[a].pTarget != -1){
if (Min5_Enemies[Min5_Towers[a].pTarget].pHealth > 0){
xdist = Math.round(((Min5_Towers[a].x + 16) - Min5_Enemies[Min5_Towers[a].pTarget].x));
ydist = Math.round(((Min5_Towers[a].y + 16) - Min5_Enemies[Min5_Towers[a].pTarget].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < Min5_Towers[a].pRange){
if (Min5_Enemies[Min5_Towers[a].pTarget].y > 0){
if (getTimer() > (Min5_Towers[a].pLastFire + Min5_Towers[a].pSpeed)){
Min5_Towers[a].pLastFire = getTimer();
if (Min5_Towers[a].pTowerType == 1){
Bullet1 = new script_bullet_arrow(Min5_Towers[a].pTarget);
};
if (Min5_Towers[a].pTowerType == 2){
Bullet2 = new script_bullet_ice(Min5_Towers[a].pTarget);
};
if (Min5_Towers[a].pTowerType == 3){
Bullet3 = new script_bullet_arcane(Min5_Towers[a].pTarget);
};
if (Min5_Towers[a].pTowerType == 4){
Bullet4 = new script_bullet_cannon(Min5_Towers[a].pTarget);
};
if (Min5_Towers[a].pTowerType == 5){
Bullet5 = new script_bullet_fire(Min5_Towers[a].pTarget);
};
if (Min5_Towers[a].pTowerType == 1){
Bullet1.x = (Min5_Towers[a].x + 16);
Bullet1.y = (Min5_Towers[a].y + 16);
Bullet1.pDamage = Min5_Towers[a].pDamage;
Bullet1.pBullet = Bullet1;
addChild(Bullet1);
Min5_Bullets.push(Bullet1);
Bullet1.pTower = a;
};
if (Min5_Towers[a].pTowerType == 2){
Bullet2.x = (Min5_Towers[a].x + 16);
Bullet2.y = (Min5_Towers[a].y + 16);
Bullet2.pDamage = Min5_Towers[a].pDamage;
Bullet2.pBullet = Bullet2;
addChild(Bullet2);
Min5_Bullets.push(Bullet2);
Bullet2.pTower = a;
};
if (Min5_Towers[a].pTowerType == 3){
Bullet3.x = (Min5_Towers[a].x + 16);
Bullet3.y = (Min5_Towers[a].y + 16);
Bullet3.pDamage = Min5_Towers[a].pDamage;
Bullet3.pBullet = Bullet3;
addChild(Bullet3);
Min5_Bullets.push(Bullet3);
Bullet3.pTower = a;
};
if (Min5_Towers[a].pTowerType == 4){
Bullet4.x = (Min5_Towers[a].x + 16);
Bullet4.y = (Min5_Towers[a].y + 16);
Bullet4.pDamage = Min5_Towers[a].pDamage;
Bullet4.pBullet = Bullet4;
addChild(Bullet4);
Min5_Bullets.push(Bullet4);
Bullet4.pTower = a;
};
if (Min5_Towers[a].pTowerType == 5){
Bullet5.x = (Min5_Towers[a].x + 16);
Bullet5.y = (Min5_Towers[a].y + 16);
Bullet5.pDamage = Min5_Towers[a].pDamage;
Bullet5.pBullet = Bullet5;
addChild(Bullet5);
Min5_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function NP_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
NP_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 119;
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_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--;
};
}
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 Min30_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
} catch(e:TypeError) {
};
}
public function NPH_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 5% Of Your Gold Every 2 mins. Limit 1.";
}
public function SB_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
SB_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 119;
SB_PausedTimer2 = getTimer();
_local2 = (SB_PausedTimer2 - SB_PausedTimer1);
_local3 = (SB_Towers.length - 1);
while (_local3 >= 0) {
SB_Towers[_local3].pLastFire = (SB_Towers[_local3].pLastFire + _local2);
_local3--;
};
SB_LastGoldUpdate = (SB_LastGoldUpdate + _local2);
SB_LastWave = (SB_LastWave + _local2);
if (SB_Muted == false){
SB_ButtonClick.play();
};
_local4 = (SB_Enemies.length - 1);
while (_local4 >= 0) {
SB_Enemies[_local4].pPaused = false;
_local4--;
};
}
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 Min10_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 5% Of Your Gold Every 2 mins. Limit 1.";
}
function frame75(){
stop();
Min10_LastWave = getTimer();
Min10_WaveDelay = 60000;
Min10_GameLevel = 0;
Min10_SelectedTower = -1;
Min10_GameScore = 0;
Min10_Gold = 300;
Min10_Lives = 25;
Min10_PlacedMine = false;
Min10_LastGoldUpdate = 0;
Min10_GoldUpdateSpeed = 120000;
Min10_LastEnemyType = 1;
Min10_CurrentSong = 1;
Min10_Muted = false;
Min10_TimeLeft = 600000;
Min10_ButtonClick = new buttonclick();
Min10_Ambient1 = new ambient_1();
Min10_Ambient2 = new ambient_2();
Min10_Ambient3 = new ambient_3();
Min10_Ambient4 = new ambient_4();
Min10_Ambient5 = new ambient_5();
Min10_channel = Min10_Ambient1.play(0, 99999);
Min10_Enemies = new Array();
Min10_Buildings = new Array();
Min10_Blizzards = new Array();
Min10_HealthBars = new Array();
Min10_Towers = new Array();
Min10_Bullets = new Array();
Min10_AngelsOfDeath = new Array();
Min10_gamemode = "none";
Min10_TimeStarted = getTimer();
addEventListener(Event.ENTER_FRAME, Min10_everytime);
nextlevelbutton.addEventListener(MouseEvent.MOUSE_UP, Min10_nextlevelbutton_mouse_up);
pausebutton.addEventListener(MouseEvent.MOUSE_UP, Min10_pausebutton_mouse_up);
playbutton.addEventListener(MouseEvent.MOUSE_UP, Min10_playbutton_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_UP, Min10_musicleft_mouse_up);
musicleft.addEventListener(MouseEvent.MOUSE_OVER, Min10_musicleft_mouse_enter);
musicleft.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
musicright.addEventListener(MouseEvent.MOUSE_UP, Min10_musicright_mouse_up);
musicright.addEventListener(MouseEvent.MOUSE_OVER, Min10_musicright_mouse_enter);
musicright.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
musicmute.addEventListener(MouseEvent.MOUSE_UP, Min10_musicmute_mouse_up);
musicmute.addEventListener(MouseEvent.MOUSE_OVER, Min10_musicmute_mouse_enter);
musicmute.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OVER, Min10_tower_select_arrow_mouse_enter);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OVER, Min10_tower_select_cannon_mouse_enter);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OVER, Min10_tower_select_ice_mouse_enter);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OVER, Min10_tower_select_fire_mouse_enter);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OVER, Min10_tower_select_arcane_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OVER, Min10_buy_angel_death_mouse_enter);
buy_angel_death.addEventListener(MouseEvent.MOUSE_UP, Min10_buy_angel_death_mouse_up);
buy_angel_death.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
select_mine.addEventListener(MouseEvent.MOUSE_OVER, Min10_select_mine_mouse_enter);
select_mine.addEventListener(MouseEvent.MOUSE_UP, Min10_select_mine_mouse_up);
select_mine.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OVER, Min10_buy_blizzard_mouse_enter);
buy_blizzard.addEventListener(MouseEvent.MOUSE_UP, Min10_buy_blizzard_mouse_up);
buy_blizzard.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OVER, Min10_upgrade_tower_mouse_enter);
upgrade_tower.addEventListener(MouseEvent.MOUSE_UP, Min10_upgrade_tower_mouse_up);
upgrade_tower.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_UP, Min10_tower_select_arrow_mouse_up);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_UP, Min10_tower_select_cannon_mouse_up);
tower_select_ice.addEventListener(MouseEvent.MOUSE_UP, Min10_tower_select_ice_mouse_up);
tower_select_fire.addEventListener(MouseEvent.MOUSE_UP, Min10_tower_select_fire_mouse_up);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_UP, Min10_tower_select_arcane_mouse_up);
tower_select_arrow.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
tower_select_cannon.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
tower_select_ice.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
tower_select_fire.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
tower_select_arcane.addEventListener(MouseEvent.MOUSE_OUT, Min10_tower_select_deselect);
road_1.addEventListener(MouseEvent.MOUSE_UP, Min10_road_deselect);
road_2.addEventListener(MouseEvent.MOUSE_UP, Min10_road_deselect);
road_3.addEventListener(MouseEvent.MOUSE_UP, Min10_road_deselect);
road_4.addEventListener(MouseEvent.MOUSE_UP, Min10_road_deselect);
road_5.addEventListener(MouseEvent.MOUSE_UP, Min10_road_deselect);
road_6.addEventListener(MouseEvent.MOUSE_UP, Min10_road_deselect);
road_7.addEventListener(MouseEvent.MOUSE_UP, Min10_road_deselect);
road_8.addEventListener(MouseEvent.MOUSE_UP, Min10_road_deselect);
road_9.addEventListener(MouseEvent.MOUSE_UP, Min10_road_deselect);
road_10.addEventListener(MouseEvent.MOUSE_UP, Min10_road_deselect);
road_11.addEventListener(MouseEvent.MOUSE_UP, Min10_road_deselect);
sell_tower.addEventListener(MouseEvent.MOUSE_UP, Min10_sell_tower_click);
TheGrid1.addEventListener(MouseEvent.MOUSE_UP, Min10_the_grid_place_tower);
TheGrid1.addEventListener(MouseEvent.MOUSE_OVER, Min10_the_grid_place_tower_enter);
restart_button.addEventListener(MouseEvent.MOUSE_UP, restart_game6);
}
public function Min5_musicmute_mouse_up(_arg1:MouseEvent):void{
if (Min5_Muted == false){
Min5_channel.stop();
Min5_Muted = true;
} else {
if (Min5_CurrentSong == 1){
Min5_channel = Min5_Ambient1.play(0, 99999);
};
if (Min5_CurrentSong == 2){
Min5_channel = Min5_Ambient2.play(0, 99999);
};
if (Min5_CurrentSong == 3){
Min5_channel = Min5_Ambient3.play(0, 99999);
};
if (Min5_CurrentSong == 4){
Min5_channel = Min5_Ambient4.play(0, 99999);
};
if (Min5_CurrentSong == 5){
Min5_channel = Min5_Ambient5.play(0, 99999);
};
Min5_Muted = false;
};
}
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 Min5_select_mine_mouse_up(_arg1:MouseEvent):void{
if (Min5_gamemode != "paused"){
if (Min5_gamemode == "set_tower"){
if (Min5_selectedtowertype == "Mine"){
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
Min5_gamemode = "off";
TheGrid1.alpha = 0;
Min5_selectedtowertype = "none";
} else {
if (Min5_selectedtowertype != "Mine"){
Min5_gamemode = "set_tower";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min5_selectedtowertype = "Mine";
};
};
} else {
if (Min5_gamemode != "set_tower"){
Min5_gamemode = "set_tower";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min5_selectedtowertype = "Mine";
};
};
};
}
public function NPS_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
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 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 HD_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 5% Of Your Gold Every 2 mins. Limit 1.";
}
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 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_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function NPH_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(300g)";
text_towerinfo.text = "Calls forth a Blizzard";
}
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) {
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);
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 Min5_MoveAndCheckAngelsOfDeath():void{
var _local1:int;
var _local2:int;
if (Min5_gamemode != "paused"){
_local1 = (Min5_AngelsOfDeath.length - 1);
while (_local1 >= 0) {
_local2 = (Min5_Enemies.length - 1);
while (_local2 >= 0) {
if (Min5_Enemies[_local2].hitTestObject(Min5_AngelsOfDeath[_local1])){
Min5_Enemies[_local2].GotHit(25, 1);
};
_local2--;
};
if (Min5_AngelsOfDeath[_local1].y < 0){
drawonme.removeChild(Min5_AngelsOfDeath[_local1]);
Min5_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
public function Min5_everytime(_arg1:Event):void{
var b:int;
var r:int;
var q:int;
var w:int;
var e:int;
var mX:int;
var mY:int;
var didHit:Boolean;
var event = _arg1;
try {
if (Min5_gamemode != "paused"){
Min5_CheckEnemiesForDirections();
Min5_CheckTowerFireBullet();
Min5_MoveBullets();
Min5_CheckEnemiesForHit();
Min5_CheckEnemyHealth();
Min5_UpdateEnemyHealthBar();
Min5_CheckSelectedTower();
Min5_MoveAndCheckAngelsOfDeath();
Min5_MoveAndCheckBlizzard();
if (getTimer() > (Min5_LastWave + Min5_WaveDelay)){
Min5_placeenemies();
};
text_timeleft.text = String(Math.round((((Min5_TimeStarted + Min5_TimeLeft) - getTimer()) / 1000)));
if (Math.round((((Min5_TimeStarted + Min5_TimeLeft) - getTimer()) / 1000)) < 0){
r = (Min5_HealthBars.length - 1);
while (r >= 0) {
removeChild(Min5_HealthBars[r]);
Min5_HealthBars.splice(r, 1);
r = (r - 1);
};
q = (Min5_Bullets.length - 1);
while (q >= 0) {
removeChild(Min5_Bullets[q]);
Min5_Bullets.splice(q, 1);
q = (q - 1);
};
w = (Min5_Towers.length - 1);
while (w >= 0) {
removeChild(Min5_Towers[w]);
Min5_Towers.splice(w, 1);
w = (w - 1);
};
e = (Min5_Enemies.length - 1);
while (e >= 0) {
removeChild(Min5_Enemies[e]);
Min5_Enemies.splice(e, 1);
e = (e - 1);
};
Min5_channel.stop();
gotoAndStop(70);
};
text_next_level.text = String(Math.round((((Min5_WaveDelay + Min5_LastWave) - getTimer()) / 1000)));
if (Min5_PlacedMine == true){
text_next_gold.text = String(Math.round((((Min5_GoldUpdateSpeed + Min5_LastGoldUpdate) - getTimer()) / 1000)));
if (getTimer() > (Min5_LastGoldUpdate + Min5_GoldUpdateSpeed)){
Min5_Gold = (Min5_Gold + (Min5_Gold * 0.05));
text_gold.text = String(Min5_Gold);
Min5_LastGoldUpdate = getTimer();
};
};
if (Min5_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
didHit = Min5_checkpathcollision(mX, mY);
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF);
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)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (Min5_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (Min5_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (Min5_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
};
if (Min5_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (Min5_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 150);
TheGrid1.graphics.endFill();
};
};
};
};
b = (Min5_Towers.length - 1);
while (b >= 0) {
Min5_Towers[b].graphics.clear();
b = (b - 1);
};
drawonme.graphics.clear();
if (Min5_SelectedTower != -1){
mX = 0;
mY = 0;
Min5_Towers[Min5_SelectedTower].graphics.clear();
Min5_Towers[Min5_SelectedTower].graphics.moveTo(mX, mY);
Min5_Towers[Min5_SelectedTower].graphics.beginFill(0xFFFFFF, 0.5);
Min5_Towers[Min5_SelectedTower].graphics.lineTo(mX, mY);
Min5_Towers[Min5_SelectedTower].graphics.lineTo((mX + 32), mY);
Min5_Towers[Min5_SelectedTower].graphics.lineTo((mX + 32), (mY + 32));
Min5_Towers[Min5_SelectedTower].graphics.lineTo(mX, (mY + 32));
Min5_Towers[Min5_SelectedTower].graphics.endFill();
if (Min5_Towers[Min5_SelectedTower].pTowerType <= 5){
upgrade_tower.x = 524;
} else {
upgrade_tower.x = 900;
};
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((Min5_Towers[Min5_SelectedTower].x + 16), (Min5_Towers[Min5_SelectedTower].y + 16), Min5_Towers[Min5_SelectedTower].pRange);
drawonme.graphics.endFill();
};
};
} catch(e:TypeError) {
};
}
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 < 0){
drawonme.removeChild(NPH_Blizzards[_local1]);
NPH_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
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 Min30_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
if (Min30_gamemode != "paused"){
if (Min30_Towers[Min30_SelectedTower].pLevel < 15){
if (Min30_Gold >= (Min30_Towers[Min30_SelectedTower].pCost * (Min30_Towers[Min30_SelectedTower].pLevel + 1))){
Min30_Gold = (Min30_Gold - (Min30_Towers[Min30_SelectedTower].pCost * (Min30_Towers[Min30_SelectedTower].pLevel + 1)));
text_gold.text = String(Min30_Gold);
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
Min30_Towers[Min30_SelectedTower].pLevel = (Min30_Towers[Min30_SelectedTower].pLevel + 1);
Min30_Towers[Min30_SelectedTower].pDamage = (Min30_Towers[Min30_SelectedTower].pDamage * 1.25);
upgrade_tower.x = 900;
text_towertype.text = (("Upgrade(" + (Min30_Towers[Min30_SelectedTower].pCost * (Min30_Towers[Min30_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_damage.text = ("Tower Damage - " + Math.round(Min30_Towers[Min30_SelectedTower].pDamage));
text_tower_range.text = ("Tower Range - " + Min30_Towers[Min30_SelectedTower].pRange);
text_tower_level.text = ("Tower Level - " + Min30_Towers[Min30_SelectedTower].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((Min30_Towers[Min30_SelectedTower].pLevel * Min30_Towers[Min30_SelectedTower].pCost) * 0.7))));
};
};
};
}
public function SB_musicleft_mouse_up(_arg1:MouseEvent):void{
if (SB_Muted == false){
SB_CurrentSong--;
if (SB_CurrentSong == 0){
SB_CurrentSong = 5;
};
SB_channel.stop();
if (SB_CurrentSong == 1){
SB_channel = SB_Ambient1.play(0, 99999);
};
if (SB_CurrentSong == 2){
SB_channel = SB_Ambient2.play(0, 99999);
};
if (SB_CurrentSong == 3){
SB_channel = SB_Ambient3.play(0, 99999);
};
if (SB_CurrentSong == 4){
SB_channel = SB_Ambient4.play(0, 99999);
};
if (SB_CurrentSong == 5){
SB_channel = SB_Ambient5.play(0, 99999);
};
};
}
public function IN_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 (IN_gamemode != "paused"){
try {
i = (IN_Towers.length - 1);
while (i >= 0) {
if (IN_Towers[i].pTowerType <= 5){
closest = 5000;
IN_Towers[i].pTarget = -1;
k = (IN_Enemies.length - 1);
while (k >= 0) {
xdist = Math.round(((IN_Towers[i].x + 16) - IN_Enemies[k].x));
ydist = Math.round(((IN_Towers[i].y + 16) - IN_Enemies[k].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < IN_Towers[i].pRange){
if (IN_Enemies[k].pType == 4){
if (IN_Towers[i].pTowerType != 2){
if (IN_Towers[i].pTowerType != 3){
if (IN_Towers[i].pTowerType != 5){
IN_Towers[i].pTarget = k;
};
};
};
};
if (IN_Enemies[k].pType != 4){
IN_Towers[i].pTarget = k;
};
};
k = (k - 1);
};
};
i = (i - 1);
};
a = (IN_Towers.length - 1);
while (a >= 0) {
if (IN_Towers[a].pTowerType <= 5){
if (IN_Enemies.length > 0){
if (IN_Towers[a].pTarget != -1){
if (IN_Enemies[IN_Towers[a].pTarget].pHealth > 0){
xdist = Math.round(((IN_Towers[a].x + 16) - IN_Enemies[IN_Towers[a].pTarget].x));
ydist = Math.round(((IN_Towers[a].y + 16) - IN_Enemies[IN_Towers[a].pTarget].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < IN_Towers[a].pRange){
if (IN_Enemies[IN_Towers[a].pTarget].y > 0){
if (getTimer() > (IN_Towers[a].pLastFire + IN_Towers[a].pSpeed)){
IN_Towers[a].pLastFire = getTimer();
if (IN_Towers[a].pTowerType == 1){
Bullet1 = new script_bullet_arrow(IN_Towers[a].pTarget);
};
if (IN_Towers[a].pTowerType == 2){
Bullet2 = new script_bullet_ice(IN_Towers[a].pTarget);
};
if (IN_Towers[a].pTowerType == 3){
Bullet3 = new script_bullet_arcane(IN_Towers[a].pTarget);
};
if (IN_Towers[a].pTowerType == 4){
Bullet4 = new script_bullet_cannon(IN_Towers[a].pTarget);
};
if (IN_Towers[a].pTowerType == 5){
Bullet5 = new script_bullet_fire(IN_Towers[a].pTarget);
};
if (IN_Towers[a].pTowerType == 1){
Bullet1.x = (IN_Towers[a].x + 16);
Bullet1.y = (IN_Towers[a].y + 16);
Bullet1.pDamage = IN_Towers[a].pDamage;
Bullet1.pBullet = Bullet1;
addChild(Bullet1);
IN_Bullets.push(Bullet1);
Bullet1.pTower = a;
};
if (IN_Towers[a].pTowerType == 2){
Bullet2.x = (IN_Towers[a].x + 16);
Bullet2.y = (IN_Towers[a].y + 16);
Bullet2.pDamage = IN_Towers[a].pDamage;
Bullet2.pBullet = Bullet2;
addChild(Bullet2);
IN_Bullets.push(Bullet2);
Bullet2.pTower = a;
};
if (IN_Towers[a].pTowerType == 3){
Bullet3.x = (IN_Towers[a].x + 16);
Bullet3.y = (IN_Towers[a].y + 16);
Bullet3.pDamage = IN_Towers[a].pDamage;
Bullet3.pBullet = Bullet3;
addChild(Bullet3);
IN_Bullets.push(Bullet3);
Bullet3.pTower = a;
};
if (IN_Towers[a].pTowerType == 4){
Bullet4.x = (IN_Towers[a].x + 16);
Bullet4.y = (IN_Towers[a].y + 16);
Bullet4.pDamage = IN_Towers[a].pDamage;
Bullet4.pBullet = Bullet4;
addChild(Bullet4);
IN_Bullets.push(Bullet4);
Bullet4.pTower = a;
};
if (IN_Towers[a].pTowerType == 5){
Bullet5.x = (IN_Towers[a].x + 16);
Bullet5.y = (IN_Towers[a].y + 16);
Bullet5.pDamage = IN_Towers[a].pDamage;
Bullet5.pBullet = Bullet5;
addChild(Bullet5);
IN_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function NPS_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (NPS_gamemode != "paused"){
if (NPS_Gold >= 500){
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
NPS_Gold = (NPS_Gold - 500);
text_gold.text = String(NPS_Gold);
_local2 = 0;
while (_local2 < 50) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
NPS_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function HD_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function SB_tower_select_ice_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Ice Tower (25g)";
text_towerinfo.text = "Slows enemies down. (Magic Damage)";
}
public function Min5_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function Min30_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 NPI_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
NPI_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 119;
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_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--;
};
}
public function SB_CheckEnemiesForHit():void{
var i:int;
var k:int;
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var a:int;
if (SB_gamemode != "paused"){
try {
i = (SB_Enemies.length - 1);
while (i >= 0) {
k = (SB_Bullets.length - 1);
while (k >= 0) {
if (SB_Enemies[i].hitTestObject(SB_Bullets[k])){
SB_Enemies[i].GotHit(SB_Bullets[k].pDamage, SB_Bullets[k].pBulletType);
if (SB_Bullets[k].pBulletType == 2){
if (SB_Enemies[i].pSpeed > 0.3){
SB_Enemies[i].pSpeed = (SB_Enemies[i].pSpeed - 0.2);
};
};
if (SB_Bullets[k].pBulletType == 4){
a = (SB_Enemies.length - 1);
while (a >= 0) {
xdist = Math.round((SB_Bullets[k].x - SB_Enemies[a].x));
ydist = Math.round((SB_Bullets[k].y - SB_Enemies[a].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < 50){
if (a != SB_Bullets[k].pTarget){
SB_Enemies[a].GotHit(((5 * SB_Towers[SB_Bullets[k].pTower].pLevel) * 0.75), 4);
};
};
a = (a - 1);
};
};
SB_Bullets[k].x = -100;
SB_Bullets[k].y = -100;
removeChild(SB_Bullets[k].pBullet);
SB_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function tower_select_ice_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Ice Tower (25g)";
text_towerinfo.text = "Slows enemies down. (Magic Damage)";
}
public function Min10_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
Min10_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 119;
Min10_PausedTimer2 = getTimer();
_local2 = (Min10_PausedTimer2 - Min10_PausedTimer1);
_local3 = (Min10_Towers.length - 1);
while (_local3 >= 0) {
Min10_Towers[_local3].pLastFire = (Min10_Towers[_local3].pLastFire + _local2);
_local3--;
};
Min10_TimeLeft = (Min10_TimeLeft + _local2);
Min10_LastGoldUpdate = (Min10_LastGoldUpdate + _local2);
Min10_LastWave = (Min10_LastWave + _local2);
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
_local4 = (Min10_Enemies.length - 1);
while (_local4 >= 0) {
Min10_Enemies[_local4].pPaused = false;
_local4--;
};
}
public function SB_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 5% Of Your Gold Every 2 mins. Limit 1.";
}
public function IN_select_mine_mouse_up(_arg1:MouseEvent):void{
if (IN_gamemode != "paused"){
if (IN_gamemode == "set_tower"){
if (IN_selectedtowertype == "Mine"){
if (IN_Muted == false){
IN_ButtonClick.play();
};
IN_gamemode = "off";
TheGrid1.alpha = 0;
IN_selectedtowertype = "none";
} else {
if (IN_selectedtowertype != "Mine"){
IN_gamemode = "set_tower";
if (IN_Muted == false){
IN_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
IN_selectedtowertype = "Mine";
};
};
} else {
if (IN_gamemode != "set_tower"){
IN_gamemode = "set_tower";
if (IN_Muted == false){
IN_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
IN_selectedtowertype = "Mine";
};
};
};
}
public function HD_the_grid_place_tower(_arg1:MouseEvent):void{
var _local2:tower_arrow;
var _local3:tower_arcane;
var _local4:tower_cannon;
var _local5:tower_ice;
var _local6:tower_fire;
var _local7:building_mine;
if (HD_gamemode != "paused"){
if (HD_gamemode == "set_tower"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (HD_selectedtowertype == "Arrow"){
if (HD_Gold >= 30){
_local2 = new tower_arrow();
_local2.x = (int((root.mouseX / 32)) * 32);
_local2.y = (int((root.mouseY / 32)) * 32);
addChild(_local2);
HD_Towers.push(_local2);
HD_Gold = (HD_Gold - 30);
text_gold.text = String(HD_Gold);
};
};
if (HD_selectedtowertype == "Arcane"){
if (HD_Gold >= 125){
_local3 = new tower_arcane();
_local3.x = (int((root.mouseX / 32)) * 32);
_local3.y = (int((root.mouseY / 32)) * 32);
addChild(_local3);
HD_Towers.push(_local3);
HD_Gold = (HD_Gold - 125);
text_gold.text = String(HD_Gold);
};
};
if (HD_selectedtowertype == "Cannon"){
if (HD_Gold >= 75){
_local4 = new tower_cannon();
_local4.x = (int((root.mouseX / 32)) * 32);
_local4.y = (int((root.mouseY / 32)) * 32);
addChild(_local4);
HD_Towers.push(_local4);
HD_Gold = (HD_Gold - 75);
text_gold.text = String(HD_Gold);
};
};
if (HD_selectedtowertype == "Ice"){
if (HD_Gold >= 25){
_local5 = new tower_ice();
_local5.x = (int((root.mouseX / 32)) * 32);
_local5.y = (int((root.mouseY / 32)) * 32);
addChild(_local5);
HD_Towers.push(_local5);
HD_Gold = (HD_Gold - 25);
text_gold.text = String(HD_Gold);
};
};
if (HD_selectedtowertype == "Fire"){
if (HD_Gold >= 100){
_local6 = new tower_fire();
_local6.x = (int((root.mouseX / 32)) * 32);
_local6.y = (int((root.mouseY / 32)) * 32);
addChild(_local6);
HD_Towers.push(_local6);
HD_Gold = (HD_Gold - 100);
text_gold.text = String(HD_Gold);
};
};
if (HD_selectedtowertype == "Mine"){
if (HD_PlacedMine == false){
if (HD_Gold >= 750){
_local7 = new building_mine();
_local7.x = (int((root.mouseX / 32)) * 32);
_local7.y = (int((root.mouseY / 32)) * 32);
addChild(_local7);
HD_Towers.push(_local7);
text_next_gold.x = _local7.x;
text_next_gold.y = (_local7.y + 6);
addChild(text_next_gold);
HD_Gold = (HD_Gold - 750);
text_gold.text = String(HD_Gold);
HD_PlacedMine = true;
HD_LastGoldUpdate = getTimer();
};
};
};
};
};
};
HD_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 HD_musicleft_mouse_up(_arg1:MouseEvent):void{
if (HD_Muted == false){
HD_CurrentSong--;
if (HD_CurrentSong == 0){
HD_CurrentSong = 5;
};
HD_channel.stop();
if (HD_CurrentSong == 1){
HD_channel = HD_Ambient1.play(0, 99999);
};
if (HD_CurrentSong == 2){
HD_channel = HD_Ambient2.play(0, 99999);
};
if (HD_CurrentSong == 3){
HD_channel = HD_Ambient3.play(0, 99999);
};
if (HD_CurrentSong == 4){
HD_channel = HD_Ambient4.play(0, 99999);
};
if (HD_CurrentSong == 5){
HD_channel = HD_Ambient5.play(0, 99999);
};
};
}
public function SB_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function Min10_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function Min30_musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function tower_select_ice_mouse_up(_arg1:MouseEvent):void{
if (gamemode != "paused"){
if (gamemode == "set_tower"){
if (selectedtowertype == "Ice"){
gamemode = "off";
if (Muted == false){
ButtonClick.play();
};
TheGrid1.alpha = 0;
selectedtowertype = "none";
} else {
if (selectedtowertype != "Ice"){
gamemode = "set_tower";
if (Muted == false){
ButtonClick.play();
};
TheGrid1.alpha = 0.5;
selectedtowertype = "Ice";
};
};
} else {
if (gamemode != "set_tower"){
gamemode = "set_tower";
if (Muted == false){
ButtonClick.play();
};
TheGrid1.alpha = 0.5;
selectedtowertype = "Ice";
};
};
};
}
public function IN_tower_select_arcane_mouse_up(_arg1:MouseEvent):void{
if (IN_gamemode != "paused"){
if (IN_gamemode == "set_tower"){
if (IN_selectedtowertype == "Arcane"){
IN_gamemode = "off";
TheGrid1.alpha = 0;
if (IN_Muted == false){
IN_ButtonClick.play();
};
IN_selectedtowertype = "none";
} else {
if (IN_selectedtowertype != "Arcane"){
IN_gamemode = "set_tower";
if (IN_Muted == false){
IN_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
IN_selectedtowertype = "Arcane";
};
};
} else {
if (IN_gamemode != "set_tower"){
IN_gamemode = "set_tower";
if (IN_Muted == false){
IN_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
IN_selectedtowertype = "Arcane";
};
};
};
}
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_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function HD_CheckEnemiesForHit():void{
var i:int;
var k:int;
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var a:int;
if (HD_gamemode != "paused"){
try {
i = (HD_Enemies.length - 1);
while (i >= 0) {
k = (HD_Bullets.length - 1);
while (k >= 0) {
if (HD_Enemies[i].hitTestObject(HD_Bullets[k])){
HD_Enemies[i].GotHit(HD_Bullets[k].pDamage, HD_Bullets[k].pBulletType);
if (HD_Bullets[k].pBulletType == 2){
if (HD_Enemies[i].pSpeed > 0.3){
HD_Enemies[i].pSpeed = (HD_Enemies[i].pSpeed - 0.2);
};
};
if (HD_Bullets[k].pBulletType == 4){
a = (HD_Enemies.length - 1);
while (a >= 0) {
xdist = Math.round((HD_Bullets[k].x - HD_Enemies[a].x));
ydist = Math.round((HD_Bullets[k].y - HD_Enemies[a].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < 50){
if (a != HD_Bullets[k].pTarget){
HD_Enemies[a].GotHit(((5 * HD_Towers[HD_Bullets[k].pTower].pLevel) * 0.75), 4);
};
};
a = (a - 1);
};
};
HD_Bullets[k].x = -100;
HD_Bullets[k].y = -100;
removeChild(HD_Bullets[k].pBullet);
HD_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
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 Min10_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_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;
removeChild(NPS_Bullets[k].pBullet);
NPS_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
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 Min5_road_deselect(_arg1:MouseEvent):void{
TheGrid1.graphics.clear();
TheGrid1.alpha = 0;
Min5_gamemode = "none";
Min5_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_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(500g)";
text_towerinfo.text = "Calls forth the Angel of Death";
}
public function NPS_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (NPS_gamemode != "paused"){
if (NPS_Enemies.length < 35){
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 NP_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(300g)";
text_towerinfo.text = "Calls forth a Blizzard";
}
public function Min10_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 (Min10_gamemode != "paused"){
_local1 = (Min10_Enemies.length - 1);
while (_local1 >= 0) {
if (Min10_Enemies[_local1].y > 500){
Min10_Lives = (Min10_Lives - 1);
text_lives.text = String(Min10_Lives);
if (Min10_Lives < 1){
_local5 = (Min10_HealthBars.length - 1);
while (_local5 >= 0) {
removeChild(Min10_HealthBars[_local5]);
Min10_HealthBars.splice(_local5, 1);
_local5--;
};
_local6 = (Min10_Bullets.length - 1);
while (_local6 >= 0) {
removeChild(Min10_Bullets[_local6]);
Min10_Bullets.splice(_local6, 1);
_local6--;
};
_local7 = (Min10_Towers.length - 1);
while (_local7 >= 0) {
removeChild(Min10_Towers[_local7]);
Min10_Towers.splice(_local7, 1);
_local7--;
};
_local8 = (Min10_Enemies.length - 1);
while (_local8 >= 0) {
removeChild(Min10_Enemies[_local8]);
Min10_Enemies.splice(_local8, 1);
_local8--;
};
removeEventListener(Event.ENTER_FRAME, Min10_everytime);
Min10_channel.stop();
gotoAndStop(80);
};
removeChild(Min10_Enemies[_local1]);
Min10_Enemies.splice(_local1, 1);
_local2 = (Min10_HealthBars.length - 1);
while (_local2 >= 0) {
if (Min10_HealthBars[_local2].pEnemy == _local1){
Min10_HealthBars[_local2].x = -900;
removeChild(Min10_HealthBars[_local2]);
Min10_HealthBars.splice(_local2, 1);
};
if (Min10_HealthBars[_local2].pEnemy > _local1){
Min10_HealthBars[_local2].pEnemy = (Min10_HealthBars[_local2].pEnemy - 1);
};
_local2--;
};
_local3 = (Min10_Bullets.length - 1);
while (_local3 >= 0) {
if (Min10_Bullets[_local3].pTarget > _local1){
Min10_Bullets[_local3].pTarget = (Min10_Bullets[_local3].pTarget - 1);
};
if (Min10_Bullets[_local3].pTarget == _local1){
Min10_Bullets[_local3].x = -100;
Min10_Bullets[_local3].y = -100;
removeChild(Min10_Bullets[_local3].pBullet);
Min10_Bullets.splice(_local3, 1);
};
_local3--;
};
_local4 = (Min10_Towers.length - 1);
while (_local4 >= 0) {
if (Min10_Towers[_local4].pTarget == _local1){
Min10_Towers[_local4].pTarget = -1;
};
if (Min10_Towers[_local4].pTarget > _local1){
Min10_Towers[_local4].pTarget = (Min10_Towers[_local4].pTarget - 1);
};
_local4--;
};
};
if (Min10_Enemies[_local1].hitTestObject(tp1)){
Min10_Enemies[_local1].pTheDirection = 2;
};
if (Min10_Enemies[_local1].hitTestObject(tp2)){
Min10_Enemies[_local1].pTheDirection = 1;
};
if (Min10_Enemies[_local1].hitTestObject(tp3)){
Min10_Enemies[_local1].pTheDirection = 3;
};
if (Min10_Enemies[_local1].hitTestObject(tp4)){
Min10_Enemies[_local1].pTheDirection = 1;
};
if (Min10_Enemies[_local1].hitTestObject(tp5)){
Min10_Enemies[_local1].pTheDirection = 2;
};
if (Min10_Enemies[_local1].hitTestObject(tp6)){
Min10_Enemies[_local1].pTheDirection = 4;
};
if (Min10_Enemies[_local1].hitTestObject(tp7)){
Min10_Enemies[_local1].pTheDirection = 2;
};
if (Min10_Enemies[_local1].hitTestObject(tp8)){
Min10_Enemies[_local1].pTheDirection = 1;
};
if (Min10_Enemies[_local1].hitTestObject(tp9)){
Min10_Enemies[_local1].pTheDirection = 3;
};
if (Min10_Enemies[_local1].hitTestObject(tp10)){
Min10_Enemies[_local1].pTheDirection = 1;
};
_local1--;
};
};
}
public function NPH_placeenemies():void{
var _local1:*;
var _local2:script_enemy_normal;
var _local3:enemy_health_bar;
var _local4:script_enemy_armor;
var _local5:enemy_health_bar;
var _local6:script_enemy_fast;
var _local7:enemy_health_bar;
var _local8:script_enemy_immune;
var _local9:enemy_health_bar;
var _local10:script_enemy_boss;
var _local11:enemy_health_bar;
if (NPH_gamemode != "paused"){
NPH_GameLevel = (NPH_GameLevel + 1);
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_normal(_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;
} else {
if (NPH_LastEnemyType == 2){
_local4 = new script_enemy_armor(_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;
} else {
if (NPH_LastEnemyType == 3){
_local6 = new script_enemy_fast(_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;
};
};
};
if (NPH_LastEnemyType == 4){
_local8 = new script_enemy_immune(_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;
};
_local1++;
};
if (NPH_LastEnemyType == 5){
_local10 = new script_enemy_boss(0, 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;
};
NPH_LastEnemyType = (NPH_LastEnemyType + 1);
if (NPH_LastEnemyType == 6){
NPH_LastEnemyType = 1;
};
};
}
public function IN_placeenemies():void{
var _local1:*;
var _local2:script_enemy_normal;
var _local3:enemy_health_bar;
var _local4:script_enemy_armor;
var _local5:enemy_health_bar;
var _local6:script_enemy_fast;
var _local7:enemy_health_bar;
var _local8:script_enemy_immune;
var _local9:enemy_health_bar;
var _local10:script_enemy_boss;
var _local11:enemy_health_bar;
if (IN_gamemode != "paused"){
IN_GameLevel = (IN_GameLevel + 1);
_local1 = 0;
while (_local1 < 25) {
if (IN_LastEnemyType == 1){
_local2 = new script_enemy_normal(_local1, IN_GameLevel, "insane");
addChild(_local2);
IN_Enemies.push(_local2);
IN_LastWave = getTimer();
text_level.text = String(IN_GameLevel);
_local3 = new enemy_health_bar();
_local3.pEnemy = (IN_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);
IN_HealthBars.push(_local3);
} else {
if (IN_LastEnemyType == 2){
_local4 = new script_enemy_armor(_local1, IN_GameLevel, "insane");
addChild(_local4);
IN_Enemies.push(_local4);
IN_LastWave = getTimer();
text_level.text = String(IN_GameLevel);
_local5 = new enemy_health_bar();
_local5.pEnemy = (IN_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);
IN_HealthBars.push(_local5);
} else {
if (IN_LastEnemyType == 3){
_local6 = new script_enemy_fast(_local1, IN_GameLevel, "insane");
addChild(_local6);
IN_Enemies.push(_local6);
IN_LastWave = getTimer();
text_level.text = String(IN_GameLevel);
_local7 = new enemy_health_bar();
_local7.pEnemy = (IN_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);
IN_HealthBars.push(_local7);
};
};
};
if (IN_LastEnemyType == 4){
_local8 = new script_enemy_immune(_local1, IN_GameLevel, "insane");
addChild(_local8);
IN_Enemies.push(_local8);
IN_LastWave = getTimer();
text_level.text = String(IN_GameLevel);
_local9 = new enemy_health_bar();
_local9.pEnemy = (IN_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);
IN_HealthBars.push(_local9);
};
_local1++;
};
if (IN_LastEnemyType == 5){
_local10 = new script_enemy_boss(0, IN_GameLevel, "insane");
addChild(_local10);
IN_Enemies.push(_local10);
IN_LastWave = getTimer();
text_level.text = String(IN_GameLevel);
_local11 = new enemy_health_bar();
_local11.pEnemy = (IN_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);
IN_HealthBars.push(_local11);
};
IN_LastEnemyType = (IN_LastEnemyType + 1);
if (IN_LastEnemyType == 6){
IN_LastEnemyType = 1;
};
};
}
public function SB_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(300g)";
text_towerinfo.text = "Calls forth a Blizzard";
}
public function play30min(_arg1:MouseEvent):void{
gotoAndStop(85);
}
public function Min30_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (Min30_gamemode != "paused"){
if (Min30_Gold >= 500){
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
Min30_Gold = (Min30_Gold - 500);
text_gold.text = String(Min30_Gold);
_local2 = 0;
while (_local2 < 50) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
Min30_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(300g)";
text_towerinfo.text = "Calls forth a Blizzard";
}
public function Min30_CheckEnemyHealth():void{
var i:int;
var h:int;
var k:int;
var a:int;
if (Min30_gamemode != "paused"){
try {
i = (Min30_Enemies.length - 1);
while (i >= 0) {
if (Min30_Enemies[i].pHealth <= 0){
Min30_Enemies[i].x = -500;
Min30_Enemies[i].y = -500;
if (Min30_Enemies[i].pType == 5){
Min30_Gold = (Min30_Gold + Math.round(((1.75 * Min30_GameLevel) + 0.5)));
Min30_GameScore = (Min30_GameScore + 50);
} else {
Min30_Gold = (Min30_Gold + Math.round(((0.25 * Min30_GameLevel) + 0.5)));
Min30_GameScore = (Min30_GameScore + 10);
};
removeChild(Min30_Enemies[i]);
Min30_Enemies.splice(i, 1);
text_gold.text = String(Min30_Gold);
text_score.text = String(Min30_GameScore);
h = (Min30_HealthBars.length - 1);
while (h >= 0) {
if (Min30_HealthBars[h].pEnemy == i){
Min30_HealthBars[h].x = -900;
removeChild(Min30_HealthBars[h]);
Min30_HealthBars.splice(h, 1);
};
if (Min30_HealthBars[h].pEnemy > i){
Min30_HealthBars[h].pEnemy = (Min30_HealthBars[h].pEnemy - 1);
};
h = (h - 1);
};
k = (Min30_Bullets.length - 1);
while (k >= 0) {
if (k != i){
if (Min30_Bullets[k].pTarget > i){
Min30_Bullets[k].pTarget = (Min30_Bullets[k].pTarget - 1);
};
};
if (Min30_Bullets[k].pTarget == i){
Min30_Bullets[k].x = -100;
Min30_Bullets[k].y = -100;
removeChild(Min30_Bullets[k].pBullet);
Min30_Bullets.splice(k, 1);
};
k = (k - 1);
};
a = (Min30_Towers.length - 1);
while (a >= 0) {
if (Min30_Towers[a].pTarget == i){
Min30_Towers[a].pTarget = -1;
};
if (Min30_Towers[a].pTarget > i){
Min30_Towers[a].pTarget = (Min30_Towers[a].pTarget - 1);
};
a = (a - 1);
};
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function Min10_the_grid_place_tower(_arg1:MouseEvent):void{
var _local2:tower_arrow;
var _local3:tower_arcane;
var _local4:tower_cannon;
var _local5:tower_ice;
var _local6:tower_fire;
var _local7:building_mine;
if (Min10_gamemode != "paused"){
if (Min10_gamemode == "set_tower"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (Min10_selectedtowertype == "Arrow"){
if (Min10_Gold >= 30){
_local2 = new tower_arrow();
_local2.x = (int((root.mouseX / 32)) * 32);
_local2.y = (int((root.mouseY / 32)) * 32);
addChild(_local2);
Min10_Towers.push(_local2);
Min10_Gold = (Min10_Gold - 30);
text_gold.text = String(Min10_Gold);
};
};
if (Min10_selectedtowertype == "Arcane"){
if (Min10_Gold >= 125){
_local3 = new tower_arcane();
_local3.x = (int((root.mouseX / 32)) * 32);
_local3.y = (int((root.mouseY / 32)) * 32);
addChild(_local3);
Min10_Towers.push(_local3);
Min10_Gold = (Min10_Gold - 125);
text_gold.text = String(Min10_Gold);
};
};
if (Min10_selectedtowertype == "Cannon"){
if (Min10_Gold >= 75){
_local4 = new tower_cannon();
_local4.x = (int((root.mouseX / 32)) * 32);
_local4.y = (int((root.mouseY / 32)) * 32);
addChild(_local4);
Min10_Towers.push(_local4);
Min10_Gold = (Min10_Gold - 75);
text_gold.text = String(Min10_Gold);
};
};
if (Min10_selectedtowertype == "Ice"){
if (Min10_Gold >= 25){
_local5 = new tower_ice();
_local5.x = (int((root.mouseX / 32)) * 32);
_local5.y = (int((root.mouseY / 32)) * 32);
addChild(_local5);
Min10_Towers.push(_local5);
Min10_Gold = (Min10_Gold - 25);
text_gold.text = String(Min10_Gold);
};
};
if (Min10_selectedtowertype == "Fire"){
if (Min10_Gold >= 100){
_local6 = new tower_fire();
_local6.x = (int((root.mouseX / 32)) * 32);
_local6.y = (int((root.mouseY / 32)) * 32);
addChild(_local6);
Min10_Towers.push(_local6);
Min10_Gold = (Min10_Gold - 100);
text_gold.text = String(Min10_Gold);
};
};
if (Min10_selectedtowertype == "Mine"){
if (Min10_PlacedMine == false){
if (Min10_Gold >= 750){
_local7 = new building_mine();
_local7.x = (int((root.mouseX / 32)) * 32);
_local7.y = (int((root.mouseY / 32)) * 32);
addChild(_local7);
Min10_Towers.push(_local7);
text_next_gold.x = _local7.x;
text_next_gold.y = (_local7.y + 6);
addChild(text_next_gold);
Min10_Gold = (Min10_Gold - 750);
text_gold.text = String(Min10_Gold);
Min10_PlacedMine = true;
Min10_LastGoldUpdate = getTimer();
};
};
};
};
};
};
Min10_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 Min30_everytime(_arg1:Event):void{
var b:int;
var r:int;
var q:int;
var w:int;
var e:int;
var mX:int;
var mY:int;
var didHit:Boolean;
var event = _arg1;
try {
if (Min30_gamemode != "paused"){
Min30_CheckEnemiesForDirections();
Min30_CheckTowerFireBullet();
Min30_MoveBullets();
Min30_CheckEnemiesForHit();
Min30_CheckEnemyHealth();
Min30_UpdateEnemyHealthBar();
Min30_CheckSelectedTower();
Min30_MoveAndCheckAngelsOfDeath();
Min30_MoveAndCheckBlizzard();
if (getTimer() > (Min30_LastWave + Min30_WaveDelay)){
Min30_placeenemies();
};
text_timeleft.text = String(Math.round((((Min30_TimeStarted + Min30_TimeLeft) - getTimer()) / 1000)));
if (Math.round((((Min30_TimeStarted + Min30_TimeLeft) - getTimer()) / 1000)) < 0){
r = (Min30_HealthBars.length - 1);
while (r >= 0) {
removeChild(Min30_HealthBars[r]);
Min30_HealthBars.splice(r, 1);
r = (r - 1);
};
q = (Min30_Bullets.length - 1);
while (q >= 0) {
removeChild(Min30_Bullets[q]);
Min30_Bullets.splice(q, 1);
q = (q - 1);
};
w = (Min30_Towers.length - 1);
while (w >= 0) {
removeChild(Min30_Towers[w]);
Min30_Towers.splice(w, 1);
w = (w - 1);
};
e = (Min30_Enemies.length - 1);
while (e >= 0) {
removeChild(Min30_Enemies[e]);
Min30_Enemies.splice(e, 1);
e = (e - 1);
};
Min30_channel.stop();
gotoAndStop(90);
};
text_next_level.text = String(Math.round((((Min30_WaveDelay + Min30_LastWave) - getTimer()) / 1000)));
if (Min30_PlacedMine == true){
text_next_gold.text = String(Math.round((((Min30_GoldUpdateSpeed + Min30_LastGoldUpdate) - getTimer()) / 1000)));
if (getTimer() > (Min30_LastGoldUpdate + Min30_GoldUpdateSpeed)){
Min30_Gold = (Min30_Gold + (Min30_Gold * 0.05));
text_gold.text = String(Min30_Gold);
Min30_LastGoldUpdate = getTimer();
};
};
if (Min30_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
didHit = Min30_checkpathcollision(mX, mY);
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF);
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)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (Min30_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (Min30_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (Min30_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
};
if (Min30_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (Min30_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 150);
TheGrid1.graphics.endFill();
};
};
};
};
b = (Min30_Towers.length - 1);
while (b >= 0) {
Min30_Towers[b].graphics.clear();
b = (b - 1);
};
drawonme.graphics.clear();
if (Min30_SelectedTower != -1){
mX = 0;
mY = 0;
Min30_Towers[Min30_SelectedTower].graphics.clear();
Min30_Towers[Min30_SelectedTower].graphics.moveTo(mX, mY);
Min30_Towers[Min30_SelectedTower].graphics.beginFill(0xFFFFFF, 0.5);
Min30_Towers[Min30_SelectedTower].graphics.lineTo(mX, mY);
Min30_Towers[Min30_SelectedTower].graphics.lineTo((mX + 32), mY);
Min30_Towers[Min30_SelectedTower].graphics.lineTo((mX + 32), (mY + 32));
Min30_Towers[Min30_SelectedTower].graphics.lineTo(mX, (mY + 32));
Min30_Towers[Min30_SelectedTower].graphics.endFill();
if (Min30_Towers[Min30_SelectedTower].pTowerType <= 5){
upgrade_tower.x = 524;
} else {
upgrade_tower.x = 900;
};
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((Min30_Towers[Min30_SelectedTower].x + 16), (Min30_Towers[Min30_SelectedTower].y + 16), Min30_Towers[Min30_SelectedTower].pRange);
drawonme.graphics.endFill();
};
};
} catch(e:TypeError) {
};
}
public function playnopathsnormal(_arg1:MouseEvent):void{
gotoAndStop(105);
}
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;
removeChild(NPI_Bullets[k].pBullet);
NPI_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
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;
};
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) {
_local2 = new Point(Math.round((NP_Enemies[_local4].x / 32)), Math.round((NP_Enemies[_local4].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local3 = NP_Enemies[_local4].pSpeed;
NP_Enemies[_local4].pSpeed = 0;
NP_Path = Pathfinding.findPath(NP_Map, _local2.y, _local2.x, NP_MapEnd.y, NP_MapEnd.x);
NP_Enemies[_local4].pSpeed = _local3;
NP_Enemies[_local4].pPath = NP_Path;
NP_Enemies[_local4].mapchange();
_local4--;
};
NP_Gold = (NP_Gold + int((0.7 * (NP_Towers[NP_SelectedTower].pCost * NP_Towers[NP_SelectedTower].pLevel))));
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 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 restart_game1(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (SB_HealthBars.length - 1);
while (_local2 >= 0) {
removeChild(SB_HealthBars[_local2]);
SB_HealthBars.splice(_local2, 1);
_local2--;
};
_local3 = (SB_Bullets.length - 1);
while (_local3 >= 0) {
removeChild(SB_Bullets[_local3]);
SB_Bullets.splice(_local3, 1);
_local3--;
};
_local4 = (SB_Towers.length - 1);
while (_local4 >= 0) {
removeChild(SB_Towers[_local4]);
SB_Towers.splice(_local4, 1);
_local4--;
};
_local5 = (SB_Enemies.length - 1);
while (_local5 >= 0) {
removeChild(SB_Enemies[_local5]);
SB_Enemies.splice(_local5, 1);
_local5--;
};
removeEventListener(Event.ENTER_FRAME, SB_everytime);
SB_channel.stop();
gotoAndStop(10);
}
public function restart_game2(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (HealthBars.length - 1);
while (_local2 >= 0) {
removeChild(HealthBars[_local2]);
HealthBars.splice(_local2, 1);
_local2--;
};
_local3 = (Bullets.length - 1);
while (_local3 >= 0) {
removeChild(Bullets[_local3]);
Bullets.splice(_local3, 1);
_local3--;
};
_local4 = (Towers.length - 1);
while (_local4 >= 0) {
removeChild(Towers[_local4]);
Towers.splice(_local4, 1);
_local4--;
};
_local5 = (Enemies.length - 1);
while (_local5 >= 0) {
removeChild(Enemies[_local5]);
Enemies.splice(_local5, 1);
_local5--;
};
removeEventListener(Event.ENTER_FRAME, everytime);
channel.stop();
gotoAndStop(10);
}
public function restart_game3(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (HD_HealthBars.length - 1);
while (_local2 >= 0) {
removeChild(HD_HealthBars[_local2]);
HD_HealthBars.splice(_local2, 1);
_local2--;
};
_local3 = (HD_Bullets.length - 1);
while (_local3 >= 0) {
removeChild(HD_Bullets[_local3]);
HD_Bullets.splice(_local3, 1);
_local3--;
};
_local4 = (HD_Towers.length - 1);
while (_local4 >= 0) {
removeChild(HD_Towers[_local4]);
HD_Towers.splice(_local4, 1);
_local4--;
};
_local5 = (HD_Enemies.length - 1);
while (_local5 >= 0) {
removeChild(HD_Enemies[_local5]);
HD_Enemies.splice(_local5, 1);
_local5--;
};
removeEventListener(Event.ENTER_FRAME, HD_everytime);
HD_channel.stop();
gotoAndStop(10);
}
public function restart_game4(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (IN_HealthBars.length - 1);
while (_local2 >= 0) {
removeChild(IN_HealthBars[_local2]);
IN_HealthBars.splice(_local2, 1);
_local2--;
};
_local3 = (IN_Bullets.length - 1);
while (_local3 >= 0) {
removeChild(IN_Bullets[_local3]);
IN_Bullets.splice(_local3, 1);
_local3--;
};
_local4 = (IN_Towers.length - 1);
while (_local4 >= 0) {
removeChild(IN_Towers[_local4]);
IN_Towers.splice(_local4, 1);
_local4--;
};
_local5 = (IN_Enemies.length - 1);
while (_local5 >= 0) {
removeChild(IN_Enemies[_local5]);
IN_Enemies.splice(_local5, 1);
_local5--;
};
removeEventListener(Event.ENTER_FRAME, IN_everytime);
IN_channel.stop();
gotoAndStop(10);
}
public function restart_game5(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (Min5_HealthBars.length - 1);
while (_local2 >= 0) {
removeChild(Min5_HealthBars[_local2]);
Min5_HealthBars.splice(_local2, 1);
_local2--;
};
_local3 = (Min5_Bullets.length - 1);
while (_local3 >= 0) {
removeChild(Min5_Bullets[_local3]);
Min5_Bullets.splice(_local3, 1);
_local3--;
};
_local4 = (Min5_Towers.length - 1);
while (_local4 >= 0) {
removeChild(Min5_Towers[_local4]);
Min5_Towers.splice(_local4, 1);
_local4--;
};
_local5 = (Min5_Enemies.length - 1);
while (_local5 >= 0) {
removeChild(Min5_Enemies[_local5]);
Min5_Enemies.splice(_local5, 1);
_local5--;
};
removeEventListener(Event.ENTER_FRAME, Min5_everytime);
Min5_channel.stop();
gotoAndStop(10);
}
public function restart_game6(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (Min10_HealthBars.length - 1);
while (_local2 >= 0) {
removeChild(Min10_HealthBars[_local2]);
Min10_HealthBars.splice(_local2, 1);
_local2--;
};
_local3 = (Min10_Bullets.length - 1);
while (_local3 >= 0) {
removeChild(Min10_Bullets[_local3]);
Min10_Bullets.splice(_local3, 1);
_local3--;
};
_local4 = (Min10_Towers.length - 1);
while (_local4 >= 0) {
removeChild(Min10_Towers[_local4]);
Min10_Towers.splice(_local4, 1);
_local4--;
};
_local5 = (Min10_Enemies.length - 1);
while (_local5 >= 0) {
removeChild(Min10_Enemies[_local5]);
Min10_Enemies.splice(_local5, 1);
_local5--;
};
removeEventListener(Event.ENTER_FRAME, Min10_everytime);
Min10_channel.stop();
gotoAndStop(10);
}
public function restart_game7(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (Min30_HealthBars.length - 1);
while (_local2 >= 0) {
removeChild(Min30_HealthBars[_local2]);
Min30_HealthBars.splice(_local2, 1);
_local2--;
};
_local3 = (Min30_Bullets.length - 1);
while (_local3 >= 0) {
removeChild(Min30_Bullets[_local3]);
Min30_Bullets.splice(_local3, 1);
_local3--;
};
_local4 = (Min30_Towers.length - 1);
while (_local4 >= 0) {
removeChild(Min30_Towers[_local4]);
Min30_Towers.splice(_local4, 1);
_local4--;
};
_local5 = (Min30_Enemies.length - 1);
while (_local5 >= 0) {
removeChild(Min30_Enemies[_local5]);
Min30_Enemies.splice(_local5, 1);
_local5--;
};
removeEventListener(Event.ENTER_FRAME, Min30_everytime);
Min30_channel.stop();
gotoAndStop(10);
}
public function SB_the_grid_place_tower(_arg1:MouseEvent):void{
var _local2:tower_arrow;
var _local3:tower_arcane;
var _local4:tower_cannon;
var _local5:tower_ice;
var _local6:tower_fire;
var _local7:building_mine;
if (SB_gamemode != "paused"){
if (SB_gamemode == "set_tower"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (SB_selectedtowertype == "Arrow"){
if (SB_Gold >= 30){
_local2 = new tower_arrow();
_local2.x = (int((root.mouseX / 32)) * 32);
_local2.y = (int((root.mouseY / 32)) * 32);
addChild(_local2);
SB_Towers.push(_local2);
SB_Gold = (SB_Gold - 30);
text_gold.text = String(SB_Gold);
};
};
if (SB_selectedtowertype == "Arcane"){
if (SB_Gold >= 125){
_local3 = new tower_arcane();
_local3.x = (int((root.mouseX / 32)) * 32);
_local3.y = (int((root.mouseY / 32)) * 32);
addChild(_local3);
SB_Towers.push(_local3);
SB_Gold = (SB_Gold - 125);
text_gold.text = String(SB_Gold);
};
};
if (SB_selectedtowertype == "Cannon"){
if (SB_Gold >= 75){
_local4 = new tower_cannon();
_local4.x = (int((root.mouseX / 32)) * 32);
_local4.y = (int((root.mouseY / 32)) * 32);
addChild(_local4);
SB_Towers.push(_local4);
SB_Gold = (SB_Gold - 75);
text_gold.text = String(SB_Gold);
};
};
if (SB_selectedtowertype == "Ice"){
if (SB_Gold >= 25){
_local5 = new tower_ice();
_local5.x = (int((root.mouseX / 32)) * 32);
_local5.y = (int((root.mouseY / 32)) * 32);
addChild(_local5);
SB_Towers.push(_local5);
SB_Gold = (SB_Gold - 25);
text_gold.text = String(SB_Gold);
};
};
if (SB_selectedtowertype == "Fire"){
if (SB_Gold >= 100){
_local6 = new tower_fire();
_local6.x = (int((root.mouseX / 32)) * 32);
_local6.y = (int((root.mouseY / 32)) * 32);
addChild(_local6);
SB_Towers.push(_local6);
SB_Gold = (SB_Gold - 100);
text_gold.text = String(SB_Gold);
};
};
if (SB_selectedtowertype == "Mine"){
if (SB_PlacedMine == false){
if (SB_Gold >= 750){
_local7 = new building_mine();
_local7.x = (int((root.mouseX / 32)) * 32);
_local7.y = (int((root.mouseY / 32)) * 32);
addChild(_local7);
SB_Towers.push(_local7);
text_next_gold.x = _local7.x;
text_next_gold.y = (_local7.y + 6);
addChild(text_next_gold);
SB_Gold = (SB_Gold - 750);
text_gold.text = String(SB_Gold);
SB_PlacedMine = true;
SB_LastGoldUpdate = getTimer();
};
};
};
};
};
};
SB_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 Min10_CheckSelectedTower():void{
var _local1:int;
var _local2:int;
if (Min10_gamemode != "paused"){
_local1 = (Min10_Towers.length - 1);
while (_local1 >= 0) {
if (Min10_Towers[_local1].CheckSelected() == true){
Min10_SelectedTower = _local1;
sell_tower.x = 524;
text_tower_damage.x = 495;
text_tower_level.x = 495;
text_tower_range.x = 495;
text_tower_sell.x = 495;
text_tower_damage.text = ("Tower Damage - " + Math.round(Min10_Towers[_local1].pDamage));
text_tower_range.text = ("Tower Range - " + Min10_Towers[_local1].pRange);
text_tower_level.text = ("Tower Level - " + Min10_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((Min10_Towers[_local1].pLevel * Min10_Towers[_local1].pCost) * 0.7))));
Min10_gamemode = "none";
TheGrid1.alpha = 0;
Min10_selectedtowertype = "none";
};
_local1--;
};
_local2 = (Min10_Towers.length - 1);
while (_local2 >= 0) {
Min10_Towers[_local2].pSelected = false;
_local2--;
};
};
}
public function Min30_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
Min30_gamemode = "paused";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
playbutton.x = 119;
pausebutton.x = 900;
Min30_PausedTimer1 = getTimer();
_local2 = (Min30_Enemies.length - 1);
while (_local2 >= 0) {
Min30_Enemies[_local2].pPaused = true;
_local2--;
};
}
public function Min30_MoveAndCheckAngelsOfDeath():void{
var _local1:int;
var _local2:int;
if (Min30_gamemode != "paused"){
_local1 = (Min30_AngelsOfDeath.length - 1);
while (_local1 >= 0) {
_local2 = (Min30_Enemies.length - 1);
while (_local2 >= 0) {
if (Min30_Enemies[_local2].hitTestObject(Min30_AngelsOfDeath[_local1])){
Min30_Enemies[_local2].GotHit(25, 1);
};
_local2--;
};
if (Min30_AngelsOfDeath[_local1].y < 0){
drawonme.removeChild(Min30_AngelsOfDeath[_local1]);
Min30_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
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(50, 1);
};
_local2--;
};
if (NP_AngelsOfDeath[_local1].y < 0){
drawonme.removeChild(NP_AngelsOfDeath[_local1]);
NP_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
public function IN_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 (IN_gamemode != "paused"){
_local1 = (IN_Enemies.length - 1);
while (_local1 >= 0) {
if (IN_Enemies[_local1].y > 500){
IN_Lives = (IN_Lives - 1);
text_lives.text = String(IN_Lives);
if (IN_Lives < 1){
_local5 = (IN_HealthBars.length - 1);
while (_local5 >= 0) {
removeChild(IN_HealthBars[_local5]);
IN_HealthBars.splice(_local5, 1);
_local5--;
};
_local6 = (IN_Bullets.length - 1);
while (_local6 >= 0) {
removeChild(IN_Bullets[_local6]);
IN_Bullets.splice(_local6, 1);
_local6--;
};
_local7 = (IN_Towers.length - 1);
while (_local7 >= 0) {
removeChild(IN_Towers[_local7]);
IN_Towers.splice(_local7, 1);
_local7--;
};
_local8 = (IN_Enemies.length - 1);
while (_local8 >= 0) {
removeChild(IN_Enemies[_local8]);
IN_Enemies.splice(_local8, 1);
_local8--;
};
removeEventListener(Event.ENTER_FRAME, IN_everytime);
IN_channel.stop();
gotoAndStop(60);
};
removeChild(IN_Enemies[_local1]);
IN_Enemies.splice(_local1, 1);
_local2 = (IN_HealthBars.length - 1);
while (_local2 >= 0) {
if (IN_HealthBars[_local2].pEnemy == _local1){
IN_HealthBars[_local2].x = -900;
removeChild(IN_HealthBars[_local2]);
IN_HealthBars.splice(_local2, 1);
};
if (IN_HealthBars[_local2].pEnemy > _local1){
IN_HealthBars[_local2].pEnemy = (IN_HealthBars[_local2].pEnemy - 1);
};
_local2--;
};
_local3 = (IN_Bullets.length - 1);
while (_local3 >= 0) {
if (IN_Bullets[_local3].pTarget > _local1){
IN_Bullets[_local3].pTarget = (IN_Bullets[_local3].pTarget - 1);
};
if (IN_Bullets[_local3].pTarget == _local1){
IN_Bullets[_local3].x = -100;
IN_Bullets[_local3].y = -100;
removeChild(IN_Bullets[_local3].pBullet);
IN_Bullets.splice(_local3, 1);
};
_local3--;
};
_local4 = (IN_Towers.length - 1);
while (_local4 >= 0) {
if (IN_Towers[_local4].pTarget == _local1){
IN_Towers[_local4].pTarget = -1;
};
if (IN_Towers[_local4].pTarget > _local1){
IN_Towers[_local4].pTarget = (IN_Towers[_local4].pTarget - 1);
};
_local4--;
};
};
if (IN_Enemies[_local1].hitTestObject(tp1)){
IN_Enemies[_local1].pTheDirection = 2;
};
if (IN_Enemies[_local1].hitTestObject(tp2)){
IN_Enemies[_local1].pTheDirection = 1;
};
if (IN_Enemies[_local1].hitTestObject(tp3)){
IN_Enemies[_local1].pTheDirection = 3;
};
if (IN_Enemies[_local1].hitTestObject(tp4)){
IN_Enemies[_local1].pTheDirection = 1;
};
if (IN_Enemies[_local1].hitTestObject(tp5)){
IN_Enemies[_local1].pTheDirection = 2;
};
if (IN_Enemies[_local1].hitTestObject(tp6)){
IN_Enemies[_local1].pTheDirection = 4;
};
if (IN_Enemies[_local1].hitTestObject(tp7)){
IN_Enemies[_local1].pTheDirection = 2;
};
if (IN_Enemies[_local1].hitTestObject(tp8)){
IN_Enemies[_local1].pTheDirection = 1;
};
if (IN_Enemies[_local1].hitTestObject(tp9)){
IN_Enemies[_local1].pTheDirection = 3;
};
if (IN_Enemies[_local1].hitTestObject(tp10)){
IN_Enemies[_local1].pTheDirection = 1;
};
_local1--;
};
};
}
public function HD_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
} catch(e:TypeError) {
};
}
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(50, 1);
};
_local2--;
};
if (NPH_AngelsOfDeath[_local1].y < 0){
drawonme.removeChild(NPH_AngelsOfDeath[_local1]);
NPH_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
function frame1(){
MochiAd.showPreloaderAd({clip:this.root, id:"d8d892ac1120ac68", res:"640x480"});
}
public function the_grid_place_tower(_arg1:MouseEvent):void{
var _local2:tower_arrow;
var _local3:tower_arcane;
var _local4:tower_cannon;
var _local5:tower_ice;
var _local6:tower_fire;
var _local7:building_mine;
if (gamemode != "paused"){
if (gamemode == "set_tower"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (selectedtowertype == "Arrow"){
if (Gold >= 30){
_local2 = new tower_arrow();
_local2.x = (int((root.mouseX / 32)) * 32);
_local2.y = (int((root.mouseY / 32)) * 32);
addChild(_local2);
Towers.push(_local2);
Gold = (Gold - 30);
text_gold.text = String(Gold);
};
};
if (selectedtowertype == "Arcane"){
if (Gold >= 125){
_local3 = new tower_arcane();
_local3.x = (int((root.mouseX / 32)) * 32);
_local3.y = (int((root.mouseY / 32)) * 32);
addChild(_local3);
Towers.push(_local3);
Gold = (Gold - 125);
text_gold.text = String(Gold);
};
};
if (selectedtowertype == "Cannon"){
if (Gold >= 75){
_local4 = new tower_cannon();
_local4.x = (int((root.mouseX / 32)) * 32);
_local4.y = (int((root.mouseY / 32)) * 32);
addChild(_local4);
Towers.push(_local4);
Gold = (Gold - 75);
text_gold.text = String(Gold);
};
};
if (selectedtowertype == "Ice"){
if (Gold >= 25){
_local5 = new tower_ice();
_local5.x = (int((root.mouseX / 32)) * 32);
_local5.y = (int((root.mouseY / 32)) * 32);
addChild(_local5);
Towers.push(_local5);
Gold = (Gold - 25);
text_gold.text = String(Gold);
};
};
if (selectedtowertype == "Fire"){
if (Gold >= 100){
_local6 = new tower_fire();
_local6.x = (int((root.mouseX / 32)) * 32);
_local6.y = (int((root.mouseY / 32)) * 32);
addChild(_local6);
Towers.push(_local6);
Gold = (Gold - 100);
text_gold.text = String(Gold);
};
};
if (selectedtowertype == "Mine"){
if (PlacedMine == false){
if (Gold >= 750){
_local7 = new building_mine();
_local7.x = (int((root.mouseX / 32)) * 32);
_local7.y = (int((root.mouseY / 32)) * 32);
addChild(_local7);
Towers.push(_local7);
text_next_gold.x = _local7.x;
text_next_gold.y = (_local7.y + 6);
addChild(text_next_gold);
Gold = (Gold - 750);
text_gold.text = String(Gold);
PlacedMine = true;
LastGoldUpdate = getTimer();
};
};
};
};
};
};
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 Min5_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
} catch(e:TypeError) {
};
}
public function restart_game9(_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) {
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);
NP_channel.stop();
gotoAndStop(10);
}
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 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;
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 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 NPS_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
} catch(e:TypeError) {
};
}
public function NPI_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (NPI_gamemode != "paused"){
if (NPI_Gold >= 500){
if (NPI_Muted == false){
if (NPI_Muted == false){
NPI_ButtonClick.play();
};
};
NPI_Gold = (NPI_Gold - 500);
text_gold.text = String(NPI_Gold);
_local2 = 0;
while (_local2 < 50) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
NPI_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
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 Min30_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (Min30_gamemode != "paused"){
if (Min30_Enemies.length < 35){
if (Min30_GameLevel != 0){
Min30_GameScore = (Min30_GameScore + Math.round((((Min30_WaveDelay + Min30_LastWave) - getTimer()) / 1000)));
text_score.text = String(Min30_GameScore);
};
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
Min30_placeenemies();
};
};
}
public function Min5_MoveBullets():void{
var i:int;
var a:int;
if (Min5_gamemode != "paused"){
try {
i = (Min5_Bullets.length - 1);
while (i >= 0) {
Min5_Bullets[i].movebullet(Min5_Enemies[Min5_Bullets[i].pTarget].x, Min5_Enemies[Min5_Bullets[i].pTarget].y);
i = (i - 1);
};
} catch(e:TypeError) {
a = (Min5_Bullets.length - 1);
while (a >= 0) {
Min5_Bullets[a].x = -900;
Min5_Bullets[a].y = -900;
Min5_Bullets[a].pTarget = -1;
removeChild(Min5_Bullets[a].pBullet);
Min5_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
public function SB_MoveBullets():void{
var i:int;
var a:int;
if (SB_gamemode != "paused"){
try {
i = (SB_Bullets.length - 1);
while (i >= 0) {
SB_Bullets[i].movebullet(SB_Enemies[SB_Bullets[i].pTarget].x, SB_Enemies[SB_Bullets[i].pTarget].y);
i = (i - 1);
};
} catch(e:TypeError) {
a = (SB_Bullets.length - 1);
while (a >= 0) {
SB_Bullets[a].x = -900;
SB_Bullets[a].y = -900;
SB_Bullets[a].pTarget = -1;
removeChild(SB_Bullets[a].pBullet);
SB_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
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;
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;
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;
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;
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;
addChild(Bullet5);
NPH_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function IN_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_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 < 0){
drawonme.removeChild(NPS_AngelsOfDeath[_local1]);
NPS_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
public function playthegame10(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
if (road_1.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_2.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_3.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_4.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_5.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_6.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_7.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_8.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_9.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_10.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_11.hitTestPoint(_local3, _local4)){
return (true);
};
return (false);
}
public function Min5_tower_select_cannon_mouse_up(_arg1:MouseEvent):void{
if (Min5_gamemode != "paused"){
if (Min5_gamemode == "set_tower"){
if (Min5_selectedtowertype == "Cannon"){
Min5_gamemode = "off";
TheGrid1.alpha = 0;
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
Min5_selectedtowertype = "none";
} else {
if (Min5_selectedtowertype != "Cannon"){
Min5_gamemode = "set_tower";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min5_selectedtowertype = "Cannon";
};
};
} else {
if (Min5_gamemode != "set_tower"){
Min5_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
Min5_selectedtowertype = "Cannon";
};
};
};
}
public function playthegame11(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function Min5_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
Min5_gamemode = "paused";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
playbutton.x = 119;
pausebutton.x = 900;
Min5_PausedTimer1 = getTimer();
_local2 = (Min5_Enemies.length - 1);
while (_local2 >= 0) {
Min5_Enemies[_local2].pPaused = true;
_local2--;
};
}
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 Min30_tower_select_arrow_mouse_up(_arg1:MouseEvent):void{
if (Min30_gamemode != "paused"){
if (Min30_gamemode == "set_tower"){
if (Min30_selectedtowertype == "Arrow"){
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
Min30_gamemode = "off";
TheGrid1.alpha = 0;
Min30_selectedtowertype = "none";
} else {
if (Min30_selectedtowertype != "Arrow"){
Min30_gamemode = "set_tower";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min30_selectedtowertype = "Arrow";
};
};
} else {
if (Min30_gamemode != "set_tower"){
Min30_gamemode = "set_tower";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min30_selectedtowertype = "Arrow";
};
};
};
}
public function SB_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function Min10_tower_select_arcane_mouse_up(_arg1:MouseEvent):void{
if (Min10_gamemode != "paused"){
if (Min10_gamemode == "set_tower"){
if (Min10_selectedtowertype == "Arcane"){
Min10_gamemode = "off";
TheGrid1.alpha = 0;
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
Min10_selectedtowertype = "none";
} else {
if (Min10_selectedtowertype != "Arcane"){
Min10_gamemode = "set_tower";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min10_selectedtowertype = "Arcane";
};
};
} else {
if (Min10_gamemode != "set_tower"){
Min10_gamemode = "set_tower";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min10_selectedtowertype = "Arcane";
};
};
};
}
public function NP_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
} catch(e:TypeError) {
};
}
public function NPI_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (NPI_gamemode != "paused"){
if (NPI_Enemies.length < 35){
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 Min10_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function tower_select_arrow_mouse_up(_arg1:MouseEvent):void{
if (gamemode != "paused"){
if (gamemode == "set_tower"){
if (selectedtowertype == "Arrow"){
if (Muted == false){
ButtonClick.play();
};
gamemode = "off";
TheGrid1.alpha = 0;
selectedtowertype = "none";
} else {
if (selectedtowertype != "Arrow"){
gamemode = "set_tower";
if (Muted == false){
ButtonClick.play();
};
TheGrid1.alpha = 0.5;
selectedtowertype = "Arrow";
};
};
} else {
if (gamemode != "set_tower"){
gamemode = "set_tower";
if (Muted == false){
ButtonClick.play();
};
TheGrid1.alpha = 0.5;
selectedtowertype = "Arrow";
};
};
};
}
public function Min10_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(300g)";
text_towerinfo.text = "Calls forth a Blizzard";
}
public function Min30_UpdateEnemyHealthBar():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (Min30_gamemode != "paused"){
_local3 = (Min30_HealthBars.length - 1);
while (_local3 >= 0) {
_local1 = (Min30_Enemies[Min30_HealthBars[_local3].pEnemy].pHealth / Min30_Enemies[Min30_HealthBars[_local3].pEnemy].pStartHealth);
_local1 = (_local1 * 100);
_local2 = ((27 * _local1) / 100);
Min30_HealthBars[_local3].x = (Min30_Enemies[Min30_HealthBars[_local3].pEnemy].x - 13);
Min30_HealthBars[_local3].y = (Min30_Enemies[Min30_HealthBars[_local3].pEnemy].y - 16);
Min30_HealthBars[_local3].pWidth = _local2;
Min30_HealthBars[_local3].width = _local2;
_local3--;
};
};
}
public function Min10_placeenemies():void{
var _local1:*;
var _local2:script_enemy_normal;
var _local3:enemy_health_bar;
var _local4:script_enemy_armor;
var _local5:enemy_health_bar;
var _local6:script_enemy_fast;
var _local7:enemy_health_bar;
var _local8:script_enemy_immune;
var _local9:enemy_health_bar;
var _local10:script_enemy_boss;
var _local11:enemy_health_bar;
if (Min10_gamemode != "paused"){
Min10_GameLevel = (Min10_GameLevel + 1);
_local1 = 0;
while (_local1 < 25) {
if (Min10_LastEnemyType == 1){
_local2 = new script_enemy_normal(_local1, Min10_GameLevel, "normal");
addChild(_local2);
Min10_Enemies.push(_local2);
Min10_LastWave = getTimer();
text_level.text = String(Min10_GameLevel);
_local3 = new enemy_health_bar();
_local3.pEnemy = (Min10_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);
Min10_HealthBars.push(_local3);
} else {
if (Min10_LastEnemyType == 2){
_local4 = new script_enemy_armor(_local1, Min10_GameLevel, "normal");
addChild(_local4);
Min10_Enemies.push(_local4);
Min10_LastWave = getTimer();
text_level.text = String(Min10_GameLevel);
_local5 = new enemy_health_bar();
_local5.pEnemy = (Min10_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);
Min10_HealthBars.push(_local5);
} else {
if (Min10_LastEnemyType == 3){
_local6 = new script_enemy_fast(_local1, Min10_GameLevel, "normal");
addChild(_local6);
Min10_Enemies.push(_local6);
Min10_LastWave = getTimer();
text_level.text = String(Min10_GameLevel);
_local7 = new enemy_health_bar();
_local7.pEnemy = (Min10_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);
Min10_HealthBars.push(_local7);
};
};
};
if (Min10_LastEnemyType == 4){
_local8 = new script_enemy_immune(_local1, Min10_GameLevel, "normal");
addChild(_local8);
Min10_Enemies.push(_local8);
Min10_LastWave = getTimer();
text_level.text = String(Min10_GameLevel);
_local9 = new enemy_health_bar();
_local9.pEnemy = (Min10_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);
Min10_HealthBars.push(_local9);
};
_local1++;
};
if (Min10_LastEnemyType == 5){
_local10 = new script_enemy_boss(0, Min10_GameLevel, "insane");
addChild(_local10);
Min10_Enemies.push(_local10);
Min10_LastWave = getTimer();
text_level.text = String(Min10_GameLevel);
_local11 = new enemy_health_bar();
_local11.pEnemy = (Min10_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);
Min10_HealthBars.push(_local11);
};
Min10_LastEnemyType = (Min10_LastEnemyType + 1);
if (Min10_LastEnemyType == 6){
Min10_LastEnemyType = 1;
};
};
}
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();
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.05));
text_gold.text = String(NPI_Gold);
NPI_LastGoldUpdate = getTimer();
};
};
if (NPI_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
didHit = NPI_checkpathcollision(mX, mY);
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF);
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)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (NPI_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NPI_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NPI_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
};
if (NPI_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (NPI_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 150);
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 HD_road_deselect(_arg1:MouseEvent):void{
TheGrid1.graphics.clear();
TheGrid1.alpha = 0;
HD_gamemode = "none";
HD_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 Min10_musicmute_mouse_up(_arg1:MouseEvent):void{
if (Min10_Muted == false){
Min10_channel.stop();
Min10_Muted = true;
} else {
if (Min10_CurrentSong == 1){
Min10_channel = Min10_Ambient1.play(0, 99999);
};
if (Min10_CurrentSong == 2){
Min10_channel = Min10_Ambient2.play(0, 99999);
};
if (Min10_CurrentSong == 3){
Min10_channel = Min10_Ambient3.play(0, 99999);
};
if (Min10_CurrentSong == 4){
Min10_channel = Min10_Ambient4.play(0, 99999);
};
if (Min10_CurrentSong == 5){
Min10_channel = Min10_Ambient5.play(0, 99999);
};
Min10_Muted = false;
};
}
public function IN_pausebutton_mouse_up(_arg1:MouseEvent):void{
var _local2:int;
IN_gamemode = "paused";
if (IN_Muted == false){
IN_ButtonClick.play();
};
playbutton.x = 119;
pausebutton.x = 900;
IN_PausedTimer1 = getTimer();
_local2 = (IN_Enemies.length - 1);
while (_local2 >= 0) {
IN_Enemies[_local2].pPaused = true;
_local2--;
};
}
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;
removeChild(NPI_Bullets[a].pBullet);
NPI_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
public function NPH_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function SB_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 (SB_gamemode != "paused"){
_local1 = (SB_Enemies.length - 1);
while (_local1 >= 0) {
if (SB_Enemies[_local1].y > 500){
SB_Lives = (SB_Lives - 1);
text_lives.text = String(SB_Lives);
if (SB_Lives < 1){
_local5 = (SB_HealthBars.length - 1);
while (_local5 >= 0) {
removeChild(SB_HealthBars[_local5]);
SB_HealthBars.splice(_local5, 1);
_local5--;
};
_local6 = (SB_Bullets.length - 1);
while (_local6 >= 0) {
removeChild(SB_Bullets[_local6]);
SB_Bullets.splice(_local6, 1);
_local6--;
};
_local7 = (SB_Towers.length - 1);
while (_local7 >= 0) {
removeChild(SB_Towers[_local7]);
SB_Towers.splice(_local7, 1);
_local7--;
};
_local8 = (SB_Enemies.length - 1);
while (_local8 >= 0) {
removeChild(SB_Enemies[_local8]);
SB_Enemies.splice(_local8, 1);
_local8--;
};
removeEventListener(Event.ENTER_FRAME, SB_everytime);
SB_channel.stop();
gotoAndStop(30);
};
removeChild(SB_Enemies[_local1]);
SB_Enemies.splice(_local1, 1);
_local2 = (SB_HealthBars.length - 1);
while (_local2 >= 0) {
if (SB_HealthBars[_local2].pEnemy == _local1){
SB_HealthBars[_local2].x = -900;
removeChild(SB_HealthBars[_local2]);
SB_HealthBars.splice(_local2, 1);
};
if (SB_HealthBars[_local2].pEnemy > _local1){
SB_HealthBars[_local2].pEnemy = (SB_HealthBars[_local2].pEnemy - 1);
};
_local2--;
};
_local3 = (SB_Bullets.length - 1);
while (_local3 >= 0) {
if (SB_Bullets[_local3].pTarget > _local1){
SB_Bullets[_local3].pTarget = (SB_Bullets[_local3].pTarget - 1);
};
if (SB_Bullets[_local3].pTarget == _local1){
SB_Bullets[_local3].x = -100;
SB_Bullets[_local3].y = -100;
removeChild(SB_Bullets[_local3].pBullet);
SB_Bullets.splice(_local3, 1);
};
_local3--;
};
_local4 = (SB_Towers.length - 1);
while (_local4 >= 0) {
if (SB_Towers[_local4].pTarget == _local1){
SB_Towers[_local4].pTarget = -1;
};
if (SB_Towers[_local4].pTarget > _local1){
SB_Towers[_local4].pTarget = (SB_Towers[_local4].pTarget - 1);
};
_local4--;
};
};
if (SB_Enemies[_local1].hitTestObject(tp1)){
SB_Enemies[_local1].pTheDirection = 2;
};
if (SB_Enemies[_local1].hitTestObject(tp2)){
SB_Enemies[_local1].pTheDirection = 1;
};
if (SB_Enemies[_local1].hitTestObject(tp3)){
SB_Enemies[_local1].pTheDirection = 3;
};
if (SB_Enemies[_local1].hitTestObject(tp4)){
SB_Enemies[_local1].pTheDirection = 1;
};
if (SB_Enemies[_local1].hitTestObject(tp5)){
SB_Enemies[_local1].pTheDirection = 2;
};
if (SB_Enemies[_local1].hitTestObject(tp6)){
SB_Enemies[_local1].pTheDirection = 4;
};
if (SB_Enemies[_local1].hitTestObject(tp7)){
SB_Enemies[_local1].pTheDirection = 2;
};
if (SB_Enemies[_local1].hitTestObject(tp8)){
SB_Enemies[_local1].pTheDirection = 1;
};
if (SB_Enemies[_local1].hitTestObject(tp9)){
SB_Enemies[_local1].pTheDirection = 3;
};
if (SB_Enemies[_local1].hitTestObject(tp10)){
SB_Enemies[_local1].pTheDirection = 1;
};
_local1--;
};
};
}
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(50, 1);
};
_local2--;
};
if (NPI_AngelsOfDeath[_local1].y < 0){
drawonme.removeChild(NPI_AngelsOfDeath[_local1]);
NPI_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
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;
if (NPS_gamemode != "paused"){
if (NPS_gamemode == "set_tower"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
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) {
_local2 = new Point(Math.round((NPS_Enemies[_local5].x / 32)), Math.round((NPS_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPS_Enemies[_local5].pSpeed;
NPS_Enemies[_local5].pSpeed = 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 = new Array();
NPS_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPS_Enemies[_local5].x / 32)), Math.round((NPS_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPS_Enemies[_local5].pSpeed;
NPS_Enemies[_local5].pSpeed = 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 = new Array();
NPS_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPS_Enemies[_local5].x / 32)), Math.round((NPS_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPS_Enemies[_local5].pSpeed;
NPS_Enemies[_local5].pSpeed = 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 = new Array();
NPS_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPS_Enemies[_local5].x / 32)), Math.round((NPS_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPS_Enemies[_local5].pSpeed;
NPS_Enemies[_local5].pSpeed = 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 = new Array();
NPS_Enemies[_local5].pSpeed = _local4;
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) {
_local2 = new Point(Math.round((NPS_Enemies[_local5].x / 32)), Math.round((NPS_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPS_Enemies[_local5].pSpeed;
NPS_Enemies[_local5].pSpeed = 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 = new Array();
NPS_Enemies[_local5].pSpeed = _local4;
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;
text_next_gold.y = (_local12.y + 6);
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) {
_local2 = new Point(Math.round((NPS_Enemies[_local5].x / 32)), Math.round((NPS_Enemies[_local5].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local4 = NPS_Enemies[_local5].pSpeed;
NPS_Enemies[_local5].pSpeed = 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 = new Array();
NPS_Enemies[_local5].pSpeed = _local4;
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 NP_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(500g)";
text_towerinfo.text = "Calls forth the Angel of Death";
}
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 SB_CheckSelectedTower():void{
var _local1:int;
var _local2:int;
if (SB_gamemode != "paused"){
_local1 = (SB_Towers.length - 1);
while (_local1 >= 0) {
if (SB_Towers[_local1].CheckSelected() == true){
SB_SelectedTower = _local1;
sell_tower.x = 524;
text_tower_damage.x = 495;
text_tower_level.x = 495;
text_tower_range.x = 495;
text_tower_sell.x = 495;
text_tower_damage.text = ("Tower Damage - " + Math.round(SB_Towers[_local1].pDamage));
text_tower_range.text = ("Tower Range - " + SB_Towers[_local1].pRange);
text_tower_level.text = ("Tower Level - " + SB_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((SB_Towers[_local1].pLevel * SB_Towers[_local1].pCost) * 0.7))));
SB_gamemode = "none";
TheGrid1.alpha = 0;
SB_selectedtowertype = "none";
};
_local1--;
};
_local2 = (SB_Towers.length - 1);
while (_local2 >= 0) {
SB_Towers[_local2].pSelected = false;
_local2--;
};
};
}
public function play10min(_arg1:MouseEvent):void{
gotoAndStop(75);
}
public function Min5_UpdateEnemyHealthBar():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (Min5_gamemode != "paused"){
_local3 = (Min5_HealthBars.length - 1);
while (_local3 >= 0) {
_local1 = (Min5_Enemies[Min5_HealthBars[_local3].pEnemy].pHealth / Min5_Enemies[Min5_HealthBars[_local3].pEnemy].pStartHealth);
_local1 = (_local1 * 100);
_local2 = ((27 * _local1) / 100);
Min5_HealthBars[_local3].x = (Min5_Enemies[Min5_HealthBars[_local3].pEnemy].x - 13);
Min5_HealthBars[_local3].y = (Min5_Enemies[Min5_HealthBars[_local3].pEnemy].y - 16);
Min5_HealthBars[_local3].pWidth = _local2;
Min5_HealthBars[_local3].width = _local2;
_local3--;
};
};
}
public function playthegame12(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function HD_CheckSelectedTower():void{
var _local1:int;
var _local2:int;
if (HD_gamemode != "paused"){
_local1 = (HD_Towers.length - 1);
while (_local1 >= 0) {
if (HD_Towers[_local1].CheckSelected() == true){
HD_SelectedTower = _local1;
sell_tower.x = 524;
text_tower_damage.x = 495;
text_tower_level.x = 495;
text_tower_range.x = 495;
text_tower_sell.x = 495;
text_tower_damage.text = ("Tower Damage - " + Math.round(HD_Towers[_local1].pDamage));
text_tower_range.text = ("Tower Range - " + HD_Towers[_local1].pRange);
text_tower_level.text = ("Tower Level - " + HD_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((HD_Towers[_local1].pLevel * HD_Towers[_local1].pCost) * 0.7))));
HD_gamemode = "none";
TheGrid1.alpha = 0;
HD_selectedtowertype = "none";
};
_local1--;
};
_local2 = (HD_Towers.length - 1);
while (_local2 >= 0) {
HD_Towers[_local2].pSelected = false;
_local2--;
};
};
}
public function Min30_tower_select_arcane_mouse_up(_arg1:MouseEvent):void{
if (Min30_gamemode != "paused"){
if (Min30_gamemode == "set_tower"){
if (Min30_selectedtowertype == "Arcane"){
Min30_gamemode = "off";
TheGrid1.alpha = 0;
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
Min30_selectedtowertype = "none";
} else {
if (Min30_selectedtowertype != "Arcane"){
Min30_gamemode = "set_tower";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min30_selectedtowertype = "Arcane";
};
};
} else {
if (Min30_gamemode != "set_tower"){
Min30_gamemode = "set_tower";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min30_selectedtowertype = "Arcane";
};
};
};
}
public function Min10_tower_select_arrow_mouse_up(_arg1:MouseEvent):void{
if (Min10_gamemode != "paused"){
if (Min10_gamemode == "set_tower"){
if (Min10_selectedtowertype == "Arrow"){
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
Min10_gamemode = "off";
TheGrid1.alpha = 0;
Min10_selectedtowertype = "none";
} else {
if (Min10_selectedtowertype != "Arrow"){
Min10_gamemode = "set_tower";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min10_selectedtowertype = "Arrow";
};
};
} else {
if (Min10_gamemode != "set_tower"){
Min10_gamemode = "set_tower";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min10_selectedtowertype = "Arrow";
};
};
};
}
public function upgrade_tower_mouse_up(_arg1:MouseEvent):void{
if (gamemode != "paused"){
if (Towers[SelectedTower].pLevel < 15){
if (Gold >= (Towers[SelectedTower].pCost * (Towers[SelectedTower].pLevel + 1))){
Gold = (Gold - (Towers[SelectedTower].pCost * (Towers[SelectedTower].pLevel + 1)));
text_gold.text = String(Gold);
if (Muted == false){
ButtonClick.play();
};
Towers[SelectedTower].pLevel = (Towers[SelectedTower].pLevel + 1);
Towers[SelectedTower].pDamage = (Towers[SelectedTower].pDamage * 1.25);
upgrade_tower.x = 900;
text_towertype.text = (("Upgrade(" + (Towers[SelectedTower].pCost * (Towers[SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_damage.text = ("Tower Damage - " + Math.round(Towers[SelectedTower].pDamage));
text_tower_range.text = ("Tower Range - " + Towers[SelectedTower].pRange);
text_tower_level.text = ("Tower Level - " + Towers[SelectedTower].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((Towers[SelectedTower].pLevel * Towers[SelectedTower].pCost) * 0.7))));
};
};
};
}
public function HD_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 Min10_tower_select_ice_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Ice Tower (25g)";
text_towerinfo.text = "Slows enemies down. (Magic Damage)";
}
public function SB_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
} catch(e:TypeError) {
};
}
public function HD_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 (HD_gamemode != "paused"){
_local1 = (HD_Enemies.length - 1);
while (_local1 >= 0) {
if (HD_Enemies[_local1].y > 500){
HD_Lives = (HD_Lives - 1);
text_lives.text = String(HD_Lives);
if (HD_Lives < 1){
_local5 = (HD_HealthBars.length - 1);
while (_local5 >= 0) {
removeChild(HD_HealthBars[_local5]);
HD_HealthBars.splice(_local5, 1);
_local5--;
};
_local6 = (HD_Bullets.length - 1);
while (_local6 >= 0) {
removeChild(HD_Bullets[_local6]);
HD_Bullets.splice(_local6, 1);
_local6--;
};
_local7 = (HD_Towers.length - 1);
while (_local7 >= 0) {
removeChild(HD_Towers[_local7]);
HD_Towers.splice(_local7, 1);
_local7--;
};
_local8 = (HD_Enemies.length - 1);
while (_local8 >= 0) {
removeChild(HD_Enemies[_local8]);
HD_Enemies.splice(_local8, 1);
_local8--;
};
removeEventListener(Event.ENTER_FRAME, HD_everytime);
HD_channel.stop();
gotoAndStop(50);
};
removeChild(HD_Enemies[_local1]);
HD_Enemies.splice(_local1, 1);
_local2 = (HD_HealthBars.length - 1);
while (_local2 >= 0) {
if (HD_HealthBars[_local2].pEnemy == _local1){
HD_HealthBars[_local2].x = -900;
removeChild(HD_HealthBars[_local2]);
HD_HealthBars.splice(_local2, 1);
};
if (HD_HealthBars[_local2].pEnemy > _local1){
HD_HealthBars[_local2].pEnemy = (HD_HealthBars[_local2].pEnemy - 1);
};
_local2--;
};
_local3 = (HD_Bullets.length - 1);
while (_local3 >= 0) {
if (HD_Bullets[_local3].pTarget > _local1){
HD_Bullets[_local3].pTarget = (HD_Bullets[_local3].pTarget - 1);
};
if (HD_Bullets[_local3].pTarget == _local1){
HD_Bullets[_local3].x = -100;
HD_Bullets[_local3].y = -100;
removeChild(HD_Bullets[_local3].pBullet);
HD_Bullets.splice(_local3, 1);
};
_local3--;
};
_local4 = (HD_Towers.length - 1);
while (_local4 >= 0) {
if (HD_Towers[_local4].pTarget == _local1){
HD_Towers[_local4].pTarget = -1;
};
if (HD_Towers[_local4].pTarget > _local1){
HD_Towers[_local4].pTarget = (HD_Towers[_local4].pTarget - 1);
};
_local4--;
};
};
if (HD_Enemies[_local1].hitTestObject(tp1)){
HD_Enemies[_local1].pTheDirection = 2;
};
if (HD_Enemies[_local1].hitTestObject(tp2)){
HD_Enemies[_local1].pTheDirection = 1;
};
if (HD_Enemies[_local1].hitTestObject(tp3)){
HD_Enemies[_local1].pTheDirection = 3;
};
if (HD_Enemies[_local1].hitTestObject(tp4)){
HD_Enemies[_local1].pTheDirection = 1;
};
if (HD_Enemies[_local1].hitTestObject(tp5)){
HD_Enemies[_local1].pTheDirection = 2;
};
if (HD_Enemies[_local1].hitTestObject(tp6)){
HD_Enemies[_local1].pTheDirection = 4;
};
if (HD_Enemies[_local1].hitTestObject(tp7)){
HD_Enemies[_local1].pTheDirection = 2;
};
if (HD_Enemies[_local1].hitTestObject(tp8)){
HD_Enemies[_local1].pTheDirection = 1;
};
if (HD_Enemies[_local1].hitTestObject(tp9)){
HD_Enemies[_local1].pTheDirection = 3;
};
if (HD_Enemies[_local1].hitTestObject(tp10)){
HD_Enemies[_local1].pTheDirection = 1;
};
_local1--;
};
};
}
public function Min10_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
} catch(e:TypeError) {
};
}
public function NPS_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(500g)";
text_towerinfo.text = "Calls forth the Angel of Death";
}
public function musicright_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function IN_UpdateEnemyHealthBar():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
if (IN_gamemode != "paused"){
_local3 = (IN_HealthBars.length - 1);
while (_local3 >= 0) {
_local1 = (IN_Enemies[IN_HealthBars[_local3].pEnemy].pHealth / IN_Enemies[IN_HealthBars[_local3].pEnemy].pStartHealth);
_local1 = (_local1 * 100);
_local2 = ((27 * _local1) / 100);
IN_HealthBars[_local3].x = (IN_Enemies[IN_HealthBars[_local3].pEnemy].x - 13);
IN_HealthBars[_local3].y = (IN_Enemies[IN_HealthBars[_local3].pEnemy].y - 16);
IN_HealthBars[_local3].pWidth = _local2;
IN_HealthBars[_local3].width = _local2;
_local3--;
};
};
}
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);
};
};
}
public function HD_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 SB_the_grid_place_tower_enter(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (SB_gamemode != "paused"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (SB_selectedtowertype == "Arrow"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (SB_selectedtowertype == "Arcane"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (SB_selectedtowertype == "Cannon"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 125);
drawonme.graphics.endFill();
};
if (SB_selectedtowertype == "Fire"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (SB_selectedtowertype == "Ice"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 150);
drawonme.graphics.endFill();
};
};
};
};
}
public function Min10_MoveAndCheckAngelsOfDeath():void{
var _local1:int;
var _local2:int;
if (Min10_gamemode != "paused"){
_local1 = (Min10_AngelsOfDeath.length - 1);
while (_local1 >= 0) {
_local2 = (Min10_Enemies.length - 1);
while (_local2 >= 0) {
if (Min10_Enemies[_local2].hitTestObject(Min10_AngelsOfDeath[_local1])){
Min10_Enemies[_local2].GotHit(25, 1);
};
_local2--;
};
if (Min10_AngelsOfDeath[_local1].y < 0){
drawonme.removeChild(Min10_AngelsOfDeath[_local1]);
Min10_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
public function Min5_select_mine_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mine (750g)";
text_towerinfo.text = "Adds 5% Of Your Gold Every 2 mins. Limit 1.";
}
public function Min5_placeenemies():void{
var _local1:*;
var _local2:script_enemy_normal;
var _local3:enemy_health_bar;
var _local4:script_enemy_armor;
var _local5:enemy_health_bar;
var _local6:script_enemy_fast;
var _local7:enemy_health_bar;
var _local8:script_enemy_immune;
var _local9:enemy_health_bar;
var _local10:script_enemy_boss;
var _local11:enemy_health_bar;
if (Min5_gamemode != "paused"){
Min5_GameLevel = (Min5_GameLevel + 1);
_local1 = 0;
while (_local1 < 25) {
if (Min5_LastEnemyType == 1){
_local2 = new script_enemy_normal(_local1, Min5_GameLevel, "normal");
addChild(_local2);
Min5_Enemies.push(_local2);
Min5_LastWave = getTimer();
text_level.text = String(Min5_GameLevel);
_local3 = new enemy_health_bar();
_local3.pEnemy = (Min5_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);
Min5_HealthBars.push(_local3);
} else {
if (Min5_LastEnemyType == 2){
_local4 = new script_enemy_armor(_local1, Min5_GameLevel, "normal");
addChild(_local4);
Min5_Enemies.push(_local4);
Min5_LastWave = getTimer();
text_level.text = String(Min5_GameLevel);
_local5 = new enemy_health_bar();
_local5.pEnemy = (Min5_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);
Min5_HealthBars.push(_local5);
} else {
if (Min5_LastEnemyType == 3){
_local6 = new script_enemy_fast(_local1, Min5_GameLevel, "normal");
addChild(_local6);
Min5_Enemies.push(_local6);
Min5_LastWave = getTimer();
text_level.text = String(Min5_GameLevel);
_local7 = new enemy_health_bar();
_local7.pEnemy = (Min5_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);
Min5_HealthBars.push(_local7);
};
};
};
if (Min5_LastEnemyType == 4){
_local8 = new script_enemy_immune(_local1, Min5_GameLevel, "normal");
addChild(_local8);
Min5_Enemies.push(_local8);
Min5_LastWave = getTimer();
text_level.text = String(Min5_GameLevel);
_local9 = new enemy_health_bar();
_local9.pEnemy = (Min5_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);
Min5_HealthBars.push(_local9);
};
_local1++;
};
if (Min5_LastEnemyType == 5){
_local10 = new script_enemy_boss(0, Min5_GameLevel, "insane");
addChild(_local10);
Min5_Enemies.push(_local10);
Min5_LastWave = getTimer();
text_level.text = String(Min5_GameLevel);
_local11 = new enemy_health_bar();
_local11.pEnemy = (Min5_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);
Min5_HealthBars.push(_local11);
};
Min5_LastEnemyType = (Min5_LastEnemyType + 1);
if (Min5_LastEnemyType == 6){
Min5_LastEnemyType = 1;
};
};
}
public function musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
public function SB_tower_select_fire_mouse_up(_arg1:MouseEvent):void{
if (SB_gamemode != "paused"){
if (SB_gamemode == "set_tower"){
if (SB_selectedtowertype == "Fire"){
SB_gamemode = "off";
TheGrid1.alpha = 0;
if (SB_Muted == false){
SB_ButtonClick.play();
};
SB_selectedtowertype = "none";
} else {
if (SB_selectedtowertype != "Fire"){
SB_gamemode = "set_tower";
if (SB_Muted == false){
SB_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
SB_selectedtowertype = "Fire";
};
};
} else {
if (SB_gamemode != "set_tower"){
SB_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (SB_Muted == false){
SB_ButtonClick.play();
};
SB_selectedtowertype = "Fire";
};
};
};
}
public function restart_game12(_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) {
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);
NPS_channel.stop();
gotoAndStop(10);
}
public function Min30_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (Min30_gamemode != "paused"){
if (Min30_Gold >= 300){
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
Min30_Gold = (Min30_Gold - 300);
text_gold.text = String(Min30_Gold);
_local2 = 0;
while (_local2 < 100) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
Min30_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function Min30_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(500g)";
text_towerinfo.text = "Calls forth the Angel of Death";
}
public function NPI_placeenemies():void{
var _local1:*;
var _local2:script_enemy_normal;
var _local3:enemy_health_bar;
var _local4:script_enemy_armor;
var _local5:enemy_health_bar;
var _local6:script_enemy_fast;
var _local7:enemy_health_bar;
var _local8:script_enemy_immune;
var _local9:enemy_health_bar;
var _local10:script_enemy_boss;
var _local11:enemy_health_bar;
if (NPI_gamemode != "paused"){
NPI_GameLevel = (NPI_GameLevel + 1);
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_normal(_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;
} else {
if (NPI_LastEnemyType == 2){
_local4 = new script_enemy_armor(_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;
} else {
if (NPI_LastEnemyType == 3){
_local6 = new script_enemy_fast(_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;
};
};
};
if (NPI_LastEnemyType == 4){
_local8 = new script_enemy_immune(_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;
};
_local1++;
};
if (NPI_LastEnemyType == 5){
_local10 = new script_enemy_boss(0, 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;
};
NPI_LastEnemyType = (NPI_LastEnemyType + 1);
if (NPI_LastEnemyType == 6){
NPI_LastEnemyType = 1;
};
};
}
public function restart_game11(_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) {
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);
NPI_channel.stop();
gotoAndStop(10);
}
public function SB_musicmute_mouse_up(_arg1:MouseEvent):void{
if (SB_Muted == false){
SB_channel.stop();
SB_Muted = true;
} else {
if (SB_CurrentSong == 1){
SB_channel = SB_Ambient1.play(0, 99999);
};
if (SB_CurrentSong == 2){
SB_channel = SB_Ambient2.play(0, 99999);
};
if (SB_CurrentSong == 3){
SB_channel = SB_Ambient3.play(0, 99999);
};
if (SB_CurrentSong == 4){
SB_channel = SB_Ambient4.play(0, 99999);
};
if (SB_CurrentSong == 5){
SB_channel = SB_Ambient5.play(0, 99999);
};
SB_Muted = false;
};
}
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 = 495;
text_tower_level.x = 495;
text_tower_range.x = 495;
text_tower_sell.x = 495;
text_tower_damage.text = ("Tower Damage - " + Math.round(NPI_Towers[_local1].pDamage));
text_tower_range.text = ("Tower Range - " + NPI_Towers[_local1].pRange);
text_tower_level.text = ("Tower Level - " + NPI_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((NPI_Towers[_local1].pLevel * NPI_Towers[_local1].pCost) * 0.7))));
NPI_gamemode = "none";
TheGrid1.alpha = 0;
NPI_selectedtowertype = "none";
};
_local1--;
};
_local2 = (NPI_Towers.length - 1);
while (_local2 >= 0) {
NPI_Towers[_local2].pSelected = false;
_local2--;
};
};
}
public function restart_game10(_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) {
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);
NPH_channel.stop();
gotoAndStop(10);
}
public function IN_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 Min30_musicleft_mouse_up(_arg1:MouseEvent):void{
if (Min30_Muted == false){
Min30_CurrentSong--;
if (Min30_CurrentSong == 0){
Min30_CurrentSong = 5;
};
Min30_channel.stop();
if (Min30_CurrentSong == 1){
Min30_channel = Min30_Ambient1.play(0, 99999);
};
if (Min30_CurrentSong == 2){
Min30_channel = Min30_Ambient2.play(0, 99999);
};
if (Min30_CurrentSong == 3){
Min30_channel = Min30_Ambient3.play(0, 99999);
};
if (Min30_CurrentSong == 4){
Min30_channel = Min30_Ambient4.play(0, 99999);
};
if (Min30_CurrentSong == 5){
Min30_channel = Min30_Ambient5.play(0, 99999);
};
};
}
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;
removeChild(NPH_Bullets[k].pBullet);
NPH_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
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 = 495;
text_tower_level.x = 495;
text_tower_range.x = 495;
text_tower_sell.x = 495;
text_tower_damage.text = ("Tower Damage - " + Math.round(NPS_Towers[_local1].pDamage));
text_tower_range.text = ("Tower Range - " + NPS_Towers[_local1].pRange);
text_tower_level.text = ("Tower Level - " + NPS_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((NPS_Towers[_local1].pLevel * NPS_Towers[_local1].pCost) * 0.7))));
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 Min30_tower_select_ice_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Ice Tower (25g)";
text_towerinfo.text = "Slows enemies down. (Magic Damage)";
}
public function IN_MoveAndCheckAngelsOfDeath():void{
var _local1:int;
var _local2:int;
if (IN_gamemode != "paused"){
_local1 = (IN_AngelsOfDeath.length - 1);
while (_local1 >= 0) {
_local2 = (IN_Enemies.length - 1);
while (_local2 >= 0) {
if (IN_Enemies[_local2].hitTestObject(IN_AngelsOfDeath[_local1])){
IN_Enemies[_local2].GotHit(25, 1);
};
_local2--;
};
if (IN_AngelsOfDeath[_local1].y < 0){
drawonme.removeChild(IN_AngelsOfDeath[_local1]);
IN_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
public function NPS_placeenemies():void{
var _local1:*;
var _local2:script_enemy_normal;
var _local3:enemy_health_bar;
var _local4:script_enemy_armor;
var _local5:enemy_health_bar;
var _local6:script_enemy_fast;
var _local7:enemy_health_bar;
var _local8:script_enemy_immune;
var _local9:enemy_health_bar;
var _local10:script_enemy_boss;
var _local11:enemy_health_bar;
if (NPS_gamemode != "paused"){
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_normal(_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;
} else {
if (NPS_LastEnemyType == 2){
_local4 = new script_enemy_armor(_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;
} else {
if (NPS_LastEnemyType == 3){
_local6 = new script_enemy_fast(_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;
};
};
};
if (NPS_LastEnemyType == 4){
_local8 = new script_enemy_immune(_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;
};
_local1++;
};
if (NPS_LastEnemyType == 5){
_local10 = new script_enemy_boss(0, 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;
};
NPS_LastEnemyType = (NPS_LastEnemyType + 1);
if (NPS_LastEnemyType == 6){
NPS_LastEnemyType = 1;
};
};
}
public function SB_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 buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(500g)";
text_towerinfo.text = "Calls forth the Angel of Death";
}
public function IN_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
if (road_1.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_2.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_3.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_4.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_5.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_6.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_7.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_8.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_9.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_10.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_11.hitTestPoint(_local3, _local4)){
return (true);
};
return (false);
}
public function HD_musicmute_mouse_up(_arg1:MouseEvent):void{
if (HD_Muted == false){
HD_channel.stop();
HD_Muted = true;
} else {
if (HD_CurrentSong == 1){
HD_channel = HD_Ambient1.play(0, 99999);
};
if (HD_CurrentSong == 2){
HD_channel = HD_Ambient2.play(0, 99999);
};
if (HD_CurrentSong == 3){
HD_channel = HD_Ambient3.play(0, 99999);
};
if (HD_CurrentSong == 4){
HD_channel = HD_Ambient4.play(0, 99999);
};
if (HD_CurrentSong == 5){
HD_channel = HD_Ambient5.play(0, 99999);
};
HD_Muted = false;
};
}
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;
NPH_gamemode = "paused";
if (NPH_Muted == false){
if (NPH_Muted == false){
NPH_ButtonClick.play();
};
};
playbutton.x = 119;
pausebutton.x = 900;
NPH_PausedTimer1 = getTimer();
_local2 = (NPH_Enemies.length - 1);
while (_local2 >= 0) {
NPH_Enemies[_local2].pPaused = true;
_local2--;
};
}
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 Min30_CheckEnemiesForHit():void{
var i:int;
var k:int;
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var a:int;
if (Min30_gamemode != "paused"){
try {
i = (Min30_Enemies.length - 1);
while (i >= 0) {
k = (Min30_Bullets.length - 1);
while (k >= 0) {
if (Min30_Enemies[i].hitTestObject(Min30_Bullets[k])){
Min30_Enemies[i].GotHit(Min30_Bullets[k].pDamage, Min30_Bullets[k].pBulletType);
if (Min30_Bullets[k].pBulletType == 2){
if (Min30_Enemies[i].pSpeed > 0.3){
Min30_Enemies[i].pSpeed = (Min30_Enemies[i].pSpeed - 0.2);
};
};
if (Min30_Bullets[k].pBulletType == 4){
a = (Min30_Enemies.length - 1);
while (a >= 0) {
xdist = Math.round((Min30_Bullets[k].x - Min30_Enemies[a].x));
ydist = Math.round((Min30_Bullets[k].y - Min30_Enemies[a].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < 50){
if (a != Min30_Bullets[k].pTarget){
Min30_Enemies[a].GotHit(((5 * Min30_Towers[Min30_Bullets[k].pTower].pLevel) * 0.75), 4);
};
};
a = (a - 1);
};
};
Min30_Bullets[k].x = -100;
Min30_Bullets[k].y = -100;
removeChild(Min30_Bullets[k].pBullet);
Min30_Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function Min10_sell_tower_click(_arg1:MouseEvent):void{
if (Min10_gamemode != "paused"){
if (Min10_SelectedTower != -1){
if (Min10_Towers[Min10_SelectedTower].pTowerType == 10){
Min10_PlacedMine = false;
};
Min10_Gold = (Min10_Gold + int((0.9 * (Min10_Towers[Min10_SelectedTower].pCost * Min10_Towers[Min10_SelectedTower].pLevel))));
text_gold.text = String(Min10_Gold);
removeChild(Min10_Towers[Min10_SelectedTower]);
Min10_Towers.splice(Min10_SelectedTower, 1);
Min10_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 SB_tower_select_cannon_mouse_up(_arg1:MouseEvent):void{
if (SB_gamemode != "paused"){
if (SB_gamemode == "set_tower"){
if (SB_selectedtowertype == "Cannon"){
SB_gamemode = "off";
TheGrid1.alpha = 0;
if (SB_Muted == false){
SB_ButtonClick.play();
};
SB_selectedtowertype = "none";
} else {
if (SB_selectedtowertype != "Cannon"){
SB_gamemode = "set_tower";
if (SB_Muted == false){
SB_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
SB_selectedtowertype = "Cannon";
};
};
} else {
if (SB_gamemode != "set_tower"){
SB_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (SB_Muted == false){
SB_ButtonClick.play();
};
SB_selectedtowertype = "Cannon";
};
};
};
}
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";
};
};
};
}
public function IN_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
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);
};
};
}
public function Min5_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
if (road_1.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_2.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_3.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_4.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_5.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_6.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_7.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_8.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_9.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_10.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_11.hitTestPoint(_local3, _local4)){
return (true);
};
return (false);
}
public function Min5_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = (("Upgrade(" + (Min5_Towers[Min5_SelectedTower].pCost * (Min5_Towers[Min5_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
}
public function tower_select_cannon_mouse_up(_arg1:MouseEvent):void{
if (gamemode != "paused"){
if (gamemode == "set_tower"){
if (selectedtowertype == "Cannon"){
gamemode = "off";
TheGrid1.alpha = 0;
if (Muted == false){
ButtonClick.play();
};
selectedtowertype = "none";
} else {
if (selectedtowertype != "Cannon"){
gamemode = "set_tower";
if (Muted == false){
ButtonClick.play();
};
TheGrid1.alpha = 0.5;
selectedtowertype = "Cannon";
};
};
} else {
if (gamemode != "set_tower"){
gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (Muted == false){
ButtonClick.play();
};
selectedtowertype = "Cannon";
};
};
};
}
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 < 0){
drawonme.removeChild(NP_Blizzards[_local1]);
NP_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
public function NPI_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
if (NPI_gamemode != "paused"){
if (NPI_Towers[NPI_SelectedTower].pLevel < 15){
if (NPI_Gold >= (NPI_Towers[NPI_SelectedTower].pCost * (NPI_Towers[NPI_SelectedTower].pLevel + 1))){
NPI_Gold = (NPI_Gold - (NPI_Towers[NPI_SelectedTower].pCost * (NPI_Towers[NPI_SelectedTower].pLevel + 1)));
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].pDamage * 1.25);
upgrade_tower.x = 900;
text_towertype.text = (("Upgrade(" + (NPI_Towers[NPI_SelectedTower].pCost * (NPI_Towers[NPI_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_damage.text = ("Tower Damage - " + Math.round(NPI_Towers[NPI_SelectedTower].pDamage));
text_tower_range.text = ("Tower Range - " + NPI_Towers[NPI_SelectedTower].pRange);
text_tower_level.text = ("Tower Level - " + 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))));
};
};
};
}
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 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 NPI_the_grid_place_tower_enter(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (NPI_gamemode != "paused"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (NPI_selectedtowertype == "Arrow"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NPI_selectedtowertype == "Arcane"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NPI_selectedtowertype == "Cannon"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 125);
drawonme.graphics.endFill();
};
if (NPI_selectedtowertype == "Fire"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NPI_selectedtowertype == "Ice"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 150);
drawonme.graphics.endFill();
};
};
};
};
}
public function NP_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
return (false);
}
public function NPH_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
NPH_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 119;
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_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--;
};
}
public function NPI_musicmute_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Mute Sound";
text_towerinfo.text = "Mutes all sound.";
}
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 NPH_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
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;
removeChild(NPS_Bullets[a].pBullet);
NPS_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
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 < 0){
drawonme.removeChild(NPI_Blizzards[_local1]);
NPI_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
public function Min30_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(300g)";
text_towerinfo.text = "Calls forth a Blizzard";
}
public function NPS_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(300g)";
text_towerinfo.text = "Calls forth a Blizzard";
}
public function NP_the_grid_place_tower_enter(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (NP_gamemode != "paused"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (NP_selectedtowertype == "Arrow"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NP_selectedtowertype == "Arcane"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NP_selectedtowertype == "Cannon"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 125);
drawonme.graphics.endFill();
};
if (NP_selectedtowertype == "Fire"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NP_selectedtowertype == "Ice"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 150);
drawonme.graphics.endFill();
};
};
};
};
}
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 Min5_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (Min5_gamemode != "paused"){
if (Min5_Gold >= 500){
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
Min5_Gold = (Min5_Gold - 500);
text_gold.text = String(Min5_Gold);
_local2 = 0;
while (_local2 < 50) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
Min5_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
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 SB_everytime(_arg1:Event):void{
var b:int;
var mX:int;
var mY:int;
var didHit:Boolean;
var event = _arg1;
try {
if (SB_gamemode != "paused"){
SB_CheckEnemiesForDirections();
SB_CheckTowerFireBullet();
SB_MoveBullets();
SB_CheckEnemiesForHit();
SB_CheckEnemyHealth();
SB_UpdateEnemyHealthBar();
SB_CheckSelectedTower();
SB_MoveAndCheckAngelsOfDeath();
SB_MoveAndCheckBlizzard();
if (getTimer() > (SB_LastWave + SB_WaveDelay)){
SB_placeenemies();
};
text_next_level.text = String(Math.round((((SB_WaveDelay + SB_LastWave) - getTimer()) / 1000)));
if (SB_PlacedMine == true){
text_next_gold.text = String(Math.round((((SB_GoldUpdateSpeed + SB_LastGoldUpdate) - getTimer()) / 1000)));
if (getTimer() > (SB_LastGoldUpdate + SB_GoldUpdateSpeed)){
SB_Gold = (SB_Gold + (SB_Gold * 0.05));
text_gold.text = String(SB_Gold);
SB_LastGoldUpdate = getTimer();
};
};
if (SB_gamemode == "set_tower"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
didHit = SB_checkpathcollision(mX, mY);
TheGrid1.graphics.clear();
if (didHit == false){
TheGrid1.graphics.moveTo(mX, mY);
TheGrid1.graphics.beginFill(0xFFFFFF);
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)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (SB_selectedtowertype == "Arrow"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (SB_selectedtowertype == "Arcane"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (SB_selectedtowertype == "Cannon"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 125);
TheGrid1.graphics.endFill();
};
if (SB_selectedtowertype == "Fire"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 200);
TheGrid1.graphics.endFill();
};
if (SB_selectedtowertype == "Ice"){
mX = (int((root.mouseX / 32)) * 32);
mY = (int((root.mouseY / 32)) * 32);
TheGrid1.graphics.beginFill(0xFFFFFF, 0.2);
TheGrid1.graphics.drawCircle((mX + 16), (mY + 16), 150);
TheGrid1.graphics.endFill();
};
};
};
};
b = (SB_Towers.length - 1);
while (b >= 0) {
SB_Towers[b].graphics.clear();
b = (b - 1);
};
drawonme.graphics.clear();
if (SB_SelectedTower != -1){
mX = 0;
mY = 0;
SB_Towers[SB_SelectedTower].graphics.clear();
SB_Towers[SB_SelectedTower].graphics.moveTo(mX, mY);
SB_Towers[SB_SelectedTower].graphics.beginFill(0xFFFFFF, 0.5);
SB_Towers[SB_SelectedTower].graphics.lineTo(mX, mY);
SB_Towers[SB_SelectedTower].graphics.lineTo((mX + 32), mY);
SB_Towers[SB_SelectedTower].graphics.lineTo((mX + 32), (mY + 32));
SB_Towers[SB_SelectedTower].graphics.lineTo(mX, (mY + 32));
SB_Towers[SB_SelectedTower].graphics.endFill();
if (SB_Towers[SB_SelectedTower].pTowerType <= 5){
upgrade_tower.x = 524;
} else {
upgrade_tower.x = 900;
};
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((SB_Towers[SB_SelectedTower].x + 16), (SB_Towers[SB_SelectedTower].y + 16), SB_Towers[SB_SelectedTower].pRange);
drawonme.graphics.endFill();
};
};
} catch(e:TypeError) {
};
}
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_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;
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 SB_MoveAndCheckAngelsOfDeath():void{
var _local1:int;
var _local2:int;
if (SB_gamemode != "paused"){
_local1 = (SB_AngelsOfDeath.length - 1);
while (_local1 >= 0) {
_local2 = (SB_Enemies.length - 1);
while (_local2 >= 0) {
if (SB_Enemies[_local2].hitTestObject(SB_AngelsOfDeath[_local1])){
SB_Enemies[_local2].GotHit(25, 1);
};
_local2--;
};
if (SB_AngelsOfDeath[_local1].y < 0){
drawonme.removeChild(SB_AngelsOfDeath[_local1]);
SB_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
public function Min5_musicright_mouse_up(_arg1:MouseEvent):void{
if (Min5_Muted == false){
Min5_CurrentSong++;
if (Min5_CurrentSong == 6){
Min5_CurrentSong = 1;
};
Min5_channel.stop();
if (Min5_CurrentSong == 1){
Min5_channel = Min5_Ambient1.play(0, 99999);
};
if (Min5_CurrentSong == 2){
Min5_channel = Min5_Ambient2.play(0, 99999);
};
if (Min5_CurrentSong == 3){
Min5_channel = Min5_Ambient3.play(0, 99999);
};
if (Min5_CurrentSong == 4){
Min5_channel = Min5_Ambient4.play(0, 99999);
};
if (Min5_CurrentSong == 5){
Min5_channel = Min5_Ambient5.play(0, 99999);
};
};
}
public function NPI_buy_blizzard_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Blizzard(300g)";
text_towerinfo.text = "Calls forth a Blizzard";
}
public function Min10_buy_angel_death_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Angel of Death(500g)";
text_towerinfo.text = "Calls forth the Angel of Death";
}
public function musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function Min30_the_grid_place_tower(_arg1:MouseEvent):void{
var _local2:tower_arrow;
var _local3:tower_arcane;
var _local4:tower_cannon;
var _local5:tower_ice;
var _local6:tower_fire;
var _local7:building_mine;
if (Min30_gamemode != "paused"){
if (Min30_gamemode == "set_tower"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (Min30_selectedtowertype == "Arrow"){
if (Min30_Gold >= 30){
_local2 = new tower_arrow();
_local2.x = (int((root.mouseX / 32)) * 32);
_local2.y = (int((root.mouseY / 32)) * 32);
addChild(_local2);
Min30_Towers.push(_local2);
Min30_Gold = (Min30_Gold - 30);
text_gold.text = String(Min30_Gold);
};
};
if (Min30_selectedtowertype == "Arcane"){
if (Min30_Gold >= 125){
_local3 = new tower_arcane();
_local3.x = (int((root.mouseX / 32)) * 32);
_local3.y = (int((root.mouseY / 32)) * 32);
addChild(_local3);
Min30_Towers.push(_local3);
Min30_Gold = (Min30_Gold - 125);
text_gold.text = String(Min30_Gold);
};
};
if (Min30_selectedtowertype == "Cannon"){
if (Min30_Gold >= 75){
_local4 = new tower_cannon();
_local4.x = (int((root.mouseX / 32)) * 32);
_local4.y = (int((root.mouseY / 32)) * 32);
addChild(_local4);
Min30_Towers.push(_local4);
Min30_Gold = (Min30_Gold - 75);
text_gold.text = String(Min30_Gold);
};
};
if (Min30_selectedtowertype == "Ice"){
if (Min30_Gold >= 25){
_local5 = new tower_ice();
_local5.x = (int((root.mouseX / 32)) * 32);
_local5.y = (int((root.mouseY / 32)) * 32);
addChild(_local5);
Min30_Towers.push(_local5);
Min30_Gold = (Min30_Gold - 25);
text_gold.text = String(Min30_Gold);
};
};
if (Min30_selectedtowertype == "Fire"){
if (Min30_Gold >= 100){
_local6 = new tower_fire();
_local6.x = (int((root.mouseX / 32)) * 32);
_local6.y = (int((root.mouseY / 32)) * 32);
addChild(_local6);
Min30_Towers.push(_local6);
Min30_Gold = (Min30_Gold - 100);
text_gold.text = String(Min30_Gold);
};
};
if (Min30_selectedtowertype == "Mine"){
if (Min30_PlacedMine == false){
if (Min30_Gold >= 750){
_local7 = new building_mine();
_local7.x = (int((root.mouseX / 32)) * 32);
_local7.y = (int((root.mouseY / 32)) * 32);
addChild(_local7);
Min30_Towers.push(_local7);
text_next_gold.x = _local7.x;
text_next_gold.y = (_local7.y + 6);
addChild(text_next_gold);
Min30_Gold = (Min30_Gold - 750);
text_gold.text = String(Min30_Gold);
Min30_PlacedMine = true;
Min30_LastGoldUpdate = getTimer();
};
};
};
};
};
};
Min30_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 HD_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (HD_gamemode != "paused"){
if (HD_Gold >= 300){
if (HD_Muted == false){
HD_ButtonClick.play();
};
HD_Gold = (HD_Gold - 300);
text_gold.text = String(HD_Gold);
_local2 = 0;
while (_local2 < 100) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
HD_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function Min5_nextlevelbutton_mouse_up(_arg1:MouseEvent):void{
if (Min5_gamemode != "paused"){
if (Min5_Enemies.length < 35){
if (Min5_GameLevel != 0){
Min5_GameScore = (Min5_GameScore + Math.round((((Min5_WaveDelay + Min5_LastWave) - getTimer()) / 1000)));
text_score.text = String(Min5_GameScore);
};
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
Min5_placeenemies();
};
};
}
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 Min5_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (Min5_gamemode != "paused"){
if (Min5_Gold >= 300){
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
Min5_Gold = (Min5_Gold - 300);
text_gold.text = String(Min5_Gold);
_local2 = 0;
while (_local2 < 100) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
Min5_Blizzards.push(_local3);
_local2++;
};
};
};
}
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;
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 Min5_tower_select_ice_mouse_up(_arg1:MouseEvent):void{
if (Min5_gamemode != "paused"){
if (Min5_gamemode == "set_tower"){
if (Min5_selectedtowertype == "Ice"){
Min5_gamemode = "off";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
TheGrid1.alpha = 0;
Min5_selectedtowertype = "none";
} else {
if (Min5_selectedtowertype != "Ice"){
Min5_gamemode = "set_tower";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min5_selectedtowertype = "Ice";
};
};
} else {
if (Min5_gamemode != "set_tower"){
Min5_gamemode = "set_tower";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min5_selectedtowertype = "Ice";
};
};
};
}
public function Min30_road_deselect(_arg1:MouseEvent):void{
TheGrid1.graphics.clear();
TheGrid1.alpha = 0;
Min30_gamemode = "none";
Min30_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_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
} catch(e:TypeError) {
};
}
public function NPS_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (NPS_gamemode != "paused"){
if (NPS_Gold >= 300){
if (NPS_Muted == false){
if (NPS_Muted == false){
NPS_ButtonClick.play();
};
};
NPS_Gold = (NPS_Gold - 300);
text_gold.text = String(NPS_Gold);
_local2 = 0;
while (_local2 < 100) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
NPS_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function Min5_the_grid_place_tower(_arg1:MouseEvent):void{
var _local2:tower_arrow;
var _local3:tower_arcane;
var _local4:tower_cannon;
var _local5:tower_ice;
var _local6:tower_fire;
var _local7:building_mine;
if (Min5_gamemode != "paused"){
if (Min5_gamemode == "set_tower"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (Min5_selectedtowertype == "Arrow"){
if (Min5_Gold >= 30){
_local2 = new tower_arrow();
_local2.x = (int((root.mouseX / 32)) * 32);
_local2.y = (int((root.mouseY / 32)) * 32);
addChild(_local2);
Min5_Towers.push(_local2);
Min5_Gold = (Min5_Gold - 30);
text_gold.text = String(Min5_Gold);
};
};
if (Min5_selectedtowertype == "Arcane"){
if (Min5_Gold >= 125){
_local3 = new tower_arcane();
_local3.x = (int((root.mouseX / 32)) * 32);
_local3.y = (int((root.mouseY / 32)) * 32);
addChild(_local3);
Min5_Towers.push(_local3);
Min5_Gold = (Min5_Gold - 125);
text_gold.text = String(Min5_Gold);
};
};
if (Min5_selectedtowertype == "Cannon"){
if (Min5_Gold >= 75){
_local4 = new tower_cannon();
_local4.x = (int((root.mouseX / 32)) * 32);
_local4.y = (int((root.mouseY / 32)) * 32);
addChild(_local4);
Min5_Towers.push(_local4);
Min5_Gold = (Min5_Gold - 75);
text_gold.text = String(Min5_Gold);
};
};
if (Min5_selectedtowertype == "Ice"){
if (Min5_Gold >= 25){
_local5 = new tower_ice();
_local5.x = (int((root.mouseX / 32)) * 32);
_local5.y = (int((root.mouseY / 32)) * 32);
addChild(_local5);
Min5_Towers.push(_local5);
Min5_Gold = (Min5_Gold - 25);
text_gold.text = String(Min5_Gold);
};
};
if (Min5_selectedtowertype == "Fire"){
if (Min5_Gold >= 100){
_local6 = new tower_fire();
_local6.x = (int((root.mouseX / 32)) * 32);
_local6.y = (int((root.mouseY / 32)) * 32);
addChild(_local6);
Min5_Towers.push(_local6);
Min5_Gold = (Min5_Gold - 100);
text_gold.text = String(Min5_Gold);
};
};
if (Min5_selectedtowertype == "Mine"){
if (Min5_PlacedMine == false){
if (Min5_Gold >= 750){
_local7 = new building_mine();
_local7.x = (int((root.mouseX / 32)) * 32);
_local7.y = (int((root.mouseY / 32)) * 32);
addChild(_local7);
Min5_Towers.push(_local7);
text_next_gold.x = _local7.x;
text_next_gold.y = (_local7.y + 6);
addChild(text_next_gold);
Min5_Gold = (Min5_Gold - 750);
text_gold.text = String(Min5_Gold);
Min5_PlacedMine = true;
Min5_LastGoldUpdate = getTimer();
};
};
};
};
};
};
Min5_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 SB_tower_select_arrow_mouse_up(_arg1:MouseEvent):void{
if (SB_gamemode != "paused"){
if (SB_gamemode == "set_tower"){
if (SB_selectedtowertype == "Arrow"){
if (SB_Muted == false){
SB_ButtonClick.play();
};
SB_gamemode = "off";
TheGrid1.alpha = 0;
SB_selectedtowertype = "none";
} else {
if (SB_selectedtowertype != "Arrow"){
SB_gamemode = "set_tower";
if (SB_Muted == false){
SB_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
SB_selectedtowertype = "Arrow";
};
};
} else {
if (SB_gamemode != "set_tower"){
SB_gamemode = "set_tower";
if (SB_Muted == false){
SB_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
SB_selectedtowertype = "Arrow";
};
};
};
}
public function Min5_tower_select_arrow_mouse_up(_arg1:MouseEvent):void{
if (Min5_gamemode != "paused"){
if (Min5_gamemode == "set_tower"){
if (Min5_selectedtowertype == "Arrow"){
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
Min5_gamemode = "off";
TheGrid1.alpha = 0;
Min5_selectedtowertype = "none";
} else {
if (Min5_selectedtowertype != "Arrow"){
Min5_gamemode = "set_tower";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min5_selectedtowertype = "Arrow";
};
};
} else {
if (Min5_gamemode != "set_tower"){
Min5_gamemode = "set_tower";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min5_selectedtowertype = "Arrow";
};
};
};
}
public function Min10_the_grid_place_tower_enter(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (Min10_gamemode != "paused"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (Min10_selectedtowertype == "Arrow"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (Min10_selectedtowertype == "Arcane"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (Min10_selectedtowertype == "Cannon"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 125);
drawonme.graphics.endFill();
};
if (Min10_selectedtowertype == "Fire"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (Min10_selectedtowertype == "Ice"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 150);
drawonme.graphics.endFill();
};
};
};
};
}
public function Min30_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = (("Upgrade(" + (Min30_Towers[Min30_SelectedTower].pCost * (Min30_Towers[Min30_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
}
public function NPH_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = (("Upgrade(" + (NPH_Towers[NPH_SelectedTower].pCost * (NPH_Towers[NPH_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
}
public function 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 (gamemode != "paused"){
_local1 = (Enemies.length - 1);
while (_local1 >= 0) {
if (Enemies[_local1].y > 500){
Lives = (Lives - 1);
text_lives.text = String(Lives);
if (Lives < 1){
_local5 = (HealthBars.length - 1);
while (_local5 >= 0) {
removeChild(HealthBars[_local5]);
HealthBars.splice(_local5, 1);
_local5--;
};
_local6 = (Bullets.length - 1);
while (_local6 >= 0) {
removeChild(Bullets[_local6]);
Bullets.splice(_local6, 1);
_local6--;
};
_local7 = (Towers.length - 1);
while (_local7 >= 0) {
removeChild(Towers[_local7]);
Towers.splice(_local7, 1);
_local7--;
};
_local8 = (Enemies.length - 1);
while (_local8 >= 0) {
removeChild(Enemies[_local8]);
Enemies.splice(_local8, 1);
_local8--;
};
removeEventListener(Event.ENTER_FRAME, everytime);
channel.stop();
gotoAndStop(40);
};
removeChild(Enemies[_local1]);
Enemies.splice(_local1, 1);
_local2 = (HealthBars.length - 1);
while (_local2 >= 0) {
if (HealthBars[_local2].pEnemy == _local1){
HealthBars[_local2].x = -900;
removeChild(HealthBars[_local2]);
HealthBars.splice(_local2, 1);
};
if (HealthBars[_local2].pEnemy > _local1){
HealthBars[_local2].pEnemy = (HealthBars[_local2].pEnemy - 1);
};
_local2--;
};
_local3 = (Bullets.length - 1);
while (_local3 >= 0) {
if (Bullets[_local3].pTarget > _local1){
Bullets[_local3].pTarget = (Bullets[_local3].pTarget - 1);
};
if (Bullets[_local3].pTarget == _local1){
Bullets[_local3].x = -100;
Bullets[_local3].y = -100;
removeChild(Bullets[_local3].pBullet);
Bullets.splice(_local3, 1);
};
_local3--;
};
_local4 = (Towers.length - 1);
while (_local4 >= 0) {
if (Towers[_local4].pTarget == _local1){
Towers[_local4].pTarget = -1;
};
if (Towers[_local4].pTarget > _local1){
Towers[_local4].pTarget = (Towers[_local4].pTarget - 1);
};
_local4--;
};
};
if (Enemies[_local1].hitTestObject(tp1)){
Enemies[_local1].pTheDirection = 2;
};
if (Enemies[_local1].hitTestObject(tp2)){
Enemies[_local1].pTheDirection = 1;
};
if (Enemies[_local1].hitTestObject(tp3)){
Enemies[_local1].pTheDirection = 3;
};
if (Enemies[_local1].hitTestObject(tp4)){
Enemies[_local1].pTheDirection = 1;
};
if (Enemies[_local1].hitTestObject(tp5)){
Enemies[_local1].pTheDirection = 2;
};
if (Enemies[_local1].hitTestObject(tp6)){
Enemies[_local1].pTheDirection = 4;
};
if (Enemies[_local1].hitTestObject(tp7)){
Enemies[_local1].pTheDirection = 2;
};
if (Enemies[_local1].hitTestObject(tp8)){
Enemies[_local1].pTheDirection = 1;
};
if (Enemies[_local1].hitTestObject(tp9)){
Enemies[_local1].pTheDirection = 3;
};
if (Enemies[_local1].hitTestObject(tp10)){
Enemies[_local1].pTheDirection = 1;
};
_local1--;
};
};
}
public function NP_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = (("Upgrade(" + (NP_Towers[NP_SelectedTower].pCost * (NP_Towers[NP_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
}
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 NPH_the_grid_place_tower_enter(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (NPH_gamemode != "paused"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (NPH_selectedtowertype == "Arrow"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NPH_selectedtowertype == "Arcane"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NPH_selectedtowertype == "Cannon"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 125);
drawonme.graphics.endFill();
};
if (NPH_selectedtowertype == "Fire"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NPH_selectedtowertype == "Ice"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 150);
drawonme.graphics.endFill();
};
};
};
};
}
public function HD_MoveAndCheckAngelsOfDeath():void{
var _local1:int;
var _local2:int;
if (HD_gamemode != "paused"){
_local1 = (HD_AngelsOfDeath.length - 1);
while (_local1 >= 0) {
_local2 = (HD_Enemies.length - 1);
while (_local2 >= 0) {
if (HD_Enemies[_local2].hitTestObject(HD_AngelsOfDeath[_local1])){
HD_Enemies[_local2].GotHit(25, 1);
};
_local2--;
};
if (HD_AngelsOfDeath[_local1].y < 0){
drawonme.removeChild(HD_AngelsOfDeath[_local1]);
HD_AngelsOfDeath.splice(_local1, 1);
};
_local1--;
};
};
}
public function NPH_upgrade_tower_mouse_up(_arg1:MouseEvent):void{
if (NPH_gamemode != "paused"){
if (NPH_Towers[NPH_SelectedTower].pLevel < 15){
if (NPH_Gold >= (NPH_Towers[NPH_SelectedTower].pCost * (NPH_Towers[NPH_SelectedTower].pLevel + 1))){
NPH_Gold = (NPH_Gold - (NPH_Towers[NPH_SelectedTower].pCost * (NPH_Towers[NPH_SelectedTower].pLevel + 1)));
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].pDamage * 1.25);
upgrade_tower.x = 900;
text_towertype.text = (("Upgrade(" + (NPH_Towers[NPH_SelectedTower].pCost * (NPH_Towers[NPH_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
text_tower_damage.text = ("Tower Damage - " + Math.round(NPH_Towers[NPH_SelectedTower].pDamage));
text_tower_range.text = ("Tower Range - " + NPH_Towers[NPH_SelectedTower].pRange);
text_tower_level.text = ("Tower Level - " + 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))));
};
};
};
}
public function NP_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (NP_gamemode != "paused"){
if (NP_Gold >= 300){
if (NP_Muted == false){
if (NP_Muted == false){
NP_ButtonClick.play();
};
};
NP_Gold = (NP_Gold - 300);
text_gold.text = String(NP_Gold);
_local2 = 0;
while (_local2 < 100) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
NP_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function Min10_tower_select_fire_mouse_up(_arg1:MouseEvent):void{
if (Min10_gamemode != "paused"){
if (Min10_gamemode == "set_tower"){
if (Min10_selectedtowertype == "Fire"){
Min10_gamemode = "off";
TheGrid1.alpha = 0;
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
Min10_selectedtowertype = "none";
} else {
if (Min10_selectedtowertype != "Fire"){
Min10_gamemode = "set_tower";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min10_selectedtowertype = "Fire";
};
};
} else {
if (Min10_gamemode != "set_tower"){
Min10_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
Min10_selectedtowertype = "Fire";
};
};
};
}
public function IN_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function Min10_MoveBullets():void{
var i:int;
var a:int;
if (Min10_gamemode != "paused"){
try {
i = (Min10_Bullets.length - 1);
while (i >= 0) {
Min10_Bullets[i].movebullet(Min10_Enemies[Min10_Bullets[i].pTarget].x, Min10_Enemies[Min10_Bullets[i].pTarget].y);
i = (i - 1);
};
} catch(e:TypeError) {
a = (Min10_Bullets.length - 1);
while (a >= 0) {
Min10_Bullets[a].x = -900;
Min10_Bullets[a].y = -900;
Min10_Bullets[a].pTarget = -1;
removeChild(Min10_Bullets[a].pBullet);
Min10_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
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;
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;
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;
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;
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;
addChild(Bullet5);
NP_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function HD_MoveAndCheckBlizzard():void{
var _local1:int;
var _local2:int;
if (HD_gamemode != "paused"){
_local1 = (HD_Blizzards.length - 1);
while (_local1 >= 0) {
_local2 = (HD_Enemies.length - 1);
while (_local2 >= 0) {
if (HD_Enemies[_local2].hitTestObject(HD_Blizzards[_local1])){
HD_Enemies[_local2].pSpeed = 0;
};
_local2--;
};
if (HD_Blizzards[_local1].y < 0){
drawonme.removeChild(HD_Blizzards[_local1]);
HD_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
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;
};
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) {
_local2 = new Point(Math.round((NPS_Enemies[_local4].x / 32)), Math.round((NPS_Enemies[_local4].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local3 = NPS_Enemies[_local4].pSpeed;
NPS_Enemies[_local4].pSpeed = 0;
NPS_Path = Pathfinding.findPath(NPS_Map, _local2.y, _local2.x, NPS_MapEnd.y, NPS_MapEnd.x);
NPS_Enemies[_local4].pSpeed = _local3;
NPS_Enemies[_local4].pPath = NPS_Path;
NPS_Enemies[_local4].mapchange();
_local4--;
};
NPS_Gold = (NPS_Gold + int((0.7 * (NPS_Towers[NPS_SelectedTower].pCost * NPS_Towers[NPS_SelectedTower].pLevel))));
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 IN_tower_select_cannon_mouse_up(_arg1:MouseEvent):void{
if (IN_gamemode != "paused"){
if (IN_gamemode == "set_tower"){
if (IN_selectedtowertype == "Cannon"){
IN_gamemode = "off";
TheGrid1.alpha = 0;
if (IN_Muted == false){
IN_ButtonClick.play();
};
IN_selectedtowertype = "none";
} else {
if (IN_selectedtowertype != "Cannon"){
IN_gamemode = "set_tower";
if (IN_Muted == false){
IN_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
IN_selectedtowertype = "Cannon";
};
};
} else {
if (IN_gamemode != "set_tower"){
IN_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (IN_Muted == false){
IN_ButtonClick.play();
};
IN_selectedtowertype = "Cannon";
};
};
};
}
public function SB_placeenemies():void{
var _local1:*;
var _local2:script_enemy_normal;
var _local3:enemy_health_bar;
var _local4:script_enemy_armor;
var _local5:enemy_health_bar;
var _local6:script_enemy_fast;
var _local7:enemy_health_bar;
var _local8:script_enemy_immune;
var _local9:enemy_health_bar;
var _local10:script_enemy_boss;
var _local11:enemy_health_bar;
if (SB_gamemode != "paused"){
SB_GameLevel = (SB_GameLevel + 1);
_local1 = 0;
while (_local1 < 25) {
if (SB_LastEnemyType == 1){
_local2 = new script_enemy_normal(_local1, SB_GameLevel, "hard");
addChild(_local2);
SB_Enemies.push(_local2);
SB_LastWave = getTimer();
text_level.text = String(SB_GameLevel);
_local3 = new enemy_health_bar();
_local3.pEnemy = (SB_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);
SB_HealthBars.push(_local3);
} else {
if (SB_LastEnemyType == 2){
_local4 = new script_enemy_armor(_local1, SB_GameLevel, "hard");
addChild(_local4);
SB_Enemies.push(_local4);
SB_LastWave = getTimer();
text_level.text = String(SB_GameLevel);
_local5 = new enemy_health_bar();
_local5.pEnemy = (SB_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);
SB_HealthBars.push(_local5);
} else {
if (SB_LastEnemyType == 3){
_local6 = new script_enemy_fast(_local1, SB_GameLevel, "hard");
addChild(_local6);
SB_Enemies.push(_local6);
SB_LastWave = getTimer();
text_level.text = String(SB_GameLevel);
_local7 = new enemy_health_bar();
_local7.pEnemy = (SB_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);
SB_HealthBars.push(_local7);
};
};
};
if (SB_LastEnemyType == 4){
_local8 = new script_enemy_immune(_local1, SB_GameLevel, "hard");
addChild(_local8);
SB_Enemies.push(_local8);
SB_LastWave = getTimer();
text_level.text = String(SB_GameLevel);
_local9 = new enemy_health_bar();
_local9.pEnemy = (SB_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);
SB_HealthBars.push(_local9);
};
_local1++;
};
if (SB_LastEnemyType == 5){
_local10 = new script_enemy_boss(0, SB_GameLevel, "hard");
addChild(_local10);
SB_Enemies.push(_local10);
SB_LastWave = getTimer();
text_level.text = String(SB_GameLevel);
_local11 = new enemy_health_bar();
_local11.pEnemy = (SB_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);
SB_HealthBars.push(_local11);
};
SB_LastEnemyType = (SB_LastEnemyType + 1);
if (SB_LastEnemyType == 6){
SB_LastEnemyType = 1;
};
};
}
public function play5min(_arg1:MouseEvent):void{
gotoAndStop(65);
}
public function Min5_playbutton_mouse_up(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:int;
var _local4:int;
Min5_gamemode = "none";
playbutton.x = 900;
pausebutton.x = 119;
Min5_PausedTimer2 = getTimer();
_local2 = (Min5_PausedTimer2 - Min5_PausedTimer1);
_local3 = (Min5_Towers.length - 1);
while (_local3 >= 0) {
Min5_Towers[_local3].pLastFire = (Min5_Towers[_local3].pLastFire + _local2);
_local3--;
};
Min5_TimeLeft = (Min5_TimeLeft + _local2);
Min5_LastGoldUpdate = (Min5_LastGoldUpdate + _local2);
Min5_LastWave = (Min5_LastWave + _local2);
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
_local4 = (Min5_Enemies.length - 1);
while (_local4 >= 0) {
Min5_Enemies[_local4].pPaused = false;
_local4--;
};
}
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 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 Min5_the_grid_place_tower_enter(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (Min5_gamemode != "paused"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (Min5_selectedtowertype == "Arrow"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (Min5_selectedtowertype == "Arcane"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (Min5_selectedtowertype == "Cannon"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 125);
drawonme.graphics.endFill();
};
if (Min5_selectedtowertype == "Fire"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (Min5_selectedtowertype == "Ice"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 150);
drawonme.graphics.endFill();
};
};
};
};
}
public function placeenemies():void{
var _local1:*;
var _local2:script_enemy_normal;
var _local3:enemy_health_bar;
var _local4:script_enemy_armor;
var _local5:enemy_health_bar;
var _local6:script_enemy_fast;
var _local7:enemy_health_bar;
var _local8:script_enemy_immune;
var _local9:enemy_health_bar;
var _local10:script_enemy_boss;
var _local11:enemy_health_bar;
if (gamemode != "paused"){
GameLevel = (GameLevel + 1);
_local1 = 0;
while (_local1 < 25) {
if (LastEnemyType == 1){
_local2 = new script_enemy_normal(_local1, GameLevel, "normal");
addChild(_local2);
Enemies.push(_local2);
LastWave = getTimer();
text_level.text = String(GameLevel);
_local3 = new enemy_health_bar();
_local3.pEnemy = (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);
HealthBars.push(_local3);
} else {
if (LastEnemyType == 2){
_local4 = new script_enemy_armor(_local1, GameLevel, "normal");
addChild(_local4);
Enemies.push(_local4);
LastWave = getTimer();
text_level.text = String(GameLevel);
_local5 = new enemy_health_bar();
_local5.pEnemy = (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);
HealthBars.push(_local5);
} else {
if (LastEnemyType == 3){
_local6 = new script_enemy_fast(_local1, GameLevel, "normal");
addChild(_local6);
Enemies.push(_local6);
LastWave = getTimer();
text_level.text = String(GameLevel);
_local7 = new enemy_health_bar();
_local7.pEnemy = (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);
HealthBars.push(_local7);
};
};
};
if (LastEnemyType == 4){
_local8 = new script_enemy_immune(_local1, GameLevel, "normal");
addChild(_local8);
Enemies.push(_local8);
LastWave = getTimer();
text_level.text = String(GameLevel);
_local9 = new enemy_health_bar();
_local9.pEnemy = (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);
HealthBars.push(_local9);
};
_local1++;
};
if (LastEnemyType == 5){
_local10 = new script_enemy_boss(0, GameLevel, "normal");
addChild(_local10);
Enemies.push(_local10);
LastWave = getTimer();
text_level.text = String(GameLevel);
_local11 = new enemy_health_bar();
_local11.pEnemy = (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);
HealthBars.push(_local11);
};
LastEnemyType = (LastEnemyType + 1);
if (LastEnemyType == 6){
LastEnemyType = 1;
};
};
}
public function IN_the_grid_place_tower(_arg1:MouseEvent):void{
var _local2:tower_arrow;
var _local3:tower_arcane;
var _local4:tower_cannon;
var _local5:tower_ice;
var _local6:tower_fire;
var _local7:building_mine;
if (IN_gamemode != "paused"){
if (IN_gamemode == "set_tower"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (IN_selectedtowertype == "Arrow"){
if (IN_Gold >= 30){
_local2 = new tower_arrow();
_local2.x = (int((root.mouseX / 32)) * 32);
_local2.y = (int((root.mouseY / 32)) * 32);
addChild(_local2);
IN_Towers.push(_local2);
IN_Gold = (IN_Gold - 30);
text_gold.text = String(IN_Gold);
};
};
if (IN_selectedtowertype == "Arcane"){
if (IN_Gold >= 125){
_local3 = new tower_arcane();
_local3.x = (int((root.mouseX / 32)) * 32);
_local3.y = (int((root.mouseY / 32)) * 32);
addChild(_local3);
IN_Towers.push(_local3);
IN_Gold = (IN_Gold - 125);
text_gold.text = String(IN_Gold);
};
};
if (IN_selectedtowertype == "Cannon"){
if (IN_Gold >= 75){
_local4 = new tower_cannon();
_local4.x = (int((root.mouseX / 32)) * 32);
_local4.y = (int((root.mouseY / 32)) * 32);
addChild(_local4);
IN_Towers.push(_local4);
IN_Gold = (IN_Gold - 75);
text_gold.text = String(IN_Gold);
};
};
if (IN_selectedtowertype == "Ice"){
if (IN_Gold >= 25){
_local5 = new tower_ice();
_local5.x = (int((root.mouseX / 32)) * 32);
_local5.y = (int((root.mouseY / 32)) * 32);
addChild(_local5);
IN_Towers.push(_local5);
IN_Gold = (IN_Gold - 25);
text_gold.text = String(IN_Gold);
};
};
if (IN_selectedtowertype == "Fire"){
if (IN_Gold >= 100){
_local6 = new tower_fire();
_local6.x = (int((root.mouseX / 32)) * 32);
_local6.y = (int((root.mouseY / 32)) * 32);
addChild(_local6);
IN_Towers.push(_local6);
IN_Gold = (IN_Gold - 100);
text_gold.text = String(IN_Gold);
};
};
if (IN_selectedtowertype == "Mine"){
if (IN_PlacedMine == false){
if (IN_Gold >= 750){
_local7 = new building_mine();
_local7.x = (int((root.mouseX / 32)) * 32);
_local7.y = (int((root.mouseY / 32)) * 32);
addChild(_local7);
IN_Towers.push(_local7);
text_next_gold.x = _local7.x;
text_next_gold.y = (_local7.y + 6);
addChild(text_next_gold);
IN_Gold = (IN_Gold - 750);
text_gold.text = String(IN_Gold);
IN_PlacedMine = true;
IN_LastGoldUpdate = getTimer();
};
};
};
};
};
};
IN_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_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 IN_sell_tower_click(_arg1:MouseEvent):void{
if (IN_gamemode != "paused"){
if (IN_SelectedTower != -1){
if (IN_Towers[IN_SelectedTower].pTowerType == 10){
IN_PlacedMine = false;
};
IN_Gold = (IN_Gold + int((0.9 * (IN_Towers[IN_SelectedTower].pCost * IN_Towers[IN_SelectedTower].pLevel))));
text_gold.text = String(IN_Gold);
removeChild(IN_Towers[IN_SelectedTower]);
IN_Towers.splice(IN_SelectedTower, 1);
IN_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 NPS_upgrade_tower_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = (("Upgrade(" + (NPS_Towers[NPS_SelectedTower].pCost * (NPS_Towers[NPS_SelectedTower].pLevel + 1))) + "g)");
text_towerinfo.text = "Increases Tower Damage";
}
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;
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;
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;
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;
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;
addChild(Bullet5);
NPI_Bullets.push(Bullet5);
Bullet5.pTower = a;
};
};
};
};
};
};
};
};
a = (a - 1);
};
} catch(e:TypeError) {
};
};
}
public function Min5_tower_select_fire_mouse_up(_arg1:MouseEvent):void{
if (Min5_gamemode != "paused"){
if (Min5_gamemode == "set_tower"){
if (Min5_selectedtowertype == "Fire"){
Min5_gamemode = "off";
TheGrid1.alpha = 0;
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
Min5_selectedtowertype = "none";
} else {
if (Min5_selectedtowertype != "Fire"){
Min5_gamemode = "set_tower";
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min5_selectedtowertype = "Fire";
};
};
} else {
if (Min5_gamemode != "set_tower"){
Min5_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (Min5_Muted == false){
Min5_ButtonClick.play();
};
Min5_selectedtowertype = "Fire";
};
};
};
}
public function SB_sell_tower_click(_arg1:MouseEvent):void{
if (SB_gamemode != "paused"){
if (SB_SelectedTower != -1){
if (SB_Towers[SB_SelectedTower].pTowerType == 10){
SB_PlacedMine = false;
};
SB_Gold = (SB_Gold + int((0.9 * (SB_Towers[SB_SelectedTower].pCost * SB_Towers[SB_SelectedTower].pLevel))));
text_gold.text = String(SB_Gold);
removeChild(SB_Towers[SB_SelectedTower]);
SB_Towers.splice(SB_SelectedTower, 1);
SB_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 Min30_CheckSelectedTower():void{
var _local1:int;
var _local2:int;
if (Min30_gamemode != "paused"){
_local1 = (Min30_Towers.length - 1);
while (_local1 >= 0) {
if (Min30_Towers[_local1].CheckSelected() == true){
Min30_SelectedTower = _local1;
sell_tower.x = 524;
text_tower_damage.x = 495;
text_tower_level.x = 495;
text_tower_range.x = 495;
text_tower_sell.x = 495;
text_tower_damage.text = ("Tower Damage - " + Math.round(Min30_Towers[_local1].pDamage));
text_tower_range.text = ("Tower Range - " + Min30_Towers[_local1].pRange);
text_tower_level.text = ("Tower Level - " + Min30_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((Min30_Towers[_local1].pLevel * Min30_Towers[_local1].pCost) * 0.7))));
Min30_gamemode = "none";
TheGrid1.alpha = 0;
Min30_selectedtowertype = "none";
};
_local1--;
};
_local2 = (Min30_Towers.length - 1);
while (_local2 >= 0) {
Min30_Towers[_local2].pSelected = false;
_local2--;
};
};
}
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 = 495;
text_tower_level.x = 495;
text_tower_range.x = 495;
text_tower_sell.x = 495;
text_tower_damage.text = ("Tower Damage - " + Math.round(NPH_Towers[_local1].pDamage));
text_tower_range.text = ("Tower Range - " + NPH_Towers[_local1].pRange);
text_tower_level.text = ("Tower Level - " + NPH_Towers[_local1].pLevel);
text_tower_sell.text = ("Sell Value - " + String(int(((NPH_Towers[_local1].pLevel * NPH_Towers[_local1].pCost) * 0.7))));
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_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 playinsane(_arg1:MouseEvent):void{
gotoAndStop(55);
}
public function HD_tower_select_arcane_mouse_up(_arg1:MouseEvent):void{
if (HD_gamemode != "paused"){
if (HD_gamemode == "set_tower"){
if (HD_selectedtowertype == "Arcane"){
HD_gamemode = "off";
TheGrid1.alpha = 0;
if (HD_Muted == false){
HD_ButtonClick.play();
};
HD_selectedtowertype = "none";
} else {
if (HD_selectedtowertype != "Arcane"){
HD_gamemode = "set_tower";
if (HD_Muted == false){
HD_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
HD_selectedtowertype = "Arcane";
};
};
} else {
if (HD_gamemode != "set_tower"){
HD_gamemode = "set_tower";
if (HD_Muted == false){
HD_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
HD_selectedtowertype = "Arcane";
};
};
};
}
public function sell_tower_click(_arg1:MouseEvent):void{
if (gamemode != "paused"){
if (SelectedTower != -1){
if (Towers[SelectedTower].pTowerType == 10){
PlacedMine = false;
};
Gold = (Gold + int((0.9 * (Towers[SelectedTower].pCost * Towers[SelectedTower].pLevel))));
text_gold.text = String(Gold);
removeChild(Towers[SelectedTower]);
Towers.splice(SelectedTower, 1);
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_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 tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
} catch(e:TypeError) {
};
}
public function SB_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_musicleft_mouse_enter(_arg1:MouseEvent):void{
text_towertype.text = "Change Track";
text_towerinfo.text = "Changes to a new background track.";
}
public function Min10_MoveAndCheckBlizzard():void{
var _local1:int;
var _local2:int;
if (Min10_gamemode != "paused"){
_local1 = (Min10_Blizzards.length - 1);
while (_local1 >= 0) {
_local2 = (Min10_Enemies.length - 1);
while (_local2 >= 0) {
if (Min10_Enemies[_local2].hitTestObject(Min10_Blizzards[_local1])){
Min10_Enemies[_local2].pSpeed = 0;
};
_local2--;
};
if (Min10_Blizzards[_local1].y < 0){
drawonme.removeChild(Min10_Blizzards[_local1]);
Min10_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
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 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 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;
removeChild(NP_Bullets[a].pBullet);
NP_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
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 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 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 SB_MoveAndCheckBlizzard():void{
var _local1:int;
var _local2:int;
if (SB_gamemode != "paused"){
_local1 = (SB_Blizzards.length - 1);
while (_local1 >= 0) {
_local2 = (SB_Enemies.length - 1);
while (_local2 >= 0) {
if (SB_Enemies[_local2].hitTestObject(SB_Blizzards[_local1])){
SB_Enemies[_local2].pSpeed = 0;
};
_local2--;
};
if (SB_Blizzards[_local1].y < 0){
drawonme.removeChild(SB_Blizzards[_local1]);
SB_Blizzards.splice(_local1, 1);
};
_local1--;
};
};
}
public function musicleft_mouse_up(_arg1:MouseEvent):void{
if (Muted == false){
CurrentSong--;
if (CurrentSong == 0){
CurrentSong = 5;
};
channel.stop();
if (CurrentSong == 1){
channel = Ambient1.play(0, 99999);
};
if (CurrentSong == 2){
channel = Ambient2.play(0, 99999);
};
if (CurrentSong == 3){
channel = Ambient3.play(0, 99999);
};
if (CurrentSong == 4){
channel = Ambient4.play(0, 99999);
};
if (CurrentSong == 5){
channel = Ambient5.play(0, 99999);
};
};
}
public function Min30_tower_select_ice_mouse_up(_arg1:MouseEvent):void{
if (Min30_gamemode != "paused"){
if (Min30_gamemode == "set_tower"){
if (Min30_selectedtowertype == "Ice"){
Min30_gamemode = "off";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
TheGrid1.alpha = 0;
Min30_selectedtowertype = "none";
} else {
if (Min30_selectedtowertype != "Ice"){
Min30_gamemode = "set_tower";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min30_selectedtowertype = "Ice";
};
};
} else {
if (Min30_gamemode != "set_tower"){
Min30_gamemode = "set_tower";
if (Min30_Muted == false){
Min30_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min30_selectedtowertype = "Ice";
};
};
};
}
public function MoveAndCheckBlizzard():void{
var _local1:int;
var _local2:int;
if (gamemode != "paused"){
_local1 = (Blizzards.length - 1);
while (_local1 >= 0) {
_local2 = (Enemies.length - 1);
while (_local2 >= 0) {
if (Enemies[_local2].hitTestObject(Blizzards[_local1])){
Enemies[_local2].pSpeed = 0;
};
_local2--;
};
if (Blizzards[_local1].y < 0){
drawonme.removeChild(Blizzards[_local1]);
Blizzards.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;
};
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) {
_local2 = new Point(Math.round((NPH_Enemies[_local4].x / 32)), Math.round((NPH_Enemies[_local4].y / 32)));
if (_local2.y < 0){
_local2.y = 0;
};
_local3 = NPH_Enemies[_local4].pSpeed;
NPH_Enemies[_local4].pSpeed = 0;
NPH_Path = Pathfinding.findPath(NPH_Map, _local2.y, _local2.x, NPH_MapEnd.y, NPH_MapEnd.x);
NPH_Enemies[_local4].pSpeed = _local3;
NPH_Enemies[_local4].pPath = NPH_Path;
NPH_Enemies[_local4].mapchange();
_local4--;
};
NPH_Gold = (NPH_Gold + int((0.7 * (NPH_Towers[NPH_SelectedTower].pCost * NPH_Towers[NPH_SelectedTower].pLevel))));
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 HD_MoveBullets():void{
var i:int;
var a:int;
if (HD_gamemode != "paused"){
try {
i = (HD_Bullets.length - 1);
while (i >= 0) {
HD_Bullets[i].movebullet(HD_Enemies[HD_Bullets[i].pTarget].x, HD_Enemies[HD_Bullets[i].pTarget].y);
i = (i - 1);
};
} catch(e:TypeError) {
a = (HD_Bullets.length - 1);
while (a >= 0) {
HD_Bullets[a].x = -900;
HD_Bullets[a].y = -900;
HD_Bullets[a].pTarget = -1;
removeChild(HD_Bullets[a].pBullet);
HD_Bullets.splice(a, 1);
a = (a - 1);
};
};
};
}
public function CheckEnemiesForHit():void{
var i:int;
var k:int;
var xdist:Number;
var ydist:Number;
var distancefromthis:Number;
var a:int;
if (gamemode != "paused"){
try {
i = (Enemies.length - 1);
while (i >= 0) {
k = (Bullets.length - 1);
while (k >= 0) {
if (Enemies[i].hitTestObject(Bullets[k])){
Enemies[i].GotHit(Bullets[k].pDamage, Bullets[k].pBulletType);
if (Bullets[k].pBulletType == 2){
if (Enemies[i].pSpeed > 0.3){
Enemies[i].pSpeed = (Enemies[i].pSpeed - 0.2);
};
};
if (Bullets[k].pBulletType == 4){
a = (Enemies.length - 1);
while (a >= 0) {
xdist = Math.round((Bullets[k].x - Enemies[a].x));
ydist = Math.round((Bullets[k].y - Enemies[a].y));
distancefromthis = Math.round(Math.sqrt(((xdist * xdist) + (ydist * ydist))));
if (distancefromthis < 50){
if (a != Bullets[k].pTarget){
Enemies[a].GotHit(((5 * Towers[Bullets[k].pTower].pLevel) * 0.75), 4);
};
};
a = (a - 1);
};
};
Bullets[k].x = -100;
Bullets[k].y = -100;
removeChild(Bullets[k].pBullet);
Bullets.splice(k, 1);
};
k = (k - 1);
};
i = (i - 1);
};
} catch(e:TypeError) {
};
};
}
public function IN_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
} catch(e:TypeError) {
};
}
public function IN_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (IN_gamemode != "paused"){
if (IN_Gold >= 500){
if (IN_Muted == false){
IN_ButtonClick.play();
};
IN_Gold = (IN_Gold - 500);
text_gold.text = String(IN_Gold);
_local2 = 0;
while (_local2 < 50) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
IN_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function Min10_checkpathcollision(_arg1, _arg2):Boolean{
var _local3:*;
var _local4:int;
_local3 = (_arg1 + 1);
_local4 = (_arg2 + 1);
if (road_1.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_2.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_3.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_4.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_5.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_6.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_7.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_8.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_9.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_10.hitTestPoint(_local3, _local4)){
return (true);
};
if (road_11.hitTestPoint(_local3, _local4)){
return (true);
};
return (false);
}
public function Min10_tower_select_cannon_mouse_up(_arg1:MouseEvent):void{
if (Min10_gamemode != "paused"){
if (Min10_gamemode == "set_tower"){
if (Min10_selectedtowertype == "Cannon"){
Min10_gamemode = "off";
TheGrid1.alpha = 0;
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
Min10_selectedtowertype = "none";
} else {
if (Min10_selectedtowertype != "Cannon"){
Min10_gamemode = "set_tower";
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
TheGrid1.alpha = 0.5;
Min10_selectedtowertype = "Cannon";
};
};
} else {
if (Min10_gamemode != "set_tower"){
Min10_gamemode = "set_tower";
TheGrid1.alpha = 0.5;
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
Min10_selectedtowertype = "Cannon";
};
};
};
}
public function Min10_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (Min10_gamemode != "paused"){
if (Min10_Gold >= 300){
if (Min10_Muted == false){
Min10_ButtonClick.play();
};
Min10_Gold = (Min10_Gold - 300);
text_gold.text = String(Min10_Gold);
_local2 = 0;
while (_local2 < 100) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
Min10_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function SB_buy_blizzard_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:blizzard_graphic;
if (SB_gamemode != "paused"){
if (SB_Gold >= 300){
if (SB_Muted == false){
SB_ButtonClick.play();
};
SB_Gold = (SB_Gold - 300);
text_gold.text = String(SB_Gold);
_local2 = 0;
while (_local2 < 100) {
_local3 = new blizzard_graphic();
drawonme.addChild(_local3);
SB_Blizzards.push(_local3);
_local2++;
};
};
};
}
public function HD_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 HD_buy_angel_death_mouse_up(_arg1:MouseEvent):void{
var _local2:*;
var _local3:angel_of_death;
if (HD_gamemode != "paused"){
if (HD_Gold >= 500){
if (HD_Muted == false){
HD_ButtonClick.play();
};
HD_Gold = (HD_Gold - 500);
text_gold.text = String(HD_Gold);
_local2 = 0;
while (_local2 < 50) {
_local3 = new angel_of_death();
drawonme.addChild(_local3);
HD_AngelsOfDeath.push(_local3);
_local2++;
};
};
};
}
public function playthegame2(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function playthegame3(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function playthegame4(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function playthegame5(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function playthegame6(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function Min5_sell_tower_click(_arg1:MouseEvent):void{
if (Min5_gamemode != "paused"){
if (Min5_SelectedTower != -1){
if (Min5_Towers[Min5_SelectedTower].pTowerType == 10){
Min5_PlacedMine = false;
};
Min5_Gold = (Min5_Gold + int((0.9 * (Min5_Towers[Min5_SelectedTower].pCost * Min5_Towers[Min5_SelectedTower].pLevel))));
text_gold.text = String(Min5_Gold);
removeChild(Min5_Towers[Min5_SelectedTower]);
Min5_Towers.splice(Min5_SelectedTower, 1);
Min5_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 playthegame7(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function 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 NPI_tower_select_deselect(_arg1:MouseEvent):void{
var event = _arg1;
try {
text_towertype.text = "";
text_towerinfo.text = "";
} catch(e:TypeError) {
};
}
public function playthegame9(_arg1:MouseEvent):void{
gotoAndStop(95);
}
public function NPS_the_grid_place_tower_enter(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
if (NPS_gamemode != "paused"){
if (int((root.mouseX / 32)) <= 14){
if (int((root.mouseY / 32)) >= 2){
if (NPS_selectedtowertype == "Arrow"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NPS_selectedtowertype == "Arcane"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NPS_selectedtowertype == "Cannon"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 125);
drawonme.graphics.endFill();
};
if (NPS_selectedtowertype == "Fire"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 200);
drawonme.graphics.endFill();
};
if (NPS_selectedtowertype == "Ice"){
_local2 = (int((root.mouseX / 32)) * 32);
_local3 = (int((root.mouseY / 32)) * 32);
drawonme.graphics.clear();
drawonme.graphics.beginFill(0xFFFFFF, 0.2);
drawonme.graphics.drawCircle((_local2 + 16), (_local3 + 16), 150);
drawonme.graphics.endFill();
};
};
};
};
}
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";
};
};
};
}
}
}//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.*;
public class angel_of_death extends Sprite {
public function angel_of_death():void{
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 - 5);
rotation = (rotation + 5);
}
public function everytime(_arg1:Event):void{
moveenemy();
}
}
}//package
Section 8
//blizzard_graphic (blizzard_graphic)
package {
import flash.display.*;
import flash.events.*;
public class blizzard_graphic extends Sprite {
public function blizzard_graphic():void{
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);
rotation = (rotation + 30);
}
public function everytime(_arg1:Event):void{
moveenemy();
}
}
}//package
Section 9
//building_mine (building_mine)
package {
import flash.display.*;
import flash.events.*;
public class building_mine extends Sprite {
public var pAddGold:Number;// = 1
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pTarget:Number;// = -1
public var pBuilding:building_mine;
public var pCost:Number;// = 100
public var pTowerType:Number;// = 10
public var buy_mine:MovieClip;
public var pLastFire:Number;// = 0
public var pRange:Number;// = 0
public var pSpeed:Number;// = 200
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;
super();
addEventListener(MouseEvent.MOUSE_UP, clickedon);
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 10
//buttonclick (buttonclick)
package {
import flash.media.*;
public dynamic class buttonclick extends Sound {
}
}//package
Section 11
//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 12
//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 13
//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 14
//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 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;
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 15
//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 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;
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 16
//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 pDamage:Number;// = 1
public function script_bullet_cannon(_arg1:Number):void{
pBulletType = 4;
pDamage = 1;
pSpeed = 4;
pTargetX = -1;
pTargetY = -1;
pTarget = -1;
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 17
//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 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;
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_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 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;
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_enemy_armor (script_enemy_armor)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class script_enemy_armor extends Sprite {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
public var pTheDirection:Number;// = 1
public var pArmor:Number;// = 30
public var pPath:Array;
public var pSpeed:Number;// = 1
public var pPaused:Boolean;// = false
public var pType:Number;// = 3
public var pStartHealth:Number;// = 1
public var pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_armor;
public function script_enemy_armor(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pArmor = 30;
pType = 3;
pStartHealth = 1;
pHealth = 1;
pSpeed = 1;
pOrigSpeed = 1;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
super();
pLevel = _arg2;
_local4 = _arg3;
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 * Math.pow(pLevel, 1.55)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((11 * Math.pow(pLevel, 1.44)) + 25);
pHealth = pStartHealth;
};
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);
rotation = 90;
};
if (pTheDirection == 2){
x = (x + pSpeed);
rotation = 0;
};
if (pTheDirection == 3){
x = (x - pSpeed);
rotation = 180;
};
if (pTheDirection == 4){
y = (y - pSpeed);
rotation = -90;
};
} 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);
};
};
}
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++;
};
};
}
}
}//package
Section 20
//script_enemy_boss (script_enemy_boss)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class script_enemy_boss extends Sprite {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
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;// = 5
public var pStartHealth:Number;// = 1
public var pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_boss;
public function script_enemy_boss(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 5;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pOrigSpeed = 1;
pSpeed = 1;
pLevel = 0;
pPaused = false;
pPathIndex = 0;
super();
_local4 = _arg3;
pLevel = _arg2;
if (_local4 == "normal"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((11 * Math.pow(pLevel, 1.9)) + 40);
pHealth = pStartHealth;
};
if (_local4 == "hard"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((12 * Math.pow(pLevel, 2.1)) + 50);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((13 * Math.pow(pLevel, 2.4)) + 60);
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);
rotation = 90;
};
if (pTheDirection == 2){
x = (x + pSpeed);
rotation = 0;
};
if (pTheDirection == 3){
x = (x - pSpeed);
rotation = 180;
};
if (pTheDirection == 4){
y = (y - pSpeed);
rotation = -90;
};
} 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);
};
};
}
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++;
};
};
}
}
}//package
Section 21
//script_enemy_fast (script_enemy_fast)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class script_enemy_fast extends Sprite {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
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;// = 2
public var pStartHealth:Number;// = 1
public var pOrigSpeed:Number;// = 1.5
public var pEnemy:script_enemy_fast;
public function script_enemy_fast(_arg1:Number, _arg2:Number, _arg3:String):void{
var _local4:String;
pTheDirection = 1;
pType = 2;
pArmor = 10;
pStartHealth = 1;
pHealth = 1;
pSpeed = 1.5;
pLevel = 0;
pOrigSpeed = 1.5;
pPaused = false;
pPathIndex = 0;
super();
pLevel = _arg2;
_local4 = _arg3;
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 * Math.pow(pLevel, 1.23)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((11 * Math.pow(pLevel, 1.45)) + 25);
pHealth = pStartHealth;
};
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);
rotation = 90;
};
if (pTheDirection == 2){
x = (x + pSpeed);
rotation = 0;
};
if (pTheDirection == 3){
x = (x - pSpeed);
rotation = 180;
};
if (pTheDirection == 4){
y = (y - pSpeed);
rotation = -90;
};
} 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);
};
};
}
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++;
};
};
}
}
}//package
Section 22
//script_enemy_immune (script_enemy_immune)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class script_enemy_immune extends Sprite {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
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 pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_immune;
public function script_enemy_immune(_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;
super();
_local4 = _arg3;
pLevel = _arg2;
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 * Math.pow(pLevel, 1.25)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((11 * Math.pow(pLevel, 1.5)) + 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);
rotation = 90;
};
if (pTheDirection == 2){
x = (x + pSpeed);
rotation = 0;
};
if (pTheDirection == 3){
x = (x - pSpeed);
rotation = 180;
};
if (pTheDirection == 4){
y = (y - pSpeed);
rotation = -90;
};
} 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);
};
};
}
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++;
};
};
}
}
}//package
Section 23
//script_enemy_normal (script_enemy_normal)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class script_enemy_normal extends Sprite {
public var pHealth:Number;// = 1
public var pPathIndex:int;// = 0
public var pLevel:Number;// = 0
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 pOrigSpeed:Number;// = 1
public var pEnemy:script_enemy_normal;
public function script_enemy_normal(_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;
super();
_local4 = _arg3;
pLevel = _arg2;
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 * Math.pow(pLevel, 1.25)) + 20);
pHealth = pStartHealth;
};
if (_local4 == "insane"){
pArmor = (10 + (pLevel * 1.5));
pStartHealth = ((11 * Math.pow(pLevel, 1.5)) + 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);
rotation = 90;
};
if (pTheDirection == 2){
x = (x + pSpeed);
rotation = 0;
};
if (pTheDirection == 3){
x = (x - pSpeed);
rotation = 180;
};
if (pTheDirection == 4){
y = (y - pSpeed);
rotation = -90;
};
} 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);
};
};
}
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++;
};
};
}
}
}//package
Section 24
//tower_arcane (tower_arcane)
package {
import flash.display.*;
import flash.events.*;
public class tower_arcane extends Sprite {
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pTarget:Number;// = -1
public var pCost:Number;// = 125
public var pTowerType:Number;// = 3
public var pLastFire:Number;// = 0
public var pTower:tower_arcane;
public var pRange:Number;// = 200
public var pSpeed:Number;// = 600
public var pDamage:Number;// = 10
public function tower_arcane():void{
pTowerType = 3;
pDamage = 10;
pRange = 200;
pCost = 125;
pLevel = 1;
pSpeed = 600;
pLastFire = 0;
pTarget = -1;
pSelected = false;
super();
addEventListener(MouseEvent.MOUSE_UP, clickedon);
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 25
//tower_arrow (tower_arrow)
package {
import flash.display.*;
import flash.events.*;
public class tower_arrow extends Sprite {
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pTarget:Number;// = -1
public var pCost:Number;// = 30
public var pTowerType:Number;// = 1
public var pLastFire:Number;// = 0
public var pTower:tower_arrow;
public var pRange:Number;// = 200
public var pSpeed:Number;// = 300
public var pDamage:Number;// = 2
public function tower_arrow():void{
pTowerType = 1;
pDamage = 2;
pRange = 200;
pCost = 30;
pLevel = 1;
pSpeed = 300;
pLastFire = 0;
pTarget = -1;
pSelected = false;
super();
addEventListener(MouseEvent.MOUSE_UP, clickedon);
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 26
//tower_cannon (tower_cannon)
package {
import flash.display.*;
import flash.events.*;
public class tower_cannon extends Sprite {
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pTarget:Number;// = -1
public var pCost:Number;// = 75
public var pTowerType:Number;// = 4
public var pLastFire:Number;// = 0
public var pTower:tower_cannon;
public var pRange:Number;// = 125
public var pSpeed:Number;// = 1500
public var pDamage:Number;// = 15
public function tower_cannon():void{
pTowerType = 4;
pDamage = 15;
pRange = 125;
pCost = 75;
pLevel = 1;
pSpeed = 1500;
pLastFire = 0;
pTarget = -1;
pSelected = false;
super();
addEventListener(MouseEvent.MOUSE_UP, clickedon);
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 27
//tower_fire (tower_fire)
package {
import flash.display.*;
import flash.events.*;
public class tower_fire extends Sprite {
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pTarget:Number;// = -1
public var pCost:Number;// = 100
public var pTowerType:Number;// = 5
public var pLastFire:Number;// = 0
public var pTower:tower_fire;
public var pRange:Number;// = 200
public var pSpeed:Number;// = 200
public var pDamage:Number;// = 5
public function tower_fire():void{
pTowerType = 5;
pDamage = 5;
pRange = 200;
pCost = 100;
pLevel = 1;
pSpeed = 200;
pLastFire = 0;
pTarget = -1;
pSelected = false;
super();
addEventListener(MouseEvent.MOUSE_UP, clickedon);
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 28
//tower_ice (tower_ice)
package {
import flash.display.*;
import flash.events.*;
public class tower_ice extends Sprite {
public var pSelected:Boolean;// = false
public var pLevel:Number;// = 1
public var pTarget:Number;// = -1
public var pCost:Number;// = 25
public var pTowerType:Number;// = 2
public var pLastFire:Number;// = 0
public var pTower:tower_ice;
public var pRange:Number;// = 150
public var pSpeed:Number;// = 350
public var pDamage:Number;// = 0.2
public function tower_ice():void{
pTowerType = 2;
pDamage = 0.2;
pRange = 150;
pCost = 25;
pLevel = 1;
pSpeed = 350;
pLastFire = 0;
pTarget = -1;
pSelected = false;
super();
addEventListener(MouseEvent.MOUSE_UP, clickedon);
}
public function clickedon(_arg1:MouseEvent):void{
pSelected = true;
}
public function CheckSelected():Boolean{
if (pSelected == true){
return (true);
};
return (false);
}
}
}//package
Section 29
//TurnPoint (TurnPoint)
package {
import flash.display.*;
public dynamic class TurnPoint extends MovieClip {
}
}//package