

If you want it a little faster, change "10" to "15". If you like the snake's speed as it is, keep the change as 10, but if you want it a little slower, change "10" to "5". If you play your program right now, when you press the up arrow, your snake will move up on the screen. Grab a "change y by 10" block from the Motion drawer and connect it to the inside of the "if direction = up" block. Change "50" to "up" and drag your Direction variable into the blank space before the = sign. From the Operators drawer, drag a "_ = 50" block into the if block. Add an "if then" block inside the "forever" block. Replace it with a "forever" block from the Control drawer.
CLASSIC SNAKE GAME ADD 1 BLOCK CODE
"When down arrow key is pressed", "set direction to down", etc.).ĭelete the "move 10 steps" block from the code space. Connect the block to the "When up arrow key is pressed" block.ĭo the same for the other arrow keys (i.e. Take a "set direction to 0" block from the Variables drawer and type "up" in the place of "0". Drag a "When space key is pressed" block from the Events Drawer onto your code space. When a box pops up asking for a new variable name, type in "direction", and then hit OK. Go to the Variables drawer and click the "Make a Variable" button. Tip: Remember to repeatedly save your code by clicking the "Save Now" button on the top right of the screen that appears when you've added new code to the code space. The red stop sign next to it stops your program. The green flag above the viewing area, when clicked, runs your program. We'll be talking about sprites more in the next step. The bottom half is your sprite pane, where all the sprites you've created are displayed. The area most right of the screen is divided in half-the top half is your viewing area, where you'll see your code output. The most left side with all the code blocks is divided into sections based on functionality, and I'll be calling these sections "drawers." The section right next to the drawers is what I call the "code space." This is where we'll be dragging and connecting the code blocks together. When you're on the Code tab, there are three main sections that we'll have to worry about. The next tab over is the Sounds tab, where we'll be adding sound effects to our game. On the tab to the right, the Costumes tab, is where we will be drawing our game characters (the apple and snake). This will take you to a brand new project page.Īutomatically, the project page is on the Code tab, where we'll be dragging code blocks to actually make our snake game. Once you're logged in, click the Create tab at the top of the page, next to the Scratch logo. Sign in if you already have an account, or click Join Scratch at the top right to create a new account.

To create a new project on Scratch, go to. If you're interested in learning more, I'd recommend going to Scratch's Ideas page.
CLASSIC SNAKE GAME ADD 1 BLOCK FULL
Disclaimer: This isn't going to be a full out crash course on how Scratch works.
