0

Im trying to show the image as if it is moving.so I need to show them seamlessly. But as you can see in the image,theres some space.How can I fix it?

 public class Ground {

    private final Paint paint = new Paint();

    private Bitmap bitmap;
    private Bitmap bitmap1;
    private Bitmap bitmap2;
    final RectF rect;

    public Ground(Bitmap bitmap, int left, int top) {
        this.rect = new RectF(left, top, left + bitmap.getWidth(), top +                                                        bitmap.getHeight());              
    this.bitmap = bitmap;
    this.bitmap1 = bitmap;
    this.bitmap2 = bitmap;
    }

    public void draw(Canvas canvas) {
    canvas.drawBitmap(bitmap, rect.left, rect.top, paint);
    canvas.drawBitmap(bitmap1, rect.left+bitmap.getWidth(),rect.top,paint);

    }

    public void move() {

    rect.offset(-10,0);

    if(rect.left < -bitmap.getWidth()){
    rect.offsetTo(0,0);
        }
    }
}

Here is the Image

Kiran Benny Joseph
  • 6,755
  • 4
  • 38
  • 57
RegJo
  • 1
  • 1

0 Answers0