Example #1
0
        /// <summary>
        /// Create a new bullet coming from the ship
        /// </summary>
        private void FireBullet()
        {
            Bullet newBullet = new Bullet(Game);
            Vector2 velocity = new Vector2((float)Math.Cos(ship.Rotation + (float)MathHelper.PiOver2), (float)Math.Sin(ship.Rotation + (float)MathHelper.PiOver2));

            velocity.Normalize();
            velocity *= 6.0f;

            newBullet.Velocity = velocity;
            newBullet.Position = ship.Position + newBullet.Velocity;

            bullets.Add(newBullet);
        }