Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
One of the most important elements of a game is the game loop. It is the heartbeat that keeps the game ticking. Every game has a series of tasks it must perform on a regular basis, as follows:
Update the game state
Update the position of game entities
Update the AI of game entities
Process user input, such as touches or the accelerometer
Play background music and sounds