I am working on a 2D project that requires rotation and moving in the direction of rotation. I have managed to get the image to rotate but I am not able to move the image in the direction of rotation. I have had this problem for a couple of days now. Here is a snippet of the source code:

Object Info

static float shipx = 300f; static float shipy = 300f; static int shipspeed = 20;

Update Method

if(input.isKeyDown(Input.KEY_UP)) { // What I am using to move in the direction of rotation, but I'm not having any luck. shipx += (float) (shipspeed * Math.toRadians(Math.cos(angle))); shipy += (float) (shipspeed * Math.toRadians(Math.sin(angle))); System.out.println("X: " + shipx + " " + "Y: " + shipy); } else if(input.isKeyDown(Input.KEY_DOWN)) { shipy += shipspeed; } else if(input.isKeyDown(Input.KEY_RIGHT)) { angle += rotation; Ship.setCenterOfRotation(Ship.getWidth() / 2, Ship.getHeight() / 2); Ship.setRotation((float) angle); } else if(input.isKeyDown(Input.KEY_LEFT)) { angle -= rotation; Ship.setCenterOfRotation(Ship.getWidth() / 2, Ship.getHeight() / 2); Ship.setRotation((float) angle); }

I am not using any vector math or anything, just simple trig. Feel free to ask for more information if needed. Thanks.