Shoot bullets out of the loop

Hello all, im finishing up some shooter game. But i have got a slight problem with my shooting mechanism. the first 5 degrees go perfectly fine, but after that it goes off.
This is the method im using to shoot bullets:

	public void shootBullets() {
		float lengDir = 1;
		switch (Ships.currentship) {
		case Ships.NORMALSHIP:
			lengDir = 15;
			break;
		}
		float tempX = Player.getPlayer().getShip().getImageOriginX();
		float tempY = -Player.getPlayer().getShip().getImageOriginY();
		tempX += (Math.sin(java.lang.Math.toRadians(this.dir)) * lengDir);
		tempY += (Math.cos(java.lang.Math.toRadians(this.dir)) * lengDir);
		System.out.println(tempX + " , " + tempY);
		Player.getPlayer().getBullets().add(new NormalBullet(x + tempX, y + tempY, dir));
	}

lengdir is the length to the loop from the origin of the image. Im using 15 in this code.
Im using slick, so the point (0,0) is at the left top of an image.
getImageOriginX:


	public float getImageOriginX() {
		return image.getWidth() / 2;
	}

The weapon is an object which is attached to the player. meaning that the x of the weapon is the x of the player (its basically a suit), same goes for the direction and the y position

output, starting facing north, and turning 90 degrees before shooting:


15.0 , -1.0
29.984562 , -16.680374
14.424611 , -30.98896
0.007386695 , -15.529313

Your code barely makes any sense but first thing I noticed is that you have to use cosine for X and sine for Y ;D

Also, please drop the “java.lang.” part, it’s hurting my eyes ;D

At least my code made more sense then you not making sense.
But i shall thank you for this stupid mistake i made. cant believe i did that! :expressionless:

if your referring to the java.lang part, his trying to say, import it so you can just do Math.cosin();

his post made a lot of sense.

Except you have a custom class named Math too.

zing!