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

Inside the OnCreate method of a monkey app, you basically set up the game. For example, loading some graphics can be done here:

  1. First set the update rate of the game to 60 frames per second.
    Method OnCreate:Int()
    SetUpdateRate(60)
    
  2. Now, create an instance of the engine class.
    eng = New engine
    

    We want to work with a virtual resolution and let the fantomEngine take care of the scaling of our graphics and touch events.

  3. Set the virtual canvas size to 480 x 800 with a call to the SetCanvasSize method.
    eng.SetCanvasSize(480,800)
    
  4. Load the texture atlas of the atom elements.
    atlas = LoadImage("CR_Tiles.png")
    
  5. Set the font1 object with our bitmap font.
    font1 = eng.LoadFont("cr_font")
    Return 0
    End
    

What just ...

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