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 — finalizing the OnCreate method

The OnCreate method in the game class is the place where all static objects are defined.

  1. Inside the OnCreate method of the game class, add calls to the methods you have created previously.
    font1 = eng.LoadFont("ts_font")
    tileMap = Create2DArray(columns,rows)
    LoadSounds()
    CreateLayers()
    CreateBackgroundScreen()
    CreateGameOverScreen()
    CreateMenuScreen()
    CreateScoreScreen()
    CreateTitleScreen()
    
  2. To display the title screen later on, set the game mode to gmTitle, and active the layers with this mode.
    gameMode = gmTitle
    ActivateLayer(gameMode)
    Return 0
    End
    

What just happened?

In the OnCreate method, you have added the calls to other methods that will set up all the static objects we need for the game, such ...

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