I have a sprite that the OrthographicCamera
follows. I have a border, that comes into the screens view when the sprite comes close to it, obviously using the OrthographicCamera
.
My code for this is:
float minCameraX = camera.zoom * (camera.viewportWidth / 2)-55;
float maxCameraX = stageWidthHeight.x - minCameraX-80;
float minCameraY = camera.zoom * (camera.viewportHeight / 2)-200;
float maxCameraY = stageWidthHeight.y - minCameraY-250;
// set the camera to either the player or the min/max of the camera based on player position
camera.position.set(
Math.min(maxCameraX, Math.max(playerSprite.getX(), minCameraX)),
Math.min(maxCameraY, Math.max(playerSprite.getY(), minCameraY)),
0);
spriteBatch.setProjectionMatrix(camera.combined);
camera.update();
I also have another texture/sprite (scoreboard) that I want to always have at the bottom of the user's view, and on top of everything.
How would I go about doing this?
Here are some images for what I want to achieve.
I found out the solution xD
I just rendered my "scoreboard" in a different SpriteBatch
The suggestions on the right gave me an idea of what to search for.
I LOVE YOU STACKOVERFLOW!!
Sorry, I should have searched more.