To control the order of drawing the game objects, do collision checks, and also to hide or show certain objects, we need several layers.
1. Insert a new method called
CreateLayers
into thegame
class.Method CreateLayers:Int()
2. Set the background layer with the default layer.
layerBackground = eng.GetDefaultLayer()
3. Now, add layers for the game, the clouds, the info text objects, and the title screen.
layerGame = eng.CreateLayer() layerClouds = eng.CreateLayer() layerInfo = eng.CreateLayer() layerTitle = eng.CreateLayer()
4. Close this method.
Return 0 End
With this method, all the required layers are created and can then be used to assign objects. Boxing these into one method will let you change them easily and in an organized fashion.