Godot Version
4.3
Question
im trying to make a parallax2D node that repeats for an infinite amount of times, but that will cause lag.so i got an idea.the parrallax2D node will repeat only two times and if one exits the screen and also the other one is going to exit, the exited one will go to the other direction.like the one on top:
but i dont know how to make/code it.
if you know the answer pls reply
Are you sure the Parallax2D
node cause lag? The way the infinite parallax is implemented is basically what you’re saying, the built-in parallax should work without any issue.
yes.but i made it repeat like 100 times horizontally and vertically but it makes my game go to 20/10 fps
But why you need that amount of repetition? Also, how you’re setting that? The way to set the Parallax2D
node don’t require that amount of repetition to work.
i have a huge world and if it doesn’t get repeated it just shows one sprite and no clones so if you move then there will be nothing at the background thats wy i repeated it 100 times(also im not using the parallaxlayer node).but i got a better idea.just make it repeat 2 times and if one exits the screen.it goes to the opposite direction, so it moves through an unoticable loop but i dont know how to do that.yeah also sorry for having almost everyday an issue.i fix most of them but other ones are also hard
You can easily archieve that with Parallax2D node:
-
Create a Parallax2D
node and create a Sprite2D
as child of the parallax node, put your background in the sprite texture.
-
Set the sprite node position more close to center possible, don’t need to be perfect in the center.
-
In the Parallax2D
node, set the repeat size for the exact size of your sprite.
-
Set the repeat time to a amount that make your background cover your entire camera and a bit more.
-
Now you have an infinite background.
In my video the parallax move alone because i setted the auto slide option, but in a normal case will follow the active camera.
i have done that before and it didn’t work so i did it again and it worked!it was just a bug.btw THX