Загрузка страницы

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
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
20 мая 2022 г. 21:15:01
01:00:04
Яндекс.Метрика