Slight correction at 0:03:12 the text at the bottom is supposed to say python 3.9 not pygame 3.9
@hariharanthegreat55763 жыл бұрын
Can you give link to assets you used here
@ClearCode3 жыл бұрын
@@hariharanthegreat5576 check the video description, there is a link to all the files :)
@aarushpal37363 жыл бұрын
you are so sensitive to your mistake love it xD :->
@jakelanghel89173 жыл бұрын
do you hav a link to all the graphics you used??
@jakelanghel89173 жыл бұрын
nvm I didn't notice the github link lol thank you.. I've been trying to teach myself how to program and this is by far one of the best tutorials I have found for free!!! super detailed and you explain everything!! alot of other tutorial I felt like I was just copying what they were doing but not rly understanding why im doing it!! thanks again
@marnierogers39312 жыл бұрын
If anyone is new here and gets stuck around the 40min mark returning an attribute error. Try adding a double underscore before and after __init__. I just learnt a looooong lesson that I'll now never forget! haha
@kafactz7710 Жыл бұрын
Thanks bro
@BonkySonky4 ай бұрын
this does nothing
@rad0stinАй бұрын
@@BonkySonky You have to put 2 underscores, not 1 or it will not work
@mixlaproduction3 жыл бұрын
I just found out your stuff. I was blown away by the amount of detail and effort you put into your videos! Your channel seems golden! Can’t wait to watch all your python game-developing related videos. Keep up with those awesome simple projects! 😎
@uiebwuiowebuiopwebfoipbewfoip3 жыл бұрын
yor channel is INSANELY underrated. I've seen many pygame tutorials yet I only understood 100% of what I was told is in your video, you explain everything so in depth and stop at every line of code to explain. You give examples and even show little animations to show us what you're trying to say. 10/10 keep it up man
@zagrajzguru2 жыл бұрын
This
@UniquelyMadeIAm Жыл бұрын
This is so true!!! Keep making these please
@flippingflipbooks5653 жыл бұрын
I am currently learning Python, but I don't know ANYTHING about pygame! I really wanted to learn it: My main motive for learning programming was to make games! You are the best person for me to help me learn. You add in litte bits of humor, so your vids aren't just plain coding. I really think that you are the best!
@uskumru31062 жыл бұрын
Python is realy bad choice if you want making game
@user-hx1lp6fc9r Жыл бұрын
Hey friend! How did it go for you?
@No3inator Жыл бұрын
yeah after learning python you can easily start using Godot using gd script which is 90% similar to python because python just has many bad things in game development which you cant avoid
@Bluemoon_wav Жыл бұрын
@@No3inator could you tell me in a broad way what those "bad things" are?
@jeremyhubaker1199 Жыл бұрын
IF YOU REALLY WANT TO MAKE GAMES THEN YOU NEED TO LEARN C++ ,C#, JAVA YOU WILL BE LIMITED WITH PYTHON AS IT IS BETTER SUITED FOR DATA MANIPULATION AND BACK ND STUFF. ALTHOUGH PYTHON IS A GOOD START BECAUSE IT IS SIMPLE
@MouseCodes3 жыл бұрын
I was happy getting the notification of this video. Keep it up, bro.
@thecomputer1424Ай бұрын
This is a great tutorial even without having a solid understanding of python classes, I am still able to comprehend this a bit.
@Xnothen3 жыл бұрын
Just started but I'm already loving the detail description of everything we are doing which is far better than some other tutorial which goes blazingly fast yet neglects to explain what is it that we are doing.
@shareefaridha80823 жыл бұрын
Same!!
@cam_the_speedrunner650027 күн бұрын
A tip for adding the snake tail: append a Vector off screen. This will become the last part of the snake, and will be the part that the move function deletes, keeping the old tail, and making it look like a part was added.
@rxphi53822 жыл бұрын
Hi, this is a great video, I learned a lot! The draw_grass() function at 1:38:45 seemed a little bit overkill to me tbh, so here is how I did it if anyone is interested in it: def draw_grass(self): for i in range(cell_number): for j in range(cell_number): if (i+j)%2==0: grass_rect = pygame.Rect(j*cell_size, i*cell_size, cell_size, cell_size) pygame.draw.rect(screen, grass_color, grass_rect)
@arkamukhopadhyay21772 жыл бұрын
BG_COLORS = [(125, 215, 70), (100, 200, 50)] for x in range(cell_number): for y in range(cell_number): rect = pygame.Rect(x * CELL_SIZE, y * CELL_SIZE, CELL_SIZE, CELL_SIZE) pygame.draw.rect(screen, BG_COLORS[(x + y) % 2], rect) this does the job as well :)
@arkamukhopadhyay21772 жыл бұрын
@@vihasharma804 works for me though
@RandomJeevanYT2 жыл бұрын
1:06:39 "Well takes no time at all to create it" More like 2 days for me cuz im doing this sort of stuff for first time 😥 But i understood everything clearly cuz u explain so well so thanks for that🤗
@RohanKumar-zd3pc3 жыл бұрын
Amazing, It is explained in a very detailed way Of all the logic from the setup to finishing
@samtheserious192 жыл бұрын
Man, your channel is amazing, your tutorials and explanations are clear and we'll explained. You have teacher material and the fact that all this is for free makes me appreciate and respect your work even more. Thanks mate
@dogesh8283 жыл бұрын
It's midnight i am gonna watch it tomorrow. But i know it's will be awesome as always.😆😆😆 Please keep making more quality content. Lots of love❤❤❤
@TheDrumtracks3 жыл бұрын
This is the best tutorial I found so far to this topic. (and the prettiest one. :D) Every line is explained in more detail than all others tutorial I watched. You Sir, did a great Job! I felt like I was able to understand everything!
@tayyabsajid75523 жыл бұрын
How do you not already have a huge fan base, you're epic!
@cup6243 жыл бұрын
i believe this tutorial is the most underrated one of other pyhton tutorials. thanks for your efforts.
@imherovirat3 жыл бұрын
Perfectly Explained, You are genius. Keep making videos on pygame, I'm proud to find your channel.
@burak9802_3 жыл бұрын
Christian you're awesome keep on loading videos. We all have been waiting for new game videos!
@yussefhallak9813 жыл бұрын
I got so happy when I saw the notification. This tutorial is gonna help a lot. Thank you!
@iamailasama3 жыл бұрын
thanks man! you are one of the best teachers out there, and you brought back my interest in python and programming!
@parthgupta48503 жыл бұрын
100th comment says that this is awesome tutorial you teach explain everything as other skip many things and at last we are confused but you are not like them you teach and explain and write everything, best tutorial as well as game of your channel.
@thelogbob281 Жыл бұрын
Incredible incredible video! Very descriptive and thorough with every little detail! You are an amazing youtuber, and I love the effort!
@roiho54053 жыл бұрын
I love your Pygame videos. I'm having so much fun with this module, I hope to see more from you :)
@sarankumar93703 жыл бұрын
Ohh my God!! This is the best tutorial I had ever seen till today... The way you are explaining every tiny bit details is just amazing... Keep doing more video's..
@bobbyreily30183 жыл бұрын
You definitely deserve more subscribers! Keep the videos coming and they will flock in.
@momanirful8 ай бұрын
Fantastic tutorial, explains concepts clearly and then applies knowledge to write code. Love your delivery style, perfect for young children to learn coding.
@klausbrier63073 жыл бұрын
I found a lot of snake-game-tutorials, but I think, this is really the best one .
@Daloshka3 жыл бұрын
I've just started watching your video about Flappy Bird. I want to say thanks for your videos. You make a huge influence on me and other people
@JayeshSarvaiya3 жыл бұрын
I am just blown away by such an effort taken for smooth explanation, planning and gaming skills, you really came up with beautiful channel, All the Best for upcoming videos. Great Stuff !!! Thanks a tonnnnn... for everything. 😃
@Omer-or8pg Жыл бұрын
Your videos are so informative and well-put. I love your channel SO much. I am so grateful for the effort you put into making your videos, and that you explain concepts beyond the code in an easily comprehensible way. Your pacing is great too. I eeply appreciate your content.
@OettingerPirat2 жыл бұрын
I can't imagine how I've could have invested the last 2-ish hours better than following your video and code along. Thank you so much for your fantastic work! :)
@e.e.schonborn9344 Жыл бұрын
This was by far the most helpful python tutorial I have ever watched! Every single detail was explained super precisely and yet so easily at the same time! Thank you so so much!
@shivamkantprasad3 жыл бұрын
Keep making these tutorials they are fun and easy to understand
@jakenik12413 жыл бұрын
Very good work and very good explanation. The only thing I found is that if you press two buttons at the same time like key.up and key.left and the snake goes to the right direction then you cause the game to end, i believe likely because the snake has not had time to go up and gives the command to go right. Again pretty amazing work keep it up!
@Hotterman105 ай бұрын
Wow, best pygame tutorial ive seen so far. Bravo.
@atharvapatil74743 жыл бұрын
Best tutorial of snake game ever found on KZfaq
@mr.curious17142 жыл бұрын
This is the best video on #PygameBasics and #SnakeGamePython . You have explained everything in the perfect pace. I would recommend this tutorial to everyone who wants to learn pygame and also snake game using pygame. Best tutorial!!!! You Earned a sub!!!!
@muradarif73732 жыл бұрын
I have finished the tutorial, Huge thank you for such a video 🤝👌
@YanisCharef-dy5rk Жыл бұрын
That was a simple and a clear tutorial, thank you!
@zCrabOG Жыл бұрын
Thank you for explaining the "why's". The puzzle pieces just fall straight into place
@christophercoronaios47323 жыл бұрын
Wow, you are extremely helpful. I love how you explain each and every single line of code and just how you have put this tutorial together in general. This has been a great experience for me. Keep it up man!
@chikaosita6622 жыл бұрын
This channel is truly amazing ive recently got into pygame and I will definetly be using this channel for all my needs. Thank you so much !!!!!
@HarryTK Жыл бұрын
broken it down makes it seem so user-friendly and easy to use. I can’t wait to start making soft! Thanks again!
@parthgupta48503 жыл бұрын
Congrats! 1 unlike only out of 5000 views great job this proves that you're videos are quality driven.
@sahidabegum73657 ай бұрын
This is the best tutorial about pygame. I enjoyed it and also understand the concepts and logics very easily.
@jananni1234567893 жыл бұрын
Such clean, logical, well organised code!
@muhammadahmadkhan3304 Жыл бұрын
Jazakallah ... Very beautiful explanation ... Thank you so much❤❤❤❤
@nullifier_2 жыл бұрын
Thank you so much! You helped me create my first game ever. I even added things like out-of-bound wrapping check for when the snake goes outside of the grid and tail cut for when the head intercepts the body
@soumenmondal76383 жыл бұрын
THANK YOU SOO MUCH FOR CLEARING EACH AND EVERY PORTION SOO WELL ❤
@danielDev-hg3jo7 ай бұрын
Great video, excellent explanation.
@Brandonator243 жыл бұрын
One of the best tutorials around. Good work mate!!
@sebzanardo3 жыл бұрын
AWESOME VIDEO! Super clear explanations of how pygame works and breaking down the program into manageable sections. subscribed and can't wait to see more pygame and coding videos in the future : D
@HoRRoRlets Жыл бұрын
Great job on this Tutorial. Helped me get my head around vectors quite a bit more.
@builder4813 жыл бұрын
Friends : what did you had for breakfast? Me : I had some eggs in a rectangle plate
@pitermg10 ай бұрын
Very nice, complete and thorough tutorial!
@Thoalfeqargamer3 жыл бұрын
What a legendary channel. Keep up the amazing work man!
@shubharamanath30493 жыл бұрын
thank you for this tutorial, I was struggling to get my snake program to work then I searched the internet to find the solutions but I did not find any , then I saw your vid , I learnt the pygame basics now I have coded many projects in which I had very few errors. thank you again for this very good tutorial. 😀😀😀😀
@astrowow93773 жыл бұрын
You are the best mate, my greetings from Mexico ✌️🇲🇽💕
@aimeedillard96652 жыл бұрын
So glad I found this channel, I immediately subscribed! Can’t wait to try some of this out
@catastrophiccarrots56263 жыл бұрын
I love this tutorial it is so clear and informative! Plus every error i get is always my fault as i did a typo or forgot the () thanks so much i will definitely watch more of your videos and you got another sub!
@clairehua75453 жыл бұрын
Wow! This vid is awesome! I didn't even get stuck once! This is probably one of my better python projects. I currently code: block code, text code, java, javascript, C, C+, C++, html, and python. Would love to see more awesome tutorials on those coding languages. Keep up the AMAZING work!
@majdnassar32573 жыл бұрын
Thanks alot, first time i use pygame lib and i understand your tutorial, because you explained every thing very well and clear :)
@Codingforkids3 жыл бұрын
Thank you for the detailed and precise tutorial! Keep up the great work!
@AbhishekMishraiitkgp Жыл бұрын
Extremely well explained tutorial. Thanks!!!
@rubenbartelet7563 жыл бұрын
You need more subscribers man! This is quality content!
@WanKy18211 ай бұрын
At 1:44:10 you can just check in order to draw grass : for row in range(cell_number): for col in range(cell_number): if (col+row) % 2 == 0:
@Code_in_simple_English2 жыл бұрын
These lessons are just awesome. Thank you for posting them. What would be useful in the comments, if you were interested in adding them, are the key concepts taught: like Vector2, enumerate, slicing.. and so on.
@Lucashallal4 ай бұрын
Nice video! That are two things that could be improved in the code though. First, a fruit can still spawn on top of the snake either in the very beginning, or if the for loop that was made to prevent that spawns the fruit in a previous iteration of the loop. Second, you can go left when the game begins, and immediately die, which is bad. But otherwise everything seems good!
@shariqshaikh2421 Жыл бұрын
I am getting an error about FRUIT class at 39:27. It says that 'Fruit' object has no attribute 'pos' after running it.
@brnsmnr8425 күн бұрын
This still worked with pygame 2.6.0 (SDL 2.28.4, Python 3.12.4). Fantastic video and thank you for these tutorials! I am learning alot but I did however run into a small issue with the scoreboard and grass. The dark green was rendering ontop of the apple and score. I checked the Draw Elements method and noticed that self.draw_score() was above self.draw.grass() in my code. I rearranged them and it fixed the issue. I learned alot from my mistake. I now kinda look at that method as layers.
@liukang812 жыл бұрын
Your explanation is awesome man! You’re the best teacher! 👍
@nathanwhite7043 жыл бұрын
Ive been working on this tutorial for nearly 6 hours and im only half way through it, programming is fun but challenging I spent an hour fixing indentation errors.
@RandomJeevanYT2 жыл бұрын
I wanted to creat snake game in python i saw so many tutorials could do the code and it worked but i wasn't satisfied cuz i understood only partly. But ur vids are amazing the differences u show between surfaces and display surface, explaining each line code. Just prefect 🤗🤗
@kareemyounes73713 жыл бұрын
Just pixel perfect tutorial. I think there is a small bug, not sure if I am the only one having this; however, if you press the down arrow key and right arrow key (while moving to the left) the snake will turn into its self. My solution is I added a variable called moved = False (in class Snake) that I used to make sure the snake moved before talkin in another input. I am not sure if this is the best solution, but it works.
@DarkSideYT Жыл бұрын
hey can u please share detailed step how to solve that bug! soon
@bycorrohmarketingdesigns78522 жыл бұрын
you are AMAZING MAN! Very clear and good class man!! CONGRATS!!!
@anupambayen55542 жыл бұрын
Fantastic Tutorial for beginners. I have learned lot from this tutorial.
@chiragaparadh14173 жыл бұрын
Sooo good of a tutorial...2 things...we can use only one image of head, body and tail by transfroming them(rotating), and i found a bug....if i change direction very fast i go in reverse direction and i loose the game...
@mrmizan19773 жыл бұрын
You’re really a great programmer!
@salouhimohammed10302 жыл бұрын
i think is more efficient to use a while loop to avoid the fruit spawns over the snake, this part i coded it like below while self.fruit.pos in self.snake.body[1:]: self.fruit.randomize() thanks for the great tutorial, a channel like the yours i never seen before
@sabirkhan68983 жыл бұрын
Well explained! I loved the amount of detail given throughout the video
@JohnSmith9523 жыл бұрын
Every your video is pure gold
@ultra_xd3 жыл бұрын
If you're having issues with your game running too slow, try this: import pygame import time window = pygame.display.set_mode((screendimensionshere)) last = time.time_ns() numberOfTicks = 60.0 ns = 1_000_000_000 / numberOfTicks delta = 0 running = True while running: now = time.time_ns() delta += (now - last) / ns last = now while delta >= 1: delta -= 1 for event in pygame.event.get(): if event.type == pygame.QUIT: running = False # event loop goes here # surface updates goes here pygame.display.update() pygame.quit() I hope this helps!
@thojmen8585 Жыл бұрын
Awesome code and tutorial but I noticed 1 little flaw what can effect the game a lot. Right now you only check when you press left if the snake is going right. But if you press up or down and then quickly or at the same time left it breaks that and still goed directly left and causes you to die❤
@anemomenoma5 ай бұрын
you can store the movements in a separete variable. newDirection = None if event.type == pygame.KEYDOWN: if event.key == pygame.K_UP and main.snake.direction != Vector2(0,1): newDirection = Vector2(0,-1) if event.key == pygame.K_DOWN and main.snake.direction != Vector2(0,-1): newDirection = Vector2(0,1) if event.key == pygame.K_LEFT and main.snake.direction != Vector2(1,0): newDirection = Vector2(-1,0) if event.key == pygame.K_RIGHT and main.snake.direction != Vector2(-1,0): newDirection = Vector2(1,0) if newDirection: main.snake.direction = newDirection
@thojmen85855 ай бұрын
@@anemomenoma thanks, I will look into this
@armeidiandanny05222 жыл бұрын
Very Helpful and really easy to understand man.. keep fight and consistenly upload to create implementation PyGame learning with another game 👍
@kalashshah10493 жыл бұрын
Hey clear code you deserved more subscribers. really nice videos.
@solijanov_05 Жыл бұрын
good man👍 thank you for video
@mehakverma70432 жыл бұрын
i dont even need the video, I just enjoyed watching you make it lol
@andrewmaksimovich24322 жыл бұрын
This is an amazing tutorial and I'm really grateful for it. I was wondering about a a small bug I encountered that when I press two arrow keys at the same time, like trying to turn around, the snake crashes. Just curious, is this related to how we handle key events, and is there an easy fix? Another thing I found was that at the beginning the reason why the snake doesn't move is because the game is constantly resetting, as the snake collides with itself for some reason. I found this out when I added a sound to the player losing. Nonetheless, this tutorial has been a great help and, being the beginning programmer I am, figuring out how the game works and bugs I encountered has taught me a lot.
@thojmen85854 ай бұрын
I've been on this same problem aswell and I have tried many ways to fix it, haven't found the solution yet but I will tell if you if I ever find it
@hoatran-dg3ir2 жыл бұрын
Wow this tutorial is really good! Thanks man!
@PixelGaming_20202 жыл бұрын
Really good tutorial. You explained everything in amazing detail. With a few other tutorials, they move too quickly, which causes me to have errors in my code that I don't know how to correct. This one is nicely paced, and I end up with a fully working and functional snake game.
@imSHEN2 жыл бұрын
how do you fixed 'MAIN' object has no attribute 'snake'
@zgreatest693 жыл бұрын
You explained it so well I'm so glad
@Schachlover3 жыл бұрын
Awesome as always. Plz. keep up the good work!!
@yisus.avocado3 жыл бұрын
This so awesome, really interesting video, keep up doing well!
@usmanamjad140910 ай бұрын
Nice tutorial every beginner will understand this. Btw is there anyway to make snake movement smooth?? pls let me know
@PennyThePerson Жыл бұрын
There is a better way to right the checker board draw_grass. If you add the row to the col 3 things can happen: 1. odd + odd 2. odd+even 3. even+even. Only instances 1 and 3 is the outcome even. If you create an if statement that take the sum of the col and row and mod 2 then you can create the def without writing the same for loop for col (or row) twice. Example shown below. def drawGrass(self): grassColor = (167, 209, 61) for row in range(cellNumber): for col in range(cellNumber): if (col + row) % 2 == 1: grassRect = pygame.Rect(col * cellSize, row * cellSize, cellSize, cellSize) pygame.draw.rect(screen, grassColor, grassRect)
@banji81713 жыл бұрын
Wow, we need more tutorial like this, keep it up🥺❤️❤️
@Extorc3 жыл бұрын
Hey bro i understand you are doing a very noble job for people who are beginers , but i would like to suggest you , upload more often
@ClearCode3 жыл бұрын
Will start uploading stuff more regularly soon!
@aditgaur15853 жыл бұрын
You defeated the entire purpose of the game in the thumbnail 😂 BTW nice tutorial 👍
@bulicanumarian37755 ай бұрын
I added a new block to the snake just with one line of code def check_collision(self): if self.fruit.pos == self.snake.body[0]: self.fruit.randomize() #Randomize the pos of fruit self.snake.body.insert(-1, self.snake.body[-1]) #Add a new block to snake