Friday 8 March 2013

pendulum movement in as3


Code :-
=====

var startingAngle:Number = 90;
var gravity:Number = 0.1;
var currentForce:Number = 0;
pendulum.rotation = startingAngle;
stage.addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void
{
currentForce -= pendulum.rotation / (gravity * 150);
pendulum.rotation +=  currentForce;
}

1 comment:

  1. eh sir why gravity not 9.81 and why grvity * 150 ?

    what the mean ?

    ReplyDelete