Chapter    14

Gameplay Programming

This chapter looks into the gameplay programming of the Tut’s Tomb game. You will learn how to use actions as an easy way to add behavior to the game world. Also, you’ll deal with interactions between game objects (for example, when two treasures of the same type collide).

Game Object Behavior

Previously, the way in which you added behavior to the games was by defining handleInput and update methods as a part of each game object class, and then making sure that those methods were called in each instance during the game loop. The nice thing about this approach is that each game object is responsible for its own behavior. The behavior of the ball in Painter is defined in the Ball class; the behavior of a treasure ...

Get Swift Game Programming for Absolute Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.