You have to rotate first, then move to rotated direction. Also, you have to use position vectors.
Set positions:
Vector2 shipPosition = new Vector2(100,100);
Vector2 blastPosition = shipPosition;
Set origins to middle of image
ship.origin = new Vector2(ship.Heigth / 2, ship.Width / 2);
blast.origin = new Vector2(blast.Heigth / 2, blast.Width / 2);
Change rotation:
blast.RotationAngle = ship.RotationAngle;
Move blast x,y forward from ship position, towards direction its rotated
float x = shipPosition.X+(float)(Math.Cos(blast.RotationAngle - MathHelper.PiOver2) * 5f);
float y = shipPosition.Y+(float)(Math.Sin(blast.RotationAngle - MathHelper.PiOver2) * 5f);
Apply new position
blastPosition = new Vector2(x,y);
Draw ship
spriteBatch.Draw(ship //the texture
, shipPosition //it's location as a Vector2
, null //no source rectangle - use entire Texture2D
, Color.White //with the image's own colors
, ship.RotationAngle //at the current XNA radians
, ship.origin //rotation point of the image, origin
, 1 //use the original scale
, SpriteEffects.None //don't flip or otherwise manipulate image
, 0 //no changes to layer depth
);
Draw blast
spriteBatch.Draw(blast //the texture
, blastPosition //it's location as a Vector2
, null //no source rectangle - use entire Texture2D
, Color.White //with the image's own colors
, blast.RotationAngle //at the current XNA radians
, blast.origin //rotation point of the image, origin
, 1 //use the original scale
, SpriteEffects.None //don't flip or otherwise manipulate image
, 0 //no changes to layer depth
);
Hope this works, i can't test this, but it should work.
Difference in this is, that if you rotate first ( you are still in the spot, inside ship, but rotated correctly ), then you move blast forward ( along the rotation its facing ) 5 steps. It should now be perfectly aligned with the ship.
NOTE:
Position is x,y where texture is located on screen.
Origin is x,y in Texture, that is used as central point when rotating it.
If you move origin from center of picture, rotation gets weird ( atleast in symmetric textures).
EDIT: Added the draw commands also, to make sure its used correctly.