/** * @(#) $RCSfile: ACGTLoop.as,v $ $Revision: 1.7 $ $Date: 2003/03/05 19:52:16 $ * * Copyright 2003 Orgdot AS. All Rights Reserved. * http://dev.swfit.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * Loop for the ACGT piece. * * @author Olaf Havnes * @version $Revision: 1.7 $ $Date: 2003/03/05 19:52:16 $ * @since SWFIT1.0 */ // Tell the parent that we've left the start pos. if (report) { report = false; _parent.conv_name = ""; } // Fade in the piece _alpha = (_alpha * _parent.delay + 100) / (_parent.delay + 1); if (conveyor) { if (pause_counter++ > pause) { // Reset counter pause_counter = 0; // Move to the left pos_lock --; if (pos_lock == _parent.num_conv - 1) report = true; // Making a slight moving sound /:shift_acgt_audio_play ++; remove = false; // Are we off the board ? if (pos_lock == 0 && mergee eq "") { remove = true; _parent.dead += 1; _parent.nuggets = 0; // play un-succesful sound /:failure_acgt_audio_play ++; } else if (pos_lock == 0) { _parent.life += _parent.life_size; _parent.nuggets ++; // play succesful sound /:success_acgt_audio_play ++; } if (pos_lock < 0) { remove = true; } if (remove) { // Remove ourself from the register i = 0; while (i < _parent.num_conv + 1) { if (_name eq eval ("../:conv_" add i)) { set ("../:conv_" add i, ""); break; } i++; }; if (mergee ne "") removeMovieClip ("../" add mergee); removeMovieClip (""); } } // Implement the slot shuffle movement. xd = (x_min + pos_lock * pos_wdt) - _x; // Compute the speed based on distance we have to travel. xv += ac * xd - fr * xv; // Set the new x pos. xp += xv; _x = int (xp); // Have we been merged with another ? if (mergee ne "") { // Rise until we meet the mergee ... if (_y > _parent.merge_fall) _y = _y - fall_speed; else { if (goldie) { // Dont do anything } else { // Play gold sound /:goldie_acgt_audio_play ++; } goldie = true; // Turn both pieces to gold tellTarget (type) { gotoAndStop ("gold"); } mtype = eval ("../" add mergee add ":type") tellTarget ("../" add mergee add "/" add mtype) { gotoAndStop ("gold"); } } // Let the mergee follow follow our x-movement setProperty ("../" add mergee, _x, int (xp)); } } else { if (falling) { // Check - once - for merge if (merge_check && _y > _parent.free_fall) { merge_check = false; // Run through the register and find the one with the same lock pos i = 0; while (i < _parent.num_conv + 1) { cname = eval ("../:conv_" add i); if (cname ne "") { if (pos_lock == eval ("../" add cname add ":pos_lock")) { // Is the matching piece un-merged ? cmergee = eval ("../" add cname add ":mergee"); // Do we have a matching type ? ctype = eval ("../" add cname add ":type"); if ( (cmergee eq "") && ( (ctype eq "a" && type eq "t") || (ctype eq "t" && type eq "a") || (ctype eq "c" && type eq "g") || (ctype eq "g" && type eq "c") ) ) { mergee = cname; set ("../" add cname add ":mergee", _name); } break; } } i++; } } // Are we above the merge line? if (_y < _parent.merge_fall - _height) _y += fall_speed; else if (mergee eq "") _y += fall_speed; if (_y > _parent.water_fall) { _parent.drown += _parent.drown_size; // Tell the bubbles to start bubbling ../../:drown = true; ../../:bpos = _x; removeMovieClip (""); // play drown sound /:drown_acgt_audio_play ++; } } }