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 — detailing the OnCreate process

The OnCreate method is the only method we can set into stone now. Cool!

  1. Set UpdateRate to 60 frames per second.
    Method OnCreate:Int()
    SetUpdateRate(60)
    
  2. Now, read the dimensions of the canvas, your visible area. You will store this information inside the previously defined variables.
    cWidth = DeviceWidth()
    cHeight = DeviceHeight()
    
  3. Before the method is closed, we will call a new method called SetupGame. In this method, we will set up the starting values of a new game. Putting this inside a method will enable us to call this part again, once the game is over.
    SetupGame()
    Return True
    End
    
  4. Now, create a new method called SetupGame. Some previously defined variable will be used and set to values appropriate ...

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