I am working on an end-less running game where obstacles are placed along the way on moving background. I have a lot of levels in the game,and I am implementing it using JSON.

My JSON file for first level look like this:

 "obstacles": [

Here I am placing obstacles up to an x position of 8700 on a moving parallax back ground.

Level1 is working fine,but my issue is that how I should place the next level obstacles.I have only one way that some position after 8700 I have to choose for placing next level obstacles.

Here I want to clarify one thing.Will it become a problem when I use larger values like this?

There is more than 20 level planned in my project,and each level get loaded automatically when one is completed.

I expect suggestions from experienced persons ,for designing the levels with these aspects.

Thanks in advance.


2 Answers 2


I would place objects in a procedural way. Keep track of the distance while ingame and try to spawn obstacles in intervals. Check for the current distance travelled and spawn obstacles according to it. Maybe hold level-specific obstacles in a dictionary, where the key is the minimum distance to spawn the obstacle


If it is an endless running game there is no point of designing all the levels. Maybe design the first 1000 meters as a tutorial, and after it use some procedurally way of generating the next objects. As you go further the shorter are the intervals of obstacles, p.e.

Anyway if u want to go with json way you can try it:

"level1": [

At the moment of spawning the obstacles, multiply the current level for the distance. It will make you json more readable.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .