Moving towards the direction that is facing [Slick2D] (STILL NEED HELP)

I’m using Slick2D and iv’e got the direction and the movement sort of working. My problem is that the rectangle I have moves in the direction that it is facing when I press the ‘W’ key, but it doesn’t use the right edge of the rectangle to do so, I want the shorter edge to do the rotating and moving . I will provide a drawing of what is happening below the code

[quote]public class Player {
	private Rectangle collisionRect;
	private int speed = 3;
	private float direction = 0;
	private Vector2f angle, position;
	private Input input;
	
	public Player(int x, int y, Input input){
		position = new Vector2f();
		angle = new Vector2f();
		
		this.position.x = x;
		this.position.y = y;
		this.input = input;
		collisionRect = new Rectangle(x, y, 120, 200);
	}
	public void render(Graphics g){
		g.rotate(collisionRect.getX() + collisionRect.getWidth()/2, collisionRect.getY() + collisionRect.getHeight()/2,  direction);
		g.draw(collisionRect);
	}
	public void update(){
		collisionRect.setLocation(position.x, position.y);
		
		angle.x = (float) Math.cos(Math.toRadians(direction));
		angle.y = (float) Math.sin(Math.toRadians(direction));
	
		if(input.isKeyDown(Input.KEY_W)){
			position.x += angle.x * speed;
			position.y += angle.y * speed;
		}
		if(input.isKeyDown(Input.KEY_A)){
			direction -= 1;
		}
		if(input.isKeyDown(Input.KEY_D)){
			direction += 1;
		}
	
		
	}

}
[/quote]

Change

collisionRect = new Rectangle(x, y, 120, 200);

to

collisionRect = new Rectangle(x, y, 200, 120);

Should probably fix your issue. That or set some kind of initial 90 degree rotation on the rectangle