void drawBall(){
  Ball ball=mBall;
  float savedX=ball.getXPosition();
  float savedY=ball.getYPosition();
  float radius=ball.getRadius();
  float xpos=BORDER_WIDTH * 2 + radius;
  float ypos=BORDER_WIDTH + radius;
  int lives=mLivesRemaining;
  boolean ballIsLive=(mGamePlayState != GAME_INITIALIZING && mGamePlayState != GAME_READY);
  if (ballIsLive) {
    lives--;
  }
  for (int i=0; i < lives; i++) {
    float jitterX=0.0f;
    float jitterY=0.0f;
    if (mLiveBrickCount > 0 && mLiveBrickCount < 4) {
      jitterX=(float)((4 - mLiveBrickCount) * (Math.random() - 0.5) * 2);
      jitterY=(float)((4 - mLiveBrickCount) * (Math.random() - 0.5) * 2);
    }
    ball.setPosition(xpos + jitterX,ypos + jitterY);
    ball.draw();
    xpos+=radius * 3;
  }
  ball.setPosition(savedX,savedY);
  if (ballIsLive) {
    ball.draw();
  }
}

void drawBall ( ) { Ball ball = mBall ; float savedX = ball . getXPosition ( ) ; float savedY = ball . getYPosition ( ) ; float radius = ball . getRadius ( ) ; float xpos = BORDER_WIDTH * 2 + radius ; float ypos = BORDER_WIDTH + radius ; int lives = mLivesRemaining ; boolean ballIsLive = ( mGamePlayState != GAME_INITIALIZING && mGamePlayState != GAME_READY ) ; if ( ballIsLive ) { lives -- ; } for ( int i = 0 ; i < lives ; i ++ ) { float jitterX = 0.0f ; float jitterY = 0.0f ; if ( mLiveBrickCount > 0 && mLiveBrickCount < 4 ) { jitterX = ( float ) ( ( 4 - mLiveBrickCount ) * ( Math . random ( ) - 0.5 ) * 2 ) ; jitterY = ( float ) ( ( 4 - mLiveBrickCount ) * ( Math . random ( ) - 0.5 ) * 2 ) ; } ball . setPosition ( xpos + jitterX , ypos + jitterY ) ; ball . draw ( ) ; xpos += radius * 3 ; } ball . setPosition ( savedX , savedY ) ; if ( ballIsLive ) { ball . draw ( ) ; } }
draws the " live " ball and the remaining - lives display .
