Learn How to Code a Classic Snake Game (Part 2 of 4)
Hey, this is Greg and welcome back to Part 2 of this 4 part programming learning series in which I show you How to Code a Classic Snake Game from Start to Finish in MIT Scratch. In part 1 of this series, we created our snake head, we set up some game flow variables, and we built out a grid-based movement system and a gameboard which can be dynamically-resized. So, if you want to check that out then I will link it up above and also in the comments down below, but now let's go ahead and continue on to part 2 where we are going to make sure our snake head rotates when it turns, we're going to set up a script for randomly placing food pellets on the screen at set intervals, we are going to tackle the problem of how to we add body segments to our snake and get them to follow our snake as it turns and moves around the board and we'll also get into things like detecting collisions and adding sound fx. Okay, so let's pick up we're we left off after part 1 and jump back into this fun coding project.
Some key moments in this video:
1:10 Getting the snake head to rotate
3:30 Randomly placing food for the snake to eat
4:42 The food placement strategy
6:00 The food placement code
9:20 Turning food placement into a custom block
13:28 Deciding when new food gets placed on screen
16:35 Adding Body Segments
17:34 Tracking Snake Movement with a List
18:11 More Game Organization via Custom Blocks
19:28 Tracking Body Segment Count
21:45 How do we know where to place new body segments?
25:35 Using the Position List + Segment Count to Determine new Segment Placment
37:20 Controlling Body Segement Movement
41:25 Broadcast vs. Broadcast and wait
42:50 Adding Sound FX
46:25 Adding Collisions and Game Over Conditions
56:42 Debugging Body Segment Position Glitch
Want to play a finished version of this game? https://scratch.mit.edu/projects/631302216/
Check out the other part of this Coding a Snake Game Learning Series:
Coding a Snake Game Part 1 -- https://www.youtube.com/watch?v=5ezXsDogFiU
Coding a Snake Game Part 3 -- https://youtu.be/JCVOItQNPr4
Coding a Snake Game Part 4 -- https://youtu.be/bHKqp6hcYuQ
Видео Learn How to Code a Classic Snake Game (Part 2 of 4) канала Learning With Greg
Some key moments in this video:
1:10 Getting the snake head to rotate
3:30 Randomly placing food for the snake to eat
4:42 The food placement strategy
6:00 The food placement code
9:20 Turning food placement into a custom block
13:28 Deciding when new food gets placed on screen
16:35 Adding Body Segments
17:34 Tracking Snake Movement with a List
18:11 More Game Organization via Custom Blocks
19:28 Tracking Body Segment Count
21:45 How do we know where to place new body segments?
25:35 Using the Position List + Segment Count to Determine new Segment Placment
37:20 Controlling Body Segement Movement
41:25 Broadcast vs. Broadcast and wait
42:50 Adding Sound FX
46:25 Adding Collisions and Game Over Conditions
56:42 Debugging Body Segment Position Glitch
Want to play a finished version of this game? https://scratch.mit.edu/projects/631302216/
Check out the other part of this Coding a Snake Game Learning Series:
Coding a Snake Game Part 1 -- https://www.youtube.com/watch?v=5ezXsDogFiU
Coding a Snake Game Part 3 -- https://youtu.be/JCVOItQNPr4
Coding a Snake Game Part 4 -- https://youtu.be/bHKqp6hcYuQ
Видео Learn How to Code a Classic Snake Game (Part 2 of 4) канала Learning With Greg
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
![How to EASILY post photos to Instagram from your Computer (Mac or PC)](https://i.ytimg.com/vi/wBDpCQfJDjo/default.jpg)
![Create Eye-Popping 3D Photos for Facebook in Minutes with Photoshop!](https://i.ytimg.com/vi/my5fsQy2nlw/default.jpg)
![How to Draw a Squirrel Speed Art in Photoshop (simulating a pencil sketch)](https://i.ytimg.com/vi/YxpXCKQiA3g/default.jpg)
![Canva Quick Start: Over 20 Super Useful Canva Tips, Tricks, and Tools!](https://i.ytimg.com/vi/H6chCxv-woU/default.jpg)
![How to Create Realistic Flames with Photoshop CC](https://i.ytimg.com/vi/pPt5umyGkJU/default.jpg)
![Easily Drawing Forests (or other stuff) on your Fantasy Maps with Photoshop's Puppet Warp Tool](https://i.ytimg.com/vi/IWNxvnf2xWk/default.jpg)
![Learn How to Code a Classic Snake Game (Part 1)](https://i.ytimg.com/vi/5ezXsDogFiU/default.jpg)
![How to Create the Ultimate Pinterest Template using Photoshop Layer Comps](https://i.ytimg.com/vi/CkiwExTjnVU/default.jpg)
![Editing Food Photography with Lightroom and Photoshop CC - What would Greg do? -- Episode 01](https://i.ytimg.com/vi/XUbBLfvh_Rg/default.jpg)
![How to Use Frames in Canva to Create Smart Reusable Templates](https://i.ytimg.com/vi/U26niNzh9-I/default.jpg)
![How to Edit a PDF with Canva (No Adobe Acrobat Required -- It's Easy!)](https://i.ytimg.com/vi/twGRUjspsss/default.jpg)
![A Master Tutorial on the Curvature Pen Tool in Photoshop and Illustrator](https://i.ytimg.com/vi/21PUDS0-Zeg/default.jpg)
![Quick Search Keyboard Shortcut in Canva: Forward Slash /Magic Timesaver!](https://i.ytimg.com/vi/QFbnN3gGxgY/default.jpg)
![Turning a Photograph into a cool animation with Plotagraph](https://i.ytimg.com/vi/tNEglFwG6NU/default.jpg)
![How to Create Custom Blocks (Functions) in MIT Scratch](https://i.ytimg.com/vi/HHaFK_jltZ0/default.jpg)
![The Easy 4 Step Method for How to Create a Book Cover for Amazon KDP or Any Publishing Platform](https://i.ytimg.com/vi/YCdEtZsVYHc/default.jpg)
![Texture vs. Clarity in Lightroom & Camera Raw: Which one is best?](https://i.ytimg.com/vi/NV6wkdXeLZw/default.jpg)
![11 Adobe Lightroom CC Tricks You Need to Know](https://i.ytimg.com/vi/z_WEIxdIPpA/default.jpg)
![Changing the Color of Anything in Photoshop: Part 2, Understanding RGB Color](https://i.ytimg.com/vi/NnrHU17laEA/default.jpg)
![Mastering Precision Edits with the Lightroom Range Mask Tool](https://i.ytimg.com/vi/4jm2Fsj11kQ/default.jpg)