Return to site

Snake In Scratch

broken image


  1. Snake Game Cool Math Games
  2. Scratch Programming Playground Zip File
  3. How To Make Snake In Scratch

Demo

Feature, some have been transcribed from existing Scratch projects. Snap.html#present:Username=jens&ProjectName=Snake&editMode&noRun Bug on a Plate. Make a Game in Scratch Page 3 of 24 Exemplar Materials The answers to the formative quiz are all available at the end of this document. I have also included 8 example projects with my.

Scratch Snake Game Tutorial

  1. Function used to translate grid coordinates into Scratch screen positions. This function appears in the scripts of sprites that are positioned on the grid such as the snake and apple. The function accepts 2 paramters: gridX and gridY. These are the X and Y coordinates of the snake grid that the object should move to.
  2. CoderDojo Milltown – Scratch Exercise 2 – Snake – v1.0 Step 5 The final bits of code for the snake are on the right This tells the new cloned version of the sprite thats left behind to become a body costume (a cloned element is always a body) It then simply says to just wait (no movement) for the delay value by the length of the snake.

Game Demo

Have a go at the go at the demo video for the Scratch Snake game tutorial, so you can see what it is that you will be making in this tutorial.

Tutorial Video

Tutorial Video

Here is the tutorial video for the game, hosted on YouTube. If you can't access YouTube, then the video can be loaded from Google Drive.

Make sure that you listen to the video on headphones as you go and don't just copy the blocks. I explain how I worked things out and why I chose the techniques I did! This will help you improve your Scratching skills.

Snake

Snake Code

Snake setup script

Snake

This script sets up a few variables, empties the tail positions lists and shows the snake in the middle of the screen.

Snake Main Script

This the main script where most of the work is done. The snake is moved, tails positions are added to the tail list and we check to see whether we have died or if we have eaten food.

Snake direction script

This script sets the direction of travel for the snake.

Tail remover

Tail remover

In this part of the Scratch snake tutorial, the tail remover sprite finds out where the end of the tail is and removes it by stamping over it with the stamp tool.

Food

Food Script

The job of the food script is to spawn to a random location on the invisible grid ( we do this be setting the location in multiples of the movedistance variable. When it get's eaten, the score is increased by one, the snake gets longer and the food moves to another random location.

Game Over

Game Over

The job of the game over script is just to display game over, so it's a pretty simple script really.

Score

Score numbers

The score numbers are used at the end of the game to display the score.

Challenges

Snake
Snake

Extension Challenges

Scratchboard

Snake Game Cool Math Games

Complete the tutorial and want to challenge yourself to achieve more? Here are some ideas to improve your game:

Easy

Snake

This script sets up a few variables, empties the tail positions lists and shows the snake in the middle of the screen.

Snake Main Script

This the main script where most of the work is done. The snake is moved, tails positions are added to the tail list and we check to see whether we have died or if we have eaten food.

Snake direction script

This script sets the direction of travel for the snake.

Tail remover

Tail remover

In this part of the Scratch snake tutorial, the tail remover sprite finds out where the end of the tail is and removes it by stamping over it with the stamp tool.

Food

Food Script

The job of the food script is to spawn to a random location on the invisible grid ( we do this be setting the location in multiples of the movedistance variable. When it get's eaten, the score is increased by one, the snake gets longer and the food moves to another random location.

Game Over

Game Over

The job of the game over script is just to display game over, so it's a pretty simple script really.

Score

Score numbers

The score numbers are used at the end of the game to display the score.

Challenges

Extension Challenges

Snake Game Cool Math Games

Complete the tutorial and want to challenge yourself to achieve more? Here are some ideas to improve your game:

Easy

  • Add some sound effects to your game
  • Include some background music in your game
  • Use a cool background instead of the boring white background I used

Medium

Scratch Programming Playground Zip File

  • Create a start screen for your game
  • Add small numbers that display the score in game.
  • Â Code a pause menu.

Hard

  • Adapt your game so that you can have 2 players instead of 1 player.

Very Hard

How To Make Snake In Scratch

  • Add a high score screen to your game using cloud variables.




broken image