private void checkHorizontalLimit ( double extrp , double vx ) { // Inside interval if ( mover . getX ( ) >= limitLeft && mover . getX ( ) <= limitRight && limitLeft != Integer . MIN_VALUE && limitRight != Integer . MAX_VALUE ) { offset . moveLocation ( extrp , vx , 0 ) ; // Block offset on its limits if ( offset . getX ( ) < - intervalHorizontal ) { offset . teleportX ( - intervalHorizontal ) ; } else if ( offset . getX ( ) > intervalHorizontal ) { offset . teleportX ( intervalHorizontal ) ; } } // Outside interval if ( ( int ) offset . getX ( ) == - intervalHorizontal || ( int ) offset . getX ( ) == intervalHorizontal ) { mover . moveLocationX ( extrp , vx ) ; } applyHorizontalLimit ( ) ; }
Check horizontal limit on move .