To set up the layers for the game, we will use a method inside the game
class, as follows:
1. At first, add a new method header called
CreateLayers
.Method CreateLayers:Int()
2. Create a new layer for the game objects and store it inside
layerGame
.layerGame = eng.CreateLayer()
3. The top row of the game will hold some text objects. As the play field would cover them a little bit, we will move the game layer a little bit downwards.
layerGame.SetPos((eng.canvasWidth-11*64)/2+32,+100)
4. Now, create another layer for the title screen and store it inside
layerTitle
. After that, close this method.layerTitle = eng.CreateLayer() Return 0 End
This time, we only created layers for the game objects and the title screen. For the text info objects, we will use the default layer of fantomEngine.