public static Boolean Intersects(Line2D l1, Line2D l2)
 {
     return Intersects(l1.StartPosition.X, l1.StartPosition.Y, l1.EndPosition.X, l1.EndPosition.Y, l2.StartPosition.X, l2.StartPosition.Y, l2.EndPosition.X, l2.EndPosition.Y);
 }
        public Player(int newPlayerNum)
        {
            //just initialziing the shiled here because;
            sheild_currentsprite = 0;
            sheild_totalsprite = 3;
            sheildSprite = GameState.content.Load<Texture2D>(@"Textures\Player\sheildBubble");

            //Base initialization
            line = new Line2D(new Vector2(150, 80), new Vector2(150, 180), Color.White);
            playerNum = newPlayerNum;
            myRect.Width = (int)posOffSet.X * 2;
            myRect.Height = (int)posOffSet.Y * 2;
            foundPickup = new Pickup(0, 'e', new Vector2(0, 0));
            energyBarBGPosition = new Rectangle[10];
            energyBarPosition = new Rectangle[10];

            //Speed and movement initialization
            speed = 1;
            baseAccel = 0.15f;
            maxSpeed = 2.0f;
            velocity = new Vector2(0, 0);
            speedChanged = false;

            onVictoryTile = false;

            //Invincibility initializations
            invTime = 0;
            isInvincible = false;
            blinkTimer = 0;
            isBlinking = false;
            blinkTimeLength = 20;

            //Sprites counts
            currentSprite = 0;
            totalSprites = 27;
            spritecolumn = 0;

            //Energy initializations
            baseMaxEnergy = 100;
            maxEnergy = 100;
            currentEnergy = maxEnergy;
            energyDrainSpeed = 16;
            energyRechargeSpeed = 0.5f;

            //Speed Zones
            speedModifier = 0;

            //Distance declarations
            minDistance = 65;
            strongDistance = 130;
            mediumDistance = 200;
            maxDistance = 320;

            data_deathsPerLevel = new int[16];
            for (int i = 0; i < 16; i++)
            {
                data_deathsPerLevel[i] = 0;
            }

            //Player Specific positions and textures.
            if (newPlayerNum == 0)
            {
                myPos = line.StartPosition;
                droneTexture = GameState.content.Load<Texture2D>(@"Textures\Player\spider_blue_trimmed_shrinked");
                energyTexture = GameState.content.Load<Texture2D>(@"Textures\Player\energyBar_sprite_small");
                energyBGTexture = GameState.content.Load<Texture2D>(@"Textures\Player\battery");
                energyBarPosition[0] = new Rectangle(44, GameState.SCREEN_HEIGHT - 120, 12, 80);
                energyBarBGPosition[0] = new Rectangle(40, GameState.SCREEN_HEIGHT - 130, 20, 100);
                for (int i = 0; i < 10; i++)
                {
                    energyBarPosition[i] = energyBarPosition[0];
                    energyBarBGPosition[i] = energyBarBGPosition[0];
                    energyBarPosition[i].X += 26 * i;
                    energyBarBGPosition[i].X += 26 * i;
                }
            }
            else
            {
                myPos = line.EndPosition;
                droneTexture = GameState.content.Load<Texture2D>(@"Textures\Player\spider_orange_trimmed_shrinked");
                energyTexture = GameState.content.Load<Texture2D>(@"Textures\Player\energybar_sprite_small2");
                energyBGTexture = GameState.content.Load<Texture2D>(@"Textures\Player\battery2");
                energyBarPosition[0] = new Rectangle(GameState.SCREEN_WIDTH - 52, GameState.SCREEN_HEIGHT - 120, 12, 80);
                energyBarBGPosition[0] = new Rectangle(GameState.SCREEN_WIDTH - 56, GameState.SCREEN_HEIGHT - 130, 20, 100);
                for (int i = 0; i < 10; i++)
                {
                    energyBarPosition[i] = energyBarPosition[0];
                    energyBarBGPosition[i] = energyBarBGPosition[0];
                    energyBarPosition[i].X -= 26 * i;
                    energyBarBGPosition[i].X -= 26 * i;
                }
            }

            Set_Rectangle();

            //Fun statistics initializations
            data_distanceTraveled = 0.0f;
            data_timeSpentInFront = 0.0f;
            data_timeSpentIdle = 0.0f;
            data_timeWalkingIntoWalls = 0.0f;
            data_energyDrained = 0.0f;
            data_pickupsGrabbed = 0;
            data_crushDeaths = 0;
            data_batteryDeaths = 0;
            data_damageDeaths = 0;

            //These are the level up bonuses
            playerCash = 0;
            cashForPartner = 0;
            playerCashPickedUp = 0;
            maxEnergyBonus = 0;
            maxEnergyLevel = 0;
            energyDrainBonus = 0;
            energyDrainLevel = 0;
            energyRechargeBonus = 0;
            energyRechargeLevel = 0;
            damageLevel = 0;
            accelBonus = 0;
            accelLevel = 0;
            speedBonus = 0;
            speedLevel = 0;
            invTimeLevel = 0;
            invTimeBonus = 0;
            healthPickupLevel = 0;
            healthPickupBonus = 0;
        }