2D Continious Background like Metal Slug

I have a player its like side scrolling game, when player finish 1 background and hut right button immidietly i have to create another background. How ?

Besides i cant erase my play button. When i hit play button its hidden behind of background.

Thank You Everybody…

Or you could have the backgrounds already created and the enemies set up and once the player reaches that area the enemies “wake up”. 

Since the player can’t see the next area of the map until the complete the current one, this method is fine.

I am fairly certain that is how Metal Slug does it.

To “erase” your play button, if you are using composer, then in the scene with the play button just insert the button into the sceneGroup:

--wherever play button is sceneGroup:insert(playButton)

This way, the button will disappear as you move into the next scene.

If you are not using composer, and you don’t need the button anymore, you can just remove it:

display.remove(playButton)

Normally for endless backrounds you will create a couple of copies of the background placing them beside each other. Then you move the background across the screen and when you detect one has moved off screen, you reposition it to other side of the other background. By creating them at the same time, when you add your button later, it will be on top.

If your objects are getting out of order (background on top of the button), you can use the :toBack() API to reorder the object. See: http://docs.coronalabs.com/api/type/DisplayObject/toBack.html

Rob

I don’t think they want them endless, as in Metal Slug the way it works is that it builds the entire level and “activates” them as the player moves along.

Or you could have the backgrounds already created and the enemies set up and once the player reaches that area the enemies “wake up”. 

Since the player can’t see the next area of the map until the complete the current one, this method is fine.

I am fairly certain that is how Metal Slug does it.

To “erase” your play button, if you are using composer, then in the scene with the play button just insert the button into the sceneGroup:

--wherever play button is sceneGroup:insert(playButton)

This way, the button will disappear as you move into the next scene.

If you are not using composer, and you don’t need the button anymore, you can just remove it:

display.remove(playButton)

Normally for endless backrounds you will create a couple of copies of the background placing them beside each other. Then you move the background across the screen and when you detect one has moved off screen, you reposition it to other side of the other background. By creating them at the same time, when you add your button later, it will be on top.

If your objects are getting out of order (background on top of the button), you can use the :toBack() API to reorder the object. See: http://docs.coronalabs.com/api/type/DisplayObject/toBack.html

Rob

I don’t think they want them endless, as in Metal Slug the way it works is that it builds the entire level and “activates” them as the player moves along.