/// <summary>
        /// Handles the movements and attacks of the player
        /// </summary>
        /// <param name="gameTime">Inherit the GameTime class</param>
        public void Movement(GameTime gameTime)
        {
            mouseState     = Mouse.GetState();
            mouseDistanceX = mouseState.Position.X - middleOfMap.X;
            mouseDistanceY = mouseState.Position.Y - middleOfMap.Y;

            if (Keyboard.GetState().IsKeyDown(Keys.Space) || mouseState.LeftButton == ButtonState.Pressed)  //vänsterklick funkar ej när man går?
            {
                if (!isAttacking)
                {
                    speedMultiplier *= weaponSpeedMultiplier;
                    isAttacking      = true;
                    moving           = false;
                    GetAttackingDirection();
                    if (equippedRange != null)
                    {
                        equippedRange.CreateNewProjectile(damageMultiplier, mouseDirection);
                    }
                }
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Left) && Keyboard.GetState().IsKeyDown(Keys.Up) || Keyboard.GetState().IsKeyDown(Keys.A) && Keyboard.GetState().IsKeyDown(Keys.W))
            {
                Animate(gameTime, 3);

                TileCollisionHandler(new Rectangle(hitbox.X - (int)(speed * speedMultiplier), hitbox.Y - (int)(speed * speedMultiplier), hitbox.Width, hitbox.Height));
                if (!isColliding)
                {
                    hitbox.X   -= (int)(Math.Sqrt(0.5) * (int)(speed * speedMultiplier));
                    hitbox.Y   -= (int)(Math.Sqrt(0.5) * (int)(speed * speedMultiplier));;
                    moving      = true;
                    isColliding = false;
                }
                else
                {
                    TileCollisionHandler(new Rectangle(hitbox.X, hitbox.Y - (int)(speed * speedMultiplier), hitbox.Width, hitbox.Height));
                    if (!isColliding)
                    {
                        hitbox.Y   -= (int)(speed * speedMultiplier);
                        moving      = true;
                        isColliding = false;
                    }
                    TileCollisionHandler(new Rectangle(hitbox.X - (int)(speed * speedMultiplier), hitbox.Y, hitbox.Width, hitbox.Height));
                    if (!isColliding)
                    {
                        hitbox.X   -= (int)(speed * speedMultiplier);
                        moving      = true;
                        isColliding = false;
                    }
                }
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Right) && Keyboard.GetState().IsKeyDown(Keys.Up) || Keyboard.GetState().IsKeyDown(Keys.D) && Keyboard.GetState().IsKeyDown(Keys.W))
            {
                Animate(gameTime, 3);

                TileCollisionHandler(new Rectangle(hitbox.X + (int)(speed * speedMultiplier), hitbox.Y - (int)(speed * speedMultiplier), hitbox.Width, hitbox.Height));
                if (!isColliding)
                {
                    hitbox.X   += (int)(Math.Sqrt(0.5) * (int)(speed * speedMultiplier));;
                    hitbox.Y   -= (int)(Math.Sqrt(0.5) * (int)(speed * speedMultiplier));;
                    moving      = true;
                    isColliding = false;
                }
                else
                {
                    TileCollisionHandler(new Rectangle(hitbox.X, hitbox.Y - (int)(speed * speedMultiplier), hitbox.Width, hitbox.Height));
                    if (!isColliding)
                    {
                        hitbox.Y   -= (int)(speed * speedMultiplier);
                        moving      = true;
                        isColliding = false;
                    }
                    TileCollisionHandler(new Rectangle(hitbox.X + (int)(speed * speedMultiplier), hitbox.Y, hitbox.Width, hitbox.Height));
                    if (!isColliding)
                    {
                        hitbox.X   += (int)(speed * speedMultiplier);
                        moving      = true;
                        isColliding = false;
                    }
                }
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Right) && Keyboard.GetState().IsKeyDown(Keys.Down) || Keyboard.GetState().IsKeyDown(Keys.D) && Keyboard.GetState().IsKeyDown(Keys.S))
            {
                Animate(gameTime, 0);

                TileCollisionHandler(new Rectangle(hitbox.X + (int)(speed * speedMultiplier), hitbox.Y + (int)(speed * speedMultiplier), hitbox.Width, hitbox.Height));
                if (!isColliding)
                {
                    hitbox.X   += (int)(Math.Sqrt(0.5) * (int)(speed * speedMultiplier));
                    hitbox.Y   += (int)(Math.Sqrt(0.5) * (int)(speed * speedMultiplier));
                    moving      = true;
                    isColliding = false;
                }
                else
                {
                    TileCollisionHandler(new Rectangle(hitbox.X, hitbox.Y + (int)(speed * speedMultiplier), hitbox.Width, hitbox.Height));
                    if (!isColliding)
                    {
                        hitbox.Y   += (int)(speed * speedMultiplier);
                        moving      = true;
                        isColliding = false;
                    }
                    TileCollisionHandler(new Rectangle(hitbox.X + (int)(speed * speedMultiplier), hitbox.Y, hitbox.Width, hitbox.Height));
                    if (!isColliding)
                    {
                        hitbox.X   += (int)(speed * speedMultiplier);
                        moving      = true;
                        isColliding = false;
                    }
                }
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Left) && Keyboard.GetState().IsKeyDown(Keys.Down) || Keyboard.GetState().IsKeyDown(Keys.A) && Keyboard.GetState().IsKeyDown(Keys.S))
            {
                Animate(gameTime, 0);

                TileCollisionHandler(new Rectangle(hitbox.X - speed, hitbox.Y + speed, hitbox.Width, hitbox.Height));
                if (!isColliding)
                {
                    hitbox.X   -= (int)(Math.Sqrt(0.5) * (int)(speed * speedMultiplier));
                    hitbox.Y   += (int)(Math.Sqrt(0.5) * (int)(speed * speedMultiplier));
                    moving      = true;
                    isColliding = false;
                }
                else
                {
                    TileCollisionHandler(new Rectangle(hitbox.X, hitbox.Y + (int)(speed * speedMultiplier), hitbox.Width, hitbox.Height));
                    if (!isColliding)
                    {
                        hitbox.Y   += (int)(speed * speedMultiplier);
                        moving      = true;
                        isColliding = false;
                    }
                    TileCollisionHandler(new Rectangle(hitbox.X - (int)(speed * speedMultiplier), hitbox.Y, hitbox.Width, hitbox.Height));
                    if (!isColliding)
                    {
                        hitbox.X   -= (int)(speed * speedMultiplier);
                        moving      = true;
                        isColliding = false;
                    }
                }
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Left) || Keyboard.GetState().IsKeyDown(Keys.A)) //left
            {
                Animate(gameTime, 1);

                TileCollisionHandler(new Rectangle(hitbox.X - (int)(speed * speedMultiplier), hitbox.Y, hitbox.Width, hitbox.Height));

                if (!isColliding)
                {
                    hitbox.X   -= (int)(speed * speedMultiplier);
                    moving      = true;
                    isColliding = false;
                }
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Right) || Keyboard.GetState().IsKeyDown(Keys.D)) //right
            {
                Animate(gameTime, 2);

                TileCollisionHandler(new Rectangle(hitbox.X + (int)(speed * speedMultiplier), hitbox.Y, hitbox.Width, hitbox.Height));
                if (!isColliding)
                {
                    hitbox.X   += (int)(speed * speedMultiplier);
                    moving      = true;
                    isColliding = false;
                }
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Down) || Keyboard.GetState().IsKeyDown(Keys.S)) //down
            {
                Animate(gameTime, 0);

                TileCollisionHandler(new Rectangle(hitbox.X, hitbox.Y + (int)(speed * speedMultiplier), hitbox.Width, hitbox.Height));
                if (!isColliding)
                {
                    hitbox.Y   += (int)(speed * speedMultiplier);
                    moving      = true;
                    isColliding = false;
                }
            }
            else if (Keyboard.GetState().IsKeyDown(Keys.Up) || Keyboard.GetState().IsKeyDown(Keys.W))//up
            {
                Animate(gameTime, 3);

                TileCollisionHandler(new Rectangle(hitbox.X, hitbox.Y - (int)(speed * speedMultiplier), hitbox.Width, hitbox.Height));
                if (!isColliding)
                {
                    hitbox.Y   -= (int)(speed * speedMultiplier);
                    moving      = true;
                    isColliding = false;
                }
            }
            else
            {
                //Idle here
                ResetFrame();
            }

            middlepos = new Vector2(hitbox.Center.X, hitbox.Center.Y);


            if (!isAttacking)
            {
            }
            else
            {
                if (equippedMelee != null)
                {
                    equippedMelee.Animate(gameTime, 0);

                    switch (mouseDirection)
                    {
                    case CardinalDirection.up:
                        equippedMelee.hitbox       = new Rectangle(hitbox.Center.X - equippedMelee.hitboxWidth / 2, hitbox.Top - equippedMelee.hitboxLength / 2, equippedMelee.hitboxWidth, equippedMelee.hitboxLength);
                        equippedMelee.position     = new Vector2(hitbox.Center.X - equippedMelee.hitboxWidth / 4, hitbox.Top - equippedMelee.hitboxLength / 4);
                        equippedMelee.damageHitbox = new Rectangle(hitbox.Center.X - equippedMelee.hitboxWidth / 2, hitbox.Top - equippedMelee.hitboxLength, equippedMelee.hitboxWidth, equippedMelee.hitboxLength);
                        break;

                    case CardinalDirection.down:
                        equippedMelee.hitbox       = new Rectangle(hitbox.Center.X - equippedMelee.hitboxWidth / 2, hitbox.Bottom + equippedMelee.hitboxLength / 2, equippedMelee.hitboxWidth, equippedMelee.hitboxLength);
                        equippedMelee.position     = new Vector2(hitbox.Center.X - equippedMelee.hitboxWidth / 4, hitbox.Bottom + equippedMelee.hitboxLength / 4);
                        equippedMelee.damageHitbox = new Rectangle(hitbox.Center.X - equippedMelee.hitboxWidth / 2, hitbox.Bottom, equippedMelee.hitboxWidth, equippedMelee.hitboxLength);
                        break;

                    case CardinalDirection.right:
                        equippedMelee.hitbox   = new Rectangle(hitbox.Right + equippedMelee.hitboxWidth, hitbox.Center.Y - equippedMelee.hitboxWidth / 2, equippedMelee.hitboxLength, equippedMelee.hitboxWidth);
                        equippedMelee.position = new Vector2(hitbox.Right + equippedMelee.hitboxWidth, hitbox.Center.Y);

                        equippedMelee.damageHitbox = new Rectangle(hitbox.Right, hitbox.Center.Y - equippedMelee.hitboxWidth / 2, equippedMelee.hitboxLength, equippedMelee.hitboxWidth);
                        break;

                    case CardinalDirection.left:
                        equippedMelee.hitbox       = new Rectangle(hitbox.Left - equippedMelee.hitboxWidth, hitbox.Center.Y - equippedMelee.hitboxWidth / 2, equippedMelee.hitboxLength, equippedMelee.hitboxWidth);
                        equippedMelee.position     = new Vector2(hitbox.Left - equippedMelee.hitboxWidth, hitbox.Center.Y);
                        equippedMelee.damageHitbox = new Rectangle(hitbox.Left - equippedMelee.hitboxLength, hitbox.Center.Y - equippedMelee.hitboxWidth / 2, equippedMelee.hitboxLength, equippedMelee.hitboxWidth);
                        break;
                    }
                }
                else
                {
                    equippedRange.Animate(gameTime, 0);

                    if (equippedRange != null)
                    {
                        equippedRange.Animate(gameTime, 0);

                        switch (mouseDirection)
                        {
                        case CardinalDirection.up:
                            equippedRange.hitbox   = new Rectangle(hitbox.Center.X - equippedRange.hitboxWidth / 2, hitbox.Top - equippedRange.hitboxLength, equippedRange.hitboxWidth, equippedRange.hitboxLength);
                            equippedRange.position = new Vector2(hitbox.Center.X - equippedRange.hitboxWidth / 4, hitbox.Top - equippedRange.hitboxLength / 4);

                            break;

                        case CardinalDirection.down:
                            equippedRange.hitbox   = new Rectangle(hitbox.Center.X - equippedRange.hitboxWidth / 2, hitbox.Bottom, equippedRange.hitboxWidth, equippedRange.hitboxLength);
                            equippedRange.position = new Vector2(hitbox.Center.X - equippedRange.hitboxWidth / 4, hitbox.Bottom + equippedRange.hitboxLength / 4);

                            break;

                        case CardinalDirection.right:
                            equippedRange.hitbox   = new Rectangle(hitbox.Right, hitbox.Center.Y - equippedRange.hitboxWidth / 2, equippedRange.hitboxLength, equippedRange.hitboxWidth);
                            equippedRange.position = new Vector2(hitbox.Right + equippedRange.hitboxWidth, hitbox.Center.Y);

                            break;

                        case CardinalDirection.left:
                            equippedRange.hitbox   = new Rectangle(hitbox.Left - equippedRange.hitboxLength, hitbox.Center.Y - equippedRange.hitboxWidth / 2, equippedRange.hitboxLength, equippedRange.hitboxWidth);
                            equippedRange.position = new Vector2(hitbox.Left - equippedRange.hitboxWidth, hitbox.Center.Y);
                            break;
                        }
                    }
                }

                timeTillMovable += (float)gameTime.ElapsedGameTime.TotalSeconds;
                if (timeTillMovable >= attackTime)
                {
                    isAttacking     = false;
                    timeTillMovable = 0;

                    speedMultiplier /= weaponSpeedMultiplier;

                    Level.UnhitAllEnemies();

                    if (equippedMelee != null)
                    {
                        equippedMelee.ResetFrame();
                        equippedMelee.hitbox       = new Rectangle(0, 0, 0, 0);
                        equippedMelee.damageHitbox = new Rectangle(0, 0, 0, 0);
                    }
                    else if (equippedRange != null)
                    {
                        equippedRange.hitbox = new Rectangle(0, 0, 0, 0);
                        equippedRange.ResetFrame();
                    }
                }
            }

            if (health <= 0)
            {
                Game1.SetGameOverScreen();
            }
        }