Buggy code:
float deltaY = ( deltaD * ( ( float ) ( Math . abs ( Math . sin ( angle ) ) ) ) ) * directionY ; x += deltaX * speedAdjust ; y += deltaY * speedAdjust ; } public boolean isMortal ( ) { } } public static class Monster extends Enemy { protected float speed = 8 ; public Color getColor ( ) { } public Monster ( float _x , float _y , float _speed ) { } public void move ( List ps , float speedAdjust ) { float dx = Float . MAX_VALUE ; float d = 0 ; Player pm = null ; Iterator i = ps . iterator ( ) ; while ( i . hasNext ( ) ) { Player p = ( ( Player ) ( i . next ( ) ) ) ; d = distanceFrom ( p . getX ( ) , p . getY ( ) ) ; if ( d < dx ) { dx = d ; pm = p ; } } int directionX = 1 ; int directionY = 1 ; float p1 = ( ( pm . getY ( ) ) - 5 ) - ( y ) ; float p2 = ( ( pm . getX ( ) ) - 5 ) - ( x ) ; if ( p1 < 0 ) { directionY = - 1 ; } if ( p2 < 0 ) { directionX = - 1 ; } float angle = ( ( float ) ( Math . atan ( ( p1 // p2 ) ) ) ) ; float deltaX = ( ( speed ) * ( ( float ) ( Math . abs ( Math . cos ( angle ) ) ) ) ) * directionX ; float deltaY = ( ( speed ) * ( ( float ) ( Math . abs ( Math . sin ( angle ) ) ) ) ) * directionY ; x += deltaX * speedAdjust ; y += deltaY * speedAdjust ; } } public static class Random extends Enemy { private float vx ; private float vy ; private int [ ] borders ; private int bounces = 0 ; public Color getColor ( ) { } public Random ( float _x , float _y , float _speed , int [ ] _borders ) { } public Random ( int _x , int _y ) { } public void move ( List ps , float speedAdjust ) { if ( ( x ) > ( borders [ 2 ] ) ) { vx = ( Math . abs ( vx ) ) * ( - 1 ) ; ( bounces ) ++ ; } if ( ( x ) < ( borders [ 0 ] ) ) { vx = Math . abs ( vx ) ; ( bounces ) ++ ; } if ( ( y ) > ( borders [ 3 ] ) ) { vy = ( Math . abs ( vy ) ) * ( - 1 ) ; ( bounces ) ++ ; } if ( ( y ) < ( borders [ 1 ] ) ) { vy = Math . abs ( vy ) ; ( bounces ) ++ ; } x += ( vx ) * speedAdjust ; y += ( vy ) * speedAdjust ; } public int getBounces ( ) { } } public static class Rain extends Enemy { private float vx ; private float vy ; private int floor ; public Color getColor ( ) { } public Rain ( float _x , float _y , float _speed , int _floor ) { } public Rain ( int _x , int _y , int _floor ) { } public void move ( List ps , float speedAdjust ) { x += ( ( vx ) * speedAdjust ) * 0.2 ; y += ( ( vy ) * speedAdjust ) * 0.2 ; if ( ( y ) > ( floor ) ) { x = ( x ) + ( y ) ; y = 0 ; } } } public static class Bomb extends EnemyTypes . Monster { private SetCallback mod ; private int [ ] borders ; private static final int PIECES = 50 ; private boolean existant = true ; public Color getColor ( ) { } public Bomb ( float _x , float _y , float _speed , int [ ] _borders , SetCallback _mod ) { } public void move ( List ps , float speedAdjust ) { if ( existant ) { super . move ( ps , speedAdjust ) ; <START_BUG> float dx = 0 ; <END_BUG> float d = 0 ; Player pm = null ; Iterator i = ps . iterator ( ) ; while ( i . hasNext ( ) ) { Player p = ( ( Player ) ( i . next ( ) ) ) ; d = distanceFrom ( p . getX ( ) , p . getY ( ) ) ; if ( d < dx ) { dx = d ; pm = p ; } } if ( dx < 8000 ) { for ( int j = 0 ; j < ( EnemyTypes . Bomb . PIECES ) ; j ++ ) { mod . add ( new EnemyTypes . Shrapnel ( x , y , speed , borders ) ) ; } existant = false ; } } } public boolean isMortal ( ) { } public void paint ( Graphics g ) { } public boolean collidesWith ( int mx , int my ) { } } public static class Shrapnel extends EnemyTypes . Random { public Shrapnel ( float _x , float _y , float _speed , int [ ] _borders ) { } public Color getColor ( ) { } } No newline ; at end ; of file ; }

Fix:
float dx = Float . MAX_VALUE ;