I set the background image like this -
batch.draw(Assets.back_sprite, 0, 0, ResX, ResY);
The problem is when i move the camera -
camera.translate(2,0);
The image starting to move backwards and eventually disappears, because I drew it at (0,0)
and the camera is moving in a speed of (2,0), that's why the the image goes away.
How can i make the image to be static and always stay there? Any ideas?
Thanks in advance :P
Render it with another camera
OrthographicCamera mStageCamera;
OrthographicCamera mFixedCamera;
SpriteBatch mBatch;
@Override
public void render() {
mBatch.setProjectionMatrix(mFixedCamera.combined);
mBatch.begin();
//render "static" elements
mBatch.end();
mBatch.setProjectionMatrix(mStageCamera.combined);
mBatch.begin();
//render "movable" elements
mBatch.end();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With