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.
ItsAres
 
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
https://thenewboston.com/videos.php?cat=98 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 http://programarcadegames.com/ 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)
https://www.youtube.com/watch?v=VO8rTsz ... rw&index=1

programming arcade games
http://programarcadegames.com/

pygame-gaming.com tutorials
http://python-gaming.com/pygame/docs/tuts/index.html

Mekires respos (these are more of examples, than tutorials)
https://github.com/Mekire/pygame-samples

proper multiscene management example
https://github.com/Mekire/pygame-mutisc ... 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.
https://github.com/metulburr/pygame_cod ... bad_habits
we will be moving to python-forum.io on October 1 2016
more details here
User avatar
metulburr
 
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 1 guest

cron