Labyrinth - 1.1
Hey everyone! This is my first pygame/python project and I had a lot of fun making this game!
Pygame.org account Comments
Mekire 2013-12-09 09:21:28
Went to try this out and discovered I couldn't download it without jumping through hoops or installing crap I don't want from the 4shared site. Please put this up on github or somewhere less demanding. If a download wants me to install a downloader or log in on facebook, the program isn't getting downloaded.
Dalton McMullen 2013-12-09 16:27:10
I changed it to mediafire, let me know if you can download it.
Mekire 2013-12-10 10:47:39
Much better thanks. As for the game, I found it very fun, but didn't find that the difficulty changed much from beginning to end. It starts easy and ends pretty easy. As for the code, it is pretty clean, but I noticed several things in a glance through I would change. Hardcoding the maps seems a bit silly and makes it hard to expand the game. Writing a basic map-editor would be a bit of work, but if you kept it simple, pretty easy; it would also be an additional feature. I also noticed a lot of ifs that should have been elifs, and frankly a lot of unwieldy if/elif/else blocks in general. For graphics and other resources you can often load them with a loop and place them in a dictionary rather than load each individually.
One thing you seem to do that is generally avoided in python is writing setters/getters for all your attributes. This is done in many languages, but in python it really is pretty silly. By all means keep your classes as encapsulated as possible, but don't write setter/getters.
Lastly I wanted to say something about main loops and event loops. You shouldn't call pygame.display.flip() all over the place. It should be called one time every frame once each time through your main loop. You also shouldn't have multiple event loops. The event loop (singular) should pass events as needed to an event manager in the active scene/state. Also, avoid time.sleep. Pygame already has its own version of this (which should also be avoided). Instead create a clock and use pygame.time.Clock.tick(fps) to control overall framerate, and pygame.time.get_ticks() to control the timing of individual events. Methods which use sleep for animation don't extend well to scenarios with multiple actors, all animating at different speeds.
Good work and fun game. I look forward to seeing more,
Dalton McMullen 2013-12-17 16:01:59
Thank you for the comments. Yes, I agree with you on the pygame.display.flip(), it should definitely not be called the way I currently have it setup.
As you mentioned and probably noticed, I code mostly in Java, so that's where the abundance of setters/getters are coming from. I will look into the proper way to access object variables inside of Python.
Thanks again for the tips and comments, I appreciate it and sorry I got back to you so late.