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 happened?

We have set the update rate of the game, set its virtual canvas size, and loaded the texture atlas for the atom elements. Some basic definition is done, but we are far from being finished.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.163.158