public Bar(Border[] borders,SpriteBatch spriteBatch,Texture2D barTexture, int barXPos, int barYPos,  Keys[] controls, String barType)
        {
            this.borders = borders;

            this.barTexture = barTexture;
            this.spriteBatch = spriteBatch;

            barSpeed = 400;
            barSpeedMultiplier = 0;

            this.barType = barType;

            this.controls = controls;

            this.barXPos = barXPos;
            this.barYPos = barYPos;
            barLength = 128;
            bar = new Rectangle(barXPos,barYPos, barLength, barWidth);
        }
        protected override void Initialize()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            bleepHigh = Content.Load<SoundEffect>("bleep-high");
            bleepLow = Content.Load<SoundEffect>("bleep-low");
            //Ball texture
            spriteTexture = Content.Load<Texture2D>("ball1.png");
            //Border textures
            borderTexture = Content.Load<Texture2D>("bar.png");
            //Player Textures
            barTexture = Content.Load<Texture2D>("ball1.png");
            //Font texture
            font = Content.Load<SpriteFont>("font");

            test = new Rectangle(400, 400, 64, 64);
            base.Window.AllowUserResizing = false;

            //initialize bar controls
            topBarKeys[0] = Keys.T; //LEFT
            topBarKeys[1] = Keys.U; //RIGHT
            topBarKeys[2] = Keys.Y; //BOOST

            bottomBarKeys[0] = Keys.V; //LEFT
            bottomBarKeys[1] = Keys.N; //RIGHT
            bottomBarKeys[2] = Keys.B; //BOOST

            leftBarKeys[0] = Keys.A; //UP
            leftBarKeys[1] = Keys.D; //DOWN
            leftBarKeys[2] = Keys.S; //BOOST

            rightBarKeys[0] = Keys.L; //UP
            rightBarKeys[1] = Keys.J; //DOWN
            rightBarKeys[2] = Keys.K; //BOOST

            controls[0, 0] = topBarKeys[0];
            controls[0, 1] = topBarKeys[1];
            controls[0, 2] = topBarKeys[2];

            controls[1, 0] = bottomBarKeys[0];
            controls[1, 1] = bottomBarKeys[1];
            controls[1, 2] = bottomBarKeys[2];

            controls[2, 0] = leftBarKeys[0];
            controls[2, 1] = leftBarKeys[1];
            controls[2, 2] = leftBarKeys[2];

            controls[3, 0] = rightBarKeys[0];
            controls[3, 1] = rightBarKeys[1];
            controls[3, 2] = rightBarKeys[2];

            //initialize ball
            balls = new List<Ball>();
            balls.Insert(0, new Ball(fieldSize, ballSize, ballSpeed, ballSpeedLimit, ballSpeedInc, bounceCorrection, false, spriteBatch, spriteTexture));
            firstCycle = true;

            //initialize bars
            //barKeys = new Keys[][]{  topBarKeys, bottomBarKeys, leftBarKeys, rightBarKeys }; //put all the inputs in 1 array

            int barStartPos = (fieldSize - barLength) / 2;

            //initialize player lives
            playerLives = new int[4] {lives,lives,lives,lives};

            //powerup
            powerup = new Powerup[3];
            powerupCount = 0;
            for(int i=0;i<powerup.Length;i++)
            powerup[i] = new Powerup(spriteBatch, spriteTexture, GraphicsDevice,i);

            //Inititialize borders
            borders = new Border[4];
            borders[0] = new Border(spriteBatch, borderTexture, 0, 0, "Lying");//Top border
            borders[1] = new Border(spriteBatch, borderTexture, 0, (fieldSize - borderWidth), "Lying");//Bottom border
            borders[2] = new Border(spriteBatch, borderTexture, 0, 0, "Standing");//Left border
            borders[3] = new Border(spriteBatch, borderTexture, (fieldSize - borderWidth), 0, "Standing");//Right border

            //initialize players
            playerBars = new Bar[4];
            playerBars[0] = new Bar(borders, spriteBatch, barTexture, barStartPos, barToBorderDist, topBarKeys, "Lying");//Topp bar
            playerBars[1] = new Bar(borders, spriteBatch, barTexture, barStartPos, fieldSize - barToBorderDist - barWidth, bottomBarKeys, "Lying");//Bottom bar
            playerBars[2] = new Bar(borders, spriteBatch, barTexture, barToBorderDist, barStartPos, leftBarKeys ,"Standing");//Left bar
            playerBars[3] = new Bar(borders, spriteBatch, barTexture, fieldSize - barToBorderDist - barWidth, barStartPos, rightBarKeys ,"Standing");//Right bar

            input = new KeyboardController(controls);
            gameTime = 0;
            setPlayersAmount();

            base.Initialize();
        }
        /*
         * Updates the ball position and makes the ball bounce on a collision. Returns an int to indicate that a player loses a live. default = -1, top = 0 bottom = 1
         */
        public int updateBall(GameTime gameTime, Bar[] bars, Border[] borders, int[] lives)
        {
            if (!active)
                return -1;

            if (spawning)
            {
                if (!timer.getTimeDone(gameTime, 2))
                {
                    return -1;
                }
                spawning = false;

            }

            //barcollision
            for (int i = 0; i < 4; i++)
            {
                if (ball.Intersects(bars[i].bar))
                {
                    barBounce(i, bars[i].bar);
                    while (ball.Intersects(bars[i].bar))
                        moveBall(gameTime);
                    return -1;
                }
            }

            // check if ball touches the border if does that player loses a life and ball is reset

            for (int i = 0; i < 4; i++)
            {
                if (ball.Intersects(borders[i].border))
                {
                    if (lives[i].Equals(0))
                    {
                        simpleBounce(i);
                        while (ball.Intersects(borders[i].border))
                            moveBall(gameTime);
                        return -1;
                    }
                    else
                    {
                        return i;
                    }
                }
            }
            //the ball isnt in collision
            moveBall(gameTime);
            return -1;
        }