My Account
How to create this random motion.
accel = 4; var randx = Math.round(Math.random()*Stage.width);
ball_mc.onEnterFrame = function (){ ball_mc._x += (randx-ball_mc._x)/accel; if(Math.round(ball_mc._x)==randx){ randx = Math.round(Math.random()*Stage.width); } }
Define variables.
Generate random numbers for the x and y positions.
Gradually move the object to this position.
Tell object to to repeat the process when it reaches the new position.
© 2008 Quantunet LLC All Rights Reserved | Intellectual Property | Terms of Use | Privacy Home | About Quantunet | FAQ's | Contact Us