The usual way to make an infinite scroller is to create the next scenario to the right and move it to the left, thus indefinitely. But for issues of particle physics and other things, in my game it looks more natural to create the scenario on the right and move the character with the camera to that new scenario (like a normal plattformer).
The scenarios that are left on the left are being erased, in both cases.
My question is, since the values of X() are getting higher and higher, could some kind of overflow or malfunction occur if you are playing for a long time? Or would it be impossible? Thank you!
Hi,
JavaScript (which GDevelop uses under the hood) can represent integers accurately up to 2^53. Beyond that, precision issues can occur, which I assume is the limit in this case.
If your game runs for a long time and the X() coordinate keeps increasing indefinitely, you might start experiencing small inaccuracies in physics or rendering.
I tested this by printing a large number (9007199254740992, which is 2^53) and adding 1 to it. The value stayed the same, indicating that precision is lost at this point, which I think would be the limit and illustrates the issue.
However, you will definitely be fine as long as you’re staying within a reasonable range, well below this threshold.
1 Like
Thank you for testing it!
Ok, so if the maximum number of pixels in x() is 2^53, and my game has a width of 480, doing the division comes out about 18764998447377 screens, I think it will be enough for the game 
Apart from this, I don’t know if I could do something else by doing the game this way.
2 Likes
Well in that case you need to go for option 2.
Camera and player stays. And the level moves.
Then you just need create a possibility to spawn and despawn the level put of vieuw.
Then you wont get into the numbers issue.
And having a lot of external layouts makes it also posible to keep track of what part of the level the player is so you can spawn or despawn the correct level positition
1 Like
Yes, I also thought about it because there are some sections of the game in which the player passes inside a dark tunnel changing level, there everything could go back to x()=0