home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Puzzle / railway-line.swf / scripts / DefineSprite_295 / frame_1 / DoAction.as < prev   
Encoding:
Text File  |  2005-09-29  |  2.1 KB  |  70 lines

  1. function do_start_bomb_drag(passed_x, passed_y, passed_name)
  2. {
  3.    this[passed_name].startDrag(true);
  4. }
  5. function do_stop_bomb_drag(passed_name)
  6. {
  7.    bomb_allowed = true;
  8.    if(_root.track_segments_MC.hitTest(_root._xmouse,_root._ymouse,true))
  9.    {
  10.       j = 1;
  11.       while(j < _root.number_segments + 1)
  12.       {
  13.          segment_ID = "segment_" + j;
  14.          if(_root.track_segments_MC[segment_ID].hitTest(_root._xmouse,_root._ymouse,true))
  15.          {
  16.             var my_limit = _root.active_segments_array.length;
  17.             a = 0;
  18.             while(a < my_limit)
  19.             {
  20.                if(_root.active_segments_array[a] == segment_ID)
  21.                {
  22.                   do_bounce_bomb_back(passed_name);
  23.                   bomb_allowed = false;
  24.                }
  25.                a++;
  26.             }
  27.             if(_root.track_segments_MC[segment_ID].no_bomb == true)
  28.             {
  29.                do_bounce_bomb_back(passed_name);
  30.                bomb_allowed = false;
  31.             }
  32.             if(bomb_allowed == true)
  33.             {
  34.                _root.bomb_sound.start();
  35.                duplicateMovieClip(explosion,"explode",116307);
  36.                explode._x = this[passed_name]._x;
  37.                explode._y = this[passed_name]._y;
  38.                explode.gotoAndPlay("go");
  39.                this[passed_name].removeMovieClip();
  40.                _root.track_segments_MC[segment_ID].removeMovieClip();
  41.                bombs_remaining_count--;
  42.                _root.bombs_remaining_text = "x" + bombs_remaining_count;
  43.                if(bombs_remaining_count > 0)
  44.                {
  45.                   do_add_next_bomb_tile();
  46.                }
  47.             }
  48.          }
  49.          j++;
  50.       }
  51.    }
  52.    else
  53.    {
  54.       do_bounce_bomb_back(passed_name);
  55.    }
  56. }
  57. function do_add_next_bomb_tile()
  58. {
  59.    bomb_generation_count++;
  60.    bomb_ID = "bomb_" + bomb_generation_count;
  61.    this.attachMovie("bomb_button_MC",bomb_ID,bomb_generation_count);
  62. }
  63. function do_bounce_bomb_back(passed_name)
  64. {
  65.    _root.no_drop_sound.start();
  66.    this[passed_name]._x = 0;
  67.    this[passed_name]._y = 0;
  68.    stopDrag();
  69. }
  70.