java - Draw background image in libgdx without moving the sprite along with the camera -
java - Draw background image in libgdx without moving the sprite along with the camera -
i have background image wish remain in same position on screen. so, advance spaceship , move photographic camera spaceship same background image remain on screen. there way draw backgroung image on screen without having move along photographic camera ? illustration using special layer or no aditional matrix translations needed move bg image?
there camera.unproject(vector2 vector)
function in libgdx photographic camera class. set background image @ location on screen need unproject every time drawing , draw onto sprite batch unprojected co-ordinates. e.g:
vector2 position = new vector2(10,10); //can anything, x , y of background should camera.unproject(position); //unproject co-ordinates position of camera, stored in position vector batch.draw(background, position.x, position.y); //you can draw sprite batch unprojected co-ordinates
java libgdx game-engine
Comments
Post a Comment