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

  1. To store the relevant fields, we will create fields again in our main class, called game.
  2. The game class already has fields for the instance of the engine class and a field that will store if the app is suspended or not.
    Class game Extends App
    Field eng:engine
    Field isSuspended:Bool = False
    
  3. Next, add fields to store text objects for storing the game score, Game Over text, and the FPS indicator.
    Field txtScore:ftObject
    Field txtGameOver:ftObject
    Field txtFPS:ftObject
    
  4. Our game ball will be a separate object and so are the fonts, which we will be using for our in-game text objects.
    Field ball:ftObject
    Field font1:ftFont
    
  5. Later on, we will create two classes for particle emitters and the enemies that will hunt ...

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