December 2015
Beginner to intermediate
522 pages
11h 21m
English
Certain versions of snake run differently; however, for the sake of paying homage to the classical approach, we will be implementing a snake that moves based on a grid, as illustrated next:

Taking this approach makes it easier to later check for collision between the snake segments and the apple. Grid movement basically means updating at a static rate. This can be achieved by utilizing a fixed time-step, which we covered back in Chapter 2, Give It Some Structure – Building the Game Framework.
The outside area symbolizes the boundaries of the game, which in the case of a grid-based movement would be in the range of [1;Width-1] ...
Read now
Unlock full access