home *** CD-ROM | disk | FTP | other *** search
- function do_attach_new_piece(passed_y)
- {
- spawn_piece_counter++;
- new_ID = "spawn_piece_" + spawn_piece_counter;
- this.attachMovie("drag_track_MC",new_ID,spawn_piece_counter);
- this[new_ID]._x = slider_x;
- this[new_ID]._y = passed_y;
- }
- function do_drop_piece(passed_name, passed_type, passed_y)
- {
- var drop_flag = true;
- drop_flag = do_test_outside_grid();
- if(drop_flag == true)
- {
- drop_flag = do_test_against_existing_track();
- }
- if(_root.lost_life_dialog_MC._visible == true)
- {
- drop_flag = false;
- }
- if(drop_flag == false)
- {
- do_return_piece_to_start(passed_name,passed_y);
- }
- else
- {
- r = 1;
- while(r <= 8)
- {
- c = 1;
- while(c <= 8)
- {
- if(_root.grid_MC["square" + r + c].hitTest(_root._xmouse,_root._ymouse,0))
- {
- seg_x = _root.grid_MC["square" + r + c]._x;
- seg_y = _root.grid_MC["square" + r + c]._y;
- _root.do_attach_track_segment(passed_type,seg_x,seg_y);
- _root.lay_track_sound.start();
- removeMovieClip(this[passed_name]);
- do_attach_new_piece(passed_y);
- return undefined;
- }
- c++;
- }
- r++;
- }
- }
- }
- function do_test_outside_grid()
- {
- if(!_root.grid_MC.hitTest(_root._xmouse,_root._ymouse,true))
- {
- return false;
- }
- return true;
- }
- function do_test_against_existing_track()
- {
- if(_root.track_segments_MC.hitTest(_root._xmouse,_root._ymouse,true))
- {
- return false;
- }
- }
- function do_return_piece_to_start(passed_name, passed_y)
- {
- stopDrag();
- _root.no_drop_sound.start();
- this[passed_name]._x = slider_x;
- this[passed_name]._y = passed_y;
- }
-