Move sprite in the direction it is facing?
I am attempting to have a projectile follow the direction a gun is facing. When using the following code I am unable to make the projectile go in the right direction.
float speed = .5f; float dX = (float) -Math.cos(Math.toRadians(degree)) * speed; float dY = (float) Math.sin(Math.toRadians(degree)) * speed;
Can anyone tell me what I am doing wrong? The degree is the direction the gun is facing in degree's.