[flexcoders] Flash/FLex gravity

2009-04-22 Thread flexaustin
Does anyone know of a tutorial on actionscript and gravity. Not like dropping a ball, but like google maps where you drag an item and it keeps going in that direction but slowing down. So gravity in all directions something like a hockey puck. TIA

Re: [flexcoders] Flash/FLex gravity

2009-04-22 Thread Josh McDonald
That sort of thing (a vector) is easy, once you've determined the direction in radians, and a speed. Let's call it pixels-per-frame, to make things simple. Note that this is typed in gmail, and will need tweaks! accuratePositionX = x; accuratePositionY = y; velocityX = Math.cos(direction) *

Re: [flexcoders] Flash/FLex gravity

2009-04-22 Thread Nate Beck
Yup Josh is correct, creating a vector is the way to go... The slowing down force you're talking about is friction (at least in physics). If you're interested in this kind of stuff, I highly recommend picking up a copy of Keith Peters book: