You can get the X and Y velocity using ship.physics.velocityX/Y

so to find the overall velocity in any direction, is like trying to find the longest side of a triangle with pythagoras' theorem

Imagine 'a' is velocityX and 'b' is velocityY.. the overall velocity would be 'c'Here's the full pageso to get the overall velocity in any direction, it's:

sqrt(ship.physics.velocityX^2,ship.physics.velocityY^2)

you might have to put each velocity value inside an abs( ) to avoid negative numbers but i'm not sure.

there is an easier way though..

The distance() expression uses pythagoras in the same way, so you can actually just use that..

distance(0,0,ship.physics.velocityX,ship.physics.velocityY)

if you do it this way, I just figured it'd be good to know why it works first

edit: double ninja'd, i aint even mad

keepee2013-07-03 01:29:01