Code Snake Game in Python

  Рет қаралды 20,816

Kenny Yip Coding

Kenny Yip Coding

Күн бұрын

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 😄!

Пікірлер: 56
@peaceandlovenz
@peaceandlovenz Ай бұрын
My first game complete. Took me 4 days working on it after work every night. Thanks was fun
@aracudas
@aracudas 9 ай бұрын
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
@tygaming-d6g
@tygaming-d6g 3 ай бұрын
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
@Pigeon1789
@Pigeon1789 17 күн бұрын
bro best coding channel on yt thank you
@marcobachini3130
@marcobachini3130 3 ай бұрын
Thanks! Interesting video and easy to follow 👍🏻
@KennyYipCoding
@KennyYipCoding 8 ай бұрын
Code Snake Game in Java: kzfaq.info/get/bejne/j5xigK2f3p-weJs.html Code Snake Game in JavaScript: kzfaq.info/get/bejne/mMdypJh4prKUj4k.html
@Doggy_Styles_Coding
@Doggy_Styles_Coding 9 ай бұрын
i kinda love that the tkinter symbol kinda fits
@philip3746
@philip3746 2 ай бұрын
Your explanations are always very clear and understandable. Do you plan on adding Python/Pygame game development in the future?
@Scarlazer
@Scarlazer 4 ай бұрын
very usefull tutorial, thanks a lot
@whoxwhat
@whoxwhat Ай бұрын
your videos are great... really very helpfull
@Ory25777
@Ory25777 4 ай бұрын
thx for the tutorial :D
@KalaKumari-sf1ps
@KalaKumari-sf1ps 6 күн бұрын
Thanks you! this video help me a lot
@ehverzy
@ehverzy 9 ай бұрын
how do you create the dimensions and squares that were already there?
@NikitaLazaroSevcisen
@NikitaLazaroSevcisen 3 ай бұрын
thank u for the tutorial
@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??
@RafL-jl3fr
@RafL-jl3fr 3 ай бұрын
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 3 ай бұрын
Check the completed code in the description to see what you’re missing.
@johnfinch3760
@johnfinch3760 5 күн бұрын
i know its a little late but in coding there is such thing as a `silent error`, meaning the code somewhat works but not in the way you want it, i had it happen to me.. - when i was writing the up, down, left, right code instead of putting a "=" sign i accident put a "-" sign. it did not flag up as broke code as it was written correctly, it just wasn't written correctly for what we was trying to code. if that makes an sense. --- however your problem may be with - cavas.draw_rectangle - try making sure that part of the code is correct.
@skatla
@skatla Ай бұрын
can you tell me how i can make the game restart using space when its game over?
@HARVEYRODGELLOPEZCARANZO
@HARVEYRODGELLOPEZCARANZO 2 ай бұрын
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?
@god_legend__6679
@god_legend__6679 8 сағат бұрын
Sir can you upload snake game project for Python IDLE
@SuneSensei
@SuneSensei 6 ай бұрын
For some reason borderwidth had no effect for me, I was using windows 11 too so I would have expected it to work.
@fl4281
@fl4281 9 ай бұрын
can u do the stick hero game next?
@Mr.ExclusiveMemes-qn3ll
@Mr.ExclusiveMemes-qn3ll 3 ай бұрын
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
@AnkitKadam-i7c
@AnkitKadam-i7c 4 күн бұрын
Tile is not working in move function
@besufikadabebe5581
@besufikadabebe5581 5 ай бұрын
why the background color isn't working for me? and centering the window too.
@KennyYipCoding
@KennyYipCoding 5 ай бұрын
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
@InternetTyrone
@InternetTyrone 14 күн бұрын
why does putting upper case T" instead of lower case t for "Tile" in line 66 matter. i see it prevents the sake from growing but why does it matter if we havent set up any variables that way prior
@KennyYipCoding
@KennyYipCoding 14 күн бұрын
the line number changes as more code is added throughout the video so I have no idea what you mean by "Tile" on line 66. Would help if you mention what time stamp youre looking at. But if I had to guess, it is probably the case that tile was defined somewhere if it worked, and by putting upper case T, as in Tile, you are creating another variable with a local scope.
@InternetTyrone
@InternetTyrone 12 күн бұрын
@@KennyYipCoding sorry kenny completly didnt factor in the lines sorry about that. but you answered my question that you
@SreelakshmiMyla-hp8vv
@SreelakshmiMyla-hp8vv Күн бұрын
I am getting type error of Tile() takes no arguments what can i do now please help me
@KennyYipCoding
@KennyYipCoding Күн бұрын
Maybe you didn’t define the constructor. Check the Tile class to see if it’s defined correctly. Definitely recommend trying to figure out where your error is coming from to improve your debugging skills. When watching coding tutorials, try to understand what the code is doing and backtrack a few seconds or minutes to see if you missed a step
@Kave-qp1yt
@Kave-qp1yt 2 ай бұрын
it doesnt center for me even if i copied the code in github
@WAPOOH
@WAPOOH 4 күн бұрын
why is my window.after not working
@Giga_funny_chats
@Giga_funny_chats 2 ай бұрын
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 2 ай бұрын
Fixed it. I changed the color of the snake to blue because it didn’t let me use „lime_green“ somehow
@Pigeon1789
@Pigeon1789 17 күн бұрын
@@Giga_funny_chats "its lime green" without the underscore
@skippertv1056
@skippertv1056 5 ай бұрын
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 5 ай бұрын
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 3 ай бұрын
@@KennyYipCoding i get the error keysym unknown word.
@kewnst
@kewnst 3 ай бұрын
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.
@Jordy699
@Jordy699 4 ай бұрын
how do i connect the strings_ ?
@anythingcraft7756
@anythingcraft7756 4 ай бұрын
no idea
@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
@Pokemonfrontpage2079
@Pokemonfrontpage2079 3 ай бұрын
bro on the 28th row how do you make that
@KennyYipCoding
@KennyYipCoding 3 ай бұрын
What do you mean?
@sieubuatv6389
@sieubuatv6389 4 ай бұрын
bro that key move in my vscode is shit
@Shawn_Gamer
@Shawn_Gamer 2 ай бұрын
the time in the bottom right corner is 3:00am?!
@KennyYipCoding
@KennyYipCoding 2 ай бұрын
Yesssir, working hard for you all 🙂👍🏻
@Jordy699
@Jordy699 4 ай бұрын
why u doing this shit at 3:50 AM
@clarissadonmaciel
@clarissadonmaciel 3 ай бұрын
i keep getting this error _tkinter.TclError: bad geometry specifier "625*625+455+119" when i try centering the window
@KennyYipCoding
@KennyYipCoding 3 ай бұрын
should be x and not *
@clarissadonmaciel
@clarissadonmaciel 3 ай бұрын
Thank you!
Learning pygame by creating Snake [python tutorial]
2:05:00
Clear Code
Рет қаралды 349 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 460 М.
Я обещал подарить ему самокат!
01:00
Vlad Samokatchik
Рет қаралды 7 МЛН
DAD LEFT HIS OLD SOCKS ON THE COUCH…😱😂
00:24
JULI_PROETO
Рет қаралды 16 МЛН
Эффект Карбонаро и нестандартная коробка
01:00
История одного вокалиста
Рет қаралды 10 МЛН
2 YEARS of PYTHON Game Development in 5 Minutes!
4:54
Coding With Russ
Рет қаралды 881 М.
Making a Game in Python with No Experience
5:57
Goodgis
Рет қаралды 1,6 МЛН
Create Snake with Python in 20 MINUTES!
22:59
baraltech
Рет қаралды 17 М.
Python Snake Game With Pygame - Create Your First Pygame Application
42:24
CODE WITH ME | Python Snake Game
15:36
CS Jackie
Рет қаралды 174 М.
Snake Game in Python Tutorial with pygame 🐍 (OOP)
1:08:52
Programming With Nick
Рет қаралды 9 М.
3 PYTHON AUTOMATION PROJECTS FOR BEGINNERS
17:00
Internet Made Coder
Рет қаралды 1,6 МЛН
Create Stunning Python GUIs in 10 Minutes With Drag & Drop
11:38
Coding Is Fun
Рет қаралды 35 М.
ASMR Programming - Coding a Snake Game - No Talking
24:06
Servet Gulnaroglu
Рет қаралды 631 М.
Java snake game 🐍
43:30
Bro Code
Рет қаралды 1,5 МЛН
Я обещал подарить ему самокат!
01:00
Vlad Samokatchik
Рет қаралды 7 МЛН