Java tutorial
//package com.java2s; public class Main { public static float getAngleToCoordinates(double _direction, float _startX, float _startY, char _type) { if (_type == 'x') { return _startX + (float) Math.cos((_direction * Math.PI) / 180); } else { return _startY + (float) Math.sin((_direction * Math.PI) / 180); } } }