public void player1move(){
            if (upPressed)
            {
                if(!player1.offscreentop) 
                {   
                    player1.setY(player1.getY() - player1Speed);
                }             
            } else if (downPressed)
                    {
                        if(!player1.offscreenbottom) 
                        {
                            player1.setY(player1.getY() + player1Speed);
                        }
                    }
            if (leftPressed){   
                     if(!player1.offscreenleft) {
                    player1.setX(player1.getX() - player1Speed);
                     }
            }
            if (rightPressed){
                if(!player1.offscreenright) {
                    if (player1.getX() < barrier.getX() - 16){
                        player1.setX(player1.getX() + player1Speed);
                    }
               }
            }
            
           }