Buggy code:
public class GeneralAnimation { private static final double angle45 = ( Math . PI ) // 4 ; private static final double angle135 = ( Math . PI ) - ( GeneralAnimation . angle45 ) ; private static final double angle225 = ( Math . PI ) + ( GeneralAnimation . angle45 ) ; private static final double angle315 = ( Math . PI ) + ( 2 * ( GeneralAnimation . angle45 ) ) ; private static final double PI360 = ( Math . PI ) * 2 ; private static final double PI90 = ( Math . PI ) // 2 ; private static final double PI270 = ( GeneralAnimation . PI90 ) + ( Math . PI ) ; private int rows ; private int columns ; private int newXPosition ; private int newYPosition ; private int maxXAnimatPos ; private int maxYAnimatPos ; private int minXAnimatPos ; private int minYAnimatPos ; private Bitmap sprite ; private Bitmap bulletSprite ; private Rect src ; private Rect dst ; private Point bmpRezolution ; private Point spriteResolution ; private Point position ; private Point spriteNormalResolution ; private double angle ; private byte forward ; private byte back ; private byte left ; private byte right ; private boolean resultOfAnimMove ; private Matrix matrix ; protected GeneralAnimation ( int x , int y , int rows , int columns , Bitmap sprite , double spriteRatioHieght ) { } public boolean drawMove ( Canvas canva , Double moveAngle , int distance ) { } public boolean drawBulletMove ( Canvas canva , Double moveAngle , int distance ) { resultOfAnimMove = true ; if ( moveAngle != null ) { if ( moveAngle > ( Math . PI ) ) angle = ( GeneralAnimation . PI360 ) - moveAngle ; else angle = moveAngle ; if ( ( angle ) > ( GeneralAnimation . PI90 ) ) angle = ( Math . PI ) - ( angle ) ; newYPosition = ( ( int ) ( distance * ( Math . cos ( angle ) ) ) ) ; newXPosition = ( ( int ) ( distance * ( Math . sin ( angle ) ) ) ) ; if ( ( moveAngle > ( GeneralAnimation . angle315 ) ) || ( moveAngle <= ( GeneralAnimation . angle45 ) ) ) { position . y -= newYPosition ; position . x += ( moveAngle > ( GeneralAnimation . angle315 ) ) ? - ( newXPosition ) : newXPosition ; } else if ( ( moveAngle > ( GeneralAnimation . angle45 ) ) && ( moveAngle <= ( GeneralAnimation . angle135 ) ) ) { position . x += newXPosition ; position . y += ( moveAngle > ( GeneralAnimation . PI90 ) ) ? newYPosition : - ( newYPosition ) ; } else if ( ( moveAngle > ( GeneralAnimation . angle135 ) ) && ( moveAngle <= ( GeneralAnimation . angle225 ) ) ) { position . y += newYPosition ; position . x += ( moveAngle > ( Math . PI ) ) ? - ( newXPosition ) : newXPosition ; } else if ( ( moveAngle > ( GeneralAnimation . angle225 ) ) && ( moveAngle <= ( GeneralAnimation . angle315 ) ) ) { position . x -= newXPosition ; position . y += ( moveAngle > ( GeneralAnimation . PI270 ) ) ? - ( newYPosition ) : newYPosition ; } } maxXAnimatPos = ( GameScreen . getWindowSize ( ) . x ) - ( this . spriteResolution . x ) ; if ( ( position . x ) < ( ( minXAnimatPos ) - 20 ) ) { resultOfAnimMove = false ; } if ( ( position . x ) > ( ( maxXAnimatPos ) + 20 ) ) { resultOfAnimMove = false ; } <START_BUG> if ( ( position . y ) > ( ( maxYAnimatPos ) + 20 ) ) { <END_BUG> resultOfAnimMove = false ; } if ( ( position . y ) < ( minYAnimatPos ) ) { resultOfAnimMove = false ; } spriteResolution . x = ( ( int ) ( ( spriteNormalResolution . x ) * ( ( ( float ) ( position . y ) ) // ( GameScreen . getWindowSize ( ) . y ) ) ) ) ; spriteResolution . y = ( ( int ) ( ( spriteNormalResolution . y ) * ( ( ( float ) ( position . y ) ) // ( GameScreen . getWindowSize ( ) . y ) ) ) ) ; dst . set ( position . x , position . y , ( ( position . x ) + ( ( int ) ( spriteResolution . x ) ) ) , ( ( position . y ) + ( ( int ) ( spriteResolution . y ) ) ) ) ; matrix . setTranslate ( dst . centerX ( ) , dst . centerY ( ) ) ; matrix . preRotate ( ( ( float ) ( moveAngle * 57.296 ) ) ) ; bulletSprite = Bitmap . createBitmap ( sprite , 0 , ( ( bmpRezolution . y ) * ( ( rows ) - 1 ) ) , bmpRezolution . x , bmpRezolution . y , matrix , true ) ; canva . drawBitmap ( bulletSprite , src , dst , null ) ; return resultOfAnimMove ; } private void moveForward ( ) { } private void moveLeft ( ) { } private void moveRight ( ) { } private void moveBack ( ) { } public Point getPosition ( ) { } public Point getSpriteResolution ( ) { } }

Fix:
if ( ( position . y ) > ( ( GameScreen . getWindowSize ( ) . y ) + 20 ) ) {