O'Reilly logo

Monkey Game Development by Michael Hartlef

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — creating some layers

We can use the following steps to create some layers:

  1. Add a new method called CreateLayers to the game class.
    Method CreateLayers:Int()
    
  2. Create the layers in the order they have to be rendered later on.
    layerBackGround = eng.CreateLayer()
    layerGame = eng.CreateLayer()
    layerFX = eng.CreateLayer()
    layerUI = eng.CreateLayer()
    layerTitle = eng.CreateLayer()
    layerScore = eng.CreateLayer()
    
  3. Close the method.
    Return 0
    End
    

Let them shine—the background stars

The stars are objects of the layerBackground layer.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required