FlywheelLoop Actionscript

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

RCSfile: FlywheelLoop.as,v  Revision: 1.1  Date: 2003/04/22 00:57:20  

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 script for the flywheel. Includes some simpliphied physics. Don't navigate by this one...
author      Olaf Havnes
version     Revision: 1.1  Date: 2003/04/22 00:57:20  
since       SWFIT1.0



val_x = flywheel._x;
#include "_scripts/GroundLookup.as"
flywheel._y = val_y;

Remember that positive is down in flash ...

this_height = start_height + val_y;
if (this_height < 0) this_height = 1;

Newton's square root method on a simplified expression for rotational / potentional energy.

angle_speed = ( angle_speed + (CONSTANT * this_height) / angle_speed ) / 2;
flywheel._rotation += angle_speed;

Flash will not leave the scale alone on repeated rotations, so ...

flywheel._xscale = 100;
flywheel._yscale = 100;