coin rotation, as3
Posted
by VideoDnd
on Stack Overflow
See other posts from Stack Overflow
or by VideoDnd
Published on 2010-04-20T16:44:35Z
Indexed on
2010/04/20
17:43 UTC
Read the original article
Hit count: 428
flash
|actionscript-3
What's the best way to make a coin rotation? I tried Math.random, but the coin doesn't wobble correctly.
starter code
//ROTATION
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
function enterFrameHandler(event:Event):void
{
/*
ADD VELOCITY, GRAVITY, ACCELERATION
*/
coin.rotationY += 8;
}
tried this, but it has no gravity or accelleration
//ROTATION AND RANDOM MATH
function wobble():void {
var wobble = ((Math.random()*4)-2);
flk.rotationY -= 11+wobble/2;
flk.rotationX -= 2+wobble/20;
}
var myInterval:uint = setInterval (wobble, 40);
I took out the work physics from my title:) I want it to behave like its affected by velocity, gravity, and acceleration.
© Stack Overflow or respective owner