Organic mouse-controlled movement in Actionscript part 2
Last week I wrote of how movement controlled by the mouse can be more organic by introducing factors such as speed and acceleration. For part 2 of the series, I’m adding mouse angle/direction into the equation.
To recap, here’s the most basic form of mouse-controlled movement found in many Flash websites today.
What I did last week incorporated mouse speed which means as the mouse accelerates, the object accelerates with it as well.
For today’s post, I added another factor—mouse angle. usually mouse angle is calculated with mouse position and an “origin”. In this case, both the mouse position and origin are dynamic but are easily checked with the same update functions that checks the speed. The end point would be the current and origin would be 50ms ago (configurable tracking speed). With basic trigonometry we get radians which are then converted into angles.
Be sure to check back for part 3!
Posting comment, please wait…
Your comment is appreciated.