public void load(Resources res){
  getMetrics(res);
  this.drawable=res.getDrawable(resId);
  this.width=drawable.getIntrinsicWidth();
  this.height=drawable.getIntrinsicHeight();
  float cx, cy, sx, sy;
  if (firstLoad) {
    cx=SCREEN_MARGIN + (float)(Math.random() * (displayWidth - 2 * SCREEN_MARGIN));
    cy=SCREEN_MARGIN + (float)(Math.random() * (displayHeight - 2 * SCREEN_MARGIN));
    float sc=(float)(Math.max(displayWidth,displayHeight) / (float)Math.max(width,height) * Math.random() * 0.3 + 0.2);
    sx=sy=sc;
    firstLoad=false;
  }
 else {
    cx=this.centerX;
    cy=this.centerY;
    sx=this.scaleX;
    sy=this.scaleY;
    if (this.maxX < SCREEN_MARGIN)     cx=SCREEN_MARGIN;
 else     if (this.minX > displayWidth - SCREEN_MARGIN)     cx=displayWidth - SCREEN_MARGIN;
    if (this.maxY > SCREEN_MARGIN)     cy=SCREEN_MARGIN;
 else     if (this.minY > displayHeight - SCREEN_MARGIN)     cy=displayHeight - SCREEN_MARGIN;
  }
  setPos(cx,cy,sx,sy,0.0f);
}

public void load ( Resources res ) { getMetrics ( res ) ; this . drawable = res . getDrawable ( resId ) ; this . width = drawable . getIntrinsicWidth ( ) ; this . height = drawable . getIntrinsicHeight ( ) ; float cx , cy , sx , sy ; if ( firstLoad ) { cx = SCREEN_MARGIN + ( float ) ( Math . random ( ) * ( displayWidth - 2 * SCREEN_MARGIN ) ) ; cy = SCREEN_MARGIN + ( float ) ( Math . random ( ) * ( displayHeight - 2 * SCREEN_MARGIN ) ) ; float sc = ( float ) ( Math . max ( displayWidth , displayHeight ) / ( float ) Math . max ( width , height ) * Math . random ( ) * 0.3 + 0.2 ) ; sx = sy = sc ; firstLoad = false ; } else { cx = this . centerX ; cy = this . centerY ; sx = this . scaleX ; sy = this . scaleY ; if ( this . maxX < SCREEN_MARGIN ) cx = SCREEN_MARGIN ; else if ( this . minX > displayWidth - SCREEN_MARGIN ) cx = displayWidth - SCREEN_MARGIN ; if ( this . maxY > SCREEN_MARGIN ) cy = SCREEN_MARGIN ; else if ( this . minY > displayHeight - SCREEN_MARGIN ) cy = displayHeight - SCREEN_MARGIN ; } setPos ( cx , cy , sx , sy , 0.0f ) ; }
called by activity ' s onresume ( ) method to load the images
