Finding and moving the next obstacle in a player's path This code finds the next obstacle in the player's path, then moves it. I am trying to make it more efficient, because this code runs for each frame, and it lags a bit. It does work though.

There are 8 blockers, which are basically obstacles. We subtract from the players rotation until the rotation is equal to one of these eight blockers. Then we move the blocker.  Each blocker cannot be moved two times in a row, though.

You might be wondering why rotation determines if the player collides. That is because my game is based around a planet, to where the player rotates.  

whileLoop:
    while (true) {

        for (Blocker blocker : blockers) {
            if (playerRotation == (int) blocker.getRotation()) {
                if(lastBlockerMoved != blocker) {
                    lastBlockerMoved = blocker;
                    float gap = Tools.generateFloat(Config.minBlockerGap, Config.maxBlockerGap);
                    float y = Tools.generateFloat(Config.minBlockerY, Config.maxBlockerY - gap);
                    float duration = Tools.generateFloat(Config.minBlockerYDuration, Config.maxBlockerYDuration);
                    blocker.addAction(Actions.moveTo(blocker.getX(), y, duration, Config.blockerInterpolation));
                    blocker.addAction(GapSizeAction.getGapSizeAction(gap, duration));
                }

                break whileLoop;
            }
        }

        playerRotation--; //-- is going right, ++ would be going left
        while (playerRotation &gt; 360) {
            playerRotation -= 360;
        }
        while (playerRotation &lt;= 0) {
            playerRotation += 360;
        }
    }
Take out the variables that are not changing within the loops and initialise them once.

float gap = Tools.generateFloat(Config.minBlockerGap, Config.maxBlockerGap);
float y = Tools.generateFloat(Config.minBlockerY, Config.maxBlockerY - gap);
float duration = Tools.generateFloat(Config.minBlockerYDuration, Config.maxBlockerYDuration); 


It is unnecessary to continue to break out of the for loop to change the playerRotation. so then add within your for loop the playerRotation decrement with two if conditions (the while is unnecessary, it can only change by 1, so cannot exceed greater than 360 or less than 0.

while (true) {

    for (Blocker blocker : blockers) {
        if (playerRotation == (int) blocker.getRotation()) {            
            if(lastBlockerMoved != blocker) {
                lastBlockerMoved = blocker;
                blocker.addAction(Actions.moveTo(blocker.getX(), y, duration, Config.blockerInterpolation));
                blocker.addAction(GapSizeAction.getGapSizeAction(gap, duration));

                playerRotation--; //-- is going right, ++ would be going left
                if (playerRotation &gt; 360) 
                    playerRotation -= 360;

                if (playerRotation &lt;= 0) 
                    playerRotation += 360;

            }
        }
    }
    // If game over -&gt; break;
}


I am not sure of what condition you need to end this game, but you will need to add this within your while loop to break out.