This page is part of the Snake in MIT Scratch Tutorial.
Scratch Implementation
This tutorial will explain the logic used in implementing each of the features described in the Game Design
Scratch Project
Click here to see the Scratch project!
Project Structure
The code is spread across a number of Scratch sprites:
- Game Controller: This invisible sprite is the central controller of the game.
- Apple: This sprite represents the apple that the snake can eat. The scripts attached to this sprite are used to position it on screen each time it is eaten.
- Snake Part: The snake’s body is composed of numerous sprites that are cloned and re-arranged as the snake moves and grows.
- Sound Controller: The events that trigger sounds are held within this sprite. Centralizing the sound events in this way makes it easier to change the sounds as they are all contained in one place.
- Hide Variables: This script is used to ensure that the score is hidden at the start of each game.
Conclusion
Throughout the tutorial the logic of each of the game’s features will be explained. It will be useful to refer to the project files while reading.
Next Section: Dividing the Playing Area into a Grid