Time for action — composing the background screen

The game background will be just one image of some fields. It needs to be assigned to the background layer. That is all.

  1. Add the method CreateBackgroundScreen to the game class.
    Method CreateBackgroundScreen:Int()
    
  2. Set the default layer to layerBackground.
    eng.SetDefaultLayer(layerBackground)
    
  3. Create a local object that calls CreateImage. It will be displayed in the center of the canvas. After that, close the method.
    Local obj:= eng.CreateImage("background.png",cw/2,ch/2)
    Return 0
    End
    

What just happened?

With this new method, you have loaded the background image. For other platforms, you could also create some buttons to switch back to the title screen, but we will handle this differently.

Hope it won't rain—creating the clouds

To have more animated objects on the screen besides the planes, we will let some clouds float around the canvas.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.222.47