private void goalieBehaviour(){
        final int REACTION_DISTANCE = 20;
        final int HOME_DISTANCE = 5;

        //the first state has the goalie wait in goal but constantly look for the ball
        if(playerState == 0){
            turnTowardBall();
            //the goalie state changes when the ball moves to a certain distance from the goalie
            if(canSeeBall && distanceBall < REACTION_DISTANCE) playerState = 1;
        }
        //in this state the goalie is actively running towards the ball attempting to intercept it and
        //kick it away if possible
        if(playerState == 1){
            canSeeBallAction();
            //the goalie state changes when the ball leaves a certain range
            if(distanceOwnGoal >= REACTION_DISTANCE) playerState = 2;
        }
        //in this state the goalie moves back to the goal
        if(playerState == 2){
            //the goalie needs to be able to see his/her own goal to move back to it
            if(!canSeeOwnGoal){
                turnTowardOwnGoal();
            }else{
                //the goalie moves back towards the goal
                canSeeOwnGoalAction();
                //the goalie state changes back to the first state of looking for the ball and
                //watching it when it returns to the goal
                if(distanceOwnGoal < HOME_DISTANCE) playerState = 0;
            }
        }
    }