I solved the problem with the following code
if (keyboard.IsKeyDown(Keys.Space) && shoot)
{
shoot = false;
this.fire.Play(.2f, .9f, 0);
lazerX = spritePosX + HeroSprite.Width / 2 * (float)Math.Sin(rotationAngle);
lazerY = spritePosY - HeroSprite.Height / 2 * (float)Math.Cos(rotationAngle);
Projectile projectile = new Projectile(heroLazer, "heroLazer",
lazerX, lazerY, rotationAngle);
Game1.AddProjectile(projectile);
}
and then with this code
public void update(GameTime gameTime, KeyboardState keyboard)
{
if (active == true)
{
projectileAge += gameTime.ElapsedGameTime.Milliseconds;
ProjectilePosX += (float)(Math.Sin(spriteHeading) *
gameTime.ElapsedGameTime.TotalMilliseconds) * ProjectileMoveAmount;
ProjectilePosY -= (float)(Math.Cos(spriteHeading) *
gameTime.ElapsedGameTime.TotalMilliseconds) * ProjectileMoveAmount;
spritePos = new Vector2(ProjectilePosX, ProjectilePosY);
}
if (projectileAge > projectileLife)
{
active = false;
}
}