Frame 2
function itemHandler1(obj, item) {
getURL ("http://www.orangefoxgames.com", "_blank");
}
function itemHandler2(obj, item) {
getURL ("http://orangefoxgames.com/forum", "_blank");
}
function itemHandler3(obj, item) {
_quality = "HIGH";
}
function itemHandler4(obj, item) {
_quality = "MEDIUM";
}
function itemHandler5(obj, item) {
_quality = "LOW";
}
function random_number(l, h) {
var _local1 = Math.round(Math.random() * (h - l)) + l;
return(_local1);
}
function move_snowflakes() {
i = 0;
var _local2 = snowflake_info.length;
while (i < _local2) {
_root["snowflake_" + snowflake_info[i].flake_name]._y = _root["snowflake_" + snowflake_info[i].flake_name]._y + snowflake_info[i].flake_speed;
if (_root["snowflake_" + snowflake_info[i].flake_name]._y > 400) {
removeMovieClip(_root["snowflake_" + snowflake_info[i].flake_name]);
create_new_snowflake(random_number(5, 695), random_number(low_speed, high_speed), random_number(0, 360));
snowflake_info.splice(i, 1);
}
i++;
}
}
function create_new_snowflake(start_x, flake_speed, flake_rotation) {
attachMovie("snowflake", "snowflake_" + use_depth, use_depth);
_root["snowflake_" + use_depth]._x = start_x;
_root["snowflake_" + use_depth]._y = -15;
_root["snowflake_" + use_depth]._rotation = flake_rotation;
snowflake_info.push({flake_name:use_depth, flake_speed:flake_speed});
use_depth++;
}
function remove_snowflakes() {
i = 0;
x = snowflake_info.length;
while (i < x) {
removeMovieClip(_root["snowflake_" + snowflake_info[i].flake_name]);
snowflake_info.splice(i, 1);
x--;
}
}
stop();
var myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
item1 = new ContextMenuItem("Visit the OFG website", itemHandler1);
myMenu.customItems.push(item1);
item2 = new ContextMenuItem("Visit the OFG forum", itemHandler2);
myMenu.customItems.push(item2);
item3 = new ContextMenuItem("High quality", itemHandler3);
myMenu.customItems.push(item3);
item4 = new ContextMenuItem("Medium quality", itemHandler4);
myMenu.customItems.push(item4);
item5 = new ContextMenuItem("Low quality", itemHandler5);
myMenu.customItems.push(item5);
myMenu.customItems[2].separatorBefore = true;
_root.menu = myMenu;
Stage.showMenu = true;
var number_of_flakes = 25;
var low_speed = 3;
var high_speed = 8;
var use_depth = 1;
snowflake_info = new Array();
var i = 0;
i = 0;
while (i < number_of_flakes) {
create_new_snowflake(random_number(5, 695), random_number(low_speed, high_speed), random_number(0, 360));
i++;
}
intro.useHandCursor = true;
Instance of Symbol 225 MovieClip "intro" in Frame 2
on (release) {
getURL ("http://www.totw.com", "_blank");
}
Frame 3
function set_cursor(cursor_number) {
_root.ucursor.gotoAndStop(cursor_number);
current_cursor = cursor_number;
}
stop();
_root.current_cursor = 1;
if (add_cursor) {
Mouse.hide();
use_depth++;
attachMovie("cursor", "ucursor", use_depth);
use_depth++;
_root.ucursor.swapDepths(50000);
add_cursor = false;
set_cursor(current_cursor);
}
Instance of Symbol 228 MovieClip in Frame 3
onClipEvent (enterFrame) {
_root.ucursor._x = _root._xmouse;
_root.ucursor._y = _root._ymouse;
}
Frame 4
function set_initial_variables() {
_root.screen_height = 400;
_root.screen_width = 700;
_root.enemy_count = 3;
_root.enemy_gone_count = 0;
_root.enemy_made_count = 0;
_root.current_level = 1;
_root.num_bad_guy_types = 1;
_root.next_depth = 50;
_root.total_kills = 0;
_root.shot_delay = 1200;
_root.game_paused = false;
_root.shot_delay_start = 0;
_root.current_money = 0;
_root.current_health_total = 100;
_root.current_health = 100;
_root.projectile_make_bigger = 0;
_root.projectile_speed = 9;
_root.number_nukes = 0;
_root.time_next_bad_guy = 2;
_root.time_next_bad_guy_started = getTimer();
_root.objects_info = new Array();
_root.objects_info = [[3, 100, 15, 10, false], [5, 100, 10, 10, false], [3, 200, 15, 20, true], [2, 200, 20, 20, true], [4, 200, 25, 20, false]];
_root.bad_guys_info = new Array();
_root.projectiles_info_name = new Array();
_root.hot_water_mines = new Array();
_root.auto_fire_turrets = new Array();
_root.nuke_info = new Array();
}
function add_bad_guy(bad_guy_type) {
if (enemy_made_count != enemy_count) {
attachMovie("bad_guy_" + bad_guy_type, "b_g_" + next_depth, next_depth);
_root["b_g_" + next_depth]._x = screen_width + 20;
var _local7 = random_number(0, 3);
var _local4;
var _local5;
var _local3;
switch (_local7) {
case 0 :
_root["b_g_" + next_depth]._x = -10;
_root["b_g_" + next_depth]._y = random_number(10, screen_height - 10);
_local4 = _root.player._x - _root["b_g_" + next_depth]._x;
_local5 = _root.player._y - _root["b_g_" + next_depth]._y;
_local3 = Math.atan2(_local5, _local4);
_root["b_g_" + next_depth]._rotation = int((_local3 * 360) / (Math.PI*2)) + 180;
var _local8 = objects_info[bad_guy_type][0];
var _local6 = _local3 * objects_info[bad_guy_type][0];
bad_guys_info.push({guy_name:next_depth, guy_type:bad_guy_type, guy_move_x:_local8, guy_move_y:_local6, guy_locked:false, guy_next_damage:0, guy_hp:objects_info[bad_guy_type][1]});
break;
case 1 :
_root["b_g_" + next_depth]._x = random_number(10, screen_width - 10);
_root["b_g_" + next_depth]._y = -10;
_local4 = _root.player._x - _root["b_g_" + next_depth]._x;
_local5 = _root.player._y - _root["b_g_" + next_depth]._y;
_local3 = Math.atan2(_local4, _local5);
_root["b_g_" + next_depth]._rotation = _root["b_g_" + next_depth]._rotation - 90;
_root["b_g_" + next_depth]._rotation = _root["b_g_" + next_depth]._rotation - int((_local3 * 360) / (Math.PI*2));
_local8 = _local3 * objects_info[bad_guy_type][0];
_local6 = objects_info[bad_guy_type][0];
bad_guys_info.push({guy_name:next_depth, guy_type:bad_guy_type, guy_move_x:_local8, guy_move_y:_local6, guy_locked:false, guy_next_damage:0, guy_hp:objects_info[bad_guy_type][1]});
break;
case 2 :
_root["b_g_" + next_depth]._x = screen_width + 10;
_root["b_g_" + next_depth]._y = random_number(10, screen_height - 10);
_local4 = _root.player._x;
_local5 = _root.player._y - _root["b_g_" + next_depth]._y;
_local3 = -Math.atan2(_local5, _local4);
_root["b_g_" + next_depth]._rotation = int((_local3 * 360) / (Math.PI*2));
_local8 = -objects_info[bad_guy_type][0];
_local6 = (-objects_info[bad_guy_type][0]) * _local3;
bad_guys_info.push({guy_name:next_depth, guy_type:bad_guy_type, guy_move_x:_local8, guy_move_y:_local6, guy_locked:false, guy_next_damage:0, guy_hp:objects_info[bad_guy_type][1]});
break;
case 3 :
_root["b_g_" + next_depth]._x = random_number(10, screen_width - 10);
_root["b_g_" + next_depth]._y = screen_height + 10;
_local4 = _root.player._x - _root["b_g_" + next_depth]._x;
_local5 = _root.player._y;
_local3 = Math.atan2(_local4, _local5);
_root["b_g_" + next_depth]._rotation = _root["b_g_" + next_depth]._rotation + 90;
_root["b_g_" + next_depth]._rotation = _root["b_g_" + next_depth]._rotation + int((_local3 * 360) / (Math.PI*2));
_local8 = _local3 * objects_info[bad_guy_type][0];
_local6 = -objects_info[bad_guy_type][0];
bad_guys_info.push({guy_name:next_depth, guy_type:bad_guy_type, guy_move_x:_local8, guy_move_y:_local6, guy_locked:false, guy_next_damage:0, guy_hp:objects_info[bad_guy_type][1]});
}
next_depth++;
enemy_made_count++;
time_next_bad_guy_started = getTimer();
}
}
function get_bad_guy_type() {
var _local1 = random_number(0, num_bad_guy_types - 1);
return(_local1);
}
function move_world() {
var _local10 = bad_guys_info.length;
var _local2 = 0;
while (_local2 < _local10) {
var _local8 = false;
var _local11 = "regular";
if (_root["b_g_" + bad_guys_info[_local2].guy_name].guy.hit_point.hitTest(_root.snow_fort)) {
if (!objects_info[bad_guys_info[_local2].guy_type][4]) {
_local8 = true;
current_health = current_health - objects_info[bad_guys_info[_local2].guy_type][2];
update_health_bar();
remove_type = "hit_fort";
} else {
if (_root["b_g_" + bad_guys_info[_local2].guy_name].guy._currentframe < 2) {
_root["b_g_" + bad_guys_info[_local2].guy_name].guy.gotoAndPlay("do_damage");
}
if (bad_guys_info[_local2].guy_next_damage < getTimer()) {
current_health = current_health - objects_info[bad_guys_info[_local2].guy_type][2];
update_health_bar();
bad_guys_info[_local2].guy_next_damage = getTimer() + 4000;
}
}
} else {
_root["b_g_" + bad_guys_info[_local2].guy_name]._x = _root["b_g_" + bad_guys_info[_local2].guy_name]._x + bad_guys_info[_local2].guy_move_x;
_root["b_g_" + bad_guys_info[_local2].guy_name]._y = _root["b_g_" + bad_guys_info[_local2].guy_name]._y + bad_guys_info[_local2].guy_move_y;
}
if ((((_root["b_g_" + bad_guys_info[_local2].guy_name]._x < -10) || (_root["b_g_" + bad_guys_info[_local2].guy_name]._x > (screen_width + 10))) || (_root["b_g_" + bad_guys_info[_local2].guy_name]._y < -10)) || (_root["b_g_" + bad_guys_info[_local2].guy_name]._y > (screen_height + 10))) {
remove_bad_guy("b_g_" + bad_guys_info[_local2].guy_name, _local2, "regular");
_local2--;
_local10--;
}
if (_local8) {
remove_bad_guy("b_g_" + bad_guys_info[_local2].guy_name, _local2, remove_type);
_local2--;
_local10--;
}
if (nuke_info.length > 0) {
var _local4 = 0;
var _local7 = nuke_info.length;
while (_local4 < _local7) {
if (((((_root["nuke_" + nuke_info[_local4]].explosion.hitTest(_root["b_g_" + bad_guys_info[_local2].guy_name]._x, _root["b_g_" + bad_guys_info[_local2].guy_name]._y, true) && (_root["b_g_" + bad_guys_info[_local2].guy_name]._x > 0)) && (_root["b_g_" + bad_guys_info[_local2].guy_name]._x < screen_width)) && (_root["b_g_" + bad_guys_info[_local2].guy_name]._y > 0)) && (_root["b_g_" + bad_guys_info[_local2].guy_name]._y < screen_height)) && (_root["nuke_" + nuke_info[_local4]]._currentframe < 21)) {
current_money = current_money + objects_info[bad_guys_info[_local2].guy_type][3];
update_money_text();
remove_bad_guy("b_g_" + bad_guys_info[_local2].guy_name, _local2, "hit_fort");
increment_kills();
_local2--;
_local10--;
}
if (_root["nuke_" + nuke_info[_local4]]._currentframe == 21) {
removeMovieClip(_root["nuke_" + nuke_info[_local4]]);
nuke_info.splice(_local4, 1);
_local4--;
_local7--;
}
_local4++;
}
}
_local2++;
}
_local10 = projectiles_info_name.length;
_local2 = 0;
var _local6 = bad_guys_info.length;
while (_local2 < _local10) {
var _local3 = 0;
_root["projectile_" + projectiles_info_name[_local2]]._y = _root["projectile_" + projectiles_info_name[_local2]]._y - (projectile_speed * Math.cos((Math.PI/180) * (_root["projectile_" + projectiles_info_name[_local2]]._rotation + 90)));
_root["projectile_" + projectiles_info_name[_local2]]._x = _root["projectile_" + projectiles_info_name[_local2]]._x + (projectile_speed * Math.sin((Math.PI/180) * (_root["projectile_" + projectiles_info_name[_local2]]._rotation + 90)));
if ((((_root["projectile_" + projectiles_info_name[_local2]]._x > screen_width) || (_root["projectile_" + projectiles_info_name[_local2]]._x < 0)) || (_root["projectile_" + projectiles_info_name[_local2]]._y < 0)) || (_root["projectile_" + projectiles_info_name[_local2]]._y > screen_height)) {
removeMovieClip("projectile_" + projectiles_info_name[_local2]);
projectiles_info_name.splice(_local2, 1);
_local2--;
_local10--;
}
while (_local3 < _local6) {
if (_root["b_g_" + bad_guys_info[_local3].guy_name].guy.hit_point.hitTest(_root["projectile_" + projectiles_info_name[_local2]].hit_point)) {
attachMovie("snowball_debris", "snowball_debris_" + next_depth, next_depth);
_root["snowball_debris_" + next_depth]._x = _root["projectile_" + projectiles_info_name[_local2]]._x;
_root["snowball_debris_" + next_depth]._y = _root["projectile_" + projectiles_info_name[_local2]]._y;
_root["snowball_debris_" + next_depth]._xscale = 20;
_root["snowball_debris_" + next_depth]._yscale = 20;
_root["snowball_debris_" + next_depth]._rotation = _root["projectile_" + projectiles_info_name[_local2]]._rotation;
next_depth++;
remove_projectile("projectile_" + projectiles_info_name[_local2], _local2);
_local2--;
_local10--;
update_money_text();
bad_guys_info[_local3].guy_hp = bad_guys_info[_local3].guy_hp - 100;
if (bad_guys_info[_local3].guy_hp <= 0) {
current_money = current_money + objects_info[bad_guys_info[_local3].guy_type][3];
update_money_text();
remove_bad_guy("b_g_" + bad_guys_info[_local3].guy_name, _local3, "regular");
_local3--;
_local6--;
increment_kills();
}
}
_local3++;
}
_local2++;
}
var _local3 = 0;
while (_local3 < hot_water_mines.length) {
if (!hot_water_mines[_local3].mine_exploded) {
if (_root["hot_water_mine_" + hot_water_mines[_local3].mine_name]._currentframe == 36) {
hot_water_mines[_local3].mine_exploded = true;
remove_hot_water_mine("hot_water_mine_" + hot_water_mines[_local3].mine_name);
} else {
_local10 = bad_guys_info.length;
_local2 = 0;
while (_local2 < _local10) {
if (_root["hot_water_mine_" + hot_water_mines[_local3].mine_name].hitTest(_root["b_g_" + bad_guys_info[_local2].guy_name]._x, _root["b_g_" + bad_guys_info[_local2].guy_name]._y, true) && (hot_water_mines[_local3].mine_exploding)) {
current_money = current_money + objects_info[bad_guys_info[_local2].guy_type][3];
update_money_text();
remove_bad_guy("b_g_" + bad_guys_info[_local2].guy_name, _local2, "hit_fort");
increment_kills();
}
_local2++;
}
}
}
_local3++;
}
_local2 = 0;
_local10 = auto_fire_turrets.length;
while (_local2 < _local10) {
_local3 = 0;
_local6 = bad_guys_info.length;
while (_local3 < _local6) {
found_target = true;
if (_root["auto_fire_turret_" + auto_fire_turrets[_local2].turret_name].hitTest(_root["b_g_" + bad_guys_info[_local3].guy_name])) {
var _local5 = 0;
if (_root["b_g_" + bad_guys_info[_local3].guy_name]._y > _root["auto_fire_turret_" + auto_fire_turrets[_local2].turret_name]._y) {
_local5 = 1;
} else {
_local5 = -1;
}
Xd = (_root["b_g_" + bad_guys_info[_local3].guy_name]._x + 1) - _root["auto_fire_turret_" + auto_fire_turrets[_local2].turret_name]._x;
Yd = _root["b_g_" + bad_guys_info[_local3].guy_name]._y - _root["auto_fire_turret_" + auto_fire_turrets[_local2].turret_name]._y;
radAngle = Math.atan2(Yd, Xd);
_root["auto_fire_turret_" + auto_fire_turrets[_local2].turret_name].turn._rotation = int((radAngle * 360) / (Math.PI*2)) + (2 * _local5);
if (getTimer() > auto_fire_turrets[_local2].turret_next_time) {
attachMovie("projectile", "projectile_" + next_depth, next_depth);
projectiles_info_name.push(next_depth);
_root["projectile_" + next_depth]._rotation = _root["auto_fire_turret_" + auto_fire_turrets[_local2].turret_name].turn._rotation;
position = {x:0, y:0};
_root["auto_fire_turret_" + auto_fire_turrets[_local2].turret_name].turn.gun_top.localToGlobal(position);
_root["projectile_" + next_depth]._x = position.x;
_root["projectile_" + next_depth]._y = position.y;
next_depth++;
auto_fire_turrets[_local2].turret_next_time = getTimer() + 12000;
}
}
_local3++;
}
_root["auto_fire_turret_" + auto_fire_turrets[_local2].turret_name].fireTime.text = Math.ceil((auto_fire_turrets[_local2].turret_next_time - getTimer()) / 1000);
_local2++;
}
if (enemy_gone_count == enemy_count) {
game_paused = true;
end_level();
}
}
function update_health_bar() {
var _local1 = current_health * 100;
_local1 = _local1 / current_health_total;
health_bar._xscale = _local1;
health_number = (current_health + "/") + current_health_total;
if ((_local1 >= 80) && (snow_fort._currentframe != "damage_0")) {
snow_fort.gotoAndStop("damage_0");
}
if (((_local1 < 80) && (_local1 >= 60)) && (snow_fort._currentframe != "damage_1")) {
snow_fort.gotoAndStop("damage_1");
}
if (((_local1 < 60) && (_local1 >= 40)) && (snow_fort._currentframe != "damage_2")) {
snow_fort.gotoAndStop("damage_2");
}
if (((_local1 < 40) && (_local1 >= 20)) && (snow_fort._currentframe != "damage_3")) {
snow_fort.gotoAndStop("damage_3");
}
if ((_local1 < 20) && (snow_fort._currentframe != "damage_4")) {
snow_fort.gotoAndStop("damage_4");
}
if (current_health <= 0) {
remove_nukes();
remove_all_objects();
onMouseMove = function () {
};
onMouseDown = function () {
};
gotoAndStop ("gameover");
}
}
function end_level() {
remove_nukes();
reset_mines();
reset_projectiles();
reset_turrets();
set_next_level_variables();
show_upgrade_screen();
}
function show_upgrade_screen() {
attachMovie("buy_upgrades_window", "buy_upgrades_window_show", next_depth);
buy_upgrades_window_show._x = screen_width / 2;
buy_upgrades_window_show._y = screen_height / 2;
next_depth++;
}
function update_money_text() {
money_number = current_money;
}
function purchase_upgrade(upgrade_type, upgrade_price) {
if (current_money >= upgrade_price) {
switch (upgrade_type) {
case "upgrade_health" :
if ((current_health_total + 20) <= 200) {
current_health_total = current_health_total + 20;
update_health_bar();
break;
}
return("You can't upgrade your maximum health anymore.");
case "restore_health" :
if (current_health != current_health_total) {
if ((current_health + 20) > current_health_total) {
current_health = current_health + (current_health_total - current_health);
} else {
current_health = current_health + 15;
}
update_health_bar();
} else {
return("You already have full health.");
if (hot_water_mines.length < 9) {
add_hot_water_mine();
} else {
return("You already have the maximim number of mines.");
if (auto_fire_turrets.length <= 3) {
add_auto_fire_turret();
} else {
return("You can't buy anymore turrets.");
if (shot_delay > 700) {
shot_delay = shot_delay - 100;
} else {
return("You can't upgrade your fire rate anymore.");
if ((projectile_make_bigger <= 45) || (projectile_speed <= 18)) {
projectile_make_bigger = projectile_make_bigger + 5;
projectile_speed++;
} else {
return("You can't upgrade your weapon any more.");
if (number_nukes < 5) {
number_nukes++;
} else {
return("You can't buy anymore nukes.");
}
}
}
}
}
}
case "buy_hot_water_mine" :
if (hot_water_mines.length < 9) {
add_hot_water_mine();
} else {
return("You already have the maximim number of mines.");
if (auto_fire_turrets.length <= 3) {
add_auto_fire_turret();
} else {
return("You can't buy anymore turrets.");
if (shot_delay > 700) {
shot_delay = shot_delay - 100;
} else {
return("You can't upgrade your fire rate anymore.");
if ((projectile_make_bigger <= 45) || (projectile_speed <= 18)) {
projectile_make_bigger = projectile_make_bigger + 5;
projectile_speed++;
} else {
return("You can't upgrade your weapon any more.");
if (number_nukes < 5) {
number_nukes++;
} else {
return("You can't buy anymore nukes.");
}
}
}
}
}
case "buy_auto_fire_turret" :
if (auto_fire_turrets.length <= 3) {
add_auto_fire_turret();
} else {
return("You can't buy anymore turrets.");
if (shot_delay > 700) {
shot_delay = shot_delay - 100;
} else {
return("You can't upgrade your fire rate anymore.");
if ((projectile_make_bigger <= 45) || (projectile_speed <= 18)) {
projectile_make_bigger = projectile_make_bigger + 5;
projectile_speed++;
} else {
return("You can't upgrade your weapon any more.");
if (number_nukes < 5) {
number_nukes++;
} else {
return("You can't buy anymore nukes.");
}
}
}
}
case "upgrade_fire_rate" :
if (shot_delay > 700) {
shot_delay = shot_delay - 100;
} else {
return("You can't upgrade your fire rate anymore.");
if ((projectile_make_bigger <= 45) || (projectile_speed <= 18)) {
projectile_make_bigger = projectile_make_bigger + 5;
projectile_speed++;
} else {
return("You can't upgrade your weapon any more.");
if (number_nukes < 5) {
number_nukes++;
} else {
return("You can't buy anymore nukes.");
}
}
}
case "upgrade_weapon" :
if ((projectile_make_bigger <= 45) || (projectile_speed <= 18)) {
projectile_make_bigger = projectile_make_bigger + 5;
projectile_speed++;
} else {
return("You can't upgrade your weapon any more.");
if (number_nukes < 5) {
number_nukes++;
} else {
return("You can't buy anymore nukes.");
}
}
case "buy_nuke" :
if (number_nukes < 5) {
number_nukes++;
} else {
return("You can't buy anymore nukes.");
}
}
current_money = current_money - upgrade_price;
update_money_text();
return("Upgrade purchased successfully.");
}
return("You don't have enough for this upgrade");
}
function add_hot_water_mine() {
hot_water_mines.push({mine_name:next_depth, mine_exploded:false, mine_exploding:false});
duplicateMovieClip ("hot_water_mine", "hot_water_mine_" + next_depth, next_depth);
_root["hot_water_mine_" + next_depth]._y = 60;
_root["hot_water_mine_" + next_depth]._x = hot_water_mines.length * 45;
_root["hot_water_mine_" + next_depth].mine_number = hot_water_mines.length;
next_depth++;
}
function set_next_level_variables() {
enemy_count = enemy_count + int(enemy_count * 0.5);
if (enemy_count > 22) {
enemy_count = 22;
}
current_level++;
update_level_counter();
enemy_gone_count = 0;
enemy_made_count = 0;
time_next_bad_guy = time_next_bad_guy - 0.06;
if (time_next_bad_guy < 1) {
time_next_bad_guy = 1;
}
if ((num_bad_guy_types < objects_info.length) && ((int(current_level) % 3) == 0)) {
num_bad_guy_types++;
}
}
function close_upgrades_window() {
removeMovieClip("buy_upgrades_window_show");
attachMovie("start_level", "start_level_show", next_depth);
start_level_show._x = screen_width / 2;
start_level_show._y = screen_height / 2;
next_depth++;
}
function close_start_level() {
var _local2 = 0;
while (_local2 < auto_fire_turrets.length) {
_root["auto_fire_turret_" + auto_fire_turrets[_local2].turret_name].turret_zone.gotoAndStop(2);
_local2++;
}
removeMovieClip("start_level_show");
Mouse.hide();
game_paused = false;
}
function remove_bad_guy(bad_guy_name, bad_guy_number, remove_type) {
if (remove_type == "regular") {
_root[bad_guy_name].guy.gotoAndPlay("die");
} else {
_root[bad_guy_name].guy.gotoAndPlay("hit_fort");
}
bad_guys_info.splice(bad_guy_number, 1);
}
function remove_projectile(projectile_name, projectile_number) {
removeMovieClip(projectile_name);
projectiles_info_name.splice(projectile_number, 1);
}
function blow_mine(mine_number) {
if (hot_water_mines.length >= (mine_number + 1)) {
_root["hot_water_mine_" + hot_water_mines[mine_number].mine_name].play();
hot_water_mines[mine_number].mine_exploding = true;
}
}
function remove_hot_water_mine(mine_name) {
removeMovieClip(mine_name);
}
function reset_mines() {
var _local3 = hot_water_mines.length;
var _local2 = 0;
while (_local2 < _local3) {
if (hot_water_mines[_local2].mine_exploded || (hot_water_mines[_local2].mine_exploding)) {
remove_hot_water_mine("hot_water_mine_" + hot_water_mines[_local2].mine_name);
hot_water_mines.splice(_local2, 1);
_local2--;
_local3--;
}
_local2++;
}
_local3 = hot_water_mines.length;
_local2 = 0;
while (_local2 < _local3) {
_root["hot_water_mine_" + hot_water_mines[_local2].mine_name].mine_number = _local2 + 1;
_local2++;
}
}
function reset_projectiles() {
var _local2 = projectiles_info_name.length;
var _local1 = 0;
while (_local1 < _local2) {
remove_projectile("projectile_" + projectiles_info_name[_local1], _local1);
_local2--;
}
}
function add_auto_fire_turret() {
auto_fire_turrets.push({turret_name:next_depth, turret_phase:0, turret_lock_rotation:0, turret_next_time:getTimer() + (shot_delay * 10)});
duplicateMovieClip ("auto_fire_turret", "auto_fire_turret_" + next_depth, next_depth);
_root["auto_fire_turret_" + next_depth]._y = 80;
_root["auto_fire_turret_" + next_depth]._x = auto_fire_turrets.length * 30;
next_depth++;
}
function guy_in_location(turret, bad_guy) {
if ((((turret._x < (screen_width / 2)) && (bad_guy._x < (screen_width / 2))) && (turret._y < (screen_height / 2))) && (bad_guy._y < (screen_height / 2))) {
return(true);
}
if ((((turret._x < (screen_width / 2)) && (bad_guy._x < (screen_width / 2))) && (turret._y > (screen_height / 2))) && (bad_guy._y > (screen_height / 2))) {
return(true);
}
if ((((turret._x > (screen_width / 2)) && (bad_guy._x > (screen_width / 2))) && (turret._y < (screen_height / 2))) && (bad_guy._y < (screen_height / 2))) {
return(true);
}
if ((((turret._x > (screen_width / 2)) && (bad_guy._x > (screen_width / 2))) && (turret._y > (screen_height / 2))) && (bad_guy._y > (screen_height / 2))) {
return(true);
}
return(false);
}
function increment_kills() {
total_kills++;
update_kills();
}
function update_kills() {
show_kills = total_kills;
}
function update_level_counter() {
show_level_counter = current_level;
}
function add_nuke() {
next_depth++;
attachMovie("nuke", "nuke_" + next_depth, next_depth);
_root["nuke_" + next_depth]._x = (screen_width / 2) - 40;
_root["nuke_" + next_depth]._y = (screen_height / 2) - 20;
nuke_info.push(next_depth);
next_depth++;
number_nukes--;
}
function remove_nukes() {
var _local2 = 0;
var _local3 = nuke_info.length;
while (_local2 < _local3) {
removeMovieClip(_root["nuke_" + nuke_info[_local2]]);
nuke_info.splice(_local2, 1);
_local3--;
}
}
function reset_turrets() {
var _local2 = 0;
while (_local2 < auto_fire_turrets.length) {
_root["auto_fire_turret_" + auto_fire_turrets[_local2].turret_name].turret_zone.gotoAndStop(1);
_local2++;
}
}
function remove_all_objects() {
var _local1 = 0;
while (_local1 < projectiles_info_name.length) {
removeMovieClip("projectile_" + projectiles_info_name[_local1]);
_local1++;
}
_local1 = 0;
while (_local1 < bad_guys_info.length) {
removeMovieClip("b_g_" + bad_guys_info[_local1].guy_name);
_local1++;
}
_local1 = 0;
while (_local1 < hot_water_mines.length) {
removeMovieClip("hot_water_mine_" + hot_water_mines[_local1].mine_name);
_local1++;
}
_local1 = 0;
while (_local1 < auto_fire_turrets.length) {
removeMovieClip("auto_fire_turret_" + auto_fire_turrets[_local1].turret_name);
_local1++;
}
stopAllSounds();
}
stop();
onMouseMove = function () {
with (player) {
this.Xd = _root._xmouse - _x;
this.Yd = _root._ymouse - _y;
radAngle = Math.atan2(Yd, Xd);
_rotation = int((radAngle * 360) / (Math.PI*2));
}
};
onMouseDown = function () {
if (((getTimer() - shot_delay_start) >= shot_delay) && (!game_paused)) {
shot_delay_start = getTimer();
attachMovie("projectile", "projectile_" + next_depth, next_depth);
projectiles_info_name.push(next_depth);
_root["projectile_" + next_depth]._xscale = _root["projectile_" + next_depth]._xscale + projectile_make_bigger;
_root["projectile_" + next_depth]._yscale = _root["projectile_" + next_depth]._yscale + projectile_make_bigger;
_root["projectile_" + next_depth]._rotation = player._rotation;
position = {x:0, y:0};
player.turret.gun_top.localToGlobal(position);
_root["projectile_" + next_depth]._x = position.x;
_root["projectile_" + next_depth]._y = position.y;
next_depth++;
player.turret.gotoAndPlay("kick_back");
}
};
set_initial_variables();
update_health_bar();
update_money_text();
update_kills();
update_level_counter();
myLoadVars = new LoadVars();
myLoadVars.giveurl = _root._url;
myLoadVars.game_id = 15;
myLoadVars.sendAndLoad("http://www.orangefoxgames.com/admin/tracker.php?cachebuster=" + new Date().getTime(), myLoadVars, "POST");
Instance of Symbol 228 MovieClip in Frame 4
onClipEvent (enterFrame) {
if (!_root.game_paused) {
if ((getTimer() - _root.time_next_bad_guy_started) >= (_root.time_next_bad_guy * 1000)) {
var bad_guy_type = _root.get_bad_guy_type();
_root.add_bad_guy(bad_guy_type);
}
_root.move_world();
}
_root.ucursor._x = _root._xmouse;
_root.ucursor._y = _root._ymouse;
}
Instance of Symbol 281 MovieClip "hot_water_mine" in Frame 4
on (press) {
if (_root.game_paused) {
this.startDrag(true);
}
}
on (release) {
if (_root.game_paused) {
this.stopDrag();
}
}
Instance of Symbol 283 MovieClip in Frame 4
on (keyPress "1") {
if (!_root.game_paused) {
_root.blow_mine(0);
}
}
on (keyPress "2") {
if (!_root.game_paused) {
_root.blow_mine(1);
}
}
on (keyPress "3") {
if (!_root.game_paused) {
_root.blow_mine(2);
}
}
on (keyPress "4") {
if (!_root.game_paused) {
_root.blow_mine(3);
}
}
on (keyPress "5") {
if (!_root.game_paused) {
_root.blow_mine(4);
}
}
on (keyPress "6") {
if (!_root.game_paused) {
_root.blow_mine(5);
}
}
on (keyPress "7") {
if (!_root.game_paused) {
_root.blow_mine(6);
}
}
on (keyPress "8") {
if (!_root.game_paused) {
_root.blow_mine(7);
}
}
on (keyPress "9") {
if (!_root.game_paused) {
_root.blow_mine(8);
}
}
on (keyPress "c") {
if (_root.current_cursor == 10) {
_root.current_cursor = 0;
}
_root.set_cursor(_root.current_cursor + 1);
}
on (keyPress "<Space>") {
if ((_root.number_nukes > 0) && (!_root.game_paused)) {
_root.add_nuke();
}
}
Frame 5
stop();
Instance of Symbol 228 MovieClip in Frame 5
onClipEvent (enterFrame) {
_root.ucursor._x = _root._xmouse;
_root.ucursor._y = _root._ymouse;
}
Frame 6
stop();
Frame 7
stop();
Frame 8
stop();
Frame 9
stop();
Frame 10
stop();
_root.clicked_submit = false;
enemies_killed = total_kills;
levels_completed = current_level - 1;
Symbol 11 MovieClip [cursor] Frame 1
stop();
Symbol 11 MovieClip [cursor] Frame 2
stop();
Symbol 11 MovieClip [cursor] Frame 3
stop();
Symbol 11 MovieClip [cursor] Frame 4
stop();
Symbol 11 MovieClip [cursor] Frame 5
stop();
Symbol 11 MovieClip [cursor] Frame 6
stop();
Symbol 11 MovieClip [cursor] Frame 7
stop();
Symbol 11 MovieClip [cursor] Frame 8
stop();
Symbol 11 MovieClip [cursor] Frame 9
stop();
Symbol 11 MovieClip [cursor] Frame 10
stop();
Symbol 14 MovieClip [bad_guy_0_leave] Frame 45
this.removeMovieClip();
Symbol 38 MovieClip Frame 35
gotoAndPlay (1);
Symbol 38 MovieClip Frame 46
stop();
_root.enemy_gone_count++;
removeMovieClip(_parent);
Symbol 38 MovieClip Frame 57
stop();
_root.enemy_gone_count++;
removeMovieClip(_parent);
Symbol 39 MovieClip [bad_guy_0] Frame 1
stop();
Symbol 42 MovieClip [projectile] Frame 1
stop();
Symbol 62 Button
on (release) {
result_message = _root.purchase_upgrade("buy_hot_water_mine", 20);
display_item_info();
}
Symbol 63 Button
on (release) {
result_message = _root.purchase_upgrade("buy_auto_fire_turret", 220);
display_item_info();
this.swapDepths(_root.getNextHighestDepth());
_root.ucursor.swapDepths(_root.getNextHighestDepth());
_root.next_depth = _root.next_depth + 5;
}
Symbol 64 Button
on (release) {
result_message = _root.purchase_upgrade("restore_health", 100);
}
Symbol 65 Button
on (release) {
result_message = _root.purchase_upgrade("upgrade_health", 180);
}
Symbol 66 Button
on (release) {
result_message = _root.purchase_upgrade("upgrade_fire_rate", 100);
}
Symbol 67 Button
on (release) {
result_message = _root.purchase_upgrade("upgrade_weapon", 100);
}
Symbol 72 Button
on (release) {
_root.close_upgrades_window();
}
Symbol 75 Button
on (release) {
result_message = _root.purchase_upgrade("buy_nuke", 120);
display_item_info();
}
Symbol 79 Button
on (release) {
getURL ("http://www.orangefoxgames.com/medieval_madness_tips_and_tricks.php", "_blank");
}
Symbol 91 Button
on (release) {
result_message = _root.purchase_upgrade("buy_hot_water_mine", 20);
display_item_info();
}
Symbol 92 Button
on (release) {
result_message = _root.purchase_upgrade("buy_auto_fire_turret", 220);
display_item_info();
this.swapDepths(_root.getNextHighestDepth());
_root.ucursor.swapDepths(_root.getNextHighestDepth());
_root.next_depth = _root.next_depth + 5;
}
Symbol 93 Button
on (release) {
result_message = _root.purchase_upgrade("restore_health", 100);
}
Symbol 94 Button
on (release) {
result_message = _root.purchase_upgrade("upgrade_health", 180);
}
Symbol 95 Button
on (release) {
result_message = _root.purchase_upgrade("upgrade_fire_rate", 100);
}
Symbol 96 Button
on (release) {
result_message = _root.purchase_upgrade("upgrade_weapon", 100);
}
Symbol 97 Button
on (release) {
result_message = _root.purchase_upgrade("buy_nuke", 120);
display_item_info();
}
Symbol 120 Button
on (release) {
_root.close_upgrades_window();
}
Symbol 129 MovieClip [buy_upgrades_window] Frame 1
function display_item_info() {
nukes_info = _root.number_nukes + "/5";
mines_info = _root.hot_water_mines.length + "/9";
turrets_info = _root.auto_fire_turrets.length + "/4";
}
display_item_info();
Symbol 131 Button
on (release) {
_root.close_start_level();
}
Symbol 156 MovieClip Frame 15
stop();
Symbol 157 MovieClip Frame 1
stop();
Symbol 157 MovieClip Frame 35
gotoAndPlay (2);
Symbol 157 MovieClip Frame 46
stop();
_root.enemy_gone_count++;
removeMovieClip(_parent);
Symbol 158 MovieClip [bad_guy_3] Frame 1
stop();
Symbol 165 MovieClip Frame 20
gotoAndPlay (1);
Symbol 165 MovieClip Frame 30
stop();
_root.enemy_gone_count++;
removeMovieClip(_parent);
Symbol 165 MovieClip Frame 39
stop();
_root.enemy_gone_count++;
removeMovieClip(_parent);
Symbol 166 MovieClip [bad_guy_1] Frame 1
stop();
Symbol 175 MovieClip Frame 1
stop();
attack.sword.stop();
Symbol 175 MovieClip Frame 61
stop();
_root.enemy_gone_count++;
removeMovieClip(_parent);
Symbol 175 MovieClip Frame 81
gotoAndPlay (62);
Symbol 175 MovieClip Frame 97
stop();
_root.enemy_gone_count++;
removeMovieClip(_parent);
Symbol 176 MovieClip [bad_guy_2] Frame 1
stop();
Symbol 181 MovieClip Frame 10
gotoAndPlay (1);
Symbol 181 MovieClip Frame 20
stop();
_root.enemy_gone_count++;
removeMovieClip(_parent);
Symbol 181 MovieClip Frame 30
stop();
_root.enemy_gone_count++;
removeMovieClip(_parent);
Symbol 184 MovieClip Frame 25
stop();
Symbol 185 MovieClip [nuke] Frame 21
stop();
Symbol 197 MovieClip Frame 35
stop();
_parent.removeMovieClip();
Symbol 208 Button
on (release) {
_root.play();
}
Symbol 209 MovieClip Frame 1
_root.stop();
PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
if (PercentLoaded != 100) {
bar._xscale = PercentLoaded;
} else {
_root.add_cursor = true;
_root.gotoAndStop("intro");
}
Symbol 209 MovieClip Frame 2
gotoAndPlay (1);
Symbol 218 MovieClip Frame 30
stop();
Symbol 220 MovieClip Frame 30
stop();
Symbol 222 MovieClip Frame 30
stop();
Symbol 224 MovieClip Frame 30
stop();
Symbol 225 MovieClip Frame 90
_root.gotoAndStop("main_menu");
Symbol 228 MovieClip Frame 1
stop();
Symbol 230 Button
on (release) {
stopAllSounds();
gotoAndStop ("game");
}
Symbol 234 Button
on (release) {
getURL ("http://www.totw.com", "_blank");
}
Symbol 238 Button
on (release) {
gotoAndStop ("options");
}
Symbol 242 Button
on (release) {
gotoAndStop ("how_to_play");
}
Symbol 246 Button
on (release) {
getURL ("http://www.orangefoxgames.com/view_scores_medieval_madness.php", "_blank");
}
Symbol 250 Button
on (release) {
gotoAndStop ("about");
}
Symbol 269 MovieClip Frame 1
stop();
Symbol 269 MovieClip Frame 2
stop();
Symbol 269 MovieClip Frame 3
stop();
Symbol 269 MovieClip Frame 4
stop();
Symbol 269 MovieClip Frame 5
stop();
Symbol 281 MovieClip Frame 1
stop();
Symbol 281 MovieClip Frame 36
stop();
Symbol 283 MovieClip Frame 1
stop();
Symbol 286 MovieClip Frame 1
stop();
Symbol 286 MovieClip Frame 2
stop();
Symbol 293 MovieClip Frame 1
stop();
Instance of Symbol 290 MovieClip "turn" in Symbol 293 MovieClip Frame 1
on (press) {
if (_root.game_paused) {
_parent.startDrag(true);
}
}
on (release) {
_parent.stopDrag();
}
Symbol 306 MovieClip Frame 1
stop();
Symbol 320 Button
on (release) {
_quality = "HIGH";
}
Symbol 322 Button
on (release) {
_quality = "MEDIUM";
}
Symbol 324 Button
on (release) {
_quality = "LOW";
}
Symbol 326 Button
on (release) {
set_cursor(1);
}
Symbol 328 Button
on (release) {
set_cursor(8);
}
Symbol 330 Button
on (release) {
set_cursor(2);
}
Symbol 332 Button
on (release) {
set_cursor(3);
}
Symbol 334 Button
on (release) {
set_cursor(10);
}
Symbol 336 Button
on (release) {
set_cursor(6);
}
Symbol 338 Button
on (release) {
set_cursor(9);
}
Symbol 340 Button
on (release) {
set_cursor(7);
}
Symbol 342 Button
on (release) {
set_cursor(4);
}
Symbol 344 Button
on (release) {
set_cursor(5);
}
Symbol 347 Button
on (release) {
gotoAndStop ("main_menu");
}
Symbol 350 Button
on (release) {
menu_music = new Sound(this);
menu_music.setVolume(0);
}
Symbol 352 Button
on (release) {
menu_music = new Sound(this);
menu_music.setVolume(100);
}
Symbol 358 Button
on (release) {
gotoAndStop ("controls");
}
Symbol 362 Button
on (release) {
gotoAndStop ("the_shop");
}
Symbol 363 Button
on (release) {
getURL ("http://www.orangefoxgames.com/medieval_madness_tips_and_tricks.php", "_blank");
}
Symbol 373 Button
on (release) {
gotoAndStop ("how_to_play");
}
Symbol 402 Button
on (release) {
getURL ("http://www.orangefoxgames.com", "_blank");
}
Symbol 421 Button
on (release) {
if (!_root.clicked_submit) {
_root.clicked_submit = true;
url = "http://www.orangefoxgames.com/high_scores_pwhrdf/submit_high_score_mm.php";
myLoadVars = new LoadVars();
trace(_root.total_kills);
myLoadVars.score_score = _root.total_kills;
myLoadVars.username = _root.username_input.text;
myLoadVars.password = _root.password_input.text;
myLoadVars.check_code = "j667igfhjjgfh5";
returnedVars = new LoadVars();
myLoadVars.sendAndLoad(url, returnedVars, "POST");
resultText = "Sending score...";
returnedVars.onLoad = function () {
resultText = returnedVars.resultText;
if (returnedVars.resultText == "Login information is incorrect.") {
clicked_submit = false;
} else {
getURL ("http://www.orangefoxgames.com/view_scores_medieval_madness.php", "_blank");
}
};
} else {
resultText = "Score already submitted";
}
}
Symbol 429 Button
on (release) {
getURL ("http://www.orangefoxgames.com/account_create.php", "_blank");
}