Snake Game in Python Tutorial with pygame 🐍 (OOP)

preview_player
Показать описание
Python snake game code tutorial example explained

Are you ready to take on the challenge of creating your very own Snake game? In this tutorial, I'll be guiding you step-by-step on how to build your very own Snake game using the Python programming language and the Pygame library with Object Orient Design. We'll start with the basics and work our way up to adding some cool features and making the game look more exciting.

Previous Tutorials (Watch in the following order)

0:00 Intro
0:50 Installing Pygame
2:50 Create a blank screen
12:35 Create the food
23:51 Create the snake
27:34 Move the snake
43:09 Make the snake eat the food
47:50 Make the snake grow
51:03 Checking for collisions
59:05 Adding title & Frame
1:04:27 Adding Score
1:06:25 Adding Sounds

#python #snake #games
Рекомендации по теме
Комментарии
Автор

I hope you took away lots from this video. Let me know below!
PS: I'm creating an OOP course! Sign up at for early access and a 50% launch discount.

programmingwithnick
Автор

Thank you for this tutorial. I found it useful and clear for beginners. Following your tutorial, I wrote my first game. Not too simple, not too difficult. The golden average of complexity with nice comments. Thank you.

tmmlcuj
Автор

This is the best YouTube channel for beginners🎉

pariskgabo
Автор

Thank you Nick for your tutorial, clearly the best one on this topic one could find! You are a great teacher. Well done!

ericleboullenger
Автор

Best tutorial out there, very underated content...

moadhoueslati
Автор

Impressive tutorial, good visualization, good sound, excellent explanation that I have seen with subtitles in Spanish. And everything explained step by step, thank you very much for all the time invested in this wonderful tutorial, I am looking forward to seeing the next one. 👍

manuelgarciagarcia
Автор

I have just completed your tutorial and I want to Thank You a Lot... easy to follow, a lot to add to my new python brain and perfect for keeping experimenting.. Thanks a lot.

rcpassionate
Автор

I just love your tutorials. You are great

oldnight
Автор

Nick, this was great. Thanks for helping me better understand Pygame and OOP!

lawrencejonesdesign
Автор

Very good tutorial. Thank you for sharing.

MNNocete
Автор

This is by far the best tutorial for this type of content Ive seen so far on youtube. Im just randomly wanna see how other people code, it makes my mind relax after long hours of coding at work lmfao Ironic.

Xarxes
Автор

BRO GOOD CONTENT❤I like your video DO PLEASE More video because its really good❤

iuliuS_o
Автор

An amazing tutorial, very useful. But I was running into a problem detecting collision between the food and the snake.
This is my code:

# Update Function- updates the game
def update(self):
self.snake.update()


# Collisions / eating
def
if self.snake.body[0] == self.food.position:
self.food.position =

when the snake would "eat" the food it wouldnt do anything. the snake will just hover over the food and not eat it. pls help!!!

notsneazy
Автор

How can i downlaod the same image of food as yours?

fatimashoaib
Автор

Hi. Very nice tutorial.
I noticed one thing. Lets say snake is moving to the right direction and if you press quickly down followed by left arrow then snake will change direction straight from right to left.
Curious how would you fix that bug ?

HalcGaming
Автор

I first want to TYVM for this tutorial. But I can't seem to get a game over text to appear I have it defined like we did the title and score but when game_over() no text appears I was trying to write GAME OVER then under it PRESS ANY KEY TO CONTINUE. also I tried to put some music so it not so quiet I got the music to play but it so loud you can;t hear the other 2 mp3's I tried the volume(0.1) but it did not seem to work it was still the same sound level as I never use that part of code
could you maybe do an extra chapter for this game with what I was trying to implement?

rtester
Автор

Hi. I am having position attribute error on line 17… food_rect o don’t understand where this error is coming from. Position is a reference to self.position =vector2 (5, 6)

milesonwheels
Автор

So, new position of food is simply random? It's ok in the, lets say, first half of the game. But when snake will grow really long, what then? Imagine the situation when snake is 615 tiles long and there is only 10 free blocks. For how long program will hang on the function food.generate_random_pos? And it will be worse with each eaten food.

Darkomen
visit shbcf.ru