LegInit Actionscript
Table of contents | Previous document | Download LegInit.as | SWF!T Homepage RCSfile: LegInit.as,v Revision: 1.1 Date: 2003/04/22 14:28:12
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 leg. Measure all the parts, and initiate some values.
author Olaf Havnes
version Revision: 1.1 Date: 2003/04/22 14:28:12
since SWFIT1.0
Constants for the downward motion of the legs.
LEG_ACC = 40;
LEG_FR = 0.2;
How does the spring act when there is no pressure on it?
SPRING_FR = 0.04;
SPRING_ACC = 0.02;
_parent needs this variable to compute the leg the swing angle.
leg_width = cylinder.outer_piston_measure._width;
We must add this variable to the ground.
foot_add = foot.foot_measure._y;
The total length of the leg runs from the center point of the outer piston,
which resides at the movie clip center, to the center point of the foot.
The inner piston (spring) is scaled from its 100px length to whatever
length it should have. The foot is placed where the spring ends.
spring_min_length = spring._xscale;
spring_max_length = foot._x - spring._x;
spring_equilibrium = (spring_min_length + spring_max_length) / 2;
Init some variables
spring_length = spring_min_length;
spring_speed = 0;
foot._x = spring._x + spring_length;
To synchronize the movie, we stop the clip here and call the relevant frames from _parent.
stop ();
|
|