0

I want to move the object from left to right. So i have used objectAnimator with translateX property. But the think is i want to display the left hiding portion in the right side. I will try to explain the below image.

enter image description here

enter image description here

Hope i have explained clearly. Thanks in advance.

Community
  • 1
  • 1
Suresh
  • 701
  • 1
  • 6
  • 20

1 Answers1

0

As far as I know there are ways to slice the bitmap and then positionate it accordingly (but I don't think that's a good practice here as it might impact your game experience). See cut the portion of bitmap

The easiest solution could be to generate 2 bitmaps of the same picture and align them after another.

So, after the first mountain is that far on the left side, that the white space might would occur -> the second mountain would show up. After the second mountain is that far on the left side the first mountain get's resetted to the right side again. By doing that you should have an infinite loop for your mountain.

I could imagine that it is not the best solution as you might need to store 2 bitmaps in your RAM, but it's probably better than slicing the bitmap and then spawning it accordingly on the other side.

I hope this helps :)

wsdt
  • 95
  • 1
  • 8
  • Thanks for the immediate answer. I have already using the second approach what you gave. But in that also felt it's not looking natural movement. Any way i think like you told as of now no way to do that. Let me know if you found any update – Suresh Oct 01 '18 at 16:57
  • A possible workaround could be to create separate mountains (in the meantime). I will comment if I have another solution for u :) – wsdt Oct 01 '18 at 17:18