2
\$\begingroup\$

I'm making an endless side scroller game like gravity guy with libgdx.

To test this I'm just creating two tiled maps with the same .tmx file to render then one after another, like:

                            [map1][map2][map3][map4]...

The thing is I'm not succeeding to do this, and I already have searched related problems... I found one topic related with this but I couldn't understand very clearly.

Would be very happy if someone could help me on this!

\$\endgroup\$
1
  • \$\begingroup\$ Can you post what you have tried and what exactly your problem is. Otherwise we cannot help you. Please update your question with relevant information. \$\endgroup\$ Aug 12 '14 at 7:18
1
\$\begingroup\$

Currently there is no way to set the position of a TiledMap. All you can do is move the camera to make it seem as though the map is moving. To do this you would have to create your own rendering code that allows for drawing position input.

A workaround that you could try would be making the map twice in Tiled (i.e. in one tmx file, have the map repeat once, or as many times as needed), then once the player moves one screen width into the second half, move the character and the camera back to the first half. The reason you need to move at least one screen width is because you don't want to see any empty space behind you when you "teleport" back to the first half, although you can adjust the extra space as needed.

\$\endgroup\$

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.