How to insert multiple levels?

First, congratulations to the creator of Level Director, his software is helping me a lot.

I’m trying to create a simple infinite runner. But I do not know how to load several levels in a row in the same scene. What I try to do are small levels, which are loaded randomly creating the map

Thank you in advance and forgive me for my English.

Hi, it looks like you are trying to ‘stitch’ levels together which I’ve not really come across before.

For endless runner type games, normally you would dynamically create the objects from the assets in some kind of random order, but you’re trying to add complete chunks of a map.

It is possible to load multiple levels at once, but this could get messy as you then don’t have overall control of a single level, but multiple, and physics are now spread across multiple display groups e.g.

local myLevel1 = {} local myLevel2 = {} local world = display.newGroup() myLevel1= LD\_Loader:new() myLevel1:loadLevel("Level01",world) myLevel2= LD\_Loader:new() myLevel2:loadLevel("Level02",world) --assuming levels are 480 wide, parallax enabled, place them side by side. myLevel1:move(-240,0) myLevel2:move(240,0) -- note 'myLevel1.level.view.x = -240' is also possible but physics won't move.

Nice concept though, but adding multiple display groups is tricky, as newly added groups will display on top, which might not be expected.

A slightly different version from above, but this will allow ‘world’ to be manipulated correctly e.g. world.x = 100

local myLevel1 = {} local myLevel2 = {} local world = display.newGroup() myLevel1= LD\_Loader:new() myLevel1:loadLevel("Level01") myLevel2= LD\_Loader:new() myLevel2:loadLevel("Level02") myLevel1:move(-240,0) myLevel2:move(240,0) world:insert(myLevel1.level.view) world:insert(myLevel2.level.view)

Hi, it looks like you are trying to ‘stitch’ levels together which I’ve not really come across before.

For endless runner type games, normally you would dynamically create the objects from the assets in some kind of random order, but you’re trying to add complete chunks of a map.

It is possible to load multiple levels at once, but this could get messy as you then don’t have overall control of a single level, but multiple, and physics are now spread across multiple display groups e.g.

local myLevel1 = {} local myLevel2 = {} local world = display.newGroup() myLevel1= LD\_Loader:new() myLevel1:loadLevel("Level01",world) myLevel2= LD\_Loader:new() myLevel2:loadLevel("Level02",world) --assuming levels are 480 wide, parallax enabled, place them side by side. myLevel1:move(-240,0) myLevel2:move(240,0) -- note 'myLevel1.level.view.x = -240' is also possible but physics won't move.

Nice concept though, but adding multiple display groups is tricky, as newly added groups will display on top, which might not be expected.

A slightly different version from above, but this will allow ‘world’ to be manipulated correctly e.g. world.x = 100

local myLevel1 = {} local myLevel2 = {} local world = display.newGroup() myLevel1= LD\_Loader:new() myLevel1:loadLevel("Level01") myLevel2= LD\_Loader:new() myLevel2:loadLevel("Level02") myLevel1:move(-240,0) myLevel2:move(240,0) world:insert(myLevel1.level.view) world:insert(myLevel2.level.view)