First off I'd make a Bullet class, so that you can hold a Rectangle or bounding sphere as well as an active bool, speed etc.
Now these code blurbs is using rotations, but othewise it's exactly what you're trying to do:
class Bullet
{
public Rectangle rectangle;
public Vector2 position;
public float speed;
public bool isActive;
public float Rotation;
public BoundingSphere sphere;
double time;
public Bullet(Vector2 Position, GameTime gameTime, float rotation,float length)
{
rectangle = new Rectangle((int)Position.X, (int)Position.Y, 4, 4);
Rotation = rotation;
isActive = true;
speed = 10+length;
position = Position;
time = gameTime.TotalGameTime.TotalSeconds+.5;
sphere = new BoundingSphere(new Vector3(position.X,position.Y,0),2);
}
public void MoveBullet(GameTime gameTime)
{
if (time >= gameTime.TotalGameTime.TotalSeconds)
{
if (isActive == true)
{
position.X += speed * ((float)Math.Cos(Rotation));
position.Y += speed * ((float)Math.Sin(Rotation));
rectangle.X = (int)position.X;
rectangle.Y = (int)position.Y;
sphere.Center.X = position.X;
sphere.Center.Y = position.Y;
}
}
else
{
isActive = false;
}
}
}
//The below code is from the main game
void AddBullet(GameTime gameTime,Vector2 position, float rotation)
{
if (gameTime.TotalGameTime.Milliseconds % 200 < 50&&shipobject.isactive)
{
if (beendone == false)
{
ScreenManager.audio.Fire();
bulletsInPlay.Add(bullets[bulletcount] = new Bullet(position, gameTime, rotation,length));
bulletcount++;
beendone = true;
}
}
else
{
beendone = false;
}
firebullet = false;
}
Here's the full code But basically here's the rundown of things to do.
Check to see if it should fire (as said before it's best to check for time since update will most likely be called 60 times or more in 1 second), then create a new bullet object from the bullet class.
Then each update you need to move it in the desired direction. If you're doing something like Space invaders, you'll just move Y by negative 5 or something. If you're doing a game where it's rotated you'll use something similar to my code.
Then using either a Rectangle or bounding sphere check to see if it hits.
Then at some point you'll want to remove it. Whether its by time or position.
You are really close with what you have, it's just that a more object orriented design would make this easier for you to handle.