+3 votes

Hello, I want to make it so that when you get to an edge of a tilemap the game will render a copy of the tilemap there.
This should include all the sub nodes like characters on the map. So when the player walks outside the map (into the redrawn map), I can seamlessly teleport the player over to the other side of the map and have a visual illusion of a looping map.

I previously did this in a SDL game by simply recalling the draw map function with an offset position. Can I do something similar in godot? I looked at _draw but couldn't find a way to redraw the node itself.
I do not want to copy the tilemap node, because all the characters on it have scripts that would run redundantly and probably cause strange behavior and make them desync, ruining the teleport illusion.

If _draw is not the way,
could this realistically be done by drawing to a texture (I suspect that could be slow),
or using multiple cameras (I suspect they would a mess to resize/position)?
Is there maybe an entirely different way to do this in a performant way?

in Engine by (15 points)

My instict would be to simply move the nodes around, but that seems really slow and hacky

Try simply to separate your map from your enemies and store their start position in variables, and then uptade their variables before you need to instantiate new scene - set new scene enemies on to curent scene eneies postition plus offset of the tilemap.
Alternatively, you can try to render your screen with separate viewport on to another texture and offset it to the desired direction and then teleport player (e.g. if it walks to the right of map, teleport it to the left of original tilemap, but center screen on newly created viewport texure).

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.