I have no trouble spawning objects on the layout but when my player starts to go into the area of unbound scrolling( beyond the layout) all my objects stop spawning. What I mean by objects spawning is I have made it so an obstacle spawns every 120 y. What I need to find out is how to continue these objects spawning even when i am off the layout and unbound scrolling.
Develop games in your browser. Powerful, performant & highly capable.
Spawn obstacles based on user position.
Eg spawn object at y = Player.Y +500, Player.X +100
This will spawn objects just fine.
Use the player's Y position to create your Obstacles. You can use the "random" expression for variation. For example.
Every x seconds ----> Create object "Obstacle" at layer 0 , random(window.Width) [for the X axis] , random(player.Y - window.Height, player.Y - window.Height*2)
Will create obstacles at random positions on the X axis (but within your viewport) and within a vertical area that spawns between the [(Player's current Y position) - (whatever Height in pixels your game has)] and [(Player's current Y position) - (whatever Height in pixels your game has * 2)].
I know that in words all the above probably don't mean nothing so, here is a relative example.
EDIT- funkyy is a ninja and answered first, but I had to carry the example with me