Code in frame 1 layer 1


btnCalc.onRelease = function(){

  //calculate DX and DY from angle and length

  //use vector projection to get DX and DY



  //offset the angle

  degrees = angle -90;



  //convert to radians

  radians = degrees / 180 * Math.PI;



  //get DX and DY (normalized: length is one)

  dx = Math.cos(radians);

  dy = Math.sin(radians);



  //compensate for speed

  dx *= length;

  dy *= length;

} // end btnCalc