Chapter 2. Let's Get These Snakes Out of This Book!

In this chapter, we will start making our first game with the LibGDX framework. We will make a little journey back to one of the very first popular mobile games, Snake. We will start out by looking at LibGDX's update cycle and how textures are handled. Then, we will dive into the world of game making by creating our Snake game!

The following will be covered in this chapter:

  • Why Snake?
  • The game update cycle
  • Introducing the snake
  • Making the snake move
  • Controlling the snake
  • Introducing the collision detection mechanism
  • Increasing the length of the snake once the apple is eaten

Why Snake?

Snake is one of the earliest mobile games that I can remember. I remember playing it many a time, chasing the apple while avoiding contact with the snake's own body. The beauty of the game was that it was a slightly different experience each time you played.

The premise is simple: navigate the snake around the board collecting apples—which increase the length of the snake when consumed—while avoiding collision with the snake itself.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.90.182