- SFML Game Development By Example
- Raimondas Pupius
- 260字
- 2021-07-23 14:55:07
Game design decisions
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] and [1;Height-1]. If the snake head isn't within that range, it's safe to say that the player has crashed into a wall. All the grid segments here are 16px by 16px big; however, that can be adjusted at any time.
Unless the player runs out of lives, we want to cut the snake at the point of intersection if its head collides with its body and decrease the amount of lives left. This adds a little variety to the game without being too unbalanced.
Lastly, you've probably already picked up on the fact that we're using very simplistic graphical representations of what a snake is in this game. This is done mainly to keep things simple for now, as well as to add the charm of a classic to the mix. It wouldn't be terribly complicated to use sprites for this, however, let's not worry about that just yet.
- Docker and Kubernetes for Java Developers
- C#程序設計實訓指導書
- Learning ArcGIS Pro 2
- Visual C++數字圖像模式識別技術詳解
- Instant 960 Grid System
- Bootstrap 4:Responsive Web Design
- Apex Design Patterns
- Windows Forensics Cookbook
- 低代碼平臺開發實踐:基于React
- 小型編譯器設計實踐
- Django 3.0入門與實踐
- C++程序設計
- 寫給青少年的人工智能(Python版·微課視頻版)
- DevOps 精要:業務視角
- INSTANT Premium Drupal Themes