Looping/wrapped borders

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Martín Álvarez Casti
:warning: Old Version Published before Godot 3 was released.

I’m trying to make a doodle jump kind-of clone with a ball that just goes up and up when you push it

I want to either:

1- Make it so that if it goes out of the lateral bounds it teleports to the other side (like Pac-Man), using code to do this seems very buggy, teleporting a rigidbody doesn’t seem too appealing visually and it also doesn’t cover the (literal) edge case where the ball stays in the bounds and you’d see half in each side

2- I could also live with the borders of the screen just deflecting the ball, I’ve thought of using static bodies as walls but when I move my viewport I have to move them and have no idea how to do so.

My intention is for the game to be infinite or very large, so putting a large static body isn’t a good solution either

I’m sure both questions have simple answers but I can’t find the answers in google

Thank you!

:bust_in_silhouette: Reply From: eons

Doodle Jump does like most do, just teleport.

Is not easy to do, depends on the mechanics, if you want the split body to react to collisions on both sides, maybe you will have to create your own physics process (shape API may be enough for collisions).


If you want to deal with all the problems that using a rigid body will give with this mechanic (in any public engine), maybe you can use the custom integrator and 2 shapes for the body, when in transition, displace the other shape to the other side but not sure how well will work.


Forgot, for the walls, well, walls can follow the player but look this way, the screen may be never moving, just the obstacles (that is how most “infinite” scrollers work).