home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Estrategia / ant_war.swf / scripts / frame_11 / DoAction_9.as < prev    next >
Encoding:
Text File  |  2007-03-13  |  8.5 KB  |  232 lines

  1. function init_visited()
  2. {
  3.    var _loc2_ = _root;
  4.    var _loc1_ = undefined;
  5.    _loc1_ = 0;
  6.    while(_loc1_ < _loc2_.locale_adjacent.length)
  7.    {
  8.       _loc2_.locale_visited[_loc1_] = false;
  9.       _loc1_ = _loc1_ + 1;
  10.    }
  11. }
  12. function hide_locations()
  13. {
  14.    var ii;
  15.    var tmp;
  16.    ii = 0;
  17.    while(ii < _root.locale_adjacent.length)
  18.    {
  19.       tmp = eval("_root.location_" + ii);
  20.       tmp._visible = false;
  21.       ii++;
  22.    }
  23. }
  24. function show_locations()
  25. {
  26.    var ii;
  27.    var jj;
  28.    var tmp;
  29.    ii = 0;
  30.    while(ii < _root.locale_adjacent[_root.localetype].length)
  31.    {
  32.       if(_root.antstats[gc_pop] >= _root.locale_minimums[_root.locale_adjacent[_root.localetype][ii]] || _root.locale_visited[_root.locale_adjacent[_root.localetype][ii]])
  33.       {
  34.          tmp = eval("_root.location_" + _root.locale_adjacent[_root.localetype][ii]);
  35.          tmp._visible = true;
  36.       }
  37.       ii++;
  38.    }
  39. }
  40. function show_nesttext(ll)
  41. {
  42.    _root.nest_description = _root.locale_text[ll];
  43. }
  44. function nest_mapclips(ll)
  45. {
  46.    var _loc1_ = undefined;
  47.    _loc1_ = "map_" + ll;
  48.    _root.mapclips.gotoAndPlay(_loc1_);
  49. }
  50. function show_nestminimums(ll)
  51. {
  52.    var _loc1_ = _root;
  53.    if(_loc1_.locale_visited[ll])
  54.    {
  55.       _loc1_.nest_unlock = "unlocked";
  56.    }
  57.    else
  58.    {
  59.       _loc1_.nest_unlock = _loc1_.locale_minimums[ll];
  60.    }
  61. }
  62. function show_nestcost(ll)
  63. {
  64.    _root.nest_cost = _root.locale_cost[ll];
  65. }
  66. function select_locale(ll)
  67. {
  68.    var _loc1_ = _root;
  69.    var _loc2_ = ll;
  70.    _loc1_.localetype = parseInt(_loc2_);
  71.    _loc1_.feedback_localetype = _loc1_.localename[_loc1_.localetype];
  72.    _loc1_.nest_mapclips(_loc2_);
  73.    _loc1_.show_nestcost(_loc2_);
  74.    _loc1_.show_nesttext(_loc2_);
  75.    _loc1_.show_nestminimums(_loc2_);
  76. }
  77. function init_locale()
  78. {
  79.    var _loc1_ = _root;
  80.    _loc1_.init_visited();
  81.    _loc1_.localetype = _loc1_.startlocale;
  82.    _loc1_.lastlocale = _loc1_.startlocale;
  83.    _loc1_.feedback_localetype = _loc1_.localename[_loc1_.localetype];
  84. }
  85. function move_nest()
  86. {
  87.    var _loc1_ = _root;
  88.    var ii;
  89.    if(arguments.length <= 0)
  90.    {
  91.       _loc1_.antstats[_loc1_.gc_stored] -= parseInt(_loc1_.antstats[_loc1_.gc_pop] / _loc1_.upkeepcost / _loc1_.foodmovecost);
  92.       _loc1_.antstats[_loc1_.gc_stored] = _loc1_.antstats[_loc1_.gc_stored] <= 0 ? 0 : _loc1_.antstats[_loc1_.gc_stored];
  93.    }
  94.    _loc1_.locale_visited[_loc1_.localetype] = true;
  95.    _loc1_.antstats[gc_money] -= _loc1_.locale_cost[_loc1_.localetype];
  96.    _loc1_.show_mapglow();
  97.    _loc1_.update_eventstats("_root.colonynest_playstats");
  98.    _loc1_.time_out();
  99. }
  100. function show_mapglow()
  101. {
  102.    var _loc2_ = _root;
  103.    var _loc1_ = undefined;
  104.    _loc1_ = 0;
  105.    while(_loc1_ < _loc2_.localename.length)
  106.    {
  107.       if(_loc1_ == _loc2_.localetype)
  108.       {
  109.          _loc2_["map_glow_" + _loc1_]._visible = true;
  110.          _loc2_["map_glow_" + _loc1_].play();
  111.       }
  112.       else
  113.       {
  114.          _loc2_["map_glow_" + _loc1_]._visible = false;
  115.          _loc2_["map_glow_" + _loc1_].stop();
  116.       }
  117.       _loc1_ = _loc1_ + 1;
  118.    }
  119. }
  120. function location_confimed(thisname)
  121. {
  122.    var _loc1_ = _root;
  123.    var _loc2_ = thisname;
  124.    if(_loc1_.lastscene == "colony_nest")
  125.    {
  126.       _loc1_.select_locale(_loc2_);
  127.       if(_loc1_.locale_cost[_loc1_.localetype] <= _loc1_.antstats[_loc1_.gc_money])
  128.       {
  129.          if(_loc1_.lastlocale != _loc1_.localetype)
  130.          {
  131.             _loc1_.move_nest();
  132.             _loc1_.lastlocale = _loc1_.localetype;
  133.             _loc1_.pause = false;
  134.             _loc1_.update_playevents();
  135.             _loc1_.hide_locations();
  136.             _loc1_.show_locations();
  137.             _loc1_.show_mapglow();
  138.             _loc1_.select_locale(_loc1_.lastlocale);
  139.          }
  140.       }
  141.       else
  142.       {
  143.          _loc1_.localetype = _loc1_.lastlocale;
  144.          _loc1_.select_locale(_loc1_.localetype);
  145.       }
  146.    }
  147.    else
  148.    {
  149.       _loc1_.select_locale(_loc2_);
  150.       if(_loc1_.lastlocale != _loc1_.localetype)
  151.       {
  152.          _loc1_.move_nest();
  153.       }
  154.       _loc1_.lastlocale = _loc1_.localetype;
  155.       _loc1_.locale_visited[_loc1_.localetype] = true;
  156.       _loc1_.pause = false;
  157.    }
  158. }
  159. var locale_visited = new Array();
  160. var locale_adjacent = new Array();
  161. _root.locale_adjacent[0] = new Array(0);
  162. _root.locale_adjacent[1] = new Array(1);
  163. _root.locale_adjacent[2] = new Array(2,3,12);
  164. _root.locale_adjacent[3] = new Array(2,3,12);
  165. _root.locale_adjacent[4] = new Array(4);
  166. _root.locale_adjacent[5] = new Array(5);
  167. _root.locale_adjacent[6] = new Array(6);
  168. _root.locale_adjacent[7] = new Array(7);
  169. _root.locale_adjacent[8] = new Array(8);
  170. _root.locale_adjacent[9] = new Array(9);
  171. _root.locale_adjacent[10] = new Array(10);
  172. _root.locale_adjacent[11] = new Array(11);
  173. _root.locale_adjacent[12] = new Array(2,3,12);
  174. _root.locale_adjacent[13] = new Array(13);
  175. _root.locale_adjacent[14] = new Array(14);
  176. _root.locale_adjacent[15] = new Array(15);
  177. _root.locale_adjacent[16] = new Array(16);
  178. var locale_minimums = new Array();
  179. _root.locale_minimums[0] = 2500;
  180. _root.locale_minimums[1] = 1000;
  181. _root.locale_minimums[2] = 0;
  182. _root.locale_minimums[3] = 100;
  183. _root.locale_minimums[4] = 5000;
  184. _root.locale_minimums[5] = 5000;
  185. _root.locale_minimums[6] = 10000;
  186. _root.locale_minimums[7] = 2500;
  187. _root.locale_minimums[8] = 5000;
  188. _root.locale_minimums[9] = 2500;
  189. _root.locale_minimums[10] = 2500;
  190. _root.locale_minimums[11] = 10000;
  191. _root.locale_minimums[12] = 250;
  192. _root.locale_minimums[13] = 500;
  193. _root.locale_minimums[14] = 5000;
  194. _root.locale_minimums[15] = 1000;
  195. _root.locale_minimums[16] = 1000;
  196. var locale_cost = new Array();
  197. _root.locale_cost[0] = 3;
  198. _root.locale_cost[1] = 3;
  199. _root.locale_cost[2] = 1;
  200. _root.locale_cost[3] = 1;
  201. _root.locale_cost[4] = 3;
  202. _root.locale_cost[5] = 3;
  203. _root.locale_cost[6] = 2;
  204. _root.locale_cost[7] = 2;
  205. _root.locale_cost[8] = 3;
  206. _root.locale_cost[9] = 2;
  207. _root.locale_cost[10] = 2;
  208. _root.locale_cost[11] = 3;
  209. _root.locale_cost[12] = 3;
  210. _root.locale_cost[13] = 1;
  211. _root.locale_cost[14] = 3;
  212. _root.locale_cost[15] = 2;
  213. _root.locale_cost[16] = 5;
  214. var locale_text = new Array();
  215. _root.locale_text[0] = "THE FIELD  -  The \'battle\' field is the place if you want to test your soldiers and have lots of fights!   ";
  216. _root.locale_text[1] = "THE PARK  -  The park is a great place for parties and picnics!  There\'s always lots of food around, especially in the summer!";
  217. _root.locale_text[2] = "MR. SUBURBIA\'S BACKYARD  -  The backyard is a great spot to begin your colony!  Just keep an eye out for Mr. Suburbia and his lawnmower!";
  218. _root.locale_text[3] = "ROSE\'S GARDEN  -  The garden is a beautiful spot to live, especially in the spring months! ";
  219. _root.locale_text[4] = "SPRING VALLEY DINER  -  This greasy spoon has lots of yummy food!  Burgers, fries and spilled ketchup!  Yum!";
  220. _root.locale_text[5] = "SPRING VALLEY SCHOOL  -  Learn some fun facts about ants and raid the cafeteria!  But not much to do here during summer break.";
  221. _root.locale_text[6] = "THE BEACH  -  The beach is a safe place to relaxΓǪno battles happen here so your ants can kick back!  Come in the summer when humans drop lots of food! ";
  222. _root.locale_text[7] = "THE FOREST  -  Deep in the forest you can find gems and encounter some wild animals!  Be careful of the termites thoughΓǪ";
  223. _root.locale_text[8] = "MARTHA\'S BAKERY  -  Good food, good treats, good gosh, lets eat!  The bakery is a great spot for sweets, especially during the winter holidays!";
  224. _root.locale_text[9] = "THE SIDEWALK  -  The cracks in the sidewalk are great for building up your nest!  Just be careful of all the humans walking around.  ";
  225. _root.locale_text[10] = "THE PLAYGROUND  -  The playground is the best spot in town for kids, so its good for your nursery too!";
  226. _root.locale_text[11] = "THE CITY DUMP  -  One person\'s trash is another ant\'s treasure.  There\'s plenty of food in the dump, but bewareΓǪthe trash attracts lots of other ants as well!";
  227. _root.locale_text[12] = "MR. SUBURBIA\'S HOUSE  -  The house will keep you safe when the weather outside is roughΓǪand keep an eye out for leftovers in the kitchen!";
  228. _root.locale_text[13] = "SPRING VALLEY BRIDGE  -  Crossing the bridge gets you to and from town.  Just watch out for all the traffic!";
  229. _root.locale_text[14] = "FARMER BROWN\'S FARM  -  Find lots of food bonuses at Farmer Brown\'s Farm!  Just beware of his crazy chicken and mad cow!";
  230. _root.locale_text[15] = "THE STREAM  -  The stream is the beginning of the wilderness and connects you to Farmer Brown\'s farm! ";
  231. _root.locale_text[16] = "THE WORM HOLE  -  The worm hole lets you travel to any location on the map that you\'ve already unlocked!";
  232.