Game loop

In its core, every game is basically just a loop of events. It is a set up to give calls to various functions and code blocks to execute in order to have draw calls on your screen, and thereby making the game playable. Mostly, your game comprises three parts:

  • Initialize
  • Update
  • Draw

Initializing the game means to set an entry point to your game through which the other two parts can be called. Your game begins here and is called just once.

Once your game is initialized, you need to start giving calls to your events that can be managed through your update function.

The draw function is responsible for drawing all your image data on the screen. Everything you see on the screen including your backgrounds, images, or even your GUI is ...

Get Learning Android Game Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.