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 layers for the game

Just as in the previous chapter, we will add a method called CreateLayers:

  1. Add a method called CreateLayers into the game class.
    Method CreateLayers:Int()
    
  2. Create new layers for the background, the game, and the title screen.
    layerBackGround = eng.CreateLayer()
    layerGame = eng.CreateLayer()
    layerTitle = eng.CreateLayer()
    
  3. Close the method.
    Return 0
    End
    

What just happened?

We want to group (layer) the game into three sections—one for the background, one for the actual game, and one for the title screen. Therefore, we have created the CreateLayers method.

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