Making a 2D Paper Tile Map loop

Hello,

I’m working on creating a looping 2D Paper Tilemap. My goal is to make the tilemap loop seamlessly, so that when the character reaches the edge, the end of the tilemap connects with the beginning, as if the tilemap were a cylinder rather than a rectangle.

To achieve this, I’ve set up an Actor Blueprint with two copies of my tilemap. The idea is that as the player moves to the right, the tilemap on the left should move to the right, and once it reaches the edge, it should be repositioned to the far right. Conversely, if the player moves left, the logic should work in reverse.

Here’s what I have so far (see attached images).

Could anyone suggest a better approach or help identify what might be wrong with my current setup? I’ve searched the forum but couldn’t find relevant information.

Any tips, YouTube video links, or guidance on where to find more help would be greatly appreciated.

Thank you!


It all looks pretty logical. I assume ‘scroll speed’ is negative.

This works with ‘tiles’ where the pivot point is in the middle ( moves the first one initially )

moving billboards

Doesn’t work with higher speeds though ( they get out of position ). You might need to use a timeline to move these components, if that’s a problem.

1 Like

Thanks for the reply. I have 2 questions.

1- How do you move the pivot point of a Tilemap to the middle? I tried adjusting the center of mass offset or the pivot point, but no luck. The only other option I see would be to create a new Blueprint with a scene component as the root, attach the tile map to this empty actor, and adjust the location of the tile map within so that its visual aligns with the center. Is that what you did?

2- Also, I might not have expressed myself properly. I don’t want the tiles to move constantly. The tiles should only reposition themselves to ensure the character can’t jump off the level. Basically, the level would be made of 3 static Tilemaps. The map on which the character stands must always have a map on the right and on the left. For example, if the character leaves the middle map and reaches the map to the right, the one on the left end will relocate to the right, and vice-versa. I’m starting to believe that I will 100% need a collision box at both ends of each Tilemap to detect when the character is leaving/entering a map, and that this should be the trigger to relocate the maps accordingly.

1 Like
  1. You don’t need to move the pivot, but things will be a little different if it’s at one end. That’s all :slight_smile:

  2. You’re right, I thought it was a ‘side runner’. If the tiles are only going to jump location when the player reaches a certain location, then tick is totally not the place to put the code. It would work better with a collision box on each end of the tile to trigger the move event.

1 Like

Alright, so I figured it out.

I did a Blueprint of class ‘‘Paper Tile Map Actor’’. In this Blueprint, I added 2 tilemaps (A and B). Each map has 2 colliders (A1, A2 for map A, and B1 and B2 for map B). You must have a minimum of 2 tilemaps for this to work. If you only have 1, just split your tilemap in 2. You can make this work with more than 2, but it’s going to be more complicated.

The way it works is, before reaching the edge of each map (before your character would fall of the ledge), you have a collider. As soon as your character collides with it, it will detect where the second map is located, and if it is on the opposite side, it will relocate it to the area where your character is headed. Feel free to place your colliders closer to the center of your tile map, so you don’t see the edge of your tilemap before colliding. As long as they stay in the same order, you are going to be fine.

The only issue I have right now is, when a tilemap gets relocated, there is a big lag spike. If anyone knows how to fix this, please let me know.

I’m a new user, so I can’t put all my screenshots in one post. I will try to make different ones to post all the required screenshots.

1 Like

Looks good :slight_smile: I don’t get why you have a lag, though…