Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | mydoghasworms | |
Old Version | Published before Godot 3 was released. |
If you make an endless runner, in which the player keeps moving in one direction, is there a chance that there might be an overflow in one of the position values, causing the game to crash eventually?
Endless runners are, to my knowledge, usually made with the runner being in a fixed space and the environment moves around them. The environment objects can be wrapped around or destroyed when they leave the viewport.
indicainkwell | 2016-11-02 22:39
And if not in a fixed space, they have phases, or levels, or ways to rotate so the player stays in the same big area.
Zylann | 2016-11-03 00:09
@indicainkwell This is what I have been doing, but I have found that trying to move everything else relative to a fixed point is such a headache, and then it seems that parallax scrolling does not work, because the camera also stays in one place. (I’m new to this, so maybe I’m missing something?)
mydoghasworms | 2016-11-03 04:28
You could also move all stuff backwards at some point, so from a global point of view your character advances, but warps back to the origin. But from the point of view of the player, nothing changes.
Zylann | 2016-11-03 20:09
You could structure this with a top level node called like ‘environment’ that will handle your base scrolling behavior and also communicating with your parallax layers. The node could be scrolled by pages (a whole screen) with some padding on the sides. At the beginning or ending of a page, give off a signal, arrange your next page, and then reset your positional values to avoid overflow.
Take this with a grain of salt because I’ve never actually created an endless runner before.
indicainkwell | 2016-11-03 23:34