Code Snake Game in Python

Поделиться
HTML-код
  • Опубликовано: 2 июл 2024
  • Python snake game! How to code a snake game in Python for beginners! Learn how to create a game of snake in Python using tkinter graphics library. Throughout the tutorial, you will learn how to create a graphical user interface (GUI) to display the Snake game, create the game loop, listen for Key presses to move the snake, use a list to store the snake's segments, and check collision and out of bounds for game over.
    Setup Python with Visual Studio Code:
    • How to set up Python o...
    Code: github.com/ImKennyYip/snake-p...
    Website: www.kennyyipcoding.com/
    Python Game Programming Projects Playlist:
    • Python Game Programmin...
    Java Game Programming Projects Playlist:
    • Java Game Programming ...
    JavaScript Game Programming Projects Playlist:
    • JavaScript Game Progra...
    Subscribe for more coding tutorials 😄!

Комментарии • 44

  • @peaceandlovenz
    @peaceandlovenz 20 дней назад +1

    My first game complete. Took me 4 days working on it after work every night. Thanks was fun

  • @tygtag7156
    @tygtag7156 2 месяца назад

    This was very useful, i took notes on how certain things work, and how to do them, it was so fun finally fixing a problem and then it working, i think I'm going to follow more of your tutorials

  • @aracudas
    @aracudas 8 месяцев назад +5

    did the whole thing in about two hours with no python knowledge. was great fun, but sometimes it takes some time to figure out, what certain things mean or why the large or lower case actually matters. but great video, i think i will go on with other ones on your channel

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

    Thanks! Interesting video and easy to follow 👍🏻

  • @Doggy_Styles_Coding
    @Doggy_Styles_Coding 8 месяцев назад +2

    i kinda love that the tkinter symbol kinda fits

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

    very usefull tutorial, thanks a lot

  • @Ory25777
    @Ory25777 3 месяца назад +1

    thx for the tutorial :D

  • @whoxwhat
    @whoxwhat 6 дней назад

    your videos are great... really very helpfull

  • @KennyYipCoding
    @KennyYipCoding  7 месяцев назад +2

    Code Snake Game in Java: ruclips.net/video/Y62MJny9LHg/видео.html
    Code Snake Game in JavaScript: ruclips.net/video/baBq5GAL0_U/видео.html

  • @NikitaLazaroSevcisen
    @NikitaLazaroSevcisen 2 месяца назад

    thank u for the tutorial

  • @ehverzy
    @ehverzy 8 месяцев назад +2

    how do you create the dimensions and squares that were already there?

  • @philip3746
    @philip3746 Месяц назад +1

    Your explanations are always very clear and understandable. Do you plan on adding Python/Pygame game development in the future?

  • @fl4281
    @fl4281 8 месяцев назад +2

    can u do the stick hero game next?

  • @skatla
    @skatla 21 день назад

    can you tell me how i can make the game restart using space when its game over?

  • @MrPotato1-jb5vw
    @MrPotato1-jb5vw 3 месяца назад

    at 25.22 it says to type a for command but now i cant run the code. im so confused??

  • @Mr.ExclusiveMemes-qn3ll
    @Mr.ExclusiveMemes-qn3ll 2 месяца назад

    how to really start learning programming with python ? no matter if i just like to make a game or try to change my future work etc

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

    Amazing tutorial and everything worked out. I tried changing the background with a custom photo, I watched different kinds of tutorials but It just doesn't work. Can someone help please?

  • @SuneSensei
    @SuneSensei 5 месяцев назад

    For some reason borderwidth had no effect for me, I was using windows 11 too so I would have expected it to work.

  • @RafL-jl3fr
    @RafL-jl3fr 2 месяца назад +2

    Everything was fine until the snake head and food! For some reason the snake head didn’t show up when I ran it, but there were no bugs, I said oh well and done the food too just to see if it would show then, no food and no snake head! Idk how

    • @KennyYipCoding
      @KennyYipCoding  2 месяца назад

      Check the completed code in the description to see what you’re missing.

  • @besufikadabebe5581
    @besufikadabebe5581 4 месяца назад +1

    why the background color isn't working for me? and centering the window too.

    • @KennyYipCoding
      @KennyYipCoding  4 месяца назад +1

      you have a typo somewhere or you missed something. I also have the completed code in the github link in the video description if you need a closer reference

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

    I‘m currently at minute 28 but when my snake eats the food, it just stops moving and I can‘t get it to move anymore. The food disappears and appears somewhere else. Why does my snake stop?

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

      Fixed it. I changed the color of the snake to blue because it didn’t let me use „lime_green“ somehow

  • @Kave-qp1yt
    @Kave-qp1yt Месяц назад

    it doesnt center for me even if i copied the code in github

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

    how do i connect the strings_
    ?

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

    Good tutorial Im stuck here on moving the snake
    im getting this error
    'Event' object has no attribute 'keysym'
    on the change_direction method

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

      Could be a typo somewhere, I left the completed code link in the video description if you want to compare line by line

    • @kewnst
      @kewnst 2 месяца назад

      @@KennyYipCoding i get the error keysym unknown word.

    • @kewnst
      @kewnst 2 месяца назад

      and i re wrote it like 5 times and used ur code inplace and stil cant get passed it lol ^^^^^^^^^^^^^^^^
      File "c:\Users\jeremy\snake.py", line 39, in change_direction
      if (e.KeySym == "Up"):
      ^^^^^^^^
      AttributeError: 'Event' object has no attribute 'KeySym'. Did you mean: 'keysym'?
      Exception in Tkinter callback
      Traceback (most recent call last):
      File "C:\Users\jeremy\AppData\L
      AND YEs i tried even capitolizingi t. nothing makes a diference. all lower or capitolizing doesnt matter.

  • @POKIplays2079
    @POKIplays2079 2 месяца назад

    bro on the 28th row how do you make that

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

    cant code a reset... can anyone help?

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

      you basically need to reset the variables to the original starting values and change game over boolean back to false

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

    the time in the bottom right corner is 3:00am?!

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

      Yesssir, working hard for you all 🙂👍🏻

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

    bro that key move in my vscode is shit

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

    why u doing this shit at 3:50 AM

  • @clarissadonmaciel
    @clarissadonmaciel 2 месяца назад

    i keep getting this error _tkinter.TclError: bad geometry specifier "625*625+455+119" when i try centering the window