Chapter     6

Game Entities

All games are made up of different objects and the way that these objects behave. Pac-Man has objects such as Pac-Man himself, the ghosts, pac-dots, power pellets, and walls. Each of these objects has a different behavior. Pac-Man responds to the player’s input and can change from being the prey to being the predator by eating a power pellet. This changes the behavior of the ghosts, who are placed into a state where they run away from the player.

Our game calls for a simpler set of behaviors, but we will construct the objects using state-of-the-art methods to get a feel for how modern games structure their game objects. Traditionally, game objects have been built with a normal class hierarchy, starting with a base ...

Get Beginning Android C++ Game Development 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.