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 — creating the data structure

The following modifications have to be made to the game class:

  1. Insert the eng field, which will store the instance of the engine class.
    Field eng:engine
    
  2. Now, add a general object called obj. We will use this field during game setup.
    Field obj:ftObject
    
  3. To display some text in the game, we need one object for the game score and one to display the FPS value we have talked about previously.
    Field txtScore:ftObject
    Field txtFPS:ftObject
    
  4. We will use a bitmap font in the game and store this font inside the font1 object.
    Field font1:ftFont
    
  5. Next, add the three layers for the background, the game itself, and the title screen.
    Field layerBackGround:ftLayer
    Field layerGame:ftLayer
    Field layerTitle:ftLayer
    
  6. For the only ...

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