Designing an end-less running game with levels-using LibGdx JSON

by Niranjana   Last Updated July 17, 2017 06:13 AM

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.

Tags : libgdx

Answers 1

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

July 17, 2017 05:40 AM

Related Questions

Libgdx with Scala: Overwrite listener

Updated April 05, 2015 00:05 AM

Set the camera to follow a TextureRegion

Updated June 14, 2015 02:05 AM

How to use world coordinates

Updated June 23, 2015 02:05 AM

Does the LibGDX AI extension work on IOS?

Updated July 03, 2015 13:05 PM