Hi all,
I was speaking with the group from Games for Science about how to get
bootstrapped in the world of Python game programming and thought that this
might be information that others might want to get their hands on.
First, a few important facts:
- Whereas other languages are broken down using brackets, Python is based
on indentation/white space.
- Python does not require you to declare data type for variables (the old
'*int a = 3*' is just '*a=3*')
- Python is not named after the snake, but Monty Python's Flying Circus;
any Monty Python related comments are not only allowed, they are encouraged
(seriously, that's out of the official documentation, *read the paragraph
4th from the bottom <
http://docs.python.org/tutorial/appetite.html> *)
A good place to get started is the official Python documentation ( *Python
2.7 Library* <
http://docs.python.org/library/> ) and do a little reading,
especially in section 2 since it covers all of Python's built-in functions.
Remember: if it's not a part of Python, it can be imported. (which brings
us to our next link...)
Python doesn't have the best support for graphics in the world, so we import
a library called 'PyGame <
http://www.pygame.org/news.html>';. PyGame has a
pretty good site, and when I learned Python I actually skipped the official
tutorials and went straight to the PyGame
tutorials<http://www.pygame.org/wiki/tutorials>
.
Finally, PEP-8 is a standard for indentation, capitalization, commenting
format, etc. Attached is a PEP-8 complacency cheat sheet (because we all
know from high school history class that cheat sheets are a force of *good*).
Using PEP-8 will make you the object of adoration of your coworkers and
online peers. I promise.
And, on a final note, if you're ever lost *read the documentation*. This
isn't my being sadistic and tricking you into killing hours of your time,
reading official documentation will make you more dangerous in any language
you ever choose to pick up.
*
*
*And speaking of cheat sheets, here's a cheat sheet for this email...*
Documentation:
docs.Python.org/library <
http://docs.python.org/library/index.html> -
www.pygame.org/docs/ref/index <
http://www.pygame.org/docs/ref/index.html> -
Pygame library notes
My common resources:
Stack Overflow <
http://stackoverflow.com/> - An excellent resource any
programmer should know.
Google <
http://www.google.com> - Throw 'Python' or 'Pygame' in the
name and
google like mad.
IRC - On the Freenode servers <
http://freenode.net/irc_servers.shtml> you
can find help from #Python and #Pygame channels
If you have any questions, feel free to shoot me an email to let me know!
JT Mengel || JTMengel(a)gmail.com