Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

2D Continious Background like Metal Slug
Started by presentxy Aug 07 2018 05:43 AM

4 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

presentxy

[GLOBAL: userInfoPane.html]
presentxy
  • Observer

  • 5 posts
  • Corona SDK

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...

[TOPIC: post.html]
#2

sdktester15

[GLOBAL: userInfoPane.html]
sdktester15
  • Corona Geek

  • 1,195 posts
  • Corona SDK

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.



[TOPIC: post.html]
#3

sdktester15

[GLOBAL: userInfoPane.html]
sdktester15
  • Corona Geek

  • 1,195 posts
  • Corona SDK

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)


[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,743 posts
  • Corona Staff

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



[TOPIC: post.html]
#5

sdktester15

[GLOBAL: userInfoPane.html]
sdktester15
  • Corona Geek

  • 1,195 posts
  • Corona SDK

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.




[topic_controls]
[/topic_controls]