/// <summary> /// Creates a Bullet, calculating the Rotation /// </summary> /// <param name="Origin">The position at which the Bullet should start</param> /// <param name="Destination">The position to which the Bullet is heading</param> /// <returns>A new Bullet</returns> public static Bullet CreateBullet(Vector2 Origin, Vector2 Destination) { Bullet New = new Bullet(); New.Position = Origin; New.Rotation = MathHelper.ToRadians((float)(Math.Atan2(Destination.Y - Origin.Y, Destination.X - Origin.X) * 180.0f / Math.PI) + 90); return New; }
/// <summary> /// Creates a Bullet, setting the Rotation /// </summary> /// <param name="Origin">The position at which the Bullet should start</param> /// <param name="Angle">The angle the Bullet is heading in</param> /// <returns>A new Bullet</returns> public static Bullet CreateBullet(Vector2 Origin, float Angle) { Bullet New = new Bullet(); New.Position = Origin; New.Rotation = MathHelper.ToRadians(Angle); return New; }