Get the rotation of an object in the game engine
The method for accessing an object's rotation varies depending upon which rendering engine you are using.

In either Blender-Internal or Cycles, you can access an object's rotation by using the Python reference bpy.context.object.rotation_euler or just object.rotation_euler. In your script, just call that reference and set your other object's velocity based on that.

In the Blender Game Engine, you need to instead use object.worldOrientation.to_euler() to retrieve the object's rotation. For example:

from bge import logic
cont = logic.getCurrentController()
obj = cont.owner
rotation = obj.worldOrientation.to_euler()
print (rotation.z)