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 — first changes to the OnCreate method

For example, let's look at loading the bitmap font and loading the sprite atlas:

  1. Inside the OnCreate method of the game class, change the canvas size to the resolution of the iPhone 4. This way, we have more space for the game. It will be automatically scaled down on older devices.
    Method OnCreate:Int()
    SetUpdateRate(60)
    eng = New engine
    eng.SetCanvasSize(640,960)
    
  2. To make our life easier by typing less, we store the dimensions of the canvas inside cw and ch.
    cw = eng.canvasWidth
    ch = eng.canvasHeight
    
  3. Now, load the sprite sheet and the bitmap font.
    atlas = LoadImage("bo_tiles.png")
    font1 = eng.LoadFont("bo_font")
    Return 0
    End
    

What just happened?

We have loaded the media files required to go on with ...

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