Building an in-game GUI?

I am just starting to use Corona, and one thing I can’t seem to find is how to build an in-game GUI. Now, I understand that you can use any object for interaction, but my problem seems to be that I can’t figure out yet how to set “layers” on objects. Is there a setting for something like “Always On Top” or “Set Layer Order”?

For example, if I were to add an object to a scene, then that new object would automatically be on the “top level”, right? And wouldn’t that mean it would appear ABOVE my GUI objects? I see there is a function called “toFront”, but it seems kind of excessive to have to do that all the time.

Any help, directions, or tutorial links would be appreciated.

Thanks. [import]uid: 166998 topic_id: 32495 reply_id: 332495[/import]

Corona supports two ways to move display objects: toFront() and toBack()

button = display.newImageRect("mybutton.png", 64,64)  
button:toFront()  

Now typically you put things into display groups:

guiGroup = display.newGroup()  
button = display.newImageRect("mybutton.png", 64,64)  
guiGroup: insert(button)  
  
button2 = display.newImageRect("mybutton2.png", 64,64)  
guiGroup: insert(button2)  
  
guiGroup:toFront()  

that will move the whole group to the front or back. Within a group, or the display in general, there is no up 1 or down 1 type moving. The group is a big table and you can use table techniques to move things up and down. Also things in groups can only be in one group at a time, so removing an item and reinserting it is the same as putting it on top. It’s best to plan your layers and load things in the order you want for most things. Then group bits by things you want to hide and show as necessary.

[import]uid: 19626 topic_id: 32495 reply_id: 129236[/import]

Corona supports two ways to move display objects: toFront() and toBack()

button = display.newImageRect("mybutton.png", 64,64)  
button:toFront()  

Now typically you put things into display groups:

guiGroup = display.newGroup()  
button = display.newImageRect("mybutton.png", 64,64)  
guiGroup: insert(button)  
  
button2 = display.newImageRect("mybutton2.png", 64,64)  
guiGroup: insert(button2)  
  
guiGroup:toFront()  

that will move the whole group to the front or back. Within a group, or the display in general, there is no up 1 or down 1 type moving. The group is a big table and you can use table techniques to move things up and down. Also things in groups can only be in one group at a time, so removing an item and reinserting it is the same as putting it on top. It’s best to plan your layers and load things in the order you want for most things. Then group bits by things you want to hide and show as necessary.

[import]uid: 19626 topic_id: 32495 reply_id: 129236[/import]

Actually, I’m about to share a library I made for that. If you look at the Code Exchange sometime in the near future, it will be under the name “Perspective.” [import]uid: 147322 topic_id: 32495 reply_id: 129326[/import]

Finished it! You can get it here. [import]uid: 147322 topic_id: 32495 reply_id: 129339[/import]

Actually, I’m about to share a library I made for that. If you look at the Code Exchange sometime in the near future, it will be under the name “Perspective.” [import]uid: 147322 topic_id: 32495 reply_id: 129326[/import]

Finished it! You can get it here. [import]uid: 147322 topic_id: 32495 reply_id: 129339[/import]