GameLoop Actionscript

Table of contents | Previous document | Download GameLoop.as | SWF!T Homepage

RCSfile: GameLoop.as,v  Revision: 1.5  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 main DNAFactory game counter.
author      Olaf Havnes
version     Revision: 1.5  Date: 2003/03/05 19:52:16  
since       SWFIT1.0



Do we have a conveyor belt piece ?

if (conv_name eq "")
{
   acgt_num++;
   conv_name = "conv_" add acgt_num;
   duplicateMovieClip ("acgt", conv_name, acgt_num);
   setProperty (conv_name, _x, conv_start_x);
   setProperty (conv_name, _y, conv_start_y);
   set (conv_name add ":conveyor", true);
   

Find a spare slot for this conveyor piece

   i = 0;
   while (i < num_conv + 1)
   {
       if (eval ("conv_" add i) eq "")
       {
           set ("conv_" add i, conv_name);
           break;
       }
       i++;
   }
}

Do we have a waiting piece ?

if (wait_name eq "")
{
   acgt_num++;
   wait_name = "drag_" add acgt_num;
   duplicateMovieClip ("acgt", wait_name, acgt_num);
}
else
{
   setProperty (wait_name, _x, acgt._x);
   setProperty (wait_name, _y, acgt._y);
}

Do we have a drag piece ?

if (wait_name eq "")
{
   acgt_num++;
   wait_name = "drag_" add acgt_num;
   duplicateMovieClip ("acgt", wait_name, acgt_num);
}
else
{
   setProperty (wait_name, _x, wait_x);
   setProperty (wait_name, _y, wait_y);
}


Do we have a deposit piece ?

if (dpst_name eq "")
{
}
else
{
   setProperty (dpst_name, _x, dpst_x);
   setProperty (dpst_name, _y, dpst_y);
}


if (drop_pause_counter < drop_pause)
{
   drop_pause_counter++;
}
else
{

Do we have a dragging piece ?

   if (drag_name eq "")
   {
       drag_name = wait_name;
       wait_name = "";
       hand.drop_drag = true;
   }
}

Was the piece just dropped ?

if (hand.drop_done)
{
   hand.drop_done = false;
   hand.drop_drag = false;
   drop_pause_counter = 0;
   set (drag_name add ":falling", true);
   drag_name = "";
}