Snake Game in Scratch 3.0 | Scratch 3.0 Game Tutorial | How to Make Games

Поделиться
HTML-код
  • Опубликовано: 7 сен 2024

Комментарии • 1 тыс.

  • @CodingWithChris
    @CodingWithChris  3 года назад +133

    A lot of people have mentioned there was a problem with length. I believe I did not reset it. Make sure you set length to 0 in the beginning ;)

    • @jiconic3233
      @jiconic3233 3 года назад

      @@alpeshpatel6486 yes

    • @shakysheikh3539
      @shakysheikh3539 3 года назад +4

      try when clicked flag
      set lenght 0

    • @thehannahs6055
      @thehannahs6055 3 года назад +2

      This coding with Chris is amazing, once I have all of my games has been gone and now coding with Chris he helped all of my games come back thank you chris

    • @TanishTalks7541
      @TanishTalks7541 3 года назад +2

      i can become coder with this channel

    • @eaglemation213
      @eaglemation213 3 года назад +2

      frick

  • @emmafinazzi7503
    @emmafinazzi7503 3 года назад +121

    you just saved me from failing my class

  • @JustFinishedCoding
    @JustFinishedCoding 4 года назад +137

    In case anyone wants to add an eye to the snake, here's what you can do:
    1. Go to the snake costume and create a new costume, "eye" with two dots on the circle.
    2. Within the "When Green Flag Clicked" in the snake code, add a "switch costume to 'eyes' "
    3. Within the "When I start as a clone" code, add a "switch costume to costume-1 (the costume without eyes)"
    That'll make sure your head has eyes. In case you're facing overlap issues, add a "go to back layer" to the "When I start as a clone" script. This will ensure that the eyes always stay on top.
    Hope this helps!

  • @sampostsrandomstuff
    @sampostsrandomstuff Год назад +11

    If you want to make the game stop when it touches an edge, put a new "When green flag clicked block". Then add a "forever loop" and put an "if < > then" inside it. Then inside of the < > put a "touching mouse pointer?" but change it to "touching edge?". Then inside the if then block, add a stop all!

    • @knoxy5252
      @knoxy5252 Год назад +1

      is there a way to make it end if it touches the snake again as well?

  • @Peach_Peachy
    @Peach_Peachy 3 года назад +152

    Everyone gangsta until the teacher asks "Can you tell me how you made it?"

    • @mayonera904
      @mayonera904 3 года назад +1

      Ooo this will be my answer....”well I know someone who used this website and created some really good games which I couldn’t at all since all the coding was everywhere and it was my year with this class even tho I was interested only into games ;-;. But yes he helped me and now he graduated last year and is joe in this company working for more coding :)”

    • @Peach_Peachy
      @Peach_Peachy 3 года назад +1

      @@mayonera904 Lol I would probably say oh first I used the green flag clicked block then- I would tell the literal process

    • @maisha5049
      @maisha5049 3 года назад

      Lol true

    • @mayonera904
      @mayonera904 3 года назад +1

      @@Peach_Peachy wait but don’t the teacher already know how to work it since it’s your teacher ..?

    • @Peach_Peachy
      @Peach_Peachy 3 года назад +1

      @@mayonera904 welllll My teacher asks so

  • @FinnBot_Technologia
    @FinnBot_Technologia 2 года назад +16

    There is a bit of a better way to do the movement. Set the direction to the actual numbers (0 = up, 90 = right, 180 = down, 270 = left) and instead of adding the 'if's, you can do (point in direction 'variable direction' and then move '5' steps). That gets rid of all the 'if's and makes the code a bit more compact.

    • @Wondercool923
      @Wondercool923 2 года назад

      That's exactly what I was thinking

    • @SoulLexx
      @SoulLexx 2 года назад +2

      Did u know
      That maybe
      Making ur own tutorial
      Is better?

    • @qk7x
      @qk7x Год назад

      @@SoulLexx what

    • @SoulLexx
      @SoulLexx Год назад

      @@qk7x that was 4 months ago
      go away noob

    • @qk7x
      @qk7x Год назад

      @@SoulLexx oldest scratch user:

  • @Darsh007Spartan
    @Darsh007Spartan 4 года назад +2

    Instead of using set direction to right just at the start (as the snake must be moving) we can use set direction to 0 (as the snake won't be moving at the start) and we can also make the snake die whenever it touches the edges and colliding into itself (as the real snake game)
    Btw nice game to play and is very addictive :p

    • @jamikhabir492
      @jamikhabir492 4 года назад

      Poetry Dragon - Text Adventure Game!
      repl.it/talk/share/Poetry-Dragon-Text-Adventure-Game/51211

  • @rabeeaaaa
    @rabeeaaaa 4 года назад +34

    How do I make the snake "die" when it touches itself?

    • @CodingWithChris
      @CodingWithChris  4 года назад +10

      One way would be having different color for head and body and check when they collide. But you should make sure the body is not attached to the head. Hope it helped ;)

    • @Ishandapro
      @Ishandapro 3 года назад +1

      @@CodingWithChris How do I make the head not touching the body?

    • @awzflyhigh4795
      @awzflyhigh4795 3 года назад

      @@CodingWithChris yes how to

    • @awzflyhigh4795
      @awzflyhigh4795 3 года назад +1

      I KNOW check my project scratch.mit.edu/projects/469081213/
      basically when you create a clone move 7 steps in ur current direction
      also make it so that u change x or y by 1 or -1 when u click WASD or up down left right
      then make a new costume for the clones and change its color
      then when touching that color make it die
      idk if u can change proportions

    • @utaschmidtblaicher3952
      @utaschmidtblaicher3952 3 года назад

      @@CodingWithChris it did not work search up snaaaaaaaaaaaaaaaaake

  • @chanelloavrao
    @chanelloavrao 3 года назад +1

    I love the project soo much and l have done it in my laptop

  • @-thetacocat-
    @-thetacocat- 2 года назад +4

    In the original game, you couldn't turn in the opposite direction that you were facing so what I did was "When up arrow key is pressed, if direction=down, blank, else, set direction to up."

    • @retrochronic44
      @retrochronic44 Год назад

      Can you make that line of code in scratch hat's difficult to understand reading

    • @retrochronic44
      @retrochronic44 Год назад

      Never mind, I figured it out

  • @duyanga3213
    @duyanga3213 4 года назад +1

    wow nice

    • @WinPeck
      @WinPeck 4 года назад +1

      Uyanga Maya yeah it is nice

  • @TallImpaired
    @TallImpaired 4 года назад +3

    i just got a apple from the sprite selection for the food this is so helpfull!

    • @CodingWithChris
      @CodingWithChris  4 года назад

      Drew Banks yeah that works too, thx for watching ;)

  • @smrizwan8164
    @smrizwan8164 4 года назад +1

    i can not believe my project had 300 loves thankyou very much coding with chris because of you i had 300 loves in the snake game project that i shared i made it with this tutorial thankyou very veryyyyyyyyyyyyyyyyyyyy much

  • @anastazijazajac5374
    @anastazijazajac5374 3 года назад +9

    I did this whole thing on my laptop and it worked! Thank you so much! Keep on making these types of vids! You did awsome!

    • @ambush-t3i
      @ambush-t3i Год назад

      did you right and left break bc mine did

  • @LiamMarks-ni3sb
    @LiamMarks-ni3sb Год назад +1

    this is awesome

  • @ttfarahani8517
    @ttfarahani8517 4 года назад +4

    Very helpful that got me my grade for computing but how do I make the wall and for the snake to disappear aka die

  • @pranavpratiknatarajan6782
    @pranavpratiknatarajan6782 4 года назад +2

    Great Job

    • @WinPeck
      @WinPeck 4 года назад +1

      PranavPratik Natarajan he did great

  • @V--ec7do
    @V--ec7do 3 года назад +6

    Cool tutorial! We followed it in our coding class.

    • @CodingWithChris
      @CodingWithChris  3 года назад

      Oh awesome ;) thx

    • @vicwin5716
      @vicwin5716 2 года назад

      Me too

    • @vicwin5716
      @vicwin5716 2 года назад

      @@CodingWithChris Can you make multiplayer snake game on scratch with cloud vars

  • @sankalpgupta8359
    @sankalpgupta8359 3 года назад +1

    very nice and interesting game

  • @hellothere-wc5qm
    @hellothere-wc5qm 3 года назад +4

    This is the first time a game tutorial actually works, thank you for making it simple and easy

  • @Marken-11-11
    @Marken-11-11 2 года назад +1

    Great video

  • @shammu1007
    @shammu1007 2 года назад +3

    Thanks Chris we did the snake game and enjoyed !

  • @heztekcoding
    @heztekcoding 2 года назад +2

    thanks a lot, I can made this nice with score and sound

  • @nethmal1204
    @nethmal1204 4 года назад +4

    thank u very much man.pls keep it up ur good things.Love from Sri Lanka.

    • @CodingWithChris
      @CodingWithChris  4 года назад +1

      Thank you very much for watching ;) appreciate your support

    • @nidhinadira4532
      @nidhinadira4532 Месяц назад

      The sussiest language in sri lanka XD

  • @PrestonArestment
    @PrestonArestment Месяц назад

    Thanks for saving me from a dangerous moments😂

  • @adamgallagher5688
    @adamgallagher5688 4 года назад +4

    great tutorial it really helped and I think you forgot to add a chomp sound effect to the steak

  • @jaisharma5ano.3kavyasharma76
    @jaisharma5ano.3kavyasharma76 3 года назад +1

    Thanks
    You are the best for teacher for scratch
    You will make better future for childrens❤️
    ❤️❤️❤️❤️

  • @noldi268
    @noldi268 2 года назад +9

    Hi Chris, great tutorial, thank you! Is there a way I can program so the game stops when the snake "eats" itself? I have tried it with different colours but it didnn't quite work for me. Thank's

    • @javajuices6357
      @javajuices6357 Год назад +3

      Thats what I was also thinking. I don't think there's a way to ask [if touching snake?]

    • @MinecraftContent5
      @MinecraftContent5 10 месяцев назад +3

      I was thinking the same thing

    • @sarastimeyea1948
      @sarastimeyea1948 3 месяца назад

      Omg I thought the sameee

  • @arkopalroychowdhury7451
    @arkopalroychowdhury7451 4 года назад +1

    THANK You for making this gaming 🥰🥰🥰
    I HOPE YOU WILL MAKE MORE GAME LIKE THIS

  • @evonne3338
    @evonne3338 3 года назад +7

    THIS HELPED ME WITH MY ROBOTICS SUBJECT THANK YOUUUUU

    • @hasnatiki2024
      @hasnatiki2024 3 года назад +1

      Mee tooo!!!

    • @wicked8752
      @wicked8752 3 года назад

      What is your teachers name?

    • @evonne3338
      @evonne3338 3 года назад

      @@wicked8752 I'm from Philippines :)

    • @evonne3338
      @evonne3338 3 года назад

      @@wicked8752 Are you?

    • @wicked8752
      @wicked8752 3 года назад

      @@evonne3338 nope

  • @sharonshar0n
    @sharonshar0n 2 года назад +1

    YOUR CODING ARE AMAZING

  • @puppetact
    @puppetact 3 года назад +4

    Awsome video as always and thxs for making a snake game I have been wondering how to make them on scratch and now I know so thxs chris 🤟🤩👍

  • @tathilaacademy1565
    @tathilaacademy1565 2 года назад +1

    You are the best teacher i have got

  • @benjy8722
    @benjy8722 2 года назад +3

    Love this, but how can I make the game end if the head of the snake touches his clones

  • @emmafinazzi7503
    @emmafinazzi7503 3 года назад +1

    I've never loved someone this much in my life :)

  • @noeliispro2504
    @noeliispro2504 4 месяца назад

    Hello 👋🏼 Coding With Chris I loved this video 📷 it helped me a lot in my technology class I passed my class because of this thank you a lot for Making this video ❤️:)

  • @bignoob5462
    @bignoob5462 4 года назад +6

    i use python instead as it gives me more practise for other coding languages and as long as i can do graphic design on python well, then i can make this game way more customisable just by myself. btw great turtorial!

    • @samahirzaib5199
      @samahirzaib5199 Год назад

      hi can you tell me how to reset the length after game stops

  • @BlackpinkLover32684
    @BlackpinkLover32684 Год назад +1

    its so good i like it

  • @brandonricciulli1175
    @brandonricciulli1175 2 года назад +3

    I have a question, how do you make the game over if you hit youself, like in google snake?

  • @farahiah1
    @farahiah1 16 дней назад +1

    my snake is getting longer lolzz..thanks though for teaching me this

  • @Bon7733
    @Bon7733 4 года назад +6

    I like the tutorial so much

    • @CodingWithChris
      @CodingWithChris  4 года назад

      Thank you very much for watching and nice comment ;)

  • @Hello_World418
    @Hello_World418 Год назад

    Instead of going throughh so much trouble to make the steak go to a random posittion, I suggest just using the 'go to (random position)' block.
    Also, the way of making the snake move in a particular direction is also inefficient. Instead of changing variables, I would strongly suggest using:
    Eg. making the snake move up:
    when green flag clicked
    Repeat forever
    If
    Point in direction (90)
    (If loop closed)
    Move (5) steps
    (Repeat forever loop closed)

  • @OrcaTheDorka
    @OrcaTheDorka 4 года назад +4

    This WORKED OMG no way chris you are awesome

    • @Peach_Peachy
      @Peach_Peachy 3 года назад

      @Jacob Liu He is speaking hindi its my Native language so I will translate it for you:
      I have made a new game

  • @sshrivastava26
    @sshrivastava26 3 года назад +1

    very nice love 😍 it.

  • @beepusballs
    @beepusballs 3 года назад +7

    Bro thank you so much for this video, you're a real lifesaver. I had a homework where we had to make a game on Scratch 3.0 and this has helped me out a lot!! I subscribed with notifications on BTW.

    • @seastarlit4134
      @seastarlit4134 2 года назад

      Yeah we definitely had the same teacher

    • @asapeinlovingscience6650
      @asapeinlovingscience6650 2 года назад +1

      @@seastarlit4134 I am in a IT group and I have to show them to make a game so its kinda my assignment

    • @sarastimeyea1948
      @sarastimeyea1948 3 месяца назад

      @asapeinlovingscience6650 same

  • @nicosvlogofinfinity1176
    @nicosvlogofinfinity1176 Год назад +1

    This is a great game you made. I will try to make it too👍

  • @justannie4987
    @justannie4987 4 года назад +3

    Very helpful! 😄

  • @Cobrapollo1
    @Cobrapollo1 3 года назад +1

    THAT WAS AN EPIC STEAK

  • @nigelewington7721
    @nigelewington7721 4 года назад +12

    i love thissss its AMAZING imsoo glad you made a vid for this eeek im so exited

    • @nilkanthshinde317
      @nilkanthshinde317 4 года назад

      Me too, and you help me a lot to inspire my family 😃

  • @Nino-ne3kl
    @Nino-ne3kl 4 года назад

    Cool video

  • @liammurawski9133
    @liammurawski9133 3 года назад +4

    the only problems are, for example if you are going right, you are able to press left and go inside yourself, also you can hit yourself and be just fine. Good base project tho.

    • @theraccoon1246
      @theraccoon1246 Год назад

      when left arrow key pressed
      if not direction = right then
      set direction to left

  • @HShardzEdits
    @HShardzEdits 3 года назад +1

    did this for my exam thank you so much

  • @ggblazing_yt3844
    @ggblazing_yt3844 4 года назад +3

    sooo helpful!!

  • @mr.tech_high6419
    @mr.tech_high6419 3 года назад

    Great

  • @padmapriyam7964
    @padmapriyam7964 4 года назад +5

    Wow , it's easier than I thought .. thank you for giving me an idea 🙏

  • @rekhasadhukhan7331
    @rekhasadhukhan7331 Год назад

    🤟Awesome

  • @temiloluwamakinde5290
    @temiloluwamakinde5290 4 года назад +4

    Coding with Chris, I like the way you drew your steak.

    • @CodingWithChris
      @CodingWithChris  4 года назад +1

      TEMILOLUWA MAKINDE haha, I’m not a good artist but that kinda turned out well yeah. Thx for the comment and watching ;)

    • @lasercatto
      @lasercatto 4 года назад

      @@CodingWithChris Hehe, I though it was a weird apple :D

  • @nadeemm6228
    @nadeemm6228 2 года назад

    Very nice

  • @iammrsushi7343
    @iammrsushi7343 4 года назад +4

    Great video! but i have a question. A variable always has to be defined by something right? For example when you made the variable direction made it equal to "Left" you assigned the left key to that. Which makes direction left, equal to the left arrow key. But when you made the variable "length" im so confused, you didn't assign it to anything. How does the variable work if you didn"t assign it a value?

    • @CodingWithChris
      @CodingWithChris  4 года назад +3

      That’s a good catch. I should have set the length to zero after clicking green flag.

    • @Twinkle_is_a_person
      @Twinkle_is_a_person 2 года назад

      Hmm. I DID have a bug before I reset it, so I don't know why it works.

    • @TheeAztechPrincess
      @TheeAztechPrincess 2 года назад

      When green flag is clicked, then add the length variable set to 0. Above the set direction That worked for me!

  • @itsyaboizakyree
    @itsyaboizakyree 2 года назад +1

    your videos help so much with my coding class thank you so much my grade is so high

  • @haydaral-samawe7514
    @haydaral-samawe7514 4 года назад +6

    Thanks for the amazing begginer game! ill see more vids from u to do more in scratch bc you are understandable

  • @krishaajagiya7275
    @krishaajagiya7275 3 года назад +1

    Thank uhh soooo much It helped me a lot .... I also created my own game thank u once again

  • @Dr4qon
    @Dr4qon 4 года назад +38

    Can you do "go to random position" for the food?

    • @CodingWithChris
      @CodingWithChris  4 года назад +15

      WackoRobin7485 that’s definitely the easier and more efficient way to go. But I was also trying to show how it can be done with operators. But thx for pointing out . Pinning this ;)

    • @Dr4qon
      @Dr4qon 4 года назад +3

      Thanks! I did not understand at first because I am new to scratch, but I am starting to get the idea now.

    • @TallImpaired
      @TallImpaired 4 года назад

      probably that makes sence!

    • @ummmwilliam
      @ummmwilliam 4 года назад

      @@Dr4qon i was about to comment the same thing but then i saw your comment

    • @wariothief
      @wariothief 4 года назад

      Coding With Chris how do i die

  • @MoNo-uv7qc
    @MoNo-uv7qc 3 года назад

    Thank u very much for this tutorial

  • @deekshaastalents3282
    @deekshaastalents3282 3 года назад +3

    I love it but instead of drawing the apple u can just take it as a sprite in the Foods section

  • @rinaakther2783
    @rinaakther2783 3 года назад

    this is usefull because i will do a game my self with whole class and i can get a head start

  • @siimplypxstelroadto250subs8
    @siimplypxstelroadto250subs8 2 года назад +3

    At first I thought this was complicated but TRUST me this is so helpful. Tysm it means a lot

    • @simplykikiYT
      @simplykikiYT 2 года назад

      Haiiiiii I watch ur vids lol I code on scratch too!

  • @GalaxyGamer-wm7oh
    @GalaxyGamer-wm7oh 2 года назад

    This project helped me with another project I am making

  • @grilledcheeseanimations3582
    @grilledcheeseanimations3582 3 года назад +10

    ayo who else is watching his tutorials to inpress there teacher

  • @beanslover957
    @beanslover957 2 месяца назад +1

    YOU ARE AMAZING!!!

  • @klara9983
    @klara9983 4 года назад +3

    i just made one but everytime my snake get longer and then i start over the snake is the same length as i stopped at?

    • @CodingWithChris
      @CodingWithChris  4 года назад

      Klara remember to reset length to 0 when you click green flag ;)

    • @xl_bxseplayer_lx7622
      @xl_bxseplayer_lx7622 4 года назад

      Coding With Chris how

    • @nelew3003
      @nelew3003 4 года назад +1

      @@xl_bxseplayer_lx7622 variables -> set (length) to 0

    • @sherin1188
      @sherin1188 4 года назад

      @@nelew3003 I cant find set length I can see set direction

    • @mousumipaul5350
      @mousumipaul5350 3 года назад

      @@sherin1188 select 'length' from the drop down list by left clicking on the 'direction' option there

  • @rakshitthegamer5463
    @rakshitthegamer5463 3 года назад

    Thank u I needed it for school

  • @ChrisCutler73
    @ChrisCutler73 4 года назад +4

    he said im gonna wait a while
    0.1 secs
    hahahha

    • @CodingWithChris
      @CodingWithChris  4 года назад +1

      Chris Cutler haha I need to think before I speak ;)

  • @sharekhanna141
    @sharekhanna141 3 года назад +1

    I can only move left and right...but you're great!

  • @botquinn
    @botquinn 4 года назад +3

    Hello Chris! I've watched your video trying to make a simple snake game for fun. I've followed everything you've done in the video, but the one problem is, before I even touch the food in which you should eat to gain length, I'm already gaining length. (better explanation ; 6:20 to 6:30) Do you know how to fix this? Hope you respond. Thanks!

    • @CodingWithChris
      @CodingWithChris  4 года назад

      Hey there. Well that could only mean your if block had a problem. Make sure you change length only if touching food . Good luck ;)

    • @Tricke432_YT
      @Tricke432_YT 2 года назад

      @@arshia8769 with an if then block duh

  • @adyadas3116
    @adyadas3116 3 года назад +1

    i was thinking when u make it multi player and put it as a tutorial pls make the big snake is able to eat smaller snakes and obstacles on it way wich if u touch will decrese ur length

  • @one_acheinya
    @one_acheinya 3 года назад

    Nice video inspirational

  • @handaruali6310
    @handaruali6310 3 года назад +1

    your game is very good. I like it

  • @khushbukatoda347
    @khushbukatoda347 4 года назад

    best i have created the same thnks alot

  • @SantoshKumar-zu9yi
    @SantoshKumar-zu9yi 3 года назад

    Nice

  • @Twinkle_is_a_person
    @Twinkle_is_a_person 2 года назад +1

    Oh! And also I really liked this tutorial and I really, REALLY want you to post a multiplayer snake game! I will make it so that you can play snake with the computer, since I don't know how to make a multiplayer game.

  • @kamilahmerchant9108
    @kamilahmerchant9108 3 года назад +1

    Thank u so much sir very easy and efficient

  • @bsksongs
    @bsksongs 3 года назад

    you are really really a hard worker i am saying the truth

  • @yaqiangzhu847
    @yaqiangzhu847 Год назад

    it's reallynice

  • @armoshiri2556
    @armoshiri2556 2 года назад

    Really cool , Thanks A LOT ! you teach SUPER COOL AND EASY how to make games on Scratch , THANK YOU ! 😃😃😃😃😃😃😃😃😃

  • @sparkysport1697
    @sparkysport1697 3 года назад

    nice tutorial

  • @antotech2867
    @antotech2867 3 года назад

    i like your videos super

  • @deeznutprojects3232
    @deeznutprojects3232 3 года назад

    cool it's very helpful

  • @Journey_with_Nature
    @Journey_with_Nature 7 месяцев назад

    It was a very nice tutorial !!

  • @8thd76parthshingte8
    @8thd76parthshingte8 2 года назад

    very nice bro

  • @anvipro7548
    @anvipro7548 3 года назад +2

    Thanx @Coding with Chris for this video BTW we want a multiplayer snake game if possible.

  • @kingsleyegbowawa2639
    @kingsleyegbowawa2639 2 года назад +1

    very creative thanks chris

  • @atar_games7386
    @atar_games7386 2 года назад

    We were working on this instant thank you for saving my life

  • @robloxplayzz2451
    @robloxplayzz2451 2 года назад

    IN 3 words OMG!!! it really works

  • @pareshmandal9091
    @pareshmandal9091 2 года назад

    Cool

  • @sharonshar0n
    @sharonshar0n 2 года назад

    THIS WORKED THANK YOU SO MUCH

  • @rekhasadhukhan7331
    @rekhasadhukhan7331 Год назад

    Really awesome and creative 😄😄😄👏👏👏

  • @nidulyaherath8804
    @nidulyaherath8804 3 года назад +1

    I'm really excited 😚😚😚thank you....

    • @ultraworld5789
      @ultraworld5789 6 месяцев назад

      i love you soooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

  • @MEGAOneX
    @MEGAOneX Год назад

    its amazing

  • @therainbowpixie9535
    @therainbowpixie9535 2 года назад

    you help me with scratch so much tysm