0
\$\begingroup\$

Here is the screenshot Game.Here is my Play constructor in Play class.

\$\endgroup\$
1
\$\begingroup\$

Here 5 options depending on your desired effect.

  1. Set the camera position, so it is centered on a point above the player. (so that there are always enough tiles below the camera to fill the screen.)

  2. Reduce the height of the window to clip the bottom area. (this will require a combination of #1 and reducing the window height to reach the desired effect)

  3. Center the camera at a fixed height, so that the bottom row of tiles is flush with the bottom of the window.

  4. Center the camera on the player, but clamp the height component to a minimum value that shows the bottom row of tiles flush with the bottom of the screen.

  5. Expand the tileset to show tiles farther below the character.

Comment if you need more detail on how to achieve a specific option.

\$\endgroup\$
  • \$\begingroup\$ I have tried decreasing the Gdx.graphics.getHeight, in doing that the black portion at the bottom disappears but the screen becomes outstretched .I have also set the position of camera like this ,how can I set the position above the player?cam.position.set(player.getPosition().cpy().scl(PPM), 0); \$\endgroup\$ – satya Jul 23 '18 at 19:33
  • \$\begingroup\$ cam.position.set(player.getPosition().cpy().scl(PPM).x, player.getPosition().cpy().scl(PPM).y + offsetY, 0); \$\endgroup\$ – Kyy13 Jul 24 '18 at 14:34
  • \$\begingroup\$ Thanks but what is offSetY/ \$\endgroup\$ – satya Jul 24 '18 at 17:23
  • \$\begingroup\$ It's the offset of the camera from the player. Try different values until the black bar dissapears. \$\endgroup\$ – Kyy13 Jul 24 '18 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.