Snake in PyGame

Snake in PyGame

Postby ItsAres » Mon Jul 11, 2016 6:07 am

Hey guys, recently i've been getting into python, and decided i wanted to code a game. So, i downloaded PyGame, and decided to make a simple game... Snake. Now, i want to be clear, most of the code has been copied from a tutorial on youtube. I wanted to use this project as a way to get myself familiarized with PyGame. Not everything has been copied though, there are a few things i have made my own, however, the main game functions are not my own, and i do not claim them to be.

You can download the game Here.
And you can view the source code Here.
And incase anyone wants to know what tutorial i used, you can find it Here.

PS - Sorry if this is the wrong place to post this. This is actually my first time on this forum.
Last edited by micseydel on Mon Jul 11, 2016 6:09 am, edited 1 time in total.
Reason: Initial post lock.
Posts: 1
Joined: Mon Jul 11, 2016 5:56 am

Re: Snake in PyGame

Postby metulburr » Mon Jul 11, 2016 12:08 pm

Be warned....

You are using Sentdex tutorials, not "bucky" The New Boston. The true New Boston is located here However, he did not give tutorials on pygame, only python, that i am aware of. Regardless of who his true identity is, its giving bad tutorials.

In addition sentdex tutorials are well known around the community as giving bad coding structures. And your game wreaks of this. The biggest issue is the fact that you/sentdex have a separate while loop for each scene (game over, paused, instruction, game intro, game loop, etc.). Each one has its own event loop. Its really a bad coding structure in gaming. The alternative and better approach is using classes. This however requires that you have knowledge of classes and inheritance, and how to use them.

mekire wrote:I have pretty strong feelings on this topic so take what I say with that in mind... Searching for pygame tutorials is extremely hard. This is exactly because there are sooo many targeting beginners (and all too often made by beginners). This means as a beginner who doesn't know what to look for, you are much more likely to land on a terrible tutorial than a good one.
I find the Sentdex videos full of bad habits. The 'Invent with Python' books full of globals and unpythonic coding standards (despite their popularity). /u/PVC 's is probably the best out there, and I will recommend it to others, but even it has issues (though at least the creator is receptive).
My personal opinion is that the teaching of Pygame can not be separated from the teaching of classes and object orientation. If students aren't ready for those, they aren't ready for graphics. Pretending otherwise does them a disservice and they will have to relearn everything when their games pass a certain level of complexity.
The last thing we need is another tutorial among the many that teaches students to concoct global spaghetti.

This is a quote from the discussion of tutorials on pygame in reddit here

tutorials using OOP/better

Kids can code (ignore "kids" its for everyone) ... rw&index=1

programming arcade games tutorials

Mekires respos (these are more of examples, than tutorials)

proper multiscene management example ... with-movie

I also once made a conversion of sentdex's tutorial.
sentdex old is his original tutorial output. It is very much like yours, but much shorter. sentdex converted is my translation of his exact code to use classes. Removals were commented out, as well as some comments on why, what is better, etc. ... bad_habits
we will be moving to on October 1 2016
more details here
User avatar
Posts: 2244
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Return to Game Development

Who is online

Users browsing this forum: No registered users and 2 guests