I think you need to break your Texture
in two separately renderable parts. Use a TextureRegion
to reference part of a Texture
. Then pass the right TextureRegion
to draw
. In your setup you do something like this:
monkeyImage = new Texture(...)
monkeyL = new TextureRegion(monkeyImage, 0, 0, 128, 256);
monkeyR = new TextureRegion(monkeyImage, 128, 0, 128, 256);
And in your render
method:
TextureRegion t = someTest ? monkeyL : monkeyR;
batch.draw(t, bucket.x, bucket.y);
If you are going to have lots of images for one character, you should look at the Libgdx Animation
which is designed to keep track of multiple "key frames" that represent the images used in a timed animation.