VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » freeCodeCamp.org
Code a Snake Game with Python and Pygame - - Tutorial

Code a Snake Game with Python and Pygame - - Tutorial

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
In this Python / Pygame tutorial you will build a snake and apple game. This Python project for beginners is perfect for you to get exposure on how you can build an end-to-end Python project after learning the basics of Python
Date: 2022-03-14

Comments and reviews: 10


Rafy-Ivan Morales-
0 seconds ago-
I'm a new student trying to learn, so I can become a programmer with python and I have a project on how to make a port scan.-
So far I already make a port scan with Python3, and it scans fine, give a date and everything working good so far. -
I see on your video tutorial, it is very good.-
I would like to ask for your advice if you can and guide me on how I will add this 3 -
in a Python script, I have:-
2. System should look for all the ports between the range of 1 to 1025 -
3. If the Ports is open, it should create a file and add an entry for port number -
4. In case of any exception for instance -host is not available-, -host name could not be resolved- or -
due to any other error, you need to write that exception into the same file.-
Thank you and Merry Christmas.

reply

hey
After i finished the program i tested it several times and it worked with no issues, but now the game logic doesnt function properly, no changes to the code or files used inside it were made, yet still it doesnt work
I even tried copying the code of the author of this tutorial from github and it had the same game logic issue,
It would be of great help if you could help me solve this issue.

reply

To complete this excelent tutorial, I want to leave my contribution for make limits in our display, if snake touch this limits then game will be over
In class Game, make a new def named -limit- ---- def limit(self, x1, x2, y1, y2):
then define a condition : if x1 >= x2 or x1 < 0 or y1 >= y2 or y1

reply

Nice tutorial, thank you very much:) I have a problem with the step where I add sounds. I did everything exactly as in the tutorial, but my game just exits whenever the snake eats the apple. If I delete the lines with pygame.mixer everything works normally. Anybody knows what might cause the issue?
reply

Hi, thanks for your valuable video. but how can i copy the score. my following score is not work although i have follow every steps of you:
score = font.render(f--Score: self.snake.length--, True, (255, 255, 255))
kindly inform me.
thanks a lot

reply

very confused, I had an issue where eating the apple was giving me a game over... so I went and took his exact code and it is still giving me game over after consuming the apple. very odd and incredibly confusing
reply

In the starting when you were just creating a window in my desktop it did not do anything even I did it on PyCharm Community Edition
Is it because of different Python or PyGame version?

reply

Does anyone know how to make the score counter go up by more than one when the snake eats the apple? My snake just instantly dies once I change the values in increase_length (Class snake).
reply

Why didn't you just wrote this instead?
def is_collision(self,x1,y1,x2,y2):-
if x1==x2 and y1==y2:-
return True-
return False

reply

i have an error, when my snake collects the apple, i get an index error saying -list index out of range-.
can you help me troubleshoot?

reply
Add a review, comment






Other channel videos