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

Let's start modifying the game class.

  1. Add a field to our engine class, the instance of the fantomEngine's ftEngine class.
    Field eng:engine
    
  2. Next, we have fields to store different ftObject instances, which need to be accessible at any time.
    Field obj:ftObject 'A general object
    Field player:ftObject 'Holds the player ship object
    Field shield:ftObject 'the Shield of the player
    
  3. To store different text information, we will need some objects for these as well.
    Field txtScore:ftObject 'Stores the game store info text Field txtLifes:ftObject 'The text info about the lifes left Field txtLevel:ftObject 'Shows which level we are in Field txtComets:ftObject 'Info about how many comets are left Field txtHighScore:ftObject[10] ...

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