Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

5. Game #4, Chain Reaction > Time for action — first changes to the OnCreate me...

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
    

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial