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

The heart of the game—the engine class

All the objects can be created now—static objects such as text and also dynamic objects such as the tiles or particles. The could move now but there is no reaction to the input or collision checks, for example. That is where the engine class comes into play. To act on collisions and touch checks, and to update objects and layers, we will utilize the fantomEngine's callback methods.

Touch me—acting on touch hits

Let's start with the touch events. The touchable objects in our game are the text buttons. They have a specific tag value and that is what we can check against. Remember, the OnObjectTouch method will be called when the mouse cursor or a touch is over the object during a call of the TouchCheck statement. ...

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