A new local function reorderLayers() needs to be created to organize the display hierarchy of objects on screen during game play:
local reorderLayers = function()
gameGroup:insert( levelGroup )
ground:toFront()
panda:toFront()
poof:toFront()
hudGroup:toFront()
end
What just happened?
The gameGroup, hudGroup, and other display objects are reorganized in the display hierarchy of the game screen. The most significant object is set to the front, while the least important one is towards the back.