Home Game Development libgdx – Objects on TiledMap present totally different proportions/spacing on Android gadget

libgdx – Objects on TiledMap present totally different proportions/spacing on Android gadget

0
libgdx – Objects on TiledMap present totally different proportions/spacing on Android gadget

[ad_1]

I’m a noob in relation to programming Java apps, so I’m making an attempt to make a quite simple platformer sport.

All is operating very effectively on the desktop venture, however once I put the sport on my Xperia, a wierd factor occurs:

Screenshots of game in different aspect ratios

I’ve an elevated ground and different tiles, and on cellphone display screen, this all seems squashed: the tiles and the elevated ground show in a decrease place than the desktop model, which is an unpleasant drawback. Resizing the window on PC, all of it runs and resizes accurately, sustaining the facet ratio.

The second picture is the common window, and the final is on the minimal dimension window, however the facet ratio is similar as on the bigger window. If I stretched out the window, all the things is stretched, however the higher ground and the sprite maintains the identical distance. I do not perceive what is going on on the cellular model.

I’m utilizing Tiled to attract the map, and in my code I exploit OrthogonalTiledMapRenderer and TiledMap, with an OrthographicCamera. I “zoom” with digicam.setToOrtho to crop to part of the map.

The determine is a Sprite in then code. The ground and the “door” are layers in Tiled (ground and doorways). I configured them as 16×16 tiles, however configuring them as 32×32 or extra provides the identical end result.

I attempted all viewports and nonetheless haven’t solved the issue. A possible resolution I can consider is to chop off the highest half when resizing, however I do not know the right way to do it!

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here