 Hey, it's been a while. I know I've been working on some content for G the quest We are working on a tower defense course there So I'm trying to rush it so you can release it as soon as possible, but in this video We are going to make a Endless screwlers. So we have a background that repeats itself indefinitely You can see that we have for instance the stars on the back which repeats themselves indefinitely And we have the planets. Let's see if we can reach the last one. I think that there's only one left So, yeah, there's the the spink one and after that we start to repeat the planets all over So it starts with Saturn and Earth and so on and so forth. So This is a technique that we use mostly in like space shooters as you can see here This is my game for me parallax. So the basic of this game the bread and butter of this game is to have endless screwler parallax and the screwler background and In this video, we are going to see how we can make one as well But before we start this, let me see I like to thank all my patrons for their amazing support They are the persons that are supporting all the content on this channel if you want more content and more quality for the videos here You can support me on patreon.com slash pig that But without further ado, let's get to the video so the basics of this technique is to use a Parallax background a note that go to provide to us that inherits from canvas layer So it is a canvas layer and you can actually define the layer. It is seated. It's set on Using the layer properties. So the lower the layer The more on the back it will be and the higher the layer More close closer to this the camera. It will be so it will be on top of other elements, but As you can see it also provides some Other properties other properties like the offset the base of offset the base scale, which is what give us the The ability to let parallax backgrounds cool And it's cruel is lower than what the camera what the movement of the movement of the camera So this is what we used to give this Feeling that the things on the back is moving is lower than things on the front of the camera Or closer to the camera actually we have some limits So we can define a limit to screw it or a limit to to end the the screw So if we define for instance that it will stop scrolling after two Screens for instance, we can define this amount and after two Repeats so after it repeats itself two times it will stop repeating itself. So this is cool for like when you have a level full of Backgrounds of parallax backgrounds and you want to like screw the forest background So when you reach the a cavern for instance a cave you can start to screw the cave background instead You can also ignore the camera. I don't know what this is for. So if true element in parallax children Child aren't affected by the zoom level of the camera. Okay, so this is also a good thing to know but We don't have only that we don't work with just the parallax background because we can actually add elements So we can add a sprite here So let's add a sprite And there we have it. Let me pick the the planets Plans SVG texture region and let me select the earth so the earth Region okay, so we could do that but instead as you can see we don't have any way to mirror this So after it's it's cruel itself and we'll never see the earth again So instead of applying the sprites and the visual elements all as child of Children of the parallax background instead. We are going to add them Inside a parallax layer So a parallax layer only works as a child of a parallax background and it offers some motion properties which Some of them are they scale so we can use this scale to slowly Move this background as well. So you can have multiple parallax layers each one moving with with with a slower scale We have an offset as well. So the offset is a Position offset of this entire entire layer and we have the mirroring which is what we are going to use to Keep scrolling to keep repeating the background After it finished screwing. So let's add some let's add three Other sprites. So let me add Saturn here Not every planet here should mirror actual planets, but let's say that this one is I don't Uranus Make it bigger. This is just so we have something to work with so since we are going to screw vertically The mirroring should work with the y-axis to actually know Why is the value you should use you can use a you can use guides here So if we click and drag we will start to draw a guide We can use right the edge of this last planet, but this will make so that as soon as we Screw this last planet Immediately the earth will appear as well. So let's see we have 22996 so 296 and you can see that the earth appears right away actually yet to 2296 So you can see that it overlaps with this last planet. So you can use a greater value here So let's say we want the earth to start to appear again after 3000 pixels. So let's say 3000 there we have it and Actually, I will add another planet just so we have to We have planets on both sides here. So Duplicate this I will use this one on the right here and Let's change this scrolling to something like 4000 That should do the trick. So now that we have this we can see that it is mirroring, right? We have the earth again here but It won't screw itself automatically So we can make a script that will screw this parallax layer this parallax background automatically for us so we can keep the player inside the this is a confined inside One single screen and this will allow us to have a better control on level design so we can make enemies appear on This give us a way more control because we know that the player will always be always be inside the a single screen So we have a control of where things should appear This is very cool because this prevents us from allowing the players to Go to the wild and explore a huge level without knowing if they have or not the skills to Face the goals or the challenge that we are going to put on them with this kind of approach We have all the control and we can present new challenge in chronological order knowing that the player already Have been challenged before so we know the steps that the player will go through So let's create a new A new script I'll make this one a building script create and what we should do is to export a Speed variable which will be float Speed which is the scrolling speed and Let's say by default it will be 500 and With that we can make inside the process callback. Oh, I hate typing Inside the process callback. We can use the offset Dot why let's see It's these correct screw offset. Okay screw offset dot why And keep adding the screwing speed screwing speed Based on the data, so it will move so let's save this and Try and test to see if we Succeed applied this technique So as you can see things are moving. We have one 2 and then it should repeat again and yeah, there we have it so this is the Bread and butter off most screwler games so a space shooter side screwlers Platform games you can use that as well. You can use that for any game that the background The environment will repeat itself indefinitely. So you don't know if which so you can save some time instead of like Making by hand everything the background you can just make one background that looks Distantly and repeat itself so the player don't don't know so the player doesn't know That like the background is repeating itself. Just make sure that it is simply seamlessly Seamlessly repeated. Okay, so that's it for this tutorial. I will see you in the next one Thank you so much for watching keep developing and until the next time