Monkey Game Development:Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Using a game framework—the fantomEngine

In Chapter 3, Game #2, Rocket commander we have created every single class and function required for our game. Sometimes we also created duplicate functionality. For example, every object had its render method. This bloats up the code of the game but it was also good to understand the concept of a whole game.

To avoid redundant coding and make your life easier, you can and will use the fantomEngine game framework for this game.

The source code file, fantomEngine.monkey is included with this book, but for the most recent version visit: http://code.google.com/p/fantomengine/.

The fantomEngine features some classes (objects) for different functionalities, which are described as follows:

  • ftEngine: This is the main engine class
  • ftObject: An object that can be an image, text, circle, or a box
  • ftSound: This is to handle sound files
  • ftLayer: A layer groups several objects together to update, render, and check collisions
  • ftFont: This is a bitmap font object which can load EZGui compatible font files
  • ftTimer: Using this, a timer will be called at will and you can automate processes with it

In this chapter, we won't go into every feature of the fantomEngine. For a detailed reference please visit its website.