private Vector2D velocity; //<! Filed to store the velocity.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Projectile constructor
        /// </summary>
        /// <param name="speed">The Objects speed</param>
        /// <param name="imagePath">The Path For the image sprite</param>
        /// <param name="startPos">Starting Position</param>
        /// <param name="display">Display Rectangle</param>
        /// <param name="animationSpeed">Speed of the animation</param>
        public Projectile(float speed, string imagePath, Vector2D startPos, Rectangle display, float animationSpeed)
            : base(speed, imagePath, startPos, display, animationSpeed)
        {
            //Makes a unit vector for the direction of the mouse.
            velocity = Position.Subtract(new Vector2D(Mouse.X,Mouse.Y));
            velocity.Normalize();
        }
        private Random random = new Random(); //!< Random used to drop powerups

        #endregion Fields

        #region Constructors

        //Methods to be used in attack
        /// <summary>
        /// Enemy constructor
        /// </summary>
        /// <param name="speed">Enemy movement speed</param>
        /// <param name="health">Enemy starting health</param>
        /// <param name="imagePath">Image path for the sprite</param>
        /// <param name="startPos">Starting position</param>
        /// <param name="display">Display rectangle</param>
        /// <param name="animationSpeed">Speed of the animation</param>
        /// <param name="attackTimer">Countdown for when an attack is ready</param>
        /// <param name="coolDown">Time between attacks</param>
        /// <param name="player">Keeps track of the player</param>
        public Enemy(float speed, int health, string imagePath, Vector2D startPos, Rectangle display,
            float animationSpeed, float attackTimer, float coolDown, Player player)
            : base(speed, health, imagePath, startPos, display, animationSpeed)
        {
            this.attackTimer = attackTimer;
            this.coolDown = coolDown;
            this.player = player;
        }
        /// <summary>
        /// Finds the difference between one position and another by creating a vector between them.
        /// </summary>
        /// <param name="vec">vector between two positions</param>
        /// <returns></returns>
        public Vector2D Subtract(Vector2D vec)
        {
            // subtracts the two positions from each other
            Vector2D newVec = new Vector2D(vec.X - this.X, vec.Y - this.Y);

            // returns the new vector
            return newVec;
        }
        private RectangleF collisionBox; //!< the collider rectangle

        #endregion Fields

        #region Constructors

        /// <summary>
        /// GameObject Constructor
        /// </summary>
        /// <param name="imagePath">Image path for the sprite</param>
        /// <param name="startPos">The starting position of the GameObject</param>
        /// <param name="display">Rectangle for the diplay</param>
        /// <param name="animationSpeed">Animation speed for animated objects</param>
        public GameObject(string imagePath, Vector2D startPos, Rectangle display, float animationSpeed)
        {
            //Assigning the values to the fields
            this.Position = startPos;
            this.display = display;
            this.animationSpeed = animationSpeed;

            //Spit the inputted imagepaths to we can have animations
            string[] imagePaths = imagePath.Split(';');
            //Initate the list ´to we can use it
            animationFrames = new List<Image>();

            //Add each image to the list from the paths in the paths array
            foreach (string path in imagePaths)
            {
                animationFrames.Add(Image.FromFile(path));
            }
            //Set the sprite to the first fram in the animation
            sprite = animationFrames[0];
        }
        /// <summary>
        /// Properly rotates and draws the objects sprite in the GameWorld
        /// </summary>
        /// <param name="dc">GDI+ for drawing the sprite</param>
        public override void Draw(Graphics dc)
        {
            //Make a vector with origin in the center of the sprite.
            Vector2D spriteCenter = new Vector2D(Position.X + sprite.Width / 2f, Position.Y + sprite.Height / 2f);
            //Subtract that vector with the mouse position.
            Vector2D vec = spriteCenter.Subtract(player.Position);
            //Normalize that vector.
            vec.Normalize();

            //Calulate the angle form the normalized vector.
            angle = Math.Atan2(vec.Y, vec.X) * 180 / Math.PI;

            //Change the origin on the coordinate system to the center of the sprite
            dc.TranslateTransform(Position.X + sprite.Width / 2f, Position.Y + sprite.Height / 2f);
            //Rotate the coordinate system the desired degrees.
            dc.RotateTransform((float)angle + 90);
            //Draw the sprite.
            dc.DrawImage(sprite, 0 - sprite.Width / 2, 0 - sprite.Height / 2, sprite.Width, sprite.Height);
            //Reset the graphics.
            dc.ResetTransform();
        }
        protected float speed; //<! the speed of the gamobject

        #endregion Fields

        #region Constructors

        /// <summary>
        /// constructer for movingobject
        /// </summary>
        /// <param name="speed">the movementspeed of the object</param>
        /// <param name="imagePath">Path to the sprite</param>
        /// <param name="startPos">Position to place the sprite</param>
        /// <param name="display">The displayrectangle</param>
        /// <param name="animationSpeed">animatinospeed</param>
        public MovingObject(float speed, string imagePath, Vector2D startPos, Rectangle display, float animationSpeed)
            : base(imagePath, startPos, display, animationSpeed)
        {
            this.speed = speed;
        }
 /// <summary>
 /// Unit Constructor
 /// </summary>
 /// <param name="speed">The units movement speed</param>
 /// <param name="health">The units starting health</param>
 /// <param name="imagePath">Image path for the sprite</param>
 /// <param name="startPos">The Units starting position</param>
 /// <param name="display">The display rectangle</param>
 /// <param name="animationSpeed">The speed of the animation</param>
 public Unit(float speed,int health, string imagePath, Vector2D startPos, Rectangle display, float animationSpeed)
     : base(speed, imagePath, startPos, display, animationSpeed)
 {
     Health = health;
 }
 /// <summary>
 /// Constructer for Powerup
 /// </summary>
 /// <param name="imagePath">Path tot he sprite</param>
 /// <param name="startPos">Start position</param>
 /// <param name="display">displayrectangle</param>
 /// <param name="animationSpeed">animationspeed</param>
 public HealthRegen(string imagePath, Vector2D startPos, Rectangle display, float animationSpeed)
     : base(imagePath, startPos, display, animationSpeed)
 {
 }
 /// <summary>
 /// Constructer for Powerup
 /// </summary>
 /// <param name="imagePath">Path tot he sprite</param>
 /// <param name="startPos">Start position</param>
 /// <param name="display">displayrectangle</param>
 /// <param name="animationSpeed">animationspeed</param>
 public PowerUp(string imagePath, Vector2D startPos, Rectangle display, float animationSpeed)
     : base(imagePath, startPos, display, animationSpeed)
 {
 }