HandInit Actionscript

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

RCSfile: HandInit.as,v  Revision: 1.4  Date: 2003/02/11 07:07:31  

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.


Init script for the ACGT dispenser.
author      Olaf Havnes
version     Revision: 1.4  Date: 2003/02/11 07:07:31  
since       SWFIT1.0


How much do we offset the piece we are to drag ?

piece_shift = 4;

Set bounds

x_min = 20;
x_max = 212;

Set lock points

pos_min = 0;
pos_max = 8;
pos_wdt = 24;
pos_hlf = pos_wdt / 2;

Set "bounce" values

ac = 0.8;
fr = 0.4;

Set start values for speed and x pos

xv = 0;
xp = _x;

Compute the lock pos

pos_lock = int ( (xp - x_min) / pos_wdt);
gap = xp - x_min - pos_lock * pos_wdt;
if (gap > pos_hlf) pos_lock += 1;

Lock the drag piece

drop_drag = false;
drop_init = false;
drop_done = false;