public void addTextBox(Sprite sprite,double x,double y,int textLength){
  int sx=convertWorldXToScaledScreen(x);
  int sy=convertWorldYToScaledScreen(y);
  sy-=sprite.getHeight();
  sx=keepSpriteOnMapX(sprite,sx);
  sy=keepSpriteOnMapY(sprite,sy);
  boolean found=true;
  int tries=0;
  while (found) {
    found=false;
synchronized (texts) {
      for (      final RemovableSprite item : texts) {
        if ((item.getX() == sx) && (item.getY() == sy)) {
          found=true;
          sy+=SIZE_UNIT_PIXELS / 2;
          sy=keepSpriteOnMapY(sprite,sy);
          break;
        }
      }
    }
    tries++;
    if (tries > 20) {
      break;
    }
  }
  texts.add(new RemovableSprite(sprite,sx,sy,Math.max(RemovableSprite.STANDARD_PERSISTENCE_TIME,textLength * RemovableSprite.STANDARD_PERSISTENCE_TIME / 50)));
}

public void addTextBox ( Sprite sprite , double x , double y , int textLength ) { int sx = convertWorldXToScaledScreen ( x ) ; int sy = convertWorldYToScaledScreen ( y ) ; sy -= sprite . getHeight ( ) ; sx = keepSpriteOnMapX ( sprite , sx ) ; sy = keepSpriteOnMapY ( sprite , sy ) ; boolean found = true ; int tries = 0 ; while ( found ) { found = false ; synchronized ( texts ) { for ( final RemovableSprite item : texts ) { if ( ( item . getX ( ) == sx ) && ( item . getY ( ) == sy ) ) { found = true ; sy += SIZE_UNIT_PIXELS / 2 ; sy = keepSpriteOnMapY ( sprite , sy ) ; break ; } } } tries ++ ; if ( tries > 20 ) { break ; } } texts . add ( new RemovableSprite ( sprite , sx , sy , Math . max ( RemovableSprite . STANDARD_PERSISTENCE_TIME , textLength * RemovableSprite . STANDARD_PERSISTENCE_TIME / 50 ) ) ) ; }
adds a text bubble at a give position .
