Hi everyone, I’ve searched the forum for this a few times and haven’t come across the answer I’m after. I apologise if I was searching the wrong terms or something and this is a common question.
My game is an endless game, but vertically. Think of the objective as climbing as high as possible, without hitting obstacles. The camera for the game only moves when you do, you’re not forced to move (unlike most other vertical endless games)
My game’s screen size is 1080x1920 (vertical 1080p) and I have paid for some seamless art of walls to be created. I’ve made them tiled sprites. My Problem is that I cannot figure out how to make them endless on each side of the screen.
I’ve tried many things but unfortunately didn’t screenshot what I did, so I don’t have evidence of what I tried. But it was mostly comparing the camera’s height to the top bounding box of the wall, and if it was greater (or lesser, I can’t remember, because it’s technically in negative y space) then it would add 1920 (or subtract, can’t remember once again) to the height of the tiled sprite wall, and that didn’t work.
What I want to happen is for the walls to be spawned when the camera is higher than them. So that they appear endless. I thought using a tiled sprite would make this simple but it seems that it isn’t.
If a regular sprite would make this easier I can attempt that.
Side Question, I also have to ask is there a point at which things will despawn if they’re far enough from the camera? Currently, my scoring is based on distance from the ground and I don’t want the ground to despawn, or the walls if the base of them gets a certain range away from the camera.
Hi there, sorry if you already saw this, but there is an example in Gdevelop called something like, Infinitely scrolling top down background that might be interesting to you. You could put your wall on the background layer like they have and then your player and obstacles on another layer.
The only thing is I don’t know enough to know how you’d limit the camera on the left and right side if you only want it going up not sideways, except maybe put some obstacles or something.
Then you can use something like Create Random Level Design For Your Video Game - With GDevelop - YouTube only backwards to make your levels.
About the last question, not sure sorry. Anyway just throwing it out there in case it’s helpful.
Hi detroitgrated and welcome. I’ve never used tiled sprites but I think the thing you want in the actions is to change the y offset of the tiled sprite. It will at least give you something to search for to get a better idea of how to apply it. There may be other ways to do it in Lucky-j’s links, good luck!
Hmmm, that example might work. I do worry that because it’s a foreground element (not a background one), they won’t move together and so it won’t appear as if you’re climbing. But I will attempt it to see.
Yes, that’s possible however because in the game you actually do climb (not stay in place and the bg moves), I still need the walls to continue endlessly, I hope that makes sense.
I just had a go at the y offset thing after I realised how useful tiled sprites are but couldn’t get it to work. But then somehow I realised the tiled sprite needs to be on a different layer to the player. I’m still not exactly sure what you need dg, maybe a screenshot of your scene will explain it better. But anyway, here’s what I did. would have put a gif of it here but it doesn’t display well.
Thank you to both @Bubble and @Lucky-j for your answers. Both were helpful.
I ended up making the tiles move with the player once it’s above the first “set of walls”, and then have the image offset by the height of the player. Here’s how I did it - the yellow blank spots are just the player object.
I also have them on the same layer, so Bubble. I don’t know why you’re having that issue.
Hopefully, someone in the future finds it useful.