How to swap between two groups in the same scene?

Hi everyone :slight_smile:

I am new to Corona SDK and currently making my first real mobile game. 

Unfortunately I´ve run into a problem which is as follows: 

In my menu scene the player can choose between two difficulty modes. But I don´t want to change scenes, because only a part of the menu scene changes. Some content ( like title text, menu bar, etc. ) stays the same. I´ve attached an image that describes my problem. The red parts in the image are the parts that should change, the yellow parts are static.

I´d like to have a slide animation between the two big red parts, but I don´t know how to go about it. I thought of having two different groups for the two big red parts and then transition between these two groups. 

My question: Is this possible or does there exist a different way to achieve this?

Thanks in advance :slight_smile:

Welcome to the forums!

You might want to consider composer.showOverlay() to show a temporary scene on top of your menu scene. You can have the overlay, when it’s in the process of hiding, execute code in the parent scene to swap out your graphics.

Here’s a tutorial that provides various techniques for image swapping: https://coronalabs.com/blog/2013/11/26/tutorial-techniques-for-swapping-images/

The Composer Guide has as section on Overlay scenes and a specific subsection on executing code in the parent to affect the parent scene:  https://docs.coronalabs.com/guide/system/composer/index.html#overlay-scenes

Rob

Thanks Rob :slight_smile:

Okay, but I can only have one Overlay per scene am I right?

If so, can I still implement a menu bar at the bottom of my game that extends upwards when being clicked. Similar to a sidebar but vertically. I´ve attached some images to describe what I mean. How would I implement that feature when I have no 2nd Overlay? 

Thanks a lot :slight_smile:

Elias, you just add all the objects for the pop up menu into its own display group. You could technically have any number of pages, menus, windows etc in one scene, just hide/show using .alpha and move them using transition.to.

Thanks, everything clear now :slight_smile:

Welcome to the forums!

You might want to consider composer.showOverlay() to show a temporary scene on top of your menu scene. You can have the overlay, when it’s in the process of hiding, execute code in the parent scene to swap out your graphics.

Here’s a tutorial that provides various techniques for image swapping: https://coronalabs.com/blog/2013/11/26/tutorial-techniques-for-swapping-images/

The Composer Guide has as section on Overlay scenes and a specific subsection on executing code in the parent to affect the parent scene:  https://docs.coronalabs.com/guide/system/composer/index.html#overlay-scenes

Rob

Thanks Rob :slight_smile:

Okay, but I can only have one Overlay per scene am I right?

If so, can I still implement a menu bar at the bottom of my game that extends upwards when being clicked. Similar to a sidebar but vertically. I´ve attached some images to describe what I mean. How would I implement that feature when I have no 2nd Overlay? 

Thanks a lot :slight_smile:

Elias, you just add all the objects for the pop up menu into its own display group. You could technically have any number of pages, menus, windows etc in one scene, just hide/show using .alpha and move them using transition.to.

Thanks, everything clear now :slight_smile: